|
|
Joined: Jun 2006
Posts: 693
Addict
|
|
Addict
Joined: Jun 2006
Posts: 693 |
I tried to create a multiple-forum RSS feed by clicking on one of my categories - the Auto category. I set the cache time to 90 minutes, chose recent posts, 0 body and 3 posts. I got the error
Fatal error: Call to a member function convert_time() on a non-object in E:\forums\libs\ubbthreads.inc.php on line 2818
|
|
|
|
|
Joined: Jun 2006
Posts: 9,242 Likes: 1
Former Developer
|
|
Former Developer
Joined: Jun 2006
Posts: 9,242 Likes: 1 |
Hmm, is your libs/ubbthreads.inc.php file modified at all? Can you take a look at that file at line 2704, and make sure it looks like this:
function generate_rss_feeds($clear='') {
global $config,$ubbt_lang,$dbh,$html,$smarty;
if (!is_object($html)) {
$html = new html;
} // end if
|
|
|
|
|
Joined: Jun 2006
Posts: 693
Addict
|
|
Addict
Joined: Jun 2006
Posts: 693 |
When I hit BACK and tried creating one that was not active, just to test that out, I get the error - insert into ubbt7_RSS_FEEDS (FEED_IS_ACTIVE,FEED_NAME,FEED_CACHE_TIME,FEED_TYPE,FEED_INCLUDE_BODY,FEED_ITEMS,FEED_FORUM_ARRAY,FEED_IS_MULTI) values ( '' , 'Auto Discussions' , '5400' , 'posts' , '0' , '3' , 'a:5:{i:0;s:3:\"364\";i:1;s:1:\"6\";i:2;s:3:\"112\";i:3;s:3:\"379\";i:4;s:3:\"374\";}' , 1 )
Incorrect integer value: '' for column 'FEED_IS_ACTIVE' at row 1
Last edited by Gizmo; 09/17/2007 6:44 PM.
|
|
|
|
|
Joined: Jun 2006
Posts: 693
Addict
|
|
Addict
Joined: Jun 2006
Posts: 693 |
That is the function I added an extra write out to - because I need those JavaScript outputs, I can't use the XML outputs you all converted to a little while back. But my changes are labelled in here - and the function doesn't start the way you have yours. Here is my entire function, which starts on line 2703: ------------- function generate_rss_feeds($clear='') {
global $config, $ubbt_lang, $dbh, $html, $smarty;
$now = time();
$clear_clause = "";
if ($clear) $clear_clause = "or 1";
// Lock everything that needs to be rebuilt
$query = "
update {$config['TABLE_PREFIX']}RSS_FEEDS
set FEED_LOCK = '$now'
where FEED_IS_ACTIVE = 1 AND
(($now - FEED_LAST_BUILD > FEED_CACHE_TIME) AND
(FEED_LOCK = '0' OR (FEED_LOCK > 0 AND ($now - FEED_LOCK > 120)))
$clear_clause)
";
$dbh->do_query($query,__LINE__,__FILE__);
// Grab the feeds that need to be rebuilt
// anything with a lock time of now or that has been locked for over
// 2 minutes
$query = "
select FEED_ID,FEED_FORUM,FEED_FORUM_ARRAY,FEED_NAME,FEED_TYPE,FEED_INCLUDE_BODY,FEED_ITEMS,FEED_LAST_BUILD,FEED_IS_MULTI
from {$config['TABLE_PREFIX']}RSS_FEEDS
where FEED_IS_ACTIVE = 1
and (($now - FEED_LAST_BUILD > FEED_CACHE_TIME
and (FEED_LOCK = '$now' or (FEED_LOCK > 0 and ($now - FEED_LOCK > 120))))
$clear_clause)
order by FEED_ID
";
$sth_islands = $dbh->do_query($query,__LINE__,__FILE__);
while(list($feed_id,$feed_forum,$forum_array,$feed_name,$feed_type,$feed_include_body,$feed_items,$feed_last_build,$multi) = $dbh->fetch_array($sth_islands)) {
// Querying 1 or multiple forums?
$feed_xml_file = "rss$feed_forum.xml";
// LISA ADDITION - WANT TO SAVE OUT AS A TABLE
$lisa_ci_file = "ci$feed_forum.js";
$clause = "";
$t1clause = "";
if ($multi) {
$feed_xml_file = "global_rss$feed_id.xml";
$sources = unserialize($forum_array);
$inlist = "";
foreach($sources as $k => $v) {
if ($v == "allforums") {
$inlist = "";
continue;
} else {
$inlist .= "'$v',";
} // end if
}
if ($inlist) {
$inlist = preg_replace("/,$/","",$inlist);
$t1clause = "AND t1.FORUM_ID in ($inlist)";
}
} else {
$t1clause = "AND t1.FORUM_ID = '$feed_forum'";
} // end if
// Topics or Posts?
if ($feed_type == "topics") {
$order = "TOPIC_CREATED_TIME desc";
} else {
$order = "TOPIC_LAST_REPLY_TIME desc";
} // end if
if (!$feed_include_body) {
$query = "
select t1.TOPIC_ID,t1.POST_ID,t1.TOPIC_SUBJECT,t1.TOPIC_CREATED_TIME,t1.TOPIC_LAST_REPLY_TIME,t1.TOPIC_LAST_POST_ID,t1.TOPIC_LAST_POSTER_ID,t1.TOPIC_LAST_POSTER_NAME,t2.USER_DISPLAY_NAME
from {$config['TABLE_PREFIX']}TOPICS as t1,
{$config['TABLE_PREFIX']}USERS as t2
where t1.TOPIC_IS_APPROVED = '1'
and t1.USER_ID = t2.USER_ID
$t1clause
ORDER BY t1.$order
limit $feed_items
";
} else {
$query = "
select t1.TOPIC_ID,t1.POST_ID,t1.TOPIC_SUBJECT,t1.TOPIC_CREATED_TIME,t1.TOPIC_LAST_REPLY_TIME,t1.TOPIC_LAST_POST_ID,t1.TOPIC_LAST_POSTER_ID,t1.TOPIC_LAST_POSTER_NAME,t2.POST_DEFAULT_BODY,t3.USER_DISPLAY_NAME
from {$config['TABLE_PREFIX']}TOPICS as t1,
{$config['TABLE_PREFIX']}POSTS as t2,
{$config['TABLE_PREFIX']}USERS as t3
where t1.TOPIC_LAST_POST_ID = t2.POST_ID
and t2.USER_ID = t3.USER_ID
$t1clause
and t2.POST_IS_APPROVED = '1'
ORDER BY t1.$order
limit $feed_items
";
}
$sth = $dbh->do_query($query,__LINE__,__FILE__);
$items = array();
$latest = 0;
while($posts = $dbh->fetch_array($sth)) {
if ($posts['TOPIC_LAST_REPLY_TIME'] > $latest) {
$latest = $posts['TOPIC_LAST_REPLY_TIME'];
}
$posts['TOPIC_SUBJECT'] = htmlspecialchars($posts['TOPIC_SUBJECT']);
if (isset($posts['POST_DEFAULT_BODY'])) {
$posts['POST_DEFAULT_BODY'] = htmlspecialchars(substr(strip_tags($posts['POST_DEFAULT_BODY']),0,$feed_include_body));
if ($feed_type == "posts") {
$posts['TOPIC_SUBJECT'] = "Re: {$posts['TOPIC_SUBJECT']}";
} // end if
} // end if
if ($feed_type == "topics") {
$posts['TOPIC_LAST_REPLY_TIME'] = $posts['TOPIC_CREATED_TIME'];
$posts['TOPIC_LAST_POSTER_NAME'] = $posts['USER_DISPLAY_NAME'];
$posts['TOPIC_LAST_POST_ID'] = $posts['POST_ID'];
} // end if
$posts['TOPIC_LAST_REPLY_TIME'] = $html->convert_time($posts['TOPIC_LAST_REPLY_TIME'],0,"rss",1,0);
$items[] = $posts;
} // end while
if ($latest <= ($feed_last_build + ($config['SERVER_TIME_OFFSET'] * 3600)) && !$clear) {
continue;
} // end if
$smarty->assign_by_ref("items",$items);
$smarty->assign("generated_on",$html->convert_time($now,0,"rss",1,0));
$smarty->assign("feed_name",htmlspecialchars($feed_name));
$rss_data = $smarty->fetch("rss_xml.tpl");
//LISA ADDITION - GET MY CUSTOM TEMPLATE
$lisa_data = $smarty->fetch("lisa_contisl.tpl");
lock_and_write("{$config['FULL_PATH']}/cache/$feed_xml_file",$rss_data);
//LISA ADDITION - WRITE OUT CONTENT ISLAND FILE
lock_and_write("{$config['FULL_PATH']}/cache/$lisa_ci_file",$lisa_data);
} // end while
// Unlock everything
$query = "
update {$config['TABLE_PREFIX']}RSS_FEEDS
set FEED_LAST_BUILD = '$now',
FEED_LOCK = '0'
where FEED_IS_ACTIVE = '1'
and (FEED_LOCK = '$now' or (FEED_LOCK > 0 and ($now - FEED_LOCK > 120)))
$clear_clause
";
$dbh->do_query($query,__LINE__,__FILE__);
} // end function generate_rss_feeds
Last edited by Gizmo; 09/17/2007 6:44 PM.
|
|
|
|
|
Joined: Jun 2006
Posts: 9,242 Likes: 1
Former Developer
|
|
Former Developer
Joined: Jun 2006
Posts: 9,242 Likes: 1 |
Ok, you're missing this little bit right after the "global" line towards the top:
if (!is_object($html)) { $html = new html; } // end if
|
|
|
|
|
Joined: Jun 2006
Posts: 693
Addict
|
|
Addict
Joined: Jun 2006
Posts: 693 |
That is really, really odd - I have a very short list of changes I made after each upgrade, just to make sure we keep our content islands and that users cannot make edits silently. Both are necessary for how we run our forums. There's no reason that other lines of code should go missing!! I don't go anywhere near that top section. I don't remember now if I had any upgrade issues with that latest version - I'm doing so much server work that they're running together. I'll try to keep better notes next time ... In any case, thanks for the fast response, and now I have three feeds for one channel  When I try to deactivate one, I get the same error as above - update ubbt7_RSS_FEEDS set FEED_IS_ACTIVE = '' , FEED_NAME = 'Auto Channel Messages' , FEED_CACHE_TIME = '5400' , FEED_TYPE = 'posts' , FEED_INCLUDE_BODY = '0' , FEED_ITEMS = '3' , FEED_FORUM_ARRAY = 'N;' where FEED_ID = '407' Incorrect integer value: '' for column 'FEED_IS_ACTIVE' at row 1 and is there not a delete option?
|
|
|
|
|
Joined: Jun 2006
Posts: 693
Addict
|
|
Addict
Joined: Jun 2006
Posts: 693 |
LOL shoot I'm foiled. My code isn't creating a JS file for these multi-forum entries. I'm only getting XML files. Does anybody have a suggestion for easily (i.e. quick processing time for the end user) having these XML files show up in my website, like here - http://www.bellaonline.com/site/lowcarbMy aim is to have the channel's worth of latest messages show up on the channel level page - http://www.bellaonline.com/Channel/c7.aspSo my options are to figure out how to get XML to work rather than fighting with these manual JavaScript code changes - or to have to do more work each upgrade, to add code so that multi-forum feeds work in addition to single-forum feeds. My website gets over 20 million pageviews a month, so I need each page draw to be really quick; I don't want it bogged down trying to translate things.
|
|
|
|
|
Joined: Jun 2006
Posts: 9,242 Likes: 1
Former Developer
|
|
Former Developer
Joined: Jun 2006
Posts: 9,242 Likes: 1 |
Ah, looks like another problem with MySQL running set in strict mode.
What you can do is run the following SQL command to disable strict mode, and then I'll need to fix that in the base code:
SET GLOBAL SQL_MODE=''
As for deleting. For multiple rss feeds, you can disable them (once you run that query) and then delete the .xml file from the cache directory. I'll need to alter the code to delete the .xml file when a feed is disabled.
|
|
|
|
|
Joined: Jun 2006
Posts: 693
Addict
|
|
Addict
Joined: Jun 2006
Posts: 693 |
OK it does work to deactivate a forum once I ran that command. However, I have to go into the 'edit' page to do it. If I'm looking at the main list of all my multi-forums, unclick the box there and click 'update RSS feeds', it says the settings have been updated, then it brings me back to the Single RSS feed page (not the multi-RSS feed page). When I click the Multi tab, it shows the entry still active. It would be nice long term if I didn't have these extra feeds showing up on my list for the rest of my life, because of one mistake I made early on  I suppose since I've only made 3 out of the 19 feeds I need so far, I can just re-use them though! I did add the code to make the multi-feeds generate JS files, so I guess that's how I'll handle this for now, until you guys bring back the JS creation feature of the software 
|
|
|
|
|
Joined: Jun 2006
Posts: 693
Addict
|
|
Addict
Joined: Jun 2006
Posts: 693 |
While we're at it, the list for the multi-forum page seems to sort randomly. It's not in alphabetical order, nor is it in numerical order. I would guess it probably should be in alphabetical order.
|
|
|
|
0 members (),
381
guests, and
101
robots. |
|
Key:
Admin,
Global Mod,
Mod
|
|
|
|