Vergleich inc/class_error.php - 1.4.4 - 1.4.10

  Keine Änderungen   Hinzugefügt   Modifiziert   Entfernt
Zeile 6Zeile 6
 * Website: http://www.mybboard.net
* License: http://www.mybboard.net/about/license
*

 * Website: http://www.mybboard.net
* License: http://www.mybboard.net/about/license
*

 * $Id: class_error.php 4271 2008-11-16 06:20:15Z Tikitiki $

 * $Id: class_error.php 4541 2009-11-26 08:22:56Z RyanGordon $

 */

// Set to 1 if recieving a blank page (template failure).

 */

// Set to 1 if recieving a blank page (template failure).

Zeile 27Zeile 27
{
// This constant has been defined since PHP 5.2.
define("E_RECOVERABLE_ERROR", 4096);

{
// This constant has been defined since PHP 5.2.
define("E_RECOVERABLE_ERROR", 4096);

 
}

if(!defined("E_DEPRECATED"))
{
// This constant has been defined since PHP 5.3.
define("E_DEPRECATED", 8192);

}

class errorHandler {

/**
* Array of all of the error types

}

class errorHandler {

/**
* Array of all of the error types

	 *
* @var array

	 *
* @var array

	 */
var $error_types = array(
E_ERROR => 'Error',

	 */
var $error_types = array(
E_ERROR => 'Error',

Zeile 45Zeile 51
		E_CORE_WARNING       => 'Core Warning',
E_COMPILE_ERROR => 'Compile Error',
E_COMPILE_WARNING => 'Compile Warning',

		E_CORE_WARNING       => 'Core Warning',
E_COMPILE_ERROR => 'Compile Error',
E_COMPILE_WARNING => 'Compile Warning',

 
		E_DEPRECATED		 => 'Deprecated Warning',

		E_USER_ERROR         => 'User Error',
E_USER_WARNING => 'User Warning',
E_USER_NOTICE => 'User Notice',

		E_USER_ERROR         => 'User Error',
E_USER_WARNING => 'User Warning',
E_USER_NOTICE => 'User Notice',

Zeile 61Zeile 68
	 * @var array
*/
var $ignore_types = array(

	 * @var array
*/
var $ignore_types = array(

 
		E_DEPRECATED,

		E_NOTICE,
E_USER_NOTICE,
E_STRICT

		E_NOTICE,
E_USER_NOTICE,
E_STRICT

Zeile 72Zeile 80
	 * @var string
*/
var $warnings = "";

	 * @var string
*/
var $warnings = "";





	/**
* Is MyBB in an errornous state? (Have we received an error?)
*

	/**
* Is MyBB in an errornous state? (Have we received an error?)
*

Zeile 132Zeile 140
			$mybb->settings['errortypemedium'] = "both";
}


			$mybb->settings['errortypemedium'] = "both";
}


		if(($mybb->settings['errortypemedium'] == "both" || !$mybb->settings['errortypemedium']) || my_strpos(my_strtolower($this->error_types[$type]), $mybb->settings['errortypemedium']) || defined("IN_INSTALL") || defined("IN_UPGRADE"))

		if(defined("IN_TASK"))

		{

		{

			if(defined("IN_TASK"))





			global $task;

require_once MYBB_ROOT."inc/functions_task.php";

if($file)

			{

			{

				global $task;

require_once MYBB_ROOT."inc/functions_task.php";

if($file)
{
$filestr = " - Line: $line - File: $file";
}

add_task_log($task, "{$this->error_types[$type]} - [$type] ".var_export($message, true)."{$filestr}");

				$filestr = " - Line: $line - File: $file";










			}


			}


			// Saving error to log file.
if($mybb->settings['errorlogmedium'] == "log" || $mybb->settings['errorlogmedium'] == "both")
{
$this->log_error($type, $message, $file, $line);
}




			add_task_log($task, "{$this->error_types[$type]} - [$type] ".var_export($message, true)."{$filestr}");
}

// Saving error to log file.
if($mybb->settings['errorlogmedium'] == "log" || $mybb->settings['errorlogmedium'] == "both")
{
$this->log_error($type, $message, $file, $line);
}





			// Are we emailing the Admin a copy?
if($mybb->settings['errorlogmedium'] == "mail" || $mybb->settings['errorlogmedium'] == "both")
{
$this->email_error($type, $message, $file, $line);
}

if($type == MYBB_SQL)









		// Are we emailing the Admin a copy?
if($mybb->settings['errorlogmedium'] == "mail" || $mybb->settings['errorlogmedium'] == "both")
{
$this->email_error($type, $message, $file, $line);
}

// SQL Error
if($type == MYBB_SQL)
{
$this->output_error($type, $message, $file, $line);
}
else
{
// Do we have a PHP error?
if(my_strpos(my_strtolower($this->error_types[$type]), 'warning') === false)

			{
$this->output_error($type, $message, $file, $line);
}

			{
$this->output_error($type, $message, $file, $line);
}

 
			// PHP Warning

			else
{

			else
{

				if(my_strpos(my_strtolower($this->error_types[$type]), 'warning') === false)

				if($mybb->settings['errortypemedium'] == "error")

				{

				{

					$this->output_error($type, $message, $file, $line);

					echo "<div class=\"php_warning\">MyBB Internal: One or more warnings occured. Please contact your administrator for assistance.</div>"; 

				}
else
{
global $templates;

				}
else
{
global $templates;

 
					

					$warning = "<strong>{$this->error_types[$type]}</strong> [$type] $message - Line: $line - File: $file PHP ".PHP_VERSION." (".PHP_OS.")<br />\n";
if(is_object($templates) && method_exists($templates, "get") && !defined("IN_ADMINCP"))
{

					$warning = "<strong>{$this->error_types[$type]}</strong> [$type] $message - Line: $line - File: $file PHP ".PHP_VERSION." (".PHP_OS.")<br />\n";
if(is_object($templates) && method_exists($templates, "get") && !defined("IN_ADMINCP"))
{

Zeile 222Zeile 238
		else
{
$template_exists = false;

		else
{
$template_exists = false;

			

			

			if(!is_object($templates) || !method_exists($templates, 'get'))
{
if(@file_exists(MYBB_ROOT."inc/class_templates.php"))

			if(!is_object($templates) || !method_exists($templates, 'get'))
{
if(@file_exists(MYBB_ROOT."inc/class_templates.php"))

Zeile 265Zeile 281
		if($type == MYBB_SQL || $type == MYBB_TEMPLATE || $type == MYBB_GENERAL)
{
$this->error($type, $message);

		if($type == MYBB_SQL || $type == MYBB_TEMPLATE || $type == MYBB_GENERAL)
{
$this->error($type, $message);

		}
else

		}
else

		{
trigger_error($message, $type);
}

		{
trigger_error($message, $type);
}

Zeile 317Zeile 333
	 */
function email_error($type, $message, $file, $line)
{

	 */
function email_error($type, $message, $file, $line)
{

 
		global $mybb;


		if(!$mybb->settings['adminemail'])
{
return false;

		if(!$mybb->settings['adminemail'])
{
return false;

		}

		}


if($type == MYBB_SQL)
{


if($type == MYBB_SQL)
{

Zeile 328Zeile 346
		}

$message = "Your copy of MyBB running on {$mybb->settings['bbname']} ({$mybb->settings['bburl']}) has experienced an error. Details of the error include:\n---\nType: $type\nFile: $file (Line no. $line)\nMessage\n$message";

		}

$message = "Your copy of MyBB running on {$mybb->settings['bbname']} ({$mybb->settings['bburl']}) has experienced an error. Details of the error include:\n---\nType: $type\nFile: $file (Line no. $line)\nMessage\n$message";





		$error = @my_mail($mybb->settings['adminemail'], "MyBB error on {$mybb->settings['bbname']}", $message, $mybb->settings['adminemail']);
if($error)

		$error = @my_mail($mybb->settings['adminemail'], "MyBB error on {$mybb->settings['bbname']}", $message, $mybb->settings['adminemail']);
if($error)

		{
$this->output_error(MYBB_GENERAL, $error);
}

		{
$this->output_error(MYBB_GENERAL, $error, "", "");
}

	}

function output_error($type, $message, $file, $line)

	}

function output_error($type, $message, $file, $line)

Zeile 341Zeile 359
		global $mybb, $parser;

if(!$mybb->settings['bbname'])

		global $mybb, $parser;

if(!$mybb->settings['bbname'])

		{

		{

			$mybb->settings['bbname'] = "MyBB";
}


			$mybb->settings['bbname'] = "MyBB";
}


Zeile 349Zeile 367
		{
$title = "MyBB SQL Error";
$error_message = "<p>MyBB has experienced an internal SQL error and cannot continue.</p>";

		{
$title = "MyBB SQL Error";
$error_message = "<p>MyBB has experienced an internal SQL error and cannot continue.</p>";

			$error_message .= "<dl>\n";
$error_message .= "<dt>SQL Error:</dt>\n<dd>{$message['error_no']} - {$message['error']}</dd>\n";
if($message['query'] != "")

			if($mybb->settings['errortypemedium'] == "both" || $mybb->settings['errortypemedium'] == "error")



			{

			{

				$error_message .= "<dt>Query:</dt>\n<dd>{$message['query']}</dd>\n";







				$error_message .= "<dl>\n";
$error_message .= "<dt>SQL Error:</dt>\n<dd>{$message['error_no']} - {$message['error']}</dd>\n";
if($message['query'] != "")
{
$error_message .= "<dt>Query:</dt>\n<dd>{$message['query']}</dd>\n";
}
$error_message .= "</dl>\n";

			}

			}

			$error_message .= "</dl>\n";

 
		}
else
{
$title = "MyBB Internal Error";
$error_message = "<p>MyBB has experienced an internal error and cannot continue.</p>";

		}
else
{
$title = "MyBB Internal Error";
$error_message = "<p>MyBB has experienced an internal error and cannot continue.</p>";

			$error_message .= "<dl>\n";
$error_message .= "<dt>Error Type:</dt>\n<dd>{$this->error_types[$type]} ($type)</dd>\n";
$error_message .= "<dt>Error Message:</dt>\n<dd>{$message}</dd>\n";
if(!empty($file))

			if($mybb->settings['errortypemedium'] == "both" || $mybb->settings['errortypemedium'] == "error")




			{

			{

				$error_message .= "<dt>Location:</dt><dd>File: {$file}<br />Line: {$line}</dd>\n";
if(!@preg_match('#config\.php|settings\.php#', $file) && @file_exists($file))



				$error_message .= "<dl>\n";
$error_message .= "<dt>Error Type:</dt>\n<dd>{$this->error_types[$type]} ($type)</dd>\n";
$error_message .= "<dt>Error Message:</dt>\n<dd>{$message}</dd>\n";
if(!empty($file))

				{

				{

					$code_pre = @file($file);























					$error_message .= "<dt>Location:</dt><dd>File: {$file}<br />Line: {$line}</dd>\n";
if(!@preg_match('#config\.php|settings\.php#', $file) && @file_exists($file))
{
$code_pre = @file($file);

$code = "";

if(isset($code_pre[$line-4]))
{
$code .= $line-3 . ". ".$code_pre[$line-4];
}

if(isset($code_pre[$line-3]))
{
$code .= $line-2 . ". ".$code_pre[$line-3];
}

if(isset($code_pre[$line-2]))
{
$code .= $line-1 . ". ".$code_pre[$line-2];
}

$code .= $line . ". ".$code_pre[$line-1]; // The actual line.





					$code = "";

if(isset($code_pre[$line-4]))
{
$code .= $line-3 . ". ".$code_pre[$line-4];
}

if(isset($code_pre[$line-3]))
{
$code .= $line-2 . ". ".$code_pre[$line-3];
}

if(isset($code_pre[$line-2]))
{
$code .= $line-1 . ". ".$code_pre[$line-2];
}

$code .= $line . ". ".$code_pre[$line-1]; // The actual line.

if(isset($code_pre[$line]))
{
$code .= $line+1 . ". ".$code_pre[$line];
}

if(isset($code_pre[$line+1]))
{
$code .= $line+2 . ". ".$code_pre[$line+1];
}

if(isset($code_pre[$line+2]))
{
$code .= $line+3 . ". ".$code_pre[$line+2];
}

unset($code_pre);

$parser_exists = false;

if(!is_object($parser) || !method_exists($parser, 'mycode_parse_php'))
{
if(@file_exists(MYBB_ROOT."inc/class_parser.php"))

						if(isset($code_pre[$line]))
{
$code .= $line+1 . ". ".$code_pre[$line];
}

if(isset($code_pre[$line+1]))
{
$code .= $line+2 . ". ".$code_pre[$line+1];
}

if(isset($code_pre[$line+2]))
{
$code .= $line+3 . ". ".$code_pre[$line+2];
}

unset($code_pre);

$parser_exists = false;

if(!is_object($parser) || !method_exists($parser, 'mycode_parse_php'))
{
if(@file_exists(MYBB_ROOT."inc/class_parser.php"))
{
@require_once MYBB_ROOT."inc/class_parser.php";
$parser = new postParser;
$parser_exists = true;
}
}
else













						{

						{

							@require_once MYBB_ROOT."inc/class_parser.php";
$parser = new postParser;

 
							$parser_exists = true;
}

							$parser_exists = true;
}

 

if($parser_exists)
{
$code = $parser->mycode_parse_php($code, true);
}
else
{
$code = @nl2br($code);
}

$error_message .= "<dt>Code:</dt><dd>{$code}</dd>\n";

					}

					}

					else
{
$parser_exists = true;
}

if($parser_exists)
{
$code = $parser->mycode_parse_php($code, true);
}
else
{
$code = @nl2br($code);
}

$error_message .= "<dt>Code:</dt><dd>{$code}</dd>\n";

 
				}

				}

 
				$backtrace = $this->generate_backtrace();
if($backtrace && $type != MYBB_GENERAL)
{
$error_message .= "<dt>Backtrace:</dt><dd>{$backtrace}</dd>\n";
}
$error_message .= "</dl>\n";

			}

			}

			$backtrace = $this->generate_backtrace();
if($backtrace && $type != MYBB_GENERAL)
{
$error_message .= "<dt>Backtrace:</dt><dd>{$backtrace}</dd>\n";
}
$error_message .= "</dl>\n";

 

}



}


Zeile 453Zeile 477
			$charset = 'UTF-8';
}


			$charset = 'UTF-8';
}


		if(!headers_sent())

		if(!headers_sent() && !defined("IN_INSTALL"))

		{
@header("Content-type: text/html; charset={$charset}");
$_SERVER['PHP_SELF'] = htmlspecialchars_uni($_SERVER['PHP_SELF']);

		{
@header("Content-type: text/html; charset={$charset}");
$_SERVER['PHP_SELF'] = htmlspecialchars_uni($_SERVER['PHP_SELF']);