<?php
- /**
- ** options_highlight.php
- **
- ** Copyright (c) 1999-2000 The SquirrelMail development team
- ** Licensed under the GNU GPL. For full terms see the file COPYING.
- **
- ** Displays message highlighting options
- **
- ** $Id$
- **/
- include('../src/validate.php');
- include('../functions/display_messages.php');
- include('../functions/imap.php');
- include('../functions/array.php');
- include('../functions/plugin.php');
+/**
+ * options_highlight.php
+ *
+ * Copyright (c) 1999-2001 The SquirrelMail Development Team
+ * Licensed under the GNU GPL. For full terms see the file COPYING.
+ *
+ * Displays message highlighting options
+ *
+ * $Id$
+ */
+
+require_once('../src/validate.php');
+require_once('../functions/display_messages.php');
+require_once('../functions/imap.php');
+require_once('../functions/array.php');
+require_once('../functions/plugin.php');
+
+function oh_opt( $val, $sel, $tit ) {
+ echo " <option value=\"$val\"";
+ if ( $sel )
+ echo 'selected';
+ echo ">$tit</option>\n";
+}
if (! isset($action))
$action = '';
} else if ($action == 'save') {
if (!$theid) $theid = 0;
$identname = ereg_replace(',', ' ', $identname);
- $identname = str_replace('\\\\', '\\', $identname);
- $identname = str_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 = "$newcolor";
+ $newcolor = ereg_replace('"', '', $newcolor);
+ $newcolor = ereg_replace('\'', '', $newcolor);
$value = ereg_replace(',', ' ', $value);
- $value = str_replace('\\\\', '\\', $value);
- $value = str_replace('\\"', '"', $value);
- $value = str_replace('"', '"', $value);
setPref($data_dir, $username, "highlight$theid", $identname.','.$newcolor.','.$value.','.$match_type);
$message_highlight_list[$theid]['name'] = $identname;
$message_highlight_list[$theid]['color'] = $newcolor;
$message_highlight_list[$theid]['value'] = $value;
$message_highlight_list[$theid]['match_type'] = $match_type;
- }
+ }
displayPageHeader($color, 'None');
?>
<br>
</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";
+ echo '<br><center>[<a href="options_highlight.php?action=add">' . _("New") . '</a>]'.
+ ' - [<a href="options.php">'._("Done").'</a>]</center><br>'."\n";
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>\n";
- echo ' <td width="1%" bgcolor="' . $color[4] . "\">\n";
- echo "<nobr><small>[<a href=\"options_highlight.php?action=edit&theid=$i\">" . _("Edit") . "</a>] [<a href=\"options_highlight.php?action=delete&theid=$i\">"._("Delete")."</a>]</small></nobr>\n";
- echo ' </td>';
- echo ' <td bgcolor="' . $message_highlight_list[$i]['color'] . "\">\n";
- echo ' ' . $message_highlight_list[$i]['name'] . ' ';
- echo " </td>\n";
- echo ' <td bgcolor="' . $message_highlight_list[$i]['color'] . "\">\n";
- echo ' '.$message_highlight_list[$i]['match_type'].' = ' . $message_highlight_list[$i]['value'];
- echo " </td>\n";
- echo "</tr>\n";
+ echo '<tr bgcolor="' . $message_highlight_list[$i]['color'] . '">'.
+ "<td width=5% bgcolor=\"$color[4]\" nobr>".
+ "<small>[<a href=\"options_highlight.php?action=edit&theid=$i\">".
+ _("Edit") .
+ '</a>] [<a href="options_highlight.php?action=delete&theid='.
+ $i . '">' . _("Delete") . '</a>]</small>'.
+ '</td><td>'.
+ htmlspecialchars($message_highlight_list[$i]['name']) .
+ '</td><td>'.
+ $message_highlight_list[$i]['match_type'] . ' = ' .
+ htmlspecialchars($message_highlight_list[$i]['value']).
+ '</td></tr>';
}
- echo "</table>\n";
- echo "<br>\n";
+ echo "</table>\n".
+ "<br>\n";
} else {
- echo '<center>' . _("No highlighting is defined") . "</center><br>\n";
- echo "<br>\n";
+ echo '<center>' . _("No highlighting is defined") . "</center><br>\n".
+ "<br>\n";
}
if ($action == 'edit' || $action == 'add') {
if (!isset($theid))
$theid = count($message_highlight_list);
$message_highlight_list[$theid] = array();
}
-
+
$color_list[0] = '4444aa';
$color_list[1] = '44aa44';
$color_list[2] = 'aaaa44';
$color_list[10] = 'aaaaaa';
$color_list[11] = 'bfbfbf';
$color_list[12] = 'dfdfdf';
- $color_list[13] = 'ffffff';
-
+ $color_list[13] = 'ffffff';
+
# helpful color chart from http://www.visibone.com/colorlab/big.html
$new_color_list["0,0"] = 'cccccc';
$new_color_list["0,1"] = '999999';
$new_color_list["6,2"] = '66ff66';
$new_color_list["6,3"] = '33ff33';
$new_color_list["6,4"] = '00ff00';
-
+
# blue
$new_color_list["7,0"] = '0000ff';
$new_color_list["7,1"] = '0000cc';
$selected_input = '';
$selected_choose = '';
-
+
for ($i=0; $i < 14; $i++) {
${"selected".$i} = '';
}
${"selected".$i} = ' selected';
continue;
}
- }
+ }
}
if (!isset($message_highlight_list[$theid]['color']))
$selected_choose = ' checked';
echo '<input type="hidden" value="'.$theid.'" name="theid">' . "\n";
echo '<table width="80%" align="center" cellpadding="3" cellspacing="0" border="0">' . "\n";
echo " <tr bgcolor=\"$color[0]\">\n";
- echo " <td align=\"right\" width=\"25%\"><b>\n";
+ echo " <td align=\"right\" nobr><b>\n";
echo _("Identifying name") . ":";
echo ' </b></td>' . "\n";
- echo ' <td width="75%">' . "\n";
+ echo ' <td>' . "\n";
if (isset($message_highlight_list[$theid]['name']))
$disp = $message_highlight_list[$theid]['name'];
else
- $disp = ' ';
- $disp = str_replace('\\\\', '\\', $disp);
- $disp = str_replace('\\"', '"', $disp);
- $disp = str_replace('"', '"', $disp);
+ $disp = '';
+ $disp = htmlspecialchars($disp);
echo " <input type=\"text\" value=\"".$disp."\" name=\"identname\">";
echo " </td>\n";
echo " </tr>\n";
echo ' <tr><td><small><small> </small></small></td></tr>' . "\n";
echo " <tr bgcolor=\"$color[0]\">\n";
- echo ' <td align="right" width="25%"><b>' . "\n";
+ echo ' <td align="right"><b>' . "\n";
echo _("Color") . ':';
echo " </b></td>\n";
- echo ' <td width="75%">' . "\n";
+ echo ' <td>' . "\n";
echo " <input type=\"radio\" name=color_type value=1$selected_choose> <select name=newcolor_choose>\n";
echo " <option value=\"$color_list[0]\"$selected0>" . _("Dark Blue") . "\n";
echo " <option value=\"$color_list[1]\"$selected1>" . _("Dark Green") . "\n";
for($y = 0; $y < 19; $y++) {
$gridindex = "$y,$x";
$gridcolor = $new_color_list[$gridindex];
- $selected = ($gridcolor == $current_color)?'SELECTED':'' ;
+ $selected = ($gridcolor == $current_color)?'SELECTED':'' ;
echo "<td bgcolor=#$gridcolor><input type='radio' name=color_type value='#$gridcolor' $selected>\n";
echo "</td>\n";
}
echo ' <tr><td><small><small> </small></small></td></tr>' . "\n";
echo " <tr bgcolor=\"$color[0]\">\n";
- echo ' <td align="right" width="25%"><b>' . "\n";
- echo _("Match") . ':';
- echo " </b></td>\n";
- echo ' <td width="75%">' . "\n";
+ echo ' <td align="center" colspan=2>' . "\n";
echo " <select name=match_type>\n";
- if (isset($message_highlight_list[$theid]['match_type']) && $message_highlight_list[$theid]['match_type'] == 'from') echo " <option value=\"from\" selected>From\n";
- else echo " <option value=\"from\">From\n";
- if (isset($message_highlight_list[$theid]['match_type']) && $message_highlight_list[$theid]['match_type'] == 'to') echo " <option value=\"to\" selected>To\n";
- else echo " <option value=\"to\">To\n";
- if (isset($message_highlight_list[$theid]['match_type']) && $message_highlight_list[$theid]['match_type'] == 'cc') echo " <option value=\"cc\" selected>Cc\n";
- else echo " <option value=\"cc\">Cc\n";
- if (isset($message_highlight_list[$theid]['match_type']) && $message_highlight_list[$theid]['match_type'] == 'to_cc') echo " <option value=\"to_cc\" selected>To or Cc\n";
- else echo " <option value=\"to_cc\">To or Cc\n";
- if (isset($message_highlight_list[$theid]['match_type']) && $message_highlight_list[$theid]['match_type'] == 'subject') echo " <option value=\"subject\" selected>Subject\n";
- else echo " <option value=\"subject\">Subject\n";
+ oh_opt( 'from',
+ ($message_highlight_list[$theid]['match_type'] == 'from'),
+ _("From") );
+ oh_opt( 'to',
+ ($message_highlight_list[$theid]['match_type'] == 'to'),
+ _("To") );
+ oh_opt( 'cc',
+ ($message_highlight_list[$theid]['match_type'] == 'cc'),
+ _("Cc") );
+ oh_opt( 'to_cc',
+ ($message_highlight_list[$theid]['match_type'] == 'to_cc'),
+ _("To or Cc") );
+ oh_opt( 'subject',
+ ($message_highlight_list[$theid]['match_type'] == 'subject'),
+ _("Subject") );
echo " </select>\n";
+ echo '<b>' . _("Matches") . ':</b> ';
if (isset($message_highlight_list[$theid]['value']))
$disp = $message_highlight_list[$theid]['value'];
else
$disp = '';
- $disp = str_replace('\\\\', '\\', $disp);
- $disp = str_replace('\\"', '"', $disp);
- $disp = str_replace('"', '"', $disp);
- echo ' <nobr><input type="text" value="'.$disp.'" name="value">';
- echo " <nobr></td>\n";
+ $disp = htmlspecialchars($disp);
+ echo ' <input type="text" value="' . $disp .
+ '" name="value" size=40>';
+ echo " </td>\n";
echo " </tr>\n";
echo "</table>\n";
echo '<center><input type="submit" value="' . _("Submit") . "\"></center>\n";
echo "</form>\n";
- do_hook('options_highlight_bottom');
- }
+ }
+ do_hook('options_highlight_bottom');
?>
</body></html>