UserSession class - Refactor addon
This commit is contained in:
parent
8eca74cfab
commit
b0eb28143a
46 changed files with 534 additions and 580 deletions
|
@ -12,7 +12,6 @@ use Friendica\App;
|
|||
use Friendica\Core\Hook;
|
||||
use Friendica\Core\Logger;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\Core\Session;
|
||||
use Friendica\DI;
|
||||
use Friendica\Model\Notification;
|
||||
|
||||
|
@ -32,10 +31,10 @@ function gnot_install()
|
|||
* and if so set our configuration setting for this person.
|
||||
*/
|
||||
function gnot_settings_post(App $a, $post) {
|
||||
if(! Session::getLocalUser() || empty($_POST['gnot-submit']))
|
||||
if(! DI::userSession()->getLocalUserId() || empty($_POST['gnot-submit']))
|
||||
return;
|
||||
|
||||
DI::pConfig()->set(Session::getLocalUser(),'gnot','enable',intval($_POST['gnot']));
|
||||
DI::pConfig()->set(DI::userSession()->getLocalUserId(),'gnot','enable',intval($_POST['gnot']));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -44,11 +43,11 @@ function gnot_settings_post(App $a, $post) {
|
|||
*/
|
||||
function gnot_settings(App &$a, array &$data)
|
||||
{
|
||||
if (!Session::getLocalUser()) {
|
||||
if (!DI::userSession()->getLocalUserId()) {
|
||||
return;
|
||||
}
|
||||
|
||||
$gnot = intval(DI::pConfig()->get(Session::getLocalUser(), 'gnot', 'enable'));
|
||||
$gnot = intval(DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'gnot', 'enable'));
|
||||
|
||||
$t = Renderer::getMarkupTemplate('settings.tpl', 'addon/gnot/');
|
||||
$html = Renderer::replaceMacros($t, [
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue