Профессор писал(а):Выложите здесь на форуме текст recent.php в том виде, как он у Вас есть. Тогда и скажем, где неполадка.
у меня вот такой:
Код: Выделить всё
<?php
/***************************************************************************
* recent.php
* -------------------
* begin : Saturday, Mar 05, 2005
* copyright : (C) 2005 Xpert
* email : xpert@phpbbguru.net
*
* $Id: recent.php,v 1.0.4 2005/08/03 20:54:00 xpert Exp $
*
*
***************************************************************************/
/***************************************************************************
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
***************************************************************************/
/* Config section */
$cfg_ignore_forums = '0'; // ids of forums you don't want to display, separated by commas
$cfg_nm_topics = 15; // number of topics to output
$cfg_max_topic_length = 30; // max topic length, if more, title will be shortened
/* End of config */
define('IN_PHPBB', true);
$phpbb_root_path = './';
include($phpbb_root_path . 'extension.inc');
include($phpbb_root_path . 'common.'.$phpEx);
//
// Let's prevent caching
//
if (!empty($HTTP_SERVER_VARS['SERVER_SOFTWARE']) && strstr($HTTP_SERVER_VARS['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 ('Expires: 0');
header ('Pragma: no-cache');
//
// Define censored word matches
//
$orig_word = array();
$replacement_word = array();
obtain_word_list($orig_word, $replacement_word);
//
// Building URL
//
$server_protocol = ($board_config['cookie_secure']) ? 'https://' : 'http://';
$server_name = preg_replace('#^\/?(.*?)\/?$#', '\1', trim($board_config['server_name']));
$server_port = ($board_config['server_port'] <> 80) ? ':' . trim($board_config['server_port']) : '';
$script_name = preg_replace('#^\/?(.*?)\/?$#', '\1', trim($board_config['script_path']));
$script_name = ($script_name == '') ? $script_name : '/' . $script_name;
$board_path = $server_protocol . $server_name . $server_port . $script_name;
$viewtopic_url = $board_path . '/viewtopic.' . $phpEx;
//
// Session management
// I don't want to log user in, so let's trick
//
$sql = "SELECT * FROM " . USERS_TABLE . " WHERE user_id = ". ANONYMOUS;
if ( !($result = $db->sql_query($sql)) )
{
message_die(CRITICAL_ERROR, 'Could not obtain anonymous data from user table', '', __LINE__, __FILE__, $sql);
}
$userdata = $db->sql_fetchrow($result);
init_userprefs($userdata);
//
// Load template
//
$template->set_filenames(array(
'body' => 'recent_body.tpl')
);
// Fetching topics of public forums
$sql = "SELECT t.topic_id, t.topic_title, t.topic_last_post_id
FROM " . TOPICS_TABLE . " AS t, " . POSTS_TABLE . " AS p, " . FORUMS_TABLE . " AS f
WHERE t.forum_id = f.forum_id
AND f.auth_read = " . AUTH_ALL . "
AND t.forum_id NOT IN(" . $cfg_ignore_forums .")
AND p.post_id = t.topic_last_post_id
AND t.topic_moved_id = 0
ORDER BY p.post_id DESC LIMIT $cfg_nm_topics";
if ( !$result = $db->sql_query($sql) )
{
message_die(GENERAL_ERROR, "Could not fetch recent topics information.", '', __LINE__, __FILE__, $sql);
}
while ( $row = $db->sql_fetchrow($result) )
{
$topic_title = $row['topic_title'];
if ( count($orig_word) )
{
$topic_title = preg_replace($orig_word, $replacement_word, $topic_title);
}
$topic_title = ( strlen($topic_title) > $cfg_max_topic_length ) ? substr($topic_title, 0, $cfg_max_topic_length) . '…' : $topic_title;
$template->assign_block_vars('topicrow', array(
'U_TOPIC' => $viewtopic_url . '?' . POST_TOPIC_URL . '=' . $row['topic_id'],
'TOPIC_TITLE' => str_replace("'", "\'", $topic_title)
));
}
//
// Output
//
$template->pparse('body');
?>
