From 88cb1b4d2ebd3e74fcee1d756df4e420da8bdf09 Mon Sep 17 00:00:00 2001 From: philippe_mingo Date: Sat, 2 Feb 2002 02:17:05 +0000 Subject: [PATCH] The 2000000 bugfix ------------------ This is mostly a warning removal "a la Tyler". I've also installed 4.1.1 on my portable and it looks it works fine with some bugfixs. Please 4.1.1 report feedback. git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@2338 7612ce4b-ef26-0410-bec9-ea0150e637f0 --- functions/auth.php | 6 +- functions/i18n.php | 10 +- functions/mailbox_display.php | 10 +- functions/mime.php | 11 +- functions/options.php | 20 ++- functions/prefs.php | 14 ++- functions/strings.php | 7 +- plugins/administrator/defines.php | 20 ++- plugins/administrator/options.php | 71 +++++++---- plugins/calendar/calendar.php | 11 +- plugins/calendar/calendar_data.php | 23 ++-- plugins/calendar/day.php | 23 ++-- plugins/calendar/event_create.php | 15 ++- plugins/sent_subfolders/setup.php | 4 +- plugins/squirrelspell/sqspell_interface.php | 2 +- plugins/squirrelspell/sqspell_options.php | 2 +- plugins/translate/options.php | 2 +- src/options.php | 3 +- src/right_main.php | 2 + src/search.php | 129 +++++++++++--------- 20 files changed, 223 insertions(+), 162 deletions(-) diff --git a/functions/auth.php b/functions/auth.php index 309a47c9..dde31475 100644 --- a/functions/auth.php +++ b/functions/auth.php @@ -14,13 +14,13 @@ require_once( '../functions/page_header.php' ); function is_logged_in () { - global $squirrelmail_language, $frame_top; + global $squirrelmail_language, $frame_top, $base_uri; if ( session_is_registered('user_is_logged_in') ) { return; } - if (!isset($frame_top)) { + if (!isset($frame_top) || $frame_top == '' ) { $frame_top = '_top'; } @@ -31,7 +31,7 @@ function is_logged_in () { echo "\n" . '

' . _("You must be logged in to access this page.").'

