]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - plugins/Event/newevent.php
Merge commit 'merge-requests/192' into statusnet_1.1.x
[quix0rs-gnu-social.git] / plugins / Event / newevent.php
index 2704501abddf5412028861b77c58d3fd9fbb8822..4c2157e01eebbe7b63843e820959618300713ade 100644 (file)
@@ -101,6 +101,7 @@ class NeweventAction extends Action
             $this->location    = $this->trimmed('location');
             $this->url         = $this->trimmed('url');
             $this->description = $this->trimmed('description');
+            $tz                = $this->trimmed('tz');
 
             $startDate = $this->trimmed('startdate');
 
@@ -128,13 +129,8 @@ class NeweventAction extends Action
                 $endTime = '00:00';
             }
 
-            $start = $startDate . ' ' . $startTime;
-
-            common_debug("Event start: '$start'");
-
-            $end = $endDate . ' ' . $endTime;
-
-            common_debug("Event start: '$end'");
+            $start = $startDate . ' ' . $startTime . ' ' . $tz;
+            $end   = $endDate . ' ' . $endTime . ' ' . $tz;
 
             $this->startTime = strtotime($start);
             $this->endTime   = strtotime($end);
@@ -194,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.'));
@@ -209,6 +206,11 @@ class NeweventAction extends Action
                 throw new ClientException(_m('Event must have an end time.'));
             }
 
+            if (!empty($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
@@ -233,6 +235,7 @@ class NeweventAction extends Action
         } catch (ClientException $ce) {
             if ($this->boolean('ajax')) {
                 $this->outputAjaxError($ce->getMessage());
+                return;
             } else {
                 $this->error = $ce->getMessage();
                 $this->showPage();