Code

Updated image reload in gotomasses
[gosa.git] / gosa-core / html / setup.php
index e98b41cfbf7810569d90ea8d37e42f1a9fcb785c..e4be820b13353faaa4034969c3d5317e1f5c3a7e 100644 (file)
@@ -1,25 +1,24 @@
 <?php
-
-/* 
- This code is part of GOsa (https://gosa.gonicus.de)
- Copyright (C) 2007 Fabian Hickert
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
-*/
-
-
+/*
+ * This code is part of GOsa (http://www.gosa-project.org)
+ * Copyright (C) 2003-2008 GONICUS GmbH
+ *
+ * ID: $$Id$$
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
 
 /* Get standard functions */
 require_once ("../include/php_setup.inc");
@@ -50,24 +49,14 @@ session_cache_expire(60*24);  // default is 180
 ini_set("session.gc_maxlifetime",24*60*60);
 
 /* Start session */
-session_start ();
-$_SESSION['DEBUGLEVEL']= 1;
-
-/* Check for js */
-if (!isset($_GET['js']) && !isset($_SESSION['js'])){
-  echo '<script language="JavaScript" type="text/javascript">';
-  echo '  location = "setup.php?js=true";';
-  echo '</script>';
-
-  $_SESSION['js']= FALSE;
-} elseif(isset($_GET['js'])) {
-  $_SESSION['js']= TRUE;
-}
+session::start();
+session::set('DEBUGLEVEL',1);
+session::set('errorsAlreadyPosted',array());
 
 /* 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 +69,30 @@ 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'];
+/* Check for js */
+if (!isset($_GET['js']) && !session::is_set('js')){
+  echo '<script language="JavaScript" type="text/javascript">';
+  echo '  location = "setup.php?js=true";';
+  echo '</script>';
+
+  session::set('js',FALSE);
+} elseif(isset($_GET['js'])) {
+  session::set('js',TRUE);
+}
+
+
+$lang = session::get('lang');
 /* Append .UTF-8 to language string if necessary */
 if(!preg_match("/utf(-)8$/i",$lang)){
   $lang .= ".UTF-8";
@@ -104,7 +105,7 @@ $GLOBALS['t_gettext_message_dir'] = $BASE_DIR.'/locale/';
 
 /* Set the text domain as 'messages' */
 $domain = 'messages';
-bindtextdomain($domain, "$BASE_DIR/locale");
+bindtextdomain($domain, LOCALE_DIR);
 textdomain($domain);
 
 
@@ -112,9 +113,6 @@ textdomain($domain);
 $display = "";
 require_once("../setup/main.inc");
 
-/* Print_out last ErrorMessage repeated string. */
-print_red(NULL);
-
 $smarty->assign("date", date("l, dS F Y H:i:s O"));
 $header= "<!-- headers.tpl-->".$smarty->fetch(get_template_path('setup_headers.tpl'));
 
@@ -122,7 +120,7 @@ $header= "<!-- headers.tpl-->".$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= '<script language="JavaScript" type="text/javascript">';
   $focus.= 'document.forms[0].error_accept.focus();';
   $focus.= '</script>';
@@ -133,10 +131,11 @@ $focus.= 'next_msg_dialog();';
 $focus.= '</script>';
 
 /* 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 != ""){