/** * Outputs the systeminfo in a human readable format. * This function outputs html styled information and should only be used for displaying information. * @return string The html styled system information */ public static final function getSystemInfo() { $output = ''; $output .= '<table style="margin: 10px; font-family: Verdana; font-size: 12px; width: 600px; border: 1px solid black; background-color: #9999cc;"> <tr><td colspan="2"> <p style="font-size: 14px; font-weight: bold;">SYSTEM INFORMATION</p> <p style="font-size: 10px;"> Notice: This file is copyrighted and unauthorized use is strictly prohibited.<br /> The file contains proprietary information and may not be distributed, modified<br /> or altered in any way, without written perimission.<br /> Copyright: SUPERHOLDER B.V. ' . date('Y') . ' </p> </td></tr> </table>'; $info = new \System\Collection\Vector(); $system = new \System\Collection\Map(); $system->name = 'SYSTEM Namespace'; $system->manifest = 'N/A'; $system->major = self::getMajor(); $system->minor = self::getMinor(); $system->revision = self::getSourceRevision(); $map = new \System\Collection\Map(); $map->PHP = self::getPHPVersion(); $map->hasSlowQueryListener = \System\Event\EventHandler::hasListeners('\\System\\Event\\Event\\OnSlowMySQLQueryEvent') ? 'true' : 'false'; if (self::$configDirectives == null) { self::$configDirectives = new \System\Collection\Vector(); } $map->requiredConfigDirectives = implode(', ', self::$configDirectives->getArrayCopy()); $map->PATH_PROJECT = PATH_PROJECT; $map->PATH_SYSTEM = PATH_SYSTEM; $map->PATH_CONFIG = PATH_CONFIG; $map->PATH_TEMP = PATH_TEMP; $map->PATH_LOGS = PATH_LOGS; $map->PATH_MODULES = PATH_MODULES; $map->installedCaches = 'LUTCache, Memcache, APCCache'; $system->additional = $map; $info[] = $system; $info->combine(\System\Module\Module::getAllModules()); foreach ($info as $module) { $output .= '<table style="margin: 10px; font-family: Verdana; font-size: 12px; width: 600px; border: 1px solid black; background-color: #9999cc;">'; $output .= '<tr><td colspan="2" style="text-align: center; font-weight: bold; font-size: 14px;">' . $module->name . '</td></tr>'; $output .= '<tr><td style="background-color: #ccccff; width: 200px;">Manifest</td><td style="background-color: #cccccc; width: 400px;">' . $module->manifest . '</td></tr>'; $output .= '<tr><td style="background-color: #ccccff; width: 200px;">Version</td><td style="background-color: #cccccc; width: 400px;">' . $module->major . "." . $module->minor . "." . $module->revision . '</td></tr>'; foreach ($module->additional as $index => $value) { $output .= '<tr><td style="background-color: #ccccff; width: 200px;">' . $index . '</td><td style="background-color: #cccccc; width: 400px;">' . $value . '</td></tr>'; } $output .= '</table>'; } return $output; }
/** * This function is the initiator of the controller call chain. It is called * automatically by the bootloader and spawns the proper controller child, based on the request. * When there is no request specified, the default controller will be loaded. * The BeforeControllerLoadEvent is called prior to the loading of the controller. * When the requested controller cannot be loaded, an OnControllerNotFoundEvent event will be fired and the optional replacement controller will be loaded. * @return \System\Web\Controller The current selected controller */ public static final function callController() { $options = getopt('', array('controller::', 'action::', 'mod::')); $get = new \System\HTTP\Request\Get(); //we default to the given config namespace and the config controller. $targetNamespace = SITE_NAMESPACE; $targetController = DEFAULT_CONTROLLER; $targetAction = 'defaultAction'; //The default controller and the default namespace can be overridden by parameters if (isset($get->controller)) { $targetController = ucfirst($get->controller); } else { if (isset($options['controller'])) { $targetController = ucfirst($options['controller']); } } if (isset($get->action)) { $targetAction = ucfirst($get->action); } else { if (isset($options['action'])) { $targetAction = ucfirst($options['action']); } } /* for security reasons, we only allow the overridden namespace to be executed from within the global modules. Effectively, this means that a mod override parameter is effectively transferring control to a global module instead of de default controllers. This way, we support controllers within global modules. */ if (isset($get->mod)) { $targetNamespace = (ucfirst($get->mod) == 'System' ? '\\System\\' : '\\Module\\') . ucfirst($get->mod); } else { if (isset($options['mod'])) { $targetNamespace = (ucfirst($options['mod']) == 'System' ? '\\System\\' : '\\Module\\') . ucfirst($options['mod']); } } //create the controller and run it $controllerName = $targetNamespace . '\\' . $targetController; $controller = null; if (class_exists($controllerName, true) && is_subclass_of($controllerName, '\\System\\Web\\Controller')) { $controller = new $controllerName(); } else { //try to load a replacement controller using eventcatching if (\System\Event\EventHandler::hasListeners('\\System\\Event\\Event\\OnControllerNotFoundEvent')) { $event = new \System\Event\Event\OnControllerNotFoundEvent(); $event->setControllerRequest($controllerName); $event->setControllerReplacement($controllerName); $event->raise(); $controllerReplacement = $event->getControllerReplacement(); if ($controllerReplacement != null && class_exists($controllerReplacement, true) && is_subclass_of($controllerReplacement, '\\System\\Web\\Controller')) { $controller = new $controllerReplacement(); } } } //check if the controller actually is a valid controller if ($controller instanceof \System\Web\Controller) { $requestMethod = \System\HTTP\Request\Request::getMethod(); //throws before load events and checks if the controller needs to be replaced $controller = self::checkControllerReplacement($controller, $targetNamespace, $targetAction, $requestMethod); //process sapi specific calls self::proccessSAPICalls($controller); //process the services self::processServices($controller); //call the proper entry action, but also allow specific method based versions of that call //example: defaultAction_GET, defaultAction_POST, etc. This falls back to defaultAction switch (true) { case self::attemptControllerAction($controller, $targetAction . '_' . $requestMethod): $action = $targetAction . '_' . $requestMethod; break; case self::attemptControllerAction($controller, $targetAction): $action = $targetAction; break; case self::attemptControllerAction($controller, 'defaultAction_' . $requestMethod): $action = 'defaultAction_' . $requestMethod; break; default: $action = 'defaultAction'; break; } $controller->{$action}(); return $controller; } throw new \System\Error\Exception\InvalidControllerException('The given controller is invalid or does not exist: ' . $targetController . ' in ' . $targetNamespace); }