vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3.7 Add-ons (https://vborg.vbsupport.ru/forumdisplay.php?f=228)
-   -   BB Code Enhancements - Google maps BBCode (https://vborg.vbsupport.ru/showthread.php?t=193760)

oasi 10-15-2008 10:00 PM

Google maps BBCode
 
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:

http://forums.tinet.org/images/usmapes.jpg

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! :)

GreasySpoon 10-16-2008 10:55 AM

What kind of HTML code can be added? Every?

oasi 10-16-2008 11:43 AM

No, it's to insert google maps references.

The javascript checks you're introducing a valid maps.google URL.

Into the image,the code you must paste is shown....

robbiefritz 10-16-2008 11:47 AM

Super!

Leo Brazil 10-16-2008 03:34 PM

Dude, this is awsome !!!

Let's see how it goes (intalling right now) and get back for a feedback.

Good job.

Feign 10-16-2008 04:11 PM

Very good. Was looking for this a few weeks ago. This seems to work for all manner of Google Maps, including the "route" type ones which is good for planning weekend cruises!

sensimilla 10-16-2008 07:38 PM

Any demo ? TIA

crkgb 10-16-2008 07:53 PM

It iframes the entire page as I see. Is there a way to display just a map?

oasi 10-17-2008 05:05 AM

As far as I know, it only iframes the map, if you tested and it appeared all the page, please send how you did it to parse this case....

Here is an example (it's in our local language, but the map is the map XD)

http://forums.tinet.org/showthread.php?t=103

skcyber 10-17-2008 12:30 PM

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_BVqD495b8b0 qyA from this server. (Client IP address: 82.238.112.139)


All times are GMT. The time now is 11:18 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.01685 seconds
  • Memory Usage 1,738KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)bbcode_code_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (1)pagenav_pagelinkrel
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.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/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.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
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete