mirror of
https://git.friendi.ca/friendica/friendica-addons.git
synced 2025-06-07 09:54:27 +02:00
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\Core\Hook;
|
|||
use Friendica\Core\Logger;
|
||||
use Friendica\Core\Protocol;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\Core\Session;
|
||||
use Friendica\Core\Worker;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\DI;
|
||||
|
@ -37,14 +36,14 @@ function ifttt_content() {}
|
|||
|
||||
function ifttt_settings(App $a, array &$data)
|
||||
{
|
||||
if (!Session::getLocalUser()) {
|
||||
if (!DI::userSession()->getLocalUserId()) {
|
||||
return;
|
||||
}
|
||||
|
||||
$key = DI::pConfig()->get(Session::getLocalUser(), 'ifttt', 'key');
|
||||
$key = DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'ifttt', 'key');
|
||||
if (!$key) {
|
||||
$key = Strings::getRandomHex(20);
|
||||
DI::pConfig()->set(Session::getLocalUser(), 'ifttt', 'key', $key);
|
||||
DI::pConfig()->set(DI::userSession()->getLocalUserId(), 'ifttt', 'key', $key);
|
||||
}
|
||||
|
||||
$t = Renderer::getMarkupTemplate('connector_settings.tpl', 'addon/ifttt/');
|
||||
|
@ -76,7 +75,7 @@ function ifttt_settings(App $a, array &$data)
|
|||
function ifttt_settings_post()
|
||||
{
|
||||
if (!empty($_POST['ifttt-submit'])) {
|
||||
DI::pConfig()->delete(Session::getLocalUser(), 'ifttt', 'key');
|
||||
DI::pConfig()->delete(DI::userSession()->getLocalUserId(), 'ifttt', 'key');
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue