[feladat @ 290]
Fixed a couple of warnings on undefined variables and array indexes. Closes: #71.
--- a/add_record.php Wed Jun 18 19:11:39 2008 +0000
+++ b/add_record.php Fri Jun 20 12:21:03 2008 +0000
@@ -49,9 +49,23 @@
$prio = $_GET['prio'];
}
-$name = $_POST['name'];
-$type = $_POST['type'];
-$content = $_POST['content'];
+if (isset($_POST['name'])) {
+ $name = $_POST['name'];
+} else {
+ $name = "";
+}
+
+if (isset($_POST['type'])) {
+ $type = $_POST['type'];
+} else {
+ $type = "";
+}
+
+if (isset($_POST['content'])) {
+ $content = $_POST['content'];
+} else {
+ $content = "";
+}
if ($zone_id == "-1") {
error(ERR_INV_INPUT);
@@ -63,13 +77,13 @@
$zone_type = get_domain_type($zone_id);
$zone_name = get_zone_name_from_id($zone_id);
-if ($_POST["commit"]) {
+if (isset($_POST["commit"])) {
if ( $zone_type == "SLAVE" || $perm_content_edit == "none" || $perm_content_edit == "own" && $user_is_zone_owner == "0" ) {
error(ERR_PERM_ADD_RECORD);
} else {
if ( add_record($zone_id, $name, $type, $content, $ttl, $prio)) {
success(_('The record was successfully added.'));
- unset($zone_id, $name, $type, $content, $ttl, $prio);
+ $name = $type = $content = $ttl = $prio = "";
}
}
}
@@ -100,7 +114,7 @@
if ($type == $record_type) {
$add = " SELECTED";
} else {
- unset ($add);
+ $add = "";
}
} else {
if (eregi('in-addr.arpa', $zone_name) && strtoupper($record_type) == 'PTR') {
@@ -108,7 +122,7 @@
} elseif (strtoupper($record_type) == 'A') {
$add = " SELECTED";
} else {
- unset($add);
+ $add = "";
}
}
echo " <option" . $add . " value=\"" . $record_type . "\">" . $record_type . "</option>\n";
--- a/inc/dns.inc.php Wed Jun 18 19:11:39 2008 +0000
+++ b/inc/dns.inc.php Fri Jun 20 12:21:03 2008 +0000
@@ -376,7 +376,7 @@
$ttl = $dns_ttl;
}
- if (!is_numeric($ttl) || $prio < 0 || $prio > 2147483647 ) {
+ if (!is_numeric($ttl) || $ttl < 0 || $ttl > 2147483647 ) {
error(ERR_DNS_INV_TTL); return false;
}
--- a/inc/record.inc.php Wed Jun 18 19:11:39 2008 +0000
+++ b/inc/record.inc.php Fri Jun 20 12:21:03 2008 +0000
@@ -23,7 +23,7 @@
global $db;
$query = "SELECT COUNT(id) FROM domains WHERE id = " . $db->quote($zid);
$count = $db->queryOne($query);
- if (PEAR::isError($result)) { error($result->getMessage()); return false; }
+ if (PEAR::isError($count)) { error($result->getMessage()); return false; }
return $count;
}