use Friendica\Core\Hook;
use Friendica\Core\Logger;
use Friendica\Core\Renderer;
-use Friendica\Core\Session;
use Friendica\DI;
use Friendica\Model\Post;
use Friendica\Model\Tag;
function dwpost_jot_nets(App $a, array &$jotnets_fields)
{
- if (!Session::getLocalUser()) {
+ if (!DI::userSession()->getLocalUserId()) {
return;
}
- if (DI::pConfig()->get(Session::getLocalUser(), 'dwpost', 'post')) {
+ if (DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'dwpost', 'post')) {
$jotnets_fields[] = [
'type' => 'checkbox',
'field' => [
'dwpost_enable',
DI::l10n()->t('Post to Dreamwidth'),
- DI::pConfig()->get(Session::getLocalUser(), 'dwpost', 'post_by_default')
+ DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'dwpost', 'post_by_default')
]
];
}
function dwpost_settings(App $a, array &$data)
{
- if (!Session::getLocalUser()) {
+ if (!DI::userSession()->getLocalUserId()) {
return;
}
- $enabled = DI::pConfig()->get(Session::getLocalUser(), 'dwpost', 'post', false);
- $dw_username = DI::pConfig()->get(Session::getLocalUser(), 'dwpost', 'dw_username');
- $def_enabled = DI::pConfig()->get(Session::getLocalUser(), 'dwpost', 'post_by_default');
+ $enabled = DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'dwpost', 'post', false);
+ $dw_username = DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'dwpost', 'dw_username');
+ $def_enabled = DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'dwpost', 'post_by_default');
$t = Renderer::getMarkupTemplate('connector_settings.tpl', 'addon/dwpost/');
$html = Renderer::replaceMacros($t, [
function dwpost_settings_post(App $a, array &$b)
{
if (!empty($_POST['dwpost-submit'])) {
- DI::pConfig()->set(Session::getLocalUser(), 'dwpost', 'post', intval($_POST['dwpost']));
- DI::pConfig()->set(Session::getLocalUser(), 'dwpost', 'post_by_default', intval($_POST['dw_bydefault']));
- DI::pConfig()->set(Session::getLocalUser(), 'dwpost', 'dw_username', trim($_POST['dw_username']));
- DI::pConfig()->set(Session::getLocalUser(), 'dwpost', 'dw_password', trim($_POST['dw_password']));
+ DI::pConfig()->set(DI::userSession()->getLocalUserId(), 'dwpost', 'post', intval($_POST['dwpost']));
+ DI::pConfig()->set(DI::userSession()->getLocalUserId(), 'dwpost', 'post_by_default', intval($_POST['dw_bydefault']));
+ DI::pConfig()->set(DI::userSession()->getLocalUserId(), 'dwpost', 'dw_username', trim($_POST['dw_username']));
+ DI::pConfig()->set(DI::userSession()->getLocalUserId(), 'dwpost', 'dw_password', trim($_POST['dw_password']));
}
}
return;
}
- if ((!Session::getLocalUser()) || (Session::getLocalUser() != $b['uid'])) {
+ if ((!DI::userSession()->getLocalUserId()) || (DI::userSession()->getLocalUserId() != $b['uid'])) {
return;
}
return;
}
- $dw_post = intval(DI::pConfig()->get(Session::getLocalUser(),'dwpost','post'));
+ $dw_post = intval(DI::pConfig()->get(DI::userSession()->getLocalUserId(),'dwpost','post'));
$dw_enable = (($dw_post && !empty($_REQUEST['dwpost_enable'])) ? intval($_REQUEST['dwpost_enable']) : 0);
- if ($b['api_source'] && intval(DI::pConfig()->get(Session::getLocalUser(),'dwpost','post_by_default'))) {
+ if ($b['api_source'] && intval(DI::pConfig()->get(DI::userSession()->getLocalUserId(),'dwpost','post_by_default'))) {
$dw_enable = 1;
}