From f01e0a2eef0604367620e8b9aa323f3feb86ea3c Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Sat, 3 May 2014 16:57:04 +0200 Subject: [ticket/10073] Deduplicate the if statement PHPBB3-10073 --- phpBB/includes/functions.php | 50 +++++++++++++++++++++++++++++++++++--------- 1 file changed, 40 insertions(+), 10 deletions(-) (limited to 'phpBB/includes/functions.php') 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']) ? '' : '', ($config['email_enable']) ? '' : '', - '', + '', '' ); 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']); + } +} -- cgit v1.2.1