phpBB2Refugees.com Logo
Not affiliated with or endorsed by the phpBB Group

Register •  Login 

Continue the legacy...

Welcome to all phpBB2 Refugees!Wave Smilie

This site is intended to continue support for the legacy 2.x line of the phpBB2 bulletin board package. If you are a fan of phpBB2, please, by all means register, post, and help us out by offering your suggestions. We are primarily a community and support network. Our secondary goal is to provide a phpBB2 MOD Author and Styles area.

little problem after upgrading php to ver 5.3.27 from 5.3.13

Goto page 1, 2  Next
 
Search this topic... | Search phpBB2 Discussion... | Search Box
Register or Login to Post    Index » phpBB2 Discussion  Previous TopicPrint TopicNext Topic
Author Message
dondino
Board Member



Joined: 09 Dec 2008

Posts: 144


flag
PostPosted: Mon Dec 16, 2013 9:30 am 
Post subject: little problem after upgrading php to ver 5.3.27 from 5.3.13

Hello, about 1 month ago I decided to make a "little" upgrade server side
and so I upgraded the version of php to 5.3.27 (previous version installed 5.3.13)
I have noticed a little issue which I am actually not able to solve, and it is about a google maps mod installed in my board (named Phoogle Map).
I have tried to contact the original author (BassFace) but the email/site in the mod txt is not active anymore, and in phpbb forum he's not showing up anymore since 2010 icon_sad.gif
The problem is only in the phpbb registration page (and so also in the user profile), where there has always been a field in which a user can point and save its own location to the google map,
well, after making this little php upgrade the map in the registration page is not showing up anymore, replaced instead by a grey box as you can see here:

Image link

I have extracted all instances of Phoogle map inside user_register.php file:

Code:
// Phoogle Map
      $show_me = ( isset($HTTP_POST_VARS['show_me']) ) ? htmlspecialchars( $HTTP_POST_VARS['show_me'] ) : '0';
      $phooicon = ( isset($HTTP_POST_VARS['phooicon']) ) ? htmlspecialchars( $HTTP_POST_VARS['phooicon'] ) : '1';
// End Phoogle Map

// Phoogle Map
      $show_me = ( isset($HTTP_POST_VARS['show_me'])) ? htmlspecialchars( $HTTP_POST_VARS['show_me'] ) : $userdata['user_phoogle_show_me'];      
      $phooicon = ( isset($HTTP_POST_VARS['phooicon'])) ? htmlspecialchars( $HTTP_POST_VARS['phooicon'] ) : $userdata['user_phoogle_icon'];
// End Phoogle Map

// Phoogle Map
      $parens = array("(",")");
      $map_center = str_replace($parens, '', $map_center); // strip off '(' and ')'
      $map_center = stripslashes($map_center);
      $show_me = stripslashes($show_me);
      $phoocomm = stripslashes($phoocomm);
      $phooicon = stripslashes($phooicon);
// End Phoogle Map

// Phoogle Map
         $parens = array("(",")");
// End Phoogle Map

// Phoogle Map
   $parens = array("(",")");
   $map_center = str_replace($parens, '', $map_center); //// strip off '(' and ')'
   $map_center = stripslashes($map_center);
   $show_me = stripslashes($show_me);
   $phoocomm = stripslashes($phoocomm);
   $phooicon = stripslashes($phooicon);
// End Phoogle Map


// Phoogle Map
   $parens = array("(",")");
   $map_center = str_replace($parens, '', $userdata['user_phoogle_map_center']); // strip off '(' and ')'
   $show_me = $userdata['user_phoogle_show_me'];
   $phoocomm = $userdata['user_phoogle_comment'];
   $phooicon = $userdata['user_phoogle_icon'];
// End Phoogle Map

// Phoogle Map
// ---------------------------------------
// Bring in phoogle class
   include($phpbb_root_path . 'includes/phpbb_phoogle_class.'.$phpEx);
