Page 41 of 55

Re: [RC6] Smartfeed for phpBB 3

Posted: Wed Aug 13, 2008 1:42 pm
by MarkDHamill
Wolfgang, until I go back and revisit that code I cannot really say why the behavior you experienced occurred. I am on vacation at the moment so it will be some time before I see whether I can rework that section of the code.

I have never heard of the Epiphany browser, but the warning doesn't matter. XML does not have to have a stylesheet attached to it to render. The whole point of RSS and Atom is to make the feed content independent of the rendering mechanism (the reader) so no style information will be in it. As a convenience smartfeed_url.php lets you look at the feed in the browser. Most people will use an agent, either browser based or standalone, to read the feed.

Re: [RC6] Smartfeed for phpBB 3

Posted: Wed Aug 13, 2008 1:51 pm
by IPB_Refugee
Hi Mark,

thanks for your answer! Good news: The page surely looks good enough now that my users will be able to use your MOD when I upgrade my board to Olympus next weekend.

Epiphany? That's one of the browsers for Linux. It is based on Mozilla's Gecko engine, too. You don't have to know this browser, but it is convient for me to test my board with two different accounts simultaneously. :)

But the most important thing: Enjoy your vacation! :)

Regards
Wolfgang

Re: [RC6] Smartfeed for phpBB 3

Posted: Wed Aug 13, 2008 2:25 pm
by jobla
MarkDHamill wrote:This mod was never designed with Joomla integration in mind so I am afraid you will have to figure out this one.
I understand that the error has nothing to do with smartfeed istself, what i wonder is if it is possible to somehow supress any error messages of this type in the rss feed since it messes it up and the result is that it wont work even though the code within rss tags are fine.

Re: [RC6] Smartfeed for phpBB 3

Posted: Wed Aug 13, 2008 11:23 pm
by MarkDHamill
The feedcreator.class.php program assumes that it can write headers, so it would have to be hacked somehow NOT to send out header information for this error message to go away. Since I did not write the class but only use it, you will have to examine it and figure it out.

I really suspect in this case that it is Joomla should be hacked to not send out header information if smartfeed.php is being executed. The clue where to put the hack should be in the error message:

joomla/session/session.php</b> on line <b>407</b>

Your choice which one you want to try. If you figure it out, publish the hack here. Others may be interested.

Re: [RC6] Smartfeed for phpBB 3

Posted: Thu Aug 14, 2008 5:02 am
by nano351
This looks great. Can't wait for it to be released :)

Re: [RC6] Smartfeed for phpBB 3

Posted: Fri Aug 15, 2008 3:25 am
by MarkDHamill
Wolfgang, I looked at the multiple query issue. It looks like it should be a pretty simple fix. Near the top of the program, do one SQL call to return the parent_id of each forum and place it into an associative array where forum_id is they key and parent_id is the value. Then in the loop replace the SQL with the value of the array key corresponding to the forum_id.

Re: [RC6] Smartfeed for phpBB 3

Posted: Fri Aug 15, 2008 10:34 am
by IPB_Refugee
Thank you, Mark!

I will try it after upgrading my main board to Olympus. If I find a code which works (I'm still learning), I will post the solution here.

Regards
Wolfgang

Re: [RC6] Smartfeed for phpBB 3

Posted: Fri Aug 15, 2008 4:08 pm
by jobla
Regarding the error messages that were produced is our installation is solved. My fellow webmaster that is a programmer and know this better than I do added the line

error_reporting(0);

to smarfeed.php

So now we can use the rss feed.

Re: [RC6] Smartfeed for phpBB 3

Posted: Sat Aug 16, 2008 3:55 am
by MarkDHamill
That's a quick and elegant solution. I cannot use it generically (and I indeed did do this once) because some want to see all error notices.

Re: [RC6] Smartfeed for phpBB 3

Posted: Sat Aug 16, 2008 4:17 am
by IPB_Refugee
Suppressing error messages or debug notices cannot be an accepted solution. Quick yes, elegant surely not. ;)

Come on, guys!
Wolfgang

Re: [RC6] Smartfeed for phpBB 3

Posted: Tue Aug 19, 2008 5:05 pm
by MarkDHamill
IPB_Refugee wrote:Thank you, Mark!