' . - ""._("Go to the login page")."\n" . + ""._("Go to the login page")."\n" . "
\n"; exit; } diff --git a/functions/i18n.php b/functions/i18n.php index 9835efc6..01f90a2c 100644 --- a/functions/i18n.php +++ b/functions/i18n.php @@ -712,19 +712,19 @@ function set_up_language($sm_language, $do_search = false) { $sm_notAlias = $languages[$sm_notAlias]['ALIAS']; } - if ( isset($sm_language) && + if ( isset($sm_language) && $use_gettext && $sm_language != '' && isset($languages[$sm_notAlias]['CHARSET']) ) { bindtextdomain( 'squirrelmail', '../locale/' ); - textdomain( 'squirrelmail' ); - if ( !ini_get('safe_mode') && + textdomain( 'squirrelmail' ); + if ( !ini_get('safe_mode') && getenv( 'LC_ALL' ) != $sm_notAlias ) { putenv( "LC_ALL=$sm_notAlias" ); putenv( "LANG=$sm_notAlias" ); putenv( "LANGUAGE=$sm_notAlias" ); } - setlocale('LC_ALL', $sm_notAlias); + setlocale(LC_ALL, $sm_notAlias); $squirrelmail_language = $sm_notAlias; header( 'Content-Type: text/html; charset=' . $languages[$sm_notAlias]['CHARSET'] ); } @@ -742,7 +742,7 @@ function set_my_charset(){ * message blindly with the system-wide $default_charset. */ global $data_dir, $username, $default_charset, $languages; - + $my_language = getPref($data_dir, $username, 'language'); if (!$my_language) { return; diff --git a/functions/mailbox_display.php b/functions/mailbox_display.php index d2b02e3d..cffa030a 100644 --- a/functions/mailbox_display.php +++ b/functions/mailbox_display.php @@ -27,12 +27,14 @@ function printMessageInfo($imapConnection, $t, $i, $key, $mailbox, $sort, $start $color_string = $color[4]; if ($GLOBALS['alt_index_colors']) { - if (!isset($GLOBALS["row_count"])) { - $GLOBALS["row_count"] = 0; + if (!isset($GLOBALS['row_count'])) { + $GLOBALS['row_count'] = 0; } $GLOBALS['row_count']++; - if ($GLOBALS["row_count"] % 2) { - if (!isset($color[12])) $color[12] = '#EAEAEA'; + if ($GLOBALS['row_count'] % 2) { + if (!isset($color[12])) { + $color[12] = '#EAEAEA'; + } $color_string = $color[12]; } } diff --git a/functions/mime.php b/functions/mime.php index a1394a66..7ff84235 100644 --- a/functions/mime.php +++ b/functions/mime.php @@ -20,12 +20,11 @@ class msg_header { /** msg_header contains generic variables for values that **/ /** could be in a header. **/ - var $type0 = '', $type1 = '', $boundary = '', $charset = ''; - var $encoding = '', $size = 0, $to = array(), $from = '', $date = ''; - var $cc = array(), $bcc = array(), $reply_to = '', $subject = ''; - var $id = 0, $mailbox = '', $description = '', $filename = ''; - var $entity_id = 0, $message_id = 0, $name = ''; - // var $priority = ""; + var $type0 = '', $type1 = '', $boundary = '', $charset = '', + $encoding = '', $size = 0, $to = array(), $from = '', $date = '', + $cc = array(), $bcc = array(), $reply_to = '', $subject = '', + $id = 0, $mailbox = '', $description = '', $filename = '', + $entity_id = 0, $message_id = 0, $name = '', $priority = 3; } class message { diff --git a/functions/options.php b/functions/options.php index b0f5ee0b..834ef3a1 100644 --- a/functions/options.php +++ b/functions/options.php @@ -36,6 +36,7 @@ define('SMOPT_SIZE_SMALL', 1); define('SMOPT_SIZE_MEDIUM', 2); define('SMOPT_SIZE_LARGE', 3); define('SMOPT_SIZE_HUGE', 4); +define('SMOPT_SIZE_NORMAL', 5); define('SMOPT_SAVE_DEFAULT', 'save_option'); define('SMOPT_SAVE_NOOP', 'save_option_noop'); @@ -177,12 +178,21 @@ class SquirrelOption { function createWidget_String() { switch ($this->size) { - case SMOPT_SIZE_TINY: $width = 5; break; - case SMOPT_SIZE_SMALL: $width = 12; break; - case SMOPT_SIZE_LARGE: $width = 38; break; - case SMOPT_SIZE_HUGE: $width = 50; break; + case SMOPT_SIZE_TINY: + $width = 5; + break; + case SMOPT_SIZE_SMALL: + $width = 12; + break; + case SMOPT_SIZE_LARGE: + $width = 38; + break; + case SMOPT_SIZE_HUGE: + $width = 50; + break; case SMOPT_SIZE_NORMAL: - default: $width = 25; + default: + $width = 25; } $result = "name\" VALUE=\"$this->value\" SIZE=\"$width\">"; diff --git a/functions/prefs.php b/functions/prefs.php index 74c7848f..5d2b38fe 100644 --- a/functions/prefs.php +++ b/functions/prefs.php @@ -11,23 +11,25 @@ * $Id$ */ +/* global $prefs_are_cached, $prefs_cache; if ( !session_is_registered('prefs_are_cached') || !isset( $prefs_cache) || - !is_array( $prefs_cache) || + !is_array( $prefs_cache) || substr( phpversion(), 0, 3 ) == '4.1' ) { $prefs_are_cached = false; $prefs_cache = array(); } +*/ /** * Check the preferences into the session cache. */ function cachePrefValues($data_dir, $username) { global $prefs_are_cached, $prefs_cache; - - if ($prefs_are_cached) { + + if ( isset($prefs_are_cached) && $prefs_are_cached) { return; } @@ -69,10 +71,10 @@ function cachePrefValues($data_dir, $username) { } fclose($file); - $prefs_are_cached = true; + $prefs_are_cached = TRUE; - session_register('prefs_cache'); - session_register('prefs_are_cached'); + session_register('prefs_cache'); + session_register('prefs_are_cached'); } /** diff --git a/functions/strings.php b/functions/strings.php index 26f07d1a..4481bd6b 100644 --- a/functions/strings.php +++ b/functions/strings.php @@ -204,12 +204,13 @@ function translateText(&$body, $wrap_at, $charset) { } $line = charset_decode($charset, $line); $line = str_replace("\t", ' ', $line); - + parseUrl ($line); - + $Quotes = 0; $pos = 0; - while (1) { + + while ( $line <> '' ) { if ($line[$pos] == ' ') { $pos ++; } else if (strpos($line, '>', $pos) === $pos) { diff --git a/plugins/administrator/defines.php b/plugins/administrator/defines.php index c9abb7fb..43b946e6 100644 --- a/plugins/administrator/defines.php +++ b/plugins/administrator/defines.php @@ -28,6 +28,7 @@ define('SMOPT_TYPE_TITLE', 9); define('SMOPT_TYPE_THEME', 10); define('SMOPT_TYPE_PLUGINS', 11); define('SMOPT_TYPE_LDAP', 12); +define('SMOPT_TYPE_EXTERNAL', 32); global $languages; @@ -47,6 +48,12 @@ for ($lsv = 100; $lsv <= 300; $lsv += 10) { $defcfg = array( '$config_version' => array( 'name' => _("Config File Version"), 'type' => SMOPT_TYPE_COMMENT, 'size' => 7 ), + 'SM_ver' => array( 'name' => _("Squirrelmail Version"), + 'type' => SMOPT_TYPE_EXTERNAL, + 'value' => "$version" ), + 'PHP_ver' => array( 'name' => _("PHP Version"), + 'type' => SMOPT_TYPE_EXTERNAL, + 'value' => phpversion() ), /* --------------------------------------------------------*/ 'Group1' => array( 'name' => _("Organization Preferences"), 'type' => SMOPT_TYPE_TITLE ), @@ -74,13 +81,13 @@ $defcfg = array( '$config_version' => array( 'name' => _("Config File Version"), 'Group2' => array( 'name' => _("Server Settings"), 'type' => SMOPT_TYPE_TITLE ), '$domain' => array( 'name' => _("Mail Domain"), - 'type' => SMOPT_TYPE_STRING, - 'size' => 40 ), + 'type' => SMOPT_TYPE_STRING, + 'size' => 40 ), '$imapServerAddress' => array( 'name' => _("IMAP Server Address"), 'type' => SMOPT_TYPE_STRING, 'size' => 40 ), '$imapPort' => array( 'name' => _("IMAP Server Port"), - 'type' => SMOPT_TYPE_INTEGER ), + 'type' => SMOPT_TYPE_INTEGER ), '$imap_server_type' => array( 'name' => _("IMAP Server Type"), 'type' => SMOPT_TYPE_STRLIST, 'posvals' => array( 'cyrus' => _("Cyrus IMAP server"), @@ -102,7 +109,7 @@ $defcfg = array( '$config_version' => array( 'name' => _("Config File Version"), 'type' => SMOPT_TYPE_STRING, 'size' => 40 ), '$smtpPort' => array( 'name' => _("SMTP Server Port"), - 'type' => SMOPT_TYPE_INTEGER ), + 'type' => SMOPT_TYPE_INTEGER ), '$use_authenticated_smtp' => array( 'name' => _("Authenticated SMTP"), 'type' => SMOPT_TYPE_BOOLEAN ), '$invert_time' => array( 'name' => _("Invert Time"), @@ -200,7 +207,7 @@ $defcfg = array( '$config_version' => array( 'name' => _("Config File Version"), 'type' => SMOPT_TYPE_TITLE ), '$addrbook_dsn' => array( 'name' => _("Address book DSN"), 'type' => SMOPT_TYPE_STRING, - 'size' => 40 ), + 'size' => 40 ), '$addrbook_table' => array( 'name' => _("Address book table"), 'type' => SMOPT_TYPE_STRING, 'size' => 40, @@ -212,7 +219,8 @@ $defcfg = array( '$config_version' => array( 'name' => _("Config File Version"), 'type' => SMOPT_TYPE_STRING, 'size' => 40 ), /* --------------------------------------------------------*/ - '$config_use_color' => array( 'type' => SMOPT_TYPE_HIDDEN ) + '$config_use_color' => array( 'name' => '', + 'type' => SMOPT_TYPE_HIDDEN ) /* --------------------------------------------------------*/ ); diff --git a/plugins/administrator/options.php b/plugins/administrator/options.php index 2bab41ce..27a77881 100644 --- a/plugins/administrator/options.php +++ b/plugins/administrator/options.php @@ -72,7 +72,8 @@ function parseConfig( $cfg_file ) { break; case 'C': // Comments - if ( $line{$j}.$line{$j+1} == '*/' ) { + if ( $s > $j + 1 && + $line{$j}.$line{$j+1} == '*/' ) { $mode = ''; $j++; } @@ -107,7 +108,12 @@ function parseConfig( $cfg_file ) { } break; default: - if ( strtoupper( substr( $line, $j, 7 ) ) == 'GLOBAL ' ) { + if ( $line{$j} == '$' ) { + // We must detect $key name + $mode = 'K'; + $key = '$'; + } else if ( $s < $j + 2 ) { + } else if ( strtoupper( substr( $line, $j, 7 ) ) == 'GLOBAL ' ) { // Skip untill next ; $mode = ';'; $j += 6; @@ -117,10 +123,6 @@ function parseConfig( $cfg_file ) { } else if ( $line{$j} == '#' || $line{$j}.$line{$j+1} == '//' ) { // Delete till the end of the line $j = $s; - } else if ( $line{$j} == '$' ) { - // We must detect $key name - $mode = 'K'; - $key = '$'; } } } @@ -157,22 +159,28 @@ $cfgfile = '../config/config.php'; parseConfig( '../config/config_default.php' ); parseConfig( $cfgfile ); -$colapse = array( 'Titles' => FALSE, - 'Group1' => getPref($data_dir, $username, 'adm_Group1', FALSE ), - 'Group2' => getPref($data_dir, $username, 'adm_Group2', TRUE ), - 'Group3' => getPref($data_dir, $username, 'adm_Group3', TRUE ), - 'Group4' => getPref($data_dir, $username, 'adm_Group4', TRUE ), - 'Group5' => getPref($data_dir, $username, 'adm_Group5', TRUE ), - 'Group6' => getPref($data_dir, $username, 'adm_Group6', TRUE ), - 'Group7' => getPref($data_dir, $username, 'adm_Group7', TRUE ), - 'Group8' => getPref($data_dir, $username, 'adm_Group8', TRUE ) ); +$colapse = array( 'Titles' => 'off', + 'Group1' => getPref($data_dir, $username, 'adm_Group1', 'off' ), + 'Group2' => getPref($data_dir, $username, 'adm_Group2', 'on' ), + 'Group3' => getPref($data_dir, $username, 'adm_Group3', 'on' ), + 'Group4' => getPref($data_dir, $username, 'adm_Group4', 'on' ), + 'Group5' => getPref($data_dir, $username, 'adm_Group5', 'on' ), + 'Group6' => getPref($data_dir, $username, 'adm_Group6', 'on' ), + 'Group7' => getPref($data_dir, $username, 'adm_Group7', 'on' ), + 'Group8' => getPref($data_dir, $username, 'adm_Group8', 'on' ) ); if ( isset( $switch ) ) { - $colapse[$switch] = !$colapse[$switch]; + + if ( $colapse[$switch] == 'on' ) { + $colapse[$switch] = 'off'; + } else { + $colapse[$switch] = 'on'; + } setPref($data_dir, $username, "adm_$switch", $colapse[$switch] ); + } -echo "
" . +echo "" . "
". "" , ""; @@ -191,7 +199,11 @@ foreach ( $newcfg as $k => $v ) { if ( isset( $defcfg[$k] ) ) { $name = $defcfg[$k]['name']; $type = $defcfg[$k]['type']; - $size = $defcfg[$k]['size']; + if ( isset( $defcfg[$k]['size'] ) ) { + $size = $defcfg[$k]['size']; + } else { + $size = 40; + } } else if ( $l == 'true' ) { $v = 'TRUE'; $type = SMOPT_TYPE_BOOLEAN; @@ -212,7 +224,7 @@ foreach ( $newcfg as $k => $v ) { $type = SMOPT_TYPE_LDAP; } - if( $type == SMOPT_TYPE_TITLE || !$colapse[$act_grp] ) { + if( $type == SMOPT_TYPE_TITLE || $colapse[$act_grp] == 'off' ) { switch ( $type ) { case SMOPT_TYPE_LDAP: @@ -220,8 +232,13 @@ foreach ( $newcfg as $k => $v ) { case SMOPT_TYPE_THEME: case SMOPT_TYPE_HIDDEN: break; + case SMOPT_TYPE_EXTERNAL: + echo ""; + break; case SMOPT_TYPE_TITLE: - if ( $colapse[$k] ) { + if ( $colapse[$k] == 'on' ) { $sw = '(+)'; } else { $sw = '(-)'; @@ -357,7 +374,7 @@ foreach ( $newcfg as $k => $v ) { } /* Special Themes Block */ -if ( !($colapse['Group7']) ) { +if ( $colapse['Group7'] == 'off' ) { $i = 0; echo ''; -if( !$colapse['Group8'] ) { +if( $colapse['Group8'] == 'off' ) { $fd = opendir( '../plugins/' ); $op_plugin = array(); @@ -420,7 +437,8 @@ if( !$colapse['Group8'] ) { $plugins = array(); if ( isset( $HTTP_POST_VARS['plg'] ) ) { foreach ( $op_plugin as $plg ) { - if ( $HTTP_POST_VARS["plgs_$plg"] == 'on' ) { + if ( isset( $HTTP_POST_VARS["plgs_$plg"] ) && + $HTTP_POST_VARS["plgs_$plg"] == 'on' ) { $plugins[] = $plg; } } @@ -453,7 +471,7 @@ if( !$colapse['Group8'] ) { } echo '' . "". - ''; + "\n"; } echo '
" . _("Configuration Administrator") . "
$name" . + $defcfg[$k]['value'] . + "
' . _("Theme Name") . '' . _("Theme Path") . @@ -391,7 +408,7 @@ if ( !($colapse['Group7']) ) { } /* Special Plugins Block */ -if ( $colapse['Group8'] ) { +if ( $colapse['Group8'] == 'on' ) { $sw = '(+)'; } else { $sw = '(-)'; @@ -400,7 +417,7 @@ echo "
" . "$sw " . _("Plugins") . '
$plg
'; @@ -471,7 +489,8 @@ fwrite( $fp, "
" . "" . @@ -82,8 +83,8 @@ function drawmonthview() { if (isset($calendardata[$cdate])){ $i=0; while ($calfoo = each($calendardata[$cdate])) { - $calbar = $calendardata[$cdate][$calfoo[key]]; - echo ($calbar[priority]==1) ? "$calbar[title]
\n" : "$calbar[title]
\n"; + $calbar = $calendardata[$cdate][$calfoo['key']]; + echo ($calbar['priority']==1) ? "$calbar[title]
\n" : "$calbar[title]
\n"; $i=$i+1; if($i==2){ break; @@ -116,13 +117,13 @@ function endcalendar() { } -if($month <= 0){ +if( !isset( $month ) || $month <= 0){ $month = date( 'm' ); } -if($year <= 0){ +if( !isset($year) || $year <= 0){ $year = date( 'Y' ); } -if($day <= 0){ +if( !isset($day) || $day <= 0){ $day = date( 'd' ); } diff --git a/plugins/calendar/calendar_data.php b/plugins/calendar/calendar_data.php index 8bf3d65e..7a2a455a 100644 --- a/plugins/calendar/calendar_data.php +++ b/plugins/calendar/calendar_data.php @@ -27,16 +27,17 @@ function readcalendardata() { if (file_exists($filename)){ $fp = fopen ($filename,'r'); - } - if ($fp){ - while ($fdata = fgetcsv ($fp, 4096, '|')) { - $calendardata[$fdata[0]][$fdata[1]] = array( 'length' => $fdata[2], - 'priority' => $fdata[3], - 'title' => $fdata[4], - 'message' => $fdata[5], - 'reminder' => $fdata[6] ); + + if ($fp){ + while ($fdata = fgetcsv ($fp, 4096, '|')) { + $calendardata[$fdata[0]][$fdata[1]] = array( 'length' => $fdata[2], + 'priority' => $fdata[3], + 'title' => $fdata[4], + 'message' => $fdata[5], + 'reminder' => $fdata[6] ); + } + fclose ($fp); } - fclose ($fp); } } @@ -49,8 +50,8 @@ function writecalendardata() { $fp = fopen ($filetmp,"w"); if ($fp) { while ( $calfoo = each ($calendardata)) { - while ( $calbar = each ($calfoo[value])) { - $calfoobar = $calendardata[$calfoo[key]][$calbar[key]]; + while ( $calbar = each ($calfoo['value'])) { + $calfoobar = $calendardata[$calfoo['key']][$calbar['key']]; $calstr = "$calfoo[key]|$calbar[key]|$calfoobar[length]|$calfoobar[priority]|$calfoobar[title]|$calfoobar[message]|$calfoobar[reminder]\n"; fwrite($fp, $calstr, 4096); } diff --git a/plugins/calendar/day.php b/plugins/calendar/day.php index d0d72f65..36ae7171 100644 --- a/plugins/calendar/day.php +++ b/plugins/calendar/day.php @@ -52,7 +52,7 @@ function initialize_events() { if (isset($calendardata[$cdate])){ while ( $calfoo = each($calendardata[$cdate])){ - $daily_events["$calfoo[key]"] = $calendardata[$cdate][$calfoo[key]]; + $daily_events["$calfoo[key]"] = $calendardata[$cdate][$calfoo['key']]; } } } @@ -70,32 +70,31 @@ function display_events() { $eo=0; } - $ehour = substr($calfoo[key],0,2); - $eminute = substr($calfoo[key],2,2); - if (!is_array($calfoo[value])){ + $ehour = substr($calfoo['key'],0,2); + $eminute = substr($calfoo['key'],2,2); + if (!is_array($calfoo['value'])){ echo " \n" . " \n" . - " \n"; } else { - $calbar=$calfoo[value]; - if ($calbar[length]!=0){ - $elength = '-'.date('H:i',mktime($ehour,$eminute+$calbar[length],0,1,1,0)); + $calbar=$calfoo['value']; + if ($calbar['length']!=0){ + $elength = '-'.date('H:i',mktime($ehour,$eminute+$calbar['length'],0,1,1,0)); } else { $elength=''; } echo " \n" . " \n" . " \n"; } - $i++; } diff --git a/plugins/calendar/event_create.php b/plugins/calendar/event_create.php index 57b30ed6..72386ae9 100644 --- a/plugins/calendar/event_create.php +++ b/plugins/calendar/event_create.php @@ -63,16 +63,16 @@ function show_event_form() { } -if ($month <= 0){ +if ( !isset($month) || $month <= 0){ $month = date( 'm' ); } -if ($year <= 0){ +if ( !isset($year) || $year <= 0){ $year = date( 'Y' ); } -if ($day <= 0){ +if (!isset($day) || $day <= 0){ $day = date( 'd' ); } -if ($hour <= 0){ +if (!isset($hour) || $hour <= 0){ $hour = '08'; } @@ -98,7 +98,12 @@ if(!isset($event_text)){ $event_text=nl2br($event_text); $event_text=ereg_replace ("\n", "", $event_text); $event_text=ereg_replace ("\r", "", $event_text); - $calendardata["$month$day$year"]["$event_hour$event_minute"] = array("length"=>"$event_length","priority"=>"$event_priority","title"=>"$event_title","message"=>"$event_text"); + $calendardata["$month$day$year"]["$event_hour$event_minute"] = + array( 'length' => $event_length, + 'priority' => $event_priority, + 'title' => $event_title, + 'message' => $event_text, + 'reminder' => '' ); //save writecalendardata(); echo "
$ehour:$eminute ". + " ". _("ADD") . "
$ehour:$eminute$elength["; - echo ($calbar[priority]==1) ? "$calbar[title]" : "$calbar[title]"; + echo ($calbar['priority']==1) ? "$calbar[title]" : "$calbar[title]"; echo"] $calbar[message] \n" . - "". + "". _("EDIT") . " | \n" . - "" . + "" . _("DEL") . '' . "
\n". diff --git a/plugins/sent_subfolders/setup.php b/plugins/sent_subfolders/setup.php index a2565c66..c620191a 100644 --- a/plugins/sent_subfolders/setup.php +++ b/plugins/sent_subfolders/setup.php @@ -68,8 +68,8 @@ function sent_subfolders_check_handleAsSent() { } function sent_subfolders_load_prefs() { - global $use_sent_subfolders; - global $sent_subfolders_setting, $sent_subfolders_base; + global $use_sent_subfolders, $data_dir, $username, + $sent_subfolders_setting, $sent_subfolders_base; $use_sent_subfolders = getPref ($data_dir, $username, 'use_sent_subfolders', SMPREF_OFF); diff --git a/plugins/squirrelspell/sqspell_interface.php b/plugins/squirrelspell/sqspell_interface.php index 1357162e..6ea1f0d9 100644 --- a/plugins/squirrelspell/sqspell_interface.php +++ b/plugins/squirrelspell/sqspell_interface.php @@ -39,7 +39,7 @@ require_once("$SQSPELL_DIR/sqspell_functions.php"); * If $MOD is undefined, use "init", else check for security * breaches. */ -if (!$MOD){ +if (!isset($MOD) || !$MOD){ $MOD='init'; } else { sqspell_ckMOD($MOD); diff --git a/plugins/squirrelspell/sqspell_options.php b/plugins/squirrelspell/sqspell_options.php index 1a7eba5b..b6d9ba50 100644 --- a/plugins/squirrelspell/sqspell_options.php +++ b/plugins/squirrelspell/sqspell_options.php @@ -36,7 +36,7 @@ require_once("$SQSPELL_DIR/sqspell_functions.php"); * If $MOD is unspecified, assign "init" to it. Else check for * security breach attempts. */ -if (!$MOD){ +if (!isset($MOD) || !$MOD){ $MOD = 'options_main'; } else { sqspell_ckMOD($MOD); diff --git a/plugins/translate/options.php b/plugins/translate/options.php index 5ba38e73..64c99843 100644 --- a/plugins/translate/options.php +++ b/plugins/translate/options.php @@ -24,7 +24,7 @@ require_once('../src/load_prefs.php'); displayPageHeader($color, 'None'); - if ($submit_translate) { + if (isset($submit_translate) && $submit_translate ) { if (isset($translate_translate_server)) { setPref($data_dir, $username, 'translate_server', $translate_translate_server); } else { diff --git a/src/options.php b/src/options.php index 9744c99a..8e11f1b5 100644 --- a/src/options.php +++ b/src/options.php @@ -235,7 +235,8 @@ if ($optpage == SMOPT_PAGE_MAIN) { echo '' . _("Successfully Saved Options") . ": $optpage_name
\n"; /* If $max_refresh != SMOPT_REFRESH_NONE, provide a refresh link. */ - if ($max_refresh == SMOPT_REFRESH_FOLDERLIST) { + if ( !isset( $max_refresh ) ) { + } else if ($max_refresh == SMOPT_REFRESH_FOLDERLIST) { echo '' . _("Refresh Folder List") . '
'; } else if ($max_refresh) { echo '' . _("Refresh Page") . '
'; diff --git a/src/right_main.php b/src/right_main.php index 07492d1a..3aa7c944 100644 --- a/src/right_main.php +++ b/src/right_main.php @@ -108,9 +108,11 @@ if (! isset($use_mailbox_cache)) { } /* There is a problem with registered vars in 4.1 */ +/* if( substr( phpversion(), 0, 3 ) == '4.1' ) { $use_mailbox_cache = FALSE; } +*/ if ($use_mailbox_cache && session_is_registered('msgs')) { showMessagesForMailbox($imapConnection, $mailbox, $numMessages, $startMessage, $sort, $color, $show_num, $use_mailbox_cache); diff --git a/src/search.php b/src/search.php index 00c46a79..cfd3c425 100644 --- a/src/search.php +++ b/src/search.php @@ -169,40 +169,41 @@ displayPageHeader($color, $mailbox); // if the page is called from a search link or button update recent values // in pref files here -if ($submit == "Search" && !empty($what)) { +if ( !isset( $submit ) ) { + $submit = ''; +} else if ($submit == 'Search' && !empty($what)) { update_recent($what_array, $what, "search_what", $username, $data_dir); update_recent($where_array, $where, "search_where", $username, $data_dir); update_recent($folder_array, $mailbox, "search_folder", $username, $data_dir); } // if the page is called from a "forget recent" link remove search from pref file -elseif ($submit == "forget") { +elseif ($submit == 'forget') { forget_recent($count, $username, $data_dir); } // if the page is called from a "save recent" link add search to saved searches -elseif ($submit == "save") { +elseif ($submit == 'save') { save_recent($count, $username, $data_dir); } -elseif ($submit == "delete") { +elseif ($submit == 'delete') { delete_saved($count, $username, $data_dir); } // if the page is called from a "delete saved" link delete saved search do_hook('search_before_form'); echo "
\n". - "
\n". - " \n". - "
\n". - "
"._("Search")."
\n". - "
\n"; -# '
'; + "\n". + "\n". + "
\n". + "
" . _("Search") . "
\n". + "
\n"; -// update the recent and saved searches from the pref files +// update the recent and saved searches from the pref files $what_array = get_recent("search_what", $username, $data_dir); $where_array = get_recent("search_where", $username, $data_dir); $folder_array = get_recent("search_folder", $username, $data_dir); $recent_count = getPref($data_dir, $username, 'search_memory', 0); -$saved_what_array = get_saved("saved_what", $username, $data_dir); +$saved_what_array = get_saved("saved_what", $username, $data_dir); $saved_where_array = get_saved("saved_where", $username, $data_dir); $saved_folder_array = get_saved("saved_folder", $username, $data_dir); $saved_count = count($saved_what_array); @@ -211,36 +212,36 @@ $count_all = 0; /* Saved Search Table */ if ($saved_count > 0) { echo "
\n" - . "" - . '\n". "
Saved Searches
' - . ''; + . "
" + . '
Saved Searches
' + . ''; for ($i=0; $i < $saved_count; ++$i) { - if ($i % 2) { - echo ""; - } else { + if ($i % 2) { + echo ""; + } else { echo ""; } echo "" - . "" - . "" - . ''; + . "" + . "" + . ''; } echo "
$saved_folder_array[$i]$saved_what_array[$i]$saved_where_array[$i]' - . '' . _("edit") . '' - . ' | ' - . '' . _("search") . '' - . ' | ' - . "" - . _("delete") - . '' - . '
$saved_what_array[$i]$saved_where_array[$i]' + . '' . _("edit") . '' + . ' | ' + . '' . _("search") . '' + . ' | ' + . "" + . _("delete") + . '' + . '
\n"; } @@ -300,7 +301,7 @@ for ($i = 0; $i < count($boxes); $i++) { } else { echo " \n"; - } + } } } echo "
\n"; +if ( !isset( $what ) ) { + $what = ''; +} $what_disp = str_replace(',', ' ', $what); $what_disp = str_replace('\\\\', '\\', $what_disp); $what_disp = str_replace('\\"', '"', $what_disp); @@ -336,43 +340,50 @@ echo " \n" . "
\n"; -do_hook("search_after_form"); +do_hook('search_after_form'); -// search all folders option still in the works. returns a table for each -// folder it finds a match in. The toggle all link does not work +/* + search all folders option still in the works. returns a table for each + folder it finds a match in. The toggle all link does not work +*/ - -if ($search_all == "all") { - $mailbox == ""; +if ($search_all == 'all') { + $mailbox == ''; $boxcount = count($boxes); - echo "
Search Results

\n"; + echo '
' . + _("Search Results") . + "

\n"; for ($x=0;$x<$boxcount;$x++) { if (!in_array('noselect', $boxes[$x]['flags'])) { - $mailbox = $boxes[$x]['unformatted']; - } + $mailbox = $boxes[$x]['unformatted']; + } if (($submit == "Search" || $submit == "Search_no_update") && !empty($what)) { sqimap_mailbox_select($imapConnection, $mailbox); - $count_all = sqimap_search($imapConnection, $where, $what, $mailbox, $color, $pos, $search_all, $count_all); - } + $count_all = sqimap_search($imapConnection, $where, $what, $mailbox, $color, 0, $search_all, $count_all); + } + } + if ($count_all == 0) { + echo '
' . + _("No Messages found") . + '
'; } - if ($count_all == 0) { - echo "
No Messages found
"; - } } -// search one folder option +// search one folder option else { - if (($submit == "Search" || $submit == "Search_no_update") && !empty($what)) { - echo "
Search Results
\n"; + if (($submit == 'Search' || $submit == 'Search_no_update') && !empty($what)) { + echo '
' . + _("Search Results") . + "
\n"; sqimap_mailbox_select($imapConnection, $mailbox); - sqimap_search($imapConnection, $where, $what, $mailbox, $color, $pos, $search_all, $count_all); + sqimap_search($imapConnection, $where, $what, $mailbox, $color, 0, $search_all, $count_all); } } -// must have search terms to search +// must have search terms to search -if ($submit == "Search" && empty($what)) { +if ($submit == 'Search' && empty($what)) { echo "
Please enter something to search for
\n"; } -- 2.25.1