Removed line, plugin.php now handles this properly.
[squirrelmail.git] / src / options_highlight.php
CommitLineData
9d157cec 1<?php
ef870322 2 /**
c36ed9cf 3 ** options_highlight.php
ef870322 4 **
5 ** Copyright (c) 1999-2000 The SquirrelMail development team
6 ** Licensed under the GNU GPL. For full terms see the file COPYING.
7 **
c36ed9cf 8 ** Displays message highlighting options
9 **
245a6892 10 ** $Id$
ef870322 11 **/
12
9d157cec 13 session_start();
14
15 if (!isset($config_php))
16 include("../config/config.php");
17 if (!isset($strings_php))
18 include("../functions/strings.php");
19 if (!isset($page_header_php))
20 include("../functions/page_header.php");
c36ed9cf 21 if (!isset($display_messages_php))
22 include("../functions/display_messages.php");
23 if (!isset($imap_php))
24 include("../functions/imap.php");
25 if (!isset($array_php))
26 include("../functions/array.php");
9d157cec 27 if (!isset($i18n_php))
28 include("../functions/i18n.php");
d7d3c4d4 29 if (!isset($plugin_php))
30 include("../functions/plugin.php");
9d157cec 31
9d157cec 32
e4bf514f 33 if ($action == "delete" && isset($theid)) {
34 removePref($data_dir, $username, "highlight$theid");
44f642f5 35 } else if ($action == "save") {
e4bf514f 36 if (!$theid) $theid = 0;
37 $identname = ereg_replace(",", " ", $identname);
acb61cb4 38 $identname = str_replace("\\\\", "\\", $identname);
39 $identname = str_replace("\\\"", "\"", $identname);
40 $identname = str_replace("\"", "&quot;", $identname);
44f642f5 41 if ($color_type == 1) $newcolor = $newcolor_choose;
42 else $newcolor = $newcolor_input;
c36ed9cf 43
44f642f5 44 $newcolor = ereg_replace(",", "", $newcolor);
45 $newcolor = ereg_replace("#", "", $newcolor);
46 $newcolor = "$newcolor";
47 $value = ereg_replace(",", " ", $value);
acb61cb4 48 $value = str_replace("\\\\", "\\", $value);
49 $value = str_replace("\\\"", "\"", $value);
50 $value = str_replace("\"", "&quot;", $value);
51
e4bf514f 52 setPref($data_dir, $username, "highlight$theid", $identname.",".$newcolor.",".$value.",".$match_type);
53 $message_highlight_list[$theid]["name"] = $identname;
54 $message_highlight_list[$theid]["color"] = $newcolor;
55 $message_highlight_list[$theid]["value"] = $value;
56 $message_highlight_list[$theid]["match_type"] = $match_type;
c36ed9cf 57 }
44f642f5 58 include("../src/load_prefs.php");
59 displayPageHeader($color, "None");
c36ed9cf 60?>
e9f8ea4e 61 <br>
6170c5b6 62 <table width=95% align=center border=0 cellpadding=2 cellspacing=0><tr><td bgcolor="<?php echo $color[0] ?>">
63 <center><b><?php echo _("Options") . " - " . _("Message Highlighting"); ?></b></center>
c36ed9cf 64 </td></tr></table>
65
8442ac08 66<?php
c36ed9cf 67 echo "<br><center>[<a href=\"options_highlight.php?action=add\">" . _("New") . "</a>]";
68 echo " - [<a href=\"options.php\">"._("Done")."</a>]</center><br>\n";
44f642f5 69 if (count($message_highlight_list) >= 1) {
70 echo "<table border=0 cellpadding=3 cellspacing=0 align=center width=80%>\n";
71 for ($i=0; $i < count($message_highlight_list); $i++) {
72 echo "<tr>\n";
73 echo " <td width=1% bgcolor=" . $color[4] . ">\n";
e4bf514f 74 echo "<nobr><small>[<a href=\"options_highlight.php?action=edit&theid=$i\">" . _("Edit") . "</a>]&nbsp;[<a href=\"options_highlight.php?action=delete&theid=$i\">"._("Delete")."</a>]</small></nobr>\n";
44f642f5 75 echo " </td>";
76 echo " <td bgcolor=" . $message_highlight_list[$i]["color"] . ">\n";
77 echo " " . $message_highlight_list[$i]["name"];
78 echo " </td>\n";
79 echo " <td bgcolor=" . $message_highlight_list[$i]["color"] . ">\n";
3e69e88b 80 echo " ".$message_highlight_list[$i]["match_type"]." = " . $message_highlight_list[$i]["value"];
44f642f5 81 echo " </td>\n";
82 echo "</tr>\n";
83 }
84 echo "</table>\n";
85 echo "<br>\n";
9d157cec 86 } else {
44f642f5 87 echo "<center>" . _("No highlighting is defined") . "</center><br>\n";
88 echo "<br>\n";
89 }
90 if ($action == "edit" || $action == "add") {
e4bf514f 91 if (!isset($theid)) $theid = count($message_highlight_list);
c36ed9cf 92
44f642f5 93 $color_list[0] = "4444aa";
94 $color_list[1] = "44aa44";
95 $color_list[2] = "aaaa44";
96 $color_list[3] = "44aaaa";
97 $color_list[4] = "aa44aa";
98 $color_list[5] = "aaaaff";
99 $color_list[6] = "aaffaa";
100 $color_list[7] = "ffffaa";
101 $color_list[8] = "aaffff";
102 $color_list[9] = "ffaaff";
103 $color_list[10] = "aaaaaa";
104 $color_list[11] = "bfbfbf";
105 $color_list[12] = "dfdfdf";
c36ed9cf 106 $color_list[13] = "ffffff";
44f642f5 107 for ($i=0; $i < 14; $i++) {
e4bf514f 108 if ($color_list[$i] == $message_highlight_list[$theid]["color"]) {
44f642f5 109 $selected_choose = " checked";
110 ${"selected".$i} = " selected";
111 continue;
112 }
113 }
e4bf514f 114 if (!$message_highlight_list[$theid]["color"])
3e69e88b 115 $selected_choose = " checked";
c36ed9cf 116 else if (!$selected_choose)
44f642f5 117 $selected_input = " checked";
c36ed9cf 118
d7d3c4d4 119 echo "<form name=f action=\"options_highlight.php\">\n";
9d157cec 120 echo "<input type=\"hidden\" value=\"save\" name=\"action\">\n";
e4bf514f 121 echo "<input type=\"hidden\" value=\"$theid\" name=\"theid\">\n";
e9f8ea4e 122 echo "<table width=80% align=center cellpadding=3 cellspacing=0 border=0>\n";
123 echo " <tr bgcolor=\"$color[0]\">\n";
124 echo " <td align=right width=25%><b>\n";
9d157cec 125 echo _("Identifying name") . ":";
e9f8ea4e 126 echo " </b></td>\n";
429f8906 127 echo " <td width=75%>\n";
acb61cb4 128 $disp = $message_highlight_list[$theid]["name"];
129 $disp = str_replace("\\\\", "\\", $disp);
130 $disp = str_replace("\\\"", "\"", $disp);
131 $disp = str_replace("\"", "&quot;", $disp);
132 echo " <input type=\"text\" value=\"".$disp."\" name=\"identname\">";
9d157cec 133 echo " </td>\n";
134 echo " </tr>\n";
e9f8ea4e 135 echo " <tr><td><small><small>&nbsp;</small></small></td></tr>\n";
136 echo " <tr bgcolor=\"$color[0]\">\n";
137 echo " <td align=right width=25%><b>\n";
9d157cec 138 echo _("Color") . ":";
e9f8ea4e 139 echo " </b></td>\n";
429f8906 140 echo " <td width=75%>\n";
44f642f5 141 echo " <input type=\"radio\" name=color_type value=1$selected_choose> &nbsp;<select name=newcolor_choose>\n";
142 echo " <option value=\"$color_list[0]\"$selected0>" . _("Dark Blue") . "\n";
143 echo " <option value=\"$color_list[1]\"$selected1>" . _("Dark Green") . "\n";
144 echo " <option value=\"$color_list[2]\"$selected2>" . _("Dark Yellow") . "\n";
145 echo " <option value=\"$color_list[3]\"$selected3>" . _("Dark Cyan") . "\n";
146 echo " <option value=\"$color_list[4]\"$selected4>" . _("Dark Magenta") . "\n";
147 echo " <option value=\"$color_list[5]\"$selected5>" . _("Light Blue") . "\n";
148 echo " <option value=\"$color_list[6]\"$selected6>" . _("Light Green") . "\n";
149 echo " <option value=\"$color_list[7]\"$selected7>" . _("Light Yellow") . "\n";
150 echo " <option value=\"$color_list[8]\"$selected8>" . _("Light Cyan") . "\n";
151 echo " <option value=\"$color_list[9]\"$selected9>" . _("Light Magenta") . "\n";
152 echo " <option value=\"$color_list[10]\"$selected10>" . _("Dark Gray") . "\n";
153 echo " <option value=\"$color_list[11]\"$selected11>" . _("Medium Gray") . "\n";
154 echo " <option value=\"$color_list[12]\"$selected12>" . _("Light Gray") . "\n";
155 echo " <option value=\"$color_list[13]\"$selected13>" . _("White") . "\n";
156 echo " </select><br>\n";
c36ed9cf 157 echo " <input type=\"radio\" name=color_type value=2$selected_input> &nbsp;". _("Other:") ."<input type=\"text\" value=\"";
e4bf514f 158 if ($selected_input) echo $message_highlight_list[$theid]["color"];
44f642f5 159 echo "\" name=\"newcolor_input\" size=7> "._("Ex: 63aa7f")."<br>\n";
9d157cec 160 echo " </td>\n";
161 echo " </tr>\n";
e9f8ea4e 162 echo " <tr><td><small><small>&nbsp;</small></small></td></tr>\n";
163 echo " <tr bgcolor=\"$color[0]\">\n";
164 echo " <td align=right width=25%><b>\n";
9d157cec 165 echo _("Match") . ":";
e9f8ea4e 166 echo " </b></td>\n";
429f8906 167 echo " <td width=75%>\n";
3e69e88b 168 echo " <select name=match_type>\n";
e4bf514f 169 if ($message_highlight_list[$theid]["match_type"] == "from") echo " <option value=\"from\" selected>From\n";
c36ed9cf 170 else echo " <option value=\"from\">From\n";
e4bf514f 171 if ($message_highlight_list[$theid]["match_type"] == "to") echo " <option value=\"to\" selected>To\n";
c36ed9cf 172 else echo " <option value=\"to\">To\n";
e4bf514f 173 if ($message_highlight_list[$theid]["match_type"] == "cc") echo " <option value=\"cc\" selected>Cc\n";
1195c340 174 else echo " <option value=\"cc\">Cc\n";
e4bf514f 175 if ($message_highlight_list[$theid]["match_type"] == "to_cc") echo " <option value=\"to_cc\" selected>To or Cc\n";
1195c340 176 else echo " <option value=\"to_cc\">To or Cc\n";
e4bf514f 177 if ($message_highlight_list[$theid]["match_type"] == "subject") echo " <option value=\"subject\" selected>Subject\n";
c36ed9cf 178 else echo " <option value=\"subject\">Subject\n";
3e69e88b 179 echo " </select>\n";
acb61cb4 180 $disp = $message_highlight_list[$theid]["value"];
181 $disp = str_replace("\\\\", "\\", $disp);
182 $disp = str_replace("\\\"", "\"", $disp);
183 $disp = str_replace("\"", "&quot;", $disp);
184 echo " <nobr><input type=\"text\" value=\"".$disp."\" name=\"value\">";
e90872be 185 echo " <nobr></td>\n";
9d157cec 186 echo " </tr>\n";
187 echo "</table>\n";
188 echo "<center><input type=\"submit\" value=\"" . _("Submit") . "\"></center>\n";
189 echo "</form>\n";
d7d3c4d4 190 do_hook("options_highlight_bottom");
c36ed9cf 191 }
9d157cec 192?>
c36ed9cf 193</body></html>