protected function save_new_event()
 {
     $event = array();
     $event['title'] = DB::escape($this->post->title);
     $event['description'] = DB::escape($this->post->description);
     $event['image'] = DB::escape($this->post->image);
     $event['time'] = DB::escape($this->post->time);
     $event['dep'] = DB::escape($this->post->dep);
     $event['arr'] = DB::escape($this->post->arr);
     $event['schedule'] = DB::escape($this->post->schedule);
     $event['limit'] = DB::escape($this->post->limit);
     $event['interval'] = DB::escape($this->post->interval);
     $event['active'] = DB::escape($this->post->active);
     $event['postnews'] = DB::escape($this->post->postnews);
     $event['month'] = DB::escape($this->post->month);
     $event['day'] = DB::escape($this->post->day);
     $event['year'] = DB::escape($this->post->year);
     if (!$event['image']) {
         $event['image'] = 'none';
     }
     foreach ($event as $test) {
         if (empty($test)) {
             $this->set('event', $event);
             $this->show('events/events_new_form.tpl');
             return;
         }
     }
     $event['date'] = $event['year'] . '-' . $event['month'] . '-' . $event['day'];
     EventsData::save_new_event($event['date'], $event['time'], $event['title'], $event['description'], $event['image'], $event['dep'], $event['arr'], $event['schedule'], $event['limit'], $event['interval'], $event['active']);
     if ($event['postnews'] == '1') {
         SiteData::AddNewsItem($event['title'], $event['description']);
     }
     $this->set('events', EventsData::get_upcoming_events());
     $this->set('history', EventsData::get_past_events());
     $this->show('events/events_index.tpl');
 }
Example #2
0
 protected function AddNewsItem()
 {
     $this->checkPermission(EDIT_NEWS);
     if ($this->post->subject == '') {
         return;
     }
     if ($this->post->body == '') {
         return;
     }
     if (!SiteData::AddNewsItem($this->post->subject, $this->post->body)) {
         $this->set('message', 'There was an error adding the news item');
     }
     $this->render('core_message.php');
     LogData::addLog(Auth::$userinfo->pilotid, 'Added news "' . $this->post->subject . '"');
 }