public function set_NewsItemInfo($news_id)
{
global $aidlink;
$locale = fusion_get_locale('', NEWS_LOCALE);
$settings = fusion_get_settings();
set_title(SiteLinks::get_current_SiteLinks("", "link_name"));
add_breadcrumb(array('link' => INFUSIONS . 'news/news.php', 'title' => SiteLinks::get_current_SiteLinks("", "link_name")));
$_GET['rowstart'] = isset($_GET['rowstart']) && isnum($_GET['rowstart']) ? $_GET['rowstart'] : 0;
$result = dbquery(self::get_NewsQuery(array('condition' => 'news_id=' . intval($news_id))));
if (dbrows($result) > 0) {
include INCLUDES . "comments_include.php";
include INCLUDES . "ratings_include.php";
$data = dbarray($result);
if ($data['news_keywords'] !== "") {
set_meta("keywords", $data['news_keywords']);
}
if (!isset($_POST['post_comment']) && !isset($_POST['post_rating'])) {
$result2 = dbquery("UPDATE " . DB_NEWS . " SET news_reads=news_reads+1 WHERE news_id='" . $_GET['readmore'] . "'");
$data['news_reads']++;
}
$news_subject = $data['news_subject'];
$news_news = preg_split("/<!?--\\s*pagebreak\\s*-->/i", $data['news_breaks'] == "y" ? nl2br(parse_textarea($data['news_extended'] ? $data['news_extended'] : $data['news_news'])) : parse_textarea($data['news_extended'] ? $data['news_extended'] : $data['news_news']));
$pagecount = count($news_news);
$_GET['rowstart'] = isset($_GET['rowstart']) && isnum($_GET['rowstart']) && $_GET['rowstart'] <= $pagecount ? $_GET['rowstart'] : 0;
$admin_actions = array();
if (iADMIN && checkrights("N")) {
$admin_actions = array("edit" => INFUSIONS . "news/news_admin.php" . $aidlink . "&action=edit&section=nform&news_id=" . $data['news_id'], "delete" => INFUSIONS . "news/news_admin.php" . $aidlink . "&action=delete&section=nform&news_id=" . $data['news_id']);
}
$news_info = $this->get_NewsData($data);
/*
array(
"news_id" => $data['news_id'],
"user_id" => $data['user_id'],
"user_name" => $data['user_name'],
"user_status" => $data['user_status'],
"user_joined" => $data['user_joined'],
"user_level" => $data['user_level'],
"user_avatar" => $data['user_avatar'],
"news_datestamp" => $data['news_datestamp'],
"news_ialign" => $data['news_ialign'],
"cat_id" => $data['news_cat'],
"news_cat_name" => $data['news_cat_name'],
"news_cat_image_src" => !empty($data['news_cat_image']) && file_exists(IMAGES_NC.$data['news_cat_image']) ? IMAGES_NC.$data['news_cat_image'] : "",
"news_image_src" => !empty($data['news_image']) && file_exists(IMAGES_N.$data['news_image']) ? IMAGES_N.$data['news_image'] : "",
"cat_image" => $data['news_cat_image'],
"news_subject" => $data['news_subject'],
"news_descr" => $data['news_news'],
"news_cat_url" => INFUSIONS.'news/news.php?cat_id='.$data['news_cat'],
'news_url' => INFUSIONS.'news/news.php?readmore='.$data['news_id'],
'news_news' => $news_news[$_GET['rowstart']],
"news_ext" => "n",
"news_keywords" => $data['news_keywords'],
"news_reads" => $data['news_reads'],
"news_comments" => $data['count_comment'],
'news_sum_rating' => $data['sum_rating'] ? $data['sum_rating'] : 0,
'news_count_votes' => $data['count_votes'],
"news_allow_comments" => $data['news_allow_comments'],
'news_allow_ratings' => $data['news_allow_ratings'],
"news_sticky" => $data['news_sticky'],
"print_link" => BASEDIR."print.php?type=N&item_id=".$data['news_id'],
'admin_actions' => $admin_actions,
); */
if (fusion_get_settings("create_og_tags")) {
add_to_head("<meta property='og:title' content='" . $data['news_subject'] . "' />");
add_to_head("<meta property='og:description' content='" . strip_tags($data['news_news']) . "' />");
add_to_head("<meta property='og:site_name' content='" . fusion_get_settings('sitename') . "' />");
add_to_head("<meta property='og:type' content='article' />");
add_to_head("<meta property='og:url' content='" . $settings['siteurl'] . "infusions/news.php?readmore=" . $_GET['readmore'] . "' />");
if ($data['news_image']) {
$og_image = IMAGES_N . $data['news_image'];
} else {
$og_image = IMAGES_NC . $data['news_cat_image'];
}
$og_image = str_replace(BASEDIR, $settings['siteurl'], $og_image);
add_to_head("<meta property='og:image' content='" . $og_image . "' />");
}
$_GET['cat_id'] = $data['news_cat_id'];
set_title($news_subject . $locale['global_200'] . $locale['news_0004']);
$news_cat_index = dbquery_tree(DB_NEWS_CATS, 'news_cat_id', 'news_cat_parent');
$this->news_cat_breadcrumbs($news_cat_index);
add_breadcrumb(array('link' => INFUSIONS . "news/news.php?readmore=" . $data['news_id'], 'title' => $data['news_subject']));
$info['news_item'] = $news_info;
$info['news_item']['page_count'] = $pagecount;
} else {
redirect(INFUSIONS . "news/news.php");
}
return $info;
}