// sql for map config
   $sql_map_config = "SELECT *
                FROM " . PHOOGLE_CONFIG_TABLE;
   if( !($result_map_config = $db->sql_query($sql_map_config)) )
   {
      message_die(GENERAL_ERROR, 'Could not query Map Config', '', __LINE__, __FILE__, $sql_map_config);
   }
   while ( $mapConfig = $db->sql_fetchrow($result_map_config) )
   {
         $api_key = $mapConfig['api_key'];
         $map_width = $mapConfig['profile_map_width'];
         $width_measure = $mapConfig['profile_width_measure'];
         $map_height = $mapConfig['profile_map_height'];
         $height_measure = $mapConfig['profile_height_measure'];
         $show_control = $mapConfig['show_control'];
         $show_type = $mapConfig['show_type'];
         $control_type = $mapConfig['control_type'];
         $show_scale = $mapConfig['show_scale'];
         $show_overview = $mapConfig['show_overview'];
         $init_zoom = $mapConfig['init_zoom'];
         $user_zoom = $mapConfig['user_zoom'];
         $map_center_c = $mapConfig['map_center'];
         $marker_folder = $mapConfig['marker_folder'];
         $target_folder = $mapConfig['target_folder'];
   }
// Create a new map and show Zoom slider
   $userMap = new PhoogleMap();
   $userMap->setAPIKey("$api_key");
   $userMap->setWidth("$map_width");
   $userMap->setHeight("$map_height");
   $userMap->showControl = 'true';
   $userMap->controlType = 'small';
   $userMap->showType = 'true';
   $userMap->showScale = 'false';
   $userMap->showOverview = 'false';
   if(!empty($map_center))
   {
      $parens = array('(',')');
      $map_center = str_replace($parens, '', $map_center);
      $userMap->centerMap = "map.setCenter(new GLatLng($map_center), $user_zoom);";
   } else
   {
      $parens = array('(',')');
      $map_center_c = str_replace($parens, '', $map_center_c);
      $userMap->centerMap = "map.setCenter(new GLatLng($map_center_c), $user_zoom);";
   }
/**************************************************************************************************************************************/
// sql for map markers   
   $sql_map_markers = "SELECT marker_id, marker_image, marker_width, marker_height
                                 FROM " . PHOOGLE_MARKERS_TABLE;
   if( !($result_map_markers = $db->sql_query($sql_map_markers)) )
   {
      message_die(GENERAL_ERROR, 'Could not query Map Markers', '', __LINE__, __FILE__, $sql_map_markers);
   }
   while ( $mapMarker = $db->sql_fetchrow($result_map_markers) )
   {      
         $mid = $mapMarker['marker_id'];
         $marker[$mid]['id']          = $mapMarker['marker_id'];
         $marker[$mid]['image']          = $marker_folder.$mapMarker['marker_image'];
         $marker[$mid]['image_width']    = $mapMarker['marker_width'];
         $marker[$mid]['image_height']    = $mapMarker['marker_height'];
         $marker[$mid]['filename']      = $mapMarker['marker_image'];
   
   $template->assign_vars(array(
      "MARKER_".$mid             => $marker[$mid]['image'],
      "MARKER_".$mid."_WIDTH"    => $marker[$mid]['image_width'],
      "MARKER_".$mid."_HEIGHT"    => $marker[$mid]['image_height'],
      "MARKER_".$mid."_NAME"       => $marker[$mid]['filename']
   ));      
   }   
// End Phoogle Map

