$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";
+ print "| t (detect themes) |\n";
print "| + (add theme) |\n";
print "| - N (remove theme) |\n";
print "| m N (mark default) |\n";
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 ($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);
}
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);
-
- for ($i = 0; $i < count($body_ary); $i++) {
+ for ($i=0; $i < count($body_ary); $i++) {
$line = $body_ary[$i];
- $line = "^^$line";
-
- //$line = str_replace(">", ">", $line);
- //$line = str_replace("<", "<", $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 = str_replace(" ", " ", $line);
$line = str_replace("\t", " ", $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(" ", "", $line)), ">>") == 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(" ", "", $line)), ">") == 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 {
- $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 */
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";
}
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]\">";
if ($type1 == "html")
echo $body;
else
- echo translateText($body, $wrap_at);
+ echo translateText($body, $wrap_at, $charset);
echo "</TT></TD></TR></TABLE>";
}
$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);
<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>
}
}
?>
-<tr><td bgcolor="<? echo $color[0] ?>"> </td></tr></table>
+<tr><td bgcolor="<?php echo $color[0] ?>"> </td></tr></table>
<td></tr></table>
</body></html>
</td>
</tr>
</table>
- <?
+ <?php
do_hook("options_link_and_description")
?>
</body></html>
<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)
<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)) {
<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
<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
<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
<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";
<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";
<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) {
<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> " . _("Use a signature") . "?<BR>";
else {