Code

Added patch from revision 5285
[gosa.git] / html / main.php
index 35295c0cbed87bd585c7f8dcf4798ca2efbf2741..e03e40b75cb59304a537581e8d8ab311df90eee9 100644 (file)
@@ -23,6 +23,7 @@ $start = microtime();
 $timing= array();
 require_once ("../include/php_setup.inc");
 require_once ("functions.inc");
+require_once ("functions_FAI.inc");
 header("Content-type: text/html; charset=UTF-8");
 
 /* Find all class files and include them */
@@ -100,7 +101,6 @@ if(empty($_SESSION['_LAST_PAGE_REQUEST'])){
     header ("Location: logout.php");
     exit;
   }
-//  echo "Session was ".$request_time." s inactive";
   $_SESSION['_LAST_PAGE_REQUEST'] = time();
 }
 
@@ -136,6 +136,11 @@ if ($config->data['MAIN']['LANG'] == ""){
   $lang= $config->data['MAIN']['LANG'];
 }
 
+/* Preset current main base */
+if(!isset($_SESSION['CurrentMainBase'])){
+  $_SESSION['CurrentMainBase']= get_base_from_people($ui->dn);
+}
+
 $lang.=".UTF-8";
 putenv("LANGUAGE=");
 putenv("LANG=$lang");
@@ -152,13 +157,17 @@ textdomain($domain);
 /* Prepare plugin list */
 if (!isset($_SESSION['plist'])){
   $_SESSION['plist']= new pluglist($config, $ui);
+  
+  /* Load ocMapping into userinfo */
+  $tmp= new acl($config, NULL, $ui->dn);
+  $ui->ocMapping= $tmp->ocMapping;
+  $_SESSION['ui']= $ui;
 }
 $plist= $_SESSION['plist'];
 
 /* Check for register globals */
 if (isset($global_check) && $config->data['MAIN']['FORCEGLOBALS'] == 'true'){
-  print_red (_("Register globals is on. GOsa will refuse to login unless this is fixed by an administrator."));
-  echo $_SESSION['errors'];
+  echo _("FATAL: Register globals is on. GOsa will refuse to login unless this is fixed by an administrator.");
   gosa_log ("Register globals is on. For security reasons, this should be turned off.");
   session_destroy ();
   exit ();
@@ -331,12 +340,13 @@ if (isset ($_SESSION['post_cnt'])){
   echo "<input type=\"hidden\" name=\"session_cnt\" value=\"".$_SESSION['post_cnt']."\">\n";
 }
 
+$start = microtime();
+
 /* Load plugin */
 if (is_file("$plugin_dir/main.inc")){
   require_once ("$plugin_dir/main.inc");
 } else {
-  print_red(sprintf(_("Can't find any plugin definitions for plugin '%s'!"), $plug));
-  echo $_SESSION['errors'];
+  echo sprintf(_("FATAL: Can't find any plugin definitions for plugin '%s'!"), $plug);
   exit();
 }
 
@@ -344,7 +354,8 @@ if (is_file("$plugin_dir/main.inc")){
 
   /* check if we are using account expiration */
 
-  if((isset($config->data['MAIN']['ACCOUNTEXPIRED'])) && $config->data['MAIN']['ACCOUNTEXPIRED'] == "1"){
+  if((isset($config->data['MAIN']['ACCOUNT_EXPIRATION'])) &&
+      preg_match('/true/i', $config->data['MAIN']['ACCOUNT_EXPIRATION'])){
     
       $expired= ldap_expired_account($config, $ui->dn, $ui->username);
 
@@ -354,11 +365,10 @@ if (is_file("$plugin_dir/main.inc")){
       }
   }
   
-/* Print_out last ErrorMessage repeated string.
- */
+/* Print_out last ErrorMessage repeated string. */
 print_red(NULL);
 
-$smarty->assign("contents", $display);
+$smarty->assign("contents", $display.get_MicroTimeDiff($start,microtime()));
 
 if (isset($_SESSION['errors'])){
   $smarty->assign("errors", $_SESSION['errors']);
@@ -389,7 +399,6 @@ echo $display;
 $_SESSION['plist']= $plist;
 $_SESSION['config']= $config;
 
-
 /* Echo compilation time * /
 $r = split(" ",$start);
 $ms = $r[0];