I will try it after upgrading my main board to Olympus. If I find a code which works (I'm still learning), I will post the solution here.

Regards
Wolfgang
Wolfgang, this code seems to resolve the multiple query issue in smartfeed_url.php (Version 2.2.3):

Replace:

Code: Select all

foreach ($forum_read_ary as $forum_id => $allowed)
{
		
	if ($allowed['f_read'])
	{
		// Since this user has read access to this forum, add it to the $allowed_forums array
		$allowed_forums[] = (int) $forum_id;
		
		// Also add to $allowed_forums the parents, if any, of this forum. Actually we have to find the parent's parents, etc., going up as far as necesary because 
		// $auth->act_getf does not return the parents for which the user has access, yet parents must be shown are on the interface
		$there_are_parents = true;
		$this_forum_id = (int) $forum_id;
		
		while ($there_are_parents)
		{
			$sql = 'SELECT parent_id 
					FROM ' . FORUMS_TABLE . "
					WHERE forum_id = $this_forum_id";
			$result = $db->sql_query($sql);
			$row = $db->sql_fetchrow($result);
			if ((int) $row['parent_id'] == 0)
			{
				$there_are_parents = false;
			}
			else
			{
				// Do not add this parent to the list of allowed forums if it is already in the array
				if (!in_array((int) $row['parent_id'], $allowed_forums))
				{
					$allowed_forums[] = (int) $row['parent_id'];
				} 
				$this_forum_id = (int) $row['parent_id'];	// Keep looping...
			}
		}
	}
}
with:

Code: Select all

// Get a list of parent_ids for each forum and put them in an array.
$parent_array = array();
$sql = 'SELECT forum_id, parent_id 
	FROM ' . FORUMS_TABLE . '
	ORDER BY 1';
$result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result))
{
	$parent_array[$row['forum_id']] = $row['parent_id'];
}

foreach ($forum_read_ary as $forum_id => $allowed)
{
		
	if ($allowed['f_read'])
	{
		// Since this user has read access to this forum, add it to the $allowed_forums array
		$allowed_forums[] = (int) $forum_id;
		
		// Also add to $allowed_forums the parents, if any, of this forum. Actually we have to find the parent's parents, etc., going up as far as necesary because 
		// $auth->act_getf does not return the parents for which the user has access, yet parents must be shown are on the interface
		$there_are_parents = true;
		$this_forum_id = (int) $forum_id;
		
		while ($there_are_parents)
		{
			if ($parent_array[$this_forum_id] == 0)
			{
				$there_are_parents = false;
			}
			else
			{
				// Do not add this parent to the list of allowed forums if it is already in the array
				if (!in_array((int) $parent_array[$this_forum_id], $allowed_forums))
				{
					$allowed_forums[] = (int) $parent_array[$this_forum_id];
				} 
				$this_forum_id = (int) $parent_array[$this_forum_id];	// Keep looping...
			}
		}
	}
}
Let me know if this works.

Re: [RC6] Smartfeed for phpBB 3

Posted: Thu Aug 21, 2008 11:11 am
by IPB_Refugee
Hi Mark,

thanks a lot - this part works perfectly now! :)

But I found another problem:

I have a limit of 7 days - no older posts should be displayed. But with my testuser, I selected just three forums to be displayed and "no limit" for the timeframe. Then I clicked on "Test" and the preview of the feed shows now also posts that had been written a month ago.
And the preview for my testuser shows always only the first post in a topic - not the latest one, although I chose to see all posts. Oops sorry, that is not correct. I think the post shown in the preview is chosen randomly. For example I see here a post written on 16.07.2008 which is the 4. post in the topic. (The topic has 8 posts up to now, the latest has been posted on 25.07.2008.)

Regards
Wolfgang

Re: [RC6] Smartfeed for phpBB 3

Posted: Thu Aug 21, 2008 12:28 pm
by MarkDHamill
Wolfgang, thanks for reporting the bug.

Line 390 needs to have time() in it and the bug will disappear.

Code: Select all

			case SMARTFEED_NO_LIMIT_VALUE:
				$date_limit = time() - ($config['sf_default_fetch_time_limit'] * 3600);

Re: [RC6] Smartfeed for phpBB 3

Posted: Thu Aug 21, 2008 4:54 pm
by IPB_Refugee
Simply great, Mark! Smartfeed is surely the best newsfeed MOD available for phpBB-3. :D I hope the MOD team will validate the latest version soon.

Regards
Wolfgang

Re: [RC6] Smartfeed for phpBB 3

Posted: Thu Aug 21, 2008 5:18 pm
by MarkDHamill
I hope so too. But it's been weeks since I heard from the mod team. I guess I better ring their bell.