vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3.0 Full Releases (https://vborg.vbsupport.ru/forumdisplay.php?f=33)
-   -   Custom error-handler based on vBulletin templates (https://vborg.vbsupport.ru/showthread.php?t=65013)

Natch 05-13-2004 02:33 PM

Quote:

Originally Posted by Boofo
The $vboptions[bburl] doesn't work for stylesheets as files. I just tested it. You have to have the absolute path for the home page to work right. ;)

You're right ... then you could use $vboptions[homeurl]/forums/ but that defeats the purpose of having one template for all ...
Quote:

Originally Posted by Boofo
How would you set up the switch code?

I knoew you would ask :D see above :)

Natch 05-13-2004 02:35 PM

I believe that Zachery has posted code that gives an absolute path to the link href statement to call stylesheets - that's why I didn't notice it not working ... it did for me :)

Boofo 05-13-2004 02:58 PM

Witrh Zach's code, I don't need the Base code in the template anymore. Thank you, sir. ;)

Boofo 05-13-2004 03:08 PM

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?

paulomt1 05-13-2004 04:12 PM

Where I can add the 'AllowOverride FileInfo' entry?

Problem already resolved, thanks

Synicide 05-13-2004 07:41 PM

Quote:

Originally Posted by Boofo
Have you thought about releasing it at all? ;)

I dunno dude, I kind of like my one of a kind styles. But hey, if I ever feel like coming up with a more generic version of it... I guess I could release it, you think it'd be a good idea?

Boofo 05-13-2004 08:30 PM

Quote:

Originally Posted by Synicide
I dunno dude, I kind of like my one of a kind styles. But hey, if I ever feel like coming up with a more generic version of it... I guess I could release it, you think it'd be a good idea?

I think that would be an excellent idea. ;)

ImportPassion 05-19-2004 01:17 AM

i wasn't using the sendmessage.php, so the link was messed up for contact. that should be an option.

also, it's funny, when you do click the contact us link, it takes u to the contact page and after you send it, it takes u back to the 404 page. ;)

Natch 05-19-2004 01:23 AM

Quote:

Originally Posted by Boofo
Shouldn't there be a break before the default line?

Yup - I''ll modify my post to reflect that :) (good debugging)

Boofo 05-19-2004 01:37 AM

Quote:

Originally Posted by Natch
Yup - I''ll modify my post to reflect that :) (good debugging)

Always willing to help a friend out. ;)


All times are GMT. The time now is 02:03 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01975 seconds
  • Memory Usage 1,802KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (2)bbcode_html_printable
  • (2)bbcode_php_printable
  • (7)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete