From d9bcf68e395d6156645a7974b1a992aa6e6c00aa Mon Sep 17 00:00:00 2001
From: Marius Cramer <m.cramer@pixcept.de>
Date: Mon, 14 Oct 2013 08:57:25 -0400
Subject: [PATCH] Added missing empty directories from svn import

---
 interface/web/login/index.php |   26 +++++++++++++++++++++++++-
 1 files changed, 25 insertions(+), 1 deletions(-)

diff --git a/interface/web/login/index.php b/interface/web/login/index.php
index 458f77a..2c596f8 100644
--- a/interface/web/login/index.php
+++ b/interface/web/login/index.php
@@ -65,7 +65,7 @@
 			$maintenance_mode_error = $app->lng('error_maintenance_mode');
 		}
 
-		//* Login Form was send
+		//* Login Form was sent
 		if(count($_POST) > 0) {
 
 			//** Check variables
@@ -141,6 +141,7 @@
 									$user['username'] = $username;
 									$user['language'] = $conf['language'];
 									$user['theme'] = $conf['theme'];
+									$user['app_theme'] = $conf['theme'];
 									$user['mailuser_id'] = $mailuser['mailuser_id'];
 									$user['default_group'] = $mailuser['sys_groupid'];
 								}
@@ -194,8 +195,31 @@
 
 								if(is_file($_SESSION['s']['user']['startmodule'].'/lib/module.conf.php')) {
 									include_once($_SESSION['s']['user']['startmodule'].'/lib/module.conf.php');
+                                    $menu_dir = ISPC_WEB_PATH.'/' . $_SESSION['s']['user']['startmodule'] . '/lib/menu.d';
+
+                                    if (is_dir($menu_dir)) {
+                                        if ($dh = opendir($menu_dir)) {
+                                            //** Go through all files in the menu dir
+                                            while (($file = readdir($dh)) !== false) {
+                                                if ($file != '.' && $file != '..' && substr($file, -9, 9) == '.menu.php' && $file != 'dns_resync.menu.php') {
+                                                    include_once($menu_dir . '/' . $file);
+                                                }
+                                            }
+                                        }
+                                    }
 									$_SESSION['s']['module'] = $module;
 								}
+                                
+                                // check if the user theme is valid
+                                if($_SESSION['s']['user']['theme'] != 'default') {
+                                    $tmp_path = ISPC_THEMES_PATH."/".$_SESSION['s']['user']['theme'];
+                                    if(!@is_dir($tmp_path) || !@file_exists($tmp_path."/ispconfig_version") || trim(file_get_contents($tmp_path."/ispconfig_version")) != ISPC_APP_VERSION) {
+                                        // fall back to default theme if this one is not compatible with current ispc version
+                                        $_SESSION['s']['user']['theme'] = 'default';
+                                        $_SESSION['s']['theme'] = 'default';
+                                        $_SESSION['show_error_msg'] = $app->lng('theme_not_compatible');
+                                    }
+                                }
 
 								$app->plugin->raiseEvent('login',$this);
 

--
Gitblit v1.9.1