[MODDB] Smartfeed for phpBB 3

A place for MOD Authors to post and receive feedback on MODs still in development. No MODs within this forum should be used within a live environment!
Get Involved
Locked
RobInk
Registered User
Posts: 22
Joined: Fri Feb 15, 2008 12:45 pm
Location: The Netherlands
Contact:

Re: [RC6] Smartfeed for phpBB 3

Post by RobInk »

Ok I checked the files, that line is correct already. Could it be a .htaccess protection on our sandbox setup?
User avatar
MarkDHamill
Registered User
Posts: 4300
Joined: Fri Aug 02, 2002 12:36 am
Location: Florence, MA USA
Contact:

Re: [RC6] Smartfeed for phpBB 3

Post by MarkDHamill »

RobInk wrote:Ok I checked the files, that line is correct already. Could it be a .htaccess protection on our sandbox setup?
That sounds quite possible. If there is a way to test the URL with a .htaccess test tool, that would verify it. I don't know how much Joomla locks things down.
Need phpBB services or a phpBB consultant? I offer most phpBB services. Getting lost managing phpBB? Buy my book, Mastering phpBB Administration. eBook and paper versions available.
User avatar
MarkDHamill
Registered User
Posts: 4300
Joined: Fri Aug 02, 2002 12:36 am
Location: Florence, MA USA
Contact:

Re: [RC6] Smartfeed for phpBB 3

Post by MarkDHamill »

BTW, if you get it working and can send an exact list of changes you made to 2.2.3 please send them to me so I can include it in the /contrib folder. A number of people have wanted to get it to work with Joomla.
Need phpBB services or a phpBB consultant? I offer most phpBB services. Getting lost managing phpBB? Buy my book, Mastering phpBB Administration. eBook and paper versions available.
klapray
Registered User
Posts: 1
Joined: Wed Sep 10, 2008 11:24 pm

Re: [RC6] Smartfeed for phpBB 3

Post by klapray »

Thanks for this great mod! It is really working well for us.

While setting up and testing version 2.2.3 we were able to fix a few problems we were having.

This first patch is for feedcreator.class.php and fixes categories for ATOM 1.0 feeds:

Code: Select all

--- C:/Dev/feedcreator.class - Copy.php	Mon May 05 10:48:00 2008
+++ C:/Dev/feedcreator.class.php	Wed Sep 10 16:55:54 2008
@@ -1203,7 +1203,7 @@
 				$feed.= "        </author>\n";
 			}
 			
-			if ($this->category!="") {
+			if ($this->items[$i]->category!="") {
 								$feed.= "        <category term=\"" . htmlspecialchars($this->items[$i]->category) . "\" />\n";
 			}
 			
These next two patches another developer I work with wrote to fix problems we were having with feeds for certain users. It turns out there was a problem with the way certain passwords were encoded.

smartfeed.php:

Code: Select all

--- C:/Dev/smartfeed - Copy.php	Fri Aug 08 07:43:18 2008
+++ C:/Dev/smartfeed.php	Wed Sep 10 17:05:44 2008
@@ -312,6 +312,8 @@
 	
 	// Because base64_encode was used instead of urlencode we get a relatively compact e parameter. However, this has one small
 	// drawback: + signs in e parameter are translated to a space character when read. Consequently we have to put them back in.
+	// ***BAD BUG: if a + sign appeared as the first or last character in the e parameter, PHP has already stripped it and it is lost for good.
+	// For this reason, I have changed things below to use "urlsafe" versions of base64_encode and _decode.
 	$encrypted_pswd = str_replace(' ','+',$encrypted_pswd);
 	
 	// Decrypt password using the user_smartfeed_key column in the phpbb_users table. This should have gotten created 
@@ -1099,6 +1101,11 @@
 
 }
 
