Blame view

sources/apps/calendar/ajax/event/sendmail.php 920 Bytes
923852aa1   Kload   Official Owncloud...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
  <?php
  /**
   * Copyright (c) 2013 Visitha Baddegama <visithauom@gmail.com>
   * This file is licensed under the Affero General Public License version 3 or
   * later.
   * See the COPYING-README file.
   */
  OCP\JSON::checkLoggedIn();
  OCP\JSON::checkAppEnabled('calendar');
  OCP\JSON::callCheck();
  
  $eventId = $_POST['eventId'];
  //check if user is actually allowed to access event
  $event = OC_Calendar_App::getEventObject($eventId);
  if($event === false || $event === null) {
  	\OCP\JSON::error();
  	exit;
  }
  
  $summary = $event['summary'];
  $location = $_POST['location'];
  $description = $_POST['description'];
  $dtstart = $_POST['dtstart'];
  $dtend = $_POST['dtend'];
  
  try {
  	OC_Calendar_App::sendEmails($eventId, $summary, $location, $description, $dtstart, $dtend);
  	\OCP\JSON::success();
  } catch(Exception $e) {
  	\OCP\Util::writeLog('calendar', 'sending mail failed (' . $e->getMessage() . ')', \OCP\Util::WARN);
  	\OCP\JSON::error();
  }