2006-04-26 12:28:53 +00:00
< ? php
/*
$Id : dom_edit . php , v 1.8 2006 / 02 / 17 18 : 20 : 08 olivier Exp $
----------------------------------------------------------------------
AlternC - Web Hosting System
Copyright ( C ) 2002 by the AlternC Development Team .
http :// alternc . org /
----------------------------------------------------------------------
Based on :
Valentin Lacambre ' s web hosting softwares : http :// altern . org /
----------------------------------------------------------------------
LICENSE
This program is free software ; you can redistribute it and / or
modify it under the terms of the GNU General Public License ( GPL )
as published by the Free Software Foundation ; either version 2
of the License , or ( at your option ) any later version .
This program is distributed in the hope that it will be useful ,
but WITHOUT ANY WARRANTY ; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the
GNU General Public License for more details .
To read the license please visit http :// www . gnu . org / copyleft / gpl . html
----------------------------------------------------------------------
Original Author of file : Benjamin Sonntag
Purpose of file : Edit a domain parameters
----------------------------------------------------------------------
*/
require_once ( " ../class/config.php " );
2009-09-08 05:29:38 +00:00
include_once ( " head.php " );
$fields = array (
" domain " => array ( " request " , " string " , " " ),
2010-04-29 08:31:15 +00:00
" sub " => array ( " request " , " string " , " " ),
" type " => array ( " request " , " integer " , $dom -> type_local ),
" sub_local " => array ( " request " , " string " , " / " ),
" sub_url " => array ( " request " , " string " , " http:// " ),
" sub_ip " => array ( " request " , " string " , " " ),
2009-09-08 05:29:38 +00:00
);
getFields ( $fields );
2006-04-26 12:28:53 +00:00
$dom -> lock ();
if ( ! $r = $dom -> get_domain_all ( $domain )) {
$error = $err -> errstr ();
}
$dom -> unlock ();
?>
< script type = " text/javascript " >
function dnson () {
// Active les composants DNS :
2010-04-29 08:31:15 +00:00
if ( document . forms [ " fdns " ] . mx . disabled != null )
document . forms [ " fdns " ] . mx . disabled = false ;
if ( document . forms [ " fdns " ] . emailon . disabled != null )
document . forms [ " fdns " ] . emailon . disabled = true ;
if ( document . forms [ " fdns " ] . emailoff . disabled != null )
document . forms [ " fdns " ] . emailoff . disabled = true ;
2006-04-26 12:28:53 +00:00
}
function dnsoff () {
// Active les composants DNS :
2010-04-29 08:31:15 +00:00
if ( document . forms [ " fdns " ] . mx . disabled != null )
document . forms [ " fdns " ] . mx . disabled = true ;
if ( document . forms [ " fdns " ] . emailon . disabled != null )
document . forms [ " fdns " ] . emailon . disabled = false ;
if ( document . forms [ " fdns " ] . emailoff . disabled != null )
document . forms [ " fdns " ] . emailoff . disabled = false ;
2006-04-26 12:28:53 +00:00
}
</ script >
2010-03-04 13:51:32 +00:00
< h3 >< ? php printf ( _ ( " Editing subdomains of %s " ), $domain ); ?> </h3>
2006-04-26 12:28:53 +00:00
< ? php
if ( $error ) {
echo " <p class= \" error \" > $error </p> " ;
}
?>
< hr />
2010-03-04 13:51:32 +00:00
< br />
2006-04-26 12:28:53 +00:00
<!-- *****************************************
gestion des sous - domaines
-->
2010-04-06 20:29:08 +00:00
< table class = " tlist " >
2010-03-04 13:51:32 +00:00
< tr >< th colspan = " 2 " >< ? php __ ( " Actions " ); ?> </th><th><?php __("Subdomain"); ?></th><th><?php __("Place"); ?></th></tr>
2006-04-26 12:28:53 +00:00
< ? php
$col = 1 ;
for ( $i = 0 ; $i < $r [ " nsub " ]; $i ++ ) {
$col = 3 - $col ;
?>
< tr class = " lst<?php echo $col ; ?> " >
2009-09-08 05:29:38 +00:00
< td class = " center " >
2010-03-04 13:51:32 +00:00
< div class = " ina " >< a href = " dom_subedit.php?domain=<?php echo urlencode( $r["name"] ) ?>&sub=<?php echo urlencode( $r["sub"] [ $i ][ " name " ]) ?> " >< img src = " images/edit.png " alt = " <?php __( " Edit " ); ?> " />< ? php __ ( " Edit " ); ?> </a></div>
2010-04-06 20:29:08 +00:00
2010-03-04 13:51:32 +00:00
</ td >< td class = " center " >
< div class = " ina " >< a href = " dom_subdel.php?domain=<?php echo urlencode( $r["name"] ) ?>&sub=<?php echo urlencode( $r["sub"] [ $i ][ " name " ]) ?> " >< img src = " images/delete.png " alt = " <?php __( " Delete " ); ?> " />< ? php __ ( " Delete " ); ?> </a></div>
2006-04-26 12:28:53 +00:00
</ td >
< td >< a href = " http://<?php ecif( $r["sub"] [ $i ][ " name " ], $r["sub"] [ $i ][ " name " ]. " . " ); echo $r["name"] ?> " target = " _blank " >< ? php ecif ( $r [ " sub " ][ $i ][ " name " ], $r [ " sub " ][ $i ][ " name " ] . " . " ); echo $r [ " name " ] ?> </a></td>
2006-05-03 15:55:42 +00:00
< td >< ? php echo $r [ " sub " ][ $i ][ 'type' ] === '0' ? '<a href="bro_main.php?R=' . urlencode ( $r [ " sub " ][ $i ][ " dest " ]) . '">' . htmlspecialchars ( $r [ " sub " ][ $i ][ " dest " ]) . '</a>' : htmlspecialchars ( $r [ " sub " ][ $i ][ " dest " ]); ?> </td>
2006-04-26 12:28:53 +00:00
</ tr >
< ? php } ?>
</ table >
< br />
2010-03-04 13:51:32 +00:00
< hr />
< br />
2010-04-06 20:29:08 +00:00
< form action = " dom_subdoedit.php " method = " post " name = " main " id = " main " >
2006-04-26 12:28:53 +00:00
< table border = " 0 " >
< tr >
2010-04-29 08:31:15 +00:00
< td >
< input type = " hidden " name = " domain " value = " <?php ehe( $r["name"] ); ?> " />
2006-04-26 12:28:53 +00:00
< input type = " hidden " name = " action " value = " add " />
2010-04-29 08:31:15 +00:00
< ? php __ ( " Create a subdomain: " ); ?> </td><td>
< 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>
2006-04-26 12:28:53 +00:00
</ tr >
< tr >
2010-04-29 08:31:15 +00:00
< td >< input type = " radio " id = " local " class = " inc " name = " type " value = " <?php echo $dom->type_local ; ?> " < ? php cbox ( $type == $dom -> type_local ); ?> onclick="document.main.sub_local.focus();" />
2006-04-26 12:28:53 +00:00
< label for = " local " >< ? php __ ( " Locally managed " ); ?> </label></td>
2010-04-29 08:31:15 +00:00
< td >< input type = " text " class = " int " name = " sub_local " id = " sub_local " value = " <?php ehe( $sub_local ); ?> " size = " 28 " />
2006-04-26 12:28:53 +00:00
< script type = " text/javascript " >
<!--
2010-03-04 16:16:13 +00:00
document . write ( " <input type= \" button \" name= \" bff \" onclick= \" browseforfolder('main.sub_local'); \" value= \" <?php __( " Choose a folder ... " ); ?> \" class= \" bff \" > " );
2006-04-26 12:28:53 +00:00
// -->
</ script >
</ td >
</ tr >
< tr >
2010-04-29 08:31:15 +00:00
< td >< input type = " radio " id = " url " class = " inc " name = " type " value = " <?php echo $dom->type_url ; ?> " < ? php cbox ( $type == $dom -> type_url ); ?> onclick="document.main.sub_url.focus();" />
2006-04-26 12:28:53 +00:00
< label for = " url " >< ? php __ ( " URL redirection " ); ?> </label></td>
2010-04-29 08:31:15 +00:00
< td >< input type = " text " class = " int " name = " sub_url " id = " sub_url " value = " <?php ehe( $sub_url ); ?> " size = " 50 " /></ td >
2006-04-26 12:28:53 +00:00
</ tr >
< ? php if ( $r [ " dns " ]) { // show only if dns is enabled ?>
< tr >
2010-04-29 08:31:15 +00:00
< td >< input type = " radio " id = " ip " class = " inc " name = " type " value = " <?php echo $dom->type_ip ; ?> " < ? php cbox ( $type == $dom -> type_ip ); ?> onclick="document.main.sub_ip.focus();" />
2006-04-26 12:28:53 +00:00
< label for = " ip " >< ? php __ ( " IP redirection " ); ?> </label></td>
2010-04-29 08:31:15 +00:00
< td >< input type = " text " class = " int " name = " sub_ip " id = " sub_ip " value = " <?php ehe( $sub_ip ); ?> " size = " 16 " /> < small >< ? php __ ( " (enter an IPv4 address, for example 192.168.1.2) " ); ?> </small></td>
2006-04-26 12:28:53 +00:00
</ tr >
2010-04-29 08:31:15 +00:00
< ? } ?>
2006-04-26 12:28:53 +00:00
< tr >
2010-04-29 08:31:15 +00:00
< td >< input type = " radio " id = " webmail " class = " inc " name = " type " value = " <?php echo $dom->type_webmail ; ?> " < ? php cbox ( $type == $dom -> type_webmail ); ?> />
2006-04-26 12:28:53 +00:00
< label for = " webmail " >< ? php __ ( " Webmail access " ); ?> </label></td>
< td >& nbsp ; </ td >
</ tr >
2010-04-28 23:58:29 +00:00
< tr class = " trbtn " >
2010-03-04 13:51:32 +00:00
< td colspan = " 2 " >< input type = " submit " class = " inb " name = " add " value = " <?php __( " Add this subdomain " ); ?> " /></ td >
2009-09-08 05:29:38 +00:00
</ tr >
2006-04-26 12:28:53 +00:00
</ table >
</ form >
< ? php $mem -> show_help ( " edit_domain " ); ?>
< p >& nbsp ; </ p >
< p >& nbsp ; </ p >
<!-- *****************************************
modification des parametres dns
-->
< ? php
if ( ! $r [ noerase ]) {
?>
< hr />
< h3 >< ? php __ ( " DNS parameters " ); ?> </h3>
2010-04-29 08:31:15 +00:00
< form action = " dom_editdns.php?domain=<?php echo urlencode( $r["name"] ) ?> " method = " post " id = " fdns " name = " fdns " >
2006-04-26 12:28:53 +00:00
< table border = " 1 " cellpadding = " 6 " cellspacing = " 0 " >
< tr >< td colspan = " 2 " >< ? php __ ( " Manage the DNS on the server ? " ); ?> </td></tr>
< tr >
2010-04-29 08:31:15 +00:00
< td align = " center " width = " 65% " >< input type = " radio " id = " yesdns " class = " inc " name = " dns " value = " 1 " < ? php cbox ( $r [ " dns " ]); ?> onclick="dnson();" /> <label for="yesdns"><?php __("Yes"); ?></label></td>
< td align = " center " width = " 35% " >< input type = " radio " id = " nodns " class = " inc " name = " dns " value = " 0 " < ? php cbox ( ! $r [ " dns " ]); ?> onclick="dnsoff();" /> <label for="nodns"><?php __("No"); ?></label></td>
2006-04-26 12:28:53 +00:00
</ tr >
< tr >
< td width = " 65% " valign = " top " >
< p >
2009-09-08 05:29:38 +00:00
< ? php printf ( _ ( " help_dns_mx %s %s " ), $L_MX , $L_HOSTING ); ?>
2006-04-26 12:28:53 +00:00
</ p >
< label for = " mx " >< ? php __ ( " MX Field " ); ?> : </label><input type="text" class="int" name="mx" id="mx" value="<?php echo $r["mx"] ?>" <?php if (!$r["dns"]) echo "disabled=\"disabled\""; ?> />
</ td >
< td width = " 35% " valign = " top " >
< p >
< ? php __ ( " help_dns_mail " ); ?> </p>
2010-04-29 08:31:15 +00:00
< input type = " radio " id = " emailon " class = " inc " name = " email " id = " emailon " value = " 1 " < ? php cbox ( $r [ " mail " ]); ?> <?php if ($r["dns"]) echo "disabled=\"disabled\""; ?>/><label for="emailon"><?php __("Yes"); ?></label>
< br />
< input type = " radio " id = " emailoff " class = " inc " name = " email " id = " emailoff " value = " 0 " < ? php cbox ( ! $r [ " mail " ]); ?> <?php if ($r["dns"]) echo "disabled=\"disabled\""; ?>/><label for="emailoff"><?php __("No"); ?></label>
2006-04-26 12:28:53 +00:00
</ td >
</ tr >
2010-04-28 23:58:29 +00:00
< tr class = " trbtn " >< td colspan = " 2 " >< input type = " submit " class = " inb " name = " submit " value = " <?php __( " Submit the changes " ); ?> " /></ td ></ tr >
2006-04-26 12:28:53 +00:00
</ table >
</ form >
<!-- *****************************************
destruction du domaine
-->
< br />
< ? php printf ( _ ( " help_domain_del %s " ), $domain ); ?> <br />
< form action = " dom_dodel.php?domain=<?php echo urlencode( $domain ) ?> " method = " post " >
< p >
2010-03-04 13:51:32 +00:00
< input type = " submit " class = " inb " name = " detruire " value = " <?php printf(_( " Delete % s from this server " ), $domain ); ?> " />
2006-04-26 12:28:53 +00:00
</ p >
</ form >
< hr />
2009-09-08 05:29:38 +00:00
< ? php } // noerase ?>
< script type = " text/javascript " >
document . forms [ 'main' ] . sub . focus ();
</ script >
< ? php include_once ( " foot.php " ); ?>