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
This commit is contained in:
Camille Lafitte 2008-05-22 14:40:18 +00:00
parent 7bc627a203
commit 6a0aa72bf8
2 changed files with 23 additions and 12 deletions

View File

@ -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>

View File

@ -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();