| 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 | include ('../includes/includes.inc.php'); |
|---|
| 26 | include('../includes/config/dntp.inc.php'); |
|---|
| 27 | |
|---|
| 28 | |
|---|
| 29 | $smarty = new Smarty; |
|---|
| 30 | |
|---|
| 31 | $smarty->template_dir = SMARTYPATH.'/templates_dntp/'; |
|---|
| 32 | $smarty->compile_dir = SMARTYPATH.'/templates_c/'; |
|---|
| 33 | $smarty->config_dir = SMARTYPATH.'/configs/'; |
|---|
| 34 | $smarty->debugging_ctrl = true; |
|---|
| 35 | $smarty->register_block('t', 'smarty_translate'); |
|---|
| 36 | |
|---|
| 37 | $smarty->compile_id = 'dntp'; |
|---|
| 38 | $smarty->caching = false; |
|---|
| 39 | $smarty->use_sub_dirs = 1; |
|---|
| 40 | |
|---|
| 41 | session_start(); |
|---|
| 42 | |
|---|
| 43 | if($_SESSION['my_lang'] == 'fa_IR') |
|---|
| 44 | $_SMARTY['rtl'] = true; |
|---|
| 45 | |
|---|
| 46 | $token = retreive_url_info($_SERVER['PHP_SELF']); |
|---|
| 47 | |
|---|
| 48 | if(!$_SESSION['my_id'] && $token[0] != 'pub') |
|---|
| 49 | { |
|---|
| 50 | header('Location: /pub'); |
|---|
| 51 | exit(); |
|---|
| 52 | } |
|---|
| 53 | |
|---|
| 54 | switch($_SESSION['my_status']) |
|---|
| 55 | { |
|---|
| 56 | case 'waiting': |
|---|
| 57 | header('Location: /pub'); |
|---|
| 58 | exit(); |
|---|
| 59 | break; |
|---|
| 60 | } |
|---|
| 61 | |
|---|
| 62 | if($token[0] != 'pub' && (!$_SESSION['my_id'] || $_SESSION['SecID'] != $_COOKIE['SecID'] )) |
|---|
| 63 | { |
|---|
| 64 | header('Location: /pub?url='.urlencode($_SERVER['PHP_SELF'])); |
|---|
| 65 | exit(); |
|---|
| 66 | } |
|---|
| 67 | |
|---|
| 68 | |
|---|
| 69 | for($idx=(count($token)-1); $idx>=0; $idx--) |
|---|
| 70 | { |
|---|
| 71 | $tpl = ''; |
|---|
| 72 | for($level=0; $level<=$idx; $level++) |
|---|
| 73 | $tpl .= $token[$level].'/'; |
|---|
| 74 | $tpl = substr($tpl,0,-1).'.tpl'; |
|---|
| 75 | if($smarty->template_exists($tpl)) |
|---|
| 76 | break; |
|---|
| 77 | } |
|---|
| 78 | |
|---|
| 79 | if(!$smarty->template_exists($tpl)) |
|---|
| 80 | $tpl='default.tpl'; |
|---|
| 81 | |
|---|
| 82 | for($idx=(count($token)-1); $idx>=0; $idx--) |
|---|
| 83 | { |
|---|
| 84 | $inc = ''; |
|---|
| 85 | for($level=0; $level<=$idx; $level++) |
|---|
| 86 | $inc .= $token[$level].'/'; |
|---|
| 87 | $inc = substr($inc,0,-1).'.inc.php'; |
|---|
| 88 | |
|---|
| 89 | if(file_exists(INCLUDEPATH.'/'.$inc)) |
|---|
| 90 | break; |
|---|
| 91 | } |
|---|
| 92 | |
|---|
| 93 | if(!file_exists(INCLUDEPATH.'/'.$inc)) |
|---|
| 94 | $inc = 'index.inc.php'; |
|---|
| 95 | |
|---|
| 96 | $db=&DB::connect($dsn); |
|---|
| 97 | if (DB::isError($db)) |
|---|
| 98 | die($_SERVER['HTTP_HOST'].' | '.__FILE__.' | Connexion SQL impossible : '.$db->getMessage()); |
|---|
| 99 | |
|---|
| 100 | $db->setFetchMode(DB_FETCHMODE_ASSOC); |
|---|
| 101 | |
|---|
| 102 | include (INCLUDEPATH.'/'.$inc); |
|---|
| 103 | $db->disconnect(); |
|---|
| 104 | |
|---|
| 105 | $_SMARTY['status'] = array('ok', 'new', 'must_be_verified'); |
|---|
| 106 | $_SMARTY['token'] = $token; |
|---|
| 107 | |
|---|
| 108 | $smarty->assign($_SMARTY); |
|---|
| 109 | |
|---|
| 110 | |
|---|
| 111 | header('Content-type: text/html; charset=UTF-8'); |
|---|
| 112 | $smarty->display('index_head.tpl'); |
|---|
| 113 | $smarty->display($tpl); |
|---|
| 114 | $smarty->display('index_foot.tpl'); |
|---|
| 115 | |
|---|
| 116 | ?> |
|---|