aboutsummaryrefslogtreecommitdiffstats
path: root/mod
diff options
context:
space:
mode:
authorfriendica <info@friendica.com>2013-02-03 19:07:01 -0800
committerfriendica <info@friendica.com>2013-02-03 19:07:01 -0800
commit9dcecb6b3704037cb13e8a6350b5df83f6917a40 (patch)
tree7095ac50e1fea699e2d2a003cbfbf4f864846471 /mod
parent4ae5445e032aadd918dc75ca71bc6819f05bb2f4 (diff)
downloadvolse-hubzilla-9dcecb6b3704037cb13e8a6350b5df83f6917a40.tar.gz
volse-hubzilla-9dcecb6b3704037cb13e8a6350b5df83f6917a40.tar.bz2
volse-hubzilla-9dcecb6b3704037cb13e8a6350b5df83f6917a40.zip
finish up the "mark all xyz seen" for all known values of xyz
Diffstat (limited to 'mod')
-rw-r--r--mod/notify.php13
-rw-r--r--mod/ping.php43
2 files changed, 45 insertions, 11 deletions
diff --git a/mod/notify.php b/mod/notify.php
index 3157e8ce8..23ba098b7 100644
--- a/mod/notify.php
+++ b/mod/notify.php
@@ -10,7 +10,7 @@ function notify_init(&$a) {
intval(argv(2)),
intval(local_user())
);
- if(count($r)) {
+ if($r) {
q("update notify set seen = 1 where ( link = '%s' or ( parent != 0 and parent = %d and otype = '%s' )) and uid = %d",
dbesc($r[0]['link']),
intval($r[0]['parent']),
@@ -24,15 +24,6 @@ function notify_init(&$a) {
}
- if(argc() > 2 && argv(1) === 'mark' && argv(2) === 'all' ) {
- $r = q("update notify set seen = 1 where uid = %d",
- intval(local_user())
- );
- $j = json_encode(array('result' => ($r) ? 'success' : 'fail'));
- echo $j;
- killme();
- }
-
}
@@ -49,7 +40,7 @@ function notify_content(&$a) {
intval(local_user())
);
- if (count($r) > 0) {
+ if($r) {
foreach ($r as $it) {
$notif_content .= replace_macros($not_tpl,array(
'$item_link' => $a->get_baseurl(true).'/notify/view/'. $it['id'],
diff --git a/mod/ping.php b/mod/ping.php
index 477b9ff0d..4ab7a68cb 100644
--- a/mod/ping.php
+++ b/mod/ping.php
@@ -48,6 +48,49 @@ function ping_init(&$a) {
killme();
}
+ if(x($_REQUEST,'markRead') && local_user()) {
+ switch($_REQUEST['markRead']) {
+ case 'network':
+ $r = q("update item set item_flags = ( item_flags ^ %d ) where (item_flags & %d) and uid = %d",
+ intval(ITEM_UNSEEN),
+ intval(ITEM_UNSEEN),
+ intval(local_user())
+ );
+ break;
+
+ case 'home':
+ $r = q("update item set item_flags = ( item_flags ^ %d ) where (item_flags & %d) and (item_flags & %d) and uid = %d",
+ intval(ITEM_UNSEEN),
+ intval(ITEM_UNSEEN),
+ intval(ITEM_WALL),
+ intval(local_user())
+ );
+ break;
+ case 'messages':
+ $r = q("update mail set mail_flags = ( item_flags ^ %d ) where uid = %d and not (item_flags & %d)",
+ intval(MAIL_SEEN),
+ intval(local_user()),
+ intval(MAIL_SEEN)
+ );
+ break;
+ case 'all_events':
+ $r = q("update event set ignore = 1 where ignore = 0 and uid = %d",
+ intval(local_user())
+ );
+ break;
+
+ case 'notify':
+ $r = q("update notify set seen = 1 where uid = %d",
+ intval(local_user())
+ );
+ break;
+
+ default:
+ break;
+ }
+ }
+
+
if(argc() > 1 && argv(1) === 'notify') {
$t = q("select count(*) as total from notify where uid = %d and seen = 0",
intval(local_user())