vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB4 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=252)
-   -   Plugin Problem (https://vborg.vbsupport.ru/showthread.php?t=267044)

thunderclap82 07-18-2011 08:47 PM

Plugin Problem
 
I have a plugin working fine on one vB site (running 4.1.2) and when I try implementing the same plugin on another site (4.1.4) it crashes the system with an Internal Error. Here is the actual plug-in code:

The Product is vBulletin, the Hook Location is template_register_var and the Execution Order is 5.

Code:

$templater = vB_Template::create('banner_rotator');
$templatevalues['banner_rotator'] = $templater->render();
vB_Template::preRegister('header', $templatevalues);

It references a template I created called banner_rotator.

Like I said, on my vB 4.1.2 site it works fine but on the newer 4.1.4 site it crashes. I was wondering if there was something that vB updated that changes some of this code?

Lynne 07-18-2011 08:56 PM

Have you tried changing the Execution Order? Do you have any other modifications that use the same hook location? Have you tried disabling your other products (or even going one-by-one) to see if it is a problem between two mods that is causing the error?

I don't see anything obviously wrong with that code you posted.

thunderclap82 07-19-2011 01:06 AM

I tried changing the execution order to 1 and 10 and neither worked. No other mod uses that hook location, and I've tried disabling all mods as well as their plug-ins.

Is it possible something in the template that the plugin is calling at fault? (I did change the template name that's called in the plugin but that resulted in the same error.)

And here is the exact error message:

Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator, webmaster@[domain].com and inform them of the time the error occurred, and anything you might have done that may have caused the error.

More information about this error may be available in the server error log.

Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.

Apache mod_fcgid/2.3.6 mod_auth_passthrough/2.1 mod_bwlimited/1.4 FrontPage/5.0.2.2635 Server at www.repairmanjack.com Port 80

And I did check the error log and all I get is:

[Mon Jul 18 21:14:59 2011] [error] [client {IP ADDRESS}] File does not exist: /home/fpaul46/public_html/500.shtml

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

After some more digging this seems to be the actual error message when trying to activate the plugin:

[19-Jul-2011 00:51:15] PHP Warning: chdir() [<a href='function.chdir'>function.chdir</a>]: No such file or directory (errno 2) in /home/fpaul46/public_html/forum/index.php on line 38

This is the code in index.php:

Code:

chdir('./' . VB_RELATIVE_PATH);
Does that help at all?

Lynne 07-19-2011 05:30 PM

Actually, the full code there is:
PHP Code:

// Do not edit.
if (defined('VB_RELATIVE_PATH'))
{
    
chdir('./' VB_RELATIVE_PATH);


So, did you define VB_RELATIVE_PATH in the code above there? By default, it is commented out, so it shouldn't be defined and that line should never be evaled.

thunderclap82 07-19-2011 06:12 PM

Quote:

Originally Posted by Lynne (Post 2222498)
Actually, the full code there is:
PHP Code:

// Do not edit.
if (defined('VB_RELATIVE_PATH'))
{
    
chdir('./' VB_RELATIVE_PATH);


So, did you define VB_RELATIVE_PATH in the code above there? By default, it is commented out, so it shouldn't be defined and that line should never be evaled.

Nope. It's not defined as the index file in in the forum directory, and not the root.

kh99 07-19-2011 07:07 PM

That seems strange to me - why should something in a plugin affect code in index.php, and how is it even getting there? Maybe an include() or require() is loading the wrong file or something?

Does the same thing happen if you put some totally different code in the plugin?

thunderclap82 07-19-2011 09:09 PM

Quote:

Originally Posted by kh99 (Post 2222531)
That seems strange to me - why should something in a plugin affect code in index.php, and how is it even getting there? Maybe an include() or require() is loading the wrong file or something?

Does the same thing happen if you put some totally different code in the plugin?

I'm really not a programmer, just someone who can usually muddle his way through it. So I have no idea what else I can put in the plugin to test your idea.

I double checked with our host and this is what they said:

From the php code the plugin introduces, the following is causing the error:

$templatevalues['banner_rotator'] = $templater->render();


They asked me to double check the template code (I have) and it's the same as it is on the other site I run.

Lynne 07-19-2011 10:15 PM

And what is that template code? And are you sure that template exists in that style?

And what happens if you remove line 38 from your index.php page? Then what is the error in your error_log?

thunderclap82 07-19-2011 11:34 PM

Quote:

Originally Posted by Lynne (Post 2222613)
And what is that template code? And are you sure that template exists in that style?

Here is the mod which, incidentally, you helped me with. :) And the template is in the style.

https://vborg.vbsupport.ru/showthread.php?t=252398

Quote:

And what happens if you remove line 38 from your index.php page? Then what is the error in your error_log?
Same error page appears, but nothing appears in the log.

Lynne 07-20-2011 01:54 AM

Quote:

Originally Posted by thunderclap82 (Post 2222645)
Here is the mod which, incidentally, you helped me with. :) And the template is in the style.

https://vborg.vbsupport.ru/showthread.php?t=252398

But your template doesn't actually look like that unless you left "your URL" and "link to your image file" in there (which you should not have). So, exactly what does your template look like?


All times are GMT. The time now is 02:18 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.01049 seconds
  • Memory Usage 1,749KB
  • 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
  • (2)bbcode_code_printable
  • (2)bbcode_php_printable
  • (5)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