Esempio n. 1
0
 /**
  * Vérifie un email
  * @return object 2 attributs, bool success et array string msg
  */
 private function check()
 {
     $std = (object) array('success' => false, 'msg' => array());
     if (!$_SESSION['user']) {
         if (($res = Membre::checkPseudo($this->pseudo)) !== true) {
             $std->msg[] = $res;
         }
         if (($res = Membre::checkEmail($this->email)) !== true) {
             $std->msg[] = $res;
         }
         $captcha = new Captcha();
         if (($res = $captcha->check($this->captcha)) !== true) {
             $std->msg[] = $res;
         }
     }
     if (($res = $this->checkSujet($this->sujet)) !== true) {
         $std->msg[] = $res;
     }
     if (($res = $this->checkMessage($this->message)) !== true) {
         $std->msg[] = $res;
     }
     if (empty($std->msg)) {
         $std->success = true;
     }
     return $std;
 }
Esempio n. 2
0
 /**
  * Vérifie les attributs de l'inscription
  * @param array $param Les attributs à vérifier
  * @return object 2 attributs, bool success et array string msg
  * @static
  */
 private static function checkInscription(&$param)
 {
     $std = (object) array('success' => false, 'msg' => array());
     $captcha = new Captcha();
     if (($res = $captcha->check($param['g-recaptcha-response'])) === true) {
         if (($res = Membre::checkPseudo($param['pseudo'])) !== true) {
             $std->msg[] = $res;
         }
         if (($res = Membre::checkEmail($param['email'])) !== true) {
             $std->msg[] = $res;
         }
         if (($res = Membre::checkPass($param['password'], $param['passwordConfirm'])) !== true) {
             $std->msg[] = $res;
         }
         if (($res = Membre::checkConditions($param['conditions'])) !== true) {
             $std->msg[] = $res;
         }
     } else {
         $std->msg[] = $res;
     }
     if (empty($std->msg)) {
         $std->success = true;
     }
     return $std;
 }