vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   Accessing vBulletin Classes - global.php (https://vborg.vbsupport.ru/showthread.php?t=96668)

Deviation 09-21-2005 06:03 PM

Accessing vBulletin Classes - global.php
 
Ok. According to the few posts I've read this should be easy. Fo whatever reason I can't get this to work for me.

Let's say I have a directory under the forum called vBTest.
/forumtest/vBtest
In that directory I have a file called test.php. Here's the basic code for that file:
PHP Code:

        error_reporting(E_ALL);
        
define('NO_REGISTER_GLOBALS'1);
        
define('THIS_SCRIPT''vBTest');

        
$phrasegroups = array();
        
$globaltemplates = array();
        
$actiontemplates = array();
        
$specialtemplates = array();
        
        
chdir('/home/username/public_html/forumtest');
        
        require_once(
'./global.php'); 

Just requiring global.php throws the following errors.

Code:

Notice: Undefined index: HTTP_REFERER in /home/username/public_html/forumtest/includes/class_core.php on line 1500

Notice: Undefined index: url in /home/username/public_html/forumtest/includes/class_core.php on line 1905

Notice: Undefined index: HTTP_REFERER in /home/username/public_html/forumtest/includes/class_core.php on line 1911

Fatal error: Call to a member function on a non-object in /home/username/public_html/forumtest/includes/functions.php on line 1545

Fatal error: Call to a member function on a non-object in /home/username/public_html/forumtest/includes/functions.php on line 4279

I'm obviously missing something simple here. I see there's a few NOTICEs, so perhaps I didn't define something I should have??

I searched the forums, but I couldn't really find anything. I'm just piecing various bits of info to try this out. i'm good with PHP/mySQL, but I've never done a vB hack/plugin/extension.

Hopefully someone can help me out. :nervous:

Marco van Herwaarden 09-21-2005 06:22 PM

PHP Code:

error_reporting(E_ALL & ~E_NOTICE); 


Deviation 09-21-2005 06:24 PM

Quote:

Originally Posted by MarcoH64
PHP Code:

error_reporting(E_ALL & ~E_NOTICE); 


That supresses the NOTICE errors, but it won't 'fix' the others. I set it to E_ALL to see what I might have missed. It did change the errors I get now.

Code:

Fatal error: Call to a member function on a non-object in /home/username/public_html/forumtest/includes/functions.php on line 988

Fatal error: Call to a member function on a non-object in /home/username/public_html/forumtest/includes/functions.php on line 4279

Thoughts?

Reven 09-21-2005 09:20 PM

If you've just copied and pasted an example of your webspace path relative to the server, then the 'username' bit is probably supposed to be changed to your own webspace username:

PHP Code:

chdir('/home/USERNAME - CHANGE/public_html/forumtest'); 

This is most likely the problem because the PHP parser can't find what you want it to find - meaning it's either not there, or you've specified the wrong path.

Deviation 09-22-2005 07:52 PM

Quote:

Originally Posted by Reven
If you've just copied and pasted an example of your webspace path relative to the server, then the 'username' bit is probably supposed to be changed to your own webspace username:

PHP Code:

chdir('/home/USERNAME - CHANGE/public_html/forumtest'); 

This is most likely the problem because the PHP parser can't find what you want it to find - meaning it's either not there, or you've specified the wrong path.

I just altered that for posting here. It seems to find the files, but as you can see from the errors, it doesn't like the function that's being called. It seems like I'm following all the other examples I've seen on this site.

Is there some reference material for vBulletin? You'd think there would be an SDK provided from vBulletin. *sigh*

Man this is frustrating.

Marco van Herwaarden 09-22-2005 07:59 PM

Is this the whole script or is there more?

Deviation 09-23-2005 12:40 AM

Quote:

Originally Posted by MarcoH64
Is this the whole script or is there more?

What you see is all I have.

The php file resides in:
Code:

/home/username/public_html/forumtest/vBTest/test.php
The forum is in:
Code:

/home/username/public_html/forumtest/
Any other ideas??:disappointed: Is there something simple I can echo out on this page to test it?

Here's line 988 of functions.php
PHP Code:

    $user $vbulletin->db->query_first(

an line 4279
PHP Code:

    $vbulletin->db->unlock_tables(); 

Do I need to do something with $vbulletin or $db??

Marco van Herwaarden 09-23-2005 11:25 AM

No, you don't need to do anything with that at all, asuming your includes/config.php is correct (ie. your board working normal).

Deviation 09-23-2005 08:27 PM

Quote:

Originally Posted by MarcoH64
No, you don't need to do anything with that at all, asuming your includes/config.php is correct (ie. your board working normal).

Its functioning fine. This makes no sense. I have to be missing something.

I checked for suspect files and everything checked OK.

Not real sure what I did, but its working now.

I downloaded a fresh copy of 3.5 and FTP'd the files. Ran my test file. Didn't work. Looked up some others extensions to see what they did. Made a minor change and it worked. Undid the change and it still works... :lol:

Oh well. Thanks for the help.

Gellpak 10-28-2005 12:47 AM

I'm having the same problem... what minor change did you make?


All times are GMT. The time now is 11:48 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.01087 seconds
  • Memory Usage 1,756KB
  • 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
  • (4)bbcode_code_printable
  • (7)bbcode_php_printable
  • (4)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)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