Quote:
Originally Posted by Natch
As I mentioned in the post above, this code can be more efficient (and easier to add new error codes) witha switch statement:
Find:
PHP Code:
if(isset($_SERVER['REDIRECT_STATUS'])) { if ($_SERVER['REDIRECT_STATUS']=="404") { $error['title'] = "404 File Not Found"; $error['description'] = "The web server cannot find the file you asked for. Check the URL to ensure that the path is correct."; $error['contact'] = "Please <a href=\"$vboptions[bburl]/$vboptions[contactuslink]\">contact</a> us if you believe that the mistake is on our part."; } elseif ($_SERVER['REDIRECT_STATUS']=="403") { $error['title'] = "403 Forbidden"; $error['description'] = "You don't have permission to access this document on this server."; $error['contact'] = "Please <a href=\"$vboptions[bburl]/$vboptions[contactuslink]\">contact</a> us if you think that there is a mistake."; } elseif ($_SERVER['REDIRECT_STATUS']=="401") { $error['title'] = "401 Unauthorized"; $error['description'] = "The URL you are requesting requires proper authentication."; $error['contact'] = "Please <a href=\"$vboptions[bburl]/$vboptions[contactuslink]\">contact</a> us if you think that there is a mistake."; } elseif ($_SERVER['REDIRECT_STATUS']=="500") { $error['title'] = "500 Internal Server Error"; $error['description'] = "We encountered an unexpected condition."; $error['contact'] = "Please <a href=\"$vboptions[bburl]/$vboptions[contactuslink]\">contact</a> us to report this problem."; } elseif ($_SERVER['REDIRECT_STATUS']=="503") { $error['title'] = "503 Service Unavailable"; $error['description'] = "We are currently unable to handle your request due to a temporary overloading or maintenance of the server."; $error['contact'] = "Please <a href=\"$vboptions[bburl]/$vboptions[contactuslink]\">contact</a> us if this problem persists."; } else { $error['title'] = "Unknown Error: " . $_SERVER['REDIRECT_STATUS']; $error['description'] = "We are currently unable to handle this error."; $error['contact'] = "Please <a href=\"$vboptions[bburl]/$vboptions[contactuslink]\">contact</a> us if this problem persists."; } } else { $error['title'] = "Unknown Error"; $error['description'] = "We are currently unable to handle this error."; $error['contact'] = "Please <a href=\"$vboptions[bburl]/$vboptions[contactuslink]\">contact</a> us if this problem persists."; }
Replace with:
PHP Code:
if(!isset($_SERVER['REDIRECT_STATUS'])) { $error['title'] = "Unknown Error"; $error['description'] = "We are currently unable to handle this error."; $error['contact'] = "Please <a href=\"$vboptions[bburl]/$vboptions[contactuslink]\">contact</a> us if this problem persists."; } else switch($_SERVER['REDIRECT_STATUS']) { case("404"): $error['title'] = "404 File Not Found"; $error['description'] = "The web server cannot find the file you asked for. Check the URL to ensure that the path is correct."; $error['contact'] = "Please <a href=\"$vboptions[bburl]/$vboptions[contactuslink]\">contact</a> us if you believe that the mistake is on our part."; break; case("403"): $error['title'] = "403 Forbidden"; $error['description'] = "You don't have permission to access this document on this server."; $error['contact'] = "Please <a href=\"$vboptions[bburl]/$vboptions[contactuslink]\">contact</a> us if you think that there is a mistake."; break; case("401"): $error['title'] = "401 Unauthorized"; $error['description'] = "The URL you are requesting requires proper authentication."; $error['contact'] = "Please <a href=\"$vboptions[bburl]/$vboptions[contactuslink]\">contact</a> us if you think that there is a mistake."; break; case("500"): $error['title'] = "500 Internal Server Error"; $error['description'] = "We encountered an unexpected condition."; $error['contact'] = "Please <a href=\"$vboptions[bburl]/$vboptions[contactuslink]\">contact</a> us to report this problem."; break; case("503"): $error['title'] = "503 Service Unavailable"; $error['description'] = "We are currently unable to handle your request due to a temporary overloading or maintenance of the server."; $error['contact'] = "Please <a href=\"$vboptions[bburl]/$vboptions[contactuslink]\">contact</a> us if this problem persists."; default: $error['title'] = "Unknown Error: " . $_SERVER['REDIRECT_STATUS']; $error['description'] = "We are currently unable to handle this error."; $error['contact'] = "Please <a href=\"$vboptions[bburl]/$vboptions[contactuslink]\">contact</a> us if this problem persists."; }
Also (to follow all those W3C tips about the TITLE tags) ...
In the ERROR_SHELL template, find:
HTML Code:
<title>$vboptions[bbtitle]</title>
Replace with:
HTML Code:
<title>$error[title] - $vboptions[bbtitle]</title>
|
Shouldn't there be a break before the default line?