Replace all functions from boot.php
This commit is contained in:
parent
5f1028a535
commit
5d8129600d
45 changed files with 577 additions and 535 deletions
|
@ -14,6 +14,7 @@ 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()
|
||||
|
@ -43,12 +44,12 @@ function krynn_post_hook(App $a, &$item)
|
|||
* - A status post by a profile owner
|
||||
* - The profile owner must have allowed our addon
|
||||
*/
|
||||
if (!local_user()) {
|
||||
if (!Session::getLocalUser()) {
|
||||
/* non-zero if this is a logged in user of this system */
|
||||
return;
|
||||
}
|
||||
|
||||
if (local_user() != $item['uid']) {
|
||||
if (Session::getLocalUser() != $item['uid']) {
|
||||
/* Does this person own the post? */
|
||||
return;
|
||||
}
|
||||
|
@ -59,7 +60,7 @@ function krynn_post_hook(App $a, &$item)
|
|||
}
|
||||
|
||||
/* Retrieve our personal config setting */
|
||||
$active = DI::pConfig()->get(local_user(), 'krynn', 'enable');
|
||||
$active = DI::pConfig()->get(Session::getLocalUser(), 'krynn', 'enable');
|
||||
|
||||
if (!$active) {
|
||||
return;
|
||||
|
@ -90,12 +91,12 @@ function krynn_post_hook(App $a, &$item)
|
|||
*/
|
||||
function krynn_settings_post(App $a, $post)
|
||||
{
|
||||
if (!local_user()) {
|
||||
if (!Session::getLocalUser()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ($_POST['krynn-submit']) {
|
||||
DI::pConfig()->set(local_user(),'krynn','enable',intval($_POST['krynn']));
|
||||
DI::pConfig()->set(Session::getLocalUser(),'krynn','enable',intval($_POST['krynn']));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -105,11 +106,11 @@ function krynn_settings_post(App $a, $post)
|
|||
*/
|
||||
function krynn_settings(App &$a, array &$data)
|
||||
{
|
||||
if (!local_user()) {
|
||||
if (!Session::getLocalUser()) {
|
||||
return;
|
||||
}
|
||||
|
||||
$enabled = DI::pConfig()->get(local_user(),'krynn','enable');
|
||||
$enabled = DI::pConfig()->get(Session::getLocalUser(),'krynn','enable');
|
||||
|
||||
$t = Renderer::getMarkupTemplate('settings.tpl', 'addon/krynn/');
|
||||
$html = Renderer::replaceMacros($t, [
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue