GLOBALS.php "cleanup" [message #6756] |
Wed, 23 October 2002 15:20 |
holstein
Messages: 9 Registered: August 2002 Location: Montreal
Karma: 0
|
Junior Member |
|
|
Hello.
I've done some changes in the way the parameters are stored / retrieved in the GLOBALS.php configuration files.
Before my changes, the parameters where stored like :
$GLOBAL_VAR = "value";
With my changes, it is like :
$GLOBALS['GLOBAL_VAR'] = "value";
Why?
Because in trying to merge the login procedure for my site and for Fud forum, I could not, for whatever reason, read the data configured in the actual way : a scope probleme I guess, since I was not including the files in the same way Fud does. I found that if the variable are defined the way I did, everything works (and nothing breaks in fud).
I have joined my modified glob.inc? Since it does not break anything in fud (or, at least, nothing that I've seen), I thing it could be a good thing to merge it in because it simplify the kind of "merging operation" like I needed to do.
Any interest in seing how I merged the login? It does not feel very "clean" for me, but it's simple and it works (or, at least, it looks like it does, for now... )
Thanks
Benoit
-
Attachment: glob.inc
(Size: 3.23KB, Downloaded 978 times)
|
|
|
Re: GLOBALS.php "cleanup" [message #6759 is a reply to message #6756] |
Wed, 23 October 2002 20:39 |
Ilia
Messages: 13241 Registered: January 2002
Karma: 0
|
Senior Member Administrator Core Developer |
|
|
There is a slight problem with implementing your suggestion. That being is that it would require format of all the GLOBALS.php to change and I do not believe such a change is necessary.
Include the GLOBALS.php will load the variables defined there into the GLOBAL scope, otherwise FUDforum would not work.
FUDforum Core Developer
|
|
|
Re: GLOBALS.php "cleanup" [message #6841 is a reply to message #6759] |
Fri, 25 October 2002 16:37 |
holstein
Messages: 9 Registered: August 2002 Location: Montreal
Karma: 0
|
Junior Member |
|
|
With my changes, all the variables declared in GLOBALS.php are effectively changed with the format I described. That way, they are explicitely added to the GLOBALS scope.
Everything is still working right with this change : all the globals are indeed called in the $GLOBALS array. From what I understand (I know way more in Perl than in PHP, so maybe I don't clearly understand peculiarity about the PHP scopes and al.), my changes are not changing anything, but it makes my code work...
What I'm doing to make Fud setup his user cookie at the same time of my cookies is this :
- - - - - - 8<- - - - -
/* set my cookies. I wont bother your with that.. ;o) /*
require_once $_SERVER['DOCUMENT_ROOT'] . '/forum/GLOBALS.php';
require_once $_SERVER['DOCUMENT_ROOT'] . '/forum/forum_data/include/theme/lpa/db.inc';
require_once $_SERVER['DOCUMENT_ROOT'] . '/forum/forum_data/include/theme/lpa/cookies.inc';
$fsess = new fud_session;
$fud_uid = $this->dbh->getOne("SELECT id FROM fud_users WHERE login = " . $this->dbh->quote($this->info['username']));
set_referer_cookie($fud_uid);
$fsess->cookie_set_session($fsess->save_session($fud_uid));
- - - - - - 8<- - - - -
As you see, I include what I need to be able to build a fud_session object and call it's cookie_set_session method.
If I leave GLOBALS.php the way it is by default, this won't work because the DBHOST_* globals are not, for a reason I confess I don't clearly understand, recognized by the fud_session object. If I apply my changes and declare all the variable in GLOBALS.php directly in the $GLOBALS array/namespace, everything work. And the forum still work right.
Am I missing something, and my forum is going to explode somewhere I have'nt figure?
|
|
|
Re: GLOBALS.php "cleanup" [message #6842 is a reply to message #6841] |
Fri, 25 October 2002 16:43 |
Ilia
Messages: 13241 Registered: January 2002
Karma: 0
|
Senior Member Administrator Core Developer |
|
|
Your forum won't explode, however you may experience problems when upgrading to future versions because the formatting of your GLOBALS.php is different.
FUDforum Core Developer
|
|
|