Code

Updated deamon handle
[gosa.git] / gosa-core / html / main.php
index d604d994b0992c797cd7e5462107d08e6e9289ea..2b7f3a4a777c4599d13de67f70856572a9c77eaa 100644 (file)
@@ -24,18 +24,16 @@ $start = microtime();
 /* Basic setup, remove eventually registered sessions */
 require_once ("../include/php_setup.inc");
 require_once ("functions.inc");
-require_once ("functions_FAI.inc");
 
 /* Set header */
 header("Content-type: text/html; charset=UTF-8");
 
 /* Set the text domain as 'messages' */
 $domain = 'messages';
-bindtextdomain($domain, "$BASE_DIR/locale");
+bindtextdomain($domain, LOCALE_DIR);
 textdomain($domain);
 
 /* Remember everything we did after the last click */
-restore_error_handler();
 session::start();
 session::set('limit_exceeded',FALSE);
 
@@ -85,7 +83,7 @@ if(session::get('_LAST_PAGE_REQUEST') == ""){
    * kill session
    */
   if($request_time > $max_life){
-    session_unset();
+    session::destroy();
     new log("security","login","",array(),"main.php called without session - logging out") ;
     header ("Location: logout.php");
     exit;
@@ -114,7 +112,7 @@ if(!session::is_set('Last_init_lang')){
 
 /* If last language != current force navi reload */
 $lang= get_browser_language();
-if(session::get('Last_init_lang',$lang)){
+if(session::get('Last_init_lang') != $lang){
   $reload_navigation = true;
 }
 
@@ -122,7 +120,7 @@ if(session::get('Last_init_lang',$lang)){
 session::set('Last_init_lang',$lang);
 
 /* Preset current main base */
-if(session::is_set('CurrentMainBase')){
+if(!session::is_set('CurrentMainBase')){
   session::set('CurrentMainBase',get_base_from_people($ui->dn));
 }
 
@@ -134,7 +132,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);
 @DEBUG (DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $lang, "Setting language to");
 
@@ -144,7 +142,12 @@ if (!session::is_set('plist')){
   $class_list= get_declared_classes();
   foreach ($class_mapping as $class => $path){
     if (!in_array($class, $class_list)){
-        require_once("$BASE_DIR/$path");
+       if (is_readable("$BASE_DIR/$path")){
+               require_once("$BASE_DIR/$path");
+       } else {
+               echo sprintf(_("Fatal error: cannot locate file '%s' - please run '%s' to fix this"), "$BASE_DIR/$path", "<b>update-gosa</b>");
+               exit;
+       }
     }
   }
   
@@ -161,7 +164,7 @@ $plist= session::get('plist');
 if (isset($global_check) && $config->data['MAIN']['FORCEGLOBALS'] == 'true'){
   echo _("FATAL: Register globals is on. GOsa will refuse to login unless this is fixed by an administrator.");
   new log("security","login","",array(),"Register globals is on. For security reasons, this should be turned off.") ;
-  session_destroy ();
+  session::destroy ();
   exit ();
 }
 
@@ -202,7 +205,7 @@ eval_sizelimit();
 /* Check for memory */
 if (function_exists("memory_get_usage")){
   if (memory_get_usage() > (to_byte(ini_get('memory_limit')) - 2048000 )){
-    print_red(_("Warning: memory is getting low - please increase the memory_limit!"));
+    msg_dialog::display(_("Configuration warning"), _("Running out of memory!"), WARNING_DIALOG);
   }
 }
 
@@ -287,7 +290,7 @@ $smarty->assign ("go_help", get_template_path('images/help.png'));
 
 /* reload navigation if language changed*/  
 if($reload_navigation){
-  $plist->menu="";;
+  $plist->menu="";
 }
 $plist->gen_headlines();
 $plist->gen_menu();
@@ -311,7 +314,7 @@ if ($_SERVER["REQUEST_METHOD"] == "POST"){
         $_POST[$name] = $value;
       } 
     }
-    sess_del ('dn');
+    session::un_set ('dn');
   }
 
 
@@ -341,7 +344,7 @@ if((isset($config->data['MAIN']['ACCOUNT_EXPIRATION'])) &&
 
   if ($expired == 2){
     new log("security","gosa","",array(),"password for user \"$ui->username\" is about to expire") ;
-    print_red(_("Your password is about to expire, please change your password"));
+    msg_dialog::display(_("Password reminder"), _("Your password is about to expire, please change your password!"), INFO_DIALOG);
   }
 }