Hook::register('connector_settings_post', 'addon/ljpost/ljpost.php', 'ljpost_settings_post');
}
-function ljpost_jot_nets(App &$a, array &$jotnets_fields)
+function ljpost_jot_nets(array &$jotnets_fields)
{
- if (!local_user()) {
+ if (!DI::userSession()->getLocalUserId()) {
return;
}
- if (DI::pConfig()->get(local_user(),'ljpost','post')) {
+ if (DI::pConfig()->get(DI::userSession()->getLocalUserId(),'ljpost','post')) {
$jotnets_fields[] = [
'type' => 'checkbox',
'field' => [
'ljpost_enable',
DI::l10n()->t('Post to LiveJournal'),
- DI::pConfig()->get(local_user(), 'ljpost', 'post_by_default'),
+ DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'ljpost', 'post_by_default'),
],
];
}
}
-function ljpost_settings(App &$a, array &$data)
+function ljpost_settings(array &$data)
{
- if (!local_user()) {
+ if (!DI::userSession()->getLocalUserId()) {
return;
}
- $enabled = DI::pConfig()->get(local_user(), 'ljpost', 'post', false);
- $ij_username = DI::pConfig()->get(local_user(), 'ljpost', 'ij_username');
- $def_enabled = DI::pConfig()->get(local_user(), 'ljpost', 'post_by_default');
+ $enabled = DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'ljpost', 'post', false);
+ $ij_username = DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'ljpost', 'ij_username');
+ $def_enabled = DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'ljpost', 'post_by_default');
$t= Renderer::getMarkupTemplate('connector_settings.tpl', 'addon/ljpost/');
$html = Renderer::replaceMacros($t, [
];
}
-function ljpost_settings_post(App $a, array &$b)
+function ljpost_settings_post(array &$b)
{
if (!empty($_POST['ljpost-submit'])) {
- DI::pConfig()->set(local_user(), 'ljpost', 'post', intval($_POST['ljpost']));
- DI::pConfig()->set(local_user(), 'ljpost', 'post_by_default', intval($_POST['lj_bydefault']));
- DI::pConfig()->set(local_user(), 'ljpost', 'lj_username', trim($_POST['lj_username']));
- DI::pConfig()->set(local_user(), 'ljpost', 'lj_password', trim($_POST['lj_password']));
+ DI::pConfig()->set(DI::userSession()->getLocalUserId(), 'ljpost', 'post', intval($_POST['ljpost']));
+ DI::pConfig()->set(DI::userSession()->getLocalUserId(), 'ljpost', 'post_by_default', intval($_POST['lj_bydefault']));
+ DI::pConfig()->set(DI::userSession()->getLocalUserId(), 'ljpost', 'lj_username', trim($_POST['lj_username']));
+ DI::pConfig()->set(DI::userSession()->getLocalUserId(), 'ljpost', 'lj_password', trim($_POST['lj_password']));
}
}
-function ljpost_post_local(App $a, array &$b)
+function ljpost_post_local(array &$b)
{
// This can probably be changed to allow editing by pointing to a different API endpoint
if ($b['edit']) {
return;
}
- if ((!local_user()) || (local_user() != $b['uid'])) {
+ if (!DI::userSession()->getLocalUserId() || (DI::userSession()->getLocalUserId() != $b['uid'])) {
return;
}
return;
}
- $lj_post = intval(DI::pConfig()->get(local_user(),'ljpost','post'));
+ $lj_post = intval(DI::pConfig()->get(DI::userSession()->getLocalUserId(),'ljpost','post'));
$lj_enable = (($lj_post && !empty($_REQUEST['ljpost_enable'])) ? intval($_REQUEST['ljpost_enable']) : 0);
- if ($b['api_source'] && intval(DI::pConfig()->get(local_user(), 'ljpost', 'post_by_default'))) {
+ if ($b['api_source'] && intval(DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'ljpost', 'post_by_default'))) {
$lj_enable = 1;
}
$b['postopts'] .= 'ljpost';
}
-function ljpost_send(App $a, array &$b)
+function ljpost_send(array &$b)
{
if ($b['deleted'] || $b['private'] || ($b['created'] !== $b['edited'])) {
return;
return;
}
- $b['body'] = Post\Media::addAttachmentsToBody($b['uri-id'], $b['body']);
+ $b['body'] = Post\Media::addAttachmentsToBody($b['uri-id'], DI::contentItem()->addSharedPost($b));
// LiveJournal post in the LJ user's timezone.
// Hopefully the person's Friendica account