Go Back   vb.org Archive > vBulletin Modifications > Archive > vB.org Archives > vBulletin 3.7 > vBulletin 3.7 Add-ons
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools
Google maps BBCode Details »»
Google maps BBCode
Version: 1.1, by oasi oasi is offline
Developer Last Online: Dec 2008 Show Printable Version Email this Page

Category: BB Code Enhancements - Version: 3.7.x Rating:
Released: 10-15-2008 Last Update: Never Installs: 86
Re-useable Code Translations Is in Beta Stage  
No support by the author.

Hi all

I've made a Custom BBcode to be able to insert any kind of google map into the forum posts, so the Plugins I tried were'nt working as we expected.

I post the code, I hope it can be useful for anyone.

Security problems, improvements and tunning will be apreciated...

I used the tag [gmap], and inside you have to copy the code for the HTML inclusion you can copy when you click the link icon in the map:



Code:
<script type="text/javascript">
function ckURL()
  {   if ((u.indexOf("http://")!=u.lastIndexOf("http://"))||u.lastIndexOf("http://")!=0){return false;}
      if (u.indexOf('"')>=0) {return false;}
      if (u.indexOf("http://maps.google")!=0){return false;}
      return true;
  }

t='';incr=0;t_i="{param}";
t_n_q=t_i.replace(/&quot;/g,'"');

if(t_n_q.indexOf("91;url")>0)
{ if(t_n_q.indexOf('91;url="')>0){t=t_n_q.substr(t_n_q.indexOf('91;url="')+8,t_n_q.length);t_n_q='';}
  if(t_n_q.indexOf('91;url=')>0) {t=t_n_q.substr(t_n_q.indexOf('91;url=')+7,t_n_q.length);t_n_q='';a=t.replace(/93;/g,'"');t=a;incr=2;}
  if(t_n_q.indexOf('91;url')>0)  {if (t_n_q.indexOf('93;')==(t_n_q.indexOf('91;url')+8)){t=t_n_q.substr(t_n_q.indexOf('91;url')+11,t_n_q.length);a=t.replace(/91;/g,'"');t=a;}}
}
else
{ t=t_n_q.substr(t_n_q.indexOf('src="')+5,t_n_q.length);}
u=t.substr(0,t.indexOf('"')-incr);
up=u.replace(/amp;/g,'');u=up;

if (ckURL())
{ document.write('<iframe width="640" height="480" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="'+u+'"></iframe>');}
else
{document.write("<p><b>Wrong map URL, edit the post to change it.</b></p>Reload the page when finished to check if correct.");}
</script>
The others settings for the BBCode are:

Use {option}: -> No
Remove Tag If Empty -> Yes
Disable BB Code Within This BB Code -> Yes
Disable Smilies Within This BB Code -> Yes
Disable Word Wrapping Within This BB Code ->Yes

Please, mark as installed if it worked and you are using it.

Hope it helps!

Show Your Support

  • This modification may not be copied, reproduced or published elsewhere without author's permission.

Comments
  #112  
Old 05-18-2009, 06:48 AM
Sunka Sunka is offline
 
Join Date: Mar 2008
Location: Croatia
Posts: 400
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hmmm.
On Google Maps, you choose LINK and then copy Paste HTML to embed in website
This is code for Zagreb on Google maps:

Code:
<iframe width="425" height="350" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="http://maps.google.com/?ie=UTF8&amp;ll=45.786679,15.930176&amp;spn=0.387841,0.839081&amp;t=h&amp;z=10&amp;output=embed"></iframe><br /><small><a href="http://maps.google.com/?ie=UTF8&amp;ll=45.786679,15.930176&amp;spn=0.387841,0.839081&amp;t=h&amp;z=10&amp;source=embed" style="color:#0000FF;text-align:left">View Larger Map</a></small>

If this code I use on my forum with [ gmap ] [ /gmap ] all is OK
Reply With Quote
  #113  
Old 06-05-2009, 05:44 PM
Sportsriders Sportsriders is offline
 
Join Date: Sep 2008
Posts: 17
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I found the IE issue is related to this

{ document.write('<iframe width="640" height="480" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="'+u+'"></iframe>');}

with this you can see the map but it messes with the php


{ document.write('<iframe width="640" height="480" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="'+u+'"</iframe>');}

So it is a formatting in the above line in BOLD that is causing the IE issues. Not yet worked out what is the actual issue.
Reply With Quote
  #114  
Old 06-07-2009, 12:04 AM
ricardoNJ ricardoNJ is offline
 
Join Date: Sep 2008
Posts: 295
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks a lot!!!!
Reply With Quote
  #115  
Old 06-07-2009, 03:07 PM
Sportsriders Sportsriders is offline
 
