diff -r c72d6d51f3d3 -r c255196bc447 edit.php --- a/edit.php Wed Mar 12 20:45:56 2008 +0000 +++ b/edit.php Tue Mar 25 22:45:31 2008 +0000 @@ -20,346 +20,234 @@ */ require_once("inc/toolkit.inc.php"); +include_once("inc/header.inc.php"); -// Assigning records to user: Check for records owned by user -$recordOwnerError = ''; -if (isset($_POST["action"]) && $_POST["action"]=="record-user") { - if (!is_array($_POST['rowid'])) { - $recordOwnerError = 'No records where selected to assign an sub-owner.'; - } else { - foreach ($_POST["rowid"] as $x_user => $recordid){ - $x_userid = $db->queryOne("SELECT id FROM record_owners WHERE user_id = ".$db->quote($_POST["userid"])." AND record_id=".$db->quote($recordid)); - if (empty($x_userid)) { - add_record_owner($_GET["id"],$_POST["userid"],$recordid); - } - } +$zone_id = "-1"; +if (isset($_GET['id']) && v_num($_GET['id'])) { + $zone_id = $_GET['id']; +} + +if ($zone_id == "-1") { + error(ERR_INV_INPUT); + include_once("inc/footer.inc.php"); + exit; +} + +if (isset($_POST['commit'])) { + foreach ($_POST['record'] as $record) { + edit_record($record); } } -if(isset($_POST['change_slave_master']) && is_numeric($_POST["domain"]) && level(5)) -{ - change_domain_slave_master($_POST['domain'], $_POST['slave_master']); -} -if(isset($_POST['type_change']) && in_array($_POST['newtype'], $server_types)) -{ - change_domain_type($_POST['newtype'], $_GET['id']); -} -if(isset($_POST["newowner"]) && is_numeric($_POST["domain"]) && is_numeric($_POST["newowner"])) -{ - add_owner($_POST["domain"], $_POST["newowner"]); + +if (verify_permission(zone_content_view_others)) { $perm_view = "all" ; } +elseif (verify_permission(zone_content_view_own)) { $perm_view = "own" ; } +else { $perm_view = "none" ; } + +if (verify_permission(zone_content_edit_others)) { $perm_content_edit = "all" ; } +elseif (verify_permission(zone_content_edit_own)) { $perm_content_edit = "own" ; } +else { $perm_content_edit = "none" ; } + +if (verify_permission(zone_meta_edit_others)) { $perm_meta_edit = "all" ; } +elseif (verify_permission(zone_meta_edit_own)) { $perm_meta_edit = "own" ; } +else { $perm_meta_edit = "none" ; } + +$user_is_zone_owner = verify_user_is_owner_zoneid($zone_id); +if ( $perm_meta_edit == "all" || ( $perm_meta_edit == "own" && $user_is_zone_owner == "1") ) { + $meta_edit = "1"; } -if(isset($_POST["del_user"]) && is_numeric($_POST["del_user"]) && level(5)) -{ - delete_owner($_GET["id"], $_POST["del_user"]); + +if(isset($_POST['slave_master_change']) && is_numeric($_POST["domain"]) ) { + change_zone_slave_master($_POST['domain'], $_POST['new_master']); } -$info = get_domain_info_from_id($_GET["id"]); -include_once("inc/header.inc.php"); - -$domain_type=get_domain_type($_GET['id']); -if ($domain_type == "SLAVE" ) { $slave_master=get_domain_slave_master($_GET['id']); }; - -if (strlen($recordOwnerError)) { -?> -
:
- -
:
- -
:
- -

""

- -
-
- - - - - - - - - - - -" . _('Edit zone') . " \"" . get_domain_name_from_id($zone_id) . "\"\n"; + +if ( $perm_view == "none" || $perm_view == "own" && $user_is_zone_owner == "0" ) { + error(ERR_PERM_VIEW_ZONE); +} else { + echo "
\n"; + show_pages($record_count,ROWAMOUNT,$zone_id); + echo "
\n"; + + $records = get_records_from_domain_id($zone_id,ROWSTART,ROWAMOUNT); + if ( $records == "-1" ) { + echo "

" . _("This zone does not have any records. Weird.") . "

\n"; + } else { + echo " \n"; + echo "
- - - "> - -
\n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + foreach ($records as $r) { + echo " \n"; + echo " \n"; + echo " \n"; + if ( $domain_type == "SLAVE" || $perm_content_edit == "none" || $perm_content_edit == "own" && $user_is_zone_owner == "0" ) { + echo " \n"; + } else { + echo " \n"; + } + echo " \n"; + echo " \n"; + echo " \n"; + if ($r['type'] == "MX") { + echo " \n"; + } else { + echo " \n"; + } + echo " \n"; + echo " \n"; + } + echo "
 " . _('Name') . "" . _('Type') . "" . _('Content') . "" . _('Priority') . "" . _('TTL') . "
 \n"; + echo " + \"[\n"; + echo " + \"[\n"; + echo " \n"; + echo " \n"; + echo "  
\n"; + echo " \n"; + echo " "; + } + + if ( $perm_content_edit == "all" || $perm_content_edit == "own" && $user_is_zone_owner == "1" ) { + if ( $domain_type != "SLAVE") { + echo "   \n"; + } + echo " \n"; + } + + echo "
\n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + + $owners = get_users_from_domain_id($zone_id); + + if ($owners == "-1") { + echo " "; + } else { + if ($meta_edit) { + foreach ($owners as $owner) { + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + } + } else { + foreach ($owners as $owner) { + echo " "; + } + } + + } + if ($meta_edit) { + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + } + echo " \n"; + echo " \n"; + echo " \n"; + + if ($meta_edit) { + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + } else { + echo " \n"; + } + + if ($domain_type == "SLAVE" ) { + $slave_master=get_domain_slave_master($zone_id); + echo " \n"; + echo " \n"; + echo " \n"; + + if ($meta_edit) { + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + } else { + echo " \n"; } } - else - { -?> - - - - - - - - - - -
" . _('Owner of zone') . "
" . _('No owner set or this zone!') . "
" . $owner["fullname"] . "\n"; + echo " \n"; + echo " \n"; + echo "
" . $owner["fullname"] . " 
\n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo "
" . _('Type of zone') . "
\n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo "
" . strtolower($domain_type) . " 
" . _('IP address of master NS') . "
\n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo "
" . $slave_master . " 
- "> - - - -
-
-
- - - - - - "> - - - - - - - - - - - - "> - - - - - - -
- - - -
- -
- - - -
-
-
-
-
- - - - - - - - - -
-
-
\n"; + echo "
\n"; // eo div meta } -?> -
- - '" value="">   - - '" value=""> - -
-
- -
-
?id=" method="post"> - - - - - -" . _('Sub-owners') . ""; - } -?> - - - - - - - - - - - - - - - - - - - - - - - - - - -
 
- - ">[ <?php echo _('Edit record'); ?> ] - ">[ <?php echo _('Delete record'); ?> ] - - - - -query("SELECT r.user_id,u.username,u.fullname FROM record_owners as r, users as u WHERE r.record_id=".$db->quote($r['id'])." AND u.id=r.user_id"); - echo ""; -?> -
-
-
- - arrow - - -
-