| 1 | <?php |
|---|
| 2 | |
|---|
| 3 | |
|---|
| 4 | |
|---|
| 5 | |
|---|
| 6 | |
|---|
| 7 | |
|---|
| 8 | |
|---|
| 9 | |
|---|
| 10 | |
|---|
| 11 | |
|---|
| 12 | |
|---|
| 13 | |
|---|
| 14 | |
|---|
| 15 | |
|---|
| 16 | |
|---|
| 17 | |
|---|
| 18 | |
|---|
| 19 | |
|---|
| 20 | |
|---|
| 21 | |
|---|
| 22 | |
|---|
| 23 | |
|---|
| 24 | |
|---|
| 25 | |
|---|
| 26 | include('../includes/includes.inc.php'); |
|---|
| 27 | include('../includes/config/global.inc.php'); |
|---|
| 28 | |
|---|
| 29 | $smarty = new Smarty_dotnode; |
|---|
| 30 | $smarty->compile_id = 'new'; |
|---|
| 31 | |
|---|
| 32 | $token = retreive_url_info($_SERVER['PHP_SELF']); |
|---|
| 33 | |
|---|
| 34 | session_start(); |
|---|
| 35 | |
|---|
| 36 | if(strlen($token[1]) == 32) |
|---|
| 37 | list($url_id) = array_splice($token, 1,1); |
|---|
| 38 | else |
|---|
| 39 | $url_id = $_SESSION['my_id']; |
|---|
| 40 | |
|---|
| 41 | if(!$_SESSION['my_id'] && $_SESSION['status'] != 'guest') |
|---|
| 42 | { |
|---|
| 43 | header('Location: /pub'); |
|---|
| 44 | exit(); |
|---|
| 45 | } |
|---|
| 46 | |
|---|
| 47 | |
|---|
| 48 | |
|---|
| 49 | for($idx=(count($token)-1); $idx>=0; $idx--) |
|---|
| 50 | { |
|---|
| 51 | $help_tpl = "help/"; |
|---|
| 52 | for($level=0; $level<=$idx; $level++) |
|---|
| 53 | $help_tpl .= $token[$level].'/'; |
|---|
| 54 | $help_tpl = substr($help_tpl,0,-1).'.tpl'; |
|---|
| 55 | if($smarty->template_exists($help_tpl)) |
|---|
| 56 | break; |
|---|
| 57 | } |
|---|
| 58 | |
|---|
| 59 | if(!$smarty->template_exists($help_tpl)) |
|---|
| 60 | unset($help_tpl); |
|---|
| 61 | else |
|---|
| 62 | $_SMARTY['help_tpl'] = $help_tpl; |
|---|
| 63 | |
|---|
| 64 | |
|---|
| 65 | |
|---|
| 66 | |
|---|
| 67 | |
|---|
| 68 | for($idx=(count($token)-1); $idx>=0; $idx--) |
|---|
| 69 | { |
|---|
| 70 | $inc = ""; |
|---|
| 71 | for($level=0; $level<=$idx; $level++) |
|---|
| 72 | $inc .= $token[$level].'/'; |
|---|
| 73 | $inc = substr($inc,0,-1).'.inc.php'; |
|---|
| 74 | error_log($_SERVER['HTTP_HOST'].' | Include:'.$inc); |
|---|
| 75 | if(file_exists(INCLUDEPATH.'/'.$inc)) |
|---|
| 76 | break; |
|---|
| 77 | } |
|---|
| 78 | |
|---|
| 79 | if(!file_exists(INCLUDEPATH.'/'.$inc)) |
|---|
| 80 | $inc = 'index.inc.php'; |
|---|
| 81 | |
|---|
| 82 | |
|---|
| 83 | $db =& DB::connect($dsn); |
|---|
| 84 | if (DB::isError($db)) |
|---|
| 85 | error_log($_SERVER['HTTP_HOST'].' | '.__FILE__.' | Connexion SQL impossible : '.$db->getMessage()); |
|---|
| 86 | $db->setFetchMode(DB_FETCHMODE_ASSOC); |
|---|
| 87 | |
|---|
| 88 | include (INCLUDEPATH.'/'.$inc); |
|---|
| 89 | |
|---|
| 90 | $db->disconnect(); |
|---|
| 91 | |
|---|
| 92 | |
|---|
| 93 | |
|---|
| 94 | for($idx=(count($token)-1); $idx>=0; $idx--) |
|---|
| 95 | { |
|---|
| 96 | $tpl = ""; |
|---|
| 97 | for($level=0; $level<=$idx; $level++) |
|---|
| 98 | $tpl .= $token[$level].'/'; |
|---|
| 99 | $tpl = substr($tpl,0,-1).'.tpl'; |
|---|
| 100 | |
|---|
| 101 | if($smarty->template_exists($tpl)) |
|---|
| 102 | break; |
|---|
| 103 | } |
|---|
| 104 | |
|---|
| 105 | if(!$smarty->template_exists($tpl)) |
|---|
| 106 | $tpl='default.tpl'; |
|---|
| 107 | |
|---|
| 108 | |
|---|
| 109 | |
|---|
| 110 | |
|---|
| 111 | $_SMARTY['token'] = $token; |
|---|
| 112 | $_SMARTY['menu'] = $menu['main']; |
|---|
| 113 | $_SMARTY['smenu'] = $smenu[$token[0]]; |
|---|
| 114 | $_SMARTY['ssmenu'] = $ssmenu[$token[0]][$token[1]]; |
|---|
| 115 | |
|---|
| 116 | $_SMARTY['tpl'] = $tpl; |
|---|
| 117 | |
|---|
| 118 | $_SMARTY['url_id'] = $url_id; |
|---|
| 119 | $_SMARTY['nyrk'] = $nyrk; |
|---|
| 120 | $_SMARTY['labels'] = $labels; |
|---|
| 121 | $_SMARTY['access_fields'] = $access_fields; |
|---|
| 122 | $_SMARTY['lang'] = $lang; |
|---|
| 123 | |
|---|
| 124 | if($_SERVER['REMOTE_ADDR'] == $config['admin_ip']) |
|---|
| 125 | { |
|---|
| 126 | $debug['session'] = $_SESSION; |
|---|
| 127 | $_SMARTY['debug'] = $debug; |
|---|
| 128 | $_SMARTY['php_mem'] = memory_get_usage()/1024; |
|---|
| 129 | $_SMARTY['inc'] = $inc; |
|---|
| 130 | } |
|---|
| 131 | |
|---|
| 132 | $smarty->assign($_SMARTY); |
|---|
| 133 | |
|---|
| 134 | |
|---|
| 135 | |
|---|
| 136 | error_log($_SERVER['HTTP_HOST'].' | '.$_SERVER['PHP_SELF'].' | '.$_SESSION['my_login']); |
|---|
| 137 | header('Content-type: text/html; charset=UTF-8'); |
|---|
| 138 | |
|---|
| 139 | |
|---|
| 140 | |
|---|
| 141 | $smarty->display('index_head.tpl', $lang2.'.'.$_SERVER['PHP_SELF']); |
|---|
| 142 | $smarty->display($tpl, $lang2.'.'.$_SERVER['PHP_SELF']); |
|---|
| 143 | $smarty->display('index_foot.tpl', $lang2.'.'.$_SERVER['PHP_SELF']); |
|---|
| 144 | |
|---|
| 145 | unset($_SESSION['error']); |
|---|
| 146 | unset($_SESSION['temp']); |
|---|
| 147 | ?> |
|---|