// Phoogle Map
      'API_KEY' => $api_key,
      'SHOW_ME_YES' => ( $show_me == 1 ) ? 'checked="checked"' : '',
          'SHOW_ME_NO' => ( $show_me == 0 ) ? 'checked="checked"' : '',
          'SHOW_CONFIRM_YES_DISPLAY' => ( $show_me == 1 ) ? 'block' : 'none',
          'SHOW_CONFIRM_NO_DISPLAY' => ( $show_me == 0 ) ? 'block' : 'none',
      'MAP_WIDTH' => $map_width,
      'WIDTH_MEASURE' => $width_measure,
      'MAP_HEIGHT' => $map_height,
      'HEIGHT_MEASURE' => $height_measure,
      'MAP_CENTER' => str_replace($parens, '', $map_center),
      'MARKER_FOLDER' => $phpbb_root_path.$marker_folder,
      'TARGET_FOLDER' => $phpbb_root_path.$target_folder,
      'PHOOGLE_COMMENT' => str_replace('<br />', "\n", $phoocomm),
      'PHOOGLE_ICON' => $phooicon,
      'MARKER_1_CHECKED' => ($phooicon == '1') ? 'checked="checked"' : '',
      'MARKER_2_CHECKED' => ($phooicon == '2') ? 'checked="checked"' : '',
      'MARKER_3_CHECKED' => ($phooicon == '3') ? 'checked="checked"' : '',
      'MARKER_4_CHECKED' => ($phooicon == '4') ? 'checked="checked"' : '',
      'MARKER_5_CHECKED' => ($phooicon == '5') ? 'checked="checked"' : '',
      'MARKER_6_CHECKED' => ($phooicon == '6') ? 'checked="checked"' : '',
      'MARKER_7_CHECKED' => ($phooicon == '7') ? 'checked="checked"' : '',
      'MARKER_8_CHECKED' => ($phooicon == '8') ? 'checked="checked"' : '',
      'MARKER_9_CHECKED' => ($phooicon == '9') ? 'checked="checked"' : '',
      'MARKER_10_CHECKED' => ($phooicon == '10') ? 'checked="checked"' : '',
      
      "PHOOGLE_SCRIPT" => $userMap->printGoogleJS(),
      "PHOOGLE_MAP" => $userMap->showMap(),
// End Phoogle Map


If needed, I attach also the file phpbb_phoogle_class.php which is a part of the mod involved and the original installation text file.

Can anyone help me in getting the map to show up again in the registration/profile page?
in all the other pages it is working, just in the registration/profile page disappeared icon_sad.gif
I never made any changes to any file beside just upgrading the php version, as written in topic.
This makes me believe it is probably about a deprecated php instruction generating this issue...

Thanks



phoogle_map_1.0.5_install.txt
 Description:
MOD Title: PHPBB_Phoogle_Maps ## Install TXT

Download
 Filename:  phoogle_map_1.0.5_install.txt
 Filesize:  60.82 KB
 Downloaded:  3079 Time(s)


phpbb_phoogle_class.zip
 Description:
Phpbb Phoogle Class php

Download
 Filename:  phpbb_phoogle_class.zip
 Filesize:  3.87 KB
 Downloaded:  591 Time(s)

Back to top
dondino
Board Member



Joined: 09 Dec 2008

Posts: 144


flag
PostPosted: Mon Dec 16, 2013 10:45 am 
Post subject: Re: little problem after upgrading php to ver 5.3.27 from 5.

I have made further researches and found out that the problem is not related to my php upgrade icon_sad.gif
but it is related to Google Maps API v2 which last month reached the End Of Life! icon_sad.gif

http://glodigital.com.au/blog/google-maps-api-v2-end-of-life

it seems there will be no solution unless someone has the skills to re-write the new class compatible with the V3 api icon_sad.gif
Back to top
dogs and things
Board Member



Joined: 18 Nov 2008

Posts: 621
Location: Spain


flag
PostPosted: Mon Dec 16, 2013 10:46 am 
Post subject: Re: little problem after upgrading php to ver 5.3.27 from 5.

Hi,

Are you sure you are still running php 5.3.x?

I guess this issue is related to whatAsavage mentions about htmlspecialchars in this post.

The fix for this is posted by him a few posts further on in that same thread.

See if adding the function htmlspecialchars_wrapped to your common.php and changing htmlspecialchars into htmlspecialchars_wrapped in the code related with your Phoogle map solves your issue.

If it does I suppose you will have more places in your board where the htmlspecialchars encoding change causes trouble.

Greetings. icon_wink.gif

_________________
phpBB2 will never die, I hope!
Back to top
dogs and things
Board Member



Joined: 18 Nov 2008

Posts: 621
Location: Spain


flag
PostPosted: Mon Dec 16, 2013 10:47 am 
Post subject: Re: little problem after upgrading php to ver 5.3.27 from 5.

Oops, I just read your follow-up.

