Code

Added xml quote to dependencies
[gosa.git] / gosa-core / html / main.php
index 6de3e86ac447f9362a0157789e51b227112c7208..77bcbc9b16e2c0c578c77c0bbb19981687f12247 100644 (file)
@@ -61,10 +61,11 @@ if ($_SERVER['REMOTE_ADDR'] != $ui->ip){
   exit;
 }
 $config= session::get('config');
+$config->check_config_version();
 $config->check_and_reload();
 
 /* Enable compressed output */
-if (isset($config->data['MAIN']['COMPRESSED']) && preg_match('/^(true|on)$/i', $config->data['MAIN']['COMPRESSED']) && !isset($_GET['no_output_compression'])){
+if ($config->get_cfg_value("compressed") == "true"){
   ob_start("ob_gzhandler");
 }
 
@@ -74,11 +75,7 @@ if(session::get('_LAST_PAGE_REQUEST') == ""){
 }else{
 
   /* check GOsa.conf for defined session lifetime */
-  if(isset($config->data['MAIN']['SESSION_LIFETIME'])){
-    $max_life = $config->data['MAIN']['SESSION_LIFETIME'];
-  }else{
-    $max_life = 60*60*2;
-  }
+  $max_life= $config->get_cfg_value("session_lifetime", 60*60*2);
 
   /* get time difference between last page reload */
   $request_time = (time()- session::get('_LAST_PAGE_REQUEST'));
@@ -99,11 +96,7 @@ if(session::get('_LAST_PAGE_REQUEST') == ""){
 @DEBUG (DEBUG_CONFIG, __LINE__, __FUNCTION__, __FILE__, $config->data, "config");
 
 /* Set template compile directory */
-if (isset ($config->data['MAIN']['COMPILE'])){
-  $smarty->compile_dir= $config->data['MAIN']['COMPILE'];
-} else {
-  $smarty->compile_dir= '/var/spool/gosa/';
-}
+$smarty->compile_dir= $config->get_cfg_value("compile", '/var/spool/gosa');
 
 /* Set default */
 $reload_navigation = false;
@@ -165,8 +158,9 @@ if (!session::is_set('plist')){
   session::set('ui',$ui);
 }
 $plist= session::get('plist');
+
 /* Check for register globals */
-if (isset($global_check) && $config->data['MAIN']['FORCEGLOBALS'] == 'true'){
+if (isset($global_check) && $config->get_cfg_value("forceglobals") == "true"){
   msg_dialog::display(
             _("PHP configuration"),
             _("FATAL: Register globals is on. GOsa will refuse to login unless this is fixed by an administrator."),
@@ -183,7 +177,7 @@ if (session::is_set('plugin_dir')){
 } else {
   $old_plugin_dir= "";
 }
-if (isset($_GET['plug'])){
+if (isset($_GET['plug']) && $plist->plugin_access_allowed($_GET['plug'])){
   $plug= validate($_GET['plug']);
   $plugin_dir= $plist->get_path($plug);
   session::set('plugin_dir',$plugin_dir);
@@ -200,7 +194,7 @@ if (isset($_GET['plug'])){
 }
 
 /* Check if we need to delete a lock */
-if ($old_plugin_dir != $plugin_dir){
+if ($old_plugin_dir != $plugin_dir && $old_plugin_dir != ""){
   if (is_file("$old_plugin_dir/main.inc")){
     $remove_lock= true;
     require_once ("$old_plugin_dir/main.inc");
@@ -287,7 +281,11 @@ if (session::get('js')==FALSE){
   $smarty->assign("help_method"," onclick=\"return popup('helpviewer.php$plug','GOsa help');\"");
 }
 
-$smarty->assign ("username", $ui->username);
+if($ui->ignore_acl_for_current_user()){
+  $smarty->assign ("username", "<font color='#FF0000';>"._("User ACL checks disabled")."</font>&nbsp;".$ui->username);
+}else{
+  $smarty->assign ("username", $ui->username);
+}
 $smarty->assign ("go_logo", get_template_path('images/go_logo.png'));
 $smarty->assign ("go_base", get_template_path('images/dtree.png'));
 $smarty->assign ("go_home", get_template_path('images/gohome.png'));
@@ -346,9 +344,7 @@ if (session::is_set('post_cnt')){
 }
 
 /* check if we are using account expiration */
-if((isset($config->data['MAIN']['ACCOUNT_EXPIRATION'])) &&
-    preg_match('/true/i', $config->data['MAIN']['ACCOUNT_EXPIRATION'])){
-
+if ($config->get_cfg_value("account_expiration") == "true"){
   $expired= ldap_expired_account($config, $ui->dn, $ui->username);
 
   if ($expired == 2){
@@ -408,7 +404,9 @@ if(isset($_COOKIE['GOsa_Filter_Settings'])){
 }elseif(isset($HTTP_COOKIE_VARS['GOsa_Filter_Settings'])){
   $cookie = unserialize(base64_decode($HTTP_COOKIE_VARS['GOsa_Filter_Settings']));
 }
-if(isset($config->data['MAIN']['SAVE_FILTER']) && preg_match("/true/",$config->data['MAIN']['SAVE_FILTER'])){
+
+/* Save filters? */
+if($config->get_cfg_value("save_filter") == "true"){
   $cookie_vars = array("MultiDialogFilters","CurrentMainBase");
   foreach($cookie_vars as $var){
     if(session::is_set($var)){