Browse Source

- fixed bug when deleting last message, sends you to previous list
- fixed bug about translate_text missing an argument
- added functionality in conf.pl to detect themes
- fixed a number of <? to be <?php

Luke Ehresman 25 years ago
parent
commit
9d36327160

+ 52 - 0
config/conf.pl

@@ -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*/) {
       } elsif ($input =~ /^\s*\?\s*/) {
          print ".-------------------------.\n";
          print ".-------------------------.\n";
+         print "| t       (detect themes) |\n";
          print "| +           (add theme) |\n";
          print "| +           (add theme) |\n";
          print "| - N      (remove theme) |\n";
          print "| - N      (remove theme) |\n";
          print "| m N      (mark default) |\n";
          print "| m N      (mark default) |\n";

+ 8 - 4
functions/mailbox_display.php

@@ -170,22 +170,26 @@
       global $folder_prefix, $sent_folder;
       global $folder_prefix, $sent_folder;
 		global $imapServerAddress;
 		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 cache isn't already set, do it now
       if (!session_is_registered("msgs"))
       if (!session_is_registered("msgs"))
          session_register("msgs");
          session_register("msgs");
       if (!session_is_registered("msort"))
       if (!session_is_registered("msort"))
          session_register("msort");
          session_register("msort");
 
 
+
       if ($startMessage + ($show_num - 1) < $numMessages) {
       if ($startMessage + ($show_num - 1) < $numMessages) {
          $endMessage = $startMessage + ($show_num-1);
          $endMessage = $startMessage + ($show_num-1);
       } else {
       } else {
          $endMessage = $numMessages;
          $endMessage = $numMessages;
       }
       }
 
 
+      
+      if ($endMessage < $startMessage) {
+         $startMessage = $startMessage - $show_num;
+         if ($startMessage < 1)
+            $startMessage = 1;
+      }
+      
       $nextGroup = $startMessage + $show_num;
       $nextGroup = $startMessage + $show_num;
       $prevGroup = $startMessage - $show_num;
       $prevGroup = $startMessage - $show_num;
       $urlMailbox = urlencode($mailbox);
       $urlMailbox = urlencode($mailbox);

+ 22 - 27
functions/strings.php

@@ -114,44 +114,39 @@
    }
    }
 
 
    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(" ", "&nbsp;", $line);
          $line = str_replace("\t", "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;", $line);
          $line = str_replace("\t", "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;", $line);
          $line = nl2br($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 */

+ 2 - 1
src/compose.php

@@ -152,7 +152,8 @@
          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) {
       if ($reply_id) {
          echo "<input type=hidden name=reply_id value=$reply_id>\n";
          echo "<input type=hidden name=reply_id value=$reply_id>\n";
       }		 
       }		 

+ 3 - 2
src/download.php

@@ -25,7 +25,7 @@
    include("../src/load_prefs.php");
    include("../src/load_prefs.php");
 
 
    function viewText($color, $body, $id, $entid, $mailbox, $type1, $wrap_at) {
    function viewText($color, $body, $id, $entid, $mailbox, $type1, $wrap_at) {
-      global $where, $what;
+      global $where, $what, $charset;
       displayPageHeader($color, "None");
       displayPageHeader($color, "None");
 
 
       echo "<BR><TABLE WIDTH=90% BORDER=0 CELLSPACING=0 CELLPADDING=2 ALIGN=CENTER><TR><TD BGCOLOR=\"$color[0]\">";
       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")
       if ($type1 == "html")
          echo $body;
          echo $body;
       else
       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;
    $header = $message->header;
    $body = mime_fetch_body($imapConnection, $passed_id, $passed_ent_id);
    $body = mime_fetch_body($imapConnection, $passed_id, $passed_ent_id);
 
 
+   $charset = $header->charset;
    $type0 = $header->type0;
    $type0 = $header->type0;
    $type1 = $header->type1;
    $type1 = $header->type1;
    $filename = decodeHeader($header->filename);
    $filename = decodeHeader($header->filename);

+ 3 - 3
src/help.php

@@ -87,8 +87,8 @@
 
 
 <br>
 <br>
 <table width=95% align=center cellpadding=2 cellspacing=2 border=0>
 <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>
 
 
 
 
@@ -184,6 +184,6 @@
       }
       }
    }
    }
 ?>
 ?>
-<tr><td bgcolor="<? echo $color[0] ?>">&nbsp;</td></tr></table>
+<tr><td bgcolor="<?php echo $color[0] ?>">&nbsp;</td></tr></table>
 <td></tr></table>
 <td></tr></table>
 </body></html>
 </body></html>

+ 1 - 1
src/options.php

@@ -152,7 +152,7 @@
    </td>
    </td>
 </tr>
 </tr>
 </table>
 </table>
-   <?
+   <?php
       do_hook("options_link_and_description")
       do_hook("options_link_and_description")
    ?>
    ?>
 </body></html>
 </body></html>

+ 7 - 7
src/options_display.php

@@ -40,7 +40,7 @@
          <tr>
          <tr>
             <td align=right nowrap><?php echo _("Theme"); ?>:
             <td align=right nowrap><?php echo _("Theme"); ?>:
             </td><td>
             </td><td>
