Ошибка с rss лентой (db)

extazys

Пользователь
#1
Could not query list of active posts
SELECT STRAIGHT_JOIN f.forum_name,f1.forum_name AS parent_name, t.topic_id, t.topic_title, u.user_id,
u.username, u.user_sig, u.user_sig_bbcode_uid, p.post_time,p.post_username, p.post_edit_time,
pt.*, t.topic_replies, t.topic_first_post_id, ph.post_html
FROM bb_posts AS p, bb_posts_html AS ph, bb_topics AS t, bb_forums AS f LEFT JOIN bb_forums AS f1 ON f.forum_parent=f1.forum_id, bb_users AS u, bb_posts_text as pt
WHERE
p.post_time >1357233917


AND ph.post_id = p.post_id
AND pt.post_id = p.post_id
AND t.forum_id = f.forum_id
AND p.poster_id = u.user_id
AND p.topic_id = t.topic_id
AND p.post_id = t.topic_first_post_id


AND f.forum_id NOT IN (106,93,109,23,107,110,108,110,112,61,116,115,118,82,33,162,36,43,27,29)
ORDER BY p.post_time DESC LIMIT 25
получаю такую ошибку.
сам код
PHP:
<?php
 
define ('IN_PHPBB', true);
$phpbb_root_path = './';
 
$ProgName='RSS Feed 2.2.4';
$verinfo='V224';
//
// BEGIN Includes of phpBB scripts
//
 
function undo_htmlspecialchars($input)
{
        $input = preg_replace("/&gt;/i", ">", $input);
        $input = preg_replace("/&lt;/i", "<", $input);
        $input = preg_replace("/&quot;/i", "\"", $input);
        $input = preg_replace("/&amp;/i", "&", $input);
 
        return $input;
}
 
 
$phpEx = substr(strrchr(__FILE__, '.'), 1);
include($phpbb_root_path . 'common.php');
include($phpbb_root_path . 'includes/bbcode.php');
include($phpbb_root_path . 'includes/rss_config.php');
include($phpbb_root_path . 'includes/rss_functions.php');
if(!SMARTOR_STATS) {
        $mtime = microtime();
        $mtime = explode(" ",$mtime);
        $mtime = $mtime[1] + $mtime[0];
        $starttime = $mtime;
}
//
// END Includes of phpBB scripts
//
 
if(isset($HTTP_SERVER_VARS['HTTP_IF_MODIFIED_SINCE']))
{
    $deadline=strtotime($HTTP_SERVER_VARS['HTTP_IF_MODIFIED_SINCE']);
  if((time()-$deadline)<300)
  {
      header("HTTP/1.1 304 Not Modified");
      exit;
  }
  $sql= "SELECT MAX(post_time) as pt FROM ". BB_POSTS;
  if ( !($result = DB()->sql_query($sql)) )
      {
        message_die(GENERAL_ERROR, 'Error in obtaining post data', '', __LINE__, __FILE__, $sql);
      }
  if( $row = DB()->sql_fetchrow($result) )
    {
        if($row['pt']<=$deadline)
        {
          header("HTTP/1.1 304 Not Modified");
          exit;
        }
    }
}
 
//if(!defined('PAGE_RSS')) define('PAGE_RSS', PAGE_INDEX);
$deadline=0;
if(isset($HTTP_SERVER_VARS['HTTP_IF_MODIFIED_SINCE']))
{
        $deadline=strtotime($HTTP_SERVER_VARS['HTTP_IF_MODIFIED_SINCE']);
        if(CACHE_TIME>0) if((time()-$deadline)<CACHE_TIME)
        {
                ExitWithHeader("304 Not Modified");
        }
}
$sql= "SELECT MAX(post_time) as pt FROM ". BB_POSTS;
if ( !($result = DB()->sql_query($sql)) )
        {
                ExitWithHeader("500 Internal Server Error","Error in obtaining post data");
        }
if( $row = DB()->sql_fetchrow($result) )
{
        if($row['pt']<=$deadline) ExitWithHeader("304 Not Modified");
        $deadline=$row['pt'];
}
 
