Replace all functions from boot.php #1294
45 changed files with 598 additions and 558 deletions
|
@ -39,6 +39,7 @@ use Friendica\Content\Text\Markdown;
|
|||
use Friendica\Core\Hook;
|
||||
use Friendica\Core\Logger;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\Core\Session;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\Database\DBStructure;
|
||||
use Friendica\DI;
|
||||
|
@ -123,21 +124,21 @@ function advancedcontentfilter_prepare_body_content_filter(App $a, &$hook_data)
|
|||
$expressionLanguage = new ExpressionLanguage\ExpressionLanguage();
|
||||
}
|
||||
|
||||
if (!local_user()) {
|
||||
if (!Session::getLocalUser()) {
|
||||
return;
|
||||
}
|
||||
|
||||
$vars = advancedcontentfilter_get_filter_fields($hook_data['item']);
|
||||
|
||||
$rules = DI::cache()->get('rules_' . local_user());
|
||||
$rules = DI::cache()->get('rules_' . Session::getLocalUser());
|
||||
if (!isset($rules)) {
|
||||
$rules = DBA::toArray(DBA::select(
|
||||
'advancedcontentfilter_rules',
|
||||
['name', 'expression', 'serialized'],
|
||||
['uid' => local_user(), 'active' => true]
|
||||
['uid' => Session::getLocalUser(), 'active' => true]
|
||||
));
|
||||
|
||||
DI::cache()->set('rules_' . local_user(), $rules);
|
||||
DI::cache()->set('rules_' . Session::getLocalUser(), $rules);
|
||||
}
|
||||
|
||||
if ($rules) {
|
||||
|
@ -165,7 +166,7 @@ function advancedcontentfilter_prepare_body_content_filter(App $a, &$hook_data)
|
|||
|
||||
function advancedcontentfilter_addon_settings(App $a, array &$data)
|
||||
{
|
||||
if (!local_user()) {
|
||||
if (!Session::getLocalUser()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -203,12 +204,12 @@ function advancedcontentfilter_init(App $a)
|
|||
|
||||
function advancedcontentfilter_content(App $a)
|
||||
{
|
||||
if (!local_user()) {
|
||||
if (!Session::getLocalUser()) {
|
||||
return Login::form('/' . implode('/', DI::args()->getArgv()));
|
||||
}
|
||||
|
||||
if (DI::args()->getArgc() > 1 && DI::args()->getArgv()[1] == 'help') {
|
||||
$user = User::getById(local_user());
|
||||
$user = User::getById(Session::getLocalUser());
|
||||
|
||||
$lang = $user['language'];
|
||||
|
||||
|
@ -272,9 +273,9 @@ function advancedcontentfilter_build_fields($data)
|
|||
|
||||
if (!empty($data['expression'])) {
|
||||
// Using a dummy item to validate the field existence
|
||||
$condition = ["(`uid` = ? OR `uid` = 0)", local_user()];
|
||||
$condition = ["(`uid` = ? OR `uid` = 0)", Session::getLocalUser()];
|
||||
$params = ['order' => ['uid' => true]];
|
||||
$item_row = Post::selectFirstForUser(local_user(), [], $condition, $params);
|
||||
$item_row = Post::selectFirstForUser(Session::getLocalUser(), [], $condition, $params);
|
||||
|
||||
if (!DBA::isResult($item_row)) {
|
||||
throw new HTTPException\NotFoundException(DI::l10n()->t('This addon requires this node having at least one post'));
|
||||
|
@ -307,29 +308,29 @@ function advancedcontentfilter_build_fields($data)
|
|||
|
||||
function advancedcontentfilter_get_rules()
|
||||
{
|
||||
if (!local_user()) {
|
||||
if (!Session::getLocalUser()) {
|
||||
throw new HTTPException\UnauthorizedException(DI::l10n()->t('You must be logged in to use this method'));
|
||||
}
|
||||
|
||||
$rules = DBA::toArray(DBA::select('advancedcontentfilter_rules', [], ['uid' => local_user()]));
|
||||
$rules = DBA::toArray(DBA::select('advancedcontentfilter_rules', [], ['uid' => Session::getLocalUser()]));
|
||||
|
||||
return json_encode($rules);
|
||||
}
|
||||
|
||||
function advancedcontentfilter_get_rules_id(ServerRequestInterface $request, ResponseInterface $response, $args)
|
||||
{
|
||||
if (!local_user()) {
|
||||
if (!Session::getLocalUser()) {
|
||||
throw new HTTPException\UnauthorizedException(DI::l10n()->t('You must be logged in to use this method'));
|
||||
}
|
||||
|
||||
$rule = DBA::selectFirst('advancedcontentfilter_rules', [], ['id' => $args['id'], 'uid' => local_user()]);
|
||||
$rule = DBA::selectFirst('advancedcontentfilter_rules', [], ['id' => $args['id'], 'uid' => Session::getLocalUser()]);
|
||||
|
||||
return json_encode($rule);
|
||||
}
|
||||
|
||||
function advancedcontentfilter_post_rules(ServerRequestInterface $request)
|
||||
{
|
||||
if (!local_user()) {
|
||||
if (!Session::getLocalUser()) {
|
||||
throw new HTTPException\UnauthorizedException(DI::l10n()->t('You must be logged in to use this method'));
|
||||
}
|
||||
|
||||
|
@ -349,7 +350,7 @@ function advancedcontentfilter_post_rules(ServerRequestInterface $request)
|
|||
throw new HTTPException\BadRequestException(DI::l10n()->t('The rule name and expression are required.'));
|
||||
}
|
||||
|
||||
$fields['uid'] = local_user();
|
||||
$fields['uid'] = Session::getLocalUser();
|
||||
$fields['created'] = DateTimeFormat::utcNow();
|
||||
|
||||
if (!DBA::insert('advancedcontentfilter_rules', $fields)) {
|
||||
|
@ -358,14 +359,14 @@ function advancedcontentfilter_post_rules(ServerRequestInterface $request)
|
|||
|
||||
$rule = DBA::selectFirst('advancedcontentfilter_rules', [], ['id' => DBA::lastInsertId()]);
|
||||
|
||||
DI::cache()->delete('rules_' . local_user());
|
||||
DI::cache()->delete('rules_' . Session::getLocalUser());
|
||||
|
||||
return json_encode(['message' => DI::l10n()->t('Rule successfully added'), 'rule' => $rule]);
|
||||
}
|
||||
|
||||
function advancedcontentfilter_put_rules_id(ServerRequestInterface $request, ResponseInterface $response, $args)
|
||||
{
|
||||
if (!local_user()) {
|
||||
if (!Session::getLocalUser()) {
|
||||
throw new HTTPException\UnauthorizedException(DI::l10n()->t('You must be logged in to use this method'));
|
||||
}
|
||||
|
||||
|
@ -373,7 +374,7 @@ function advancedcontentfilter_put_rules_id(ServerRequestInterface $request, Res
|
|||
throw new HTTPException\BadRequestException(DI::l10n()->t('Invalid form security token, please refresh the page.'));
|
||||
}
|
||||
|
||||
if (!DBA::exists('advancedcontentfilter_rules', ['id' => $args['id'], 'uid' => local_user()])) {
|
||||
if (!DBA::exists('advancedcontentfilter_rules', ['id' => $args['id'], 'uid' => Session::getLocalUser()])) {
|
||||
throw new HTTPException\NotFoundException(DI::l10n()->t('Rule doesn\'t exist or doesn\'t belong to you.'));
|
||||
}
|
||||
|
||||
|
@ -389,14 +390,14 @@ function advancedcontentfilter_put_rules_id(ServerRequestInterface $request, Res
|
|||
throw new HTTPException\ServiceUnavailableException(DBA::errorMessage());
|
||||
}
|
||||
|
||||
DI::cache()->delete('rules_' . local_user());
|
||||
DI::cache()->delete('rules_' . Session::getLocalUser());
|
||||
|
||||
return json_encode(['message' => DI::l10n()->t('Rule successfully updated')]);
|
||||
}
|
||||
|
||||
function advancedcontentfilter_delete_rules_id(ServerRequestInterface $request, ResponseInterface $response, $args)
|
||||
{
|
||||
if (!local_user()) {
|
||||
if (!Session::getLocalUser()) {
|
||||
throw new HTTPException\UnauthorizedException(DI::l10n()->t('You must be logged in to use this method'));
|
||||
}
|
||||
|
||||
|
@ -404,7 +405,7 @@ function advancedcontentfilter_delete_rules_id(ServerRequestInterface $request,
|
|||
throw new HTTPException\BadRequestException(DI::l10n()->t('Invalid form security token, please refresh the page.'));
|
||||
}
|
||||
|
||||
if (!DBA::exists('advancedcontentfilter_rules', ['id' => $args['id'], 'uid' => local_user()])) {
|
||||
if (!DBA::exists('advancedcontentfilter_rules', ['id' => $args['id'], 'uid' => Session::getLocalUser()])) {
|
||||
throw new HTTPException\NotFoundException(DI::l10n()->t('Rule doesn\'t exist or doesn\'t belong to you.'));
|
||||
}
|
||||
|
||||
|
@ -412,14 +413,14 @@ function advancedcontentfilter_delete_rules_id(ServerRequestInterface $request,
|
|||
throw new HTTPException\ServiceUnavailableException(DBA::errorMessage());
|
||||
}
|
||||
|
||||
DI::cache()->delete('rules_' . local_user());
|
||||
DI::cache()->delete('rules_' . Session::getLocalUser());
|
||||
|
||||
return json_encode(['message' => DI::l10n()->t('Rule successfully deleted')]);
|
||||
}
|
||||
|
||||
function advancedcontentfilter_get_variables_guid(ServerRequestInterface $request, ResponseInterface $response, $args)
|
||||
{
|
||||
if (!local_user()) {
|
||||
if (!Session::getLocalUser()) {
|
||||
throw new HTTPException\UnauthorizedException(DI::l10n()->t('You must be logged in to use this method'));
|
||||
}
|
||||
|
||||
|
@ -427,9 +428,9 @@ function advancedcontentfilter_get_variables_guid(ServerRequestInterface $reques
|
|||
throw new HTTPException\BadRequestException(DI::l10n()->t('Missing argument: guid.'));
|
||||
}
|
||||
|
||||
$condition = ["`guid` = ? AND (`uid` = ? OR `uid` = 0)", $args['guid'], local_user()];
|
||||
$condition = ["`guid` = ? AND (`uid` = ? OR `uid` = 0)", $args['guid'], Session::getLocalUser()];
|
||||
$params = ['order' => ['uid' => true]];
|
||||
$item_row = Post::selectFirstForUser(local_user(), [], $condition, $params);
|
||||
$item_row = Post::selectFirstForUser(Session::getLocalUser(), [], $condition, $params);
|
||||
|
||||
if (!DBA::isResult($item_row)) {
|
||||
throw new HTTPException\NotFoundException(DI::l10n()->t('Unknown post with guid: %s', $args['guid']));
|
||||
|
|
|
@ -10,6 +10,7 @@ use Friendica\App;
|
|||
use Friendica\Core\Hook;
|
||||
use Friendica\Core\Logger;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\Core\Session;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\DI;
|
||||
use Friendica\Model\Contact;
|
||||
|
@ -36,14 +37,14 @@ function birdavatar_install()
|
|||
*/
|
||||
function birdavatar_addon_settings(App $a, array &$data)
|
||||
{
|
||||
if (!local_user()) {
|
||||
if (!Session::getLocalUser()) {
|
||||
return;
|
||||
}
|
||||
|
||||
$t = Renderer::getMarkupTemplate('settings.tpl', 'addon/birdavatar/');
|
||||
$html = Renderer::replaceMacros($t, [
|
||||
'$uncache' => time(),
|
||||
'$uid' => local_user(),
|
||||
'$uid' => Session::getLocalUser(),
|
||||
'$setrandomize' => DI::l10n()->t('Set default profile avatar or randomize the bird.'),
|
||||
]);
|
||||
|
||||
|
@ -54,7 +55,7 @@ function birdavatar_addon_settings(App $a, array &$data)
|
|||
'submit' => [
|
||||
'birdavatar-usebird' => DI::l10n()->t('Use Bird as Avatar'),
|
||||
'birdavatar-morebird' => DI::l10n()->t('More Random Bird!'),
|
||||
'birdavatar-emailbird' => DI::pConfig()->get(local_user(), 'birdavatar', 'seed', false) ? DI::l10n()->t('Reset to email Bird') : null,
|
||||
'birdavatar-emailbird' => DI::pConfig()->get(Session::getLocalUser(), 'birdavatar', 'seed', false) ? DI::l10n()->t('Reset to email Bird') : null,
|
||||
],
|
||||
];
|
||||
}
|
||||
|
@ -64,50 +65,50 @@ function birdavatar_addon_settings(App $a, array &$data)
|
|||
*/
|
||||
function birdavatar_addon_settings_post(App $a, &$s)
|
||||
{
|
||||
if (!local_user()) {
|
||||
if (!Session::getLocalUser()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!empty($_POST['birdavatar-usebird'])) {
|
||||
$url = DI::baseUrl()->get() . '/birdavatar/' . local_user() . '?ts=' . time();
|
||||
$url = DI::baseUrl()->get() . '/birdavatar/' . Session::getLocalUser() . '?ts=' . time();
|
||||
|
||||
$self = DBA::selectFirst('contact', ['id'], ['uid' => local_user(), 'self' => true]);
|
||||
$self = DBA::selectFirst('contact', ['id'], ['uid' => Session::getLocalUser(), 'self' => true]);
|
||||
if (!DBA::isResult($self)) {
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t("The bird has not found itself."));
|
||||
return;
|
||||
}
|
||||
|
||||
Photo::importProfilePhoto($url, local_user(), $self['id']);
|
||||
Photo::importProfilePhoto($url, Session::getLocalUser(), $self['id']);
|
||||
|
||||
$condition = ['uid' => local_user(), 'contact-id' => $self['id']];
|
||||
$condition = ['uid' => Session::getLocalUser(), 'contact-id' => $self['id']];
|
||||
$photo = DBA::selectFirst('photo', ['resource-id'], $condition);
|
||||
if (!DBA::isResult($photo)) {
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('There was an error, the bird flew away.'));
|
||||
return;
|
||||
}
|
||||
|
||||
DBA::update('photo', ['profile' => false], ['profile' => true, 'uid' => local_user()]);
|
||||
DBA::update('photo', ['profile' => false], ['profile' => true, 'uid' => Session::getLocalUser()]);
|
||||
|
||||
$fields = ['profile' => true, 'album' => DI::l10n()->t('Profile Photos'), 'contact-id' => 0];
|
||||
DBA::update('photo', $fields, ['uid' => local_user(), 'resource-id' => $photo['resource-id']]);
|
||||
DBA::update('photo', $fields, ['uid' => Session::getLocalUser(), 'resource-id' => $photo['resource-id']]);
|
||||
|
||||
Photo::importProfilePhoto($url, local_user(), $self['id']);
|
||||
Photo::importProfilePhoto($url, Session::getLocalUser(), $self['id']);
|
||||
|
||||
Contact::updateSelfFromUserID(local_user(), true);
|
||||
Contact::updateSelfFromUserID(Session::getLocalUser(), true);
|
||||
|
||||
// Update global directory in background
|
||||
Profile::publishUpdate(local_user());
|
||||
Profile::publishUpdate(Session::getLocalUser());
|
||||
|
||||
DI::sysmsg()->addInfo(DI::l10n()->t('Meow!'));
|
||||
return;
|
||||
}
|
||||
|
||||
if (!empty($_POST['birdavatar-morebird'])) {
|
||||
DI::pConfig()->set(local_user(), 'birdavatar', 'seed', time());
|
||||
DI::pConfig()->set(Session::getLocalUser(), 'birdavatar', 'seed', time());
|
||||
}
|
||||
|
||||
if (!empty($_POST['birdavatar-emailbird'])) {
|
||||
DI::pConfig()->delete(local_user(), 'birdavatar', 'seed');
|
||||
DI::pConfig()->delete(Session::getLocalUser(), 'birdavatar', 'seed');
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -48,6 +48,7 @@ use Friendica\App;
|
|||
use Friendica\Core\Hook;
|
||||
use Friendica\Core\Logger;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\Core\Session;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\DI;
|
||||
|
||||
|
@ -58,7 +59,7 @@ function blackout_install() {
|
|||
function blackout_redirect (App $a, $b)
|
||||
{
|
||||
// if we have a logged in user, don't throw her out
|
||||
if (local_user()) {
|
||||
if (Session::getLocalUser()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
use Friendica\App;
|
||||
use Friendica\Core\Hook;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\Core\Session;
|
||||
use Friendica\DI;
|
||||
use Friendica\Util\Strings;
|
||||
|
||||
|
@ -28,11 +29,11 @@ function blockem_install()
|
|||
|
||||
function blockem_addon_settings(App $a, array &$data)
|
||||
{
|
||||
if (!local_user()) {
|
||||
if (!Session::getLocalUser()) {
|
||||
return;
|
||||
}
|
||||
|
||||
$words = DI::pConfig()->get(local_user(), 'blockem', 'words', '');
|
||||
$words = DI::pConfig()->get(Session::getLocalUser(), 'blockem', 'words', '');
|
||||
|
||||
$t = Renderer::getMarkupTemplate('settings.tpl', 'addon/blockem/');
|
||||
$html = Renderer::replaceMacros($t, [
|
||||
|
@ -49,12 +50,12 @@ function blockem_addon_settings(App $a, array &$data)
|
|||
|
||||
function blockem_addon_settings_post(App $a, array &$b)
|
||||
{
|
||||
if (!local_user()) {
|
||||
if (!Session::getLocalUser()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!empty($_POST['blockem-submit'])) {
|
||||
DI::pConfig()->set(local_user(), 'blockem', 'words', trim($_POST['blockem-words']));
|
||||
DI::pConfig()->set(Session::getLocalUser(), 'blockem', 'words', trim($_POST['blockem-words']));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -91,14 +92,14 @@ function blockem_enotify_store(App $a, array &$b)
|
|||
|
||||
function blockem_prepare_body_content_filter(App $a, array &$hook_data)
|
||||
{
|
||||
if (!local_user()) {
|
||||
if (!Session::getLocalUser()) {
|
||||
return;
|
||||
}
|
||||
|
||||
$profiles_string = null;
|
||||
|
||||
if (local_user()) {
|
||||
$profiles_string = DI::pConfig()->get(local_user(), 'blockem', 'words');
|
||||
if (Session::getLocalUser()) {
|
||||
$profiles_string = DI::pConfig()->get(Session::getLocalUser(), 'blockem', 'words');
|
||||
}
|
||||
|
||||
if ($profiles_string) {
|
||||
|
@ -132,11 +133,11 @@ function blockem_conversation_start(App $a, array &$b)
|
|||
{
|
||||
global $blockem_words;
|
||||
|
||||
if (!local_user()) {
|
||||
if (!Session::getLocalUser()) {
|
||||
return;
|
||||
}
|
||||
|
||||
$words = DI::pConfig()->get(local_user(), 'blockem', 'words');
|
||||
$words = DI::pConfig()->get(Session::getLocalUser(), 'blockem', 'words');
|
||||
|
||||
if ($words) {
|
||||
$blockem_words = explode(',', $words);
|
||||
|
@ -164,7 +165,7 @@ function blockem_item_photo_menu(App $a, array &$b)
|
|||
{
|
||||
global $blockem_words;
|
||||
|
||||
if (!local_user() || $b['item']['self']) {
|
||||
if (!Session::getLocalUser() || $b['item']['self']) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -195,11 +196,11 @@ function blockem_module() {}
|
|||
|
||||
function blockem_init(App $a)
|
||||
{
|
||||
if (!local_user()) {
|
||||
if (!Session::getLocalUser()) {
|
||||
return;
|
||||
}
|
||||
|
||||
$words = DI::pConfig()->get(local_user(), 'blockem', 'words');
|
||||
$words = DI::pConfig()->get(Session::getLocalUser(), 'blockem', 'words');
|
||||
|
||||
if (array_key_exists('block', $_GET) && $_GET['block']) {
|
||||
if (strlen($words)) {
|
||||
|
@ -224,6 +225,6 @@ function blockem_init(App $a)
|
|||
$words = implode(',', $newarr);
|
||||
}
|
||||
|
||||
DI::pConfig()->set(local_user(), 'blockem', 'words', $words);
|
||||
DI::pConfig()->set(Session::getLocalUser(), 'blockem', 'words', $words);
|
||||
exit();
|
||||
}
|
||||
|
|
|
@ -10,6 +10,7 @@ use Friendica\App;
|
|||
use Friendica\Core\Hook;
|
||||
use Friendica\Core\Logger;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\Core\Session;
|
||||
use Friendica\Core\Worker;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\DI;
|
||||
|
@ -37,14 +38,14 @@ function catavatar_install()
|
|||
*/
|
||||
function catavatar_addon_settings(App $a, array &$data)
|
||||
{
|
||||
if (!local_user()) {
|
||||
if (!Session::getLocalUser()) {
|
||||
return;
|
||||
}
|
||||
|
||||
$t = Renderer::getMarkupTemplate('settings.tpl', 'addon/catavatar/');
|
||||
$html = Renderer::replaceMacros($t, [
|
||||
'$uncache' => time(),
|
||||
'$uid' => local_user(),
|
||||
'$uid' => Session::getLocalUser(),
|
||||
'$setrandomize' => DI::l10n()->t('Set default profile avatar or randomize the cat.'),
|
||||
]);
|
||||
|
||||
|
@ -55,7 +56,7 @@ function catavatar_addon_settings(App $a, array &$data)
|
|||
'submit' => [
|
||||
'catavatar-usecat' => DI::l10n()->t('Use Cat as Avatar'),
|
||||
'catavatar-morecat' => DI::l10n()->t('Another random Cat!'),
|
||||
'catavatar-emailcat' => DI::pConfig()->get(local_user(), 'catavatar', 'seed', false) ? DI::l10n()->t('Reset to email Cat') : null,
|
||||
'catavatar-emailcat' => DI::pConfig()->get(Session::getLocalUser(), 'catavatar', 'seed', false) ? DI::l10n()->t('Reset to email Cat') : null,
|
||||
],
|
||||
];
|
||||
}
|
||||
|
@ -65,50 +66,50 @@ function catavatar_addon_settings(App $a, array &$data)
|
|||
*/
|
||||
function catavatar_addon_settings_post(App $a, &$s)
|
||||
{
|
||||
if (!local_user()) {
|
||||
if (!Session::getLocalUser()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!empty($_POST['catavatar-usecat'])) {
|
||||
$url = DI::baseUrl()->get() . '/catavatar/' . local_user() . '?ts=' . time();
|
||||
$url = DI::baseUrl()->get() . '/catavatar/' . Session::getLocalUser() . '?ts=' . time();
|
||||
|
||||
$self = DBA::selectFirst('contact', ['id'], ['uid' => local_user(), 'self' => true]);
|
||||
$self = DBA::selectFirst('contact', ['id'], ['uid' => Session::getLocalUser(), 'self' => true]);
|
||||
if (!DBA::isResult($self)) {
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t("The cat hadn't found itself."));
|
||||
return;
|
||||
}
|
||||
|
||||
Photo::importProfilePhoto($url, local_user(), $self['id']);
|
||||
Photo::importProfilePhoto($url, Session::getLocalUser(), $self['id']);
|
||||
|
||||
$condition = ['uid' => local_user(), 'contact-id' => $self['id']];
|
||||
$condition = ['uid' => Session::getLocalUser(), 'contact-id' => $self['id']];
|
||||
$photo = DBA::selectFirst('photo', ['resource-id'], $condition);
|
||||
if (!DBA::isResult($photo)) {
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('There was an error, the cat ran away.'));
|
||||
return;
|
||||
}
|
||||
|
||||
DBA::update('photo', ['profile' => false], ['profile' => true, 'uid' => local_user()]);
|
||||
DBA::update('photo', ['profile' => false], ['profile' => true, 'uid' => Session::getLocalUser()]);
|
||||
|
||||
$fields = ['profile' => true, 'album' => DI::l10n()->t('Profile Photos'), 'contact-id' => 0];
|
||||
DBA::update('photo', $fields, ['uid' => local_user(), 'resource-id' => $photo['resource-id']]);
|
||||
DBA::update('photo', $fields, ['uid' => Session::getLocalUser(), 'resource-id' => $photo['resource-id']]);
|
||||
|
||||
Photo::importProfilePhoto($url, local_user(), $self['id']);
|
||||
Photo::importProfilePhoto($url, Session::getLocalUser(), $self['id']);
|
||||
|
||||
Contact::updateSelfFromUserID(local_user(), true);
|
||||
Contact::updateSelfFromUserID(Session::getLocalUser(), true);
|
||||
|
||||
// Update global directory in background
|
||||
Profile::publishUpdate(local_user());
|
||||
Profile::publishUpdate(Session::getLocalUser());
|
||||
|
||||
DI::sysmsg()->addInfo(DI::l10n()->t('Meow!'));
|
||||
return;
|
||||
}
|
||||
|
||||
if (!empty($_POST['catavatar-morecat'])) {
|
||||
DI::pConfig()->set(local_user(), 'catavatar', 'seed', time());
|
||||
DI::pConfig()->set(Session::getLocalUser(), 'catavatar', 'seed', time());
|
||||
}
|
||||
|
||||
if (!empty($_POST['catavatar-emailcat'])) {
|
||||
DI::pConfig()->delete(local_user(), 'catavatar', 'seed');
|
||||
DI::pConfig()->delete(Session::getLocalUser(), 'catavatar', 'seed');
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -32,7 +32,7 @@ function getWeather($loc, $units = 'metric', $lang = 'en', $appid = '', $cacheti
|
|||
$now = new DateTime();
|
||||
|
||||
if (!is_null($cached)) {
|
||||
$cdate = DI::pConfig()->get(local_user(), 'curweather', 'last');
|
||||
$cdate = DI::pConfig()->get(Session::getLocalUser(), 'curweather', 'last');
|
||||
$cached = unserialize($cached);
|
||||
|
||||
if ($cdate + $cachetime > $now->getTimestamp()) {
|
||||
|
@ -81,7 +81,7 @@ function getWeather($loc, $units = 'metric', $lang = 'en', $appid = '', $cacheti
|
|||
'icon' => (string) $res->weather['icon'],
|
||||
];
|
||||
|
||||
DI::pConfig()->set(local_user(), 'curweather', 'last', $now->getTimestamp());
|
||||
DI::pConfig()->set(Session::getLocalUser(), 'curweather', 'last', $now->getTimestamp());
|
||||
DI::cache()->set('curweather'.md5($url), serialize($r), Duration::HOUR);
|
||||
|
||||
return $r;
|
||||
|
@ -89,7 +89,7 @@ function getWeather($loc, $units = 'metric', $lang = 'en', $appid = '', $cacheti
|
|||
|
||||
function curweather_network_mod_init(App $a, string &$body)
|
||||
{
|
||||
if (!intval(DI::pConfig()->get(local_user(), 'curweather', 'curweather_enable'))) {
|
||||
if (!intval(DI::pConfig()->get(Session::getLocalUser(), 'curweather', 'curweather_enable'))) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -104,11 +104,11 @@ function curweather_network_mod_init(App $a, string &$body)
|
|||
// those parameters will be used to get: cloud status, temperature, preassure
|
||||
// and relative humidity for display, also the relevent area of the map is
|
||||
// linked from lat/log of the reply of OWMp
|
||||
$rpt = DI::pConfig()->get(local_user(), 'curweather', 'curweather_loc');
|
||||
$rpt = DI::pConfig()->get(Session::getLocalUser(), 'curweather', 'curweather_loc');
|
||||
|
||||
// Set the language to the browsers language or default and use metric units
|
||||
$lang = DI::session()->get('language', DI::config()->get('system', 'language'));
|
||||
$units = DI::pConfig()->get( local_user(), 'curweather', 'curweather_units');
|
||||
$units = DI::pConfig()->get(Session::getLocalUser(), 'curweather', 'curweather_units');
|
||||
$appid = DI::config()->get('curweather', 'appid');
|
||||
$cachetime = intval(DI::config()->get('curweather', 'cachetime'));
|
||||
|
||||
|
@ -155,23 +155,23 @@ function curweather_network_mod_init(App $a, string &$body)
|
|||
|
||||
function curweather_addon_settings_post(App $a, $post)
|
||||
{
|
||||
if (!local_user() || empty($_POST['curweather-settings-submit'])) {
|
||||
if (!Session::getLocalUser() || empty($_POST['curweather-settings-submit'])) {
|
||||
return;
|
||||
}
|
||||
|
||||
DI::pConfig()->set(local_user(), 'curweather', 'curweather_loc' , trim($_POST['curweather_loc']));
|
||||
DI::pConfig()->set(local_user(), 'curweather', 'curweather_enable', intval($_POST['curweather_enable']));
|
||||
DI::pConfig()->set(local_user(), 'curweather', 'curweather_units' , trim($_POST['curweather_units']));
|
||||
DI::pConfig()->set(Session::getLocalUser(), 'curweather', 'curweather_loc' , trim($_POST['curweather_loc']));
|
||||
DI::pConfig()->set(Session::getLocalUser(), 'curweather', 'curweather_enable', intval($_POST['curweather_enable']));
|
||||
DI::pConfig()->set(Session::getLocalUser(), 'curweather', 'curweather_units' , trim($_POST['curweather_units']));
|
||||
}
|
||||
|
||||
function curweather_addon_settings(App $a, array &$data)
|
||||
{
|
||||
if (!local_user()) {
|
||||
if (!Session::getLocalUser()) {
|
||||
return;
|
||||
}
|
||||
|
||||
$curweather_loc = DI::pConfig()->get(local_user(), 'curweather', 'curweather_loc');
|
||||
$curweather_units = DI::pConfig()->get(local_user(), 'curweather', 'curweather_units');
|
||||
$curweather_loc = DI::pConfig()->get(Session::getLocalUser(), 'curweather', 'curweather_loc');
|
||||
$curweather_units = DI::pConfig()->get(Session::getLocalUser(), 'curweather', 'curweather_units');
|
||||
$appid = DI::config()->get('curweather', 'appid');
|
||||
|
||||
if ($appid == '') {
|
||||
|
@ -180,7 +180,7 @@ function curweather_addon_settings(App $a, array &$data)
|
|||
$noappidtext = '';
|
||||
}
|
||||
|
||||
$enabled = intval(DI::pConfig()->get(local_user(), 'curweather', 'curweather_enable'));
|
||||
$enabled = intval(DI::pConfig()->get(Session::getLocalUser(), 'curweather', 'curweather_enable'));
|
||||
|
||||
$t = Renderer::getMarkupTemplate('settings.tpl', 'addon/curweather/');
|
||||
$html = Renderer::replaceMacros($t, [
|
||||
|
|
|
@ -32,17 +32,17 @@ function diaspora_install()
|
|||
|
||||
function diaspora_jot_nets(App $a, array &$jotnets_fields)
|
||||
{
|
||||
if (!local_user()) {
|
||||
if (!Session::getLocalUser()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (DI::pConfig()->get(local_user(), 'diaspora', 'post')) {
|
||||
if (DI::pConfig()->get(Session::getLocalUser(), 'diaspora', 'post')) {
|
||||
$jotnets_fields[] = [
|
||||
'type' => 'checkbox',
|
||||
'field' => [
|
||||
'diaspora_enable',
|
||||
DI::l10n()->t('Post to Diaspora'),
|
||||
DI::pConfig()->get(local_user(), 'diaspora', 'post_by_default')
|
||||
DI::pConfig()->get(Session::getLocalUser(), 'diaspora', 'post_by_default')
|
||||
]
|
||||
];
|
||||
}
|
||||
|
@ -50,16 +50,16 @@ function diaspora_jot_nets(App $a, array &$jotnets_fields)
|
|||
|
||||
function diaspora_settings(App $a, array &$data)
|
||||
{
|
||||
if (!local_user()) {
|
||||
if (!Session::getLocalUser()) {
|
||||
return;
|
||||
}
|
||||
|
||||
$enabled = DI::pConfig()->get(local_user(), 'diaspora', 'post', false);
|
||||
$def_enabled = DI::pConfig()->get(local_user(), 'diaspora', 'post_by_default');
|
||||
$enabled = DI::pConfig()->get(Session::getLocalUser(), 'diaspora', 'post', false);
|
||||
$def_enabled = DI::pConfig()->get(Session::getLocalUser(), 'diaspora', 'post_by_default');
|
||||
|
||||
$handle = DI::pConfig()->get(local_user(), 'diaspora', 'handle');
|
||||
$password = DI::pConfig()->get(local_user(), 'diaspora', 'password');
|
||||
$aspect = DI::pConfig()->get(local_user(), 'diaspora', 'aspect');
|
||||
$handle = DI::pConfig()->get(Session::getLocalUser(), 'diaspora', 'handle');
|
||||
$password = DI::pConfig()->get(Session::getLocalUser(), 'diaspora', 'password');
|
||||
$aspect = DI::pConfig()->get(Session::getLocalUser(), 'diaspora', 'aspect');
|
||||
|
||||
$info = '';
|
||||
$error = '';
|
||||
|
@ -121,18 +121,18 @@ function diaspora_settings(App $a, array &$data)
|
|||
function diaspora_settings_post(App $a, array &$b)
|
||||
{
|
||||
if (!empty($_POST['diaspora-submit'])) {
|
||||
DI::pConfig()->set(local_user(),'diaspora', 'post' , intval($_POST['enabled']));
|
||||
DI::pConfig()->set(Session::getLocalUser(),'diaspora', 'post' , intval($_POST['enabled']));
|
||||
if (intval($_POST['enabled'])) {
|
||||
if (isset($_POST['handle'])) {
|
||||
DI::pConfig()->set(local_user(),'diaspora', 'handle' , trim($_POST['handle']));
|
||||
DI::pConfig()->set(local_user(),'diaspora', 'password' , trim($_POST['password']));
|
||||
DI::pConfig()->set(Session::getLocalUser(),'diaspora', 'handle' , trim($_POST['handle']));
|
||||
DI::pConfig()->set(Session::getLocalUser(),'diaspora', 'password' , trim($_POST['password']));
|
||||
}
|
||||
if (!empty($_POST['aspect'])) {
|
||||
DI::pConfig()->set(local_user(),'diaspora', 'aspect' , trim($_POST['aspect']));
|
||||
DI::pConfig()->set(local_user(),'diaspora', 'post_by_default', intval($_POST['post_by_default']));
|
||||
DI::pConfig()->set(Session::getLocalUser(),'diaspora', 'aspect' , trim($_POST['aspect']));
|
||||
DI::pConfig()->set(Session::getLocalUser(),'diaspora', 'post_by_default', intval($_POST['post_by_default']));
|
||||
}
|
||||
} else {
|
||||
DI::pConfig()->delete(local_user(), 'diaspora', 'password');
|
||||
DI::pConfig()->delete(Session::getLocalUser(), 'diaspora', 'password');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -158,7 +158,7 @@ function diaspora_post_local(App $a, array &$b)
|
|||
return;
|
||||
}
|
||||
|
||||
if (!local_user() || (local_user() != $b['uid'])) {
|
||||
if (!Session::getLocalUser() || (Session::getLocalUser() != $b['uid'])) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -166,11 +166,11 @@ function diaspora_post_local(App $a, array &$b)
|
|||
return;
|
||||
}
|
||||
|
||||
$diaspora_post = intval(DI::pConfig()->get(local_user(),'diaspora','post'));
|
||||
$diaspora_post = intval(DI::pConfig()->get(Session::getLocalUser(),'diaspora','post'));
|
||||
|
||||
$diaspora_enable = (($diaspora_post && !empty($_REQUEST['diaspora_enable'])) ? intval($_REQUEST['diaspora_enable']) : 0);
|
||||
|
||||
if ($b['api_source'] && intval(DI::pConfig()->get(local_user(),'diaspora','post_by_default'))) {
|
||||
if ($b['api_source'] && intval(DI::pConfig()->get(Session::getLocalUser(),'diaspora','post_by_default'))) {
|
||||
$diaspora_enable = 1;
|
||||
}
|
||||
|
||||
|
|
|
@ -14,6 +14,7 @@ use Friendica\Core\Hook;
|
|||
use Friendica\Core\Logger;
|
||||
use Friendica\Core\Protocol;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\Core\Session;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\DI;
|
||||
use Friendica\Model\Contact;
|
||||
|
@ -38,11 +39,11 @@ function discourse_install()
|
|||
|
||||
function discourse_settings(App $a, array &$data)
|
||||
{
|
||||
if (!local_user()) {
|
||||
if (!Session::getLocalUser()) {
|
||||
return;
|
||||
}
|
||||
|
||||
$enabled = intval(DI::pConfig()->get(local_user(), 'discourse', 'enabled'));
|
||||
$enabled = intval(DI::pConfig()->get(Session::getLocalUser(), 'discourse', 'enabled'));
|
||||
|
||||
$t = Renderer::getMarkupTemplate('connector_settings.tpl', 'addon/discourse/');
|
||||
$html = Renderer::replaceMacros($t, [
|
||||
|
@ -60,11 +61,11 @@ function discourse_settings(App $a, array &$data)
|
|||
|
||||
function discourse_settings_post(App $a)
|
||||
{
|
||||
if (!local_user() || empty($_POST['discourse-submit'])) {
|
||||
if (!Session::getLocalUser() || empty($_POST['discourse-submit'])) {
|
||||
return;
|
||||
}
|
||||
|
||||
DI::pConfig()->set(local_user(), 'discourse', 'enabled', intval($_POST['enabled']));
|
||||
DI::pConfig()->set(Session::getLocalUser(), 'discourse', 'enabled', intval($_POST['enabled']));
|
||||
}
|
||||
|
||||
function discourse_email_getmessage(App $a, &$message)
|
||||
|
|
|
@ -13,6 +13,7 @@ use Friendica\Content\Text\BBCode;
|
|||
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;
|
||||
|
@ -31,17 +32,17 @@ function dwpost_install()
|
|||
|
||||
function dwpost_jot_nets(App $a, array &$jotnets_fields)
|
||||
{
|
||||
if (!local_user()) {
|
||||
if (!Session::getLocalUser()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (DI::pConfig()->get(local_user(), 'dwpost', 'post')) {
|
||||
if (DI::pConfig()->get(Session::getLocalUser(), 'dwpost', 'post')) {
|
||||
$jotnets_fields[] = [
|
||||
'type' => 'checkbox',
|
||||
'field' => [
|
||||
'dwpost_enable',
|
||||
DI::l10n()->t('Post to Dreamwidth'),
|
||||
DI::pConfig()->get(local_user(), 'dwpost', 'post_by_default')
|
||||
DI::pConfig()->get(Session::getLocalUser(), 'dwpost', 'post_by_default')
|
||||
]
|
||||
];
|
||||
}
|
||||
|
@ -50,13 +51,13 @@ function dwpost_jot_nets(App $a, array &$jotnets_fields)
|
|||
|
||||
function dwpost_settings(App $a, array &$data)
|
||||
{
|
||||
if (!local_user()) {
|
||||
if (!Session::getLocalUser()) {
|
||||
return;
|
||||
}
|
||||
|
||||
$enabled = DI::pConfig()->get(local_user(), 'dwpost', 'post', false);
|
||||
$dw_username = DI::pConfig()->get(local_user(), 'dwpost', 'dw_username');
|
||||
$def_enabled = DI::pConfig()->get(local_user(), 'dwpost', 'post_by_default');
|
||||
$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');
|
||||
|
||||
$t = Renderer::getMarkupTemplate('connector_settings.tpl', 'addon/dwpost/');
|
||||
$html = Renderer::replaceMacros($t, [
|
||||
|
@ -79,10 +80,10 @@ function dwpost_settings(App $a, array &$data)
|
|||
function dwpost_settings_post(App $a, array &$b)
|
||||
{
|
||||
if (!empty($_POST['dwpost-submit'])) {
|
||||
DI::pConfig()->set(local_user(), 'dwpost', 'post', intval($_POST['dwpost']));
|
||||
DI::pConfig()->set(local_user(), 'dwpost', 'post_by_default', intval($_POST['dw_bydefault']));
|
||||
DI::pConfig()->set(local_user(), 'dwpost', 'dw_username', trim($_POST['dw_username']));
|
||||
DI::pConfig()->set(local_user(), 'dwpost', 'dw_password', trim($_POST['dw_password']));
|
||||
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']));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -93,7 +94,7 @@ function dwpost_post_local(App $a, array &$b)
|
|||
return;
|
||||
}
|
||||
|
||||
if ((!local_user()) || (local_user() != $b['uid'])) {
|
||||
if ((!Session::getLocalUser()) || (Session::getLocalUser() != $b['uid'])) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -101,11 +102,11 @@ function dwpost_post_local(App $a, array &$b)
|
|||
return;
|
||||
}
|
||||
|
||||
$dw_post = intval(DI::pConfig()->get(local_user(),'dwpost','post'));
|
||||
$dw_post = intval(DI::pConfig()->get(Session::getLocalUser(),'dwpost','post'));
|
||||
|
||||
$dw_enable = (($dw_post && !empty($_REQUEST['dwpost_enable'])) ? intval($_REQUEST['dwpost_enable']) : 0);
|
||||
|
||||
if ($b['api_source'] && intval(DI::pConfig()->get(local_user(),'dwpost','post_by_default'))) {
|
||||
if ($b['api_source'] && intval(DI::pConfig()->get(Session::getLocalUser(),'dwpost','post_by_default'))) {
|
||||
$dw_enable = 1;
|
||||
}
|
||||
|
||||
|
|
|
@ -12,11 +12,11 @@ use Friendica\Content\Pager;
|
|||
use Friendica\Content\Widget;
|
||||
use Friendica\Core\Hook;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\Core\Session;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\DI;
|
||||
use Friendica\Model\Profile;
|
||||
use Friendica\Model\User;
|
||||
use Friendica\Util\Strings;
|
||||
|
||||
global $forumdirectory_search;
|
||||
|
||||
|
@ -44,7 +44,7 @@ function forumdirectory_app_menu(App $a, array &$b)
|
|||
|
||||
function forumdirectory_init(App $a)
|
||||
{
|
||||
if (local_user()) {
|
||||
if (Session::getLocalUser()) {
|
||||
DI::page()['aside'] .= Widget::findPeople();
|
||||
}
|
||||
}
|
||||
|
@ -62,7 +62,7 @@ function forumdirectory_content(App $a)
|
|||
{
|
||||
global $forumdirectory_search;
|
||||
|
||||
if ((DI::config()->get('system', 'block_public')) && (!local_user()) && (!remote_user())) {
|
||||
if (DI::config()->get('system', 'block_public') && !Session::getLocalUser() && !Session::getRemoteUser()) {
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('Public access denied.'));
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -11,6 +11,7 @@ use Friendica\App;
|
|||
use Friendica\Core\Hook;
|
||||
use Friendica\Core\Logger;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\Core\Session;
|
||||
use Friendica\DI;
|
||||
|
||||
function fromapp_install()
|
||||
|
@ -23,22 +24,22 @@ function fromapp_install()
|
|||
|
||||
function fromapp_settings_post(App $a, $post)
|
||||
{
|
||||
if (!local_user() || empty($_POST['fromapp-submit'])) {
|
||||
if (!Session::getLocalUser() || empty($_POST['fromapp-submit'])) {
|
||||
return;
|
||||
}
|
||||
|
||||
DI::pConfig()->set(local_user(), 'fromapp', 'app', $_POST['fromapp-input']);
|
||||
DI::pConfig()->set(local_user(), 'fromapp', 'force', intval($_POST['fromapp-force']));
|
||||
DI::pConfig()->set(Session::getLocalUser(), 'fromapp', 'app', $_POST['fromapp-input']);
|
||||
DI::pConfig()->set(Session::getLocalUser(), 'fromapp', 'force', intval($_POST['fromapp-force']));
|
||||
}
|
||||
|
||||
function fromapp_settings(App &$a, array &$data)
|
||||
{
|
||||
if (!local_user()) {
|
||||
if (!Session::getLocalUser()) {
|
||||
return;
|
||||
}
|
||||
|
||||
$fromapp = DI::pConfig()->get(local_user(), 'fromapp', 'app', '');
|
||||
$force = intval(DI::pConfig()->get(local_user(), 'fromapp', 'force'));
|
||||
$fromapp = DI::pConfig()->get(Session::getLocalUser(), 'fromapp', 'app', '');
|
||||
$force = intval(DI::pConfig()->get(Session::getLocalUser(), 'fromapp', 'force'));
|
||||
|
||||
$t = Renderer::getMarkupTemplate('settings.tpl', 'addon/fromapp/');
|
||||
$html = Renderer::replaceMacros($t, [
|
||||
|
@ -55,16 +56,16 @@ function fromapp_settings(App &$a, array &$data)
|
|||
|
||||
function fromapp_post_hook(App $a, &$item)
|
||||
{
|
||||
if (!local_user()) {
|
||||
if (!Session::getLocalUser()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (local_user() != $item['uid']) {
|
||||
if (Session::getLocalUser() != $item['uid']) {
|
||||
return;
|
||||
}
|
||||
|
||||
$app = DI::pConfig()->get(local_user(), 'fromapp', 'app');
|
||||
$force = intval(DI::pConfig()->get(local_user(), 'fromapp', 'force'));
|
||||
$app = DI::pConfig()->get(Session::getLocalUser(), 'fromapp', 'app');
|
||||
$force = intval(DI::pConfig()->get(Session::getLocalUser(), 'fromapp', 'force'));
|
||||
|
||||
if (is_null($app) || (! strlen($app))) {
|
||||
return;
|
||||
|
|
|
@ -12,6 +12,7 @@ use Friendica\Core\Logger;
|
|||
use Friendica\Core\Renderer;
|
||||
use Friendica\DI;
|
||||
use Friendica\Core\Config\Util\ConfigFileLoader;
|
||||
use Friendica\Core\Session;
|
||||
use Friendica\Util\XML;
|
||||
|
||||
function geonames_install()
|
||||
|
@ -48,11 +49,11 @@ function geonames_post_hook(App $a, array &$item)
|
|||
|
||||
Logger::notice('geonames invoked');
|
||||
|
||||
if (!local_user()) { /* non-zero if this is a logged in user of this system */
|
||||
if (!Session::getLocalUser()) { /* non-zero if this is a logged in user of this system */
|
||||
return;
|
||||
}
|
||||
|
||||
if (local_user() != $item['uid']) { /* Does this person own the post? */
|
||||
if (Session::getLocalUser() != $item['uid']) { /* Does this person own the post? */
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -63,7 +64,7 @@ function geonames_post_hook(App $a, array &$item)
|
|||
/* Retrieve our personal config setting */
|
||||
|
||||
$geo_account = DI::config()->get('geonames', 'username');
|
||||
$active = DI::pConfig()->get(local_user(), 'geonames', 'enable');
|
||||
$active = DI::pConfig()->get(Session::getLocalUser(), 'geonames', 'enable');
|
||||
|
||||
if (!$geo_account || !$active) {
|
||||
return;
|
||||
|
@ -102,11 +103,11 @@ function geonames_post_hook(App $a, array &$item)
|
|||
*/
|
||||
function geonames_addon_settings_post(App $a, array $post)
|
||||
{
|
||||
if (!local_user() || empty($_POST['geonames-submit'])) {
|
||||
if (!Session::getLocalUser() || empty($_POST['geonames-submit'])) {
|
||||
return;
|
||||
}
|
||||
|
||||
DI::pConfig()->set(local_user(), 'geonames', 'enable', intval($_POST['geonames-enable']));
|
||||
DI::pConfig()->set(Session::getLocalUser(), 'geonames', 'enable', intval($_POST['geonames-enable']));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -119,7 +120,7 @@ function geonames_addon_settings_post(App $a, array $post)
|
|||
*/
|
||||
function geonames_addon_settings(App $a, array &$data)
|
||||
{
|
||||
if (!local_user()) {
|
||||
if (!Session::getLocalUser()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -128,7 +129,7 @@ function geonames_addon_settings(App $a, array &$data)
|
|||
return;
|
||||
}
|
||||
|
||||
$enabled = intval(DI::pConfig()->get(local_user(), 'geonames', 'enable'));
|
||||
$enabled = intval(DI::pConfig()->get(Session::getLocalUser(), 'geonames', 'enable'));
|
||||
|
||||
$t = Renderer::getMarkupTemplate('settings.tpl', 'addon/geonames/');
|
||||
$html = Renderer::replaceMacros($t, [
|
||||
|
|
|
@ -12,6 +12,7 @@ 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;
|
||||
|
||||
|
@ -31,10 +32,10 @@ function gnot_install()
|
|||
* and if so set our configuration setting for this person.
|
||||
*/
|
||||
function gnot_settings_post(App $a, $post) {
|
||||
if(! local_user() || empty($_POST['gnot-submit']))
|
||||
if(! Session::getLocalUser() || empty($_POST['gnot-submit']))
|
||||
return;
|
||||
|
||||
DI::pConfig()->set(local_user(),'gnot','enable',intval($_POST['gnot']));
|
||||
DI::pConfig()->set(Session::getLocalUser(),'gnot','enable',intval($_POST['gnot']));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -43,11 +44,11 @@ function gnot_settings_post(App $a, $post) {
|
|||
*/
|
||||
function gnot_settings(App &$a, array &$data)
|
||||
{
|
||||
if (!local_user()) {
|
||||
if (!Session::getLocalUser()) {
|
||||
return;
|
||||
}
|
||||
|
||||
$gnot = intval(DI::pConfig()->get(local_user(), 'gnot', 'enable'));
|
||||
$gnot = intval(DI::pConfig()->get(Session::getLocalUser(), 'gnot', 'enable'));
|
||||
|
||||
$t = Renderer::getMarkupTemplate('settings.tpl', 'addon/gnot/');
|
||||
$html = Renderer::replaceMacros($t, [
|
||||
|
|
|
@ -10,14 +10,13 @@ use Friendica\App;
|
|||
use Friendica\Core\Hook;
|
||||
use Friendica\Core\Logger;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\Core\Session;
|
||||
use Friendica\DI;
|
||||
|
||||
function group_text_install() {
|
||||
|
||||
function group_text_install()
|
||||
{
|
||||
Hook::register('addon_settings', 'addon/group_text/group_text.php', 'group_text_settings');
|
||||
Hook::register('addon_settings_post', 'addon/group_text/group_text.php', 'group_text_settings_post');
|
||||
|
||||
Logger::notice("installed group_text");
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -29,10 +28,13 @@ function group_text_install() {
|
|||
*
|
||||
*/
|
||||
|
||||
function group_text_settings_post(App $a, $post) {
|
||||
if(! local_user() || empty($_POST['group_text-submit']))
|
||||
function group_text_settings_post(App $a, array $post)
|
||||
{
|
||||
if (!Session::getLocalUser() || empty($post['group_text-submit'])) {
|
||||
return;
|
||||
DI::pConfig()->set(local_user(),'system','groupedit_image_limit',intval($_POST['group_text']));
|
||||
}
|
||||
|
||||
DI::pConfig()->set(Session::getLocalUser(), 'system', 'groupedit_image_limit', intval($post['group_text']));
|
||||
}
|
||||
|
||||
|
||||
|
@ -43,15 +45,13 @@ function group_text_settings_post(App $a, $post) {
|
|||
*
|
||||
*/
|
||||
|
||||
|
||||
|
||||
function group_text_settings(App &$a, array &$data)
|
||||
{
|
||||
if (!local_user()) {
|
||||
if (!Session::getLocalUser()) {
|
||||
return;
|
||||
}
|
||||
|
||||
$enabled = DI::pConfig()->get(local_user(),'system','groupedit_image_limit');
|
||||
$enabled = DI::pConfig()->get(Session::getLocalUser(), 'system', 'groupedit_image_limit');
|
||||
|
||||
$t = Renderer::getMarkupTemplate('settings.tpl', 'addon/group_text/');
|
||||
$html = Renderer::replaceMacros($t, [
|
||||
|
|
|
@ -12,6 +12,7 @@ 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;
|
||||
|
@ -36,14 +37,14 @@ function ifttt_content() {}
|
|||
|
||||
function ifttt_settings(App $a, array &$data)
|
||||
{
|
||||
if (!local_user()) {
|
||||
if (!Session::getLocalUser()) {
|
||||
return;
|
||||
}
|
||||
|
||||
$key = DI::pConfig()->get(local_user(), 'ifttt', 'key');
|
||||
$key = DI::pConfig()->get(Session::getLocalUser(), 'ifttt', 'key');
|
||||
if (!$key) {
|
||||
$key = Strings::getRandomHex(20);
|
||||
DI::pConfig()->set(local_user(), 'ifttt', 'key', $key);
|
||||
DI::pConfig()->set(Session::getLocalUser(), 'ifttt', 'key', $key);
|
||||
}
|
||||
|
||||
$t = Renderer::getMarkupTemplate('connector_settings.tpl', 'addon/ifttt/');
|
||||
|
@ -75,7 +76,7 @@ function ifttt_settings(App $a, array &$data)
|
|||
function ifttt_settings_post()
|
||||
{
|
||||
if (!empty($_POST['ifttt-submit'])) {
|
||||
DI::pConfig()->delete(local_user(), 'ifttt', 'key');
|
||||
DI::pConfig()->delete(Session::getLocalUser(), 'ifttt', 'key');
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -13,6 +13,7 @@ use Friendica\Content\Text\BBCode;
|
|||
use Friendica\Core\Hook;
|
||||
use Friendica\Core\Logger;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\Core\Session;
|
||||
use Friendica\DI;
|
||||
use Friendica\Model\Tag;
|
||||
use Friendica\Model\User;
|
||||
|
@ -30,17 +31,17 @@ function ijpost_install()
|
|||
|
||||
function ijpost_jot_nets(App &$a, array &$jotnets_fields)
|
||||
{
|
||||
if (!local_user()) {
|
||||
if (!Session::getLocalUser()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (DI::pConfig()->get(local_user(), 'ijpost', 'post')) {
|
||||
if (DI::pConfig()->get(Session::getLocalUser(), 'ijpost', 'post')) {
|
||||
$jotnets_fields[] = [
|
||||
'type' => 'checkbox',
|
||||
'field' => [
|
||||
'ijpost_enable',
|
||||
DI::l10n()->t('Post to Insanejournal'),
|
||||
DI::pConfig()->get(local_user(), 'ijpost', 'post_by_default')
|
||||
DI::pConfig()->get(Session::getLocalUser(), 'ijpost', 'post_by_default')
|
||||
]
|
||||
];
|
||||
}
|
||||
|
@ -48,13 +49,13 @@ function ijpost_jot_nets(App &$a, array &$jotnets_fields)
|
|||
|
||||
function ijpost_settings(App &$a, array &$data)
|
||||
{
|
||||
if (!local_user()) {
|
||||
if (!Session::getLocalUser()) {
|
||||
return;
|
||||
}
|
||||
|
||||
$enabled = DI::pConfig()->get(local_user(), 'ijpost', 'post', false);
|
||||
$ij_username = DI::pConfig()->get(local_user(), 'ijpost', 'ij_username');
|
||||
$def_enabled = DI::pConfig()->get(local_user(), 'ijpost', 'post_by_default');
|
||||
$enabled = DI::pConfig()->get(Session::getLocalUser(), 'ijpost', 'post', false);
|
||||
$ij_username = DI::pConfig()->get(Session::getLocalUser(), 'ijpost', 'ij_username');
|
||||
$def_enabled = DI::pConfig()->get(Session::getLocalUser(), 'ijpost', 'post_by_default');
|
||||
|
||||
$t = Renderer::getMarkupTemplate('connector_settings.tpl', 'addon/ijpost/');
|
||||
$html = Renderer::replaceMacros($t, [
|
||||
|
@ -76,10 +77,10 @@ function ijpost_settings(App &$a, array &$data)
|
|||
function ijpost_settings_post(App $a, array &$b)
|
||||
{
|
||||
if (!empty($_POST['ijpost-submit'])) {
|
||||
DI::pConfig()->set(local_user(), 'ijpost', 'post', intval($_POST['ijpost']));
|
||||
DI::pConfig()->set(local_user(), 'ijpost', 'post_by_default', intval($_POST['ij_bydefault']));
|
||||
DI::pConfig()->set(local_user(), 'ijpost', 'ij_username', trim($_POST['ij_username']));
|
||||
DI::pConfig()->set(local_user(), 'ijpost', 'ij_password', trim($_POST['ij_password']));
|
||||
DI::pConfig()->set(Session::getLocalUser(), 'ijpost', 'post', intval($_POST['ijpost']));
|
||||
DI::pConfig()->set(Session::getLocalUser(), 'ijpost', 'post_by_default', intval($_POST['ij_bydefault']));
|
||||
DI::pConfig()->set(Session::getLocalUser(), 'ijpost', 'ij_username', trim($_POST['ij_username']));
|
||||
DI::pConfig()->set(Session::getLocalUser(), 'ijpost', 'ij_password', trim($_POST['ij_password']));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -91,7 +92,7 @@ function ijpost_post_local(App $a, array &$b)
|
|||
return;
|
||||
}
|
||||
|
||||
if (!local_user() || (local_user() != $b['uid'])) {
|
||||
if (!Session::getLocalUser() || (Session::getLocalUser() != $b['uid'])) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -99,11 +100,11 @@ function ijpost_post_local(App $a, array &$b)
|
|||
return;
|
||||
}
|
||||
|
||||
$ij_post = intval(DI::pConfig()->get(local_user(), 'ijpost', 'post'));
|
||||
$ij_post = intval(DI::pConfig()->get(Session::getLocalUser(), 'ijpost', 'post'));
|
||||
|
||||
$ij_enable = (($ij_post && !empty($_REQUEST['ijpost_enable'])) ? intval($_REQUEST['ijpost_enable']) : 0);
|
||||
|
||||
if ($b['api_source'] && intval(DI::pConfig()->get(local_user(), 'ijpost', 'post_by_default'))) {
|
||||
if ($b['api_source'] && intval(DI::pConfig()->get(Session::getLocalUser(), 'ijpost', 'post_by_default'))) {
|
||||
$ij_enable = 1;
|
||||
}
|
||||
|
||||
|
|
21
irc/irc.php
21
irc/irc.php
|
@ -10,6 +10,7 @@
|
|||
use Friendica\App;
|
||||
use Friendica\Core\Hook;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\Core\Session;
|
||||
use Friendica\DI;
|
||||
|
||||
function irc_install()
|
||||
|
@ -21,12 +22,12 @@ function irc_install()
|
|||
|
||||
function irc_addon_settings(App &$a, array &$data)
|
||||
{
|
||||
if (!local_user()) {
|
||||
if (!Session::getLocalUser()) {
|
||||
return;
|
||||
}
|
||||
|
||||
$sitechats = DI::pConfig()->get(local_user(), 'irc', 'sitechats'); /* popular channels */
|
||||
$autochans = DI::pConfig()->get(local_user(), 'irc', 'autochans'); /* auto connect chans */
|
||||
$sitechats = DI::pConfig()->get(Session::getLocalUser(), 'irc', 'sitechats'); /* popular channels */
|
||||
$autochans = DI::pConfig()->get(Session::getLocalUser(), 'irc', 'autochans'); /* auto connect chans */
|
||||
|
||||
$t = Renderer::getMarkupTemplate('settings.tpl', 'addon/irc/');
|
||||
$html = Renderer::replaceMacros($t, [
|
||||
|
@ -44,16 +45,16 @@ function irc_addon_settings(App &$a, array &$data)
|
|||
|
||||
function irc_addon_settings_post(App $a, array &$b)
|
||||
{
|
||||
if (!local_user()) {
|
||||
if (!Session::getLocalUser()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!empty($_POST['irc-submit'])) {
|
||||
if (isset($_POST['autochans'])) {
|
||||
DI::pConfig()->set(local_user(), 'irc', 'autochans', trim(($_POST['autochans'])));
|
||||
DI::pConfig()->set(Session::getLocalUser(), 'irc', 'autochans', trim(($_POST['autochans'])));
|
||||
}
|
||||
if (isset($_POST['sitechats'])) {
|
||||
DI::pConfig()->set(local_user(), 'irc', 'sitechats', trim($_POST['sitechats']));
|
||||
DI::pConfig()->set(Session::getLocalUser(), 'irc', 'sitechats', trim($_POST['sitechats']));
|
||||
}
|
||||
/* upid pop-up thing */
|
||||
}
|
||||
|
@ -77,8 +78,8 @@ function irc_content(App $a)
|
|||
$o = '';
|
||||
|
||||
/* set the list of popular channels */
|
||||
if (local_user()) {
|
||||
$sitechats = DI::pConfig()->get( local_user(), 'irc', 'sitechats');
|
||||
if (Session::getLocalUser()) {
|
||||
$sitechats = DI::pConfig()->get( Session::getLocalUser(), 'irc', 'sitechats');
|
||||
if (!$sitechats) {
|
||||
$sitechats = DI::config()->get('irc', 'sitechats');
|
||||
}
|
||||
|
@ -100,8 +101,8 @@ function irc_content(App $a)
|
|||
DI::page()['aside'] .= '</ul></div>';
|
||||
|
||||
/* setting the channel(s) to auto connect */
|
||||
if (local_user()) {
|
||||
$autochans = DI::pConfig()->get(local_user(), 'irc', 'autochans');
|
||||
if (Session::getLocalUser()) {
|
||||
$autochans = DI::pConfig()->get(Session::getLocalUser(), 'irc', 'autochans');
|
||||
if (!$autochans)
|
||||
$autochans = DI::config()->get('irc','autochans');
|
||||
} else {
|
||||
|
|
|
@ -10,6 +10,7 @@ use Friendica\App;
|
|||
use Friendica\Core\Hook;
|
||||
use Friendica\Core\Logger;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\Core\Session;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\DI;
|
||||
use Friendica\Model\User;
|
||||
|
@ -142,7 +143,7 @@ function keycloakpassword_addon_admin(App $a, string &$o)
|
|||
|
||||
function keycloakpassword_addon_admin_post(App $a)
|
||||
{
|
||||
if (!local_user()) {
|
||||
if (!Session::getLocalUser()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -14,6 +14,7 @@ use Friendica\App;
|
|||
use Friendica\Core\Hook;
|
||||
use Friendica\Core\Logger;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\Core\Session;
|
||||
use Friendica\DI;
|
||||
|
||||
function krynn_install()
|
||||
|
@ -43,12 +44,12 @@ function krynn_post_hook(App $a, &$item)
|
|||
* - A status post by a profile owner
|
||||
* - The profile owner must have allowed our addon
|
||||
*/
|
||||
if (!local_user()) {
|
||||
if (!Session::getLocalUser()) {
|
||||
/* non-zero if this is a logged in user of this system */
|
||||
return;
|
||||
}
|
||||
|
||||
if (local_user() != $item['uid']) {
|
||||
if (Session::getLocalUser() != $item['uid']) {
|
||||
/* Does this person own the post? */
|
||||
return;
|
||||
}
|
||||
|
@ -59,7 +60,7 @@ function krynn_post_hook(App $a, &$item)
|
|||
}
|
||||
|
||||
/* Retrieve our personal config setting */
|
||||
$active = DI::pConfig()->get(local_user(), 'krynn', 'enable');
|
||||
$active = DI::pConfig()->get(Session::getLocalUser(), 'krynn', 'enable');
|
||||
|
||||
if (!$active) {
|
||||
return;
|
||||
|
@ -90,12 +91,12 @@ function krynn_post_hook(App $a, &$item)
|
|||
*/
|
||||
function krynn_settings_post(App $a, $post)
|
||||
{
|
||||
if (!local_user()) {
|
||||
if (!Session::getLocalUser()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ($_POST['krynn-submit']) {
|
||||
DI::pConfig()->set(local_user(),'krynn','enable',intval($_POST['krynn']));
|
||||
DI::pConfig()->set(Session::getLocalUser(),'krynn','enable',intval($_POST['krynn']));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -105,11 +106,11 @@ function krynn_settings_post(App $a, $post)
|
|||
*/
|
||||
function krynn_settings(App &$a, array &$data)
|
||||
{
|
||||
if (!local_user()) {
|
||||
if (!Session::getLocalUser()) {
|
||||
return;
|
||||
}
|
||||
|
||||
$enabled = DI::pConfig()->get(local_user(),'krynn','enable');
|
||||
$enabled = DI::pConfig()->get(Session::getLocalUser(),'krynn','enable');
|
||||
|
||||
$t = Renderer::getMarkupTemplate('settings.tpl', 'addon/krynn/');
|
||||
$html = Renderer::replaceMacros($t, [
|
||||
|
|
|
@ -11,6 +11,7 @@ use Friendica\App;
|
|||
use Friendica\Content\Text\BBCode;
|
||||
use Friendica\Core\Hook;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\Core\Session;
|
||||
use Friendica\DI;
|
||||
|
||||
/* Define the hooks we want to use
|
||||
|
@ -33,16 +34,16 @@ function langfilter_install()
|
|||
|
||||
function langfilter_addon_settings(App $a, array &$data)
|
||||
{
|
||||
if (!local_user()) {
|
||||
if (!Session::getLocalUser()) {
|
||||
return;
|
||||
}
|
||||
|
||||
$enabled = DI::pConfig()->get(local_user(), 'langfilter', 'enable',
|
||||
!DI::pConfig()->get(local_user(), 'langfilter', 'disable'));
|
||||
$enabled = DI::pConfig()->get(Session::getLocalUser(), 'langfilter', 'enable',
|
||||
!DI::pConfig()->get(Session::getLocalUser(), 'langfilter', 'disable'));
|
||||
|
||||
$languages = DI::pConfig()->get(local_user(), 'langfilter', 'languages');
|
||||
$minconfidence = DI::pConfig()->get(local_user(), 'langfilter', 'minconfidence', 0) * 100;
|
||||
$minlength = DI::pConfig()->get(local_user(), 'langfilter', 'minlength', 32);
|
||||
$languages = DI::pConfig()->get(Session::getLocalUser(), 'langfilter', 'languages');
|
||||
$minconfidence = DI::pConfig()->get(Session::getLocalUser(), 'langfilter', 'minconfidence', 0) * 100;
|
||||
$minlength = DI::pConfig()->get(Session::getLocalUser(), 'langfilter', 'minlength', 32);
|
||||
|
||||
$t = Renderer::getMarkupTemplate('settings.tpl', 'addon/langfilter/');
|
||||
$html = Renderer::replaceMacros($t, [
|
||||
|
@ -69,7 +70,7 @@ function langfilter_addon_settings(App $a, array &$data)
|
|||
|
||||
function langfilter_addon_settings_post(App $a, array &$b)
|
||||
{
|
||||
if (!local_user()) {
|
||||
if (!Session::getLocalUser()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -82,10 +83,10 @@ function langfilter_addon_settings_post(App $a, array &$b)
|
|||
$minlength = 32;
|
||||
}
|
||||
|
||||
DI::pConfig()->set(local_user(), 'langfilter', 'enable' , $enable);
|
||||
DI::pConfig()->set(local_user(), 'langfilter', 'languages' , $languages);
|
||||
DI::pConfig()->set(local_user(), 'langfilter', 'minconfidence', $minconfidence);
|
||||
DI::pConfig()->set(local_user(), 'langfilter', 'minlength' , $minlength);
|
||||
DI::pConfig()->set(Session::getLocalUser(), 'langfilter', 'enable' , $enable);
|
||||
DI::pConfig()->set(Session::getLocalUser(), 'langfilter', 'languages' , $languages);
|
||||
DI::pConfig()->set(Session::getLocalUser(), 'langfilter', 'minconfidence', $minconfidence);
|
||||
DI::pConfig()->set(Session::getLocalUser(), 'langfilter', 'minlength' , $minlength);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -100,7 +101,7 @@ function langfilter_addon_settings_post(App $a, array &$b)
|
|||
|
||||
function langfilter_prepare_body_content_filter(App $a, &$hook_data)
|
||||
{
|
||||
$logged_user = local_user();
|
||||
$logged_user = Session::getLocalUser();
|
||||
if (!$logged_user) {
|
||||
return;
|
||||
}
|
||||
|
@ -128,7 +129,7 @@ function langfilter_prepare_body_content_filter(App $a, &$hook_data)
|
|||
$naked_body = preg_replace('#\s+#', ' ', trim($naked_body));
|
||||
|
||||
// Don't filter if body lenght is below minimum
|
||||
$minlen = DI::pConfig()->get(local_user(), 'langfilter', 'minlength', 32);
|
||||
$minlen = DI::pConfig()->get(Session::getLocalUser(), 'langfilter', 'minlength', 32);
|
||||
if (!$minlen) {
|
||||
$minlen = 32;
|
||||
}
|
||||
|
@ -137,8 +138,8 @@ function langfilter_prepare_body_content_filter(App $a, &$hook_data)
|
|||
return;
|
||||
}
|
||||
|
||||
$read_languages_string = DI::pConfig()->get(local_user(), 'langfilter', 'languages');
|
||||
$minconfidence = DI::pConfig()->get(local_user(), 'langfilter', 'minconfidence');
|
||||
$read_languages_string = DI::pConfig()->get(Session::getLocalUser(), 'langfilter', 'languages');
|
||||
$minconfidence = DI::pConfig()->get(Session::getLocalUser(), 'langfilter', 'minconfidence');
|
||||
|
||||
// Don't filter if no spoken languages are configured
|
||||
if (!$read_languages_string) {
|
||||
|
|
|
@ -11,6 +11,7 @@ use Friendica\Content\Text\BBCode;
|
|||
use Friendica\Core\Hook;
|
||||
use Friendica\Core\Logger;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\Core\Session;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\DI;
|
||||
use Friendica\Model\Post;
|
||||
|
@ -27,17 +28,17 @@ function libertree_install()
|
|||
|
||||
function libertree_jot_nets(App &$a, array &$jotnets_fields)
|
||||
{
|
||||
if (!local_user()) {
|
||||
if (!Session::getLocalUser()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (DI::pConfig()->get(local_user(), 'libertree', 'post')) {
|
||||
if (DI::pConfig()->get(Session::getLocalUser(), 'libertree', 'post')) {
|
||||
$jotnets_fields[] = [
|
||||
'type' => 'checkbox',
|
||||
'field' => [
|
||||
'libertree_enable',
|
||||
DI::l10n()->t('Post to libertree'),
|
||||
DI::pConfig()->get(local_user(), 'libertree', 'post_by_default'),
|
||||
DI::pConfig()->get(Session::getLocalUser(), 'libertree', 'post_by_default'),
|
||||
],
|
||||
];
|
||||
}
|
||||
|
@ -45,14 +46,14 @@ function libertree_jot_nets(App &$a, array &$jotnets_fields)
|
|||
|
||||
function libertree_settings(App $a, array &$data)
|
||||
{
|
||||
if (!local_user()) {
|
||||
if (!Session::getLocalUser()) {
|
||||
return;
|
||||
}
|
||||
|
||||
$enabled = DI::pConfig()->get(local_user(), 'libertree', 'post', false);
|
||||
$ltree_api_token = DI::pConfig()->get(local_user(), 'libertree', 'libertree_api_token');
|
||||
$ltree_url = DI::pConfig()->get(local_user(), 'libertree', 'libertree_url');
|
||||
$def_enabled = DI::pConfig()->get(local_user(), 'libertree', 'post_by_default');
|
||||
$enabled = DI::pConfig()->get(Session::getLocalUser(), 'libertree', 'post', false);
|
||||
$ltree_api_token = DI::pConfig()->get(Session::getLocalUser(), 'libertree', 'libertree_api_token');
|
||||
$ltree_url = DI::pConfig()->get(Session::getLocalUser(), 'libertree', 'libertree_url');
|
||||
$def_enabled = DI::pConfig()->get(Session::getLocalUser(), 'libertree', 'post_by_default');
|
||||
|
||||
$t = Renderer::getMarkupTemplate('connector_settings.tpl', 'addon/libertree/');
|
||||
$html = Renderer::replaceMacros($t, [
|
||||
|
@ -74,10 +75,10 @@ function libertree_settings(App $a, array &$data)
|
|||
function libertree_settings_post(App $a, array &$b)
|
||||
{
|
||||
if (!empty($_POST['libertree-submit'])) {
|
||||
DI::pConfig()->set(local_user(),'libertree','post',intval($_POST['libertree']));
|
||||
DI::pConfig()->set(local_user(),'libertree','post_by_default',intval($_POST['libertree_bydefault']));
|
||||
DI::pConfig()->set(local_user(),'libertree','libertree_api_token',trim($_POST['libertree_api_token']));
|
||||
DI::pConfig()->set(local_user(),'libertree','libertree_url',trim($_POST['libertree_url']));
|
||||
DI::pConfig()->set(Session::getLocalUser(),'libertree','post',intval($_POST['libertree']));
|
||||
DI::pConfig()->set(Session::getLocalUser(),'libertree','post_by_default',intval($_POST['libertree_bydefault']));
|
||||
DI::pConfig()->set(Session::getLocalUser(),'libertree','libertree_api_token',trim($_POST['libertree_api_token']));
|
||||
DI::pConfig()->set(Session::getLocalUser(),'libertree','libertree_url',trim($_POST['libertree_url']));
|
||||
|
||||
}
|
||||
|
||||
|
@ -107,7 +108,7 @@ function libertree_post_local(App $a, array &$b)
|
|||
return;
|
||||
}
|
||||
|
||||
if ((!local_user()) || (local_user() != $b['uid'])) {
|
||||
if (!Session::getLocalUser() || (Session::getLocalUser() != $b['uid'])) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -115,11 +116,11 @@ function libertree_post_local(App $a, array &$b)
|
|||
return;
|
||||
}
|
||||
|
||||
$ltree_post = intval(DI::pConfig()->get(local_user(),'libertree','post'));
|
||||
$ltree_post = intval(DI::pConfig()->get(Session::getLocalUser(),'libertree','post'));
|
||||
|
||||
$ltree_enable = (($ltree_post && !empty($_REQUEST['libertree_enable'])) ? intval($_REQUEST['libertree_enable']) : 0);
|
||||
|
||||
if ($b['api_source'] && intval(DI::pConfig()->get(local_user(),'libertree','post_by_default'))) {
|
||||
if ($b['api_source'] && intval(DI::pConfig()->get(Session::getLocalUser(),'libertree','post_by_default'))) {
|
||||
$ltree_enable = 1;
|
||||
}
|
||||
|
||||
|
|
|
@ -13,6 +13,7 @@ use Friendica\Content\Text\BBCode;
|
|||
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;
|
||||
|
@ -31,17 +32,17 @@ function ljpost_install()
|
|||
|
||||
function ljpost_jot_nets(App &$a, array &$jotnets_fields)
|
||||
{
|
||||
if (!local_user()) {
|
||||
if (!Session::getLocalUser()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (DI::pConfig()->get(local_user(),'ljpost','post')) {
|
||||
if (DI::pConfig()->get(Session::getLocalUser(),'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(Session::getLocalUser(), 'ljpost', 'post_by_default'),
|
||||
],
|
||||
];
|
||||
}
|
||||
|
@ -49,13 +50,13 @@ function ljpost_jot_nets(App &$a, array &$jotnets_fields)
|
|||
|
||||
function ljpost_settings(App &$a, array &$data)
|
||||
{
|
||||
if (!local_user()) {
|
||||
if (!Session::getLocalUser()) {
|
||||
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(Session::getLocalUser(), 'ljpost', 'post', false);
|
||||
$ij_username = DI::pConfig()->get(Session::getLocalUser(), 'ljpost', 'ij_username');
|
||||
$def_enabled = DI::pConfig()->get(Session::getLocalUser(), 'ljpost', 'post_by_default');
|
||||
|
||||
$t= Renderer::getMarkupTemplate('connector_settings.tpl', 'addon/ljpost/');
|
||||
$html = Renderer::replaceMacros($t, [
|
||||
|
@ -77,10 +78,10 @@ function ljpost_settings(App &$a, array &$data)
|
|||
function ljpost_settings_post(App $a, 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(Session::getLocalUser(), 'ljpost', 'post', intval($_POST['ljpost']));
|
||||
DI::pConfig()->set(Session::getLocalUser(), 'ljpost', 'post_by_default', intval($_POST['lj_bydefault']));
|
||||
DI::pConfig()->set(Session::getLocalUser(), 'ljpost', 'lj_username', trim($_POST['lj_username']));
|
||||
DI::pConfig()->set(Session::getLocalUser(), 'ljpost', 'lj_password', trim($_POST['lj_password']));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -91,7 +92,7 @@ function ljpost_post_local(App $a, array &$b)
|
|||
return;
|
||||
}
|
||||
|
||||
if ((!local_user()) || (local_user() != $b['uid'])) {
|
||||
if (!Session::getLocalUser() || (Session::getLocalUser() != $b['uid'])) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -99,10 +100,10 @@ function ljpost_post_local(App $a, array &$b)
|
|||
return;
|
||||
}
|
||||
|
||||
$lj_post = intval(DI::pConfig()->get(local_user(),'ljpost','post'));
|
||||
$lj_post = intval(DI::pConfig()->get(Session::getLocalUser(),'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(Session::getLocalUser(), 'ljpost', 'post_by_default'))) {
|
||||
$lj_enable = 1;
|
||||
}
|
||||
|
||||
|
|
|
@ -11,6 +11,7 @@ use Friendica\Content\Text\BBCode;
|
|||
use Friendica\Core\Hook;
|
||||
use Friendica\Core\Logger;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\Core\Session;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\Core\Worker;
|
||||
use Friendica\Database\DBA;
|
||||
|
@ -481,10 +482,10 @@ function mailstream_convert_table_entries()
|
|||
*/
|
||||
function mailstream_addon_settings(App &$a, array &$data)
|
||||
{
|
||||
$enabled = DI::pConfig()->get(local_user(), 'mailstream', 'enabled');
|
||||
$address = DI::pConfig()->get(local_user(), 'mailstream', 'address');
|
||||
$nolikes = DI::pConfig()->get(local_user(), 'mailstream', 'nolikes');
|
||||
$attachimg = DI::pConfig()->get(local_user(), 'mailstream', 'attachimg');
|
||||
$enabled = DI::pConfig()->get(Session::getLocalUser(), 'mailstream', 'enabled');
|
||||
$address = DI::pConfig()->get(Session::getLocalUser(), 'mailstream', 'address');
|
||||
$nolikes = DI::pConfig()->get(Session::getLocalUser(), 'mailstream', 'nolikes');
|
||||
$attachimg = DI::pConfig()->get(Session::getLocalUser(), 'mailstream', 'attachimg');
|
||||
|
||||
$template = Renderer::getMarkupTemplate('settings.tpl', 'addon/mailstream/');
|
||||
$html = Renderer::replaceMacros($template, [
|
||||
|
@ -529,28 +530,28 @@ function mailstream_addon_settings(App &$a, array &$data)
|
|||
*/
|
||||
function mailstream_addon_settings_post(App $a, array $post)
|
||||
{
|
||||
if (!local_user() || empty($post['mailstream-submit'])) {
|
||||
if (!Session::getLocalUser() || empty($post['mailstream-submit'])) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ($post['mailstream_address'] != "") {
|
||||
DI::pConfig()->set(local_user(), 'mailstream', 'address', $post['mailstream_address']);
|
||||
DI::pConfig()->set(Session::getLocalUser(), 'mailstream', 'address', $post['mailstream_address']);
|
||||
} else {
|
||||
DI::pConfig()->delete(local_user(), 'mailstream', 'address');
|
||||
DI::pConfig()->delete(Session::getLocalUser(), 'mailstream', 'address');
|
||||
}
|
||||
if ($post['mailstream_nolikes']) {
|
||||
DI::pConfig()->set(local_user(), 'mailstream', 'nolikes', $post['mailstream_enabled']);
|
||||
DI::pConfig()->set(Session::getLocalUser(), 'mailstream', 'nolikes', $post['mailstream_enabled']);
|
||||
} else {
|
||||
DI::pConfig()->delete(local_user(), 'mailstream', 'nolikes');
|
||||
DI::pConfig()->delete(Session::getLocalUser(), 'mailstream', 'nolikes');
|
||||
}
|
||||
if ($post['mailstream_enabled']) {
|
||||
DI::pConfig()->set(local_user(), 'mailstream', 'enabled', $post['mailstream_enabled']);
|
||||
DI::pConfig()->set(Session::getLocalUser(), 'mailstream', 'enabled', $post['mailstream_enabled']);
|
||||
} else {
|
||||
DI::pConfig()->delete(local_user(), 'mailstream', 'enabled');
|
||||
DI::pConfig()->delete(Session::getLocalUser(), 'mailstream', 'enabled');
|
||||
}
|
||||
if ($post['mailstream_attachimg']) {
|
||||
DI::pConfig()->set(local_user(), 'mailstream', 'attachimg', $post['mailstream_attachimg']);
|
||||
DI::pConfig()->set(Session::getLocalUser(), 'mailstream', 'attachimg', $post['mailstream_attachimg']);
|
||||
} else {
|
||||
DI::pConfig()->delete(local_user(), 'mailstream', 'attachimg');
|
||||
DI::pConfig()->delete(Session::getLocalUser(), 'mailstream', 'attachimg');
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,6 +9,7 @@ use Friendica\App;
|
|||
use Friendica\Core\Hook;
|
||||
use Friendica\Content\Text\Markdown;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\Core\Session;
|
||||
use Friendica\DI;
|
||||
|
||||
function markdown_install() {
|
||||
|
@ -19,11 +20,11 @@ function markdown_install() {
|
|||
|
||||
function markdown_addon_settings(App $a, array &$data)
|
||||
{
|
||||
if (!local_user()) {
|
||||
if (!Session::getLocalUser()) {
|
||||
return;
|
||||
}
|
||||
|
||||
$enabled = intval(DI::pConfig()->get(local_user(), 'markdown', 'enabled'));
|
||||
$enabled = intval(DI::pConfig()->get(Session::getLocalUser(), 'markdown', 'enabled'));
|
||||
|
||||
$t = Renderer::getMarkupTemplate('settings.tpl', 'addon/markdown/');
|
||||
$html = Renderer::replaceMacros($t, [
|
||||
|
@ -39,15 +40,15 @@ function markdown_addon_settings(App $a, array &$data)
|
|||
|
||||
function markdown_addon_settings_post(App $a, array &$b)
|
||||
{
|
||||
if (!local_user() || empty($_POST['markdown-submit'])) {
|
||||
if (!Session::getLocalUser() || empty($_POST['markdown-submit'])) {
|
||||
return;
|
||||
}
|
||||
|
||||
DI::pConfig()->set(local_user(), 'markdown', 'enabled', intval($_POST['enabled']));
|
||||
DI::pConfig()->set(Session::getLocalUser(), 'markdown', 'enabled', intval($_POST['enabled']));
|
||||
}
|
||||
|
||||
function markdown_post_local_start(App $a, &$request) {
|
||||
if (empty($request['body']) || !DI::pConfig()->get(local_user(), 'markdown', 'enabled')) {
|
||||
if (empty($request['body']) || !DI::pConfig()->get(Session::getLocalUser(), 'markdown', 'enabled')) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
use Friendica\App;
|
||||
use Friendica\Core\Hook;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\Core\Session;
|
||||
use Friendica\DI;
|
||||
|
||||
function mathjax_install()
|
||||
|
@ -22,20 +23,20 @@ function mathjax_install()
|
|||
|
||||
function mathjax_settings_post(App $a)
|
||||
{
|
||||
if (!local_user() || empty($_POST['mathjax-submit'])) {
|
||||
if (!Session::getLocalUser() || empty($_POST['mathjax-submit'])) {
|
||||
return;
|
||||
}
|
||||
|
||||
DI::pConfig()->set(local_user(), 'mathjax', 'use', intval($_POST['mathjax_use']));
|
||||
DI::pConfig()->set(Session::getLocalUser(), 'mathjax', 'use', intval($_POST['mathjax_use']));
|
||||
}
|
||||
|
||||
function mathjax_settings(App $a, array &$data)
|
||||
{
|
||||
if (!local_user()) {
|
||||
if (!Session::getLocalUser()) {
|
||||
return;
|
||||
}
|
||||
|
||||
$use = DI::pConfig()->get(local_user(), 'mathjax', 'use', false);
|
||||
$use = DI::pConfig()->get(Session::getLocalUser(), 'mathjax', 'use', false);
|
||||
|
||||
$tpl = Renderer::getMarkupTemplate('settings.tpl', 'addon/mathjax');
|
||||
$html = Renderer::replaceMacros($tpl, [
|
||||
|
@ -54,7 +55,7 @@ function mathjax_footer(App $a, string &$body)
|
|||
{
|
||||
// if the visitor of the page is not a local_user, use MathJax
|
||||
// otherwise check the users settings.
|
||||
if (!local_user() || DI::pConfig()->get(local_user(), 'mathjax', 'use', false)) {
|
||||
if (!Session::getLocalUser() || DI::pConfig()->get(Session::getLocalUser(), 'mathjax', 'use', false)) {
|
||||
DI::page()->registerFooterScript(__DIR__ . '/asset/MathJax.js?config=TeX-MML-AM_CHTML');
|
||||
DI::page()->registerFooterScript(__DIR__ . '/mathjax.js');
|
||||
}
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
use Friendica\App;
|
||||
use Friendica\Core\Hook;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\Core\Session;
|
||||
use Friendica\DI;
|
||||
|
||||
function nsfw_install()
|
||||
|
@ -53,12 +54,12 @@ function nsfw_extract_photos($body)
|
|||
|
||||
function nsfw_addon_settings(App &$a, array &$data)
|
||||
{
|
||||
if (!local_user()) {
|
||||
if (!Session::getLocalUser()) {
|
||||
return;
|
||||
}
|
||||
|
||||
$enabled = !DI::pConfig()->get(local_user(), 'nsfw', 'disable');
|
||||
$words = DI::pConfig()->get(local_user(), 'nsfw', 'words', 'nsfw,');
|
||||
$enabled = !DI::pConfig()->get(Session::getLocalUser(), 'nsfw', 'disable');
|
||||
$words = DI::pConfig()->get(Session::getLocalUser(), 'nsfw', 'words', 'nsfw,');
|
||||
|
||||
$t = Renderer::getMarkupTemplate('settings.tpl', 'addon/nsfw/');
|
||||
$html = Renderer::replaceMacros($t, [
|
||||
|
@ -76,27 +77,27 @@ function nsfw_addon_settings(App &$a, array &$data)
|
|||
|
||||
function nsfw_addon_settings_post(App $a, array &$b)
|
||||
{
|
||||
if (!local_user()) {
|
||||
if (!Session::getLocalUser()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!empty($_POST['nsfw-submit'])) {
|
||||
DI::pConfig()->set(local_user(), 'nsfw', 'words', trim($_POST['nsfw-words']));
|
||||
DI::pConfig()->set(Session::getLocalUser(), 'nsfw', 'words', trim($_POST['nsfw-words']));
|
||||
$enable = (!empty($_POST['nsfw-enable']) ? intval($_POST['nsfw-enable']) : 0);
|
||||
$disable = 1 - $enable;
|
||||
DI::pConfig()->set(local_user(), 'nsfw', 'disable', $disable);
|
||||
DI::pConfig()->set(Session::getLocalUser(), 'nsfw', 'disable', $disable);
|
||||
}
|
||||
}
|
||||
|
||||
function nsfw_prepare_body_content_filter(App $a, &$hook_data)
|
||||
{
|
||||
$words = null;
|
||||
if (DI::pConfig()->get(local_user(), 'nsfw', 'disable')) {
|
||||
if (DI::pConfig()->get(Session::getLocalUser(), 'nsfw', 'disable')) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (local_user()) {
|
||||
$words = DI::pConfig()->get(local_user(), 'nsfw', 'words');
|
||||
if (Session::getLocalUser()) {
|
||||
$words = DI::pConfig()->get(Session::getLocalUser(), 'nsfw', 'words');
|
||||
}
|
||||
|
||||
if ($words) {
|
||||
|
|
|
@ -10,6 +10,7 @@ use Friendica\App;
|
|||
use Friendica\Core\Hook;
|
||||
use Friendica\Core\Logger;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\Core\Session;
|
||||
use Friendica\DI;
|
||||
|
||||
function numfriends_install() {
|
||||
|
@ -29,11 +30,11 @@ function numfriends_install() {
|
|||
*
|
||||
*/
|
||||
function numfriends_settings_post(App $a, $post) {
|
||||
if (! local_user() || empty($_POST['numfriends-submit'])) {
|
||||
if (! Session::getLocalUser() || empty($_POST['numfriends-submit'])) {
|
||||
return;
|
||||
}
|
||||
|
||||
DI::pConfig()->set(local_user(), 'system', 'display_friend_count', intval($_POST['numfriends']));
|
||||
DI::pConfig()->set(Session::getLocalUser(), 'system', 'display_friend_count', intval($_POST['numfriends']));
|
||||
}
|
||||
|
||||
|
||||
|
@ -45,11 +46,11 @@ function numfriends_settings_post(App $a, $post) {
|
|||
*/
|
||||
function numfriends_settings(App &$a, array &$data)
|
||||
{
|
||||
if (!local_user()) {
|
||||
if (!Session::getLocalUser()) {
|
||||
return;
|
||||
}
|
||||
|
||||
$numfriends = DI::pConfig()->get(local_user(), 'system', 'display_friend_count', 24);
|
||||
$numfriends = DI::pConfig()->get(Session::getLocalUser(), 'system', 'display_friend_count', 24);
|
||||
|
||||
$t = Renderer::getMarkupTemplate('settings.tpl', 'addon/numfriends/');
|
||||
$html = Renderer::replaceMacros($t, [
|
||||
|
|
|
@ -15,6 +15,7 @@ use Friendica\Network\HTTPException;
|
|||
use Friendica\Database\DBA;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\Core\Protocol;
|
||||
use Friendica\Core\Session;
|
||||
use Friendica\Model\Contact;
|
||||
use Friendica\Model\User;
|
||||
|
||||
|
@ -29,7 +30,7 @@ function opmlexport_install()
|
|||
function opmlexport(App $a)
|
||||
{
|
||||
$condition = [
|
||||
'uid' => local_user(),
|
||||
'uid' => Session::getLocalUser(),
|
||||
'self' => false,
|
||||
'deleted' => false,
|
||||
'archive' => false,
|
||||
|
@ -38,7 +39,7 @@ function opmlexport(App $a)
|
|||
'network' => Protocol::FEED
|
||||
];
|
||||
$data = Contact::selectToArray([], $condition, ['order' => ['name']]);
|
||||
$user = User::getById(local_user());
|
||||
$user = User::getById(Session::getLocalUser());
|
||||
|
||||
$xml = new \DOMDocument( '1.0', 'utf-8' );
|
||||
$opml = $xml->createElement('opml');
|
||||
|
@ -70,7 +71,7 @@ function opmlexport(App $a)
|
|||
|
||||
function opmlexport_addon_settings(App $a, array &$data)
|
||||
{
|
||||
if (!local_user()) {
|
||||
if (!Session::getLocalUser()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -84,7 +85,7 @@ function opmlexport_addon_settings(App $a, array &$data)
|
|||
|
||||
function opmlexport_addon_settings_post(App $a, array &$b)
|
||||
{
|
||||
if (!local_user() || empty($_POST['opmlexport-submit'])) {
|
||||
if (!Session::getLocalUser() || empty($_POST['opmlexport-submit'])) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -11,6 +11,7 @@ use Friendica\App;
|
|||
use Friendica\Core\Hook;
|
||||
use Friendica\Core\Logger;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\Core\Session;
|
||||
use Friendica\DI;
|
||||
|
||||
function planets_install()
|
||||
|
@ -42,12 +43,12 @@ function planets_post_hook(App $a, &$item)
|
|||
{
|
||||
Logger::notice('planets invoked');
|
||||
|
||||
if (!local_user()) {
|
||||
if (!Session::getLocalUser()) {
|
||||
/* non-zero if this is a logged in user of this system */
|
||||
return;
|
||||
}
|
||||
|
||||
if (local_user() != $item['uid']) {
|
||||
if (Session::getLocalUser() != $item['uid']) {
|
||||
/* Does this person own the post? */
|
||||
return;
|
||||
}
|
||||
|
@ -58,7 +59,7 @@ function planets_post_hook(App $a, &$item)
|
|||
}
|
||||
|
||||
/* Retrieve our personal config setting */
|
||||
$active = DI::pConfig()->get(local_user(), 'planets', 'enable');
|
||||
$active = DI::pConfig()->get(Session::getLocalUser(), 'planets', 'enable');
|
||||
|
||||
if (!$active) {
|
||||
return;
|
||||
|
@ -95,11 +96,11 @@ function planets_post_hook(App $a, &$item)
|
|||
|
||||
function planets_settings_post(App $a, $post)
|
||||
{
|
||||
if (!local_user()) {
|
||||
if (!Session::getLocalUser()) {
|
||||
return;
|
||||
}
|
||||
if ($_POST['planets-submit']) {
|
||||
DI::pConfig()->set(local_user(), 'planets', 'enable' ,intval($_POST['planets']));
|
||||
DI::pConfig()->set(Session::getLocalUser(), 'planets', 'enable' ,intval($_POST['planets']));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -115,11 +116,11 @@ function planets_settings_post(App $a, $post)
|
|||
|
||||
function planets_settings(App &$a, array &$data)
|
||||
{
|
||||
if(!local_user()) {
|
||||
if(!Session::getLocalUser()) {
|
||||
return;
|
||||
}
|
||||
|
||||
$enabled = DI::pConfig()->get(local_user(),'planets','enable');
|
||||
$enabled = DI::pConfig()->get(Session::getLocalUser(),'planets','enable');
|
||||
|
||||
$t = Renderer::getMarkupTemplate('settings.tpl', 'addon/planets/');
|
||||
$html = Renderer::replaceMacros($t, [
|
||||
|
|
|
@ -16,6 +16,7 @@ use Friendica\DI;
|
|||
use Friendica\Model\Notification;
|
||||
use Friendica\Model\User;
|
||||
use Friendica\Core\Config\Util\ConfigFileLoader;
|
||||
use Friendica\Core\Session;
|
||||
use Friendica\Util\DateTimeFormat;
|
||||
|
||||
function public_server_install()
|
||||
|
@ -118,7 +119,7 @@ function public_server_login(App $a, $b)
|
|||
}
|
||||
|
||||
$fields = ['account_expires_on' => DateTimeFormat::utc('now +' . $days . ' days')];
|
||||
$condition = ["`uid` = ? AND `account_expires_on` > ?", local_user(), DBA::NULL_DATETIME];
|
||||
$condition = ["`uid` = ? AND `account_expires_on` > ?", Session::getLocalUser(), DBA::NULL_DATETIME];
|
||||
DBA::update('user', $fields, $condition);
|
||||
}
|
||||
|
||||
|
|
|
@ -27,6 +27,7 @@ use Friendica\Network\HTTPClient\Client\HttpClientOptions;
|
|||
use Friendica\Protocol\Activity;
|
||||
use Friendica\Protocol\ActivityNamespace;
|
||||
use Friendica\Core\Config\Util\ConfigFileLoader;
|
||||
use Friendica\Core\Session;
|
||||
use Friendica\Util\DateTimeFormat;
|
||||
use Friendica\Util\Strings;
|
||||
use Friendica\Util\XML;
|
||||
|
@ -59,7 +60,7 @@ function pumpio_module() {}
|
|||
|
||||
function pumpio_content(App $a)
|
||||
{
|
||||
if (!local_user()) {
|
||||
if (!Session::getLocalUser()) {
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('Permission denied.'));
|
||||
return '';
|
||||
}
|
||||
|
@ -138,18 +139,18 @@ function pumpio_registerclient(App $a, $host)
|
|||
function pumpio_connect(App $a)
|
||||
{
|
||||
// Define the needed keys
|
||||
$consumer_key = DI::pConfig()->get(local_user(), 'pumpio', 'consumer_key');
|
||||
$consumer_secret = DI::pConfig()->get(local_user(), 'pumpio', 'consumer_secret');
|
||||
$hostname = DI::pConfig()->get(local_user(), 'pumpio', 'host');
|
||||
$consumer_key = DI::pConfig()->get(Session::getLocalUser(), 'pumpio', 'consumer_key');
|
||||
$consumer_secret = DI::pConfig()->get(Session::getLocalUser(), 'pumpio', 'consumer_secret');
|
||||
$hostname = DI::pConfig()->get(Session::getLocalUser(), 'pumpio', 'host');
|
||||
|
||||
if ((($consumer_key == '') || ($consumer_secret == '')) && ($hostname != '')) {
|
||||
Logger::notice('pumpio_connect: register client');
|
||||
$clientdata = pumpio_registerclient($a, $hostname);
|
||||
DI::pConfig()->set(local_user(), 'pumpio', 'consumer_key', $clientdata->client_id);
|
||||
DI::pConfig()->set(local_user(), 'pumpio', 'consumer_secret', $clientdata->client_secret);
|
||||
DI::pConfig()->set(Session::getLocalUser(), 'pumpio', 'consumer_key', $clientdata->client_id);
|
||||
DI::pConfig()->set(Session::getLocalUser(), 'pumpio', 'consumer_secret', $clientdata->client_secret);
|
||||
|
||||
$consumer_key = DI::pConfig()->get(local_user(), 'pumpio', 'consumer_key');
|
||||
$consumer_secret = DI::pConfig()->get(local_user(), 'pumpio', 'consumer_secret');
|
||||
$consumer_key = DI::pConfig()->get(Session::getLocalUser(), 'pumpio', 'consumer_key');
|
||||
$consumer_secret = DI::pConfig()->get(Session::getLocalUser(), 'pumpio', 'consumer_secret');
|
||||
|
||||
Logger::info('pumpio_connect: ckey: ' . $consumer_key . ' csecrect: ' . $consumer_secret);
|
||||
}
|
||||
|
@ -185,8 +186,8 @@ function pumpio_connect(App $a)
|
|||
if (($success = $client->Process())) {
|
||||
if (strlen($client->access_token)) {
|
||||
Logger::info('pumpio_connect: otoken: ' . $client->access_token . ', osecrect: ' . $client->access_token_secret);
|
||||
DI::pConfig()->set(local_user(), 'pumpio', 'oauth_token', $client->access_token);
|
||||
DI::pConfig()->set(local_user(), 'pumpio', 'oauth_token_secret', $client->access_token_secret);
|
||||
DI::pConfig()->set(Session::getLocalUser(), 'pumpio', 'oauth_token', $client->access_token);
|
||||
DI::pConfig()->set(Session::getLocalUser(), 'pumpio', 'oauth_token_secret', $client->access_token_secret);
|
||||
}
|
||||
}
|
||||
$success = $client->Finalize($success);
|
||||
|
@ -209,17 +210,17 @@ function pumpio_connect(App $a)
|
|||
|
||||
function pumpio_jot_nets(App $a, array &$jotnets_fields)
|
||||
{
|
||||
if (!local_user()) {
|
||||
if (!Session::getLocalUser()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (DI::pConfig()->get(local_user(), 'pumpio', 'post')) {
|
||||
if (DI::pConfig()->get(Session::getLocalUser(), 'pumpio', 'post')) {
|
||||
$jotnets_fields[] = [
|
||||
'type' => 'checkbox',
|
||||
'field' => [
|
||||
'pumpio_enable',
|
||||
DI::l10n()->t('Post to pumpio'),
|
||||
DI::pConfig()->get(local_user(), 'pumpio', 'post_by_default')
|
||||
DI::pConfig()->get(Session::getLocalUser(), 'pumpio', 'post_by_default')
|
||||
]
|
||||
];
|
||||
}
|
||||
|
@ -227,20 +228,20 @@ function pumpio_jot_nets(App $a, array &$jotnets_fields)
|
|||
|
||||
function pumpio_settings(App $a, array &$data)
|
||||
{
|
||||
if (!local_user()) {
|
||||
if (!Session::getLocalUser()) {
|
||||
return;
|
||||
}
|
||||
|
||||
$pumpio_host = DI::pConfig()->get(local_user(), 'pumpio', 'host');
|
||||
$pumpio_user = DI::pConfig()->get(local_user(), 'pumpio', 'user');
|
||||
$oauth_token = DI::pConfig()->get(local_user(), 'pumpio', 'oauth_token');
|
||||
$oauth_token_secret = DI::pConfig()->get(local_user(), 'pumpio', 'oauth_token_secret');
|
||||
$pumpio_host = DI::pConfig()->get(Session::getLocalUser(), 'pumpio', 'host');
|
||||
$pumpio_user = DI::pConfig()->get(Session::getLocalUser(), 'pumpio', 'user');
|
||||
$oauth_token = DI::pConfig()->get(Session::getLocalUser(), 'pumpio', 'oauth_token');
|
||||
$oauth_token_secret = DI::pConfig()->get(Session::getLocalUser(), 'pumpio', 'oauth_token_secret');
|
||||
|
||||
$import_enabled = DI::pConfig()->get(local_user(), 'pumpio', 'import', false);
|
||||
$enabled = DI::pConfig()->get(local_user(), 'pumpio', 'post', false);
|
||||
$def_enabled = DI::pConfig()->get(local_user(), 'pumpio', 'post_by_default', false);
|
||||
$public_enabled = DI::pConfig()->get(local_user(), 'pumpio', 'public', false);
|
||||
$mirror_enabled = DI::pConfig()->get(local_user(), 'pumpio', 'mirror', false);
|
||||
$import_enabled = DI::pConfig()->get(Session::getLocalUser(), 'pumpio', 'import', false);
|
||||
$enabled = DI::pConfig()->get(Session::getLocalUser(), 'pumpio', 'post', false);
|
||||
$def_enabled = DI::pConfig()->get(Session::getLocalUser(), 'pumpio', 'post_by_default', false);
|
||||
$public_enabled = DI::pConfig()->get(Session::getLocalUser(), 'pumpio', 'public', false);
|
||||
$mirror_enabled = DI::pConfig()->get(Session::getLocalUser(), 'pumpio', 'mirror', false);
|
||||
|
||||
$submit = ['pumpio-submit' => DI::l10n()->t('Save Settings')];
|
||||
if ($oauth_token && $oauth_token_secret) {
|
||||
|
@ -279,19 +280,19 @@ function pumpio_settings(App $a, array &$data)
|
|||
function pumpio_settings_post(App $a, array &$b)
|
||||
{
|
||||
if (!empty($_POST['pumpio_delete'])) {
|
||||
DI::pConfig()->set(local_user(), 'pumpio', 'consumer_key' , '');
|
||||
DI::pConfig()->set(local_user(), 'pumpio', 'consumer_secret' , '');
|
||||
DI::pConfig()->set(local_user(), 'pumpio', 'oauth_token' , '');
|
||||
DI::pConfig()->set(local_user(), 'pumpio', 'oauth_token_secret', '');
|
||||
DI::pConfig()->set(local_user(), 'pumpio', 'post' , false);
|
||||
DI::pConfig()->set(local_user(), 'pumpio', 'import' , false);
|
||||
DI::pConfig()->set(local_user(), 'pumpio', 'host' , '');
|
||||
DI::pConfig()->set(local_user(), 'pumpio', 'user' , '');
|
||||
DI::pConfig()->set(local_user(), 'pumpio', 'public' , false);
|
||||
DI::pConfig()->set(local_user(), 'pumpio', 'mirror' , false);
|
||||
DI::pConfig()->set(local_user(), 'pumpio', 'post_by_default' , false);
|
||||
DI::pConfig()->set(local_user(), 'pumpio', 'lastdate' , 0);
|
||||
DI::pConfig()->set(local_user(), 'pumpio', 'last_id' , '');
|
||||
DI::pConfig()->set(Session::getLocalUser(), 'pumpio', 'consumer_key' , '');
|
||||
DI::pConfig()->set(Session::getLocalUser(), 'pumpio', 'consumer_secret' , '');
|
||||
DI::pConfig()->set(Session::getLocalUser(), 'pumpio', 'oauth_token' , '');
|
||||
DI::pConfig()->set(Session::getLocalUser(), 'pumpio', 'oauth_token_secret', '');
|
||||
DI::pConfig()->set(Session::getLocalUser(), 'pumpio', 'post' , false);
|
||||
DI::pConfig()->set(Session::getLocalUser(), 'pumpio', 'import' , false);
|
||||
DI::pConfig()->set(Session::getLocalUser(), 'pumpio', 'host' , '');
|
||||
DI::pConfig()->set(Session::getLocalUser(), 'pumpio', 'user' , '');
|
||||
DI::pConfig()->set(Session::getLocalUser(), 'pumpio', 'public' , false);
|
||||
DI::pConfig()->set(Session::getLocalUser(), 'pumpio', 'mirror' , false);
|
||||
DI::pConfig()->set(Session::getLocalUser(), 'pumpio', 'post_by_default' , false);
|
||||
DI::pConfig()->set(Session::getLocalUser(), 'pumpio', 'lastdate' , 0);
|
||||
DI::pConfig()->set(Session::getLocalUser(), 'pumpio', 'last_id' , '');
|
||||
} elseif (!empty($_POST['pumpio-submit'])) {
|
||||
// filtering the username if it is filled wrong
|
||||
$user = $_POST['pumpio_user'];
|
||||
|
@ -308,16 +309,16 @@ function pumpio_settings_post(App $a, array &$b)
|
|||
$host = trim($host);
|
||||
$host = str_replace(['https://', 'http://'], ['', ''], $host);
|
||||
|
||||
DI::pConfig()->set(local_user(), 'pumpio', 'post' , $_POST['pumpio'] ?? false);
|
||||
DI::pConfig()->set(local_user(), 'pumpio', 'import' , $_POST['pumpio_import'] ?? false);
|
||||
DI::pConfig()->set(local_user(), 'pumpio', 'host' , $host);
|
||||
DI::pConfig()->set(local_user(), 'pumpio', 'user' , $user);
|
||||
DI::pConfig()->set(local_user(), 'pumpio', 'public' , $_POST['pumpio_public'] ?? false);
|
||||
DI::pConfig()->set(local_user(), 'pumpio', 'mirror' , $_POST['pumpio_mirror'] ?? false);
|
||||
DI::pConfig()->set(local_user(), 'pumpio', 'post_by_default', $_POST['pumpio_bydefault'] ?? false);
|
||||
DI::pConfig()->set(Session::getLocalUser(), 'pumpio', 'post' , $_POST['pumpio'] ?? false);
|
||||
DI::pConfig()->set(Session::getLocalUser(), 'pumpio', 'import' , $_POST['pumpio_import'] ?? false);
|
||||
DI::pConfig()->set(Session::getLocalUser(), 'pumpio', 'host' , $host);
|
||||
DI::pConfig()->set(Session::getLocalUser(), 'pumpio', 'user' , $user);
|
||||
DI::pConfig()->set(Session::getLocalUser(), 'pumpio', 'public' , $_POST['pumpio_public'] ?? false);
|
||||
DI::pConfig()->set(Session::getLocalUser(), 'pumpio', 'mirror' , $_POST['pumpio_mirror'] ?? false);
|
||||
DI::pConfig()->set(Session::getLocalUser(), 'pumpio', 'post_by_default', $_POST['pumpio_bydefault'] ?? false);
|
||||
|
||||
if (!empty($_POST['pumpio_mirror'])) {
|
||||
DI::pConfig()->delete(local_user(), 'pumpio', 'lastdate');
|
||||
DI::pConfig()->delete(Session::getLocalUser(), 'pumpio', 'lastdate');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -365,15 +366,15 @@ function pumpio_hook_fork(App $a, array &$b)
|
|||
|
||||
function pumpio_post_local(App $a, array &$b)
|
||||
{
|
||||
if (!local_user() || (local_user() != $b['uid'])) {
|
||||
if (!Session::getLocalUser() || (Session::getLocalUser() != $b['uid'])) {
|
||||
return;
|
||||
}
|
||||
|
||||
$pumpio_post = intval(DI::pConfig()->get(local_user(), 'pumpio', 'post'));
|
||||
$pumpio_post = intval(DI::pConfig()->get(Session::getLocalUser(), 'pumpio', 'post'));
|
||||
|
||||
$pumpio_enable = (($pumpio_post && !empty($_REQUEST['pumpio_enable'])) ? intval($_REQUEST['pumpio_enable']) : 0);
|
||||
|
||||
if ($b['api_source'] && intval(DI::pConfig()->get(local_user(), 'pumpio', 'post_by_default'))) {
|
||||
if ($b['api_source'] && intval(DI::pConfig()->get(Session::getLocalUser(), 'pumpio', 'post_by_default'))) {
|
||||
$pumpio_enable = 1;
|
||||
}
|
||||
|
||||
|
@ -1124,7 +1125,6 @@ function pumpio_dopost(App $a, $client, int $uid, array $self, $post, string $ow
|
|||
$reply->generator->displayName = 'pumpio';
|
||||
$reply->published = $post->object->inReplyTo->published;
|
||||
$reply->received = $post->object->inReplyTo->updated;
|
||||
$reply->url = $post->object->inReplyTo->url;
|
||||
pumpio_dopost($a, $client, $uid, $self, $reply, $own_id, false);
|
||||
|
||||
$postarray['thr-parent'] = $post->object->inReplyTo->id;
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
use Friendica\App;
|
||||
use Friendica\Core\Hook;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\Core\Session;
|
||||
use Friendica\DI;
|
||||
use Friendica\Util\XML;
|
||||
|
||||
|
@ -38,11 +39,11 @@ function qcomment_footer(App $a, string &$body)
|
|||
|
||||
function qcomment_addon_settings(App &$a, array &$data)
|
||||
{
|
||||
if (!local_user()) {
|
||||
if (!Session::getLocalUser()) {
|
||||
return;
|
||||
}
|
||||
|
||||
$words = DI::pConfig()->get(local_user(), 'qcomment', 'words', DI::l10n()->t(':-)') . "\n" . DI::l10n()->t(':-(') . "\n" . DI::l10n()->t('lol'));
|
||||
$words = DI::pConfig()->get(Session::getLocalUser(), 'qcomment', 'words', DI::l10n()->t(':-)') . "\n" . DI::l10n()->t(':-(') . "\n" . DI::l10n()->t('lol'));
|
||||
|
||||
$t = Renderer::getMarkupTemplate('settings.tpl', 'addon/qcomment/');
|
||||
$html = Renderer::replaceMacros($t, [
|
||||
|
@ -59,11 +60,11 @@ function qcomment_addon_settings(App &$a, array &$data)
|
|||
|
||||
function qcomment_addon_settings_post(App $a, array &$b)
|
||||
{
|
||||
if (!local_user()) {
|
||||
if (!Session::getLocalUser()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (isset($_POST['qcomment-words'])) {
|
||||
DI::pConfig()->set(local_user(), 'qcomment', 'words', XML::escape($_POST['qcomment-words']));
|
||||
DI::pConfig()->set(Session::getLocalUser(), 'qcomment', 'words', XML::escape($_POST['qcomment-words']));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,6 +23,7 @@ use Friendica\App;
|
|||
use Friendica\Core\Hook;
|
||||
use Friendica\Core\Logger;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\Core\Session;
|
||||
use Friendica\DI;
|
||||
|
||||
function randplace_install()
|
||||
|
@ -64,12 +65,12 @@ function randplace_post_hook(App $a, &$item)
|
|||
*/
|
||||
Logger::notice('randplace invoked');
|
||||
|
||||
if (!local_user()) {
|
||||
if (!Session::getLocalUser()) {
|
||||
/* non-zero if this is a logged in user of this system */
|
||||
return;
|
||||
}
|
||||
|
||||
if (local_user() != $item['uid']) {
|
||||
if (Session::getLocalUser() != $item['uid']) {
|
||||
/* Does this person own the post? */
|
||||
return;
|
||||
}
|
||||
|
@ -81,7 +82,7 @@ function randplace_post_hook(App $a, &$item)
|
|||
|
||||
/* Retrieve our personal config setting */
|
||||
|
||||
$active = DI::pConfig()->get(local_user(), 'randplace', 'enable');
|
||||
$active = DI::pConfig()->get(Session::getLocalUser(), 'randplace', 'enable');
|
||||
|
||||
if (!$active) {
|
||||
return;
|
||||
|
@ -122,12 +123,12 @@ function randplace_post_hook(App $a, &$item)
|
|||
*/
|
||||
function randplace_settings_post(App $a, $post)
|
||||
{
|
||||
if (!local_user()) {
|
||||
if (!Session::getLocalUser()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ($_POST['randplace-submit']) {
|
||||
DI::pConfig()->set(local_user(), 'randplace', 'enable', intval($_POST['randplace']));
|
||||
DI::pConfig()->set(Session::getLocalUser(), 'randplace', 'enable', intval($_POST['randplace']));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -138,11 +139,11 @@ function randplace_settings_post(App $a, $post)
|
|||
*/
|
||||
function randplace_settings(App &$a, array &$data)
|
||||
{
|
||||
if(!local_user()) {
|
||||
if(!Session::getLocalUser()) {
|
||||
return;
|
||||
}
|
||||
|
||||
$enabled = DI::pConfig()->get(local_user(),'randplace','enable');
|
||||
$enabled = DI::pConfig()->get(Session::getLocalUser(),'randplace','enable');
|
||||
|
||||
$t = Renderer::getMarkupTemplate('settings.tpl', 'addon/randplace/');
|
||||
$html = Renderer::replaceMacros($t, [
|
||||
|
|
|
@ -25,6 +25,7 @@ use Friendica\App;
|
|||
use Friendica\App\BaseURL;
|
||||
use Friendica\Core\Config\Capability\IManageConfigValues;
|
||||
use Friendica\Core\PConfig\Capability\IManagePersonalConfigValues;
|
||||
use Friendica\Core\Session;
|
||||
use Friendica\Model\User;
|
||||
use Friendica\Object\Email;
|
||||
|
||||
|
@ -47,16 +48,16 @@ class SecureTestEmail extends Email
|
|||
$sender_email = 'noreply@' . $hostname;
|
||||
}
|
||||
|
||||
$user = User::getById(local_user());
|
||||
$user = User::getById(Session::getLocalUser());
|
||||
|
||||
$subject = 'Friendica - Secure Mail - Test';
|
||||
$message = 'This is a test message from your Friendica Secure Mail addon.';
|
||||
|
||||
// enable addon for test
|
||||
$pConfig->set(local_user(), 'securemail', 'enable', 1);
|
||||
$pConfig->set(Session::getLocalUser(), 'securemail', 'enable', 1);
|
||||
|
||||
parent::__construct($sitename, $sender_email, $sender_email, $user['email'],
|
||||
$subject, "<p>{$message}</p>", $message,
|
||||
[], local_user());
|
||||
[], Session::getLocalUser());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,6 +11,7 @@ use Friendica\App;
|
|||
use Friendica\Core\Hook;
|
||||
use Friendica\Core\Logger;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\Core\Session;
|
||||
use Friendica\DI;
|
||||
use Friendica\Object\EMail\IEmail;
|
||||
|
||||
|
@ -38,12 +39,12 @@ function securemail_install()
|
|||
*/
|
||||
function securemail_settings(App &$a, array &$data)
|
||||
{
|
||||
if (!local_user()) {
|
||||
if (!Session::getLocalUser()) {
|
||||
return;
|
||||
}
|
||||
|
||||
$enabled = intval(DI::pConfig()->get(local_user(), 'securemail', 'enable'));
|
||||
$publickey = DI::pConfig()->get(local_user(), 'securemail', 'pkey');
|
||||
$enabled = intval(DI::pConfig()->get(Session::getLocalUser(), 'securemail', 'enable'));
|
||||
$publickey = DI::pConfig()->get(Session::getLocalUser(), 'securemail', 'pkey');
|
||||
|
||||
$t = Renderer::getMarkupTemplate('settings.tpl', 'addon/securemail/');
|
||||
$html = Renderer::replaceMacros($t, [
|
||||
|
@ -74,20 +75,20 @@ function securemail_settings(App &$a, array &$data)
|
|||
*/
|
||||
function securemail_settings_post(App &$a, array &$b)
|
||||
{
|
||||
if (!local_user()) {
|
||||
if (!Session::getLocalUser()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!empty($_POST['securemail-submit']) || !empty($_POST['securemail-test'])) {
|
||||
DI::pConfig()->set(local_user(), 'securemail', 'pkey', trim($_POST['securemail-pkey']));
|
||||
DI::pConfig()->set(Session::getLocalUser(), 'securemail', 'pkey', trim($_POST['securemail-pkey']));
|
||||
$enable = (!empty($_POST['securemail-enable']) ? 1 : 0);
|
||||
DI::pConfig()->set(local_user(), 'securemail', 'enable', $enable);
|
||||
DI::pConfig()->set(Session::getLocalUser(), 'securemail', 'enable', $enable);
|
||||
|
||||
if (!empty($_POST['securemail-test'])) {
|
||||
$res = DI::emailer()->send(new SecureTestEmail(DI::app(), DI::config(), DI::pConfig(), DI::baseUrl()));
|
||||
|
||||
// revert to saved value
|
||||
DI::pConfig()->set(local_user(), 'securemail', 'enable', $enable);
|
||||
DI::pConfig()->set(Session::getLocalUser(), 'securemail', 'enable', $enable);
|
||||
|
||||
if ($res) {
|
||||
DI::sysmsg()->addInfo(DI::l10n()->t('Test email sent'));
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
use Friendica\App;
|
||||
use Friendica\Core\Hook;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\Core\Session;
|
||||
use Friendica\DI;
|
||||
use Friendica\Util\Strings;
|
||||
|
||||
|
@ -23,14 +24,14 @@ function showmore_install()
|
|||
|
||||
function showmore_addon_settings(App &$a, array &$data)
|
||||
{
|
||||
if (!local_user()) {
|
||||
if (!Session::getLocalUser()) {
|
||||
return;
|
||||
}
|
||||
|
||||
DI::page()->registerStylesheet(__DIR__ . '/showmore.css', 'all');
|
||||
|
||||
$enabled = !DI::pConfig()->get(local_user(), 'showmore', 'disable');
|
||||
$chars = DI::pConfig()->get(local_user(), 'showmore', 'chars', 1100);
|
||||
$enabled = !DI::pConfig()->get(Session::getLocalUser(), 'showmore', 'disable');
|
||||
$chars = DI::pConfig()->get(Session::getLocalUser(), 'showmore', 'chars', 1100);
|
||||
|
||||
$t = Renderer::getMarkupTemplate('settings.tpl', 'addon/showmore/');
|
||||
$html = Renderer::replaceMacros($t, [
|
||||
|
@ -47,15 +48,15 @@ function showmore_addon_settings(App &$a, array &$data)
|
|||
|
||||
function showmore_addon_settings_post(App $a, array &$b)
|
||||
{
|
||||
if (!local_user()) {
|
||||
if (!Session::getLocalUser()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!empty($_POST['showmore-submit'])) {
|
||||
DI::pConfig()->set(local_user(), 'showmore', 'chars', trim($_POST['showmore-chars']));
|
||||
DI::pConfig()->set(Session::getLocalUser(), 'showmore', 'chars', trim($_POST['showmore-chars']));
|
||||
$enable = (!empty($_POST['showmore-enable']) ? intval($_POST['showmore-enable']) : 0);
|
||||
$disable = 1-$enable;
|
||||
DI::pConfig()->set(local_user(), 'showmore', 'disable', $disable);
|
||||
DI::pConfig()->set(Session::getLocalUser(), 'showmore', 'disable', $disable);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -100,11 +101,11 @@ function showmore_prepare_body(App $a, &$hook_data)
|
|||
return;
|
||||
}
|
||||
|
||||
if (DI::pConfig()->get(local_user(), 'showmore', 'disable')) {
|
||||
if (DI::pConfig()->get(Session::getLocalUser(), 'showmore', 'disable')) {
|
||||
return;
|
||||
}
|
||||
|
||||
$chars = (int) DI::pConfig()->get(local_user(), 'showmore', 'chars', 1100);
|
||||
$chars = (int) DI::pConfig()->get(Session::getLocalUser(), 'showmore', 'chars', 1100);
|
||||
|
||||
if (get_body_length($hook_data['html']) > $chars) {
|
||||
$found = true;
|
||||
|
|
|
@ -12,6 +12,7 @@ use Friendica\Core\Hook;
|
|||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\Logger;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\Core\Session;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\DI;
|
||||
|
||||
|
@ -36,23 +37,23 @@ function showmore_dyn_footer(App $a, string &$body)
|
|||
|
||||
function showmore_dyn_settings_post()
|
||||
{
|
||||
if(!local_user()) {
|
||||
if(!Session::getLocalUser()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (isset($_POST['showmore_dyn-submit'])) {
|
||||
DI::pConfig()->set(local_user(), 'showmore_dyn', 'limitHeight', $_POST['limitHeight'] ?? 0);
|
||||
DI::pConfig()->set(Session::getLocalUser(), 'showmore_dyn', 'limitHeight', $_POST['limitHeight'] ?? 0);
|
||||
}
|
||||
}
|
||||
|
||||
function showmore_dyn_settings(App &$a, array &$data)
|
||||
{
|
||||
if(!local_user()) {
|
||||
if(!Session::getLocalUser()) {
|
||||
return;
|
||||
}
|
||||
|
||||
$limitHeight = DI::pConfig()->get(local_user(), 'showmore_dyn', 'limitHeight', 250);
|
||||
DI::pConfig()->set(local_user(), 'showmore_dyn', 'limitHeight', $limitHeight);
|
||||
$limitHeight = DI::pConfig()->get(Session::getLocalUser(), 'showmore_dyn', 'limitHeight', 250);
|
||||
DI::pConfig()->set(Session::getLocalUser(), 'showmore_dyn', 'limitHeight', $limitHeight);
|
||||
|
||||
$t = Renderer::getMarkupTemplate('settings.tpl', 'addon/showmore_dyn/');
|
||||
$html = Renderer::replaceMacros($t, [
|
||||
|
@ -68,7 +69,7 @@ function showmore_dyn_settings(App &$a, array &$data)
|
|||
|
||||
function showmore_dyn_script()
|
||||
{
|
||||
$limitHeight = intval(DI::pConfig()->get(local_user(), 'showmore_dyn', 'limitHeight', 250));
|
||||
$limitHeight = intval(DI::pConfig()->get(Session::getLocalUser(), 'showmore_dyn', 'limitHeight', 250));
|
||||
$showmore_dyn_showmore_linktext = DI::l10n()->t('Show more...');
|
||||
DI::page()['htmlhead'] .= <<<EOT
|
||||
<script>
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
use Friendica\App;
|
||||
use Friendica\Core\Hook;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\Core\Session;
|
||||
use Friendica\DI;
|
||||
|
||||
function startpage_install() {
|
||||
|
@ -20,11 +21,11 @@ function startpage_install() {
|
|||
|
||||
function startpage_home_init(App $a, $b)
|
||||
{
|
||||
if (!local_user()) {
|
||||
if (!Session::getLocalUser()) {
|
||||
return;
|
||||
}
|
||||
|
||||
$page = DI::pConfig()->get(local_user(), 'startpage', 'startpage');
|
||||
$page = DI::pConfig()->get(Session::getLocalUser(), 'startpage', 'startpage');
|
||||
if (strlen($page)) {
|
||||
DI::baseUrl()->redirect($page);
|
||||
}
|
||||
|
@ -42,12 +43,12 @@ function startpage_home_init(App $a, $b)
|
|||
|
||||
function startpage_settings_post(App $a, $post)
|
||||
{
|
||||
if (!local_user()) {
|
||||
if (!Session::getLocalUser()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!empty($_POST['startpage-submit'])) {
|
||||
DI::pConfig()->set(local_user(), 'startpage', 'startpage', strip_tags(trim($_POST['startpage'])));
|
||||
DI::pConfig()->set(Session::getLocalUser(), 'startpage', 'startpage', strip_tags(trim($_POST['startpage'])));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -59,11 +60,11 @@ function startpage_settings_post(App $a, $post)
|
|||
*/
|
||||
function startpage_settings(App &$a, array &$data)
|
||||
{
|
||||
if (!local_user()) {
|
||||
if (!Session::getLocalUser()) {
|
||||
return;
|
||||
}
|
||||
|
||||
$startpage = DI::pConfig()->get(local_user(), 'startpage', 'startpage');
|
||||
$startpage = DI::pConfig()->get(Session::getLocalUser(), 'startpage', 'startpage');
|
||||
|
||||
$t = Renderer::getMarkupTemplate('settings.tpl', 'addon/startpage/');
|
||||
$html = Renderer::replaceMacros($t, [
|
||||
|
|
|
@ -47,6 +47,7 @@ use Friendica\Core\Hook;
|
|||
use Friendica\Core\Logger;
|
||||
use Friendica\Core\Protocol;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\Core\Session;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\DI;
|
||||
|
@ -86,17 +87,17 @@ function statusnet_check_item_notification(App $a, &$notification_data)
|
|||
|
||||
function statusnet_jot_nets(App $a, array &$jotnets_fields)
|
||||
{
|
||||
if (!local_user()) {
|
||||
if (!Session::getLocalUser()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (DI::pConfig()->get(local_user(), 'statusnet', 'post')) {
|
||||
if (DI::pConfig()->get(Session::getLocalUser(), 'statusnet', 'post')) {
|
||||
$jotnets_fields[] = [
|
||||
'type' => 'checkbox',
|
||||
'field' => [
|
||||
'statusnet_enable',
|
||||
DI::l10n()->t('Post to GNU Social'),
|
||||
DI::pConfig()->get(local_user(), 'statusnet', 'post_by_default')
|
||||
DI::pConfig()->get(Session::getLocalUser(), 'statusnet', 'post_by_default')
|
||||
]
|
||||
];
|
||||
}
|
||||
|
@ -104,7 +105,7 @@ function statusnet_jot_nets(App $a, array &$jotnets_fields)
|
|||
|
||||
function statusnet_settings_post(App $a, $post)
|
||||
{
|
||||
if (!local_user()) {
|
||||
if (!Session::getLocalUser()) {
|
||||
return;
|
||||
}
|
||||
// don't check GNU Social settings if GNU Social submit button is not clicked
|
||||
|
@ -116,18 +117,18 @@ function statusnet_settings_post(App $a, $post)
|
|||
/* * *
|
||||
* if the GNU Social-disconnect button is clicked, clear the GNU Social configuration
|
||||
*/
|
||||
DI::pConfig()->delete(local_user(), 'statusnet', 'consumerkey');
|
||||
DI::pConfig()->delete(local_user(), 'statusnet', 'consumersecret');
|
||||
DI::pConfig()->delete(local_user(), 'statusnet', 'post');
|
||||
DI::pConfig()->delete(local_user(), 'statusnet', 'post_by_default');
|
||||
DI::pConfig()->delete(local_user(), 'statusnet', 'oauthtoken');
|
||||
DI::pConfig()->delete(local_user(), 'statusnet', 'oauthsecret');
|
||||
DI::pConfig()->delete(local_user(), 'statusnet', 'baseapi');
|
||||
DI::pConfig()->delete(local_user(), 'statusnet', 'lastid');
|
||||
DI::pConfig()->delete(local_user(), 'statusnet', 'mirror_posts');
|
||||
DI::pConfig()->delete(local_user(), 'statusnet', 'import');
|
||||
DI::pConfig()->delete(local_user(), 'statusnet', 'create_user');
|
||||
DI::pConfig()->delete(local_user(), 'statusnet', 'own_url');
|
||||
DI::pConfig()->delete(Session::getLocalUser(), 'statusnet', 'consumerkey');
|
||||
DI::pConfig()->delete(Session::getLocalUser(), 'statusnet', 'consumersecret');
|
||||
DI::pConfig()->delete(Session::getLocalUser(), 'statusnet', 'post');
|
||||
DI::pConfig()->delete(Session::getLocalUser(), 'statusnet', 'post_by_default');
|
||||
DI::pConfig()->delete(Session::getLocalUser(), 'statusnet', 'oauthtoken');
|
||||
DI::pConfig()->delete(Session::getLocalUser(), 'statusnet', 'oauthsecret');
|
||||
DI::pConfig()->delete(Session::getLocalUser(), 'statusnet', 'baseapi');
|
||||
DI::pConfig()->delete(Session::getLocalUser(), 'statusnet', 'lastid');
|
||||
DI::pConfig()->delete(Session::getLocalUser(), 'statusnet', 'mirror_posts');
|
||||
DI::pConfig()->delete(Session::getLocalUser(), 'statusnet', 'import');
|
||||
DI::pConfig()->delete(Session::getLocalUser(), 'statusnet', 'create_user');
|
||||
DI::pConfig()->delete(Session::getLocalUser(), 'statusnet', 'own_url');
|
||||
} else {
|
||||
if (isset($_POST['statusnet-preconf-apiurl'])) {
|
||||
/* * *
|
||||
|
@ -141,10 +142,10 @@ function statusnet_settings_post(App $a, $post)
|
|||
$apibase = $asn['apiurl'];
|
||||
$c = DI::httpClient()->fetch($apibase . 'statusnet/version.xml');
|
||||
if (strlen($c) > 0) {
|
||||
DI::pConfig()->set(local_user(), 'statusnet', 'consumerkey', $asn['consumerkey']);
|
||||
DI::pConfig()->set(local_user(), 'statusnet', 'consumersecret', $asn['consumersecret']);
|
||||
DI::pConfig()->set(local_user(), 'statusnet', 'baseapi', $asn['apiurl']);
|
||||
//DI::pConfig()->set(local_user(), 'statusnet', 'application_name', $asn['applicationname'] );
|
||||
DI::pConfig()->set(Session::getLocalUser(), 'statusnet', 'consumerkey', $asn['consumerkey']);
|
||||
DI::pConfig()->set(Session::getLocalUser(), 'statusnet', 'consumersecret', $asn['consumersecret']);
|
||||
DI::pConfig()->set(Session::getLocalUser(), 'statusnet', 'baseapi', $asn['apiurl']);
|
||||
//DI::pConfig()->set(Session::getLocalUser(), 'statusnet', 'application_name', $asn['applicationname'] );
|
||||
} else {
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('Please contact your site administrator.<br />The provided API URL is not valid.') . '<br />' . $asn['apiurl']);
|
||||
}
|
||||
|
@ -159,19 +160,19 @@ function statusnet_settings_post(App $a, $post)
|
|||
$c = DI::httpClient()->fetch($apibase . 'statusnet/version.xml');
|
||||
if (strlen($c) > 0) {
|
||||
// ok the API path is correct, let's save the settings
|
||||
DI::pConfig()->set(local_user(), 'statusnet', 'consumerkey', $_POST['statusnet-consumerkey']);
|
||||
DI::pConfig()->set(local_user(), 'statusnet', 'consumersecret', $_POST['statusnet-consumersecret']);
|
||||
DI::pConfig()->set(local_user(), 'statusnet', 'baseapi', $apibase);
|
||||
//DI::pConfig()->set(local_user(), 'statusnet', 'application_name', $_POST['statusnet-applicationname'] );
|
||||
DI::pConfig()->set(Session::getLocalUser(), 'statusnet', 'consumerkey', $_POST['statusnet-consumerkey']);
|
||||
DI::pConfig()->set(Session::getLocalUser(), 'statusnet', 'consumersecret', $_POST['statusnet-consumersecret']);
|
||||
DI::pConfig()->set(Session::getLocalUser(), 'statusnet', 'baseapi', $apibase);
|
||||
//DI::pConfig()->set(Session::getLocalUser(), 'statusnet', 'application_name', $_POST['statusnet-applicationname'] );
|
||||
} else {
|
||||
// the API path is not correct, maybe missing trailing / ?
|
||||
$apibase = $apibase . '/';
|
||||
$c = DI::httpClient()->fetch($apibase . 'statusnet/version.xml');
|
||||
if (strlen($c) > 0) {
|
||||
// ok the API path is now correct, let's save the settings
|
||||
DI::pConfig()->set(local_user(), 'statusnet', 'consumerkey', $_POST['statusnet-consumerkey']);
|
||||
DI::pConfig()->set(local_user(), 'statusnet', 'consumersecret', $_POST['statusnet-consumersecret']);
|
||||
DI::pConfig()->set(local_user(), 'statusnet', 'baseapi', $apibase);
|
||||
DI::pConfig()->set(Session::getLocalUser(), 'statusnet', 'consumerkey', $_POST['statusnet-consumerkey']);
|
||||
DI::pConfig()->set(Session::getLocalUser(), 'statusnet', 'consumersecret', $_POST['statusnet-consumersecret']);
|
||||
DI::pConfig()->set(Session::getLocalUser(), 'statusnet', 'baseapi', $apibase);
|
||||
} else {
|
||||
// still not the correct API base, let's do noting
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('We could not contact the GNU Social API with the Path you entered.'));
|
||||
|
@ -180,31 +181,31 @@ function statusnet_settings_post(App $a, $post)
|
|||
} else {
|
||||
if (isset($_POST['statusnet-pin'])) {
|
||||
// if the user supplied us with a PIN from GNU Social, let the magic of OAuth happen
|
||||
$api = DI::pConfig()->get(local_user(), 'statusnet', 'baseapi');
|
||||
$ckey = DI::pConfig()->get(local_user(), 'statusnet', 'consumerkey');
|
||||
$csecret = DI::pConfig()->get(local_user(), 'statusnet', 'consumersecret');
|
||||
$api = DI::pConfig()->get(Session::getLocalUser(), 'statusnet', 'baseapi');
|
||||
$ckey = DI::pConfig()->get(Session::getLocalUser(), 'statusnet', 'consumerkey');
|
||||
$csecret = DI::pConfig()->get(Session::getLocalUser(), 'statusnet', 'consumersecret');
|
||||
// the token and secret for which the PIN was generated were hidden in the settings
|
||||
// form as token and token2, we need a new connection to GNU Social using these token
|
||||
// and secret to request a Access Token with the PIN
|
||||
$connection = new StatusNetOAuth($api, $ckey, $csecret, $_POST['statusnet-token'], $_POST['statusnet-token2']);
|
||||
$token = $connection->getAccessToken($_POST['statusnet-pin']);
|
||||
// ok, now that we have the Access Token, save them in the user config
|
||||
DI::pConfig()->set(local_user(), 'statusnet', 'oauthtoken', $token['oauth_token']);
|
||||
DI::pConfig()->set(local_user(), 'statusnet', 'oauthsecret', $token['oauth_token_secret']);
|
||||
DI::pConfig()->set(local_user(), 'statusnet', 'post', 1);
|
||||
DI::pConfig()->set(local_user(), 'statusnet', 'post_taglinks', 1);
|
||||
DI::pConfig()->set(Session::getLocalUser(), 'statusnet', 'oauthtoken', $token['oauth_token']);
|
||||
DI::pConfig()->set(Session::getLocalUser(), 'statusnet', 'oauthsecret', $token['oauth_token_secret']);
|
||||
DI::pConfig()->set(Session::getLocalUser(), 'statusnet', 'post', 1);
|
||||
DI::pConfig()->set(Session::getLocalUser(), 'statusnet', 'post_taglinks', 1);
|
||||
// reload the Addon Settings page, if we don't do it see Bug #42
|
||||
} else {
|
||||
// if no PIN is supplied in the POST variables, the user has changed the setting
|
||||
// to post a dent for every new __public__ posting to the wall
|
||||
DI::pConfig()->set(local_user(), 'statusnet', 'post', intval($_POST['statusnet-enable']));
|
||||
DI::pConfig()->set(local_user(), 'statusnet', 'post_by_default', intval($_POST['statusnet-default']));
|
||||
DI::pConfig()->set(local_user(), 'statusnet', 'mirror_posts', intval($_POST['statusnet-mirror']));
|
||||
DI::pConfig()->set(local_user(), 'statusnet', 'import', intval($_POST['statusnet-import']));
|
||||
DI::pConfig()->set(local_user(), 'statusnet', 'create_user', intval($_POST['statusnet-create_user']));
|
||||
DI::pConfig()->set(Session::getLocalUser(), 'statusnet', 'post', intval($_POST['statusnet-enable']));
|
||||
DI::pConfig()->set(Session::getLocalUser(), 'statusnet', 'post_by_default', intval($_POST['statusnet-default']));
|
||||
DI::pConfig()->set(Session::getLocalUser(), 'statusnet', 'mirror_posts', intval($_POST['statusnet-mirror']));
|
||||
DI::pConfig()->set(Session::getLocalUser(), 'statusnet', 'import', intval($_POST['statusnet-import']));
|
||||
DI::pConfig()->set(Session::getLocalUser(), 'statusnet', 'create_user', intval($_POST['statusnet-create_user']));
|
||||
|
||||
if (!intval($_POST['statusnet-mirror']))
|
||||
DI::pConfig()->delete(local_user(), 'statusnet', 'lastid');
|
||||
DI::pConfig()->delete(Session::getLocalUser(), 'statusnet', 'lastid');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -213,7 +214,7 @@ function statusnet_settings_post(App $a, $post)
|
|||
|
||||
function statusnet_settings(App $a, array &$data)
|
||||
{
|
||||
if (!local_user()) {
|
||||
if (!Session::getLocalUser()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -225,16 +226,16 @@ function statusnet_settings(App $a, array &$data)
|
|||
* allow the user to cancel the connection process at this step
|
||||
* 3) Checkbox for "Send public notices (respect size limitation)
|
||||
*/
|
||||
$baseapi = DI::pConfig()->get(local_user(), 'statusnet', 'baseapi');
|
||||
$ckey = DI::pConfig()->get(local_user(), 'statusnet', 'consumerkey');
|
||||
$csecret = DI::pConfig()->get(local_user(), 'statusnet', 'consumersecret');
|
||||
$otoken = DI::pConfig()->get(local_user(), 'statusnet', 'oauthtoken');
|
||||
$osecret = DI::pConfig()->get(local_user(), 'statusnet', 'oauthsecret');
|
||||
$enabled = DI::pConfig()->get(local_user(), 'statusnet', 'post', false);
|
||||
$def_enabled = DI::pConfig()->get(local_user(), 'statusnet', 'post_by_default', false);
|
||||
$mirror_enabled = DI::pConfig()->get(local_user(), 'statusnet', 'mirror_posts', false);
|
||||
$createuser_enabled = DI::pConfig()->get(local_user(), 'statusnet', 'create_user', false);
|
||||
$import = DI::pConfig()->get(local_user(), 'statusnet', 'import');
|
||||
$baseapi = DI::pConfig()->get(Session::getLocalUser(), 'statusnet', 'baseapi');
|
||||
$ckey = DI::pConfig()->get(Session::getLocalUser(), 'statusnet', 'consumerkey');
|
||||
$csecret = DI::pConfig()->get(Session::getLocalUser(), 'statusnet', 'consumersecret');
|
||||
$otoken = DI::pConfig()->get(Session::getLocalUser(), 'statusnet', 'oauthtoken');
|
||||
$osecret = DI::pConfig()->get(Session::getLocalUser(), 'statusnet', 'oauthsecret');
|
||||
$enabled = DI::pConfig()->get(Session::getLocalUser(), 'statusnet', 'post', false);
|
||||
$def_enabled = DI::pConfig()->get(Session::getLocalUser(), 'statusnet', 'post_by_default', false);
|
||||
$mirror_enabled = DI::pConfig()->get(Session::getLocalUser(), 'statusnet', 'mirror_posts', false);
|
||||
$createuser_enabled = DI::pConfig()->get(Session::getLocalUser(), 'statusnet', 'create_user', false);
|
||||
$import = DI::pConfig()->get(Session::getLocalUser(), 'statusnet', 'import');
|
||||
|
||||
// Radio button list to select existing application credentials
|
||||
$sites = array_map(function ($site) {
|
||||
|
@ -256,7 +257,7 @@ function statusnet_settings(App $a, array &$data)
|
|||
$connected_account = DI::l10n()->t('Currently connected to: <a href="%s" target="_statusnet">%s</a>', $account->statusnet_profile_url, $account->screen_name);
|
||||
}
|
||||
|
||||
$user = User::getById(local_user());
|
||||
$user = User::getById(Session::getLocalUser());
|
||||
if ($user['hidewall']) {
|
||||
$privacy_warning = DI::l10n()->t('<strong>Note</strong>: Due your privacy settings (<em>Hide your profile details from unknown viewers?</em>) the link potentially included in public postings relayed to GNU Social will lead the visitor to a blank page informing the visitor that the access to your profile has been restricted.');
|
||||
}
|
||||
|
@ -379,15 +380,15 @@ function statusnet_post_local(App $a, array &$b)
|
|||
return;
|
||||
}
|
||||
|
||||
if (!local_user() || (local_user() != $b['uid'])) {
|
||||
if (!Session::getLocalUser() || (Session::getLocalUser() != $b['uid'])) {
|
||||
return;
|
||||
}
|
||||
|
||||
$statusnet_post = DI::pConfig()->get(local_user(), 'statusnet', 'post');
|
||||
$statusnet_post = DI::pConfig()->get(Session::getLocalUser(), 'statusnet', 'post');
|
||||
$statusnet_enable = (($statusnet_post && !empty($_REQUEST['statusnet_enable'])) ? intval($_REQUEST['statusnet_enable']) : 0);
|
||||
|
||||
// if API is used, default to the chosen settings
|
||||
if ($b['api_source'] && intval(DI::pConfig()->get(local_user(), 'statusnet', 'post_by_default'))) {
|
||||
if ($b['api_source'] && intval(DI::pConfig()->get(Session::getLocalUser(), 'statusnet', 'post_by_default'))) {
|
||||
$statusnet_enable = 1;
|
||||
}
|
||||
|
||||
|
@ -668,7 +669,7 @@ function statusnet_prepare_body(App $a, array &$b)
|
|||
}
|
||||
|
||||
if ($b['preview']) {
|
||||
$max_char = DI::pConfig()->get(local_user(), 'statusnet', 'max_char');
|
||||
$max_char = DI::pConfig()->get(Session::getLocalUser(), 'statusnet', 'max_char');
|
||||
if (intval($max_char) == 0) {
|
||||
$max_char = 140;
|
||||
}
|
||||
|
@ -676,7 +677,7 @@ function statusnet_prepare_body(App $a, array &$b)
|
|||
$item = $b['item'];
|
||||
$item['plink'] = DI::baseUrl()->get() . '/display/' . $item['guid'];
|
||||
|
||||
$condition = ['uri' => $item['thr-parent'], 'uid' => local_user()];
|
||||
$condition = ['uri' => $item['thr-parent'], 'uid' => Session::getLocalUser()];
|
||||
$orig_post = Post::selectFirst(['author-link', 'uri'], $condition);
|
||||
if (DBA::isResult($orig_post)) {
|
||||
$nick = preg_replace("=https?://(.*)/(.*)=ism", "$2", $orig_post['author-link']);
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
use Friendica\App;
|
||||
use Friendica\Core\Hook;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\Core\Session;
|
||||
use Friendica\DI;
|
||||
use Friendica\Util\Strings;
|
||||
|
||||
|
@ -24,11 +25,11 @@ function superblock_install()
|
|||
|
||||
function superblock_addon_settings(App &$a, array &$data)
|
||||
{
|
||||
if (!local_user()) {
|
||||
if (!Session::getLocalUser()) {
|
||||
return;
|
||||
}
|
||||
|
||||
$blocked = DI::pConfig()->get(local_user(), 'system', 'blocked', '');
|
||||
$blocked = DI::pConfig()->get(Session::getLocalUser(), 'system', 'blocked', '');
|
||||
|
||||
$t = Renderer::getMarkupTemplate('settings.tpl', 'addon/superblock/');
|
||||
$html = Renderer::replaceMacros($t, [
|
||||
|
@ -44,12 +45,12 @@ function superblock_addon_settings(App &$a, array &$data)
|
|||
|
||||
function superblock_addon_settings_post(App $a, array &$b)
|
||||
{
|
||||
if (!local_user()) {
|
||||
if (!Session::getLocalUser()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!empty($_POST['superblock-submit'])) {
|
||||
DI::pConfig()->set(local_user(), 'system', 'blocked',trim($_POST['superblock-words']));
|
||||
DI::pConfig()->set(Session::getLocalUser(), 'system', 'blocked',trim($_POST['superblock-words']));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -89,11 +90,11 @@ function superblock_enotify_store(App $a, array &$b)
|
|||
|
||||
function superblock_conversation_start(App $a, array &$b)
|
||||
{
|
||||
if (!local_user()) {
|
||||
if (!Session::getLocalUser()) {
|
||||
return;
|
||||
}
|
||||
|
||||
$words = DI::pConfig()->get(local_user(), 'system', 'blocked');
|
||||
$words = DI::pConfig()->get(Session::getLocalUser(), 'system', 'blocked');
|
||||
if ($words) {
|
||||
$a->data['superblock'] = explode(',', $words);
|
||||
}
|
||||
|
@ -112,7 +113,7 @@ EOT;
|
|||
|
||||
function superblock_item_photo_menu(App $a, array &$b)
|
||||
{
|
||||
if (!local_user() || $b['item']['self']) {
|
||||
if (!Session::getLocalUser() || $b['item']['self']) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -139,11 +140,11 @@ function superblock_module() {}
|
|||
|
||||
function superblock_init(App $a)
|
||||
{
|
||||
if (!local_user()) {
|
||||
if (!Session::getLocalUser()) {
|
||||
return;
|
||||
}
|
||||
|
||||
$words = DI::pConfig()->get(local_user(), 'system', 'blocked');
|
||||
$words = DI::pConfig()->get(Session::getLocalUser(), 'system', 'blocked');
|
||||
|
||||
if (array_key_exists('block', $_GET) && $_GET['block']) {
|
||||
if (strlen($words))
|
||||
|
@ -151,6 +152,6 @@ function superblock_init(App $a)
|
|||
$words .= trim($_GET['block']);
|
||||
}
|
||||
|
||||
DI::pConfig()->set(local_user(), 'system', 'blocked', $words);
|
||||
DI::pConfig()->set(Session::getLocalUser(), 'system', 'blocked', $words);
|
||||
exit();
|
||||
}
|
||||
|
|
|
@ -14,6 +14,7 @@ use Friendica\Content\Text\BBCode;
|
|||
use Friendica\Core\Hook;
|
||||
use Friendica\Core\Logger;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\Core\Session;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\DI;
|
||||
use Friendica\Model\Post;
|
||||
|
@ -38,7 +39,7 @@ function tumblr_module() {}
|
|||
|
||||
function tumblr_content(App $a)
|
||||
{
|
||||
if (!local_user()) {
|
||||
if (!Session::getLocalUser()) {
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('Permission denied.'));
|
||||
return '';
|
||||
}
|
||||
|
@ -171,8 +172,8 @@ function tumblr_callback(App $a)
|
|||
}
|
||||
|
||||
// What's next? Now that we have an Access Token and Secret, we can make an API call.
|
||||
DI::pConfig()->set(local_user(), 'tumblr', 'oauth_token', $access_token['oauth_token']);
|
||||
DI::pConfig()->set(local_user(), 'tumblr', 'oauth_token_secret', $access_token['oauth_token_secret']);
|
||||
DI::pConfig()->set(Session::getLocalUser(), 'tumblr', 'oauth_token', $access_token['oauth_token']);
|
||||
DI::pConfig()->set(Session::getLocalUser(), 'tumblr', 'oauth_token_secret', $access_token['oauth_token_secret']);
|
||||
|
||||
$o = DI::l10n()->t("You are now authenticated to tumblr.");
|
||||
$o .= '<br /><a href="' . DI::baseUrl()->get() . '/settings/connectors">' . DI::l10n()->t("return to the connector page") . '</a>';
|
||||
|
@ -182,17 +183,17 @@ function tumblr_callback(App $a)
|
|||
|
||||
function tumblr_jot_nets(App $a, array &$jotnets_fields)
|
||||
{
|
||||
if (!local_user()) {
|
||||
if (!Session::getLocalUser()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (DI::pConfig()->get(local_user(),'tumblr','post')) {
|
||||
if (DI::pConfig()->get(Session::getLocalUser(),'tumblr','post')) {
|
||||
$jotnets_fields[] = [
|
||||
'type' => 'checkbox',
|
||||
'field' => [
|
||||
'tumblr_enable',
|
||||
DI::l10n()->t('Post to Tumblr'),
|
||||
DI::pConfig()->get(local_user(),'tumblr','post_by_default')
|
||||
DI::pConfig()->get(Session::getLocalUser(),'tumblr','post_by_default')
|
||||
]
|
||||
];
|
||||
}
|
||||
|
@ -200,18 +201,18 @@ function tumblr_jot_nets(App $a, array &$jotnets_fields)
|
|||
|
||||
function tumblr_settings(App $a, array &$data)
|
||||
{
|
||||
if (!local_user()) {
|
||||
if (!Session::getLocalUser()) {
|
||||
return;
|
||||
}
|
||||
|
||||
$enabled = DI::pConfig()->get(local_user(), 'tumblr', 'post', false);
|
||||
$def_enabled = DI::pConfig()->get(local_user(), 'tumblr', 'post_by_default', false);
|
||||
$enabled = DI::pConfig()->get(Session::getLocalUser(), 'tumblr', 'post', false);
|
||||
$def_enabled = DI::pConfig()->get(Session::getLocalUser(), 'tumblr', 'post_by_default', false);
|
||||
|
||||
$oauth_token = DI::pConfig()->get(local_user(), 'tumblr', 'oauth_token');
|
||||
$oauth_token_secret = DI::pConfig()->get(local_user(), 'tumblr', 'oauth_token_secret');
|
||||
$oauth_token = DI::pConfig()->get(Session::getLocalUser(), 'tumblr', 'oauth_token');
|
||||
$oauth_token_secret = DI::pConfig()->get(Session::getLocalUser(), 'tumblr', 'oauth_token_secret');
|
||||
|
||||
if ($oauth_token && $oauth_token_secret) {
|
||||
$page = DI::pConfig()->get(local_user(), 'tumblr', 'page');
|
||||
$page = DI::pConfig()->get(Session::getLocalUser(), 'tumblr', 'page');
|
||||
$consumer_key = DI::config()->get('tumblr', 'consumer_key');
|
||||
$consumer_secret = DI::config()->get('tumblr', 'consumer_secret');
|
||||
|
||||
|
@ -251,9 +252,9 @@ function tumblr_settings(App $a, array &$data)
|
|||
function tumblr_settings_post(App $a, array &$b)
|
||||
{
|
||||
if (!empty($_POST['tumblr-submit'])) {
|
||||
DI::pConfig()->set(local_user(), 'tumblr', 'post', intval($_POST['tumblr']));
|
||||
DI::pConfig()->set(local_user(), 'tumblr', 'page', $_POST['tumblr_page']);
|
||||
DI::pConfig()->set(local_user(), 'tumblr', 'post_by_default', intval($_POST['tumblr_bydefault']));
|
||||
DI::pConfig()->set(Session::getLocalUser(), 'tumblr', 'post', intval($_POST['tumblr']));
|
||||
DI::pConfig()->set(Session::getLocalUser(), 'tumblr', 'page', $_POST['tumblr_page']);
|
||||
DI::pConfig()->set(Session::getLocalUser(), 'tumblr', 'post_by_default', intval($_POST['tumblr_bydefault']));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -280,7 +281,7 @@ function tumblr_post_local(App $a, array &$b)
|
|||
return;
|
||||
}
|
||||
|
||||
if (!local_user() || (local_user() != $b['uid'])) {
|
||||
if (!Session::getLocalUser() || (Session::getLocalUser() != $b['uid'])) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -288,11 +289,11 @@ function tumblr_post_local(App $a, array &$b)
|
|||
return;
|
||||
}
|
||||
|
||||
$tmbl_post = intval(DI::pConfig()->get(local_user(), 'tumblr', 'post'));
|
||||
$tmbl_post = intval(DI::pConfig()->get(Session::getLocalUser(), 'tumblr', 'post'));
|
||||
|
||||
$tmbl_enable = (($tmbl_post && !empty($_REQUEST['tumblr_enable'])) ? intval($_REQUEST['tumblr_enable']) : 0);
|
||||
|
||||
if ($b['api_source'] && intval(DI::pConfig()->get(local_user(), 'tumblr', 'post_by_default'))) {
|
||||
if ($b['api_source'] && intval(DI::pConfig()->get(Session::getLocalUser(), 'tumblr', 'post_by_default'))) {
|
||||
$tmbl_enable = 1;
|
||||
}
|
||||
|
||||
|
|
|
@ -85,6 +85,7 @@ use Friendica\Model\Tag;
|
|||
use Friendica\Model\User;
|
||||
use Friendica\Protocol\Activity;
|
||||
use Friendica\Core\Config\Util\ConfigFileLoader;
|
||||
use Friendica\Core\Session;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\Util\DateTimeFormat;
|
||||
use Friendica\Util\Images;
|
||||
|
@ -204,17 +205,17 @@ function twitter_api_contact(string $apiPath, array $contact, int $uid): ?bool
|
|||
|
||||
function twitter_jot_nets(App $a, array &$jotnets_fields)
|
||||
{
|
||||
if (!local_user()) {
|
||||
if (!Session::getLocalUser()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (DI::pConfig()->get(local_user(), 'twitter', 'post')) {
|
||||
if (DI::pConfig()->get(Session::getLocalUser(), 'twitter', 'post')) {
|
||||
$jotnets_fields[] = [
|
||||
'type' => 'checkbox',
|
||||
'field' => [
|
||||
'twitter_enable',
|
||||
DI::l10n()->t('Post to Twitter'),
|
||||
DI::pConfig()->get(local_user(), 'twitter', 'post_by_default')
|
||||
DI::pConfig()->get(Session::getLocalUser(), 'twitter', 'post_by_default')
|
||||
]
|
||||
];
|
||||
}
|
||||
|
@ -223,7 +224,7 @@ function twitter_jot_nets(App $a, array &$jotnets_fields)
|
|||
|
||||
function twitter_settings_post(App $a)
|
||||
{
|
||||
if (!local_user()) {
|
||||
if (!Session::getLocalUser()) {
|
||||
return;
|
||||
}
|
||||
// don't check twitter settings if twitter submit button is not clicked
|
||||
|
@ -236,18 +237,18 @@ function twitter_settings_post(App $a)
|
|||
* if the twitter-disconnect checkbox is set, clear the OAuth key/secret pair
|
||||
* from the user configuration
|
||||
*/
|
||||
DI::pConfig()->delete(local_user(), 'twitter', 'consumerkey');
|
||||
DI::pConfig()->delete(local_user(), 'twitter', 'consumersecret');
|
||||
DI::pConfig()->delete(local_user(), 'twitter', 'oauthtoken');
|
||||
DI::pConfig()->delete(local_user(), 'twitter', 'oauthsecret');
|
||||
DI::pConfig()->delete(local_user(), 'twitter', 'post');
|
||||
DI::pConfig()->delete(local_user(), 'twitter', 'post_by_default');
|
||||
DI::pConfig()->delete(local_user(), 'twitter', 'lastid');
|
||||
DI::pConfig()->delete(local_user(), 'twitter', 'thread');
|
||||
DI::pConfig()->delete(local_user(), 'twitter', 'mirror_posts');
|
||||
DI::pConfig()->delete(local_user(), 'twitter', 'import');
|
||||
DI::pConfig()->delete(local_user(), 'twitter', 'create_user');
|
||||
DI::pConfig()->delete(local_user(), 'twitter', 'own_id');
|
||||
DI::pConfig()->delete(Session::getLocalUser(), 'twitter', 'consumerkey');
|
||||
DI::pConfig()->delete(Session::getLocalUser(), 'twitter', 'consumersecret');
|
||||
DI::pConfig()->delete(Session::getLocalUser(), 'twitter', 'oauthtoken');
|
||||
DI::pConfig()->delete(Session::getLocalUser(), 'twitter', 'oauthsecret');
|
||||
DI::pConfig()->delete(Session::getLocalUser(), 'twitter', 'post');
|
||||
DI::pConfig()->delete(Session::getLocalUser(), 'twitter', 'post_by_default');
|
||||
DI::pConfig()->delete(Session::getLocalUser(), 'twitter', 'lastid');
|
||||
DI::pConfig()->delete(Session::getLocalUser(), 'twitter', 'thread');
|
||||
DI::pConfig()->delete(Session::getLocalUser(), 'twitter', 'mirror_posts');
|
||||
DI::pConfig()->delete(Session::getLocalUser(), 'twitter', 'import');
|
||||
DI::pConfig()->delete(Session::getLocalUser(), 'twitter', 'create_user');
|
||||
DI::pConfig()->delete(Session::getLocalUser(), 'twitter', 'own_id');
|
||||
} else {
|
||||
if (isset($_POST['twitter-pin'])) {
|
||||
// if the user supplied us with a PIN from Twitter, let the magic of OAuth happen
|
||||
|
@ -265,9 +266,9 @@ function twitter_settings_post(App $a)
|
|||
$connection = new TwitterOAuth($ckey, $csecret, $_POST['twitter-token'], $_POST['twitter-token2']);
|
||||
$token = $connection->oauth('oauth/access_token', ['oauth_verifier' => $_POST['twitter-pin']]);
|
||||
// ok, now that we have the Access Token, save them in the user config
|
||||
DI::pConfig()->set(local_user(), 'twitter', 'oauthtoken', $token['oauth_token']);
|
||||
DI::pConfig()->set(local_user(), 'twitter', 'oauthsecret', $token['oauth_token_secret']);
|
||||
DI::pConfig()->set(local_user(), 'twitter', 'post', 1);
|
||||
DI::pConfig()->set(Session::getLocalUser(), 'twitter', 'oauthtoken', $token['oauth_token']);
|
||||
DI::pConfig()->set(Session::getLocalUser(), 'twitter', 'oauthsecret', $token['oauth_token_secret']);
|
||||
DI::pConfig()->set(Session::getLocalUser(), 'twitter', 'post', 1);
|
||||
} catch(Exception $e) {
|
||||
DI::sysmsg()->addNotice($e->getMessage());
|
||||
} catch(TwitterOAuthException $e) {
|
||||
|
@ -276,15 +277,15 @@ function twitter_settings_post(App $a)
|
|||
} else {
|
||||
// if no PIN is supplied in the POST variables, the user has changed the setting
|
||||
// to post a tweet for every new __public__ posting to the wall
|
||||
DI::pConfig()->set(local_user(), 'twitter', 'post', intval($_POST['twitter-enable']));
|
||||
DI::pConfig()->set(local_user(), 'twitter', 'post_by_default', intval($_POST['twitter-default']));
|
||||
DI::pConfig()->set(local_user(), 'twitter', 'thread', intval($_POST['twitter-thread']));
|
||||
DI::pConfig()->set(local_user(), 'twitter', 'mirror_posts', intval($_POST['twitter-mirror']));
|
||||
DI::pConfig()->set(local_user(), 'twitter', 'import', intval($_POST['twitter-import']));
|
||||
DI::pConfig()->set(local_user(), 'twitter', 'create_user', intval($_POST['twitter-create_user']));
|
||||
DI::pConfig()->set(Session::getLocalUser(), 'twitter', 'post', intval($_POST['twitter-enable']));
|
||||
DI::pConfig()->set(Session::getLocalUser(), 'twitter', 'post_by_default', intval($_POST['twitter-default']));
|
||||
DI::pConfig()->set(Session::getLocalUser(), 'twitter', 'thread', intval($_POST['twitter-thread']));
|
||||
DI::pConfig()->set(Session::getLocalUser(), 'twitter', 'mirror_posts', intval($_POST['twitter-mirror']));
|
||||
DI::pConfig()->set(Session::getLocalUser(), 'twitter', 'import', intval($_POST['twitter-import']));
|
||||
DI::pConfig()->set(Session::getLocalUser(), 'twitter', 'create_user', intval($_POST['twitter-create_user']));
|
||||
|
||||
if (!intval($_POST['twitter-mirror'])) {
|
||||
DI::pConfig()->delete(local_user(), 'twitter', 'lastid');
|
||||
DI::pConfig()->delete(Session::getLocalUser(), 'twitter', 'lastid');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -292,11 +293,11 @@ function twitter_settings_post(App $a)
|
|||
|
||||
function twitter_settings(App $a, array &$data)
|
||||
{
|
||||
if (!local_user()) {
|
||||
if (!Session::getLocalUser()) {
|
||||
return;
|
||||
}
|
||||
|
||||
$user = User::getById(local_user());
|
||||
$user = User::getById(Session::getLocalUser());
|
||||
|
||||
DI::page()->registerStylesheet(__DIR__ . '/twitter.css', 'all');
|
||||
|
||||
|
@ -307,15 +308,15 @@ function twitter_settings(App $a, array &$data)
|
|||
*/
|
||||
$ckey = DI::config()->get('twitter', 'consumerkey');
|
||||
$csecret = DI::config()->get('twitter', 'consumersecret');
|
||||
$otoken = DI::pConfig()->get(local_user(), 'twitter', 'oauthtoken');
|
||||
$osecret = DI::pConfig()->get(local_user(), 'twitter', 'oauthsecret');
|
||||
$otoken = DI::pConfig()->get(Session::getLocalUser(), 'twitter', 'oauthtoken');
|
||||
$osecret = DI::pConfig()->get(Session::getLocalUser(), 'twitter', 'oauthsecret');
|
||||
|
||||
$enabled = intval(DI::pConfig()->get(local_user(), 'twitter', 'post'));
|
||||
$defenabled = intval(DI::pConfig()->get(local_user(), 'twitter', 'post_by_default'));
|
||||
$threadenabled = intval(DI::pConfig()->get(local_user(), 'twitter', 'thread'));
|
||||
$mirrorenabled = intval(DI::pConfig()->get(local_user(), 'twitter', 'mirror_posts'));
|
||||
$importenabled = intval(DI::pConfig()->get(local_user(), 'twitter', 'import'));
|
||||
$create_userenabled = intval(DI::pConfig()->get(local_user(), 'twitter', 'create_user'));
|
||||
$enabled = intval(DI::pConfig()->get(Session::getLocalUser(), 'twitter', 'post'));
|
||||
$defenabled = intval(DI::pConfig()->get(Session::getLocalUser(), 'twitter', 'post_by_default'));
|
||||
$threadenabled = intval(DI::pConfig()->get(Session::getLocalUser(), 'twitter', 'thread'));
|
||||
$mirrorenabled = intval(DI::pConfig()->get(Session::getLocalUser(), 'twitter', 'mirror_posts'));
|
||||
$importenabled = intval(DI::pConfig()->get(Session::getLocalUser(), 'twitter', 'import'));
|
||||
$create_userenabled = intval(DI::pConfig()->get(Session::getLocalUser(), 'twitter', 'create_user'));
|
||||
|
||||
// Hide the submit button by default
|
||||
$submit = '';
|
||||
|
@ -465,15 +466,15 @@ function twitter_post_local(App $a, array &$b)
|
|||
return;
|
||||
}
|
||||
|
||||
if (!local_user() || (local_user() != $b['uid'])) {
|
||||
if (!Session::getLocalUser() || (Session::getLocalUser() != $b['uid'])) {
|
||||
return;
|
||||
}
|
||||
|
||||
$twitter_post = intval(DI::pConfig()->get(local_user(), 'twitter', 'post'));
|
||||
$twitter_post = intval(DI::pConfig()->get(Session::getLocalUser(), 'twitter', 'post'));
|
||||
$twitter_enable = (($twitter_post && !empty($_REQUEST['twitter_enable'])) ? intval($_REQUEST['twitter_enable']) : 0);
|
||||
|
||||
// if API is used, default to the chosen settings
|
||||
if ($b['api_source'] && intval(DI::pConfig()->get(local_user(), 'twitter', 'post_by_default'))) {
|
||||
if ($b['api_source'] && intval(DI::pConfig()->get(Session::getLocalUser(), 'twitter', 'post_by_default'))) {
|
||||
$twitter_enable = 1;
|
||||
}
|
||||
|
||||
|
@ -1069,7 +1070,7 @@ function twitter_prepare_body(App $a, array &$b)
|
|||
$item = $b['item'];
|
||||
$item['plink'] = DI::baseUrl()->get() . '/display/' . $item['guid'];
|
||||
|
||||
$condition = ['uri' => $item['thr-parent'], 'uid' => local_user()];
|
||||
$condition = ['uri' => $item['thr-parent'], 'uid' => Session::getLocalUser()];
|
||||
$orig_post = Post::selectFirst(['author-link'], $condition);
|
||||
if (DBA::isResult($orig_post)) {
|
||||
$nicknameplain = preg_replace("=https?://twitter.com/(.*)=ism", "$1", $orig_post['author-link']);
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
|
||||
use Friendica\App;
|
||||
use Friendica\Core\Hook;
|
||||
use Friendica\Core\Session;
|
||||
use Friendica\DI;
|
||||
|
||||
function viewsrc_install()
|
||||
|
@ -32,7 +33,7 @@ EOS;
|
|||
|
||||
function viewsrc_item_photo_menu(App $a, array &$b)
|
||||
{
|
||||
if (!local_user()) {
|
||||
if (!Session::getLocalUser()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -33,6 +33,7 @@ use Friendica\Content\Text\HTML;
|
|||
use Friendica\Core\Hook;
|
||||
use Friendica\Core\Logger;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\Core\Session;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\DI;
|
||||
use Friendica\Model\Item;
|
||||
|
@ -72,19 +73,19 @@ function windowsphonepush_module() {}
|
|||
* We will make sure we've got a valid user account
|
||||
* and if so set our configuration setting for this person.
|
||||
*/
|
||||
function windowsphonepush_settings_post(App $a, $post)
|
||||
function windowsphonepush_settings_post(App $a, array $post)
|
||||
{
|
||||
if (!local_user() || empty($_POST['windowsphonepush-submit'])) {
|
||||
if (!Session::getLocalUser() || empty($post['windowsphonepush-submit'])) {
|
||||
return;
|
||||
}
|
||||
$enable = intval($_POST['windowsphonepush']);
|
||||
DI::pConfig()->set(local_user(), 'windowsphonepush', 'enable', $enable);
|
||||
$enable = intval($post['windowsphonepush']);
|
||||
DI::pConfig()->set(Session::getLocalUser(), 'windowsphonepush', 'enable', $enable);
|
||||
|
||||
if ($enable) {
|
||||
DI::pConfig()->set(local_user(), 'windowsphonepush', 'counterunseen', 0);
|
||||
DI::pConfig()->set(Session::getLocalUser(), 'windowsphonepush', 'counterunseen', 0);
|
||||
}
|
||||
|
||||
DI::pConfig()->set(local_user(), 'windowsphonepush', 'senditemtext', intval($_POST['windowsphonepush-senditemtext']));
|
||||
DI::pConfig()->set(Session::getLocalUser(), 'windowsphonepush', 'senditemtext', intval($post['windowsphonepush-senditemtext']));
|
||||
}
|
||||
|
||||
/* Called from the Addon Setting form.
|
||||
|
@ -92,13 +93,13 @@ function windowsphonepush_settings_post(App $a, $post)
|
|||
*/
|
||||
function windowsphonepush_settings(App &$a, array &$data)
|
||||
{
|
||||
if (!local_user()) {
|
||||
if (!Session::getLocalUser()) {
|
||||
return;
|
||||
}
|
||||
|
||||
$enabled = DI::pConfig()->get(local_user(), 'windowsphonepush', 'enable');
|
||||
$senditemtext = DI::pConfig()->get(local_user(), 'windowsphonepush', 'senditemtext');
|
||||
$device_url = DI::pConfig()->get(local_user(), 'windowsphonepush', 'device_url');
|
||||
$enabled = DI::pConfig()->get(Session::getLocalUser(), 'windowsphonepush', 'enable');
|
||||
$senditemtext = DI::pConfig()->get(Session::getLocalUser(), 'windowsphonepush', 'senditemtext');
|
||||
$device_url = DI::pConfig()->get(Session::getLocalUser(), 'windowsphonepush', 'device_url');
|
||||
|
||||
$t = Renderer::getMarkupTemplate('settings.tpl', 'addon/windowsphonepush/');
|
||||
$html = Renderer::replaceMacros($t, [
|
||||
|
@ -274,7 +275,7 @@ function send_push($device_url, $headers, $msg)
|
|||
// and log this fact
|
||||
$subscriptionStatus = get_header_value($output, 'X-SubscriptionStatus');
|
||||
if ($subscriptionStatus == "Expired") {
|
||||
DI::pConfig()->set(local_user(), 'windowsphonepush', 'device_url', "");
|
||||
DI::pConfig()->set(Session::getLocalUser(), 'windowsphonepush', 'device_url', "");
|
||||
Logger::notice("ERROR: the stored Device-URL " . $device_url . "returned an 'Expired' error, it has been deleted now.");
|
||||
}
|
||||
|
||||
|
@ -329,15 +330,15 @@ function windowsphonepush_content(App $a)
|
|||
// return settings for windowsphonepush addon to be able to check them in WP app
|
||||
function windowsphonepush_showsettings()
|
||||
{
|
||||
if (!local_user()) {
|
||||
if (!Session::getLocalUser()) {
|
||||
return;
|
||||
}
|
||||
|
||||
$enable = DI::pConfig()->get(local_user(), 'windowsphonepush', 'enable');
|
||||
$device_url = DI::pConfig()->get(local_user(), 'windowsphonepush', 'device_url');
|
||||
$senditemtext = DI::pConfig()->get(local_user(), 'windowsphonepush', 'senditemtext');
|
||||
$lastpushid = DI::pConfig()->get(local_user(), 'windowsphonepush', 'lastpushid');
|
||||
$counterunseen = DI::pConfig()->get(local_user(), 'windowsphonepush', 'counterunseen');
|
||||
$enable = DI::pConfig()->get(Session::getLocalUser(), 'windowsphonepush', 'enable');
|
||||
$device_url = DI::pConfig()->get(Session::getLocalUser(), 'windowsphonepush', 'device_url');
|
||||
$senditemtext = DI::pConfig()->get(Session::getLocalUser(), 'windowsphonepush', 'senditemtext');
|
||||
$lastpushid = DI::pConfig()->get(Session::getLocalUser(), 'windowsphonepush', 'lastpushid');
|
||||
$counterunseen = DI::pConfig()->get(Session::getLocalUser(), 'windowsphonepush', 'counterunseen');
|
||||
$addonversion = "2.0";
|
||||
|
||||
if (!$device_url) {
|
||||
|
@ -349,7 +350,7 @@ function windowsphonepush_showsettings()
|
|||
}
|
||||
|
||||
header("Content-Type: application/json");
|
||||
echo json_encode(['uid' => local_user(),
|
||||
echo json_encode(['uid' => Session::getLocalUser(),
|
||||
'enable' => $enable,
|
||||
'device_url' => $device_url,
|
||||
'senditemtext' => $senditemtext,
|
||||
|
@ -363,12 +364,12 @@ function windowsphonepush_showsettings()
|
|||
*/
|
||||
function windowsphonepush_updatesettings()
|
||||
{
|
||||
if (!local_user()) {
|
||||
if (!Session::getLocalUser()) {
|
||||
return "Not Authenticated";
|
||||
}
|
||||
|
||||
// no updating if user hasn't enabled the addon
|
||||
$enable = DI::pConfig()->get(local_user(), 'windowsphonepush', 'enable');
|
||||
$enable = DI::pConfig()->get(Session::getLocalUser(), 'windowsphonepush', 'enable');
|
||||
if (!$enable) {
|
||||
return "Plug-in not enabled";
|
||||
}
|
||||
|
@ -384,32 +385,32 @@ function windowsphonepush_updatesettings()
|
|||
// the user on the Windows Phone device and that device url is no longer true for the other user, so we
|
||||
// et the device_url for the OTHER user blank (should normally not occur as App should include User/server
|
||||
// in url request to Microsoft Push Notification server)
|
||||
$pconfigs = DBA::selectToArray('pconfig', ['uid'], ["`uid` != ? AND `cat` = ? AND `k` = ? AND `v` = ?", local_user(), 'windowsphonepush', 'device_url', $device_url]);
|
||||
$pconfigs = DBA::selectToArray('pconfig', ['uid'], ["`uid` != ? AND `cat` = ? AND `k` = ? AND `v` = ?", Session::getLocalUser(), 'windowsphonepush', 'device_url', $device_url]);
|
||||
foreach ($pconfigs as $rr) {
|
||||
DI::pConfig()->set($rr['uid'], 'windowsphonepush', 'device_url', '');
|
||||
Logger::notice("WARN: the sent URL was already registered with user '" . $rr['uid'] . "'. Deleted for this user as we expect to be correct now for user '" . local_user() . "'.");
|
||||
Logger::notice("WARN: the sent URL was already registered with user '" . $rr['uid'] . "'. Deleted for this user as we expect to be correct now for user '" . Session::getLocalUser() . "'.");
|
||||
}
|
||||
|
||||
DI::pConfig()->set(local_user(), 'windowsphonepush', 'device_url', $device_url);
|
||||
DI::pConfig()->set(Session::getLocalUser(), 'windowsphonepush', 'device_url', $device_url);
|
||||
// output the successfull update of the device URL to the logger for error analysis if necessary
|
||||
Logger::notice("INFO: Device-URL for user '" . local_user() . "' has been updated with '" . $device_url . "'");
|
||||
Logger::notice("INFO: Device-URL for user '" . Session::getLocalUser() . "' has been updated with '" . $device_url . "'");
|
||||
return "Device-URL updated successfully!";
|
||||
}
|
||||
|
||||
// update_counterunseen is used to reset the counter to zero from Windows Phone app
|
||||
function windowsphonepush_updatecounterunseen()
|
||||
{
|
||||
if (!local_user()) {
|
||||
if (!Session::getLocalUser()) {
|
||||
return "Not Authenticated";
|
||||
}
|
||||
|
||||
// no updating if user hasn't enabled the addon
|
||||
$enable = DI::pConfig()->get(local_user(), 'windowsphonepush', 'enable');
|
||||
$enable = DI::pConfig()->get(Session::getLocalUser(), 'windowsphonepush', 'enable');
|
||||
if (!$enable) {
|
||||
return "Plug-in not enabled";
|
||||
}
|
||||
|
||||
DI::pConfig()->set(local_user(), 'windowsphonepush', 'counterunseen', 0);
|
||||
DI::pConfig()->set(Session::getLocalUser(), 'windowsphonepush', 'counterunseen', 0);
|
||||
return "Counter set to zero";
|
||||
}
|
||||
|
||||
|
|
|
@ -12,6 +12,7 @@ use Friendica\Content\Text\HTML;
|
|||
use Friendica\Core\Hook;
|
||||
use Friendica\Core\Logger;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\Core\Session;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\DI;
|
||||
use Friendica\Model\Post;
|
||||
|
@ -29,17 +30,17 @@ function wppost_install()
|
|||
|
||||
function wppost_jot_nets(App &$a, array &$jotnets_fields)
|
||||
{
|
||||
if (!local_user()) {
|
||||
if (!Session::getLocalUser()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (DI::pConfig()->get(local_user(),'wppost','post')) {
|
||||
if (DI::pConfig()->get(Session::getLocalUser(),'wppost','post')) {
|
||||
$jotnets_fields[] = [
|
||||
'type' => 'checkbox',
|
||||
'field' => [
|
||||
'wppost_enable',
|
||||
DI::l10n()->t('Post to Wordpress'),
|
||||
DI::pConfig()->get(local_user(),'wppost','post_by_default')
|
||||
DI::pConfig()->get(Session::getLocalUser(),'wppost','post_by_default')
|
||||
]
|
||||
];
|
||||
}
|
||||
|
@ -48,17 +49,17 @@ function wppost_jot_nets(App &$a, array &$jotnets_fields)
|
|||
|
||||
function wppost_settings(App &$a, array &$data)
|
||||
{
|
||||
if (!local_user()) {
|
||||
if (!Session::getLocalUser()) {
|
||||
return;
|
||||
}
|
||||
|
||||
$enabled = DI::pConfig()->get(local_user(), 'wppost', 'post', false);
|
||||
$wp_username = DI::pConfig()->get(local_user(), 'wppost', 'wp_username');
|
||||
$wp_blog = DI::pConfig()->get(local_user(), 'wppost', 'wp_blog');
|
||||
$def_enabled = DI::pConfig()->get(local_user(), 'wppost', 'post_by_default', false);
|
||||
$back_enabled = DI::pConfig()->get(local_user(), 'wppost', 'backlink', false);
|
||||
$wp_backlink_text = DI::pConfig()->get(local_user(), 'wppost', 'wp_backlink_text');
|
||||
$shortcheck_enabled = DI::pConfig()->get(local_user(), 'wppost', 'shortcheck', false);
|
||||
$enabled = DI::pConfig()->get(Session::getLocalUser(), 'wppost', 'post', false);
|
||||
$wp_username = DI::pConfig()->get(Session::getLocalUser(), 'wppost', 'wp_username');
|
||||
$wp_blog = DI::pConfig()->get(Session::getLocalUser(), 'wppost', 'wp_blog');
|
||||
$def_enabled = DI::pConfig()->get(Session::getLocalUser(), 'wppost', 'post_by_default', false);
|
||||
$back_enabled = DI::pConfig()->get(Session::getLocalUser(), 'wppost', 'backlink', false);
|
||||
$wp_backlink_text = DI::pConfig()->get(Session::getLocalUser(), 'wppost', 'wp_backlink_text');
|
||||
$shortcheck_enabled = DI::pConfig()->get(Session::getLocalUser(), 'wppost', 'shortcheck', false);
|
||||
|
||||
$t = Renderer::getMarkupTemplate('connector_settings.tpl', 'addon/wppost/');
|
||||
$html = Renderer::replaceMacros($t, [
|
||||
|
@ -85,16 +86,16 @@ function wppost_settings(App &$a, array &$data)
|
|||
function wppost_settings_post(App $a, array &$b)
|
||||
{
|
||||
if(!empty($_POST['wppost-submit'])) {
|
||||
DI::pConfig()->set(local_user(), 'wppost', 'post' , intval($_POST['wppost']));
|
||||
DI::pConfig()->set(local_user(), 'wppost', 'post_by_default', intval($_POST['wp_bydefault']));
|
||||
DI::pConfig()->set(local_user(), 'wppost', 'wp_username' , trim($_POST['wp_username']));
|
||||
DI::pConfig()->set(local_user(), 'wppost', 'wp_password' , trim($_POST['wp_password']));
|
||||
DI::pConfig()->set(local_user(), 'wppost', 'wp_blog' , trim($_POST['wp_blog']));
|
||||
DI::pConfig()->set(local_user(), 'wppost', 'backlink' , intval($_POST['wp_backlink']));
|
||||
DI::pConfig()->set(local_user(), 'wppost', 'shortcheck' , intval($_POST['wp_shortcheck']));
|
||||
DI::pConfig()->set(Session::getLocalUser(), 'wppost', 'post' , intval($_POST['wppost']));
|
||||
DI::pConfig()->set(Session::getLocalUser(), 'wppost', 'post_by_default', intval($_POST['wp_bydefault']));
|
||||
DI::pConfig()->set(Session::getLocalUser(), 'wppost', 'wp_username' , trim($_POST['wp_username']));
|
||||
DI::pConfig()->set(Session::getLocalUser(), 'wppost', 'wp_password' , trim($_POST['wp_password']));
|
||||
DI::pConfig()->set(Session::getLocalUser(), 'wppost', 'wp_blog' , trim($_POST['wp_blog']));
|
||||
DI::pConfig()->set(Session::getLocalUser(), 'wppost', 'backlink' , intval($_POST['wp_backlink']));
|
||||
DI::pConfig()->set(Session::getLocalUser(), 'wppost', 'shortcheck' , intval($_POST['wp_shortcheck']));
|
||||
$wp_backlink_text = BBCode::convert(trim($_POST['wp_backlink_text']), false, BBCode::BACKLINK);
|
||||
$wp_backlink_text = HTML::toPlaintext($wp_backlink_text, 0, true);
|
||||
DI::pConfig()->set(local_user(), 'wppost', 'wp_backlink_text', $wp_backlink_text);
|
||||
DI::pConfig()->set(Session::getLocalUser(), 'wppost', 'wp_backlink_text', $wp_backlink_text);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -121,7 +122,7 @@ function wppost_post_local(App $a, array &$b) {
|
|||
return;
|
||||
}
|
||||
|
||||
if (!local_user() || (local_user() != $b['uid'])) {
|
||||
if (!Session::getLocalUser() || (Session::getLocalUser() != $b['uid'])) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -129,11 +130,11 @@ function wppost_post_local(App $a, array &$b) {
|
|||
return;
|
||||
}
|
||||
|
||||
$wp_post = intval(DI::pConfig()->get(local_user(), 'wppost', 'post'));
|
||||
$wp_post = intval(DI::pConfig()->get(Session::getLocalUser(), 'wppost', 'post'));
|
||||
|
||||
$wp_enable = (($wp_post && !empty($_REQUEST['wppost_enable'])) ? intval($_REQUEST['wppost_enable']) : 0);
|
||||
|
||||
if ($b['api_source'] && intval(DI::pConfig()->get(local_user(), 'wppost', 'post_by_default'))) {
|
||||
if ($b['api_source'] && intval(DI::pConfig()->get(Session::getLocalUser(), 'wppost', 'post_by_default'))) {
|
||||
$wp_enable = 1;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue