Merge branch 'develop' of https://github.com/friendica/friendica-addons into develop
[friendica-addons.git/.git] / gnot / gnot.php
index fa311de..15fb4da 100644 (file)
@@ -12,7 +12,6 @@ use Friendica\App;
 use Friendica\Core\Hook;
 use Friendica\Core\Logger;
 use Friendica\Core\Renderer;
-use Friendica\Core\Session;
 use Friendica\DI;
 use Friendica\Model\Notification;
 
@@ -31,24 +30,24 @@ function gnot_install()
  * We will make sure we've got a valid user account
  * and if so set our configuration setting for this person.
  */
-function gnot_settings_post(App $a, $post) {
-       if(! Session::getLocalUser() || empty($_POST['gnot-submit']))
+function gnot_settings_post($post) {
+       if(! DI::userSession()->getLocalUserId() || empty($_POST['gnot-submit']))
                return;
 
-       DI::pConfig()->set(Session::getLocalUser(),'gnot','enable',intval($_POST['gnot']));
+       DI::pConfig()->set(DI::userSession()->getLocalUserId(),'gnot','enable',intval($_POST['gnot']));
 }
 
 /**
  * Called from the Addon Setting form. 
  * Add our own settings info to the page.
  */
-function gnot_settings(App &$a, array &$data)
+function gnot_settings(array &$data)
 {
-       if (!Session::getLocalUser()) {
+       if (!DI::userSession()->getLocalUserId()) {
                return;
        }
 
-       $gnot = intval(DI::pConfig()->get(Session::getLocalUser(), 'gnot', 'enable'));
+       $gnot = intval(DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'gnot', 'enable'));
 
        $t    = Renderer::getMarkupTemplate('settings.tpl', 'addon/gnot/');
        $html = Renderer::replaceMacros($t, [
@@ -63,7 +62,7 @@ function gnot_settings(App &$a, array &$data)
        ];
 }
 
-function gnot_enotify_mail(App $a, array &$b)
+function gnot_enotify_mail(array &$b)
 {
        if ((!$b['uid']) || (! intval(DI::pConfig()->get($b['uid'], 'gnot','enable')))) {
                return;