$page = "article";
include "header.php";
require('_drawrating.php');
$id=preg_replace("/[^0-9]+/","",$_GET['id']);
//$id=$_GET['id'];
$artquery= "Select * from se_art where id=$id";
$artlist = $database->database_query($artquery);
$art_array = Array();
$art_count=0;
while($artdata = $database->database_fetch_assoc($artlist)) {
if ($artdata[keywords]>'') { $keywords=$artdata[keywords]; }
else
{
$keywords='диеты,быстрые диеты,мода,модные прически,фитнесс,таблица калорий,как похудеть,похудение,целлюлит,здоровье,питание';
}
if ($artdata[description]>'') { $description=$artdata[description]; }
else
{
$description=substr($artdata[short], 0, 180);
}
$art_array[$art_count] = Array('ddate' => $artdata[ddate],
'artname' => $artdata[artname],
'img' => $artdata[img],
'view' => $artdata[view],
'short' => $artdata[short],
'cat' => $artdata[cat],
'id' => $artdata[id],
'art' => gzuncompress($artdata[art]) );
$pagename=$artdata[artname];
$art_count++;
}
// ЩОЧЕГ ПРОСМОТРОВ ПЛЮСАДИН
$database->database_query("UPDATE se_art SET view=view+1 WHERE id=$id");
// ПЯТЬ СТАТЬИШЕК ИЗ ЭТОЙ ТЕМЫ
$query= "Select * from se_art where cat=".$art_array[0][cat]." ORDER BY ddate DESC LIMIT 3";
$qresult = $database->database_query($query);
$short_array = Array();
$short_count=0;
while($shortdata = $database->database_fetch_assoc($qresult)) {
if ($shortdata[id]<846) {$arturl='article.php?id='.$shortdata[id];} else {$arturl=$shortdata[id].'-'.$shortdata[url];}
$short_array[$short_count] = Array('ddate' => $shortdata[ddate],
'id' => $shortdata[id],
'img' => $shortdata[img],
'arturl' => $arturl,
'artname' => $shortdata[artname]);
$short_count++;
}
// ПЯТЬ СТАТЬИШЕК ИЗ ЭТОЙ ТЕМЫ
$query= "Select * from se_art where cat=".$art_array[0][cat]." ORDER BY ddate DESC LIMIT 3,3";
$qresult = $database->database_query($query);
$short_array2 = Array();
$short_count2=0;
while($shortdata2 = $database->database_fetch_assoc($qresult)) {
$short_array2[$short_count2] = Array('img' => $shortdata2[img]);
$short_count2++;
}
// ПОПУЛЯРНЫЕ СТАТЬИ
$query= "Select * from se_art ORDER BY view DESC LIMIT 15";
$qresult = $database->database_query($query);
$pop_array = Array();
$pop_count=0;
while($popdata = $database->database_fetch_assoc($qresult)) {
if ($popdata[id]<846) {$arturl='article.php?id='.$popdata[id];} else {$arturl=$popdata[id].'-'.$popdata[url];}
$pop_array[$pop_count] = Array('ddate' => $popdata[ddate],
'id' => $popdata[id],
'img' => $popdata[img],
'arturl' => $arturl,
'artname' => $popdata[artname]);
$pop_count++;
}
shuffle($pop_array);
array_splice($pop_array, 3);
$smarty->assign('popdata', $pop_array);
// IF A COMMENT IS BEING POSTED
if($task == "dopost") {
$comment_date = time();
$comment_body = $_POST['comment_body'];
// RETRIEVE AND CHECK SECURITY CODE IF NECESSARY
if($setting[setting_comment_code] != 0 || $user->user_info[user_username] == '') {
session_start();
$code = $_SESSION['code'];
if($code == "") { $code = randomcode(); }
$comment_secure = $_POST['comment_secure'];
if($comment_secure != $code) { $is_error = 1; }
}
// MAKE SURE COMMENT BODY IS NOT EMPTY
$comment_body = censor(str_replace("\r\n", "
", $comment_body));
$comment_body = preg_replace('/(
){3,}/is', '
', $comment_body);
$comment_body = ChopText($comment_body);
if(str_replace(" ", "", $comment_body) == "") { $is_error = 1; $comment_body = ""; }
// ADD COMMENT IF NO ERROR
if($is_error == 0) {
$database->database_query("INSERT INTO se_artcomments (artcomment_artentry_id, artcomment_authoruser_id, artcomment_date, artcomment_body) VALUES ('$art_id', '".$user->user_info[user_id]."', '$comment_date', '$comment_body')");
// INSERT ACTION IF USER EXISTS
if($user->user_exists != 0) {
$commenter = $user->user_info[user_username];
$comment_body_encoded = $comment_body;
if(strlen($comment_body_encoded) > 250) {
$comment_body_encoded = substr($comment_body_encoded, 0, 240);
$comment_body_encoded .= "...";
}
$comment_body_encoded = htmlspecialchars(str_replace("
", " ", $comment_body_encoded));
$actions->actions_add($user, "blogcomment", Array('[username1]', '[username2]', '[id]', '[comment]'), Array($commenter, $owner->user_info[user_username], $blogentry_id, $comment_body_encoded));
} else {
$commenter = $blog_entry[11];
}
// SEND COMMENT NOTIFICATION IF NECESSARY
$owner->user_settings();
if($owner->usersetting_info[usersetting_notify_blogcomment] == 1 & $owner->user_info[user_id] != $user->user_info[user_id]) {
send_generic($owner->user_info[user_email], "$setting[setting_email_fromname] <$setting[setting_email_fromemail]>", $setting[setting_email_blogcomment_subject], $setting[setting_email_blogcomment_message], Array('[username]', '[commenter]', '[link]'), Array($owner->user_info[user_username], $commenter, "url_create("blog_entry", $owner->user_info[user_username], $blogentry_info[blogentry_id])."\">".$url->url_create("blog_entry", $owner->user_info[user_username], $blogentry_info[blogentry_id]).""));
}
}
echo "