public function processform()
 {
     $widget = tpostcatwidget::i();
     if (isset($_POST['mode'])) {
         extract($_POST, EXTR_SKIP);
         switch ($mode) {
             case 'add':
                 $_GET['idwidget'] = $widget->add($widgettitle, $content, $template, tposteditor::processcategories());
                 break;
             case 'edit':
                 $id = isset($_GET['idwidget']) ? (int) $_GET['idwidget'] : 0;
                 if ($id == 0) {
                     $id = isset($_POST['idwidget']) ? (int) $_POST['idwidget'] : 0;
                 }
                 $item = $widget->items[$id];
                 $item['title'] = $widgettitle;
                 $item['content'] = $content;
                 $item['template'] = $template;
                 $item['cats'] = tposteditor::processcategories();
                 $widget->items[$id] = $item;
                 $widget->save();
                 $widgets = twidgets::i();
                 $widgets->items[$id]['title'] = $widgettitle;
                 $widgets->save();
                 break;
         }
     } else {
         $this->deletewidgets($widget);
     }
 }
 public function processform()
 {
     $widget = texcerptslide::i();
     $id = (int) tadminhtml::getparam('idwidget', 0);
     if (isset($widget->items[$id])) {
         $widget->items[$id]['maxcount'] = (int) $_POST['maxcount'];
         $widget->items[$id]['invertorder'] = isset($_POST['invertorder']);
         $widget->save();
         litepublisher::$urlmap->clearcache();
         return '';
     }
     $tags = array();
     foreach ($widget->items as $id => $item) {
         $tags[] = $item['idtag'];
     }
     $list = tposteditor::processcategories();
     $add = array_diff($list, $tags);
     $delete = array_diff($tags, $list);
     if (count($add) == 0 && count($delete) == 0) {
         return '';
     }
     $widget->lock();
     foreach ($delete as $idtag) {
         $widget->tagdeleted($idtag);
     }
     foreach ($add as $idtag) {
         $widget->add($idtag);
     }
     $widget->unlock();
     litepublisher::$urlmap->clearcache();
 }
 public function processform()
 {
     $widget = tsubcatwidget::i();
     $id = (int) tadminhtml::getparam('idwidget', 0);
     if (isset($widget->items[$id])) {
         $item = $widget->items[$id];
         extract($_POST, EXTR_SKIP);
         $item['maxcount'] = (int) $maxcount;
         $item['showcount'] = isset($showcount);
         $item['showsubitems'] = isset($showsubitems);
         $item['sortname'] = $sort;
         $widget->items[$id] = $item;
         $widget->save();
         return '';
     }
     $tags = array();
     foreach ($widget->items as $id => $item) {
         $tags[] = $item['idtag'];
     }
     $list = tposteditor::processcategories();
     $add = array_diff($list, $tags);
     $delete = array_diff($tags, $list);
     if (count($add) == 0 && count($delete) == 0) {
         return '';
     }
     $widget->lock();
     foreach ($delete as $idtag) {
         $widget->tagdeleted($idtag);
     }
     foreach ($add as $idtag) {
         $widget->add($idtag);
     }
     $widget->unlock();
 }
 public function processform()
 {
     $tickets = ttickets::i();
     $tickets->cats = tposteditor::processcategories();
     $tickets->save();
 }
Esempio n. 5
0
 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;
 }