Join Date: Sep 2008
Posts: 17
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Some more information

Internet Explored adds [URL] tags to the Google code and this causes the map not to
show. You see
"Wrong map URL, edit the post to change it. Reload the page when finished to check if correct."

You need to edit the [URL] tags out. Firefox and Chrome do not add these tags when
posting the Google code.
Reply With Quote
  #116  
Old 06-07-2009, 03:32 PM
Sportsriders Sportsriders is offline
 
Join Date: Sep 2008
Posts: 17
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

And more..................

If you can see WHITE where the map should be in IE, then Refreshing the page with the <REFRESH>
button will not cause the map to show. HOWEVER right clicking on where the map should be and selecting
REFRESH will cause the map to show.

I noticed that IE will show the map only the first time the page with the map is accessed. After that it will
not load the map the next time the page is loaded ( unless you use the above mentioned refresh ).
Reply With Quote
  #117  
Old 06-07-2009, 03:48 PM
Sportsriders Sportsriders is offline
 
Join Date: Sep 2008
Posts: 17
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I wonder is someone with code experience could modify the script to detect if IE is the
browser and if so detected, refresh the frame twice and also remove any URL /URL
tags from betten the GAMP /GMAP tags.
Reply With Quote
  #118  
Old 06-07-2009, 03:53 PM
Sportsriders Sportsriders is offline
 
Join Date: Sep 2008
Posts: 17
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Sunka View Post
This is work for me in vBulletin v3.8.2

Code:
<script type="text/javascript">
function checkURL()
  {
      if ((url.indexOf("http://")!=url.lastIndexOf("http://"))||url.lastIndexOf("http://")!=0){return false;}
      if (url.indexOf('&quot')>=0) {return false;}
      if (url.indexOf("http://maps.google")!=0){return false;}
      return true
  }

tot='{param}';
tot=tot.substr(tot.indexOf("src=&quot;")+10,tot.length);
url=tot.substr(0,tot.indexOf("&quot;"));
urlp=url.replace(/;amp;/g,';');
url=urlp;

if (checkURL())
{   
    document.write('<iframe width="640" height="480" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="'+url+'"></iframe>');
}
else
{
document.write("<p><b>Wrong map URL, edit the post to change it.</b></p>Reload the page when finished to check if correct.");
}
</script>
This worked for me when I used Firefox to do add the BBcode. But strangely, when I used
IE it did not work.
Reply With Quote
  #119  
Old 06-08-2009, 08:10 AM
hytram hytram is offline
 
Join Date: Nov 2007
Posts: 3
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

thanks for great Mod..

It been working fine for a few weeks and today we have hit a glitch, I think its always been there but only showed up today

until now all [gmap] code has been in threads started by one of 2 Admins, members have replied with maps and they have showed up with no problems. Today a supermod posted a map in his own thread and it errored and didnt show up, Even if an Admin post a [gmap] in that thread it wouldnt show up. Cut and paste the same code into a Admin started thread, it works fine

doing the research on my forum, Admins have HTML turned on, no one else does, I dont want to turn it on if I can help it.

will turning HTML on for everyone but turn HTML code of be safe?

I will do some more testing, but I wont be near a puter for the next 24hr

any thoughts or ideas?

ta

Marty
Reply With Quote
  #120  
Old 06-09-2009, 12:29 AM
Sportsriders Sportsriders is offline
 
Join Date: Sep 2008
Posts: 17
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by hytram View Post
thanks for great Mod..

until now all [gmap] code has been in threads started by one of 2 Admins, members have replied with maps and they have showed up with no problems. Today a supermod posted a map in his own thread and it errored and didnt show up, Even if an Admin post a [gmap] in that thread it wouldnt show up. Cut and paste the same code into a Admin started thread, it works fine

doing the research on my forum, Admins have HTML turned on, no one else does, I dont want to turn it on if I can help it.

will turning HTML on for everyone but turn HTML code of be safe?

I will do some more testing, but I wont be near a puter for the next 24hr

any thoughts or ideas?

ta

Marty
Every thing I have read suggests keep HTML turned off for the forums. I am admin on
my forum and I do not have HTML turned on and my users can post maps.

You should post up the error message.
Reply With Quote
  #121  
Old 06-09-2009, 11:28 AM
hytram hytram is offline
 
Join Date: Nov 2007
Posts: 3
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

there is no error message, just nothing..blank
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 03:22 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.04985 seconds
  • Memory Usage 2,319KB
  • Queries Executed 25 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (3)bbcode_code
  • (2)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (6)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (1)pagenav_pagelinkrel
  • (11)post_thanks_box
  • (11)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (11)post_thanks_postbit_info
  • (10)postbit
  • (11)postbit_onlinestatus
  • (11)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete