Skip to content

Commit 51761b1

Browse files
committed
Merge branch '6603-warnings-due-to-the-use-of-php-8-2-in-server-php-logs' of git.ispconfig.org:ispconfig/ispconfig3 into 6603-warnings-due-to-the-use-of-php-8-2-in-server-php-logs
2 parents b5f39ce + f586f50 commit 51761b1

File tree

20 files changed

+245
-145
lines changed

20 files changed

+245
-145
lines changed

install/lib/installer_base.lib.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,11 +253,12 @@ public function check_prerequisites() {
253253
if ($conf['default_php'] != '') {
254254
if(version_compare(phpversion('tidy'), $conf['default_php'], '==')) $msg .= "Your PHP version is not the OS default. Change the PHP version back to the default version of the OS. The currently used PHP version is " . phpversion() . "The default version for your OS is PHP " . $conf['default_php'] . ".\n";
255255
}
256-
if(version_compare(phpversion(), '5.4', '<')) $msg .= "PHP Version 5.4 or newer is required. The currently used PHP version is " . phpversion() . ".\n";
256+
if(version_compare(phpversion(), '7.0', '<')) $msg .= "PHP Version 7.0 or newer is required. The currently used PHP version is " . phpversion() . ".\n";
257257
//if(version_compare(phpversion(), '8.2', '>=')) $msg .= "PHP Version 8.2+ is not supported yet. Change the PHP version back to the default version of the OS. The currently used PHP version is " . phpversion() . ".\n";
258258
if(!function_exists('curl_init')) $msg .= "PHP Curl Module is missing.\n";
259259
if(!function_exists('mysqli_connect')) $msg .= "PHP MySQLi Module is nmissing.\n";
260260
if(!function_exists('mb_detect_encoding')) $msg .= "PHP Multibyte Module (MB) is missing.\n";
261+
if(!function_exists('openssl_pkey_get_details')) $msg .= "PHP OpenSSL fiúnctions are missing.\n";
261262

262263
if($msg != '') die($msg);
263264
}

install/patches/upd_0100.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
if(!defined('INSTALLER_RUN')) die('Patch update file access violation.');
44

