assign('gotMenu',$gotMenu); $smarty->assign('gotTree',$gotTree); $smarty->assign('gotBlock',$gotBlock); $smarty->assign('gotNewsWorld',$gotNewsWorld); session_start(); if($_SESSION['sky_userid']>0) $sql_where=''; else $sql_where='status!=2 AND '; if($id>0){ $gotCont=sql_query('SELECT nid, name_'.$_SESSION['lang'].', txt_'.$_SESSION['lang'].', created, visited, url_name, visited_today, main_image FROM '.$dbprefix.'news WHERE '.$sql_where.' nid="'.$id.'"',0); $innerIMG=1; } elseif($nid!=''){ $gotCont=sql_query('SELECT nid, name_'.$_SESSION['lang'].', txt_'.$_SESSION['lang'].', created, visited, url_name, visited_today, main_image FROM '.$dbprefix.'news WHERE '.$sql_where.' url_name="'.$nid.'"',0); $innerIMG=1; } else{ $sqlArhive=sql_query('SELECT from_unixtime(created, "%Y") AS year,from_unixtime(created, "%m") AS month, from_unixtime(created, "%m") AS monthEng, from_unixtime(created, "%Y-%m-%d") AS ndate FROM '.$dbprefix.'news GROUP by YEAR(ndate), MONTH(ndate) ORDER by year DESC, month DESC',1); $rusMonth=array(1=>'Январь', 2=>'Февраль', 3=>'Март', 4=>'Апрель', 5=>'Май', 6=>'Июнь', 7=>'Июль', 8=>'Август', 9=>'Сентябрь', 10=>'Октябрь', 11=>'Ноябрь',12=>'Декабрь'); $engMonth=array(1=>'january', 2=>'february', 3=>'march', 4=>'april', 5=>'may', 6=>'june', 7=>'july', 8=>'august', 9=>'september', 10=>'october', 11=>'november',12=>'december'); foreach($sqlArhive as $key=>$val){ $cyear=(int)$val[0]; $cmonth=(int)$val[1]; $yearArchive[$cyear][$cmonth]=$rusMonth[$cmonth]; } $smarty->assign('yearArchive',$yearArchive); $smarty->assign('engMonth',$engMonth); $aerror=false; $ayear=intval($_GET['ayear']); $amonth=intval($_GET['amonth']); if($ayear<2007 || $ayear>2058) $aerror=true; if($amonth<1 || $amonth>12) $aerror=true; if($aerror) $gotCont=sql_query('SELECT nid, name_'.$_SESSION['lang'].', txt_'.$_SESSION['lang'].', created, visited, url_name FROM '.$dbprefix.'news WHERE status!=2 and from_unixtime(created, "%Y")=YEAR(NOW()) AND from_unixtime(created, "%m")=MONTH(NOW()) ORDER by created DESC',1); else $gotCont=sql_query('SELECT nid, name_'.$_SESSION['lang'].', txt_'.$_SESSION['lang'].', created, visited, url_name FROM '.$dbprefix.'news WHERE status!=2 and from_unixtime(created, "%Y")=YEAR("'.$ayear.'-01-01") and from_unixtime(created, "%m")=MONTH("2007-'.$amonth.'-01") ORDER by created DESC',1); $innerIMG=0; $smarty->assign('newsArhive','1'); $smarty->assign('pageTitleHead',$pageLang['txtNewsArchive']); } if(count($gotCont)>1 && $innerIMG){ $gotCont[2]=str_replace('[pagebreak]', '',$gotCont[2]); if($gotCont[0]<402){ $startpos=0; $str1=""; $ahref_e=""; $gotCont[2]=str_replace($getimg, $ahref_b.$getimg_new.$ahref_e,$gotCont[2]); $startpos=$pos3+strlen($str3)+strlen($ahref_b)+strlen($ahref_e); $getimg=$getsrc=''; } } $Find = "#\[img\][\s]*([\S]+)[\s]*\[\/img\]#isU"; $Replace=""; $gotCont[2] = preg_replace($Find, $Replace, $gotCont[2]); $Find = "#\[img align=\'left\'\][\s]*([\S]+)[\s]*\[\/img\]#isU"; $Replace=""; $gotCont[2] = preg_replace($Find, $Replace, $gotCont[2]); $Find = "#\[img align=\'right\'\][\s]*([\S]+)[\s]*\[\/img\]#isU"; $Replace=""; $gotCont[2] = preg_replace($Find, $Replace, $gotCont[2]); $index=$values=array(); $index[]='visited'; $values[]=$gotCont[4]+1; $rez=sql_update($dbprefix.'content','WHERE cid="'.$id.'"',$index,$values); } $galleryJS=''; $smarty->assign('galleryJS',$galleryJS); $smarty->assign('gotCont',$gotCont); $smarty->assign('gotNews',$gotNews); $smarty->assign('gotPubl',$gotPubl); $smarty->assign('gotLastPath',$gotLastPath); ### GET NEWSTYPE $smarty->assign('gotNewsType',$gotNewsType); $smarty->assign('gotNewsTypeCnt',count($gotNewsType)); foreach ($genLang as $key=>$val){ $smarty->assign($key,$val); } if(isset($_COOKIE['news_visit']) && $_COOKIE['news_visit']==$gotCont[0] && $gotCont[0]>0) $old_visiter=true; else { setcookie("news_visit", $gotCont[0], time()+2592000); $old_visiter=false; if($_COOKIE['news_visit']=$gotCont[0]) $old_visiter=false; else $old_visiter=true; } if(intval($gotCont[0])>0 && $innerIMG==1){ $index=$values=array(); if($old_visiter==false) {$index[]='visited'; $values[]=$viewsTotal=$gotCont[4]+1;} else $viewsTotal=$gotCont[4]; if($old_visiter==false) $rez=sql_update($dbprefix.'news','WHERE nid="'.$gotCont[0].'"',$index,$values); list($getTodayDate)=sql_query('SELECT value FROM '.$dbprefix.'settings WHERE vname="current_date"',0); if($getTodayDate==date("Y-m-d")){ $index=$values=array(); $index[]='visited_today'; $values[]=$gotCont[6]+1; $rez=sql_update($dbprefix.'news','WHERE nid="'.$gotCont[0].'"',$index,$values); } else{ $index=$values=array(); $index[]='views_today'; $values[]=0; $rez=sql_update($dbprefix.'audio','WHERE 1',$index,$values); $index=$values=array(); $index[]='visited_today'; $values[]=0; $rez=sql_update($dbprefix.'news','WHERE 1',$index,$values); $index=$values=array(); $index[]='visited_today'; $values[]=0; $rez=sql_update($dbprefix.'newsworld','WHERE 1',$index,$values); $index=$values=array(); $index[]='views_today'; $values[]=0; $rez=sql_update($dbprefix.'categories','WHERE 1',$index,$values); $index=$values=array(); $index[]='views_today'; $values[]=0; $rez=sql_update($dbprefix.'gallery_cat','WHERE 1',$index,$values); $index=$values=array(); $index[]='value'; $values[]=date("Y-m-d"); $rez=sql_update($dbprefix.'settings','WHERE vname="current_date"',$index,$values); } } $smarty->assign('viewsTotal',$viewsTotal); $tpl = $smarty->fetch($file_tpl.'.tpl'); print $tpl; ?>