diff --git a/bureau/admin/adm_domstype.php b/bureau/admin/adm_domstype.php
index 0c82b151..7f47f25a 100644
--- a/bureau/admin/adm_domstype.php
+++ b/bureau/admin/adm_domstype.php
@@ -51,7 +51,7 @@ include_once("head.php");
/>
@@ -94,6 +109,22 @@ $dom->unlock();
+
+
diff --git a/bureau/class/m_dom.php b/bureau/class/m_dom.php
index 5f5057d8..34aafccd 100644
--- a/bureau/class/m_dom.php
+++ b/bureau/class/m_dom.php
@@ -102,7 +102,7 @@ class m_dom {
function domains_type_lst() {
global $db,$err,$cuid;
$err->log("dom","domains_type_lst");
- $db->query("select * from domaines_type order by name;");
+ $db->query("select * from domaines_type order by advanced, name;");
$this->domains_type_lst=false;
while ($db->next_record()) {
$this->domains_type_lst[] = $db->Record;
@@ -110,6 +110,20 @@ class m_dom {
return $this->domains_type_lst;
}
+ function domains_type_enable_values() {
+ global $db,$err,$cuid;
+ $err->log("dom","domains_type_target_values");
+ $db->query("desc domaines_type;");
+ $r = array();
+ while ($db->next_record()) {
+ if ($db->f('Field') == 'enable') {
+ $tab = explode(",", substr($db->f('Type'), 5, -1));
+ foreach($tab as $t) { $r[]=substr($t,1,-1); }
+ }
+ }
+ return $r;
+ }
+
function domains_type_target_values($type=null) {
global $db,$err,$cuid;
$err->log("dom","domains_type_target_values");
@@ -167,7 +181,7 @@ class m_dom {
return true;
}
- function domains_type_update($name, $description, $target, $entry, $compatibility, $enable, $only_dns, $need_dns) {
+ function domains_type_update($name, $description, $target, $entry, $compatibility, $enable, $only_dns, $need_dns,$advanced) {
global $err,$cuid,$db;
$id=intval($id);
$name=mysql_real_escape_string($name);
@@ -175,10 +189,11 @@ class m_dom {
$target=mysql_real_escape_string($target);
$entry=mysql_real_escape_string($entry);
$compatibility=mysql_real_escape_string($compatibility);
- $enable=intval($enable);
+ $enable=mysql_real_escape_string($enable);
$only_dns=intval($only_dns);
$need_dns=intval($need_dns);
- $db->query("UPDATE domaines_type SET description='$description', target='$target', entry='$entry', compatibility='$compatibility', enable=$enable, need_dns=$need_dns, only_dns=$only_dns where name='$name';");
+ $advanced=intval($advanced);
+ $db->query("UPDATE domaines_type SET description='$description', target='$target', entry='$entry', compatibility='$compatibility', enable='$enable', need_dns=$need_dns, only_dns=$only_dns, advanced='$advanced' where name='$name';");
return true;
}
diff --git a/install/mysql.sql b/install/mysql.sql
index 17fbcff2..68dff8f8 100644
--- a/install/mysql.sql
+++ b/install/mysql.sql
@@ -487,22 +487,23 @@ CREATE TABLE IF NOT EXISTS `domaines_type` (
`target` enum ('NONE', 'URL', 'DIRECTORY', 'IP', 'IPV6', 'DOMAIN', 'TXT') NOT NULL DEFAULT 'NONE', -- Target type
`entry` VARCHAR (255) DEFAULT '', -- BIND entry
`compatibility` VARCHAR (255) DEFAULT '', -- Which type can be on the same subdomains
- `enable` BOOLEAN DEFAULT TRUE, -- Show this options to the users ?
+ `enable` enum ('ALL', 'NONE', 'ADMIN') NOT NULL DEFAULT 'ALL', -- Show this option to who ?
`only_dns` BOOLEAN DEFAULT FALSE, -- Update_domains modify just the dns, no web configuration
`need_dns` BOOLEAN DEFAULT TRUE, -- The server need to be the DNS to allow this service
+ `advanced` BOOLEAN DEFAULT TRUE, -- It's an advanced option
PRIMARY KEY ( `name` )
) COMMENT = 'Type of domains allowed';
-INSERT IGNORE INTO `domaines_type` (name, description, target, entry, compatibility, only_dns, need_dns) values
-('local','Locally managed', 'DIRECTORY', '%SUB% IN A @@PUBLIC_IP@@', 'txt', false, false),
-('url','URL redirection', 'URL', '%SUB% IN A @@PUBLIC_IP@@','txt', true, true),
-('ip','IP redirection', 'IP', '%SUB% IN A %TARGET%','url,ip,ipv6,txt', false, true),
-('webmail', 'Webmail access', 'NONE', '%SUB% IN A @@PUBLIC_IP@@', 'txt', false, false),
-('ipv6','ipv6 address', 'IPV6', '%SUB% IN AAAA %TARGET%','ip,ipv6,webmail,txt',true, true),
-('cname', 'cname entry', 'DOMAIN', '%SUB% CNAME %TARGET%', 'txt',true, true),
-('txt', 'txt entry', 'TXT', '%SUB% IN TXT "%TARGET%"','local,url,ip,webmail,ipv6,cname,txt',true, true),
-('mx', 'mx entry', 'IP', '%SUB% IN MX %TARGET%', 'local,url,ip,webmail,ipv6,cname,txt',true, false),
-('panel', 'Panel redirection', 'NONE', '%SUB% IN A @@PUBLIC_IP@@', 'local,url,ip,webmail,ipv6,cname,txt',true, false)
+INSERT IGNORE INTO `domaines_type` (name, description, target, entry, compatibility, only_dns, need_dns, advanced) values
+('vhost','Locally managed', 'DIRECTORY', '%SUB% IN A @@PUBLIC_IP@@', 'txt', false, false, false),
+('url','URL redirection', 'URL', '%SUB% IN A @@PUBLIC_IP@@','txt', true, true, false),
+('ip','IP redirection', 'IP', '%SUB% IN A %TARGET%','url,ip,ipv6,txt', false, true, true),
+('webmail', 'Webmail access', 'NONE', '%SUB% IN A @@PUBLIC_IP@@', 'txt', false, false, false),
+('ipv6','IPv6 address', 'IPV6', '%SUB% IN AAAA %TARGET%','ip,ipv6,webmail,txt',true, true, true ),
+('cname', 'cname entry', 'DOMAIN', '%SUB% CNAME %TARGET%', 'txt',true, true, true ),
+('txt', 'txt entry', 'TXT', '%SUB% IN TXT "%TARGET%"','vhost,url,ip,webmail,ipv6,cname,txt',true, true, true),
+('mx', 'mx entry', 'IP', '%SUB% IN MX %TARGET%', 'vhost,url,ip,webmail,ipv6,cname,txt',true, false, true),
+('panel', 'Panel redirection', 'NONE', '%SUB% IN A @@PUBLIC_IP@@', 'vhost,url,ip,webmail,ipv6,cname,txt',true, false, false)
;
diff --git a/install/upgrades/1.0.sql b/install/upgrades/1.0.sql
index 7519fa7a..c754efd6 100644
--- a/install/upgrades/1.0.sql
+++ b/install/upgrades/1.0.sql
@@ -12,27 +12,26 @@ CREATE TABLE IF NOT EXISTS `domaines_type` (
`target` enum ('NONE', 'URL', 'DIRECTORY', 'IP', 'IPV6', 'DOMAIN', 'TXT') NOT NULL DEFAULT 'NONE', -- Target type
`entry` VARCHAR (255) DEFAULT '', -- BIND entry
`compatibility` VARCHAR (255) DEFAULT '', -- Which type can be on the same subdomains
- `enable` BOOLEAN DEFAULT TRUE, -- Show this options to the users ?
+ `enable` enum ('ALL', 'NONE', 'ADMIN') NOT NULL DEFAULT 'ALL', -- Show this option to who ?
`only_dns` BOOLEAN DEFAULT FALSE, -- Update_domains modify just the dns, no web configuration
`need_dns` BOOLEAN DEFAULT TRUE, -- The server need to be the DNS to allow this service
+ `advanced` BOOLEAN DEFAULT TRUE, -- It's an advanced option
PRIMARY KEY ( `name` )
) COMMENT = 'Type of domains allowed';
-INSERT IGNORE INTO `domaines_type` (name, description, target, entry, compatibility, only_dns, need_dns) values
-('massvhost','Locally managed with Mass Virtual Hosting technologie', 'DIRECTORY', '%SUB% IN A @@PUBLIC_IP@@', 'txt', false, false),
-('local','Locally managed', 'DIRECTORY', '%SUB% IN A @@PUBLIC_IP@@', 'txt', false, false),
-('url','URL redirection', 'URL', '%SUB% IN A @@PUBLIC_IP@@','txt', true, true),
-('ip','IP redirection', 'IP', '%SUB% IN A %TARGET%','url,ip,ipv6,txt', false, true),
-('webmail', 'Webmail access', 'NONE', '%SUB% IN A @@PUBLIC_IP@@', 'txt', false, false),
-('ipv6','ipv6 address', 'IPV6', '%SUB% IN AAAA %TARGET%','ip,ipv6,webmail,txt',true, true),
-('cname', 'cname entry', 'DOMAIN', '%SUB% CNAME %TARGET%', 'txt',true, true),
-('txt', 'txt entry', 'TXT', '%SUB% IN TXT "%TARGET%"','local,url,ip,webmail,ipv6,cname,txt',true, true),
-('mx', 'mx entry', 'IP', '%SUB% IN MX %TARGET%', 'local,url,ip,webmail,ipv6,cname,txt',true, false),
-('panel', 'Panel redirection', 'NONE', '%SUB% IN A @@PUBLIC_IP@@', 'local,url,ip,webmail,ipv6,cname,txt',true, false)
+INSERT IGNORE INTO `domaines_type` (name, description, target, entry, compatibility, only_dns, need_dns, advanced) values
+('vhost','Locally managed', 'DIRECTORY', '%SUB% IN A @@PUBLIC_IP@@', 'txt', false, false, false),
+('url','URL redirection', 'URL', '%SUB% IN A @@PUBLIC_IP@@','txt', true, true, false),
+('ip','IP redirection', 'IP', '%SUB% IN A %TARGET%','url,ip,ipv6,txt', false, true, true),
+('webmail', 'Webmail access', 'NONE', '%SUB% IN A @@PUBLIC_IP@@', 'txt', false, false, false),
+('ipv6','IPv6 address', 'IPV6', '%SUB% IN AAAA %TARGET%','ip,ipv6,webmail,txt',true, true, true ),
+('cname', 'cname entry', 'DOMAIN', '%SUB% CNAME %TARGET%', 'txt',true, true, true ),
+('txt', 'txt entry', 'TXT', '%SUB% IN TXT "%TARGET%"','vhost,url,ip,webmail,ipv6,cname,txt',true, true, true),
+('mx', 'mx entry', 'IP', '%SUB% IN MX %TARGET%', 'vhost,url,ip,webmail,ipv6,cname,txt',true, false, true),
+('panel', 'Panel redirection', 'NONE', '%SUB% IN A @@PUBLIC_IP@@', 'vhost,url,ip,webmail,ipv6,cname,txt',true, false, false)
;
-- Changing standby use
--- TODO modify mysql.sh to add this changes
alter table domaines add column dns_action enum ('OK','UPDATE','DELETE') NOT NULL default 'UPDATE';
alter table domaines add column dns_result varchar(255) not null default '';
alter table sub_domaines add column web_action enum ('OK','UPDATE','DELETE') NOT NULL default 'UPDATE';
@@ -41,16 +40,12 @@ alter table sub_domaines add column enable enum ('ENABLED', 'ENABLE', 'DISABLED'
drop table sub_domaines_standby;
drop table domaines_standby;
-update sub_domaines set type='MASSVHOST' where type='0';
+update sub_domaines set type='VHOST' where type='0'; -- We decide to drop massvhost.
update sub_domaines set type='URL' where type='1';
update sub_domaines set type='IP' where type='2';
update sub_domaines set type='WEBMAIL' where type='3';
update sub_domaines set type='IPV6' where type='4';
update sub_domaines set type='CNAME' where type='5';
update sub_domaines set type='TXT' where type='6';
-
--- If people want to stop using mass virtual hosting and use only virtual hosting :
--- insert into sub_domaines (compte, domaine, sub, valeur, type,web_action) select compte, domaine, sub, valeur, 'local', 'UPDATE'
--- from sub_domaines where lower(type)='massvhost';
--- update sub_domaines set web_action = 'DELETE' where lower(type)='massvhost';
+update sub_domaines set web_action='UPDATE';