$SESSION = new Session($DB, ConfigHelper::getConfig('phpui.timeout')); $AUTH = new Auth($DB, $SESSION, $SYSLOG); if ($SYSLOG) { $SYSLOG->SetAuth($AUTH); } $LMS = new LMS($DB, $AUTH, $SYSLOG); $LMS->ui_lang = $_ui_language; $LMS->lang = $_language; $plugin_manager = new LMSPluginManager(); $LMS->setPluginManager($plugin_manager); $SMARTY->setPluginManager($plugin_manager); // Initialize Swekey class if (ConfigHelper::checkConfig('phpui.use_swekey')) { require_once LIB_DIR . DIRECTORY_SEPARATOR . 'swekey' . DIRECTORY_SEPARATOR . 'lms_integration.php'; $LMS_SWEKEY = new LmsSwekeyIntegration($DB, $AUTH, $LMS); $SMARTY->assign('lms_swekey', $LMS_SWEKEY->GetIntegrationScript($AUTH->id)); } // Set some template and layout variables $SMARTY->setTemplateDir(null); $custom_templates_dir = ConfigHelper::getConfig('phpui.custom_templates_dir'); if (!empty($custom_templates_dir) && file_exists(SMARTY_TEMPLATES_DIR . DIRECTORY_SEPARATOR . $custom_templates_dir) && !is_file(SMARTY_TEMPLATES_DIR . DIRECTORY_SEPARATOR . $custom_templates_dir)) { $SMARTY->AddTemplateDir(SMARTY_TEMPLATES_DIR . DIRECTORY_SEPARATOR . $custom_templates_dir); } $SMARTY->AddTemplateDir(array(SMARTY_TEMPLATES_DIR . DIRECTORY_SEPARATOR . 'default', SMARTY_TEMPLATES_DIR)); $SMARTY->setCompileDir(SMARTY_COMPILE_DIR); $SMARTY->debugging = ConfigHelper::checkConfig('phpui.smarty_debug'); $layout['logname'] = $AUTH->logname; $layout['logid'] = $AUTH->id; $layout['lmsdbv'] = $DB->GetVersion(); $layout['smarty_version'] = SMARTY_VERSION; $layout['hostname'] = hostname();
$layout['lmsv'] = $LMS->_version; $layout['lmsvr'] = $LMS->_revision; $layout['dberrors'] = $DB->GetErrors(); $layout['dbdebug'] = isset($_DBDEBUG) ? $_DBDEBUG : false; $layout['popup'] = isset($_GET['popup']) ? true : false; $SMARTY->assignByRef('layout', $layout); $SMARTY->assignByRef('LANGDEFS', $LANGDEFS); $SMARTY->assignByRef('_ui_language', $LMS->ui_lang); $SMARTY->assignByRef('_language', $LMS->lang); $error = NULL; // initialize error variable needed for (almost) all modules // Load menu if (!$layout['popup']) { require_once LIB_DIR . DIRECTORY_SEPARATOR . 'menu.php'; $menu = $plugin_manager->executeHook('menu_initialized', $menu); $SMARTY->assign('newmenu', $menu); } header('X-Powered-By: LMS/' . $layout['lmsv']); $modules_dirs = array(MODULES_DIR); $modules_dirs = $plugin_manager->executeHook('modules_dir_initialized', $modules_dirs); $plugin_manager->executeHook('lms_initialized', $LMS); $plugin_manager->executeHook('smarty_initialized', $SMARTY); $documents_dirs = array(DOC_DIR); $documents_dirs = $plugin_manager->executeHook('documents_dir_initialized', $documents_dirs); // Check privileges and execute modules if ($AUTH->islogged) { $SMARTY->assign('main_menu_sortable_order', $SESSION->get_persistent_setting('main-menu-order')); // Load plugin files and register hook callbacks $plugins = $plugin_manager->getAllPluginInfo(LMSPluginManager::OLD_STYLE); if (!empty($plugins)) { foreach ($plugins as $plugin_name => $plugin) {
$SMARTY->assignByRef('_language', $LMS->lang); $SMARTY->setTemplateDir(null); $style = ConfigHelper::getConfig('userpanel.style', 'default'); $SMARTY->addTemplateDir(array(USERPANEL_DIR . DIRECTORY_SEPARATOR . 'style' . DIRECTORY_SEPARATOR . $style . DIRECTORY_SEPARATOR . 'templates', USERPANEL_DIR . DIRECTORY_SEPARATOR . 'templates')); $SMARTY->setCompileDir(SMARTY_COMPILE_DIR); $SMARTY->debugging = ConfigHelper::checkConfig('phpui.smarty_debug'); require_once USERPANEL_LIB_DIR . DIRECTORY_SEPARATOR . 'smarty_addons.php'; $layout['lmsdbv'] = $DB->GetVersion(); $layout['lmsv'] = $LMS->_version; $layout['lmsvr'] = $LMS->_revision; $layout['smarty_version'] = SMARTY_VERSION; $layout['hostname'] = hostname(); $layout['dberrors'] =& $DB->GetErrors(); $SMARTY->assignByRef('modules', $USERPANEL->MODULES); $SMARTY->assignByRef('layout', $layout); $SMARTY->assign('page_header', ConfigHelper::getConfig('userpanel.page_header')); header('X-Powered-By: LMS/' . $layout['lmsv']); $plugin_manager->executeHook('userpanel_lms_initialized', $LMS); $plugin_manager->executeHook('userpanel_smarty_initialized', $SMARTY); if ($SESSION->islogged) { $module = isset($_GET['m']) ? $_GET['m'] : ''; if (isset($USERPANEL->MODULES[$module])) { $USERPANEL->MODULES[$module]['selected'] = true; } // Userpanel rights module $rights = $USERPANEL->GetCustomerRights($SESSION->id); $SMARTY->assign('rights', $rights); if (ConfigHelper::checkConfig('userpanel.hide_nodes_modules')) { if (!$DB->GetOne('SELECT COUNT(*) FROM vnodes WHERE ownerid = ? LIMIT 1', array($SESSION->id))) { unset($USERPANEL->MODULES['notices']); unset($USERPANEL->MODULES['stats']);
$SMARTY->assignByRef('_language', $LMS->lang); $SMARTY->setTemplateDir(null); $style = ConfigHelper::getConfig('userpanel.style', 'default'); $SMARTY->addTemplateDir(array(USERPANEL_DIR . DIRECTORY_SEPARATOR . 'style' . DIRECTORY_SEPARATOR . $style . DIRECTORY_SEPARATOR . 'templates', USERPANEL_DIR . DIRECTORY_SEPARATOR . 'templates')); $SMARTY->setCompileDir(SMARTY_COMPILE_DIR); $SMARTY->debugging = ConfigHelper::checkConfig('phpui.smarty_debug'); require_once USERPANEL_LIB_DIR . DIRECTORY_SEPARATOR . 'smarty_addons.php'; $layout['lmsdbv'] = $DB->GetVersion(); $layout['lmsv'] = $LMS->_version; $layout['lmsvr'] = $LMS->_revision; $layout['smarty_version'] = SMARTY_VERSION; $layout['hostname'] = hostname(); $layout['dberrors'] =& $DB->GetErrors(); $SMARTY->assignByRef('modules', $USERPANEL->MODULES); $SMARTY->assignByRef('layout', $layout); $SMARTY->assign('page_header', ConfigHelper::getConfig('userpanel.page_header')); $SMARTY->assign('company_logo', ConfigHelper::getConfig('userpanel.company_logo')); header('X-Powered-By: LMS/' . $layout['lmsv']); $plugin_manager->executeHook('userpanel_lms_initialized', $LMS); $plugin_manager->executeHook('userpanel_smarty_initialized', $SMARTY); if ($SESSION->islogged) { $module = isset($_GET['m']) ? $_GET['m'] : ''; if (isset($USERPANEL->MODULES[$module])) { $USERPANEL->MODULES[$module]['selected'] = true; } // Userpanel rights module $rights = $USERPANEL->GetCustomerRights($SESSION->id); $SMARTY->assign('rights', $rights); if (ConfigHelper::checkConfig('userpanel.hide_nodes_modules')) { if (!$DB->GetOne('SELECT COUNT(*) FROM vnodes WHERE ownerid = ? LIMIT 1', array($SESSION->id))) { unset($USERPANEL->MODULES['notices']);