From: Zach Copley Date: Thu, 8 Sep 2011 08:14:24 +0000 (-0700) Subject: * Validate event URL X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=449451b8e73645e1b20b66c20ba605f5819809e8;p=quix0rs-gnu-social.git * Validate event URL * Remove more debugging statements --- diff --git a/plugins/Event/newevent.php b/plugins/Event/newevent.php index 14e3168d42..34e83cd7e0 100644 --- a/plugins/Event/newevent.php +++ b/plugins/Event/newevent.php @@ -130,12 +130,7 @@ class NeweventAction extends Action } $start = $startDate . ' ' . $startTime . ' ' . $tz; - - common_debug("Event start: '$start'"); - - $end = $endDate . ' ' . $endTime . ' ' . $tz; - - common_debug("Event start: '$end'"); + $end = $endDate . ' ' . $endTime . ' ' . $tz; $this->startTime = strtotime($start); $this->endTime = strtotime($end); @@ -195,6 +190,7 @@ class NeweventAction extends Action function newEvent() { try { + if (empty($this->title)) { // TRANS: Client exception thrown when trying to post an event without providing a title. throw new ClientException(_m('Event must have a title.')); @@ -210,6 +206,11 @@ class NeweventAction extends Action throw new ClientException(_m('Event must have an end time.')); } + if (isset($this->url) && Validate::uri($this->url) === false) { + // TRANS: Client exception thrown when trying to post an event with an invalid URL. + throw new ClientException(_m('URL must be valid.')); + } + $options = array(); // Does the heavy-lifting for getting "To:" information