Ajout page de gestion des sous domaines par defaults
This commit is contained in:
parent
bb744c7321
commit
7e017eb2c7
|
@ -61,6 +61,7 @@ bureau/admin/adm_dodel.php -text
|
|||
bureau/admin/adm_doedit.php -text
|
||||
bureau/admin/adm_domlock.php -text
|
||||
bureau/admin/adm_doms.php -text
|
||||
bureau/admin/adm_doms_def_type.php -text
|
||||
bureau/admin/adm_domstype.php -text
|
||||
bureau/admin/adm_domstypedoedit.php -text
|
||||
bureau/admin/adm_domstypeedit.php -text
|
||||
|
|
|
@ -0,0 +1,81 @@
|
|||
<?php
|
||||
require_once("../class/config.php");
|
||||
|
||||
if (!$admin->enabled) {
|
||||
__("This page is restricted to authorized staff");
|
||||
exit();
|
||||
}
|
||||
|
||||
include_once("head.php");
|
||||
|
||||
?>
|
||||
<h3><?php __("Manage defaults domains type"); ?></h3>
|
||||
<hr id="topbar" />
|
||||
<p><?php __("If you don't know what this page is about, don't touch anything, and read AlternC documentation about domain types"); ?></p>
|
||||
|
||||
<br />
|
||||
<?php
|
||||
if (isset($error) && $error) {
|
||||
echo "<p class=\"error\">$error</p>";
|
||||
}
|
||||
|
||||
|
||||
$fields = array (
|
||||
"domup" => array ("post", "array", ""),
|
||||
);
|
||||
getFields($fields);
|
||||
|
||||
if (!empty($domup)) {
|
||||
if (!$dom->update_default_subdomains($domup) ) {
|
||||
$error=_("There was an error during the record.");
|
||||
} else {
|
||||
$error=_("Save done.");
|
||||
}
|
||||
}
|
||||
|
||||
$tab=$dom->lst_default_subdomains();
|
||||
?>
|
||||
<form method="post" action="dom_defedit.php" name="main" id="main">
|
||||
<table class="tlist">
|
||||
<tr><th> </th><th><?php __("Sub"); ?></th><th><?php __("Type"); ?></th><th><?php __("settings"); ?></th><th><?php __("Concerned"); ?></th><th><?php __("Activation"); ?></th></tr>
|
||||
<?php
|
||||
$col=1;
|
||||
for($i=0;$i<count($tab)+1;$i++) {
|
||||
@$val=$tab[$i];
|
||||
$col=3-$col;
|
||||
if (isset($tab[$i])){
|
||||
echo "<input type='hidden' name='domup[$i][id]' value='".$val['id']."' />";
|
||||
}
|
||||
?>
|
||||
<tr class="lst<?php echo $col; ?>">
|
||||
<td></td>
|
||||
<td><input type='text' name='domup[<?php echo $i; ?>][sub]' value="<?php echo $val['sub']; ?>"/></td>
|
||||
<?php $type=array("VHOST","URL","WEBMAIL","");
|
||||
if(in_array($val['domain_type'],$type)){?>
|
||||
<td><select name='domup[<?php echo $i; ?>][domain_type]'>
|
||||
<option value='VHOST' <?php if($val['domain_type']=='VHOST') echo "selected=\"selected\""; ?> >VHOST</option>
|
||||
<option value='URL' <?php if($val['domain_type']=='URL') echo "selected=\"selected\""; ?> >URL</option>
|
||||
<option value='WEBMAIL' <?php if($val['domain_type']=='WEBMAIL') echo "selected=\"selected\""; ?> >WEBMAIL</option>
|
||||
</select>
|
||||
<?php }else{?>
|
||||
<td><input type ='text' name='domup[<?php echo $i; ?>][domain_type]' value='<?php echo $val['domain_type']?>' ></td>
|
||||
<? }?>
|
||||
</td>
|
||||
<td><input type ='text' name='domup[<?php echo $i; ?>][domain_type_parameter]' value='<?php echo $val['domain_type_parameter']?>' ></td>
|
||||
<td><select name='domup[<?php echo $i; ?>][concerned]'>
|
||||
<option value='MAIN' <?php if($val['concerned']=='MAIN') echo "selected=\"selected\""; ?> >MAIN</option>
|
||||
<option value='SLAVE' <?php if($val['concerned']=='SLAVE') echo "selected=\"selected\""; ?> >SLAVE</option>
|
||||
<option value='BOTH' <?php if($val['concerned']=='BOTH') echo "selected=\"selected\""; ?> >BOTH</option>
|
||||
</select>
|
||||
</td>
|
||||
<td><input type="checkbox" id="enabled" name="domup[<?php echo $i; ?>][enabled]" value="1" <?php if ($val['enabled']==1) echo "checked=\"checked\""; ?> /></td>
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
|
||||
</table>
|
||||
<p><input type="submit" class="inb" name="submit" value="<?php __("Save"); ?>" /></p>
|
||||
</form>
|
||||
<?php
|
||||
include_once("foot.php"); ?>
|
|
@ -64,9 +64,10 @@ if (isset($error) && $error) {
|
|||
<li class="lst1"><a href="adm_slaveaccount.php"><?php __("Manage allowed accounts for slave zone transfers"); ?></a></li>
|
||||
<li class="lst2"><a href="adm_mxaccount.php"><?php __("Manage allowed accounts for secondary mx"); ?></a></li>
|
||||
<li class="lst1"><a href="adm_variables.php"><?php __("Configure AlternC variables"); ?></a></li>
|
||||
<li class="lst2"><a href="adm_domstype.php"><?php __("Manage domains type"); ?></a></li>
|
||||
<li class="lst1"><a href="adm_dnsweberror.php"><?php __("DNS and website having errors"); ?></a></li>
|
||||
<li class="lst2"><a href="adm_menulist.php"><?php __("Manage menu"); ?></a></li>
|
||||
<li class="lst2"><a href="adm_doms_def_type.php"><?php __("Manage defaults domains type"); ?></a></li>
|
||||
<li class="lst1"><a href="adm_domstype.php"><?php __("Manage domains type"); ?></a></li>
|
||||
<li class="lst2"><a href="adm_dnsweberror.php"><?php __("DNS and website having errors"); ?></a></li>
|
||||
<li class="lst1"><a href="adm_menulist.php"><?php __("Manage menu"); ?></a></li>
|
||||
<!-- <li class="lst2"><a href="stats_members.php"><?php __("Account creation statistics"); ?></a></li> -->
|
||||
</ul>
|
||||
|
||||
|
|
|
@ -416,6 +416,55 @@ class m_dom {
|
|||
return "/www/".$this->domshort($domain);
|
||||
}
|
||||
|
||||
|
||||
function lst_default_subdomains(){
|
||||
global $db,$err;
|
||||
$c=array();
|
||||
$db->query("select * from default_subdomains;");
|
||||
|
||||
while($db->next_record()) {
|
||||
$c[]=array('id'=>$db->f('id'),
|
||||
'sub'=>$db->f('sub'),
|
||||
'domain_type'=>$db->f('domain_type'),
|
||||
'domain_type_parameter'=>$db->f('domain_type_parameter'),
|
||||
'concerned'=>$db->f('concerned'),
|
||||
'enabled'=>$db->f('enabled')
|
||||
) ;
|
||||
}
|
||||
|
||||
return $c;
|
||||
}
|
||||
|
||||
|
||||
function update_default_subdomains($arr) {
|
||||
$ok=true;
|
||||
foreach ($arr as $a) {
|
||||
if (! isset($a['id'])) $a['id']=null;
|
||||
if(!empty($a['sub']) || !empty($a['domain_type_parameter'])){
|
||||
|
||||
if (! isset($a['enabled'])) $a['enabled']=0;
|
||||
printvar($a);
|
||||
if (! $this->update_one_default($a['domain_type'],$a['sub'], $a['domain_type_parameter'], $a['concerned'], $a['enabled'],$a['id']) ) {
|
||||
$ok=false;
|
||||
}
|
||||
}
|
||||
}
|
||||
return $ok;
|
||||
}
|
||||
|
||||
function update_one_default($domain_type,$sub,$domain_type_parameter,$concerned,$enabled,$id=null){
|
||||
global $db,$err;
|
||||
|
||||
if($id==null)
|
||||
$db->query("INSERT INTO default_subdomains values ('','".$sub."','".$domain_type."','".$domain_type_parameter."','".$concerned."','".$enabled."');");
|
||||
else
|
||||
$db->query("UPDATE default_subdomains set sub='".$sub."', domain_type='".$domain_type."',domain_type_parameter='".$domain_type_parameter."',concerned='".$concerned."',enabled='".$enabled."' where id=".$id.";");
|
||||
return true;
|
||||
//update
|
||||
|
||||
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------- */
|
||||
/**
|
||||
* Retourne les entrées DNS du domaine $domain issues du WHOIS.
|
||||
|
|
Loading…
Reference in New Issue