X-Git-Url: https://reisub.nsupdate.info/git/?a=blobdiff_plain;f=mod%2Fnotifications.php;h=091323d998c725b136ad038abe5f185b6cbaba2c;hb=59d06b6c7809179339f3e8bf82467a85f17294b8;hp=0b7ac14d45e68378189ab6ae5d9893508c3dae4e;hpb=4e44b07dfe07dde78fe8a095fbb43d9ec1ffcb53;p=friendica.git%2F.git diff --git a/mod/notifications.php b/mod/notifications.php index 0b7ac14d45..091323d998 100644 --- a/mod/notifications.php +++ b/mod/notifications.php @@ -9,9 +9,9 @@ use Friendica\Content\ContactSelector; use Friendica\Content\Nav; use Friendica\Core\L10n; use Friendica\Core\NotificationsManager; +use Friendica\Core\Protocol; use Friendica\Core\System; -use Friendica\Database\dba; -use Friendica\Database\DBM; +use Friendica\Database\DBA; function notifications_post(App $a) { @@ -26,9 +26,9 @@ function notifications_post(App $a) } if ($request_id) { - $intro = dba::selectFirst('intro', ['id', 'contact-id', 'fid'], ['id' => $request_id, 'uid' => local_user()]); + $intro = DBA::selectFirst('intro', ['id', 'contact-id', 'fid'], ['id' => $request_id, 'uid' => local_user()]); - if (DBM::is_result($intro)) { + if (DBA::isResult($intro)) { $intro_id = $intro['id']; $contact_id = $intro['contact-id']; } else { @@ -42,20 +42,20 @@ function notifications_post(App $a) $fid = $intro['fid']; if ($_POST['submit'] == L10n::t('Discard')) { - dba::delete('intro', ['id' => $intro_id]); + DBA::delete('intro', ['id' => $intro_id]); if (!$fid) { // 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 $condition = ['id' => $contact_id, 'uid' => local_user(), 'self' => false, 'blocked' => true, 'pending' => true]; - dba::delete('contact', $condition); + DBA::delete('contact', $condition); } goaway('notifications/intros'); } if ($_POST['submit'] == L10n::t('Ignore')) { - dba::update('intro', ['ignore' => true], ['id' => $intro_id]); + DBA::update('intro', ['ignore' => true], ['id' => $intro_id]); goaway('notifications/intros'); } } @@ -87,10 +87,11 @@ function notifications_content(App $a) $perpage = 20; $startrec = ($page * $perpage) - $perpage; + $notif_header = L10n::t('Notifications'); + // Get introductions if ((($a->argc > 1) && ($a->argv[1] == 'intros')) || (($a->argc == 1))) { Nav::setSelected('introductions'); - $notif_header = L10n::t('Notifications'); $all = (($a->argc > 2) && ($a->argv[2] == 'all')); @@ -115,7 +116,6 @@ function notifications_content(App $a) } elseif (($a->argc > 1) && ($a->argv[1] == 'home')) { $notif_header = L10n::t('Home Notifications'); $notifs = $nm->homeNotifs($show, $startrec, $perpage); - } @@ -134,7 +134,7 @@ function notifications_content(App $a) $notif_tpl = get_markup_template('notifications.tpl'); // Process the data for template creation - if ($notifs['ident'] === 'introductions') { + if (defaults($notifs, 'ident', '') === 'introductions') { $sugg = get_markup_template('suggestions.tpl'); $tpl = get_markup_template("intros.tpl"); @@ -182,8 +182,8 @@ function notifications_content(App $a) // Normal connection requests default: - $friend_selected = (($it['network'] !== NETWORK_OSTATUS) ? ' checked="checked" ' : ' disabled '); - $fan_selected = (($it['network'] === NETWORK_OSTATUS) ? ' checked="checked" disabled ' : ''); + $friend_selected = (($it['network'] !== Protocol::OSTATUS) ? ' checked="checked" ' : ' disabled '); + $fan_selected = (($it['network'] === Protocol::OSTATUS) ? ' checked="checked" disabled ' : ''); $dfrn_tpl = get_markup_template('netfriend.tpl'); $knowyou = ''; @@ -193,8 +193,8 @@ function notifications_content(App $a) $helptext2 = ''; $helptext3 = ''; - if ($it['network'] === NETWORK_DFRN || $it['network'] === NETWORK_DIASPORA) { - if ($it['network'] === NETWORK_DFRN) { + if ($it['network'] === Protocol::DFRN || $it['network'] === Protocol::DIASPORA) { + if ($it['network'] === Protocol::DFRN) { $lbl_knowyou = L10n::t('Claims to be known to you: '); $knowyou = (($it['knowyou']) ? L10n::t('yes') : L10n::t('no')); $helptext = L10n::t('Shall your connection be bidirectional or not?'); @@ -216,7 +216,7 @@ function notifications_content(App $a) '$approve_as2' => $helptext2, '$approve_as3' => $helptext3, '$as_friend' => L10n::t('Friend'), - '$as_fan' => (($it['network'] == NETWORK_DIASPORA) ? L10n::t('Sharer') : L10n::t('Subscriber')) + '$as_fan' => (($it['network'] == Protocol::DIASPORA) ? L10n::t('Sharer') : L10n::t('Subscriber')) ]); $header = $it["name"]; @@ -227,7 +227,7 @@ function notifications_content(App $a) $header .= " (".ContactSelector::networkToName($it['network'], $it['url']).")"; - if ($it['network'] != NETWORK_DIASPORA) { + if ($it['network'] != Protocol::DIASPORA) { $discard = L10n::t('Discard'); } else { $discard = ''; @@ -277,7 +277,7 @@ function notifications_content(App $a) } // Normal notifications (no introductions) - } else { + } elseif (!empty($notifs['notifications'])) { // The template files we need in different cases for formatting the content $tpl_item_like = 'notifications_likes_item.tpl'; $tpl_item_dislike = 'notifications_dislikes_item.tpl';