/**
  * Create a comment on a distant website
  *
  * @access	private
  */
 private function create()
 {
     if (VPost::submit(false) && VPost::content(false)) {
         try {
             $user = new User();
             $user->_id = $this->_user['user_id'];
             $user->read('_publicname');
             $user->read('_email');
             $data = array('name' => $user->_publicname, 'email' => $user->_email, 'content' => VPost::content(), 'id' => $this->_content['post']['POST_ID'], 'type' => 'post');
             $url = $this->_prefs->_data['timeline'][$this->_key]['url'] . 'admin/index.php?ns=rpc&ctl=comment';
             $curl = new Curl();
             $curl->_post = true;
             $curl->_data = $data;
             $curl->_url = $url;
             $curl->connect();
             $msg = json_decode($curl->_content, true);
             if ($msg['message'] !== true) {
                 throw new Exception('Error on distant website! ' . $this->_prefs->_data['timeline'][$this->_key]['title'] . ' says "' . $msg['message'] . '"');
             }
             $this->_action_msg = ActionMessages::custom_good('Comment submitted');
         } catch (Exception $e) {
             $this->_action_msg = ActionMessages::custom_wrong($e->getMessage());
         }
     }
 }
 /**
  * Set data from the form into the object
  *
  * If errors detected in the object it's returned into an array
  *
  * @access	private
  * @return	boolean
  */
 private function check_post_data()
 {
     $results = array();
     $errors = array();
     array_push($results, $this->_post->__set('_title', VPost::title()));
     array_push($results, $this->_post->__set('_content', VPost::content()));
     array_push($results, $this->_post->__set('_allow_comment', VPost::allow_comment('closed')));
     if (VPost::publish(false)) {
         array_push($results, $this->_post->__set('_status', 'publish'));
     } else {
         array_push($results, $this->_post->__set('_status', 'draft'));
     }
     array_push($results, $this->_post->__set('_category', implode(',', VPost::categories(array()))));
     //insertion of an empty aarray to return error message defined in the object
     array_push($results, $this->_post->__set('_tags', VPost::tags('divers')));
     if ($this->_action == 'to_insert') {
         array_push($results, $this->_post->__set('_permalink', Helper::slug($this->_post->__get('_title'))));
     }
     //we should make it in create method, but we need to handle the error
     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;
     }
 }