fix: Edit events by uuid instead of id, fixes #1842

pull/1857/head
Iglocska 2017-01-15 09:05:17 +01:00
parent c3225e0679
commit d537fa4447
1 changed files with 7 additions and 0 deletions

View File

@ -1278,6 +1278,13 @@ class EventsController extends AppController {
}
public function edit($id = null) {
if (Validation::uuid($id)) {
$temp = $this->Event->find('first', array('recursive' => -1, 'fields' => array('Event.id'), 'conditions' => array('Event.uuid' => $id)));
if (empty($temp)) throw new NotFoundException('Invalid event');
$id = $temp['Event']['id'];
} else if (!is_numeric($id)) {
throw new NotFoundException(__('Invalid event'));
}
$this->Event->id = $id;
if (!$this->Event->exists()) {
throw new NotFoundException(__('Invalid event'));