Sergio Cambra
2014-06-30 b91328b225502a9fd9d871bae4529b6ea04b9b67
interface/web/index.php
@@ -1,7 +1,7 @@
<?php
/*
Copyright (c) 2005, Till Brehm, projektfarm Gmbh
Copyright (c) 2007, Till Brehm, projektfarm Gmbh
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
@@ -28,72 +28,55 @@
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
require_once('../lib/config.inc.php');
require_once('../lib/app.inc.php');
require_once '../lib/config.inc.php';
require_once '../lib/app.inc.php';
if(!isset($_SESSION['s']['module']['name'])) $_SESSION['s']['module']['name'] = 'login';
$app->uses('tpl');
$app->tpl->newTemplate('main.tpl.htm');
/*
// Checke User Login and current module
if(!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);
// tab change warning?
// read misc config
$app->uses('getconf');
$sys_config = $app->getconf->get_global_config('misc');
if($sys_config['tab_change_warning'] == 'y') {
   $app->tpl->setVar('tabchange_warning_enabled', 'y');
   $app->tpl->setVar('global_tabchange_warning_txt', $app->lng('global_tabchange_warning_txt'));
} else {
   // 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")) {
            include_once($mt."/lib/module.conf.php");
            $active = ($module["name"] == $_SESSION["s"]["module"]["name"])?1:0;
            $topnav[] = array(   'title'    => $app->lng($module["title"]),
                             'active'    => $active,
                           'module'   => $module["name"]);
         }
      }
   }
   $app->tpl->setVar('tabchange_warning_enabled', 'n');
}
$app->tpl->setVar('tabchange_discard_enabled', $sys_config['tab_change_discard']);
if($sys_config['tab_change_discard'] == 'y') {
   $app->tpl->setVar('global_tabchange_discard_txt', $app->lng('global_tabchange_discard_txt'));
}
// Topnavigation
$app->tpl->setLoop('nav_top',$topnav);
// Loading Module part
$app->tpl->setInclude('module_tpl',$_SESSION["s"]["module"]["template"]);
// translating module navigation
$nav_translated = array();
if(is_array($_SESSION["s"]["module"]["nav"])) {
   foreach($_SESSION["s"]["module"]["nav"] as $nav) {
      $tmp_items = array();
      foreach($nav["items"] as $item) {
         $item["title"] = $app->lng($item["title"]);
         $tmp_items[] = $item;
      }
      $nav["title"] = $app->lng($nav["title"]);
      $nav["items"] = $tmp_items;
      $nav_translated[] = $nav;
   }
} else {
   $nav_translated = null;
if(isset($_SESSION['show_info_msg'])) {
   $app->tpl->setVar('show_info_msg', $_SESSION['show_info_msg']);
   unset($_SESSION['show_info_msg']);
}
if(isset($_SESSION['show_error_msg'])) {
   $app->tpl->setVar('show_error_msg', $_SESSION['show_error_msg']);
   unset($_SESSION['show_error_msg']);
}
// Loading left navigation
//$app->tpl->setLoop('nav_left',$_SESSION["s"]["module"]["nav"]);
$app->tpl->setLoop('nav_left',$nav_translated);
// read js.d files
$js_d = ISPC_WEB_PATH . '/js/js.d';
$js_d_files = array();
if(@is_dir($js_d)) {
   $dir = opendir($js_d);
   while($file = readdir($dir)) {
      $filename = $js_d . '/' . $file;
      if($file === '.' || $file === '..' || !is_file($filename)) continue;
      if(substr($file, -3) !== '.js') continue;
      $js_d_files[] = array('file' => $file);
   }
   closedir($dir);
}
// Setting startpage
$app->tpl->setVar('startpage',$_SESSION["s"]["module"]["startpage"]);
$app->tpl->setVar('navframe_page',$_SESSION["s"]["module"]["navframe_page"]);
*/
if (!empty($js_d_files)) $app->tpl->setLoop('js_d_includes', $js_d_files);
unset($js_d_files);
$app->tpl_defaults();
$app->tpl->pparse();
?>
?>