dom_edit.php 9.19 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
<?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");
31
32
33
include_once("head.php");

$fields = array (
34
35
	"domain"    => array ("request", "string", (empty($domain)?"":$domain) ),
	"sub"       => array ("request", "string", (empty($sub)?"":$sub) ),
36
37
);
getFields($fields);
38
39
40
41

$dom->lock();
if (!$r=$dom->get_domain_all($domain)) {
	$error=$err->errstr();
Alan Garcia's avatar
Alan Garcia committed
42
	echo "<p class=\"error\">$error</p>";
Steven Mondji-Lerider's avatar
Steven Mondji-Lerider committed
43
	include('foot.php');
Alan Garcia's avatar
Alan Garcia committed
44
45
	die();
}
Steven Mondji-Lerider's avatar
Steven Mondji-Lerider committed
46
47
48
if (isset($error) && $error ) {
	echo "<p class=\"error\">$error</p>";
}
49
50
51
52
53
$dom->unlock();

?>
<script type="text/javascript">
function dnson() {
54
  alert('This function seems unused. If you see this message, please let us know.');
55
	// Active les composants DNS :
56
57
58
59
60
61
	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;
62
63
}
function dnsoff() {
64
  alert('This function seems unused. If you see this message, please let us know.');
65
	// Active les composants DNS :
66
67
68
69
70
71
	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;
72
}
Alan Garcia's avatar
Alan Garcia committed
73
74

function destruction_alert() {
Alan Garcia's avatar
Alan Garcia committed
75
76
77
78
79
80
81
82
83
84
85
86
87
  // On ne se pose pas de question si le DNS est deja sur NON
  if (<?php echo (int)$r["dns"]; ?>!=1) {
    return true;
  }
  if (document.forms["fdns"].email[1].checked) {
    if ( confirm("<?php __("Are you sure you want to do this? This will DELETE ALL the mailboxes, messages and aliases on this domain ?"); ?>") ) {
      return true;
    } else {
      return false;
    }
  } else {
      return true;
  }
Alan Garcia's avatar
Alan Garcia committed
88
}
89
</script>
Benjamin Sonntag's avatar
Benjamin Sonntag committed
90
<h3><?php printf(_("Editing subdomains of %s"),$domain); ?></h3>
91
<hr id="topbar"/>
92
93
94
95
96
97
<?php

if ($r['dns_action']=='UPDATE') {?>
  <p class="error"><?php __("This domain have some DNS change pending. Please wait."); ?></p>
<?php
} elseif ($r['dns_action']=='DELETE') {?>
domi's avatar
domi committed
98
  <p class="error"><?php printf(_("You requested deletion of domain %s."), $domain);?></p>
99
100
101
102
103
104
105
106
107
108
109
110
<?php
/*
  // Link hidden as long as the del_domain_cancel function is not complete
  <a href="dom_dodel.php?domain=<?php echo urlencode($domain);?>&del_cancel=true"><?php __("Clic here to cancel deletion");?></a>
*/
?>
  <?php
  include_once("foot.php");
  die();
}

?>
Benjamin Sonntag's avatar
Benjamin Sonntag committed
111
<br />
112
113
114
<!-- *****************************************
		 gestion des sous-domaines
 -->
