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']);
$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']."'";
}
else
{
$domainresult = $db->query("SELECT * FROM `" . TABLE_PANEL_DOMAINS . "` WHERE `phpsettingid` = " . (int)$row['id']);
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).")";
}
}
$domainresult = $db->query($query);
$domains = '';
if($db->num_rows($domainresult) > 0)
{
while($row2 = $db->fetch_array($domainresult))
{
if ($db->num_rows($domainresult) > 0) {
while ($row2 = $db->fetch_array($domainresult)) {
$domains.= $row2['domain'] . '<br/>';
}
}
else
{
} 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

@@ -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") . "\";");
@@ -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.';