/** * ErrorHandler-Function * Handles internal PHP-Errors * @param string $code * @param string $message * @param string $file * @param integer $line */ function error_handler($code, $message, $file, $line) { global $db; if ($code != 8 and $code != 2048) { if (stripos($message, "Failed to connect to mailserver") === false and stripos($message, "pg_query()") === false) { if (class_exists("BasePHPErrorException")) { $e = new BasePHPErrorException("PHP Error occurs in: " . $file . " on Line " . $line . " with Message: " . $message . ""); if (class_exists("Error_IO")) { $error_io = new Error_IO($e); $error_io->display_error(); } else { echo "PHP Error occurs in: " . $file . " on Line " . $line . " with Message: " . $message . ""; } } else { echo "PHP Error occurs in: " . $file . " on Line " . $line . " with Message: " . $message . ""; } die; } } }
/** * Main Controller for requests via ajax.php * @throws BaseModuleControllerClassNotFoundException * @throws BaseModuleControllerFileNotFoundException * @throws BaseExtensionClassNotFoundException * @throws BaseExtensionFileNotFoundException * @throws BaseExtensionNotFoundException * @throws BaseModuleIllegalControllerCallException */ public static function ajax() { global $session; try { $session_valid_array = $session->is_valid(); if ($session_valid_array[0] === true) { if ($_GET['nav']) { $module_controller_array = SystemHandler::get_module_controller($_GET['nav']); $module_controller_path = "core/modules/" . $module_controller_array['path']; if (file_exists($module_controller_path)) { require_once $module_controller_path; if (class_exists($module_controller_array['class'])) { $module_controller_array['class']::ajax_handler($module_controller_array['alias']); } else { throw new BaseModuleControllerClassNotFoundException(); } } else { throw new BaseModuleControllerFileNotFoundException(); } } elseif ($_GET['extension']) { $extension_id = Extension::get_id_by_identifier($_GET['extension']); if (is_numeric($extension_id)) { $extension = new Extension($extension_id); $extension_class = $extension->get_class(); $extension_file = constant("EXTENSION_DIR") . "/" . $extension->get_folder() . "/" . $extension->get_main_file(); if (file_exists($extension_file)) { require_once $extension_file; if (class_exists($extension_class)) { $extension_class::ajax(); } else { throw new BaseExtensionClassNotFoundException(); } } else { throw new BaseExtensionFileNotFoundException(); } } else { throw new BaseExtensionNotFoundException(); } } else { throw new BaseModuleIllegalControllerCallException(); } } else { if ($_GET['nav'] == "base" and $_GET['run'] == "login" or $_GET['nav'] == "base" and $_GET['run'] == "forgot_password" or $_GET['run'] == "cron" or $_GET['nav'] == "base" and $_GET['run'] == "logout" and $session->is_dead() == true) { require_once "core/modules/base/base.request.php"; BaseRequest::ajax_handler(null); } } } catch (DatabaseQueryFailedException $e) { echo "EXCEPTION: DatabaseQueryFailedException"; } catch (BaseException $e) { $error_io = new Error_IO($e); echo "EXCEPTION: " . $error_io->get_error_message(); } }