home *** CD-ROM | disk | FTP | other *** search
/ 79.96.193.101 / 79.96.193.101.tar / 79.96.193.101 / www / index.php < prev    next >
PHP Script  |  2014-10-20  |  10KB  |  318 lines

  1. <?php
  2. //============================================
  3. // Easy 2.0
  4. // Copyright     : .exe Evolution
  5. // Wersja        : 2.0
  6. // Uwagi         : Brak
  7. //============================================
  8. ob_start();
  9.  
  10. $_global_start_time = microtime();
  11. $_smarty_control_time = 0;
  12.  
  13. if(isset($_REQUEST['area']) && !is_numeric($_REQUEST['area']))
  14. {
  15.     header("Location:index.php?area=1");
  16.     exit;
  17. }
  18.  
  19. header("Content-type: text/html; charset=UTF-8");
  20. define("BASEDIR", dirname(__FILE__));
  21.  
  22. define('AJAX', true); 
  23. require(BASEDIR . "/inc/init.php");
  24.  
  25. if(SSLMODE==1 && $_SERVER['SERVER_PORT']=='80') header("Location:".redir()."");
  26. if(SSLMODE!=1 && $_SERVER['SERVER_PORT']=='443') header("Location:".redir()."");
  27.  
  28. define("HPURL", HTTPSSL . $_SERVER['HTTP_HOST'] . str_replace("/index.php", "", $_SERVER['PHP_SELF']) . "/");
  29.  
  30. if(isset($_REQUEST['p']) && $_REQUEST['p']=='shop' && ISSHOP != 1) header("Location:index.php");
  31. if(isset($_REQUEST['p']) && $_REQUEST['p']=='register') header("Location:index.php?p=signup");
  32.  
  33. $expire = time() + (60 * 10);
  34. $sql = $db->Query("DELETE FROM " . PREFIX . "_useronline WHERE expire <= '" . time() . "'");
  35. $sql = $db->Query("SELECT ip FROM " . PREFIX . "_useronline WHERE ip='" . $_SERVER['REMOTE_ADDR'] . "' limit 1");
  36. $num = $sql->numrows();
  37.  
  38. if ($num < 1)
  39.     $sql = $db->Query("INSERT INTO " . PREFIX . "_useronline (ip,expire,uname,invisible) VALUES ('" . $_SERVER['REMOTE_ADDR'] . "','$expire','" . UNAME . "','" . INVISIBLE . "')");
  40.  else
  41.     $sql = $db->Query("UPDATE " . PREFIX . "_useronline set uname='" . UNAME . "' WHERE ip='" . $_SERVER['REMOTE_ADDR'] . "'");
  42.  
  43.  
  44. if (!isset($_REQUEST['p'])) {
  45.     $_REQUEST['p'] = "index";
  46.     $loader = "?";
  47. }
  48.  
  49. $buffer = str_replace(array(":", "/", "..", ".", ";", "\\", "http", "ftp"), "", $_REQUEST['p']);
  50. $sql = $db->Query("SELECT area_template,active FROM " . PREFIX . "_areas WHERE area_id='".(int)$area."'");
  51. $row = $sql->fetchrow();
  52.  
  53. if ($row->active != 1) {
  54.     if (!($HTTP_SESSION_VARS['secpass' . $area])) {
  55.         $HTTP_SESSION_VARS['secpass' . $area] = $_GET['pass'];
  56.     }
  57.     $sql = $db->Query("SELECT pass,tmpl FROM " . PREFIX . "_areas WHERE area_id='".(int)$area."'");
  58.     $row = $sql->fetchrow();
  59.  
  60.     if (($row->pass == "") || ($row->pass != $HTTP_SESSION_VARS['secpass' . $area])) {
  61.         $HTTP_SESSION_VARS['secpass' . $area] = "";
  62.         echo $row->tmpl;
  63.         exit();
  64.     }
  65. }
  66.  
  67. if(AJAX) {
  68.     define('AJAX_DIR', BASEDIR.'/ajax/');
  69.     require_once(AJAX_DIR.'inc/ajax_init.php');
  70.  
  71.     $tmpl = new Easy("templates/$THEME/");
  72.     $tmpl->assign('theme', $THEME);
  73.     $tmpl->assign('pref', $pref);
  74.     $tmpl->assign('lang', $lang);
  75.     if($show_start_div)
  76.         $tmpl->assign('show_start_div', 1);
  77.  
  78.     if(isset($_REQUEST['ajax']) && $_REQUEST['ajax']=='ajax') {
  79.         define('AJAX_REQUEST', true);
  80.         if(@include(AJAX_DIR.'request/'.$buffer.'.php')) {
  81.             exit;
  82.         }
  83.     }
  84. }
  85. else {
  86.     $tmpl = new Easy("templates/$THEME/");
  87.     $tmpl->assign('theme', $THEME);
  88.     $tmpl->assign('pref', $pref);
  89. }
  90.  
  91. @include('inc/globals.php');
  92.  
  93. if(ISSHOP==1) {
  94.     if(!@include( BASEDIR . "/system/shop/shopinc.php"))
  95.         echo '<div><strong>Error:</strong> Shop could not be initialized.</div>';
  96. }
  97.  
  98. if (!@include("system/$buffer.php"))
  99. {
  100.     $EOUT = msg("error_once", "modulenotfound", str_replace("__URL__", "index.php", $lang['redirect']), "index.php");
  101.     $NOOUT = 1;
  102. }
  103. switch ($_REQUEST['p']) {
  104.     case "pic" :
  105.     case "gallerypic" : $template = fetchmaintemplate("27"); break;
  106.     case "misc" : $template = fetchmaintemplate("13"); break;
  107.     case "shopimage" : $template = fetchmaintemplate("55"); break;
  108.     case "userlist" : $template = fetchmaintemplate("14"); break;
  109.     case "manufacturer" : $template = fetchmaintemplate("22"); break;
  110.     case "tell" : $template = fetchmaintemplate("23"); break;
  111.     case "static" : $template = fetchmaintemplate("24"); break;
  112.     case "poll" : $template = fetchmaintemplate("25"); break;
  113.     case "faq" : $template = fetchmaintemplate("26"); break;
  114.     case "gallery" : $template = fetchmaintemplate("27"); break;
  115.     case "signup" :
  116.     case "register" : $template = fetchmaintemplate("28"); break;
  117.     case "pwlost" : $template = fetchmaintemplate("29"); break;
  118.     case "ignorelist" : $template = fetchmaintemplate("30"); break;
  119.     case "changedetails" : $template = fetchmaintemplate("31"); break;
  120.     case "changepw" : $template = fetchmaintemplate("32");  break;
  121.     case "pn" : $template = fetchmaintemplate("33"); break;
  122.     case "query" :
  123.     case "news" : $template = fetchmaintemplate("34"); break;
  124.     case "index" : $template = fetchmaintemplate("12"); break;
  125.     case "product": $template = fetchmaintemplate("36");break;
  126.     case "downloads": $template = fetchmaintemplate("40");break;
  127.     case "links": $template = fetchmaintemplate("43");break;
  128.     case "downloadfile": $template = fetchmaintemplate("42");break;
  129.     case "contact" : $template = fetchmaintemplate("45"); break;
  130.     case "articles" : $template = fetchmaintemplate("38"); break;
  131.     case "guestbook" : $template = fetchmaintemplate("47"); break;
  132.     case "calendar" : $template = fetchmaintemplate("50"); break;
  133.     case "shop" : $template = fetchmaintemplate("52"); break;
  134.     case "showforums" :
  135.     case "showforum" :
  136.     case "showtopic" :
  137.     case "newpost" :
  138.     case "addpost" :
  139.     case "move" :
  140.     case "deltopic" :
  141.     case "newcategory" :
  142.     case "newforum" :
  143.     case "forum";
  144.     case "newtopic" :
  145.     case "addpost" :
  146.     case "addtopic" : $template = fetchmaintemplate("35");
  147.     break;
  148.     default : $template = fetchmaintemplate("12");
  149. }
  150.  
  151. if (!$template) $template = fetchmaintemplate("12");
  152.  
  153. $d = getdate(time());
  154. $year = ($_REQUEST['easy_year'] != '') ? (int)$_REQUEST['easy_year'] : $d['year'];
  155. $month = ($_REQUEST['easy_month'] != '') ? (int)$_REQUEST['easy_month'] : $d['mon'];
  156. $cal = new EasyCalendar;
  157.  
  158. $tmpl->assign('simple_calendar', $cal->getMonthView($month, $year, 'calendar/calendar_small.tpl','1','small'));
  159.  
  160. if(ISSHOP==1)
  161. {
  162.     $categs = array();
  163.     get_shop_categs_simple(0, '', $categs, $area);
  164.     $tmpl->assign('shopnavi', $categs);
  165. }
  166.  
  167.  
  168. if ($islogged == 1) {
  169.     $tmpl->assign("login", 1);
  170.     $tmpl->assign("name", $BENUTZER);
  171. } else {
  172.     $tmpl->assign("login", 0);
  173.     $tmpl->assign("gast", $GROUPSINGLE);
  174. }
  175. if (permission("canpn")) {
  176.     $tmpl->assign('pn', 1);
  177. } else {
  178.     $tmpl->assign('pn', 0);
  179. }
  180. if (permission("adminpanel")) {
  181.     $tmpl->assign('adminlink', 1);
  182. }
  183.  
  184.  
  185. switch ($_REQUEST['p']) {
  186.     case "index" :
  187.     case "" :
  188.         $printlink = "?area=$area&print=1";
  189.         break;
  190.     default :
  191.         $printlink = redir() . "&print=1";
  192. }
  193.  
  194.  
  195. $tmpl->assign('maxattachment', MAXATTACHMENT);
  196. $tmpl->assign('disp_shortnews', $disp_shortnews);
  197. $tmpl->assign('toggleimage_shortnews', $toggleimage_shortnews);
  198. $tmpl->assign('toggletd_shortnews', $toggletd_shortnews);
  199. $tmpl->assign('shortnews', $shortnews);
  200. $tmpl->assign('homelink', "index.php?p=index&area=" . $area . "");
  201. $tmpl->assign('forumlink', "index.php?area=" . $area . "&p=showforums");
  202. $tmpl->assign('easyversion', KVERSION);
  203. $tmpl->assign('redir', redir());
  204. $tmpl->assign('titel', $pref['hpname']);
  205. $tmpl->assign('aktuelleseite', $sname);
  206. $tmpl->assign('index.php?', "index.php?area=$area&");
  207. $tmpl->assign('area', $area);
  208. $tmpl->assign('lang', $lang);
  209. $tmpl->assign('document', getDocument());
  210. $tmpl->assign('speedbar', speedbar($area));
  211. $tmpl->assign('the_printlink', $printlink);
  212. $tmpl->assign('telllink', "index.php?area=" . $area . "&p=tell&action=form");
  213. $tmpl->register_function('printpanel', 'printpanel');
  214.  
  215. $languages = array();
  216. $sql = $db->Query("SELECT area_id, lang FROM ".PREFIX."_areas GROUP BY lang");
  217. while($row = $sql->fetchrow())
  218. {
  219.    if(empty($row->lang))
  220.       $row->lang = $pref['lang'];
  221.  
  222.    array_push($languages, $row);
  223. }
  224. $tmpl->assign('languages', $languages);
  225.  
  226. if ((isset($NOOUT) && $NOOUT == 1) || (isset($MISC) && $MISC == 1)) {
  227.     $tmpl->assign("content", $EOUT);
  228. }
  229. @setcookie ("real", 1);
  230.  
  231. $today = date("d-m-Y");
  232. $sql = $db->Query("SELECT datum FROM " . PREFIX . "_sitestats WHERE datum='$today' LIMIT 1");
  233. $isda = $sql->numrows();
  234.  
  235. if ($_SERVER['HTTP_REFERER'] != "") {
  236.     define("HOST", HTTPSSL . $HTTP_SERVER_VARS['HTTP_HOST']);
  237.     $host_1 = explode("//", HOST);
  238.     $host_1_1 = $host_1[1];
  239.     $host_1_1 = explode("/", $host_1_1);
  240.     $host_1_1 = $host_1_1[0];
  241.  
  242.     $host_2 = explode("//", $_SERVER['HTTP_REFERER']);
  243.     $host_2_2 = $host_2[1];
  244.     $host_2_2 = explode("/", $host_2_2);
  245.     $host_2_2 = $host_2_2[0];
  246.  
  247.     $referer = $_SERVER['HTTP_REFERER'];
  248.     $clientInfo = new Browser;
  249.     if ($host_1_1 != $host_2_2) {
  250.         $query_ref = "INSERT INTO " . PREFIX . "_referer (
  251.         id,
  252.         user_os,
  253.         user_ua,
  254.         user_referer,
  255.         datum
  256.         ) VALUES (
  257.         '',
  258.         '" . $clientInfo->Platform . "',
  259.         '" . $clientInfo->Name . " " . $clientInfo->Version . "',
  260.         '$referer',
  261.         NOW()
  262.         )";
  263.     }
  264. }
  265. if ($isda<1) {
  266.     $sql = $db->Query("INSERT INTO " . PREFIX . "_sitestats (datum,hits,tag,monat,jahr) VALUES ('$today','1','" . date("d") . "','" . date("m") . "','" . date("Y") . "')");
  267.     if ($query_ref) $sql = $db->Query($query_ref);
  268. }
  269.  
  270.  
  271. if ( ($isda>0) && ($_COOKIE['real']==1) ) {
  272.     $sql = $db->Query("UPDATE " . PREFIX . "_sitestats SET hits=hits+1 WHERE datum='$today'");
  273.     if ($query_ref) $sql = $db->Query($query_ref);
  274. }
  275.  
  276.  
  277. if ( ($_COOKIE['real']==1) && ($_COOKIE['visited'] != $today) ) {
  278.     $sql = $db->Query("UPDATE " . PREFIX . "_sitestats SET visits=visits+1 WHERE datum='$today'");
  279.     setcookie ('visited', $today , time() + (3600 * 24));
  280. }
  281.  
  282.  
  283. if(AJAX && defined('AJAX_REQUEST') && AJAX_REQUEST) {
  284.     $prepage = $tmpl->fetch('container/empty.tpl');
  285. }
  286. elseif((isset($NOOUT) && $NOOUT == 1) || (isset($nometa) && $nometa == 1)) {
  287.     $tmpl->display('page/noheader.tpl');
  288. }
  289. elseif($_REQUEST['print'] == 1) {
  290.     printupdate();
  291.     $tmpl->assign('url', str_replace("&print=1", "", redir()));
  292.     $tmpl->assign('print', $lang['printpage']);
  293.     $prepage = $tmpl->fetch('page/print.tpl');
  294. }
  295. else {
  296.     $prepage = $tmpl->fetch($template);
  297. }
  298.  
  299.  
  300. if(MRWRITE==1){
  301.  
  302.     if($_REQUEST['p'] != "showtopic" && $_REQUEST['p'] != "newpost" && $_REQUEST['p'] != "newtopic"){
  303.         
  304.         if(file_exists('index_rewrite.php'))
  305.             include('index_rewrite.php');
  306.         
  307.     }
  308. }
  309.  
  310. $prepage = str_replace(array("index.php&print=1", "index.php&print=1"), "?print=1", $prepage);
  311.  
  312. $db->_timer = sprintf('%.2f', $db->_timer);
  313. $_smarty_control_time = sprintf('%.2f', $_smarty_control_time);
  314. $_end_time = sprintf('%.2f', microtime_diff($_global_start_time));
  315.  
  316. echo $prepage;
  317. echo "\n<!-- {$_end_time} | {$db->_counter} | {$db->_timer} | {$_smarty_control_time} -->";
  318. ?>