Replace all functions from boot.php
parent
5f1028a535
commit
5d8129600d
|
@ -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,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 group_text_install() {
|
||||
|
@ -30,9 +31,9 @@ function group_text_install() {
|
|||
*/
|
||||
|
||||
function group_text_settings_post(App $a, $post) {
|
||||
if(! local_user() || empty($_POST['group_text-submit']))
|
||||
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']));
|
||||
}
|
||||
|
||||
|
||||
|
@ -47,11 +48,11 @@ 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;
|
||||
}
|
||||
|
||||