It shouldn┤t be too hard to upgrade the Phoogle Map MOD from API V2 to API V3.

_________________
phpBB2 will never die, I hope!
Back to top
dondino
Board Member



Joined: 09 Dec 2008

Posts: 144


flag
PostPosted: Mon Dec 16, 2013 10:48 am 
Post subject: Re: little problem after upgrading php to ver 5.3.27 from 5.

dogs and things wrote:
Hi,

Are you sure you are still running php 5.3.x?

I guess this issue is related to whatAsavage mentions about htmlspecialchars in this post.

The fix for this is posted by him a few posts further on in that same thread.

See if adding the function htmlspecialchars_wrapped to your common.php and changing htmlspecialchars into htmlspecialchars_wrapped in the code related with your Phoogle map solves your issue.

If it does I suppose you will have more places in your board where the htmlspecialchars encoding change causes trouble.

Greetings. icon_wink.gif


hi dogs and things ... we wrote a new message at the same time!
i think that the problem is related to google api v2, last month it was disabled icon_sad.gif
Back to top
dogs and things
Board Member



Joined: 18 Nov 2008

Posts: 621
Location: Spain


flag
PostPosted: Mon Dec 16, 2013 10:49 am 
Post subject: Re: little problem after upgrading php to ver 5.3.27 from 5.

I edited my latest message, added a link to upgrade instruction for google maps api from v2 to v3.
_________________
phpBB2 will never die, I hope!
Back to top
dondino
Board Member



Joined: 09 Dec 2008

Posts: 144


flag
PostPosted: Mon Dec 16, 2013 10:56 am 
Post subject: Re: little problem after upgrading php to ver 5.3.27 from 5.

dogs and things wrote:
I edited my latest message, added a link to upgrade instruction for google maps api from v2 to v3.

i'm still not quite sure if the problem is really the api, because for example the page phoogle_map.php loads the map correctly.... I may try that htmlspecialchars snippet you were referring to

Image link
Back to top
dogs and things
Board Member



Joined: 18 Nov 2008

Posts: 621
Location: Spain


flag
PostPosted: Mon Dec 16, 2013 11:00 am 
Post subject: Re: little problem after upgrading php to ver 5.3.27 from 5.

I don't think it will be as easy as changing in phpbb_phoogle_class.php on line 116
Code:
// printGoogleJS: function | Adds the necessary Javascript for the Google Map to function should be called in between the html <head></head> tags
   function printGoogleJS()
   {
      echo "<script src=\"http://maps.google.com/maps?file=api&v=2.x&key=".$this->apiKey."\" type=\"text/javascript\"></script>";
   }

into
Code:
// printGoogleJS: function | Adds the necessary Javascript for the Google Map to function should be called in between the html <head></head> tags
   function printGoogleJS()
   {
      echo "<script src=\"//maps.googleapis.com/maps/api/js?key=".$this->apiKey."\" type=\"text/javascript\"></script>";
   }


If you don┤t think it's the API version used by Phoogle Maps then just try the htmlspecialchars fix from Asavage.

_________________
phpBB2 will never die, I hope!
Back to top
dondino
Board Member



Joined: 09 Dec 2008

Posts: 144


flag
PostPosted: Mon Dec 16, 2013 11:03 am 
Post subject: Re: little problem after upgrading php to ver 5.3.27 from 5.

thanks, will try and let you know icon_wink.gif
Back to top
dondino
Board Member



Joined: 09 Dec 2008

Posts: 144


flag
PostPosted: Mon Dec 16, 2013 11:11 am 
Post subject: Re: little problem after upgrading php to ver 5.3.27 from 5.

dogs and things,
are you able to tell me if the file phoogle_map.php I attach, uses the api v2 to show the map or it uses an ordinary google map link without the use of api?
because as you could see from my recent screenshot only on that page the map shows up...
while in both registration/profile and phoogle admin config page not anymore
and it's quite strange, cause otherwise map shouldn't appear in any place... am I right?

I don't think the problem is related to htmlspecialchars fix for php 5.4 as I am still using php 5.3 (rel. 27)



