Файл: apwa/errors.php
Строк: 86
<?php
/* 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
/* 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);
// 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 = ($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($message, 0, $cfg_max_text_length) . '...' : $message;
}
$message = censor_text($message);
$message = str_replace(array("rn", "r", "n"), ' ', $message);
$message = addslashes($message);
$template->assign_block_vars('topicrow', array(
'U_TOPIC' => append_sid(generate_board_url() . "/viewtopic.$phpEx", 't=' . $row['topic_id']),
'TOPIC_TITLE' => $row['topic_title'],
'MESSAGE' => $message,
'U_LAST_POST' => append_sid(generate_board_url() . "/viewtopic.$phpEx", 'p=' . $row['topic_last_post_id']) . '#p' . $row['topic_last_post_id'],
'TOPIC_REPLIES' => $replies,
));
}
$db->sql_freeresult($result);
// BEGIN mChat Mod
$mchat_installed = (!empty($config['mchat_version']) && !empty($config['mchat_enable'])) ? true : false;
if ($mchat_installed && $auth->acl_get('u_mchat_view'))
{
if(!defined('MCHAT_INCLUDE'))
{
define('MCHAT_INCLUDE', true);
$mchat_include_index = true;
include($phpbb_root_path . 'mchat.' . $phpEx);
}
if (!function_exists('mchat_users'))
{
include($phpbb_root_path . 'includes/functions_mchat.' . $phpEx);
}
}
// END mChat Mod
page_header('Error 404, Not Found');
$template->set_filenames(array(
'body' => 'errors.html',
));
make_jumpbox(append_sid(generate_board_url() . "/viewforum.$phpEx"));
page_footer();
?>