X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=krynn%2Fkrynn.php;h=f7e77c26990ec6b9485606c166ec9ca2a7508633;hb=8d3d0f267be0ce3eef6b2fbfdbd9388d37c29bd4;hp=6c1790021067dc3b8501ef1b48956b4ffe41d734;hpb=8eca74cfabee22683eee42e9a6e4bdc6ca4f0d3f;p=friendica-addons.git diff --git a/krynn/krynn.php b/krynn/krynn.php index 6c179002..f7e77c26 100644 --- a/krynn/krynn.php +++ b/krynn/krynn.php @@ -14,7 +14,6 @@ use Friendica\App; use Friendica\Core\Hook; use Friendica\Core\Logger; use Friendica\Core\Renderer; -use Friendica\Core\Session; use Friendica\DI; function krynn_install() @@ -36,7 +35,7 @@ function krynn_install() Logger::notice("installed krynn"); } -function krynn_post_hook(App $a, &$item) +function krynn_post_hook(&$item) { /** * An item was posted on the local system. @@ -44,12 +43,12 @@ function krynn_post_hook(App $a, &$item) * - A status post by a profile owner * - The profile owner must have allowed our addon */ - 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; } @@ -60,7 +59,7 @@ function krynn_post_hook(App $a, &$item) } /* Retrieve our personal config setting */ - $active = DI::pConfig()->get(Session::getLocalUser(), 'krynn', 'enable'); + $active = DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'krynn', 'enable'); if (!$active) { return; @@ -89,14 +88,14 @@ function krynn_post_hook(App $a, &$item) * We will make sure we've got a valid user account * and if so set our configuration setting for this person. */ -function krynn_settings_post(App $a, $post) +function krynn_settings_post($post) { - if (!Session::getLocalUser()) { + if (!DI::userSession()->getLocalUserId()) { return; } if ($_POST['krynn-submit']) { - DI::pConfig()->set(Session::getLocalUser(),'krynn','enable',intval($_POST['krynn'])); + DI::pConfig()->set(DI::userSession()->getLocalUserId(),'krynn','enable',intval($_POST['krynn'])); } } @@ -104,13 +103,13 @@ function krynn_settings_post(App $a, $post) * Called from the addon Setting form. * Add our own settings info to the page. */ -function krynn_settings(App &$a, array &$data) +function krynn_settings(array &$data) { - if (!Session::getLocalUser()) { + if (!DI::userSession()->getLocalUserId()) { return; } - $enabled = DI::pConfig()->get(Session::getLocalUser(),'krynn','enable'); + $enabled = DI::pConfig()->get(DI::userSession()->getLocalUserId(),'krynn','enable'); $t = Renderer::getMarkupTemplate('settings.tpl', 'addon/krynn/'); $html = Renderer::replaceMacros($t, [