1 (edited by rs324 2010-09-05 22:06)

Topic: Integration Bug or something

Hi ,

im using MVC desgin pattren for my website

so each page on my website is executed via controller->function

no common.php is breaking out if you include it under function

i took plain php page and i wrote :

$cwd = dirname(__FILE__).DIRECTORY_SEPARATOR.'forums'.DIRECTORY_SEPARATOR;

define('FORUM_ROOT',$cwd);

require FORUM_ROOT.'include/common.php';

debug($forum_user,1);

the result was getting the currect user , and i can use add_user function to do integration

now , if i do this thing :

function test()
{

$cwd = dirname(__FILE__).DIRECTORY_SEPARATOR.'forums'.DIRECTORY_SEPARATOR;

define('FORUM_ROOT',$cwd);

require FORUM_ROOT.'include/common.php';

debug($forum_user,1);
}

test();

im getting :

Fatal error: Call to a member function escape() on a non-object in ............\forums\include\functions.php on line 1353

quick check and i found the function is set_default_user() ,

and if we look a little bit better i found out that $forum_db is not a db constractor

so if i put the call to punbb its cant execute the db quries inside.


any idea how to slove it ?

------------------------------------------------
problem sloved
just add to function

global $forum_url, $forum_db, $forum_user, $forum_config, $base_url,$lang_common;

and its will be ok.

-------------------------------