public function editpost(tpost $post) { extract($_POST, EXTR_SKIP); $posts = tposts::i(); $html = tadminhtml::i(); if ($this->checkspam && $id == 0) { $post->status = 'published'; $hold = $posts->db->getcount('status = \'draft\' and author = ' . litepublisher::$options->user); $approved = $posts->db->getcount('status = \'published\' and author = ' . litepublisher::$options->user); if ($approved < 3) { if ($hold - $approved >= 2) { return $this->norights; } $post->status = 'draft'; } } if ($this->insertsource) { $post->meta->sourceurl = $sourceurl; } $post->title = $title; $post->categories = tposteditor::processcategories(); if (litepublisher::$options->user > 1) { $post->author = litepublisher::$options->user; } if (isset($files)) { $files = trim($files); $post->files = $files == '' ? array() : explode(',', $files); } $post->content = tcontentfilter::remove_scripts($raw); if ($this->insertsource) { $post->filtered = sprintf($this->sourcetml, $post->meta->sourceurl) . $post->filtered; } if ($id == 0) { $id = $posts->add($post); $_GET['id'] = $id; $_POST['id'] = $id; } else { $posts->edit($post); } return $html->h4->successedit; }
public function processform() { // return dumpvar($_POST); extract($_POST, EXTR_SKIP); $posts = tposts::i(); $this->basename = 'posts'; $html = $this->html; if ($id == 0) { $forum = tforum::i(); if (!$forum->moderate || litepublisher::$options->ingroup('editor')) { $status = 'published'; } else { $status = 'draft'; // if too many drafts then reject $hold = $posts->db->getcount('status = \'draft\' and author = ' . litepublisher::$options->user); if ($hold >= 3) { return $html->manydrafts; } } if (empty($title)) { $lang = tlocal::i('editor'); return $html->h4->emptytitle; } } $post = tpost::i((int) $id); $post->title = $title; $post->categories = array((int) $category); if ($post->author == 0) { $post->author = litepublisher::$options->user; } if (isset($files)) { $files = trim($files); $post->files = $files == '' ? array() : explode(',', $files); } $post->content = tcontentfilter::remove_scripts($raw); if ($id == 0) { $post->status = $status; $post->comstatus = $forum->comstatus; $post->idview = $forum->idview; $post->idperm = $forum->idperm; $post->url = tlinkgenerator::i()->addurl($post, 'forum'); $id = $posts->add($post); $_GET['id'] = $id; $_POST['id'] = $id; $this->idpost = $id; } else { $posts->edit($post); } return $html->h4->successedit; }