]> git.mxchange.org Git - friendica-addons.git/blobdiff - planets/planets.php
[smileybutton] Add explicit conversion from float to int
[friendica-addons.git] / planets / planets.php
index 8cee996d6ccabdedc0eb7ed00d584acc03d91a52..8a206fb51641c2bd46df0f514b39a403b4fe9aaa 100644 (file)
@@ -11,7 +11,6 @@ use Friendica\App;
 use Friendica\Core\Hook;
 use Friendica\Core\Logger;
 use Friendica\Core\Renderer;
-use Friendica\Core\Session;
 use Friendica\DI;
 
 function planets_install()
@@ -39,16 +38,16 @@ function planets_install()
  *      - A status post by a profile owner
  *      - The profile owner must have allowed our addon
  */
-function planets_post_hook(App $a, &$item)
+function planets_post_hook(&$item)
 {
        Logger::notice('planets invoked');
 
-       if (!Session::getLocalUser()) {
+       if (!DI::userSession()->getLocalUserId()) {
                /* non-zero if this is a logged in user of this system */
                return;
        }
 
-       if (Session::getLocalUser() != $item['uid']) {
+       if (DI::userSession()->getLocalUserId() != $item['uid']) {
                /* Does this person own the post? */
                return;
        }
@@ -59,7 +58,7 @@ function planets_post_hook(App $a, &$item)
        }
 
        /* Retrieve our personal config setting */
-       $active = DI::pConfig()->get(Session::getLocalUser(), 'planets', 'enable');
+       $active = DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'planets', 'enable');
 
        if (!$active) {
                return;
@@ -94,13 +93,13 @@ function planets_post_hook(App $a, &$item)
  *
  */
 
-function planets_settings_post(App $a, $post)
+function planets_settings_post($post)
 {
-       if (!Session::getLocalUser()) {
+       if (!DI::userSession()->getLocalUserId()) {
                return;
        }
        if ($_POST['planets-submit']) {
-               DI::pConfig()->set(Session::getLocalUser(), 'planets', 'enable' ,intval($_POST['planets']));
+               DI::pConfig()->set(DI::userSession()->getLocalUserId(), 'planets', 'enable' ,intval($_POST['planets']));
        }
 }
 
@@ -114,13 +113,13 @@ function planets_settings_post(App $a, $post)
 
 
 
-function planets_settings(App &$a, array &$data)
+function planets_settings(array &$data)
 {
-       if(!Session::getLocalUser()) {
+       if(!DI::userSession()->getLocalUserId()) {
                return;
        }
 
-       $enabled = DI::pConfig()->get(Session::getLocalUser(),'planets','enable');
+       $enabled = DI::pConfig()->get(DI::userSession()->getLocalUserId(),'planets','enable');
 
        $t    = Renderer::getMarkupTemplate('settings.tpl', 'addon/planets/');
        $html = Renderer::replaceMacros($t, [