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)

Dankinit 05-12-2004 11:34 AM

Quote:

Originally Posted by Boofo
Where would I have to give the path for that at? Do you remember? ;)

This is very useful for anybody writing custom hacks outside of their vb3 base directory and storing css as file:

https://vborg.vbsupport.ru/showthread.php?t=63520

MrNase 05-12-2004 06:19 PM

Quote:

Originally Posted by AlexanderT
Cool. I have updated the instruction accordingly. <base> is an empty tag, or a standalone tag, that doesn't use a </base> endtag. The /> at the end is sufficient to make the code xhtml 1.0-valid.

Nice to see my tip actually worked :)

AlexanderT 05-12-2004 06:35 PM

Quote:

Originally Posted by MrNase
Nice to see my tip actually worked :)

Yup, merci for it :)

Synicide 05-12-2004 08:19 PM

Wow, this is awesome. :D Saves me a LOT of work.

[high]* Synicide clicks install![/high]

Boofo 05-13-2004 08:39 AM

Quote:

Originally Posted by Synicide
Wow, this is awesome. :D Saves me a LOT of work.

[high]* Synicide clicks install![/high]

I love the skin on your site. Did you do that? ;)

Synicide 05-13-2004 11:57 AM

Quote:

Originally Posted by Boofo
I love the skin on your site. Did you do that? ;)

Yep, that's homemade. :D

Boofo 05-13-2004 01:33 PM

Quote:

Originally Posted by Synicide
Yep, that's homemade. :D

Have you thought about releasing it at all? ;)

Natch 05-13-2004 02:01 PM

Quote:

Originally Posted by AlexanderT
Cool. I have updated the instruction accordingly. <base> is an empty tag, or a standalone tag, that doesn't use a </base> endtag. The /> at the end is sufficient to make the code xhtml 1.0-valid.

One useful bit of info :) try
Code:

<base href="$vboptions[bburl]" />
and it should work across all boards :) you could include that code in your template :)

Also a switch($_SERVER['REDIRECT_STATUS']) would probably be a nicer way to code this ... rather than all those else if's

Just a personal preference thing :)

[high]* Natch clicks install just the same :)
[/high]

Great idea!

Boofo 05-13-2004 02:27 PM

Quote:

Originally Posted by Natch
One useful bit of info :) try
Code:

<base href="$vboptions[bburl]" />
and it should work across all boards :) you could include that code in your template :)

Also a switch($_SERVER['REDIRECT_STATUS']) would probably be a nicer way to code this ... rather than all those else if's

Just a personal preference thing :)

[high]* Natch clicks install just the same :)
[/high]

Great idea!

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. ;)

How would you set up the switch code?

Natch 05-13-2004 02:30 PM

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.";
    break;
    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>
UPDATED: thanks Boofo for the heads up about the missing break;


All times are GMT. The time now is 08:12 AM.

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.01828 seconds
  • Memory Usage 1,803KB
  • 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_code_printable
  • (2)bbcode_html_printable
  • (2)bbcode_php_printable
  • (8)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