mirror of
https://git.friendi.ca/friendica/friendica-addons.git
synced 2025-06-07 09:54:27 +02:00
Replace all functions from boot.php
This commit is contained in:
parent
5f1028a535
commit
5d8129600d
45 changed files with 577 additions and 535 deletions
|
@ -11,6 +11,7 @@ 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()
|
||||
|
@ -42,12 +43,12 @@ function planets_post_hook(App $a, &$item)
|
|||
{
|
||||
Logger::notice('planets invoked');
|
||||
|
||||
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;
|
||||
}
|
||||
|
@ -58,7 +59,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(Session::getLocalUser(), 'planets', 'enable');
|
||||
|
||||
if (!$active) {
|
||||
return;
|
||||
|
@ -95,11 +96,11 @@ function planets_post_hook(App $a, &$item)
|
|||
|
||||
function planets_settings_post(App $a, $post)
|
||||
{
|
||||
if (!local_user()) {
|
||||
if (!Session::getLocalUser()) {
|
||||
return;
|
||||
}
|
||||
if ($_POST['planets-submit']) {
|
||||
DI::pConfig()->set(local_user(), 'planets', 'enable' ,intval($_POST['planets']));
|
||||
DI::pConfig()->set(Session::getLocalUser(), 'planets', 'enable' ,intval($_POST['planets']));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -115,11 +116,11 @@ function planets_settings_post(App $a, $post)
|
|||
|
||||
function planets_settings(App &$a, array &$data)
|
||||
{
|
||||
if(!local_user()) {
|
||||
if(!Session::getLocalUser()) {
|
||||
return;
|
||||
}
|
||||
|
||||
$enabled = DI::pConfig()->get(local_user(),'planets','enable');
|
||||
$enabled = DI::pConfig()->get(Session::getLocalUser(),'planets','enable');
|
||||
|
||||
$t = Renderer::getMarkupTemplate('settings.tpl', 'addon/planets/');
|
||||
$html = Renderer::replaceMacros($t, [
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue