diff options
-rw-r--r-- | phpBB/includes/acp/acp_email.php | 11 | ||||
-rw-r--r-- | phpBB/includes/captcha/plugins/captcha_abstract.php | 9 | ||||
-rw-r--r-- | phpBB/includes/captcha/plugins/phpbb_recaptcha_plugin.php | 9 | ||||
-rw-r--r-- | phpBB/includes/functions.php | 50 | ||||
-rw-r--r-- | phpBB/memberlist.php | 11 | ||||
-rw-r--r-- | phpBB/phpbb/message/form.php | 11 | ||||
-rw-r--r-- | phpBB/phpbb/session.php | 9 |
7 files changed, 46 insertions, 64 deletions
diff --git a/phpBB/includes/acp/acp_email.php b/phpBB/includes/acp/acp_email.php index 4402b6bcf0..fe55b36e67 100644 --- a/phpBB/includes/acp/acp_email.php +++ b/phpBB/includes/acp/acp_email.php @@ -200,17 +200,8 @@ class acp_email $messenger->subject(htmlspecialchars_decode($subject)); $messenger->set_mail_priority($priority); - if ($config['contact_admin_form_enable']) - { - $contact_link = generate_board_url() . '/memberlist.' . $phpEx . '?mode=contactadmin'; - } - else - { - $contact_link = $config['board_contact']; - } - $messenger->assign_vars(array( - 'CONTACT_EMAIL' => $contact_link, + 'CONTACT_EMAIL' => phpbb_get_board_contact($config, $phpEx), 'MESSAGE' => htmlspecialchars_decode($message)) ); diff --git a/phpBB/includes/captcha/plugins/captcha_abstract.php b/phpBB/includes/captcha/plugins/captcha_abstract.php index c75a4ffb83..8e1e61bdb7 100644 --- a/phpBB/includes/captcha/plugins/captcha_abstract.php +++ b/phpBB/includes/captcha/plugins/captcha_abstract.php @@ -96,14 +96,7 @@ class phpbb_captcha_plugins_captcha_abstract else { $link = append_sid($phpbb_root_path . 'ucp.' . $phpEx, 'mode=confirm&confirm_id=' . $this->confirm_id . '&type=' . $this->type); - if ($config['contact_admin_form_enable']) - { - $contact_link = append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=contactadmin'); - } - else - { - $contact_link = 'mailto:' . htmlspecialchars($config['board_contact']); - } + $contact_link = phpbb_get_board_contact_link($config, $phpbb_root_path, $phpEx); $explain = $user->lang(($this->type != CONFIRM_POST) ? 'CONFIRM_EXPLAIN' : 'POST_CONFIRM_EXPLAIN', '<a href="' . $contact_link . '">', '</a>'); $template->assign_vars(array( diff --git a/phpBB/includes/captcha/plugins/phpbb_recaptcha_plugin.php b/phpBB/includes/captcha/plugins/phpbb_recaptcha_plugin.php index 69864a75ab..12cc49ef9b 100644 --- a/phpBB/includes/captcha/plugins/phpbb_recaptcha_plugin.php +++ b/phpBB/includes/captcha/plugins/phpbb_recaptcha_plugin.php @@ -158,14 +158,7 @@ class phpbb_recaptcha extends phpbb_default_captcha } else { - if ($config['contact_admin_form_enable']) - { - $contact_link = append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=contactadmin'); - } - else - { - $contact_link = 'mailto:' . htmlspecialchars($config['board_contact']); - } + $contact_link = phpbb_get_board_contact_link($config, $phpbb_root_path, $phpEx); $explain = $user->lang(($this->type != CONFIRM_POST) ? 'CONFIRM_EXPLAIN' : 'POST_CONFIRM_EXPLAIN', '<a href="' . $contact_link . '">', '</a>'); $template->assign_vars(array( diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index 026dd949fb..be032440b9 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -2814,20 +2814,11 @@ function login_box($redirect = '', $l_explain = '', $l_success = '', $admin = fa break; case LOGIN_ERROR_PASSWORD_CONVERT: - if ($config['contact_admin_form_enable']) - { - $contact_link = append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=sendpassword'); - } - else - { - $contact_link = 'mailto:' . htmlspecialchars($config['board_contact']); - } - $err = sprintf( $user->lang[$result['error_msg']], ($config['email_enable']) ? '<a href="' . append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=sendpassword') . '">' : '', ($config['email_enable']) ? '</a>' : '', - '<a href="' . $contact_link . '">', + '<a href="' . phpbb_get_board_contact_link($config, $phpbb_root_path, $phpEx) . '">', '</a>' ); break; @@ -5308,3 +5299,42 @@ function phpbb_convert_30_dbms_to_31($dbms) throw new \RuntimeException("You have specified an invalid dbms driver: $dbms"); } + +/** +* Get the board contact details (e.g. for emails) +* +* @param \phpbb\config\config $config +* @param string $phpEx +* @return string +*/ +function phpbb_get_board_contact(\phpbb\config\config $config, $phpEx) +{ + if ($config['contact_admin_form_enable']) + { + return generate_board_url() . '/memberlist.' . $phpEx . '?mode=contactadmin'; + } + else + { + return $config['board_contact']; + } +} + +/** +* Get a clickable board contact details link +* +* @param \phpbb\config\config $config +* @param string $phpbb_root_path +* @param string $phpEx +* @return string +*/ +function phpbb_get_board_contact_link(\phpbb\config\config $config, $phpbb_root_path, $phpEx) +{ + if ($config['contact_admin_form_enable']) + { + return append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=contactadmin'); + } + else + { + return 'mailto:' . htmlspecialchars($config['board_contact']); + } +} diff --git a/phpBB/memberlist.php b/phpBB/memberlist.php index a688f810a0..b3025dacce 100644 --- a/phpBB/memberlist.php +++ b/phpBB/memberlist.php @@ -392,17 +392,8 @@ switch ($mode) $messenger->replyto($user->data['user_email']); $messenger->set_addresses($row); - if ($config['contact_admin_form_enable']) - { - $contact_link = generate_board_url() . '/memberlist.' . $phpEx . '?mode=contactadmin'; - } - else - { - $contact_link = $config['board_contact']; - } - $messenger->assign_vars(array( - 'BOARD_CONTACT' => $contact_link, + 'BOARD_CONTACT' => phpbb_get_board_contact($config, $phpEx), 'FROM_USERNAME' => htmlspecialchars_decode($user->data['username']), 'TO_USERNAME' => htmlspecialchars_decode($row['username']), 'MESSAGE' => htmlspecialchars_decode($message)) diff --git a/phpBB/phpbb/message/form.php b/phpBB/phpbb/message/form.php index b57bf7423a..d7a42c4080 100644 --- a/phpBB/phpbb/message/form.php +++ b/phpBB/phpbb/message/form.php @@ -149,16 +149,7 @@ abstract class form $this->message->cc_sender(); } - - if ($this->config['contact_admin_form_enable']) - { - $board_contact = generate_board_url() . '/memberlist.' . $this->phpEx . '?mode=contactadmin'; - } - else - { - $board_contact = $this->config['board_contact']; - } - $this->message->send($messenger, $board_contact); + $this->message->send($messenger, phpbb_get_board_contact($this->config, $this->phpEx)); meta_refresh(3, append_sid($this->phpbb_root_path . 'index.' . $this->phpEx)); trigger_error($this->user->lang['EMAIL_SENT'] . '<br /><br />' . $this->get_return_message()); diff --git a/phpBB/phpbb/session.php b/phpBB/phpbb/session.php index 093c013e42..c2669ea6cc 100644 --- a/phpBB/phpbb/session.php +++ b/phpBB/phpbb/session.php @@ -1233,14 +1233,7 @@ class session $till_date = ($ban_row['ban_end']) ? $this->format_date($ban_row['ban_end']) : ''; $message = ($ban_row['ban_end']) ? 'BOARD_BAN_TIME' : 'BOARD_BAN_PERM'; - if ($config['contact_admin_form_enable']) - { - $contact_link = append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=contactadmin'); - } - else - { - $contact_link = 'mailto:' . htmlspecialchars($config['board_contact']); - } + $contact_link = phpbb_get_board_contact_link($config, $phpbb_root_path, $phpEx); $message = sprintf($this->lang[$message], $till_date, '<a href="' . $contact_link . '">', '</a>'); $message .= ($ban_row['ban_give_reason']) ? '<br /><br />' . sprintf($this->lang['BOARD_BAN_REASON'], $ban_row['ban_give_reason']) : ''; $message .= '<br /><br /><em>' . $this->lang['BAN_TRIGGERED_BY_' . strtoupper($ban_triggered_by)] . '</em>'; |