getErrors() public méthode

@param void
public getErrors ( ) : array
Résultat array Array containing all error messages
Exemple #1
0
 /**
  * 	validateInstallationData
  * 	Validates data necessary for installation
  *
  * 	@param	array	$data.- Data to be validated
  *
  * 	@return	boolean	True on success, false otherwise
  */
 public static function validateInstallationData($data)
 {
     require_once Pommo::$_baseDir . 'classes/Pommo_Validate.php';
     self::$errors = array();
     $validator = new Pommo_Validate();
     $validator->setPost($data);
     $validator->addData('list_name', 'Other', false);
     $validator->addData('site_name', 'Other', false);
     $validator->addData('site_url', 'Url', false);
     $validator->addData('admin_password', 'Other', false);
     $validator->addData('admin_email', 'Email', false);
     $validator->addPasswordMatch('admin_password', 'admin_password2');
     $result = $validator->checkData();
     self::$errors = $validator->getErrors();
     return $result;
 }
Exemple #2
0
    $validator->setPost($_POST);
    $validator->addData('list_name', 'Other', false);
    $validator->addData('site_name', 'Other', false);
    $validator->addData('site_url', 'Url', false);
    $validator->addData('site_success', 'Url', true);
    $validator->addData('site_confirm', 'Url', true);
    $validator->addData('list_confirm', 'matchRegex', false, '!^(on|off)$!');
    $validator->addData('list_exchanger', 'matchRegex', false, '!^(sendmail|mail|smtp)$!');
    /**********************************
    		JSON OUTPUT INITIALIZATION
    	 *********************************/
    require_once Pommo::$_baseDir . 'classes/Pommo_Json.php';
    $json = new Pommo_Json();
    if ($result = $validator->checkData()) {
        // __ FORM IS VALID
        Pommo_Api::configUpdate($_POST);
        Pommo::reloadConfig();
        $json->success(Pommo::_T('Configuration Updated.'));
    } else {
        // __ FORM NOT VALID
        $fieldErrors = array();
        $errors = $validator->getErrors();
        foreach ($errors as $key => $val) {
            $fieldErrors[] = array('field' => $key, 'message' => $val);
        }
        $json->add('fieldErrors', $fieldErrors);
        $json->fail(Pommo::_T('Please review and correct errors with your submission.'));
    }
}
$view->assign($_POST);
$view->display('admin/setup/config/general');