* Handles creation and modification requests (POSTS) for events. * * @package Kiki * @author Rob Kaper <http://robkaper.nl/> * @copyright 2012 Rob Kaper <http://robkaper.nl/> * @license Released under the terms of the MIT license. */ // require_once "../../lib/init.php"; if ($_POST) { $event = new Event($_POST['eventId']); $errors = array(); if (!$user->id()) { $errors[] = "Je bent niet ingelogd."; } // In case of multiple authors who can proofread, amend: don't update unless empty. if (!$event->userId()) { $event->setUserId($user->id()); } list($date, $time) = explode(" ", $_POST['start']); list($day, $month, $year) = explode("-", $date); $start = "{$year}-{$month}-{$day} {$time}"; $event->setStart($start); list($date, $time) = explode(" ", $_POST['end']); list($day, $month, $year) = explode("-", $date); $end = "{$year}-{$month}-{$day} {$time}"; $event->setEnd($end); $event->setTitle($_POST['title']); $event->setDescription($_POST['description']); $event->setLocation($_POST['location']); $event->setFeatured(isset($_POST['featured']) && $_POST['featured'] == 'on' ? 1 : 0); $event->setVisible(isset($_POST['visible']) && $_POST['visible'] == 'on' ? 1 : 0);