| 1 | <?php |
|---|
| 2 | /* |
|---|
| 3 | $Id: dom_edit.php,v 1.8 2006/02/17 18:20:08 olivier Exp $ |
|---|
| 4 | ---------------------------------------------------------------------- |
|---|
| 5 | AlternC - Web Hosting System |
|---|
| 6 | Copyright (C) 2002 by the AlternC Development Team. |
|---|
| 7 | http://alternc.org/ |
|---|
| 8 | ---------------------------------------------------------------------- |
|---|
| 9 | Based on: |
|---|
| 10 | Valentin Lacambre's web hosting softwares: http://altern.org/ |
|---|
| 11 | ---------------------------------------------------------------------- |
|---|
| 12 | LICENSE |
|---|
| 13 | |
|---|
| 14 | This program is free software; you can redistribute it and/or |
|---|
| 15 | modify it under the terms of the GNU General Public License (GPL) |
|---|
| 16 | as published by the Free Software Foundation; either version 2 |
|---|
| 17 | of the License, or (at your option) any later version. |
|---|
| 18 | |
|---|
| 19 | This program is distributed in the hope that it will be useful, |
|---|
| 20 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 21 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|---|
| 22 | GNU General Public License for more details. |
|---|
| 23 | |
|---|
| 24 | To read the license please visit http://www.gnu.org/copyleft/gpl.html |
|---|
| 25 | ---------------------------------------------------------------------- |
|---|
| 26 | Original Author of file: Benjamin Sonntag |
|---|
| 27 | Purpose of file: Edit a domain parameters |
|---|
| 28 | ---------------------------------------------------------------------- |
|---|
| 29 | */ |
|---|
| 30 | require_once("../class/config.php"); |
|---|
| 31 | include_once("head.php"); |
|---|
| 32 | |
|---|
| 33 | $fields = array ( |
|---|
| 34 | "domain" => array ("request", "string", ""), |
|---|
| 35 | "sub" => array ("request", "string", ""), |
|---|
| 36 | ); |
|---|
| 37 | getFields($fields); |
|---|
| 38 | |
|---|
| 39 | $dom->lock(); |
|---|
| 40 | if (!$r=$dom->get_domain_all($domain)) { |
|---|
| 41 | $error=$err->errstr(); |
|---|
| 42 | } |
|---|
| 43 | $dom->unlock(); |
|---|
| 44 | |
|---|
| 45 | ?> |
|---|
| 46 | <script type="text/javascript"> |
|---|
| 47 | function dnson() { |
|---|
| 48 | // Active les composants DNS : |
|---|
| 49 | if (document.forms["fdns"].mx.disabled!=null) |
|---|
| 50 | document.forms["fdns"].mx.disabled=false; |
|---|
| 51 | if (document.forms["fdns"].emailon.disabled!=null) |
|---|
| 52 | document.forms["fdns"].emailon.disabled=true; |
|---|
| 53 | if (document.forms["fdns"].emailoff.disabled!=null) |
|---|
| 54 | document.forms["fdns"].emailoff.disabled=true; |
|---|
| 55 | } |
|---|
| 56 | function dnsoff() { |
|---|
| 57 | // Active les composants DNS : |
|---|
| 58 | if (document.forms["fdns"].mx.disabled!=null) |
|---|
| 59 | document.forms["fdns"].mx.disabled=true; |
|---|
| 60 | if (document.forms["fdns"].emailon.disabled!=null) |
|---|
| 61 | document.forms["fdns"].emailon.disabled=false; |
|---|
| 62 | if (document.forms["fdns"].emailoff.disabled!=null) |
|---|
| 63 | document.forms["fdns"].emailoff.disabled=false; |
|---|
| 64 | } |
|---|
| 65 | </script> |
|---|
| 66 | <h3><?php printf(_("Editing subdomains of %s"),$domain); ?></h3> |
|---|
| 67 | <?php |
|---|
| 68 | if (isset($error) && $error) { |
|---|
| 69 | echo "<p class=\"error\">$error</p>"; |
|---|
| 70 | } |
|---|
| 71 | ?> |
|---|
| 72 | <hr id="topbar"/> |
|---|
| 73 | <?php |
|---|
| 74 | |
|---|
| 75 | if ($r['dns_action']=='UPDATE') {?> |
|---|
| 76 | <p class="error"><?php __("This domain have some DNS change pending. Please wait."); ?></p> |
|---|
| 77 | <?php |
|---|
| 78 | } elseif ($r['dns_action']=='DELETE') {?> |
|---|
| 79 | <p class="error"><?php __("You requested deletion of this domain.");?></p> |
|---|
| 80 | <?php |
|---|
| 81 | /* |
|---|
| 82 | // Link hidden as long as the del_domain_cancel function is not complete |
|---|
| 83 | <a href="dom_dodel.php?domain=<?php echo urlencode($domain);?>&del_cancel=true"><?php __("Clic here to cancel deletion");?></a> |
|---|
| 84 | */ |
|---|
| 85 | ?> |
|---|
| 86 | <?php |
|---|
| 87 | include_once("foot.php"); |
|---|
| 88 | die(); |
|---|
| 89 | } |
|---|
| 90 | |
|---|
| 91 | ?> |
|---|
| 92 | <br /> |
|---|
| 93 | <!-- ***************************************** |
|---|
| 94 | gestion des sous-domaines |
|---|
| 95 | --> |
|---|
| 96 | <table class="tlist"> |
|---|
| 97 | <tr><th colspan="2"> </th><th><?php __("Subdomain"); ?></th><th><?php __("Type");?></th><th><?php __("Status")?></th><th><?php __("Pending");?></tr> |
|---|
| 98 | <?php |
|---|
| 99 | $col=1; |
|---|
| 100 | for($i=0;$i<$r["nsub"];$i++) { |
|---|
| 101 | $col=3-$col; |
|---|
| 102 | ?> |
|---|
| 103 | <tr class="lst<?php echo $col; ?>"> |
|---|
| 104 | <?php if ( $r['sub'][$i]['web_action'] =='DELETE') { echo "<td colspan=2 />"; } else { ?> |
|---|
| 105 | <td class="center"> |
|---|
| 106 | <div class="ina"><a href="dom_subedit.php?domain=<?php echo urlencode($r["name"]) ?>&sub=<?php echo urlencode($r["sub"][$i]["name"]) ?>&type=<?php echo urlencode($r["sub"][$i]["type"]) ?>&value=<?php echo urlencode($r["sub"][$i]['dest'])?>"><img src="images/edit.png" alt="<?php __("Edit"); ?>" /><?php __("Edit"); ?></a></div> |
|---|
| 107 | |
|---|
| 108 | </td><td class="center"> |
|---|
| 109 | <div class="ina"><a href="dom_subdel.php?domain=<?php echo urlencode($r["name"]) ?>&sub=<?php echo urlencode($r["sub"][$i]["name"]) ?>&type=<?php echo urlencode($r["sub"][$i]["type"]) ?>&value=<?php echo urlencode($r["sub"][$i]['dest'])?>"><img src="images/delete.png" alt="<?php __("Delete"); ?>" /><?php __("Delete"); ?></a></div> |
|---|
| 110 | </td> |
|---|
| 111 | <?php } // end IF ==DELETE ?> |
|---|
| 112 | <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> |
|---|
| 113 | <td><?php __($r['sub'][$i]['type_desc']); ?> |
|---|
| 114 | <?php |
|---|
| 115 | if ($r["sub"][$i]['type'] === 'VHOST') { |
|---|
| 116 | echo '<br /><a href="bro_main.php?R='.urlencode($r["sub"][$i]["dest"]).'">'.htmlspecialchars($r["sub"][$i]["dest"]).'</a>'; |
|---|
| 117 | } else { |
|---|
| 118 | if ($r["sub"][$i]['type']) echo "<br />".htmlspecialchars($r["sub"][$i]["dest"]); |
|---|
| 119 | } |
|---|
| 120 | ?></td> |
|---|
| 121 | <td><?php |
|---|
| 122 | if ( $r['sub'][$i]['web_action'] !='DELETE') { |
|---|
| 123 | switch ($r['sub'][$i]['enable']) { |
|---|
| 124 | case 'ENABLED': |
|---|
| 125 | __("Enabled"); |
|---|
| 126 | echo "<br/><a href='dom_substatus.php?domain=".urlencode($r["name"])."&sub=".urlencode($r["sub"][$i]["name"])."&type=".urlencode($r["sub"][$i]["type"])."&value=".urlencode($r["sub"][$i]['dest'])."&status=disable'>";__("Disable");echo "</a>"; |
|---|
| 127 | break; |
|---|
| 128 | case 'ENABLE': |
|---|
| 129 | __("Activation pending"); |
|---|
| 130 | break; |
|---|
| 131 | case 'DISABLED': |
|---|
| 132 | __("Disabled"); |
|---|
| 133 | echo "<br/><a href='dom_substatus.php?domain=".urlencode($r["name"])."&sub=".urlencode($r["sub"][$i]["name"])."&type=".urlencode($r["sub"][$i]["type"])."&value=".urlencode($r["sub"][$i]['dest'])."&status=enable'>";__("Enable");echo "</a>"; |
|---|
| 134 | break; |
|---|
| 135 | case 'DISABLE': |
|---|
| 136 | __("Desactivation pending"); |
|---|
| 137 | break; |
|---|
| 138 | } |
|---|
| 139 | }?></td> |
|---|
| 140 | <td><?php |
|---|
| 141 | switch ($r['sub'][$i]['web_action']) { |
|---|
| 142 | case 'UPDATE': |
|---|
| 143 | __("Update pending"); |
|---|
| 144 | break; |
|---|
| 145 | case 'DELETE': |
|---|
| 146 | __("Deletion pending"); |
|---|
| 147 | break; |
|---|
| 148 | case 'OK': |
|---|
| 149 | default: |
|---|
| 150 | __("Up to date"); |
|---|
| 151 | break; |
|---|
| 152 | }?></td> |
|---|
| 153 | |
|---|
| 154 | </tr> |
|---|
| 155 | <?php } ?> |
|---|
| 156 | </table> |
|---|
| 157 | <br /> |
|---|
| 158 | <hr/> |
|---|
| 159 | <?php |
|---|
| 160 | $isedit=false; |
|---|
| 161 | require_once('dom_edit.inc.php'); |
|---|
| 162 | sub_domains_edit($domain); |
|---|
| 163 | ?> |
|---|
| 164 | <br /> |
|---|
| 165 | <?php $mem->show_help("edit_domain"); ?> |
|---|
| 166 | <p> </p> |
|---|
| 167 | <p> </p> |
|---|
| 168 | <!-- ***************************************** |
|---|
| 169 | modification des parametres dns |
|---|
| 170 | --> |
|---|
| 171 | <?php |
|---|
| 172 | if (!$r['noerase']) { |
|---|
| 173 | ?> |
|---|
| 174 | |
|---|
| 175 | <hr /> |
|---|
| 176 | <h3><?php __("DNS parameters"); ?></h3> |
|---|
| 177 | <form action="dom_editdns.php?domain=<?php echo urlencode($r["name"]) ?>" method="post" id="fdns" name="fdns"> |
|---|
| 178 | <table border="1" cellpadding="6" cellspacing="0"> |
|---|
| 179 | <tr><td colspan="2"><?php __("Manage the DNS on the server ?"); ?></td></tr> |
|---|
| 180 | <tr> |
|---|
| 181 | <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> |
|---|
| 182 | <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> |
|---|
| 183 | </tr> |
|---|
| 184 | <tr> |
|---|
| 185 | <td width="65%" valign="top"> |
|---|
| 186 | <p> |
|---|
| 187 | <?php printf(_("help_dns_mx %s %s"),$L_MX,$L_HOSTING); ?> |
|---|
| 188 | </p> |
|---|
| 189 | <label for="mx"><?php __("MX Field"); ?> : </label><input type="text" class="int" name="mx" id="mx" value="<?php if ($r["dns"]) echo $r["mx"]; else echo $L_MX; ?>" <?php if (!$r["dns"]) echo "disabled=\"disabled\""; ?> /> |
|---|
| 190 | </td> |
|---|
| 191 | <td width="35%" valign="top"> |
|---|
| 192 | <p> |
|---|
| 193 | <?php __("help_dns_mail"); ?></p> |
|---|
| 194 | <p> |
|---|
| 195 | <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> |
|---|
| 196 | <br /> |
|---|
| 197 | <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> |
|---|
| 198 | </p> |
|---|
| 199 | <p> <?php __("Warning: If you set this to 'no', all your email accounts and aliases on this domain will be immediately deleted."); ?> |
|---|
| 200 | </p> |
|---|
| 201 | </td> |
|---|
| 202 | |
|---|
| 203 | </tr> |
|---|
| 204 | <tr class="trbtn"><td colspan="2"><input type="submit" class="inb" name="submit" value="<?php __("Submit the changes"); ?>" /></td></tr> |
|---|
| 205 | </table> |
|---|
| 206 | </form> |
|---|
| 207 | |
|---|
| 208 | <!-- ***************************************** |
|---|
| 209 | destruction du domaine |
|---|
| 210 | --> |
|---|
| 211 | <br /> |
|---|
| 212 | <?php printf(_("help_domain_del %s"),$domain); ?><br /> |
|---|
| 213 | <form action="dom_dodel.php?domain=<?php echo urlencode($domain) ?>" method="post"> |
|---|
| 214 | <p> |
|---|
| 215 | <input type="submit" class="inb" name="detruire" value="<?php printf(_("Delete %s from this server"),$domain); ?>" /> |
|---|
| 216 | </p> |
|---|
| 217 | </form> |
|---|
| 218 | <hr /> |
|---|
| 219 | <?php } // noerase ?> |
|---|
| 220 | <script type="text/javascript"> |
|---|
| 221 | document.forms['main'].sub.focus(); |
|---|
| 222 | </script> |
|---|
| 223 | <?php include_once("foot.php"); ?> |
|---|