UserSession class [7] - Refactor view/ files
This commit is contained in:
parent
bf39b5a948
commit
ee71086133
8 changed files with 55 additions and 63 deletions
|
@ -21,16 +21,15 @@
|
|||
|
||||
use Friendica\App;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\Core\Session;
|
||||
use Friendica\DI;
|
||||
|
||||
function theme_content(App $a)
|
||||
{
|
||||
if (!Session::getLocalUser()) {
|
||||
if (!DI::userSession()->getLocalUserId()) {
|
||||
return;
|
||||
}
|
||||
|
||||
$colorset = DI::pConfig()->get(Session::getLocalUser(), 'duepuntozero', 'colorset');
|
||||
$colorset = DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'duepuntozero', 'colorset');
|
||||
$user = true;
|
||||
|
||||
return clean_form($a, $colorset, $user);
|
||||
|
@ -38,12 +37,12 @@ function theme_content(App $a)
|
|||
|
||||
function theme_post(App $a)
|
||||
{
|
||||
if (! Session::getLocalUser()) {
|
||||
if (!DI::userSession()->getLocalUserId()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (isset($_POST['duepuntozero-settings-submit'])) {
|
||||
DI::pConfig()->set(Session::getLocalUser(), 'duepuntozero', 'colorset', $_POST['duepuntozero_colorset']);
|
||||
DI::pConfig()->set(DI::userSession()->getLocalUserId(), 'duepuntozero', 'colorset', $_POST['duepuntozero_colorset']);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -76,7 +75,7 @@ function clean_form(App $a, &$colorset, $user)
|
|||
];
|
||||
|
||||
if ($user) {
|
||||
$color = DI::pConfig()->get(Session::getLocalUser(), 'duepuntozero', 'colorset');
|
||||
$color = DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'duepuntozero', 'colorset');
|
||||
} else {
|
||||
$color = DI::config()->get('duepuntozero', 'colorset');
|
||||
}
|
||||
|
|
|
@ -21,7 +21,6 @@
|
|||
|
||||
use Friendica\App;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\Core\Session;
|
||||
use Friendica\DI;
|
||||
|
||||
/*
|
||||
|
@ -35,7 +34,7 @@ function duepuntozero_init(App $a) {
|
|||
$colorset = null;
|
||||
|
||||
if (DI::mode()->has(App\Mode::MAINTENANCEDISABLED)) {
|
||||
$colorset = DI::pConfig()->get(Session::getLocalUser(), 'duepuntozero', 'colorset');
|
||||
$colorset = DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'duepuntozero', 'colorset');
|
||||
if (!$colorset)
|
||||
$colorset = DI::config()->get('duepuntozero', 'colorset'); // user setting have priority, then node settings
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue