Page 40 of 55

Re: [RC6] Smartfeed for phpBB 3

Posted: Fri Aug 08, 2008 4:20 pm
by MarkDHamill
Michael,

Were you ever able to get it working for any version?

I did not have a LDAP test bed, so yours may be the first case of someone using LDAP actually putting it through its paces.

The problem appears to be related to selecting the user_permissions column from the phpbb_users table. This is a BLOB column which contains packed information on forum permissions. My understanding is that whether LDAP is used or not, the column contains a bunch of flags that indicate forum read permissions. I used logic I stole from auth.php so that I could get forum permissions without needing someone to log in. I am guessing that in the case of LDAP the data is blank or different than for those with DB or AUTH access.

Here is an example of what the contents in the column might look like:

Code: Select all

zik0zjzik0zjzik0w0
i1cjyo000000
zik0zjzhb2tc
I am wondering what you see for the user_id you tested. You can use a program like phpMyAdmin to examine the contents of the column.

It is likely that something about this column is tripping things up.

I'd like to figure out the issue so that I can support LDAP authentication properly.

Re: [RC6] Smartfeed for phpBB 3

Posted: Fri Aug 08, 2008 4:33 pm
by mamisano
Mark,
I only tried to install with 2.2.2 and 2.2.3 and neither worked. Both times LDAP was on.

I checked out the user_permissions field. My ID is the ONLY one that is not 0 Bytes. I have 7 other users (besides the bots) and they all have no data in that field.

Here is mine:

Code: Select all

zik0zjzik0zjzik0w0
i1cjyo000000

zik0zi000000
zik0zi000000
zik0zi000000
zik0zi000000
zik0zi000000
zik0zi000000
zik0zi000000
zik0zi000000
zik0zi000000
zik0zi000000
zik0zi000000
zik0zi000000
zik0zi000000
zik0zi000000
zik0zi000000
zik0zi000000
zik0zi000000
zik0zi000000
zik0zi000000
zik0zi000000
Let me know if you need any help testing changes, etc so we can fix the issue.

Thanks for such a quick reply!
-Michael

Re: [RC6] Smartfeed for phpBB 3

Posted: Fri Aug 08, 2008 4:45 pm
by MarkDHamill
Let's test the obvious first. If you are logged out and access the board, are any forums available? Since you have notices turned on you are seeing a message that others do not see, but you should get the No Forums message if there are none that are publicly accessible.

Re: [RC6] Smartfeed for phpBB 3

Posted: Fri Aug 08, 2008 5:13 pm
by mamisano
Correct - "This board has no forums"

Re: [RC6] Smartfeed for phpBB 3

Posted: Fri Aug 08, 2008 5:46 pm
by mamisano
Mark, I just changed it back to "DB" authentication and the Smartfeed page came RIGHT up, no errors.

Re: [RC6] Smartfeed for phpBB 3

Posted: Fri Aug 08, 2008 7:27 pm
by MarkDHamill
mamisano wrote:Correct - "This board has no forums"
So perhaps all I really need to do is trap for the condition of the board having no forums so the PHP Notice does not occur. I don't see it of course because I have no LDAP server available.

Re: [RC6] Smartfeed for phpBB 3

Posted: Fri Aug 08, 2008 7:28 pm
by MarkDHamill
mamisano wrote:Mark, I just changed it back to "DB" authentication and the Smartfeed page came RIGHT up, no errors.
That is because the block of code that triggers the PHP Notice is never executed.

Re: [RC6] Smartfeed for phpBB 3

Posted: Sat Aug 09, 2008 5:22 am
by John T. Folden
I've just installed this on my forum and it seems to be working well. However, I've noticed an oddity when an anonymous user tries to set up a feed:

If the maximum number of posts in a feed is set to 100 then the user can only set it to 1, 10, or 100. Setting it to 33, for example, bring up an error about having to choose a positive whole number.

Thanks,
John

Re: [RC6] Smartfeed for phpBB 3

Posted: Sat Aug 09, 2008 1:08 pm
by MarkDHamill
It looks like my Javascript logic could be better. Essentially, I did not convert the fields into numbers, so I was comparing strings.

Replace the functions check_word_size and check_word_size_min in /style/prosilver/templates/smartfeed_url_body.html with the following, then refresh the template. You can also replace subsilver2 if you are using that since this code is identical.

Code: Select all

function check_word_size (field)
{
	if (isNaN(field.value))
	{
		alert("{LA_SMARTFEED_SIZE_ERROR}");
		field.focus();
		return;
	}
	size = parseInt(field.value);
	if (field.defaultValue != '')
	{
		max_items = parseInt(field.defaultValue);
	}
	else
	{
		max_items = 0;
	}
	if (size <= 0)
	{
		alert("{LA_SMARTFEED_SIZE_ERROR}");
		field.focus();
		return;
	}
	if (field.defaultValue != '')
	{
		if (size > max_items) 
		{
			alert("{LA_SMARTFEED_SIZE_ERROR}");

		}
	}
}

function check_word_size_min (field) 
{
	size = field.value;
	if (size == '')
	{
		return;
	}
	if (isNaN(size))
	{
		alert("{LA_SMARTFEED_SIZE_ERROR_MIN}");
		field.focus();
	}
	else
	{
		size = parseInt(size);
		if (size < 1) 
		{
			alert("{LA_SMARTFEED_SIZE_ERROR_MIN}");
			field.focus();
		}
		else
		{
			field.value = size;
		}
	}
}
As bugs are discovered of course they get fixed in subsequent versions. Thanks for finding this one!

