PrecioGasolina.com - Donde encuentras el Precio de tu Gasolina favorita en Puerto Rico. Home of NukeAmazon
Ahorre hasta un 40% en sus Libros Aqui! Amazon.com

Bienvenido a PrecioGasolina.com Buy Books, Music, DVDs, CDs, VHS Video, Toys, Computers, Software, Baby Products, Magazines and More.
Búsqueda

Tópicos
  Crear Cuenta PrecioGasolina  ·  NukeAmazon  ·  Offers  ·  NukeOverstock  ·  Top 10  ·  Tu Cuenta  
GoogleAds

Menú
· Home
· AllPosters
· Bare Necessities
· Content
· FAQ
· Feedback
· Forums
· Loto y Pega3
· Mondera
· NetMagazines
· NukeAmazon
· Ofertas
· PrecioGasolina
· Reviews
· Search
· Statistics
· Stories Archive
· Surveys
· TigerDirect
· Top
· Topics
· Your Account

Amazon
Kodak EasyShare CX7330 3.1MP Digital Camera with 3x Optical Zoom & Kodak Easyshare Printer Dock with 64MB Memory Card
Kodak EasyShare CX7330 3.1MP Digital Camera with 3x Optical Zoom & Kodak Easyshare Printer Dock with 64MB Memory Card
Price: $349.99

OverStock Offer

Great Offers
There isn't content right now for this block.

OverStock Item
Italian Sterling Silver Atlas Walking Stick/Cane
Italian Sterling Silver Atlas Walking Stick/Cane

Price: $549.99
You Save: $401.21


Showcase
·Radio Flyer Ultimate Family Wagon $149.63*
·Intel Core 2 Quad Q6600 2.40GHz Socket 775 OEM Processor and a FREE XFX nForce 680i LT SLI NVIDIA Socket 775 ATX Motherboard $499.99*
·Acer Aspire 3003LC1 15.0" Laptop, 1.8 GHz Mobile AMD Sempron Processor 3000+ $628.00*
·TOMTOM ONE XL GPS for only $309*
·Apple 8 GB iPod Touch $299.00*
·J.L. Childress Ultimate Padded Car Seat Travel Bag
·Seagate / Barracuda 7200.10 / 500GB / 7200 / 8MB / Serial ATA-300 / OEM / Hard Drive $99.99*
· Earn Up to 5% Cash Back*
·Michelin X-930 GPS Navigation with 3.5" LCD Screen and SiRF Star III Technology $159.99*
·SHARP LD-23SH1U 23-Inch Widescreen LCD TV $499.99*

read more...

PrecioGasolina.com: Forums

PrecioGasolina.com :: View topic - fopen is disabled so module doesn't work
 Forum FAQForum FAQ   SearchSearch   UsergroupsUsergroups   ProfileProfile   Login to check your private messagesLogin to check your private messages   LoginLogin 

fopen is disabled so module doesn't work

 
Post new topic   Reply to topic    PrecioGasolina.com Forum Index -> Bugs found - NukeAmazon 2.7
View previous topic :: View next topic  
Author Message
heshys
Novato
Novato


Joined: Dec 16, 2003
Posts: 9

PostPosted: Tue Apr 26, 2005 5:24 pm    Post subject: fopen is disabled so module doesn't work Reply with quote

My host has disabled PHP's allow_url_fopen which includes the "fopen" command for security reasons which doesn't allow this module to work. They instead recommend curl functions.

Here's an example:
http://blog.unitedheroes.net/archives/p/1630/

