]> git.mxchange.org Git - friendica-addons.git/blobdiff - planets/planets.php
Changes:
[friendica-addons.git] / planets / planets.php
index 8fa7c3ff4f07eee61cfcf8ca65c993cd1e12b2b7..2937c0360ed3c32596638b66665e0126df576060 100644 (file)
@@ -38,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 (!local_user()) {
+       if (!DI::userSession()->getLocalUserId()) {
                /* non-zero if this is a logged in user of this system */
                return;
        }
 
-       if (local_user() != $item['uid']) {
+       if (DI::userSession()->getLocalUserId() != $item['uid']) {
                /* Does this person own the post? */
                return;
        }
@@ -58,7 +58,7 @@ function planets_post_hook(App $a, &$item)
        }
 
        /* Retrieve our personal config setting */
-       $active = DI::pConfig()->get(local_user(), 'planets', 'enable');
+       $active = DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'planets', 'enable');
 
        if (!$active) {
                return;
@@ -81,45 +81,35 @@ function planets_post_hook(App $a, &$item)
        return;
 }
 
-
-
-
 /**
- *
  * Callback from the settings post function.
  * $post contains the $_POST array.
  * We will make sure we've got a valid user account
  * and if so set our configuration setting for this person.
- *
  */
-
-function planets_settings_post(App $a, $post)
+function planets_settings_post(array $post)
 {
-       if (!local_user()) {
+       if (!DI::userSession()->getLocalUserId()) {
                return;
        }
-       if ($_POST['planets-submit']) {
-               DI::pConfig()->set(local_user(), 'planets', 'enable' ,intval($_POST['planets']));
+       if ($post['planets-submit']) {
+               DI::pConfig()->set(DI::userSession()->getLocalUserId(), 'planets', 'enable' ,intval($post['planets']));
        }
 }
 
 
 /**
- *
  * Called from the Addon Setting form.
  * Add our own settings info to the page.
  *
  */
-
-
-
-function planets_settings(App &$a, array &$data)
+function planets_settings(array &$data)
 {
-       if(!local_user()) {
+       if(!DI::userSession()->getLocalUserId()) {
                return;
        }
 
-       $enabled = DI::pConfig()->get(local_user(),'planets','enable');
+       $enabled = DI::pConfig()->get(DI::userSession()->getLocalUserId(),'planets','enable');
 
        $t    = Renderer::getMarkupTemplate('settings.tpl', 'addon/planets/');
        $html = Renderer::replaceMacros($t, [