Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100755 277 lines (251 sloc) 10.951 kB
eff2851 @flol Initial revision
authored
1 <?php
2 /**
3 * filename: $Source$
4 * begin: Friday, Aug 06, 2004
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version. This program is distributed in the
10 * hope that it will be useful, but WITHOUT ANY WARRANTY; without even the
11 * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12 * See the GNU General Public License for more details.
13 *
14 * @author Florian Lippert <flo@redenswert.de>
15 * @copyright (C) 2003-2004 Florian Lippert
16 * @package Panel
17 * @version $Id$
18 */
19
20 define('AREA', 'admin');
21
22 /**
23 * Include our init.php, which manages Sessions, Language etc.
24 */
25 require("./lib/init.php");
26
27 if(isset($_POST['id']))
28 {
29 $id=intval($_POST['id']);
30 }
31 elseif(isset($_GET['id']))
32 {
33 $id=intval($_GET['id']);
34 }
35
36 if($page == 'domains' || $page == 'overview')
37 {
38 if($action=='')
39 {
40 if(isset($_GET['sortby']))
41 {
42 $sortby=addslashes($_GET['sortby']);
43 }
44 else
45 {
46 $sortby='domain';
47 }
48 if(isset($_GET['sortorder']) && strtolower($_GET['sortorder'])=='desc')
49 {
50 $sortorder='DESC';
51 }
52 else
53 {
54 $sortorder='ASC';
55 }
56
57 $domains='';
b73f055 @flol When you're adding a domain in the adminpanel, now not the userid but…
authored
58 $result=$db->query("SELECT `d`.`id`, `d`.`domain`, `d`.`customerid`, `d`.`documentroot`, `d`.`zonefile`, `d`.`openbasedir`, `d`.`safemode`, `c`.`loginname`, `c`.`name`, `c`.`surname` FROM `".TABLE_PANEL_DOMAINS."` `d` LEFT JOIN `".TABLE_PANEL_CUSTOMERS."` `c` USING(`customerid`) WHERE `d`.`isemaildomain`='1' ".( $userinfo['customers_see_all'] ? '' : " AND `d`.`adminid` = '{$userinfo['adminid']}' ")."ORDER BY `$sortby` $sortorder");
eff2851 @flol Initial revision
authored
59 while($row=$db->fetch_array($result))
60 {
1e0edc2 IDN Domain Patch added
Michael Duergner authored
61 $row['domain'] = $idna_convert->decode($row['domain']);
eff2851 @flol Initial revision
authored
62 eval("\$domains.=\"".getTemplate("domains/domains_domain")."\";");
63 }
64 eval("echo \"".getTemplate("domains/domains")."\";");
65 }
66
67 elseif($action=='delete' && $id!=0)
68 {
4abb417 @flol Volle Multi-Admin bzw. Reseller-Funktion hinzugefuegt.
authored
69 $result=$db->query_first("SELECT `id`, `domain`, `customerid`, `documentroot`, `isemaildomain`, `zonefile` FROM `".TABLE_PANEL_DOMAINS."` WHERE `id`='$id'".( $userinfo['customers_see_all'] ? '' : " AND `adminid` = '{$userinfo['adminid']}' "));
eff2851 @flol Initial revision
authored
70 if($result['domain']!='')
71 {
72 if(isset($_POST['send']) && $_POST['send']=='send')
73 {
74 $db->query("DELETE FROM `".TABLE_PANEL_DOMAINS."` WHERE `id`='$id' OR `parentdomainid`='".$result['id']."'");
4abb417 @flol Volle Multi-Admin bzw. Reseller-Funktion hinzugefuegt.
authored
75 $deleted_domains = $db->affected_rows();
76 $db->query("UPDATE `".TABLE_PANEL_CUSTOMERS."` SET `subdomains_used` = `subdomains_used` - 0".($deleted_domains - 1)." WHERE `customerid` = '{$result['customerid']}'");
bcb4207 @flol Die Tabellen-Prefixe wurden von proftpd_ auf ftp_ bzw postfix_ auf ma…
authored
77 $db->query("DELETE FROM `".TABLE_MAIL_USERS."` WHERE `domainid`='$id'");
78 $db->query("DELETE FROM `".TABLE_MAIL_VIRTUAL."` WHERE `domainid`='$id'");
4abb417 @flol Volle Multi-Admin bzw. Reseller-Funktion hinzugefuegt.
authored
79 $db->query("UPDATE `".TABLE_PANEL_ADMINS."` SET `domains_used` = `domains_used` - 1 WHERE `adminid` = '{$userinfo['adminid']}'");
6c7a5e3 @flol Some little bugfixes for the big commit from yesterday plus language …
authored
80 updateCounters () ;
eff2851 @flol Initial revision
authored
81
82 inserttask('1');
83 inserttask('4');
84
85 header("Location: $filename?page=$page&s=$s");
86 }
6c7a5e3 @flol Some little bugfixes for the big commit from yesterday plus language …
authored
87 else
88 {
762ba4f Little problem with the IDN Domain Patch solved; domainname was not d…
Michael Duergner authored
89 ask_yesno('admin_domain_reallydelete', $filename, "id=$id;page=$page;action=$action", $idna_convert->decode($result['domain']));
eff2851 @flol Initial revision
authored
90 }
91 }
92 }
93
94 elseif($action=='add')
95 {
4abb417 @flol Volle Multi-Admin bzw. Reseller-Funktion hinzugefuegt.
authored
96 if($userinfo['domains_used'] < $userinfo['domains'] || $userinfo['domains'] == '-1')
eff2851 @flol Initial revision
authored
97 {
4abb417 @flol Volle Multi-Admin bzw. Reseller-Funktion hinzugefuegt.
authored
98 if(isset($_POST['send']) && $_POST['send']=='send')
99 {
1e0edc2 IDN Domain Patch added
Michael Duergner authored
100 $domain = $idna_convert->encode(addslashes($_POST['domain']));
4abb417 @flol Volle Multi-Admin bzw. Reseller-Funktion hinzugefuegt.
authored
101 $customerid = intval($_POST['customerid']);
102 if($userinfo['change_serversettings'] == '1')
103 {
104 $zonefile = addslashes($_POST['zonefile']);
105 $openbasedir = intval($_POST['openbasedir']);
106 $safemode = intval($_POST['safemode']);
4540e92 @flol Man kann nun beim Anlegen einer Domain entscheiden, ob der Transfer i…
authored
107 $speciallogfile = intval($_POST['speciallogfile']);
5f0a03e @flol Noch einen Bug bei der Datenweitergabe beim Editieren oder Anlegen ei…
authored
108 $specialsettings = str_replace("\r\n", "\n", $_POST['specialsettings']);
4abb417 @flol Volle Multi-Admin bzw. Reseller-Funktion hinzugefuegt.
authored
109 }
110 else
111 {
112 $zonefile = '';
113 $openbasedir = '1';
114 $safemode = '1';
4540e92 @flol Man kann nun beim Anlegen einer Domain entscheiden, ob der Transfer i…
authored
115 $speciallogfile = '1';
4abb417 @flol Volle Multi-Admin bzw. Reseller-Funktion hinzugefuegt.
authored
116 $specialsettings = '';
117 }
eff2851 @flol Initial revision
authored
118
4abb417 @flol Volle Multi-Admin bzw. Reseller-Funktion hinzugefuegt.
authored
119 $domain_check = $db->query_first("SELECT `id`, `domain` FROM `".TABLE_PANEL_DOMAINS."` WHERE `domain` = '$domain'");
eff2851 @flol Initial revision
authored
120
52fdf2a @flol documentrootstyle wieder komplett entfernt. eremit hat schon einen Ha…
authored
121 if( (isset($_POST['documentroot']) && $_POST['documentroot'] == '') || $userinfo['change_serversettings'] != '1')
4abb417 @flol Volle Multi-Admin bzw. Reseller-Funktion hinzugefuegt.
authored
122 {
123 $customer = $db->query_first("SELECT `documentroot` FROM `".TABLE_PANEL_CUSTOMERS."` WHERE `customerid`='$customerid'");
124 $documentroot = $customer['documentroot'];
125 }
126 else
127 {
128 $documentroot=addslashes($_POST['documentroot']);
129 }
eff2851 @flol Initial revision
authored
130
4abb417 @flol Volle Multi-Admin bzw. Reseller-Funktion hinzugefuegt.
authored
131 $documentroot=str_replace('..','',$documentroot);
132 if(substr($documentroot, -1, 1) != '/')
133 {
134 $documentroot.='/';
135 }
4e0a035 - fixed bug #33
Martin Burchert authored
136 if ( ( substr($documentroot, 0, 1) != '/') && ( substr($documentroot,0 ,7) != 'http://') )
4abb417 @flol Volle Multi-Admin bzw. Reseller-Funktion hinzugefuegt.
authored
137 {
138 $documentroot='/'.$documentroot;
139 }
eff2851 @flol Initial revision
authored
140
4abb417 @flol Volle Multi-Admin bzw. Reseller-Funktion hinzugefuegt.
authored
141 if($openbasedir != '1')
142 {
143 $openbasedir = '0';
144 }
145 if($safemode != '1')
146 {
147 $safemode = '0';
148 }
4540e92 @flol Man kann nun beim Anlegen einer Domain entscheiden, ob der Transfer i…
authored
149 if($speciallogfile != '1')
150 {
151 $speciallogfile = '0';
152 }
eff2851 @flol Initial revision
authored
153
4abb417 @flol Volle Multi-Admin bzw. Reseller-Funktion hinzugefuegt.
authored
154 if($domain=='' || $documentroot=='' || $customerid==0 || $domain_check['domain'] == $domain)
eff2851 @flol Initial revision
authored
155 {
4abb417 @flol Volle Multi-Admin bzw. Reseller-Funktion hinzugefuegt.
authored
156 standard_error('notallreqfieldsorerrors');
eff2851 @flol Initial revision
authored
157 exit;
158 }
4abb417 @flol Volle Multi-Admin bzw. Reseller-Funktion hinzugefuegt.
authored
159 else
4e0a035 - fixed bug #33
Martin Burchert authored
160 {
4abb417 @flol Volle Multi-Admin bzw. Reseller-Funktion hinzugefuegt.
authored
161 if(($openbasedir == '0' || $safemode == '0') && (!isset($_POST['reallydoit']) || $_POST['reallydoit'] != 'reallydoit'))
162 {
5f0a03e @flol Noch einen Bug bei der Datenweitergabe beim Editieren oder Anlegen ei…
authored
163 ask_yesno('admin_domain_reallydisablesecuritysetting', $filename, "page=$page;action=$action;domain=$domain;documentroot=$documentroot;zonefile=$zonefile;openbasedir=$openbasedir;customerid=$customerid;safemode=$safemode;specialsettings=".urlencode($specialsettings).";speciallogfile=$speciallogfile;reallydoit=reallydoit");
4abb417 @flol Volle Multi-Admin bzw. Reseller-Funktion hinzugefuegt.
authored
164 exit;
165 }
5f0a03e @flol Noch einen Bug bei der Datenweitergabe beim Editieren oder Anlegen ei…
authored
166 if(isset($_POST['reallydoit']) && $_POST['reallydoit'] == 'reallydoit')
167 {
168 $specialsettings = urldecode($specialsettings);
169 }
eff2851 @flol Initial revision
authored
170
a2b6e48 @flol Nun werden auch Backslashes beim Anlegen oder Bearbeiten einer Domain…
authored
171 $specialsettings = addslashes($specialsettings);
4540e92 @flol Man kann nun beim Anlegen einer Domain entscheiden, ob der Transfer i…
authored
172 $db->query("INSERT INTO `".TABLE_PANEL_DOMAINS."` (`domain`, `customerid`, `adminid`, `documentroot`, `zonefile`, `isemaildomain`, `openbasedir`, `safemode`, `speciallogfile`, `specialsettings`) VALUES ('$domain', '$customerid', '{$userinfo['adminid']}', '$documentroot', '$zonefile', '1', '$openbasedir', '$safemode', '$speciallogfile', '$specialsettings')");
4abb417 @flol Volle Multi-Admin bzw. Reseller-Funktion hinzugefuegt.
authored
173 $domainid=$db->insert_id();
174 $db->query("UPDATE `".TABLE_PANEL_ADMINS."` SET `domains_used` = `domains_used` + 1 WHERE `adminid` = '{$userinfo['adminid']}'");
eff2851 @flol Initial revision
authored
175
4abb417 @flol Volle Multi-Admin bzw. Reseller-Funktion hinzugefuegt.
authored
176 inserttask('1');
177 inserttask('4');
eff2851 @flol Initial revision
authored
178
4abb417 @flol Volle Multi-Admin bzw. Reseller-Funktion hinzugefuegt.
authored
179 header("Location: $filename?page=$page&s=$s");
180 }
eff2851 @flol Initial revision
authored
181 }
4abb417 @flol Volle Multi-Admin bzw. Reseller-Funktion hinzugefuegt.
authored
182 else
eff2851 @flol Initial revision
authored
183 {
4abb417 @flol Volle Multi-Admin bzw. Reseller-Funktion hinzugefuegt.
authored
184 $customers='';
b73f055 @flol When you're adding a domain in the adminpanel, now not the userid but…
authored
185 $result_customers=$db->query("SELECT `customerid`, `loginname`, `name`, `surname` FROM `".TABLE_PANEL_CUSTOMERS."` ".( $userinfo['customers_see_all'] ? '' : " WHERE `adminid` = '{$userinfo['adminid']}' ")." ORDER BY `name` ASC");
4abb417 @flol Volle Multi-Admin bzw. Reseller-Funktion hinzugefuegt.
authored
186 while($row_customer=$db->fetch_array($result_customers))
187 {
b73f055 @flol When you're adding a domain in the adminpanel, now not the userid but…
authored
188 $customers.=makeoption($row_customer['name'].' '.$row_customer['surname'].' ('.$row_customer['loginname'].')',$row_customer['customerid']);
4abb417 @flol Volle Multi-Admin bzw. Reseller-Funktion hinzugefuegt.
authored
189 }
190 $openbasedir=makeyesno('openbasedir', '1', '0', '1');
191 $safemode=makeyesno('safemode', '1', '0', '1');
4540e92 @flol Man kann nun beim Anlegen einer Domain entscheiden, ob der Transfer i…
authored
192 $speciallogfile=makeyesno('speciallogfile', '1', '0', '0');
4abb417 @flol Volle Multi-Admin bzw. Reseller-Funktion hinzugefuegt.
authored
193 eval("echo \"".getTemplate("domains/domains_add")."\";");
eff2851 @flol Initial revision
authored
194 }
195 }
196 }
197
198 elseif($action=='edit' && $id!=0)
199 {
b73f055 @flol When you're adding a domain in the adminpanel, now not the userid but…
authored
200 $result=$db->query_first("SELECT `d`.`id`, `d`.`domain`, `d`.`customerid`, `d`.`documentroot`, `d`.`zonefile`, `d`.`openbasedir`, `d`.`safemode`, `d`.`speciallogfile`, `d`.`specialsettings`, `c`.`loginname`, `c`.`name`, `c`.`surname` FROM `".TABLE_PANEL_DOMAINS."` `d` LEFT JOIN `".TABLE_PANEL_CUSTOMERS."` `c` USING(`customerid`) WHERE `d`.`isemaildomain`='1' AND `d`.`id`='$id'".( $userinfo['customers_see_all'] ? '' : " AND `d`.`adminid` = '{$userinfo['adminid']}' "));
eff2851 @flol Initial revision
authored
201 if($result['domain']!='')
202 {
203 if(isset($_POST['send']) && $_POST['send']=='send')
204 {
4abb417 @flol Volle Multi-Admin bzw. Reseller-Funktion hinzugefuegt.
authored
205 if($userinfo['change_serversettings'] == '1')
206 {
207 $zonefile = addslashes($_POST['zonefile']);
208 $openbasedir = intval($_POST['openbasedir']);
209 $safemode = intval($_POST['safemode']);
5f0a03e @flol Noch einen Bug bei der Datenweitergabe beim Editieren oder Anlegen ei…
authored
210 $specialsettings = str_replace("\r\n", "\n", $_POST['specialsettings']);
eff2851 @flol Initial revision
authored
211
c36f514 @flol Domain-basierte Verzeichnisstruktur hinzugefuegt (eremit's patch)
authored
212 $documentroot = addslashes($_POST['documentroot']);
213 if($documentroot=='')
214 {
215 $customer=$db->query_first("SELECT `documentroot` FROM ".TABLE_PANEL_CUSTOMERS." WHERE `customerid`='".$result['customerid']."'");
216 $documentroot=$customer['documentroot'];
217 }
4540e92 @flol Man kann nun beim Anlegen einer Domain entscheiden, ob der Transfer i…
authored
218 $documentroot = makeCorrectDir($documentroot);
eff2851 @flol Initial revision
authored
219 }
c36f514 @flol Domain-basierte Verzeichnisstruktur hinzugefuegt (eremit's patch)
authored
220 else
eff2851 @flol Initial revision
authored
221 {
4540e92 @flol Man kann nun beim Anlegen einer Domain entscheiden, ob der Transfer i…
authored
222 $zonefile = $result['zonefile'];
223 $openbasedir = $result['openbasedir'];
224 $safemode = $result['safemode'];
225 $specialsettings = $result['specialsettings'];
c36f514 @flol Domain-basierte Verzeichnisstruktur hinzugefuegt (eremit's patch)
authored
226 $documentroot = $result['documentroot'];
eff2851 @flol Initial revision
authored
227 }
228
229 if($openbasedir != '1')
230 {
231 $openbasedir = '0';
232 }
233 if($safemode != '1')
234 {
235 $safemode = '0';
236 }
237
52fdf2a @flol documentrootstyle wieder komplett entfernt. eremit hat schon einen Ha…
authored
238 if(($openbasedir == '0' || $safemode == '0') && (!isset($_POST['reallydoit']) || $_POST['reallydoit'] != 'reallydoit') && $userinfo['change_serversettings'] == '1')
eff2851 @flol Initial revision
authored
239 {
5f0a03e @flol Noch einen Bug bei der Datenweitergabe beim Editieren oder Anlegen ei…
authored
240 ask_yesno('admin_domain_reallydisablesecuritysetting', $filename, "id=$id;page=$page;action=$action;documentroot=$documentroot;zonefile=$zonefile;openbasedir=$openbasedir;safemode=$safemode;specialsettings=".urlencode($specialsettings).";reallydoit=reallydoit");
eff2851 @flol Initial revision
authored
241 exit;
242 }
5f0a03e @flol Noch einen Bug bei der Datenweitergabe beim Editieren oder Anlegen ei…
authored
243 if(isset($_POST['reallydoit']) && $_POST['reallydoit'] == 'reallydoit')
244 {
245 $specialsettings = urldecode($specialsettings);
246 }
eff2851 @flol Initial revision
authored
247
248 if($documentroot != $result['documentroot'] || $openbasedir != $result['openbasedir'] || $safemode != $result['safemode'] || $specialsettings != $result['specialsettings'])
249 {
250 inserttask('1');
251 }
252 if($zonefile != $result['zonefile'])
253 {
254 inserttask('4');
255 }
256
a2b6e48 @flol Nun werden auch Backslashes beim Anlegen oder Bearbeiten einer Domain…
authored
257 $specialsettings = addslashes($specialsettings);
eff2851 @flol Initial revision
authored
258 $result=$db->query("UPDATE `".TABLE_PANEL_DOMAINS."` SET `documentroot`='$documentroot', `zonefile`='$zonefile', `openbasedir`='$openbasedir', `safemode`='$safemode', `specialsettings`='$specialsettings' WHERE `id`='$id'");
259 $result=$db->query("UPDATE `".TABLE_PANEL_DOMAINS."` SET `openbasedir`='$openbasedir', `safemode`='$safemode', `specialsettings`='$specialsettings' WHERE `parentdomainid`='$id'");
260
261 header("Location: $filename?page=$page&s=$s");
262 }
263 else
264 {
40cc6b8 Problem in admin_domains.php with IDN Domain Patch fixed;
Michael Duergner authored
265 $result['domain'] = $idna_convert->decode($result['domain']);
cc2e4cf @flol stripslashes() eingefuegt und damit einen Bug behoben, der die Backsl…
authored
266 $result['specialsettings'] = stripslashes($result['specialsettings']);
eff2851 @flol Initial revision
authored
267 $openbasedir=makeyesno('openbasedir', '1', '0', $result['openbasedir']);
268 $safemode=makeyesno('safemode', '1', '0', $result['safemode']);
4540e92 @flol Man kann nun beim Anlegen einer Domain entscheiden, ob der Transfer i…
authored
269 $speciallogfile=($result['speciallogfile'] == 1 ? $lng['panel']['yes'] : $lng['panel']['no']);
eff2851 @flol Initial revision
authored
270 eval("echo \"".getTemplate("domains/domains_edit")."\";");
271 }
272 }
273 }
274 }
275
276 ?>
Something went wrong with that request. Please try again.