Replace all functions from boot.php

This commit is contained in:
Michael 2022-10-18 20:42:46 +00:00 committed by Hypolite Petovan
parent 5f1028a535
commit 5d8129600d
45 changed files with 577 additions and 535 deletions

View file

@ -10,6 +10,7 @@
use Friendica\App;
use Friendica\Core\Hook;
use Friendica\Core\Renderer;
use Friendica\Core\Session;
use Friendica\DI;
function startpage_install() {
@ -20,11 +21,11 @@ function startpage_install() {
function startpage_home_init(App $a, $b)
{
if (!local_user()) {
if (!Session::getLocalUser()) {
return;
}
$page = DI::pConfig()->get(local_user(), 'startpage', 'startpage');
$page = DI::pConfig()->get(Session::getLocalUser(), 'startpage', 'startpage');
if (strlen($page)) {
DI::baseUrl()->redirect($page);
}
@ -42,12 +43,12 @@ function startpage_home_init(App $a, $b)
function startpage_settings_post(App $a, $post)
{
if (!local_user()) {
if (!Session::getLocalUser()) {
return;
}
if (!empty($_POST['startpage-submit'])) {
DI::pConfig()->set(local_user(), 'startpage', 'startpage', strip_tags(trim($_POST['startpage'])));
DI::pConfig()->set(Session::getLocalUser(), 'startpage', 'startpage', strip_tags(trim($_POST['startpage'])));
}
}
@ -59,11 +60,11 @@ function startpage_settings_post(App $a, $post)
*/
function startpage_settings(App &$a, array &$data)
{
if (!local_user()) {
if (!Session::getLocalUser()) {
return;
}
$startpage = DI::pConfig()->get(local_user(), 'startpage', 'startpage');
$startpage = DI::pConfig()->get(Session::getLocalUser(), 'startpage', 'startpage');
$t = Renderer::getMarkupTemplate('settings.tpl', 'addon/startpage/');
$html = Renderer::replaceMacros($t, [