source: alternc/trunk/bureau/admin/dom_edit.php @ 2863

Revision 2863, 8.6 KB checked in by fufroma, 2 years ago (diff)

QQues bugs corrigé et une GROSSE optimisation sur les quotas :
Les quota était recalculé une dizaine de fois par page... y compris le quota disque (donc avec un exec, etc).
Là, c'est calculé une fois par chargement.

Line 
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*/
30require_once("../class/config.php");
31include_once("head.php");
32
33$fields = array (
34        "domain"    => array ("request", "string", ""),
35        "sub"       => array ("request", "string", ""),
36);
37getFields($fields);
38
39$dom->lock();
40if (!$r=$dom->get_domain_all($domain)) {
41        $error=$err->errstr();
42}
43$dom->unlock();
44
45?>
46<script type="text/javascript">
47function 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}
56function 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
75if ($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 __("Place"); ?></th><th><?php __("Status")?></th><th><?php __("Pending");?></tr>
98<?php
99$col=1;
100for($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"]) ?>&amp;sub=<?php  echo urlencode($r["sub"][$i]["name"]) ?>&amp;type=<?php  echo urlencode($r["sub"][$i]["type"]) ?>&amp;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"]) ?>&amp;sub=<?php  echo urlencode($r["sub"][$i]["name"]) ?>&amp;type=<?php  echo urlencode($r["sub"][$i]["type"]) ?>&amp;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']);?></td>
114                <td><?php echo $r["sub"][$i]['type'] === 'LOCAL' ? '<a href="bro_main.php?R='.urlencode($r["sub"][$i]["dest"]).'">'.htmlspecialchars($r["sub"][$i]["dest"]).'</a>' : htmlspecialchars($r["sub"][$i]["dest"]); ?>&nbsp;</td>
115                <td><?php 
116      if ( $r['sub'][$i]['web_action'] !='DELETE') { 
117        switch ($r['sub'][$i]['enable']) {
118          case 'ENABLED':
119            __("Enabled");
120            echo "<br/><a href='dom_substatus.php?domain=".urlencode($r["name"])."&amp;sub=".urlencode($r["sub"][$i]["name"])."&amp;type=".urlencode($r["sub"][$i]["type"])."&amp;value=".urlencode($r["sub"][$i]['dest'])."&status=disable'>";__("Disable");echo "</a>";
121            break;
122          case 'ENABLE':
123            __("Activation pending");
124            break;
125          case 'DISABLED':
126            __("Disabled");
127            echo "<br/><a href='dom_substatus.php?domain=".urlencode($r["name"])."&amp;sub=".urlencode($r["sub"][$i]["name"])."&amp;type=".urlencode($r["sub"][$i]["type"])."&amp;value=".urlencode($r["sub"][$i]['dest'])."&status=enable'>";__("Enable");echo "</a>";
128            break;
129          case 'DISABLE':
130            __("Desactivation pending");
131            break;
132        }
133      }?></td>
134                <td><?php 
135      switch ($r['sub'][$i]['web_action']) {
136        case 'UPDATE':
137          __("Update pending");
138          break;
139        case 'DELETE':
140          __("Deletion pending");
141          break;
142        case 'OK':
143        default:
144          __("Up to date");
145          break;
146      }?></td>
147           
148        </tr>
149<?php } ?>
150</table>
151<br />
152<hr/>
153<?php
154require_once('dom_edit.inc.php');
155sub_domains_edit($domain);
156?>
157<br />
158<?php $mem->show_help("edit_domain"); ?>
159<p>&nbsp;</p>
160<p>&nbsp;</p>
161<!-- *****************************************
162                 modification des parametres dns
163 -->
164<?php
165if (!$r['noerase']) {
166?>
167
168<hr />
169<h3><?php __("DNS parameters"); ?></h3>
170<form action="dom_editdns.php?domain=<?php echo urlencode($r["name"]) ?>" method="post" id="fdns" name="fdns">
171<table border="1" cellpadding="6" cellspacing="0">
172<tr><td colspan="2"><?php __("Manage the DNS on the server ?"); ?></td></tr>
173<tr>
174                                                                      <td align="center" width="65%"><input type="radio" id="yesdns" class="inc" name="dns" value="1"<?php cbox($r["dns"]); ?> onclick="dnson();" />&nbsp;<label for="yesdns"><?php __("Yes"); ?></label></td>
175   <td align="center" width="35%"><input type="radio" id="nodns" class="inc" name="dns" value="0"<?php cbox(!$r["dns"]); ?> onclick="dnsoff();" />&nbsp;<label for="nodns"><?php __("No"); ?></label></td>
176</tr>
177<tr>
178        <td width="65%" valign="top">
179        <p>
180<?php printf(_("help_dns_mx %s %s"),$L_MX,$L_HOSTING); ?>
181        </p>
182        <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\""; ?> />
183        </td>
184        <td width="35%" valign="top">
185        <p>
186        <?php __("help_dns_mail"); ?></p>
187<p>
188         <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>
189<br />
190         <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>
191</p>
192        <p>                                                                                                                                                                                                               <?php __("Warning: If you set this to 'no', all your email accounts and aliases on this domain will be immediately deleted."); ?>
193</p>
194        </td>
195
196</tr>
197<tr class="trbtn"><td colspan="2"><input type="submit" class="inb" name="submit" value="<?php __("Submit the changes"); ?>" /></td></tr>
198</table>
199        </form>
200
201<!-- *****************************************
202                 destruction du domaine
203 -->
204<br />
205<?php printf(_("help_domain_del %s"),$domain); ?><br />
206<form action="dom_dodel.php?domain=<?php echo urlencode($domain) ?>" method="post">
207<p>
208<input type="submit" class="inb" name="detruire" value="<?php printf(_("Delete %s from this server"),$domain); ?>" />
209</p>
210</form>
211<hr />
212<?php } // noerase ?>
213<script type="text/javascript">
214document.forms['main'].sub.focus();
215</script>
216<?php include_once("foot.php"); ?>
Note: See TracBrowser for help on using the repository browser.