Blame view

sources/apps/notify/ajax/markRead.php 460 Bytes
42e4f8d60   Kload   add all apps
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
  <?php
  OCP\JSON::checkLoggedIn();
  OCP\JSON::checkAppEnabled("notify");
  // FIXME CSRF !!
  if(isset($_POST["id"])) {
  	$id = (int)$_POST["id"];
  } else {
  	OCP\JSON::error();
  }
  if(isset($_POST["read"])) {
  	$read = (bool)$_POST["read"];
  }
  try {
  	$num = OC_Notify::markReadById(null, $id, $read);
  	OCP\JSON::success(array("unread" => OC_Notify::getUnreadNumber(), "num" => $num));
  } catch(Exception $e) {
  	OCP\JSON::error(array("message" => $e->getMessage()));
  }
  exit;