[feladat @ 85]
authorrejo
Mon, 23 Jul 2007 22:05:19 +0000
changeset 38 cf767482333a
parent 37 b785e54690ce
child 39 7c2b82bff121
[feladat @ 85] The type of zone wasn't show to users with access level 1. If a user with access level 1 did have access to a slave zone the user did not see the IP of the master nameserver of that zone. Now the user will the IP address (readonly and only if one is set). Bugfix. If no master IP for a slave zone is given, a warning is shown regardless of the userlevel. Bugfix. Both the "add record" and "edit record" buttons in the "edit zone" screen is no longer available for users with level 1 for domains of type "slave". Bug report by Antonio Prado. Some PHP and HTML cleanup (removing of empty tags and unnecessary repeatings of calls to a single function).
edit.php
--- a/edit.php	Tue Jul 10 21:24:06 2007 +0000
+++ b/edit.php	Mon Jul 23 22:05:19 2007 +0000
@@ -30,32 +30,25 @@
 }
 $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 (level(5))
+if(!isset($info["ownerid"]) && $domain_type != "SLAVE")
 {
-	if(!isset($info["ownerid"]))
-	{
-	?>
-	    <div class="error"><? echo _('Error'); ?>: <? echo ('There is no owner for this zone, please assign someone.'); ?></div>
-	<?
-	}
-	$domain_type=get_domain_type($_GET['id']);
-	if ($domain_type == "SLAVE" )
-	{
-		$slave_master=get_domain_slave_master($_GET['id']);
-		if ($slave_master == "" )
-		{
 ?>
-            <div class="error"><? echo _('Type of this zone is "slave", but there is no IP address for it\'s master given.'); ?></div>
+    <div class="error"><? echo _('Error'); ?>: <? echo ('There is no owner for this zone, please assign someone.'); ?></div>
 <?
-		}
-	}
 }
-
+if ($domain_type == "SLAVE" && $slave_master )
+{
+?>
+    <div class="error"><? echo _('Error'); ?>: <? echo _('Type of this zone is "slave", but there is no IP address for it\'s master given.'); ?></div>
+<?
+}
 ?>
     <h2><? echo _('Edit zone'); ?> "<? echo get_domain_name_from_id($_GET["id"]) ?>"</h2>
 <?
-
 if (level(5)) 
 { ?>	
        <div id="meta">
@@ -120,10 +113,6 @@
   	  </tr>
          </table>
 	</div> <? // eo div meta-left ?>
- 
-<?
-	$domain_type=get_domain_type($_GET['id']);
-?>
         <div id="meta-right">
          <table>
 	  <tr>
@@ -177,11 +166,35 @@
           </form>
 <?
 	}
-}
 ?>
          </table>  
         </div> <? // eo div meta-right ?>
-       </div> <? // eo div meta ?>
+       </div> <? // eo div meta 
+}
+else
+{
+?>
+       <div id="meta">
+        <div id="meta-right">
+         <table>
+ 	  <tr>
+ 	   <th><? echo _('Type of zone'); ?></th><td class="y"><? echo $domain_type; ?></td>
+	  </tr>
+<?
+	if ($domain_type == "SLAVE" &&  $slave_master )
+	{
+?>
+	  <tr>
+	   <th><? echo _('IP address of master NS'); ?></th><td class="y"><? echo $slave_master; ?></td>
+	  </tr>
+<?
+	}
+?>
+         </table>
+        </div> <? //eo div meta-right ?>
+        </div> <? // eo div meta
+}
+?>
        <div id="meta">
 <?
 	if ($_SESSION[$_GET["id"]."_ispartial"] != 1 && $domain_type != "SLAVE" )
@@ -239,15 +252,15 @@
 			if(level(5) || (!($r["type"] == "SOA" && !$GLOBALS["ALLOW_SOA_EDIT"]) && !($r["type"] == "NS" && !$GLOBALS["ALLOW_NS_EDIT"])))
 			{
 ?>
-             <a href="edit_record.php?id=<? echo $r['id'] ?>&amp;domain=<? echo $_GET["id"] ?>"><img src="images/edit.gif" alt="[ <? echo _('Edit record'); ?> ]"></a>
-             <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>
+			     <a href="edit_record.php?id=<? echo $r['id'] ?>&amp;domain=<? echo $_GET["id"] ?>"><img src="images/edit.gif" alt="[ <? echo _('Edit record'); ?> ]"></a>
+			     <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>
 <?
 			}
 		}
 		if(level(10) && $domain_type != "SLAVE") 
 		{ 
 ?>
-	     <input type="checkbox" name="rowid[<? echo $countinput++?>]" value="<? echo $r['id']?>" />
+		     <input type="checkbox" name="rowid[<? echo $countinput++?>]" value="<? echo $r['id']?>" />
 <? 
 		}
 ?>