public function processform()
 {
     if (litepublisher::$options->group == 'ticket') {
         return '';
     }
     $tickets = ttickets::i();
     $status = isset($_POST['publish']) ? 'published' : (isset($_POST['setdraft']) ? 'draft' : (isset($_POST['setfixed']) ? 'fixed' : 'delete'));
     foreach ($_POST as $key => $id) {
         if (!is_numeric($id)) {
             continue;
         }
         $id = (int) $id;
         if ($status == 'delete') {
             $tickets->delete($id);
         } else {
             $ticket = tticket::i($id);
             if ($status == 'fixed') {
                 $ticket->set_state($status);
             } else {
                 $ticket->status = $status;
             }
             $tickets->edit($ticket);
         }
     }
 }
Example #2
0
 public function newpost()
 {
     return tticket::i();
 }
 public function processform()
 {
     /* dumpvar($_POST);
        return;
        */
     extract($_POST, EXTR_SKIP);
     $tickets = ttickets::i();
     $this->basename = 'tickets';
     $html = $this->html;
     // check spam
     if ($id == 0) {
         $newstatus = 'published';
         if (litepublisher::$options->group == 'ticket') {
             $hold = $tickets->db->getcount('status = \'draft\' and author = ' . litepublisher::$options->user);
             $approved = $tickets->db->getcount('status = \'published\' and author = ' . litepublisher::$options->user);
             if ($approved < 3) {
                 if ($hold - $approved >= 2) {
                     return $html->h4->noapproved;
                 }
                 $newstatus = 'draft';
             }
         }
     }
     if (empty($title)) {
         $lang = tlocal::i('editor');
         return $html->h4->emptytitle;
     }
     $ticket = tticket::i((int) $id);
     $ticket->title = $title;
     $ticket->categories = array((int) $combocat);
     if (isset($tags)) {
         $ticket->tagnames = $tags;
     }
     if ($ticket->author == 0) {
         $ticket->author = litepublisher::$options->user;
     }
     if (isset($files)) {
         $files = trim($files);
         $ticket->files = $files == '' ? array() : explode(',', $files);
     }
     $ticket->content = tcontentfilter::quote(htmlspecialchars($raw));
     $ticket->code = $code;
     $ticket->prio = $prio;
     $ticket->set_state($state);
     $ticket->version = $version;
     $ticket->os = $os;
     //if (litepublisher::$options->group != 'ticket') $ticket->state = $state;
     if ($id == 0) {
         $ticket->status = $newstatus;
         $ticket->categories = array((int) $combocat);
         $ticket->closed = time();
         $id = $tickets->add($ticket);
         $_GET['id'] = $id;
         $_POST['id'] = $id;
         $this->idpost = $id;
     } else {
         $tickets->edit($ticket);
     }
     return $html->h4->successedit;
 }