aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes/error.php
blob: fc01406f89829270fb4aa96434113e27cdba7480 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
<?php
/***************************************************************************  
 *                                 error.php
 *                            -------------------                         
 *   begin                : Saturday, Feb 13, 2001 
 *   copyright            : (C) 2001 The phpBB Group        
 *   email                : support@phpbb.com                           
 *                                                          
 *   $Id$                                                           
 *                                                            
 * 
 ***************************************************************************/ 


/***************************************************************************  
 *                                                     
 *   This program is free software; you can redistribute it and/or modify    
 *   it under the terms of the GNU General Public License as published by   
 *   the Free Software Foundation; either version 2 of the License, or  
 *   (at your option) any later version.                      
 *                                                          
 * 
 ***************************************************************************/ 

function error_die($error_code, $error_msg = "", $line = "", $file = "") 
{
	global $db, $template, $board_config, $theme, $lang, $phpEx, $phpbb_root_path;

	if(!defined("HEADER_INC"))
	{
		if(!empty($board_config['default_lang']))
		{
			include($phpbb_root_path . 'language/lang_' . $board_config['default_lang'] . '.'.$phpEx);
		}
		else
		{
			include($phpbb_root_path . 'language/lang_english.'.$phpEx);
		}
		if(!$template)
		{
			$template = new Template($phpbb_root_path . "templates/Default");
		}
		if(!$theme)
		{
			$theme = setuptheme(1);
		}
		include($phpbb_root_path . 'includes/page_header.'.$phpEx);
	}
	if(!$error_msg)
	{
		switch($error_code)
		{
			case GENERAL_ERROR:
				if(!$error_msg)
				{
					$error_msg = "An Error Occured";
				}
				if(!$message_title)
				{
					$message_title = "General Error";
				}
				break;

			case SQL_CONNECT:
				$message_title = "General Error";
				$error_msg = "Couldn't connect to database!";
				break;

			case BANNED:
				$message_title = $lang['Information'];
				$error_msg = "You have been banned from this forum.";
				break;
			
			case SQL_QUERY:
				break;
			
			case SESSION_CREATE:
				$message_title = "General Error";
				$error_msg = "Error creating session<br>Could not log you in, please go back and try again.";
				break;
			
			case NO_POSTS:
				$message_title = $lang['Information'];
				$error_msg = "There are no posts in this forum<br>Click on the <b>Post New Topic</b> link on this page to post one.";
				break;

			case LOGIN_FAILED:
				$message_title = $lang['Information'];
				$error_msg = "Login Failed<br>You have specified an incorrect/inactive username or invalid password, please go back and try again.";
				break;
		}
	}
	if(DEBUG)
	{
		if($line != "" && $file != "")
			$error_msg .= "<br /><br /><u>DEBUG INFO</u></br /><br>Line: ".$line."<br />File: ".$file;
	}

	$template->set_filenames(array(
		"message_body" => "error_body.tpl")
	);
	$template->assign_vars(array(
		"ERROR_MESSAGE" => $error_msg)
	);
	$template->pparse("message_body");

	include($phpbb_root_path . 'includes/page_tail.'.$phpEx);

	exit();
}

?>