]> git.mxchange.org Git - friendica.git/blobdiff - mod/notifications.php
Update Pager->__construct calls for minimal use cases
[friendica.git] / mod / notifications.php
index 3934a32357b5c9989ab355bb9a237de758e53f6a..81084c1bc3f180a5c71297d2cdcdf01e6efcc65a 100644 (file)
@@ -7,16 +7,18 @@
 use Friendica\App;
 use Friendica\Content\ContactSelector;
 use Friendica\Content\Nav;
+use Friendica\Content\Pager;
 use Friendica\Core\L10n;
 use Friendica\Core\NotificationsManager;
 use Friendica\Core\Protocol;
 use Friendica\Core\System;
 use Friendica\Database\DBA;
+use Friendica\Module\Login;
 
 function notifications_post(App $a)
 {
        if (!local_user()) {
-               goaway(System::baseUrl());
+               $a->internalRedirect();
        }
 
        $request_id = (($a->argc > 1) ? $a->argv[1] : 0);
@@ -51,12 +53,12 @@ function notifications_post(App $a)
                                        'self' => false, 'blocked' => true, 'pending' => true];
                                DBA::delete('contact', $condition);
                        }
-                       goaway('notifications/intros');
+                       $a->internalRedirect('notifications/intros');
                }
 
                if ($_POST['submit'] == L10n::t('Ignore')) {
                        DBA::update('intro', ['ignore' => true], ['id' => $intro_id]);
-                       goaway('notifications/intros');
+                       $a->internalRedirect('notifications/intros');
                }
        }
 }
@@ -65,7 +67,7 @@ function notifications_content(App $a)
 {
        if (!local_user()) {
                notice(L10n::t('Permission denied.') . EOL);
-               return;
+               return Login::form();
        }
 
        $page = defaults($_REQUEST, 'page', 1);
@@ -119,11 +121,11 @@ function notifications_content(App $a)
        }
 
        // Set the pager
-       $a->set_pager_itemspage($perpage);
+       $pager = new Pager($a->query_string, $perpage);
 
        // Add additional informations (needed for json output)
-       $notifs['items_page'] = $a->pager['itemspage'];
-       $notifs['page'] = $a->pager['page'];
+       $notifs['items_page'] = $pager->getItemsPerPage();
+       $notifs['page'] = $pager->getPage();
 
        // Json output
        if (intval($json) === 1) {
@@ -314,7 +316,7 @@ function notifications_content(App $a)
                '$notif_content'   => $notif_content,
                '$notif_nocontent' => $notif_nocontent,
                '$notif_show_lnk'  => $notif_show_lnk,
-               '$notif_paginate'  => alt_pager($a, count($notif_content))
+               '$notif_paginate'  => $pager->renderMinimal(count($notif_content))
        ]);
 
        return $o;