X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=notifyall%2Fnotifyall.php;h=270557c4bec24748f72af292d0bf0bd23c21f82e;hb=97fcee53c04345271c62df18f44e6fad948a3d0e;hp=7b23255388f6ea0be58a0110cf87d44151d7e54e;hpb=2c69a9c3597c7363b5ebf3010f276e0225dff35c;p=friendica-addons.git diff --git a/notifyall/notifyall.php b/notifyall/notifyall.php index 7b232553..270557c4 100644 --- a/notifyall/notifyall.php +++ b/notifyall/notifyall.php @@ -15,19 +15,14 @@ use Friendica\Core\Logger; use Friendica\Core\Renderer; use Friendica\DI; -function notifyall_install() -{ - Logger::log("installed notifyall"); -} - -function notifyall_uninstall() -{ - Logger::log("removed notifyall"); -} - +/** + * This is a statement rather than an actual function definition. The simple + * existence of this method is checked to figure out if the addon offers a + * module. + */ function notifyall_module() {} -function notifyall_addon_admin(App $a, &$o) +function notifyall_addon_admin(App $a, string &$o) { $o = '
    ' . DI::l10n()->t('Send email to all members') . '
'; } @@ -35,7 +30,7 @@ function notifyall_addon_admin(App $a, &$o) function notifyall_post(App $a) { - if(!is_site_admin()) { + if (!$a->isSiteAdmin()) { return; } @@ -56,7 +51,7 @@ function notifyall_post(App $a) $recipients = DBA::p("SELECT DISTINCT `email` FROM `user` WHERE `verified` AND NOT `account_removed` AND NOT `account_expired` $sql_extra"); if (! $recipients) { - notice(DI::l10n()->t('No recipients found.') . EOL); + DI::sysmsg()->addNotice(DI::l10n()->t('No recipients found.')); return; } @@ -66,13 +61,13 @@ function notifyall_post(App $a) DI::emailer()->send($notifyEmail->withRecipient($recipient['email'])); } - info(DI::l10n()->t('Emails sent')); + DI::sysmsg()->addInfo(DI::l10n()->t('Emails sent')); DI::baseUrl()->redirect('admin'); } -function notifyall_content(&$a) +function notifyall_content(App $a) { - if (! is_site_admin()) { + if (!$a->isSiteAdmin()) { return ''; }