Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100755 289 lines (267 sloc) 10.465 kb
4abb4175 »
2004-08-11 Volle Multi-Admin bzw. Reseller-Funktion hinzugefuegt.
1 <?php
2 /**
3 * filename: $Source$
4 * begin: Wednesday, Aug 11, 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");
1e0edc24 »
2004-12-08 IDN Domain Patch added
26
4abb4175 »
2004-08-11 Volle Multi-Admin bzw. Reseller-Funktion hinzugefuegt.
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=='admins' && $userinfo['change_serversettings'] == '1' )
37 {
38 if($action=='')
39 {
40 if(isset($_GET['sortby']))
41 {
42 $sortby=addslashes($_GET['sortby']);
43 }
44 else
45 {
46 $sortby='loginname';
47 }
48 if(isset($_GET['sortorder']) && strtolower($_GET['sortorder'])=='desc')
49 {
50 $sortorder='DESC';
51 }
52 else
53 {
54 $sortorder='ASC';
55 }
56
57 $admins='';
58 $result=$db->query("SELECT * FROM `".TABLE_PANEL_ADMINS."` ORDER BY `$sortby` $sortorder");
59 while($row=$db->fetch_array($result))
60 {
61 $row['traffic_used']=round($row['traffic_used']/(1024*1024),4);
62 $row['traffic']=round($row['traffic']/(1024*1024),4);
63 $row['diskspace_used']=round($row['diskspace_used']/1024,2);
64 $row['diskspace']=round($row['diskspace']/1024,2);
65 $row['deactivated'] = str_replace('0', $lng['panel']['yes'], $row['deactivated']);
66 $row['deactivated'] = str_replace('1', $lng['panel']['no'], $row['deactivated']);
67
183839a1 »
2004-12-22 Rewrote the whole eMail-part in the customer-panel. You only have ema…
68 $row = str_replace_array('-1', 'UL', $row, 'customers domains diskspace traffic mysqls emails email_accounts email_forwarders ftps subdomains');
4abb4175 »
2004-08-11 Volle Multi-Admin bzw. Reseller-Funktion hinzugefuegt.
69
70 eval("\$admins.=\"".getTemplate("admins/admins_admin")."\";");
71 }
72 eval("echo \"".getTemplate("admins/admins")."\";");
73 }
74
75 elseif($action=='delete' && $id!=0)
76 {
77 if($id == '1')
78 {
79 standard_error('youcantdeletechangemainadmin');
80 exit;
81 }
82 $result=$db->query_first("SELECT * FROM `".TABLE_PANEL_ADMINS."` WHERE `adminid`='$id'");
83 if($result['loginname']!='')
84 {
85 if(isset($_POST['send']) && $_POST['send']=='send')
86 {
87 $db->query("DELETE FROM `".TABLE_PANEL_ADMINS."` WHERE `adminid`='$id'");
68bc974b »
2004-12-15 Tim's admin-traffic-patch included.
88 $db->query("DELETE FROM `".TABLE_PANEL_TRAFFIC_ADMINS."` WHERE `adminid`='$id'");
4abb4175 »
2004-08-11 Volle Multi-Admin bzw. Reseller-Funktion hinzugefuegt.
89 $db->query("UPDATE `".TABLE_PANEL_CUSTOMERS."` SET `adminid` = '1' WHERE `adminid` = '$id'");
90 $db->query("UPDATE `".TABLE_PANEL_DOMAINS."` SET `adminid` = '1' WHERE `adminid` = '$id'");
08bed183 »
2004-12-19 Added workaround for php 4.3.10 in connection to libmysql14.so.
91 updateCounters () ;
4abb4175 »
2004-08-11 Volle Multi-Admin bzw. Reseller-Funktion hinzugefuegt.
92
04920c0b »
2005-08-11 Encapsulated the header-location-statement into a redirectTo-function.
93 redirectTo ( $filename , Array ( 'page' => $page , 's' => $s ) ) ;
4abb4175 »
2004-08-11 Volle Multi-Admin bzw. Reseller-Funktion hinzugefuegt.
94 }
95 else {
efcfe12a »
2004-11-21 In the securityquestions the target (eg email, domain, databasename e…
96 ask_yesno('admin_admin_reallydelete', $filename, "id=$id;page=$page;action=$action", $result['loginname']);
4abb4175 »
2004-08-11 Volle Multi-Admin bzw. Reseller-Funktion hinzugefuegt.
97 }
98 }
99 }
100
101 elseif($action=='add')
102 {
103 if(isset($_POST['send']) && $_POST['send']=='send')
104 {
24b273d6 »
2004-12-18 Fixed a serious bug in the ressourcemanagement of admins/resellers.
105 $name = addslashes ( $_POST['name'] ) ;
106 $loginname = addslashes ( $_POST['loginname'] ) ;
4abb4175 »
2004-08-11 Volle Multi-Admin bzw. Reseller-Funktion hinzugefuegt.
107 $loginname_check = $db->query_first("SELECT `loginname` FROM `".TABLE_PANEL_ADMINS."` WHERE `loginname`='".$loginname."'");
24b273d6 »
2004-12-18 Fixed a serious bug in the ressourcemanagement of admins/resellers.
108 $password = addslashes ( $_POST['password'] ) ;
109 $email = $idna_convert->encode ( addslashes ( $_POST['email'] ) ) ;
2cfcefce »
2005-01-17 Profile based language and e-mail templates
110 $def_language = addslashes($_POST['def_language']);
24b273d6 »
2004-12-18 Fixed a serious bug in the ressourcemanagement of admins/resellers.
111 $customers = intval_ressource ( $_POST['customers'] ) ;
112 $domains = intval_ressource ( $_POST['domains'] ) ;
113 $subdomains = intval_ressource ( $_POST['subdomains'] ) ;
114 $emails = intval_ressource ( $_POST['emails'] ) ;
183839a1 »
2004-12-22 Rewrote the whole eMail-part in the customer-panel. You only have ema…
115 $email_accounts = intval_ressource ( $_POST['email_accounts'] ) ;
24b273d6 »
2004-12-18 Fixed a serious bug in the ressourcemanagement of admins/resellers.
116 $email_forwarders = intval_ressource ( $_POST['email_forwarders'] ) ;
117 $ftps = intval_ressource ( $_POST['ftps'] ) ;
118 $mysqls = intval_ressource ( $_POST['mysqls'] ) ;
119 $customers_see_all = intval ( $_POST['customers_see_all'] ) ;
120 $domains_see_all = intval ( $_POST['domains_see_all'] ) ;
121 $change_serversettings = intval ( $_POST['change_serversettings'] ) ;
122
123 $diskspace = intval_ressource ( $_POST['diskspace'] ) ;
124 $traffic = doubleval_ressource ( $_POST['traffic'] ) ;
125 $diskspace = $diskspace * 1024 ;
126 $traffic = $traffic * 1024 * 1024 ;
4abb4175 »
2004-08-11 Volle Multi-Admin bzw. Reseller-Funktion hinzugefuegt.
127
d36b2b0d »
2005-05-30 Added detailed error messages - many thanks to Ron Brand!
128 if($loginname == '')
4abb4175 »
2004-08-11 Volle Multi-Admin bzw. Reseller-Funktion hinzugefuegt.
129 {
d36b2b0d »
2005-05-30 Added detailed error messages - many thanks to Ron Brand!
130 standard_error(array('stringisempty','myloginname'));
4abb4175 »
2004-08-11 Volle Multi-Admin bzw. Reseller-Funktion hinzugefuegt.
131 }
d36b2b0d »
2005-05-30 Added detailed error messages - many thanks to Ron Brand!
132 elseif($loginname_check['loginname'] == $loginname)
133 {
134 standard_error('loginnameexists',$loginname);
135 }
136 elseif(!check_username($loginname))
137 {
138 standard_error('loginnameiswrong',$loginname);
139 }
140 elseif($name == '')
141 {
142 standard_error(array('stringisempty','myname'));
143 }
144 elseif($email == '')
145 {
146 standard_error(array('stringisempty','emailadd'));
147 }
148 elseif($password == '')
149 {
150 standard_error(array('stringisempty','mypassword'));
151 }
152 elseif(!verify_email($email))
153 {
154 standard_error('emailiswrong',$email);
155 }
156
4abb4175 »
2004-08-11 Volle Multi-Admin bzw. Reseller-Funktion hinzugefuegt.
157 else
158 {
159 if($customers_see_all != '1')
160 {
161 $customers_see_all = '0';
162 }
163 if($domains_see_all != '1')
164 {
165 $domains_see_all = '0';
166 }
167 if($change_serversettings != '1')
168 {
169 $change_serversettings = '0';
170 }
171
2cfcefce »
2005-01-17 Profile based language and e-mail templates
172 $result=$db->query("INSERT INTO `".TABLE_PANEL_ADMINS."` (`loginname`, `password`, `name`, `email`, `def_language`, `change_serversettings`, `customers`, `customers_see_all`, `domains`, `domains_see_all`, `diskspace`, `traffic`, `subdomains`, `emails`, `email_accounts`, `email_forwarders`, `ftps`, `mysqls`)
173 VALUES ('$loginname', '".md5($password)."', '$name', '$email','$def_language', '$change_serversettings', '$customers', '$customers_see_all', '$domains', '$domains_see_all', '$diskspace', '$traffic', '$subdomains', '$emails', '$email_accounts', '$email_forwarders', '$ftps', '$mysqls')");
4abb4175 »
2004-08-11 Volle Multi-Admin bzw. Reseller-Funktion hinzugefuegt.
174 $adminid=$db->insert_id();
04920c0b »
2005-08-11 Encapsulated the header-location-statement into a redirectTo-function.
175 redirectTo ( $filename , Array ( 'page' => $page , 's' => $s ) ) ;
4abb4175 »
2004-08-11 Volle Multi-Admin bzw. Reseller-Funktion hinzugefuegt.
176 }
177 }
178 else
179 {
2cfcefce »
2005-01-17 Profile based language and e-mail templates
180 $language_options = '';
181 while(list($language_file, $language_name) = each($languages))
182 {
183 $language_options .= makeoption($language_name, $language_file, $userinfo['language']);
184 }
4abb4175 »
2004-08-11 Volle Multi-Admin bzw. Reseller-Funktion hinzugefuegt.
185 $change_serversettings=makeyesno('change_serversettings', '1', '0', '0');
186 $customers_see_all=makeyesno('customers_see_all', '1', '0', '0');
187 $domains_see_all=makeyesno('domains_see_all', '1', '0', '0');
188 eval("echo \"".getTemplate("admins/admins_add")."\";");
189 }
190 }
191
192 elseif($action=='edit' && $id!=0)
193 {
194 if($id == '1')
195 {
196 standard_error('youcantdeletechangemainadmin');
197 exit;
198 }
199 $result=$db->query_first("SELECT * FROM `".TABLE_PANEL_ADMINS."` WHERE `adminid`='$id'");
200 if($result['loginname']!='')
201 {
202 if(isset($_POST['send']) && $_POST['send']=='send')
203 {
24b273d6 »
2004-12-18 Fixed a serious bug in the ressourcemanagement of admins/resellers.
204 $name = addslashes ( $_POST['name'] ) ;
205 $newpassword = addslashes ( $_POST['newpassword'] ) ;
206 $email = $idna_convert->encode ( addslashes ( $_POST['email'] ) ) ;
2cfcefce »
2005-01-17 Profile based language and e-mail templates
207 $def_language = addslashes($_POST['def_language']);
24b273d6 »
2004-12-18 Fixed a serious bug in the ressourcemanagement of admins/resellers.
208 $deactivated = intval ( $_POST['deactivated'] ) ;
209 $customers = intval_ressource ( $_POST['customers'] ) ;
210 $domains = intval_ressource ( $_POST['domains'] ) ;
211 $subdomains = intval_ressource ( $_POST['subdomains'] ) ;
212 $emails = intval_ressource ( $_POST['emails'] ) ;
183839a1 »
2004-12-22 Rewrote the whole eMail-part in the customer-panel. You only have ema…
213 $email_accounts = intval_ressource ( $_POST['email_accounts'] ) ;
24b273d6 »
2004-12-18 Fixed a serious bug in the ressourcemanagement of admins/resellers.
214 $email_forwarders = intval_ressource ( $_POST['email_forwarders'] ) ;
215 $ftps = intval_ressource ( $_POST['ftps'] ) ;
216 $mysqls = intval_ressource ( $_POST['mysqls'] ) ;
217 $customers_see_all = intval ( $_POST['customers_see_all'] ) ;
218 $domains_see_all = intval ( $_POST['domains_see_all'] ) ;
219 $change_serversettings = intval ( $_POST['change_serversettings'] ) ;
220
221 $diskspace = intval ( $_POST['diskspace'] ) ;
222 $traffic = doubleval_ressource ( $_POST['traffic'] ) ;
223 $diskspace = $diskspace * 1024 ;
224 $traffic = $traffic * 1024 * 1024 ;
4abb4175 »
2004-08-11 Volle Multi-Admin bzw. Reseller-Funktion hinzugefuegt.
225
d36b2b0d »
2005-05-30 Added detailed error messages - many thanks to Ron Brand!
226 if($name == '')
227 {
228 standard_error(array('stringisempty','myname'));
229 }
230 elseif($email == '')
231 {
232 standard_error(array('stringisempty','emailadd'));
233 }
234 elseif(!verify_email($email))
4abb4175 »
2004-08-11 Volle Multi-Admin bzw. Reseller-Funktion hinzugefuegt.
235 {
d36b2b0d »
2005-05-30 Added detailed error messages - many thanks to Ron Brand!
236 standard_error('emailiswrong',$email);
4abb4175 »
2004-08-11 Volle Multi-Admin bzw. Reseller-Funktion hinzugefuegt.
237 }
238 else
239 {
240 $updatepassword='';
241 if($newpassword!='')
242 {
243 $updatepassword="`password`='".md5($newpassword)."', ";
244 }
245
246 if($deactivated != '1')
247 {
248 $deactivated = '0';
249 }
250
251 if($customers_see_all != '1')
252 {
253 $customers_see_all = '0';
254 }
255 if($domains_see_all != '1')
256 {
257 $domains_see_all = '0';
258 }
259 if($change_serversettings != '1')
260 {
261 $change_serversettings = '0';
262 }
263
2cfcefce »
2005-01-17 Profile based language and e-mail templates
264 $db->query("UPDATE `".TABLE_PANEL_ADMINS."` SET `name`='$name', `email`='$email', `def_language`='$def_language', `change_serversettings` = '$change_serversettings', `customers` = '$customers', `customers_see_all` = '$customers_see_all', `domains` = '$domains', `domains_see_all` = '$domains_see_all', $updatepassword `diskspace`='$diskspace', `traffic`='$traffic', `subdomains`='$subdomains', `emails`='$emails', `email_accounts` = '$email_accounts', `email_forwarders`='$email_forwarders', `ftps`='$ftps', `mysqls`='$mysqls', `deactivated`='$deactivated' WHERE `adminid`='$id'");
4abb4175 »
2004-08-11 Volle Multi-Admin bzw. Reseller-Funktion hinzugefuegt.
265
04920c0b »
2005-08-11 Encapsulated the header-location-statement into a redirectTo-function.
266 redirectTo ( $filename , Array ( 'page' => $page , 's' => $s ) ) ;
4abb4175 »
2004-08-11 Volle Multi-Admin bzw. Reseller-Funktion hinzugefuegt.
267 }
268 }
269 else
270 {
271 $result['traffic']=$result['traffic']/(1024*1024);
272 $result['diskspace']=$result['diskspace']/1024;
1e0edc24 »
2004-12-08 IDN Domain Patch added
273 $result['email'] = $idna_convert->decode($result['email']);
2cfcefce »
2005-01-17 Profile based language and e-mail templates
274 $language_options = '';
275 while(list($language_file, $language_name) = each($languages))
276 {
277 $language_options .= makeoption($language_name, $language_file, $result['def_language']);
278 }
4abb4175 »
2004-08-11 Volle Multi-Admin bzw. Reseller-Funktion hinzugefuegt.
279 $change_serversettings=makeyesno('change_serversettings', '1', '0', $result['change_serversettings']);
280 $customers_see_all=makeyesno('customers_see_all', '1', '0', $result['customers_see_all']);
281 $domains_see_all=makeyesno('domains_see_all', '1', '0', $result['domains_see_all']);
282 $deactivated=makeyesno('deactivated', '1', '0', $result['deactivated']);
283 eval("echo \"".getTemplate("admins/admins_edit")."\";");
284 }
285 }
286 }
287 }
288
d36b2b0d »
2005-05-30 Added detailed error messages - many thanks to Ron Brand!
289 ?>
Something went wrong with that request. Please try again.