Go Back   vb.org Archive > vBulletin Modifications > Archive > vB.org Archives > vBulletin 3.0 > vBulletin 3.0 Full Releases
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools
Custom error-handler based on vBulletin templates Details »»
Custom error-handler based on vBulletin templates
Version: 1.00, by AlexanderT AlexanderT is offline
Developer Last Online: Jul 2021 Show Printable Version Email this Page

Version: 3.0.0 Rating:
Released: 05-10-2004 Last Update: Never Installs: 34
 
No support by the author.

What this hack does?
---------------------------

UPDATE: Improved instruction.txt, fixed for those who use external style sheets

This hack adds a custom error-handler to your site using the vBulletin template engine to display the appropriate errors (e.g. 404 File not Found, 403 Forbidden, etc).

Demo
-------
Go to my site and enter some non-existing url. E.g. Random 404 Error. Or try to access my /cgi-bin path to receive a 403 error.

What to do?
----------------
queries to run: 0
templates changed: 0
templates added: 1 (ERROR_SHELL)
files changed: 1 (.htaccess)
files added: 1 (error.php)

Time needed to install
----------------------------
< 5 mins

Show Your Support

  • This modification may not be copied, reproduced or published elsewhere without author's permission.

Comments
  #32  
Old 05-13-2004, 03:33 PM
Natch's Avatar
Natch Natch is offline
 
Join Date: Nov 2002
Location: Australia
Posts: 851
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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 see above
Reply With Quote
  #33  
Old 05-13-2004, 03:35 PM
Natch's Avatar
Natch Natch is offline
 
Join Date: Nov 2002
Location: Australia
Posts: 851
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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
Reply With Quote
  #34  
Old 05-13-2004, 03:58 PM
Boofo's Avatar
Boofo Boofo is offline
 
Join Date: Mar 2002
Location: Des Moines, IA (USA)
Posts: 15,776
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Witrh Zach's code, I don't need the Base code in the template anymore. Thank you, sir.
Reply With Quote
  #35  
Old 05-13-2004, 04:08 PM
Boofo's Avatar
Boofo Boofo is offline
 
Join Date: Mar 2002
Location: Des Moines, IA (USA)
Posts: 15,776
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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?
Reply With Quote
  #36  
Old 05-13-2004, 05:12 PM
paulomt1 paulomt1 is offline
 
Join Date: Nov 2001
Posts: 82
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Where I can add the 'AllowOverride FileInfo' entry?

Problem already resolved, thanks
Reply With Quote
  #37  
Old 05-13-2004, 08:41 PM
Synicide Synicide is offline
 
Join Date: Dec 2002
Location: Providence, RI
Posts: 50
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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?
Reply With Quote
  #38  
Old 05-13-2004, 09:30 PM
Boofo's Avatar
Boofo Boofo is offline
 
Join Date: Mar 2002
Location: Des Moines, IA (USA)
Posts: 15,776
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
  #39  
Old 05-19-2004, 02:17 AM
ImportPassion ImportPassion is offline
 
Join Date: Mar 2002
Location: Gilbert, AZ
Posts: 605
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
  #40  
Old 05-19-2004, 02:23 AM
Natch's Avatar
Natch Natch is offline
 
Join Date: Nov 2002
Location: Australia
Posts: 851
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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)
Reply With Quote
  #41  
Old 05-19-2004, 02:37 AM
Boofo's Avatar
Boofo Boofo is offline
 
Join Date: Mar 2002
Location: Des Moines, IA (USA)
Posts: 15,776
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Natch
Yup - I''ll modify my post to reflect that (good debugging)
Always willing to help a friend out.
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 09:09 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.08582 seconds
  • Memory Usage 2,370KB
  • Queries Executed 25 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (2)bbcode_html
  • (2)bbcode_php
  • (7)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (6)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (11)post_thanks_box
  • (11)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (11)post_thanks_postbit_info
  • (10)postbit
  • (11)postbit_onlinestatus
  • (11)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.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
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete