From bd4520e753ba2b3896ffaab1fb27ce2bafe74a9c Mon Sep 17 00:00:00 2001 From: hickert Date: Mon, 17 Sep 2007 11:50:28 +0000 Subject: [PATCH] Added gosa.conf(ig) flag 'save_filter'. if save_filter is 'true' the current filter settings will be stored in a seperate user cookie git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@7304 594d385d-05f5-0310-b6e9-bd551577e9d8 --- contrib/gosa.conf | 5 +++++ html/index.php | 14 ++++++++------ html/main.php | 10 ++++++---- setup/class_setupStep_Config3.inc | 3 ++- setup/setup_config3.tpl | 12 ++++++++++++ 5 files changed, 33 insertions(+), 11 deletions(-) diff --git a/contrib/gosa.conf b/contrib/gosa.conf index a7a4f2637..0de32e9a1 100644 --- a/contrib/gosa.conf +++ b/contrib/gosa.conf @@ -424,6 +424,11 @@ {/if} {if $cv.optional.auto_network_hook_active} auto_network_hook="{$cv.optional.auto_network_hook} " +{/if} +{if $cv.optional.user_filter_cookie} + save_filter="true" +{else} + save_filter="false" {/if} lang="{$cv.lang_selected}" theme="{$cv.theme}" diff --git a/html/index.php b/html/index.php index f525d267c..2f7a401ae 100644 --- a/html/index.php +++ b/html/index.php @@ -282,12 +282,14 @@ if ($_SERVER["REQUEST_METHOD"] == "POST" && isset($_POST['login'])){ /* Restore filter settings from cookie, if available */ - $cookie_vars= array("MultiDialogFilters","CurrentMainBase"); - foreach($cookie_vars as $var){ - if(isset($_COOKIE[$var])){ - $_SESSION[$var] = unserialize(base64_decode($_COOKIE[$var])); - }elseif(isset($HTTP_COOKIE_VARS[$var])){ - $_SESSION[$var] = unserialize(base64_decode($HTTP_COOKIE_VARS[$var])); + if(isset($config->data['MAIN']['SAVE_FILTER']) && preg_match("/true/",$config->data['MAIN']['SAVE_FILTER'])){ + $cookie_vars= array("MultiDialogFilters","CurrentMainBase"); + foreach($cookie_vars as $var){ + if(isset($_COOKIE[$var])){ + $_SESSION[$var] = unserialize(base64_decode($_COOKIE[$var])); + }elseif(isset($HTTP_COOKIE_VARS[$var])){ + $_SESSION[$var] = unserialize(base64_decode($HTTP_COOKIE_VARS[$var])); + } } } diff --git a/html/main.php b/html/main.php index a2db883eb..c56a23175 100644 --- a/html/main.php +++ b/html/main.php @@ -386,10 +386,12 @@ $display= $header.$smarty->fetch(get_template_path('framework.tpl')); /* Save dialog filters and selected base in a cookie. So we may be able to restore the filter an base settings on reload. */ -$cookie_vars = array("MultiDialogFilters","CurrentMainBase"); -foreach($cookie_vars as $var){ - if(isset($_SESSION[$var])){ - setcookie($var,base64_encode(serialize($_SESSION[$var])),time()+ 60*60*24*30); +if(isset($config->data['MAIN']['SAVE_FILTER']) && preg_match("/true/",$config->data['MAIN']['SAVE_FILTER'])){ + $cookie_vars = array("MultiDialogFilters","CurrentMainBase"); + foreach($cookie_vars as $var){ + if(isset($_SESSION[$var])){ + setcookie($var,base64_encode(serialize($_SESSION[$var])),time()+ 60*60*24*30); + } } } diff --git a/setup/class_setupStep_Config3.inc b/setup/class_setupStep_Config3.inc index 9148868ef..cb1d28c8a 100644 --- a/setup/class_setupStep_Config3.inc +++ b/setup/class_setupStep_Config3.inc @@ -33,6 +33,7 @@ class Step_Config3 extends setup_step "forcessl" => false, "ldapstats" => false, "warnssl" => true, + "user_filter_cookie" => true, "ppd_path" => "/var/spool/ppd/", "ppd_path_active" => FALSE, "compile" => "/var/spool/gosa", @@ -97,7 +98,7 @@ class Step_Config3 extends setup_step } } - foreach(array("list_summary","strict_units","noprimarygroup","forceglobals","forcessl","ldapstats","warnssl","compile","debuglevel","session_lifetime") as $name){ + foreach(array("list_summary","strict_units","noprimarygroup","forceglobals","forcessl","ldapstats","user_filter_cookie","warnssl","compile","debuglevel","session_lifetime") as $name){ if(isset($_POST[$name])){ $this->optional[$name] = get_post($name); } diff --git a/setup/setup_config3.tpl b/setup/setup_config3.tpl index 47c2a4230..724bae715 100644 --- a/setup/setup_config3.tpl +++ b/setup/setup_config3.tpl @@ -190,6 +190,18 @@ +
+
+ {t}Remember dialog filter settings{/t} +
+
+ + +
+
+
{t}Session lifetime{/t} -- 2.30.2