- fixed bug when deleting last message, sends you to previous list
authorlkehresman <lkehresman@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Mon, 31 Jul 2000 14:24:37 +0000 (14:24 +0000)
committerlkehresman <lkehresman@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Mon, 31 Jul 2000 14:24:37 +0000 (14:24 +0000)
- fixed bug about translate_text missing an argument
- added functionality in conf.pl to detect themes
- fixed a number of <? to be <?php

git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@656 7612ce4b-ef26-0410-bec9-ea0150e637f0

config/conf.pl
functions/mailbox_display.php
functions/strings.php
src/compose.php
src/download.php
src/help.php
src/options.php
src/options_display.php
src/options_highlight.php
src/options_personal.php

index 6cb6038f64738739447f7f333d33f57c169f3b0b..2d6e34d740f486ae7f197533e0234aa92dfb059f 100755 (executable)
@@ -1155,8 +1155,60 @@ sub command41 {
                $theme_default--;
             }   
          }
                $theme_default--;
             }   
          }
+      } elsif ($input =~ /^\s*t\s*/i) {
+         print "\nStarting detection...\n\n";
+         
+         opendir(DIR, "../themes");
+         @files = grep { /\.php$/i } readdir(DIR);
+         $cnt = 0;
+         while ($cnt <= $#files) {
+            $filename = "../themes/" . $files[$cnt];
+            $found = 0;
+            for ($x=0; $x <= $#theme_path; $x++) {
+               if ($theme_path[$x] eq $filename) {
+                  $found = 1;
+               }
+            }
+            if ($found != 1) {
+               print "** Found theme: $filename\n";
+               print "   What is its name? ";
+               $nm = <STDIN>;
+               $nm =~ s/[\n|\r]//g;
+               $theme_name[$#theme_name+1] = $nm;
+               $theme_path[$#theme_path+1] = $filename;
+            }
+            $cnt++;
+         }
+         print "\n";
+         for ($cnt=0; $cnt <= $#theme_path; $cnt++) {
+            $filename = $theme_path[$cnt];
+            if (! (-e $filename)) {
+               print "  Removing $filename (file not found)\n";
+               $offset = 0;
+               @new_theme_name = ();
+               @new_theme_path = ();
+               for ($x=0; $x < $#theme_path; $x++) {
+                  if ($theme_path[$x] eq $filename) {
+                     $offset = 1;
+                  }
+                  if ($offset == 1) {
+                     $new_theme_name[$x] = $theme_name[$x+1];
+                     $new_theme_path[$x] = $theme_path[$x+1];
+                  } else {
+                     $new_theme_name[$x] = $theme_name[$x];
+                     $new_theme_path[$x] = $theme_path[$x];
+                  }
+               }
+               @theme_name = @new_theme_name;
+               @theme_path = @new_theme_path;
+            }
+         }
+         print "\nDetection complete!\n\n";
+         
+         closedir DIR;  
       } elsif ($input =~ /^\s*\?\s*/) {
          print ".-------------------------.\n";
       } elsif ($input =~ /^\s*\?\s*/) {
          print ".-------------------------.\n";
+         print "| t       (detect themes) |\n";
          print "| +           (add theme) |\n";
          print "| - N      (remove theme) |\n";
          print "| m N      (mark default) |\n";
          print "| +           (add theme) |\n";
          print "| - N      (remove theme) |\n";
          print "| m N      (mark default) |\n";
index e30254534dfc5a0a9f4b4adc8824238ceb11845c..ac5ba8e47e86dc2cb2626fb060a7ecbccd31f0e1 100644 (file)
       global $folder_prefix, $sent_folder;
                global $imapServerAddress;
 
       global $folder_prefix, $sent_folder;
                global $imapServerAddress;
 
-      // do a check to see if the config stuff has already been included or not
-//      if (!isset($imapServerAddress))
-//         include("../config/config.php");
-
       // if cache isn't already set, do it now
       if (!session_is_registered("msgs"))
          session_register("msgs");
       if (!session_is_registered("msort"))
          session_register("msort");
 
       // if cache isn't already set, do it now
       if (!session_is_registered("msgs"))
          session_register("msgs");
       if (!session_is_registered("msort"))
          session_register("msort");
 
+
       if ($startMessage + ($show_num - 1) < $numMessages) {
          $endMessage = $startMessage + ($show_num-1);
       } else {
          $endMessage = $numMessages;
       }
 
       if ($startMessage + ($show_num - 1) < $numMessages) {
          $endMessage = $startMessage + ($show_num-1);
       } else {
          $endMessage = $numMessages;
       }
 
+      
+      if ($endMessage < $startMessage) {
+         $startMessage = $startMessage - $show_num;
+         if ($startMessage < 1)
+            $startMessage = 1;
+      }
+      
       $nextGroup = $startMessage + $show_num;
       $prevGroup = $startMessage - $show_num;
       $urlMailbox = urlencode($mailbox);
       $nextGroup = $startMessage + $show_num;
       $prevGroup = $startMessage - $show_num;
       $urlMailbox = urlencode($mailbox);
index 05e155fb062d04db7bb1b1b3e3f8e6ef338ce90a..7906d1385ad4c2186ece26a70649d993a1e81105 100644 (file)
    }
 
    function translateText($body, $wrap_at, $charset) {
    }
 
    function translateText($body, $wrap_at, $charset) {
-      include ("../functions/url_parser.php");
-      /** Add any parsing you want to in here */
+      if (!isset($url_parser_php)) {
+         include "../functions/url_parser.php";
+      }
+      
       $body_ary = explode("\n", $body);
       $body_ary = explode("\n", $body);
-
-      for ($i = 0; $i < count($body_ary); $i++) {
+      for ($i=0; $i < count($body_ary); $i++) {
          $line = $body_ary[$i];
          $line = $body_ary[$i];
-         $line = "^^$line";
-
-         //$line = str_replace(">", "&gt;", $line);
-         //$line = str_replace("<", "&lt;", $line);
-         //$line = htmlspecialchars($line);
-
-         if (strlen($line) >= $wrap_at) // -2 because of the ^^ at the beginning
-            $line = wordWrap($line, $wrap_at);
-
          $line = charset_decode($charset, $line);
          $line = charset_decode($charset, $line);
-
+         
          $line = str_replace(" ", "&nbsp;", $line);
          $line = str_replace("\t", "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;", $line);
          $line = nl2br($line);
 
          $line = str_replace(" ", "&nbsp;", $line);
          $line = str_replace("\t", "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;", $line);
          $line = nl2br($line);
 
+         $line = parseEmail ($line);
+         $line = parseUrl ($line);
+
+         $line = "^^$line"; // gotta do this because if not, strpos() returns 0 
+                            // which in PHP is the same as false.  Now it returns 2
          if (strpos(trim(str_replace("&nbsp;", "", $line)), "&gt;&gt;") == 2) {
          if (strpos(trim(str_replace("&nbsp;", "", $line)), "&gt;&gt;") == 2) {
-            $line = substr($line, 2, strlen($line));
-            $line = "<TT><FONT COLOR=FF0000>$line</FONT></TT><BR>\n";
+            $line = substr($line, 2);
+            $line = "<FONT COLOR=FF0000>$line</FONT>\n";
          } else if (strpos(trim(str_replace("&nbsp;", "", $line)), "&gt;") == 2) {
          } else if (strpos(trim(str_replace("&nbsp;", "", $line)), "&gt;") == 2) {
-            $line = substr($line, 2, strlen($line));
-            $line = "<TT><FONT COLOR=800000>$line</FONT></TT><BR>\n";
+            $line = substr($line, 2);
+            $line = "<FONT COLOR=800000>$line</FONT>\n";
          } else {
          } else {
-            $line = substr($line, 2, strlen($line));
-            $line = "<TT><FONT COLOR=000000>$line</FONT></TT><BR>\n";
-         }
-
-         $line = parseEmail ($line);
-         $line = parseUrl ($line);
-         $new_body[$i] = "$line";
+            $line = substr($line, 2);
+         } 
+         
+         $body_ary[$i] = "<tt>$line</tt><br>";
       }
       }
-      $bdy = implode("\n", $new_body);
-      return $bdy;
+      $body = implode("\n", $body_ary);
+      
+      return $body;
    }
 
    /* SquirrelMail version number -- DO NOT CHANGE */
    }
 
    /* SquirrelMail version number -- DO NOT CHANGE */
index 9c8acbaa8d23817794c735e1f65bd9375c66c853..1fc27a8dccb8a0cd46052f3393b5bdae00003ffa 100644 (file)
          echo "// --></SCRIPT>\n\n";
       }
 
          echo "// --></SCRIPT>\n\n";
       }
 
-      echo "\n<FORM name=compose action=\"compose.php\" METHOD=POST ENCTYPE=\"multipart/form-data\">\n";
+      //echo "\n<FORM name=compose action=\"compose.php\" METHOD=POST ENCTYPE=\"multipart/form-data\">\n";
+      echo "\n<FORM name=compose action=\"compose.php\" METHOD=POST>\n";
       if ($reply_id) {
          echo "<input type=hidden name=reply_id value=$reply_id>\n";
       }                 
       if ($reply_id) {
          echo "<input type=hidden name=reply_id value=$reply_id>\n";
       }                 
index ef6df67eee2727104066367bf862dae8ee6f5dcf..bb7adb366c16b47cdcfd376184ad5da3ee1cd331 100644 (file)
@@ -25,7 +25,7 @@
    include("../src/load_prefs.php");
 
    function viewText($color, $body, $id, $entid, $mailbox, $type1, $wrap_at) {
    include("../src/load_prefs.php");
 
    function viewText($color, $body, $id, $entid, $mailbox, $type1, $wrap_at) {
-      global $where, $what;
+      global $where, $what, $charset;
       displayPageHeader($color, "None");
 
       echo "<BR><TABLE WIDTH=90% BORDER=0 CELLSPACING=0 CELLPADDING=2 ALIGN=CENTER><TR><TD BGCOLOR=\"$color[0]\">";
       displayPageHeader($color, "None");
 
       echo "<BR><TABLE WIDTH=90% BORDER=0 CELLSPACING=0 CELLPADDING=2 ALIGN=CENTER><TR><TD BGCOLOR=\"$color[0]\">";
@@ -46,7 +46,7 @@
       if ($type1 == "html")
          echo $body;
       else
       if ($type1 == "html")
          echo $body;
       else
-         echo translateText($body, $wrap_at);
+         echo translateText($body, $wrap_at, $charset);
 
       echo "</TT></TD></TR></TABLE>";
    }
 
       echo "</TT></TD></TR></TABLE>";
    }
@@ -67,6 +67,7 @@
    $header = $message->header;
    $body = mime_fetch_body($imapConnection, $passed_id, $passed_ent_id);
 
    $header = $message->header;
    $body = mime_fetch_body($imapConnection, $passed_id, $passed_ent_id);
 
+   $charset = $header->charset;
    $type0 = $header->type0;
    $type1 = $header->type1;
    $filename = decodeHeader($header->filename);
    $type0 = $header->type0;
    $type1 = $header->type1;
    $filename = decodeHeader($header->filename);
index e8c4b43cfcfaf82893867252f1d937ccb59b925a..3b1e62329ced529d5ae6519294eaabcc369d782f 100644 (file)
@@ -87,8 +87,8 @@
 
 <br>
 <table width=95% align=center cellpadding=2 cellspacing=2 border=0>
 
 <br>
 <table width=95% align=center cellpadding=2 cellspacing=2 border=0>
-<tr><td bgcolor="<? echo $color[0] ?>">
-   <center><b><? echo _("Help") ?></b></center>
+<tr><td bgcolor="<?php echo $color[0] ?>">
+   <center><b><?php echo _("Help") ?></b></center>
 </td></tr></table>
 
 
 </td></tr></table>
 
 
       }
    }
 ?>
       }
    }
 ?>
-<tr><td bgcolor="<? echo $color[0] ?>">&nbsp;</td></tr></table>
+<tr><td bgcolor="<?php echo $color[0] ?>">&nbsp;</td></tr></table>
 <td></tr></table>
 </body></html>
 <td></tr></table>
 </body></html>
index 1f7d38b33ccd78bf96db882b0ac449443a0acd29..769a48c213f4d64320f0b1c8248bddf1e170af0a 100644 (file)
    </td>
 </tr>
 </table>
    </td>
 </tr>
 </table>
-   <?
+   <?php
       do_hook("options_link_and_description")
    ?>
 </body></html>
       do_hook("options_link_and_description")
    ?>
 </body></html>
index 43333dcfc88dbead9fff53f4682db52b4b8583a8..5dabd931b86a186d5814ea4878b74bdd19d70527 100644 (file)
@@ -40,7 +40,7 @@
          <tr>
             <td align=right nowrap><?php echo _("Theme"); ?>:
             </td><td>
          <tr>
             <td align=right nowrap><?php echo _("Theme"); ?>:
             </td><td>