5-
class upd_0099 extends installer_patch_update {
5+
class upd_0100 extends installer_patch_update {
66

77
public function onAfterSQL() {
88
global $inst;
@@ -12,7 +12,6 @@ public function onAfterSQL() {
1212
unlink('/usr/local/ispconfig/server/plugins-available/nginx_reverseproxy_plugin.inc.php');
1313
if(!is_link('/usr/local/ispconfig/server/plugins-enabled/bind_dlz_plugin.inc.php'))
1414
unlink('/usr/local/ispconfig/server/plugins-available/bind_dlz_plugin.inc.php');
15-
1615
}
1716

1817
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
INSERT IGNORE INTO `dns_ssl_ca` (`id`, `sys_userid`, `sys_groupid`, `sys_perm_user`, `sys_perm_group`, `sys_perm_other`, `active`, `ca_name`, `ca_issue`, `ca_wildcard`, `ca_iodef`, `ca_critical`) VALUES
2+
(NULL, 1, 1, 'riud', 'riud', '', 'Y', 'Amazon Trust Services', 'amazontrust.com', 'Y', '', 0);
3+
4+
-- 5374-mail-last-accessed-frontend
5+
ALTER TABLE `mail_user` ADD `last_access` int(11) NULL DEFAULT NULL after `disabledoveadm`;
6+
7+
ALTER TABLE `web_domain` ADD `disable_symlinknotowner` enum('n','y') NOT NULL default 'n' AFTER `last_jailkit_hash`;
8+
UPDATE `web_domain` SET `backup_format_web` = 'tar_gzip' WHERE `backup_format_web` = 'rar';
9+
UPDATE `web_domain` SET `backup_format_db` = 'zip' WHERE `backup_format_db` = 'rar';
Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +0,0 @@
1-
INSERT IGNORE INTO `dns_ssl_ca` (`id`, `sys_userid`, `sys_groupid`, `sys_perm_user`, `sys_perm_group`, `sys_perm_other`, `active`, `ca_name`, `ca_issue`, `ca_wildcard`, `ca_iodef`, `ca_critical`) VALUES
2-
(NULL, 1, 1, 'riud', 'riud', '', 'Y', 'Amazon Trust Services', 'amazontrust.com', 'Y', '', 0);
3-
4-
-- 5374-mail-last-accessed-frontend
5-
ALTER TABLE `mail_user` ADD `last_access` int(11) NULL DEFAULT NULL after `disabledoveadm`;
6-
7-
ALTER TABLE `web_domain` ADD `disable_symlinknotowner` enum('n','y') NOT NULL default 'n' AFTER `last_jailkit_hash`;
8-
UPDATE `web_domain` SET `backup_format_web` = 'tar_gzip' WHERE `backup_format_web` = 'rar';
9-
UPDATE `web_domain` SET `backup_format_db` = 'zip' WHERE `backup_format_db` = 'rar';

install/tpl/system.ini.master

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ vhost_aliasdomains=n
3535
client_username_web_check_disabled=n
3636
backups_include_into_web_quota=n
3737
reseller_can_use_options=n
38-
web_php_options=no,fast-cgi,php-fpm
38+
web_php_options=no,php-fpm
3939
show_aps_menu=n
4040
client_protection=y
4141
ssh_authentication=

interface/lib/classes/auth.inc.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,13 @@ public function is_superadmin() {
5353
}
5454
}
5555

56+
public function is_reseller() {
57+
if($this->has_clients($_SESSION['s']['user']['userid'])) {
58+
return true;
59+
} else {
60+
return false;
61+
}
62+
}
5663
public function has_clients($userid) {
5764
global $app, $conf;
5865

interface/lib/classes/functions.inc.php

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -287,11 +287,33 @@ public function intval($string, $force_numeric = false) {
287287
* @return string - formated bytes
288288
*/
289289
public function formatBytes($size, $precision = 2) {
290+
// 0 is a special as it would give NAN otehrwise.
291+
if ($size == 0) {
292+
return 0;
293+
}
294+
290295
$base=log($size)/log(1024);
291296
$suffixes=array('', ' kB', ' MB', ' GB', ' TB');
292297
return round(pow(1024, $base-floor($base)), $precision).$suffixes[floor($base)];
293298
}
294299

300+
/**
301+
* Function to change bytes to kB, MB, GB or TB or the translated string 'Unlimited' for -1
302+
* @param int $size - size in bytes
303+
* @param int precicion - after-comma-numbers (default: 2)
304+
* @return string - formated bytes
305+
*/
306+
public function formatBytesOrUnlimited($size, $precision = 2) {
307+
global $app;
308+
309+
if ($size == -1) {
310+
return $app->lng('unlimited_txt');
311+
}
312+
else {
313+
return $this->formatBytes($size, $precision);
314+
}
315+
316+
}
295317

296318
/**
297319
* Normalize a path and strip duplicate slashes from it
@@ -652,6 +674,22 @@ public function func_client_cancel($client_id,$cancel) {
652674
return $result;
653675
}
654676

677+
/**
678+
* Lookup a client's group + all groups he is reselling.
679+
*
680+
* @return string Comma separated list of groupid's
681+
*/
682+
function clientid_to_groups_list($client_id) {
683+
global $app;
684+
685+
if ($client_id != null) {
686+
// Get the clients groupid, and incase it's a reseller the groupid's of it's clients.
687+
$group = $app->db->queryOneRecord("SELECT GROUP_CONCAT(groupid) AS groups FROM `sys_group` WHERE client_id IN (SELECT client_id FROM `client` WHERE client_id=? OR parent_client_id=?)", $client_id, $client_id);
688+
return $group['groups'];
689+
}
690+
return null;
691+
}
692+
655693
}
656694

657695
?>

interface/lib/classes/quota_lib.inc.php

Lines changed: 22 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,10 @@ public function get_quota_data($clientid = null, $readable = true) {
1414
//print_r($monitor_data);
1515

1616
// select all websites or websites belonging to client
17-
$sites = $app->db->queryAllRecords("SELECT * FROM web_domain WHERE active = 'y' AND type = 'vhost'".(($clientid != null)?" AND sys_groupid = (SELECT default_group FROM sys_user WHERE client_id=?)":'') . " ORDER BY domain", $clientid);
17+
$q = "SELECT * FROM web_domain WHERE type = 'vhost' AND ";
18+
$q .= $app->tform->getAuthSQL('r', '', '', $app->functions->clientid_to_groups_list($clientid));
19+
$q .= " ORDER BY domain";
20+
$sites = $app->db->queryAllRecords($q, $clientid);
1821

1922
//print_r($sites);
2023
if(is_array($sites) && !empty($sites)){
@@ -36,9 +39,10 @@ public function get_quota_data($clientid = null, $readable = true) {
3639
if (!is_numeric($sites[$i]['hard'])) $sites[$i]['hard']=$sites[$i]['hard'][1];
3740
if (!is_numeric($sites[$i]['files'])) $sites[$i]['files']=$sites[$i]['files'][1];
3841

39-
$sites[$i]['used_raw'] = $sites[$i]['used'];
40-
$sites[$i]['soft_raw'] = $sites[$i]['soft'];
41-
$sites[$i]['hard_raw'] = $sites[$i]['hard'];
42+
// Convert from kb to bytes, and use -1 for instead of 0 for Unlimited.
43+
$sites[$i]['used_raw'] = $sites[$i]['used'] * 1024;
44+
$sites[$i]['soft_raw'] = ($sites[$i]['soft'] > 0) ? $sites[$i]['soft'] * 1024 : -1;
45+
$sites[$i]['hard_raw'] = ($sites[$i]['hard'] > 0) ? $sites[$i]['hard'] * 1024 : -1;
4246
$sites[$i]['files_raw'] = $sites[$i]['files'];
4347
$sites[$i]['used_percentage'] = ($sites[$i]['soft'] > 0 && $sites[$i]['used'] > 0 ? round($sites[$i]['used'] * 100 / $sites[$i]['soft']) : 0);
4448

@@ -53,43 +57,14 @@ public function get_quota_data($clientid = null, $readable = true) {
5357
if($used_ratio >= 0.8) $sites[$i]['display_colour'] = '#fd934f';
5458
if($used_ratio >= 1) $sites[$i]['display_colour'] = '#cc0000';
5559

56-
if($sites[$i]['used'] > 1024) {
57-
$sites[$i]['used'] = round($sites[$i]['used'] / 1024, 1).' MB';
58-
} else {
59-
if ($sites[$i]['used'] != '') $sites[$i]['used'] .= ' KB';
60-
}
61-
62-
if($sites[$i]['soft'] > 1024) {
63-
$sites[$i]['soft'] = round($sites[$i]['soft'] / 1024, 1).' MB';
64-
} else {
65-
$sites[$i]['soft'] .= ' KB';
66-
}
67-
68-
if($sites[$i]['hard'] > 1024) {
69-
$sites[$i]['hard'] = round($sites[$i]['hard'] / 1024, 1).' MB';
70-
} else {
71-
$sites[$i]['hard'] .= ' KB';
72-
}
73-
74-
if($sites[$i]['soft'] == " KB") $sites[$i]['soft'] = $app->lng('unlimited_txt');
75-
if($sites[$i]['hard'] == " KB") $sites[$i]['hard'] = $app->lng('unlimited_txt');
76-
77-
if($sites[$i]['soft'] == '0 B' || $sites[$i]['soft'] == '0 KB' || $sites[$i]['soft'] == '0') $sites[$i]['soft'] = $app->lng('unlimited_txt');
78-
if($sites[$i]['hard'] == '0 B' || $sites[$i]['hard'] == '0 KB' || $sites[$i]['hard'] == '0') $sites[$i]['hard'] = $app->lng('unlimited_txt');
7960

8061
/*
8162
if(!strstr($sites[$i]['used'],'M') && !strstr($sites[$i]['used'],'K')) $sites[$i]['used'].= ' B';
8263
if(!strstr($sites[$i]['soft'],'M') && !strstr($sites[$i]['soft'],'K')) $sites[$i]['soft'].= ' B';
8364
if(!strstr($sites[$i]['hard'],'M') && !strstr($sites[$i]['hard'],'K')) $sites[$i]['hard'].= ' B';
8465
*/
8566
}
86-
else {
87-
if (empty($sites[$i]['soft'])) $sites[$i]['soft'] = -1;
88-
if (empty($sites[$i]['hard'])) $sites[$i]['hard'] = -1;
8967

90-
if($sites[$i]['soft'] == '0 B' || $sites[$i]['soft'] == '0 KB' || $sites[$i]['soft'] == '0') $sites[$i]['soft'] = -1;
91-
if($sites[$i]['hard'] == '0 B' || $sites[$i]['hard'] == '0 KB' || $sites[$i]['hard'] == '0') $sites[$i]['hard'] = -1;
92-
}
9368
}
9469
}
9570

@@ -245,7 +220,10 @@ public function get_mailquota_data($clientid = null, $readable = true, $email =
245220

246221
}
247222
// select all email accounts or email accounts belonging to client
248-
$emails = $app->db->queryAllRecords("SELECT * FROM mail_user".(($clientid != null)? " WHERE sys_groupid = (SELECT default_group FROM sys_user WHERE client_id=?)" : '') . " ORDER BY email", $clientid);
223+
$q = "SELECT * FROM mail_user WHERE";
224+
$q .= $app->tform->getAuthSQL('r', '', '', $app->functions->clientid_to_groups_list($clientid));
225+
$q .= " ORDER BY email";
226+
$emails = $app->db->queryAllRecords($q, $clientid);
249227

250228
//print_r($emails);
251229
if(is_array($emails) && !empty($emails)) {
@@ -280,17 +258,8 @@ public function get_mailquota_data($clientid = null, $readable = true, $email =
280258
if($used_ratio >= 0.8) $emails[$i]['display_colour'] = '#fd934f';
281259
if($used_ratio >= 1) $emails[$i]['display_colour'] = '#cc0000';
282260

283-
if($emails[$i]['quota'] == 0){
284-
$emails[$i]['quota'] = $app->lng('unlimited_txt');
285-
} else {
286-
$emails[$i]['quota'] = round($emails[$i]['quota'] / 1048576, 1).' MB';
287-
}
288-
289-
290-
if($emails[$i]['used'] < 1544000) {
291-
$emails[$i]['used'] = round($emails[$i]['used'] / 1024, 1).' KB';
292-
} else {
293-
$emails[$i]['used'] = round($emails[$i]['used'] / 1048576, 1).' MB';
261+
if($emails[$i]['quota'] == 0) {
262+
$emails[$i]['quota'] = -1;
294263
}
295264
}
296265
}
@@ -317,18 +286,21 @@ public function get_databasequota_data($clientid = null, $readable = true) {
317286
//print_r($monitor_data);
318287

319288
// select all databases belonging to client
320-
$databases = $app->db->queryAllRecords("SELECT * FROM web_database".(($clientid != null)? " WHERE sys_groupid = (SELECT default_group FROM sys_user WHERE client_id=?)" : '') . " ORDER BY database_name", $clientid);
289+
$q = "SELECT * FROM web_database WHERE";
290+
$q .= $app->tform->getAuthSQL('r', '', '', $app->functions->clientid_to_groups_list($clientid));
291+
$q .= " ORDER BY database_name";
292+
$databases = $app->db->queryAllRecords($q);
321293

322294
//print_r($databases);
323295
if(is_array($databases) && !empty($databases)){
324296
for($i=0;$i<sizeof($databases);$i++){
325297
$databasename = $databases[$i]['database_name'];
326298

327-
$databases[$i]['used'] = isset($monitor_data[$databasename]['size']) ? $monitor_data[$databasename]['size'] : 0;
299+
$size = isset($monitor_data[$databasename]['size']) ? $monitor_data[$databasename]['size'] : 0;
328300

329-
$databases[$i]['quota_raw'] = $databases[$i]['database_quota'];
330-
$databases[$i]['used_raw'] = $databases[$i]['used'] / 1024 / 1024; //* quota is stored as MB - calculated bytes
331-
$databases[$i]['used_percentage'] = (($databases[$i]['database_quota'] > 0) && ($databases[$i]['used'] > 0)) ? round($databases[$i]['used_raw'] * 100 / $databases[$i]['database_quota']) : 0;
301+
$databases[$i]['database_quota_raw'] = ($databases[$i]['database_quota'] == -1) ? -1 : $databases[$i]['database_quota'] * 1000 * 1000;
302+
$databases[$i]['used_raw'] = $size; // / 1024 / 1024; //* quota is stored as MB - calculated bytes
303+
$databases[$i]['used_percentage'] = (($databases[$i]['database_quota'] > 0) && ($size > 0)) ? round($databases[$i]['used_raw'] * 100 / $databases[$i]['database_quota_raw']) : 0;
332304

333305
if ($readable) {
334306
// colours
@@ -341,18 +313,8 @@ public function get_databasequota_data($clientid = null, $readable = true) {
341313
if($used_ratio >= 0.8) $databases[$i]['display_colour'] = '#fd934f';
342314
if($used_ratio >= 1) $databases[$i]['display_colour'] = '#cc0000';
343315

344-
if($databases[$i]['database_quota'] == -1) {
345-
$databases[$i]['database_quota'] = $app->lng('unlimited_txt');
346-
} else {
347-
$databases[$i]['database_quota'] = $databases[$i]['database_quota'] . ' MB';
348-
}
349316

350317

351-
if($databases[$i]['used'] < 1544000) {
352-
$databases[$i]['used'] = round($databases[$i]['used'] / 1024, 1).' KB';
353-
} else {
354-
$databases[$i]['used'] = round($databases[$i]['used'] / 1048576, 1).' MB';
355-
}
356318
}
357319
}
358320
}

interface/web/client/client_edit.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ function onShowEdit() {
8282
chdir('../dashboard');
8383

8484
$dashlet_list = array();
85-
$dashlets = array('databasequota.php', 'limits.php', 'mailquota.php', 'quota.php');
85+
$dashlets = array('quota.php', 'databasequota.php', 'mailquota.php', 'limits.php');
8686
$current_client_id = $this->id;
8787

8888
foreach ($dashlets as $file) {

interface/web/client/form/reseller.tform.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
$form["db_table"] = "client";
4747
$form["db_table_idx"] = "client_id";
4848
$form["db_history"] = "yes";
49-
$form["tab_default"] = "address";
49+
$form["tab_default"] = "info";
5050
$form["list_default"] = "reseller_list.php";
5151
$form["auth"] = 'yes';
5252

@@ -81,6 +81,12 @@
8181
}
8282
}
8383

84+
$form["tabs"]['info'] = array(
85+
'title' => "Info",
86+
'width' => 100,
87+
'template' => "templates/reseller_edit_info.htm",
88+
'fields' => array()
89+
);
8490
$form["tabs"]['address'] = array (
8591
'title' => "Address",
8692
'width' => 100,

0 commit comments

Comments
 (0)