Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
404 management
#2
Well, let me see whether I can help you with this Smile

Code:
if (! file_exists($file)) {
    if (file_exists($file_404))    {
        $file = $file_404;
        exec_action('error-404');
    }
}
spilarix Wrote:Why is there no “else” here? It [w]ould avoid notices on $data_index properties if the file doesn’t exists.
You’re completely right. The answer to your question would be something along the lines of: this is how the first version of GetSimple was written. As it started out as a little system for Chris to use he could be pretty confident of the existence of the 404 file.

Code:
# if page is private, send to 404 error page
if ($private == 'Y') {
    header('Location: 403');
    exit;
}
spilarix Wrote:I think there are some problems between 403 and 404
I believe Chris once mentioned having had a long night when he wrote that part of the code. I don’t know whether it’s really of any importance to modify the variable names.

Code:
# if page does not exist, throw 404 error
if ($url == '403') {
    header('HTTP/1.0 404 Not Found');
}
spilarix Wrote:A test on $url is useless because in the case of 404, the url will be empty.
No, when the script has read the XML-data of the 404 file it will have set $url to 403. This is the URL specified by 403.xml.

Anything else?
“Don’t forget the important ˚ (not °) on the a,” says the Unicode lover.
Help us test a key change for the core! ¶ Problems with GetSimple? Be sure to enable debug mode!
Reply


Messages In This Thread
404 management - by spilarix - 2010-05-07, 21:00:56
404 management - by Zegnåt - 2010-05-08, 02:07:07
404 management - by spilarix - 2010-05-08, 21:46:30
404 management - by Zegnåt - 2010-05-08, 23:27:18



Users browsing this thread: 1 Guest(s)