function __construct($params) { parent::__construct($params); $this->type = 'options'; $this->setRequiredCapability('edit_settings'); $this->setNonceRequired(); $goal = $this->getParam('goal'); // check that goal number is present $v1 = owa_coreAPI::validationFactory('required'); $v1->setValues($goal['goal_number']); $this->setValidation('goal_number', $v1); // check that goal status is present $v1 = owa_coreAPI::validationFactory('required'); $v1->setValues($goal['goal_status']); $this->setValidation('goal_status', $v1); // check that goal status is present $v1 = owa_coreAPI::validationFactory('required'); $v1->setValues($goal['goal_group']); $this->setValidation('goal_group', $v1); // check that goal type is present $v1 = owa_coreAPI::validationFactory('required'); $v1->setValues($goal['goal_type']); $this->setValidation('goal_type', $v1); if ($goal['goal_type'] === 'url_destination') { // check that match_type is present $v1 = owa_coreAPI::validationFactory('required'); $v1->setValues($goal['details']['match_type']); $this->setValidation('match_type', $v1); // check that goal_url is present $v1 = owa_coreAPI::validationFactory('required'); $v1->setValues($goal['details']['goal_url']); $this->setValidation('goal_url', $v1); } $steps = $goal['details']['funnel_steps']; if (isset($goal['details']['funnel_steps'])) { foreach ($goal['details']['funnel_steps'] as $num => $step) { if (!empty($step['name']) || !empty($step['url'])) { // check that step name is present $v1 = owa_coreAPI::validationFactory('required'); $v1->setValues($step['name']); $this->setValidation('step_name_' . $num, $v1); // check that step url is present $v1 = owa_coreAPI::validationFactory('required'); $v1->setValues($step['url']); $this->setValidation('step_url_' . $num, $v1); } $check = owa_lib::array_values_assoc($step); if (!empty($check)) { $step['step_number'] = $num; $this->params['goal']['details']['funnel_steps'][$num] = $step; } else { // remove the array as it only contains empty values. // this can happen when the use adds a step but does not fill in any // values. unset($this->params['goal']['details']['funnel_steps'][$num]); } } } }
function __construct($params) { parent::__construct($params); $v0 = owa_coreAPI::validationFactory('userName'); $v0->setValues($this->getParam('user_id')); $v0->setConfig('stopOnError', true); $this->setValidation('user_id', $v0); }
function __construct($params) { parent::__construct($params); $v1 = owa_coreAPI::validationFactory('entityExists'); $v1->setConfig('entity', 'base.user'); $v1->setConfig('column', 'email_address'); $v1->setValues(trim($this->getParam('email_address'))); $v1->setErrorMessage($this->getMsg(3010)); $this->setValidation('email_address', $v1); }
function __construct($params) { parent::__construct($params); // Add validations to the run $v1 = owa_coreAPI::validationFactory('stringMatch'); $v1->setValues(array($this->getParam('password'), $this->getParam('password2'))); $v1->setErrorMessage("Your passwords must match."); $this->setValidation('password_match', $v1); $v2 = owa_coreAPI::validationFactory('stringLength'); $v2->setValues($this->getParam('password')); $v2->setConfig('operator', '>='); $v2->setConfig('length', 6); $v2->setErrorMessage("Your password must be at least 6 characters in length."); $this->setValidation('password_length', $v2); return; }
function __construct($params) { parent::__construct($params); $this->setRequiredCapability('edit_users'); $this->setNonceRequired(); // check that user_id is present $v1 = owa_coreAPI::validationFactory('required'); $v1->setValues($this->getParam('user_id')); $this->setValidation('user_id', $v1); // Check user name exists $v2 = owa_coreAPI::validationFactory('entityExists'); $v2->setConfig('entity', 'base.user'); $v2->setConfig('column', 'user_id'); $v2->setValues($this->getParam('user_id')); $v2->setErrorMessage($this->getMsg(3001)); $this->setValidation('user_id', $v2); }
function __construct($params) { parent::__construct($params); $this->setRequiredCapability('edit_sites'); $this->setNonceRequired(); // validations // check that siteId is present $v1 = owa_coreAPI::validationFactory('required'); $v1->setValues($this->getParam('siteId')); $this->setValidation('siteId', $v1); // Check site exists $v2 = owa_coreAPI::validationFactory('entityExists'); $v2->setConfig('entity', 'base.site'); $v2->setConfig('column', 'site_id'); $v2->setValues($this->getParam('siteId')); $v2->setErrorMessage($this->getMsg(3208)); $this->setValidation('siteId', $v2); }
function __construct($params) { parent::__construct($params); // require nonce $this->setNonceRequired(); //required params $v1 = owa_coreAPI::validationFactory('required'); $v1->setValues($this->getParam('db_host')); $v1->setErrorMessage("Database host is required."); $this->setValidation('db_host', $v1); $v2 = owa_coreAPI::validationFactory('required'); $v2->setValues($this->getParam('db_name')); $v2->setErrorMessage("Database name is required."); $this->setValidation('db_name', $v2); $v3 = owa_coreAPI::validationFactory('required'); $v3->setValues($this->getParam('db_user')); $v3->setErrorMessage("Database user is required."); $this->setValidation('db_user', $v3); $v4 = owa_coreAPI::validationFactory('required'); $v4->setValues($this->getParam('db_password')); $v4->setErrorMessage("Database password is required."); $this->setValidation('db_password', $v4); $v7 = owa_coreAPI::validationFactory('required'); $v7->setValues($this->getParam('db_type')); $v7->setErrorMessage("Database type is required."); $this->setValidation('db_type', $v7); // Config for the public_url validation $v5 = owa_coreAPI::validationFactory('subStringMatch'); $v5->setConfig('match', '/'); $v5->setConfig('length', 1); $v5->setValues($this->getParam('public_url')); $v5->setConfig('position', -1); $v5->setConfig('operator', '='); $v5->setErrorMessage("Your URL of OWA's base directory must end with a slash."); $this->setValidation('public_url', $v5); // Config for the domain validation $v6 = owa_coreAPI::validationFactory('subStringPosition'); $v6->setConfig('substring', 'http'); $v6->setValues($this->getParam('public_url')); $v6->setConfig('position', 0); $v6->setConfig('operator', '='); $v6->setErrorMessage("Please add http:// or https:// to the beginning of your public url."); $this->setValidation('public_url', $v6); }
function __construct($params) { parent::__construct($params); $this->setRequiredCapability('edit_sites'); // Config for the domain validation $domain_conf = array('substring' => 'http', 'position' => 0, 'operator' => '!=', 'errorMsgTemplate' => 'Please remove the "http://" from your beginning of your domain.'); // Add validations to the run $this->addValidation('domain', $this->params['domain'], 'subStringPosition', $domain_conf); $this->addValidation('domain', $this->params['domain'], 'required'); // Check user name exists $v2 = owa_coreAPI::validationFactory('entityDoesNotExist'); $v2->setConfig('entity', 'base.site'); $v2->setConfig('column', 'domain'); $v2->setValues($this->getParam('protocol') . $this->getParam('domain')); $v2->setErrorMessage($this->getMsg(3206)); $this->setValidation('domain', $v2); // require nonce for this action $this->setNonceRequired(); }
function __construct($params) { parent::__construct($params); $this->setRequiredCapability('edit_users'); $this->setNonceRequired(); // Check for user with the same email address // this is needed or else the change password feature will not know which account // to chane the password for. $v1 = owa_coreAPI::validationFactory('entityDoesNotExist'); $v1->setConfig('entity', 'base.user'); $v1->setConfig('column', 'email_address'); $v1->setValues(trim($this->getParam('email_address'))); $v1->setErrorMessage($this->getMsg(3009)); $this->setValidation('email_address', $v1); // Check user name. $v2 = owa_coreAPI::validationFactory('entityDoesNotExist'); $v2->setConfig('entity', 'base.user'); $v2->setConfig('column', 'user_id'); $v2->setValues(trim($this->getParam('user_id'))); $v2->setErrorMessage($this->getMsg(3001)); $this->setValidation('user_id', $v2); }
function __construct($params) { parent::__construct($params); // require nonce $this->setNonceRequired(); // validations $v1 = owa_coreAPI::validationFactory('required'); $v1->setValues($this->getParam('domain')); $v1->setErrorMessage($this->getMsg(3309)); $this->setValidation('domain', $v1); // validations $v2 = owa_coreAPI::validationFactory('required'); $v2->setValues($this->getParam('email_address')); $v2->setErrorMessage($this->getMsg(3310)); $this->setValidation('email_address', $v2); // validations $v5 = owa_coreAPI::validationFactory('required'); $v5->setValues($this->getParam('password')); $v5->setErrorMessage($this->getMsg(3310)); $this->setValidation('password', $v5); // Check entity exists $v3 = owa_coreAPI::validationFactory('entityDoesNotExist'); $v3->setConfig('entity', 'base.site'); $v3->setConfig('column', 'domain'); $v3->setValues($this->getParam('protocol') . $this->getParam('domain')); $v3->setErrorMessage($this->getMsg(3206)); $this->setValidation('domain', $v3); // Config for the domain validation $v4 = owa_coreAPI::validationFactory('subStringPosition'); $v4->setConfig('substring', 'http'); $v4->setValues($this->getParam('domain')); $v4->setConfig('position', 0); $v4->setConfig('operator', '!='); $v4->setErrorMessage($this->getMsg(3208)); $this->setValidation('domain', $v4); }
/** * Factory method for producing validation objects * * @return Object */ function validationFactory($class_file, $conf = array()) { return owa_coreAPI::validationFactory($class_file, $conf); }