1){ ini_set("session.cookie_domain", $_CONFIG['domain']);} session_start(); //error_reporting(0); //if(isset($_POST['page'])){$_POST="";} // include('przekierowanie.php'); //ini_set('session.cookie_domain', (strpos($_SERVER['HTTP_HOST'],'.') !== false) ? $_SERVER['HTTP_HOST'] : ''); /*****************************************************/ /* Panicz CMS - zapraszamy na www.panicz.org */ /*****************************************************/ if(!empty($_SERVER['REQUEST_URI']) && strstr($_SERVER['REQUEST_URI'], 'http://') !== false){die('STOP BOT');} function podaj_czas(){list($usec, $sec) = explode(" ", microtime());return ((float)$usec + (float)$sec);}$na_poczatku = podaj_czas(); //echo $_SESSION['usersession']; //include('module/safe.php'); include('db_conf.php'); include('config.php'); include('inc/function.php'); include('lang/'.$_CONFIG['lang'].'/index.php'); $Z['idx']=preg_replace('/[^0-9\,]/','',$_GET['idx']); $Z['idxname']=preg_replace('/[^a-z0-9\_\-]/','',$_GET['idxname']); $Z['p']=explode('/',preg_replace('/[^a-zA-Z0-9\,\_\.\-\/]/','',$_GET['p'])); //katalog //if($_GET['page']<1){$_GET['page']=0;} //if(!isset($_GET['page'])){$_GET['page']=0;} //if(!isset($_GET['pagename'])){$_GET['pagename']='';} if(empty($_GET['s'])) { if($_GET['page']>0){if($_GET['pagename']!=$_CONFIG['pagename']){header("HTTP/1.1 301 Moved Permanently");header('Location: '.$_CONFIG['pagename'].',p'.$_GET['page'].'.html'); header("Connection: close"); exit;} } } //if($_GET['page']>0){if($_GET['pagename']!=$_CONFIG['pagename']){header("HTTP/1.1 301 Moved Permanently");header('Location: '.$_CONFIG['pagename'].',p'.$_GET['page'].'.html'); header("Connection: close"); exit;} } require_once('libs/Smarty.class.php'); $smarty = new Smarty; $smarty->template_dir = 'style/'.$_CONFIG['style'] .'/'; $smarty->compile_dir = 'temp/templates_c/'; $smarty->config_dir = 'temp/configs/'; $smarty->cache_dir = 'temp/cache/'; if($_CONFIG['wildcard']==1) { $Z['subdomena']=subdomena(); //if(empty($Z[subdomena])){unset($Z[subdomena]);} } if($_CONFIG['wildcard']==2) { if(($Z['p'][0]=='u')&(!empty($Z['p'][1]))) { header("HTTP/1.1 301 Moved Permanently"); header("Location: ".user_url($Z['p'][1])); header("Connection: close"); exit; } $Z['subdomena']=subdomena(); if(!empty($Z['subdomena'])){ $Z['p'][3]=$Z['p'][1]; $Z['p'][2]=$Z['p'][0]; $Z['p'][1]=$Z['subdomena']; $Z['p'][0]='u'; $Z['u']='u'; }else{unset($Z['subdomena']);} }else{$Z['u']=$Z['p'][0];} if($_CONFIG['wildcard']==3) { $Z['subdomena']=subdomena(); if(!empty($Z['subdomena'])){$Z['p'][2]=$Z['p'][0]; $Z['p'][0]='t'; $Z['p'][1]=$Z['subdomena']; }else{unset($Z['subdomena']);} } if( ($_CONFIG['cache']>0) & (empty($_COOKIE['login'])) & ((($Z['u']=='u')&(!isset($_GET['page'])))||(($Z['u']!='u'))) & ( (empty($_SESSION['sort']))&(empty($_POST['pole'])) ) & (empty($_POST['d'])) & (empty($_SESSION['usersession'])) ) { if($_GET['idx']=='index'){unset($_GET['idx']);} if(empty($_GET['idx'])){$full_cache=1;}else{$medium_cache=1;} } // full cache // if(!isset($full_cache)){$full_cache=0;} if(!isset($medium_cache)){$medium_cache=0;} if($full_cache==1) { if(!empty($Z['subdomena'])){$zz[0]=$Z['subdomena'];} if($_COOKIE['show']=='big'){$z[0]=$z[0].'big';} if ($_CONFIG['mod_rewrite']==1){$my_cache_id = $zz[0].''.$_GET['p'].''.$z[0].''.$_GET['page'];} $smarty->caching = 2; $smarty->cache_lifetime=$_CONFIG['cache']*60; if ($smarty->is_cached('index.tpl',$my_cache_id)) { $smarty->display('index.tpl',$my_cache_id); // $na_koncu = podaj_czas(); //echo $na_koncu - $na_poczatku .' '; die(); }//cache funkcja sprawdzajaca }$zz='';$z=''; //full cache koniec //połaczenie z mysql @$sql_conn = mysql_connect($db['host'], $db['user'], $db['pass'])or die('DB Error');mysql_select_db($db['name']);unset($db); mysql_query("SET NAMES 'utf8'"); /* $result = mysql_query( "SELECT * FROM `{$prefix}com_film` WHERE `id`>'0' "); while($r = mysql_fetch_assoc($result)) { // $r[txt]= show_polish($r[txt]) ; @mysql_query( "UPDATE `{$prefix}com_film` SET `date`='$teraz' WHERE `id`='$r[id]'"); } */ //autologowanie if (($_CONFIG['autologin']==1)&(empty($_SESSION['usersession']))) { if(isset($_COOKIE['login'])) { $cookie=preg_replace('/[^a-zA-Z0-9\_\.]/','',$_COOKIE['login']); $cookie=explode('.', $cookie); if($cookie[0]>0){$r = mysql_fetch_assoc(mysql_query("SELECT * FROM `{$prefix}users` WHERE `id`='$cookie[0]' LIMIT 1"));} if (($r['id']==$cookie[0])&($cookie[1]==md5($r['id'].'-'.$r['pass']))) { $_SESSION['usersession']=$r['id'].','.$key_SID.','.$r['date']; $medium_cache=0; }//else{setcookie("login", '',0,'/','',0,1);} } } //sprawdzamy czy jestes zalogowany user_login(); //menu wczytujemu do tablicy if(!file_exists('temp/menu.php')) { include('inc/menu.php'); }//if flie... menu istnije else { include('temp/menu.php'); } // menu wczytane if ($_CONFIG['mod_rewrite']==1) { // $Z[idx]=ereg_replace('[^a-zA-Z0-9,_-]','',$_GET['idx']) ; // $Z[p]=explode('/',ereg_replace('[^a-zA-Z0-9/,_.-]','',$_GET['p'])); //katalog /* if($Z[p][0]=='u'){ $Z[p1]=$Z[p][0]; $Z[p2]=$Z[p][1]; $Z[p3]=$Z[p][2]; $Z[p4]=$Z[p][3];} else if($Z[p][0]=='t'){ $Z[p1]=$Z[p][0]; $Z[p2]=$Z[p][1]; $Z[p3]=$Z[p][2]; $Z[p4]=$Z[p][3]; } else if($Z[p][0]=='sitemap'){$Z[p1]=$Z[p][0]; $Z[p2]=$Z[p][1]; $Z[p3]=$Z[p][2];} else { if(($_CONFIG['portal']==1)&($_CONFIG['wildcard']==1)) { $Z[p1]=$Z[p][0]; $Z[p2]=$Z[p][0]; $Z[p3]=$Z[p][1]; $Z[p4]=$Z[p][2]; $Z[idmenu]=idmenu($Z[p1]); //echo $_SERVER[HTTP_HOST]; echo $_CONFIG[site_url] ; if($_CONFIG[site_url]!='http://'.$_SERVER[HTTP_HOST]) { $zz=ereg_replace('www.','',$_SERVER[HTTP_HOST]); $z=ereg_replace('http://www.','',$_CONFIG[site_url]); $z=ereg_replace('http://','',$z); if($z!=$zz) { $zz=explode('.',$zz); $Z[module]=$zz[0];$zz=''; } } } else if(($_CONFIG['portal']==1)&($_CONFIG['wildcard']!=1)) { $Z[p1]=$Z[p][0]; $Z[p2]=$Z[p][1]; $Z[p3]=$Z[p][2]; $Z[p4]=$Z[p][3]; $Z[p5]=$Z[p][4]; $Z[module]=$Z[p][0]; $Z[idmenu]=idmenu($Z[p2]); } else { $Z[p1]=$Z[p][0]; $Z[p2]=$Z[p][0]; $Z[p3]=$Z[p][1]; $Z[p4]=$Z[p][2]; $Z[idmenu]=idmenu($Z[p1]); } } */ if($Z['p'][0]=='u'){ $Z['p1']='u'; $Z['p2']=$Z['p'][1]; $Z['p3']=$Z['p'][2]; $Z['p4']=$Z['p'][3];} else if($Z['p'][0]=='t'){ $Z['p1']='t'; $Z['p2']=$Z['p'][1]; $Z['p3']=$Z['p'][2]; $Z['p4']=$Z['p'][3];} else if((!empty($_GET['s']))||(!empty($_POST['s']))){$Z['p1']='search';} else if($Z['p'][0]=='sitemap'){$Z['p1']=$Z['p'][0]; $Z['p2']=$Z['p'][1]; $Z['p3']=$Z['p'][2];} else { if($_CONFIG['wildcard']==1){$Z['subdomena']=subdomena();} if(!empty($Z['subdomena'])) { $Z['p1']=$Z['subdomena']; $Z['p2']=$Z['p'][0]; $Z['p3']=$Z['p'][1]; $Z['p4']=$Z['p'][2]; //$Z[idmenu]=idmenu($Z[p1]); } else { $Z['p1']=$Z['p'][0]; $Z['p2']=$Z['p'][1]; $Z['p3']=$Z['p'][2]; $Z['p4']=$Z['p'][3]; } } $Z['idmenu']=idmenu($Z['p1'],$Z['p2']); // echo ' x '.$Z[p1].' x '.$Z[p2]; } //if(eregi('[a-z]', $Z[idmenu])) {$Z[idmenu]='';} /* if(($_CONFIG['wildcard']==2)&(!empty($Z[subdomena]))) { $Z[p4]=$Z[p2]; $Z[p3]=$Z[p1]; $Z[p2]=$Z[subdomena]; $Z[p1]='u'; // echo $Z[subdomena]; } */ // medium cache if($medium_cache==1) { if(file_exists('module/'.$menu[$Z['idmenu']]['com'].'.php')){include('module/'.$menu[$Z['idmenu']]['com'].'.php');} if($_CONFIG['no_cache']!=1) { // $z=explode('-',$_GET['idx']); if ($_CONFIG['mod_rewrite']==1){$my_cache_id = $menu[$Z['idmenu']]['com'].''.$Z['idx'].'_'.strlen($Z['idxname']).'';} $smarty->caching = 2; $smarty->cache_lifetime=$_CONFIG['cache']*60; if ($smarty->is_cached('index.tpl',$my_cache_id)) { $smarty->display('index.tpl',$my_cache_id); // $na_koncu = podaj_czas(); //echo $na_koncu - $na_poczatku .' '; if($_CONFIG['on_views']==1){ @mysql_query( "UPDATE `{$prefix}com_{$menu[$Z[idmenu]][com]}` SET views=views+1 WHERE `id`='$Z[idx]' LIMIT 1");} mysql_close($sql_conn); die(); } } //no cache }$z=''; //full cache koniec //if((empty($Z[p1]))&(empty($Z[module]))){$Z[com]=$menu[$_CONFIG[idmenu]][com]; $Z[module]=$menu[$_CONFIG[idmenu]][module]; $Z[idmenu]=$_CONFIG['idmenu']; if($Z['idmenu']==0){$start=1;} }else{$Z[com]=$menu[$Z[idmenu]][com];} //echo $Z[idmenu].' '.$Z[p1]; if($Z['idmenu']>0){$Z['com']=$menu[$Z['idmenu']]['com'];} else if(empty($Z['p1'])){ if(!empty($_CONFIG['light'])){ if($_CONFIG['idmenu']==0){$start=1;}else{$Z['com']=$_CONFIG['light'];} }else{ $Z['com']=$menu[$_CONFIG['idmenu']]['com']; $Z['idmenu']=$_CONFIG['idmenu']; if($Z['idmenu']==0){$start=1;} } } //else if((empty($Z[p1]))||($Z[p1]==0)) //echo $menu[$Z[idmenu]][com] ; //if($Z[module]=='u'){include('inc/u.php');} if($Z['p1']=='u'){include('components/u/index.php');$Z['idcat']='';} else if($Z['p1']=='sitemap'){include('inc/sitemap.php');} else if(($Z['p1']=='search')||($Z['p1']=='t')){include('components/search/index.php');} else if($start==1){include('module/start.php'); include('components/start/index.php'); } else if((!empty($Z['com'])) & (($menu[$Z['idmenu']]['usertype']<1)||($user['type']>=$menu[$Z['idmenu']]['usertype']))){include('module/'.$Z['com'].'.php'); include('components/'.$_CONFIG['component'].'/index.php'); } /* $link=''; // MENU wyświetlamy foreach ($menu as $value) { //if($value[poziom]==1){$zzz.='';} if ($_CONFIG['mod_rewrite']==1) { if($_CONFIG['uniquemenu']==1){$link=module_link($value[module]).'/'.title_($value[title]).'/';} else{$link=module_link($value[module]).'/'.$value[id].'-'.title_($value[title]).'/';} } if($Z[idcat]==$value[id]) {$zzz.='
  • '.$value[title].'
  • ';} else{$zzz.='
  • '.$value[title].'
  • ';} } unset ($link) ; $menuleweee=''; //end menu */ // echo $menu_top; if(is_array($menu_top)){$menu_top=menu('top');} if(($_CONFIG['adult']==1)||($menu[$Z['idmenu']]['adult']==1)){$_CONFIG['meta'].=''; }if($_CONFIG['stats']==1){$stats='';}else{unset($stats);} //if($_CONFIG['menu_l']<10){$_CONFIG['menu_l']=10;} //if($_CONFIG['menu_r']<10){$_CONFIG['menu_r']=10;} if(empty($tpl)){header("HTTP/1.0 404 Not Found"); $tpl='error'; $_CONFIG['menu_l']=0;$_CONFIG['menu_r']=0;$_CONFIG['site_title']='404'; $my_cache_id='error';} $index= array('id'=>$r['id'], 'page'=>page(), //'banner'=>$banner, 'user_links'=>user_links($user_type,$user_id,$user_nick), 'stats'=>$stats, 'menu_top'=>$menu_top, 'component_url'=>$component_url, 'component_url2'=>$component_url2, 'component_sort'=>$component_sort, 'tu_jestem'=>tu_jestem($Z['idmenu']).''.$tu_jestem, 'tpl'=>$tpl.'.tpl', 'msg'=>$msg); $smarty->assign('banner', $banner); $smarty->assign('lang', $_LANG); //lang $smarty->assign('config', $_CONFIG); $smarty->assign('index', $index); $smarty->display('index.tpl',$my_cache_id); mysql_close($sql_conn); if($user['type']>8){echo $_COOKIE['login']; $na_koncu = podaj_czas(); echo $na_koncu - $na_poczatku ;} ?>