Code

Added html and documentation when calling update-gosa
[gosa.git] / gosa-core / html / setup.php
1 <?php
2 /*
3  * This code is part of GOsa (http://www.gosa-project.org)
4  * Copyright (C) 2003-2008 GONICUS GmbH
5  *
6  * ID: $$Id$$
7  *
8  * This program is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation; either version 2 of the License, or
11  * (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program; if not, write to the Free Software
20  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
21  */
23 /* Get standard functions */
24 require_once ("../include/php_setup.inc");
25 require_once ("functions.inc");
27 require_once("../setup/class_setup.inc");
28 require_once("../setup/class_setupStep.inc");
29 require_once("../setup/class_setupStep_Welcome.inc");
30 require_once("../setup/class_setupStep_Language.inc");
31 require_once("../setup/class_setupStep_Checks.inc");
32 require_once("../setup/class_setupStep_License.inc");
33 require_once("../setup/class_setupStep_Ldap.inc");
34 require_once("../setup/class_setupStep_Config1.inc");
35 require_once("../setup/class_setupStep_Config2.inc");
36 require_once("../setup/class_setupStep_Config3.inc");
37 require_once("../setup/class_setupStep_Schema.inc");
38 require_once("../setup/class_setupStep_Migrate.inc");
39 require_once("../setup/class_setupStep_Feedback.inc");
40 require_once("../setup/class_setupStep_Finish.inc");
43 /* Set header */
44 header("Content-type: text/html; charset=UTF-8");
46 /* Set cookie lifetime to one day (The parameter is in seconds ) */
47 session_set_cookie_params(24*60*60);
48 session_cache_expire(60*24);  // default is 180
49 ini_set("session.gc_maxlifetime",24*60*60);
51 /* Start session */
52 session::start();
53 session::set('DEBUGLEVEL',1);
54 session::set('errorsAlreadyPosted',array());
56 /* Attribute initialization, reset errors */
57 session::set('errors',"");
58 session::set('errorsAlreadyPosted',array());
59 session::set('LastError',"");
61 /* Set template compile directory */
62 $smarty->compile_dir= '/var/spool/gosa/';
64 /* Check for compile directory */
65 if (!(is_dir($smarty->compile_dir) && is_writable($smarty->compile_dir))){
66   msg_dialog::display(_("Smarty"),sprintf(_("Directory '%s' specified as compile directory is not accessible!"),
67     $smarty->compile_dir),FATAL_ERROR_DIALOG);
68   exit();
69 }
71 /* Get posted language */
72 if(!session::is_set('lang')){
73   session::set('lang',get_browser_language());
74 }
75 if(isset($_POST['lang_selected'])){
76   if($_POST['lang_selected'] != ""){
77     session::set('lang',$_POST['lang_selected']);
78   }else{
79     session::set('lang',get_browser_language());
80   }
81 }
83 /* Check for js */
84 if (!isset($_GET['js']) && !session::is_set('js')){
85   echo '<script language="JavaScript" type="text/javascript">';
86   echo '  location = "setup.php?js=true";';
87   echo '</script>';
89   session::set('js',FALSE);
90 } elseif(isset($_GET['js'])) {
91   session::set('js',TRUE);
92 }
95 $lang = session::get('lang');
96 /* Append .UTF-8 to language string if necessary */
97 if(!preg_match("/utf(-)8$/i",$lang)){
98   $lang .= ".UTF-8";
99 }
100 putenv("LANGUAGE=");
101 putenv("LANG=$lang");
102 setlocale(LC_ALL, $lang);
103 $GLOBALS['t_language']= $lang;
104 $GLOBALS['t_gettext_message_dir'] = $BASE_DIR.'/locale/';
106 /* Set the text domain as 'messages' */
107 $domain = 'messages';
108 bindtextdomain($domain, LOCALE_DIR);
109 textdomain($domain);
112 /* Call setup */
113 $display = "";
114 require_once("../setup/main.inc");
116 $smarty->assign("date", date("l, dS F Y H:i:s O"));
117 $header= "<!-- headers.tpl-->".$smarty->fetch(get_template_path('setup_headers.tpl'));
121 /* Set focus to the error button if we've an error message */
122 $focus= "";
123 if (session::is_set('errors') && session::get('errors') != ""){
124   $focus= '<script language="JavaScript" type="text/javascript">';
125   $focus.= 'document.forms[0].error_accept.focus();';
126   $focus.= '</script>';
129 $focus= '<script language="JavaScript" type="text/javascript">';
130 $focus.= 'next_msg_dialog();';
131 $focus.= '</script>';
133 /* show web frontend */
134 $setup = session::get('setup');
135 $smarty->assign("contents"  , $display);
136 $smarty->assign("navigation", $setup->get_navigation_html());
137 $smarty->assign("header", $setup->get_header_html());
138 $smarty->assign("bottom", $focus.$setup->get_bottom_html());
139 $smarty->assign("msg_dialogs", msg_dialog::get_dialogs());
141 if ($error_collector != ""){
142   $smarty->assign("php_errors", preg_replace("/%BUGBODY%/",$error_collector_mailto,$error_collector)."</div>");
143 } else {
144   $smarty->assign("php_errors", "");
147 $smarty->assign("version",get_gosa_version());
149 echo $header.$smarty->fetch("../setup/setup_frame.tpl");
150 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
151 ?>