Exemplo n.º 1
0
 private function checkFormData()
 {
     $this->output['errors'] = false;
     if (empty($this->fname) || !$this->isName($this->fname)) {
         $this->output['errors']['fname'] = "Неверное имя";
     }
     if (empty($this->sname) || !$this->isName($this->sname)) {
         $this->output['errors']['sname'] = "Неверная фамилия";
     }
     if (empty($this->pname) || !$this->isName($this->pname)) {
         $this->output['errors']['pname'] = "Неверное отчество";
     }
     if (empty($this->dob) || !$this->isDate($this->dob)) {
         $this->output['errors']['dob'] = "Неверная дата";
     }
     if (empty($this->nick) || !$this->isNick($this->nick)) {
         $this->output['errors']['nick'] = "Неверный ник";
     }
     $uniqueNick = new UniqueNick();
     if (!$uniqueNick->isUniqueNick($this->nick)) {
         $this->output['errors']['nick'] = "Этот ник занят";
     }
     if (empty($this->country) || !$this->isGeoName($this->country)) {
         $this->output['errors']['country'] = "Неверная страна";
     }
     if (empty($this->region) || !$this->isGeoName($this->region)) {
         $this->output['errors']['region'] = "Неверный регион";
     }
     if (empty($this->city) || !$this->isGeoName($this->city)) {
         $this->output['errors']['city'] = "Неверный город";
     }
     if (empty($this->email) || !$this->isEmail($this->email)) {
         $this->output['errors']['email'] = "Неверный E-mail";
     }
     if (empty($this->tel) || !$this->isTelNumber($this->tel)) {
         $this->output['errors']['tel'] = "Неверный телефон";
     }
     if (empty($this->files) || !is_array($this->files)) {
         $this->output['errors']['files'] = "Неверные фотографии";
     } else {
         foreach ($this->files as $path) {
             if (empty($path) || !file_exists(PUBLIC_DIR . $path) || is_dir(PUBLIC_DIR . $path) || !getimagesize(PUBLIC_DIR . $path)) {
                 $this->output['errors']['files'] = "Неверные фотографии";
                 break;
             }
         }
     }
     if (empty($this->avatar) || isset($this->output['errors']['files']) || !in_array($this->avatar, $this->files)) {
         $this->output['errors']['avatar'] = "Неверный аватар";
     }
 }
 public function uniqueNick()
 {
     $uniqueNick = new UniqueNick();
     $this->_template->setHeader();
     $this->_template->showString($uniqueNick->isUniqueNick());
 }