115
<table class="tlist">
116
<tr><th colspan="2"> </th><th><?php __("Subdomain"); ?></th><th><?php __("Type");?></th><th><?php __("Status")?></th><th></th></tr>
117
<?php
118
$dt=$dom->domains_type_lst();
119
for($i=0;$i<$r["nsub"];$i++) {
120

121
?>
122
	<tr class="lst">
123
    <?php if ( $r['sub'][$i]['web_action'] =='DELETE') { echo "<td colspan='2' />"; } else { ?>
124
		<td class="center">
125
    <?php  if (!(!$isinvited && $dt[strtolower($r["sub"][$i]["type"])]["enable"] != "ALL" )) { ?>
126
			<div class="ina edit"><a href="dom_subedit.php?sub_domain_id=<?php echo urlencode($r["sub"][$i]["id"]) ?>"><?php __("Edit"); ?></a></div>
127
128
  <?php } ?>

129

Benjamin Sonntag's avatar
Benjamin Sonntag committed
130
			</td><td class="center">
131
    <?php  if (!(!$isinvited && $dt[strtolower($r["sub"][$i]["type"])]["enable"] != "ALL" )) { ?>
132
			<div class="ina delete"><a href="dom_subdel.php?sub_domain_id=<?php echo urlencode($r["sub"][$i]["id"]) ?>"><?php __("Delete"); ?></a></div>
133
<?php } ?>
134
		</td>
Alan Garcia's avatar
Hop    
Alan Garcia committed
135
    <?php } // end IF ==DELETE ?>
136
137
138
139
		<td><div class="retour-auto"><a href="http://<?php ecif($r["sub"][$i]["name"],$r["sub"][$i]["name"]."."); echo $r["name"] ?>" target="_blank"><?php 
				echo ecif($r["sub"][$i]["name"] , $r["sub"][$i]["name"]."." , "" , 0) . $r["name"];
			?></a></div></td>
		<td><div class="retour-auto"><?php __($r['sub'][$i]['type_desc']); ?>
140
 <?php 
141
 //if ($r["sub"][$i]['type'] === 'VHOST') {
Alan Garcia's avatar
Alan Garcia committed
142
 if ( @$dt[$r["sub"][$i]['type']]['target'] === 'DIRECTORY') {
143
144
145
  $iidir=$r["sub"][$i]["dest"];
  if ($iidir=='') $iidir='/';
  echo '<br /><a href="bro_main.php?R='.urlencode($iidir).'">'.htmlspecialchars($iidir).'</a>';
Alan Garcia's avatar
Alan Garcia committed
146
  if ( ! file_exists($bro->convertabsolute($iidir,0))) { echo " <span class=\"alerte\">"._("Directory not found")."</span>"; }
147
148
149
} else {
  if ($r["sub"][$i]['type']) echo "<br />".htmlspecialchars($r["sub"][$i]["dest"]);
}
150
?></div></td>
151
		<td><?php 
Alan Garcia's avatar
Alan Garcia committed
152
153
154
155
156
			if (!(!$isinvited && $dt[strtolower($r["sub"][$i]["type"])]["enable"] != "ALL" )) {
				if ( $r['sub'][$i]['web_action'] !='DELETE') { 
					switch ($r['sub'][$i]['enable']) {
						case 'ENABLED':
							__("Enabled");
157
							echo "<br/><a href='dom_substatus.php?sub_id=".urlencode($r["sub"][$i]["id"])."&amp;status=disable'>";__("Disable");echo "</a>";
Alan Garcia's avatar
Alan Garcia committed
158
159
160
161
162
163
							break;
						case 'ENABLE':
							__("Activation pending");
							break;
						case 'DISABLED':
							__("Disabled");
164
							echo "<br/><a href='dom_substatus.php?sub_id=".urlencode($r["sub"][$i]["id"])."&amp;status=enable'>";__("Enable");echo "</a>";
Alan Garcia's avatar
Alan Garcia committed
165
166
167
168
169
170
							break;
						case 'DISABLE':
							__("Desactivation pending");
							break;
					}
				}
171
172
173
174
175
176
177
178
179
180
181
182
183
184
      }?></td>
		<td><?php 
      switch ($r['sub'][$i]['web_action']) {
        case 'UPDATE':
          __("Update pending");
          break;
        case 'DELETE':
          __("Deletion pending");
          break;
        case 'OK':
        default:
          break;
      }?></td>
            
185
186
187
188
	</tr>
<?php } ?>
</table>
<br />
Benjamin Sonntag's avatar
Benjamin Sonntag committed
189
<hr/>
190
<?php
191
$isedit=false;
192
193
194
require_once('dom_edit.inc.php');
sub_domains_edit($domain);
?>
Benjamin Sonntag's avatar
Benjamin Sonntag committed
195
<br />
196
197
198
199
200
201
<?php $mem->show_help("edit_domain"); ?>
<p>&nbsp;</p>
<!-- *****************************************
		 modification des parametres dns
 -->
