PHP-Nuke Services - Addons, Modules, Blocks Vizitati www.westdesign.ro Select Interface Language:EnglishRomanian
  Login or Register HomeForumsDownloadsYour AccountWeb LinksContact   
SectionsShow\Hide
MultiheadlinesShow\Hide
LoginShow\Hide
~ Welcome, alien
Nickname Password
(Register)

~ Membership:

Greetings to the newest member jincesoft
~ New Today: 0
~ New Yesterday: 0
~ Overall: 4306

~ People Online:
~ Visitors: 9
~ Members: 0
~ Total: 9
~Aikon is offline
on Yahoo Msg.
Link to meShow\Hide

aikons.net
Search in FeedsShow\Hide
Search in feeds
HistoryShow\Hide
On 17 May


Speed Up   Pause   Speed Down
DictionaryShow\Hide
Enter the word

Romanian users only

- aikons.net - PHP-Nuke Services Forum Index


This topic is locked: you cannot edit posts or make replies. Page 1 of 1
Multiheadlines with "allow_url_fopen" set to OFF
Message Author
Reply with quote
Post Posted: Friday 17 November, 2006 13:40

For Multiheadlines to work, allow_url_fopen directive must be to ON in your php.ini. However more and more hosting providers do not want to do this due to security risks as detailed here :-
http://bugs.php.net/bug.php?id=37874

It appears that if other RSS blocks are working then according to Aikon, Multiheadlines can also work through modding it to use fsockopen. Can someone, maybe Aikon, help me mod my MH to do this please?

Thanks.

View user's profile Send private message
Reply with quote
Post Posted: Saturday 18 November, 2006 14:07

Ok.
We just gonna emulate the file_get_contents function using the fsockopen as it is used for regular rss/rdf nuke blocks.

Open functions.php [/modules/Multiheadlines/ folder] and look for:

Code:
if (($contents=@file_get_contents($rss)) <> false) {

and replace with
Code:
   $parsedf = parse_url($rss);
   $con = fsockopen($parsedf['host'], 80, $errno, $errstr, 30);
   if ($con) {
       if ($parsedf['query'] !== '') {
           $parsedf['query'] = "?" . $parsedf['query'];
      } else {
           $parsedf['query'] = '';      
      }
       fputs($con, "GET " . $parsedf['path'] . $parsedf['query'] . " HTTP/1.0\r\n");
       fputs($con, "HOST: " . $parsedf['host'] . "\r\n\r\n");
       $contents   = "";
       while(!feof($con)) {
          $contents .= trim(fgets($con));
       }
       fputs($con,"Connection: close\r\n\r\n");
       fclose($con);

Now should work!

View user's profile Send private message Visit poster's website
Reply with quote
Post Posted: Saturday 18 November, 2006 14:35

Wow Aikon, you ARE a start and now you have made the next version security friendly.

I had trouble looking for the line "if (($contents=@file_get_contents($rss)) <> false) {"
because I had done the cURL mode but after reverting back and then doing the above,
it now works perfectly!

Many thanks and keep up with the great work!

View user's profile Send private message
Reply with quote
Post Posted: Saturday 18 November, 2006 16:30

Mr. Green

View user's profile Send private message Visit poster's website
Reply with quote
Post Posted: Thursday 23 August, 2007 03:19

Agreed... this module is beautifully written, and the above fix worked very well for me. Great Job!! Thanks Aikon for the killer app. Very Happy

One Question: Any reason why the above fix shouldn't become incorporated into the next version? That way when people download it, it will work out of the box regardless of the allow_url_fopen setting, and they won't waste tons of time troubleshooting it. (Sorry if it's a dumb question... I'm a php noob =)

Thanks again!! Mr. Green

View user's profile Send private message Send e-mail Visit poster's website
Reply with quote
Post Posted: Thursday 23 August, 2007 09:08

Actualy it is incorporated in the next version. Wink

View user's profile Send private message Visit poster's website
Display posts from previous:
This topic is locked: you cannot edit posts or make replies. Page 1 of 1
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
  


Page Generation: 0.60 Seconds