Code

Fixed goPhone conference language selection
[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");
27 require_once ("class_timezones.inc");
29 require_once("../setup/class_setup.inc");
30 require_once("../setup/class_setupStep.inc");
31 require_once("../setup/class_setupStep_Welcome.inc");
32 require_once("../setup/class_setupStep_Language.inc");
33 require_once("../setup/class_setupStep_Checks.inc");
34 require_once("../setup/class_setupStep_License.inc");
35 require_once("../setup/class_setupStep_Ldap.inc");
36 require_once("../setup/class_setupStep_Config1.inc");
37 require_once("../setup/class_setupStep_Config2.inc");
38 require_once("../setup/class_setupStep_Config3.inc");
39 require_once("../setup/class_setupStep_Schema.inc");
40 require_once("../setup/class_setupStep_Migrate.inc");
41 require_once("../setup/class_setupStep_Feedback.inc");
42 require_once("../setup/class_setupStep_Finish.inc");
45 /* Set header */
46 header("Content-type: text/html; charset=UTF-8");
48 /* Set cookie lifetime to one day (The parameter is in seconds ) */
49 session_set_cookie_params(24*60*60);
50 session_cache_expire(60*24);  // default is 180
51 ini_set("session.gc_maxlifetime",24*60*60);
53 /* Start session */
54 session_start ();
55 $_SESSION['DEBUGLEVEL']= 1;
57 /* Attribute initialization, reset errors */
58 $_SESSION['errors']             = "";
59 $_SESSION['errorsAlreadyPosted']= array();
60 $_SESSION['LastError']          = "";
62 /* Set template compile directory */
63 $smarty->compile_dir= '/var/spool/gosa/';
65 /* Check for compile directory */
66 if (!(is_dir($smarty->compile_dir) && is_writable($smarty->compile_dir))){
67   echo sprintf(_("Directory '%s' specified as compile directory is not accessible!"),
68         $smarty->compile_dir);
69   exit();
70 }
71 /* Get posted language */
72 if(!isset($_SESSION['lang'])){
73   $_SESSION['lang'] = get_browser_language();
74 }
75 if(isset($_POST['lang_selected'])){
76   if($_POST['lang_selected'] != ""){
77     $_SESSION['lang'] = $_POST['lang_selected'];
78   }else{
79     $_SESSION['lang'] = get_browser_language();
80   }
81 }
83 /* Check for js */
84 if (!isset($_GET['js']) && !isset($_SESSION['js'])){
85   echo '<script language="JavaScript" type="text/javascript">';
86   echo '  location = "setup.php?js=true";';
87   echo '</script>';
89   $_SESSION['js']= FALSE;
90 } elseif(isset($_GET['js'])) {
91   $_SESSION['js']= TRUE;
92 }
94 $lang = $_SESSION['lang'];
95 /* Append .UTF-8 to language string if necessary */
96 if(!preg_match("/utf(-)8$/i",$lang)){
97   $lang .= ".UTF-8";
98 }
99 putenv("LANGUAGE=");
100 putenv("LANG=$lang");
101 setlocale(LC_ALL, $lang);
102 $GLOBALS['t_language']= $lang;
103 $GLOBALS['t_gettext_message_dir'] = $BASE_DIR.'/locale/';
105 /* Set the text domain as 'messages' */
106 $domain = 'messages';
107 bindtextdomain($domain, "$BASE_DIR/locale");
108 textdomain($domain);
111 /* Call setup */
112 $display = "";
113 require_once("../setup/main.inc");
115 /* Print_out last ErrorMessage repeated string. */
116 print_red(NULL);
118 $smarty->assign("date", date("l, dS F Y H:i:s O"));
119 $header= "<!-- headers.tpl-->".$smarty->fetch(get_template_path('setup_headers.tpl'));
120 /* show web frontend */
121 $smarty->assign("contents"  , $display);
122 $smarty->assign("navigation", $_SESSION['setup']->get_navigation_html());
123 $smarty->assign("header", $_SESSION['setup']->get_header_html());
124 $smarty->assign("bottom", $_SESSION['setup']->get_bottom_html());
126 if ($error_collector != ""){
127   $smarty->assign("php_errors", preg_replace("/%BUGBODY%/",$error_collector_mailto,$error_collector)."</div>");
128 } else {
129   $smarty->assign("php_errors", "");
131 if (isset($_SESSION['errors'])){
132   $smarty->assign("errors", $_SESSION['errors']);
133 }else{
134   $smarty->assign("errors"    , "");
137 $smarty->assign("version",get_gosa_version());
139 echo $header.$smarty->fetch("../setup/setup_frame.tpl");
140 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
141 ?>