<?php
202
if (!$r['noerase']) {
203
204
205
?>

<hr />
206
<h3><?php __("DNS &amp; Email parameters"); ?></h3>
Alan Garcia's avatar
Alan Garcia committed
207
<form action="dom_editdns.php?domain=<?php echo urlencode($r["name"]) ?>" method="post" id="fdns" name="fdns" onSubmit="return destruction_alert();">
208

209
<table class="tlist2">
210
<tr>
211
212
213
214
215
  <td><?php __("Manage the DNS on the server ?"); ?></td>
  <td> 
     <input type="radio" id="yesdns" class="inc" name="dns" value="1"<?php cbox($r["dns"]); ?> />&nbsp;<label for="yesdns"><?php __("Yes"); ?></label>
      </td><td><input type="radio" id="nodns" class="inc" name="dns" value="0"<?php cbox(!$r["dns"]); ?> />&nbsp;<label for="nodns"><?php __("No"); ?></label>
  </td>
216
</tr>
217
</table>
218

domi's avatar
   
domi committed
219
220
221
222
223
<?php if ($r["dns"]) { ?>
<table class="tlist2">
<tr>
  <td><?php __("Define TTL for the zone records"); ?>&nbsp;: </td>
  <td> 
224
     <input type="text" id="ttldns" class="inc" name="ttl" size="6" value="<?php echo ($r["zonettl"]); ?>" /> <?php __("seconds"); ?> <small><i><?php __("Warning: a low TTL can be problematic. It is recommended not to use a lower TTL than 3600 seconds."); ?></i></small>
domi's avatar
   
domi committed
225
226
227
228
229
  </td>
</tr>
</table>
<?php } ?>

230
<table class="tlist2">
231
232
233
234
235
236
237
238
<tr>
  <td>
    <?php __("Manage the Emails Addresses of this domain on the server?"); ?>
  </td>
  <td> 
     <input type="radio" id="yesemail" class="inc" name="email" value="1"<?php cbox($r["mail"]); ?> />&nbsp;<label for="yesemail"><?php __("Yes"); ?></label>
     </td><td><input type="radio" id="noemail" class="inc" name="email" value="0"<?php cbox(!$r["mail"]); ?> />&nbsp;<label for="noemail"><?php __("No"); ?></label>
  </td>
239
</tr>
240
</table>
Alan Garcia's avatar
Alan Garcia committed
241
<p class="error">    <?php __("Warning: If you set this to 'no', all your email accounts and aliases on this domain will be immediately deleted."); ?></p>
Alan Garcia's avatar
Alan Garcia committed
242
<input type="submit" class="inb ok" name="submit" value="<?php __("Submit the changes"); ?>" />
243
244
	</form>

245
<p>&nbsp;</p>
246
247
248
<hr />
<h3><?php __("Domain removal"); ?></h3>

249
<br />
250
<?php printf(_("If you want to destroy the domain %s, click on the button below. Warning: this also deletes all FTP accounts, email, mailing lists associated with the domain and subdomains."),$domain); ?><br />
251
252
<form action="dom_dodel.php?domain=<?php echo urlencode($domain) ?>" method="post">
<p>
Alan Garcia's avatar
Alan Garcia committed
253
<input type="submit" class="inb delete" name="detruire" value="<?php printf(_("Delete %s from this server"),$domain); ?>" />
254
255
</p>
</form>
256
257

<br />
258
<hr />
259
260
261
262
263
<?php } // noerase ?>
<script type="text/javascript">
document.forms['main'].sub.focus();
</script>
<?php include_once("foot.php"); ?>