PDA

View Full Version : Accessing vBulletin Classes - global.php


Deviation
09-21-2005, 06:03 PM
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:

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.

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
error_reporting(E_ALL & ~E_NOTICE);

Deviation
09-21-2005, 06:24 PM
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.


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:

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

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
Is this the whole script or is there more?
What you see is all I have.

The php file resides in:
/home/username/public_html/forumtest/vBTest/test.php

The forum is in:
/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
$user = $vbulletin->db->query_first("

an line 4279
$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
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?

Deviation
10-28-2005, 12:51 AM
I'm having the same problem... what minor change did you make?
All I did was download a fresh copy of 3.5 and FTP the files up to the site. I didn't do anything else.

It was an odd issue.