| | |
| | | |
| | | $app->uses('tpl'); |
| | | |
| | | //die('HHH'); |
| | | |
| | | //** Top Naviation |
| | | if(isset($_GET['nav']) && $_GET['nav'] == 'top') { |
| | | |
| | | $app->tpl->newTemplate('topnav.tpl.htm'); |
| | | |
| | | //* Check User Login and current module |
| | | if(!isset($_SESSION['s']['user']) or !is_array($_SESSION['s']['user']) or !is_array($_SESSION['s']['module'])) { |
| | | //* Loading Login Module |
| | | include_once('login/lib/module.conf.php'); |
| | | $_SESSION['s']['module'] = $module; |
| | | $topnav[] = array( 'title' => 'Login', |
| | | 'active' => 1); |
| | | $module = null; |
| | | unset($module); |
| | | } else { |
| | | if(isset($_SESSION["s"]["user"]) && $_SESSION["s"]["user"]['active'] == 1 && is_array($_SESSION['s']['module'])) {
|
| | | //* Loading modules of the user and building top navigation |
| | | $modules = explode(',', $_SESSION['s']['user']['modules']); |
| | | if(is_array($modules)) { |
| | | foreach($modules as $mt) { |
| | | if(is_file($mt.'/lib/module.conf.php')) { |
| | | if(!preg_match("/^[a-z]{2,20}$/i", $mt)) die('module name contains unallowed chars.');
|
| | | include_once($mt.'/lib/module.conf.php'); |
| | | $active = ($module['name'] == $_SESSION['s']['module']['name']) ? 1 : 0; |
| | | $topnav[] = array( 'title' => $app->lng($module['title']), |
| | |
| | | } |
| | | } |
| | | } |
| | | } else {
|
| | | //* Loading Login Module
|
| | | include_once('login/lib/module.conf.php');
|
| | | $_SESSION['s']['module'] = $module;
|
| | | $topnav[] = array( 'title' => 'Login',
|
| | | 'active' => 1);
|
| | | $module = null;
|
| | | unset($module);
|
| | | } |
| | | |
| | | //* Topnavigation |