From: hickert Date: Mon, 26 Nov 2007 09:28:08 +0000 (+0000) Subject: Closes #276 Filter settings will be saved per ui->dn now. X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=d1ad73d37e3070b47dfca4158f2e486d2f330f20;p=gosa.git Closes #276 Filter settings will be saved per ui->dn now. git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@7884 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/html/index.php b/html/index.php index 50a3d45a2..67d3c0826 100644 --- a/html/index.php +++ b/html/index.php @@ -295,18 +295,26 @@ if ($_SERVER["REQUEST_METHOD"] == "POST" && isset($_POST['login'])){ /* Restore filter settings from cookie, if available */ if(isset($config->data['MAIN']['SAVE_FILTER']) && preg_match("/true/",$config->data['MAIN']['SAVE_FILTER'])){ - $cookie_vars= array("MultiDialogFilters","CurrentMainBase","plug"); - 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($_COOKIE['GOsa_Filter_Settings']) || isset($HTTP_COOKIE_VARS['GOsa_Filter_Settings'])){ + + if(isset($_COOKIE['GOsa_Filter_Settings'])){ + $cookie_all = unserialize(base64_decode($_COOKIE['GOsa_Filter_Settings'])); + }else{ + $cookie_all = unserialize(base64_decode($HTTP_COOKIE_VARS['GOsa_Filter_Settings'])); + } + if(isset($cookie_all[$ui->dn])){ + $cookie = $cookie_all[$ui->dn]; + $cookie_vars= array("MultiDialogFilters","CurrentMainBase","plug"); + foreach($cookie_vars as $var){ + if(isset($cookie[$var])){ + $_SESSION[$var] = $cookie[$var]; + } + } + if(isset($cookie['plug'])){ + $plug =$cookie['plug']; + } } - } - if(isset($_COOKIE['plug'])){ - $plug = $_COOKIE['plug']; - }elseif($HTTP_COOKIE_VARS['plug']){ - $plug = $HTTP_COOKIE_VARS['plug']; } } diff --git a/html/main.php b/html/main.php index 1583904f7..d8f643c2a 100644 --- a/html/main.php +++ b/html/main.php @@ -403,16 +403,24 @@ $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 = array(); + +if(isset($_COOKIE['GOsa_Filter_Settings'])){ + $cookie = unserialize(base64_decode($_COOKIE['GOsa_Filter_Settings'])); +}elseif($HTTP_COOKIE_VARS['GOsa_Filter_Settings']){ + $cookie = unserialize(base64_decode($HTTP_COOKIE_VARS['GOsa_Filter_Settings'])); +} 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); + $cookie[$ui->dn][$var] = $_SESSION[$var]; } } if(isset($_GET['plug'])){ - @setcookie("plug", $_GET['plug'],time()+ 60*60*24*30); + $cookie[$ui->dn]['plug'] = $_GET['plug']; } + setcookie("GOsa_Filter_Settings",base64_encode(serialize($cookie)),time() + (60*60*24)); } /* Show page... */