本文整理汇总了PHP中Zend_Controller_Action::getRequest方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Controller_Action::getRequest方法的具体用法?PHP Zend_Controller_Action::getRequest怎么用?PHP Zend_Controller_Action::getRequest使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend_Controller_Action
的用法示例。
在下文中一共展示了Zend_Controller_Action::getRequest方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: gen_beforePageBuild
/**
* Redirect to controls if vlc is running
* @param Zend_Controller_Action $controller
*/
public function gen_beforePageBuild(Zend_Controller_Action $controller)
{
/*
$vlc = X_Vlc::getLastInstance();
if ( $vlc === null ) {
X_Debug::i("No vlc instance");
return;
}
*/
$controllerName = $controller->getRequest()->getControllerName();
$actionName = $controller->getRequest()->getActionName();
$query = "{$controllerName}/{$actionName}";
X_Debug::i("Plugin triggered for: {$query}");
//$isRunning = $vlc->isRunning();
$isRunning = X_Streamer::i()->isStreaming();
if (array_search($query, $this->redirectCond_To) !== false && $isRunning) {
$controller->getRequest()->setControllerName('controls')->setActionName('control')->setDispatched(false);
X_Debug::i("Redirect to controls/control");
} elseif (array_search($query, $this->redirectCond_Away) !== false && !$isRunning) {
X_Debug::i("Redirect to index/collections");
$controller->getRequest()->setControllerName('index')->setActionName('collections')->setDispatched(false);
} else {
X_Debug::i("No redirection: vlc is running? " . ($isRunning ? 'Yes' : 'No'));
}
}
示例2: doAction
public function doAction(Zend_Controller_Action $action)
{
$entryId = $action->getRequest()->getParam('entry-id');
$xslt = $action->getRequest()->getParam('xslt');
$this->client = Infra_ClientHelper::getClient();
$xml = $this->client->media->getMrss($entryId);
$xslParams = array();
$xslParams['entryDistributionId'] = '';
$xslParams['distributionProfileId'] = '';
ob_start();
$xmlDoc = new DOMDocument();
$xmlDoc->loadXML($xml);
$xsltDoc = new DOMDocument();
$xsltDoc->loadXML($xslt);
$xslt = new XSLTProcessor();
$xslt->registerPHPFunctions();
// it is safe to register all php fuctions here
$xslt->setParameter('', $xslParams);
$xslt->importStyleSheet($xsltDoc);
$ob = ob_get_clean();
ob_end_clean();
if ($ob) {
$action->getHelper('json')->direct(array('error' => $ob));
}
$obj = array('result' => $xslt->transformToXml($xmlDoc));
$action->getHelper('json')->direct($obj);
}
示例3: gen_beforePageBuild
/**
* Redirect to controls if vlc is running
* @param Zend_Controller_Action $controller
*/
public function gen_beforePageBuild(Zend_Controller_Action $controller)
{
X_Debug::i("Plugin triggered: redirect to installer");
$controllerName = $controller->getRequest()->getControllerName();
if ($controllerName != 'installer' && $controllerName != 'error') {
//die($controllerName);
$controller->getRequest()->setControllerName('installer')->setActionName('index')->setDispatched(false);
}
}
示例4: doAction
public function doAction(Zend_Controller_Action $action)
{
$request = $action->getRequest();
$page = $this->_getParam('page', 1);
$pageSize = $this->_getParam('pageSize', 10);
$form = new Form_PartnerIdFilter();
$form->populate($request->getParams());
$newForm = new Form_NewEventNotificationTemplate();
$actionUrl = $action->view->url(array('controller' => 'plugin', 'action' => 'EventNotificationTemplatesListAction'), null, true);
$form->setAction($actionUrl);
// init filter
$partnerFilter = $this->getPartnerFilterFromRequest($request);
$client = Infra_ClientHelper::getClient();
$eventNotificationPlugin = Kaltura_Client_EventNotification_Plugin::get($client);
// get results and paginate
$paginatorAdapter = new Infra_FilterPaginator($eventNotificationPlugin->eventNotificationTemplate, "listByPartner", null, $partnerFilter);
$paginator = new Infra_Paginator($paginatorAdapter, $request);
$paginator->setCurrentPageNumber($page);
$paginator->setItemCountPerPage($pageSize);
if ($partnerFilter) {
$newForm->getElement('newPartnerId')->setValue($partnerFilter->idIn);
}
// set view
$action->view->form = $form;
$action->view->newForm = $newForm;
$action->view->paginator = $paginator;
}
开发者ID:EfncoPlugins,项目名称:Media-Management-based-on-Kaltura,代码行数:27,代码来源:EventNotificationTemplatesListAction.php
示例5: doAction
public function doAction(Zend_Controller_Action $action)
{
$request = $action->getRequest();
$field = $request->getParam('field', null);
$id = $request->getParam('id', null);
$type = $request->getParam('type', null);
$reqponse = $this->query($type, array("{$field}Id" => array($id)), array("@timestamp" => "desc"), 100, array("sessionId"));
$json = array();
if (isset($reqponse->hits) && isset($reqponse->hits->hits)) {
$sessions = array();
foreach ($reqponse->hits->hits as $hit) {
if (isset($hit->fields) && isset($hit->fields->sessionId)) {
foreach ($hit->fields->sessionId as $sessionId) {
if (!in_array("{$sessionId}", $sessions)) {
$sessions[] = "{$sessionId}";
}
}
}
}
$reqponse = $this->query($type, array("sessionId" => $sessions), array("@timestamp" => "asc", "sessionIndex" => "asc"), 100000);
if (isset($reqponse->hits) && isset($reqponse->hits->hits)) {
$json = $reqponse->hits->hits;
}
}
echo $action->getHelper('json')->sendJson($json, false);
}
示例6: doAction
public function doAction(Zend_Controller_Action $action)
{
$client = Infra_ClientHelper::getClient();
$virusScanPlugin = Kaltura_Client_VirusScan_Plugin::get($client);
//create new form
$newForm = new Form_NewVirusScanProfile();
$page = $this->_getParam('page', 1);
$pageSize = $this->_getParam('pageSize', 10);
//get PartnerId
$partnerId = $this->_getParam('partnerId');
//filter form
$request = $action->getRequest();
$virusScanFilterForm = new Form_VirusScanFilter();
$virusScanFilterFormAction = $action->view->url(array('controller' => $request->getParam('controller'), 'action' => $request->getParam('action')), null, true);
$virusScanFilterForm->setAction($virusScanFilterFormAction);
$virusScanFilterForm->populate($request->getParams());
$virusScanFilter = $this->getVirusScanFilterFromRequest($request);
$newForm->getElement("newPartnerId")->setValue($virusScanFilter->partnerIdEqual);
//filter also by partnerId
if (!is_null($partnerId)) {
$virusScanFilter->partnerIdEqual = $partnerId;
}
$paginatorAdapter = new Infra_FilterPaginator($virusScanPlugin->virusScanProfile, "listAction", null, $virusScanFilter);
$paginator = new Infra_Paginator($paginatorAdapter);
$paginator->setCurrentPageNumber($page);
$paginator->setItemCountPerPage($pageSize);
$action->view->virusScanFilterForm = $virusScanFilterForm;
$action->view->newForm = $newForm;
$action->view->paginator = $paginator;
}
示例7: doAction
public function doAction(Zend_Controller_Action $action)
{
$request = $action->getRequest();
$page = $this->_getParam('page', 1);
$pageSize = $this->_getParam('pageSize', 10);
$partnerId = $this->_getParam('partnerId');
// init filter
$drmProfileFilter = $this->getDrmProfileFilterFromRequest($request);
$drmProfileFilter->orderBy = "-createdAt";
$client = Infra_ClientHelper::getClient();
$drmPluginClient = Kaltura_Client_Drm_Plugin::get($client);
// get results and paginate
$paginatorAdapter = new Infra_FilterPaginator($drmPluginClient->drmProfile, "listAction", null, $drmProfileFilter);
$paginator = new Infra_Paginator($paginatorAdapter, $request);
$paginator->setCurrentPageNumber($page);
$paginator->setItemCountPerPage($pageSize);
// set view
$drmProfileFilterForm = new Form_DrmProfileFilter();
$drmProfileFilterForm->populate($request->getParams());
$drmProfileFilterFormAction = $action->view->url(array('controller' => $request->getParam('controller'), 'action' => $request->getParam('action')), null, true);
$drmProfileFilterForm->setAction($drmProfileFilterFormAction);
$action->view->filterForm = $drmProfileFilterForm;
$action->view->paginator = $paginator;
$createProfileForm = new Form_CreateDrmProfile();
$actionUrl = $action->view->url(array('controller' => 'plugin', 'action' => 'DrmProfileConfigure'), null, true);
$createProfileForm->setAction($actionUrl);
if ($drmProfileFilter && isset($drmProfileFilter->partnerIdEqual)) {
$createProfileForm->getElement("newPartnerId")->setValue($drmProfileFilter->partnerIdEqual);
}
$action->view->newProfileForm = $createProfileForm;
}
示例8: preDispatch
/**
* Hook into action controller preDispatch() workflow
*
* @return void
*/
public function preDispatch()
{
$role = 'guest';
// die($role);
if ($this->_auth->hasIdentity()) {
$user = $this->_auth->getIdentity();
if (is_object($user)) {
$role = $this->_auth->getIdentity()->role;
}
}
$request = $this->_action->getRequest();
$controller = $request->getControllerName();
$action = $request->getActionName();
$module = $request->getModuleName();
// $this->view->getLayout()->setLayout($module);
$this->_controllerName = $controller;
$resource = $controller;
$privilege = $action;
if (!$this->_acl->has($resource)) {
$resource = null;
}
if (!$this->_acl->isAllowed($role, $resource, $privilege)) {
if (!$this->_auth->hasIdentity()) {
$noPermsAction = $this->_acl->getNoAuthAction();
} else {
$noPermsAction = $this->_acl->getNoAclAction();
}
$request->setModuleName($noPermsAction['module']);
$request->setControllerName($noPermsAction['controller']);
$request->setActionName($noPermsAction['action']);
$request->setDispatched(false);
}
}
示例9: getRequest
/**
* getRequest() -
*
* @return Zend_Controller_Request_Abstract $request
*/
public function getRequest()
{
if (null === $this->_request) {
$this->_request = $this->_actionController->getRequest();
}
return $this->_request;
}
示例10: preDispatch
/**
* Hook into action controller preDispatch() workflow
*
* @return void
*/
public function preDispatch()
{
$role = 'public';
if ($this->_auth->hasIdentity()) {
$user = $this->_auth->getIdentity();
if (is_object($user)) {
$role = $this->_auth->getIdentity()->role;
}
}
$request = $this->_action->getRequest();
$controller = $request->getControllerName();
$action = $request->getActionName();
$module = $request->getModuleName();
$this->_controllerName = $controller;
$resource = $controller;
$privilege = $action;
if (!$this->_acl->has($resource)) {
$resource = null;
}
if (!$this->_acl->isAllowed($role, $resource, $privilege)) {
$request->setModuleName('default');
$request->setControllerName('error');
$request->setActionName('error');
$request->setDispatched(false);
}
/**
if (!$this->_acl->isAllowed($role, $resource, $privilege)){
throw new Pas_Exception_NotAuthorised('Not authorised');
}
***/
}
示例11: doAction
public function doAction(Zend_Controller_Action $action)
{
$entryId = $action->getRequest()->getParam('entry-id');
$this->client = Infra_ClientHelper::getClient();
$action->getHelper('layout')->setLayout('layout_empty');
$action->view->entryId = $entryId;
$action->view->xml = $this->client->media->getMrss($entryId);
}
示例12: doAction
public function doAction(Zend_Controller_Action $action)
{
$request = $action->getRequest();
$page = $request->getParam('page', 1);
$pageSize = $request->getParam('pageSize', 10);
$action->view->form = new Form_PartnerFilter();
// init filter
$partnerFilter = $this->getPartnerFilterFromRequest($request);
/*
// get results and paginate
$paginatorAdapter = new Kaltura_FilterPaginator("metadataProfile", "listAction", null, $partnerFilter);
$paginator = new Kaltura_Paginator($paginatorAdapter, $request);
$paginator->setCurrentPageNumber($page);
$paginator->setItemCountPerPage($pageSize);
// popule the form
$form->populate($request->getParams());
// set view
$action->view->form = $form;
$action->view->paginator = $paginator;
*/
return;
$request = $action->getRequest();
$action->view->metadataProfilesForm = new Form_metadataProfiles();
$action->view->metadataProfilesForm->populate($request->getParams());
$partnerId = $request->getParam('partnerId', false);
$entryId = $request->getParam('entryId', false);
$freeText = $request->getParam('freeText', false);
$form = new Form_PartnerFilter();
$form->populate($request->getParams());
$action->view->form = $form;
if ($partnerId || $entryId || $freeText) {
try {
$client = Kaltura_ClientHelper::getClient();
$metadataProfileFilter = new KalturaMetadataProfileFilter();
$metadataProfileFilter->partnerIdEqual = $partnerId;
$this->view->inQueuePaginator = null;
//$client->user->add($systemUser);
} catch (Exception $ex) {
//to do
}
}
}
示例13: init
public function init()
{
parent::getRequest();
$this->view = new Smarty();
$this->view->template_dir = ROOT_DIR . '/application/views/';
$this->view->compile_dir = ROOT_DIR . '/application/views_c/';
$this->view->assign('BASE_URL', BASE_URL);
$this->view->assign('ROOT_DIR', ROOT_DIR);
$this->view->assign('ADMIN_DIR', ADMIN_DIR);
$this->view->assign('isAjax', $this->getIsAjaxRequest());
$this->view->caching = false;
$this->viewIncludes = array();
$this->dbAdapter = Zend_Registry::get('dbAdapter');
$this->auth = Zend_Auth::getInstance();
//---------- from predispatch
$request = $this->getRequest();
$controller = $request->getControllerName();
$action = $request->getActionName();
if (!$this->auth->hasIdentity() && $controller != 'auth') {
$this->_redirect('/auth/');
} else {
if ($this->auth->hasIdentity() && $controller == 'auth' && $action != 'logout') {
$this->_redirect('/');
}
}
// ---------------
if ($this->auth->hasIdentity()) {
$this->user = new User($this->auth->getStorage()->read()->u_id);
} else {
return;
}
$this->controllers = new ControllersHandler();
if (!$this->user->checkReadPerm($this->controllers->getControllerIdByName($this->getRequest()->getControllerName()))) {
$this->_redirect('/pages/');
}
/* if(!($this->siteId = $this->getCookie('cur_site_id')))
{
$this->siteId = 2;
}
*/
$sitesList = $this->getSitesList();
$this->tplVars['header'] = array('username' => $this->user->getLogin(), 'sites' => $sitesList, 'curSite' => $sitesList['names'][$this->siteId], 'curHost' => $this->getNCSiteHostname(), 'controllers' => $this->getControllersList(), 'actions' => array('selected' => $this->getRequest()->getActionName()), 'curController' => $this->getRequest()->getControllerName(), 'adminHost' => $this->getXadmin());
$this->tplVars['page_css'] = array();
$this->tplVars['page_js'] = array();
$config = new Zend_Config_Ini(ROOT_DIR . '/application/config.ini', 'general');
$filter = $config->log->toArray();
foreach ($filter as $k => $f) {
$filter[$k] = explode(",", $f);
}
if (isset($filter[$controller]) && in_array($action, $filter[$controller])) {
$this->to_log();
}
}
示例14: elseif
function gen_beforePageBuild(Zend_Controller_Action $controller)
{
$moduleName = $controller->getRequest()->getModuleName();
$controllerName = $controller->getRequest()->getControllerName();
$actionName = $controller->getRequest()->getActionName();
$providerName = $controller->getRequest()->getParam('p', false);
// check permission class
if ($controllerName == 'browse' && $actionName == 'share') {
// check provider too only if controller == browse
$resourceKey = "{$moduleName}/{$controllerName}/{$actionName}" . ($providerName !== false ? "/{$providerName}" : '');
} else {
$resourceKey = "{$moduleName}/{$controllerName}/{$actionName}";
}
// TODO:
// replace this with an ACL call:
// if ( !$acl->canUse($resource, $currentStatus) )
if (array_search("{$moduleName}/{$controllerName}/{$actionName}", $this->_whiteList) === false) {
if (!$this->isLoggedIn()) {
X_Debug::i("Login required and user not logged in");
if ($this->helpers()->devices()->isVlc()) {
X_Debug::i("Look like it's this vlc: {$_SERVER['REMOTE_ADDR']}");
if (gethostbyname($_SERVER['REMOTE_ADDR']) == '::1' || gethostbyname($_SERVER['REMOTE_ADDR']) == '127.0.0.1') {
X_Debug::i("Skipping auth, it should be the local vlc");
return;
}
} elseif ($this->helpers()->devices()->isWiimc() && $this->helpers()->devices()->isWiimcBeforeVersion('1.1.6')) {
// wiimc <= 1.1.5 send 2 different user-agent string
// for browsing mode and video mode
// so i have care about this
// TODO remove this when 1.1.5 an older will be deprecated
// anyway i take care only of vanilla wiimc based on ios58. custom version
// not supported
$useragent = "{$_SERVER['HTTP_USER_AGENT']} (IOS58)";
// try to add " (ISO58)" to the useragent and check again
if (Application_Model_AuthSessionsMapper::i()->fetchByIpUserAgent($_SERVER['REMOTE_ADDR'], $useragent)) {
X_Debug::i("Workaround for WIIMC user-agent-incongruence");
return;
}
} elseif ($this->helpers()->acl()->canUseAnonymously($resourceKey)) {
X_Debug::i("Resource can be used anonymously");
return;
}
X_Debug::w("Auth required, redirecting to login");
$controller->getRequest()->setControllerName("auth")->setActionName('index')->setDispatched(false);
} elseif ($this->config('acl.enabled', false)) {
X_Debug::i("ACL enabled, checking resource {{$resourceKey}}");
$username = $this->getCurrentUser(true);
if (!$this->helpers()->acl()->canUse($username, $resourceKey)) {
X_Debug::w("Forbidden, can't access resource");
$controller->getRequest()->setControllerName("auth")->setActionName('forbidden')->setDispatched(false);
} else {
X_Debug::i("Access granted");
}
} else {
X_Debug::i("ACL disabled");
}
} else {
X_Debug::i("Whitelisted resource");
}
}
示例15: doAction
public function doAction(Zend_Controller_Action $action)
{
$action->getHelper('layout')->disableLayout();
$request = $action->getRequest();
$drmProfileId = $this->_getParam('drm_profile_id');
$partnerId = $this->_getParam('new_partner_id');
$drmProfileProvider = $this->_getParam('new_drm_profile_provider');
$drmProfileForm = null;
$action->view->formValid = false;
try {
if ($request->isPost()) {
$partnerId = $this->_getParam('partnerId');
$drmProfileProvider = $this->_getParam('provider');
$drmProfileForm = new Form_DrmProfileConfigure($partnerId, $drmProfileProvider);
$action->view->formValid = $this->processForm($drmProfileForm, $request->getPost(), $partnerId, $drmProfileId);
if (!is_null($drmProfileId)) {
$drmProfile = $drmProfileForm->getObject("Kaltura_Client_Drm_Type_DrmProfile", $request->getPost(), false, true);
}
} else {
if (!is_null($drmProfileId)) {
$client = Infra_ClientHelper::getClient();
$drmPluginClient = Kaltura_Client_Drm_Plugin::get($client);
$drmProfile = $drmPluginClient->drmProfile->get($drmProfileId);
$partnerId = $drmProfile->partnerId;
$drmProfileProvider = $drmProfile->provider;
$drmProfileForm = new Form_DrmProfileConfigure($partnerId, $drmProfileProvider);
$drmProfileForm->populateFromObject($drmProfile, false);
} else {
$drmProfileForm = new Form_DrmProfileConfigure($partnerId, $drmProfileProvider);
$drmProfileForm->getElement('partnerId')->setValue($partnerId);
}
}
} catch (Exception $e) {
$action->view->formValid = false;
KalturaLog::err($e->getMessage() . "\n" . $e->getTraceAsString());
$action->view->errMessage = $e->getMessage();
}
$action->view->form = $drmProfileForm;
$pluginInstances = KalturaPluginManager::getPluginInstances('IKalturaApplicationPartialView');
KalturaLog::debug("plugin instances [" . count($pluginInstances) . "]");
foreach ($pluginInstances as $pluginInstance) {
$drmProfilePlugins = $pluginInstance->getApplicationPartialViews('plugin', get_class($this));
if (!$drmProfilePlugins) {
continue;
}
foreach ($drmProfilePlugins as $plugin) {
/* @var $plugin Kaltura_View_Helper_PartialViewPlugin */
$plugin->plug($action->view);
}
}
}