The 2000000 bugfix
authorphilippe_mingo <philippe_mingo@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Sat, 2 Feb 2002 02:17:05 +0000 (02:17 +0000)
committerphilippe_mingo <philippe_mingo@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Sat, 2 Feb 2002 02:17:05 +0000 (02:17 +0000)
------------------

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

20 files changed:
functions/auth.php
functions/i18n.php
functions/mailbox_display.php
functions/mime.php
functions/options.php
functions/prefs.php
functions/strings.php
plugins/administrator/defines.php
plugins/administrator/options.php
plugins/calendar/calendar.php
plugins/calendar/calendar_data.php
plugins/calendar/day.php
plugins/calendar/event_create.php
plugins/sent_subfolders/setup.php
plugins/squirrelspell/sqspell_interface.php
plugins/squirrelspell/sqspell_options.php
plugins/translate/options.php
src/options.php
src/right_main.php
src/search.php

index 309a47c944e8ceaec8f6f1dfe6737dec1ad9c064..dde3147547b482272b47d88e883b83d34d2d93ba 100644 (file)
 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 "<body bgcolor=\"ffffff\">\n" .
          '<br><br><center><b>' .
          _("You must be logged in to access this page.").'</b><br><br>' .
-         "<a href=\"../src/login.php\" target=\"$frame_top\">"._("Go to the login page")."</a>\n" .
+         "<a href=\"$base_uri/src/login.php\" target=\"$frame_top\">"._("Go to the login page")."</a>\n" .
          "</center></body></html>\n";
     exit;
 }
index 9835efc6ca7fc97233113f94eff6e3a9517c9722..01f90a2cb9418c709fc654a91f71a9fcab7691fc 100644 (file)
@@ -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;
index d2b02e3ded4f999a57f7c421f038c5d73277356f..cffa030acc37ac58d81dc60732a17645bc2af0f4 100644 (file)
@@ -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];
         }
     }
index a1394a6647e2c632e9f20043219e0024de0f7c86..7ff842357e223f25839d7b43a6df25d15d0fb9b0 100644 (file)
@@ -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 {
index b0f5ee0b0c9a94621df04fc3a73e307039fd17ca..834ef3a1272ca39a72df2f58de3de0ca52c866a0 100644 (file)
@@ -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 = "<INPUT NAME=\"new_$this->name\" VALUE=\"$this->value\" SIZE=\"$width\">";
index 74c7848f237f7601d0cd7e6d4597d29ff07abe43..5d2b38fe52471ca8a38512d1ce48bca7a0bc131b 100644 (file)
  * $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');
 }
    
 /**
index 26f07d1aad48324de3cce821b66f52081da493fa..4481bd6ba5643f53cff2b3dafc25b5cb973084dc 100644 (file)
@@ -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, '&gt;', $pos) === $pos) {
index c9abb7fbf03872f654cffe4a92981eee6a3b7111..43b946e6daed4b71c5ea5802ca2cebdd617f866d 100644 (file)
@@ -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 )
                  /* --------------------------------------------------------*/
 
                );
index 2bab41ceed40e7d387339aa4c7ccfc1b1b4cfbab..27a778815babee96966136175bfc2898a5300a16 100644 (file)
@@ -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 "<form action=options.php method=post>" .
+echo "<form action=options.php method=post name=options>" .
     "<br><center><table width=95% bgcolor=\"$color[5]\"><tr><td>".
     "<table width=100% cellspacing=0 bgcolor=\"$color[4]\">" ,
     "<tr bgcolor=\"$color[5]\"><th colspan=2>" . _("Configuration Administrator") . "</th></tr>";
@@ -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 "<tr><td>$name</td><td><b>" .
+                 $defcfg[$k]['value'] .
+                 "</b></td></tr>";
+            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 '<tr><th>' . _("Theme Name") .
          '</th><th>' . _("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 "<tr bgcolor=\"$color[0]\"><th colspan=2>" .
      "<a href=options.php?switch=Group8 STYLE=\"text-decoration:none\"><b>$sw</b> </a>" .
      _("Plugins") . '</th></tr>';
 
-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 '<tr>' .
              "<td>$plg</td><td><input$sw type=checkbox name=plgs_$plg></td>".
-             '</tr>';
+             "</tr>\n";
     }
     echo '</td></tr></table>';
 
@@ -471,7 +489,8 @@ fwrite( $fp, "<?PHP\n".
             "/**\n".
             " * SquirrelMail Configuration File\n".
             " * Created using the Administrator Plugin\n".
-            " */\n" );
+            " */\n".
+            "GLOBAL \$version;\n" );
 
 /*
 fwrite( $fp, 'GLOBAL ' );
index 1c03cb6f6ee1139c0452572b6bf197373eb470bd..013215bf028b5eace641f94ff63d90ea5ddf3a17 100644 (file)
@@ -32,6 +32,7 @@ function startcalendar() {
     $next_month = date( 'm', $next_date);
     $prev_year = date( 'Y', $prev_date);
     $next_year = date( 'Y', $next_date );
+    $self = 'calendar.php';
 
     echo "<TR BGCOLOR=\"$color[0]\"><TD>" .
          "<TABLE WIDTH=100% BORDER=0 CELLPADDING=2 CELLSPACING=1 BGCOLOR=\"$color[0]\">" .
@@ -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) ? "<FONT COLOR=\"$color[1]\">$calbar[title]</FONT><br>\n" : "$calbar[title]<br>\n";
+                    $calbar = $calendardata[$cdate][$calfoo['key']];
+                    echo ($calbar['priority']==1) ? "<FONT COLOR=\"$color[1]\">$calbar[title]</FONT><br>\n" : "$calbar[title]<br>\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' );
 }
 
index 8bf3d65e448f1701c5d66f555413d49370e1a603..7a2a455aacc4e5194653f7d4ad6d848c143ff961 100644 (file)
@@ -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);
             }
index d0d72f65eb9e005fe8bc7b98fe72043123e3d54c..36ae7171bb6acbf8e26cb4c7d645c11d02e84590 100644 (file)
@@ -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 "         <TR BGCOLOR=\"$color[$eo]\"><TD>$ehour:$eminute</TD>\n" .
                  "              <TD>&nbsp;</TD>\n" .
-                 "              <TD ALIGN=CENTER><FONT SIZE=-1><A HREF=\"event_create.php?year=$year&month=$month&day=$day&hour=".substr($calfoo[key],0,2)."\">".
+                 "              <TD ALIGN=CENTER><FONT SIZE=-1><A HREF=\"event_create.php?year=$year&month=$month&day=$day&hour=".substr($calfoo['key'],0,2)."\">".
                  _("ADD") . "</A></FONT></TD></TR>\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 "         <TR BGCOLOR=\"$color[$eo]\"><TD>$ehour:$eminute$elength</TD>\n" .
                  "              <TD>[";
-            echo ($calbar[priority]==1) ? "<FONT COLOR=\"$color[1]\">$calbar[title]</FONT>" : "$calbar[title]";
+            echo ($calbar['priority']==1) ? "<FONT COLOR=\"$color[1]\">$calbar[title]</FONT>" : "$calbar[title]";
             echo"] $calbar[message]&nbsp;</TD>\n" .
                  "              <TD ALIGN=CENTER><FONT SIZE=-1><nobr>\n" .
-                 "<A HREF=\"event_edit.php?year=$year&month=$month&day=$day&hour=".substr($calfoo[key],0,2)."&minute=".substr($calfoo[key],2,2)."\">".
+                 "<A HREF=\"event_edit.php?year=$year&month=$month&day=$day&hour=".substr($calfoo['key'],0,2)."&minute=".substr($calfoo['key'],2,2)."\">".
                  _("EDIT") . "</A>&nbsp;|&nbsp;\n" .
-                 "<A HREF=\"event_delete.php?dyear=$year&dmonth=$month&dday=$day&dhour=".substr($calfoo[key],0,2)."&dminute=".substr($calfoo[key],2,2)."&year=$year&month=$month&day=$day\">" .
+                 "<A HREF=\"event_delete.php?dyear=$year&dmonth=$month&dday=$day&dhour=".substr($calfoo['key'],0,2)."&dminute=".substr($calfoo['key'],2,2)."&year=$year&month=$month&day=$day\">" .
                  _("DEL") . '</A>' .
                  "              </nobr></FONT></TD></TR>\n";
     }
-    $i++;
 }
 
 
index 57b30ed623e4bbd0ff6dac5bb2f9deac9a78504b..72386ae9445a42720c84319d24d7e0580146211c 100644 (file)
@@ -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 "  <TABLE BORDER=0 CELLPADDING=2 CELLSPACING=1 BGCOLOR=\"$color[0]\">\n".
index a2565c66aae591f8bbff3371602b8ca7ec64e931..c620191a450e850c77836afd5b5bbe969dfd8e8b 100644 (file)
@@ -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);
index 1357162e17979e7e0c49d1f28431e22fbfc270ce..6ea1f0d94ca6c785417518c9f37ee1caa9651b23 100644 (file)
@@ -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);
index 1a7eba5b30f2ea93a1d28246685ba3957dd063d3..b6d9ba506af8cd561a118df25b69625c2863d492 100644 (file)
@@ -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);
index 5ba38e730ef2217264222370ef935bbe644280a3..64c99843eb769f21b96567c248c73023a8b86f39 100644 (file)
@@ -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 {
index 9744c99ac6d464033d1f8a7698c92c0796bd85f3..8e11f1b5cc3a469fb1d6e6daa5609c9ff6f86cc8 100644 (file)
@@ -235,7 +235,8 @@ if ($optpage == SMOPT_PAGE_MAIN) {
         echo '<B>' . _("Successfully Saved Options") . ": $optpage_name</B><BR>\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 '<A HREF="../src/left_main.php" TARGET="left">' . _("Refresh Folder List") . '</A><BR>';
         } else if ($max_refresh) {
             echo '<A HREF="../src/webmail.php?right_frame=options.php" TARGET="' . $frame_top . '">' . _("Refresh Page") . '</A><BR>';
index 07492d1a1d4db104f4939c001f39ca8f37e96f37..3aa7c944bb2bc652affdcb2dcdb231572034dc83 100644 (file)
@@ -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);
index 00c46a79fd279ccbd45b38baddd5da2c956b125a..cfd3c425e5807d8491d81f7c172f56ac286c12d9 100644 (file)
@@ -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 "<BR>\n".
-     "      <table width=\"100%\">\n".
-     "      <TR><td bgcolor=\"$color[0]\">\n".
-     "          <CENTER><B>"._("Search")."</B></CENTER>\n".
-     "      </TD></TR>\n".
-        "              </TABLE>\n";
-#     '      <TR><td align=center>';
+     "<table width=\"100%\">\n".
+        "<TR><td bgcolor=\"$color[0]\">\n".
+            "<CENTER><B>" . _("Search") . "</B></CENTER>\n".
+        "</TD></TR>\n".
+     "</TABLE>\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 "<BR>\n"
-       . "<TABLE WIDTH=\"95%\" BGCOLOR=\"$color[9]\" ALIGN=\"CENTER\" CELLPADDING=1 CELLSPACING=1>"
-       . '<TR><TD align=center><B>Saved Searches</B></TD></TR><TR><TD>'
-       . '<TABLE WIDTH="100%" ALIGN="CENTER" CELLPADDING=0 CELLSPACING=0>';
+    . "<TABLE WIDTH=\"95%\" BGCOLOR=\"$color[9]\" ALIGN=\"CENTER\" CELLPADDING=1 CELLSPACING=1>"
+    . '<TR><TD align=center><B>Saved Searches</B></TD></TR><TR><TD>'
+    . '<TABLE WIDTH="100%" ALIGN="CENTER" CELLPADDING=0 CELLSPACING=0>';
     for ($i=0; $i < $saved_count; ++$i) {
-               if ($i % 2) {
-                       echo "<TR BGCOLOR=\"$color[0]\">";
-               } else {
+        if ($i % 2) {
+            echo "<TR BGCOLOR=\"$color[0]\">";
+        } else {
             echo "<TR BGCOLOR=\"$color[4]\">";
         }
         echo "<TD WIDTH=\"35%\">$saved_folder_array[$i]</TD>"
-           . "<TD ALIGN=LEFT>$saved_what_array[$i]</TD>"
-           . "<TD ALIGN=CENTER>$saved_where_array[$i]</TD>"
-           . '<TD ALIGN=RIGHT>'
-           .   '<A HREF=search.php'
-              .     '?mailbox=' . urlencode($saved_folder_array[$i])
-              .     '&what=' . urlencode($saved_what_array[$i])
-              .     '&where=' . urlencode($saved_where_array[$i])
-              .   '>' . _("edit") . '</A>'
-              .   '&nbsp;|&nbsp;'
-           .   '<A HREF=search.php'
-              .     '?mailbox=' . urlencode($saved_folder_array[$i])
-              .     '&what=' . urlencode($saved_what_array[$i])
-              .     '&where=' . urlencode($saved_where_array[$i])
-              .     '&submit=Search_no_update'
-           .   '>' . _("search") . '</A>'
-              .   '&nbsp;|&nbsp;'
-              .   "<A HREF=search.php?count=$i&submit=delete>"
-           .     _("delete")
-           .   '</A>'
-              . '</TD></TR>';
+        . "<TD ALIGN=LEFT>$saved_what_array[$i]</TD>"
+        . "<TD ALIGN=CENTER>$saved_where_array[$i]</TD>"
+        . '<TD ALIGN=RIGHT>'
+        .   '<A HREF=search.php'
+        .     '?mailbox=' . urlencode($saved_folder_array[$i])
+        .     '&what=' . urlencode($saved_what_array[$i])
+        .     '&where=' . urlencode($saved_where_array[$i])
+        .   '>' . _("edit") . '</A>'
+        .   '&nbsp;|&nbsp;'
+        .   '<A HREF=search.php'
+        .     '?mailbox=' . urlencode($saved_folder_array[$i])
+        .     '&what=' . urlencode($saved_what_array[$i])
+        .     '&where=' . urlencode($saved_where_array[$i])
+        .     '&submit=Search_no_update'
+        .   '>' . _("search") . '</A>'
+        .   '&nbsp;|&nbsp;'
+        .   "<A HREF=search.php?count=$i&submit=delete>"
+        .     _("delete")
+        .   '</A>'
+        . '</TD></TR>';
     }
     echo "</TABLE></TD></TR></TABLE>\n";
 }
@@ -300,7 +301,7 @@ for ($i = 0; $i < count($boxes); $i++) {
         }
         else {
             echo "         <OPTION VALUE=\"$box\">$box2</OPTION>\n";
-        }  
+        }
     }
 }
         echo "<OPTION VALUE=\"All Folders\"";
@@ -311,6 +312,9 @@ for ($i = 0; $i < count($boxes); $i++) {
 echo '         </SELECT>'.
      "       </TD>\n".
      "        <TD ALIGN=\"CENTER\">\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 "         </SELECT>\n" .
      "</TD></TR></TABLE>\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 "<BR><CENTER><B>Search Results</B><CENTER><BR>\n";
+    echo '<BR><CENTER><B>' .
+         _("Search Results") .
+         "</B><CENTER><BR>\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 '<br><b>' .
+             _("No Messages found") .
+             '</b><br>';
     }
-       if ($count_all == 0) {
-       echo "<br><b>No Messages found</b><br>";
-       }
 }
 
-//     search one folder option
+//  search one folder option
 
 else {
-    if (($submit == "Search" || $submit == "Search_no_update") && !empty($what)) {
-        echo "<BR><CENTER><B>Search Results</B></CENTER>\n";
+    if (($submit == 'Search' || $submit == 'Search_no_update') && !empty($what)) {
+        echo '<BR><CENTER><B>' .
+             _("Search Results") .
+             "</B></CENTER>\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 "<BR><CENTER><B>Please enter something to search for</B></CENTER>\n";
 }