Skip to content

Commit f822d0d

Browse files
committed
replaced empty() with isset() to avoid parsing zeroes as empty value
1 parent f3ec3bb commit f822d0d

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

web/add/cron/index.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,12 @@
1616
//if ($_SESSION['user'] == 'admin') {
1717
if (!empty($_POST['ok'])) {
1818
// Check input
19-
if (empty($_POST['v_min'])) $errors[] = __('minute');
20-
if (empty($_POST['v_hour'])) $errors[] = __('hour');
21-
if (empty($_POST['v_day'])) $errors[] = __('day');
22-
if (empty($_POST['v_month'])) $errors[] = __('month');
23-
if (empty($_POST['v_wday'])) $errors[] = __('day of week');
24-
if (empty($_POST['v_cmd'])) $errors[] = __('cmd');
19+
if (!isset($_POST['v_min'])) $errors[] = __('minute');
20+
if (!isset($_POST['v_hour'])) $errors[] = __('hour');
21+
if (!isset($_POST['v_day'])) $errors[] = __('day');
22+
if (!isset($_POST['v_month'])) $errors[] = __('month');
23+
if (!isset($_POST['v_wday'])) $errors[] = __('day of week');
24+
if (!isset($_POST['v_cmd'])) $errors[] = __('cmd');
2525

2626
// Protect input
2727
$v_min = escapeshellarg($_POST['v_min']);

web/templates/admin/edit_cron.html

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
</tr>
5353
<tr>
5454
<td>
55-
<input type="text" size="20" class="vst-input" name="v_min" <?php if (!empty($v_min)) echo "value=".$v_min; ?>>
55+
<input type="text" size="20" class="vst-input" name="v_min" <?php if (isset($v_min)) echo "value=".$v_min; ?>>
5656
</td>
5757
</tr>
5858
<tr>
@@ -62,7 +62,7 @@
6262
</tr>
6363
<tr>
6464
<td>
65-
<input type="text" size="20" class="vst-input" name="v_hour" <?php if (!empty($v_hour)) echo "value=".$v_hour; ?>>
65+
<input type="text" size="20" class="vst-input" name="v_hour" <?php if (isset($v_hour)) echo "value=".$v_hour; ?>>
6666
</td>
6767
</tr>
6868
<tr>
@@ -72,7 +72,7 @@
7272
</tr>
7373
<tr>
7474
<td>
75-
<input type="text" size="20" class="vst-input" name="v_day" <?php if (!empty($v_day)) echo "value=".$v_day; ?>>
75+
<input type="text" size="20" class="vst-input" name="v_day" <?php if (isset($v_day)) echo "value=".$v_day; ?>>
7676
</td>
7777
</tr>
7878
<tr>
@@ -82,7 +82,7 @@
8282
</tr>
8383
<tr>
8484
<td>
85-
<input type="text" size="20" class="vst-input" name="v_month" <?php if (!empty($v_month)) echo "value=".$v_month; ?>>
85+
<input type="text" size="20" class="vst-input" name="v_month" <?php if (isset($v_month)) echo "value=".$v_month; ?>>
8686
</td>
8787
</tr>
8888
<tr>
@@ -92,7 +92,7 @@
9292
</tr>
9393
<tr>
9494
<td>
95-
<input type="text" size="20" class="vst-input" name="v_wday" <?php if (!empty($v_wday)) echo "value=".$v_wday; ?>>
95+
<input type="text" size="20" class="vst-input" name="v_wday" <?php if (isset($v_wday)) echo "value=".$v_wday; ?>>
9696
</td>
9797
</tr>
9898
<tr>
@@ -102,7 +102,7 @@
102102
</tr>
103103
<tr>
104104
<td>
105-
<input type="text" size="20" class="vst-input" name="v_cmd" <?php if (!empty($v_cmd)) echo "value='".$v_cmd."'"; ?>>
105+
<input type="text" size="20" class="vst-input" name="v_cmd" <?php if (isset($v_cmd)) echo "value='".$v_cmd."'"; ?>>
106106
</td>
107107
</tr>
108108
</table>

0 commit comments

Comments
 (0)