vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   Prevent a plugin from running bassed on url/script (https://vborg.vbsupport.ru/showthread.php?t=181508)

h2ojunkie 06-04-2008 04:04 PM

Prevent a plugin from running bassed on url/script
 
I've been working with a plugin that runs on attachment.php at the attachment_start hook.

I'm looking for a way to prevent this plugin from executing when a user is viewing showthread.php or showpost.php.

For example, a user embeds a attachment image in a post using "http://www.mydomain.com/forum/attach...5&d=1212540637" I don't want the plugin to run.

I've tried using a this_script conditional to check for showthread or showpost, however that isn't working. I'm not an expert at this, but my assumption is this_script won't work because even though they are viewing showthread, attachment.php is still called in the link which makes this_script = attachment.

Can anyone suggest another way to prevent the plugin from running in this situation?

Thanks in advance!

Dismounted 06-05-2008 07:27 AM

Check the referrer - although this can be forged, I don't think you really care for this purpose.

h2ojunkie 06-05-2008 03:15 PM

Checking the referrer won't work in this case since that would disable the plugin any time they clicked a link to view a full size of the attached image as well as disabling it when embedded with the image tag.

Paul M 06-05-2008 03:31 PM

If this_script doesnt work then how about defining your own constant in the showthread and showpost start hooks, and then checking for that in the attachment start hook.

h2ojunkie 06-05-2008 05:57 PM

I didn't think a constant defined in showthread would get passed though to the attachment script..I'll have to give that a try.

--------------- Added [DATE]1212703778[/DATE] at [TIME]1212703778[/TIME] ---------------

Gave the define a try, and as I suspected same problem as this_script

The define made in showthread start hook, isn't passed on to the attachment start hook

back to the drawing bored


All times are GMT. The time now is 07:12 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.00905 seconds
  • Memory Usage 1,713KB
  • 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)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (5)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
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete