vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   Errors when including global.php (https://vborg.vbsupport.ru/showthread.php?t=91514)

Xia 07-03-2005 03:39 PM

Ok, so I have changed the code to :

PHP Code:

<?php
function test() {
    global 
$phrasegroups;
    global 
$specialtemplates;
    global 
$globaltemplates;
    global 
$actiontemplates;

    
chdir('/home/wa/public_html/forum/');
    
$phrasegroups = array();
    
$specialtemplates = array();
    
$globaltemplates = array();
    
$actiontemplates = array();
    require_once(
'./global.php');
}

test();
?>

But it still doesn't work :(

Xia 07-04-2005 06:01 PM

anyone ? :s

Xia 07-06-2005 11:03 AM

No replies, does this mean it's impossible to do??

merk 07-06-2005 12:05 PM

it just means noone has a solution to fix your problem.


Now that I've read your requirements, no. you will not be able to do this to use it inside a class.

It is still possible, and since you're already mucking around with classes i dont see why you'd need help to copy the data_managers init function to make it work.

you will need to reproduce init.php's behaviour to initialise any variables the datamanager requires.

Xia 07-07-2005 06:21 AM

I'll look into that, thanks!

Btw, is there also a login function in that class or anywhere else which I can easily use from outside Vb? That would be very nice.

merk 07-07-2005 06:23 AM

im not sure. if there is one itll be in /includes/.

johnobandalong 03-15-2006 12:19 AM

I'm having this problem too. Did anybody find a solution? How do other people integrate vbulletin with their application?

kolita 04-14-2006 10:44 PM

Hi Xia,

(Hope is not too late.. well, it will serve someone else if it's too late for you :))

Here's the code to get an instance of vbulletins' registry object (a.k.a $vbulletin).

I've placed toghether a couple pieces from various threads here in vb.org (including some of them from this same one, and from https://vborg.vbsupport.ru/showthread.php?t=112388)

You can place the function as a method in your class and call it statically like:
PHP Code:

$vbInstance = &yourClass::_getVbulletinRegistryInstance() 

(remember to use '=&', not just '=' here :))

I've successfully tested this and used a datamanager, and it worked perfectly (created thread and post correctly :-D)

This follows a singleton pattern, so you'll never overwrite the instance, even if the instance was created by vB itself.

PHP Code:

function &_getVbulletinRegistryInstance() {
    
define('SKIP_SESSIONCREATE'1);
    
define('DIE_QUIETLY'1);
    
define('THIS_SCRIPT''vbSupport');
    
$GLOBALS['phrasegroups'] = array();
    
$GLOBALS['specialtemplates'] = array();
    
$GLOBALS['globaltemplates'] = array();
    
$GLOBALS['actiontemplates'] = array();

    
$cwd getcwd();
    
chdir($_SERVER['DOCUMENT_ROOT'].'/forum'); 

    if (!isset(
$GLOBALS['vbulletin'])) {
        include_once(
'./includes/init.php');
        
$GLOBALS['vbulletin'] = &$vbulletin;
    }
    
chdir($cwd);

    return 
$GLOBALS['vbulletin'];


regards!

Markus

Hammon 05-10-2006 12:27 PM

Quote:

Why isn't it possible to create a session? I would like to display the username on an external website if a user is logged in in the forum.
No one has the answer? I'm interested me too.

bradsears 05-18-2006 03:51 PM

I'm struggling with this as well. Please help.


All times are GMT. The time now is 01:23 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.01123 seconds
  • Memory Usage 1,746KB
  • 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
  • (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