Prechádzať zdrojové kódy

- did decodeHeader on to_ary and cc_ary
- removed requirements for subject and body of message (by request
from the list a while ago)
- fixed some language problems in help.php
- fixed some bugs with saving sent and trash folders in prefs
- let the searched results use message highlighting

Luke Ehresman 25 rokov pred
rodič
commit
edb75abb23
5 zmenil súbory, kde vykonal 30 pridanie a 26 odobranie
  1. 16 6
      functions/imap_search.php
  2. 1 5
      src/compose.php
  3. 6 8
      src/help.php
  4. 4 4
      src/options.php
  5. 3 3
      src/read_body.php

+ 16 - 6
functions/imap_search.php

@@ -13,8 +13,10 @@
    if (!isset($mime_php))
       include("../functions/mime.php");
 
+   $imap_search_php = true;
+
 function sqimap_search($imapConnection,$search_where,$search_what,$mailbox,$color) {
-   global $msgs;
+   global $msgs, $message_highlight_list;
    $urlMailbox = urlencode($mailbox);
    
    # Construct the Search QuERY
@@ -55,9 +57,13 @@ function sqimap_search($imapConnection,$search_where,$search_what,$mailbox,$colo
          $hdr = sqimap_get_small_header ($imapConnection, $messagelist[$q], true);
       else
          $hdr = sqimap_get_small_header ($imapConnection, $messagelist[$q], false);
-         $from[$q] = $hdr->from;
-         $date[$q] = $hdr->date;
-         $subject[$q] = $hdr->subject;
+						
+			$from[$q] = $hdr->from;
+			$date[$q] = $hdr->date;
+			$subject[$q] = $hdr->subject;
+         $to[$q] = $hdr->to;
+         $priority[$q] = $hdr->priority;
+         $cc[$q] = $hdr->cc;
          $id[$q] = $messagelist[$q];
 
          $flags[$q] = sqimap_get_flags ($imapConnection, $messagelist[$q]);
@@ -70,9 +76,14 @@ function sqimap_search($imapConnection,$search_where,$search_what,$mailbox,$colo
 
          $messages[$j]["TIME_STAMP"] = getTimeStamp($tmpdate);
          $messages[$j]["DATE_STRING"] = getDateString($messages[$j]["TIME_STAMP"]);
-         $messages[$j]["ID"] = $id[$j]; 
+         $messages[$j]["ID"] = $id[$j];
          $messages[$j]["FROM"] = decodeHeader($from[$j]);
+         $messages[$j]["FROM-SORT"] = strtolower(sqimap_find_displayable_name(decodeHeader($from[$j])));
          $messages[$j]["SUBJECT"] = decodeHeader($subject[$j]);
+         $messages[$j]["SUBJECT-SORT"] = strtolower(decodeHeader($subject[$j]));
+         $messages[$j]["TO"] = decodeHeader($to[$j]);
+			$messages[$j]["PRIORITY"] = $priority[$j];
+         $messages[$j]["CC"] = $cc[$j];
 
          $num = 0;
          while ($num < count($flags[$j])) {
@@ -166,7 +177,6 @@ function sqimap_search($imapConnection,$search_where,$search_what,$mailbox,$colo
  
          while ($j < count($msgs)) {
             printMessageInfo($imapConnection, $msgs[$j]["ID"], 0, $j, $mailbox, "", 0, $search_where, $search_what);
-            //echo $msgs[$j]["SUBJECT"]."<br>";
             $j++;
          }
          echo "</table>";

+ 1 - 5
src/compose.php

@@ -285,11 +285,7 @@
           error message, show=true **/
       global $body, $send_to, $subject, $color;
 
-      if ($body == "" && $subject == "") {
-         if ($show)
-            plain_error_message(_("You have not entered a message body or a subject."), $color);
-         return false;
-      } else if ($send_to == "") {
+      if ($send_to == "") {
          if ($show)
             plain_error_message(_("You have not filled in the \"To:\" field."), $color);
          return false;

+ 6 - 8
src/help.php

@@ -28,11 +28,6 @@
    if (!isset($auth_php))
       include ("../functions/auth.php"); 
 
-   if ($language) {
-      setcookie("squirrelmail_language", $language, time()+2592000);
-      $squirrelmail_language = $language;
-   }   
-
    include("../src/load_prefs.php");
    displayPageHeader($color, "None");
    is_logged_in(); 
@@ -47,6 +42,10 @@
 	$helpdir[7] = "FAQ.hlp";
 
    /****************[ HELP FUNCTIONS ]********************/
+   // parses through and gets the information from the different documents.  
+   // this returns one section at a time.  You must keep track of the position
+   // so that it knows where to start to look for the next section.
+
    function get_info($doc, $pos) {
       for ($n=$pos; $n < count($doc); $n++) {
          if (trim(strtolower($doc[$n])) == "<chapter>" || trim(strtolower($doc[$n])) == "<section>") {
@@ -111,13 +110,12 @@
          $context = "read"; 
    }
    
-   if (file_exists("../help/$user_language")) {
+   if (file_exists("../help/$squirrelmail_language")) {
       $help_exists = true;
-      $user_language = $user_language;
    } else if (file_exists("../help/en")) {
       $help_exists = true;
       echo "<center><font color=\"$color[2]\">";
-      echo _("The help has not been translated to your preferred language.  It will be displayed in English instead.");
+      printf (_("The help has not been translated to %s.  It will be displayed in English instead."), $languages[$squirrelmail_language]["NAME"]);
       echo "</font></center><br>";
       $user_language = "en";
    } else {

+ 4 - 4
src/options.php

@@ -74,15 +74,15 @@
          setPref($data_dir, $username, "move_to_trash", true);
          setPref($data_dir, $username, "trash_folder", $trash);
       } else {
-         setPref($data_dir, $username, "move_to_trash", false);
-         setPref($data_dir, $username, "trash_folder", "");
+         setPref($data_dir, $username, "move_to_trash", "0");
+         setPref($data_dir, $username, "trash_folder", "none");
       }
       if ($sent != "none") {
          setPref($data_dir, $username, "move_to_sent", true);
          setPref($data_dir, $username, "sent_folder", $sent);
       } else {
-         setPref($data_dir, $username, "move_to_sent", false);
-         setPref($data_dir, $username, "sent_folder", "");
+         setPref($data_dir, $username, "move_to_sent", "0");
+         setPref($data_dir, $username, "sent_folder", "none");
       } 
       setPref($data_dir, $username, "folder_prefix", $folderprefix);
       setPref($data_dir, $username, "unseen_notify", $unseennotify);

+ 3 - 3
src/read_body.php

@@ -135,7 +135,7 @@
    $to_string = "";
    $to_ary = $message->header->to;
    while ($i < count($to_ary)) {
-      $to_ary[$i] = htmlspecialchars($to_ary[$i]);
+      $to_ary[$i] = htmlspecialchars(decodeHeader($to_ary[$i]));
 
       if ($to_string)
          $to_string = "$to_string<BR>$to_ary[$i]";
@@ -169,7 +169,7 @@
    $i = 0;
    $cc_string = "";
    $cc_ary = $message->header->cc;
-   while ($i < count($cc_ary)) {
+   while ($i < count(decodeHeader($cc_ary))) {
       $cc_ary[$i] = htmlspecialchars($cc_ary[$i]);
       if ($cc_string)
          $cc_string = "$cc_string<BR>$cc_ary[$i]";
@@ -218,7 +218,7 @@
    echo _("Message List");
    echo "</A>&nbsp;|&nbsp;";
    if ($where && $what) {
-      echo "               <A HREF=\"delete_message.php?mailbox=$urlMailbox&message=$passed_id&sort=$sort&startMessage=1&where=".urlencode($where)."&what=".urlencode($what)."\">";
+      echo "               <A HREF=\"delete_message.php?mailbox=$urlMailbox&message=$passed_id&where=".urlencode($where)."&what=".urlencode($what)."\">";
    } else {
       echo "               <A HREF=\"delete_message.php?mailbox=$urlMailbox&message=$passed_id&sort=$sort&startMessage=1\">";
    }