Вход Регистрация
Файл: apwa/recent.php
Строк: 82
<?php
/** 
*
* @package phpBB3
* @version $Id: recent.php,v 1.1.2 2007/08/21 23:21:39 rxu Exp $
* @copyright (c) 2005 phpBB Group 
* @license http://opensource.org/licenses/gpl-license.php GNU Public License 
*
*/

/**
* @ignore
*/

/* Config section */
$cfg_ignore_forums '';         // ids of forums you don't want to display, separated by commas or empty
$cfg_only_forums '';             // ids of forums you only want to display, separated by commas or empty
$cfg_nm_topics 7;            // number of topics to output
$cfg_max_text_length 160;     // max topic length, if more, title will be shortened
$cfg_show_replies true;         // show number of replies to topics
/* End of config */

define('IN_PHPBB'true);
$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH './';
$phpEx substr(strrchr(__FILE__'.'), 1);
include(
$phpbb_root_path 'common.' $phpEx);
include(
$phpbb_root_path 'includes/bbcode.' $phpEx);

//
// Let's prevent caching
//
if (!empty($_SERVER['SERVER_SOFTWARE']) && strstr($_SERVER['SERVER_SOFTWARE'], 'Apache/2'))
{
    
header ('Cache-Control: no-cache, pre-check=0, post-check=0');
}
else
{
    
header ('Cache-Control: private, pre-check=0, post-check=0, max-age=0');
}
header('Content-type: text/html; charset=UTF-8');
header('Expires: 0');
header('Pragma: no-cache');

// Start session management
$user->session_begin();
$auth->acl($user->data);
$user->setup('common');

// Fetching forums that should not be displayed
$forums implode(','array_keys($auth->acl_getf('!f_read'true)));
$cfg_ignore_forums = (!empty($cfg_ignore_forums) && !empty($forums)) ? $cfg_ignore_forums ',' $forums : ((!empty($forums)) ? $forums : ((!empty($cfg_ignore_forums)) ? $cfg_ignore_forums ''));

// Building sql for forums that should not be displayed
$sql_ignore_forums = (!empty($cfg_ignore_forums)) ? ' AND t.forum_id NOT IN(' $cfg_ignore_forums .') ' '';

// Building sql for forums that should only be displayed
$sql_only_forums = (!empty($cfg_only_forums)) ? ' AND t.forum_id IN(' $cfg_only_forums .') ' '';

// Fetching topics of public forums
$sql 'SELECT t.topic_id, t.forum_id, t.topic_title, t.topic_last_post_id, t.topic_first_post_id, t.topic_replies, t.topic_replies_real, p.post_id, p.post_text, p.bbcode_uid, p.bbcode_bitfield, p.post_attachment, p.post_approved
    FROM ' 
TOPICS_TABLE ' AS t, ' POSTS_TABLE ' AS p, ' FORUMS_TABLE " AS f
    WHERE t.forum_id = f.forum_id
        
$sql_ignore_forums
        
$sql_only_forums 
        AND p.post_id = t.topic_first_post_id
        AND t.topic_moved_id = 0
    ORDER BY t.topic_last_post_id DESC LIMIT 
$cfg_nm_topics";

$result $db->sql_query($sql);

$recent_topics $db->sql_fetchrowset($result);

foreach ( 
$recent_topics as $row )
{
    
// Replies
    
$replies = ($auth->acl_get('m_approve'$row['forum_id']) ? $row['topic_replies_real'] : $row['topic_replies']);

    
$message $row['post_text'];
    
strip_bbcode($message);

    if (
utf8_strlen($message) >= $cfg_max_text_length)
    {
        
$message = (utf8_strlen($message) > $cfg_max_text_length 3) ? utf8_substr($message0$cfg_max_text_length) . '...' $message;
    }

    
$message censor_text($message);
    
$message smiley_text($message);
    
$message str_replace(array("rn""r""n"), '<br />'$message);
    
$message addslashes($message);

    
$template->assign_block_vars('topicrow', array(
        
'U_TOPIC'                => append_sid("{$phpbb_root_path}viewtopic.$phpEx"'f=' $row['forum_id'] . '&amp;t=' $row['topic_id']) . '#p' $row['post_id'],
        
'TOPIC_TITLE'             => $row['topic_title'],
        
'MESSAGE'                => $message,
        
'U_LAST_POST'                => append_sid("{$phpbb_root_path}viewtopic.$phpEx"'f=' $row['forum_id'] . '&amp;p=' $row['topic_last_post_id']) . '#p' $row['topic_last_post_id'],
        
'TOPIC_REPLIES'            => ($cfg_show_replies) ? ' [' $replies '] ' '',
    ));
}
$db->sql_freeresult($result);

$template->set_filenames(array(
    
'body' => 'recent_body.html')
);

$template->display('body');

?>
Онлайн: 2
Реклама