diff --git a/install/tpl/system.ini.master b/install/tpl/system.ini.master index 42a003b9c1179f236ca2e843470bd457d158e5c7..c916a6254792bb55369f825a462ad9e40b22f997 100644 --- a/install/tpl/system.ini.master +++ b/install/tpl/system.ini.master @@ -33,6 +33,7 @@ vhost_aliasdomains=n client_username_web_check_disabled=n backups_include_into_web_quota=n reseller_can_use_options=n +web_php_options=no,fast-cgi,mod,php-fpm [tools] diff --git a/interface/lib/classes/tform_base.inc.php b/interface/lib/classes/tform_base.inc.php index 36de1371ab25fabe07d908f431ce8bb9016a8833..e6174d2da763556a2a3f94f8ad4ccb57fba3cbbd 100644 --- a/interface/lib/classes/tform_base.inc.php +++ b/interface/lib/classes/tform_base.inc.php @@ -336,69 +336,84 @@ class tform_base { } //* If the parameter 'valuelimit' is set - function applyValueLimit($limit, $values) { + function applyValueLimit($limit, $values, $current_value = '') { global $app; + + // we mas have multiple limits, therefore we explode by ; first + // Example: "system:sites:web_php_options;client:web_php_options" + $limits = explode(';',$limit); + + + foreach($limits as $limit) { - $limit_parts = explode(':', $limit); + $limit_parts = explode(':', $limit); - //* values are limited to a comma separated list - if($limit_parts[0] == 'list') { - $allowed = explode(',', $limit_parts[1]); - } - - //* values are limited to a field in the client settings - if($limit_parts[0] == 'client') { - if($_SESSION["s"]["user"]["typ"] == 'admin') { - return $values; - } else { - $client_group_id = $_SESSION["s"]["user"]["default_group"]; - $client = $app->db->queryOneRecord("SELECT ".$limit_parts[1]." as lm FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = ?", $client_group_id); - $allowed = explode(',', $client['lm']); + //* values are limited to a comma separated list + if($limit_parts[0] == 'list') { + $allowed = explode(',', $limit_parts[1]); } - } - //* values are limited to a field in the reseller settings - if($limit_parts[0] == 'reseller') { - if($_SESSION["s"]["user"]["typ"] == 'admin') { - return $values; - } else { - //* Get the limits of the client that is currently logged in - $client_group_id = $_SESSION["s"]["user"]["default_group"]; - $client = $app->db->queryOneRecord("SELECT parent_client_id FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = ?", $client_group_id); - //echo "SELECT parent_client_id FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id"; - //* If the client belongs to a reseller, we will check against the reseller Limit too - if($client['parent_client_id'] != 0) { - - //* first we need to know the groups of this reseller - $tmp = $app->db->queryOneRecord("SELECT userid, groups FROM sys_user WHERE client_id = ?", $client['parent_client_id']); - $reseller_groups = $tmp["groups"]; - $reseller_userid = $tmp["userid"]; - - // Get the limits of the reseller of the logged in client - $client_group_id = $_SESSION["s"]["user"]["default_group"]; - $reseller = $app->db->queryOneRecord("SELECT ".$limit_parts[1]." as lm FROM client WHERE client_id = ?", $client['parent_client_id']); - $allowed = explode(',', $reseller['lm']); - } else { + //* values are limited to a field in the client settings + if($limit_parts[0] == 'client') { + if($_SESSION["s"]["user"]["typ"] == 'admin') { return $values; + } else { + $client_group_id = $_SESSION["s"]["user"]["default_group"]; + $client = $app->db->queryOneRecord("SELECT ".$limit_parts[1]." as lm FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = ?", $client_group_id); + $allowed = explode(',', $client['lm']); } - } // end if admin - } // end if reseller - - //* values are limited to a field in the system settings - if($limit_parts[0] == 'system') { - $app->uses('getconf'); - $tmp_conf = $app->getconf->get_global_config($limit_parts[1]); - $tmp_key = $limit_parts[2]; - $allowed = $tmp_conf[$tmp_key]; - } + } + + //* values are limited to a field in the reseller settings + if($limit_parts[0] == 'reseller') { + if($_SESSION["s"]["user"]["typ"] == 'admin') { + return $values; + } else { + //* Get the limits of the client that is currently logged in + $client_group_id = $_SESSION["s"]["user"]["default_group"]; + $client = $app->db->queryOneRecord("SELECT parent_client_id FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = ?", $client_group_id); + //echo "SELECT parent_client_id FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id"; + //* If the client belongs to a reseller, we will check against the reseller Limit too + if($client['parent_client_id'] != 0) { + + //* first we need to know the groups of this reseller + $tmp = $app->db->queryOneRecord("SELECT userid, groups FROM sys_user WHERE client_id = ?", $client['parent_client_id']); + $reseller_groups = $tmp["groups"]; + $reseller_userid = $tmp["userid"]; + + // Get the limits of the reseller of the logged in client + $client_group_id = $_SESSION["s"]["user"]["default_group"]; + $reseller = $app->db->queryOneRecord("SELECT ".$limit_parts[1]." as lm FROM client WHERE client_id = ?", $client['parent_client_id']); + $allowed = explode(',', $reseller['lm']); + } else { + return $values; + } + } // end if admin + } // end if reseller + + //* values are limited to a field in the system settings + if($limit_parts[0] == 'system') { + $app->uses('getconf'); + $tmp_conf = $app->getconf->get_global_config($limit_parts[1]); + $tmp_key = $limit_parts[2]; + $allowed = $allowed = explode(',',$tmp_conf[$tmp_key]); + } + + // add the current value to the allowed array + $allowed[] = $current_value; + + // remove all values that are not allowed + $values_new = array(); + foreach($values as $key => $val) { + if(in_array($key, $allowed)) $values_new[$key] = $val; + } + + $values = $values_new; - $values_new = array(); - foreach($values as $key => $val) { - if(in_array($key, $allowed)) $values_new[$key] = $val; } - return $values_new; + return $values; } @@ -464,7 +479,7 @@ class tform_base { // If a limitation for the values is set if(isset($field['valuelimit']) && is_array($field["value"])) { - $field["value"] = $this->applyValueLimit($field['valuelimit'], $field["value"]); + $field["value"] = $this->applyValueLimit($field['valuelimit'], $field["value"], $val); } switch ($field['formtype']) { @@ -599,7 +614,7 @@ class tform_base { // If a limitation for the values is set if(isset($field['valuelimit']) && is_array($field["value"])) { - $field["value"] = $this->applyValueLimit($field['valuelimit'], $field["value"]); + $field["value"] = $this->applyValueLimit($field['valuelimit'], $field["value"], $field['default']); } switch ($field['formtype']) { diff --git a/interface/web/admin/form/system_config.tform.php b/interface/web/admin/form/system_config.tform.php index d718e4ef8221fe73788d8ab6fc2eaec82a692c75..3fe7f0c7e3cd2b5627a0f8c60f3a432a97f04c3d 100644 --- a/interface/web/admin/form/system_config.tform.php +++ b/interface/web/admin/form/system_config.tform.php @@ -200,6 +200,16 @@ $form["tabs"]['sites'] = array ( 'value' => '', 'name' => 'default_dbserver' ), + 'web_php_options' => array ( + 'datatype' => 'VARCHAR', + 'formtype' => 'CHECKBOXARRAY', + 'validators' => array ( 0 => array ( 'type' => 'NOTEMPTY', + 'errmsg'=> 'web_php_options_notempty'), + ), + 'default' => '', + 'separator' => ',', + 'value' => array('no' => 'Disabled', 'fast-cgi' => 'Fast-CGI', 'cgi' => 'CGI', 'mod' => 'Mod-PHP', 'suphp' => 'SuPHP', 'php-fpm' => 'PHP-FPM', 'hhvm' => 'HHVM') + ), //################################# // ENDE Datatable fields //################################# diff --git a/interface/web/admin/lib/lang/de_system_config.lng b/interface/web/admin/lib/lang/de_system_config.lng index 0771322ef951a228046a932c1bdaa45875e34dfc..59a3e8d11159a141d811c667e154b559e14aab45 100644 --- a/interface/web/admin/lib/lang/de_system_config.lng +++ b/interface/web/admin/lib/lang/de_system_config.lng @@ -89,4 +89,5 @@ $wb['ca_iodef_txt'] = 'iodef'; $wb['active_txt'] = 'Aktiv'; $wb['btn_save_txt'] = 'Speichern'; $wb['btn_cancel_txt'] = 'Abbrechen'; +$wb['web_php_options_txt'] = 'PHP Handler (Nur Apache)'; ?> diff --git a/interface/web/admin/lib/lang/en_system_config.lng b/interface/web/admin/lib/lang/en_system_config.lng index 29732e4169fe04cc2ab3cba6ce6e961b2f6eb758..ef34493c9daed786fa16f342b056de52c3b58234 100644 --- a/interface/web/admin/lib/lang/en_system_config.lng +++ b/interface/web/admin/lib/lang/en_system_config.lng @@ -92,4 +92,5 @@ $wb['ca_iodef_txt'] = 'iodef'; $wb['active_txt'] = 'Active'; $wb['btn_save_txt'] = 'Save'; $wb['btn_cancel_txt'] = 'Cancel'; +$wb['web_php_options_txt'] = 'PHP Handler (Apache only)'; ?> diff --git a/interface/web/admin/lib/lang/es_system_config.lng b/interface/web/admin/lib/lang/es_system_config.lng index 21575571f000e3c10baa7b2317652b06be78ef27..6dc07dfd5b20fe8357b076c90d04b9285f482267 100755 --- a/interface/web/admin/lib/lang/es_system_config.lng +++ b/interface/web/admin/lib/lang/es_system_config.lng @@ -89,4 +89,5 @@ $wb['ca_iodef_txt'] = 'iodef'; $wb['active_txt'] = 'Aktive'; $wb['btn_save_txt'] = 'Save'; $wb['btn_cancel_txt'] = 'Cancel'; +$wb['web_php_options_txt'] = 'PHP Handler (Apache only)'; ?> diff --git a/interface/web/admin/templates/server_config_web_edit.htm b/interface/web/admin/templates/server_config_web_edit.htm index 8cc8dc4340bc11e65d507a3ae53a8b945e3eda97..8231e45cb7539d4d7a19ee095d94152f9bba2000 100644 --- a/interface/web/admin/templates/server_config_web_edit.htm +++ b/interface/web/admin/templates/server_config_web_edit.htm @@ -256,7 +256,7 @@
-
+
diff --git a/interface/web/admin/templates/system_config_sites_edit.htm b/interface/web/admin/templates/system_config_sites_edit.htm index 1c4c5c6f9a19b924f283c3cf767b25f6ff40ddd8..a0f95e479a36bcdf336a5b723a6bae4a2c04cc7a 100644 --- a/interface/web/admin/templates/system_config_sites_edit.htm +++ b/interface/web/admin/templates/system_config_sites_edit.htm @@ -63,6 +63,12 @@ {tmpl_var name='reseller_can_use_options'}
+
+ +
+ {tmpl_var name='web_php_options'} +
+