本文整理汇总了PHP中FrontController::handleRequest方法的典型用法代码示例。如果您正苦于以下问题:PHP FrontController::handleRequest方法的具体用法?PHP FrontController::handleRequest怎么用?PHP FrontController::handleRequest使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FrontController
的用法示例。
在下文中一共展示了FrontController::handleRequest方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: IpCheckHandler
<?php
/*******************************************************************************
*
* DEMO application
*
* @package demo
* @author Benjamin Ulmer
* @link http://github.com/remluben/rsf
*
* - Access with
* user: user
* password: password
* - Ensure, that demo/logs/auth.log is writeable by your webserver
*
******************************************************************************/
require_once 'bootstrap.php';
$registry->get('AutoLoader')->addPath(__APP_PATH . 'classes/')->addPath(__APP_PATH . 'commands/')->addPath(__APP_PATH . 'filters/')->addPath(__APP_PATH . 'helpers/');
// if running on a local lampp, set IP adress to 127.0.0.1 in order to block
// yourself
$ipCheckHandler = new IpCheckHandler($registry, array('127.0.0.2'));
$authLoggingHandler = new AuthLoggingHandler($registry, __APP_PATH . 'logs/auth.log');
$dispatcher = $registry->get('EventDispatcher');
$dispatcher->addHandler('onLogin', $ipCheckHandler);
$dispatcher->addHandler('onInvalidLogin', $authLoggingHandler);
$resolver = new FileSystemCommandResolver(__APP_PATH . 'commands', 'Default');
$controller = new FrontController($resolver);
$controller->addPreFilter(new HttpAuthFilter($registry, array('user' => 'password')));
$controller->handleRequest($registry->getRequest(), $registry->getResponse());
示例2: LdapAccess
<?php
set_include_path(get_include_path() . PATH_SEPARATOR . '/var/www/PHPsTeam');
// Einbindung aller benötigten PHP-Dateien
include_once 'class.GuiCommandResolver.php';
include_once 'class.FrontController.php';
include_once 'class.HttpRequest.php';
include_once 'class.HttpResponse.php';
include_once 'interface.Command.php';
include_once 'class.Registry.php';
include_once 'class.SessionRegistry.php';
include_once 'class.TemplateView.php';
include_once 'testclass.LdapAccess.php';
include_once 'class.Configuration.php';
include_once 'layoutFunctions.php';
include_once '../PHPsTeam/steam_connector.class.php';
include_once 'class.steamObjectUsertool.php';
include_once '../PHPsTeam/steam_factory.class.php';
$registry = Registry::getInstance();
$registry->set('ldapAccess', new LdapAccess());
$registry->set('configuration', new Configuration());
$resolver = new GuiCommandResolver('commands/gui', 'login');
$controller = new FrontController($resolver);
$request = new HttpRequest();
$response = new HttpResponse();
// Beginn der Abarbeitung des Requests.
$controller->handleRequest($request, $response);
?>
示例3: handleRequest
public function handleRequest($path)
{
//***********AJAX Handling*************
// Is current request is an AJAX-Request, don't generate template code
if (self::isAjaxRequest()) {
$app = lms_portal::get_instance();
$app->initialize(GUEST_NOT_ALLOWED);
$frontController = new FrontController();
//$request = new HttpRequest();
//$response = new HttpResponse();
$ajaxRequestObject = new AjaxRequestObject();
if (isset($_REQUEST["namespace"]) && $_REQUEST["namespace"] != "") {
$ajaxRequestObject->setNamespace($_REQUEST["namespace"]);
} else {
$ajaxRequestObject->setNamespace($path[0]);
}
$ajaxRequestObject->setCommand(isset($_REQUEST["command"]) ? $_REQUEST["command"] : "");
$ajaxRequestObject->setElementId(isset($_REQUEST["elementId"]) ? $_REQUEST["elementId"] : "");
$ajaxRequestObject->setRequestType(isset($_REQUEST["requestType"]) ? $_REQUEST["requestType"] : "");
$params = $_REQUEST;
unset($params["command"]);
unset($params["elementId"]);
unset($params["requestType"]);
$ajaxRequestObject->setParams($params);
$ajaxResponseObject = new AjaxResponseObject();
// Handle request by calling command with frontcontroller
$result = $frontController->handleRequest($ajaxRequestObject, $ajaxResponseObject);
exit;
}
//**************************************
}
示例4: FrontController
// connect to database
// -------------------------------------------------
setConnectionName('default');
setConnectionConf(config('mysql'));
// -------------------------------------------------
// run system
// -------------------------------------------------
if (version_compare(PHP_VERSION, '5.3') == -1) {
$err = 'The current PHP version ' . PHP_VERSION . ' is not supported.' . PHP_EOL;
$err .= 'Please upgrade your PHP installation to 5.3 or later.';
system_error($err);
} else {
// create front controller object
$FrontController = new FrontController();
// create registry object as singleton
$Registry = Singleton::getInstance('Registry');
$Cookie = Singleton::getInstance('Cookie');
if (!$Cookie->isCookie('langcode')) {
$Cookie->set('langcode', tellme('langcode', 'DE'));
}
$Request = new HTTP_Request();
$Response = new HTTP_Response();
$Registry->set('HttpRequest', $Request);
$Registry->set('HttpResponse', $Response);
// handle request
$obj = $FrontController->handleRequest($Request, $Response);
// output response
$obj->display();
}
// flush output buffer
ob_end_flush();
示例5: sTeamServerDataAccess
// Instance for accessing data on sTeam- or LDAP server
$GLOBALS["USERMANAGEMENT_DATA_ACCESS"] = new sTeamServerDataAccess();
// Initialize the LMS portal
$portal = lms_portal::get_instance();
$portal->initialize(GUEST_NOT_ALLOWED);
// Initialize sTeam structure if necessary
if (!$GLOBALS["USERMANAGEMENT_DATA_ACCESS"]->isInitialized()) {
$GLOBALS["USERMANAGEMENT_DATA_ACCESS"]->initialize();
}
// Some initialization stuff
$frontController = new FrontController($portal);
$request = new HttpRequest();
$response = new HttpResponse();
$viewHelper = new ViewHelper();
// Handle request by calling command with frontcontroller
$result = $frontController->handleRequest($request, $response);
// Is current request is an AJAX-Request, don't generate template code
if (isAjaxRequest()) {
echo $result;
die;
}
// Initialize template
$usermanagementHTMLTemplate = new koala_html_usermanagement($request->getParameter("template"));
$content = $usermanagementHTMLTemplate->get_template();
// ID of the current user
$currentUserID = $GLOBALS["STEAM"]->get_current_steam_user()->get_id();
// Set the value of the session variable with the current customer id, if not already done
if (!isset($_SESSION["CURRENT_CUSTOMER_ID"])) {
// load default or if user is admin, set the value to the first found customer is
if ($GLOBALS["USERMANAGEMENT_DATA_ACCESS"]->isAdmin($currentUserID)) {
$customerIDs = $GLOBALS["USERMANAGEMENT_DATA_ACCESS"]->getAllCustomers();