From 407b01379c518b490e08438b9af8daac5bd710aa Mon Sep 17 00:00:00 2001 From: Victor Boctor Date: Sat, 25 Feb 2012 17:30:50 -0800 Subject: [PATCH] Added lost_pwd_page to the list of pages where the logo is centered 1. Add lost password page to the list of pages where the logo is centered. 2. Move this logic to a method that can be called from elsewhere. For example, it is useful to call this logic from custom headers. --- core/html_api.php | 6 +----- core/utility_api.php | 9 +++++++++ 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/core/html_api.php b/core/html_api.php index dad50526d9..4c4e8b6188 100644 --- a/core/html_api.php +++ b/core/html_api.php @@ -463,11 +463,7 @@ function html_top_banner() { if( !is_blank( $t_page ) && file_exists( $t_page ) && !is_dir( $t_page ) ) { include( $t_page ); } else if( $t_show_logo ) { - if ( is_page_name( 'login_page' ) || is_page_name( 'signup_page' ) || is_page_name( 'signup' ) ) { - $t_align = 'center'; - } else { - $t_align = 'left'; - } + $t_align = should_center_logo() ? 'center' : 'left'; echo '
'; if( $t_show_url ) { diff --git a/core/utility_api.php b/core/utility_api.php index c5a71a3142..dca6c457cc 100644 --- a/core/utility_api.php +++ b/core/utility_api.php @@ -198,6 +198,15 @@ function is_page_name( $p_string ) { return isset( $_SERVER['SCRIPT_NAME'] ) && ( 0 < strpos( $_SERVER['SCRIPT_NAME'], $p_string ) ); } +/** + * A function that determines whether the logo should be centered or left aligned based on the page. + * @return bool true: centered, false: otherwise. + * @access public + */ +function should_center_logo() { + return ( is_page_name( 'login_page' ) || is_page_name( 'signup_page' ) || is_page_name( 'signup' ) || is_page_name( 'lost_pwd_page' ) ); +} + function is_windows_server() { if( defined( 'PHP_WINDOWS_VERSION_MAJOR' ) ) { return (PHP_WINDOWS_VERSION_MAJOR > 0);