/**
  * Set passed data into the user object and return errors if data doesn't fit
  *
  * @access	private
  * @return	boolean
  */
 private function check_post_data()
 {
     $results = array();
     $errors = array();
     array_push($results, $this->_new_user->__set('_username', VPost::username()));
     array_push($results, $this->_new_user->__set('_nickname', VPost::username()));
     array_push($results, $this->_new_user->__set('_publicname', VPost::username()));
     array_push($results, $this->_new_user->__set('_email', VPost::email()));
     array_push($results, $this->_new_user->__set('_firstname', VPost::firstname()));
     array_push($results, $this->_new_user->__set('_lastname', VPost::lastname()));
     if (VPost::website()) {
         array_push($results, $this->_new_user->__set('_website', VPost::website()));
     }
     array_push($results, $this->_new_user->__set('_role', VPost::role()));
     if (VPost::pwd() == VPost::re_pwd()) {
         array_push($results, $this->_new_user->__set('_password', VPost::pwd()));
     } else {
         array_push($results, 'Passwords doesn\'t match');
     }
     foreach ($results as $result) {
         if ($result !== true) {
             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;
     }
 }
 /**
  * Install database with config.php already created
  *
  * @access	private
  */
 private function install_woc()
 {
     require_once 'config.php';
     $this->_db_host = DB_HOST;
     $this->_db_name = DB_NAME;
     $this->_db_user = DB_USER;
     $this->_db_pwd = DB_PWD;
     $this->_db_prefix = DB_PREFIX;
     $this->_ws_url = WS_URL;
     $this->_ws_name = WS_NAME;
     $this->_ws_email = WS_EMAIL;
     $this->_username = VPost::username();
     $this->_password = VPost::password();
     try {
         //try to connect to database, if not exception raisen and we create it
         $this->_db = new PDO('mysql:dbname=' . $this->_db_name . ';host=' . $this->_db_host . ';', $this->_db_user, $this->_db_pwd, array(PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8'));
         //create tables
         $this->create_activity();
         $this->create_category();
         $this->create_comment();
         $this->create_link();
         $this->create_media();
         $this->create_post();
         $this->create_setting();
         $this->create_user();
         $this->_result = 'successful';
     } catch (Exception $e) {
         if ($e->getMessage() == 'SQLSTATE[42000] [1049] Unknown database \'' . $this->_db_name . '\'') {
             try {
                 $this->_db = new PDO('mysql:host=' . $this->_db_host . ';', $this->_db_user, $this->_db_pwd, array(PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8'));
                 $this->create_database();
                 $this->_db = new PDO('mysql:dbname=' . $this->_db_name . ';host=' . $this->_db_host . ';', $this->_db_user, $this->_db_pwd, array(PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8'));
                 $this->create_activity();
                 $this->create_category();
                 $this->create_comment();
                 $this->create_link();
                 $this->create_media();
                 $this->create_post();
                 $this->create_setting();
                 $this->create_user();
                 $this->_result = 'successful';
             } catch (Exception $e) {
                 if ($e->getMessage() == 'false create') {
                     $this->_result = 'false create';
                 } else {
                     $this->_result = 'unknown';
                 }
             }
         } elseif ($e->getMessage() == 'false create') {
             $this->_result = 'false create';
         } else {
             $this->_result = 'unknown';
         }
     }
 }