Skip to content

Commit c249fd1

Browse files
author
Till Brehm
committed
Merge branch 'stable-3.1' into 'stable-3.1'
stats Folder created even when Statistics set to none - Fixes #4977 See merge request ispconfig/ispconfig3!885
2 parents 5d019bf + 9768d64 commit c249fd1

File tree

3 files changed

+30
-18
lines changed

3 files changed

+30
-18
lines changed

interface/web/client/client_message.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,18 +71,18 @@
7171
$where[] = 'client_id = '.$app->functions->intval($tmp_client_id);
7272
}
7373
if(!empty($where)) $where_clause = ' AND ('.implode(' OR ', $where).')';
74-
$sql = "SELECT * FROM client WHERE email != ''".$where_clause;
74+
$sql = "SELECT * FROM client WHERE canceled != 'y' AND email != ''".$where_clause;
7575
} else {
76-
$sql = "SELECT * FROM client WHERE 0";
76+
$sql = "SELECT * FROM client WHERE canceled != 'y'";
7777
}
7878
} else {
7979
//* Select all clients and resellers
8080
if($_SESSION["s"]["user"]["typ"] == 'admin'){
81-
$sql = "SELECT * FROM client WHERE email != ''";
81+
$sql = "SELECT * FROM client WHERE email != '' AND canceled != 'y'";
8282
} else {
8383
$client_id = $app->functions->intval($_SESSION['s']['user']['client_id']);
8484
if($client_id == 0) die('Invalid Client ID.');
85-
$sql = "SELECT * FROM client WHERE email != '' AND parent_client_id = '$client_id'";
85+
$sql = "SELECT * FROM client WHERE email != '' AND canceled != 'y' AND parent_client_id = '$client_id'";
8686
}
8787
}
8888

server/plugins-available/apache2_plugin.inc.php

Lines changed: 21 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1801,21 +1801,23 @@ function update($event_name, $data) {
18011801

18021802
//* Create .htaccess and .htpasswd file for website statistics
18031803
//if(!is_file($data['new']['document_root'].'/' . $web_folder . '/stats/.htaccess') or $data['old']['document_root'] != $data['new']['document_root']) {
1804-
if(!is_dir($data['new']['document_root'].'/' . $web_folder . '/stats')) $app->system->mkdir($data['new']['document_root'].'/' . $web_folder . '/stats');
1805-
$ht_file = "AuthType Basic\nAuthName \"Members Only\"\nAuthUserFile ".$data['new']['document_root']."/web/stats/.htpasswd_stats\nrequire valid-user";
1806-
$app->system->file_put_contents($data['new']['document_root'].'/' . $web_folder . '/stats/.htaccess', $ht_file);
1807-
$app->system->chmod($data['new']['document_root'].'/' . $web_folder . '/stats/.htaccess', 0755);
1808-
unset($ht_file);
1809-
//}
18101804

1811-
if(!is_file($data['new']['document_root'].'/web/stats/.htpasswd_stats') || $data['new']['stats_password'] != $data['old']['stats_password']) {
1812-
if(trim($data['new']['stats_password']) != '') {
1813-
$htp_file = 'admin:'.trim($data['new']['stats_password']);
1814-
$app->system->web_folder_protection($data['new']['document_root'], false);
1815-
$app->system->file_put_contents($data['new']['document_root'].'/web/stats/.htpasswd_stats', $htp_file);
1816-
$app->system->web_folder_protection($data['new']['document_root'], true);
1817-
$app->system->chmod($data['new']['document_root'].'/web/stats/.htpasswd_stats', 0755);
1818-
unset($htp_file);
1805+
if($data['new']['stats_type'] != '') {
1806+
if(!is_dir($data['new']['document_root'].'/' . $web_folder . '/stats')) $app->system->mkdir($data['new']['document_root'].'/' . $web_folder . '/stats');
1807+
$ht_file = "AuthType Basic\nAuthName \"Members Only\"\nAuthUserFile ".$data['new']['document_root']."/web/stats/.htpasswd_stats\nrequire valid-user";
1808+
$app->system->file_put_contents($data['new']['document_root'].'/' . $web_folder . '/stats/.htaccess', $ht_file);
1809+
$app->system->chmod($data['new']['document_root'].'/' . $web_folder . '/stats/.htaccess', 0755);
1810+
unset($ht_file);
1811+
1812+
if(!is_file($data['new']['document_root'].'/web/stats/.htpasswd_stats') || $data['new']['stats_password'] != $data['old']['stats_password']) {
1813+
if(trim($data['new']['stats_password']) != '') {
1814+
$htp_file = 'admin:'.trim($data['new']['stats_password']);
1815+
$app->system->web_folder_protection($data['new']['document_root'], false);
1816+
$app->system->file_put_contents($data['new']['document_root'].'/web/stats/.htpasswd_stats', $htp_file);
1817+
$app->system->web_folder_protection($data['new']['document_root'], true);
1818+
$app->system->chmod($data['new']['document_root'].'/web/stats/.htpasswd_stats', 0755);
1819+
unset($htp_file);
1820+
}
18191821
}
18201822
}
18211823

@@ -1824,6 +1826,11 @@ function update($event_name, $data) {
18241826
$this->awstats_update($data, $web_config);
18251827
}
18261828

1829+
//* Remove Stats-Folder when Statistics set to none
1830+
if($data['new']['stats_type'] == '' && ($data['new']['type'] == 'vhost' || $data['new']['type'] == 'vhostsubdomain' || $data['new']['type'] == 'vhostalias')) {
1831+
$app->file->removeDirectory($data['new']['document_root'].'/web/stats');
1832+
}
1833+
18271834
$this->php_fpm_pool_update($data, $web_config, $pool_dir, $pool_name, $socket_dir, $web_folder);
18281835
$this->hhvm_update($data, $web_config);
18291836

server/plugins-available/nginx_plugin.inc.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1889,6 +1889,11 @@ function update($event_name, $data) {
18891889
$this->awstats_update($data, $web_config);
18901890
}
18911891

1892+
//* Remove Stats-Folder when Statistics set to none
1893+
if($data['new']['stats_type'] == '' && ($data['new']['type'] == 'vhost' || $data['new']['type'] == 'vhostsubdomain' || $data['new']['type'] == 'vhostalias')) {
1894+
$app->file->removeDirectory($data['new']['document_root'].'/web/stats');
1895+
}
1896+
18921897
$this->php_fpm_pool_update($data, $web_config, $pool_dir, $pool_name, $socket_dir, $web_folder);
18931898
$this->hhvm_update($data, $web_config);
18941899

0 commit comments

Comments
 (0)