Przeglądaj źródła

Fixes for minor bugs pointed out by Tyler Akins.
These were found because Tyler has error_reporting set to E_ALL.
To all developers: *please TURN E_ALL ON* to prevent these!

Thijs Kinkhorst 22 lat temu
rodzic
commit
4f552ee17e

+ 3 - 1
functions/file_prefs.php

@@ -49,7 +49,9 @@ function cachePrefValues($data_dir, $username) {
     /* Read in the preferences. */
     /* Read in the preferences. */
     $highlight_num = 0;
     $highlight_num = 0;
     while (! feof($file)) {
     while (! feof($file)) {
-        $pref = trim(fgets($file, 1024));
+        // Make sure that this fgets is larger than any of the pref strings
+        // could ever be.  1024 is too short
+        $pref = trim(fgets($file, 65536));
         $equalsAt = strpos($pref, '=');
         $equalsAt = strpos($pref, '=');
         if ($equalsAt > 0) {
         if ($equalsAt > 0) {
             $key = substr($pref, 0, $equalsAt);
             $key = substr($pref, 0, $equalsAt);

+ 1 - 1
functions/mailbox_display.php

@@ -118,7 +118,7 @@ function printMessageInfo($imapConnection, $t, $not_last=true, $key, $mailbox,
     * AAAAH! Make my eyes stop bleeding!
     * AAAAH! Make my eyes stop bleeding!
     * Who wrote this?!
     * Who wrote this?!
     */
     */
-    if (sizeof($message_highlight_list)){
+    if (is_array($message_highlight_list) && count($message_highlight_list)){
         foreach ($message_highlight_list as $message_highlight_list_part) {
         foreach ($message_highlight_list as $message_highlight_list_part) {
             if (trim($message_highlight_list_part['value']) != '') {
             if (trim($message_highlight_list_part['value']) != '') {
                 $high_val   = strtolower($message_highlight_list_part['value']);
                 $high_val   = strtolower($message_highlight_list_part['value']);

+ 1 - 1
include/load_prefs.php

@@ -174,7 +174,7 @@ if( $ser = getPref($data_dir, $username, 'hililist') ) {
         $message_highlight_list[$i]['color'] = $highlight_array[1];
         $message_highlight_list[$i]['color'] = $highlight_array[1];
         $message_highlight_list[$i]['value'] = $highlight_array[2];
         $message_highlight_list[$i]['value'] = $highlight_array[2];
         $message_highlight_list[$i]['match_type'] = $highlight_array[3];
         $message_highlight_list[$i]['match_type'] = $highlight_array[3];
-        removePref($data_dir, $user_name, "highlight$i");
+        removePref($data_dir, $username, "highlight$i");
     }
     }
     /* store in new format for the next time */
     /* store in new format for the next time */
     setPref($data_dir, $username, 'hililist', serialize($message_highlight_list));
     setPref($data_dir, $username, 'hililist', serialize($message_highlight_list));

+ 9 - 5
plugins/abook_take/setup.php

@@ -61,7 +61,7 @@ function abook_take_read_array($array)
   $i = 0;
   $i = 0;
   while ($i < count($array))
   while ($i < count($array))
   {
   {
-    abook_take_read_string($array[$i]);
+    abook_take_read_string($array[$i]->getAddress());
     $i ++;
     $i ++;
   }
   }
 }
 }
@@ -83,10 +83,14 @@ function abook_take_read()
                   html_tag( 'tr' ) .
                   html_tag( 'tr' ) .
                       html_tag( 'td' );
                       html_tag( 'td' );
 
 
-              abook_take_read_string($message->header->from);
-              abook_take_read_array($message->header->cc);
-              abook_take_read_array($message->header->reply_to);
-              abook_take_read_array($message->header->to);
+              if (isset($message->rfc822_header->from))
+                  abook_take_read_array($message->rfc822_header->from);
+              if (isset($message->rfc822_header->cc))
+                  abook_take_read_array($message->rfc822_header->cc);
+              if (isset($message->rfc822_header->reply_to))
+                  abook_take_read_array($message->rfc822_header->reply_to);
+              if (isset($message->rfc822_header->to))
+                  abook_take_read_array($message->rfc822_header->to);
 
 
 
 
               $new_body = $body;
               $new_body = $body;

+ 2 - 2
themes/darkness.php

@@ -38,8 +38,8 @@ function Darkness_HeaderPlugin() {
    global $PHP_SELF, $Darkness_Transition;
    global $PHP_SELF, $Darkness_Transition;
    
    
    if (substr($PHP_SELF, -18) == '/src/left_main.php') {
    if (substr($PHP_SELF, -18) == '/src/left_main.php') {
-      echo '<meta http-equiv='Page-Enter' content='' .
-         'blendTrans(Duration=2.0)'>' . '\n';
+      echo '<meta http-equiv="Page-Enter" content="' .
+         'blendTrans(Duration=2.0)">' . '\n';
    }
    }
 	 
 	 
 ?><script language=javascript>
 ?><script language=javascript>