X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=mod%2Fnotifications.php;h=b8029fd03fa928eb27ea8942a6fd629d9dfa00a6;hb=5635fe250ca4ef8e1dcf12cfe0f49b2a23c86b16;hp=ff131010f0871a2127eff649a5ad14801fbf3aac;hpb=e5c29fcc786cee73c08247824cb87e9ed65a2c36;p=friendica.git diff --git a/mod/notifications.php b/mod/notifications.php old mode 100755 new mode 100644 index ff131010f0..b8029fd03f --- a/mod/notifications.php +++ b/mod/notifications.php @@ -37,7 +37,11 @@ function notifications_post(&$a) { intval($intro_id) ); if(! $fid) { - $r = q("DELETE FROM `contact` WHERE `id` = %d AND `uid` = %d AND `self` = 0 LIMIT 1", + + // The check for blocked and pending is in case the friendship was already approved + // and we just want to get rid of the now pointless notification + + $r = q("DELETE FROM `contact` WHERE `id` = %d AND `uid` = %d AND `self` = 0 AND `blocked` = 1 AND `pending` = 1 LIMIT 1", intval($contact_id), intval(local_user()) ); @@ -65,6 +69,9 @@ function notifications_content(&$a) { nav_set_selected('notifications'); + $json = (($a->argc > 1 && $a->argv[$a->argc - 1] === 'json') ? true : false); + + $o = ''; $tabs = array( array( @@ -145,9 +152,9 @@ function notifications_content(&$a) { '$contact_id' => $rr['contact-id'], '$photo' => ((x($rr,'fphoto')) ? $rr['fphoto'] : "images/person-175.jpg"), '$fullname' => $rr['fname'], - '$url' => $rr['furl'], + '$url' => zrl($rr['furl']), '$hidden' => array('hidden', t('Hide this contact from others'), ($rr['hidden'] == 1), ''), - '$activity' => array('activity', t('Post a new friend activity'), 1, t('if applicable')), + '$activity' => array('activity', t('Post a new friend activity'), (intval(get_pconfig(local_user(),'system','post_newfriend')) ? '1' : 0), t('if applicable')), '$knowyou' => $knowyou, '$approve' => t('Approve'), @@ -194,8 +201,8 @@ function notifications_content(&$a) { '$photo' => ((x($rr,'photo')) ? $rr['photo'] : "images/person-175.jpg"), '$fullname' => $rr['name'], '$hidden' => array('hidden', t('Hide this contact from others'), ($rr['hidden'] == 1), ''), - '$activity' => array('activity', t('Post a new friend activity'), 1, t('if applicable')), - '$url' => $rr['url'], + '$activity' => array('activity', t('Post a new friend activity'), (intval(get_pconfig(local_user(),'system','post_newfriend')) ? '1' : 0), t('if applicable')), + '$url' => zrl($rr['url']), '$knowyou' => $knowyou, '$approve' => t('Approve'), '$note' => $rr['note'], @@ -207,7 +214,7 @@ function notifications_content(&$a) { } else info( t('No introductions.') . EOL); - + $o .= replace_macros($notif_tpl,array( '$notif_header' => t('Notifications'), '$tabs' => $tabs, @@ -225,7 +232,7 @@ function notifications_content(&$a) { `item`.`author-link`, `item`.`author-avatar`, `item`.`created`, `item`.`object` as `object`, `pitem`.`author-name` as `pname`, `pitem`.`author-link` as `plink` FROM `item` INNER JOIN `item` as `pitem` ON `pitem`.`id`=`item`.`parent` - WHERE `item`.`unseen` = 1 AND `item`.`visible` = 1 AND + WHERE `item`.`unseen` = 1 AND `item`.`visible` = 1 AND `pitem`.`parent` != 0 `item`.`deleted` = 0 AND `item`.`uid` = %d AND `item`.`wall` = 0 ORDER BY `item`.`created` DESC" , intval(local_user()) ); @@ -238,7 +245,7 @@ function notifications_content(&$a) { $notif_content = ''; - if (count($r) > 0) { + if ($r) { foreach ($r as $it) { switch($it['verb']){