Codice PHP:
<?php
/*
||==========================================================
|| Fusion News 3.x
||----------------------------------------------------------
|| File Version : $Id: news.php 233 2008-07-09 15:43:06Z xycaleth $
|| Contact : [email]xycaleth@gmail.com[/email]
|| Copyright: : (c) 2006 - 2008, FusionNews.net
|| License Info : [url]http://www.gnu.org/copyleft/gpl.html[/url]
||==========================================================
*/
# Edit the line below to align the page list (left, center, right)
$fn_page_align = 'center';
// Hackish fix
global $fsnw, $wfpost, $ht, $cbwordwrap, $smilies, $bb, $stfpop, $compop,
$furl, $fullnewsh, $fullnewsw, $fullnewss, $fullnewsz, $fslink, $datefor,
$stflink, $stfheight, $stfwidth, $stfscrolls, $stfresize, $pclink, $datefor,
$link_headline_fullstory, $hurl, $wwwidth, $comheight, $comwidth, $comscrolls,
$comresize;
if ( !defined ('FNEWS_ROOT_PATH') )
{
define ('FNEWS_ROOT_PATH', str_replace ('\\', '/', dirname (__FILE__)) . '/');
include_once FNEWS_ROOT_PATH . 'common.php';
}
// For singling out which news inclusion should be changing.
$fn_incl = ( isset ($VARS['fn_incl']) ) ? (int)$VARS['fn_incl'] : 0;
$fn_category = ( isset ($fn_category) ) ? (int)$fn_category : 0;
$fn_mode = '';
if ( isset ($VARS['fn_mode']) )
{
if ( $fn_incl == $fn_category )
{
$fn_mode = $VARS['fn_mode'];
}
}
switch ( $fn_mode )
{
case 'comments':
case 'fullnews':
case 'send':
include FNEWS_ROOT_PATH . $fn_mode . '.php';
unset ($fn_mode, $fn_page, $fn_category, $next_page, $prev_page, $pagination);
return;
break;
}
$fn_page = 1;
if ( $news_pagination )
{
$fn_page = ( isset ($_GET['fn_page']) ) ? intval ($VARS['fn_page']) : $fn_page;
$fn_page = ( $fn_page < 1 ) ? 1 : $fn_page;
}
$file = arrange_by_date();
$total_posts = sizeof ($file);
if ( $total_posts <= 0 )
{
unset ($fn_mode, $fn_page, $fn_category, $next_page, $prev_page, $pagination);
return;
}
$valid_posts = array();
for ( $i = 0; $i < $total_posts; $i++ )
{
$toc = get_line_data ('news_toc', $file[$i]);
$categories = explode (',', $toc['categories']);
if ( $fn_category === 0 || in_array ($fn_category, $categories) )
{
if ( file_exists (FNEWS_ROOT_PATH . 'news/news.' . $toc['news_id'] . '.php') )
{
$news_file = file (FNEWS_ROOT_PATH . 'news/news.' . $toc['news_id'] . '.php');
$valid_posts[] = get_line_data ('news', $news_file[1]);
}
}
}
if ( sizeof ($valid_posts) > 0 )
{
if ( $flip_news )
{
$valid_posts = array_reverse ($valid_posts);
}
if ( $news_pagination )
{
$total_posts = sizeof ($valid_posts);
$pagination = '';
$max_pages = ceil ($total_posts / $numofposts);
if ( $max_pages > 1 )
{
$fn_page = ( $fn_page > $max_pages ) ? $max_pages : $fn_page;
$other_qs = clean_query_string();
$other_qs .= '&fn_incl=' . $fn_category;
if ( $news_pagination_arrows )
{
if ( ($fn_page - 1) >= 1 )
{
$pagination .= '[url="?fn_page=' . ($fn_page - 1) . $other_qs . '"]' . $news_pagination_prv . '[/url]';
}
else
{
$pagination .= $news_pagination_prv . '';
}
}
if ( $news_pagination_numbers || (!$news_pagination_numbers && !$news_pagination_arrows))
{
for ( $i = 1; $i <= $max_pages; $i++ )
{
if ( $i > 1 )
{
$pagination .= '';
}
if ( $fn_page == $i )
{
$pagination .= '[b]' . $i . '[/b]';
}
else
{
$pagination .= '[url="?fn_page=' . $i . $other_qs . '"]' . $i . '[/url]';
}
}
}
if ( $news_pagination_arrows )
{
if ( ($fn_page + 1) <= $max_pages )
{
$pagination .= '[url="?fn_page=' . ($fn_page + 1) . $other_qs . '"]' . $news_pagination_nxt . '[/url]';
}
else
{
$pagination .= '' . $news_pagination_nxt;
}
}
}
}
$end = $fn_page * $numofposts;
if ( $news_pagination && $max_pages > 1 )
{
$pagination = '<div style="text-align:' . $fn_page_align . '">' . $pagination . '</div>';
echo $pagination;
}
if ( $post_per_day )
{
$posts = array();
}
for ( $i = $end - $numofposts; $i < $end; $i++ )
{
if ( !isset ($valid_posts[$i]) )
{
continue;
}
if ( $post_per_day )
{
$posts[mktime (0, 0, 0, date ('n', $valid_posts[$i]['timestamp']), date ('j', $valid_posts[$i]['timestamp']), date ('Y', $valid_posts[$i]['timestamp']))][] = $valid_posts[$i];
}
else
{
$news_info = parse_news_to_view ($valid_posts[$i], $fn_category);
echo $news_info['display'];
}
}
if ( $post_per_day )
{
$temp = get_template ('news_a_day_temp.php', false);
foreach ( $posts as $key => $value )
{
$news_display = '';
$display = replace_masks ($temp, array ('date' => date ($ppp_date, $key)));
foreach ( $value as $post )
{
$news = parse_news_to_view ($post, $fn_category);
$news_display .= $news['display'];
}
echo replace_masks ($display, array ('news_a_day' => $news_display));
}
}
if ( $news_pagination && $max_pages > 1 )
{
echo $pagination;
}
}
// Now remove the variables
unset ($fn_mode, $fn_page, $fn_category, $next_page, $prev_page, $pagination, $fn_incl);
?>