X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=blackout%2Fblackout.php;h=55fb8d32c1b2f8b6d0e02c85cfea3e103210d338;hb=ebf5ff1276b82f832736532bee75ebe1504b70ed;hp=e8efecd24d9d6a75576494299a2f4e79e82c0748;hpb=04df7f6e058626c030c115fd9062156a981cb619;p=friendica-addons.git diff --git a/blackout/blackout.php b/blackout/blackout.php index e8efecd2..55fb8d32 100644 --- a/blackout/blackout.php +++ b/blackout/blackout.php @@ -55,10 +55,10 @@ function blackout_install() { Hook::register('page_header', 'addon/blackout/blackout.php', 'blackout_redirect'); } -function blackout_redirect (App $a, $b) +function blackout_redirect ($b) { // if we have a logged in user, don't throw her out - if (local_user()) { + if (DI::userSession()->getLocalUserId()) { return true; } @@ -83,7 +83,8 @@ function blackout_redirect (App $a, $b) } } -function blackout_addon_admin(App $a, &$o) { +function blackout_addon_admin(string &$o) +{ $mystart = DI::config()->get('blackout','begindate'); if (! is_string($mystart)) { $mystart = 'YYYY-MM-DD hh:mm'; } $myend = DI::config()->get('blackout','enddate'); @@ -110,11 +111,10 @@ function blackout_addon_admin(App $a, &$o) { '$aboutredirect' => DI::l10n()->t("Note: The redirect will be active from the moment you press the submit button. Users currently logged in will not be thrown out but can't login again after logging out while the blackout is still in place."), ]); } -function blackout_addon_admin_post (App $a) { - $begindate = trim($_POST['startdate']); - $enddate = trim($_POST['enddate']); - $url = trim($_POST['rurl']); - DI::config()->set('blackout','begindate',$begindate); - DI::config()->set('blackout','enddate',$enddate); - DI::config()->set('blackout','url',$url); + +function blackout_addon_admin_post () +{ + DI::config()->set('blackout', 'begindate', trim($_POST['startdate'])); + DI::config()->set('blackout', 'enddate', trim($_POST['enddate'])); + DI::config()->set('blackout', 'url', trim($_POST['rurl'])); }