|
|
Joined: Sep 1999
Posts: 33
Power User
|
Power User
Joined: Sep 1999
Posts: 33 |
Hi Scream,
Fix for weird language file names (at least in the logout.php routine). It might be happening elsewhere too.
In logout.php t he line $user[loggedout] = 1; should be $user['loggedout'] = "1";
I have put some gettype commands in main.inc.php so I can see what is happening. When I execute logout.php from the command line (I am logged out already, no cookies), $user will have a type of "string" instead of "array" when it comes into send_header in main.inc.php. Very weird.
When this happens $user[newlanguage] is equal to "1" or "s" or whatever it grabs from memory. This causes problems with the language files because now it uses that instead of english or whatever.
$user['loggedout'] = "1"; fixes it.
I hope this helps!
Last edited by SitStay; 08/06/2001 9:36 PM.
|
|
|
|
Joined: May 1999
Posts: 3,039
Guru
|
Guru
Joined: May 1999
Posts: 3,039 |
Thanks for the info. Will get that changed over.
UBB.threads Developer
|
|
|
|
Joined: Sep 1999
Posts: 33
Power User
|
Power User
Joined: Sep 1999
Posts: 33 |
I put 5.4.3 into production and this Type Conversion problem bit me again. It seems that typing is a problem with the $user variable which might need to be explored in greater depth. I put gettype statements in the send_header routine and found the type for $user isn't always the array but we expect it to be.
In main.inc.php's send_header routine, I was getting stylesheets not found because they were coming up "/stylesheet/1.css".
When I was testing I found that in the logout.php routine sets the $user[loggedout] flag to 1 right before sending calling send_header. In my original tests, changing this to [:blue]$user['loggedout'] = "1"; kept the type as array in the send_header routine. But when I moved the files into production, the problem crept back in. I could run the exact same program files in one directory and I'd get the error. But in another directory I wouldn't. It seems type is still a problem. So here is what I did to correct it once and for all.
In the send_header routine, I added an if statement to verify that $user is actually an array. Because of the typing problem, sometimes it is Boolean and sometimes it is a string. In those cases this section will cause problems. But also in those cases, none of the fields in this section are set so bypassing them doesn't cause problems. My additions are in blue.
[:blue]if ( is_array($user) ) { // ----------------------------- // Grab any personal preferences $FrontPage = $user[U_FrontPage]; $Privates = $user[U_Privates]; $StyleSheet= $user[U_StyleSheet]; $Status = $user[U_Status]; if ($user[newlanguage]) { require ("$config[path]/languages/$user[newlanguage]/generic.php"); } [:blue]}
This has solved the problem and I am no longer seeing the stylesheet errors.
|
|
|
|
Joined: May 1999
Posts: 3,039
Guru
|
Guru
Joined: May 1999
Posts: 3,039 |
Thanks for the info. I'm going to spend some time and change the majority of the arrays to the ['key'] type instead of the [key], at least the ones that seem to be causing some problems currently.
UBB.threads Developer
|
|
|
Donate to UBBDev today to help aid in Operational, Server and Script Maintenance, and Development costs.
Please also see our parent organization VNC Web Services if you're in the need of a new UBB.threads Install or Upgrade, Site/Server Migrations, or Security and Coding Services.
|
|
Posts: 449
Joined: February 2008
|
|
Forums63
Topics37,573
Posts293,925
Members13,849
|
Most Online5,166 Sep 15th, 2019
|
|
Currently Online
Topics Created
Posts Made
Users Online
Birthdays
|
|
|
|
|