From 1088995c0f64ad025984dd8e2fe7df1510929f62 Mon Sep 17 00:00:00 2001 From: hickert Date: Thu, 3 Jan 2008 13:19:26 +0000 Subject: [PATCH] Replaced $_SESSION with session:: calls git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@8192 594d385d-05f5-0310-b6e9-bd551577e9d8 --- gosa-core/html/combine.php | 2 +- gosa-core/html/getFAIscript.php | 15 ++++++----- gosa-core/html/get_attachment.php | 6 ++--- gosa-core/html/getbin.php | 12 ++++----- gosa-core/html/getfax.php | 14 +++++------ gosa-core/html/getkiosk.php | 6 ++--- gosa-core/html/getldif.php | 6 ++--- gosa-core/html/getvcard.php | 4 +-- gosa-core/html/getxls.php | 6 ++--- gosa-core/html/helpviewer.php | 38 ++++++++++++++++------------ gosa-core/html/index.php | 42 +++++++++++++++---------------- gosa-core/html/logout.php | 6 ++--- gosa-core/html/main.php | 4 +-- gosa-core/html/password.php | 26 +++++++++---------- gosa-core/html/setup.php | 35 +++++++++++++------------- 15 files changed, 116 insertions(+), 106 deletions(-) diff --git a/gosa-core/html/combine.php b/gosa-core/html/combine.php index d5c23fc79..69c8a9306 100644 --- a/gosa-core/html/combine.php +++ b/gosa-core/html/combine.php @@ -25,7 +25,7 @@ error_reporting (0); session_start (); /* Logged in? Simple security check */ -if (!isset($_SESSION['ui'])){ +if (!session::is_set('ui')){ new log("security","all/all","",array(),"Error: combine.php called without session") ; header ("Location: index.php"); exit; diff --git a/gosa-core/html/getFAIscript.php b/gosa-core/html/getFAIscript.php index 45277a6fd..1a55d0487 100644 --- a/gosa-core/html/getFAIscript.php +++ b/gosa-core/html/getFAIscript.php @@ -20,9 +20,12 @@ restore_error_handler(); function getFAIScript ($id) { -restore_error_handler(); - $ldap = $_SESSION['config']->get_ldap_link(); - $ldap->cd($_SESSION['config']->current['BASE']); + restore_error_handler(); + + $config = session::get('config'); + + $ldap = $config->get_ldap_link(); + $ldap->cd($config->current['BASE']); $sr= $ldap->cat($id, array("FAItemplateFile", "FAIscript", "cn", "objectClass")); $ei= ldap_first_entry($ldap->cid, $sr); @@ -66,13 +69,13 @@ error_reporting (E_ALL | E_STRICT); session_start (); /* Logged in? Simple security check */ -if (!isset($_SESSION['ui'])){ +if (!session::is_set('ui')){ new log("security","fai","",array(),"Error: getFAIScript.php called without session") ; header ("Location: index.php"); exit; } -$ui= $_SESSION["ui"]; -$config= $_SESSION['config']; +$ui= session::get("ui"); +$config= session::get('config'); /* Check ACL's */ #FIXME Use more specific acl categories instead of all/all diff --git a/gosa-core/html/get_attachment.php b/gosa-core/html/get_attachment.php index d853e5b9f..850950ab4 100644 --- a/gosa-core/html/get_attachment.php +++ b/gosa-core/html/get_attachment.php @@ -25,14 +25,14 @@ session_start (); /* Logged in? Simple security check */ -if (!isset($_SESSION['ui'])){ +if (!session::is_set('ui')){ new log("security","glpi/all","",array(),"Error: get_attachment.php called without session") ; header ("Location: index.php"); exit; } -$ui= $_SESSION["ui"]; +$ui= session::get("ui"); -$config = $_SESSION['config']; +$config = session::get('config'); /* Abort class construction, if no db is defined */ if(!isset($config->data['SERVERS']['GLPI'])){ return; diff --git a/gosa-core/html/getbin.php b/gosa-core/html/getbin.php index daa16de6e..183924935 100644 --- a/gosa-core/html/getbin.php +++ b/gosa-core/html/getbin.php @@ -25,7 +25,7 @@ error_reporting (0); session_start (); /* Logged in? Simple security check */ -if (!isset($_SESSION['ui'])){ +if (!session::is_set('ui')){ new log("security","unknown","",array(),"Error: getbin.php called without session") ; header ("Location: index.php"); exit; @@ -36,15 +36,15 @@ header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); header("Cache-Control: no-cache"); header("Pragma: no-cache"); header("Cache-Control: post-check=0, pre-check=0"); -$bintype = isset($_SESSION['binarytype']) - ? $_SESSION['binarytype'] : "octet-stream"; +$bintype = session::is_set('binarytype') + ? session::get('binarytype') : "octet-stream"; header("Content-type: " . $bintype); -if (isset($_SESSION['binaryfile'])) { +if (session::is_set('binaryfile')) { header( "Content-disposition: attachment; filename=" - . $_SESSION['binaryfile'] ); + . session::get('binaryfile')); } -echo $_SESSION['binary']; +echo session::get('binary'); error_reporting (E_ALL | E_STRICT); // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: diff --git a/gosa-core/html/getfax.php b/gosa-core/html/getfax.php index 374b7e255..98e89c7c7 100644 --- a/gosa-core/html/getfax.php +++ b/gosa-core/html/getfax.php @@ -25,15 +25,15 @@ error_reporting (0); session_start (); /* Logged in? Simple security check */ -if (!isset($_SESSION['ui'])){ +if (!session::is_set('ui')){ new log("security","faxreport/faxreport","",array(),"Error: getfax.php called without session") ; header ("Location: index.php"); exit; } -$ui= $_SESSION["ui"]; +$ui= session::is_set("ui"); /* User object present? */ -if (!isset($_SESSION['fuserfilter'])){ +if (!session::is_set('fuserfilter')){ new log("security","faxreport/faxreport","",array(),"getfax.php called without propper session data") ; header ("Location: index.php"); exit; @@ -41,13 +41,13 @@ if (!isset($_SESSION['fuserfilter'])){ /* Get loaded servers */ foreach (array("FAX_SERVER", "FAX_LOGIN", "FAX_PASSWORD") as $val){ - if (isset ($_SESSION[$val])){ - $$val= $_SESSION[$val]; + if (session::is_set($val)){ + $$val= session::get($val); } } /* Load fax entry */ -$config= $_SESSION['config']; +$config= session::get('config'); $cfg= $config->data['SERVERS']['FAX']; $link = mysql_pconnect($cfg['SERVER'], $cfg['LOGIN'], $cfg['PASSWORD']) or die(_("Could not connect to database server!")); @@ -59,7 +59,7 @@ mysql_select_db("gofax") or die(_("Could not select database!")); $query = "SELECT id,uid FROM faxlog WHERE id = '".validate(stripcslashes($_GET['id']))."'"; $result = mysql_query($query) or die(_("Database query failed!")); $line = mysql_fetch_array($result, MYSQL_ASSOC); -if (!preg_match ("/'".$line["uid"]."'/", $_SESSION['fuserfilter'])){ +if (!preg_match ("/'".$line["uid"]."'/", session::get('fuserfilter'))){ die ("No permissions to view fax!"); } diff --git a/gosa-core/html/getkiosk.php b/gosa-core/html/getkiosk.php index 1b383e753..e5a7b6bc7 100644 --- a/gosa-core/html/getkiosk.php +++ b/gosa-core/html/getkiosk.php @@ -53,13 +53,13 @@ error_reporting (E_ALL | E_STRICT); session_start (); /* Logged in? Simple security check */ -if (!isset($_SESSION['ui'])){ +if (!session::is_set('ui')){ new log("security","fai","",array(),"Error: getkiosk.php called without session") ; header ("Location: index.php"); exit; } -$ui= $_SESSION["ui"]; -$config= $_SESSION['config']; +$ui= session::get("ui"); +$config= session::get('config'); /* Check ACL's */ #FIXME Use more specific acl categories instead of all/all diff --git a/gosa-core/html/getldif.php b/gosa-core/html/getldif.php index 95964d3ff..d5e528609 100644 --- a/gosa-core/html/getldif.php +++ b/gosa-core/html/getldif.php @@ -64,13 +64,13 @@ error_reporting (E_ALL | E_STRICT); session_start (); /* Logged in? Simple security check */ -if (!isset($_SESSION['ui'])){ +if (!session::is_set('ui')){ new log("security","all/all","",array(),"Error: getldif.php called without session") ; header ("Location: index.php"); exit; } -$ui= $_SESSION["ui"]; -$config= $_SESSION['config']; +$ui= session::get("ui"); +$config= session::get('config'); /* Check ACL's */ $dn = base64_decode($_GET['dn']); diff --git a/gosa-core/html/getvcard.php b/gosa-core/html/getvcard.php index a1c68bc82..9aba00617 100644 --- a/gosa-core/html/getvcard.php +++ b/gosa-core/html/getvcard.php @@ -25,7 +25,7 @@ error_reporting (0); session_start (); /* Logged in? Simple security check */ -if (!isset($_SESSION['ui'])){ +if (!session::is_set('ui')){ new log("security","all/all","",array(),"Error: getvcard.php called without session") ; header ("Location: index.php"); exit; @@ -53,7 +53,7 @@ if (preg_match('/MSIE 5.5/', $HTTP_USER_AGENT) || } /* Get entry */ -$config= $_SESSION['config']; +$config= session::get('config'); $ldap= $config->get_ldap_link(); $ldap->cat(base64_decode(validate($_GET['dn']))); diff --git a/gosa-core/html/getxls.php b/gosa-core/html/getxls.php index a9427a3ca..5db29b8b1 100644 --- a/gosa-core/html/getxls.php +++ b/gosa-core/html/getxls.php @@ -469,13 +469,13 @@ function dump_ldap ($mode= 0) session_start (); /* Logged in? Simple security check */ -if (!isset($_SESSION['ui'])){ +if (!session::is_set('ui')){ new log("security","all/all","",array(),"Error: getxls.php called without session") ; header ("Location: index.php"); exit; } -$ui = $_SESSION["ui"]; -$config = $_SESSION['config']; +$ui = session::get('ui'); +$config = session::get('config'); /* Check ACL's */ diff --git a/gosa-core/html/helpviewer.php b/gosa-core/html/helpviewer.php index 4cbc459ab..6fae266d4 100644 --- a/gosa-core/html/helpviewer.php +++ b/gosa-core/html/helpviewer.php @@ -28,16 +28,17 @@ restore_error_handler(); header("Content-type: text/html; charset=UTF-8"); session_start(); -$ui= $_SESSION["ui"]; -$config= $_SESSION['config']; /* If no config object is found in the session, abort help */ -if (!isset($_SESSION['config'])){ +if (!session::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'); + /* Language setup */ if ($config->data['MAIN']['LANG'] == ""){ $lang= get_browser_language(); @@ -58,7 +59,7 @@ bindtextdomain($domain, "$BASE_DIR/locale"); textdomain($domain); @DEBUG (DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $lang, "Setting language to"); -$config= $_SESSION['config']; +$config= session::get('config'); if (isset ($config->data['MAIN']['COMPILE'])){ $smarty->compile_dir= $config->data['MAIN']['COMPILE']; } else { @@ -70,14 +71,17 @@ $smarty->assign("title", "GOsa - "._("Help browser")); */ /* Generate helpobject */ -if(isset($_SESSION['helpobject'])){ - $helpobject = $_SESSION['helpobject']; +if(session::is_set('helpobject')){ + $helpobject = session::get('helpobject'); }else{ + + $plist = session::get('plist'); + $helpobject['lang'] = $lang; $helpobject['helpconf'] = array(); $helpobject['currentplug'] = ""; $helpobject['file'] = "index.html"; - $helpobject['helpconf'] = $_SESSION['plist']->gen_headlines(); + $helpobject['helpconf'] = $plist->gen_headlines(); } $lang = $lang[0].$lang[1]; @@ -97,11 +101,11 @@ $forward ="node1.html"; $helpdir =""; /* Every class which is called within a tab, stores its name in the Session. - * If $_SESSION['current_class_for_help'] isset, + * If session::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(isset($_SESSION['current_class_for_help'])){ +if(session::is_set('current_class_for_help')){ /* Create new XML parser with the path to the Xml file */ $xml = new parseXml("../doc/guide.xml"); @@ -110,7 +114,7 @@ if(isset($_SESSION['current_class_for_help'])){ $str = $xml->parse(); /* __LANG__ is used as placeholder for the used language*/ - $helpdir= @preg_replace("/__LANG__/i",$lang,$str[($_SESSION['current_class_for_help'])]['PATH']); + $helpdir= @preg_replace("/__LANG__/i",$lang,$str[(session::get('current_class_for_help'))]['PATH']); /* If there is no entry in the xml file for this class, display an error message */ if($helpdir == ""){ @@ -119,24 +123,24 @@ if(isset($_SESSION['current_class_for_help'])){ $header= "".$smarty->fetch(get_template_path('headers.tpl')); $display= ( $header.$smarty->fetch(get_template_path('help.tpl'))); echo $display; - unset($_SESSION['current_class_for_help']); + session::un_set('current_class_for_help'); exit(); } /* Save filename */ - $helpobject['file']= $str[($_SESSION['current_class_for_help'])]['FILE']; + $helpobject['file']= $str[(session::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'])){ - unset($_SESSION['current_class_for_help']); + session::un_set('current_class_for_help'); } }elseif(isset($_GET['plug'])){ /* This displays helpfiles depending on the current $_GET[plug] */ - $tmp = new pluglist($_SESSION['config'],NULL); + $tmp = new pluglist(session::get('config'),get_userinfo()); $path = $tmp->get_path($_GET['plug']); $helpobject['currentplug'] = $path; $helpobject['file'] = "index.html"; @@ -175,7 +179,7 @@ if(isset($_GET['pg'])){ $helpdir.="/"; /* Save current settings */ -$_SESSION['helpobject'] = $helpobject; +session::set('helpobject',$helpobject); /* * Display management @@ -243,9 +247,11 @@ if(isset($_POST['search'])){ * parse it, rework links images and so on */ $index = readfiles($helpdir,$prefix,$suffix,false,$helpobject['file']); + $lastresults = session::get('lastresults'); + /* if this page is result from a search, mark the search strings */ if(isset($_GET['mark'])){ - $matches = $_SESSION['lastresults'][preg_replace("/^.*\//i","",$helpobject['currentplug'])][$helpobject['file']]; + $matches = $lastresults[preg_replace("/^.*\//i","",$helpobject['currentplug'])][$helpobject['file']]; $index[$helpobject['file']]['content'] = markup_page($index[$helpobject['file']]['content'],$matches); } diff --git a/gosa-core/html/index.php b/gosa-core/html/index.php index 39f8b74f4..b5e9bf62b 100644 --- a/gosa-core/html/index.php +++ b/gosa-core/html/index.php @@ -74,8 +74,8 @@ function displayLogin() /* show login screen */ $smarty->assign ("PHPSESSID", session_id()); - if (isset($_SESSION['errors'])){ - $smarty->assign("errors", $_SESSION['errors']); + if (session::is_set('errors')){ + $smarty->assign("errors", session::get('errors')); } if ($error_collector != ""){ $smarty->assign("php_errors", $error_collector.""); @@ -96,17 +96,17 @@ session_start (); /* Destroy old session if exists. Else you will get your old session back, if you not logged out correctly. */ -if(is_array($_SESSION) && count($_SESSION)){ - session_destroy(); - session_start(); +if(is_array(session::get_all()) && count(session::get_all())){ + session::destroy(); + session::start(); } $username= ""; /* Reset errors */ -$_SESSION['errors'] = ""; -$_SESSION['errorsAlreadyPosted']= array(); -$_SESSION['LastError'] = ""; +session::set('errors',""); +session::set('errorsAlreadyPosted',""); +session::set('LastError',""); /* Check if we need to run setup */ if (!file_exists(CONFIG_DIR."/".CONFIG_FILE)){ @@ -115,13 +115,13 @@ if (!file_exists(CONFIG_DIR."/".CONFIG_FILE)){ } /* Reset errors */ -$_SESSION['errors']= ""; +session::set('errors',""); /* Check for java script */ if(isset($_POST['javascript']) && $_POST['javascript'] == "true") { - $_SESSION['js']= TRUE; + session::set('js',TRUE); }elseif(isset($_POST['javascript'])) { - $_SESSION['js']= FALSE; + session::set('js',FALSE); } /* Check if gosa.conf (.CONFIG_FILE) is accessible */ @@ -132,7 +132,7 @@ if (!is_readable(CONFIG_DIR."/".CONFIG_FILE)){ /* Parse configuration file */ $config= new config(CONFIG_DIR."/".CONFIG_FILE, $BASE_DIR); -$_SESSION['DEBUGLEVEL']= $config->data['MAIN']['DEBUGLEVEL']; +session::set('DEBUGLEVEL',$config->data['MAIN']['DEBUGLEVEL']); if ($_SERVER["REQUEST_METHOD"] != "POST"){ @DEBUG (DEBUG_CONFIG, __LINE__, __FUNCTION__, __FILE__, $config->data, "config"); } @@ -228,8 +228,8 @@ if (($_SERVER["REQUEST_METHOD"] == "POST" && isset($_POST['login'])) || $htacces $message= ""; /* Destroy old sessions, they cause a successfull login to relog again ...*/ - if(isset($_SESSION['_LAST_PAGE_REQUEST'])){ - $_SESSION['_LAST_PAGE_REQUEST'] = time(); + if(session::is_set('_LAST_PAGE_REQUEST')){ + session::set('_LAST_PAGE_REQUEST',time()); } if (!$htaccess_authenticated){ @@ -318,14 +318,14 @@ if (($_SERVER["REQUEST_METHOD"] == "POST" && isset($_POST['login'])) || $htacces del_user_locks($ui->dn); /* Save userinfo and plugin structure */ - $_SESSION['ui']= $ui; - $_SESSION['session_cnt']= 0; + session::set('ui',$ui); + session::set('session_cnt',0); /* Let GOsa trigger a new connection for each POST, save config to session. */ $config->get_departments(); $config->make_idepartments(); - $_SESSION['config']= $config; + session::set('config',$config); /* Restore filter settings from cookie, if available */ if(isset($config->data['MAIN']['SAVE_FILTER']) && preg_match("/true/",$config->data['MAIN']['SAVE_FILTER'])){ @@ -342,7 +342,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[$var] = $cookie[$var]; + session::set($var,$cookie[$var]); } } if(isset($cookie['plug'])){ @@ -428,8 +428,8 @@ $smarty->assign ("server_id", $selected); /* show login screen */ $smarty->assign ("PHPSESSID", session_id()); -if (isset($_SESSION['errors'])){ - $smarty->assign("errors", $_SESSION['errors']); +if (session::is_set('errors')){ + $smarty->assign("errors", session::get('errors')); } if ($error_collector != ""){ $smarty->assign("php_errors", preg_replace("/%BUGBODY%/",$error_collector_mailto,$error_collector).""); @@ -439,7 +439,7 @@ if ($error_collector != ""){ /* Set focus to the error button if we've an error message */ $focus= ""; -if (isset($_SESSION['errors']) && $_SESSION['errors'] != ""){ +if (session::is_set('errors') && session::get('errors') != ""){ $focus= ''; diff --git a/gosa-core/html/logout.php b/gosa-core/html/logout.php index fef58fb1b..e41c71326 100644 --- a/gosa-core/html/logout.php +++ b/gosa-core/html/logout.php @@ -26,13 +26,13 @@ header("Content-type: text/html; charset=UTF-8"); /* try to start session, so we can remove userlocks, if the old session is still available */ @session_start(); -if(isset($_SESSION['ui'])){ +if(session::is_set('ui')){ /* Get config & ui informations */ - $ui= $_SESSION["ui"]; + $ui= session::get("ui"); /* config used for del_user_locks & some lines below to detect the language */ - $config= $_SESSION["config"]; + $config= session::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 412ca9526..d604d994b 100644 --- a/gosa-core/html/main.php +++ b/gosa-core/html/main.php @@ -247,7 +247,7 @@ if (isset($_GET['reset'])){ } } -/* Install eGOsa hooks, convert _POST to _SESSION['POST'] */ +/* Install eGOsa hooks, convert _POST to session */ if(isset($_GET['explorer'])){ session::set('eGosa',TRUE); } @@ -323,7 +323,7 @@ if ($_SERVER["REQUEST_METHOD"] == "POST"){ $smarty->display(get_template_path('conflict.tpl')); exit (); } - session::set('session_cnt',$_SESSION['session_cnt'] + 1); + session::set('session_cnt', (session::get('session_cnt') + 1)); session::set('post_cnt' , validate($_POST['session_cnt']) + 1); } } diff --git a/gosa-core/html/password.php b/gosa-core/html/password.php index c93410bd4..801bba2cd 100644 --- a/gosa-core/html/password.php +++ b/gosa-core/html/password.php @@ -40,16 +40,16 @@ session_start(); /* Destroy old session if exists. Else you will get your old session back, if you not logged out correctly. */ -if(is_array($_SESSION) && count($_SESSION)){ - session_destroy(); - session_start(); +if(is_array(session::get_all()) && count(session::get_all())){ + session::destroy(); + session::start(); } /* Reset errors */ -$_SESSION['js'] = true; -$_SESSION['errors'] = ""; -$_SESSION['errorsAlreadyPosted']= array(); -$_SESSION['LastError'] = ""; +session::set('js',true); +session::set('errors',""); +session::set('errorsAlreadyPosted',array()); +session::set('LastError',""); /* Check if CONFIG_FILE is accessible */ if (!is_readable(CONFIG_DIR."/".CONFIG_FILE)){ @@ -59,7 +59,7 @@ if (!is_readable(CONFIG_DIR."/".CONFIG_FILE)){ /* Parse configuration file */ $config= new config(CONFIG_DIR."/".CONFIG_FILE, $BASE_DIR); -$_SESSION['DEBUGLEVEL']= $config->data['MAIN']['DEBUGLEVEL']; +session::set('DEBUGLEVEL',$config->data['MAIN']['DEBUGLEVEL']); if ($_SERVER["REQUEST_METHOD"] != "POST"){ @DEBUG (DEBUG_CONFIG, __LINE__, __FUNCTION__, __FILE__, $config->data, "config"); } @@ -124,7 +124,7 @@ if (isset($_GET['directory']) && isset($servers[$_GET['directory']])){ /* Set config to selected one */ $config->set_current($directory); -$_SESSION['config']= $config; +session::set('config',$config); if ($_SERVER["REQUEST_METHOD"] != "POST"){ @DEBUG (DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $lang, "Setting language to"); @@ -182,8 +182,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(isset($_SESSION['_LAST_PAGE_REQUEST'])){ - $_SESSION['_LAST_PAGE_REQUEST'] = time(); + if(session::is_set('_LAST_PAGE_REQUEST')){ + session::set('_LAST_PAGE_REQUEST',time()); } $message= array(); @@ -286,8 +286,8 @@ if ($ssl != "" && $config->data['MAIN']['WARNSSL'] == 'true'){ /* show login screen */ $smarty->assign ("PHPSESSID", session_id()); -if (isset($_SESSION['errors'])){ - $smarty->assign("errors", $_SESSION['errors']); +if (session::is_set('errors')){ + $smarty->assign("errors", session::get('errors'));; } if ($error_collector != ""){ $smarty->assign("php_errors", $error_collector.""); diff --git a/gosa-core/html/setup.php b/gosa-core/html/setup.php index e98b41cfb..e18c99a34 100644 --- a/gosa-core/html/setup.php +++ b/gosa-core/html/setup.php @@ -50,24 +50,24 @@ session_cache_expire(60*24); // default is 180 ini_set("session.gc_maxlifetime",24*60*60); /* Start session */ -session_start (); -$_SESSION['DEBUGLEVEL']= 1; +session::start(); +session::set('DEBUGLEVEL',1); /* Check for js */ -if (!isset($_GET['js']) && !isset($_SESSION['js'])){ +if (!isset($_GET['js']) && !session::is_set('js')){ echo ''; - $_SESSION['js']= FALSE; + session::set('js',FALSE); } elseif(isset($_GET['js'])) { - $_SESSION['js']= TRUE; + session::set('js',TRUE); } /* Attribute initialization, reset errors */ -$_SESSION['errors'] = ""; -$_SESSION['errorsAlreadyPosted']= array(); -$_SESSION['LastError'] = ""; +session::set('errors',""); +session::set('errorsAlreadyPosted',array()); +session::set('LastError',""); /* Set template compile directory */ $smarty->compile_dir= '/var/spool/gosa/'; @@ -80,18 +80,18 @@ if (!(is_dir($smarty->compile_dir) && is_writable($smarty->compile_dir))){ } /* Get posted language */ -if(!isset($_SESSION['lang'])){ - $_SESSION['lang'] = get_browser_language(); +if(!session::is_set('lang')){ + session::set('lang',get_browser_language()); } if(isset($_POST['lang_selected'])){ if($_POST['lang_selected'] != ""){ - $_SESSION['lang'] = $_POST['lang_selected']; + session::set('lang',$_POST['lang_selected']); }else{ - $_SESSION['lang'] = get_browser_language(); + session::set('lang',get_browser_language()); } } -$lang = $_SESSION['lang']; +$lang = session::get('lang'); /* Append .UTF-8 to language string if necessary */ if(!preg_match("/utf(-)8$/i",$lang)){ $lang .= ".UTF-8"; @@ -122,7 +122,7 @@ $header= "".$smarty->fetch(get_template_path('setup_headers.t /* Set focus to the error button if we've an error message */ $focus= ""; -if (isset($_SESSION['errors']) && $_SESSION['errors'] != ""){ +if (session::is_set('errors') && session::get('errors') != ""){ $focus= ''; @@ -133,10 +133,11 @@ $focus.= 'next_msg_dialog();'; $focus.= ''; /* show web frontend */ +$setup = session::get('setup'); $smarty->assign("contents" , $display); -$smarty->assign("navigation", $_SESSION['setup']->get_navigation_html()); -$smarty->assign("header", $_SESSION['setup']->get_header_html()); -$smarty->assign("bottom", $focus.$_SESSION['setup']->get_bottom_html()); +$smarty->assign("navigation", $setup->get_navigation_html()); +$smarty->assign("header", $setup->get_header_html()); +$smarty->assign("bottom", $focus.$setup->get_bottom_html()); $smarty->assign("msg_dialogs", msg_dialog::get_dialogs()); if ($error_collector != ""){ -- 2.30.2