本文整理汇总了PHP中Zend_Controller_Request_Abstract::getQuery方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Controller_Request_Abstract::getQuery方法的具体用法?PHP Zend_Controller_Request_Abstract::getQuery怎么用?PHP Zend_Controller_Request_Abstract::getQuery使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend_Controller_Request_Abstract
的用法示例。
在下文中一共展示了Zend_Controller_Request_Abstract::getQuery方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: preDispatch
public function preDispatch(AbstractRequest $request)
{
if ($request->module === 'default' && $request->controller === 'auth') {
return;
}
$frontController = FrontController::getInstance();
$bootstrap = $frontController->getParam('bootstrap');
$serviceManager = $bootstrap->getResource('ServiceManager');
$authService = $serviceManager->get('Zend\\Authentication\\AuthenticationService');
if (!$authService->hasIdentity()) {
$response = $this->getResponse();
$currentUri = sprintf('%s://%s%s%s', $request->getScheme(), $request->getHttpHost(), $request->getBaseUrl(), $request->getPathInfo());
$adapter = $authService->getAdapter();
$adapter->setLoginParameters(array('service' => $currentUri));
// Assume user is back here from a CAS authentication
if ($request->getQuery('ticket')) {
$adapter->setServiceValidateParameters(array('service' => $currentUri, 'ticket' => $request->getQuery('ticket')));
// Validate the ticket
$result = $authService->authenticate();
if (!$result->isValid()) {
$response->setRedirect($adapter->createLoginUri());
}
// Assume the user just got here
} else {
$response->setRedirect($adapter->createLoginUri());
}
}
}
示例2: routeShutdown
public function routeShutdown(Zend_Controller_Request_Abstract $request)
{
require_once 'Sitengine/Env.php';
$frontController = Zend_Controller_Front::getInstance();
#print $request->getQuery(Sitengine_Env::PARAM_CONTROLLER);
#Sitengine_Debug::print_r($frontController->getControllers());
$controllerName = $frontController->getController($request->getQuery(Sitengine_Env::PARAM_CONTROLLER));
$request->setParam(Sitengine_Env::PARAM_CONTROLLER, $controllerName);
$request->setControllerName($controllerName);
$request->setActionName($request->getQuery(Sitengine_Env::PARAM_ACTION));
#$frontController->getDispatcher()->dispatch($request, $frontController->getResponse());
}
示例3: dispatchLoopShutdown
public function dispatchLoopShutdown()
{
$log = $this->_getLogger();
$coreLog = $this->_getLogCoreAccess();
$asyncLog = $this->_getLogAsyncAccess();
// Try to obtain the logged in user
$id = Zend_Auth::getInstance()->getIdentity();
$msg = '[' . (isset($id['username']) ? $id['username'] : '#unknown#') . '] ';
$msg .= $this->_method . ' ' . $this->_path;
// Calculate the time expend serving the request
$time = ceil((microtime(true) - $this->_time) * 1000);
$msg .= ' (' . $time . 'ms)';
// Check if the request was redirecto to the error controller
$error = $this->_request->getParam('error_handler');
if (NULL !== $error) {
$ex = $error->exception;
$msg .= ' [' . $ex->getCode() . '] ' . $ex->getMessage();
$log->err($msg);
if ($coreLog) {
$coreLog->err($msg);
}
if ($asyncLog) {
$asyncLog->err($msg);
}
} else {
$log->info($msg);
}
// Print debug information about the request
if ($this->_request instanceof Zend_Controller_Request_Http) {
$query = $this->_request->getQuery();
if (!empty($query)) {
$log->info(">>> Request (Query): " . http_build_query($query));
}
$headers = array();
if (!function_exists('apache_request_headers')) {
foreach ($_SERVER as $key => $value) {
if (substr($key, 0, 5) == "HTTP_") {
$name = str_replace(" ", "-", ucwords(strtolower(str_replace("_", " ", substr($key, 5)))));
$headers[] = "{$name}: {$value}";
}
}
} else {
foreach (getallheaders() as $name => $value) {
$headers[] = "{$name}: {$value}";
}
}
$log->debug(">>> Headers:\n" . implode("\n", $headers));
$body = $this->_request->getRawBody();
if (!empty($body)) {
$log->debug(">>> Request (Body):\n" . $body);
}
$resp = Zend_Controller_Front::getInstance()->getResponse();
$headers = array();
foreach ($resp->getHeaders() as $header) {
$headers[] = $header['name'] . ": " . $header['value'];
}
$log->debug("<<< Headers:\n" . implode("\n", $headers));
$log->debug("<<< Response:\n" . $resp->getBody());
}
}
示例4: preDispatch
public function preDispatch(Zend_Controller_Request_Abstract $request)
{
$req = array('GET' => $request->getQuery(), 'POST' => $request->getPost(), 'COOKIE' => $request->getCookie(), 'PARAMS' => $request->getUserParams());
$init = IDS_Init::init(APPLICATION_PATH . '/configs/phpids.ini');
$ids = new IDS_Monitor($req, $init);
$result = $ids->run();
if (!$result->isEmpty()) {
$compositeLog = new IDS_Log_Composite();
$compositeLog->addLogger(IDS_Log_File::getInstance($init));
$compositeLog->execute($result);
}
}
示例5: routeStartup
/**
* Called before Zend_Controller_Front begins evaluating the
* request against its routes.
*
* @param AbstractRequest $request
* @return void
*/
public function routeStartup(AbstractRequest $request)
{
if (!$request instanceof HttpRequest) {
return;
}
if ($request->getQuery('monitor') === 'x' && $request->isXmlHttpRequest()) {
$message = "A javascript error was detected.\n" . "================================\n" . 'Message: ' . $request->getPost('message', '') . "\n" . 'URI: ' . $request->getPost('errorUrl', 'unknown') . "\n" . 'Line: ' . $request->getPost('errorLine', 'unknown') . "\n";
Zend_Registry::get('monitor')->writeLog($message, Zend_Log::WARN, 'javascript-error');
// Immediately return empty response
$this->getResponse()->setBody('')->sendResponse();
exit;
}
}
示例6: routeStartup
/**
* Called before Zend_Controller_Front begins evaluating the
* request against its routes.
*
* @param Zend_Controller_Request_Abstract $request
* @return void
*/
public function routeStartup(Zend_Controller_Request_Abstract $request)
{
$frontController = Zend_Controller_Front::getInstance();
// Request keys
$moduleKey = $request->getModuleKey();
$controllerKey = $request->getControllerKey();
$actionKey = $request->getActionKey();
// Defaults
$moduleName = $frontController->getDefaultModule();
$controllerName = $frontController->getDefaultControllerName();
$actionName = $frontController->getDefaultAction();
// Set a url path
$module = $request->getQuery($moduleKey, $moduleName);
$controller = $request->getQuery($controllerKey, $controllerName);
$action = $request->getQuery($actionKey, $actionName);
// Assemble
if ($request->getPathInfo() == '/') {
$modulePart = $module == $moduleName ? $module : '/' . $module;
$controllerPart = $controller == $controllerName && $action == $actionName ? '' : '/' . $controller;
$actionPart = $action == $actionName && $controller ? '' : '/' . $action;
$request->setPathInfo($modulePart . $controllerPart . $actionPart);
}
}
示例7: routeShutdown
public function routeShutdown(Zend_Controller_Request_Abstract $request)
{
try {
$this->_statusRules($request->getModuleName(), $request->getControllerName(), $request->getActionName(), $request->getParam('resourceStack'));
$this->_aclRules($request->getModuleName(), $request->getControllerName(), $request->getActionName(), $request->getParam('resourceStack'), $request->getQuery());
$this->_workflowRules($request->getModuleName(), $request->getControllerName(), $request->getActionName(), $request->getParam('resourceStack'));
} catch (Saf_Controller_Front_Plugin_RouteRules_Exception $e) {
Saf_Debug::out('Enforcing Routing Rule: ' . $e->getMessage());
$request->setModuleName($e->getModuleName());
$request->setControllerName($e->getControllerName());
$request->setActionName($e->getActionName());
$request->setParam('resourceStack', $e->getResourceStack());
}
}
示例8: preDispatch
public function preDispatch(Zend_Controller_Request_Abstract $request)
{
$lang = $request->getQuery('lang');
if ($lang) {
setcookie("syj_lang", $lang, 0, "", "", false, true);
} else {
$lang = $request->getCookie('syj_lang');
}
if (!$lang) {
return;
}
$translator = Zend_Registry::get('Zend_Translate');
$adapter = $translator->getAdapter();
if (!$adapter->isAvailable($lang)) {
return;
}
$adapter->setLocale($lang);
}