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

(-)poweradmin/Makefile (-4 / +5 lines)
Lines 6-25 Link Here
6
#
6
#
7
7
8
PORTNAME=	poweradmin
8
PORTNAME=	poweradmin
9
PORTVERSION=	2.1.4
9
PORTVERSION=	2.1.5
10
CATEGORIES=	dns www
10
CATEGORIES=	dns www
11
MASTER_SITES=	https://www.poweradmin.org/download/
11
MASTER_SITES=	SF/${PORTNAME} \
12
		https://www.poweradmin.org/download/
12
EXTRACT_SUFX=	.tgz
13
EXTRACT_SUFX=	.tgz
13
14
14
MAINTAINER=	eg@fbsd.lt
15
MAINTAINER=	eg@fbsd.lt
15
COMMENT=	A set of PHP-scripts to manage PowerDNS over the web
16
COMMENT=	A set of PHP-scripts to manage PowerDNS over the web
16
17
17
USE_PHP=	gettext session
18
USE_PHP=	gettext session mcrypt
18
WANT_PHP_WEB=	yes
19
WANT_PHP_WEB=	yes
19
NO_BUILD=	yes
20
NO_BUILD=	yes
20
PEARDIR=	${PREFIX}/share/pear
21
PEARDIR=	${PREFIX}/share/pear
21
22
22
OPTIONS=    	MYSQL	"Use Mysql database support" on \
23
OPTIONS=	MYSQL	"Use Mysql database support" on \
23
		PGSQL	"Use Pgsql database support" off
24
		PGSQL	"Use Pgsql database support" off
