Deux choses :
- premier jet de "on degage le mass virtual hosting" - modification des types de domaine pour avoir des domaines avancé - modification des types de domaines pour avoir des domaines visible "que" par les admins
This commit is contained in:
parent
7c73dba4e2
commit
9533121a53
|
@ -51,7 +51,7 @@ include_once("head.php");
|
|||
<p>
|
||||
<?php __("Here is the list of domain types."); ?>
|
||||
</p>
|
||||
<p><span class="ina"><a href="adm_domstypeadd.php"><?php __("Create a domain type"); ?></a></span></p>
|
||||
<p><span class="ina"><a href="#" OnClick="alert('Todo. But if you want to play with that, you are advanced enough to do an insert in MySQL');" ><?php __("Create a domain type"); ?></a></span></p>
|
||||
<table class="tlist">
|
||||
<tr>
|
||||
<th colspan="2"> </th>
|
||||
|
@ -63,6 +63,7 @@ include_once("head.php");
|
|||
<th><?php __("Enabled?");?></th>
|
||||
<th><?php __("Only DNS?");?></th>
|
||||
<th><?php __("Need to be DNS?");?></th>
|
||||
<th><?php __("Advanced?");?></th>
|
||||
<th/>
|
||||
</tr>
|
||||
<?php
|
||||
|
@ -78,9 +79,10 @@ foreach($dom->domains_type_lst() as $d) {
|
|||
<td><?php echo $d['target'];?></td>
|
||||
<td><?php echo $d['entry'];?></td>
|
||||
<td><?php echo $d['compatibility'];?></td>
|
||||
<td><?php echo $d['enable']?__("Yes"):__("No");?></td>
|
||||
<td><?php echo __($d['enable']);?></td>
|
||||
<td><?php echo $d['only_dns']?__("Yes"):__("No");?></td>
|
||||
<td><?php echo $d['need_dns']?__("Yes"):__("No");?></td>
|
||||
<td><?php echo $d['advanced']?__("Yes"):__("No");?></td>
|
||||
</tr>
|
||||
<?php } // end foreach
|
||||
?>
|
||||
|
|
|
@ -6,7 +6,7 @@ if (!$admin->enabled) {
|
|||
}
|
||||
|
||||
|
||||
if ( ! $dom->domains_type_update($name, $description, $target, $entry, $compatibility, $enable, $only_dns, $need_dns) ) {
|
||||
if ( ! $dom->domains_type_update($name, $description, $target, $entry, $compatibility, $enable, $only_dns, $need_dns, $advanced) ) {
|
||||
die($err->errstr());
|
||||
} else {
|
||||
include("adm_domstype.php");
|
||||
|
|
|
@ -41,9 +41,10 @@ $fields = array (
|
|||
"target" => array ("request", "string", ""),
|
||||
"entry" => array ("request", "string", ""),
|
||||
"compatibility" => array ("request", "string", ""),
|
||||
"enable" => array ("request", "boolean", ""),
|
||||
"enable" => array ("request", "string", ""),
|
||||
"only_dns" => array ("request", "boolean", ""),
|
||||
"need_dns" => array ("request", "boolean", ""),
|
||||
"advanced" => array ("request", "boolean", ""),
|
||||
);
|
||||
getFields($fields);
|
||||
|
||||
|
@ -90,12 +91,18 @@ if ($error_edit) {
|
|||
<td><input name="entry" type="text" size="30" value="<?php echo $d['entry']; ?>" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><?php __("Compatibility");?><br /><small><?php __("Enter comma-separated name of other types"); ?></small></th>
|
||||
<th><?php __("Compatibility");?><br /><small><?php __("Enter comma-separated name of other types"); ?></small></th>
|
||||
<td><input name="compatibility" type="text" size="15" value="<?php echo $d['compatibility']; ?>" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><?php __("Enabled");?></th>
|
||||
<td><input name="enable" type="checkbox" value="1" <?php cbox($d['enable']); ?> /></td>
|
||||
<td>
|
||||
<select name="enable">
|
||||
<?php foreach ($dom->domains_type_enable_values() as $k) { ?>
|
||||
<option value="<?php echo $k ?>" <?php echo ($d['enable']==$k)?"selected":"";?> ><?php __($k);?></option>
|
||||
<?php } ?>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><?php __("Do only a DNS entry");?></th>
|
||||
|
@ -104,11 +111,15 @@ if ($error_edit) {
|
|||
<tr>
|
||||
<th><?php __("Domain must have our DNS");?></th>
|
||||
<td><input name="need_dns" type="checkbox" value="1" <?php cbox($d['need_dns']); ?> /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><?php __("Is it an advanced option ?");?></th>
|
||||
<td><input name="advanced" type="checkbox" value="1" <?php cbox($d['advanced']); ?> /></td>
|
||||
</tr>
|
||||
<tr class="trbtn">
|
||||
<td colspan="2">
|
||||
<input type="submit" class="inb" name="submit" value="<?php __("Change this domain type"); ?>" />
|
||||
<input type="button" class="inb" name="cancel" value="<?php __("Cancel"); ?>" onclick="document.location='adm_domstype.php'"/>
|
||||
<input type="button" class="inb" name="cancel" value="<?php __("Cancel"); ?>" onclick="document.location='adm_domstype.php'"/>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
|
|
@ -7,6 +7,7 @@ include_once("head.php");
|
|||
# Take the values of the subdomain in arguments
|
||||
|
||||
function sub_domains_edit($domain, $sub=false,$type=false,$value=false) {
|
||||
global $admin, $oldid;
|
||||
|
||||
$dom=new m_dom();
|
||||
$dom->lock();
|
||||
|
@ -37,13 +38,27 @@ $dom->unlock();
|
|||
<?php __("Create a subdomain:"); ?></td><td>
|
||||
<input type="text" class="int" name="sub" style="text-align:right" value="<?php ehe($sub); ?>" size="22" id="sub" /><span class="int" id="newsubname">.<?php echo $domain; ?></span></td>
|
||||
</tr>
|
||||
<?php foreach($dom->domains_type_lst() as $dt) {
|
||||
if (! $dt['enable']) continue;
|
||||
<?php
|
||||
$first_advanced=true;
|
||||
foreach($dom->domains_type_lst() as $dt) {
|
||||
// If this type is disabled AND it's not the type in use here, continue
|
||||
if ( $dt['enable'] == 'NONE' && strtoupper($type)!=strtoupper($dt['name'])) continue ;
|
||||
// If this type is only for ADMIN and i'm not an admin, continue (oldid is to check if we are an admin who take user identity)
|
||||
if (( $dt['enable'] == 'ADMIN') && (! $admin->enabled and ! intval($oldid))) continue;
|
||||
|
||||
if ( (! $r['dns'] ) and ($dt['need_dns']) ) continue;
|
||||
//if ( strtoupper($type)!=strtoupper($dt['name']) ) continue;
|
||||
$targval=(strtoupper($type)==strtoupper($dt['name']))?$sd['dest']:'';
|
||||
|
||||
if ($dt['advanced']) {
|
||||
$lst_advanced[]=$dt['name'];
|
||||
if ($first_advanced) {
|
||||
$first_advanced=false;
|
||||
echo "<tr id='domtype_show' onClick=\"domtype_advanced_show();\"><th colspan=2><a href=\"javascript:domtype_advanced_show();\"><b>+ "; __("Show advanced options"); echo "</b></a></th></tr>";
|
||||
echo "<tr id='domtype_hide' onClick=\"domtype_advanced_hide();\" style='display:none'><th colspan=2><a href=\"javascript:domtype_advanced_hide();\"><b>- "; __("Hide advanced options"); echo "</b></a></th></tr>";
|
||||
}
|
||||
}
|
||||
?>
|
||||
<tr>
|
||||
<tr id="tr_<?php echo $dt['name']; ?>">
|
||||
<td>
|
||||
<input type="radio" id="r_<?php echo $dt['name']?>" class="inc" name="type" value="<?php echo $dt['name']; ?>" <?php cbox(strtoupper($type)==strtoupper($dt['name'])); ?> />
|
||||
<label for="r_<?php echo $dt['name']?>"><?php __($dt['description']); ?></label>
|
||||
|
@ -94,6 +109,22 @@ $dom->unlock();
|
|||
</table>
|
||||
</form>
|
||||
|
||||
<script type="text/javascript">
|
||||
function domtype_advanced_hide() {
|
||||
<?php foreach ($lst_advanced as $adv) echo "$(\"#tr_$adv\").hide();\n"?>
|
||||
$("#domtype_show").show();
|
||||
$("#domtype_hide").hide();
|
||||
}
|
||||
function domtype_advanced_show() {
|
||||
<?php foreach ($lst_advanced as $adv) echo "$(\"#tr_$adv\").show();\n"?>
|
||||
$("#domtype_show").hide();
|
||||
$("#domtype_hide").show();
|
||||
}
|
||||
|
||||
domtype_advanced_hide();
|
||||
|
||||
</script>
|
||||
|
||||
<?php
|
||||
} // sub_domains_edit
|
||||
?>
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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)
|
||||
;
|
||||
|
||||
|
||||
|
|
|
@ -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';
|
||||
|
||||
|
|
Loading…
Reference in New Issue