]> git.mxchange.org Git - friendica.git/blobdiff - src/Module/Admin/Blocklist/Contact.php
post/thread views are renamed, search bugs fixed
[friendica.git] / src / Module / Admin / Blocklist / Contact.php
index 871a7ea7471e6bc068e93264306a8b10ad4c16b7..73cb16819004ed4c0aaf828c6c14d2e9ca8eb4bd 100644 (file)
@@ -1,4 +1,23 @@
 <?php
+/**
+ * @copyright Copyright (C) 2020, Friendica
+ *
+ * @license GNU AGPL version 3 or any later version
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <https://www.gnu.org/licenses/>.
+ *
+ */
 
 namespace Friendica\Module\Admin\Blocklist;
 
@@ -13,19 +32,19 @@ class Contact extends BaseAdmin
 {
        public static function post(array $parameters = [])
        {
-               parent::post($parameters);
+               self::checkAdminAccess();
+
+               self::checkFormSecurityTokenRedirectOnError('/admin/blocklist/contact', 'admin_contactblock');
 
                $contact_url  = $_POST['contact_url'] ?? '';
                $block_reason = $_POST['contact_block_reason'] ?? '';
                $contacts     = $_POST['contacts'] ?? [];
 
-               parent::checkFormSecurityTokenRedirectOnError('/admin/blocklist/contact', 'admin_contactblock');
-
                if (!empty($_POST['page_contactblock_block'])) {
                        $contact_id = Model\Contact::getIdForURL($contact_url);
                        if ($contact_id) {
                                Model\Contact::block($contact_id, $block_reason);
-                               notice(DI::l10n()->t('The contact has been blocked from the node'));
+                               info(DI::l10n()->t('The contact has been blocked from the node'));
                        } else {
                                notice(DI::l10n()->t('Could not find any contact entry for this URL (%s)', $contact_url));
                        }
@@ -35,7 +54,7 @@ class Contact extends BaseAdmin
                        foreach ($contacts as $uid) {
                                Model\Contact::unblock($uid);
                        }
-                       notice(DI::l10n()->tt('%s contact unblocked', '%s contacts unblocked', count($contacts)));
+                       info(DI::l10n()->tt('%s contact unblocked', '%s contacts unblocked', count($contacts)));
                }
 
                DI::baseUrl()->redirect('admin/blocklist/contact');
@@ -49,7 +68,7 @@ class Contact extends BaseAdmin
 
                $total = DBA::count('contact', $condition);
 
-               $pager = new Pager(DI::args()->getQueryString(), 30);
+               $pager = new Pager(DI::l10n(), DI::args()->getQueryString(), 30);
 
                $contacts = Model\Contact::selectToArray([], $condition, ['limit' => [$pager->getStart(), $pager->getItemsPerPage()]]);
 
@@ -70,7 +89,7 @@ class Contact extends BaseAdmin
                        '$h_newblock'  => DI::l10n()->t('Block New Remote Contact'),
                        '$th_contacts' => [DI::l10n()->t('Photo'), DI::l10n()->t('Name'), DI::l10n()->t('Reason')],
 
-                       '$form_security_token' => parent::getFormSecurityToken('admin_contactblock'),
+                       '$form_security_token' => self::getFormSecurityToken('admin_contactblock'),
 
                        // values //
                        '$baseurl'    => DI::baseUrl()->get(true),