Exemplo n.º 1
0
 /**
  * @see	\wcf\action\IAction::readParameters()
  */
 public function readParameters()
 {
     if (!MODULE_POLL) {
         throw new IllegalLinkException();
     }
     AbstractSecureAction::readParameters();
     if (isset($_POST['actionName'])) {
         $this->actionName = StringUtil::trim($_POST['actionName']);
     }
     if (isset($_POST['pollID'])) {
         $this->pollID = intval($_POST['pollID']);
     }
     $polls = PollManager::getInstance()->getPolls(array($this->pollID));
     if (!isset($polls[$this->pollID])) {
         throw new UserInputException('pollID');
     }
     $this->poll = $polls[$this->pollID];
     // load related object
     $this->relatedObject = PollManager::getInstance()->getRelatedObject($this->poll);
     if ($this->relatedObject === null) {
         if ($this->poll->objectID) {
             throw new SystemException("Missing related object for poll id '" . $this->poll->pollID . "'");
         }
     } else {
         $this->poll->setRelatedObject($this->relatedObject);
     }
     // validate action
     switch ($this->actionName) {
         case 'getResult':
             if (!$this->poll->canSeeResult()) {
                 throw new PermissionDeniedException();
             }
             break;
         case 'getVote':
         case 'vote':
             if (!$this->poll->canVote()) {
                 throw new PermissionDeniedException();
             }
             break;
         default:
             throw new SystemException("Unknown action '" . $this->actionName . "'");
             break;
     }
     if (isset($_POST['optionIDs']) && is_array($_POST['optionIDs'])) {
         $this->optionIDs = ArrayUtil::toIntegerArray($_POST['optionIDs']);
         if (count($this->optionIDs) > $this->poll->maxVotes) {
             throw new PermissionDeniedException();
         }
         $optionIDs = array();
         foreach ($this->poll->getOptions() as $option) {
             $optionIDs[] = $option->optionID;
         }
         foreach ($this->optionIDs as $optionID) {
             if (!in_array($optionID, $optionIDs)) {
                 throw new PermissionDeniedException();
             }
         }
     }
 }
Exemplo n.º 2
0
	/**
	 * @see	wcf\action\IAction::readParameters()
	 */
	public function readParameters() {
		parent::readParameters();
		
		if (isset($_POST['actionName'])) $this->actionName = StringUtil::trim($_POST['actionName']);
		if (isset($_POST['className'])) $this->className = StringUtil::trim($_POST['className']);
		if (empty($this->className) || !class_exists($this->className)) {
			throw new UserInputException('className');
		}
	}
Exemplo n.º 3
0
	/**
	 * @see	wcf\action\Action::readParameters()
	 */
	public function readParameters() {
		AbstractSecureAction::readParameters();
		
		if (isset($_POST['action'])) $this->action = StringUtil::trim($_POST['action']);
		if (isset($_POST['containerData']) && is_array($_POST['containerData'])) $this->containerData = $_POST['containerData'];
		if (isset($_POST['objectIDs']) && is_array($_POST['objectIDs'])) $this->objectIDs = ArrayUtil::toIntegerArray($_POST['objectIDs']);
		if (isset($_POST['pageClassName'])) $this->pageClassName = StringUtil::trim($_POST['pageClassName']);
		if (isset($_POST['type'])) $this->type = StringUtil::trim($_POST['type']);
	}
Exemplo n.º 4
0
	/**
	 * @see	wcf\action\IAction::readParameters()
	 */
	public function readParameters() {
		AbstractSecureAction::readParameters();
		
		if (isset($_POST['className'])) $this->className = $_POST['className'];
		if (isset($_POST['loopCount'])) $this->loopCount = intval($_POST['loopCount']);
		if (isset($_POST['parameters']) && is_array($_POST['parameters'])) $this->parameters = $_POST['parameters'];
		
		$this->validate();
	}
Exemplo n.º 5
0
 /**
  * @see	wcf\action\IAction::readParameters()
  */
 public function readParameters()
 {
     parent::readParameters();
     if (isset($_POST['parameters']) && is_array($_POST['parameters'])) {
         $this->parameters = $_POST['parameters'];
     }
     if (isset($_POST['typeName'])) {
         $this->typeName = StringUtil::trim($_POST['typeName']);
     }
 }
 /**
  * @see	\wcf\action\IAction::readParameters()
  */
 public function readParameters()
 {
     parent::readParameters();
     if (empty($this->templateName)) {
         throw new IllegalLinkException();
     }
     if (isset($_REQUEST['step'])) {
         $this->step = StringUtil::trim($_REQUEST['step']);
         // append step as part of template name
         $this->templateName .= StringUtil::firstCharToUpperCase($this->step);
     }
     $this->validateStep();
 }
Exemplo n.º 7
0
 /**
  * @see	wcf\action\IAction::readParameters()
  */
 public function readParameters()
 {
     parent::readParameters();
     if (isset($_POST['className'])) {
         $this->className = $_POST['className'];
     }
     if (isset($_POST['loopCount'])) {
         $this->loopCount = intval($_POST['loopCount']);
     }
     if (isset($_POST['parameters']) && is_array($_POST['parameters'])) {
         $this->parameters = $_POST['parameters'];
     }
     $this->validate();
 }
Exemplo n.º 8
0
 /**
  * @see	wcf\action\IAction::readParameters()
  */
 public function readParameters()
 {
     parent::readParameters();
     if (isset($_POST['className'])) {
         $this->className = StringUtil::trim($_POST['className']);
     }
     if (isset($_POST['actionName'])) {
         $this->actionName = StringUtil::trim($_POST['actionName']);
     }
     if (isset($_POST['objectIDs'])) {
         if (is_array($_POST['objectIDs'])) {
             $this->objectIDs = ArrayUtil::toIntegerArray($_POST['objectIDs']);
         }
     }
     if (isset($_POST['parameters'])) {
         if (is_array($_POST['parameters'])) {
             $this->parameters = $_POST['parameters'];
         }
     }
 }
Exemplo n.º 9
0
 /**
  * @see	\wcf\action\IAction::readParameters()
  */
 public function readParameters()
 {
     AbstractSecureAction::readParameters();
     if (isset($_POST['actionName'])) {
         $this->actionName = StringUtil::trim($_POST['actionName']);
     }
     if (isset($_POST['getFullQuoteObjectIDs'])) {
         $this->_getFullQuoteObjectIDs = intval($_POST['getFullQuoteObjectIDs']);
     }
     if (isset($_POST['objectTypes']) && is_array($_POST['objectTypes'])) {
         $this->objectTypes = ArrayUtil::trim($_POST['objectTypes']);
     }
     if (isset($_POST['quoteIDs'])) {
         $this->quoteIDs = ArrayUtil::trim($_POST['quoteIDs']);
         // validate quote ids
         foreach ($this->quoteIDs as $key => $quoteID) {
             if (MessageQuoteManager::getInstance()->getQuote($quoteID) === null) {
                 unset($this->quoteIDs[$key]);
             }
         }
     }
 }