edit.php
changeset 71 e1b918eaf69a
parent 65 ce1c4d5e1576
child 75 a53200a76f9d
equal deleted inserted replaced
70:47248e2af079 71:e1b918eaf69a
    58 if ($domain_type == "SLAVE" ) { $slave_master=get_domain_slave_master($_GET['id']); };
    58 if ($domain_type == "SLAVE" ) { $slave_master=get_domain_slave_master($_GET['id']); };
    59 
    59 
    60 if (strlen($recordOwnerError)) {
    60 if (strlen($recordOwnerError)) {
    61 ?>
    61 ?>
    62   <div class="error"><?php echo _('Error'); ?>: <?php echo _($recordOwnerError); ?></div>
    62   <div class="error"><?php echo _('Error'); ?>: <?php echo _($recordOwnerError); ?></div>
    63 <?php	
    63 <?php
    64 }
    64 }
    65 
    65 
    66 if(!isset($info["ownerid"]) && $domain_type != "SLAVE")
    66 if(!isset($info["ownerid"]) && $domain_type != "SLAVE")
    67 {
    67 {
    68 ?>
    68 ?>
    69     <div class="error"><? echo _('Error'); ?>: <? echo ('There is no owner for this zone, please assign someone.'); ?></div>
    69     <div class="error"><?php echo _('Error'); ?>: <?php echo ('There is no owner for this zone, please assign someone.'); ?></div>
    70 <?
    70 <?php
    71 }
    71 }
    72 if ($domain_type == "SLAVE" && ! $slave_master )
    72 if ($domain_type == "SLAVE" && ! $slave_master )
    73 {
    73 {
    74 ?>
    74 ?>
    75     <div class="error"><? echo _('Error'); ?>: <? echo _('Type of this zone is "slave", but there is no IP address for it\'s master given.'); ?></div>
    75     <div class="error"><?php echo _('Error'); ?>: <?php echo _('Type of this zone is "slave", but there is no IP address for it\'s master given.'); ?></div>
    76 <?
    76 <?php
    77 }
    77 }
    78 ?>
    78 ?>
    79     <h2><? echo _('Edit zone'); ?> "<? echo get_domain_name_from_id($_GET["id"]) ?>"</h2>
    79     <h2><?php echo _('Edit zone'); ?> "<?php echo get_domain_name_from_id($_GET["id"]) ?>"</h2>
    80 <?
    80 <?php
    81 if (level(5)) 
    81 if (level(5)) 
    82 { ?>	
    82 { ?>	
    83        <div id="meta">
    83        <div id="meta">
    84         <div id="meta-left">
    84         <div id="meta-left">
    85 	 <table>
    85 	 <table>
    86    	  <tr>
    86    	  <tr>
    87   	   <th colspan="2"><? echo _('Owner of zone'); ?></th>
    87   	   <th colspan="2"><?php echo _('Owner of zone'); ?></th>
    88   	  </tr>
    88   	  </tr>
    89 <?
    89 <?php
    90 	if(isset($info["ownerid"]))
    90 	if(isset($info["ownerid"]))
    91 	{
    91 	{
    92 		$userRes = get_users_from_domain_id($_GET["id"]);
    92 		$userRes = get_users_from_domain_id($_GET["id"]);
    93 		foreach($userRes as $user)
    93 		foreach($userRes as $user)
    94 		{ ?>
    94 		{ ?>
    95   	  <tr>
    95   	  <tr>
    96   	   <form method="post" action="edit.php?id=<? echo $_GET['id']?>">
    96   	   <form method="post" action="edit.php?id=<?php echo $_GET['id']?>">
    97   	    <td>
    97   	    <td>
    98 	     <? echo $user["fullname"]?>
    98 	     <?php echo $user["fullname"]?>
    99 	    </td>
    99 	    </td>
   100             <td>
   100             <td>
   101   	     <input type="hidden" name="del_user" value="<? echo $user["id"]?>">
   101   	     <input type="hidden" name="del_user" value="<?php echo $user["id"]?>">
   102              <input type="submit" class="sbutton" name="co" value="<? echo _('Delete'); ?>">
   102              <input type="submit" class="sbutton" name="co" value="<?php echo _('Delete'); ?>">
   103   	    </td>
   103   	    </td>
   104            </form>
   104            </form>
   105   	  </tr>
   105   	  </tr>
   106 <?
   106 <?php
   107 		}
   107 		}
   108 	}
   108 	}
   109 	else
   109 	else
   110 	{
   110 	{
   111 ?>
   111 ?>
   112 	  <tr>
   112 	  <tr>
   113 	   <td><? echo _('No owner set or this zone!'); ?></td>
   113 	   <td><?php echo _('No owner set or this zone!'); ?></td>
   114 	  </tr>
   114 	  </tr>
   115 <?
   115 <?php
   116 	}
   116 	}
   117   ?>
   117   ?>
   118           <tr>
   118           <tr>
   119   	   <form method="post" action="edit.php?id=<? echo $_GET['id']?>">
   119   	   <form method="post" action="edit.php?id=<?php echo $_GET['id']?>">
   120   	    <td>
   120   	    <td>
   121   	     <input type="hidden" name="domain" value="<? echo $_GET["id"] ?>">
   121   	     <input type="hidden" name="domain" value="<?php echo $_GET["id"] ?>">
   122   	     <select name="newowner">
   122   	     <select name="newowner">
   123   			<?
   123   			<?php
   124   			$users = show_users();
   124   			$users = show_users();
   125   			foreach ($users as $u)
   125   			foreach ($users as $u)
   126   			{
   126   			{
   127   				unset($add);
   127   				unset($add);
   128   				if ($u["id"] == $info["ownerid"])
   128   				if ($u["id"] == $info["ownerid"])
   129   				{
   129   				{
   130   					$add = " SELECTED";
   130   					$add = " SELECTED";
   131   				}
   131   				}
   132   				?>
   132   				?>
   133   				<option<? echo $add ?> value="<? echo $u["id"] ?>"><? echo $u["fullname"] ?></option><?
   133   				<option<?php echo $add ?> value="<?php echo $u["id"] ?>"><?php echo $u["fullname"] ?></option><?php
   134   			}
   134   			}
   135   			?>
   135   			?>
   136   			</select>
   136   			</select>
   137   	    </td>
   137   	    </td>
   138   	    <td>
   138   	    <td>
   139      	     <input type="submit" class="sbutton" name="co" value="<? echo _('Add'); ?>">
   139      	     <input type="submit" class="sbutton" name="co" value="<?php echo _('Add'); ?>">
   140             </td>
   140             </td>
   141   	   </form>
   141   	   </form>
   142   	  </tr>
   142   	  </tr>
   143          </table>
   143          </table>
   144 	</div> <? // eo div meta-left ?>
   144 	</div> <?php // eo div meta-left ?>
   145         <div id="meta-right">
   145         <div id="meta-right">
   146          <table>
   146          <table>
   147 	  <tr>
   147 	  <tr>
   148 	   <th colspan="2"><? echo _('Type of zone'); ?></th>
   148 	   <th colspan="2"><?php echo _('Type of zone'); ?></th>
   149 	  </tr>
   149 	  </tr>
   150 	  <form action="<? echo $_SERVER['PHP_SELF']?>?id=<? echo $_GET['id']?>" method="post">
   150 	  <form action="<?php echo $_SERVER['PHP_SELF']?>?id=<?php echo $_GET['id']?>" method="post">
   151 	   <input type="hidden" name="domain" value="<? echo $_GET["id"] ?>">
   151 	   <input type="hidden" name="domain" value="<?php echo $_GET["id"] ?>">
   152 	   <tr>
   152 	   <tr>
   153 	    <td>
   153 	    <td>
   154 	     <select name="newtype">
   154 	     <select name="newtype">
   155 <?
   155 <?php
   156 	foreach($server_types as $s)
   156 	foreach($server_types as $s)
   157 	{
   157 	{
   158 		unset($add);
   158 		unset($add);
   159 		if ($s == $domain_type)
   159 		if ($s == $domain_type)
   160 		{
   160 		{
   161 			$add = " SELECTED";
   161 			$add = " SELECTED";
   162 		}
   162 		}
   163 ?>
   163 ?>
   164               <option<? echo $add ?> value="<? echo $s?>"><? echo $s?></option><?
   164               <option<?php echo $add ?> value="<?php echo $s?>"><?php echo $s?></option><?php
   165 	}
   165 	}
   166 ?>
   166 ?>
   167              </select>
   167              </select>
   168             </td>
   168             </td>
   169 	    <td>
   169 	    <td>
   170 	     <input type="submit" class="sbutton" name="type_change" value="<? echo _('Change'); ?>">
   170 	     <input type="submit" class="sbutton" name="type_change" value="<?php echo _('Change'); ?>">
   171 	    </td>
   171 	    </td>
   172 	   </tr>
   172 	   </tr>
   173 	  </form>
   173 	  </form>
   174 
   174 
   175 <?
   175 <?php
   176 	if ($domain_type == "SLAVE" ) 
   176 	if ($domain_type == "SLAVE" ) 
   177 	{ 
   177 	{ 
   178 		$slave_master=get_domain_slave_master($_GET['id']);
   178 		$slave_master=get_domain_slave_master($_GET['id']);
   179 ?>
   179 ?>
   180           <tr>
   180           <tr>
   181 	   <th colspan="2">
   181 	   <th colspan="2">
   182 	    <? echo _('IP address of master NS'); ?>
   182 	    <?php echo _('IP address of master NS'); ?>
   183 	   </th>
   183 	   </th>
   184 	  </tr>
   184 	  </tr>
   185 	  <form action="<? echo $_SERVER['PHP_SELF']?>?&amp;id=<? echo $_GET['id']?>" method="post">
   185 	  <form action="<?php echo $_SERVER['PHP_SELF']?>?&amp;id=<?php echo $_GET['id']?>" method="post">
   186 	   <input type="hidden" name="domain" value="<? echo $_GET["id"] ?>">
   186 	   <input type="hidden" name="domain" value="<?php echo $_GET["id"] ?>">
   187 	   <tr>
   187 	   <tr>
   188 	    <td>
   188 	    <td>
   189 	     <input type="text" name="slave_master" value="<? echo $slave_master; ?>" class="input">
   189 	     <input type="text" name="slave_master" value="<?php echo $slave_master; ?>" class="input">
   190             </td>
   190             </td>
   191             <td>
   191             <td>
   192 	     <input type="submit" class="sbutton" name="change_slave_master" value="<? echo _('Change'); ?>">
   192 	     <input type="submit" class="sbutton" name="change_slave_master" value="<?php echo _('Change'); ?>">
   193             </td>
   193             </td>
   194            </tr>
   194            </tr>
   195           </form>
   195           </form>
   196 <?
   196 <?php
   197 	}
   197 	}
   198 ?>
   198 ?>
   199          </table>  
   199          </table>  
   200         </div> <? // eo div meta-right ?>
   200         </div> <?php // eo div meta-right ?>
   201        </div> <? // eo div meta 
   201        </div> <?php // eo div meta 
   202 }
   202 }
   203 else
   203 else
   204 {
   204 {
   205 ?>
   205 ?>
   206        <div id="meta">
   206        <div id="meta">
   207         <div id="meta-right">
   207         <div id="meta-right">
   208          <table>
   208          <table>
   209  	  <tr>
   209  	  <tr>
   210  	   <th><? echo _('Type of zone'); ?></th><td class="y"><? echo $domain_type; ?></td>
   210  	   <th><?php echo _('Type of zone'); ?></th><td class="y"><?php echo $domain_type; ?></td>
   211 	  </tr>
   211 	  </tr>
   212 <?
   212 <?php
   213 	if ($domain_type == "SLAVE" &&  $slave_master )
   213 	if ($domain_type == "SLAVE" &&  $slave_master )
   214 	{
   214 	{
   215 ?>
   215 ?>
   216 	  <tr>
   216 	  <tr>
   217 	   <th><? echo _('IP address of master NS'); ?></th><td class="y"><? echo $slave_master; ?></td>
   217 	   <th><?php echo _('IP address of master NS'); ?></th><td class="y"><?php echo $slave_master; ?></td>
   218 	  </tr>
   218 	  </tr>
   219 <?
   219 <?php
   220 	}
   220 	}
   221 ?>
   221 ?>
   222          </table>
   222          </table>
   223         </div> <? //eo div meta-right ?>
   223         </div> <?php //eo div meta-right ?>
   224         </div> <? // eo div meta
   224         </div> <?php // eo div meta
   225 }
   225 }
   226 ?>
   226 ?>
   227        <div id="meta">
   227        <div id="meta">
   228 <?
   228 <?php
   229 	if ($_SESSION[$_GET["id"]."_ispartial"] != 1 && $domain_type != "SLAVE" )
   229 	if ($_SESSION[$_GET["id"]."_ispartial"] != 1 && $domain_type != "SLAVE" )
   230 	{
   230 	{
   231 ?>
   231 ?>
   232         <input type="button" class="button" OnClick="location.href='add_record.php?id=<? echo $_GET["id"] ?>'" value="<? echo _('Add record'); ?>">&nbsp;&nbsp;
   232         <input type="button" class="button" OnClick="location.href='add_record.php?id=<?php echo $_GET["id"] ?>'" value="<?php echo _('Add record'); ?>">&nbsp;&nbsp;
   233 <?
   233 <?php
   234 	}
   234 	}
   235 	if (level(5))
   235 	if (level(5))
   236 	{
   236 	{
   237 ?>
   237 ?>
   238 	<input type="button" class="button" OnClick="location.href='delete_domain.php?id=<? echo $_GET["id"] ?>'" value="<? echo _('Delete zone'); ?>">
   238 	<input type="button" class="button" OnClick="location.href='delete_domain.php?id=<?php echo $_GET["id"] ?>'" value="<?php echo _('Delete zone'); ?>">
   239 <?
   239 <?php
   240 	}
   240 	}
   241 ?>
   241 ?>
   242         </div> <? // eo div meta ?>
   242         </div> <?php // eo div meta ?>
   243        <div class="showmax">
   243        <div class="showmax">
   244 <?
   244 <?php
   245 show_pages($info["numrec"],ROWAMOUNT,$_GET["id"]);
   245 show_pages($info["numrec"],ROWAMOUNT,$_GET["id"]);
   246 ?>
   246 ?>
   247         </div> <? // eo div showmax ?>
   247         </div> <?php // eo div showmax ?>
   248          <form action="<? echo $_SERVER["PHP_SELF"]?>?id=<? echo $_GET["id"]?>" method="post">
   248          <form action="<?php echo $_SERVER["PHP_SELF"]?>?id=<?php echo $_GET["id"]?>" method="post">
   249           <input type="hidden" name="action" value="record-user">
   249           <input type="hidden" name="action" value="record-user">
   250           <table>
   250           <table>
   251 <?
   251 <?php
   252 $countinput=0;
   252 $countinput=0;
   253 $rec_result = get_records_from_domain_id($_GET["id"],ROWSTART,ROWAMOUNT);
   253 $rec_result = get_records_from_domain_id($_GET["id"],ROWSTART,ROWAMOUNT);
   254 if($rec_result != -1)
   254 if($rec_result != -1)
   255 {
   255 {
   256 ?>
   256 ?>
   257            <tr>
   257            <tr>
   258 	    <th>&nbsp;</th>
   258 	    <th>&nbsp;</th>
   259 <? 
   259 <?php 
   260 	if (level(10) && $domain_type != "SLAVE") 
   260 	if (level(10) && $domain_type != "SLAVE") 
   261 	{ 
   261 	{ 
   262 		echo "<th class=\"n\">" . _('Sub-owners') . "</td>"; 
   262 		echo "<th class=\"n\">" . _('Sub-owners') . "</td>"; 
   263 	} 
   263 	} 
   264 ?>
   264 ?>
   265 	    <th><? echo _('Name'); ?></th>
   265 	    <th><?php echo _('Name'); ?></th>
   266 	    <th><? echo _('Type'); ?></th>
   266 	    <th><?php echo _('Type'); ?></th>
   267 	    <th><? echo _('Content'); ?></th>
   267 	    <th><?php echo _('Content'); ?></th>
   268 	    <th><? echo _('Priority'); ?></th>
   268 	    <th><?php echo _('Priority'); ?></th>
   269 	    <th><? echo _('TTL'); ?></th>
   269 	    <th><?php echo _('TTL'); ?></th>
   270            </tr>
   270            </tr>
   271 <?
   271 <?php
   272   	$recs = sort_zone($rec_result);
   272   	$recs = sort_zone($rec_result);
   273   	foreach($recs as $r)
   273   	foreach($recs as $r)
   274   	{
   274   	{
   275 ?>
   275 ?>
   276            <tr>
   276            <tr>
   277 	    <td class="n">
   277 	    <td class="n">
   278 <?
   278 <?php
   279 		if ($domain_type != "SLAVE" )
   279 		if ($domain_type != "SLAVE" )
   280 		{	
   280 		{	
   281 			if(level(5) || (!($r["type"] == "SOA" && !$GLOBALS["ALLOW_SOA_EDIT"]) && !($r["type"] == "NS" && !$GLOBALS["ALLOW_NS_EDIT"])))
   281 			if(level(5) || (!($r["type"] == "SOA" && !$GLOBALS["ALLOW_SOA_EDIT"]) && !($r["type"] == "NS" && !$GLOBALS["ALLOW_NS_EDIT"])))
   282 			{
   282 			{
   283 ?>
   283 ?>
   284 			     <a href="edit_record.php?id=<? echo $r['id'] ?>&amp;domain=<? echo $_GET["id"] ?>"><img src="images/edit.gif" alt="[ <? echo _('Edit record'); ?> ]"></a>
   284 			     <a href="edit_record.php?id=<?php echo $r['id'] ?>&amp;domain=<?php echo $_GET["id"] ?>"><img src="images/edit.gif" alt="[ <?php echo _('Edit record'); ?> ]"></a>
   285 			     <a href="delete_record.php?id=<? echo $r['id'] ?>&amp;domain=<? echo $_GET["id"] ?>"><img src="images/delete.gif" ALT="[ <? echo _('Delete record'); ?> ]" BORDER="0"></a>
   285 			     <a href="delete_record.php?id=<?php echo $r['id'] ?>&amp;domain=<?php echo $_GET["id"] ?>"><img src="images/delete.gif" ALT="[ <?php echo _('Delete record'); ?> ]" BORDER="0"></a>
   286 <?
   286 <?php
   287 			}
   287 			}
   288 		}
   288 		}
   289 		if(level(10) && $domain_type != "SLAVE") 
   289 		if(level(10) && $domain_type != "SLAVE") 
   290 		{ 
   290 		{ 
   291 ?>
   291 ?>
   292 		     <input type="checkbox" name="rowid[<? echo $countinput++?>]" value="<? echo $r['id']?>" />
   292 		     <input type="checkbox" name="rowid[<?php echo $countinput++?>]" value="<?php echo $r['id']?>" />
   293 <? 
   293 <?php 
   294 		}
   294 		}
   295 ?>
   295 ?>
   296             </td>
   296             </td>
   297 <? 
   297 <?php 
   298 		if (level(10) && $domain_type != "SLAVE") 
   298 		if (level(10) && $domain_type != "SLAVE") 
   299 		{ 
   299 		{ 
   300 ?>
   300 ?>
   301             <td class="n">
   301             <td class="n">
   302 <? 
   302 <?php 
   303 			$x_result = $db->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");
   303 			$x_result = $db->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");
   304 			echo "<select style=\"width:120px;\">";
   304 			echo "<select style=\"width:120px;\">";
   305 			while ($x_r = $x_result->fetchRow()) {
   305 			while ($x_r = $x_result->fetchRow()) {
   306 				echo "<option value=\"".$x_r["username"]."\">".$x_r["fullname"]."</option>";
   306 				echo "<option value=\"".$x_r["username"]."\">".$x_r["fullname"]."</option>";
   307 			}
   307 			}
   308 			echo "</select>";
   308 			echo "</select>";
   309 ?>
   309 ?>
   310             </td>
   310             </td>
   311 <? 
   311 <?php 
   312 		} 
   312 		} 
   313 ?>
   313 ?>
   314 	    <td class="y"><? echo $r['name'] ?></td>
   314 	    <td class="y"><?php echo $r['name'] ?></td>
   315 	    <td class="y"><? echo $r['type'] ?></td>
   315 	    <td class="y"><?php echo $r['type'] ?></td>
   316 	    <td class="y"><? echo $r['content'] ?></td>
   316 	    <td class="y"><?php echo $r['content'] ?></td>
   317 <?
   317 <?php
   318 		if ($r['prio'] != 0) 
   318 		if ($r['prio'] != 0) 
   319 		{
   319 		{
   320 ?>
   320 ?>
   321             <td class="y"><? echo $r['prio']; ?></td>
   321             <td class="y"><?php echo $r['prio']; ?></td>
   322 <?
   322 <?php
   323 		} else {
   323 		} else {
   324 ?>
   324 ?>
   325             <td class="n"></td><?
   325             <td class="n"></td><?php
   326 		}
   326 		}
   327 ?>
   327 ?>
   328             <td class="y"><? echo $r['ttl'] ?></td>
   328             <td class="y"><?php echo $r['ttl'] ?></td>
   329 	   </tr>
   329 	   </tr>
   330 <?
   330 <?php
   331 	}
   331 	}
   332 }
   332 }
   333 else
   333 else
   334 {
   334 {
   335 ?>
   335 ?>
   336            <tr>
   336            <tr>
   337             <td class="n">
   337             <td class="n">
   338 	     <div class="warning"><? echo _('No records for this zone.'); ?></div>
   338 	     <div class="warning"><?php echo _('No records for this zone.'); ?></div>
   339 	    </td>
   339 	    </td>
   340            </tr>
   340            </tr>
   341 <?
   341 <?php
   342 }
   342 }
   343 ?>
   343 ?>
   344           </table>
   344           </table>
   345 
   345 
   346 <?
   346 <?php
   347 if ($domain_type != "SLAVE")
   347 if ($domain_type != "SLAVE")
   348 {
   348 {
   349 	if (level(10)) { ?>
   349 	if (level(10)) { ?>
   350 	   <img src="images/arrow.png" alt="arrow" class="edit-assign-to-user">
   350 	   <img src="images/arrow.png" alt="arrow" class="edit-assign-to-user">
   351 	   <select name="userid">
   351 	   <select name="userid">
   352 		<?
   352 		<?php
   353 		$users = show_users();
   353 		$users = show_users();
   354 		foreach ($users as $user) {
   354 		foreach ($users as $user) {
   355 			echo "<option value=\"".$user[id]."\">".$user[fullname]."</option>";
   355 			echo "<option value=\"".$user[id]."\">".$user[fullname]."</option>";
   356 		}
   356 		}
   357 		?>
   357 		?>
   358            </select>
   358            </select>
   359 	   <input type="submit" class="button" value="<? echo _('Assign to user'); ?>">
   359 	   <input type="submit" class="button" value="<?php echo _('Assign to user'); ?>">
   360 	  </form>
   360 	  </form>
   361 <? 
   361 <?php 
   362 	} 
   362 	} 
   363 }
   363 }
   364 include_once("inc/footer.inc.php");
   364 include_once("inc/footer.inc.php");
   365 ?>
   365 ?>