Error in MobiMaps 2.0.7

Bugs
buiak
2011-11-02
2013-04-24
  • buiak
    buiak
    2011-11-02

    Greetings,
    I've this error when I try to set the location

    Warning: file_get_contents() : URL file-access is disabled in the server configuration in /home/______/public_html/components/com_mobimaps/controller.php on line 173

    Warning: file_get_contents(http://maps.google.com/maps/api/geocode/xml?address=breziseanu+eugen%2C+targoviste&sensor=false) : failed to open stream: no suitable wrapper could be found in /home/______/public_html/components/com_mobimaps/controller.php on line 173

    Please help !

     
  • Johan Ekblad
    Johan Ekblad
    2011-11-02

    The error message says "URL file-access is disabled in the server configuration". Try to set:
    allow_url_fopen = On
    in your php.ini (If you are using LAMP the file is usually located in: /etc/php5/apache2/php.ini  then restart your apache webserver)

     
  • buiak
    buiak
    2011-11-03

    The reason allow_url_open is disabled is it can cause some security holes within the apache service running on my host. I'm thinking to change into scripts where that instead use cURL, as that php addon handles the same thing as allow_url_open but with better security and error handling. Can you assist me to make this changing ?

    Thank you in advance,

     
  • Johan Ekblad
    Johan Ekblad
    2011-11-03

    You have to change on four different places in three files (the files and row numbers are listed below):

    src/component/site/controller.php:173
    src/component/site/controller.php:263
    src/component/admin/models/mobimaps.php:152
    src/component/site/models/mobimap.php:870

    should work if you replace the rows (similar with):

    $context = stream_context_create(array('http' => array('timeout' =>5,),));
    $xmlRows=file_get_contents($theURL, false, $context);

    with:

    $curl = curl_init();
    curl_setopt($curl, CURLOPT_URL, $theURL);
    curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($curl, CURLOPT_TIMEOUT_MS, 5000);
    $xmlRows = curl_exec($curl);
    curl_close($curl);     

     
  • buiak
    buiak
    2011-11-03

    Thank you,
    I have Joomla 1.7.0 and MobiMaps 2.0.7

    Those files and code lines are diffrent in my files then your specified files and code lines.
    Please support me for this issue.

    Regards,

     
  • buiak
    buiak
    2011-11-03

    ok,

    for anyone who will need to resolve same issue with MobiMaps 2.07 under Joomla 1.7.0  :

    the files that must be modified are :
    1. /public_html/components/com_mobimaps/models    -> mobimap.php at line 1731 
    with :       $curl = curl_init();
    curl_setopt($curl, CURLOPT_URL, $flickrURL);
    curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($curl, CURLOPT_TIMEOUT_MS, 5000);
    $xmlRows = curl_exec($curl); curl_close($curl);

    2. /public_html/components/com_mobimaps   -> controller.php at line 339
    with :      $curl = curl_init();
    curl_setopt($curl, CURLOPT_URL, $googleURL);
    curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($curl, CURLOPT_TIMEOUT_MS, 5000);
    $xmlRows = curl_exec($curl); curl_close($curl);

    and at line 517 with :

                    $curl = curl_init();
    curl_setopt($curl, CURLOPT_URL, $googleURL);
    curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($curl, CURLOPT_TIMEOUT_MS, 5000);
    $xmlRows = curl_exec($curl); curl_close($curl);

    Thank you very much for your support and quick response johanekblad !
    Kind regards !