Question about redirect function in misc.functions.php

Talk about writing modules and plugins for CMS Made Simple, or about specific core functionality. This board is for PHP programmers that are contributing to CMSMS not for site developers
Post Reply
ejweidl

Question about redirect function in misc.functions.php

Post by ejweidl »

I'm a CMSMS newbie. Kinda new to PHP, too.

I downloaded and installed 0.13 under IIS on XP yesterday. The install went smoothly and the main site worked well; however, I got an error anytime I clicked on a submit button in the admin area.

After digging around the code a bit I found the redirect() function in misc.functions.php. I did some debugging and found that the function wasn't adding the admin subdirectory to the URL. For example, it was created "http://localhost/listusers.php" when it should have been generating "http://localhost/admin/listusers.php".

It looks like the code was checking the contents of the $_SERVER['PHP_SELF'] variable, but right at the top of the function, it sets that variable to NULL:

...
function redirect($to, $noappend=false)
{
$_SERVER['PHP_SELF'] = null;
...

When I commented out that line, the function generates the correct redirect URL and the site is working properly.

Is that a mistake in the code or am I not understanding how the code works?

Eric
Ted
Power Poster
Power Poster
Posts: 3329
Joined: Fri Jun 11, 2004 6:58 pm
Location: Fairless Hills, Pa USA

Re: Question about redirect function in misc.functions.php

Post by Ted »

I agree.  This seems incredibly pointless to me.  I know I committed the code, but I can't remember why.  :)  I'm almost thinking it was test code that never got removed.

I'll look into it.  Thanks.
Post Reply

Return to “Developers Discussion”