[feladat @ 231]
authorrejo
Thu, 03 Apr 2008 22:32:52 +0000
changeset 127 e2c54e888f7e
parent 126 cb06e3e29ed8
child 128 12f5e0869676
[feladat @ 231] Input for edit_record function in edit_record.php was array with incorrect fields. Fixed. This closes ticket:32.
edit.php
edit_record.php
inc/record.inc.php
--- a/edit.php	Thu Apr 03 21:48:36 2008 +0000
+++ b/edit.php	Thu Apr 03 22:32:52 2008 +0000
@@ -113,7 +113,7 @@
 			echo "      <td class=\"u\">\n";
 			echo "       <select name=\"record[" . $r['id'] . "][type]\">\n";
 			foreach (get_record_types() as $type_available) {
-				if ($type_available == $r["type"]) {
+				if ($type_available == $r['type']) {
 					$add = " SELECTED";
 				} else {
 					$add = "";
--- a/edit_record.php	Thu Apr 03 21:48:36 2008 +0000
+++ b/edit_record.php	Thu Apr 03 22:32:52 2008 +0000
@@ -34,7 +34,7 @@
 elseif (verify_permission('zone_meta_edit_own')) { $perm_meta_edit = "own" ; }
 else { $perm_meta_edit = "none" ; }
 
-$zid = get_zone_id_from_record_id($_GET["id"]);
+$zid = get_zone_id_from_record_id($_GET['id']);
 
 $user_is_zone_owner = verify_user_is_owner_zoneid($zid);
 $zone_type = get_domain_type($zid);
@@ -44,7 +44,7 @@
 	if ( $zone_type == "SLAVE" || $perm_content_edit == "none" || $perm_content_edit == "own" && $user_is_zone_owner == "0" ) {
 		error(ERR_PERM_EDIT_RECORD);
 	} else {
-		$ret_val = edit_record($_POST["recordid"], $_POST["domainid"], $_POST["name"], $_POST["type"], $_POST["content"], $_POST["ttl"], $_POST["prio"]);
+		$ret_val = edit_record($_POST);
 		if ( $ret_val == "1" ) {
 			success(SUC_RECORD_UPD);
 		} else {
@@ -80,8 +80,8 @@
 		echo "       <td>" . $record["ttl"] . "</td>\n";
 		echo "      </tr>\n";
 	} else {
-		echo "      <input type=\"hidden\" name=\"recordid\" value=\"" . $_GET["id"] . "\">\n";
-		echo "      <input type=\"hidden\" name=\"domainid\" value=\"" . $zid . "\">\n";
+		echo "      <input type=\"hidden\" name=\"rid\" value=\"" . $_GET["id"] . "\">\n";
+		echo "      <input type=\"hidden\" name=\"zid\" value=\"" . $zid . "\">\n";
 		echo "      <tr>\n";
 		echo "       <td><input type=\"text\" name=\"name\" value=\"" . trim(str_replace($zone_name, '', $record["name"]), '.') . "\" class=\"input\">." . $zone_name . "</td>\n";
 		echo "       <td>IN</td>\n";
--- a/inc/record.inc.php	Thu Apr 03 21:48:36 2008 +0000
+++ b/inc/record.inc.php	Thu Apr 03 22:32:52 2008 +0000
@@ -112,6 +112,7 @@
 		global $db;
 		// TODO: no need to check for numeric-ness of zone id if we check with validate_input as well?
 		if (is_numeric($record['zid'])) {
+			debug_print($record['type']);
 			validate_input($record['zid'], $record['type'], $record['content'], $record['name'], $record['prio'], $record['ttl']);
 			$query = "UPDATE records 
 					SET name=".$db->quote($record['name']).",