3 * @copyright Copyright (C) 2010-2023, the Friendica project
5 * @license GNU AGPL version 3 or any later version
7 * This program is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU Affero General Public License as
9 * published by the Free Software Foundation, either version 3 of the
10 * License, or (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU Affero General Public License for more details.
17 * You should have received a copy of the GNU Affero General Public License
18 * along with this program. If not, see <https://www.gnu.org/licenses/>.
22 namespace Friendica\Module\Moderation;
25 use Friendica\Core\L10n;
26 use Friendica\Core\Renderer;
27 use Friendica\Core\Session\Capability\IHandleUserSessions;
28 use Friendica\Database\Database;
29 use Friendica\Model\Register;
30 use Friendica\Module\BaseModeration;
31 use Friendica\Module\Response;
32 use Friendica\Navigation\SystemMessages;
33 use Friendica\Util\Profiler;
34 use Psr\Log\LoggerInterface;
36 class Summary extends BaseModeration
41 public function __construct(Database $database, App\Page $page, App $app, SystemMessages $systemMessages, IHandleUserSessions $session, L10n $l10n, App\BaseURL $baseUrl, App\Arguments $args, LoggerInterface $logger, Profiler $profiler, Response $response, array $server, array $parameters = [])
43 parent::__construct($page, $app, $systemMessages, $session, $l10n, $baseUrl, $args, $logger, $profiler, $response, $server, $parameters);
45 $this->database = $database;
48 protected function content(array $request = []): string
53 [$this->t('Normal Account'), 0],
54 [$this->t('Automatic Follower Account'), 0],
55 [$this->t('Public Group Account'), 0],
56 [$this->t('Automatic Friend Account'), 0],
57 [$this->t('Blog Account'), 0],
58 [$this->t('Private Group Account'), 0]
63 $pageFlagsCountStmt = $this->database->p('SELECT `page-flags`, COUNT(`uid`) AS `count` FROM `user` WHERE `uid` != ? GROUP BY `page-flags`', 0);
64 while ($pageFlagsCount = $this->database->fetch($pageFlagsCountStmt)) {
65 $accounts[$pageFlagsCount['page-flags']][1] = $pageFlagsCount['count'];
66 $users += $pageFlagsCount['count'];
68 $this->database->close($pageFlagsCountStmt);
70 $this->logger->debug('accounts', ['accounts' => $accounts]);
72 $pending = Register::getPendingCount();
74 $t = Renderer::getMarkupTemplate('moderation/summary.tpl');
75 return Renderer::replaceMacros($t, [
76 '$title' => $this->t('Moderation'),
77 '$page' => $this->t('Summary'),
78 '$users' => [$this->t('Registered users'), $users],
79 '$accounts' => $accounts,
80 '$pending' => [$this->t('Pending registrations'), $pending],