Topic: punBB integration code and function/classes

I have a problem when using punBB code inside functions/classes of my CMF - i get errors that something is not set/not present etc. What variables etc. should be in the global statement for it to work?

function foo()
    {
    global WHAT?;
    define('PUN_ROOT', 'punbb/');
    require PUN_ROOT.'include/common.php';
    IF($pun_user['group_id'] == 3)    return false;
    IF($pun_user['username'] == 'Guest')    return false;
    IF($pun_user['password'] == 'Guest')    return false;
    IF($pun_user['id'] == 1)    return false;
    return true;
    }
My site [PHP, Python, Linux]

Re: punBB integration code and function/classes

What kind of errors do you get?

"Programming is like sex: one mistake and you have to support it for the rest of your life."

Re: punBB integration code and function/classes

Fatal error: Call to a member function on a non-object in /opt/lampp/htdocs/html/punbb/functions.php on line 110

My site [PHP, Python, Linux]

Re: punBB integration code and function/classes

Try globalizing the variable $db.

"Programming is like sex: one mistake and you have to support it for the rest of your life."

Re: punBB integration code and function/classes

Notice: Undefined index: language in /opt/lampp/htdocs/html/punbb/include/common.php on line 120
There is no valid language pack '' installed. Please reinstall a language of that name.

smile

code:

function foo()
    {
    global $db;
    $lang_common = 'English';
    define('PUN_ROOT', 'pubb/');
    require PUN_ROOT.'include/common.php';
    print_r($pun_user);
    }
foo();

gives an empty array:

Array ( )
My site [PHP, Python, Linux]

Re: punBB integration code and function/classes

you might need go global $pun_user too (why are you putting this in a function?)

Re: punBB integration code and function/classes

I have my RkCMF which is Object oriented and 99,9% of the code (not counting index.php) is in classes and in the user class I want to add the punBB user data..... it works smile Now we can hack it more... CMF with punBB comming soon

My site [PHP, Python, Linux]