Commit 6a0aa72b authored by Camille Lafitte's avatar Camille Lafitte
Browse files

Création d'un nouveau compte avec son sous domaine

Permettre à un (sous) administrateur d'affecter au choix le domaine entre ceux déclarés pour son compte ou celui générique du serveur (défini par l'admin général).

close #1087
parent 7bc627a2
......@@ -91,18 +91,31 @@ if ($error) {
$type = $db->f("type");
echo "<option value=\"$type\"";
if($type == 'default')
echo " selected";
echo " selected=\"selected\"";
echo ">$type</option>";
}
?></select>
</td>
</tr>
<? if (variable_get('hosting_tld')) { ?>
<tr>
<th colspan="2"><label><input type="checkbox" name="create_dom" value="1" />
<?php printf(_("Create the domain <b>username.%s</b>"),variable_get('hosting_tld')); ?></label></th>
</tr>
<th colspan="2">
<input type="checkbox" name="create_dom" value="1" />
<label><?php printf(_("Create the domain <b>username.%s</b>"),""); ?></label>
<select name="create_dom_list">
<?php if (variable_get('hosting_tld')) { ?>
<option value="<?php echo variable_get('hosting_tld'); ?>" selected="selected"><?php echo variable_get('hosting_tld'); ?></option>
<?php }
/* Enumeration des domaines : */
$domain=$dom->enum_domains();
reset($domain);
while (list($key,$val)=each($domain)) { ?>
<option value="<?php echo $val; ?>" > <?php echo $val?> </option>
<?php } ?>
</select>
</th>
</tr>
<tr>
<? } ?>
<td colspan="2"><input type="submit" class="inb" name="submit" value="<?php __("Create a new member"); ?>" /></td>
</tr>
</table>
......
......@@ -59,16 +59,14 @@ if (!($u=$admin->add_mem($login, $pass, $nom, $prenom, $nmail, $canpass, $type))
*
* 1 = force = ne tient pas compte du whois ou des droits de tld
*/
if ($create_dom) {
if (variable_get("hosting_tld")) {
if (($create_dom == 1) && !is_null($create_dom_list)) {
# make sure we don't have multiple dots there
$dom->lock();
$dom->add_domain($login.".".preg_replace("/^\.\.*/", "", variable_get("hosting_tld")),1,1,1);
$dom->add_domain($login.".".preg_replace("/^\.\.*/", "", $create_dom_list),1,1,1);
$dom->unlock();
} else {
$err->log("no 'hosting_tld' variable defined in `variables` table, not creating domain");
}
}
$ftp->add_ftp($login,"",$pass,"/");
$mem->unsu();
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment