本文整理汇总了PHP中Zend_Controller_Request_Abstract::getUserParam方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Controller_Request_Abstract::getUserParam方法的具体用法?PHP Zend_Controller_Request_Abstract::getUserParam怎么用?PHP Zend_Controller_Request_Abstract::getUserParam使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend_Controller_Request_Abstract
的用法示例。
在下文中一共展示了Zend_Controller_Request_Abstract::getUserParam方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: isAuthorizationRequired
/**
* Check if running authorization checks is required.
*
* @param Zend_Controller_Request_Abstract $request
* @return bool
*/
private function isAuthorizationRequired(Zend_Controller_Request_Abstract $request) {
$controller = $request->getControllerName();
$action = $request->getActionName();
// Any error controller call does not require any authorization
if ($controller === 'error') return false;
// An index/index action call does not require any authorization
if ($controller === 'index' && $action === 'index') return false;
// We require authentication for all actions, unless otherwise stated.
if ($request->getUserParam('skip-auth') !== null && $request->getUserParam('skip-auth') == true) {
return false;
}
return true;
}
示例2: toLog
/**
* Write data to log
*
* @param Zend_Controller_Request_Abstract $request
* @return void
*/
static function toLog($request)
{
//return;
$params = $request->getParams();
$serializer = Zend_Serializer::factory('PhpSerialize');
$db = Zend_Registry::get('db');
$logStat = Zend_Registry::get('Zend_LogStat');
$auth = Zend_Auth::getInstance();
$user_url = $_SERVER['REMOTE_ADDR'];
//------------------
// Получим адрес в виде: module/controller/action
$module = $request->getModuleName();
$controller = $request->getControllerName();
$action = $request->getActionName();
$url_action = "{$module}/{$controller}/{$action}";
$arrLogURL = array('default/user/view', 'default/user/videos');
// Определим данные для сохранения в лог
foreach ($arrLogURL as $urlLog) {
switch ($urlLog) {
case 'default/user/view':
// Открыть сообщение
if ($url_action == $urlLog) {
$urlPost = trim($request->getUserParam('url'));
$username = trim($request->getUserParam('username'));
$arrStat = array('author' => $username, 'post_url' => $urlPost, 'user_url' => $user_url);
if ($auth->hasIdentity()) {
$identity = $auth->getIdentity();
$arrStat['user'] = $identity->username;
}
$serialized = $serializer->serialize($arrStat);
$logStat->post_open($serialized);
}
break;
case 'default/user/videos':
// Открыть сообщение
if ($url_action == $urlLog && $params['type_action'] == 'play') {
$clip_id = $params['clip_id'];
$arrStat = array('clip_id' => $clip_id, 'user_url' => $user_url);
if ($auth->hasIdentity()) {
$identity = $auth->getIdentity();
$arrStat['user'] = $identity->username;
}
$serialized = $serializer->serialize($arrStat);
$logStat->video_play($serialized);
}
break;
default:
break;
}
}
}