<?php
/*-------------------------------------------------------+
| PHPFusion Content Management System
| Copyright © 2002 - 2013 Nick Jones
| http://www.php-fusion.co.uk/
+--------------------------------------------------------+
| Name: News Categories Center Panel
| Version: 1.00
| File Name: news_cats_center_panel.php
| Author: PHPFusion Mods UK
| Developers: Craig
| Site: http://www.phpfusionmods.co.uk
| Additional code from PHPFusion V7.02 news.php
| Author: Nick Jones (Digitanium)
+--------------------------------------------------------+
| This program is released as free software under the
| Affero GPL license. You can redistribute it and/or
| modify it under the terms of this license which you
| can read by viewing the included agpl.txt or online
| at www.gnu.org/licenses/agpl.html. Removal of this
| copyright header is strictly prohibited without
| written permission from the original author(s).
+--------------------------------------------------------*/
if (!defined("IN_FUSION")) { die("Access Denied"); }
if (file_exists(INFUSIONS."news_cats_center_panel/locale/".$settings['locale'].".php")) {
include INFUSIONS."news_cats_center_panel/locale/".$settings['locale'].".php";
} else {
include INFUSIONS."news_cats_center_panel/locale/English.php";
}
include LOCALE.LOCALESET."news_cats.php";
if (isset($_GET['cat_id']) && isnum($_GET['cat_id'])) {
$result = dbquery("SELECT * FROM ".DB_NEWS_CATS." WHERE news_cat_id='".$_GET['cat_id']."'");
$numrows = dbrows($result);
while ($datab = dbarray($result)) {
opentable($datab['news_cat_name'].$locale['global_200'].$locale['newscats001']);
$news_in_this_cat = dbcount("(news_id)", DB_NEWS, "news_cat='".$_GET['cat_id']."' AND ".groupaccess('news_visibility')." AND (news_start='0'||news_start<=".time().") AND (news_end='0'||news_end>=".time().") AND news_draft='0'");
echo " <div style='margin-bottom: 10px; margin-left: auto; margin-right:auto; padding-left: 5px; padding-right: 5px;'><div style='float:left;'>".THEME_BULLET." ".$locale['newscats005'].$datab['news_cat_name'].$locale['newscats006']."
</div><div style='float:right;'>Total News Items In This Category: ".$news_in_this_cat."</div></div>";
closetable();
}
$items_per_page = "5";
$rows = dbcount("(news_id)", DB_NEWS, "news_cat='".$_GET['cat_id']."' AND ".groupaccess('news_visibility')." AND (news_start='0'||news_start<=".time().") AND (news_end='0'||news_end>=".time().") AND news_draft='0'");
if (!isset($_GET['rowstart']) || !isnum($_GET['rowstart'])) { $_GET['rowstart'] = 0; }
if ($rows) {
$result = dbquery("SELECT tn.*, tc.*, tu.user_id, tu.user_name, tu.user_status
FROM ".DB_NEWS." tn
LEFT JOIN ".DB_USERS." tu ON tn.news_name=tu.user_id
LEFT JOIN ".DB_NEWS_CATS." tc ON tn.news_cat=tc.news_cat_id
WHERE ".groupaccess('news_visibility')." AND (news_start='0'||news_start<=".time().")
AND (news_end='0'||news_end>=".time().") AND news_draft='0' AND news_cat_id='".$_GET['cat_id']."'
GROUP BY news_id
ORDER BY news_sticky DESC, news_datestamp DESC LIMIT ".$_GET['rowstart'].",".$items_per_page);
$numrows = dbrows($result);
while ($data = dbarray($result)) {
$i++;
$comments = dbcount("(comment_id)", DB_COMMENTS." WHERE comment_type='N' AND comment_hidden='0' AND comment_item_id='".$data['news_id']."'");
$news_cat_image = "";
$news_subject = "<a href='".BASEDIR."news.php?readmore=".$data['news_id']."' name='news_".$data['news_id']."' id='news_".$data['news_id']."'>".stripslashes($data['news_subject'])."</a>";
$news_cat_image = "<a href='".($settings['news_image_link'] == 0 ? "news_cats.php?cat_id=".$data['news_cat']
: BASEDIR."news.php?readmore=".$data['news_id'] )."'>";
if ($data['news_image_t2'] && $settings['news_image_frontpage'] == 0) {
$news_cat_image .= "<img src='".IMAGES_N_T.$data['news_image_t2']."' alt='".$data['news_subject']."' class='news-category' /></a>";
} elseif ($data['news_cat_image']) {
$news_cat_image .= "<img src='".get_image("nc_".$data['news_cat_name'])."' alt='".$data['news_cat_name']."' class='news-category' /></a>";
} else {
$news_cat_image = "";
}
$news_news = preg_replace("/<!?--\s*pagebreak\s*-->/i", "", ($data['news_breaks'] == "y" ? nl2br(stripslashes($data['news_news'])) : stripslashes($data['news_news'])));
$news_info = array(
"news_id" => $data['news_id'],
"user_id" => $data['user_id'],
"user_name" => $data['user_name'],
"user_status" => $data['user_status'],
"news_date" => $data['news_datestamp'],
"cat_id" => $data['news_cat'],
"cat_name" => $data['news_cat_name'],
"cat_image" => $news_cat_image,
"news_subject" => $data['news_subject'],
"news_ext" => $data['news_extended'] ? "y" : "n",
"news_reads" => $data['news_reads'],
"news_comments" => $comments,
"news_allow_comments" => $data['news_allow_comments'],
"news_sticky" => $data['news_sticky']
);
echo "<!--news_prepost_".$i."-->\n";
render_news($news_subject, $news_news, $news_info);
}
echo "<!--sub_news_idx-->\n";
if ($rows > $items_per_page) echo "<div align='center' style='margin-top:5px;'>\n".makepagenav($_GET['rowstart'], $items_per_page, $rows, 3, FUSION_SELF."?cat_id=".$_GET['cat_id']."&")."\n</div>\n";
echo"<div align='center' style='font-weight: bold; margin-top:10px;'><a class='small' href='".FUSION_SELF."'>".$locale['newscats007']."</a></div>";
} else {
redirect(FUSION_SELF);
}
if (!dbrows($result) || !isset($_GET['rowstart']) || !isnum($_GET['rowstart'])) { redirect(FUSION_SELF); }
}
?>
Category Forum
Panels and InfusionsLabels
None yet
Statistics
3 participants
Notifications
You are not receiving notifications from this thread.
Related Questions