2011-01-28 15:55:26 +00:00
|
|
|
<?php
|
|
|
|
require_once("../class/config.php");
|
|
|
|
include_once("head.php");
|
|
|
|
|
|
|
|
|
|
|
|
# Function to create/edit subdomain
|
|
|
|
# Take the values of the subdomain in arguments
|
|
|
|
|
|
|
|
function sub_domains_edit($domain, $sub=false,$type=false,$value=false) {
|
2011-03-27 13:29:44 +00:00
|
|
|
global $admin, $oldid, $isedit;
|
2011-01-28 15:55:26 +00:00
|
|
|
|
|
|
|
$dom=new m_dom();
|
|
|
|
$dom->lock();
|
|
|
|
if (!$r=$dom->get_domain_all($domain)) {
|
|
|
|
$error=$err->errstr();
|
|
|
|
}
|
|
|
|
/*
|
|
|
|
if (! empty($sub)) {
|
|
|
|
if (!$sd=$dom->get_sub_domain_all($domain,$sub,$type,$value)) {
|
|
|
|
$error=$err->errstr();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
*/
|
|
|
|
$sd=$dom->get_sub_domain_all($domain,$sub,$type,$value);
|
|
|
|
|
|
|
|
$dom->unlock();
|
|
|
|
?>
|
|
|
|
|
|
|
|
<form action="dom_subdoedit.php" method="post" name="main" id="main">
|
|
|
|
<table border="0">
|
|
|
|
<tr>
|
|
|
|
<td>
|
|
|
|
<input type="hidden" name="domain" value="<?php ehe($domain); ?>" />
|
|
|
|
<input type="hidden" name="sub_old" value="<?php ehe($sub); ?>" />
|
|
|
|
<input type="hidden" name="type_old" value="<?php ehe($type); ?>" />
|
|
|
|
<input type="hidden" name="value_old" value="<?php ehe($value); ?>" />
|
|
|
|
<input type="hidden" name="action" value="add" />
|
2011-03-27 13:21:09 +00:00
|
|
|
<?php
|
|
|
|
if ($isedit) {
|
|
|
|
__("Edit a subdomain:");
|
2011-03-27 13:29:44 +00:00
|
|
|
} else {
|
|
|
|
__("Create a subdomain:");
|
2011-03-27 13:21:09 +00:00
|
|
|
}
|
|
|
|
?></td><td>
|
2011-01-28 15:55:26 +00:00
|
|
|
<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>
|
2011-03-06 15:03:51 +00:00
|
|
|
<?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;
|
|
|
|
|
2011-01-28 15:55:26 +00:00
|
|
|
if ( (! $r['dns'] ) and ($dt['need_dns']) ) continue;
|
|
|
|
$targval=(strtoupper($type)==strtoupper($dt['name']))?$sd['dest']:'';
|
2011-03-06 15:03:51 +00:00
|
|
|
|
|
|
|
if ($dt['advanced']) {
|
|
|
|
$lst_advanced[]=$dt['name'];
|
|
|
|
if ($first_advanced) {
|
|
|
|
$first_advanced=false;
|
2011-03-27 13:29:44 +00:00
|
|
|
echo "<tr><td colspan=\"2\" class=\"advdom\"></td></tr>";
|
2011-03-06 18:09:18 +00:00
|
|
|
echo "<tr id='domtype_show' class='lst2' onClick=\"domtype_advanced_show();\"><td colspan=2><a href=\"javascript:domtype_advanced_show();\"><b>+ "; __("Show advanced options"); echo "</b></a></td></tr>";
|
|
|
|
echo "<tr id='domtype_hide' class='lst2' onClick=\"domtype_advanced_hide();\" style='display:none'><td colspan=2><a href=\"javascript:domtype_advanced_hide();\"><b>- "; __("Hide advanced options"); echo "</b></a></td></tr>";
|
2011-03-27 13:29:44 +00:00
|
|
|
echo "<tr><td colspan=\"2\" class=\"advdom\"></td></tr>";
|
2011-03-06 15:03:51 +00:00
|
|
|
}
|
|
|
|
}
|
2011-01-28 15:55:26 +00:00
|
|
|
?>
|
2011-03-06 15:03:51 +00:00
|
|
|
<tr id="tr_<?php echo $dt['name']; ?>">
|
2011-01-28 15:55:26 +00:00
|
|
|
<td>
|
2011-01-29 10:39:22 +00:00
|
|
|
<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>
|
2011-01-28 15:55:26 +00:00
|
|
|
</td>
|
|
|
|
<td>
|
|
|
|
<?php
|
|
|
|
|
|
|
|
switch ($dt['target']) {
|
|
|
|
case "NONE":
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
case "DIRECTORY": ?>
|
|
|
|
<input type="text" class="int" name="t_<?php echo $dt['name']?>" id="t_<?php echo $dt['name']?>" value="<?php ehe($targval); ?>" size="28" />
|
|
|
|
<script type="text/javascript">
|
|
|
|
<!--
|
2011-01-28 16:46:32 +00:00
|
|
|
document.write(" <input type=\"button\" name=\"bff\" onclick=\"browseforfolder('main.t_<?php echo $dt['name'];?>');\" value=\" <?php __("Choose a folder..."); ?> \" class=\"bff\">");
|
2011-01-28 15:55:26 +00:00
|
|
|
// -->
|
|
|
|
</script><?php
|
|
|
|
break;
|
|
|
|
case "URL": ?>
|
|
|
|
<input type="text" class="int" name="t_<?php echo $dt['name']?>" id="t_<?php echo $dt['name']?>" value="<?php ehe($targval); ?>" size="50" />
|
|
|
|
<small><?php __("(enter an URL here)"); ?></small><?php
|
|
|
|
break;;
|
|
|
|
case 'IP':?>
|
|
|
|
<input type="text" class="int" name="t_<?php echo $dt['name']?>" id="t_<?php echo $dt['name']?>" value="<?php ehe($targval); ?>" size="16" />
|
|
|
|
<small><?php __("(enter an IPv4 address, for example 192.168.1.2)"); ?></small><?php
|
|
|
|
break;
|
|
|
|
case 'IPV6':?>
|
|
|
|
<input type="text" class="int" name="t_<?php echo $dt['name']?>" id="t_<?php echo $dt['name']?>" value="<?php ehe($targval); ?>" size="32" />
|
|
|
|
<small><?php __("(enter an IPv6 address, for example 2001:0910::0)"); ?></small><?php
|
|
|
|
break;
|
|
|
|
case 'TXT':?>
|
|
|
|
<input type="text" class="int" name="t_<?php echo $dt['name']?>" id="t_<?php echo $dt['name']?>" value="<?php ehe($targval);?>" size="32" />
|
|
|
|
<small><?php __("(enter a TXT informations for this domain)"); ?></small></td><?php
|
|
|
|
break;
|
|
|
|
case 'DOMAIN':?>
|
|
|
|
<input type="text" class="int" name="t_<?php echo $dt['name']?>" id="t_<?php echo $dt['name']?>" value="<?php ehe($targval);?>" size="32" />
|
2011-02-08 08:41:08 +00:00
|
|
|
<small><?php __("(enter a domain name or subdomain)"); ?></small><?php
|
2011-01-28 15:55:26 +00:00
|
|
|
break;
|
|
|
|
} // switch ?>
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
<?php } // foreach ?>
|
|
|
|
|
|
|
|
<tr class="trbtn">
|
|
|
|
<td colspan="2"><input type="submit" class="inb" name="add" value="<?php __("Add this subdomain"); ?>" /></td>
|
|
|
|
</tr>
|
|
|
|
</table>
|
|
|
|
</form>
|
|
|
|
|
2011-03-06 15:03:51 +00:00
|
|
|
<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>
|
|
|
|
|
2011-01-28 15:55:26 +00:00
|
|
|
<?php
|
|
|
|
} // sub_domains_edit
|
|
|
|
?>
|
|
|
|
|