edit.php
changeset 45 eddff78bf57f
parent 41 48f2ac49ec24
child 47 ae140472d97c
equal deleted inserted replaced
44:f8886b13c495 45:eddff78bf57f
     1 <?php
     1 <?php
     2 
     2 
     3 require_once("inc/toolkit.inc.php");
     3 require_once("inc/toolkit.inc.php");
     4 
     4 
     5 // Assigning records to user: Check for records owned by user
     5 // Assigning records to user: Check for records owned by user
     6 
     6 $recordOwnerError = '';
     7 if (isset($_POST["action"]) && $_POST["action"]=="record-user") {
     7 if (isset($_POST["action"]) && $_POST["action"]=="record-user") {
     8 	foreach ($_POST["rowid"] as $x_user => $x_value){
     8 	if (!is_array($_POST['rowid'])) {
     9 		$x_userid = $db->queryOne("SELECT id FROM record_owners WHERE user_id = '".$_POST["userid"]."' AND record_id='".$x_value."'");
     9 		$recordOwnerError = 'No records where selected to assign an sub-owner.';
    10 		if (empty($x_userid)) {
    10 	} else {
    11 			$db->query("INSERT INTO record_owners SET user_id = '".$_POST["userid"]."',record_id='".$x_value."'");
    11 		foreach ($_POST["rowid"] as $x_user => $x_value){
       
    12 			$x_userid = $db->queryOne("SELECT id FROM record_owners WHERE user_id = '".$_POST["userid"]."' AND record_id='".$x_value."'");
       
    13 			if (empty($x_userid)) {
       
    14 				$db->query("INSERT INTO record_owners SET user_id = '".$_POST["userid"]."',record_id='".$x_value."'");
       
    15 			}
    12 		}
    16 		}
    13 	}
    17 	}
    14 }
    18 }
    15 if(isset($_POST['change_slave_master']) && is_numeric($_POST["domain"]) && level(5))
    19 if(isset($_POST['change_slave_master']) && is_numeric($_POST["domain"]) && level(5))
    16 {
    20 {
    31 $info = get_domain_info_from_id($_GET["id"]);
    35 $info = get_domain_info_from_id($_GET["id"]);
    32 include_once("inc/header.inc.php");
    36 include_once("inc/header.inc.php");
    33 	
    37 	
    34 $domain_type=get_domain_type($_GET['id']);
    38 $domain_type=get_domain_type($_GET['id']);
    35 if ($domain_type == "SLAVE" ) { $slave_master=get_domain_slave_master($_GET['id']); };
    39 if ($domain_type == "SLAVE" ) { $slave_master=get_domain_slave_master($_GET['id']); };
       
    40 
       
    41 if (strlen($recordOwnerError)) {
       
    42 ?>
       
    43   <div class="error"><?php echo _('Error'); ?>: <?php echo _($recordOwnerError); ?></div>
       
    44 <?php	
       
    45 }
    36 
    46 
    37 if(!isset($info["ownerid"]) && $domain_type != "SLAVE")
    47 if(!isset($info["ownerid"]) && $domain_type != "SLAVE")
    38 {
    48 {
    39 ?>
    49 ?>
    40     <div class="error"><? echo _('Error'); ?>: <? echo ('There is no owner for this zone, please assign someone.'); ?></div>
    50     <div class="error"><? echo _('Error'); ?>: <? echo ('There is no owner for this zone, please assign someone.'); ?></div>