Re: [RC6] Smartfeed for phpBB 3

Posted: Sat Aug 09, 2008 7:23 pm
by John T. Folden
Thanks! That seems to do the trick.

I have one feature request, if it's possible. I have quite a number of forums and divide them up under categories. Would it be possible to add a feature where if you put a check mark on the parent that the sub-forums would get checked, too?


Thanks again,
John

Re: [RC6] Smartfeed for phpBB 3

Posted: Sat Aug 09, 2008 8:39 pm
by MarkDHamill
That was tried early in the development, but it got too complex and I was told to keep it simple. However, you can switch all forums on and off. Sorry.

Re: [RC6] Smartfeed for phpBB 3

Posted: Sat Aug 09, 2008 11:33 pm
by John T. Folden
Not a biggie. Thankfully, it's not something you do every day. 8-)

Re: [RC6] Smartfeed for phpBB 3

Posted: Wed Aug 13, 2008 10:04 am
by jobla
Hi

installed 2.2.3 on a phpbb3.0.2 we also have rokbridge installed so we share users with joomla site.
the rss works but after the </RSS> in the feed there are some <b>[phpBB Debug] PHP Notice</b>

Code: Select all

<b>[phpBB Debug] PHP Notice</b>: in file <b>/home/123/public_html/joomla1.5/libraries/joomla/session/session.php</b> on line <b>407</b>: <b>session_start() [<a href='function.session-start'>function.session-start</a>]: Cannot send session cookie - headers already sent by (output started at /includes/feedcreator.class.php:695)</b><br />
<b>[phpBB Debug] PHP Notice</b>: in file <b>/home/123/public_html/joomla1.5/libraries/joomla/session/session.php</b> on line <b>407</b>: <b>session_start() [<a href='function.session-start'>function.session-start</a>]: Cannot send session cache limiter - headers already sent (output started at /includes/feedcreator.class.php:695)</b><br />
<b>[phpBB Debug] PHP Notice</b>: in file <b>/home/123/public_html/joomla1.5/libraries/joomla/session/session.php</b> on line <b>410</b>: <b>Cannot modify header information - headers already sent by (output started at /includes/feedcreator.class.php:695)</b><br />
<b>[phpBB Debug] PHP Notice</b>: in file <b>/home/123/public_html/joomla1.5/libraries/joomla/application/application.php</b> on line <b>601</b>: <b>Cannot modify header information - headers already sent by (output started at /includes/feedcreator.class.php:695)</b><br />


is there a way of getting rid of the notice messages?

Re: [RC6] Smartfeed for phpBB 3

Posted: Wed Aug 13, 2008 12:42 pm
by MarkDHamill
This mod was never designed with Joomla integration in mind so I am afraid you will have to figure out this one.

Re: [RC6] Smartfeed for phpBB 3

Posted: Wed Aug 13, 2008 12:58 pm
by IPB_Refugee
Hi Mark,

regarding the problem of too many queries when you have a lot of forums:

I commented (/* */) the following part in smartfeed_url.php now (thanks for pointing me to this piece of code!) which reduced the number of queries dramatically:

Code: Select all

		/*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...
			}
		}*/
And then I noticed something strange: While my founder account still sees all forums and categories, a regular user sees only the names of the forums.
And while my founder account had a nice look of smarfeed_url-page, e.g.

Code: Select all

Category A
	Forum 1
	Forum 2
Category B
	Forum 3
	Forum 4
... a regular user saw something like that:

Code: Select all

Forum 1
	Forum 2
		Forum 3
		Forum 4
			Forum 5
				Forum 6
				Forum 7
					Forum 8
Last problem was very easy to solve by deleting style="position:relative; left:20px;" in smartfeed_url_body.html.

BUT: Why can't regular users see the names of the categories? Is it because they are not allowed to see categories that contain only forums visible for admins and so on? (In this case shouldn't it be possible to count how many forums are displayed for user X in a certain category and if that number == 0, don't display the name of the category, too?)

Anyway, I like it much better the way it is now - with 13 queries instead of 209. And the page looks fine for everybody - the only difference is, that regular users do not see the names of the categories anymore. This might be interesting for people who love your MOD as much as I do and who also have many forums. :)

Regards
Wolfgang


EDIT:

When I click on "Generate URL" on smartfeed_url - page and then on "Test", everything works fine with Firefox 3. But when I do the same with the browser Epiphany (I do it both times with my founder account) it tells me:
This XML file does not appear to have any style information associated with it. The document tree is shown below.
And then I see the source code:
<!--
generator="FeedCreator 1.8.0-dev (info@mypapit.net)"
-->

<rss version="2.0">

<channel>
....
....
....
Is this a problem of the browser or of the MOD or did I break something?


EDIT 2:

If you have many forums and want to follow the suggestions above, here is one more thing you can do to make the smartfeed_url-page look better: Add a space between the categories! To do this, simply change

Code: Select all

<div id="{forums.CAT_ID}" style="position:relative; left:20px;">
to

Code: Select all

<div id="{forums.CAT_ID}" style="margin:0.6em 0;">
in smartfeed_url_body.html (That's the line you might already have altered when you followed my suggestion in this post.) Not later than now the page should look okay for everybody - and you save hundreds of queries! :)