From 5c4ff7bfc6e04337bd6bcf76743b1fbb92556233 Mon Sep 17 00:00:00 2001 From: stekkel Date: Sat, 28 Jan 2006 15:58:30 +0000 Subject: [PATCH] * added footer template which also takes care of displaying the error messages from the error_handler. * moved template object creation to a higher level, validate.php * merge patch from Steve Brown into style.php * modifications in order to create template set selection support git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@10579 7612ce4b-ef26-0410-bec9-ea0150e637f0 --- src/about.php | 6 ++++-- src/addrbook_popup.php | 2 +- src/addrbook_search.php | 7 +++---- src/addrbook_search_html.php | 8 ++++---- src/addressbook.php | 17 ++++++++--------- src/compose.php | 20 +++++++++---------- src/delete_message.php | 7 +++---- src/folders.php | 18 +++++++++-------- src/help.php | 7 +++++-- src/image.php | 6 ++++-- src/left_main.php | 9 ++++++--- src/options_highlight.php | 7 +++++-- src/options_order.php | 4 ++-- src/printer_friendly_bottom.php | 14 +++++++------- src/printer_friendly_top.php | 6 +++--- src/read_body.php | 9 ++++----- src/right_main.php | 34 +++------------------------------ src/search.php | 4 ++-- src/signout.php | 7 +++---- src/style.php | 28 ++++++++++++++++++++++----- src/vcard.php | 6 ++++-- src/view_header.php | 4 ++-- src/view_html.php | 2 +- src/view_text.php | 6 ++++-- 24 files changed, 121 insertions(+), 117 deletions(-) diff --git a/src/about.php b/src/about.php index 76f85ffa..90873ae0 100644 --- a/src/about.php +++ b/src/about.php @@ -23,7 +23,7 @@ define('SM_PATH','../'); /* SquirrelMail required files. */ -require_once(SM_PATH . 'include/validate.php'); +include_once(SM_PATH . 'include/validate.php'); displayPageHeader($color, 'None' ); @@ -89,4 +89,6 @@ if ( count ($plugins) > 0 ) { © 1999 - 2006 The SquirrelMail Project Team

- \ No newline at end of file +display('footer.tpl'); +?> \ No newline at end of file diff --git a/src/addrbook_popup.php b/src/addrbook_popup.php index e43bf2ae..5d6a288a 100644 --- a/src/addrbook_popup.php +++ b/src/addrbook_popup.php @@ -19,7 +19,7 @@ define('SM_PATH','../'); /** SquirrelMail required files. */ -require_once(SM_PATH . 'include/validate.php'); +include_once(SM_PATH . 'include/validate.php'); require_once(SM_PATH . 'functions/addressbook.php'); ?> diff --git a/src/addrbook_search.php b/src/addrbook_search.php index cd6366bc..b26dfc53 100644 --- a/src/addrbook_search.php +++ b/src/addrbook_search.php @@ -23,7 +23,7 @@ define('SM_PATH','../'); /** SquirrelMail required files. */ -require_once(SM_PATH . 'include/validate.php'); +include_once(SM_PATH . 'include/validate.php'); include_once(SM_PATH . 'functions/strings.php'); include_once(SM_PATH . 'functions/global.php'); include_once(SM_PATH . 'functions/html.php'); @@ -311,6 +311,5 @@ if ($show == 'form' && ! isset($listall)) { echo html_tag( 'p', '
' . _("Nothing to search") . "\n",'center' ); } } - -?> - \ No newline at end of file +$oTemplate->display('footer.tpl'); +?> \ No newline at end of file diff --git a/src/addrbook_search_html.php b/src/addrbook_search_html.php index 9862ced6..f1931f0d 100644 --- a/src/addrbook_search_html.php +++ b/src/addrbook_search_html.php @@ -22,7 +22,7 @@ if (! defined('SM_PATH') ) { } /** SquirrelMail required files. */ -require_once(SM_PATH . 'include/validate.php'); +include_once(SM_PATH . 'include/validate.php'); include_once(SM_PATH . 'functions/global.php'); include_once(SM_PATH . 'functions/date.php'); include_once(SM_PATH . 'functions/display_messages.php'); @@ -300,6 +300,6 @@ if ($addrquery == '' || sizeof($res) == 0) { echo '' . "\n" . ''; } - -?> - \ No newline at end of file +display('footer.tpl'); +?> \ No newline at end of file diff --git a/src/addressbook.php b/src/addressbook.php index b3509bde..50b16a92 100644 --- a/src/addressbook.php +++ b/src/addressbook.php @@ -19,7 +19,7 @@ define('SM_PATH','../'); /** SquirrelMail required files. */ -require_once(SM_PATH . 'include/validate.php'); +include_once(SM_PATH . 'include/validate.php'); require_once(SM_PATH . 'functions/display_messages.php'); require_once(SM_PATH . 'functions/addressbook.php'); require_once(SM_PATH . 'functions/forms.php'); @@ -284,7 +284,7 @@ if ($showaddrlist) { html_tag( 'th', _("Info") . show_abook_sort_button($abook_sort_order, _("sort by info"), 6, 7), 'left', '', 'width="1%"' ) . - ($abook->add_extra_field ? html_tag( 'th', ' ','left', '', 'width="1%"'): '') . + ($abook->add_extra_field ? html_tag( 'th', ' ','left', '', 'width="1%"'): '') . "\n", '', $color[9] ) . "\n"; } @@ -328,8 +328,8 @@ if ($showaddrlist) { ' ' , 'center', '', 'valign="top" width="1%"' ); } - echo html_tag( 'td', - ' ' . htmlspecialchars($row['nickname']) . ' ', + echo html_tag( 'td', + ' ' . htmlspecialchars($row['nickname']) . ' ', 'left', '', 'valign="top" width="1%" style="white-space: nowrap;"' ); // different full name display formating for Japanese translation @@ -338,7 +338,7 @@ if ($showaddrlist) { * translation uses euc-jp character set internally. * htmlspecialchars() should not break any characters. */ - echo html_tag( 'td', + echo html_tag( 'td', ' ' . htmlspecialchars($row['lastname']) . ' ' . htmlspecialchars($row['firstname']) . ' ', 'left', '', 'valign="top" width="1%" style="white-space: nowrap;"' ); } else { @@ -359,7 +359,7 @@ if ($showaddrlist) { // add extra column if third party backend needs it if ($abook->add_extra_field) { - echo html_tag( 'td', + echo html_tag( 'td', ' ' . (isset($row['extra']) ? $row['extra'] : '') . ' ', 'left', '', 'valign="top" width="1%"' ); } @@ -394,6 +394,5 @@ echo "\n"; echo "\n"; do_hook('addressbook_bottom'); echo "\n\n"; - -?> - \ No newline at end of file +$oTemplate->display('footer.tpl'); +?> \ No newline at end of file diff --git a/src/compose.php b/src/compose.php index abcdf9d8..4f610ca5 100644 --- a/src/compose.php +++ b/src/compose.php @@ -24,7 +24,7 @@ define('SM_PATH','../'); /* SquirrelMail required files. */ -require_once(SM_PATH . 'include/validate.php'); +include_once(SM_PATH . 'include/validate.php'); require_once(SM_PATH . 'functions/global.php'); require_once(SM_PATH . 'functions/imap.php'); require_once(SM_PATH . 'functions/date.php'); @@ -467,7 +467,7 @@ if ($send) { exit(); } unset($compose_messages[$session]); - + /* if it is resumed draft, delete draft message */ if ( isset($delete_draft)) { $imap_stream = sqimap_login($username, $key, $imapServerAddress, $imapPort, false); @@ -1025,7 +1025,7 @@ function showInputForm ($session, $values=false) { $username, $data_dir, $identity, $idents, $delete_draft, $mailprio, $compose_new_win, $saved_draft, $mail_sent, $sig_first, $username, $compose_messages, $composesession, $default_charset, - $compose_onsubmit; + $compose_onsubmit, $oTemplate; if (checkForJavascript()) { $onfocus = ' onfocus="alreadyFocused=true;"'; @@ -1070,8 +1070,8 @@ function showInputForm ($session, $values=false) { // Plugins that use compose_form hook can add an array entry // to the globally scoped $compose_onsubmit; we add them up - // here and format the form tag's full onsubmit handler. - // Each plugin should use "return false" if they need to + // here and format the form tag's full onsubmit handler. + // Each plugin should use "return false" if they need to // stop form submission but otherwise should NOT use "return // true" to give other plugins the chance to do what they need // to do; SquirrelMail itself will add the final "return true". @@ -1079,21 +1079,21 @@ function showInputForm ($session, $values=false) { // need to quote accordingly. if (checkForJavascript()) { $onsubmit_text = ' onsubmit="'; - if (empty($compose_onsubmit)) + if (empty($compose_onsubmit)) $compose_onsubmit = array(); - else if (!is_array($compose_onsubmit)) + else if (!is_array($compose_onsubmit)) $compose_onsubmit = array($compose_onsubmit); foreach ($compose_onsubmit as $text) { $text = trim($text); - if (substr($text, -1) != ';' && substr($text, -1) != '}') + if (substr($text, -1) != ';' && substr($text, -1) != '}') $text .= '; '; $onsubmit_text .= $text; } echo $onsubmit_text . ' return true;"'; } - + echo ">\n"; @@ -1340,7 +1340,7 @@ function showInputForm ($session, $values=false) { } do_hook('compose_bottom'); - echo '' . "\n"; + $oTemplate->display('footer.tpl'); } diff --git a/src/delete_message.php b/src/delete_message.php index c70877a3..56f6da3f 100644 --- a/src/delete_message.php +++ b/src/delete_message.php @@ -18,11 +18,10 @@ define('SM_PATH','../'); /* SquirrelMail required files. */ -require_once(SM_PATH . 'include/validate.php'); +include_once(SM_PATH . 'include/validate.php'); include_once(SM_PATH . 'functions/display_messages.php'); global $color; error_box('delete_message.php script is obsolete since 1.5.1.',$color); - -?> - \ No newline at end of file +$oTemplate->display('footer.tpl'); +?> \ No newline at end of file diff --git a/src/folders.php b/src/folders.php index cfb8bb49..f5ccdbed 100644 --- a/src/folders.php +++ b/src/folders.php @@ -20,7 +20,7 @@ define('SM_PATH','../'); /* SquirrelMail required files. */ -require_once(SM_PATH . 'include/validate.php'); +include_once(SM_PATH . 'include/validate.php'); require_once(SM_PATH . 'functions/imap.php'); require_once(SM_PATH . 'functions/folder_manip.php'); require_once(SM_PATH . 'functions/plugin.php'); @@ -142,9 +142,9 @@ $server_type = strtolower($imap_server_type); if ( $server_type == 'courier' ) { /** * If we use courier, we should hide system trash folder - * FIXME: (tokul) Who says that courier does not allow storing folders in - * INBOX.Trash or inbox.trash? Can't reproduce it 3.0.8. This entry is - * useless, because in_array() check is case sensitive and INBOX is in + * FIXME: (tokul) Who says that courier does not allow storing folders in + * INBOX.Trash or inbox.trash? Can't reproduce it 3.0.8. This entry is + * useless, because in_array() check is case sensitive and INBOX is in * upper case. */ array_push($skip_folders, 'inbox.trash'); @@ -192,14 +192,14 @@ foreach ($boxes as $index => $aBoxData) { if (isSpecialMailbox($aBoxData['unformatted']) && ! in_array($aBoxData['unformatted'],$skip_folders)) { $skip_folders[] = $aBoxData['unformatted']; - } + } } /** * Retrieve list of folders when special folders are excluded. Special folders * should be unavailable in rename/delete/unsubscribe. Theoretically user can - * modify form and perform these operations with special folders, but if user - * manages to delete/rename/unsubscribe special folder by hacking form... + * modify form and perform these operations with special folders, but if user + * manages to delete/rename/unsubscribe special folder by hacking form... * * If script or program depends on special folder, they should not assume that * folder is available. @@ -358,4 +358,6 @@ sqimap_logout($imapConnection); - \ No newline at end of file +display('footer.tpl'); +?> \ No newline at end of file diff --git a/src/help.php b/src/help.php index eecd7776..42b236c4 100644 --- a/src/help.php +++ b/src/help.php @@ -18,7 +18,7 @@ define('SM_PATH','../'); /* SquirrelMail required files. */ -require_once(SM_PATH . 'include/validate.php'); +include_once(SM_PATH . 'include/validate.php'); require_once(SM_PATH . 'functions/global.php'); require_once(SM_PATH . 'functions/display_messages.php'); @@ -212,4 +212,7 @@ echo html_tag( 'tr', ); ?> - \ No newline at end of file + +display('footer.tpl'); +?> \ No newline at end of file diff --git a/src/image.php b/src/image.php index 19bb1d0f..1158ca41 100644 --- a/src/image.php +++ b/src/image.php @@ -18,7 +18,7 @@ define('SM_PATH','../'); /* SquirrelMail required files. */ -require_once(SM_PATH . 'include/validate.php'); +include_once(SM_PATH . 'include/validate.php'); require_once(SM_PATH . 'functions/global.php'); require_once(SM_PATH . 'functions/date.php'); require_once(SM_PATH . 'functions/page_header.php'); @@ -63,4 +63,6 @@ $DownloadLink = '../src/download.php?passed_id=' . $passed_id . - \ No newline at end of file +display('footer.tpl'); +?> \ No newline at end of file diff --git a/src/left_main.php b/src/left_main.php index de427279..8e7e941a 100644 --- a/src/left_main.php +++ b/src/left_main.php @@ -19,7 +19,7 @@ define('SM_PATH','../'); /* SquirrelMail required files. */ -require_once(SM_PATH . 'include/validate.php'); +include_once(SM_PATH . 'include/validate.php'); require_once(SM_PATH . 'functions/imap.php'); require_once(SM_PATH . 'functions/plugin.php'); require_once(SM_PATH . 'functions/page_header.php'); @@ -125,7 +125,7 @@ function ListBoxes ($boxes, $j=0 ) { $boxes->total = $result['MESSAGES']; $boxes->unseen = $result['UNSEEN']; } - + $pre .= ""; if ($unseen > 0) { $pre .= ''; @@ -794,4 +794,7 @@ sqimap_logout($imapConnection); ?> - \ No newline at end of file + +display('footer.tpl'); +?> \ No newline at end of file diff --git a/src/options_highlight.php b/src/options_highlight.php index 61ac7ddf..f68c1da2 100644 --- a/src/options_highlight.php +++ b/src/options_highlight.php @@ -19,7 +19,7 @@ define('SM_PATH','../'); /* SquirrelMail required files. */ -require_once(SM_PATH . 'include/validate.php'); +include_once(SM_PATH . 'include/validate.php'); include_once(SM_PATH . 'functions/display_messages.php'); include_once(SM_PATH . 'functions/imap.php'); include_once(SM_PATH . 'functions/plugin.php'); @@ -466,4 +466,7 @@ if ($action == 'edit' || $action == 'add') { do_hook('options_highlight_bottom'); ?> - \ No newline at end of file + +display('footer.tpl'); +?> \ No newline at end of file diff --git a/src/options_order.php b/src/options_order.php index e37e016a..5e1c36f2 100644 --- a/src/options_order.php +++ b/src/options_order.php @@ -19,7 +19,7 @@ define('SM_PATH','../'); /* SquirrelMail required files. */ -require_once(SM_PATH . 'include/validate.php'); +include_once(SM_PATH . 'include/validate.php'); include_once(SM_PATH . 'functions/global.php'); include_once(SM_PATH . 'functions/display_messages.php'); include_once(SM_PATH . 'functions/imap.php'); @@ -234,8 +234,8 @@ function viewOrderForm($aColumns, $aOrder, $aOpts, $mailbox) { - display('footer.tpl'); ?> \ No newline at end of file diff --git a/src/printer_friendly_bottom.php b/src/printer_friendly_bottom.php index 51b4a129..3e4e95fa 100644 --- a/src/printer_friendly_bottom.php +++ b/src/printer_friendly_bottom.php @@ -21,7 +21,7 @@ define('SM_PATH','../'); /* SquirrelMail required files. */ -require_once(SM_PATH . 'include/validate.php'); +include_once(SM_PATH . 'include/validate.php'); require_once(SM_PATH . 'functions/imap.php'); /* get some of these globals */ @@ -135,7 +135,7 @@ echo '
' . "\n" . $body, 'left', '', 'colspan="2"' ) ) . "\n" ; - + if (! empty($attachments)) { // attachments title echo html_tag( 'tr', @@ -151,8 +151,8 @@ echo '' . "\n" . - ''; + echo '' . "\n"; +$oTemplate->display('footer.tpl'); /* --end browser output-- */ @@ -262,12 +262,12 @@ function pf_show_attachments($message, $exclude_id, $mailbox, $id) { // TODO: maybe make it nicer? $attachments .= '' . - ''. - html_tag( 'td',_("Size:"), 'right', '', 'width="25%"') . + ''. + html_tag( 'td',_("Size:"), 'right', '', 'width="25%"') . html_tag( 'td',show_readable_size($header->size), 'left', '', 'width="75%"') . '' . "\n" . html_tag( 'td',_("Type:"), 'right', '', 'width="25%"') . - html_tag( 'td',htmlspecialchars($type0).'/'.htmlspecialchars($type1), 'left', '', 'width="75%"') . + html_tag( 'td',htmlspecialchars($type0).'/'.htmlspecialchars($type1), 'left', '', 'width="75%"') . ''; if (! empty($description)) { $attachments .= $description; diff --git a/src/printer_friendly_top.php b/src/printer_friendly_top.php index 0d21deed..cc7a924f 100644 --- a/src/printer_friendly_top.php +++ b/src/printer_friendly_top.php @@ -19,7 +19,7 @@ define('SM_PATH','../'); /* SquirrelMail required files. */ -require_once(SM_PATH . 'include/validate.php'); +include_once(SM_PATH . 'include/validate.php'); displayHtmlHeader( _("Printer Friendly"), "
'.decodeHeader($display_filename).'