replaced empty() with isset() to avoid parsing zeroes as empty value

This commit is contained in:
Serghey Rodin 2013-08-20 14:10:58 +03:00
commit f822d0daf7
2 changed files with 12 additions and 12 deletions

View file

@ -16,12 +16,12 @@ top_panel($user,$TAB);
//if ($_SESSION['user'] == 'admin') {
if (!empty($_POST['ok'])) {
// Check input
if (empty($_POST['v_min'])) $errors[] = __('minute');
if (empty($_POST['v_hour'])) $errors[] = __('hour');
if (empty($_POST['v_day'])) $errors[] = __('day');
if (empty($_POST['v_month'])) $errors[] = __('month');
if (empty($_POST['v_wday'])) $errors[] = __('day of week');
if (empty($_POST['v_cmd'])) $errors[] = __('cmd');
if (!isset($_POST['v_min'])) $errors[] = __('minute');
if (!isset($_POST['v_hour'])) $errors[] = __('hour');
if (!isset($_POST['v_day'])) $errors[] = __('day');
if (!isset($_POST['v_month'])) $errors[] = __('month');
if (!isset($_POST['v_wday'])) $errors[] = __('day of week');
if (!isset($_POST['v_cmd'])) $errors[] = __('cmd');
// Protect input
$v_min = escapeshellarg($_POST['v_min']);

View file

@ -52,7 +52,7 @@
</tr>
<tr>
<td>
<input type="text" size="20" class="vst-input" name="v_min" <?php if (!empty($v_min)) echo "value=".$v_min; ?>>
<input type="text" size="20" class="vst-input" name="v_min" <?php if (isset($v_min)) echo "value=".$v_min; ?>>
</td>
</tr>
<tr>
@ -62,7 +62,7 @@
</tr>
<tr>
<td>
<input type="text" size="20" class="vst-input" name="v_hour" <?php if (!empty($v_hour)) echo "value=".$v_hour; ?>>
<input type="text" size="20" class="vst-input" name="v_hour" <?php if (isset($v_hour)) echo "value=".$v_hour; ?>>
</td>
</tr>
<tr>
@ -72,7 +72,7 @@
</tr>
<tr>
<td>
<input type="text" size="20" class="vst-input" name="v_day" <?php if (!empty($v_day)) echo "value=".$v_day; ?>>
<input type="text" size="20" class="vst-input" name="v_day" <?php if (isset($v_day)) echo "value=".$v_day; ?>>
</td>
</tr>
<tr>
@ -82,7 +82,7 @@
</tr>
<tr>
<td>
<input type="text" size="20" class="vst-input" name="v_month" <?php if (!empty($v_month)) echo "value=".$v_month; ?>>
<input type="text" size="20" class="vst-input" name="v_month" <?php if (isset($v_month)) echo "value=".$v_month; ?>>
</td>
</tr>
<tr>
@ -92,7 +92,7 @@
</tr>
<tr>
<td>
<input type="text" size="20" class="vst-input" name="v_wday" <?php if (!empty($v_wday)) echo "value=".$v_wday; ?>>
<input type="text" size="20" class="vst-input" name="v_wday" <?php if (isset($v_wday)) echo "value=".$v_wday; ?>>
</td>
</tr>
<tr>
@ -102,7 +102,7 @@
</tr>
<tr>
<td>
<input type="text" size="20" class="vst-input" name="v_cmd" <?php if (!empty($v_cmd)) echo "value='".$v_cmd."'"; ?>>
<input type="text" size="20" class="vst-input" name="v_cmd" <?php if (isset($v_cmd)) echo "value='".$v_cmd."'"; ?>>
</td>
</tr>
</table>