don't show subdomains in php-configuration-overview + allow to hide standard-subdomains (they are full-domains) via panel-setting; fixes #744

Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
This commit is contained in:
Michael Kaufmann (d00p)
2013-04-14 11:10:51 +02:00
parent 79b2adea16
commit 1c0937f29b
9 changed files with 93 additions and 42 deletions

View File

@@ -194,6 +194,14 @@ return array(
'default' => false,
'save_method' => 'storeSettingField',
),
'panel_phpconfigs_hidestdsubdomain' => array(
'label' => $lng['serversettings']['panel_phpconfigs_hidestdsubdomain'],
'settinggroup' => 'panel',
'varname' => 'phpconfigs_hidestdsubdomain',
'type' => 'bool',
'default' => false,
'save_method' => 'storeSettingField',
),
),
),
),

View File

@@ -25,47 +25,54 @@ define('AREA', 'admin');
require ("./lib/init.php");
if(isset($_POST['id']))
{
if (isset($_POST['id'])) {
$id = intval($_POST['id']);
}
elseif(isset($_GET['id']))
{
} elseif (isset($_GET['id'])) {
$id = intval($_GET['id']);
}
if($page == 'overview')
{
if($action == '')
{
if ($page == 'overview') {
if ($action == '') {
$tablecontent = '';
$count = 0;
$result = $db->query("SELECT * FROM `" . TABLE_PANEL_PHPCONFIGS . "`");
while($row = $db->fetch_array($result))
{
while ($row = $db->fetch_array($result)) {
$domainresult = false;
if((int)$userinfo['domains_see_all'] == 0)
{
$domainresult = $db->query("SELECT * FROM `" . TABLE_PANEL_DOMAINS . "` WHERE `adminid` = " . (int)$userinfo['userid'] . " AND `phpsettingid` = " . (int)$row['id']);
}
else
{
$domainresult = $db->query("SELECT * FROM `" . TABLE_PANEL_DOMAINS . "` WHERE `phpsettingid` = " . (int)$row['id']);
$query = "SELECT * FROM `".TABLE_PANEL_DOMAINS."`
WHERE `phpsettingid` = '".(int)$row['id']."'
AND `parentdomainid` = '0'";
if ((int)$userinfo['domains_see_all'] == 0) {
$query .= " AND `adminid` = '".(int)$userinfo['userid']."'";
}
$domains = '';
if($db->num_rows($domainresult) > 0)
{
while($row2 = $db->fetch_array($domainresult))
{
$domains.= $row2['domain'] . '<br/>';
if ((int)$settings['panel']['phpconfigs_hidestdsubdomain'] == 1) {
$query2 = "SELECT DISTINCT `standardsubdomain`
FROM `".TABLE_PANEL_CUSTOMERS."`
WHERE `standardsubdomain` > 0 ORDER BY `standardsubdomain` ASC;";
$ssdids_res = $db->query($query2);
$ssdids = array();
while ($ssd = $db->fetch_array($ssdids_res)) {
$ssdids[] = $ssd['standardsubdomain'];
}
if (count($ssdids) > 0) {
$query .= " AND `id` NOT IN (".implode(', ', $ssdids).")";
}
}
else
{
$domainresult = $db->query($query);
$domains = '';
if ($db->num_rows($domainresult) > 0) {
while ($row2 = $db->fetch_array($domainresult)) {
$domains.= $row2['domain'] . '<br/>';
}
} else {
$domains = $lng['admin']['phpsettings']['notused'];
}

View File

@@ -534,7 +534,8 @@ INSERT INTO `panel_settings` (`settinggroup`, `varname`, `value`) VALUES
('panel', 'password_regex', ''),
('panel', 'use_webfonts', '0'),
('panel', 'webfont', 'Numans'),
('panel', 'version', '0.9.28.1');
('panel', 'phpconfigs_hidestdsubdomain', '0'),
('panel', 'version', '0.9.29-dev1');

View File

@@ -2052,3 +2052,15 @@ if (isFroxlorVersion('0.9.28')) {
lastStepStatus(0);
updateToVersion('0.9.28.1');
}
if(isFroxlorVersion('0.9.28.1')) {
showUpdateStep("Updating from 0.9.28.1 to 0.9.29-dev1", true);
lastStepStatus(0);
$hide_stdsubdomains = isset($_POST['hide_stdsubdomains']) ? (int)$_POST['hide_stdsubdomains'] : '0';
showUpdateStep('Setting value for "hide standard subdomains"', true);
$db->query("INSERT INTO `panel_settings` (`settinggroup`, `varname`, `value`) VALUES ('panel', 'phpconfigs_hidestdsubdomain', '".$hide_stdsubdomains."');");
lastStepStatus(0);
updateToVersion('0.9.29-dev1');
}

View File

@@ -124,6 +124,7 @@ function version_compare2($a, $b) {
}
}
/*
if (count($a) > count($b)) {
if ($a[count($b)-1] == $b[count($b)-1]) {
return -1;
@@ -134,6 +135,7 @@ function version_compare2($a, $b) {
return 1;
}
}
*/
foreach ($a as $depth => $aVal) {
// iterate over each piece of A

View File

@@ -158,7 +158,7 @@ function parseAndOutputPreconfig(&$has_preconfig, &$return, $current_version)
$question.= makeyesno('update_defdns_mailentry', '1', '0', '0');
eval("\$return.=\"" . getTemplate("update/preconfigitem") . "\";");
}
if(versionInUpdate($current_version, '0.9.10-svn1'))
{
$has_nouser = false;
@@ -171,13 +171,13 @@ function parseAndOutputPreconfig(&$has_preconfig, &$return, $current_version)
$has_nouser = true;
$guessed_user = 'www-data';
if(function_exists('posix_getuid')
&& function_exists('posix_getpwuid')
&& function_exists('posix_getpwuid')
) {
$_httpuser = posix_getpwuid(posix_getuid());
$guessed_user = $_httpuser['name'];
}
}
$result = $db->query_first("SELECT * FROM `" . TABLE_PANEL_SETTINGS . "` WHERE `settinggroup` = 'system' AND `varname` = 'httpgroup'");
if(!isset($result) || !isset($result['value']))
{
@@ -185,7 +185,7 @@ function parseAndOutputPreconfig(&$has_preconfig, &$return, $current_version)
$has_nogroup = true;
$guessed_group = 'www-data';
if(function_exists('posix_getgid')
&& function_exists('posix_getgrgid')
&& function_exists('posix_getgrgid')
) {
$_httpgroup = posix_getgrgid(posix_getgid());
$guessed_group = $_httpgroup['name'];
@@ -198,8 +198,8 @@ function parseAndOutputPreconfig(&$has_preconfig, &$return, $current_version)
if($has_nouser)
{
$question = '<strong>Please enter the webservers username:</strong>&nbsp;<input type="text" class="text" name="update_httpuser" value="'.$guessed_user.'" />';
}
elseif($has_nogroup)
}
elseif($has_nogroup)
{
$question2 = '<strong>Please enter the webservers groupname:</strong>&nbsp;<input type="text" class="text" name="update_httpgroup" value="'.$guessed_group.'" />';
if($has_nouser) {
@@ -238,7 +238,7 @@ function parseAndOutputPreconfig(&$has_preconfig, &$return, $current_version)
$question.= '<input type="text" class="text" name="update_perlpath" value="/usr/bin/perl" />';
eval("\$return.=\"" . getTemplate("update/preconfigitem") . "\";");
}
if(versionInUpdate($current_version, '0.9.12-svn1'))
{
if($settings['system']['mod_fcgid'] == 1)
@@ -345,13 +345,13 @@ function parseAndOutputPreconfig(&$has_preconfig, &$return, $current_version)
}
if(versionInUpdate($current_version, '0.9.14-svn10'))
{
{
$has_preconfig = true;
$description = '<strong>This update removes the unsupported real-time option. Additionally the deprecated tables for navigation and cronscripts are removed, any modules using these tables need to be updated to the new structure!</strong>';
$description = '<strong>This update removes the unsupported real-time option. Additionally the deprecated tables for navigation and cronscripts are removed, any modules using these tables need to be updated to the new structure!</strong>';
$question = '';
eval("\$return.=\"" . getTemplate("update/preconfigitem") . "\";");
}
if(versionInUpdate($current_version, '0.9.16-svn1'))
{
$has_preconfig = true;
@@ -419,7 +419,7 @@ function parseAndOutputPreconfig(&$has_preconfig, &$return, $current_version)
if(versionInUpdate($current_version, '0.9.18-svn2'))
{
$has_preconfig = true;
$description = 'As you can (obviously) see, Froxlor now comes with a new theme. You also have the possibility to switch back to "Classic" if you want to.';
$description = 'As you can (obviously) see, Froxlor now comes with a new theme. You also have the possibility to switch back to "Classic" if you want to.';
$question = '<strong>Select default panel theme:</strong>&nbsp;';
$question.= '<select name="update_default_theme">';
$themes = getThemes();
@@ -458,7 +458,7 @@ function parseAndOutputPreconfig(&$has_preconfig, &$return, $current_version)
$has_preconfig = true;
$description = 'Froxlor now supports the new Apache 2.4. Please be aware that you need to load additional apache-modules in ordner to use it.<br />';
$description.= '<pre>LoadModule authz_core_module modules/mod_authz_core.so
LoadModule authz_host_module modules/mod_authz_host.so</pre><br />';
LoadModule authz_host_module modules/mod_authz_host.so</pre><br />';
$question = '<strong>Do you want to enable the Apache-2.4 modification?:</strong>&nbsp;';
$question.= makeyesno('update_system_apache24', '1', '0', '0');
eval("\$return.=\"" . getTemplate("update/preconfigitem") . "\";");
@@ -467,7 +467,7 @@ LoadModule authz_host_module modules/mod_authz_host.so</pre><br />';
$description = 'The path to nginx\'s fastcgi_params file is now customizable.<br /><br />';
$question = '<strong>Please enter full path to you nginx/fastcgi_params file (including filename):</strong>&nbsp;';
$question.= '<input type="text" class="text" name="nginx_fastcgi_params" value="/etc/nginx/fastcgi_params" />';
eval("\$return.=\"" . getTemplate("update/preconfigitem") . "\";");
eval("\$return.=\"" . getTemplate("update/preconfigitem") . "\";");
}
}
@@ -503,4 +503,17 @@ LoadModule authz_host_module modules/mod_authz_host.so</pre><br />';
eval("\$return.=\"" . getTemplate("update/preconfigitem") . "\";");
}
if (versionInUpdate($current_version, '0.9.29-dev1')) {
// we only need to ask if fcgid|php-fpm is enabled
if ($settings['system']['mod_fcgid'] == '1'
|| $settings['phpfpm']['enabled'] == '1'
) {
$has_preconfig = true;
$description = 'Standard-subdomains can now be hidden from the php-configuration overview.<br />';
$question = '<strong>Do you want to hide the standard-subdomains (this can be changed in the settings any time)?:</strong>&nbsp;';
$question.= makeyesno('hide_stdsubdomains', '1', '0', '0');
eval("\$return.=\"" . getTemplate("update/preconfigitem") . "\";");
}
}
}

View File

@@ -73,6 +73,6 @@ define('PACKAGE_ENABLED', 2);
// VERSION INFO
$version = '0.9.28.1';
$version = '0.9.29-dev1';
$dbversion = '2';
$branding = '';

View File

@@ -1932,3 +1932,7 @@ $lng['error']['setlessthanalreadyused'] = 'You cannot set less resources of \'%s
$lng['error']['stringmustntbeempty'] = 'The value for the field %s must not be empty';
$lng['admin']['domain_editable']['title'] = 'Allow editing of domain';
$lng['admin']['domain_editable']['desc'] = 'If set to yes, the customer is allowed to change several domain-settings.<br />If set to no, nothing can be changed by the customer.';
// Added in Froxlor 0.9.29-dev1
$lng['serversettings']['panel_phpconfigs_hidestdsubdomain']['title'] = 'Hide standard-subdomains in PHP-configuration overview';
$lng['serversettings']['panel_phpconfigs_hidestdsubdomain']['description'] = 'If activated the standard-subdomains for customers will not be displayed in the php-configurations overview<br /><br />Note: This is only visible if you have enabled FCGID or PHP-FPM';

View File

@@ -1653,3 +1653,7 @@ $lng['error']['setlessthanalreadyused'] = 'Es können nicht weniger Resourcen vo
$lng['error']['stringmustntbeempty'] = 'Der Wert für das Feld %s darf nicht leer sein';
$lng['admin']['domain_editable']['title'] = 'Erlaube Bearbeiten der Domain';
$lng['admin']['domain_editable']['desc'] = 'Wenn ja, darf der Kunde verschiedene Einstellungen anpassen.<br />Wenn nein, darf nichts durch den Kunden geändert werden.';
// Added in Froxlor 0.9.29-dev1
$lng['serversettings']['panel_phpconfigs_hidestdsubdomain']['title'] = 'Verstecke Standard-Subdomains in PHP-Konfigurations-Übersicht';
$lng['serversettings']['panel_phpconfigs_hidestdsubdomain']['description'] = 'Wenn aktiviert, werden die Standard-Subdomains der Kunden nicht mehr in der PHP-Konfigurations-Übersicht angezeigt.<br /><br />Hinweis: Nur relevant, wenn FCGID oder PHP-FPM aktiviert ist.';