Version 0.6pre1 -- DEVELOPMENT
------------------------------
-- Updated attachment viewing, added plugin support (see plugins.txt)
+- Updated attachment plugin support and passing values to hooks (see plugins.txt)
- Added file and message size in many locations
- Made message index order customizable (from, subject, date) can be (date, from, subject)
- Fixed some security problems with uploading attachments
- Added Catalan translation from Josep Sanz <jsanz@fa.upc.es>
- When reading, attachments look better and have a better plugin interface
+- Some functions now pass values by reference to save on memory
Version 0.5 -- September 25, 2000
}
// Wraps text at $wrap characters
- function sqWordWrap($passed, $wrap) {
- $passed = str_replace("<", "<", $passed);
- $passed = str_replace(">", ">", $passed);
+ function sqWordWrap(&$line, $wrap) {
+ $line = str_replace("<", "<", $line);
+ $line = str_replace(">", ">", $line);
- preg_match("/^(\s|>)+/", $passed, $regs);
+ preg_match("/^(\s|>)+/", $line, $regs);
$beginning_spaces = $regs[0];
- $words = explode(" ", $passed);
+ $words = explode(" ", $line);
$i = -1;
$line_len = strlen($words[0])+1;
$line = "";
if (count($words) > 1) {
while ($i++ < count($words)) {
- while ($line_len < $wrap) {
+ while ($line_len < $wrap && $i < count($words)) {
$line = "$line$words[$i] ";
$i++;
$line_len = $line_len + strlen($words[$i]) + 1;
$line = str_replace(">", ">", $line);
$line = str_replace("<", "<", $line);
- return $line;
}
/** Returns an array of email addresses **/
return $to_line;
}
- function translateText($body, $wrap_at, $charset) {
+ function translateText(&$body, $wrap_at, $charset) {
global $where, $what; // from searching
if (!isset($url_parser_php)) {
$line = $body_ary[$i];
$line = charset_decode($charset, $line);
$line = str_replace("\t", ' ', $line);
+ chop($line);
if (strlen($line) - 2 >= $wrap_at) {
- $line = sqWordWrap($line, $wrap_at);
+ sqWordWrap($line, $wrap_at);
}
$line = str_replace(' ', ' ', $line);
$line = nl2br($line);
- // Removed parseEmail and integrated it into parseUrl
- // This line is no longer needed.
- // $line = parseEmail ($line);
- $line = parseUrl ($line);
+ parseUrl ($line);
- $test_line = str_replace(' ', '', $line);
- if (strpos($test_line, '>>') === 0) {
+ $Quotes = 0;
+ $pos = 0;
+ while (1)
+ {
+ if (strpos($line, ' ', $pos) === $pos)
+ {
+ $pos += 6;
+ }
+ else if (strpos($line, '>', $pos) === $pos)
+ {
+ $pos += 4;
+ $Quotes ++;
+ }
+ else
+ {
+ break;
+ }
+ }
+
+ if ($Quotes > 1) {
$line = "<FONT COLOR=FF0000>$line</FONT>\n";
- } else if (strpos($test_line, '>') === 0) {
+ } else if ($Quotes) {
$line = "<FONT COLOR=800000>$line</FONT>\n";
}
$body_ary[$i] = $line . '<br>';
}
$body = implode("\n", $body_ary);
-
- return $body;
}
/* SquirrelMail version number -- DO NOT CHANGE */
return $ret;
}
- function parseEmail ($body) {
+ function parseEmail (&$body) {
global $color;
+ $Size = strlen($body);
// Having this defined in just one spot could help when changes need
// to be made to the pattern
*/
$body = eregi_replace ($Expression, "<a href=\"../src/compose.php?send_to=\\0\">\\0</a>", $body);
- return $body;
+
+ // If there are any changes, it'll just get bigger.
+ if ($Size != strlen($body))
+ return 1;
+ return 0;
}
- function parseUrl ($body)
+ function parseUrl (&$body)
{
$url_tokens = array(
'http://',
// Look for email addresses between $start and $target_pos
$check_str = substr($body, $start, $target_pos);
- $new_str = parseEmail($check_str);
- if ($check_str != $new_str)
+ if (parseEmail($check_str))
{
- $body = replaceBlock($body, $new_str, $start, $target_pos);
- $target_pos = strlen($new_str) + $start;
+ $body = replaceBlock($body, $check_str, $start, $target_pos);
+ $target_pos = strlen($check_str) + $start;
}
// If there was a token to replace, replace it
$start = $target_pos;
$target_pos = strlen($body);
}
-
- return $body;
}
?>