Commit c249fd18 authored by Till Brehm's avatar Till Brehm

Merge branch 'stable-3.1' into 'stable-3.1'

stats Folder created even when Statistics set to none - Fixes #4977

See merge request !885
parents 5d019bf5 9768d64e
......@@ -71,18 +71,18 @@ if(isset($_POST) && count($_POST) > 1) {
$where[] = 'client_id = '.$app->functions->intval($tmp_client_id);
}
if(!empty($where)) $where_clause = ' AND ('.implode(' OR ', $where).')';
$sql = "SELECT * FROM client WHERE email != ''".$where_clause;
$sql = "SELECT * FROM client WHERE canceled != 'y' AND email != ''".$where_clause;
} else {
$sql = "SELECT * FROM client WHERE 0";
$sql = "SELECT * FROM client WHERE canceled != 'y'";
}
} else {
//* Select all clients and resellers
if($_SESSION["s"]["user"]["typ"] == 'admin'){
$sql = "SELECT * FROM client WHERE email != ''";
$sql = "SELECT * FROM client WHERE email != '' AND canceled != 'y'";
} else {
$client_id = $app->functions->intval($_SESSION['s']['user']['client_id']);
if($client_id == 0) die('Invalid Client ID.');
$sql = "SELECT * FROM client WHERE email != '' AND parent_client_id = '$client_id'";
$sql = "SELECT * FROM client WHERE email != '' AND canceled != 'y' AND parent_client_id = '$client_id'";
}
}
......
......@@ -1801,21 +1801,23 @@ class apache2_plugin {
//* Create .htaccess and .htpasswd file for website statistics
//if(!is_file($data['new']['document_root'].'/' . $web_folder . '/stats/.htaccess') or $data['old']['document_root'] != $data['new']['document_root']) {
if(!is_dir($data['new']['document_root'].'/' . $web_folder . '/stats')) $app->system->mkdir($data['new']['document_root'].'/' . $web_folder . '/stats');
$ht_file = "AuthType Basic\nAuthName \"Members Only\"\nAuthUserFile ".$data['new']['document_root']."/web/stats/.htpasswd_stats\nrequire valid-user";
$app->system->file_put_contents($data['new']['document_root'].'/' . $web_folder . '/stats/.htaccess', $ht_file);
$app->system->chmod($data['new']['document_root'].'/' . $web_folder . '/stats/.htaccess', 0755);
unset($ht_file);
//}
if(!is_file($data['new']['document_root'].'/web/stats/.htpasswd_stats') || $data['new']['stats_password'] != $data['old']['stats_password']) {
if(trim($data['new']['stats_password']) != '') {
$htp_file = 'admin:'.trim($data['new']['stats_password']);
$app->system->web_folder_protection($data['new']['document_root'], false);
$app->system->file_put_contents($data['new']['document_root'].'/web/stats/.htpasswd_stats', $htp_file);
$app->system->web_folder_protection($data['new']['document_root'], true);
$app->system->chmod($data['new']['document_root'].'/web/stats/.htpasswd_stats', 0755);
unset($htp_file);
if($data['new']['stats_type'] != '') {
if(!is_dir($data['new']['document_root'].'/' . $web_folder . '/stats')) $app->system->mkdir($data['new']['document_root'].'/' . $web_folder . '/stats');
$ht_file = "AuthType Basic\nAuthName \"Members Only\"\nAuthUserFile ".$data['new']['document_root']."/web/stats/.htpasswd_stats\nrequire valid-user";
$app->system->file_put_contents($data['new']['document_root'].'/' . $web_folder . '/stats/.htaccess', $ht_file);
$app->system->chmod($data['new']['document_root'].'/' . $web_folder . '/stats/.htaccess', 0755);
unset($ht_file);
if(!is_file($data['new']['document_root'].'/web/stats/.htpasswd_stats') || $data['new']['stats_password'] != $data['old']['stats_password']) {
if(trim($data['new']['stats_password']) != '') {
$htp_file = 'admin:'.trim($data['new']['stats_password']);
$app->system->web_folder_protection($data['new']['document_root'], false);
$app->system->file_put_contents($data['new']['document_root'].'/web/stats/.htpasswd_stats', $htp_file);
$app->system->web_folder_protection($data['new']['document_root'], true);
$app->system->chmod($data['new']['document_root'].'/web/stats/.htpasswd_stats', 0755);
unset($htp_file);
}
}
}
......@@ -1824,6 +1826,11 @@ class apache2_plugin {
$this->awstats_update($data, $web_config);
}
//* Remove Stats-Folder when Statistics set to none
if($data['new']['stats_type'] == '' && ($data['new']['type'] == 'vhost' || $data['new']['type'] == 'vhostsubdomain' || $data['new']['type'] == 'vhostalias')) {
$app->file->removeDirectory($data['new']['document_root'].'/web/stats');
}
$this->php_fpm_pool_update($data, $web_config, $pool_dir, $pool_name, $socket_dir, $web_folder);
$this->hhvm_update($data, $web_config);
......
......@@ -1889,6 +1889,11 @@ class nginx_plugin {
$this->awstats_update($data, $web_config);
}
//* Remove Stats-Folder when Statistics set to none
if($data['new']['stats_type'] == '' && ($data['new']['type'] == 'vhost' || $data['new']['type'] == 'vhostsubdomain' || $data['new']['type'] == 'vhostalias')) {
$app->file->removeDirectory($data['new']['document_root'].'/web/stats');
}
$this->php_fpm_pool_update($data, $web_config, $pool_dir, $pool_name, $socket_dir, $web_folder);
$this->hhvm_update($data, $web_config);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment