|
@@ -48,7 +48,6 @@ if (isset($_GET['value'])) {
|
|
$value = $_GET['value'];
|
|
$value = $_GET['value'];
|
|
}
|
|
}
|
|
|
|
|
|
-$SCRIPT_NAME = $_SERVER['SCRIPT_NAME'];
|
|
|
|
/* end of get globals */
|
|
/* end of get globals */
|
|
|
|
|
|
function oh_opt( $val, $sel, $tit ) {
|
|
function oh_opt( $val, $sel, $tit ) {
|
|
@@ -66,27 +65,41 @@ if (! isset($message_highlight_list)) {
|
|
}
|
|
}
|
|
|
|
|
|
if ($action == 'delete' && isset($theid)) {
|
|
if ($action == 'delete' && isset($theid)) {
|
|
- removePref($data_dir, $username, "highlight$theid");
|
|
|
|
- header( "Location: $SCRIPT_NAME" );
|
|
|
|
|
|
+
|
|
|
|
+ $new_rules = array();
|
|
|
|
+ foreach($message_highlight_list as $rid => $rule) {
|
|
|
|
+ if($rid != $theid) {
|
|
|
|
+ $new_rules[] = $rule;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ $message_highlight_list = $new_rules;
|
|
|
|
+
|
|
|
|
+ setPref($data_dir, $username, 'hililist', serialize($message_highlight_list));
|
|
|
|
+
|
|
|
|
+ header( 'Location: options_highlight.php' );
|
|
exit;
|
|
exit;
|
|
} else if ($action == 'save') {
|
|
} else if ($action == 'save') {
|
|
- if (!$theid) $theid = 0;
|
|
|
|
- $identname = str_replace(',', ' ', $identname);
|
|
|
|
|
|
+
|
|
if ($color_type == 1) $newcolor = $newcolor_choose;
|
|
if ($color_type == 1) $newcolor = $newcolor_choose;
|
|
elseif ($color_type == 2) $newcolor = $newcolor_input;
|
|
elseif ($color_type == 2) $newcolor = $newcolor_input;
|
|
else $newcolor = $color_type;
|
|
else $newcolor = $color_type;
|
|
|
|
|
|
- $newcolor = str_replace(',', '', $newcolor);
|
|
|
|
$newcolor = str_replace('#', '', $newcolor);
|
|
$newcolor = str_replace('#', '', $newcolor);
|
|
$newcolor = str_replace('"', '', $newcolor);
|
|
$newcolor = str_replace('"', '', $newcolor);
|
|
$newcolor = str_replace('\'', '', $newcolor);
|
|
$newcolor = str_replace('\'', '', $newcolor);
|
|
$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;
|
|
|
|
|
|
+ if(isset($theid)) {
|
|
|
|
+ $message_highlight_list[$theid] =
|
|
|
|
+ array( 'name' => $identname, 'color' => $newcolor,
|
|
|
|
+ 'value' => $value, 'match_type' => $match_type );
|
|
|
|
+ } else {
|
|
|
|
+ $message_highlight_list[] =
|
|
|
|
+ array( 'name' => $identname, 'color' => $newcolor,
|
|
|
|
+ 'value' => $value, 'match_type' => $match_type );
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ setPref($data_dir, $username, 'hililist', serialize($message_highlight_list));
|
|
}
|
|
}
|
|
displayPageHeader($color, 'None');
|
|
displayPageHeader($color, 'None');
|
|
|
|
|
|
@@ -147,11 +160,6 @@ if (count($message_highlight_list) >= 1) {
|
|
"<br>\n";
|
|
"<br>\n";
|
|
}
|
|
}
|
|
if ($action == 'edit' || $action == 'add') {
|
|
if ($action == 'edit' || $action == 'add') {
|
|
- if (!isset($theid))
|
|
|
|
- {
|
|
|
|
- $theid = count($message_highlight_list);
|
|
|
|
- $message_highlight_list[$theid] = array();
|
|
|
|
- }
|
|
|
|
|
|
|
|
$color_list[0] = '4444aa';
|
|
$color_list[0] = '4444aa';
|
|
$color_list[1] = '44aa44';
|
|
$color_list[1] = '44aa44';
|
|
@@ -295,7 +303,7 @@ if ($action == 'edit' || $action == 'add') {
|
|
for ($i=0; $i < 14; $i++) {
|
|
for ($i=0; $i < 14; $i++) {
|
|
${"selected".$i} = '';
|
|
${"selected".$i} = '';
|
|
}
|
|
}
|
|
- if (isset($message_highlight_list[$theid]['color'])) {
|
|
|
|
|
|
+ if ($action == 'edit' && isset($message_highlight_list[$theid]['color'])) {
|
|
for ($i=0; $i < 14; $i++) {
|
|
for ($i=0; $i < 14; $i++) {
|
|
if ($color_list[$i] == $message_highlight_list[$theid]['color']) {
|
|
if ($color_list[$i] == $message_highlight_list[$theid]['color']) {
|
|
$selected_choose = ' checked';
|
|
$selected_choose = ' checked';
|
|
@@ -305,7 +313,7 @@ if ($action == 'edit' || $action == 'add') {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- if (isset($message_highlight_list[$theid]['color'])) {
|
|
|
|
|
|
+ if ($action == 'edit' && isset($message_highlight_list[$theid]['color'])) {
|
|
$current_color = $message_highlight_list[$theid]['color'];
|
|
$current_color = $message_highlight_list[$theid]['color'];
|
|
}
|
|
}
|
|
else {
|
|
else {
|
|
@@ -332,14 +340,15 @@ if ($action == 'edit' || $action == 'add') {
|
|
|
|
|
|
echo '<form name="f" action="options_highlight.php">' . "\n";
|
|
echo '<form name="f" action="options_highlight.php">' . "\n";
|
|
echo '<input type="hidden" value="save" name="action">' . "\n";
|
|
echo '<input type="hidden" value="save" name="action">' . "\n";
|
|
- echo '<input type="hidden" value="'.$theid.'" name="theid">' . "\n";
|
|
|
|
|
|
+ if($action == 'edit')
|
|
|
|
+ echo '<input type="hidden" value="'.$theid.'" name="theid">' . "\n";
|
|
echo html_tag( 'table', '', 'center', '', 'width="80%" cellpadding="3" cellspacing="0" border="0"' ) . "\n";
|
|
echo html_tag( 'table', '', 'center', '', 'width="80%" cellpadding="3" cellspacing="0" border="0"' ) . "\n";
|
|
echo html_tag( 'tr', '', '', $color[0] ) . "\n";
|
|
echo html_tag( 'tr', '', '', $color[0] ) . "\n";
|
|
echo html_tag( 'td', '', 'right', '', 'nowrap' ) . "<b>\n";
|
|
echo html_tag( 'td', '', 'right', '', 'nowrap' ) . "<b>\n";
|
|
echo _("Identifying name") . ":";
|
|
echo _("Identifying name") . ":";
|
|
echo ' </b></td>' . "\n";
|
|
echo ' </b></td>' . "\n";
|
|
echo html_tag( 'td', '', 'left' ) . "\n";
|
|
echo html_tag( 'td', '', 'left' ) . "\n";
|
|
- if (isset($message_highlight_list[$theid]['name']))
|
|
|
|
|
|
+ if ($action == 'edit' && isset($message_highlight_list[$theid]['name']))
|
|
$disp = $message_highlight_list[$theid]['name'];
|
|
$disp = $message_highlight_list[$theid]['name'];
|
|
else
|
|
else
|
|
$disp = '';
|
|
$disp = '';
|
|
@@ -412,7 +421,7 @@ if ($action == 'edit' || $action == 'add') {
|
|
_("Subject") );
|
|
_("Subject") );
|
|
echo " </select>\n";
|
|
echo " </select>\n";
|
|
echo '<b>' . _("Matches") . ':</b> ';
|
|
echo '<b>' . _("Matches") . ':</b> ';
|
|
- if (isset($message_highlight_list[$theid]['value']))
|
|
|
|
|
|
+ if ($action == 'edit' && isset($message_highlight_list[$theid]['value']))
|
|
$disp = $message_highlight_list[$theid]['value'];
|
|
$disp = $message_highlight_list[$theid]['value'];
|
|
else
|
|
else
|
|
$disp = '';
|
|
$disp = '';
|