Пример #1
0
 /**
  * Proxy calls to undefined methods to getHelper()->direct()
  * 
  * 
  * @param string $method
  * @param array $params
  * @return mixed
  */
 public function __call($method, $params)
 {
     if (substr($method, -6) !== 'Action') {
         $helper = $this->_helper->getHelper($method);
         return call_user_func_array(array($helper, 'direct'), $params);
     }
     return parent::__call($method, $params);
 }
Пример #2
0
 public function preDispatch()
 {
     parent::preDispatch();
     $request = $this->getRequest();
     parent::__call($request->getActionName(), array());
     if (!$this->checkActionAccess($request->getControllerName(), $request->getActionName())) {
         throw new Rabotal_Exception_Access('Access denied!', 403);
     }
 }
Пример #3
0
 /**
  * Map an unknown call to the delegate manager
  *
  * @todo A flag to prevent recursive action loops?
  * @param string $name
  * @param array $args
  * @return mixed Return value of the delegated action
  */
 public function __call($name, $args)
 {
     if (substr(strtolower($name), -6) !== 'action') {
         return parent::__call($name, $args);
     } else {
         $manager = $this->_getDelegateManager();
         return $manager->run($name, $args);
     }
 }
 public function __call($method, $args = array())
 {
     // Proxy externals for
     if ('externalsAction' == $method) {
         $path = APPLICATION_PATH . '/application/libraries/Adminer';
         list($base, $static) = explode('externals', $_SERVER['REQUEST_URI']);
         $this->_outputFile($path . '/externals' . $static);
         exit;
     }
     parent::__call($methodName, $args);
 }
Пример #5
0
 public function __call($method, $args)
 {
     $arr = null;
     if (!preg_match('/^(.+)Action$/', $method, $arr)) {
         return parent::__call($method, $args);
     }
     $class = $arr[1];
     $actionController = new $class();
     if ($actionController && $actionController instanceof KalturaAdminConsolePlugin) {
         $actionController->action($this);
     }
 }
Пример #6
0
 public function __call($method, $args)
 {
     KalturaLog::debug("Called method [{$method}] with args [" . print_r($args, true) . "]");
     $arr = null;
     if (!preg_match('/^(.+)Action$/', $method, $arr)) {
         return parent::__call($method, $args);
     }
     $class = $arr[1];
     $actionController = new $class();
     if ($actionController && $actionController instanceof KalturaApplicationPlugin) {
         $actionController->action($this);
     }
 }
Пример #7
0
 public function __call($methodName, $args)
 {
     if (preg_match('~^(.*)Action$~', $methodName, $m)) {
         $action_name = $m[1];
         if (preg_match('~^(.*)(' . $this->_suffixes() . ')$~', $action_name, $m)) {
             $action_name = $m[1];
             $handler = $m[2];
         } else {
             $handler = 'run';
         }
         $capitaized_action_name = ucfirst(strtolower($action_name));
         $cn = $this->controller_name($this);
         $cd = $this->controller_dir();
         $action_class_path = $cd . $cn . DIRECTORY_SEPARATOR . $capitaized_action_name . 'Action.php';
         if (file_exists($action_class_path)) {
             require_once $action_class_path;
             $action_class = $this->module_name($this) . '_' . $cn . '_' . $capitaized_action_name . 'Action';
             $action = new $action_class($this);
             return $action->{$handler}();
         }
     }
     return parent::__call($methodName, $args);
 }
 /**
  * The router is set to /action and this segment of the url is overloaded
  * so that /someRecipient is also valid.  This __call method is invoked
  * whenever this segment of the url is not a defined action and in these
  * cases, the $actionMethod may be a valid recipient.  These sre trapped
  * here and, if valid, the request is re-dispatched to the index action to
  * which we pass a recipient parameter.
  * If a valid recipient is not found then execution is passed to the  parent
  * __call method.
  *
  * @param string $actionMethod Url segment.
  * @param array  $args         Request arguments.
  *
  * @return null
  */
 public function __call($actionMethod, $args)
 {
     $logger = ESAPI::getAuditor('IndexController');
     // I do not anticipate this happening often...
     if (!is_string($actionMethod)) {
         return parent::__call($actionMethod, $args);
     }
     // If there's less than two recipients defined, we don't need to trap
     // usernames. ignore them.
     if ($this->_recipientsConfig->count() < 2) {
         return parent::__call($actionMethod, $args);
     }
     // Strip the trailing 'Action' from the method name.
     $method = null;
     $detectedCharacterEncoding = mb_detect_encoding($actionMethod);
     $len = mb_strlen($actionMethod, $detectedCharacterEncoding);
     if (mb_substr($actionMethod, $len - 6, 6, $detectedCharacterEncoding) == 'Action') {
         $method = mb_substr($actionMethod, 0, $len - 6, $detectedCharacterEncoding);
     } else {
         $method = $actionMethod;
     }
     // Validate the possible recipient and, if valid, add a 'recipient'
     // request param and continue on to the indexAction of this controller.
     $recipientValidator = new Custom_Validate_ValidRecipient($this->_recipientsConfig);
     if ($recipientValidator->isValid($method)) {
         $this->_request->setActionName('index');
         $this->_request->setParams(array('recipient' => $method, 'action' => 'index'));
         $this->_request->setDispatched(false);
         return;
     }
     return parent::__call($actionMethod, $args);
 }
