diff --git a/bureau/admin/dom_add.php b/bureau/admin/dom_add.php index 15e01626..0e65ffe7 100644 --- a/bureau/admin/dom_add.php +++ b/bureau/admin/dom_add.php @@ -35,6 +35,7 @@ if (!isset($dns)) $dns="1"; ?>

+
cancreate("dom")) { ?>

@@ -44,14 +45,39 @@ exit(); if ($error) echo "

$error

"; ?>
- -
- -
" />

- />
- + www.

+

+ />  +

+getquota("dom"); +if ($q["u"]>0) { +?> +

+ +
+ +
+ +
+

+ + +

+ " /> +

+

diff --git a/bureau/admin/dom_doadd.php b/bureau/admin/dom_doadd.php index d0ca2566..3b2c5ae4 100644 --- a/bureau/admin/dom_doadd.php +++ b/bureau/admin/dom_doadd.php @@ -33,12 +33,14 @@ include_once("head.php"); $fields = array ( "newdomain" => array ("post", "string", ""), "dns" => array ("post", "string", ""), + "newisslave" => array ("post", "integer" ,0), + "slavedom" => array ("post", "string" ,0), ); getFields($fields); $dom->lock(); -if (!$dom->add_domain($newdomain,$dns)) { +if (!$dom->add_domain($newdomain,$dns,0,0,$newisslave,$slavedom)) { $error=$err->errstr(); include("dom_add.php"); exit(); diff --git a/bureau/admin/dom_edit.php b/bureau/admin/dom_edit.php index f005ddfa..d3b80eda 100644 --- a/bureau/admin/dom_edit.php +++ b/bureau/admin/dom_edit.php @@ -97,7 +97,7 @@ for($i=0;$i<$r["nsub"];$i++) { " /> -. +. @@ -105,7 +105,7 @@ for($i=0;$i<$r["nsub"];$i++) { diff --git a/bureau/admin/dom_subedit.php b/bureau/admin/dom_subedit.php index 2aae0bb9..09024db9 100644 --- a/bureau/admin/dom_subedit.php +++ b/bureau/admin/dom_subedit.php @@ -43,7 +43,7 @@ if (!$r=$dom->get_sub_domain_all($domain,$sub)) { $dom->unlock(); ?> -

http:// :

+

http://

$error

"; @@ -52,10 +52,10 @@ $dom->unlock(); } ?>
+
-

http://

@@ -68,7 +68,7 @@ $dom->unlock(); @@ -88,10 +88,9 @@ $dom->unlock(); - - - -
" size="40" />  
" />" onclick="history.back();" />
+
+" /> +" onclick="history.back();" />
diff --git a/bureau/admin/styles/style.css b/bureau/admin/styles/style.css index eadd0557..d9945bab 100644 --- a/bureau/admin/styles/style.css +++ b/bureau/admin/styles/style.css @@ -95,6 +95,7 @@ hr { color: black; background-color: #CFE3F1; cursor: pointer; + margin-right: 4px; } .inb:hover { background-color: #BFD3E1; @@ -144,9 +145,8 @@ hr { border: 1px dotted black; background-color: white; font-family: Verdana, Arial, Helvetica, sans-serif; - font-size: 10px; - padding-left: 2px; - padding-right: 2px; + font-size: 11px; + padding: 2px; color: black; } @@ -213,8 +213,9 @@ img { #content { display: block; - width: 740px; + width: 730px; padding-left: 10px; + padding-right: 10px; vertical-align: top; } @@ -349,4 +350,21 @@ a:hover { .breadcrumb { font-size: 12px; -} \ No newline at end of file +} + +#newdomwww { + border-right: 0; + padding-right: 0; +} +#newdomain { + border-left: 0; + padding-left: 0; +} +#sub { + border-right: 0; + padding-right: 0; +} +#newsubname { + border-left: 0; + padding-left: 0; +} diff --git a/bureau/class/functions.php b/bureau/class/functions.php index bce820e6..bf7badad 100644 --- a/bureau/class/functions.php +++ b/bureau/class/functions.php @@ -398,5 +398,19 @@ function duration_list($name, $selected=0) { return $res; } +/* select_values($arr,$cur) echo des "; + } + } +} + ?> diff --git a/bureau/class/m_dom.php b/bureau/class/m_dom.php index 5113af4f..14c40c58 100644 --- a/bureau/class/m_dom.php +++ b/bureau/class/m_dom.php @@ -178,7 +178,7 @@ class m_dom { * force ne devrait être utilisé que par le super-admin. $ @return boolean Retourne FALSE si une erreur s'est produite, TRUE sinon. */ - function add_domain($domain,$dns,$noerase=0,$force=0) { + function add_domain($domain,$dns,$noerase=0,$force=0,$isslave,$slavedom) { global $db,$err,$quota,$classes,$L_MX,$L_FQDN,$tld,$cuid,$bro; $err->log("dom","add_domain",$domain); $mx="1"; @@ -257,21 +257,36 @@ class m_dom { $db->query("insert into domaines (compte,domaine,mx,gesdns,gesmx,noerase) values ('$cuid','$domain','$L_MX','$dns','$mx','$noerase');"); $db->query("insert into domaines_standby (compte,domaine,mx,gesdns,gesmx,action) values ('$cuid','$domain','$L_MX','$dns','$mx',0);"); // INSERT - // Creation du repertoire dans www - $dest_root = $bro->get_userid_root($cuid); - $domshort=str_replace("-","",str_replace(".","",$domain)); - - if (! is_dir($dest_root . "/". $domshort)) { - mkdir($dest_root . "/". $domshort); + if ($isslave) { + $isslave=true; + $db->query("SELECT domaine FROM domaines WHERE compte='$cuid' AND domaine='$slavedom';"); + $db->next_record(); + if (!$db->Record["domaine"]) { + $err->raise("dom",1,$slavedom); + $isslave=false; + } + // Point to the master domain : + $this->set_sub_domain($domain, '', $this->type_url,'add', 'http://www.'.$slavedom); + $this->set_sub_domain($domain, 'www', $this->type_url,'add', 'http://www.'.$slavedom); + $this->set_sub_domain($domain, 'mail', $this->type_url,'add', 'http://mail.'.$slavedom); + } + if (!$isslave) { + // Creation du repertoire dans www + $dest_root = $bro->get_userid_root($cuid); + $domshort=str_replace("-","",str_replace(".","",$domain)); + + if (! is_dir($dest_root . "/". $domshort)) { + mkdir($dest_root . "/". $domshort); + } + + // Creation des 3 sous-domaines par défaut : Vide, www et mail + $this->set_sub_domain($domain, '', $this->type_url, 'add', 'http://www.'.$domain); + $this->set_sub_domain($domain, 'www', $this->type_local, 'add', '/'. $domshort); + $this->set_sub_domain($domain, 'mail', $this->type_webmail, 'add', ''); } - - // Creation des 3 sous-domaines par défaut : Vide, www et mail - $this->set_sub_domain($domain, '', $this->type_url, 'add', 'http://www.'.$domain); - $this->set_sub_domain($domain, 'www', $this->type_local, 'add', '/'. $domshort); - $this->set_sub_domain($domain, 'mail', $this->type_webmail, 'add', ''); // DEPENDANCE : // Lancement de add_dom sur les classes domain_sensitive : - // Declenchons les autres classes. + // Declenchons les autres classes. foreach($classes as $c) { if (method_exists($GLOBALS[$c],"alternc_add_domain")) { $GLOBALS[$c]->alternc_add_domain($domain); @@ -282,7 +297,14 @@ class m_dom { $GLOBALS[$c]->alternc_add_mx_domain($domain); } } - return true; + if ($isslave) { + foreach($classes as $c) { + if (method_exists($GLOBALS[$c],"alternc_add_slave_domain")) { + $GLOBALS[$c]->alternc_add_slave_domain($domain,$slavedom); + } + } + } + return true; } /* ----------------------------------------------------------------- */ @@ -948,6 +970,22 @@ class m_dom { return true; } + + /* ----------------------------------------------------------------- */ + /** + * Returns the complete hosted domain list : + */ + function get_domain_list() { + global $db,$err; + $res=array(); + $db->query("SELECT domaine FROM domaines WHERE gesdns=1 ORDER BY domaine"); + while ($db->next_record()) { + $res[]=$db->f("domaine"); + } + return $res; + } + + /* ----------------------------------------------------------------- */ /** * Return the list of allowed slave accounts diff --git a/bureau/class/m_mail.php b/bureau/class/m_mail.php index ef01e274..ed72cc57 100644 --- a/bureau/class/m_mail.php +++ b/bureau/class/m_mail.php @@ -695,6 +695,22 @@ class m_mail { } + /* ----------------------------------------------------------------- */ + /** hook function called by AlternC when a domain is created for + * the current user account using the SLAVE DOMAIN feature + * This function create a CATCHALL to the master domain + * @param string $dom Domain that has just been created + * @param string $master Master domain + * @access private + */ + function alternc_add_slave_domain($dom,$slave) { + global $err; + $err->log("mail","alternc_add_slave_domain",$dom); + $this->add_mail($dom,"",0,"","@".$slave); + return true; + } + + /* ----------------------------------------------------------------- */ /** * Returns the used quota for the $name service for the current user.