| 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 | ); |
|---|
| 36 | getFields($fields); |
|---|
| 37 | |
|---|
| 38 | $dom->lock(); |
|---|
| 39 | if (!$r=$dom->get_domain_all($domain)) { |
|---|
| 40 | $error=$err->errstr(); |
|---|
| 41 | } |
|---|
| 42 | $dom->unlock(); |
|---|
| 43 | |
|---|
| 44 | ?> |
|---|
| 45 | <script type="text/javascript"> |
|---|
| 46 | function dnson() { |
|---|
| 47 | // Active les composants DNS : |
|---|
| 48 | if (document.forms["dns"].mx.disabled!=null) |
|---|
| 49 | document.forms["dns"].mx.disabled=false; |
|---|
| 50 | if (document.forms["dns"].mail.disabled!=null) |
|---|
| 51 | document.forms["dns"].mail.disabled=true; |
|---|
| 52 | } |
|---|
| 53 | function dnsoff() { |
|---|
| 54 | // Active les composants DNS : |
|---|
| 55 | if (document.forms["dns"].mx.disabled!=null) |
|---|
| 56 | document.forms["dns"].mx.disabled=true; |
|---|
| 57 | if (document.forms["dns"].mail.disabled!=null) |
|---|
| 58 | document.forms["dns"].mail.disabled=false; |
|---|
| 59 | } |
|---|
| 60 | </script> |
|---|
| 61 | <h3><?php printf(_("Editing subdomains of %s"),$domain); ?></h3> |
|---|
| 62 | <?php |
|---|
| 63 | if ($error) { |
|---|
| 64 | echo "<p class=\"error\">$error</p>"; |
|---|
| 65 | } |
|---|
| 66 | ?> |
|---|
| 67 | <hr /> |
|---|
| 68 | <br /> |
|---|
| 69 | <!-- ***************************************** |
|---|
| 70 | gestion des sous-domaines |
|---|
| 71 | --> |
|---|
| 72 | <table class="tlist"> |
|---|
| 73 | <tr><th colspan="2"><?php __("Actions"); ?></th><th><?php __("Subdomain"); ?></th><th><?php __("Place"); ?></th></tr> |
|---|
| 74 | <?php |
|---|
| 75 | $col=1; |
|---|
| 76 | for($i=0;$i<$r["nsub"];$i++) { |
|---|
| 77 | $col=3-$col; |
|---|
| 78 | ?> |
|---|
| 79 | <tr class="lst<?php echo $col; ?>"> |
|---|
| 80 | <td class="center"> |
|---|
| 81 | <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> |
|---|
| 82 | |
|---|
| 83 | </td><td class="center"> |
|---|
| 84 | <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> |
|---|
| 85 | </td> |
|---|
| 86 | <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> |
|---|
| 87 | <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> |
|---|
| 88 | </tr> |
|---|
| 89 | <?php } ?> |
|---|
| 90 | </table> |
|---|
| 91 | <br /> |
|---|
| 92 | <hr/> |
|---|
| 93 | <br /> |
|---|
| 94 | <form action="dom_subdoedit.php" method="post" name="main" id="main"> |
|---|
| 95 | <table border="0"> |
|---|
| 96 | <tr> |
|---|
| 97 | <td colspan="2"> |
|---|
| 98 | <input type="hidden" name="domain" value="<?php echo $r["name"]; ?>" /> |
|---|
| 99 | <input type="hidden" name="action" value="add" /> |
|---|
| 100 | <?php __("Create a subdomain:"); ?> |
|---|
| 101 | <input type="text" class="int" name="sub" style="text-align:right" value="" size="22" id="sub" /><span class="int" id="newsubname">.<?php echo $domain; ?></span></td> |
|---|
| 102 | </tr> |
|---|
| 103 | <tr> |
|---|
| 104 | <td><input type="radio" id="local" class="inc" name="type" value="<?php echo $dom->type_local; ?>" checked="checked" onclick="document.main.sub_local.focus();" /> |
|---|
| 105 | <label for="local"><?php __("Locally managed"); ?></label></td> |
|---|
| 106 | <td><input type="text" class="int" name="sub_local" id="sub_local" value="/" size="28" /> |
|---|
| 107 | <script type="text/javascript"> |
|---|
| 108 | <!-- |
|---|
| 109 | document.write(" <input type=\"button\" name=\"bff\" onclick=\"browseforfolder('main.sub_local');\" value=\" <?php __("Choose a folder..."); ?> \" class=\"bff\">"); |
|---|
| 110 | // --> |
|---|
| 111 | </script> |
|---|
| 112 | </td> |
|---|
| 113 | </tr> |
|---|
| 114 | <tr> |
|---|
| 115 | <td><input type="radio" id="url" class="inc" name="type" value="<?php echo $dom->type_url; ?>" onclick="document.main.sub_url.focus();" /> |
|---|
| 116 | <label for="url" ><?php __("URL redirection"); ?></label></td> |
|---|
| 117 | <td><input type="text" class="int" name="sub_url" id="sub_url" value="http://" size="50" /></td> |
|---|
| 118 | </tr> |
|---|
| 119 | <?php if ($r["dns"]) { // show only if dns is enabled ?> |
|---|
| 120 | <tr> |
|---|
| 121 | <td><input type="radio" id="ip" class="inc" name="type" value="<?php echo $dom->type_ip; ?>" onclick="document.main.sub_ip.focus();" /> |
|---|
| 122 | <label for="ip"><?php __("IP redirection"); ?></label></td> |
|---|
| 123 | <td><input type="text" class="int" name="sub_ip" id="sub_ip" value="xxx.xxx.xxx.xxx" size="16" /></td> |
|---|
| 124 | </tr> |
|---|
| 125 | <? } ?> |
|---|
| 126 | <tr> |
|---|
| 127 | <td><input type="radio" id="webmail" class="inc" name="type" value="<?php echo $dom->type_webmail; ?>" /> |
|---|
| 128 | <label for="webmail"><?php __("Webmail access"); ?></label></td> |
|---|
| 129 | <td> </td> |
|---|
| 130 | </tr> |
|---|
| 131 | <tr class="trbtn"> |
|---|
| 132 | <td colspan="2"><input type="submit" class="inb" name="add" value="<?php __("Add this subdomain"); ?>" /></td> |
|---|
| 133 | </tr> |
|---|
| 134 | </table> |
|---|
| 135 | </form> |
|---|
| 136 | <?php $mem->show_help("edit_domain"); ?> |
|---|
| 137 | <p> </p> |
|---|
| 138 | <p> </p> |
|---|
| 139 | <!-- ***************************************** |
|---|
| 140 | modification des parametres dns |
|---|
| 141 | --> |
|---|
| 142 | <?php |
|---|
| 143 | if (!$r[noerase]) { |
|---|
| 144 | ?> |
|---|
| 145 | |
|---|
| 146 | <hr /> |
|---|
| 147 | <h3><?php __("DNS parameters"); ?></h3> |
|---|
| 148 | <form action="dom_editdns.php?domain=<?php echo urlencode($r["name"]) ?>" method="post" id="dns"> |
|---|
| 149 | <table border="1" cellpadding="6" cellspacing="0"> |
|---|
| 150 | <tr><td colspan="2"><?php __("Manage the DNS on the server ?"); ?></td></tr> |
|---|
| 151 | <tr> |
|---|
| 152 | <td align="center" width="65%"><label for="yesdns"><?php __("Yes"); ?></label><input type="radio" id="yesdns" class="inc" name="dns" value="1"<?php if ($r["dns"]) echo " checked=\"checked\"" ?> onclick="dnson();" /></td> |
|---|
| 153 | <td align="center" width="35%"><label for="nodns"><?php __("No"); ?></label><input type="radio" id="nodns" class="inc" name="dns" value="0"<?php if (!$r["dns"]) echo " checked=\"checked\"" ?> onclick="dnsoff();" /></td> |
|---|
| 154 | </tr> |
|---|
| 155 | <tr> |
|---|
| 156 | <td width="65%" valign="top"> |
|---|
| 157 | <p> |
|---|
| 158 | <?php printf(_("help_dns_mx %s %s"),$L_MX,$L_HOSTING); ?> |
|---|
| 159 | </p> |
|---|
| 160 | <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\""; ?> /> |
|---|
| 161 | </td> |
|---|
| 162 | <td width="35%" valign="top"> |
|---|
| 163 | <p> |
|---|
| 164 | <?php __("help_dns_mail"); ?></p> |
|---|
| 165 | <select class="inl" id="email" name="email" <?php if ($r["dns"]) echo "disabled=\"disabled\""; ?>><option value="1"<?php if ($r["mail"]) echo " selected=\"selected\"";?>><?php __("Yes"); ?></option><option value="0"<?php if (!$r["mail"]) echo " selected=\"selected\"";?>><?php __("No"); ?></option></select> |
|---|
| 166 | </td> |
|---|
| 167 | </tr> |
|---|
| 168 | <tr class="trbtn"><td colspan="2"><input type="submit" class="inb" name="submit" value="<?php __("Submit the changes"); ?>" /></td></tr> |
|---|
| 169 | </table> |
|---|
| 170 | </form> |
|---|
| 171 | |
|---|
| 172 | <!-- ***************************************** |
|---|
| 173 | destruction du domaine |
|---|
| 174 | --> |
|---|
| 175 | <br /> |
|---|
| 176 | <?php printf(_("help_domain_del %s"),$domain); ?><br /> |
|---|
| 177 | <form action="dom_dodel.php?domain=<?php echo urlencode($domain) ?>" method="post"> |
|---|
| 178 | <p> |
|---|
| 179 | <input type="submit" class="inb" name="detruire" value="<?php printf(_("Delete %s from this server"),$domain); ?>" /> |
|---|
| 180 | </p> |
|---|
| 181 | </form> |
|---|
| 182 | <hr /> |
|---|
| 183 | <?php } // noerase ?> |
|---|
| 184 | <script type="text/javascript"> |
|---|
| 185 | document.forms['main'].sub.focus(); |
|---|
| 186 | </script> |
|---|
| 187 | <?php include_once("foot.php"); ?> |
|---|