karailiev
2008-11-21 88134f50d36458269ed612287be3df9574ff4478
commit | author | age
cf71a4 1 <?php
T 2
3 /*
4 Copyright (c) 2005, Till Brehm, projektfarm Gmbh
5 All rights reserved.
6
7 Redistribution and use in source and binary forms, with or without modification,
8 are permitted provided that the following conditions are met:
9
10     * Redistributions of source code must retain the above copyright notice,
11       this list of conditions and the following disclaimer.
12     * Redistributions in binary form must reproduce the above copyright notice,
13       this list of conditions and the following disclaimer in the documentation
14       and/or other materials provided with the distribution.
15     * Neither the name of ISPConfig nor the names of its contributors
16       may be used to endorse or promote products derived from this software without
17       specific prior written permission.
18
19 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
20 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
21 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
22 IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
23 INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
24 BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
26 OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
27 NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
28 EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */
30
31 require_once('../lib/config.inc.php');
32 require_once('../lib/app.inc.php');
33
34 $app->uses('tpl');
35
36 //die('HHH');
37
6bb878 38 //** Top Naviation
P 39 if(isset($_GET['nav']) && $_GET['nav'] == 'top') {
cf71a4 40     
6bb878 41     $app->tpl->newTemplate('topnav.tpl.htm');
cf71a4 42
6bb878 43     //* Check User Login and current module
P 44     if(!isset($_SESSION['s']['user']) or !is_array($_SESSION['s']['user']) or !is_array($_SESSION['s']['module'])) {
45         //*  Loading Login Module
cf71a4 46         include_once('login/lib/module.conf.php');
6bb878 47         $_SESSION['s']['module'] = $module;
P 48         $topnav[] = array(    'title'     => 'Login',
cf71a4 49                               'active'     => 1);
T 50         $module = null;
51         unset($module);
52     } else {
6bb878 53         //* Loading modules of the user and building top navigation
P 54         $modules = explode(',', $_SESSION['s']['user']['modules']);
cf71a4 55         if(is_array($modules)) {
T 56             foreach($modules as $mt) {
6bb878 57                 if(is_file($mt.'/lib/module.conf.php')) {
P 58                     include_once($mt.'/lib/module.conf.php');
59                     $active = ($module['name'] == $_SESSION['s']['module']['name']) ? 1 : 0;
60                     $topnav[] = array(    'title'     => $app->lng($module['title']),
61                                           'active'     => $active,
62                                         'module'    => $module['name']);
cf71a4 63                 }
T 64             }
65         }
66     }
67
6bb878 68     //* Topnavigation
cf71a4 69     $app->tpl->setLoop('nav_top',$topnav);
T 70     
71 }
72
6bb878 73 //** Side Naviation
P 74 if(isset($_GET['nav']) && $_GET['nav'] == 'side') {
cf71a4 75     
6bb878 76     $app->tpl->newTemplate('sidenav.tpl.htm');
cf71a4 77     
6bb878 78     //* translating module navigation
cf71a4 79     $nav_translated = array();
6bb878 80     if(isset($_SESSION['s']['module']['nav']) && is_array($_SESSION['s']['module']['nav'])) {
P 81         foreach($_SESSION['s']['module']['nav'] as $nav) {
cf71a4 82             $tmp_items = array();
6bb878 83             foreach($nav['items'] as $item) {
P 84                 $item['title'] = $app->lng($item['title']);
cf71a4 85                 $tmp_items[] = $item;
T 86             }
6bb878 87             $nav['title'] = $app->lng($nav['title']);
94890d 88             $nav['startpage'] = $_SESSION['s']['module']['startpage'];
6bb878 89             $nav['items'] = $tmp_items;
cf71a4 90             $nav_translated[] = $nav;
T 91         }
92     } else {
93         $nav_translated = null;
94     }
95
96     $app->tpl->setLoop('nav_left',$nav_translated);
97     
98 }
99
100 $app->tpl_defaults();
101 $app->tpl->pparse();
102
103 ?>