function error_handler($number, $error, $file, $line) { if (in_array($number, unserialize(ERROR_LOG_EXCEPTIONS)) == false) { $error_types = array(E_WARNING => "Warning", E_ERROR => "Fatal Error", E_PARSE => "Parse Error", E_STRICT => "Strict Notice", E_USER_ERROR => "User Error", E_USER_NOTICE => "User Notice", E_USER_WARNING => "User Warning"); $error_message = "====================================================================\n"; $error_message .= sprintf("Time Encountered: %s\n", date("F j, Y, g:i:s A")); $error_message .= sprintf("Error Type: %s\n", array_key_exists($number, $error_types) == true ? "{$error_types[$number]} (Error #{$number})" : "Unknown Error (Error #{$number})"); $error_message .= sprintf("Error String: %s\n", $error); $error_message .= sprintf("Error File: %s\n", $file); $error_message .= sprintf("Error Line: %s\n", $line); $error_message .= "====================================================================\n"; @file_put_contents(sprintf("%ssource/errorlog/php5/%s.log", ROOT_PATH, date("m-d-Y")), $error_message, FILE_APPEND); if ($number == E_ERROR || $number == E_PARSE) { output_fatal_error("PHP Fatal Error"); } } return true; }
function error($query = "No Query Executed", $custom_error = NULL, $returnerr = false) { $error_message = "====================================================================\n"; $error_message .= sprintf("Query Executed: %s\n", $query); $error_message .= sprintf("Time Encountered: %s\n", date("F j, Y, g:i:s A")); $error_message .= sprintf("URL Location: %s\n", $this->mmhclass->info->page_url); $error_message .= sprintf("IP Address: %s\n", $this->mmhclass->input->server_vars['remote_addr']); $error_message .= sprintf("Error: %s\n", $this->mmhclass->funcs->is_null($custom_error) == false ? $custom_error : mysql_error()); $error_message .= sprintf("Error Number: %s\n", $this->mmhclass->funcs->is_null(mysql_error()) == false ? mysql_errno() : "Unknown Error Number"); $error_message .= "====================================================================\n"; @file_put_contents(sprintf("%ssource/errorlog/mysql/%s.log", ROOT_PATH, date("m-d-Y")), $error_message, FILE_APPEND); if ($returnerr == true) { return false; } else { output_fatal_error("MySQL Driver Error"); } return true; }
$mmhclass->info->script_path = ($path = dirname($mmhclass->input->server_vars['php_self'])) == "/" ? $path : "{$path}/"; $mmhclass->image->manipulator = USE_IMAGICK_LIBRARY == true ? "imagick" : (USE_GD_LIBRARY == true || USE_GD2_LIBRARY == true ? "gd" : $mmhclass->templ->fatal_error($mmhclass->lang['7414'])); if (version_compare(PHPVERSION, "5.0.0", "<") == true) { $mmhclass->templ->fatal_error(sprintf($mmhclass->lang['9553'], $mmhclass->info->version)); } if (version_compare(PHPVERSION, "5.1.0", ">=") == true) { if (ini_get("date.timezone") == false) { date_default_timezone_set(DEFAULT_TIME_ZONE); } } if (MONITOR_CPU_LOAD == true && IS_WINDOWS_OS == false) { $load_average = sys_getloadavg(); if ($load_average['0'] > MAX_CPU_LOAD) { // Header and exit taken right from the PHP Manual header("HTTP/1.1 503 Too busy, try again later"); output_fatal_error("Server too busy. Please try again later."); } } if (ENABLE_GZHANDLER_COMPRESSION == true) { if (ini_get("zlib.output_compression") == false) { ob_start(array("ob_gzhandler", GZHANDLER_COMPRESSION_LEVEL)); } } if ($mmhclass->info->site_installed == false) { if ($mmhclass->image->basename($mmhclass->input->server_vars['php_self']) !== "install.php") { $mmhclass->templ->page_title = $mmhclass->lang['6897']; $mmhclass->templ->message($mmhclass->lang['5435'], true); } } else { if (isset($mmhclass->input->get_vars['rurl']) == true) { header(sprintf("Location: %s", base64_decode($mmhclass->input->get_vars['rurl'])));