コード例 #1
0
 /**
  * Set data in user object and returns errors if data doesn't fit
  *
  * @access	private
  * @return	boolean
  */
 private function check_post_data()
 {
     $results = array();
     $errors = array();
     array_push($results, $this->_profile->__set('_firstname', VPost::firstname()));
     array_push($results, $this->_profile->__set('_lastname', VPost::lastname()));
     array_push($results, $this->_profile->__set('_nickname', VPost::nickname()));
     array_push($results, $this->_profile->__set('_publicname', VPost::public_name()));
     if (VPost::role(false)) {
         //don't set when update own profile
         array_push($results, $this->_profile->__set('_role', VPost::role()));
     }
     array_push($results, $this->_profile->__set('_email', VPost::email()));
     array_push($results, $this->_profile->__set('_website', VPost::website()));
     array_push($results, $this->_profile->__set('_msn', VPost::msn()));
     array_push($results, $this->_profile->__set('_twitter', VPost::twitter()));
     array_push($results, $this->_profile->__set('_facebook', VPost::fb()));
     array_push($results, $this->_profile->__set('_google', VPost::google()));
     array_push($results, $this->_profile->__set('_avatar', VPost::avatar()));
     array_push($results, $this->_profile->__set('_bio', VPost::bio()));
     if (VPost::new_pwd(false) && VPost::new_pwd() == VPost::re_new_pwd()) {
         array_push($results, $this->_profile->__set('_password', Helper::make_password($this->_profile->_username, VPost::new_pwd())));
     } elseif (VPost::new_pwd(false) && VPost::new_pwd() != VPost::re_new_pwd()) {
         array_push($results, 'Passwords does\'t match');
     }
     foreach ($results as $result) {
         if ($result !== true) {
             //so it contains an error message
             array_push($errors, '<li>- ' . $result . '<li>');
         }
     }
     if (!empty($errors)) {
         $error_msg = 'Check your informations:<br/><ul>' . implode('', $errors) . '</ul>';
         $this->_action_msg = ActionMessages::custom_wrong($error_msg);
         return false;
     } else {
         return true;
     }
 }