/** * Forward to specific controller / action * * @access public * @param string $action * @param string $controller. If this value is NULL current controller will be * used * @return null */ function forward($action, $controller = null) { return empty($controller) ? $this->execute($action) : Env::executeAction($controller, $action); }
} // if } // try // Init application if (Env::isDebugging()) { benchmark_timer_set_marker('Init application'); } // if // We need to call application.php after the routing is executed because // some of the application classes may need CONTROLLER, ACTION or $_GET // data collected by the matched route require_once 'application.php'; // Set handle request timer... if (Env::isDebugging()) { benchmark_timer_set_marker('Handle request'); } // if // Get controller and action and execute... try { Env::executeAction(request_controller(), request_action()); } catch (Exception $e) { if (Env::isDebugging()) { Env::dumpError($e); } else { Logger::log($e, Logger::FATAL); redirect_to(get_url('error', 'execute_action')); } // if } // try
trace(__FILE__, 'FileRepository::setBackend() - use file storage'); FileRepository::setBackend(new FileRepository_Backend_FileSystem(FILES_DIR)); } else { trace(__FILE__, 'FileRepository::setBackend() - use mysql storage'); FileRepository::setBackend(new FileRepository_Backend_MySQL(DB::connection()->getLink(), TABLE_PREFIX)); } // if PublicFiles::setRepositoryPath(ROOT . '/public/files'); if (trim(PUBLIC_FOLDER) == '') { PublicFiles::setRepositoryUrl(with_slash(ROOT_URL) . 'files'); } else { PublicFiles::setRepositoryUrl(with_slash(ROOT_URL) . PUBLIC_FOLDER . '/files'); } // if // Owner company or administrator doen't exist? Let the user create them } catch (OwnerCompanyDnxError $e) { Env::executeAction('access', 'complete_installation'); } catch (AdministratorDnxError $e) { Env::executeAction('access', 'complete_installation'); // Other type of error? We need to break here } catch (Exception $e) { trace(__FILE__, '- catch ' . $e); if (Env::isDebugging()) { Env::dumpError($e); } else { Logger::log($e, Logger::FATAL); Env::executeAction('error', 'system'); } // if } // if
require_once LIBRARY_PATH . '/utf8/utf8.php'; } // Set handle request timer... if (Env::isDebugging()) { benchmark_timer_set_marker('Handle request'); } // if $url = urldecode($_SERVER['REQUEST_URI']); if (preg_match('/<script[^>]*>.*(<\\/script>|$)/i', $url)) { Logger::log("Javascript injection from " . $_SERVER['REMOTE_ADDR'] . " in URL:" . $url); remove_scripts_and_redirect($url); } // Get controller and action and execute... try { if (!defined('CONSOLE_MODE')) { Env::executeAction(request_controller(), request_action()) or DB::rollback(); } } catch (Exception $e) { if (Env::isDebugging()) { Logger::log($e, Logger::FATAL); Env::dumpError($e); } else { Logger::log($e, Logger::FATAL); redirect_to(get_url('error', 'execute_action')); } // if } // try if (Env::isDebuggingTime()) { TimeIt::stop(); $report = TimeIt::getTimeReportByType();