// BEGIN Cache Mod
$use_cached=false;
$cache_file ='';
if(CACHE_TO_FILE and CACHE_TIME>0) {
        $cache_file =$phpbb_root_path.$cache_root.$cache_filename;
        if($cache_root!='' and empty($HTTP_GET_VARS))
        {
                $cachefiletime=@filemtime($cache_file);
                $timedif = ($deadline - $cachefiletime);
                if ($timedif < CACHE_TIME and filesize($cache_file)>0) $use_cached=true;
        }
}
// END Cache Mod
//
// gzip_compression
//
$do_gzip_compress = FALSE;
$useragent = (isset($HTTP_SERVER_VARS['HTTP_USER_AGENT'])) ? $HTTP_SERVER_VARS['HTTP_USER_AGENT'] : getenv('HTTP_USER_AGENT');
if($use_cached && AUTOSTYLED and strpos($useragent,'MSIE'))$use_cached=false;
$bb_cfg['gzip_compress'] = false;//roman
if ( $bb_cfg['gzip_compress'] )
{
        $phpver = phpversion();
        if ( $phpver >= '4.0.4pl1' && ( strstr($useragent,'compatible') || strstr($useragent,'Gecko') ) )
        {
                if ( extension_loaded('zlib') )
                {
                        ob_start('ob_gzhandler');
                }
        }
        else if ( $phpver > '4.0' )
        {
                if ( strstr($HTTP_SERVER_VARS['HTTP_ACCEPT_ENCODING'], 'gzip') )
                {
                        if ( extension_loaded('zlib') )
                        {
                                $do_gzip_compress = TRUE;
                                ob_start();
                                ob_implicit_flush(0);
                                header('Content-Encoding: gzip');
                        }
                }
        }
}
// end gzip block
 
// How many posts do you want to returnd (count)?  Specified in the URL with "c=".  Defaults to 25, upper limit of 50.
$count = ( isset($HTTP_GET_VARS['c']) ) ? intval($HTTP_GET_VARS['c']) : DEFAULT_ITEMS;
$count = ( $count == 0 ) ? DEFAULT_ITEMS : $count;
$count = ( $count > MAX_ITEMS ) ? MAX_ITEMS : $count;
 
// Which forum do you want posts from (forum_id)?  specified in the url with "f=".  Defaults to all (public) forums.
$forum_id = $sql_filter = '';
if( isset($HTTP_GET_VARS['f']) ) {
  if (ctype_digit ($HTTP_GET_VARS['f']) )
    $forum_id = intval($HTTP_GET_VARS['f']);
  elseif (preg_match ("/^(\d+,)*\d+$/", $HTTP_GET_VARS['f']))
    $sql_filter .= ' AND f.forum_id IN('. $HTTP_GET_VARS['f'] .') ';
}
 
if (isset($HTTP_GET_VARS['u']) && preg_match ("/^(\d+,)*\d+$/", $HTTP_GET_VARS['u'])) {
  $sql_filter .= ' AND p.poster_id IN('. $HTTP_GET_VARS['u'] .') ';
}
 
$sql_limit = " LIMIT $count";
if (isset($HTTP_GET_VARS['h']) && ctype_digit($HTTP_GET_VARS['h']) &&
    $HTTP_GET_VARS['h'] > 0 && $HTTP_GET_VARS['h'] <= 48) {
  $sql_filter .= ' AND p.post_time >= unix_timestamp() - '. (3600 * $HTTP_GET_VARS['h']);
  $sql_limit = '';
}
 
$no_limit=1;
$no_forum= isset($HTTP_GET_VARS['nf']);
 
if( isset($HTTP_GET_VARS['nocache']) ) $use_cached = false;
 
$needlogin=( isset($HTTP_GET_VARS['login']) or isset($HTTP_GET_VARS['uid'])) ? true : false;
 
$sql_forum_where = ( !empty($forum_id) ) ? ' AND f.forum_id = ' . $forum_id : ' ';
 
