vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB4 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=252)
-   -   PHP-direct eval problems [Solved] (https://vborg.vbsupport.ru/showthread.php?t=261817)

janaf 04-14-2011 08:04 AM

1 Attachment(s)
I have tried adding on the top of my code:
PHP Code:

$vbulletin->options['nocache'] = 1

But it behaves as before: code works if global caching is disabled only.

There is also a caching timeout setting (which I set to 0) for each php-direct-eval (se attachment) but it does not seem to have any effect.

This is also abut as far as I got also half a year ago when I took a shot at this. Then Lynne and others helped too, but I never got to get things fully working. Actually there was a hack that seemd to work but of course I forgot to update with new vB versions:
https://vborg.vbsupport.ru/showthread.php?t=251402
..and it seem that hack is obsolete, vB code and variable names have changed since then.

So should this be reported as a bug / update request?

I'd realy like this solved once for all. Would you suggest I rewrite this as a product (never done that before) or widget (never done that before) or is there a fix in site?

Lynne 04-14-2011 04:10 PM

I would put this in as a bug. The cache refresh time being set to 0 does not seem to be working at all. If I set it to 1, it works the first time. If I set it to something like .1, then it doesn't work and if I go to edit the article again, then that value is changed to 0. I have a feeling 0 means just cache the darned thing, forget about the setting, instead of actually meaning 0 caching.

I does work for me if I also use the plugin I wrote above.

janaf 04-14-2011 06:13 PM

Thanks for the feedback Lynne. I have made a bug report.

SkyStryder 04-14-2011 07:31 PM

Hi, I have verified the bug and the cache plugin that Lynne wrote and that is
all working. My current problem is I am trying to move some php programs into
PHP-direct eval. They all have session_start(); and then manipulate $_SESSION.
This appears not to be working. Could someone explain what I need to do the
keep session variables for a php direct eval program? Thank you!

Lynne 04-14-2011 09:05 PM

You should start your own thread and post exactly what you are entering into the php direct eval text form so we can see what is going on.

janaf 04-15-2011 08:26 AM

For other newbs out there this is what I finally did:

Added to my php-direct-eval POST form:
PHP Code:

<input type="hidden" name="nocache" value="yes" /> 

then added to the file /forum/includes/init.php under the init_stratup (near line 330 in unmodded vb 4.1.3)

PHP Code:

if ($_POST['nocache']=='yes')
{
$vbulletin->options['nocache'] = 1;


Now the code works with caching enabled and one just needs to remember this fix on future vb updates :)

SkyStryder 04-15-2011 07:50 PM

That is the idea of putting it into a plugin. Then repatching software
is not necessary. Just create the plugin and insert your code. Then
make sure the plugin is active. Hope this helps.

janaf 04-15-2011 08:14 PM

Quote:

Originally Posted by rickf (Post 2185064)
That is the idea of putting it into a plugin. Then repatching software
is not necessary. Just create the plugin and insert your code. Then
make sure the plugin is active. Hope this helps.

Thanks Rickf

Never done that. Is there a newbie primer on plugins :)

Ah found it!

Really simple to use IF you know which hooks to use.

SkyStryder 04-16-2011 04:21 PM

Fortunately, Lynne mentioned it above. For this one,
use hook location - init_startup

janaf 04-26-2011 08:13 AM

This could possibly related to that I had Apache KeepAlive disabled:

http://tracker.vbulletin.com/browse/VBIV-7712

I have enabled KeepAlive now, and things like POST seem to work better with php-direct-eval but I have not dug into details yet.

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

I have done some more tests and it seems that both the POST problem and the security token issues where solved simply by enabling Apache KeepAlive (which is the default setting for Apache).


All times are GMT. The time now is 11:04 AM.

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.01093 seconds
  • Memory Usage 1,740KB
  • 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
  • (3)bbcode_php_printable
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (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