-<?
+<?php
    echo "         <tt><select name=chosentheme>\n";
    echo "         <tt><select name=chosentheme>\n";
    for ($i = 0; $i < count($theme); $i++) {
    for ($i = 0; $i < count($theme); $i++) {
       if ($theme[$i]["PATH"] == $chosen_theme)
       if ($theme[$i]["PATH"] == $chosen_theme)
@@ -55,7 +55,7 @@
          <tr>
          <tr>
             <td align=right nowrap><?php echo _("Language"); ?>:
             <td align=right nowrap><?php echo _("Language"); ?>:
             </td><td>
             </td><td>
-<?
+<?php
    echo "         <tt><select name=language>\n";
    echo "         <tt><select name=language>\n";
    reset ($languages);
    reset ($languages);
    while (list($code, $name)=each($languages)) {
    while (list($code, $name)=each($languages)) {
@@ -85,7 +85,7 @@
          <tr>
          <tr>
             <td align=right nowrap><?php echo _("Number of Messages to Index"); ?>:
             <td align=right nowrap><?php echo _("Number of Messages to Index"); ?>:
             </td><td>
             </td><td>
-<?
+<?php
    if (isset($show_num))
    if (isset($show_num))
       echo "         <tt><input type=text size=5 name=shownum value=\"$show_num\"></tt><br>";
       echo "         <tt><input type=text size=5 name=shownum value=\"$show_num\"></tt><br>";
    else
    else
@@ -96,7 +96,7 @@
          <tr>
          <tr>
             <td align=right nowrap><?php echo _("Wrap incoming text at"); ?>:
             <td align=right nowrap><?php echo _("Wrap incoming text at"); ?>:
             </td><td>
             </td><td>
-<?
+<?php
    if (isset($wrap_at))
    if (isset($wrap_at))
       echo "         <tt><input type=text size=5 name=wrapat value=\"$wrap_at\"></tt><br>";
       echo "         <tt><input type=text size=5 name=wrapat value=\"$wrap_at\"></tt><br>";
    else
    else
@@ -107,7 +107,7 @@
          <tr>
          <tr>
             <td align=right nowrap><?php echo _("Size of editor window"); ?>:
             <td align=right nowrap><?php echo _("Size of editor window"); ?>:
             </td><td>
             </td><td>
-<?
+<?php
    if ($editor_size >= 10 && $editor_size <= 255)
    if ($editor_size >= 10 && $editor_size <= 255)
       echo "         <tt><input type=text size=5 name=editorsize value=\"$editor_size\"></tt><br>";
       echo "         <tt><input type=text size=5 name=editorsize value=\"$editor_size\"></tt><br>";
    else
    else
@@ -118,7 +118,7 @@
          <tr>
          <tr>
             <td align=right nowrap><?php echo _("Width of left folder list"); ?>:
             <td align=right nowrap><?php echo _("Width of left folder list"); ?>:
             </td><td>
             </td><td>
-<?
+<?php
    echo "         <select name=leftsize>\n";
    echo "         <select name=leftsize>\n";
    if ($left_size == 100)
    if ($left_size == 100)
       echo "<option value=100 selected>100 pixels\n";
       echo "<option value=100 selected>100 pixels\n";
@@ -172,7 +172,7 @@
          <tr>
          <tr>
             <td align=right nowrap><?php echo _("Auto refresh folder list"); ?>:
             <td align=right nowrap><?php echo _("Auto refresh folder list"); ?>:
             </td><td>
             </td><td>
-<?
+<?php
    echo "               <SELECT name=leftrefresh>";
    echo "               <SELECT name=leftrefresh>";
    if (($left_refresh == "None") || ($left_refresh == ""))
    if (($left_refresh == "None") || ($left_refresh == ""))
       echo "                  <OPTION VALUE=None SELECTED>None";
       echo "                  <OPTION VALUE=None SELECTED>None";

+ 1 - 1
src/options_highlight.php

@@ -53,7 +53,7 @@
       <center><b><?php echo _("Options") . " - " . _("Message Highlighting"); ?></b></center>
       <center><b><?php echo _("Options") . " - " . _("Message Highlighting"); ?></b></center>
    </td></tr></table>
    </td></tr></table>
 
 
-<?
+<?php
    echo "<br><center>[<a href=\"options_highlight.php?action=add\">" . _("New") . "</a>]";
    echo "<br><center>[<a href=\"options_highlight.php?action=add\">" . _("New") . "</a>]";
    echo " - [<a href=\"options.php\">"._("Done")."</a>]</center><br>\n";
    echo " - [<a href=\"options.php\">"._("Done")."</a>]</center><br>\n";
    if (count($message_highlight_list) >= 1) {
    if (count($message_highlight_list) >= 1) {

+ 1 - 1
src/options_personal.php

@@ -62,7 +62,7 @@
          <tr>
          <tr>
             <td align=right nowrap valign=top><br><?php echo _("Signature"); ?>:
             <td align=right nowrap valign=top><br><?php echo _("Signature"); ?>:
             </td><td>
             </td><td>
-<?
+<?php
    if ($use_signature == true)
    if ($use_signature == true)
       echo "<input type=checkbox value=\"0\" name=usesignature checked>&nbsp;&nbsp;" . _("Use a signature") . "?<BR>";
       echo "<input type=checkbox value=\"0\" name=usesignature checked>&nbsp;&nbsp;" . _("Use a signature") . "?<BR>";
    else {
    else {