Code

52f528b38b1fc285dbc4855a89959338f119c36e
[gosa.git] / html / setup.php
1 <?php
3 /* 
4  This code is part of GOsa (https://gosa.gonicus.de)
5  Copyright (C) 2007 Fabian Hickert
7  This program is free software; you can redistribute it and/or modify
8  it under the terms of the GNU General Public License as published by
9  the Free Software Foundation; either version 2 of the License, or
10  (at your option) any later version.
12  This program is distributed in the hope that it will be useful,
13  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  GNU General Public License for more details.
17  You should have received a copy of the GNU General Public License
18  along with this program; if not, write to the Free Software
19  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
20 */
24 /* Get standard functions */
25 require_once ("../include/php_setup.inc");
26 require_once ("functions.inc");
28 require_once("../setup/class_setup.inc");
29 require_once("../setup/class_setupStep.inc");
30 require_once("../setup/class_setupStep_Welcome.inc");
31 require_once("../setup/class_setupStep_Language.inc");
32 require_once("../setup/class_setupStep_Checks.inc");
33 require_once("../setup/class_setupStep_License.inc");
34 require_once("../setup/class_setupStep_Ldap.inc");
35 require_once("../setup/class_setupStep_Config1.inc");
36 require_once("../setup/class_setupStep_Config2.inc");
37 require_once("../setup/class_setupStep_Config3.inc");
38 require_once("../setup/class_setupStep_Schema.inc");
39 require_once("../setup/class_setupStep_Finish.inc");
42 /* Set header */
43 header("Content-type: text/html; charset=UTF-8");
45 /* Set cookie lifetime to one day (The parameter is in seconds ) */
46 session_set_cookie_params(24*60*60);
47 session_cache_expire(60*24);  // default is 180
48 ini_set("session.gc_maxlifetime",24*60*60);
50 /* Start session */
51 session_start ();
52 $_SESSION['DEBUGLEVEL']= 1;
54 /* Check for js */
55 if (!isset($_GET['js']) && !isset($_SESSION['js'])){
56   echo '<script language="JavaScript" type="text/javascript">';
57   echo '  location = "setup.php?js=true";';
58   echo '</script>';
60   $_SESSION['js']= FALSE;
61 } elseif(isset($_GET['js'])) {
62   $_SESSION['js']= TRUE;
63 }
65 /* Attribute initialization, reset errors */
66 $_SESSION['errors']             = "";
67 $_SESSION['errorsAlreadyPosted']= array();
68 $_SESSION['LastError']          = "";
70 /* Set template compile directory */
71 if (isset ($config->data['MAIN']['COMPILE'])){
72   $smarty->compile_dir= $config->data['MAIN']['COMPILE'];
73 } else {
74   $smarty->compile_dir= '/var/spool/gosa/';
75 }
79 /* Get posted language */
80 if(!isset($_SESSION['lang'])){
81   $_SESSION['lang'] = get_browser_language();
82 }
83 if(isset($_POST['lang_selected'])){
84   if($_POST['lang_selected'] != ""){
85     $_SESSION['lang'] = $_POST['lang_selected'];
86   }else{
87     $_SESSION['lang'] = get_browser_language();
88   }
89 }
91 $lang = $_SESSION['lang'];
92 $lang.=".UTF-8";
93 putenv("LANGUAGE=");
94 putenv("LANG=$lang");
95 setlocale(LC_ALL, $lang);
96 $GLOBALS['t_language']= $lang;
97 $GLOBALS['t_gettext_message_dir'] = $BASE_DIR.'/locale/';
99 /* Set the text domain as 'messages' */
100 $domain = 'messages';
101 bindtextdomain($domain, "$BASE_DIR/locale");
102 textdomain($domain);
105 /* Call setup */
106 $display = "";
107 require_once("../setup/main.inc");
109 /* Print_out last ErrorMessage repeated string. */
110 print_red(NULL);
112 $smarty->assign("date", date("l, dS F Y H:i:s O"));
113 $header= "<!-- headers.tpl-->".$smarty->fetch(get_template_path('setup_headers.tpl'));
114 /* show web frontend */
115 $smarty->assign("contents"  , $display);
116 $smarty->assign("navigation", $_SESSION['setup']->get_navigation_html());
117 $smarty->assign("header", $_SESSION['setup']->get_header_html());
118 $smarty->assign("bottom", $_SESSION['setup']->get_bottom_html());
120 if ($error_collector != ""){
121   $smarty->assign("php_errors", $error_collector."</div>");
122 } else {
123   $smarty->assign("php_errors", "");
125 if (isset($_SESSION['errors'])){
126   $smarty->assign("errors", $_SESSION['errors']);
127 }else{
128   $smarty->assign("errors"    , "");
131 $smarty->assign("version",get_gosa_version());
133 echo $header.$smarty->fetch("../setup/setup_frame.tpl");
134 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
135 ?>