24
25
25
SUB_FILES=	pkg-message
26
SUB_FILES=	pkg-message
(-)poweradmin/distinfo (-2 / +2 lines)
Lines 1-2 Link Here
1
SHA256 (poweradmin-2.1.4.tgz) = 46a13d4ce34444896ed95d265935fc7605aadc489f81214d545f8ee8a47137a1
1
SHA256 (poweradmin-2.1.5.tgz) = fe296a512dc1fe24483ebb4fc63d469e555ac64ae83f6a9ae2e6947cb94aef52
2
SIZE (poweradmin-2.1.4.tgz) = 121052
2
SIZE (poweradmin-2.1.5.tgz) = 179862
(-)poweradmin/files/patch-add_zone_master.php (+39 lines)
Line 0 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)
Line 0 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)
Line 0 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-poweradmin-mysql-db-structure.sql (-62 lines)
Lines 1-62 Link Here
1
--- docs/poweradmin-mysql-db-structure.sql.orig	2008-03-27 22:38:03.000000000 +0200
2
+++ docs/poweradmin-mysql-db-structure.sql	2010-03-14 17:07:14.000000000 +0200
3
@@ -1,4 +1,3 @@
4
-DROP TABLE IF EXISTS `users`;
5
 CREATE TABLE `users` (
6
   `id` int(11) NOT NULL auto_increment,
7
   `username` varchar(16) NOT NULL default '',
8
@@ -15,7 +14,6 @@
9
 INSERT INTO `users` VALUES (1,'admin','21232f297a57a5a743894a0e4a801fc3','Administrator','admin@example.net','Administrator with full rights.',1,1);
10
 UNLOCK TABLES;
11
 
12
-DROP TABLE IF EXISTS `perm_items`;
13
 CREATE TABLE `perm_items` (
14
   `id` int(11) NOT NULL auto_increment,
15
   `name` varchar(64) NOT NULL,
16
@@ -27,7 +25,6 @@
17
 INSERT INTO `perm_items` VALUES (41,'zone_master_add','User is allowed to add new master zones.'),(42,'zone_slave_add','User is allowed to add new slave zones.'),(43,'zone_content_view_own','User is allowed to see the content and meta data of zones he owns.'),(44,'zone_content_edit_own','User is allowed to edit the content of zones he owns.'),(45,'zone_meta_edit_own','User is allowed to edit the meta data of zones he owns.'),(46,'zone_content_view_others','User is allowed to see the content and meta data  of zones he does not own.'),(47,'zone_content_edit_others','User is allowed to edit the content of zones he does not own.'),(48,'zone_meta_edit_others','User is allowed to edit the meta data of zones he does not own.'),(49,'search','User is allowed to perform searches.'),(50,'supermaster_view','User is allowed to view supermasters.'),(51,'supermaster_add','User is allowed to add new supermasters.'),(52,'supermaster_edit','User is allowed to edit supermasters.'),(53,'user_is_ueberu
18
ser','User has full access. God-like. Redeemer.'),(54,'user_view_others','User is allowed to see other users and their details.'),(55,'user_add_new','User is allowed to add new users.'),(56,'user_edit_own','User is allowed to edit their own details.'),(57,'user_edit_others','User is allowed to edit other users.'),(58,'user_passwd_edit_others','User is allowed to edit the password of other users.'),(59,'user_edit_templ_perm','User is allowed to change the permission template that is assigned to a us er.'),(60,'templ_perm_add','User is allowed to add new permission templates.'),(61,'templ_perm_edit','User is allowed to edit existing permission templates.');
0
ser','User has full access. God-like. Redeemer.'),(54,'user_view_others','User is allowed to see other users and their details.'),(55,'user_add_new','User is allowed to add new users.'),(56,'user_edit_own','User is allowed to edit their own details.'),(57,'user_edit_others','User is allowed to edit other users.'),(58,'user_passwd_edit_others','User is allowed to edit the password of other users.'),(59,'user_edit_templ_perm','User is allowed to change the permission template that is assigned to a us er.'),(60,'templ_perm_add','User is allowed to add new permission templates.'),(61,'templ_perm_edit','User is allowed to edit existing permission templates.');
19
 UNLOCK TABLES;
20
 
21
-DROP TABLE IF EXISTS `perm_templ`;
22
 CREATE TABLE `perm_templ` (
23
   `id` int(11) NOT NULL auto_increment,
24
   `name` varchar(128) NOT NULL,
25
@@ -39,7 +36,6 @@
26
 INSERT INTO `perm_templ` VALUES (1,'Administrator','Administrator template with full rights.');
27
 UNLOCK TABLES;
28
 
29
-DROP TABLE IF EXISTS `perm_templ_items`;
30
 CREATE TABLE `perm_templ_items` (
31
   `id` int(11) NOT NULL auto_increment,
32
   `templ_id` int(11) NOT NULL,
33
@@ -51,7 +47,6 @@
34
 INSERT INTO `perm_templ_items` VALUES (249,1,53);
35
 UNLOCK TABLES;
36
 
37
-DROP TABLE IF EXISTS `zones`;
38
 CREATE TABLE `zones` (
39
   `id` int(11) NOT NULL auto_increment,
40
   `domain_id` int(11) NOT NULL default '0',
41
@@ -60,3 +55,22 @@
42
   PRIMARY KEY  (`id`),
43
   KEY `owner` (`owner`)
44
 ) ENGINE=MyISAM AUTO_INCREMENT=22001 DEFAULT CHARSET=latin1;
45
+
46
+CREATE TABLE IF NOT EXISTS `zone_templ` (
47
+  `id` int(11) NOT NULL auto_increment,
48
+  `name` varchar(128) NOT NULL,
49
+  `descr` varchar(1024) NOT NULL,
50
+  `owner` int(11) NOT NULL,
51
+  PRIMARY KEY  (`id`)
52
+) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=latin1;
53
+
54
+CREATE TABLE IF NOT EXISTS `zone_templ_records` (
55
+  `id` int(11) NOT NULL auto_increment,
56
+  `zone_templ_id` int(11) NOT NULL,
57
+  `name` varchar(255) NOT NULL,
58
+  `type` varchar(6) NOT NULL,
59
+  `content` varchar(255) NOT NULL,
60
+  `ttl` int(11) NOT NULL,
61
+  `prio` int(11) NOT NULL,
62
+  PRIMARY KEY  (`id`)
63
+) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=latin1;
(-)poweradmin/files/patch-poweradmin-pqsql-db-structure.sql (-23 lines)
Lines 1-23 Link Here
1
--- docs/poweradmin-pgsql-db-structure.sql.orig	2010-03-14 17:18:54.000000000 +0200
2
+++ docs/poweradmin-pgsql-db-structure.sql	2010-03-14 17:28:38.000000000 +0200
3
@@ -63,3 +63,20 @@
4
 );
5
 
6
 CREATE INDEX zone_domain_owner ON zones(domain_id, owner);
7
+
8
+CREATE TABLE zone_templ (
9
+  id SERIAL PRIMARY KEY,
10
+  name varchar(128) NOT NULL,
11
+  descr text NOT NULL,
12
+  owner integer default 0
13
+);
14
+
15
+CREATE TABLE zone_templ_records (
16
+  id SERIAL PRIMARY KEY,
17
+  zone_templ_id integer NOT NULL,
18
+  name varchar(255) NOT NULL,
19
+  type varchar(6) NOT NULL,
20
+  content varchar(255) NOT NULL,
21
+  ttl integer default NULL,
22
+  prio integer default NULL 
23
+);
(-)poweradmin/files/patch-record.inc.php (+29 lines)
Line 0 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 (-11 / +25 lines)
Lines 1-11 Link Here
1
--- inc/templates.inc.php.orig	2010-03-14 16:47:47.000000000 +0200
1
--- inc/templates.inc.php.orig	2010-12-10 23:26:28.839400000 +0200
2
+++ inc/templates.inc.php	2010-03-14 16:48:00.000000000 +0200
2
+++ inc/templates.inc.php	2011-05-30 12:39:13.319768001 +0300
3
@@ -193,7 +193,7 @@
3
@@ -312,7 +312,7 @@
4
 			while($r = $result->fetchRow()) {
4
 
5
 				// Call get_record_from_id for each row.
5
 // Add a zone template from zone / another template.
6
 				$ret[$retcount] = get_zone_templ_record_from_id($r["id"]);
6
 
7
-				$retcount;
7
-function add_zone_templ_save_as($template_name, $description, $userid, $records) {
8
+				$retcount++;
8
+function add_zone_templ_save_as($template_name, $description, $userid, $records, $domain = null) {
9
 			}
9
 	global $db;
10
 			return $ret;
10
 
11
 		}
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') . ","
(-)poweradmin/pkg-descr (+3 lines)
Lines 1-3 Link Here
1
This project is a web-based front-end for the PowerDNS DNS server.
1
This project is a web-based front-end for the PowerDNS DNS server.
2
2
3
WWW: http://www.poweradmin.org/
3
WWW: http://www.poweradmin.org/
4
5
- Edmondas Girkantas
6
eg@fbsd.lt

Return to bug 167841