parsing $message to magicHTML for better handling message/rfc822 attachments
[squirrelmail.git] / src / options_highlight.php
index 55ab27cc6b684e3da296d9c776216b908bd9889f..fdd0a279230080c635801b9a2245353d1cca4a10 100644 (file)
@@ -16,6 +16,7 @@ require_once('../functions/display_messages.php');
 require_once('../functions/imap.php');
 require_once('../functions/array.php');
 require_once('../functions/plugin.php');
+require_once('../functions/strings.php');
 
 function oh_opt( $val, $sel, $tit ) {
     echo "<option value=\"$val\"";
@@ -33,20 +34,20 @@ if (! isset($message_highlight_list)) {
 
 if ($action == 'delete' && isset($theid)) {
     removePref($data_dir, $username, "highlight$theid");
-    header( "Location: $PHP_SELF" );
+    header( "Location: $SCRIPT_NAME" );
     exit;
 } else if ($action == 'save') {
     if (!$theid) $theid = 0;
-    $identname = ereg_replace(',', ' ', $identname);
+    $identname = str_replace(',', ' ', $identname);
     if ($color_type == 1) $newcolor = $newcolor_choose;
     elseif ($color_type == 2) $newcolor = $newcolor_input;
     else $newcolor = $color_type;
 
-    $newcolor = ereg_replace(',', '', $newcolor);
-    $newcolor = ereg_replace('#', '', $newcolor);
-    $newcolor = ereg_replace('"', '', $newcolor);
-    $newcolor = ereg_replace('\'', '', $newcolor);
-    $value = ereg_replace(',', ' ', $value);
+    $newcolor = str_replace(',', '', $newcolor);
+    $newcolor = str_replace('#', '', $newcolor);
+    $newcolor = str_replace('"', '', $newcolor);
+    $newcolor = str_replace('\'', '', $newcolor);
+    $value = str_replace(',', ' ', $value);
 
     setPref($data_dir, $username, "highlight$theid", $identname.','.$newcolor.','.$value.','.$match_type);
     $message_highlight_list[$theid]['name'] = $identname;
@@ -68,10 +69,10 @@ if (count($message_highlight_list) >= 1) {
     echo '<table border="0" cellpadding="3" cellspacing="0" align="center" width="80%">'."\n";
     for ($i=0; $i < count($message_highlight_list); $i++) {
         echo '<tr bgcolor="' . $message_highlight_list[$i]['color'] . '">'.
-                "<td width=\"20%\" bgcolor=\"$color[4]\" nobr>".
-                "<small>[<a href=\"options_highlight.php?action=edit&theid=$i\">".
+                "<td width=\"20%\" bgcolor=\"$color[4]\" nowrap>".
+                "<small>[<a href=\"options_highlight.php?action=edit&amp;theid=$i\">".
             _("Edit") .
-            '</a>]&nbsp;[<a href="options_highlight.php?action=delete&theid='.
+            '</a>]&nbsp;[<a href="options_highlight.php?action=delete&amp;theid='.
             $i . '">' . _("Delete") . '</a>]</small>'.
             '</td><td>'.
             htmlspecialchars($message_highlight_list[$i]['name']) .
@@ -297,7 +298,12 @@ if ($action == 'edit' || $action == 'add') {
     # Show grid of color choices
     echo "<tr bgcolor=\"$color[0]\"><td colspan='2'>\n";
     echo "<table border=0 cellpadding=\"2\" align=\"center\" cellspacing=\"1\">\n";
-    $current_color = $message_highlight_list[$theid]['color'];
+    if (isset($message_highlight_list[$theid]['color'])) {
+        $current_color = $message_highlight_list[$theid]['color'];
+    }
+    else {
+        $current_color = '63aa7f';
+    }
     for($x = 0; $x < 5; $x++) {
         echo "<tr>\n";
         for($y = 0; $y < 19; $y++) {