コード例 #1
0
	/**
	  * Edit mail
	  *
	  * @param Tx_Powermail_Domain_Model_Mails $mail
	  * @return void
	  */
	public function editAction(Tx_Powermail_Domain_Model_Mails $mail) {
		$this->view->assign('mail', $mail);

		// get field array for output
		$fields = t3lib_div::trimExplode(',', $this->settings['edit']['fields'], 1);
		if (!$fields) {
			$fields = $this->div->getFieldsFromForm($this->settings['main']['form']);
		}
		foreach ((array) $fields as $key => $field) {
			$fields[$key] = $this->fieldsRepository->findByUid($field);
		}
		$this->view->assign('fields', $fields);

		// list pid
		if (empty($this->settings['list']['pid'])) {
			$this->settings['list']['pid'] = $GLOBALS['TSFE']->id;
		}
		$this->view->assign('listPid', $this->settings['list']['pid']);

		// single pid
		if (empty($this->settings['single']['pid'])) {
			$this->settings['single']['pid'] = $GLOBALS['TSFE']->id;
		}
		$this->view->assign('singlePid', $this->settings['single']['pid']);
	}
コード例 #2
0
	/**
	 * Validation of given Params
	 *
	 * @param $params
	 * @return bool
	 */
	public function isValid($params) {

		foreach ((array) $params as $uid => $value) {
			// get current field values
			$field = $this->fieldsRepository->findByUid($uid);
			if (!method_exists($field, 'getUid')) {
				continue;
			}

			// if validation of field or value empty
			if (empty($value) || !$field->getValidation()) {
				continue;
			}

			// if regex or filter found
			if (isset($this->regEx[$field->getValidation()])) {

				if (is_numeric($this->regEx[$field->getValidation()])) { // filter

					if (filter_var($value, $this->regEx[$field->getValidation()]) === false) { // check failed
						$this->addError('validation', $uid);
						$this->isValid = false;
					}

				} else { // regex

					if (preg_replace($this->regEx[$field->getValidation()], '', $value) != $value) { // check failed
						$this->addError('validation', $uid);
						$this->isValid = false;
					}

				}
			}

		}

		return $this->isValid;
  	}
コード例 #3
0
	/**
	 * Validation of given Captcha fields
	 *
	 * @param $params
	 * @return bool
	 */
	public function isValid($params) {
		if (!$this->formHasCaptcha()) {
			return $this->isValid;
		}

		foreach ((array) $params as $uid => $value) {
			// get current field values
			$field = $this->fieldsRepository->findByUid($uid);
			if (!method_exists($field, 'getUid')) {
				continue;
			}

			// if not a captcha field
			if ($field->getType() != 'captcha') {
				continue;
			}

			// if field wrong code given - set error
			$captcha = t3lib_div::makeInstance('Tx_Powermail_Utility_CalculatingCaptcha');
			if (!$captcha->validCode($value, $this->clearSession)) {
				$this->addError('captcha', $uid);
				$this->isValid = false;
			}

			// Captcha field found
			$this->captchaFound = true;
		}

		if ($this->captchaFound) {
			return $this->isValid;
		} else {
			// if no captcha vars given
			$this->addError('captcha', 0);
			return false;
		}
  	}
コード例 #4
0
    /**
     * Read Label of a field from given UID
     *
     * @param 	int 		field uid
     * @return 	string		Label
     */
    public function render($uid) {
		$field = $this->fieldsRepository->findByUid($uid);
		if (method_exists($field, 'getMarker')) {
			return $field->getMarker();
		}
    }