Go Back   vb.org Archive > vBulletin Modifications > Archive > vB.org Archives > vBulletin 3.7 > vBulletin 3.7 Add-ons

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
  #12  
Old 10-17-2008, 02:30 PM
MrEyes MrEyes is offline
 
Join Date: Nov 2004
Posts: 380
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

This is great, thankyou very much for providing this.

I have been looking at doing it myself but could not find a secure solution that would prevent people embedding any link. Looking at the javascript it looks like this solves that problem
Reply With Quote
  #13  
Old 10-17-2008, 06:34 PM
segwayon segwayon is offline
 
Join Date: Mar 2008
Posts: 152
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by skcyber View Post
hey guys, I got a problem using this wonderful code..

when I paste the html code (iframe...)

I have this message in the post :

Google
Error


Forbidden
Your client does not have permission to get URL /maps?f=q&hl=fr&geocode=&q=tour+eiffel+%20%20paris& ie=UTF8&ll=48.858072,2.294859&sp%20%20n=0.006295,0 .006295&output=embed&s=AARTsJr%20%20CvdyoV0AZQw6_B VqD495b8b0qyA from this server. (Client IP address: 82.238.112.139)
Me too.

As I recall, Google requires an API key on a server to dish out their maps. Any leads on this? I know their licensing levels for businesses is really steep.
Reply With Quote
  #14  
Old 10-17-2008, 06:51 PM
safakuygur's Avatar
safakuygur safakuygur is offline
 
Join Date: Sep 2007
Posts: 193
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

very nice
good
thanks
Reply With Quote
  #15  
Old 10-17-2008, 07:33 PM
segwayon segwayon is offline
 
Join Date: Mar 2008
Posts: 152
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

My first try was with a Google search on my town. It had one pin in the map. That URL got a permissions error from the Google server.

When I tried to paste in a URL with driving directions, it embedded the page, albeit in a small form, and with the driving directions hogging a lot of the IFRAME space. I can alter the scripts' width and height, but are there any pointers for embedding the map alone as showing on the Tinet.org website?
Reply With Quote
  #16  
Old 10-17-2008, 08:03 PM
segwayon segwayon is offline
 
Join Date: Mar 2008
Posts: 152
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I'm attaching a "gmap.gif" button which I made for this BB Code, if anyone wishes to use it.
Reply With Quote
  #17  
Old 10-17-2008, 08:36 PM
Leo Brazil's Avatar
Leo Brazil Leo Brazil is offline
 
Join Date: Dec 2007
Location: Brazil
Posts: 485
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by crkgb View Post
It iframes the entire page as I see. Is there a way to display just a map?
I could reproduce this situation here. It gave me the intire page if I use a link that comes for the first page when you open googlemaps, like your country. If you get a close up one it gave me only the map.

Quote:
Originally Posted by skcyber View Post
hey guys, I got a problem using this wonderful code..

when I paste the html code (iframe...)

I have this message in the post :

Google
Error


Forbidden
Your client does not have permission to get URL /maps?f=q&hl=fr&geocode=&q=tour+eiffel+%20%20paris& ie=UTF8&ll=48.858072,2.294859&sp%20%20n=0.006295,0 .006295&output=embed&s=AARTsJr%20%20CvdyoV0AZQw6_B VqD495b8b0qyA from this server. (Client IP address: 82.238.112.139)
I've got the same here. I don't know why but If use a code from anyplace in US it works fine but anything from out side like my country, it gives me the same error.
Any idea what could it be ?

If this problem can be solved this will be one of the best BBCode ever.

Tks
Reply With Quote
  #18  
Old 10-17-2008, 09:40 PM
skcyber skcyber is offline
 
Join Date: Nov 2005
Posts: 48
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Leo Brazil View Post
If this problem can be solved this will be one of the best BBCode ever.
yeah this would be the best BB code ever lol :up:

I tried with the USA, it's working, but it doesn't store the zoom on the street.
Reply With Quote
  #19  
Old 10-18-2008, 02:40 AM
segwayon segwayon is offline
 
Join Date: Mar 2008
Posts: 152
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I compared my HTML source with yours, and noticed that mine contains some extra space characters. Not sure if that matters or not, but here they are, represented by underline characters for ease of viewing:
  • &amp;__amp;t=h
  • &amp;a__mp;ll=38.1 . . .
  • &amp;amp;ou__tput=embed&quot; . . .
  • &amp;__amp;t=h
  • &amp;amp;so__urce=embed&quot; . . .

The URL source from Google didn't contain any of these extra space characters.

On another note, would you mind sharing how you acquired the URL from Google? Did you use the "My Maps" feature? And do just plain driving directions embedd a map, too? Or a whole webpage as it does for me?

Thanks!
Reply With Quote
  #20  
Old 10-18-2008, 02:55 AM
segwayon segwayon is offline
 
Join Date: Mar 2008
Posts: 152
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Leo Brazil View Post
I could reproduce this situation here. It gave me the intire page if I use a link that comes for the first page when you open googlemaps, like your country. If you get a close up one it gave me only the map.



I've got the same here. I don't know why but If use a code from anyplace in US it works fine but anything from out side like my country, it gives me the same error.
Any idea what could it be ?

If this problem can be solved this will be one of the best BBCode ever.

Tks
I noticed that using a URL of just a town's location returned the forbidden permissions error, but using a URL of driving directions of maybe 80 miles embeds a whole page. Update: Page embeds also for a 1.6 mile drive.
Reply With Quote
  #21  
Old 10-18-2008, 11:08 AM
saan saan is offline
 
Join Date: Aug 2004
Posts: 2
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thank you very much for this bb-code, but mostly I got this

saanAttachment 88262
Reply With Quote
Reply

Thread Tools

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:47 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.05494 seconds
  • Memory Usage 2,312KB
  • 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
  • (1)bbcode_code
  • (5)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
  • (3)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