summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorthomascube <thomas@roundcube.net>2006-08-30 19:55:55 +0000
committerthomascube <thomas@roundcube.net>2006-08-30 19:55:55 +0000
commit10c92bef09262b7d46e6c87893715bb5a2e5e4a1 (patch)
treeb61ce9acf911f4429acbc0985f67d48e18b56c82
parent107bde9cfd9a0392d18544b5a433552ce6f2f0a6 (diff)
New indentation for quoted message text; HTML validity
-rw-r--r--CHANGELOG6
-rw-r--r--index.php2
-rw-r--r--program/include/main.inc2
-rw-r--r--program/steps/mail/func.inc41
-rw-r--r--skins/default/mail.css27
5 files changed, 57 insertions, 21 deletions
diff --git a/CHANGELOG b/CHANGELOG
index 422fb1762..6dbccd230 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,6 +1,12 @@
CHANGELOG RoundCube Webmail
---------------------------
+2006/08/30 (thomasb)
+----------
+- New indentation for quoted message text
+- Improved HTML validity
+
+
2006/08/28 (estadtherr)
----------
- Fixed URL character set (Ticket #1445501)
diff --git a/index.php b/index.php
index 313ca0bfd..f98243023 100644
--- a/index.php
+++ b/index.php
@@ -116,7 +116,7 @@ $SESS_HIDDEN_FIELD = '';
// add framed parameter
if ($_framed)
{
- $COMM_PATH .= '&_framed=1';
+ $COMM_PATH .= '&amp;_framed=1';
$SESS_HIDDEN_FIELD .= "\n".'<input type="hidden" name="_framed" value="1" />';
}
diff --git a/program/include/main.inc b/program/include/main.inc
index 7458fe131..ecf53b52d 100644
--- a/program/include/main.inc
+++ b/program/include/main.inc
@@ -921,7 +921,6 @@ function rep_specialchars_output($str, $enctype='', $mode='', $newlines=TRUE)
{
$html_encode_arr = get_html_translation_table(HTML_SPECIALCHARS);
unset($html_encode_arr['?']);
- unset($html_encode_arr['&']);
}
$ltpos = strpos($str, '<');
@@ -933,6 +932,7 @@ function rep_specialchars_output($str, $enctype='', $mode='', $newlines=TRUE)
unset($encode_arr['"']);
unset($encode_arr['<']);
unset($encode_arr['>']);
+ unset($encode_arr['&']);
}
else if ($mode=='remove')
$str = strip_tags($str);
diff --git a/program/steps/mail/func.inc b/program/steps/mail/func.inc
index 8f4f5894c..bae14a299 100644
--- a/program/steps/mail/func.inc
+++ b/program/steps/mail/func.inc
@@ -214,7 +214,7 @@ function rcmail_render_folder_tree_html(&$arrFolders, &$special, &$mbox_name, $m
else if ($folder['id']==$CONFIG['junk_mbox'])
$class_name = 'junk';
- $js_name = rep_specialchars_output($folder['id'], 'js');
+ $js_name = htmlspecialchars(rep_specialchars_output($folder['id'], 'js'));
$out .= sprintf('<li id="rcmbx%s" class="mailbox %s %s%s%s"><a href="%s&amp;_mbox=%s"'.
' onclick="return %s.command(\'list\',\'%s\')"'.
' onmouseover="return %s.focus_mailbox(\'%s\')"' .
@@ -271,7 +271,7 @@ function rcmail_render_folder_tree_select(&$arrFolders, &$special, &$mbox_name,
}
$out .= sprintf('<option value="%s">%s%s</option>'."\n",
- $folder['id'],
+ htmlspecialchars($folder['id']),
str_repeat('&nbsp;', $nestLevel*4),
rep_specialchars_output($foldername, 'html', 'all'));
@@ -729,39 +729,44 @@ function rcmail_print_body($part, $safe=FALSE, $plain=FALSE)
$convert_patterns[] = '/([a-z0-9][a-z0-9\-\.\+\_]*@[a-z0-9]([a-z0-9\-][.]?)*[a-z0-9]\\.[a-z]{2,5})/ie';
$convert_replaces[] = "rcmail_str_replacement('<a href=\"mailto:\\1\" onclick=\"return $JS_OBJECT_NAME.command(\'compose\',\'\\1\',this)\">\\1</a>', \$replace_strings)";
+
+ if ($part->ctype_parameters['format'] != 'flowed')
+ $body = wordwrap(trim($body), 80);
- $body = wordwrap(trim($body), 80);
$body = preg_replace($convert_patterns, $convert_replaces, $body);
// split body into single lines
$a_lines = preg_split('/\r?\n/', $body);
+ $quote_level = 0;
// colorize quoted parts
for($n=0; $n<sizeof($a_lines); $n++)
{
$line = $a_lines[$n];
+ $quotation = '';
+ $q = 0;
+
+ if (preg_match('/^(>+\s*)/', $line, $regs))
+ {
+ $q = strlen(preg_replace('/\s/', '', $regs[1]));
+ $line = substr($line, strlen($regs[1]));
- if ($line{2}=='>')
- $color = 'red';
- else if ($line{1}=='>')
- $color = 'green';
- else if ($line{0}=='>')
- $color = 'blue';
- else
- $color = FALSE;
+ if ($q > $quote_level)
+ $quotation = str_repeat('<blockquote>', $q - $quote_level);
+ else if ($q < $quote_level)
+ $quotation = str_repeat("</blockquote>", $quote_level - $q);
+ }
+ else if ($quote_level > 0)
+ $quotation = str_repeat("</blockquote>", $quote_level);
- $line = rep_specialchars_output($line, 'html', 'replace', FALSE);
-
- if ($color)
- $a_lines[$n] = sprintf('<font color="%s">%s</font>', $color, $line);
- else
- $a_lines[$n] = $line;
+ $quote_level = $q;
+ $a_lines[$n] = $quotation . rep_specialchars_output($line, 'html', 'replace', FALSE);
}
// insert the links for urls and mailtos
$body = preg_replace("/##string_replacement\{([0-9]+)\}##/e", "\$replace_strings[\\1]", join("\n", $a_lines));
- return "<pre>\n".$body."\n</pre>";
+ return "<div class=\"pre\">\n".$body."\n</div>";
}
}
diff --git a/skins/default/mail.css b/skins/default/mail.css
index 72a782bc2..c60a73dc8 100644
--- a/skins/default/mail.css
+++ b/skins/default/mail.css
@@ -654,12 +654,37 @@ div.message-part a
color: #0000CC;
}
-div.message-part pre
+div.message-part div.pre
{
margin: 0px;
padding: 0px;
+ white-space: pre;
+ font-family: monospace;
}
+div.message-part blockquote
+{
+ color: blue;
+ border-left: 2px solid blue;
+ border-right: 2px solid blue;
+ background-color: #F6F6F6;
+ margin: 2px 0px 2px 0px;
+ padding: 1px 8px 1px 10px;
+}
+
+div.message-part blockquote blockquote
+{
+ color: green;
+ border-left: 2px solid green;
+ border-right: 2px solid green;
+}
+
+div.message-part blockquote blockquote blockquote
+{
+ color: #990000;
+ border-left: 2px solid #bb0000;
+ border-right: 2px solid #bb0000;
+}
#remote-objects-message
{