+function base64_decode_urlsafe($input)
+{
+    return base64_decode(strtr($input, '-_.', '+/='));
+}
+
 function decrypt($encoded_64, $key)
 {
 
@@ -1115,7 +1122,7 @@
 	$des->setKey($key);
 
 	// Decrypt
-	$decrypted_data = $des->decrypt(base64_decode($encoded_64));
+	$decrypted_data = $des->decrypt(base64_decode_urlsafe($encoded_64));
 	return $decrypted_data;
 	
 }  
smartfeed_url.php:

Code: Select all

--- C:/Dev/smartfeed_url - Copy.php	Wed Jul 30 21:15:50 2008
+++ C:/Dev/smartfeed_url.php	Wed Sep 10 16:51:06 2008
@@ -70,6 +70,8 @@
 			$user_smartfeed_key = gen_rand_string(32);
 			$encrypted_password = encrypt($user_password, $user_smartfeed_key);
 			$encrypted_password_with_ip = encrypt($user_password . '~' . $_SERVER['REMOTE_ADDR'], $user_smartfeed_key);
+			// Comment [LRS]: it seems to me this is completely pointless, because base64_encode (and thus encrypt) will NEVER return anything
+			// containing an ampersand. It's impossible. So every possible key generated will be "clean", and $ampersand_loc will never be > 0.
 			$ampersand_loc = strpos($encrypted_password_with_ip, '&');
 			if ($ampersand_loc > 0)
 			{
@@ -453,6 +455,11 @@
 
 page_footer();
 
+function base64_encode_urlsafe($input)
+{
+    return strtr(base64_encode($input), '+/=', '-_.');
+}
+
 function encrypt($data_input, $key)
 {   
 
@@ -472,8 +479,8 @@
 
 	$des->setKey($key);
 
-	// Encrypt
-	$encrypted_data = base64_encode($des->encrypt($data_input));
+	// Encode
+	$encrypted_data = base64_encode_urlsafe($des->encrypt($data_input));
 	return $encrypted_data;
 
 }   
User avatar
MarkDHamill
Registered User
Posts: 4300
Joined: Fri Aug 02, 2002 12:36 am
Location: Florence, MA USA
Contact:

Re: [RC6] Smartfeed for phpBB 3

Post by MarkDHamill »

Thank you for the bug fixes. I never understood why those + signs were being converted into spaces in the first place! Finally, an answer!

Rest assured your code fixes will make it into the next version.

The feedcreator.class.php is a 3rd party program. I will include the changes there and notify the author.
Need phpBB services or a phpBB consultant? I offer most phpBB services. Getting lost managing phpBB? Buy my book, Mastering phpBB Administration. eBook and paper versions available.
User avatar
IPB_Refugee
Registered User
Posts: 1290
Joined: Fri Jul 07, 2006 2:25 pm
Location: Austria
Name: Wolfgang Weber

Re: [RC6] Smartfeed for phpBB 3

Post by IPB_Refugee »

Hi Mark,

I tried to use your MOD as a guest with the following settings:

smartfeed.php?&limit=7_DAY&count_limit=15&sort_by=standard&feed_type=RSS2.0&feed_style=HTMLSAFE

This URL has been generated by smartfeed_url.php. (Is it correct, that directly after "?" there is a "&") Then I clicked on "Test" and got this error:
XML Parsing Error: junk after document element
Location: http://www.example.com/smartfeed.php?&l ... e=HTMLSAFE

Line Number 72, Column 1:<b>[phpBB Debug] PHP Notice</b>: in file <b>/smartfeed.php</b> on line <b>708</b>: <b>Undefined variable: lastvisit</b><br />
^
Lines 706 - 714 in smartfeed.php:

Code: Select all

// Reset the user's last visit date on the forum, if so requested
if ($lastvisit)
{
	$sql = 'UPDATE ' . USERS_TABLE . '
				SET user_lastvisit = ' . time() . " 
				WHERE user_id = $user_id";

	$result = $db->sql_query($sql);
}
BUGFIX:

In smartfeed.php FIND:

Code: Select all

// Set up some variables
Add after:

Code: Select all

$lastvisit = false;

Another suggestion: In smartfeed_url_body.html of subsilver style you have this code:

Code: Select all

<input type="text" name="url" id="url" size="80" maxlength="3000" class="post" onfocus="this.select();" />
size="80" is too much for people with a small resolution - they will get a horicontal scroll bar. Better would be to delete size="80" and to add style="width:95%;" instead. (In this case the left <td> should have a width of about 40%, too.)

Regards
Wolfgang


EDIT: You define other variables inside an if() {...} part, too, starting with:

Code: Select all

if ($registered_user)
{
	// Validate the removemine parameter, if present
This might create a similar debug notice I posted above. (Haven't looked at the code closely yet.) Possible problems e.g. with variables $remove_mine, $show_pms, $bookmarks and $filter_foes which are declared inside the if ($registered_user) part.
sergey17
Registered User
Posts: 1
Joined: Wed Oct 01, 2008 6:00 pm

Re: [RC6] Smartfeed for phpBB 3

Post by sergey17 »

Hi

I have successfully installed this on "prosilver special edition" and it is working fine.
The only issue is that I'm not seeing RSS icon (icon_mini_feed.gif) instead is just showing {FEED}
http://www.bglions.com/forum
Any ideas how to get this icon in place will be highly appreciated?

Cheers
User avatar
MarkDHamill
Registered User
Posts: 4300
Joined: Fri Aug 02, 2002 12:36 am
Location: Florence, MA USA
Contact:

Re: [RC6] Smartfeed for phpBB 3

Post by MarkDHamill »

Presumably you purged the cache according to the directions.

If you still don't see it, clear your browser cache too, exit your browser and try again. It should be there.
Need phpBB services or a phpBB consultant? I offer most phpBB services. Getting lost managing phpBB? Buy my book, Mastering phpBB Administration. eBook and paper versions available.
User avatar
MarkDHamill
Registered User
Posts: 4300
Joined: Fri Aug 02, 2002 12:36 am
Location: Florence, MA USA
Contact:

Re: [RC6] Smartfeed for phpBB 3

Post by MarkDHamill »

IPB_Refugee wrote:Hi Mark,

I tried to use your MOD as a guest with the following settings:

smartfeed.php?&limit=7_DAY&count_limit=15&sort_by=standard&feed_type=RSS2.0&feed_style=HTMLSAFE

This URL has been generated by smartfeed_url.php. (Is it correct, that directly after "?" there is a "&") Then I clicked on "Test" and got this error:
XML Parsing Error: junk after document element
Location: http://www.example.com/smartfeed.php?&l ... e=HTMLSAFE

Line Number 72, Column 1:<b>[phpBB Debug] PHP Notice</b>: in file <b>/smartfeed.php</b> on line <b>708</b>: <b>Undefined variable: lastvisit</b><br />
^
Wolfgang,

Sorry I missed this suggestion. I will apply it to the next version.

As for the Generate URL box, I tested it in 800x600 resolution and don't see a horizontal scroll bar although text sure is scrunched up in the left column.

I should have a bug fix version out soon.
Need phpBB services or a phpBB consultant? I offer most phpBB services. Getting lost managing phpBB? Buy my book, Mastering phpBB Administration. eBook and paper versions available.
User avatar
IPB_Refugee
Registered User
Posts: 1290
Joined: Fri Jul 07, 2006 2:25 pm
Location: Austria
Name: Wolfgang Weber

Re: [RC6] Smartfeed for phpBB 3

Post by IPB_Refugee »

MarkDHamill wrote:As for the Generate URL box, I tested it in 800x600 resolution and don't see a horizontal scroll bar although text sure is scrunched up in the left column.
Oops, I use a style created by my own and this style uses just 80% of the available width. So you are probably right that size="80" doesn't cause a horizontal scroll bar in regular subsilver2 with 800px width. (BTW: That might also depend on the font size used by the style.)

Regards
Wolfgang
User avatar
MarkDHamill
Registered User
Posts: 4300
Joined: Fri Aug 02, 2002 12:36 am
Location: Florence, MA USA
Contact:

Updated translations needed

Post by MarkDHamill »

Smartfeed has a number of language translations. I am readying a version 2.2.4 and would appreciate translations for the following:

Code: Select all

	'SMARTFEED_AJAX_ERROR'					=> 'An error occurred generating an AJAX request',
	'SMARTFEED_INVALID_SESSION_KEY'			=> "sid argument value of %s is not valid for user_id = %s when calling smartfeed_url_new_key.$phpEx. Session may have expired.",
	'SMARTFEED_NEW_KEY'						=> 'Generate a new phpBB Smartfeed key',
	'SMARTFEED_NEW_KEY_EXPLAIN'				=> 'If you are concerned that the security to your feed has been compromised, you may want to create a new phpBB Smartfeed encryption key. If you change your key, you will have to reprogram your newsreaders to use the new generated URL.',
	'SMARTFEED_NO_AJAX_SUPPORT'				=> 'A new key cannot be generated because this browser does not support AJAX',
	'SMARTFEED_NO_SESSION_KEY'				=> "No sid argument was passed when calling smartfeed_url_new_key.$phpEx. There should normally be a sid parameter on the URL field.",
	'SMARTFEED_NO_U_ARGUMENT'				=> "No u argument was passed when calling smartfeed_url_new_key.$phpEx",
Currently I have translations for French, German and Bulgarian.

It's kind of ugly but if I cannot get them then I have to put English into the language files.

Hopefully all the original translators are watching this topic and can post the translations here.
Need phpBB services or a phpBB consultant? I offer most phpBB services. Getting lost managing phpBB? Buy my book, Mastering phpBB Administration. eBook and paper versions available.
User avatar
IPB_Refugee
Registered User
Posts: 1290
Joined: Fri Jul 07, 2006 2:25 pm
Location: Austria
Name: Wolfgang Weber

Re: [RC6] Smartfeed for phpBB 3

Post by IPB_Refugee »

Hi Mark,

here is my German translation:

Code: Select all

       'SMARTFEED_AJAX_ERROR'               => 'Beim Erzeugen einer AJAX-Anfrage ist ein Fehler aufgetreten.',
       'SMARTFEED_INVALID_SESSION_KEY'         => "Der sid-Parameter mit dem Wert %s ist für den Benutzer mit der ID %s nicht gültig. Möglicherweise ist die Session abgelaufen.",
       'SMARTFEED_NEW_KEY'                  => 'Erzeuge einen neuen phpBB Smartfeed Schlüssel',
       'SMARTFEED_NEW_KEY_EXPLAIN'            => 'Wenn du Bedenken hast, dass die Sicherheit deines Feeds nicht mehr gewährleistet ist, kannst du einen neuen Schlüssel für die phpBB Smartfeed Verschlüsselung erzeugen. Wenn du deinen Schlüssel änderst, musst du deinem Newsreader die neu generierte URL bekannt geben.',
       'SMARTFEED_NO_AJAX_SUPPORT'            => 'Ein neuer Schlüssel kann nicht erzeugt werden, weil der Browser AJAX nicht unterstützt.',
       'SMARTFEED_NO_SESSION_KEY'            => "Beim Aufruf von smartfeed_url_new_key.$phpEx wurde kein sid-Parameter übergeben. Normalerweise sollte der sid-Parameter ein Bestandteil der URL sein.",
       'SMARTFEED_NO_U_ARGUMENT'            => "Beim Aufruf von smartfeed_url_new_key.$phpEx wurde kein u-Parameter übergeben.",
Two questions:

Regarding SMARTFEED_NO_AJAX_SUPPORT: Wouldn't it be better to write that Javascript has to be enabled instead of "the browser does not support AJAX"? (Not everybody knows that AJAX is a Javascript technology.)

Regarding SMARTFEED_NEW_KEY_EXPLAIN: "you will have to reprogram your newsreaders to use the new generated URL" Does that mean that you simply have to tell the newsreader the new URL of the feed? (IF yes, my translation is okay.)

Regards
Wolfgang
User avatar
MarkDHamill
Registered User
Posts: 4300
Joined: Fri Aug 02, 2002 12:36 am
Location: Florence, MA USA
Contact:

Re: [RC6] Smartfeed for phpBB 3

Post by MarkDHamill »

Thanks for the translation Wolfgang.
Regarding SMARTFEED_NO_AJAX_SUPPORT: Wouldn't it be better to write that Javascript has to be enabled instead of "the browser does not support AJAX"? (Not everybody knows that AJAX is a Javascript technology.)
Some older browsers do not support AJAX but do support Javascript. If Javascript is turned off though no message would appear at all. I was working from an example on the w3schools.com site.
Regarding SMARTFEED_NEW_KEY_EXPLAIN: "you will have to reprogram your newsreaders to use the new generated URL" Does that mean that you simply have to tell the newsreader the new URL of the feed? (IF yes, my translation is okay.)
Yes, that's what it means.
Need phpBB services or a phpBB consultant? I offer most phpBB services. Getting lost managing phpBB? Buy my book, Mastering phpBB Administration. eBook and paper versions available.
User avatar
IPB_Refugee
Registered User
Posts: 1290
Joined: Fri Jul 07, 2006 2:25 pm
Location: Austria
Name: Wolfgang Weber

Re: [RC6] Smartfeed for phpBB 3

Post by IPB_Refugee »

MarkDHamill wrote:Some older browsers do not support AJAX but do support Javascript.
Thanks - I didn't know that. My translation above regarding SMARTFEED_NO_AJAX_SUPPORT and SMARTFEED_NEW_KEY_EXPLAIN should be okay then.

Have a nice day
Wolfgang
User avatar
MarkDHamill
Registered User
Posts: 4300
Joined: Fri Aug 02, 2002 12:36 am
Location: Florence, MA USA
Contact:

Version 2.2.4 Available

Post by MarkDHamill »

I'll submit this one to the mod team, which still has 2.2.3 in the queue for review.

Here are the changes:

* New program smartfeed_url_new_key.php. This is a program which allows a user to create a new Smartfeed key. It is called asynchronously using AJAX from smartfeed_url_body.html.
* Utilizing base64_decode_safe and base64_encode_safe provided by phpBB user klapray. He discovered in certain cases the "e" parameter in the URL string will not be encoded or decode correctly. Much thanks. This has been a tough bug to figure out! As a consequence of fixing this problem, your users may have to regenerate a URL using smartfeed_url.php. They should get an error notice to this effect in this case.
* smartfeed_url.php issues fewer SQL calls by gathering a list of parent forums before executing logic to show nested categories and forums.
* The functions check_word_size and check_word_size_min in smartfeed_url_body.html was fixed to do number comparisons instead of ASCII comparisons.
* Fixed category error for ATOM feeds in feedcreator.class.php. Fix provided by phpBB user klapray.
* Fixed date limit error in SQL for the case of SMARTFEED_NO_LIMIT smartfeed.php.
* Fixed PHP Notices for variables $user_permissions, $acl_options, $acl, $forum_read_ary, in smartfeed_url.php.
* Fixed PHP Notice in smartfeed.php for variable lastvisit.

Download Here
Need phpBB services or a phpBB consultant? I offer most phpBB services. Getting lost managing phpBB? Buy my book, Mastering phpBB Administration. eBook and paper versions available.
Locked

Return to “[3.0.x] MODs in Development”