// Return topics only, or all posts?  Specified in the URL with "t=".  Defaults to all posts (0).
$topics_only = 1;
 
$topics_view = (isset($HTTP_GET_VARS['topic']) && preg_match("/^(\d+,)*\d+$/", $HTTP_GET_VARS['topic'])) ? $HTTP_GET_VARS['topic'] : 0;
 
$sql_topics_only_where = '';
if ( $topics_only == 1 )
{
        $sql_topics_only_where = 'AND p.post_id = t.topic_first_post_id';
}
if($topics_view)
{
        $sql_topic_view = 'AND p.topic_id in('.$topics_view.')';
}
 
//
// BEGIN Session management
//
// Check user
$user_id=($needlogin)? rss_get_user() : ANONYMOUS;
$user->session_start();
$userdata = $user->data;
if($user_id==ANONYMOUS && AUTOLOGIN) {
        $user_id = $user->data['user_id'];
}
 
$username=$userdata["username"];
 
 
//
// END session management
//
 
// BEGIN Cache Mod
if($user_id==ANONYMOUS && $use_cached) {
        $MyETag='"RSS'.gmdate("YmdHis", $cachefiletime).$verinfo.'"';
        $MyGMTtime=gmdate("D, d M Y H:i:s", $cachefiletime)." GMT";
        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, max-age=0');
        }
        else
        {
                header ('Cache-Control: private, pre-check=0, post-check=0, max-age=0');
        }
        header("Last-Modified: ".$MyGMTtime);
        header("Etag: ".$MyETag);
        header("Expires: ".gmdate("D, d M Y H:i:s", time())." GMT");
        header ('Content-Type: text/xml; charset='.$lang['CONTENT_ENCODING']);
 
 
        readfile($cache_file);
        }
        else
{
// END Cache Mod
//-----------------------------------------------------
 
// Define censored word matches
$orig_word = array();
$replacement_word = array();
obtain_word_list($orig_word, $replacement_word);
//
// BEGIN Create main board information (some code borrowed from functions_post.php)
//
 
// Build URL components
$script_name = preg_replace('/^\/?(.*?)\/?$/', '\1', trim($bb_cfg['script_path']));
$viewpost = ( $script_name != '' ) ? $script_name . '/viewtopic.' . $phpEx : 'viewtopic.'. $phpEx;
$replypost = ( $script_name != '' ) ? $script_name . '/posting.' . $phpEx.'?mode=quote' : 'posting.'. $phpEx.'?mode=quote';
$index = ( $script_name != '' ) ? $script_name . '/index.' . $phpEx : 'index.'. $phpEx;
$server_name = trim($bb_cfg['server_name']);
$server_protocol = ( $bb_cfg['cookie_secure'] ) ? 'https://' : 'http://';
$server_port = ( $bb_cfg['server_port'] <> 80 ) ? ':' . trim($bb_cfg['server_port']) . '/' : '/';
// Assemble URL components
$index_url = $server_protocol . $server_name . $server_port . (( $script_name != '' )? $script_name . '/':'');
$viewpost_url = $server_protocol . $server_name . $server_port . $viewpost;
$replypost_url =$server_protocol . $server_name . $server_port . $replypost;
// Reformat site name and description
$site_name = strip_tags($bb_cfg['sitename']);
$site_description = strip_tags($bb_cfg['site_desc']);
// Set the fully qualified url to your smilies folder
$smilies_path = $bb_cfg['smilies_path'];
$smilies_url = $index_url . $smilies_path;
$smilies_path = preg_replace("/\//", "\/", $smilies_path);
//
// END Create main board information
//
 
// Auth check
$sql_forum_where="";
if($userdata['user_level']<>ADMIN)
{
        $is_auth = array();
        $is_auth = auth(AUTH_READ, AUTH_LIST_ALL, $userdata);
        if($forum_id=='') {
                while ( list($forumId, $auth_mode) = each($is_auth) )
                {
                        if ( !$auth_mode['auth_read'] )
                        {
                                $unauthed .= ',' . $forumId;
                        }
                }
        $sql_forum_where="AND f.forum_id NOT IN (" . $unauthed . ")";
        }
        else
        {
                if((!$is_auth[$forum_id]['auth_read']) or (strpos(",$unauthed," , ",$forum_id,")))
                {
                  if($needlogin) ExitWithHeader("404 Not Found","This forum does not exists");
                  else
                  {
                        header('Location: ' .$index_url.'rss.'.$phpEx.'?f='.$forum_id.(($no_limit)?'&nolimit':'').(isset($HTTP_GET_VARS['atom'])?'&atom':'').(isset($HTTP_GET_VARS['c'])?'&c='.$count:'').(isset($HTTP_GET_VARS['t'])?'&t='.$topics_only:'').(isset($HTTP_GET_VARS['styled'])?'&styled':'').'&login');
                        ExitWithHeader('301 Moved Permanently');
                  }
                }
                else $sql_forum_where = 'AND f.forum_id = ' . $forum_id;
        }
unset($is_auth);
}
elseif($forum_id!='')
{
        $sql_forum_where = 'AND f.forum_id = ' . $forum_id;
}
 
//
// BEGIN Initialise template
//
if(isset($HTTP_GET_VARS['atom']))
{
        $template->set_filenames(array("body" => "atom_body.tpl"));
        $verinfo.="A";
}
else
{
        $template->set_filenames(array("body" => "rss_body.tpl"));
        $verinfo.="R";
}
//
// END Initialise template
//
if(isset($HTTP_GET_VARS['styled']) or (AUTOSTYLED and strpos($useragent,'MSIE')))
{
        $template->assign_block_vars('switch_enable_xslt', array());
}
//
// BEGIN SQL statement to fetch active posts of allowed forums
//
$sql_limit_by_http='';
$MaxRecordAge=time()-MAX_WEEKS_AGO*604800;
$sql_limit_time=(MAX_WEEKS_AGO>0)?"p.post_time >".$MaxRecordAge:"1";
//roman
$NotErrorFlag='';
if (!$no_limit){
        if(isset($HTTP_SERVER_VARS['HTTP_IF_MODIFIED_SINCE'])) {
                $NotErrorFlag=true;
                $NotModifiedSince=strtotime($HTTP_SERVER_VARS['HTTP_IF_MODIFIED_SINCE']);
 
                if(SEE_MODIFYED) $sql_limit_by_http =  "AND (p.post_time > ".$NotModifiedSince." OR p.post_edit_time >".$NotModifiedSince." )";
                else if($NotModifiedSince>$MaxRecordAge) $sql_limit_time="p.post_time > ".$NotModifiedSince;
        }
}
$getdesc=($forum_id<>'')?'f.forum_desc,':'';
 
$hint = 'STRAIGHT_JOIN'; # $forum_id || $topics_view || $topics_only ? '' : ;
//roman
$sql_topic_view = '';
 
$sql = "SELECT $hint f.forum_name,f1.forum_name AS parent_name,".$getdesc." t.topic_id, t.topic_title, u.user_id,
    u.username, u.user_sig, u.user_sig_bbcode_uid, p.post_time,p.post_username, p.post_edit_time,
    pt.*, t.topic_replies, t.topic_first_post_id, ph.post_html
    FROM " . BB_POSTS . " AS p, bb_posts_html AS ph, " . BB_TOPICS . " AS t, "
. BB_FORUMS . " AS f LEFT JOIN " . BB_FORUMS . " AS f1 ON f.forum_parent=f1.forum_id, "
. BB_USERS . " AS u, " . BB_POSTS_TEXT . " as pt
    WHERE 
            $sql_limit_time
            $sql_forum_where
            $sql_limit_by_http
            AND ph.post_id = p.post_id
            AND pt.post_id = p.post_id
            AND t.forum_id = f.forum_id
            AND p.poster_id = u.user_id
            AND p.topic_id = t.topic_id
            $sql_topics_only_where
            $sql_topic_view
            $sql_filter
            AND f.forum_id NOT IN (106,93,109,23,107,110,108,110,112,61,116,115,118,82,33,162,36,43,27,29)
    ORDER BY p.post_time DESC $sql_limit";
$posts_query = DB()->sql_query($sql);
//
// END SQL statement to fetch active posts of public forums
//
 
//
// BEGIN Query failure check
//
if ( !$posts_query )
{
  ExitWithHeader("500 Internal Server Error","Could not query list of active posts\n$sql");
}
 
$allposts = DB()->sql_fetchrowset($posts_query);
if(($forum_id<>'')&&(count($allposts) != 0)) {
          $site_name=strip_tags($allposts[0]["forum_name"]);
          $site_description=$allposts[0]["forum_desc"];
          }
 
//
// BEGIN Assign static variables to template
//
// Variable reassignment for Topic Replies
$l_topic_replies = $lang['TOPIC'] . ' ' . $lang['REPLIES'];
$user_lang=$userdata['user_lang'];
if(empty($user_lang))$user_lang=$bb_cfg['default_lang'];
$template->assign_vars(array(
        'S_CONTENT_ENCODING' => $lang['CONTENT_ENCODING'],
'L_ENCODING' => $lang['CONTENT_ENCODING'],
        'BOARD_URL' => $index_url,
        'BOARD_TITLE' => htmlspecialchars(undo_htmlspecialchars($site_name)),
        'PROGRAM' => $ProgName,
        'BOARD_DESCRIPTION' => htmlspecialchars(undo_htmlspecialchars($site_description)),
        'BOARD_MANAGING_EDITOR' => $bb_cfg['board_email'],
        'BOARD_WEBMASTER' => $bb_cfg['board_email'],
        'BUILD_DATE' => gmdate('D, d M Y H:i:s').' GMT',
        'ATOM_BUILD_DATE'=>gmdate("Y-m-d\TH:i:s")."Z",
        'READER' => $username,
        'FN' => ! $no_forum,
        'L_AUTHOR' => $lang['AUTHOR'],
        'L_POSTED' => $lang['POSTED'],
        'L_TOPIC_REPLIES' => $l_topic_replies,
        'LANGUAGE'=>FormatLanguage($user_lang),
        'L_POST' => $lang['POST'])
);
//
// END Assign static variabless to template
//
$LastPostTime=0;
if ( count($allposts) == 0 )
{
        if($NotErrorFlag) ExitWithHeader("304 Not Modified");
}
else
{
//
// BEGIN "item" loop
//
 
        $PostCount=0;
        $SeenTopics=array();
        foreach ($allposts as $post)
        {
                if( $post['post_time']>$LastPostTime) $LastPostTime=$post['post_time'];
                if( $post['post_edit_time']>$LastPostTime) $LastPostTime=$post['post_edit_time'];
                $topic_id=$post['topic_id'];
                $PostCount++;
                if(!isset($SeenTopics[$topic_id])) $SeenTopics[$topic_id] = 0;
                $SeenTopics[$topic_id]++;
                // Variable reassignment and reformatting for post text
                $post_id=$post['post_id'];
//                $post_subject = ( $post['post_subject'] != '' ) ? $post['post_subject'] : '';
                $message = $post['post_text'];
                $message_html = $post['post_html'];
//                $user_sig = ( $post['enable_sig'] && $post['user_sig'] != '' && $bb_cfg['allow_sig'] ) ? $post['user_sig'] : '';
                //$user_sig_html = ( $post['enable_sig'] && $post['user_sig'] != '' && $bb_cfg['allow_sig'] ) ? $post['user_sig_html'] : '';
//                $user_sig_bbcode_uid = $post['user_sig_bbcode_uid'];
 
$reparse = ($message != '' && $message_html == '');// || ($user_sig != '');
if( $reparse ) {
 
        //
        // Parse message and/or sig for BBCode if reqd
        //
        if ( $bb_cfg['allow_bbcode'] )
        {
                if ( $user_sig != '' && $user_sig_bbcode_uid != '' )
                {
                        $user_sig = ( $bb_cfg['allow_bbcode'] ) ? bbencode_second_pass($user_sig, $user_sig_bbcode_uid) : preg_replace('/\:[0-9a-z\:]+\]/si', ']', $user_sig);
                }
 
                if ( $bbcode_uid != '' )
                {
                        $message = ( $bb_cfg['allow_bbcode'] ) ? bbencode_second_pass($message, $bbcode_uid) : preg_replace('/\:[0-9a-z\:]+\]/si', ']', $message);
                }
        }
 
        if ( $user_sig != '' )
        {
                $user_sig = make_clickable($user_sig);
        }
        $message = make_clickable($message);
 
        //
        // Parse smilies
        //
        if ( $bb_cfg['allow_smilies'] )
        {
                if ($bb_cfg['allow_smilies'] && $user_sig != '' )
                {
                        $user_sig = smilies_pass($user_sig);
                        $user_sig = preg_replace("/$smilies_path/", $smilies_url, $user_sig);
                }
 
                if ($bb_cfg['allow_smilies'] && $post['enable_smilies'] )
                {
                        $message = smilies_pass($message);
                        $message = preg_replace("/$smilies_path/", $smilies_url, $message);
                }
        }
        //
        // Replace naughty words
        //
/*        if (count($orig_word))
        {
                $post_subject = preg_replace($orig_word, $replacement_word, $post_subject);
 
                if ($user_sig != '')
                {
                        $user_sig = str_replace('\"', '"', substr(@preg_replace('#(\>(((?>([^><]+|(?R)))*)\<))#se', "@preg_replace(\$orig_word, \$replacement_word, '\\0')", '>' . $user_sig . '<'), 1, -1));
                }
 
          $message = str_replace('\"', '"', substr(@preg_replace('#(\>(((?>([^><]+|(?R)))*)\<))#se', "@preg_replace(\$orig_word, \$replacement_word, '\\0')", '>' . $message . '<'), 1, -1));
        }
*/        //
        // Replace newlines (we use this rather than nl2br because
        // till recently it wasn't XHTML compliant)
        //
        if ( $user_sig != '' )
        {
                $user_sig = '<br />_________________<br />' . str_replace("\n", "\n<br />\n", $user_sig);
        }
 
        $message = str_replace("\n", "\n<br />\n", $message);
 
} else {
 
        $message = $message_html;
        //$user_sig = $user_sig_html;
 
}
 
        $message = preg_replace( "[\s*</?textarea>\s*]", "", $message );
 
//                if ( $post_subject != '' )
//                {
//                        $post_subject = htmlspecialchars($lang['Subject'].': '.$post_subject.'<br />');
//                }
                // Variable reassignment for topic title, and show whether it is the start of topic, or a reply
                $topic_title = $post['topic_title'];
                if ( $post['post_id'] != $post['topic_first_post_id'] )
                {
                        $topic_title = 'RE: ' . $topic_title;
                }
                // Variable reassignment and reformatting for author
                $author = $post['username'];
                $author0 =$author;
                if ( $post['user_id'] != -1 )
                {
                        $author = '<a href="' . $index_url . 'profile.' . $phpEx . '?mode=viewprofile&u=' . $post['user_id'] . '" target="_blank">'
                        . $author . '</a>';
                }
                else
                {
                        // Uncomment next string if you want or $author0=='Anonymus'.
                        //  $author0= $post['post_username'];
                        $author= $post['post_username'];
                }
//                $author = make_clickable($author);
 
//roman
$patterns[0] = "#var[\s]class=\"postImg[\s]postImgAligned[\s][-a-z]{9}\"[\s]title=\"#";
$patterns[1] = "#<div[\s]style=\"display:[\s]none;\">[\D\d]*</div>#";
$patterns[2] = "#<div[\s]class=\"sp-wrap\">[\D\d]*</div><!--/spoiler-wrap-->#";
$patterns[3] = "#<hr[\s]*/>#";
$patterns[4] = "#<a[\s]class=\"zoom\"[\D\d]*>[\D\d]*</a>#";
 
$replacements[0] = "img align=\"right\" src=\"";
$replacements[1] = "";
$replacements[2] = "";
$replacements[3] = "</br>";
$replacements[4] = "";
 
$message = preg_replace($patterns, $replacements, $message);
//
                // Assign "item" variables to template
                $template->assign_block_vars('post_item', array(
                        'POST_URL' => $viewpost_url . '?' . POST_POST_URL . '=' . $post['post_id'] . '#' . $post['post_id'],
                        'FIRST_POST_URL' => $viewpost_url . '?' . POST_POST_URL . '=' . $post['topic_first_post_id'] . '#' . $post['topic_first_post_id'],
                        'REPLY_URL'=>$replypost_url."&amp;".POST_POST_URL."=".$post['post_id'],
                        'TOPIC_TITLE' =>htmlspecialchars(undo_htmlspecialchars($topic_title)),
                        'AUTHOR0' => htmlspecialchars($author0),
                        'AUTHOR' => htmlspecialchars($author),
                        'POST_TIME' => bb_date($post['post_time'], $bb_cfg['post_date_format']),
                        'ATOM_TIME'=>gmdate("Y-m-d\TH:i:s", $post['post_time'])."Z",
                        'ATOM_TIME_M'=>($post['post_edit_time']<>"" ? gmdate("Y-m-d\TH:i:s", $post['post_edit_time'])."Z": gmdate("Y-m-d\TH:i:s", $post['post_time'])."Z"),
//                        'POST_SUBJECT' => $post_subject,
                        'FORUM_NAME' => htmlspecialchars($post['forum_name']),
                        'HAVE_PARENT' => $post['parent_name'] ? TRUE : FALSE,
                        'PARENT_NAME' => htmlspecialchars($post['parent_name']),
                        'UTF_TIME'=>RSSTimeFormat($post['post_time'],$userdata['user_timezone']),
                        'POST_TEXT' => htmlspecialchars(preg_replace('|[\x00-\x08\x0B\x0C\x0E-\x1f]|','',$message)),
//                        'USER_SIG' => htmlspecialchars($user_sig),
                        'TOPIC_REPLIES' => $post['topic_replies']
                        )
                );
        }
//
// END "item" loop
//
 
if($user_id!=ANONYMOUS && UPDATE_VIEW_COUNT)
{
 
        $updlist='';
        foreach ($SeenTopics as $topic_id=>$tcount)
        {
                $updlist.=(empty($updlist))? $topic_id : ",".$topic_id;
                if(defined('TOPIC_VIEW_TABLE') and AUTO_WVT_MOD)
                {
                        $sql='UPDATE '.BB_TOPIC_VIEW.' SET topic_id="'.$topic_id.'", view_time="'.time().'", view_count=view_count+1 WHERE topic_id='.$topic_id.' AND user_id='.$user_id;
                        if ( !DB()->sql_query($sql) || !DB()->sql_affectedrows() )
                        {
                                $sql = 'INSERT IGNORE INTO '.BB_TOPIC_VIEW.' (topic_id, user_id, view_time,view_count)
                                VALUES ('.$topic_id.', "'.$user_id.'", "'.time().'","1")';
                                if ( !(DB()->sql_query($sql)) )
                                {
                                        ExitWithHeader("500 Internal Server Error",'Error create user view topic information');
                                }
                        }
                }
                // End add - Who viewed a topic MOD
        }
        if($updlist!='')
        {
                //
                // Update the topic view counter
                //
                $sql = "UPDATE " . BB_TOPICS . "
                SET topic_views = topic_views + 1
                WHERE topic_id IN ($updlist)";
                if ( !DB()->sql_query($sql) )
                {
                        ExitWithHeader("500 Internal Server Error","Could not update topic views");
                }
        }
}
                // LAstvisit MOD
                if(LV_MOD_INSTALLED and $user_id!=ANONYMOUS){
                $sql = "UPDATE " . BB_USERS . "
                  SET user_totalpages=user_totalpages+$PostCount
                  WHERE user_id = $user_id";
                  if ( !DB()->sql_query($sql) )
                {
                        ExitWithHeader("500 Internal Server Error",'Error updating user totalpages ');
                }}
}
// Check for E-Tag
if($LastPostTime==0) $LastPostTime=$deadline;
$MyETag='"RSS'.gmdate("YmdHis", $LastPostTime).$verinfo.'"';
$MyGMTtime=gmdate("D, d M Y H:i:s", $LastPostTime)." GMT";
if(isset($HTTP_SERVER_VARS['HTTP_IF_NONE_MATCH'])&& ($HTTP_SERVER_VARS['HTTP_IF_NONE_MATCH']== $MyETag)) ExitWithHeader("304 Not Modified");
if(isset($HTTP_SERVER_VARS['HTTP_IF_MODIFIED_SINCE']) && ($HTTP_SERVER_VARS['HTTP_IF_MODIFIED_SINCE'] == $MyGMTtime)) ExitWithHeader("304 Not Modified");
 
//
// BEGIN XML and nocaching headers (copied from page_header.php)
//
 
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, max-age=0');
}
else
{
        header ('Cache-Control: private, pre-check=0, post-check=0, max-age=0');
}
header("Last-Modified: ".$MyGMTtime);
header("Etag: ".$MyETag);
header("Expires: ".gmdate("D, d M Y H:i:s", time())." GMT");
header ('Content-Type: text/xml; charset='.$lang['CONTENT_ENCODING']);
//
// End XML and nocaching headers
//
 
