1 <?php # vim:ts=2:sw=2:et:
2 /* For licensing and copyright terms, see the file named LICENSE */
3 include '../../inc/common.php';
5 $me = mtrack_canon_username(MTrackAuth::whoami());
7 if ($me == 'anonymous' || MTrackAuth::getUserClass() == 'anonymous') {
11 if ($_SERVER['REQUEST_METHOD'] == 'POST') {
15 $value = json_decode($v);
17 $db = MTrackDB::get();
18 $db->beginTransaction();
19 MTrackDB::q('delete from watches where otype = ? and oid = ? and userid = ?',
22 foreach ($value as $medium => $events) {
23 foreach ($events as $evt => $value) {
24 MTrackDB::q('insert into watches (otype, oid, userid, medium, event, active) values (?, ?, ?, ?, ?, 1)',
25 $object, $id, $me, $medium, $evt);