phoogle_map.zip
 Description:

Download
 Filename:  phoogle_map.zip
 Filesize:  6.21 KB
 Downloaded:  588 Time(s)

Back to top
dogs and things
Board Member



Joined: 18 Nov 2008

Posts: 621
Location: Spain


flag
PostPosted: Mon Dec 16, 2013 12:15 pm 
Post subject: Re: little problem after upgrading php to ver 5.3.27 from 5.

In the file phpbb_phoogle_class.php you attached earlier is defined what version of the API is used by Phoogle Maps. In the line I recommended you to change, to be precise.

I don't think different versions of the API are used in different places of your forum, at least the phoogle_map.php you post doesn┤t determine a google map version.

Try the htmlspecialchars fix I commented earlier, it is really easy to do and worth a try.

_________________
phpBB2 will never die, I hope!
Back to top
dondino
Board Member



Joined: 09 Dec 2008

Posts: 144


flag
PostPosted: Mon Dec 16, 2013 5:15 pm 
Post subject: Re: little problem after upgrading php to ver 5.3.27 from 5.

I just tried the snippet by asavage, related to a htmlspecialchars function fix, but sadly it didn't work icon_sad.gif

This problem is quite strange and at this point I don't even think it is related to the deprecated API v2
because in the "phoogle_map.php" page the map is showing up correctly.

