]> git.mxchange.org Git - friendica-addons.git/blobdiff - notifyall/notifyall.php
[saml] Replace $_SESSION with DI::session()
[friendica-addons.git] / notifyall / notifyall.php
index 7b23255388f6ea0be58a0110cf87d44151d7e54e..270557c4bec24748f72af292d0bf0bd23c21f82e 100644 (file)
@@ -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 = '<div></div>&nbsp;&nbsp;&nbsp;&nbsp;<a href="' . DI::baseUrl()->get() . '/notifyall">' . DI::l10n()->t('Send email to all members') . '</a></br/>';
 }
@@ -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 '';
        }