-<?
+<?php
    echo "         <tt><select name=chosentheme>\n";
    for ($i = 0; $i < count($theme); $i++) {
       if ($theme[$i]["PATH"] == $chosen_theme)
    echo "         <tt><select name=chosentheme>\n";
    for ($i = 0; $i < count($theme); $i++) {
       if ($theme[$i]["PATH"] == $chosen_theme)
@@ -55,7 +55,7 @@
          <tr>
             <td align=right nowrap><?php echo _("Language"); ?>:
             </td><td>
          <tr>
             <td align=right nowrap><?php echo _("Language"); ?>:
             </td><td>
-<?
+<?php
    echo "         <tt><select name=language>\n";
    reset ($languages);
    while (list($code, $name)=each($languages)) {
    echo "         <tt><select name=language>\n";
    reset ($languages);
    while (list($code, $name)=each($languages)) {
@@ -85,7 +85,7 @@
          <tr>
             <td align=right nowrap><?php echo _("Number of Messages to Index"); ?>:
             </td><td>
          <tr>
             <td align=right nowrap><?php echo _("Number of Messages to Index"); ?>:
             </td><td>
-<?
+<?php
    if (isset($show_num))
       echo "         <tt><input type=text size=5 name=shownum value=\"$show_num\"></tt><br>";
    else
    if (isset($show_num))
       echo "         <tt><input type=text size=5 name=shownum value=\"$show_num\"></tt><br>";
    else
@@ -96,7 +96,7 @@
          <tr>
             <td align=right nowrap><?php echo _("Wrap incoming text at"); ?>:
             </td><td>
          <tr>
             <td align=right nowrap><?php echo _("Wrap incoming text at"); ?>:
             </td><td>
-<?
+<?php
    if (isset($wrap_at))
       echo "         <tt><input type=text size=5 name=wrapat value=\"$wrap_at\"></tt><br>";
    else
    if (isset($wrap_at))
       echo "         <tt><input type=text size=5 name=wrapat value=\"$wrap_at\"></tt><br>";
    else
          <tr>
             <td align=right nowrap><?php echo _("Size of editor window"); ?>:
             </td><td>
          <tr>
             <td align=right nowrap><?php echo _("Size of editor window"); ?>:
             </td><td>
-<?
+<?php
    if ($editor_size >= 10 && $editor_size <= 255)
       echo "         <tt><input type=text size=5 name=editorsize value=\"$editor_size\"></tt><br>";
    else
    if ($editor_size >= 10 && $editor_size <= 255)
       echo "         <tt><input type=text size=5 name=editorsize value=\"$editor_size\"></tt><br>";
    else
          <tr>
             <td align=right nowrap><?php echo _("Width of left folder list"); ?>:
             </td><td>
          <tr>
             <td align=right nowrap><?php echo _("Width of left folder list"); ?>:
             </td><td>
-<?
+<?php
    echo "         <select name=leftsize>\n";
    if ($left_size == 100)
       echo "<option value=100 selected>100 pixels\n";
    echo "         <select name=leftsize>\n";
    if ($left_size == 100)
       echo "<option value=100 selected>100 pixels\n";
          <tr>
             <td align=right nowrap><?php echo _("Auto refresh folder list"); ?>:
             </td><td>
          <tr>
             <td align=right nowrap><?php echo _("Auto refresh folder list"); ?>:
             </td><td>
-<?
+<?php
    echo "               <SELECT name=leftrefresh>";
    if (($left_refresh == "None") || ($left_refresh == ""))
       echo "                  <OPTION VALUE=None SELECTED>None";
    echo "               <SELECT name=leftrefresh>";
    if (($left_refresh == "None") || ($left_refresh == ""))
       echo "                  <OPTION VALUE=None SELECTED>None";
index 868920b230d1d7713409feada7817093e0826c5a..c007c668cfc229e30c2c8ec6aba6b1f897703551 100644 (file)
@@ -53,7 +53,7 @@
       <center><b><?php echo _("Options") . " - " . _("Message Highlighting"); ?></b></center>
    </td></tr></table>
 
       <center><b><?php echo _("Options") . " - " . _("Message Highlighting"); ?></b></center>
    </td></tr></table>
 
-<?
+<?php
    echo "<br><center>[<a href=\"options_highlight.php?action=add\">" . _("New") . "</a>]";
    echo " - [<a href=\"options.php\">"._("Done")."</a>]</center><br>\n";
    if (count($message_highlight_list) >= 1) {
    echo "<br><center>[<a href=\"options_highlight.php?action=add\">" . _("New") . "</a>]";
    echo " - [<a href=\"options.php\">"._("Done")."</a>]</center><br>\n";
    if (count($message_highlight_list) >= 1) {
index 8d71cae2a50d863b1aa3dfca43a57365af707421..f140316fba096b906f6d49119bb6f82e3b49c1e3 100644 (file)
@@ -62,7 +62,7 @@
          <tr>
             <td align=right nowrap valign=top><br><?php echo _("Signature"); ?>:
             </td><td>
          <tr>
             <td align=right nowrap valign=top><br><?php echo _("Signature"); ?>:
             </td><td>
-<?
+<?php
    if ($use_signature == true)
       echo "<input type=checkbox value=\"0\" name=usesignature checked>&nbsp;&nbsp;" . _("Use a signature") . "?<BR>";
    else {
    if ($use_signature == true)
       echo "<input type=checkbox value=\"0\" name=usesignature checked>&nbsp;&nbsp;" . _("Use a signature") . "?<BR>";
    else {