* Validate event URL

* Remove more debugging statements
This commit is contained in:
Zach Copley 2011-09-08 01:14:24 -07:00
parent a910d28132
commit 449451b8e7

View File

@ -130,12 +130,7 @@ class NeweventAction extends Action
} }
$start = $startDate . ' ' . $startTime . ' ' . $tz; $start = $startDate . ' ' . $startTime . ' ' . $tz;
$end = $endDate . ' ' . $endTime . ' ' . $tz;
common_debug("Event start: '$start'");
$end = $endDate . ' ' . $endTime . ' ' . $tz;
common_debug("Event start: '$end'");
$this->startTime = strtotime($start); $this->startTime = strtotime($start);
$this->endTime = strtotime($end); $this->endTime = strtotime($end);
@ -195,6 +190,7 @@ class NeweventAction extends Action
function newEvent() function newEvent()
{ {
try { try {
if (empty($this->title)) { if (empty($this->title)) {
// TRANS: Client exception thrown when trying to post an event without providing a title. // TRANS: Client exception thrown when trying to post an event without providing a title.
throw new ClientException(_m('Event must have 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.')); 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(); $options = array();
// Does the heavy-lifting for getting "To:" information // Does the heavy-lifting for getting "To:" information