X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=src%2Foptions.php;h=3968e12151a30059547193433351b2bb28011a09;hb=2de8b87fad334dde39eedb9254879365a66a3f44;hp=6a64d234aa248f77d00b80940ebc260aac5aa2bb;hpb=4b4abf93a9624311afef0c385023724ee46a2b60;p=squirrelmail.git diff --git a/src/options.php b/src/options.php index 6a64d234..3968e121 100644 --- a/src/options.php +++ b/src/options.php @@ -6,7 +6,7 @@ * Displays the options page. Pulls from proper user preference files * and config.php. Displays preferences as selected and other options. * - * @copyright © 1999-2005 The SquirrelMail Project Team + * @copyright © 1999-2006 The SquirrelMail Project Team * @license http://opensource.org/licenses/gpl-license.php GNU Public License * @version $Id$ * @package squirrelmail @@ -14,20 +14,15 @@ */ /** - * Path for SquirrelMail required files. - * @ignore + * Include the SquirrelMail initialization file. */ -define('SM_PATH','../'); +require('../include/init.php'); /* SquirrelMail required files. */ -require_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'); -include_once(SM_PATH . 'functions/options.php'); -include_once(SM_PATH . 'functions/strings.php'); -include_once(SM_PATH . 'functions/html.php'); -include_once(SM_PATH . 'functions/forms.php'); + +//include(SM_PATH . 'functions/imap_general.php'); +require_once(SM_PATH . 'functions/options.php'); +require_once(SM_PATH . 'functions/forms.php'); /*********************************/ /*** Build the resultant page. ***/ @@ -74,57 +69,10 @@ function process_optionmode_link($optpage) { } -/** - * This function prints out an option page row. - */ -function print_optionpages_row($leftopt, $rightopt = false) { - global $color; - - if ($rightopt) { - $rightopt_name = html_tag( 'td', '' . $rightopt['name'] . '', 'left', $color[9], 'valign="top" width="49%"' ); - $rightopt_desc = html_tag( 'td', $rightopt['desc'], 'left', $color[0], 'valign="top" width="49%"' ); - } else { - $rightopt_name = html_tag( 'td', ' ', 'left', $color[4], 'valign="top" width="49%"' ); - $rightopt_desc = html_tag( 'td', ' ', 'left', $color[4], 'valign="top" width="49%"' ); - } - - echo - html_tag( 'table', "\n" . - html_tag( 'tr', "\n" . - html_tag( 'td', "\n" . - html_tag( 'table', "\n" . - html_tag( 'tr', "\n" . - html_tag( 'td', - '' . $leftopt['name'] . '' , - 'left', $color[9], 'valign="top" width="49%"' ) . - html_tag( 'td', - ' ' , - 'left', $color[4], 'valign="top" width="2%"' ) . "\n" . - $rightopt_name - ) . "\n" . - html_tag( 'tr', "\n" . - html_tag( 'td', - $leftopt['desc'] , - 'left', $color[0], 'valign="top" width="49%"' ) . - html_tag( 'td', - ' ' , - 'left', $color[4], 'valign="top" width="2%"' ) . "\n" . - $rightopt_desc - ) , - '', '', 'width="100%" cellpadding="2" cellspacing="0" border="0"' ) , - 'left', '', 'valign="top"' ) - ) , - '', $color[4], 'width="100%" cellpadding="0" cellspacing="5" border="0"' ); -} /* ---------------------------- main ---------------------------- */ /* get the globals that we may need */ -sqgetGlobalVar('key', $key, SQ_COOKIE); -sqgetGlobalVar('username', $username, SQ_SESSION); -sqgetGlobalVar('onetimepad',$onetimepad, SQ_SESSION); -sqgetGlobalVar('delimiter', $delimiter, SQ_SESSION); - sqgetGlobalVar('optpage', $optpage); sqgetGlobalVar('optmode', $optmode, SQ_FORM); sqgetGlobalVar('optpage_data',$optpage_data, SQ_POST); @@ -297,32 +245,35 @@ if ($optpage == SMOPT_PAGE_MAIN) { /**********************************************************/ /* First, display the results of a submission, if needed. */ /**********************************************************/ + $notice = ''; if ($optmode == SMOPT_MODE_SUBMIT) { if (!isset($frame_top)) { $frame_top = '_top'; } if (isset($optpage_save_error) && $optpage_save_error!=array()) { - echo "" . _("Error(s) occurred while saving your options") . "
\n"; - echo "\n" + . '' . _("Some of your preference changes were not applied.") . "
\n"; } else { /* Display a message indicating a successful save. */ - echo '' . _("Successfully Saved Options") . ": $optpage_name
\n"; + $notice = '' . _("Successfully Saved Options") . ": $optpage_name
\n"; } /* If $max_refresh != SMOPT_REFRESH_NONE, provide a refresh link. */ if ( !isset( $max_refresh ) ) { } else if ($max_refresh == SMOPT_REFRESH_FOLDERLIST) { - echo '' . _("Refresh Folder List") . '
'; + $notice .= '' . _("Refresh Folder List") . '
'; } else if ($max_refresh) { - echo '' . _("Refresh Page") . '
'; + $notice .= '' . _("Refresh Page") . '
'; } } + $oTemplate->assign('notice',$notice); + /******************************************/ /* Build our array of Option Page Blocks. */ /******************************************/ @@ -396,27 +347,10 @@ if ($optpage == SMOPT_PAGE_MAIN) { /********************************************/ /* Now, print out each option page section. */ /********************************************/ - $first_optpage = false; - echo html_tag( 'table', '', '', $color[4], 'width="100%" cellpadding="0" cellspacing="5" border="0"' ) . "\n" . - html_tag( 'tr' ) . "\n" . - html_tag( 'td', '', 'left', '', 'valign="top"' ) . - html_tag( 'table', '', '', $color[4], 'width="100%" cellpadding="3" cellspacing="0" border="0"' ) . "\n" . - html_tag( 'tr' ) . "\n" . - html_tag( 'td', '', 'left' ); - foreach ($optpage_blocks as $next_optpage) { - if ($first_optpage == false) { - $first_optpage = $next_optpage; - } else { - print_optionpages_row($first_optpage, $next_optpage); - $first_optpage = false; - } - } - - if ($first_optpage != false) { - print_optionpages_row($first_optpage); - } - echo "\n"; + $oTemplate->assign('color',$color); + $oTemplate->assign('optpage_blocks',$optpage_blocks); + $oTemplate->display('option_groups.tpl'); do_hook('options_link_and_description'); @@ -484,11 +418,13 @@ if ($optpage == SMOPT_PAGE_MAIN) { if ($bottom_hook_name != '') { do_hook($bottom_hook_name); } + if (isset($max_refresh)) $oTemplate->assign('max_refresh',$max_refresh); + $oTemplate->assign('color',$color); + $oTemplate->assign('optpage',$optpage); + $oTemplate->assign('optpage_name',$optpage_name); + $oTemplate->assign('optpage_data',$optpage_data); + $oTemplate->assign('optmode',$optmode); + $oTemplate->display('options.tpl'); } -?> - - - - - \ No newline at end of file +$oTemplate->display('footer.tpl');