Пример #9
0
 public function __call($method, $args)
 {
     $retVal = null;
     try {
         $retVal = parent::__call($method, $args);
     } catch (Zend_Controller_Action_Exception $e) {
         list($found, $retVal) = Centurion_Traits_Common::checkTraitOverload($this, $method, $args);
         if (!$found) {
             throw $e;
         }
     }
     return $retVal;
 }
Пример #10
0
 public function __call($function, $args)
 {
     $method_name = '_' . $function;
     if (in_array($function, $this->_genericActionsEnabled) && method_exists($this, $method_name)) {
         return $this->{$method_name}();
     }
     if (preg_match('/(\\w+)Action\\z/', $function, $matches)) {
         $module = $this->getRequest()->getModuleName();
         $controller = $this->getRequest()->getControllerName();
         $filename = join('/', array($this->getFrontController()->getControllerDirectory($module), $controller, $matches[1] . '.php'));
         $className = ucfirst($controller) . '_' . ucfirst($matches[1]);
         if (file_exists($filename)) {
             require_once $filename;
             $action = new $className($this);
             //$action->dispatch();
             return $action;
         }
     }
     return parent::__call($function, $args);
 }
Пример #11
0
 public function __call($methodName, $args)
 {
     // jeżeli nie używać kolejki kroków
     if (!Base_Controller_Action_Helper_Steps::getUseSteps()) {
         return parent::__call($methodName, $args);
     }
     // jeżeli akcja nie jest akcją inicjującą proces
     if (substr($methodName, -13, 7) != 'Process' || substr($methodName, -6) != 'Action') {
         return parent::__call($methodName, $args);
     }
     $stepsHelper = $this->_helper->getHelper('steps');
     $processName = substr($methodName, 0, -13);
     // jeżeli akcja zamykająca proces, zakończ proces i przekieruj na wyszukiwanie
     if ($processName == 'stop') {
         $ownerAction = $stepsHelper->getOwnerAction();
         $this->_helper->messenger->error("Proces '" . $stepsHelper->getGeneralProcesDesc() . "' został anulowany");
         $stepsHelper->closeStepsQueue();
         $redirector = $this->_helper->getHelper('Redirector');
         $redirector->setExit(true);
         if ($ownerAction === false || !is_array($ownerAction)) {
             $this->_helper->redirector('index', 'index', null, array());
         } else {
             $this->_helper->redirector($ownerAction['action'], $ownerAction['controller'], null, $ownerAction['params']);
         }
         return;
     }
     // jeżeli jesteśmy w kolejce kroków
     if ($stepsHelper->isStepsQueue()) {
         // jeżeli wywołany proces jest innym procesem niż ten w kolejce
         if ($stepsHelper->getGeneralProcessName() != $processName) {
             $stepsHelper->closeStepsQueue();
             $stepsHelper->initNewProcess($processName);
         }
         // jeżeli kolejka kroków nie istnieje
     } else {
         $model = new Process();
         $row = $model->fetchRow($model->select('id')->where('process_name = ? ', $processName));
         if (is_null($row)) {
             return parent::__call($methodName, $args);
         }
         $stepsHelper->initNewProcess($processName);
     }
     $stepsHelper->forwardToActualStep($this->getRequest()->getParams());
 }