View | Details | Raw Unified | Return to bug 175699
Collapse All | Expand All

(-)poweradmin/Makefile (-1 / +1 lines)
Lines 6-12 Link Here
6
#
6
#
7
7
8
PORTNAME=	poweradmin
8
PORTNAME=	poweradmin
9
PORTVERSION=	2.1.5
9
PORTVERSION=	2.1.6
10
CATEGORIES=	dns www
10
CATEGORIES=	dns www
11
MASTER_SITES=	SF/${PORTNAME} \
11
MASTER_SITES=	SF/${PORTNAME} \
12
		https://www.poweradmin.org/download/
12
		https://www.poweradmin.org/download/
(-)poweradmin/distinfo (-2 / +2 lines)
Lines 1-2 Link Here
1
SHA256 (poweradmin-2.1.5.tgz) = fe296a512dc1fe24483ebb4fc63d469e555ac64ae83f6a9ae2e6947cb94aef52
1
SHA256 (poweradmin-2.1.6.tgz) = ea728a522641bce59dfbe67b080c168b5484aa67b1af90a61c52f36ee573097d
2
SIZE (poweradmin-2.1.5.tgz) = 179862
2
SIZE (poweradmin-2.1.6.tgz) = 254258
(-)poweradmin/files/patch-add_zone_master.php (-39 lines)
Lines 1-39 Link Here
1
--- add_zone_master.php.orig	2011-05-30 12:33:42.399768001 +0300
2
+++ add_zone_master.php	2011-05-30 12:34:41.423768002 +0300
3
@@ -36,7 +36,10 @@
4
 if (isset($_POST['domain'])) {
5
         $temp = array();
6
         foreach ($_POST['domain'] as $domain) {
7
-          $temp[] = trim($domain);
8
+                if($domain != "")
9
+                {
10
+                        $temp[] = trim($domain);
11
+                }
12
         }
13
 	$domains = $temp;
14
 } else {
15
@@ -56,6 +59,7 @@
16
 (verify_permission('user_view_others')) ? $perm_view_others = "1" : $perm_view_others = "0" ; 
17
 
18
 if (isset($_POST['submit']) && $zone_master_add == "1" ) {
19
+        $error = false;
20
         foreach ($domains as $domain) {
21
                 if (domain_exists($domain)) {
22
                         error($domain . " failed - " . ERR_DOMAIN_EXISTS);
23
@@ -63,7 +67,6 @@
24
                         $error = true;
25
                 } elseif (add_domain($domain, $owner, $dom_type, '', $zone_template)) {
26
                         success("<a href=\"edit.php?id=" . get_zone_id_from_name($domain) . "\">".$domain . " - " . SUC_ZONE_ADD.'</a>');
27
-                        $error = false;
28
                 }
29
         }
30
 
31
@@ -139,7 +142,7 @@
32
 	echo "       <tr>\n";
33
 	echo "        <td class=\"n\">&nbsp;</td>\n";
34
 	echo "        <td class=\"n\">\n";
35
-	echo "         <input type=\"submit\" class=\"button\" name=\"submit\" value=\"" . _('Add zone') . "\">\n";
36
+        echo "         <input type=\"submit\" class=\"button\" name=\"submit\" value=\"" . _('Add zone') . "\" onclick=\"checkDomainFilled();return false;\">\n";
37
 	echo "        </td>\n";
38
 	echo "        <td class=\"n\">&nbsp;</td>\n";
39
 	echo "       </tr>\n";
(-)poweradmin/files/patch-edit.php (-20 lines)
Lines 1-20 Link Here
1
--- edit.php.orig	2011-05-30 13:41:59.411768002 +0300
2
+++ edit.php	2011-05-30 12:59:05.851768002 +0300
3
@@ -51,9 +51,15 @@
4
 }
5
 
6
 if (isset($_POST['save_as'])) {
7
+	if (zone_templ_name_exists($_POST['templ_name'])) {
8
+		error(ERR_ZONE_TEMPL_EXIST);
9
+	} elseif ($_POST['templ_name'] == '') {
10
+		error(ERR_ZONE_TEMPL_IS_EMPTY);
11
+	} else {
12
+		success(SUC_ZONE_TEMPL_ADD);
13
         $records = get_records_from_domain_id($zone_id);
14
-        add_zone_templ_save_as($_POST['templ_name'], $_POST['templ_descr'], $_SESSION['userid'], $records);
15
-
16
+        add_zone_templ_save_as($_POST['templ_name'], $_POST['templ_descr'], $_SESSION['userid'], $records, get_zone_name_from_id($zone_id));
17
+	}
18
 }
19
 
20
 /*
(-)poweradmin/files/patch-helper.js (-55 lines)
Lines 1-55 Link Here
1
--- inc/helper.js.orig	2011-05-30 12:32:41.799768002 +0300
2
+++ inc/helper.js	2011-05-30 12:35:03.911768000 +0300
3
@@ -47,3 +47,52 @@
4
 		field_area.innerHTML += "<li><input name='domain[]' id='"+(field+count)+"' type='text' class='input' /> <a onclick=\"this.parentNode.parentNode.removeChild(this.parentNode);\">Remove Field</a></li>";
5
 	}
6
 }
7
+
8
+function getDomainsElements(){
9
+    var
10
+        coll=document.getElementsByTagName('input'),
11
+        re=/^domain\[\]$/,
12
+        t,
13
+        elm,
14
+        i=0,
15
+        key=0,
16
+        records=new Array();
17
+
18
+    while(elm=coll.item(i++))
19
+    {
20
+            t=re.exec(elm.name);
21
+            if(t!=null)
22
+              {
23
+                records[key]=elm;
24
+                key++;
25
+              }
26
+    }
27
+    return records;
28
+}
29
+
30
+function checkDomainFilled(){
31
+    var
32
+        domains= new Array(),
33
+        allEmpty=true,
34
+        domains=getDomainsElements();
35
+
36
+    if (domains.length == 1) {
37
+        if ((domains[0].value.length == 0 || domains[0].value == null || domains[0].value == "")) {
38
+            alert('Zone name cannot be empty');
39
+            return false;
40
+        }
41
+    } else {
42
+        for (key in domains) {
43
+            if((domains[key].value.length != 0)) {
44
+                allEmpty = false;
45
+            }
46
+        }
47
+
48
+        if (true === allEmpty) {
49
+          alert('Please fill in at least one Zone name');
50
+          return false;
51
+        }
52
+    }
53
+
54
+    add_zone_master.submit();
55
+}
(-)poweradmin/files/patch-record.inc.php (-29 lines)
Lines 1-29 Link Here
1
--- inc/record.inc.php.orig	2010-11-30 10:46:51.416703000 +0200
2
+++ inc/record.inc.php	2011-05-30 12:38:50.523768002 +0300
3
@@ -1276,14 +1276,15 @@
4
                         }
5
 
6
                         if($zone_master_add == "1" || $zone_slave_add == "1") {
7
+                                $domain = get_zone_name_from_id($zone_id);
8
                                 $now = time();
9
                                 $templ_records = get_zone_templ_records($zone_template);
10
                                 foreach ($templ_records as $r) {
11
                                         if ((preg_match('/in-addr.arpa/i', $zone_id) && ($r["type"] == "NS" || $r["type"] == "SOA")) || (!preg_match('/in-addr.arpa/i', $zone_id)))
12
                                         {
13
-                                                $name     = parse_template_value($r["name"], $zone_id);
14
+                                                $name     = parse_template_value($r["name"], $domain);
15
                                                 $type     = $r["type"];
16
-                                                $content  = parse_template_value($r["content"], $zone_id);
17
+                                                $content  = parse_template_value($r["content"], $domain);
18
                                                 $ttl      = $r["ttl"];
19
                                                 $prio     = intval($r["prio"]);
20
 
21
@@ -1307,7 +1308,7 @@
22
 
23
         $query = "UPDATE zones
24
                     SET zone_templ_id = " . $db->quote($zone_template, 'integer') . "
25
-                    WHERE id = " . $db->quote($zone_id, 'integer') ;
26
+                    WHERE domain_id = " . $db->quote($zone_id, 'integer') ;
27
 	$response = $db->exec($query);
28
 
29
         if (PEAR::isError($response)) {
(-)poweradmin/files/patch-templates.inc.php (-25 lines)
Lines 1-25 Link Here
1
--- inc/templates.inc.php.orig	2010-12-10 23:26:28.839400000 +0200
2
+++ inc/templates.inc.php	2011-05-30 12:39:13.319768001 +0300
3
@@ -312,7 +312,7 @@
4
 
5
 // Add a zone template from zone / another template.
6
 
7
-function add_zone_templ_save_as($template_name, $description, $userid, $records) {
8
+function add_zone_templ_save_as($template_name, $description, $userid, $records, $domain = null) {
9
 	global $db;
10
 
11
 	if (!(verify_permission('zone_master_add'))) {
12
@@ -339,9 +339,12 @@
13
                             $content = $db->quote($record['content'], 'text');
14
                     }
15
 
16
+                    $name = $domain ? preg_replace('/'.$domain.'/', '[ZONE]',$record['name']) : $record['name'];
17
+                    $content = $domain ? preg_replace('/'.$domain.'/', '[ZONE]',$content) : $content;
18
+
19
                     $query2 = "INSERT INTO zone_templ_records (zone_templ_id, name, type, content, ttl, prio) VALUES ("
20
                                             . $db->quote($zone_templ_id, 'integer') . ","
21
-                                            . $db->quote($record['name'], 'text') . ","
22
+                                            . $db->quote($name, 'text') . ","
23
                                             . $db->quote($record['type'], 'text') . ","
24
                                             . $content . ","
25
                                             . $db->quote($record['ttl'], 'integer') . ","

Return to bug 175699