//
// BEGIN Output XML page
//
// BEGIN Cache Mod
if(($user_id==ANONYMOUS) and CACHE_TO_FILE and ($cache_root!='') and empty($HTTP_GET_VARS) and !isset($HTTP_SERVER_VARS['HTTP_IF_MODIFIED_SINCE']) and !(AUTOSTYLED and strpos($useragent,'MSIE')))
{
        ob_start();
        $template->pparse('body');
        $out=ob_get_contents();
        ob_end_flush();
        if ($f = @fopen($cache_file, 'w')) {
                fwrite ($f, $out,strlen($out));
                fclose($f);
                }
}
else {
        $template->pparse('body');
        }
}// END Cache Mod
// And remove temporary session from database
//if(defined(TEMP_SESSION)) rss_session_end;
 
 
$gzip_text = ($bb_cfg['gzip_compress']) ? 'GZIP enabled' : 'GZIP disabled';
$mtime = microtime();
$mtime = explode(" ",$mtime);
$mtime = $mtime[1] + $mtime[0];
$endtime = $mtime;
$gentime = round(($endtime - $starttime), 4);
if($show_time) {
        echo '<!-- Page generation time: '.$gentime .'s ';
        if(SMARTOR_STATS) {
                $sql_time = round(DB()->sql_time, 4);
                $sql_part = round($sql_time / $gentime * 100);
                $excuted_queries = DB()->num_queries;
                $php_part = 100 - $sql_part;
                echo '(PHP: '. $php_part .'% - SQL: '. $sql_part .'%) - SQL queries: '. $excuted_queries;
        }
        if (function_exists('memory_get_usage') && ($mem = @memory_get_usage())) echo ' - Memory Usage: '.(number_format(($mem/(1024*1024)),3)).' Mb ';
        echo  ' - '. $gzip_text.' -->';
}
//
// END Output XML page
//
DB()->close();
 
//
// Compress buffered output if required and send to browser
//
if ( $do_gzip_compress )
{
        //
        // Borrowed from php.net!
        //
        $gzip_contents = ob_get_contents();
        ob_end_clean();
 
        $gzip_size = strlen($gzip_contents);
        $gzip_crc = crc32($gzip_contents);
 
        $gzip_contents = gzcompress($gzip_contents, 9);
        $gzip_contents = substr($gzip_contents, 0, strlen($gzip_contents) - 4);
 
        echo "\x1f\x8b\x08\x00\x00\x00\x00\x00";
        echo $gzip_contents;
        echo pack('V', $gzip_crc);
        echo pack('V', $gzip_size);
}
 
$bb_cfg['gzip_compress'] = true; //roman
exit;
?>
помогите пофиксить
 
Сверху