Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 295 lines (255 sloc) 9.546 kb
eff2851 @flol Initial revision
authored
1 <?php
fb05771 PHPBeautify SysCP 1.2 at least once, to have an unitary code look. :)
Luca Longinotti authored
2
eff2851 @flol Initial revision
authored
3 /**
0ad5dc6 @flol Inserted new php file header and corrected all svn props, refs #166
authored
4 * This file is part of the SysCP project.
a439744 hm, don't we have 2008 already?
Florian Aders authored
5 * Copyright (c) 2003-2008 the SysCP Team (see authors).
eff2851 @flol Initial revision
authored
6 *
0ad5dc6 @flol Inserted new php file header and corrected all svn props, refs #166
authored
7 * For the full copyright and license information, please view the COPYING
8 * file that was distributed with this source code. You can also view the
9 * COPYING file online at http://files.syscp.org/misc/COPYING.txt
eff2851 @flol Initial revision
authored
10 *
0ad5dc6 @flol Inserted new php file header and corrected all svn props, refs #166
authored
11 * @copyright (c) the authors
12 * @author Florian Lippert <flo@syscp.org>
13 * @license GPLv2 http://files.syscp.org/misc/COPYING.txt
14 * @package Panel
15 * @version $Id$
eff2851 @flol Initial revision
authored
16 */
17
fb05771 PHPBeautify SysCP 1.2 at least once, to have an unitary code look. :)
Luca Longinotti authored
18 define('AREA', 'admin');
19
20 /**
21 * Include our init.php, which manages Sessions, Language etc.
22 */
23
24 require ("./lib/init.php");
25
26 if($action == 'logout')
27 {
fb26173 Now the trunk is beautified with tabs insterad of spaces, sorry for t…
Florian Aders authored
28 $log->logAction(ADM_ACTION, LOG_NOTICE, "logged out");
f0d1ca7 @flol Made domain-moving deactivateable, added realtime patch, added possib…
authored
29
30 if($settings['session']['allow_multiple_login'] == '1')
31 {
32 $db->query("DELETE FROM `" . TABLE_PANEL_SESSIONS . "` WHERE `userid` = '" . (int)$userinfo['adminid'] . "' AND `adminsession` = '1' AND `hash` = '" . $s . "'");
33 }
34 else
35 {
36 $db->query("DELETE FROM `" . TABLE_PANEL_SESSIONS . "` WHERE `userid` = '" . (int)$userinfo['adminid'] . "' AND `adminsession` = '1'");
37 }
38
fb26173 Now the trunk is beautified with tabs insterad of spaces, sorry for t…
Florian Aders authored
39 redirectTo('index.php');
40 exit;
fb05771 PHPBeautify SysCP 1.2 at least once, to have an unitary code look. :)
Luca Longinotti authored
41 }
42
43 if(isset($_POST['id']))
44 {
fb26173 Now the trunk is beautified with tabs insterad of spaces, sorry for t…
Florian Aders authored
45 $id = intval($_POST['id']);
fb05771 PHPBeautify SysCP 1.2 at least once, to have an unitary code look. :)
Luca Longinotti authored
46 }
47 elseif(isset($_GET['id']))
48 {
fb26173 Now the trunk is beautified with tabs insterad of spaces, sorry for t…
Florian Aders authored
49 $id = intval($_GET['id']);
fb05771 PHPBeautify SysCP 1.2 at least once, to have an unitary code look. :)
Luca Longinotti authored
50 }
51
52 if($page == 'overview')
53 {
fb26173 Now the trunk is beautified with tabs insterad of spaces, sorry for t…
Florian Aders authored
54 $log->logAction(ADM_ACTION, LOG_NOTICE, "viewed admin_index");
55 $overview = $db->query_first("SELECT COUNT(*) AS `number_customers`,
eff2851 @flol Initial revision
authored
56 SUM(`diskspace_used`) AS `diskspace_used`,
57 SUM(`mysqls_used`) AS `mysqls_used`,
58 SUM(`emails_used`) AS `emails_used`,
183839a @flol Rewrote the whole eMail-part in the customer-panel. You only have ema…
authored
59 SUM(`email_accounts_used`) AS `email_accounts_used`,
eff2851 @flol Initial revision
authored
60 SUM(`email_forwarders_used`) AS `email_forwarders_used`,
276859f adding e-mail quota support (thx to JamieWolf), this fixes #302, fixe…
Michael Kaufmann authored
61 SUM(`email_quota_used`) AS `email_quota_used`,
eff2851 @flol Initial revision
authored
62 SUM(`ftps_used`) AS `ftps_used`,
e14e675 * Merging branches/d00p/Support_Ticket to trunk, many thx to d00p
Florian Aders authored
63 SUM(`tickets_used`) AS `tickets_used`,
eff2851 @flol Initial revision
authored
64 SUM(`subdomains_used`) AS `subdomains_used`,
fedd76e @flol Merging changes from branches/radiation/aps_trunk to trunk/syscp
authored
65 SUM(`traffic_used`) AS `traffic_used`,
66 SUM(`aps_packages_used`) AS `aps_packages_used`
fb05771 PHPBeautify SysCP 1.2 at least once, to have an unitary code look. :)
Luca Longinotti authored
67 FROM `" . TABLE_PANEL_CUSTOMERS . "`" . ($userinfo['customers_see_all'] ? '' : " WHERE `adminid` = '" . (int)$userinfo['adminid'] . "' "));
7d1fb05 @flol Beautified with new SysCP filter
authored
68 $overview['traffic_used'] = round($overview['traffic_used'] / (1024 * 1024), $settings['panel']['decimal_places']);
69 $overview['diskspace_used'] = round($overview['diskspace_used'] / 1024, $settings['panel']['decimal_places']);
fb26173 Now the trunk is beautified with tabs insterad of spaces, sorry for t…
Florian Aders authored
70 $number_domains = $db->query_first("SELECT COUNT(*) AS `number_domains` FROM `" . TABLE_PANEL_DOMAINS . "` WHERE `parentdomainid`='0'" . ($userinfo['customers_see_all'] ? '' : " AND `adminid` = '" . (int)$userinfo['adminid'] . "' "));
71 $overview['number_domains'] = $number_domains['number_domains'];
72 $phpversion = phpversion();
73 $phpmemorylimit = @ini_get("memory_limit");
74
75 if($phpmemorylimit == "")
76 {
77 $phpmemorylimit = $lng['admin']['memorylimitdisabled'];
78 }
79
80 $mysqlserverversion = mysql_get_server_info();
81 $mysqlclientversion = mysql_get_client_info();
82 $webserverinterface = strtoupper(@php_sapi_name());
83
84 if((isset($_GET['lookfornewversion']) && $_GET['lookfornewversion'] == 'yes')
85 || (isset($lookfornewversion) && $lookfornewversion == 'yes'))
86 {
87 $latestversion = @file('http://version.syscp.org/SysCP/legacy/' . $version);
88
89 if(is_array($latestversion)
90 && count($latestversion) >= 2)
91 {
92 $lookfornewversion_lable = $latestversion[0];
93 $lookfornewversion_link = $latestversion[1];
94 $lookfornewversion_addinfo = '';
95
96 if(count($latestversion) >= 3)
97 {
98 $addinfo = $latestversion;
99 unset($addinfo[0]);
100 unset($addinfo[1]);
101 $lookfornewversion_addinfo = implode("\n", $addinfo);
102 }
103 }
104 else
105 {
106 redirectTo('http://version.syscp.org/SysCP/legacy/' . $version . '/pretty', NULL);
107 }
108 }
109 else
110 {
111 $lookfornewversion_lable = $lng['admin']['lookfornewversion']['clickhere'];
112 $lookfornewversion_link = htmlspecialchars($filename . '?s=' . urlencode($s) . '&page=' . urlencode($page) . '&lookfornewversion=yes');
113 $lookfornewversion_addinfo = '';
114 }
115
7d1fb05 @flol Beautified with new SysCP filter
authored
116 $userinfo['diskspace'] = round($userinfo['diskspace'] / 1024, $settings['panel']['decimal_places']);
117 $userinfo['diskspace_used'] = round($userinfo['diskspace_used'] / 1024, $settings['panel']['decimal_places']);
118 $userinfo['traffic'] = round($userinfo['traffic'] / (1024 * 1024), $settings['panel']['decimal_places']);
119 $userinfo['traffic_used'] = round($userinfo['traffic_used'] / (1024 * 1024), $settings['panel']['decimal_places']);
fedd76e @flol Merging changes from branches/radiation/aps_trunk to trunk/syscp
authored
120 $userinfo = str_replace_array('-1', $lng['customer']['unlimited'], $userinfo, 'customers domains diskspace traffic mysqls emails email_accounts email_forwarders email_quota ftps tickets subdomains aps_packages');
fb26173 Now the trunk is beautified with tabs insterad of spaces, sorry for t…
Florian Aders authored
121
122 if($settings['system']['last_tasks_run'] == 0)
123 {
124 $cronlastrun = $lng['cronjobs']['notyetrun'];
125 }
126 else
127 {
128 $cronlastrun = date("d.m.Y H:i:s", $settings['system']['last_tasks_run']);
129 }
130
131 if($settings['system']['last_traffic_run'] == 0)
132 {
133 $trafficlastrun = $lng['cronjobs']['notyetrun'];
134 }
135 else
136 {
137 $trafficlastrun = date("d.m.Y H:i:s", $settings['system']['last_traffic_run']);
138 }
139
140 if($settings['system']['last_archive_run'] == 0)
141 {
142 $archivelastrun = $lng['cronjobs']['notyetrun'];
143 }
144 else
145 {
146 $archivelastrun = date("d.m.Y H:i:s", $settings['system']['last_archive_run']);
147 }
148
149 $opentickets = 0;
150 $opentickets = $db->query_first('SELECT COUNT(`id`) as `count` FROM `' . TABLE_PANEL_TICKETS . '`
0ea7e94 Fuck, re-introduced a bug which was already fixed -.-, sry
Florian Aders authored
151 WHERE `answerto` = "0" AND (`status` = "0" OR `status` = "1")
4d7791f only show "currently open tickets" to the admin they belong to
Michael Kaufmann authored
152 AND `lastreplier`="0" AND `adminid` = "' . $userinfo['adminid'] . '"');
fb26173 Now the trunk is beautified with tabs insterad of spaces, sorry for t…
Florian Aders authored
153 $awaitingtickets = $opentickets['count'];
154 $awaitingtickets_text = '';
155
156 if($opentickets > 0)
157 {
8efb126 @flol Beautified trunk and set correct svn props, refs #741
authored
158 $awaitingtickets_text = strtr($lng['ticket']['awaitingticketreply'], array('%s' => '<a href="admin_tickets.php?page=tickets&amp;s=' . $s . '">' . $opentickets['count'] . '</a>'));
fb26173 Now the trunk is beautified with tabs insterad of spaces, sorry for t…
Florian Aders authored
159 }
160
161 if(function_exists('sys_getloadavg'))
162 {
163 $loadArray = sys_getloadavg();
164 $load = number_format($loadArray[0], 2, '.', '') . " / " . number_format($loadArray[1], 2, '.', '') . " / " . number_format($loadArray[2], 2, '.', '');
165 }
166 else
167 {
168 $load = @file_get_contents('/proc/loadavg');
169
170 if(!$load)
171 {
172 $load = $lng['admin']['noloadavailable'];
173 }
174 }
175
176 if(function_exists('posix_uname'))
177 {
178 $showkernel = 1;
179 $kernel_nfo = posix_uname();
180 $kernel = $kernel_nfo['release'] . ' (' . $kernel_nfo['machine'] . ')';
181 }
182 else
183 {
184 $showkernel = 0;
185 $kernel = '';
186 }
187
11dceee Merged the uptime - displayfix
Florian Aders authored
188 // Try to get the uptime
189 // First: With exec (let's hope it's enabled for the SysCP - vHost)
f6f1a03 Just beautified my work ;)
Florian Aders authored
190
5aed800 Merging pimped_uptime branch, refs #0000658
Florian Aders authored
191 $uptime_array = explode(" ", @file_get_contents("/proc/uptime"));
f6f1a03 Just beautified my work ;)
Florian Aders authored
192
193 if(is_array($uptime_array)
194 && isset($uptime_array[0])
195 && is_numeric($uptime_array[0]))
11dceee Merged the uptime - displayfix
Florian Aders authored
196 {
197 // Some calculatioon to get a nicly formatted display
f6f1a03 Just beautified my work ;)
Florian Aders authored
198
11dceee Merged the uptime - displayfix
Florian Aders authored
199 $seconds = round($uptime_array[0], 0);
200 $minutes = $seconds / 60;
201 $hours = $minutes / 60;
202 $days = floor($hours / 24);
203 $hours = floor($hours - ($days * 24));
204 $minutes = floor($minutes - ($days * 24 * 60) - ($hours * 60));
205 $seconds = floor($seconds - ($days * 24 * 60 * 60) - ($hours * 60 * 60) - ($minutes * 60));
206 $uptime = "{$days}d, {$hours}h, {$minutes}m, {$seconds}s";
f6f1a03 Just beautified my work ;)
Florian Aders authored
207
11dceee Merged the uptime - displayfix
Florian Aders authored
208 // Just cleanup
f6f1a03 Just beautified my work ;)
Florian Aders authored
209
11dceee Merged the uptime - displayfix
Florian Aders authored
210 unset($uptime_array, $seconds, $minutes, $hours, $days);
211 }
fb26173 Now the trunk is beautified with tabs insterad of spaces, sorry for t…
Florian Aders authored
212 else
213 {
11dceee Merged the uptime - displayfix
Florian Aders authored
214 // Nothing of the above worked, show an error :/
f6f1a03 Just beautified my work ;)
Florian Aders authored
215
5aed800 Merging pimped_uptime branch, refs #0000658
Florian Aders authored
216 $uptime = '';
fb26173 Now the trunk is beautified with tabs insterad of spaces, sorry for t…
Florian Aders authored
217 }
218
219 eval("echo \"" . getTemplate("index/index") . "\";");
fb05771 PHPBeautify SysCP 1.2 at least once, to have an unitary code look. :)
Luca Longinotti authored
220 }
221 elseif($page == 'change_password')
222 {
fb26173 Now the trunk is beautified with tabs insterad of spaces, sorry for t…
Florian Aders authored
223 if(isset($_POST['send'])
224 && $_POST['send'] == 'send')
225 {
226 $old_password = validate($_POST['old_password'], 'old password');
227
228 if(md5($old_password) != $userinfo['password'])
229 {
230 standard_error('oldpasswordnotcorrect');
231 exit;
232 }
233
234 $new_password = validate($_POST['new_password'], 'new password');
235 $new_password_confirm = validate($_POST['new_password_confirm'], 'new password confirm');
236
237 if($old_password == '')
238 {
8efb126 @flol Beautified trunk and set correct svn props, refs #741
authored
239 standard_error(array('stringisempty', 'oldpassword'));
fb26173 Now the trunk is beautified with tabs insterad of spaces, sorry for t…
Florian Aders authored
240 }
241 elseif($new_password == '')
242 {
8efb126 @flol Beautified trunk and set correct svn props, refs #741
authored
243 standard_error(array('stringisempty', 'newpassword'));
fb26173 Now the trunk is beautified with tabs insterad of spaces, sorry for t…
Florian Aders authored
244 }
245 elseif($new_password_confirm == '')
246 {
8efb126 @flol Beautified trunk and set correct svn props, refs #741
authored
247 standard_error(array('stringisempty', 'newpasswordconfirm'));
fb26173 Now the trunk is beautified with tabs insterad of spaces, sorry for t…
Florian Aders authored
248 }
249 elseif($new_password != $new_password_confirm)
250 {
251 standard_error('newpasswordconfirmerror');
252 }
253 else
254 {
255 $db->query("UPDATE `" . TABLE_PANEL_ADMINS . "` SET `password`='" . md5($new_password) . "' WHERE `adminid`='" . (int)$userinfo['adminid'] . "' AND `password`='" . md5($old_password) . "'");
256 $log->logAction(ADM_ACTION, LOG_NOTICE, "changed his/her password from '" . $old_password . "' to '" . $new_password . "'");
8efb126 @flol Beautified trunk and set correct svn props, refs #741
authored
257 redirectTo($filename, Array('s' => $s));
fb26173 Now the trunk is beautified with tabs insterad of spaces, sorry for t…
Florian Aders authored
258 }
259 }
260 else
261 {
262 eval("echo \"" . getTemplate("index/change_password") . "\";");
263 }
fb05771 PHPBeautify SysCP 1.2 at least once, to have an unitary code look. :)
Luca Longinotti authored
264 }
265 elseif($page == 'change_language')
266 {
fb26173 Now the trunk is beautified with tabs insterad of spaces, sorry for t…
Florian Aders authored
267 if(isset($_POST['send'])
268 && $_POST['send'] == 'send')
269 {
270 $def_language = validate($_POST['def_language'], 'default language');
271
272 if(isset($languages[$def_language]))
273 {
274 $db->query("UPDATE `" . TABLE_PANEL_ADMINS . "` SET `def_language`='" . $db->escape($def_language) . "' WHERE `adminid`='" . (int)$userinfo['adminid'] . "'");
275 $db->query("UPDATE `" . TABLE_PANEL_SESSIONS . "` SET `language`='" . $db->escape($def_language) . "' WHERE `hash`='" . $db->escape($s) . "'");
276 }
277
278 $log->logAction(ADM_ACTION, LOG_NOTICE, "changed his/her default language to '" . $def_language . "'");
8efb126 @flol Beautified trunk and set correct svn props, refs #741
authored
279 redirectTo($filename, Array('s' => $s));
fb26173 Now the trunk is beautified with tabs insterad of spaces, sorry for t…
Florian Aders authored
280 }
281 else
282 {
283 $language_options = '';
284
285 while(list($language_file, $language_name) = each($languages))
286 {
287 $language_options.= makeoption($language_name, $language_file, $userinfo['def_language'], true);
288 }
289
290 eval("echo \"" . getTemplate("index/change_language") . "\";");
291 }
fb05771 PHPBeautify SysCP 1.2 at least once, to have an unitary code look. :)
Luca Longinotti authored
292 }
eff2851 @flol Initial revision
authored
293
fc923c7 @flol Fixed a little bug with htmlentities and languages: Now the name of a…
authored
294 ?>
Something went wrong with that request. Please try again.