Code

Updated stats handling.
[gosa.git] / gosa-core / html / setup.php
index 77454483a136098816abe55d9170efefd668fc5b..4b692e02639a45e2ea2bda33de2afc8496408e68 100644 (file)
@@ -1,30 +1,34 @@
 <?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");
 require_once ("functions.inc");
 
+// Do not use the GOsa default error handler.
+// To do so we require a valid config object - and at this point 
+//  we doesn't have one.
+restore_error_handler();
+
 require_once("../setup/class_setup.inc");
 require_once("../setup/class_setupStep.inc");
 require_once("../setup/class_setupStep_Welcome.inc");
@@ -32,9 +36,6 @@ require_once("../setup/class_setupStep_Language.inc");
 require_once("../setup/class_setupStep_Checks.inc");
 require_once("../setup/class_setupStep_License.inc");
 require_once("../setup/class_setupStep_Ldap.inc");
-require_once("../setup/class_setupStep_Config1.inc");
-require_once("../setup/class_setupStep_Config2.inc");
-require_once("../setup/class_setupStep_Config3.inc");
 require_once("../setup/class_setupStep_Schema.inc");
 require_once("../setup/class_setupStep_Migrate.inc");
 require_once("../setup/class_setupStep_Feedback.inc");
@@ -51,47 +52,54 @@ ini_set("session.gc_maxlifetime",24*60*60);
 
 /* Start session */
 session::start();
-session::set('DEBUGLEVEL',1);
-
-/* 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);
-}
+session::global_set('debugLevel',1);
+session::set('errorsAlreadyPosted',array());
 
 /* Attribute initialization, reset errors */
 session::set('errors',"");
 session::set('errorsAlreadyPosted',array());
 session::set('LastError',"");
 
-/* Set template compile directory */
-$smarty->compile_dir= '/var/spool/gosa/';
+$smarty->compile_dir= "/var/spool/gosa/";
+if (!(is_dir($smarty->compile_dir) && is_writable($smarty->compile_dir))){
+
+    if(isset($_SERVER['SCRIPT_FILENAME'])){
+        $smarty->compile_dir= preg_replace("#/html/.*$#","",$_SERVER['SCRIPT_FILENAME']);
+    }
+}
 
 /* Check for compile directory */
 if (!(is_dir($smarty->compile_dir) && is_writable($smarty->compile_dir))){
-  msg_dialog::display(_("Smarty"),sprintf(_("Directory '%s' specified as compile directory is not accessible!"),
-    $smarty->compile_dir),FATAL_ERROR_DIALOG);
-  exit();
+    msg_dialog::display(_("Smarty"),sprintf( _("Compile directory %s is not accessible!"),
+                bold('/var/spool/gosa/')),FATAL_ERROR_DIALOG);
+    exit();
 }
 
 /* Get posted language */
-if(!session::is_set('lang')){
-  session::set('lang',get_browser_language());
+if(!session::global_is_set('lang')){
+  session::global_set('lang',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());
   }
 }
 
-$lang = session::get('lang');
+/* Check for js */
+if (!isset($_GET['js']) && !session::global_is_set('js')){
+  echo '<script language="JavaScript" type="text/javascript">';
+  echo '  location = "setup.php?js=true";';
+  echo '</script>';
+
+  session::global_set('js',FALSE);
+} elseif(isset($_GET['js'])) {
+  session::global_set('js',TRUE);
+}
+
+
+$lang = session::global_get('lang');
 /* Append .UTF-8 to language string if necessary */
 if(!preg_match("/utf(-)8$/i",$lang)){
   $lang .= ".UTF-8";
@@ -112,6 +120,7 @@ textdomain($domain);
 $display = "";
 require_once("../setup/main.inc");
 
+$smarty->assign ("title","GOsa");
 $smarty->assign("date", date("l, dS F Y H:i:s O"));
 $header= "<!-- headers.tpl-->".$smarty->fetch(get_template_path('setup_headers.tpl'));
 
@@ -130,7 +139,7 @@ $focus.= 'next_msg_dialog();';
 $focus.= '</script>';
 
 /* 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());
@@ -142,8 +151,11 @@ if ($error_collector != ""){
 } else {
   $smarty->assign("php_errors", "");
 }
-
-$smarty->assign("version",get_gosa_version());
+if(function_exists("get_gosa_version")){
+  $smarty->assign("version",get_gosa_version());
+}else{
+  $smarty->assign("version","");
+}
 
 echo $header.$smarty->fetch("../setup/setup_frame.tpl");
 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: