From: cajus Date: Thu, 11 Dec 2008 14:39:09 +0000 (+0000) Subject: Push first set of changes X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=3cab42f378c95a0ee58ef0cb62dea7baaced83ff;p=gosa.git Push first set of changes git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@13261 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/gosa-core/html/getFAIstatus.php b/gosa-core/html/getFAIstatus.php index 4f931a26f..42d67404a 100644 --- a/gosa-core/html/getFAIstatus.php +++ b/gosa-core/html/getFAIstatus.php @@ -25,10 +25,10 @@ @require_once ("functions.inc"); session::start(); -session::set('errorsAlreadyPosted',array()); +session::global_set('errorsAlreadyPosted',array()); /* Logged in? Simple security check */ -if (!session::is_set('ui')){ +if (!session::global_is_set('ui')){ new log("security","unknown","",array(),"Error: getbin.php called without session") ; header ("Location: index.php"); exit; @@ -39,7 +39,7 @@ if(!isset($_GET['mac'])){ return; } -$config = session::get("config"); +$config = session::global_get("config"); $o = new gosaSupportDaemon(); $res = $o->get_entries_by_mac(split(",",$_GET['mac'])); foreach($res as $entry){ diff --git a/gosa-core/html/getbin.php b/gosa-core/html/getbin.php index aa0f037fa..55b7188fe 100644 --- a/gosa-core/html/getbin.php +++ b/gosa-core/html/getbin.php @@ -25,10 +25,10 @@ @require_once ("functions.inc"); error_reporting (0); session::start(); -session::set('errorsAlreadyPosted',array()); +session::global_set('errorsAlreadyPosted',array()); /* Logged in? Simple security check */ -if (!session::is_set('ui')){ +if (!session::global_is_set('ui')){ new log("security","unknown","",array(),"Error: getbin.php called without session") ; header ("Location: index.php"); exit; diff --git a/gosa-core/html/helpviewer.php b/gosa-core/html/helpviewer.php index c327b6c9b..f9b72d1bf 100644 --- a/gosa-core/html/helpviewer.php +++ b/gosa-core/html/helpviewer.php @@ -32,14 +32,14 @@ header("Content-type: text/html; charset=UTF-8"); session::start(); /* If no config object is found in the session, abort help */ -if (!session::is_set('config')){ +if (!session::global_is_set('config')){ new log("security","all/all","",array(),"Help viewer called without session") ; header ("Location: index.php"); exit; } -$ui= session::get('ui'); -$config= session::get('config'); +$ui= session::global_get('ui'); +$config= session::global_get('config'); /* Language setup */ $lang= $config->get_cfg_value("language"); @@ -60,7 +60,6 @@ bindtextdomain($domain, LOCALE_DIR); textdomain($domain); @DEBUG (DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $lang, "Setting language to"); -$config= session::get('config'); $smarty->compile_dir= $config->get_cfg_value("compile", "/var/spool/gosa/"); $smarty->assign("title", "GOsa - "._("Help browser")); @@ -68,11 +67,11 @@ $smarty->assign("title", "GOsa - "._("Help browser")); */ /* Generate helpobject */ -if(session::is_set('helpobject')){ - $helpobject = session::get('helpobject'); +if(session::global_is_set('helpobject')){ + $helpobject = session::global_get('helpobject'); }else{ - $plist = session::get('plist'); + $plist = session::global_get('plist'); $helpobject['lang'] = $lang; $helpobject['helpconf'] = array(); @@ -98,11 +97,11 @@ $forward ="node1.html"; $helpdir =""; /* Every class which is called within a tab, stores its name in the Session. - * If session::is_set('current_class_for_help') is true, + * If session::global_is_set('current_class_for_help') is true, * get the helpfile specified in the xml file and display it. * Unset this Session entry, to avoid displaying it again. */ -if(session::is_set('current_class_for_help')){ +if(session::global_is_set('current_class_for_help')){ /* Create new XML parser with the path to the Xml file */ $xml = new parseXml("../doc/guide.xml"); @@ -111,7 +110,7 @@ if(session::is_set('current_class_for_help')){ $str = $xml->parse(); /* __LANG__ is used as placeholder for the used language*/ - $helpdir= @preg_replace("/__LANG__/i",$lang,$str[(session::get('current_class_for_help'))]['PATH']); + $helpdir= @preg_replace("/__LANG__/i",$lang,$str[(session::global_get('current_class_for_help'))]['PATH']); /* If there is no entry in the xml file for this class, display an error message */ if($helpdir == ""){ @@ -120,25 +119,25 @@ if(session::is_set('current_class_for_help')){ $header= "".$smarty->fetch(get_template_path('headers.tpl')); $display= ( $header.$smarty->fetch(get_template_path('help.tpl'))); echo $display; - session::un_set('current_class_for_help'); + session::global_un_set('current_class_for_help'); exit(); } /* Save filename */ - $helpobject['file']= $str[(session::get('current_class_for_help'))]['FILE']; + $helpobject['file']= $str[(session::global_get('current_class_for_help'))]['FILE']; /* Save path to the file */ $helpobject['currentplug'] = $helpdir; /* Avoid displaying the same help every time */ if(isset($_GET['pg'])){ - session::un_set('current_class_for_help'); + session::global_un_set('current_class_for_help'); } }elseif(isset($_GET['plug'])){ /* This displays helpfiles depending on the current $_GET[plug] */ $ui= get_userinfo(); - $tmp = new pluglist(session::get('config'), $ui); + $tmp = new pluglist($config, $ui); $path = $tmp->get_path($_GET['plug']); $helpobject['currentplug'] = $path; $helpobject['file'] = "index.html"; @@ -177,7 +176,7 @@ if(isset($_GET['pg'])){ $helpdir.="/"; /* Save current settings */ -session::set('helpobject',$helpobject); +session::global_set('helpobject',$helpobject); /* * Display management @@ -245,7 +244,7 @@ if(isset($_POST['search'])){ * parse it, rework links images and so on */ $index = readfiles($helpdir,$prefix,$suffix,false,$helpobject['file']); - $lastresults = session::get('lastresults'); + $lastresults = session::global_get('lastresults'); /* if this page is result from a search, mark the search strings */ if(isset($_GET['mark'])){ diff --git a/gosa-core/html/index.php b/gosa-core/html/index.php index 390def98a..137235b68 100644 --- a/gosa-core/html/index.php +++ b/gosa-core/html/index.php @@ -132,9 +132,9 @@ session::set('errors',""); /* Check for java script */ if(isset($_POST['javascript']) && $_POST['javascript'] == "true") { - session::set('js',TRUE); + session::global_set('js',TRUE); }elseif(isset($_POST['javascript'])) { - session::set('js',FALSE); + session::global_set('js',FALSE); } /* Check if gosa.conf (.CONFIG_FILE) is accessible */ @@ -145,7 +145,7 @@ if (!is_readable(CONFIG_DIR."/".CONFIG_FILE)){ /* Parse configuration file */ $config= new config(CONFIG_DIR."/".CONFIG_FILE, $BASE_DIR); -session::set('DEBUGLEVEL',$config->get_cfg_value('DEBUGLEVEL')); +session::global_set('DEBUGLEVEL',$config->get_cfg_value('DEBUGLEVEL')); if ($_SERVER["REQUEST_METHOD"] != "POST"){ @DEBUG (DEBUG_CONFIG, __LINE__, __FUNCTION__, __FILE__, $config->data, "config"); } @@ -237,8 +237,8 @@ if (($_SERVER["REQUEST_METHOD"] == "POST" && isset($_POST['login'])) || $htacces $message= ""; /* Destroy old sessions, they cause a successfull login to relog again ...*/ - if(session::is_set('_LAST_PAGE_REQUEST')){ - session::set('_LAST_PAGE_REQUEST',time()); + if(session::global_is_set('_LAST_PAGE_REQUEST')){ + session::global_set('_LAST_PAGE_REQUEST',time()); } if (!$htaccess_authenticated){ @@ -328,14 +328,14 @@ if (($_SERVER["REQUEST_METHOD"] == "POST" && isset($_POST['login'])) || $htacces del_user_locks($ui->dn); /* Save userinfo and plugin structure */ - session::set('ui',$ui); - session::set('session_cnt',0); + session::global_set('ui',$ui); + session::global_set('session_cnt',0); /* Let GOsa trigger a new connection for each POST, save config to session. */ $config->get_departments(); $config->make_idepartments(); - session::set('config',$config); + session::global_set('config',$config); /* Restore filter settings from cookie, if available */ if($config->get_cfg_value("storeFilterSettings") == "true"){ @@ -352,7 +352,7 @@ if (($_SERVER["REQUEST_METHOD"] == "POST" && isset($_POST['login'])) || $htacces $cookie_vars= array("MultiDialogFilters","CurrentMainBase","plug"); foreach($cookie_vars as $var){ if(isset($cookie[$var])){ - session::set($var,$cookie[$var]); + session::global_set($var,$cookie[$var]); } } if(isset($cookie['plug'])){ diff --git a/gosa-core/html/logout.php b/gosa-core/html/logout.php index 05990a151..fd4bb903d 100644 --- a/gosa-core/html/logout.php +++ b/gosa-core/html/logout.php @@ -29,13 +29,13 @@ header("Content-type: text/html; charset=UTF-8"); if the old session is still available */ @session::start(); session::set('errorsAlreadyPosted',array()); -if(session::is_set('ui')){ +if(session::global_is_set('ui')){ /* Get config & ui informations */ - $ui= session::get("ui"); + $ui= session::global_get("ui"); /* config used for del_user_locks & some lines below to detect the language */ - $config= session::get("config"); + $config= session::global_get("config"); /* Remove all locks of this user */ del_user_locks($ui->dn); diff --git a/gosa-core/html/main.php b/gosa-core/html/main.php index 0161a23b6..6c2a5e7e4 100644 --- a/gosa-core/html/main.php +++ b/gosa-core/html/main.php @@ -38,7 +38,7 @@ textdomain($domain); /* Remember everything we did after the last click */ session::start(); session::set('errorsAlreadyPosted',array()); -session::set('runtime_cache',array()); +session::global_set('runtime_cache',array()); session::set('limit_exceeded',FALSE); if ($_SERVER["REQUEST_METHOD"] == "POST"){ @@ -47,20 +47,20 @@ if ($_SERVER["REQUEST_METHOD"] == "POST"){ @DEBUG (DEBUG_POST, __LINE__, __FUNCTION__, __FILE__, session::get_all(), "_SESSION"); /* Logged in? Simple security check */ -if (!session::is_set('config')){ +if (!session::global_is_set('config')){ new log("security","login","",array(),"main.php called without session - logging out") ; header ("Location: logout.php"); exit; } /* Check for uniqe ip address */ -$ui= session::get('ui'); +$ui= session::global_get('ui'); if ($_SERVER['REMOTE_ADDR'] != $ui->ip){ new log("security","login","",array(),"main.php called with session which has a changed IP address.") ; header ("Location: logout.php"); exit; } -$config= session::get('config'); +$config= session::global_get('config'); $config->check_and_reload(); /* Enable compressed output */ @@ -69,15 +69,15 @@ if ($config->get_cfg_value("sendCompressedOutput") == "true"){ } /* Check for invalid sessions */ -if(session::get('_LAST_PAGE_REQUEST') == ""){ - session::set('_LAST_PAGE_REQUEST',time()); +if(session::global_get('_LAST_PAGE_REQUEST') == ""){ + session::global_set('_LAST_PAGE_REQUEST',time()); }else{ /* check GOsa.conf for defined session lifetime */ $max_life= $config->get_cfg_value("sessionLifetime", 60*60*2); /* get time difference between last page reload */ - $request_time = (time()- session::get('_LAST_PAGE_REQUEST')); + $request_time = (time()- session::global_get('_LAST_PAGE_REQUEST')); /* If page wasn't reloaded for more than max_life seconds * kill session @@ -88,7 +88,7 @@ if(session::get('_LAST_PAGE_REQUEST') == ""){ header ("Location: logout.php"); exit; } - session::set('_LAST_PAGE_REQUEST',time()); + session::global_set('_LAST_PAGE_REQUEST',time()); } @@ -101,23 +101,23 @@ $smarty->compile_dir= $config->get_cfg_value("templateCompileDirectory", '/var/s $reload_navigation = false; /* Set last initialised language to current, browser settings */ -if(!session::is_set('Last_init_lang')){ +if(!session::global_is_set('Last_init_lang')){ $reload_navigation = true; - session::set('Last_init_lang',get_browser_language()); + session::global_set('Last_init_lang',get_browser_language()); } /* If last language != current force navi reload */ $lang= get_browser_language(); -if(session::get('Last_init_lang') != $lang){ +if(session::global_get('Last_init_lang') != $lang){ $reload_navigation = true; } /* Language setup */ -session::set('Last_init_lang',$lang); +session::global_set('Last_init_lang',$lang); /* Preset current main base */ -if(!session::is_set('CurrentMainBase')){ - session::set('CurrentMainBase',get_base_from_people($ui->dn)); +if(!session::global_is_set('CurrentMainBase')){ + session::global_set('CurrentMainBase',get_base_from_people($ui->dn)); } putenv("LANGUAGE="); @@ -136,7 +136,7 @@ textdomain($domain); @DEBUG (DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $lang, "Setting language to"); /* Prepare plugin list */ -if (!session::is_set('plist')){ +if (!session::global_is_set('plist')){ /* Initially load all classes */ $class_list= get_declared_classes(); foreach ($class_mapping as $class => $path){ @@ -152,14 +152,14 @@ if (!session::is_set('plist')){ } } - session::set('plist', new pluglist($config, $ui)); + session::global_set('plist', new pluglist($config, $ui)); /* Load ocMapping into userinfo */ $tmp= new acl($config, NULL, $ui->dn); $ui->ocMapping= $tmp->ocMapping; - session::set('ui',$ui); + session::global_set('ui',$ui); } -$plist= session::get('plist'); +$plist= session::global_get('plist'); /* Check for register globals */ if (isset($global_check) && $config->get_cfg_value("forceglobals") == "true"){ @@ -174,15 +174,15 @@ if (isset($global_check) && $config->get_cfg_value("forceglobals") == "true"){ } /* Check Plugin variable */ -if (session::is_set('plugin_dir')){ - $old_plugin_dir= session::get('plugin_dir'); +if (session::global_is_set('plugin_dir')){ + $old_plugin_dir= session::global_get('plugin_dir'); } else { $old_plugin_dir= ""; } if (isset($_GET['plug']) && $plist->plugin_access_allowed($_GET['plug'])){ $plug= validate($_GET['plug']); $plugin_dir= $plist->get_path($plug); - session::set('plugin_dir',$plugin_dir); + session::global_set('plugin_dir',$plugin_dir); if ($plugin_dir == ""){ new log("security","gosa","",array(),"main.php called with invalid plug parameter \"$plug\"") ; header ("Location: logout.php"); @@ -191,7 +191,7 @@ if (isset($_GET['plug']) && $plist->plugin_access_allowed($_GET['plug'])){ } else { /* set to welcome page as default plugin */ - session::set('plugin_dir',"welcome"); + session::global_set('plugin_dir',"welcome"); $plugin_dir= "$BASE_DIR/plugins/generic/welcome"; } @@ -255,18 +255,6 @@ if (isset($_GET['reset'])){ } } -/* Install eGOsa hooks, convert _POST to session */ -if(isset($_GET['explorer'])){ - session::set('eGosa',TRUE); -} -if(session::is_set('POST')){ - $_SERVER["REQUEST_METHOD"] = "POST"; - foreach (session::get('POST') as $key => $dummy){ - $_POST[$key]= $dummy; - } - session::un_set('POST'); -} - /* show web frontend */ $smarty->assign ("date", date("l, dS F Y H:i:s O")); $smarty->assign ("must", "*"); @@ -275,7 +263,7 @@ if (isset($plug)){ } else { $plug= ""; } -if (session::get('js')==FALSE){ +if (session::global_get('js')==FALSE){ $smarty->assign("javascript", "false"); $smarty->assign("help_method", "href='helpviewer.php$plug' target='_blank'"); } else { @@ -320,8 +308,8 @@ if ($_SERVER["REQUEST_METHOD"] == "POST"){ if (isset($_POST['delete_lock']) || isset($_POST['open_readonly'])){ /* Set old Post data */ - if(session::is_set('LOCK_VARS_USED')){ - foreach(session::get('LOCK_VARS_USED') as $name => $value){ + if(session::global_is_set('LOCK_VARS_USED')){ + foreach(session::global_get('LOCK_VARS_USED') as $name => $value){ $_GET[$name] = $value; $_POST[$name] = $value; } @@ -329,23 +317,6 @@ if ($_SERVER["REQUEST_METHOD"] == "POST"){ session::un_set ('dn'); } - - /* I don't want multiple browser windows open. One way to check it is - to count a hidden field and warn the user if SESSION and INPUT count - differ. */ - if (isset($_POST['session_cnt'])){ - if ($_POST['session_cnt'] != session::get('session_cnt')){ - $smarty->display(get_template_path('conflict.tpl')); - exit (); - } - session::set('session_cnt', (session::get('session_cnt') + 1)); - session::set('post_cnt' , validate($_POST['session_cnt']) + 1); - } -} - -/* Only generate hidden click counter, if post_cnt is defined */ -if (session::is_set('post_cnt')){ - echo "\n"; } /* check if we are using account expiration */ @@ -408,6 +379,23 @@ $focus.= 'next_msg_dialog();'; $focus.= ''; $smarty->assign("focus", $focus); +/* Set channel if needed */ +#TODO: * move all global session calls to global_ +# * create a new channel where needed (mostly management dialogues) +# * remove regulary created channels when not needed anymore +# * take a look at external php calls (i.e. get fax, ldif, etc.) +# * handle aborted sessions (by pressing anachors i.e. Main, Menu, etc.) +# * check lock removals, is "dn" global or not in this case? +# * last page request -> global or not? +# * check that filters are still global +# * maxC global? +if (isset($_POST['_channel_'])){ + echo "DEBUG - current channel: ".$_POST['_channel_']; + $smarty->assign("channel", $_POST['_channel_']); +} else { + $smarty->assign("channel", ""); +} + $display= $header.$smarty->fetch(get_template_path('framework.tpl')); /* Save dialog filters and selected base in a cookie. @@ -425,8 +413,8 @@ if(isset($_COOKIE['GOsa_Filter_Settings'])){ if($config->get_cfg_value("storeFilterSettings") == "true"){ $cookie_vars = array("MultiDialogFilters","CurrentMainBase"); foreach($cookie_vars as $var){ - if(session::is_set($var)){ - $cookie[$ui->dn][$var] = session::get($var); + if(session::global_is_set($var)){ + $cookie[$ui->dn][$var] = session::global_get($var); } } if(isset($_GET['plug'])){ @@ -439,8 +427,8 @@ if($config->get_cfg_value("storeFilterSettings") == "true"){ echo $display; /* Save plist and config */ -session::set('plist',$plist); -session::set('config',$config); +session::global_set('plist',$plist); +session::global_set('config',$config); session::set('errorsAlreadyPosted',array()); // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: diff --git a/gosa-core/html/password.php b/gosa-core/html/password.php index ef555df23..459512228 100644 --- a/gosa-core/html/password.php +++ b/gosa-core/html/password.php @@ -48,7 +48,7 @@ if(is_array(session::get_all()) && count(session::get_all())){ } /* Reset errors */ -session::set('js',true); +session::global_set('js',true); session::set('errors',""); session::set('errorsAlreadyPosted',array()); session::set('LastError',""); @@ -61,7 +61,7 @@ if (!is_readable(CONFIG_DIR."/".CONFIG_FILE)){ /* Parse configuration file */ $config= new config(CONFIG_DIR."/".CONFIG_FILE, $BASE_DIR); -session::set('DEBUGLEVEL', $config->get_cfg_value("debuglevel")); +session::global_set('DEBUGLEVEL', $config->get_cfg_value("debuglevel")); if ($_SERVER["REQUEST_METHOD"] != "POST"){ @DEBUG (DEBUG_CONFIG, __LINE__, __FUNCTION__, __FILE__, $config->data, "config"); } @@ -122,7 +122,7 @@ if (isset($_GET['directory']) && isset($servers[$_GET['directory']])){ /* Set config to selected one */ $config->set_current($directory); -session::set('config',$config); +session::global_set('config',$config); if ($_SERVER["REQUEST_METHOD"] != "POST"){ @DEBUG (DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $lang, "Setting language to"); @@ -180,8 +180,8 @@ $smarty->assign("changed", false); if ($_SERVER["REQUEST_METHOD"] == "POST" && isset($_POST['apply'])){ /* Destroy old sessions, they cause a successfull login to relog again ...*/ - if(session::is_set('_LAST_PAGE_REQUEST')){ - session::set('_LAST_PAGE_REQUEST',time()); + if(session::global_is_set('_LAST_PAGE_REQUEST')){ + session::global_set('_LAST_PAGE_REQUEST',time()); } $message= array(); @@ -283,7 +283,7 @@ if ($ssl != "" && $config->get_cfg_value("warnssl") == 'true'){ } /* show login screen */ -$smarty->assign("JS",session::get('js')); +$smarty->assign("JS",session::global_get('js')); $smarty->assign ("PHPSESSID", session_id()); if (session::is_set('errors')){ $smarty->assign("errors", session::get('errors'));; diff --git a/gosa-core/html/setup.php b/gosa-core/html/setup.php index b4d805437..87eb0ec89 100644 --- a/gosa-core/html/setup.php +++ b/gosa-core/html/setup.php @@ -50,7 +50,7 @@ ini_set("session.gc_maxlifetime",24*60*60); /* Start session */ session::start(); -session::set('DEBUGLEVEL',1); +session::global_set('DEBUGLEVEL',1); session::set('errorsAlreadyPosted',array()); /* Attribute initialization, reset errors */ @@ -69,30 +69,30 @@ if (!(is_dir($smarty->compile_dir) && is_writable($smarty->compile_dir))){ } /* Get posted language */ -if(!session::is_set('language')){ - session::set('language',get_browser_language()); +if(!session::global_is_set('language')){ + session::global_set('language',get_browser_language()); } if(isset($_POST['lang_selected'])){ if($_POST['lang_selected'] != ""){ - session::set('lang',$_POST['lang_selected']); + session::global_set('lang',$_POST['lang_selected']); }else{ - session::set('lang',get_browser_language()); + session::global_set('lang',get_browser_language()); } } /* Check for js */ -if (!isset($_GET['js']) && !session::is_set('js')){ +if (!isset($_GET['js']) && !session::global_is_set('js')){ echo ''; - session::set('js',FALSE); + session::global_set('js',FALSE); } elseif(isset($_GET['js'])) { - session::set('js',TRUE); + session::global_set('js',TRUE); } -$lang = session::get('lang'); +$lang = session::global_get('lang'); /* Append .UTF-8 to language string if necessary */ if(!preg_match("/utf(-)8$/i",$lang)){ $lang .= ".UTF-8"; @@ -131,7 +131,7 @@ $focus.= 'next_msg_dialog();'; $focus.= ''; /* show web frontend */ -$setup = session::get('setup'); +$setup = session::global_get('setup'); $smarty->assign("contents" , $display); $smarty->assign("navigation", $setup->get_navigation_html()); $smarty->assign("header", $setup->get_header_html()); diff --git a/gosa-core/ihtml/themes/default/framework.tpl b/gosa-core/ihtml/themes/default/framework.tpl index 4d9f8f9b1..c02e26576 100644 --- a/gosa-core/ihtml/themes/default/framework.tpl +++ b/gosa-core/ihtml/themes/default/framework.tpl @@ -52,4 +52,7 @@ + {if $channel != ""} + + {/if} {$errors}{$focus} diff --git a/gosa-core/include/class_MultiSelectWindow.inc b/gosa-core/include/class_MultiSelectWindow.inc index 5fe22de80..8c75dd229 100644 --- a/gosa-core/include/class_MultiSelectWindow.inc +++ b/gosa-core/include/class_MultiSelectWindow.inc @@ -645,7 +645,7 @@ class MultiSelectWindow{ } /* Save currenlty selected base in session */ - session::set("CurrentMainBase",$this->selectedBase); + session::global_set("CurrentMainBase",$this->selectedBase); } diff --git a/gosa-core/include/class_acl.inc b/gosa-core/include/class_acl.inc index b5852d5cd..a1809b044 100644 --- a/gosa-core/include/class_acl.inc +++ b/gosa-core/include/class_acl.inc @@ -132,7 +132,7 @@ class acl extends plugin } /* Objects */ - $tmp= session::get('plist'); + $tmp= session::global_get('plist'); $plist= $tmp->info; $cats = array(); if (isset($this->parent) && $this->parent !== NULL){ @@ -230,7 +230,7 @@ class acl extends plugin /* Call parent execute */ plugin::execute(); - $tmp= session::get('plist'); + $tmp= session::global_get('plist'); $plist= $tmp->info; /* Handle posts */ @@ -607,7 +607,7 @@ class acl extends plugin function sort_by_priority($list) { - $tmp= session::get('plist'); + $tmp= session::global_get('plist'); $plist= $tmp->info; asort($plist); $newSort = array(); @@ -664,7 +664,7 @@ class acl extends plugin { $display= ""; $cols= 3; - $tmp= session::get('plist'); + $tmp= session::global_get('plist'); $plist= $tmp->info; asort($plist); @@ -721,7 +721,7 @@ class acl extends plugin /* Object header */ $tname= preg_replace("/[^a-z0-9]/i","_",$name); - if(session::get('js')) { + if(session::global_get('js')) { if(isset($_SERVER['HTTP_USER_AGENT']) && preg_match("/gecko/i",$_SERVER['HTTP_USER_AGENT'])) { $display.= "\n". "\n ". @@ -771,7 +771,7 @@ class acl extends plugin $cnt= 1; $splist= $plist[preg_replace('%^.*/%', '', $key)]['plProvidedAcls']; # asort($splist); - if(session::get('js')) { + if(session::global_get('js')) { if(isset($_SERVER['HTTP_USER_AGENT']) && preg_match("/gecko/i",$_SERVER['HTTP_USER_AGENT'])) { $display.= "\n ". "\n ", $cols-$cnt); } - if(session::get('js')) { + if(session::global_get('js')) { if(isset($_SERVER['HTTP_USER_AGENT']) && (preg_match("/gecko/i",$_SERVER['HTTP_USER_AGENT'])) || (preg_match("/ie/i",$_SERVER['HTTP_USER_AGENT']))) { $display.= "\n
". @@ -821,7 +821,7 @@ class acl extends plugin $display.= str_repeat("\n  
". "\n ". @@ -1173,7 +1173,7 @@ class acl extends plugin /* Refresh users ACLs */ $ui= get_userinfo(); $ui->loadACL(); - session::set('ui',$ui); + session::global_set('ui',$ui); } diff --git a/gosa-core/include/class_config.inc b/gosa-core/include/class_config.inc index 5c36ae83b..e47586ff8 100644 --- a/gosa-core/include/class_config.inc +++ b/gosa-core/include/class_config.inc @@ -75,14 +75,14 @@ class config { /* Check if class_location.inc has changed, this is the case if we have installed or removed plugins. */ - if(session::is_set("class_location.inc:timestamp")){ + if(session::global_is_set("class_location.inc:timestamp")){ $tmp = stat("../include/class_location.inc"); - if($tmp['mtime'] != session::get("class_location.inc:timestamp")){ - session::un_set("plist"); + if($tmp['mtime'] != session::global_get("class_location.inc:timestamp")){ + session::global_un_set("plist"); } } $tmp = stat("../include/class_location.inc"); - session::set("class_location.inc:timestamp",$tmp['mtime']); + session::global_set("class_location.inc:timestamp",$tmp['mtime']); @@ -268,15 +268,15 @@ class config { $this->ldap->referrals= $this->current['REFERRAL']; } - if (!session::is_set('size_limit')){ - session::set('size_limit',$this->current['LDAPSIZELIMIT']); - session::set('size_ignore',$this->current['LDAPSIZEIGNORE']); + if (!session::global_is_set('size_limit')){ + session::global_set('size_limit',$this->current['LDAPSIZELIMIT']); + session::global_set('size_ignore',$this->current['LDAPSIZEIGNORE']); } } $obj = new ldapMultiplexer($this->ldap); if ($sizelimit){ - $obj->set_size_limit(session::get('size_limit')); + $obj->set_size_limit(session::global_get('size_limit')); } else { $obj->set_size_limit(0); } @@ -298,7 +298,7 @@ class config { } if (isset($this->current['INITIAL_BASE'])){ - session::set('CurrentMainBase',$this->current['INITIAL_BASE']); + session::global_set('CurrentMainBase',$this->current['INITIAL_BASE']); } /* Remove possibly added ',' from end of group and people ou */ @@ -966,11 +966,11 @@ class config { { /* Skip check, if we've already mentioned the mismatch */ - if(session::is_set("LastChecked") && session::get("LastChecked") == $this->config_version) return; + if(session::global_is_set("LastChecked") && session::global_get("LastChecked") == $this->config_version) return; /* Remember last checked version */ - session::set("LastChecked",$this->config_version); + session::global_set("LastChecked",$this->config_version); $current = md5(file_get_contents(CONFIG_TEMPLATE_DIR."/gosa.conf")); diff --git a/gosa-core/include/class_ldap.inc b/gosa-core/include/class_ldap.inc index 1d00c9466..81e7dd044 100644 --- a/gosa-core/include/class_ldap.inc +++ b/gosa-core/include/class_ldap.inc @@ -1210,8 +1210,8 @@ class LDAP{ } /* Return the cached results. */ - if(class_available('session') && session::is_set("LDAP_CACHE::get_objectclasses") && !$force_reload){ - $objectclasses = session::get("LDAP_CACHE::get_objectclasses"); + if(class_available('session') && session::global_is_set("LDAP_CACHE::get_objectclasses") && !$force_reload){ + $objectclasses = session::global_get("LDAP_CACHE::get_objectclasses"); return($objectclasses); } @@ -1274,7 +1274,7 @@ class LDAP{ } if(class_available("session")){ - session::set("LDAP_CACHE::get_objectclasses",$objectclasses); + session::global_set("LDAP_CACHE::get_objectclasses",$objectclasses); } return $objectclasses; @@ -1305,8 +1305,8 @@ class LDAP{ function log($string) { - if (session::is_set('config')){ - $cfg = session::get('config'); + if (session::global_is_set('config')){ + $cfg = session::global_get('config'); if (isset($cfg->current['LDAPSTATS']) && preg_match('/true/i', $cfg->current['LDAPSTATS'])){ syslog (LOG_INFO, $string); } diff --git a/gosa-core/include/class_log.inc b/gosa-core/include/class_log.inc index 8b283bd25..bbe31517e 100644 --- a/gosa-core/include/class_log.inc +++ b/gosa-core/include/class_log.inc @@ -52,11 +52,11 @@ class log { } $entry = array(); - if(!session::is_set('config')){ + if(!session::global_is_set('config')){ $entry['user']= "unkown"; }else{ - $this->config = session::get('config'); + $this->config = session::global_get('config'); $ui = get_userinfo(); $entry['user']= @$ui->dn; } diff --git a/gosa-core/include/class_msg_dialog.inc b/gosa-core/include/class_msg_dialog.inc index 4f765a5b5..6cd25e6d6 100644 --- a/gosa-core/include/class_msg_dialog.inc +++ b/gosa-core/include/class_msg_dialog.inc @@ -135,7 +135,7 @@ class msg_dialog $smarty->assign("s_Title",$this->s_Title); $smarty->assign("i_ID",$this->i_ID); $smarty->assign("frame",false); - $smarty->assign("JS",session::get('js')); + $smarty->assign("JS",session::global_get('js')); $smarty->assign("IE",preg_match("/MSIE/", $_SERVER['HTTP_USER_AGENT'])); return($smarty->fetch(get_template_path('msg_dialog.tpl'))); } @@ -170,7 +170,7 @@ class msg_dialog $smarty->assign("IE",preg_match("/MSIE/", $_SERVER['HTTP_USER_AGENT'])); $return = $smarty->fetch(get_template_path('msg_dialog.tpl')); - if(!session::get('js')){ + if(!session::global_get('js')){ $dialog = array_pop(session::get('msg_dialogs')); $return.= $dialog->execute(); }else{ diff --git a/gosa-core/include/class_plugin.inc b/gosa-core/include/class_plugin.inc index 2ca362bdd..35cbce9e7 100644 --- a/gosa-core/include/class_plugin.inc +++ b/gosa-core/include/class_plugin.inc @@ -152,7 +152,7 @@ class plugin /* Check if this entry was opened in read only mode */ if(isset($_POST['open_readonly'])){ - if(session::is_set("LOCK_CACHE")){ + if(session::global_is_set("LOCK_CACHE")){ $cache = &session::get("LOCK_CACHE"); if(isset($cache['READ_ONLY'][$this->dn])){ $this->read_only = TRUE; @@ -259,7 +259,7 @@ class plugin function execute() { /* This one is empty currently. Fabian - please fill in the docu code */ - session::set('current_class_for_help',get_class($this)); + session::global_set('current_class_for_help',get_class($this)); /* Reset Lock message POST/GET check array, to prevent perg_match errors*/ session::set('LOCK_VARS_TO_USE',array()); @@ -990,7 +990,7 @@ class plugin if(count($leaf_deps)){ $this->config->get_departments(); $this->config->make_idepartments(); - session::set("config",$this->config); + session::global_set("config",$this->config); $ui =get_userinfo(); $ui->reset_acl_cache(); } @@ -1727,10 +1727,10 @@ class plugin } /* Update userinfo if necessary */ - $ui = session::get('ui'); + $ui = session::global_get('ui'); if($ui->dn == $old_dn){ $ui->dn = $new_dn; - session::set('ui',$ui); + session::global_set('ui',$ui); new log("view","acl/".get_class($this),$this->dn,array(),"Updated current object dn from '".$old_dn."' to '".$new_dn."'"); } @@ -1875,7 +1875,7 @@ class plugin function multiple_execute() { /* This one is empty currently. Fabian - please fill in the docu code */ - session::set('current_class_for_help',get_class($this)); + session::global_set('current_class_for_help',get_class($this)); /* Reset Lock message POST/GET check array, to prevent perg_match errors*/ session::set('LOCK_VARS_TO_USE',array()); diff --git a/gosa-core/include/class_pluglist.inc b/gosa-core/include/class_pluglist.inc index b7c497daf..0bed2a8a7 100644 --- a/gosa-core/include/class_pluglist.inc +++ b/gosa-core/include/class_pluglist.inc @@ -201,7 +201,7 @@ class pluglist { $entries= $entries."

"; - if(session::get('js')){ + if(session::global_get('js')){ $entries.= _($plHeadline)."

\n"; } else { $entries.= ""; - if(session::get('js')){ + if(session::global_get('js')){ $entries.= "\"*\" ". _($plHeadline); diff --git a/gosa-core/include/class_session.inc b/gosa-core/include/class_session.inc index 2d14d1f5e..0d543e689 100644 --- a/gosa-core/include/class_session.inc +++ b/gosa-core/include/class_session.inc @@ -32,17 +32,107 @@ class session { } + public static function add_channel($name) + { + /* If there's already such kind of channel, skip... */ + if (isset($_SESSION[$name])){ + return (FALSE); + } + + /* Allocate it... */ + $_SESSION[$name]= array(); + $_POST["_channel_"]= $name; + return (TRUE); + } + + public static function remove_channel($name) + { + /* If there's already such kind of channel, skip... */ + if (isset($_SESSION[$name])){ + unset($_SESSION[$name]); + if (isset($_POST["_channel_"])){ + unset($_POST["_channel_"]); + } + return (TRUE); + } + + return (FALSE); + } + public static function is_set($name) + { + $channel= ""; + if (isset($_POST['_channel_'])){ + $channel= $_POST['_channel_']; + } + + /* Global fallback if not set */ + if ($channel == ""){ + return(isset($_SESSION[$name])); + } + + /* Sanity check */ + if (!session::channel_exists($channel)){ + msg_dialog::display(_("Internal error"), _("Requested channel does not exist! Please contact your Administrator."), FATAL_ERROR_DIALOG); + } + + $channel= "gch_".$channel; + return(isset($_SESSION[$channel][$name])); + } + + public static function global_is_set($name) { return(isset($_SESSION[$name])); } public static function set($name,$value) + { + $channel= ""; + if (isset($_POST['_channel_'])){ + $channel= $_POST['_channel_']; + } + + /* Global fallback if not set */ + if ($channel == ""){ + $_SESSION[$name] = $value; + } else { + /* Sanity check */ + if (!session::channel_exists($channel)){ + msg_dialog::display(_("Internal error"), _("Requested channel does not exist! Please contact your Administrator."), FATAL_ERROR_DIALOG); + } + $_SESSION[$channel][$name] = $value; + } + } + + public static function global_set($name,$value) { $_SESSION[$name] = $value; } public static function &get($name) + { + $channel= ""; + if (isset($_POST['_channel_'])){ + $channel= $_POST['_channel_']; + } + + /* Global fallback if not set */ + if ($channel == ""){ + $ret = &$_SESSION[$name]; + return($ret); + } + + /* Sanity check */ + if (!session::channel_exists($channel)){ + msg_dialog::display(_("Internal error"), _("Requested channel does not exist! Please contact your Administrator."), FATAL_ERROR_DIALOG); + } + + $channel= "gch_".$channel; + $ret = &$_SESSION[$channel][$name]; + return($ret); + } + + public static function &global_get($name) { $ret = &$_SESSION[$name]; return($ret); @@ -50,7 +140,26 @@ class session { public static function delete($name) { - if(session::is_set($name)){ + $channel= ""; + if (isset($_POST['_channel_'])){ + $channel= $_POST['_channel_']; + } + + /* Global fallback if not set */ + if ($channel == ""){ + if(isset($_SESSION[$name])){ + unset($_SESSION[$name]); + } + } else { + if(isset($_SESSION[$channel][$name])){ + unset($_SESSION[$channel][$name]); + } + } + } + + public static function global_delete($name) + { + if($_SESSION[$name]){ unset($_SESSION[$name]); } } @@ -60,6 +169,11 @@ class session { return(session::delete($name)); } + public static function global_un_set($name) + { + return(session::global_delete($name)); + } + public static function start() { /* Set cookie lifetime to one day (The parameter is in seconds ) */ diff --git a/gosa-core/include/class_tabs.inc b/gosa-core/include/class_tabs.inc index b4e72f9e0..feb50d164 100644 --- a/gosa-core/include/class_tabs.inc +++ b/gosa-core/include/class_tabs.inc @@ -230,7 +230,7 @@ class tabs font-size:13px; color: gray;' title=\"$title\">".$title.""; - }elseif (session::get('js')==FALSE){ + }elseif (session::global_get('js')==FALSE){ $display.= "
"; } else { diff --git a/gosa-core/include/class_userinfo.inc b/gosa-core/include/class_userinfo.inc index 4564beda6..912bb29a0 100644 --- a/gosa-core/include/class_userinfo.inc +++ b/gosa-core/include/class_userinfo.inc @@ -80,7 +80,7 @@ class userinfo public function reset_acl_cache() { /* Initialize ACL_CACHE */ - session::set('ACL_CACHE',array()); + session::global_set('ACL_CACHE',array()); } function loadACL() @@ -328,7 +328,7 @@ class userinfo } /* Push cache answer? */ - $ACL_CACHE = &session::get('ACL_CACHE'); + $ACL_CACHE = &session::global_get('ACL_CACHE'); if (isset($ACL_CACHE["$dn+$object+$attribute"])){ $ret = $ACL_CACHE["$dn+$object+$attribute"]; if($skip_write){ @@ -526,7 +526,7 @@ class userinfo } /* Use cached results if possilbe */ - $ACL_CACHE = &session::get('ACL_CACHE'); + $ACL_CACHE = &session::global_get('ACL_CACHE'); if(!is_array($module)){ $module = array($module); diff --git a/gosa-core/include/functions.inc b/gosa-core/include/functions.inc index ae3ccfc8e..2f137ba65 100644 --- a/gosa-core/include/functions.inc +++ b/gosa-core/include/functions.inc @@ -164,7 +164,7 @@ function make_seed() { /* Debug level action */ function DEBUG($level, $line, $function, $file, $data, $info="") { - if (session::get('DEBUGLEVEL') & $level){ + if (session::global_get('DEBUGLEVEL') & $level){ $output= "DEBUG[$level] "; if ($function != ""){ $output.= "($file:$function():$line) - $info: "; @@ -219,10 +219,10 @@ function get_browser_language() /* Rewrite ui object to another dn */ function change_ui_dn($dn, $newdn) { - $ui= session::get('ui'); + $ui= session::global_get('ui'); if ($ui->dn == $dn){ $ui->dn= $newdn; - session::set('ui',$ui); + session::global_set('ui',$ui); } } @@ -247,7 +247,7 @@ function get_template_path($filename= '', $plugin= FALSE, $path= "") /* Return plugin dir or root directory? */ if ($plugin){ if ($path == ""){ - $nf= preg_replace("!^".$BASE_DIR."/!", "", session::get('plugin_dir')); + $nf= preg_replace("!^".$BASE_DIR."/!", "", session::global_get('plugin_dir')); } else { $nf= preg_replace("!^".$BASE_DIR."/!", "", $path); } @@ -258,7 +258,7 @@ function get_template_path($filename= '', $plugin= FALSE, $path= "") return ("$BASE_DIR/ihtml/themes/default/$nf/$filename"); } if ($path == ""){ - return (session::get('plugin_dir')."/$filename"); + return (session::global_get('plugin_dir')."/$filename"); } else { return ($path."/$filename"); } @@ -411,7 +411,7 @@ function ldap_login_user_htaccess ($username) $ui->loadACL(); /* TODO: check java script for htaccess authentication */ - session::set('js',true); + session::global_set('js',true); return ($ui); } @@ -603,10 +603,10 @@ function add_lock($object, $user) /* Remember which entries were opened as read only, because we don't need to remove any locks for them later. */ - if(!session::is_set("LOCK_CACHE")){ - session::set("LOCK_CACHE",array("")); + if(!session::global_is_set("LOCK_CACHE")){ + session::global_set("LOCK_CACHE",array("")); } - $cache = &session::get("LOCK_CACHE"); + $cache = &session::global_get("LOCK_CACHE"); if(isset($_POST['open_readonly'])){ $cache['READ_ONLY'][$object] = TRUE; return; @@ -675,8 +675,8 @@ function del_lock ($object) /* If this object was opened in read only mode then skip removing the lock entry, there wasn't any lock created. */ - if(session::is_set("LOCK_CACHE")){ - $cache = &session::get("LOCK_CACHE"); + if(session::global_is_set("LOCK_CACHE")){ + $cache = &session::global_get("LOCK_CACHE"); if(isset($cache['READ_ONLY'][$object])){ unset($cache['READ_ONLY'][$object]); return; @@ -1025,7 +1025,7 @@ function get_list($filter, $category, $base= "", $attributes= array(), $flags= G function check_sizelimit() { /* Ignore dialog? */ - if (session::is_set('size_ignore') && session::get('size_ignore')){ + if (session::global_is_set('size_ignore') && session::global_get('size_ignore')){ return (""); } @@ -1033,8 +1033,8 @@ function check_sizelimit() if (session::is_set('limit_exceeded') && session::get('limit_exceeded')){ $smarty= get_smarty(); $smarty->assign('warning', sprintf(_("The size limit of %d entries is exceed!"), - session::get('size_limit'))); - $smarty->assign('limit_message', sprintf(_("Set the new size limit to %s and show me this message if the limit still exceeds"), '')); + session::global_get('size_limit'))); + $smarty->assign('limit_message', sprintf(_("Set the new size limit to %s and show me this message if the limit still exceeds"), '')); return($smarty->fetch(get_template_path('sizelimit.tpl'))); } @@ -1044,7 +1044,7 @@ function check_sizelimit() function print_sizelimit_warning() { - if (session::is_set('size_limit') && session::get('size_limit') >= 10000000 || + if (session::global_is_set('size_limit') && session::global_get('size_limit') >= 10000000 || (session::is_set('limit_exceeded') && session::get('limit_exceeded'))){ $config= ""; } else { @@ -1065,25 +1065,25 @@ function eval_sizelimit() if (tests::is_id($_POST['new_limit']) && isset($_POST['action']) && $_POST['action']=="newlimit"){ - session::set('size_limit', validate($_POST['new_limit'])); + session::global_set('size_limit', validate($_POST['new_limit'])); session::set('size_ignore', FALSE); } /* User wants no limits? */ if (isset($_POST['action']) && $_POST['action']=="ignore"){ - session::set('size_limit', 0); - session::set('size_ignore', TRUE); + session::global_set('size_limit', 0); + session::global_set('size_ignore', TRUE); } /* User wants incomplete results */ if (isset($_POST['action']) && $_POST['action']=="limited"){ - session::set('size_ignore', TRUE); + session::global_set('size_ignore', TRUE); } } getMenuCache(); /* Allow fallback to dialog */ if (isset($_POST['edit_sizelimit'])){ - session::set('size_ignore',FALSE); + session::global_set('size_ignore',FALSE); } } diff --git a/gosa-core/include/functions_helpviewer.inc b/gosa-core/include/functions_helpviewer.inc index 1c282794d..13a528d7d 100644 --- a/gosa-core/include/functions_helpviewer.inc +++ b/gosa-core/include/functions_helpviewer.inc @@ -63,9 +63,9 @@ function genIndex() { global $helpobject; $str = ""; - $helpobject = session::get('helpobject'); + $helpobject = session::global_get('helpobject'); $ui= get_userinfo(); - $test = new pluglist(session::get('config'), $ui); + $test = new pluglist(session::global_get('config'), $ui); $current_hl = ""; foreach($helpobject['helpconf'] as $id => $attrs){ $path = $test -> get_path($id);