X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=mod%2Fnotify.php;h=02260514af91493b287a06438fd799e016c224e5;hb=53c10aaef13aa46553d1faf4775cb525931591e3;hp=e6a7a885966418d35c9dcf163410c8dfe74e1cfe;hpb=65ddefe9c5db4f5af9495377cd7e4463e8f68ef6;p=friendica.git diff --git a/mod/notify.php b/mod/notify.php index e6a7a88596..02260514af 100644 --- a/mod/notify.php +++ b/mod/notify.php @@ -11,14 +11,27 @@ function notify_init(&$a) { intval(local_user()) ); if(count($r)) { - q("update notify set seen = 1 where id = %d and uid = %d limit 1", - intval($a->argv[2]), + 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']), + dbesc($r[0]['otype']), intval(local_user()) ); + + // The friendica client has problems with the GUID. this is some workaround + if ($a->is_friendica_app()) { + require_once("include/items.php"); + $urldata = parse_url($r[0]['link']); + $guid = basename($urldata["path"]); + $itemdata = get_item_id($guid, local_user()); + if ($itemdata["id"] != 0) + $r[0]['link'] = $a->get_baseurl().'/display/'.$itemdata["nick"].'/'.$itemdata["id"]; + } + goaway($r[0]['link']); } - goaway($a->get_baseurl()); + goaway($a->get_baseurl(true)); } if($a->argc > 2 && $a->argv[1] === 'mark' && $a->argv[2] === 'all' ) { @@ -38,18 +51,18 @@ function notify_content(&$a) { return login(); $notif_tpl = get_markup_template('notifications.tpl'); - + $not_tpl = get_markup_template('notify.tpl'); require_once('include/bbcode.php'); $r = q("SELECT * from notify where uid = %d and seen = 0 order by date desc", intval(local_user()) ); - + if (count($r) > 0) { foreach ($r as $it) { $notif_content .= replace_macros($not_tpl,array( - '$item_link' => $a->get_baseurl().'/notify/view/'. $it['id'], + '$item_link' => $a->get_baseurl(true).'/notify/view/'. $it['id'], '$item_image' => $it['photo'], '$item_text' => strip_tags(bbcode($it['msg'])), '$item_when' => relative_date($it['date']) @@ -58,8 +71,8 @@ function notify_content(&$a) { } else { $notif_content .= t('No more system notifications.'); } - - $o .= replace_macros($notif_tpl,array( + + $o .= replace_macros($notif_tpl, array( '$notif_header' => t('System Notifications'), '$tabs' => '', // $tabs, '$notif_content' => $notif_content, @@ -68,4 +81,4 @@ function notify_content(&$a) { return $o; -} \ No newline at end of file +}