本文整理汇总了PHP中Zend_Controller_Request_Abstract::getParam方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Controller_Request_Abstract::getParam方法的具体用法?PHP Zend_Controller_Request_Abstract::getParam怎么用?PHP Zend_Controller_Request_Abstract::getParam使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend_Controller_Request_Abstract
的用法示例。
在下文中一共展示了Zend_Controller_Request_Abstract::getParam方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: preDispatch
/**
* Nastavuje ktere menu zobrazit a uklada do registru
*
* @param Zend_Controller_Request_Abstract $request
* @todo Cachovat menu!!!
*/
public function preDispatch(Zend_Controller_Request_Abstract $request)
{
$auth = Zend_Auth::getInstance();
$identity = $auth->getIdentity();
if ($request->getParam('projekt') > 0) {
$this->_project = $request->getParam('projekt');
}
$this->_account = $request->getParam('account');
switch ($request->module) {
case 'mybase':
$env = isset($this->_project) ? 'sub' : 'main';
$config = new Zend_Config_Xml(APP_PATH . '/configs/navigation.xml', $env, true);
$registry = new Zend_Registry();
if ($registry->isRegistered('acl')) {
$acl = $registry->get('acl');
}
foreach ($config as $item) {
$item->params->account = $this->_account;
if (isset($item->pages)) {
foreach ($item->pages as $page) {
$page->params->account = $this->_account;
if (isset($page->params->projekt)) {
$page->params->projekt = $this->_project;
if ($acl->has($this->_project . '|' . $page->controller)) {
$page->resource = $this->_project . '|' . $page->controller;
} else {
$page->resource = 'noResource';
}
}
if (isset($page->pages)) {
foreach ($page->pages as $sub) {
$sub->params->account = $this->_account;
$sub->params->projekt = $this->_project;
if ($acl->has($this->_project . '|' . $page->controller)) {
$sub->resource = $this->_project . '|' . $page->controller;
} else {
$sub->resource = 'noResource';
}
}
}
}
}
}
$navigation = new Zend_Navigation($config);
Zend_Registry::set('Zend_Navigation', $navigation);
break;
default:
//Zend_Registry::set('Zend_Navigation', $this->_DefaultMenu());
break;
}
}
示例2: _initBrowsebox
/**
* Fetch a Browsebox object configured based on parameters found in the request.
*
* @param Zend_Controller_Request_Abstract $request The current request
* @return Garp_Browsebox
*/
protected function _initBrowsebox(Zend_Controller_Request_Abstract $request)
{
$bb = Garp_Browsebox::factory($request->getParam('id'));
if ($request->getParam('conditions')) {
$options = unserialize(base64_decode($request->getParam('conditions')));
if (!empty($options['filters'])) {
$conditions = base64_decode($options['filters']);
$conditions = explode(Garp_Browsebox::BROWSEBOX_QUERY_FILTER_SEPARATOR, $conditions);
foreach ($conditions as $condition) {
$parts = explode(':', $condition);
if (count($parts) < 2) {
continue;
}
$filterId = $parts[0];
$params = explode(Garp_Browsebox::BROWSEBOX_QUERY_FILTER_PROP_SEPARATOR, $parts[1]);
$bb->setFilter($filterId, $params);
}
}
unset($options['filters']);
foreach ($options as $key => $value) {
$bb->setOption($key, $value);
}
}
$chunk = $request->getParam('chunk');
if ($chunk < 1) {
$chunk = 1;
}
$bb->init($chunk);
return $bb;
}
示例3: dispatchLoopStartup
public function dispatchLoopStartup(Zend_Controller_Request_Abstract $request)
{
$authNamespace = new Zend_Session_Namespace('Gslab_Session');
$controller = $request->getParam('controller');
$action = $request->getParam('action');
$module = $request->getParam('module');
$baseUrl = Zend_Controller_Front::getInstance()->getBaseUrl();
if (!$this->_auth->hasIdentity() && $module == 'default' && $controller != 'login') {
$redirect = '/';
if ($action != 'index') {
$redirect = '/' . $action . $redirect;
}
if ($controller != 'index' || $action != 'index') {
$redirect = '/' . $controller . $redirect;
}
if ($module != 'default') {
$redirect = '/' . $module . $redirect;
}
$redirect = urlencode($redirect);
//$this->getResponse()->setRedirect($baseUrl . '/admin/login?redirect=' . $redirect, 302);
$request->setModuleName('default');
$request->setControllerName('login');
$request->setActionName('index');
}
}
示例4: preDispatch
public function preDispatch(Zend_Controller_Request_Abstract $request)
{
if ($request->getParam('sid') !== null && $request->getParam('PHPSESSID') === null) {
$request->setParam('PHPSESSID', $request->getParam('sid'));
}
if ($request->getParam('PHPSESSID') === null) {
$module = strtolower($request->getModuleName());
$controller = strtolower($request->getControllerName());
$action = strtolower($request->getActionName());
$route = $module . '/' . $controller . '/' . $action;
if (!in_array($route, $this->_whitelist)) {
if (is_null($this->_auth)) {
$auth = Zend_Auth::getInstance();
$auth->setStorage(new Zend_Auth_Storage_Session($this->getStorage()));
$this->_auth = $auth;
}
if (!$this->_auth->hasIdentity()) {
$errorHandler = new ArrayObject(array(), ArrayObject::ARRAY_AS_PROPS);
$errorHandler->type = 'EXCEPTION_NOT_ALLOWED';
$errorHandler->exception = new Zend_Controller_Action_Exception('No credentials available');
$errorHandler->request = clone $request;
$request->setParam('error_handler', $errorHandler)->setModuleName($this->getErrorHandlerModule())->setControllerName($this->getErrorHandlerController())->setActionName($this->getErrorHandlerAction());
} else {
$this->_auth->getIdentity()->connect();
$this->_auth->getIdentity()->refresh();
}
}
}
}
示例5: preDispatch
/**
* PreDispatch method for ACL Plugin. It checks if current user has privileges for resources requested
* @see Zend_Controller_Plugin_Abstract::preDispatch()
* @param Zend_Controller_Request_Abstract $request
*/
public function preDispatch(Zend_Controller_Request_Abstract $request)
{
try {
$module = strtolower($request->getParam('module'));
$controller = strtolower($request->getParam('controller'));
$action = strtolower($request->getParam('action'));
$resource = $module . ":" . $controller;
$acl = Zend_Registry::get('ZendACL');
$auth = Zend_Auth::getInstance();
$identity = $auth->getIdentity();
$roleID = $auth->hasIdentity() ? $auth->getIdentity()->role_id : 3;
#var_dump($acl->isAllowed( $roleID, $resource, $action), $roleID, $resource, $action);
#Zend_Debug::dump($module, $controller, $action, $roleID, $acl);
#die();
$redirector = Zend_Controller_Action_HelperBroker::getStaticHelper('redirector');
if ($acl->isAllowed($roleID, $resource, $action) != true) {
$redirector->gotoUrl('logout')->redirectAndExit();
} else {
return;
}
} catch (Exception $e) {
try {
$writer = new Zend_Log_Writer_Stream(APPLICATION_LOG_PATH . 'plugins.log');
$logger = new Zend_Log($writer);
$logger->log($e->getMessage(), Zend_Log::ERR);
} catch (Exception $e) {
}
}
}
示例6: preDispatch
public function preDispatch(Zend_Controller_Request_Abstract $request)
{
//set lang var to session
$nsLang = new Zend_Session_Namespace("Language");
$lang = "vi";
if ($request->getParam("lang") != "") {
$lang = $request->getParam("lang");
} else {
if ($nsLang->language != "") {
$lang = $nsLang->language;
}
}
$nsLang->language = $lang;
//Set back to session
$options = array('disableNotices' => true, 'logUntranslated' => false);
$commonLang = new Zend_Translate("tmx", APP_PATH . "/languages/common.tmx", $lang, $options);
$controller = $request->getControllerName();
$langPath = APP_PATH . "/languages/" . $controller . ".tmx";
if (file_exists($langPath)) {
$commonLang->addTranslation($langPath, $lang);
}
$registry = Zend_Registry::getInstance();
$registry->set("translate", $commonLang);
return $lang;
}
示例7: routeShutdown
public function routeShutdown(Zend_Controller_Request_Abstract $request)
{
if (!$this->_domain) {
$error = false;
if ($request->getParam('lang') && !$this->_issession) {
$this->_session->lang = $this->_model->fetchOne('id', array('`stitle` = ?' => $request->getParam('lang')));
if (!$this->_session->lang) {
$error = true;
}
}
$this->_lang = $this->_model->fetchRow(null, '(`id` = ' . (int) $this->_session->lang . ') DESC, (`default` = 1) DESC');
if ($this->_lang) {
$this->_lang = new Zkernel_View_Data($this->_lang);
$this->_lang->session = $this->_issession;
if (!$this->_domain) {
unset($this->_lang->domain);
}
}
$this->_lang->_default = $this->getDefault();
$this->_lang->_ids = $this->_model->fetchIds();
$front = Zend_Controller_Front::getInstance();
$router = $front->getRouter();
$router->setGlobalParam('lang', $this->_lang->stitle);
$this->save();
if ($error) {
throw new Zend_Controller_Action_Exception('Not Found', 404);
}
}
if (!$this->_domain && !$this->_issession && substr($_SERVER['REQUEST_URI'], 0, 8) == '/control') {
header('Location: /' . $this->_lang->_default->stitle . $_SERVER['REQUEST_URI'], true, 301);
exit;
}
}
示例8: _setTimestamp
/**
* Imposta il timestamp.
* Se non è stato passato con le opzioni prende come base il timestamp attuale e quindi lo modifica in base alla richiesta.
*/
protected function _setTimestamp()
{
if (!isset($this->_options['timestamp'])) {
$date = array('year' => (int) date('Y'), 'month' => (int) date('m'), 'day' => (int) date('d'), 'hour' => (int) date('h'), 'minute' => (int) date('i'), 'second' => (int) date('s'));
if ($this->_request->getParam('year')) {
$date['year'] = $this->_request->getParam('year');
}
if ($this->_request->getParam('month')) {
$date['month'] = $this->_request->getParam('month');
}
if ($this->_request->getParam('day')) {
$date['day'] = $this->_request->getParam('day');
}
if ($this->_request->getParam('hour')) {
$date['hour'] = $this->_request->getParam('hour');
}
if ($this->_request->getParam('minute')) {
$date['minute'] = $this->_request->getParam('minute');
}
if ($this->_request->getParam('second')) {
$date['second'] = $this->_request->getParam('second');
}
$date = array_merge($date, isset($this->_options['date']) ? $this->_options['date'] : array());
unset($this->_options['date']);
$this->_options['timestamp'] = mktime($date['hour'], $date['minute'], $date['second'], $date['month'], $date['day'], $date['year']);
}
}
示例9: authenticate
public function authenticate(Zend_Controller_Request_Abstract $request, Zend_Controller_Response_Abstract $response)
{
if ($request->getParam('error')) {
$this->_addError($request->getParam('error_description'));
return false;
}
try {
$cookie = new Garp_Store_Cookie('Garp_Auth');
// User returns from LinkedIn and has authorized the app
if ($request->getParam('code')) {
$accessToken = $this->_getLinkedInInstance()->getAccessToken($request->getParam('code'));
if ($cookie->extendedUserColumns) {
$this->setExtendedUserColumns(unserialize($cookie->extendedUserColumns));
$cookie->destroy('extendedUserColumns');
}
return $this->_getUserData($accessToken);
}
// User has not interacted yet, and needs to authorize the app
if (!empty($this->_extendedUserColumns)) {
$cookie->extendedUserColumns = serialize($this->_extendedUserColumns);
}
$cookie->writeCookie();
$authorizeUrl = $this->_getLinkedInInstance()->getLoginUrl(array(LinkedIn::SCOPE_BASIC_PROFILE, LinkedIn::SCOPE_EMAIL_ADDRESS));
Zend_Controller_Action_HelperBroker::getStaticHelper('redirector')->gotoUrl($authorizeUrl);
return false;
} catch (Exception $e) {
if (strpos($e->getMessage(), 'Duplicate entry') !== false && strpos($e->getMessage(), 'email_unique') !== false) {
$this->_addError(__('this email address already exists'));
return false;
}
$this->_addError(APPLICATION_ENV === 'development' ? $e->getMessage() : __('login error'));
return false;
}
}
示例10: _changeDispatch
private function _changeDispatch(Zend_Controller_Request_Abstract &$request, Zend_Controller_Response_Abstract $response)
{
$module = $request->getParam($request->getModuleKey());
$controller = $request->getParam($request->getControllerKey());
$action = $request->getParam($request->getActionKey());
$submodule = '';
$subcontroller = '';
$subaction = '';
if ('admin' != $module) {
$submodule = $module;
$subcontroller = $controller ? $controller : 'index';
$subaction = $action ? $action : 'index';
$controller = 'index';
$action = 'subroute';
$module = 'default';
} else {
$submodule = $controller;
$subcontroller = $action ? $action : 'index';
//долно быть настроено в route
//$subaction = ( $action ) ? $action : 'index';
$controller = 'index';
$action = 'subroute';
}
$request->setParam($request->getModuleKey(), $module);
$request->setModuleName($module);
$request->setParam($request->getControllerKey(), $controller);
$request->setControllerName($controller);
$request->setParam($request->getActionKey(), $action);
$request->setActionName($action);
$request->setParam('submodule', $submodule);
$request->setParam('subcontroller', $subcontroller);
$request->setParam('subaction', $subaction);
}
示例11: routeShutdown
/**
* Routes all (public) request to unknown modules to the standard
* Cms module / Page controller
*
* @param Zend_Controller_Request_Abstract $request
*/
public function routeShutdown(Zend_Controller_Request_Abstract $request)
{
//Set the locale at Zend_Translate
$locale = Zend_Registry::get('Zend_Locale');
if ($request->getParam('language') != null) {
$locale->setLocale($request->getParam('language'));
}
}
示例12: authenticate
/**
* Authenticate a user.
*
* @param Zend_Controller_Request_Abstract $request The current request
* @param Zend_Controller_Response_Abstract $response The current response
* @return array|bool User data,
* or FALSE when no user is logged in yet
*/
public function authenticate(Zend_Controller_Request_Abstract $request, Zend_Controller_Response_Abstract $response)
{
if (!$request->isPost()) {
return $this->acceptToken($request->getParam('token'), $request->getParam('uid'));
}
$this->requestToken($request->getPost());
return false;
}
示例13: dispatchLoopStartup
/**
* Called before Zend_Controller_Front enters its dispatch loop.
*
* @param Zend_Controller_Request_Abstract $request
* @return void
*/
public function dispatchLoopStartup(Zend_Controller_Request_Abstract $request)
{
$layout_route = $request->getParam('_layout', null);
$layout_param = $request->getParam('layout', $layout_route);
if (!is_null($layout_param)) {
Zend_Layout::getMvcInstance()->setLayout($layout_param);
}
}
示例14: preDispatch
/**
* checks whether a user needs a login and is loggedin
* otherwise redirect to login page
*
* @return void
*/
public function preDispatch(Zend_Controller_Request_Abstract $request)
{
// allways allow silent update (for easy cronjob)
if ($request->getControllerName() == 'update' && $request->getActionName() == 'silent') {
return;
}
// show login
if ($request->getParam('login', false) !== false) {
$request->setControllerName('index');
$request->setActionName('login');
return;
}
// logout?
if ($request->getParam('logout', false) !== false) {
Zend_Registry::get('session')->__unset('authenticated');
$request->setControllerName('index');
$request->setActionName('login');
return;
}
// disallow readonly mode if user has option public not set
if (Zend_Registry::get('session')->authenticated === 'readonly' && Zend_Registry::get('session')->public != 1) {
Zend_Registry::get('session')->authenticated = false;
}
// check whether user loggedin or public access allowed
if (Zend_Registry::get('session')->authenticated !== true && Zend_Registry::get('session')->authenticated !== 'readonly') {
// no login required?
$users = new application_models_users();
if (!$users->getUsername()) {
Zend_Registry::get('session')->authenticated = true;
// public access allowed? start public mode
} elseif (Zend_Registry::get('session')->public == 1) {
Zend_Registry::get('session')->authenticated = 'readonly';
// unallowed access -> show login window
} else {
$request->setControllerName('index');
$request->setActionName('login');
return;
}
}
// load default values 4 readonly mode
if (Zend_Registry::get('session')->authenticated === 'readonly') {
$priorityStart = Zend_Registry::get('session')->priorityStart;
$priorityEnd = Zend_Registry::get('session')->priorityEnd;
// reset session with default config from config.ini
Zend_Registry::get('bootstrap')->resetSession(false);
// set priority slider
Zend_Registry::get('session')->currentPriorityStart = $priorityStart;
Zend_Registry::get('session')->currentPriorityEnd = $priorityEnd;
Zend_Registry::get('session')->priorityStart = $priorityStart;
Zend_Registry::get('session')->priorityEnd = $priorityEnd;
}
// don't allow any changings in readonly mode
if (Zend_Registry::get('session')->authenticated !== true) {
if ($request->getControllerName() != 'error' && $request->getControllerName() != 'index' && $request->getControllerName() != 'patch' && !($request->getControllerName() == 'item' && $request->getActionName() == 'list') && !($request->getControllerName() == 'item' && $request->getActionName() == 'listmore') && !($request->getControllerName() == 'update' && $request->getActionName() == 'silent')) {
die('access denied');
}
}
}
示例15: _redirectNoAuth
protected function _redirectNoAuth(Zend_Controller_Request_Abstract $request)
{
if ($request->getParam('controller') == 'error' && $request->getParam('module') == 'default' && $request->getParam('action') == 'noauth') {
return;
}
$redir = Zend_Controller_Action_HelperBroker::getStaticHelper('Redirector');
$redir->setGotoRoute(array(), 'noauth', true);
$redir->redirectAndExit();
}