/*---------------------------------------------------+
| PHP-Fusion 6 Content Management System
+----------------------------------------------------+
| Copyright © 2002 - 2006 Nick Jones
| http://www.php-fusion.co.uk/
+----------------------------------------------------+
| Released under the terms & conditions of v2 of the
| GNU General Public License. For details refer to
| the included gpl.txt file or visit http://gnu.org
+----------------------------------------------------*/
require_once "maincore.php";
require_once THEMES."templates/header.php";
if ( isset($_GET['readmore']) && !isNum($_GET['readmore'])) redirect(FUSION_SELF);
$settings['news_style'] = "0" ;
// Predefined variables, do not edit these values
if ($settings['news_style'] == "1" )
{
$i = 0; $rc = 0; $ncount = 1; $ncolumn = 1; $news_[0] = ""; $news_[1] = ""; $news_[2] = "";
}
else
{
$i = 1;
}
// This number should be an odd number to keep layout tidy
$items_per_page = 5;
$news = "";
if (!isset($_GET['readmore']))
{
$rows = dbcount("(news_id)", DB_PREFIX."news", groupaccess('news_visibility')." AND (news_start='0'||news_start<=".time().") AND (news_end='0'||news_end>=".time().")");
if ($rows != 0)
{
$result = dbquery(
"SELECT tn.*, tc.*, user_id, user_name FROM ".DB_PREFIX."news tn
LEFT JOIN ".DB_PREFIX."users tu ON tn.news_name=tu.user_id
LEFT JOIN ".DB_PREFIX."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().")
ORDER BY news_sticky DESC, news_datestamp DESC LIMIT 0,".$items_per_page.""
);
$numrows = dbrows($result);
if ($settings['news_style'] == "1" ) $nrows = round((dbrows($result) - 1) / 2);
$r_color=0;
while ($data = dbarray($result))
{
$news_info = array(
"news_id" => $data['news_id'],
"user_id" => $data['user_id'],
"user_name" => $data['user_name'],
"news_date" => $data['news_datestamp'],
"news_ext" => $data['news_extended'] ? "y" : "n",
"news_reads" => $data['news_reads'],
"news_comments" => dbcount("(comment_id)", DB_PREFIX."comments", "comment_type='N' AND comment_item_id='".$data['news_id']."'"),
"news_allow_comments" => $data['news_allow_comments']
);
if ( strlen($data['news_subject']) > 30)
{
$news_subject = substr($data['news_subject'],0,30)." ...";
}
else
{
$news_subject = $data['news_subject'];
}
$news .= "
";
$r_color++;
}
if ($settings['news_style'] == "0" )
{
opentable($locale['global_077']);
echo "";
echo "\n\n\n";
echo "";
echo "Thema | ";
echo "Gelesen | ";
echo "Kommentare | ";
echo "Ver\366ffentlicht | ";
echo " \n";
echo " |
\n";
echo "\n\n";
echo $news;
echo " | \n
\n";
echo " » weitere Neuigkeiten |
";
echo "
\n";
closetable();
}
if ($settings['news_style'] == "1" )
{
opentable($locale['046']);
echo "\n\n\n";
echo $news_[0];
echo $news_[1];
echo $news_[2];
echo " | \n
\n
\n";
closetable();
}
}
else
{
opentable($locale['046']);
echo "
\n".$locale['047']."
\n\n";
closetable();
}
}// if (!isset($_GET['readmore']))
else
{
include INCLUDES."comments_include.php";
include INCLUDES."ratings_include.php";
$result = dbquery(
"SELECT tn.*, user_id, user_name FROM ".DB_PREFIX."news tn
LEFT JOIN ".DB_PREFIX."users tu ON tn.news_name=tu.user_id
WHERE news_id='".$_GET['readmore']."'"
);
if (dbrows($result)!=0)
{
$data = dbarray($result);
if (checkgroup($data['news_visibility']))
{
$news_cat_image = "";
if (!isset($_GET['post_comment']) && !isset($_GET['post_rating']))
{
$result2 = dbquery("UPDATE ".DB_PREFIX."news SET news_reads=news_reads+1 WHERE news_id='".$_GET['readmore']."'");
$data['news_reads']++;
}
$news_subject = $data['news_subject'];
if ($data['news_cat'] != 0)
{
$result2 = dbquery("SELECT * FROM ".DB_PREFIX."news_cats WHERE news_cat_id='".$data['news_cat']."'");
if (dbrows($result2))
{
$data2 = dbarray($result2);
$news_cat_image = "";
}
}
$news_news = stripslashes($data['news_extended'] ? $data['news_extended'] : $data['news_news']);
if ($data['news_breaks'] == "y") { $news_news = nl2br($news_news); }
if ($news_cat_image != "") $news_news = $news_cat_image.$news_news;
$news_info = array(
"news_id" => $data['news_id'],
"user_id" => $data['user_id'],
"user_name" => $data['user_name'],
"news_date" => $data['news_datestamp'],
"news_ext" => "n",
"news_reads" => $data['news_reads'],
"news_comments" => dbcount("(comment_id)", DB_PREFIX."comments", "comment_type='N' AND comment_item_id='".$data['news_id']."'"),
"news_allow_comments" => $data['news_allow_comments']
);
render_news($news_subject, $news_news, $news_info);
if ($data['news_allow_comments']) showcomments("N",DB_NEWS,"news_id",$_GET['readmore'],FUSION_SELF."?readmore=".$_GET['readmore']."");
if ($data['news_allow_ratings']) showratings("N",$_GET['readmore'],FUSION_SELF."?readmore=".$_GET['readmore']."");
}
else
{
redirect(FUSION_SELF);
}
}
else
{
redirect(FUSION_SELF);
}
}
require_once THEMES."templates/footer.php";
?>