aboutsummaryrefslogtreecommitdiff
path: root/dns/poweradmin
diff options
context:
space:
mode:
authorPawel Pekala <pawel@FreeBSD.org>2012-05-18 16:27:18 +0000
committerPawel Pekala <pawel@FreeBSD.org>2012-05-18 16:27:18 +0000
commitd1ebb0f8b41cd352e902cf2a0e08479a3988447e (patch)
tree1c38dbed68d37e835d36f35c155df3a47b307437 /dns/poweradmin
parente3277ef2f7b466dc30a048d047bf6795ba9514e4 (diff)
downloadports-d1ebb0f8b41cd352e902cf2a0e08479a3988447e.tar.gz
ports-d1ebb0f8b41cd352e902cf2a0e08479a3988447e.zip
Notes
Diffstat (limited to 'dns/poweradmin')
-rw-r--r--dns/poweradmin/Makefile13
-rw-r--r--dns/poweradmin/distinfo4
-rw-r--r--dns/poweradmin/files/patch-add_zone_master.php39
-rw-r--r--dns/poweradmin/files/patch-edit.php20
-rw-r--r--dns/poweradmin/files/patch-helper.js55
-rw-r--r--dns/poweradmin/files/patch-poweradmin-mysql-db-structure.sql62
-rw-r--r--dns/poweradmin/files/patch-poweradmin-pqsql-db-structure.sql23
-rw-r--r--dns/poweradmin/files/patch-record.inc.php29
-rw-r--r--dns/poweradmin/files/patch-templates.inc.php36
9 files changed, 177 insertions, 104 deletions
diff --git a/dns/poweradmin/Makefile b/dns/poweradmin/Makefile
index 1f4b171892ff..06645bedf7d4 100644
--- a/dns/poweradmin/Makefile
+++ b/dns/poweradmin/Makefile
@@ -6,20 +6,21 @@
#
PORTNAME= poweradmin
-PORTVERSION= 2.1.4
+PORTVERSION= 2.1.5
CATEGORIES= dns www
-MASTER_SITES= https://www.poweradmin.org/download/
+MASTER_SITES= SF/${PORTNAME} \
+ https://www.poweradmin.org/download/
EXTRACT_SUFX= .tgz
MAINTAINER= eg@fbsd.lt
COMMENT= A set of PHP-scripts to manage PowerDNS over the web
-USE_PHP= gettext session
+USE_PHP= gettext session mcrypt
WANT_PHP_WEB= yes
NO_BUILD= yes
PEARDIR= ${PREFIX}/share/pear
-OPTIONS= MYSQL "Use Mysql database support" on \
+OPTIONS= MYSQL "Use Mysql database support" on \
PGSQL "Use Pgsql database support" off
SUB_FILES= pkg-message
@@ -29,7 +30,7 @@ CFGFILE= config.inc.php
PLIST= ${WRKDIR}/plist
-.include <bsd.port.pre.mk>
+.include <bsd.port.options.mk>
.if defined(WITH_MYSQL)
RUN_DEPENDS+= ${PEARDIR}/MDB2/Driver/mysql.php:${PORTSDIR}/databases/pear-MDB2_Driver_mysql
@@ -75,4 +76,4 @@ install-conf: install-app
post-install:
@${CAT} ${PKGMESSAGE}
-.include <bsd.port.post.mk>
+.include <bsd.port.mk>
diff --git a/dns/poweradmin/distinfo b/dns/poweradmin/distinfo
index 999a346865ec..8ef990fc9113 100644
--- a/dns/poweradmin/distinfo
+++ b/dns/poweradmin/distinfo
@@ -1,2 +1,2 @@
-SHA256 (poweradmin-2.1.4.tgz) = 46a13d4ce34444896ed95d265935fc7605aadc489f81214d545f8ee8a47137a1
-SIZE (poweradmin-2.1.4.tgz) = 121052
+SHA256 (poweradmin-2.1.5.tgz) = fe296a512dc1fe24483ebb4fc63d469e555ac64ae83f6a9ae2e6947cb94aef52
+SIZE (poweradmin-2.1.5.tgz) = 179862
diff --git a/dns/poweradmin/files/patch-add_zone_master.php b/dns/poweradmin/files/patch-add_zone_master.php
new file mode 100644
index 000000000000..b723586ee3af
--- /dev/null
+++ b/dns/poweradmin/files/patch-add_zone_master.php
@@ -0,0 +1,39 @@
+--- add_zone_master.php.orig 2011-05-30 12:33:42.399768001 +0300
++++ add_zone_master.php 2011-05-30 12:34:41.423768002 +0300
+@@ -36,7 +36,10 @@
+ if (isset($_POST['domain'])) {
+ $temp = array();
+ foreach ($_POST['domain'] as $domain) {
+- $temp[] = trim($domain);
++ if($domain != "")
++ {
++ $temp[] = trim($domain);
++ }
+ }
+ $domains = $temp;
+ } else {
+@@ -56,6 +59,7 @@
+ (verify_permission('user_view_others')) ? $perm_view_others = "1" : $perm_view_others = "0" ;
+
+ if (isset($_POST['submit']) && $zone_master_add == "1" ) {
++ $error = false;
+ foreach ($domains as $domain) {
+ if (domain_exists($domain)) {
+ error($domain . " failed - " . ERR_DOMAIN_EXISTS);
+@@ -63,7 +67,6 @@
+ $error = true;
+ } elseif (add_domain($domain, $owner, $dom_type, '', $zone_template)) {
+ success("<a href=\"edit.php?id=" . get_zone_id_from_name($domain) . "\">".$domain . " - " . SUC_ZONE_ADD.'</a>');
+- $error = false;
+ }
+ }
+
+@@ -139,7 +142,7 @@
+ echo " <tr>\n";
+ echo " <td class=\"n\">&nbsp;</td>\n";
+ echo " <td class=\"n\">\n";
+- echo " <input type=\"submit\" class=\"button\" name=\"submit\" value=\"" . _('Add zone') . "\">\n";
++ echo " <input type=\"submit\" class=\"button\" name=\"submit\" value=\"" . _('Add zone') . "\" onclick=\"checkDomainFilled();return false;\">\n";
+ echo " </td>\n";
+ echo " <td class=\"n\">&nbsp;</td>\n";
+ echo " </tr>\n";
diff --git a/dns/poweradmin/files/patch-edit.php b/dns/poweradmin/files/patch-edit.php
new file mode 100644
index 000000000000..6261ee517d14
--- /dev/null
+++ b/dns/poweradmin/files/patch-edit.php
@@ -0,0 +1,20 @@
+--- edit.php.orig 2011-05-30 13:41:59.411768002 +0300
++++ edit.php 2011-05-30 12:59:05.851768002 +0300
+@@ -51,9 +51,15 @@
+ }
+
+ if (isset($_POST['save_as'])) {
++ if (zone_templ_name_exists($_POST['templ_name'])) {
++ error(ERR_ZONE_TEMPL_EXIST);
++ } elseif ($_POST['templ_name'] == '') {
++ error(ERR_ZONE_TEMPL_IS_EMPTY);
++ } else {
++ success(SUC_ZONE_TEMPL_ADD);
+ $records = get_records_from_domain_id($zone_id);
+- add_zone_templ_save_as($_POST['templ_name'], $_POST['templ_descr'], $_SESSION['userid'], $records);
+-
++ add_zone_templ_save_as($_POST['templ_name'], $_POST['templ_descr'], $_SESSION['userid'], $records, get_zone_name_from_id($zone_id));
++ }
+ }
+
+ /*
diff --git a/dns/poweradmin/files/patch-helper.js b/dns/poweradmin/files/patch-helper.js
new file mode 100644
index 000000000000..67cb1895510f
--- /dev/null
+++ b/dns/poweradmin/files/patch-helper.js
@@ -0,0 +1,55 @@
+--- inc/helper.js.orig 2011-05-30 12:32:41.799768002 +0300
++++ inc/helper.js 2011-05-30 12:35:03.911768000 +0300
+@@ -47,3 +47,52 @@
+ 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>";
+ }
+ }
++
++function getDomainsElements(){
++ var
++ coll=document.getElementsByTagName('input'),
++ re=/^domain\[\]$/,
++ t,
++ elm,
++ i=0,
++ key=0,
++ records=new Array();
++
++ while(elm=coll.item(i++))
++ {
++ t=re.exec(elm.name);
++ if(t!=null)
++ {
++ records[key]=elm;
++ key++;
++ }
++ }
++ return records;
++}
++
++function checkDomainFilled(){
++ var
++ domains= new Array(),
++ allEmpty=true,
++ domains=getDomainsElements();
++
++ if (domains.length == 1) {
++ if ((domains[0].value.length == 0 || domains[0].value == null || domains[0].value == "")) {
++ alert('Zone name cannot be empty');
++ return false;
++ }
++ } else {
++ for (key in domains) {
++ if((domains[key].value.length != 0)) {
++ allEmpty = false;
++ }
++ }
++
++ if (true === allEmpty) {
++ alert('Please fill in at least one Zone name');
++ return false;
++ }
++ }
++
++ add_zone_master.submit();
++}
diff --git a/dns/poweradmin/files/patch-poweradmin-mysql-db-structure.sql b/dns/poweradmin/files/patch-poweradmin-mysql-db-structure.sql
deleted file mode 100644
index 0323e7921d8b..000000000000
--- a/dns/poweradmin/files/patch-poweradmin-mysql-db-structure.sql
+++ /dev/null
@@ -1,62 +0,0 @@
---- docs/poweradmin-mysql-db-structure.sql.orig 2008-03-27 22:38:03.000000000 +0200
-+++ docs/poweradmin-mysql-db-structure.sql 2010-03-14 17:07:14.000000000 +0200
-@@ -1,4 +1,3 @@
--DROP TABLE IF EXISTS `users`;
- CREATE TABLE `users` (
- `id` int(11) NOT NULL auto_increment,
- `username` varchar(16) NOT NULL default '',
-@@ -15,7 +14,6 @@
- INSERT INTO `users` VALUES (1,'admin','21232f297a57a5a743894a0e4a801fc3','Administrator','admin@example.net','Administrator with full rights.',1,1);
- UNLOCK TABLES;
-
--DROP TABLE IF EXISTS `perm_items`;
- CREATE TABLE `perm_items` (
- `id` int(11) NOT NULL auto_increment,
- `name` varchar(64) NOT NULL,
-@@ -27,7 +25,6 @@
- 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_ueberuser','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.');
- UNLOCK TABLES;
-
--DROP TABLE IF EXISTS `perm_templ`;
- CREATE TABLE `perm_templ` (
- `id` int(11) NOT NULL auto_increment,
- `name` varchar(128) NOT NULL,
-@@ -39,7 +36,6 @@
- INSERT INTO `perm_templ` VALUES (1,'Administrator','Administrator template with full rights.');
- UNLOCK TABLES;
-
--DROP TABLE IF EXISTS `perm_templ_items`;
- CREATE TABLE `perm_templ_items` (
- `id` int(11) NOT NULL auto_increment,
- `templ_id` int(11) NOT NULL,
-@@ -51,7 +47,6 @@
- INSERT INTO `perm_templ_items` VALUES (249,1,53);
- UNLOCK TABLES;
-
--DROP TABLE IF EXISTS `zones`;
- CREATE TABLE `zones` (
- `id` int(11) NOT NULL auto_increment,
- `domain_id` int(11) NOT NULL default '0',
-@@ -60,3 +55,22 @@
- PRIMARY KEY (`id`),
- KEY `owner` (`owner`)
- ) ENGINE=MyISAM AUTO_INCREMENT=22001 DEFAULT CHARSET=latin1;
-+
-+CREATE TABLE IF NOT EXISTS `zone_templ` (
-+ `id` int(11) NOT NULL auto_increment,
-+ `name` varchar(128) NOT NULL,
-+ `descr` varchar(1024) NOT NULL,
-+ `owner` int(11) NOT NULL,
-+ PRIMARY KEY (`id`)
-+) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=latin1;
-+
-+CREATE TABLE IF NOT EXISTS `zone_templ_records` (
-+ `id` int(11) NOT NULL auto_increment,
-+ `zone_templ_id` int(11) NOT NULL,
-+ `name` varchar(255) NOT NULL,
-+ `type` varchar(6) NOT NULL,
-+ `content` varchar(255) NOT NULL,
-+ `ttl` int(11) NOT NULL,
-+ `prio` int(11) NOT NULL,
-+ PRIMARY KEY (`id`)
-+) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=latin1;
diff --git a/dns/poweradmin/files/patch-poweradmin-pqsql-db-structure.sql b/dns/poweradmin/files/patch-poweradmin-pqsql-db-structure.sql
deleted file mode 100644
index 6b8136a13173..000000000000
--- a/dns/poweradmin/files/patch-poweradmin-pqsql-db-structure.sql
+++ /dev/null
@@ -1,23 +0,0 @@
---- docs/poweradmin-pgsql-db-structure.sql.orig 2010-03-14 17:18:54.000000000 +0200
-+++ docs/poweradmin-pgsql-db-structure.sql 2010-03-14 17:28:38.000000000 +0200
-@@ -63,3 +63,20 @@
- );
-
- CREATE INDEX zone_domain_owner ON zones(domain_id, owner);
-+
-+CREATE TABLE zone_templ (
-+ id SERIAL PRIMARY KEY,
-+ name varchar(128) NOT NULL,
-+ descr text NOT NULL,
-+ owner integer default 0
-+);
-+
-+CREATE TABLE zone_templ_records (
-+ id SERIAL PRIMARY KEY,
-+ zone_templ_id integer NOT NULL,
-+ name varchar(255) NOT NULL,
-+ type varchar(6) NOT NULL,
-+ content varchar(255) NOT NULL,
-+ ttl integer default NULL,
-+ prio integer default NULL
-+);
diff --git a/dns/poweradmin/files/patch-record.inc.php b/dns/poweradmin/files/patch-record.inc.php
new file mode 100644
index 000000000000..1e79c4639f9d
--- /dev/null
+++ b/dns/poweradmin/files/patch-record.inc.php
@@ -0,0 +1,29 @@
+--- inc/record.inc.php.orig 2010-11-30 10:46:51.416703000 +0200
++++ inc/record.inc.php 2011-05-30 12:38:50.523768002 +0300
+@@ -1276,14 +1276,15 @@
+ }
+
+ if($zone_master_add == "1" || $zone_slave_add == "1") {
++ $domain = get_zone_name_from_id($zone_id);
+ $now = time();
+ $templ_records = get_zone_templ_records($zone_template);
+ foreach ($templ_records as $r) {
+ if ((preg_match('/in-addr.arpa/i', $zone_id) && ($r["type"] == "NS" || $r["type"] == "SOA")) || (!preg_match('/in-addr.arpa/i', $zone_id)))
+ {
+- $name = parse_template_value($r["name"], $zone_id);
++ $name = parse_template_value($r["name"], $domain);
+ $type = $r["type"];
+- $content = parse_template_value($r["content"], $zone_id);
++ $content = parse_template_value($r["content"], $domain);
+ $ttl = $r["ttl"];
+ $prio = intval($r["prio"]);
+
+@@ -1307,7 +1308,7 @@
+
+ $query = "UPDATE zones
+ SET zone_templ_id = " . $db->quote($zone_template, 'integer') . "
+- WHERE id = " . $db->quote($zone_id, 'integer') ;
++ WHERE domain_id = " . $db->quote($zone_id, 'integer') ;
+ $response = $db->exec($query);
+
+ if (PEAR::isError($response)) {
diff --git a/dns/poweradmin/files/patch-templates.inc.php b/dns/poweradmin/files/patch-templates.inc.php
index 895e8e7c6d8e..6f2b0cffb2e6 100644
--- a/dns/poweradmin/files/patch-templates.inc.php
+++ b/dns/poweradmin/files/patch-templates.inc.php
@@ -1,11 +1,25 @@
---- inc/templates.inc.php.orig 2010-03-14 16:47:47.000000000 +0200
-+++ inc/templates.inc.php 2010-03-14 16:48:00.000000000 +0200
-@@ -193,7 +193,7 @@
- while($r = $result->fetchRow()) {
- // Call get_record_from_id for each row.
- $ret[$retcount] = get_zone_templ_record_from_id($r["id"]);
-- $retcount;
-+ $retcount++;
- }
- return $ret;
- }
+--- inc/templates.inc.php.orig 2010-12-10 23:26:28.839400000 +0200
++++ inc/templates.inc.php 2011-05-30 12:39:13.319768001 +0300
+@@ -312,7 +312,7 @@
+
+ // Add a zone template from zone / another template.
+
+-function add_zone_templ_save_as($template_name, $description, $userid, $records) {
++function add_zone_templ_save_as($template_name, $description, $userid, $records, $domain = null) {
+ global $db;
+
+ if (!(verify_permission('zone_master_add'))) {
+@@ -339,9 +339,12 @@
+ $content = $db->quote($record['content'], 'text');
+ }
+
++ $name = $domain ? preg_replace('/'.$domain.'/', '[ZONE]',$record['name']) : $record['name'];
++ $content = $domain ? preg_replace('/'.$domain.'/', '[ZONE]',$content) : $content;
++
+ $query2 = "INSERT INTO zone_templ_records (zone_templ_id, name, type, content, ttl, prio) VALUES ("
+ . $db->quote($zone_templ_id, 'integer') . ","
+- . $db->quote($record['name'], 'text') . ","
++ . $db->quote($name, 'text') . ","
+ . $db->quote($record['type'], 'text') . ","
+ . $content . ","
+ . $db->quote($record['ttl'], 'integer') . ","