summaryrefslogtreecommitdiffstats
path: root/editwhines.cgi
diff options
context:
space:
mode:
Diffstat (limited to 'editwhines.cgi')
-rwxr-xr-xeditwhines.cgi74
1 files changed, 24 insertions, 50 deletions
diff --git a/editwhines.cgi b/editwhines.cgi
index 33a7fc499..1f5c954f3 100755
--- a/editwhines.cgi
+++ b/editwhines.cgi
@@ -221,23 +221,14 @@ if ($cgi->param('update')) {
}
}
else {
- my $o_day = $cgi->param("orig_day_$sid");
- my $day = $cgi->param("day_$sid");
- my $o_time = $cgi->param("orig_time_$sid");
- my $time = $cgi->param("time_$sid");
- my $o_mailto = $cgi->param("orig_mailto_$sid");
- my $mailto = $cgi->param("mailto_$sid");
- my $o_mailto_type = lc $cgi->param("orig_mailto_type_$sid");
- my $mailto_type = $cgi->param("mailto_type_$sid");
-
- $o_day = '' unless length($o_day);
- $o_time = '' unless length($o_time);
- $o_mailto = '' unless length($o_mailto);
- $o_mailto_type = '' unless length($o_mailto_type);
- $day = '' unless length($day);
- $time = '' unless length($time);
- $mailto = '' unless length($mailto);
- $mailto_type = '' unless length($mailto_type);
+ my $o_day = $cgi->param("orig_day_$sid") || '';
+ my $day = $cgi->param("day_$sid") || '';
+ my $o_time = $cgi->param("orig_time_$sid") || '';
+ my $time = $cgi->param("time_$sid") || '';
+ my $o_mailto = $cgi->param("orig_mailto_$sid") || '';
+ my $mailto = $cgi->param("mailto_$sid") || '';
+ my $o_mailto_type = $cgi->param("orig_mailto_type_$sid") || 0;
+ my $mailto_type = $cgi->param("mailto_type_$sid") || 0;
my $mailto_id = $userid;
@@ -271,11 +262,11 @@ if ($cgi->param('update')) {
if ( ($o_day ne $day) ||
($o_time ne $time) ||
- ($o_mailto != $mailto) ||
+ ($o_mailto ne $mailto) ||
($o_mailto_type != $mailto_type) ){
- trick_taint($day) if length($day);
- trick_taint($time) if length($time);
+ trick_taint($day);
+ trick_taint($time);
# the schedule table must be locked
$sth = $dbh->prepare("UPDATE whine_schedules " .
@@ -318,42 +309,25 @@ if ($cgi->param('update')) {
}
}
else {
- my $o_sort = $cgi->param("orig_query_sort_$qid");
- my $sort = $cgi->param("query_sort_$qid");
- my $o_queryname = $cgi->param("orig_query_name_$qid");
- my $queryname = $cgi->param("query_name_$qid");
- my $o_title = $cgi->param("orig_query_title_$qid");
- my $title = $cgi->param("query_title_$qid");
+ my $o_sort = $cgi->param("orig_query_sort_$qid") || 0;
+ my $sort = $cgi->param("query_sort_$qid") || 0;
+ my $o_queryname = $cgi->param("orig_query_name_$qid") || '';
+ my $queryname = $cgi->param("query_name_$qid") || '';
+ my $o_title = $cgi->param("orig_query_title_$qid") || '';
+ my $title = $cgi->param("query_title_$qid") || '';
my $o_onemailperbug =
- $cgi->param("orig_query_onemailperbug_$qid");
+ $cgi->param("orig_query_onemailperbug_$qid") || 0;
my $onemailperbug =
- $cgi->param("query_onemailperbug_$qid");
-
- $o_sort = '' unless length($o_sort);
- $o_queryname = '' unless length($o_queryname);
- $o_title = '' unless length($o_title);
- $o_onemailperbug = '' unless length($o_onemailperbug);
- $sort = '' unless length($sort);
- $queryname = '' unless length($queryname);
- $title = '' unless length($title);
- $onemailperbug = '' unless length($onemailperbug);
-
- if ($onemailperbug eq 'on') {
- $onemailperbug = 1;
- }
- elsif ($onemailperbug eq 'off') {
- $onemailperbug = 0;
- }
+ $cgi->param("query_onemailperbug_$qid") ? 1 : 0;
- if ( ($o_sort ne $sort) ||
+ if ( ($o_sort != $sort) ||
($o_queryname ne $queryname) ||
- ($o_onemailperbug xor $onemailperbug) ||
+ ($o_onemailperbug != $onemailperbug) ||
($o_title ne $title) ){
- detaint_natural($sort) if length $sort;
- trick_taint($queryname) if length $queryname;
- trick_taint($title) if length $title;
- trick_taint($onemailperbug) if length $onemailperbug;
+ detaint_natural($sort);
+ trick_taint($queryname);
+ trick_taint($title);
$sth = $dbh->prepare("UPDATE whine_queries " .
"SET sortkey=?, " .