예제 #1
0
 /**
  * Factory method: Get the action
  * @param string $type
  * @return JD_Action the action
  */
 function &_getAction($type)
 {
     $action =& JD_Action::getInstance($type);
     return $action;
 }
예제 #2
0
파일: log.php 프로젝트: alphashuro/audeprac
 /**
  * This method can receive both single integer value, and an array
  */
 function _getAction()
 {
     global $mainframe;
     JRequest::checkToken() or die('Invalid token');
     $logId = JRequest::getInt('id');
     $logIds = JRequest::getVar('cid', array(), 'default', 'array');
     if (!empty($logIds)) {
         JArrayHelper::toInteger($logIds);
         $logId = reset($logIds);
     } else {
         $logIds = array($logId);
     }
     // Check the log
     $logRecord =& JTable::getInstance('Log', 'Table');
     if (!$logRecord->load($logId)) {
         JError::raiseError(404, JText::_('Cannot find log'));
         return false;
     }
     $action =& JD_Action::getInstance($logRecord->type);
     if (empty($action)) {
         JError::raiseError(404, JText::_('Cannot find action for type') . ': ' . $logRecord->type);
         return array(false, false);
     }
     return array(&$action, $logIds);
 }