Code:
$curl_handle = curl_init();
// Where should we get the data?
curl_setopt ($curl_handle, CURLOPT_URL, ‘http://example.com’);
// This says not to dump it directly to the output stream, but instead
// have it return as a string.
curl_setopt ($curl_handle, CURLOPT_RETURNTRANSFER, 1);
// the following is optional, but you should consider setting it
// anyway. It prevents your page from hanging if the remote site is
// down.
curl_setopt ($curl_handle, CURLOPT_CONNECTTIMEOUT, 1);
// Now, YOU make the call.
$buffer = curl_exec($curl_handle);
// And tell it to shut down (when your done. You can always make more
// calls if you want.)
curl_close($curl_handle);
// This is where i’d probably do some extra checks on what i just got.
// Paranoia pays dividends.
print $buffer;


Can this be made to work with this?[/quote]
Back to top
View users profile
EJDiaz
Administrador
Administrador


Joined: May 24, 2002
Posts: 295
Location: Florida

PostPosted: Fri Jun 10, 2005 8:12 pm    Post subject: Cure for allow_url_fopen blues! Reply with quote

Open /includes/NukeAmazon/functions.php
replace function AMZ_file_get_contents($filename) with the following code.
Code:

function AMZ_file_get_contents($url)
{
////
// Fetch URL using whathever method is available. Returns content of page on success, false on failure
#  function tep_fetch_url($url) {
    if(function_exists('curl_init')) {
      $ch = curl_init($url);
      curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
      curl_setopt($ch, CURLOPT_HEADER, 0);
      $page = curl_exec($ch);
      curl_close($ch);
      return utf8_decode($page);
    } else if(ini_get('allow_url_fopen')) {
      $page = file($url);
      $page = implode('', $page);
      return utf8_decode($page);
    } else {
      $page = '';

      $elements = parse_url($url);

      if(strtolower($elements['scheme']) != 'http') {
        return false;
      }

      $fp = @fsockopen($elements['host'], isset($elements['port']) ? $elements['port'] : 80);

      if(!$fp) {
        return false;
      }

      fputs($fp, sprintf("GET %s HTTP/1.0\nHost: %s\n\n",
        $elements['path'] . (isset($elements['query']) ? '?' . $elements['query'] : ''),
        $host
      ));

      $headers = true;

      while(!feof($fp)) {
        $line = fgets($fp, 4096);
        if(chop($line) == "") {
          $headers = false;
        }
        if(!$headers) {
          $page .= $line;
        }
      }

      fclose($fp);
      return utf8_decode($page);
    }

    return false;
}

Wink

Edited to correct the second line "AMZ_file_get_contents($filename)"
_________________
~Edgardo
PrecioGasolina.com | E.J. Stores


Last edited by EJDiaz on Tue Aug 23, 2005 7:04 pm, edited 1 time in total
Back to top
View users profile Visit posters website
heshys
Novato
Novato


Joined: Dec 16, 2003
Posts: 9

PostPosted: Sat Jun 11, 2005 9:34 pm    Post subject: Reply with quote

Thanks that worked perfectly...
Back to top
View users profile
shizznitbiznatch
Novato
Novato


Joined: Aug 23, 2005
Posts: 7

PostPosted: Tue Aug 23, 2005 11:31 am    Post subject: Does not work. Reply with quote

There is no function AMZ_file_get_contents($url) in functions.php.

Only reference to fopen is code below:

Code:

function AMZ_file_get_contents($filename)
{
   $fp = @open($filename, "r");
   if (!($fp))
   {
      return 0;
   }
   while (!feof($fp))
   {
      $temp .= utf8_decode(fread($fp, 4096));
   }
   fclose($fp);
   return $temp;
}


Only reference to AMZ_file_get_contents($url) is found just above that in functions.php:

Code:

$String = AMZ_file_get_contents($URL);


Need a version that uses curl when fopen is off. I have been waiting over a year for a solution! I'm about ready to remove module. It has been broken since admin disabled fopen. Is anyone working on this?!

Thanks
Back to top
View users profile
EJDiaz
Administrador
Administrador


Joined: May 24, 2002
Posts: 295
Location: Florida

PostPosted: Tue Aug 23, 2005 7:13 pm    Post subject: Reply with quote

In the speed of getting this issue posted I typed $url instead of $filename. I have edited the post to show the correct text.

Sorry for any confusion $url may have caused. Wink
_________________
~Edgardo
PrecioGasolina.com | E.J. Stores
Back to top
View users profile Visit posters website
shizznitbiznatch
Novato
Novato


Joined: Aug 23, 2005
Posts: 7

PostPosted: Wed Aug 24, 2005 12:03 pm    Post subject: Reply with quote

Thanks for clearing that up! Smile

I made the change but was still getting the same error and found that the version number in my index.php file:

$AMZCodeVer = "2.7.2";

did not match the version in my database "amazon_cfg" file which was listed as AMZVer 2.7. Once I corrected that the module appeared.

However, I have another problem now- I get the following error:

Warning: getimagesize(): URL file-access is disabled in the server configuration....

This is causing product images not to be displayed. When fopen was set to off, URL file-access was also disabled for the same security reason.

I remember I had to rewrite another script to get around this...will have to look it up, can't remember what changes I made.

Any help would be appreciated!
Back to top
View users profile
EJDiaz
Administrador
Administrador


Joined: May 24, 2002
Posts: 295
Location: Florida

PostPosted: Wed Aug 24, 2005 6:46 pm    Post subject: Reply with quote

Quote:
AMZVer 2.7

Did you do the sql upgrade when upgrading from 2.7 to 2.7.2?

Quote:
I remember I had to rewrite another script to get around this...will have to look it up, can't remember what changes I made

When you find it, please post it here for the benefit of all.
_________________
~Edgardo
PrecioGasolina.com | E.J. Stores
Back to top
View users profile Visit posters website
112502
Novato
Novato


Joined: Oct 02, 2003
Posts: 5

PostPosted: Fri Nov 11, 2005 12:18 pm    Post subject: Reply with quote

While we're on this fopen problem ...

With fopen() disabled (which it should be), using the curl method to grab XML works great. Unfortunately, the "getImageSize" function gets disabled where the code does "getImageSize($url)" ... and we end up with no thumbnails.

So .. umm .. how about a patch for this one? Smile
Back to top
View users profile
shizznitbiznatch
Novato
Novato


Joined: Aug 23, 2005
Posts: 7

PostPosted: Fri Nov 11, 2005 8:35 pm    Post subject: re: no thumbnails Reply with quote

Image problem solved! Cool

Did a little digging and came up with a workaround for image display problem. Did a search of code in includes/NukeAmazon/functions.php and made the following changes. Images now displaying for products.

Worked for me in combination with curl option since fopen was disabled. getImageSize function still works for the most part, just not in fetching product images as $ImageUrl.

Must use $arr['imageurlsmall'] and $arr['imageurlmedium'] instead. Only had to make the 3 changes below in functions.php to get it working on my server.

---------------------

Do a search and replace to fix code. FYI- I'm using NukeAmazon 2.7

small images fix:
(for May we suggest ... & related products, etc...)

Approx. Line 1394 replace

$Accessory .= $LinkStartStr ."<img src=\"" . $A_ImageUrl . "\" border=\"0\" alt=\"" . $A_ProductName . "\"></a>";

with

$Accessory .= $LinkStartStr ."<img src=\"" . $a_arr['imageurlsmall'] . "\" border=\"0\" alt=\"" . $A_ProductName . "\"></a>";

Approx. Line 1517 replace

$content .= $LinkStartStr ."<br><img src=\"" . $S_ImageUrl . "\" border=\"0\" alt=\"" . $S_ProductName . "\"></a><br>";

with

$content .= $LinkStartStr ."<br><img src=\"" . $s_arr['imageurlsmall'] . "\" border=\"0\" alt=\"" . $S_ProductName . "\"></a><br>";

Medium images fix:
(for main product image)

Approx. Line 1066 replace

$content .= "<img src=\"" . $ImageUrl . "\" border =\"0\" alt=\"$ProductName\" >";

with

$content .= "<img src=\"" . $arr['imageurlmedium'] . "\" border =\"0\" alt=\"$ProductName\" width=\"80%\">";
Back to top
View users profile
112502
Novato
Novato


Joined: Oct 02, 2003
Posts: 5

PostPosted: Sat Nov 12, 2005 11:31 am    Post subject: Reply with quote

hmmm ... I'm using 2.7.2, and my line numbers don't anywhere near correspond with yours ---- I mean like, 1000 lines off. And, I'm still getting "Image Not Available" due to the Product Image bits checking "GetImageSize($url)" ...

I was able to get it to work, though not the best way, but simply commenting out the rather hefty Conditional in a couple of places ...

Code:
        # Product Image
//              $size = GetImageSize($b_arr['imageurlsmall']);
//              if ( $size[0] > 2 && $size[1] > 2 )
//              {
                        $details['image'][$i] = $b_arr['imageurlsmall'];
//              }
//              else
//              {
//                      $catalog = strtolower($ProductCatalog);
//                      $sql = "SELECT no_image FROM ".$prefix."_amazon_catalog WHERE r_catalog = '$catalog'";
//                      $result = $db->sql_query($sql);
//                      list($details['image'][$i]) = $db->sql_fetchrow($result);
//              }
Code:
# Product Image
//              $size = GetImageSize($arr['imageurlsmall']);
//              if ( $size[0] > 2 && $size[1] > 2 )
//              {
                        switch ($ImageSize)
                        {
                                case "small":
                                        $ImageUrl = $arr['imageurlsmall'];
                                        break;
                                case "medium":
                                        $ImageUrl = $arr['imageurlmedium'];
                                        break;
                                case "large":
                                        $ImageUrl = $arr['imageurllarge'];
                                        break;
                        }
//              }
//              else
//              {
//                      $catalog = strtolower($ProductCatalog);
//                      $sql = "SELECT no_image FROM ".$prefix."_amazon_catalog WHERE r_catalog = '$catalog'";
//                      $result = $db->sql_query($sql);
//                      list($ImageUrl) = $db->sql_fetchrow($result);
//                      $NoImage = true;
//              }
Then it works with fopen disabled --- an easy fix, that's easy to see. But who knows if I'm breaking something else... But ... at the same time, it's not likely you're going to end up with an image in their XML that's LESS than 2x2, so the issue is kinda moot.

The thing that'll actually fix it ... is to use curl to download the thumbnails to a cache, and do the GetImageSize against the local file. fopen's just too dangerous to leave turn on, especially with PHP-Nuke.
Back to top
View users profile
shizznitbiznatch
Novato
Novato


Joined: Aug 23, 2005
Posts: 7

PostPosted: Sat Nov 12, 2005 1:22 pm    Post subject: re: GetImageSize Reply with quote

Oops! Embarassed

I forgot about that last part.

In functions.php I added a @ before all getimagesize so php doesn't broadcast it. (@getimagesize)

I'll try to find a "real fix" that works with curl, but for now at least I have images. I agree that using curl to write images to a /temp directory and then accessing it locally rather than by url is the real ticket.

Guess I have to dig a little deeper and see what I can come up with. I'll let you know if I come up with a fix...
Back to top
View users profile
Display posts from previous:   
Post new topic   Reply to topic    PrecioGasolina.com Forum Index -> Bugs found - NukeAmazon 2.7 All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
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

Powered by phpBB 2.0.10 © 2001 phpBB Group
phpBB port v2.1 based on Tom Nitzschner's phpbb2.0.6 upgraded to phpBB 2.0.4 standalone was developed and tested by:
ArtificialIntel, ChatServ, mikem,
sixonetonoffun and Paul Laudanski (aka Zhen-Xjell).

Version 2.1 by Nuke Cops © 2003 http://www.nukecops.com

Forums ©

 
PrecioGasolina.com - Donde encuentras el Precio de tu Gasolina favorita en Puerto Rico.
· Quíenes Somos · Términos y Condiciones · Confidencialidad / Privacidad ·
Todos los logos y marcas son propiedad de sus respectivos propietarios.
Los comentarios son propiedad de quien los escribió.
Todo el resto es © por PrecioGasolina.com - Derechos Reservados
· E.J. Stores · Texaco Rio Piedras · Precio Gasolina · The Amazing Store Shopper · Associates PR · BuyBooksDvdsMusic ·
Page Generation: 0.566 Seconds