include_once("../../db.inc.php"); include_once("../../classes/templates.php"); $template=new Template("home"); //--------------------get article $sql="select * from articles where id=".(int)$_GET["id"]; if ($article=SQLread($sql)) { }else{ header("location:/"); die(); } if ($article["picture"]!="") { $tmp_pic=explode(".",$article["picture"]); $sql="select * from pictures where id = ".$tmp_pic[0]; $picture=SQLread($sql); } //--------------------------------------------------------------update views $sql="update LOW_PRIORITY articles set views=views+1 where id=".$article["id"]; SQLexec($sql); //---------------------get section $sql="select section_id as id from articles_sections where article_id=".$article["id"]." limit 1"; $section=SQLread($sql); $articles_sections=getArticleSection($section["id"]); //---------------------get RELATED $sql="select * from articles_related where article_id=".$article["id"]." "; $rel=SQLread($sql); if ($rel["related"]!="") { $sql="select articles.id, name, picture, hasMedia, comments_nr, created from articles where id in (".$rel["related"].") and vizible = 1 order by FIELD(articles.id,".$rel["related"].")"; $related=SQL2Array($sql); $sql="select * from articles_sections where articles_sections.article_id in (".$rel["related"].")"; $res=SQLexec($sql); while ($row=SQLfetch($res)) { $related_sections[$row["article_id"]]=$row["section_id"]; } } //---------------------get pictures $sql="select * from pictures where item_id =".$article["id"]." and item_type=1 and gallery = 1 order by position asc, id asc"; $article["pictures"]=SQL2Array($sql); //---------------------get videos $sql="select videos.* from videos inner join articles_videos on articles_videos.video_id = videos.id where articles_videos.article_id =".$article["id"]." order by articles_videos.id asc"; $article["videos"]=SQL2Array($sql); //---------------------get authors $sql="select authors.* from articles_authors inner join authors on articles_authors.author_id = authors.id where article_id=".$article["id"]." order by articles_authors.id asc"; $article["authors"]=SQL2Array($sql); //---------------------get tags $sql="select tags.* from articles_tags inner join tags on articles_tags.tag_id=tags.id where article_id=".$article["id"]." order by articles_tags.id asc"; $article["tags"]=SQL2Array($sql); //set pager if( !isset($_GET["pager"]) ){ $pager = 1; }else{$pager=(int)($_GET["pager"]); }; $text=explode('