<?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;
* * You should have received a copy of the GNU Affero General Public * License along with this library. If not, see <http://www.gnu.org/licenses/>. * */ /** * redirect to the notification's href */ try { OCP\App::checkAppEnabled("notify"); OCP\User::checkLoggedIn(); $id = (int) $_GET["id"]; $uid = OCP\User::getUser(); $notification = OC_Notify::getNotificationById((int) $id); if ($notification && $notification["uid"] == $uid) { OC_Notify::markReadById($uid, $id, true); if ($notification["app"] == "notify") { switch ($notification["class"]) { case "sharedCalendar": case "sharedEvent": $href = OCP\Util::linkTo("calendar", "index.php"); break; case "sharedAbook": $href = OCP\Util::linkTo("contacts", "index.php"); break; case "sharedFile": $href = OCP\Util::linkTo("files", "index.php", array("dir" => "/Shared" . rtrim(dirname($notification["params"]["name"]), "/"))); break; case "sharedFolder": $href = OCP\Util::linkTo("files", "index.php", array("dir" => "/Shared" . $notification["params"]["name"])); break;