Esempio n. 1
0
 /**
  * Create an item entry for a forum thread
  *
  * @param   integer  $id  Optional ID to use
  * @return  boolean
  */
 public function make($id = null)
 {
     if ($this->exists()) {
         return true;
     }
     $id = $id ?: Request::getInt('thread', 0);
     $this->_tbl->loadType($id, $this->_type);
     if ($this->exists()) {
         return true;
     }
     include_once PATH_CORE . DS . 'components' . DS . 'com_forum' . DS . 'models' . DS . 'post.php';
     $thread = new Post($id);
     if (!$thread->exists()) {
         $this->setError(Lang::txt('Forum thread not found.'));
         return false;
     }
     $this->set('type', $this->_type)->set('object_id', $thread->get('id'))->set('created', $thread->get('created'))->set('created_by', $thread->get('created_by'))->set('title', $thread->get('title'))->set('description', $thread->content('clean', 200))->set('url', $thread->link());
     if (!$this->store()) {
         return false;
     }
     return true;
 }