When I open the profile page (which doesn't show the map) with IE I see the error:
Code:
Object does not support this property or method
profile.php
Line 1004. Char: 3. Code: 0
url: xxxxxxx/profile.php?mode=editprofile

looking at the html source, the involved part is this: *line 1004 is the one starting with "target.apply(document...*
Code:
// This little bit controls whether the target image is shown depending ======================
// on whether there is a div named phoogleTarget on the page or not ==========================
    if(document.getElementById('phoogleTarget') != null)
   {
      var target = new GControlPosition(G_ANCHOR_BOTTOM_LEFT, new GSize(193,93));
      target.apply(document.getElementById("phoogleTarget"));
      map.getContainer().appendChild(document.getElementById("phoogleTarget"));
   }
// =======================================================================================


When I look at the same part, in the page which is showing the map correctly (phoogle_map.php) and doesn't give any error in IE, I see this:
Code:
// This little bit controls whether the target image is shown depending ======================
// on whether there is a div named phoogleTarget on the page or not ==========================
    if(document.getElementById('phoogleTarget') != null)
   {
      var target = new GControlPosition(G_ANCHOR_BOTTOM_LEFT, new GSize(313,233));
      target.apply(document.getElementById("phoogleTarget"));
      map.getContainer().appendChild(document.getElementById("phoogleTarget"));
   }
// =======================================================================================

in the admin configuration page instead, the part of the code is identical to the one working above, but the map instead its not showing!!
Code:
// This little bit controls whether the target image is shown depending ======================
// on whether there is a div named phoogleTarget on the page or not ==========================
    if(document.getElementById('phoogleTarget') != null)
   {
      var target = new GControlPosition(G_ANCHOR_BOTTOM_LEFT, new GSize(313,233));
      target.apply(document.getElementById("phoogleTarget"));
      map.getContainer().appendChild(document.getElementById("phoogleTarget"));
   }
// ========================================================================================

Image link

I have no idea of what is causing this problem but I am sure it is somehow related to the php recent upgrade (although still 5.3.xx) as I am 100% sure that the map was always displaying before, and I never touched any core files since years icon_sad.gif

maybe when I did the easy_apache update I forgot to install a specific php extension? but I don't think so... since in the phoogle_map.php the map shows up...
it just doesn't show up in registration page, profile page... admin page...
Back to top
dogs and things
Board Member



Joined: 18 Nov 2008

Posts: 621
Location: Spain


flag
PostPosted: Mon Dec 16, 2013 6:09 pm 
Post subject: Re: little problem after upgrading php to ver 5.3.27 from 5.

Place this
Code:
error_reporting(-1);
ini_set('display_errors', '1');

at the top of your usercp_register.php, after the opening <?php and see what errors are shown on your registration form.

Did you do the fix by Asavage correctly?

You need to place the snippet he posted at the end of your common.php, before the closing ?>

And then you need to change al instances of htmlspecialchars in your usercp_register.php realted to the Phoogle map, like this:
Code:
// Phoogle Map
      $show_me = ( isset($HTTP_POST_VARS['show_me']) ) ? htmlspecialchars_wrapped( $HTTP_POST_VARS['show_me'] ) : '0';
      $phooicon = ( isset($HTTP_POST_VARS['phooicon']) ) ? htmlspecialchars_wrapped( $HTTP_POST_VARS['phooicon'] ) : '1';
// End Phoogle Map

// Phoogle Map
      $show_me = ( isset($HTTP_POST_VARS['show_me'])) ? htmlspecialchars_wrapped( $HTTP_POST_VARS['show_me'] ) : $userdata['user_phoogle_show_me'];     
      $phooicon = ( isset($HTTP_POST_VARS['phooicon'])) ? htmlspecialchars_wrapped( $HTTP_POST_VARS['phooicon'] ) : $userdata['user_phoogle_icon'];
// End Phoogle Map

_________________
phpBB2 will never die, I hope!
Back to top
dondino
Board Member



Joined: 09 Dec 2008

Posts: 144


flag
PostPosted: Mon Dec 16, 2013 7:54 pm 
Post subject: Re: little problem after upgrading php to ver 5.3.27 from 5.

dogs and things wrote:
Code:
error_reporting(-1);
ini_set('display_errors', '1');


after placing the code above I get really a long long list of notices and Strict Standards, due to the massive amount of mods I have installed.
The only notices related to phoogle mod are the following three entries:

Code:
Notice: Undefined variable: phoocomm in /****/includes/usercp_register.php on line 268

Notice: Undefined variable: phoocomm in /****/includes/includes/usercp_register.php on line 2780

Notice: Undefined index: Phoogle_Get in /****/includes/usercp_register.php on line 2981


In order:
Code:
Line 268
   validate_optional_fields($icq, $aim, $msn, $yim, $website, $location, $occupation, $interests, $signature, $user_away_status, $user_away_message, $user_away_date, $map_center, $phoocomm, $skype, $myspace);


Code:
Line 2780
      'PHOOGLE_COMMENT' => str_replace('<br />', "\n", $phoocomm),


Code:
Line 2981
      'L_PHOOGLE_GET' => $lang['Phoogle_Get'],


About the asavage fix... yes, I applied that correctly, exactly as described.
I have also cleared the cache just to make sure...
It had no effect.

I am thinking.... could the problem be related to that (javascript?) blinking red target symbol which is the only thing NOT included in the phoogle_map.php page which is instead working?
That target is used just in the registration/profile page to center the map by positioning the chosen location over that target. Originally it stays always in the center of the map, but now that the map doesn't show up it is at the bottom, out of the grayed box...
It is also in the admin page (where also the map doesn't work), see screenshot in my previous message, it was just less visible because when i took the screenshot it was blinking in yellow, but it's there.

Image link
Back to top
Salvatos
Board Member



Joined: 19 Feb 2009

Posts: 428
Location: Qu├ębec


flag
PostPosted: Mon Dec 16, 2013 8:16 pm 
Post subject: Re: little problem after upgrading php to ver 5.3.27 from 5.

Interesting puzzle. I'd like to compare the HTML sources for your phoogle_map.php and any of the pages where the map doesn't work, please.
Back to top
Display posts from previous:   
Register or Login to Post    Index » phpBB2 Discussion  Previous TopicPrint TopicNext Topic
Page 1 of 2 All times are GMT
Goto page 1, 2  Next
 
Jump to:  

Index • About • FAQ • Rules • Privacy • Search •  Register •  Login 
Not affiliated with or endorsed by the phpBB Group
Powered by phpBB2 © phpBB Group
Generated in 0.0368 seconds using 17 queries. (SQL 0.0023 Parse 0.0025 Other 0.0320)
phpBB Customizations by the phpBBDoctor.com
Template Design by DeLFlo and MomentsOfLight.com Moments of Light Logo