From: stekkel Date: Sat, 28 Jan 2006 16:06:12 +0000 (+0000) Subject: Merge of template patch from Steve Brown X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=5fe8257d38437196c050b12601ea2a6d7fdbf4fe;p=squirrelmail.git Merge of template patch from Steve Brown Adapted static dirs to configurable template dir (template set support) git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@10583 7612ce4b-ef26-0410-bec9-ea0150e637f0 --- diff --git a/functions/global.php b/functions/global.php index 6613c046..aeee4ff8 100644 --- a/functions/global.php +++ b/functions/global.php @@ -371,7 +371,7 @@ if ((bool) @ini_get('register_globals')) { /** * Remove globalized $_FILES variables * Before 4.3.0 $_FILES are included in $_REQUEST. - * Unglobalize them in separate call in order to remove dependency + * Unglobalize them in separate call in order to remove dependency * on PHP version. */ foreach ($_FILES as $key => $value) { @@ -404,7 +404,7 @@ $PHP_SELF = php_self(); sqsession_is_active(); -/** +/** * Remove globalized session data in rg=on setups */ if ((bool) @ini_get('register_globals')) { @@ -412,4 +412,5 @@ if ((bool) @ini_get('register_globals')) { unset($GLOBALS[$key]); } } + ?> diff --git a/functions/page_header.php b/functions/page_header.php index 6dc17d5c..ab3ece74 100644 --- a/functions/page_header.php +++ b/functions/page_header.php @@ -19,6 +19,7 @@ require_once(SM_PATH . 'functions/strings.php'); require_once(SM_PATH . 'functions/html.php'); require_once(SM_PATH . 'functions/imap_mailbox.php'); require_once(SM_PATH . 'functions/global.php'); +include_once(SM_PATH . 'class/template/template.class.php'); /** * Output a SquirrelMail page header, from to @@ -33,12 +34,12 @@ require_once(SM_PATH . 'functions/global.php'); * @return void */ function displayHtmlHeader( $title = 'SquirrelMail', $xtra = '', $do_hook = true, $frames = false ) { - global $squirrelmail_language; + global $squirrelmail_language, $sTplDir; if ( !sqgetGlobalVar('base_uri', $base_uri, SQ_SESSION) ) { global $base_uri; } - global $theme_css, $custom_css, $pageheader_sent, + global $theme_css, $custom_css, $pageheader_sent, $chosen_fontset, $chosen_fontsize, $chosen_theme; /* add no cache headers here */ @@ -53,13 +54,13 @@ function displayHtmlHeader( $title = 'SquirrelMail', $xtra = '', $do_hook = true echo "\n" . html_tag( 'html' ,'' , '', '', 'lang="'.$squirrelmail_language.'"' ) . "\n\n"; - + $used_theme = basename($chosen_theme,'.php'); /* - * Add closing / to link and meta elements only after switching to xhtml 1.0 Transitional. - * It is not compatible with html 4.01 Transitional - */ + * Add closing / to link and meta elements only after switching to xhtml 1.0 Transitional. + * It is not compatible with html 4.01 Transitional + */ echo '\n"; echo '' . "\n"; } @@ -91,12 +92,12 @@ function displayHtmlHeader( $title = 'SquirrelMail', $xtra = '', $do_hook = true echo << @@ -157,22 +158,26 @@ function displayInternalLink($path, $text, $target='') { function displayPageHeader($color, $mailbox, $sHeaderJs='', $sBodyTagJs = '') { global $reply_focus, $hide_sm_attributions, $frame_top, - $provider_name, $provider_uri, $startMessage, - $javascript_on, $action; + $provider_name, $provider_uri, $startMessage, + $javascript_on, $action, $oTemplate; if (empty($sBodyTagJs)) { if (strpos($action, 'reply') !== FALSE && $reply_focus) { - if ($reply_focus == 'select') - $sBodyTagJs = 'onload="checkForm(\'select\');"'; - else if ($reply_focus == 'focus') - $sBodyTagJs = 'onload="checkForm(\'focus\');"'; - else if ($reply_focus != 'none') - $sBodyTagJs = 'onload="checkForm();"'; + if ($reply_focus == 'select') + $sBodyTagJs = 'onload="checkForm(\'select\');"'; + else if ($reply_focus == 'focus') + $sBodyTagJs = 'onload="checkForm(\'focus\');"'; + else if ($reply_focus != 'none') + $sBodyTagJs = 'onload="checkForm();"'; } else - $sBodyTagJs = 'onload="checkForm();"'; + $sBodyTagJs = 'onload="checkForm();"'; } + $urlMailbox = urlencode($mailbox); + $startMessage = (int)$startMessage; + + $sTplDir = $oTemplate->template_dir; sqgetGlobalVar('delimiter', $delimiter, SQ_SESSION ); @@ -181,78 +186,45 @@ function displayPageHeader($color, $mailbox, $sHeaderJs='', $sBodyTagJs = '') { } if( $javascript_on || strpos($sHeaderJs, 'new_js_autodetect_results.value') ) { - $sJsBlock = '' ."\n"; + $sJsBlock = '' ."\n"; if ($sHeaderJs) { $sJsBlock .= "\n\n"; } displayHtmlHeader ('SquirrelMail', $sJsBlock); - } else { + } else { /* do not use JavaScript */ displayHtmlHeader ('SquirrelMail'); $sBodyTagJs = ''; } - echo "\n\n"; - - /** Here is the header and wrapping table **/ $shortBoxName = htmlspecialchars(imap_utf7_decode_local( readShortMailboxName($mailbox, $delimiter))); if ( $shortBoxName == 'INBOX' ) { $shortBoxName = _("INBOX"); } - echo "\n" - . html_tag( 'table', '', '', $color[4], 'border="0" width="100%" cellspacing="0" cellpadding="2"' ) ."\n" - . html_tag( 'tr', '', '', $color[9] ) ."\n" - . html_tag( 'td', '', 'left' ) ."\n"; - if ( $shortBoxName <> '' && strtolower( $shortBoxName ) <> 'none' ) { - echo ' ' . _("Current Folder") . ": $shortBoxName \n"; - } else { - echo ' '; - } - echo " \n" - . html_tag( 'td', '', 'right' ) ."\n"; - displayInternalLink ('src/signout.php', _("Sign Out"), $frame_top); - echo "\n" - . " \n" - . html_tag( 'tr', '', '', $color[4] ) ."\n" - . ($hide_sm_attributions ? html_tag( 'td', '', 'left', '', 'colspan="2"' ) - : html_tag( 'td', '', 'left' ) ) - . "\n"; - $urlMailbox = urlencode($mailbox); - $startMessage = (int)$startMessage; - echo makeComposeLink('src/compose.php?mailbox='.$urlMailbox.'&startMessage='.$startMessage); - echo "  \n"; - displayInternalLink ('src/addressbook.php', _("Addresses")); - echo "  \n"; - displayInternalLink ('src/folders.php', _("Folders")); - echo "  \n"; - displayInternalLink ('src/options.php', _("Options")); - echo "  \n"; - displayInternalLink ("src/search.php?mailbox=$urlMailbox", _("Search")); - echo "  \n"; - displayInternalLink ('src/help.php', _("Help")); - echo "  \n"; - - do_hook('menuline'); - - echo " \n"; - - if (!$hide_sm_attributions) - { - echo html_tag( 'td', '', 'right' ) ."\n"; + $sm_attributes = ''; + if (!$hide_sm_attributions) { + $sm_attributes .= '' ."\n"; if (empty($provider_uri)) { - echo 'SquirrelMail'; + $sm_attributes .= ' SquirrelMail'; } else { if (empty($provider_name)) $provider_name= 'SquirrelMail'; - echo ''.$provider_name.''; + $sm_attributes .= ' '.$provider_name.''."\n"; } - echo "\n"; + $sm_attributes .= " \n"; } - echo " \n". - "
\n\n"; + + $oTemplate->assign('body_tag_js', $sBodyTagJs); + $oTemplate->assign('shortBoxName', $shortBoxName); + $oTemplate->assign('sm_attribute_str', $sm_attributes); + $oTemplate->assign('frame_top', $frame_top); + $oTemplate->assign('urlMailbox', $urlMailbox); + $oTemplate->assign('startMessage', $startMessage); + $oTemplate->assign('hide_sm_attributions', $hide_sm_attributions); + $oTemplate->display('page_header.tpl'); } /** @@ -271,15 +243,15 @@ function compose_Header($color, $mailbox, $sHeaderJs='', $sBodyTagJs = '') { if (empty($sBodyTagJs)) { if (strpos($action, 'reply') !== FALSE && $reply_focus) { - if ($reply_focus == 'select') - $sBodyTagJs = 'onload="checkForm(\'select\');"'; - else if ($reply_focus == 'focus') - $sBodyTagJs = 'onload="checkForm(\'focus\');"'; - else if ($reply_focus != 'none') - $sBodyTagJs = 'onload="checkForm();"'; + if ($reply_focus == 'select') + $sBodyTagJs = 'onload="checkForm(\'select\');"'; + else if ($reply_focus == 'focus') + $sBodyTagJs = 'onload="checkForm(\'focus\');"'; + else if ($reply_focus != 'none') + $sBodyTagJs = 'onload="checkForm();"'; } else - $sBodyTagJs = 'onload="checkForm();"'; + $sBodyTagJs = 'onload="checkForm();"'; } @@ -292,7 +264,7 @@ function compose_Header($color, $mailbox, $sHeaderJs='', $sBodyTagJs = '') { "\n\n\n"; } else { - $sJsBlock = ''; + $sJsBlock = ''; } $sJsBlock .= "\n" . '' ."\n"; displayHtmlHeader (_("Compose"), $sJsBlock);