mirror of
https://github.com/friendica/friendica
synced 2024-12-23 03:20:15 +00:00
Merge pull request #12022 from annando/no-boot-various
old boot.php functions replaced in various places
This commit is contained in:
commit
7fc37832f7
20 changed files with 183 additions and 105 deletions
|
@ -281,7 +281,7 @@ $data = [
|
||||||
'submit' => [
|
'submit' => [
|
||||||
'catavatar-usecat' => DI::l10n()->t('Use Cat as Avatar'),
|
'catavatar-usecat' => DI::l10n()->t('Use Cat as Avatar'),
|
||||||
'catavatar-morecat' => DI::l10n()->t('Another random Cat!'),
|
'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,
|
||||||
],
|
],
|
||||||
];
|
];
|
||||||
```
|
```
|
||||||
|
|
|
@ -30,7 +30,7 @@ function doSomething(array $intros)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$intros = \Friendica\Database\DBA::selectToArray('intros', [], ['uid' => local_user()]);
|
$intros = \Friendica\Database\DBA::selectToArray('intros', [], ['uid' => Session::getLocalUser()]);
|
||||||
|
|
||||||
doSomething($intros);
|
doSomething($intros);
|
||||||
```
|
```
|
||||||
|
@ -47,7 +47,7 @@ function doSomething(\Friendica\Contact\Introductions\Collection\Introductions $
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @var $intros \Friendica\Contact\Introductions\Collection\Introductions */
|
/** @var $intros \Friendica\Contact\Introductions\Collection\Introductions */
|
||||||
$intros = \Friendica\DI::intro()->selecForUser(local_user());
|
$intros = \Friendica\DI::intro()->selecForUser(Session::getLocalUser());
|
||||||
|
|
||||||
doSomething($intros);
|
doSomething($intros);
|
||||||
```
|
```
|
||||||
|
|
|
@ -123,13 +123,13 @@ The selected 1st part will be saved in the database by the theme_post function.
|
||||||
|
|
||||||
function theme_post(App $a){
|
function theme_post(App $a){
|
||||||
// non local users shall not pass
|
// non local users shall not pass
|
||||||
if (! local_user()) {
|
if (!Session::getLocalUser()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// if the one specific submit button was pressed then proceed
|
// if the one specific submit button was pressed then proceed
|
||||||
if (isset($_POST['duepuntozero-settings-submit'])){
|
if (isset($_POST['duepuntozero-settings-submit'])){
|
||||||
// and save the selection key into the personal config of the user
|
// and save the selection key into the personal config of the user
|
||||||
DI::pConfig()->set(local_user(), 'duepuntozero', 'colorset', $_POST['duepuntozero_colorset']);
|
DI::pConfig()->set(Session::getLocalUser(), 'duepuntozero', 'colorset', $_POST['duepuntozero_colorset']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -137,7 +137,7 @@ Now that this information is set in the database, what should friendica do with
|
||||||
For this, have a look at the theme.php file of the *duepunto zero*.
|
For this, have a look at the theme.php file of the *duepunto zero*.
|
||||||
There you'll find somethink alike
|
There you'll find somethink alike
|
||||||
|
|
||||||
$colorset = DI::pConfig()->get( local_user(), 'duepuntozero','colorset');
|
$colorset = DI::pConfig()->get(Session::getLocalUser(), 'duepuntozero','colorset');
|
||||||
if (!$colorset)
|
if (!$colorset)
|
||||||
$colorset = DI::config()->get('duepuntozero', 'colorset');
|
$colorset = DI::config()->get('duepuntozero', 'colorset');
|
||||||
if ($colorset) {
|
if ($colorset) {
|
||||||
|
|
|
@ -23,6 +23,7 @@ namespace Friendica\Navigation\Notifications\Factory;
|
||||||
|
|
||||||
use Friendica\BaseFactory;
|
use Friendica\BaseFactory;
|
||||||
use Friendica\Core\Renderer;
|
use Friendica\Core\Renderer;
|
||||||
|
use Friendica\Core\Session;
|
||||||
use Friendica\Model\Contact;
|
use Friendica\Model\Contact;
|
||||||
use Friendica\Navigation\Notifications\Entity;
|
use Friendica\Navigation\Notifications\Entity;
|
||||||
use Friendica\Navigation\Notifications\Exception\NoMessageException;
|
use Friendica\Navigation\Notifications\Exception\NoMessageException;
|
||||||
|
@ -71,7 +72,7 @@ class FormattedNavNotification extends BaseFactory
|
||||||
*/
|
*/
|
||||||
public function createFromParams(array $contact, string $message, \DateTime $date, Uri $href, bool $seen = false): ValueObject\FormattedNavNotification
|
public function createFromParams(array $contact, string $message, \DateTime $date, Uri $href, bool $seen = false): ValueObject\FormattedNavNotification
|
||||||
{
|
{
|
||||||
$contact['photo'] = Contact::getAvatarUrlForUrl($contact['url'], local_user(), Proxy::SIZE_MICRO);
|
$contact['photo'] = Contact::getAvatarUrlForUrl($contact['url'], Session::getLocalUser(), Proxy::SIZE_MICRO);
|
||||||
|
|
||||||
$dateMySQL = $date->format(DateTimeFormat::MYSQL);
|
$dateMySQL = $date->format(DateTimeFormat::MYSQL);
|
||||||
|
|
||||||
|
|
|
@ -27,6 +27,7 @@ use Friendica\BaseFactory;
|
||||||
use Friendica\Content\Text\BBCode;
|
use Friendica\Content\Text\BBCode;
|
||||||
use Friendica\Core\L10n;
|
use Friendica\Core\L10n;
|
||||||
use Friendica\Core\Protocol;
|
use Friendica\Core\Protocol;
|
||||||
|
use Friendica\Core\Session;
|
||||||
use Friendica\Database\Database;
|
use Friendica\Database\Database;
|
||||||
use Friendica\Model\Contact;
|
use Friendica\Model\Contact;
|
||||||
use Friendica\Model\Item;
|
use Friendica\Model\Item;
|
||||||
|
@ -210,7 +211,7 @@ class FormattedNotify extends BaseFactory
|
||||||
|
|
||||||
$formattedNotifications = new FormattedNotifies();
|
$formattedNotifications = new FormattedNotifies();
|
||||||
try {
|
try {
|
||||||
$Notifies = $this->notify->selectForUser(local_user(), $conditions, $params);
|
$Notifies = $this->notify->selectForUser(Session::getLocalUser(), $conditions, $params);
|
||||||
|
|
||||||
foreach ($Notifies as $Notify) {
|
foreach ($Notifies as $Notify) {
|
||||||
$formattedNotifications[] = new ValueObject\FormattedNotify(
|
$formattedNotifications[] = new ValueObject\FormattedNotify(
|
||||||
|
@ -243,7 +244,7 @@ class FormattedNotify extends BaseFactory
|
||||||
*/
|
*/
|
||||||
public function getNetworkList(bool $seen = false, int $start = 0, int $limit = BaseNotifications::DEFAULT_PAGE_LIMIT): FormattedNotifies
|
public function getNetworkList(bool $seen = false, int $start = 0, int $limit = BaseNotifications::DEFAULT_PAGE_LIMIT): FormattedNotifies
|
||||||
{
|
{
|
||||||
$condition = ['wall' => false, 'uid' => local_user()];
|
$condition = ['wall' => false, 'uid' => Session::getLocalUser()];
|
||||||
|
|
||||||
if (!$seen) {
|
if (!$seen) {
|
||||||
$condition['unseen'] = true;
|
$condition['unseen'] = true;
|
||||||
|
@ -256,7 +257,7 @@ class FormattedNotify extends BaseFactory
|
||||||
$formattedNotifications = new FormattedNotifies();
|
$formattedNotifications = new FormattedNotifies();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$userPosts = Post::selectForUser(local_user(), $fields, $condition, $params);
|
$userPosts = Post::selectForUser(Session::getLocalUser(), $fields, $condition, $params);
|
||||||
while ($userPost = $this->dba->fetch($userPosts)) {
|
while ($userPost = $this->dba->fetch($userPosts)) {
|
||||||
$formattedNotifications[] = $this->createFromFormattedItem($this->formatItem($userPost));
|
$formattedNotifications[] = $this->createFromFormattedItem($this->formatItem($userPost));
|
||||||
}
|
}
|
||||||
|
@ -279,7 +280,7 @@ class FormattedNotify extends BaseFactory
|
||||||
*/
|
*/
|
||||||
public function getPersonalList(bool $seen = false, int $start = 0, int $limit = BaseNotifications::DEFAULT_PAGE_LIMIT): FormattedNotifies
|
public function getPersonalList(bool $seen = false, int $start = 0, int $limit = BaseNotifications::DEFAULT_PAGE_LIMIT): FormattedNotifies
|
||||||
{
|
{
|
||||||
$condition = ['wall' => false, 'uid' => local_user(), 'author-id' => public_contact()];
|
$condition = ['wall' => false, 'uid' => Session::getLocalUser(), 'author-id' => Session::getPublicContact()];
|
||||||
|
|
||||||
if (!$seen) {
|
if (!$seen) {
|
||||||
$condition['unseen'] = true;
|
$condition['unseen'] = true;
|
||||||
|
@ -292,7 +293,7 @@ class FormattedNotify extends BaseFactory
|
||||||
$formattedNotifications = new FormattedNotifies();
|
$formattedNotifications = new FormattedNotifies();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$userPosts = Post::selectForUser(local_user(), $fields, $condition, $params);
|
$userPosts = Post::selectForUser(Session::getLocalUser(), $fields, $condition, $params);
|
||||||
while ($userPost = $this->dba->fetch($userPosts)) {
|
while ($userPost = $this->dba->fetch($userPosts)) {
|
||||||
$formattedNotifications[] = $this->createFromFormattedItem($this->formatItem($userPost));
|
$formattedNotifications[] = $this->createFromFormattedItem($this->formatItem($userPost));
|
||||||
}
|
}
|
||||||
|
@ -315,7 +316,7 @@ class FormattedNotify extends BaseFactory
|
||||||
*/
|
*/
|
||||||
public function getHomeList(bool $seen = false, int $start = 0, int $limit = BaseNotifications::DEFAULT_PAGE_LIMIT): FormattedNotifies
|
public function getHomeList(bool $seen = false, int $start = 0, int $limit = BaseNotifications::DEFAULT_PAGE_LIMIT): FormattedNotifies
|
||||||
{
|
{
|
||||||
$condition = ['wall' => true, 'uid' => local_user()];
|
$condition = ['wall' => true, 'uid' => Session::getLocalUser()];
|
||||||
|
|
||||||
if (!$seen) {
|
if (!$seen) {
|
||||||
$condition['unseen'] = true;
|
$condition['unseen'] = true;
|
||||||
|
@ -328,7 +329,7 @@ class FormattedNotify extends BaseFactory
|
||||||
$formattedNotifications = new FormattedNotifies();
|
$formattedNotifications = new FormattedNotifies();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$userPosts = Post::selectForUser(local_user(), $fields, $condition, $params);
|
$userPosts = Post::selectForUser(Session::getLocalUser(), $fields, $condition, $params);
|
||||||
while ($userPost = $this->dba->fetch($userPosts)) {
|
while ($userPost = $this->dba->fetch($userPosts)) {
|
||||||
$formattedItem = $this->formatItem($userPost);
|
$formattedItem = $this->formatItem($userPost);
|
||||||
|
|
||||||
|
|
|
@ -29,6 +29,7 @@ use Friendica\Content\Text\BBCode;
|
||||||
use Friendica\Core\L10n;
|
use Friendica\Core\L10n;
|
||||||
use Friendica\Core\PConfig\Capability\IManagePersonalConfigValues;
|
use Friendica\Core\PConfig\Capability\IManagePersonalConfigValues;
|
||||||
use Friendica\Core\Protocol;
|
use Friendica\Core\Protocol;
|
||||||
|
use Friendica\Core\Session;
|
||||||
use Friendica\Core\Session\Capability\IHandleSessions;
|
use Friendica\Core\Session\Capability\IHandleSessions;
|
||||||
use Friendica\Database\Database;
|
use Friendica\Database\Database;
|
||||||
use Friendica\Model\Contact;
|
use Friendica\Model\Contact;
|
||||||
|
@ -142,7 +143,7 @@ class Introduction extends BaseFactory
|
||||||
'url' => $intro['furl'],
|
'url' => $intro['furl'],
|
||||||
'zrl' => Contact::magicLink($intro['furl']),
|
'zrl' => Contact::magicLink($intro['furl']),
|
||||||
'hidden' => $intro['hidden'] == 1,
|
'hidden' => $intro['hidden'] == 1,
|
||||||
'post_newfriend' => (intval($this->pConfig->get(local_user(), 'system', 'post_newfriend')) ? '1' : 0),
|
'post_newfriend' => (intval($this->pConfig->get(Session::getLocalUser(), 'system', 'post_newfriend')) ? '1' : 0),
|
||||||
'note' => $intro['note'],
|
'note' => $intro['note'],
|
||||||
'request' => $intro['frequest'] . '?addr=' . $return_addr]);
|
'request' => $intro['frequest'] . '?addr=' . $return_addr]);
|
||||||
|
|
||||||
|
@ -167,7 +168,7 @@ class Introduction extends BaseFactory
|
||||||
'about' => BBCode::convert($intro['about'], false),
|
'about' => BBCode::convert($intro['about'], false),
|
||||||
'keywords' => $intro['keywords'],
|
'keywords' => $intro['keywords'],
|
||||||
'hidden' => $intro['hidden'] == 1,
|
'hidden' => $intro['hidden'] == 1,
|
||||||
'post_newfriend' => (intval($this->pConfig->get(local_user(), 'system', 'post_newfriend')) ? '1' : 0),
|
'post_newfriend' => (intval($this->pConfig->get(Session::getLocalUser(), 'system', 'post_newfriend')) ? '1' : 0),
|
||||||
'url' => $intro['url'],
|
'url' => $intro['url'],
|
||||||
'zrl' => Contact::magicLink($intro['url']),
|
'zrl' => Contact::magicLink($intro['url']),
|
||||||
'addr' => $intro['addr'],
|
'addr' => $intro['addr'],
|
||||||
|
|
|
@ -27,6 +27,7 @@ use Exception;
|
||||||
use Friendica\Core\Hook;
|
use Friendica\Core\Hook;
|
||||||
use Friendica\Core\Logger;
|
use Friendica\Core\Logger;
|
||||||
use Friendica\Core\Protocol;
|
use Friendica\Core\Protocol;
|
||||||
|
use Friendica\Core\Session;
|
||||||
use Friendica\Core\System;
|
use Friendica\Core\System;
|
||||||
use Friendica\Database\DBA;
|
use Friendica\Database\DBA;
|
||||||
use Friendica\DI;
|
use Friendica\DI;
|
||||||
|
@ -316,7 +317,7 @@ class Probe
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($uid == -1) {
|
if ($uid == -1) {
|
||||||
$uid = local_user();
|
$uid = Session::getLocalUser();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (empty($network) || ($network == Protocol::ACTIVITYPUB)) {
|
if (empty($network) || ($network == Protocol::ACTIVITYPUB)) {
|
||||||
|
|
|
@ -104,14 +104,14 @@ class Post
|
||||||
if (!empty($data['children'])) {
|
if (!empty($data['children'])) {
|
||||||
foreach ($data['children'] as $item) {
|
foreach ($data['children'] as $item) {
|
||||||
// Only add will be displayed
|
// Only add will be displayed
|
||||||
if ($item['network'] === Protocol::MAIL && local_user() != $item['uid']) {
|
if ($item['network'] === Protocol::MAIL && Session::getLocalUser() != $item['uid']) {
|
||||||
continue;
|
continue;
|
||||||
} elseif (!DI::contentItem()->isVisibleActivity($item)) {
|
} elseif (!DI::contentItem()->isVisibleActivity($item)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// You can always comment on Diaspora and OStatus items
|
// You can always comment on Diaspora and OStatus items
|
||||||
if (in_array($item['network'], [Protocol::OSTATUS, Protocol::DIASPORA]) && (local_user() == $item['uid'])) {
|
if (in_array($item['network'], [Protocol::OSTATUS, Protocol::DIASPORA]) && (Session::getLocalUser() == $item['uid'])) {
|
||||||
$item['writable'] = true;
|
$item['writable'] = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -206,7 +206,7 @@ class Post
|
||||||
$lock = ($item['private'] == Item::PRIVATE) ? $privacy : false;
|
$lock = ($item['private'] == Item::PRIVATE) ? $privacy : false;
|
||||||
$connector = !in_array($item['network'], Protocol::NATIVE_SUPPORT) ? DI::l10n()->t('Connector Message') : false;
|
$connector = !in_array($item['network'], Protocol::NATIVE_SUPPORT) ? DI::l10n()->t('Connector Message') : false;
|
||||||
|
|
||||||
$shareable = in_array($conv->getProfileOwner(), [0, local_user()]) && $item['private'] != Item::PRIVATE;
|
$shareable = in_array($conv->getProfileOwner(), [0, Session::getLocalUser()]) && $item['private'] != Item::PRIVATE;
|
||||||
$announceable = $shareable && in_array($item['network'], [Protocol::ACTIVITYPUB, Protocol::DFRN, Protocol::DIASPORA, Protocol::TWITTER]);
|
$announceable = $shareable && in_array($item['network'], [Protocol::ACTIVITYPUB, Protocol::DFRN, Protocol::DIASPORA, Protocol::TWITTER]);
|
||||||
|
|
||||||
// On Diaspora only toplevel posts can be reshared
|
// On Diaspora only toplevel posts can be reshared
|
||||||
|
@ -216,7 +216,7 @@ class Post
|
||||||
|
|
||||||
$edpost = false;
|
$edpost = false;
|
||||||
|
|
||||||
if (local_user()) {
|
if (Session::getLocalUser()) {
|
||||||
if (Strings::compareLink(DI::session()->get('my_url'), $item['author-link'])) {
|
if (Strings::compareLink(DI::session()->get('my_url'), $item['author-link'])) {
|
||||||
if ($item['event-id'] != 0) {
|
if ($item['event-id'] != 0) {
|
||||||
$edpost = ['events/event/' . $item['event-id'], DI::l10n()->t('Edit')];
|
$edpost = ['events/event/' . $item['event-id'], DI::l10n()->t('Edit')];
|
||||||
|
@ -224,7 +224,7 @@ class Post
|
||||||
$edpost = ['editpost/' . $item['id'], DI::l10n()->t('Edit')];
|
$edpost = ['editpost/' . $item['id'], DI::l10n()->t('Edit')];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$dropping = in_array($item['uid'], [0, local_user()]);
|
$dropping = in_array($item['uid'], [0, Session::getLocalUser()]);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Editing on items of not subscribed users isn't currently possible
|
// Editing on items of not subscribed users isn't currently possible
|
||||||
|
@ -234,7 +234,7 @@ class Post
|
||||||
$edpost = false;
|
$edpost = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (($this->getDataValue('uid') == local_user()) || $this->isVisiting()) {
|
if (($this->getDataValue('uid') == Session::getLocalUser()) || $this->isVisiting()) {
|
||||||
$dropping = true;
|
$dropping = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -249,7 +249,7 @@ class Post
|
||||||
|
|
||||||
$drop = false;
|
$drop = false;
|
||||||
$block = false;
|
$block = false;
|
||||||
if (local_user()) {
|
if (Session::getLocalUser()) {
|
||||||
$drop = [
|
$drop = [
|
||||||
'dropping' => $dropping,
|
'dropping' => $dropping,
|
||||||
'pagedrop' => $item['pagedrop'],
|
'pagedrop' => $item['pagedrop'],
|
||||||
|
@ -258,7 +258,7 @@ class Post
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$item['self'] && local_user()) {
|
if (!$item['self'] && Session::getLocalUser()) {
|
||||||
$block = [
|
$block = [
|
||||||
'blocking' => true,
|
'blocking' => true,
|
||||||
'block' => DI::l10n()->t('Block %s', $item['author-name']),
|
'block' => DI::l10n()->t('Block %s', $item['author-name']),
|
||||||
|
@ -266,7 +266,7 @@ class Post
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
$filer = local_user() ? DI::l10n()->t('Save to folder') : false;
|
$filer = Session::getLocalUser() ? DI::l10n()->t('Save to folder') : false;
|
||||||
|
|
||||||
$profile_name = $item['author-name'];
|
$profile_name = $item['author-name'];
|
||||||
if (!empty($item['author-link']) && empty($item['author-name'])) {
|
if (!empty($item['author-link']) && empty($item['author-name'])) {
|
||||||
|
@ -327,8 +327,8 @@ class Post
|
||||||
$tagger = '';
|
$tagger = '';
|
||||||
|
|
||||||
if ($this->isToplevel()) {
|
if ($this->isToplevel()) {
|
||||||
if (local_user()) {
|
if (Session::getLocalUser()) {
|
||||||
$ignored = PostModel\ThreadUser::getIgnored($item['uri-id'], local_user());
|
$ignored = PostModel\ThreadUser::getIgnored($item['uri-id'], Session::getLocalUser());
|
||||||
if ($item['mention'] || $ignored) {
|
if ($item['mention'] || $ignored) {
|
||||||
$ignore = [
|
$ignore = [
|
||||||
'do' => DI::l10n()->t('Ignore thread'),
|
'do' => DI::l10n()->t('Ignore thread'),
|
||||||
|
@ -351,7 +351,7 @@ class Post
|
||||||
'starred' => DI::l10n()->t('Starred'),
|
'starred' => DI::l10n()->t('Starred'),
|
||||||
];
|
];
|
||||||
|
|
||||||
if ($conv->getProfileOwner() == local_user() && ($item['uid'] != 0)) {
|
if ($conv->getProfileOwner() == Session::getLocalUser() && ($item['uid'] != 0)) {
|
||||||
if ($origin && in_array($item['private'], [Item::PUBLIC, Item::UNLISTED])) {
|
if ($origin && in_array($item['private'], [Item::PUBLIC, Item::UNLISTED])) {
|
||||||
$ispinned = ($item['featured'] ? 'pinned' : 'unpinned');
|
$ispinned = ($item['featured'] ? 'pinned' : 'unpinned');
|
||||||
|
|
||||||
|
@ -397,17 +397,17 @@ class Post
|
||||||
|
|
||||||
$body_html = Item::prepareBody($item, true);
|
$body_html = Item::prepareBody($item, true);
|
||||||
|
|
||||||
list($categories, $folders) = DI::contentItem()->determineCategoriesTerms($item, local_user());
|
list($categories, $folders) = DI::contentItem()->determineCategoriesTerms($item, Session::getLocalUser());
|
||||||
|
|
||||||
if (!empty($item['title'])) {
|
if (!empty($item['title'])) {
|
||||||
$title = $item['title'];
|
$title = $item['title'];
|
||||||
} elseif (!empty($item['content-warning']) && DI::pConfig()->get(local_user(), 'system', 'disable_cw', false)) {
|
} elseif (!empty($item['content-warning']) && DI::pConfig()->get(Session::getLocalUser(), 'system', 'disable_cw', false)) {
|
||||||
$title = ucfirst($item['content-warning']);
|
$title = ucfirst($item['content-warning']);
|
||||||
} else {
|
} else {
|
||||||
$title = '';
|
$title = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (DI::pConfig()->get(local_user(), 'system', 'hide_dislike')) {
|
if (DI::pConfig()->get(Session::getLocalUser(), 'system', 'hide_dislike')) {
|
||||||
$buttons['dislike'] = false;
|
$buttons['dislike'] = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -434,7 +434,7 @@ class Post
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fetching of Diaspora posts doesn't always work. There are issues with reshares and possibly comments
|
// Fetching of Diaspora posts doesn't always work. There are issues with reshares and possibly comments
|
||||||
if (!local_user() && ($item['network'] != Protocol::DIASPORA) && !empty(DI::session()->get('remote_comment'))) {
|
if (!Session::getLocalUser() && ($item['network'] != Protocol::DIASPORA) && !empty(DI::session()->get('remote_comment'))) {
|
||||||
$remote_comment = [DI::l10n()->t('Comment this item on your system'), DI::l10n()->t('Remote comment'),
|
$remote_comment = [DI::l10n()->t('Comment this item on your system'), DI::l10n()->t('Remote comment'),
|
||||||
str_replace('{uri}', urlencode($item['uri']), DI::session()->get('remote_comment'))];
|
str_replace('{uri}', urlencode($item['uri']), DI::session()->get('remote_comment'))];
|
||||||
|
|
||||||
|
@ -642,7 +642,7 @@ class Post
|
||||||
/*
|
/*
|
||||||
* Only add what will be displayed
|
* Only add what will be displayed
|
||||||
*/
|
*/
|
||||||
if ($item->getDataValue('network') === Protocol::MAIL && local_user() != $item->getDataValue('uid')) {
|
if ($item->getDataValue('network') === Protocol::MAIL && Session::getLocalUser() != $item->getDataValue('uid')) {
|
||||||
return false;
|
return false;
|
||||||
} elseif ($activity->match($item->getDataValue('verb'), Activity::LIKE) ||
|
} elseif ($activity->match($item->getDataValue('verb'), Activity::LIKE) ||
|
||||||
$activity->match($item->getDataValue('verb'), Activity::DISLIKE)) {
|
$activity->match($item->getDataValue('verb'), Activity::DISLIKE)) {
|
||||||
|
@ -850,7 +850,7 @@ class Post
|
||||||
// This will allow us to comment on wall-to-wall items owned by our friends
|
// This will allow us to comment on wall-to-wall items owned by our friends
|
||||||
// and community forums even if somebody else wrote the post.
|
// and community forums even if somebody else wrote the post.
|
||||||
// bug #517 - this fixes for conversation owner
|
// bug #517 - this fixes for conversation owner
|
||||||
if ($conv->getMode() == 'profile' && $conv->getProfileOwner() == local_user()) {
|
if ($conv->getMode() == 'profile' && $conv->getProfileOwner() == Session::getLocalUser()) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -898,20 +898,20 @@ class Post
|
||||||
{
|
{
|
||||||
$a = DI::app();
|
$a = DI::app();
|
||||||
|
|
||||||
if (!local_user()) {
|
if (!Session::getLocalUser()) {
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
$owner = User::getOwnerDataById($a->getLoggedInUserId());
|
$owner = User::getOwnerDataById($a->getLoggedInUserId());
|
||||||
$item = $this->getData();
|
$item = $this->getData();
|
||||||
|
|
||||||
if (!empty($item['content-warning']) && Feature::isEnabled(local_user(), 'add_abstract')) {
|
if (!empty($item['content-warning']) && Feature::isEnabled(Session::getLocalUser(), 'add_abstract')) {
|
||||||
$text = '[abstract=' . Protocol::ACTIVITYPUB . ']' . $item['content-warning'] . "[/abstract]\n";
|
$text = '[abstract=' . Protocol::ACTIVITYPUB . ']' . $item['content-warning'] . "[/abstract]\n";
|
||||||
} else {
|
} else {
|
||||||
$text = '';
|
$text = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!Feature::isEnabled(local_user(), 'explicit_mentions')) {
|
if (!Feature::isEnabled(Session::getLocalUser(), 'explicit_mentions')) {
|
||||||
return $text;
|
return $text;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -958,7 +958,7 @@ class Post
|
||||||
*/
|
*/
|
||||||
$qcomment = null;
|
$qcomment = null;
|
||||||
if (Addon::isEnabled('qcomment')) {
|
if (Addon::isEnabled('qcomment')) {
|
||||||
$words = DI::pConfig()->get(local_user(), 'qcomment', 'words');
|
$words = DI::pConfig()->get(Session::getLocalUser(), 'qcomment', 'words');
|
||||||
$qcomment = $words ? explode("\n", $words) : [];
|
$qcomment = $words ? explode("\n", $words) : [];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -23,6 +23,7 @@ namespace Friendica\Object;
|
||||||
|
|
||||||
use Friendica\Core\Logger;
|
use Friendica\Core\Logger;
|
||||||
use Friendica\Core\Protocol;
|
use Friendica\Core\Protocol;
|
||||||
|
use Friendica\Core\Session;
|
||||||
use Friendica\DI;
|
use Friendica\DI;
|
||||||
use Friendica\Protocol\Activity;
|
use Friendica\Protocol\Activity;
|
||||||
use Friendica\Security\Security;
|
use Friendica\Security\Security;
|
||||||
|
@ -75,7 +76,7 @@ class Thread
|
||||||
switch ($mode) {
|
switch ($mode) {
|
||||||
case 'network':
|
case 'network':
|
||||||
case 'notes':
|
case 'notes':
|
||||||
$this->profile_owner = local_user();
|
$this->profile_owner = Session::getLocalUser();
|
||||||
$this->writable = true;
|
$this->writable = true;
|
||||||
break;
|
break;
|
||||||
case 'profile':
|
case 'profile':
|
||||||
|
@ -168,7 +169,7 @@ class Thread
|
||||||
/*
|
/*
|
||||||
* Only add will be displayed
|
* Only add will be displayed
|
||||||
*/
|
*/
|
||||||
if ($item->getDataValue('network') === Protocol::MAIL && local_user() != $item->getDataValue('uid')) {
|
if ($item->getDataValue('network') === Protocol::MAIL && Session::getLocalUser() != $item->getDataValue('uid')) {
|
||||||
Logger::info('[WARN] Conversation::addThread : Thread is a mail ('. $item->getId() .').');
|
Logger::info('[WARN] Conversation::addThread : Thread is a mail ('. $item->getId() .').');
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -201,7 +202,7 @@ class Thread
|
||||||
$result = [];
|
$result = [];
|
||||||
|
|
||||||
foreach ($this->parents as $item) {
|
foreach ($this->parents as $item) {
|
||||||
if ($item->getDataValue('network') === Protocol::MAIL && local_user() != $item->getDataValue('uid')) {
|
if ($item->getDataValue('network') === Protocol::MAIL && Session::getLocalUser() != $item->getDataValue('uid')) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -191,7 +191,7 @@ class BasicAuth
|
||||||
|
|
||||||
Hook::callAll('logged_in', $record);
|
Hook::callAll('logged_in', $record);
|
||||||
|
|
||||||
self::$current_user_id = local_user();
|
self::$current_user_id = Session::getLocalUser();
|
||||||
|
|
||||||
return self::$current_user_id;
|
return self::$current_user_id;
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,12 +40,12 @@ class Security
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
$uid = local_user();
|
$uid = Session::getLocalUser();
|
||||||
if ($uid == $owner) {
|
if ($uid == $owner) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (local_user() && ($owner == 0)) {
|
if (Session::getLocalUser() && ($owner == 0)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -93,7 +93,7 @@ class Security
|
||||||
*/
|
*/
|
||||||
public static function getPermissionsSQLByUserId(int $owner_id, bool $accessible = false)
|
public static function getPermissionsSQLByUserId(int $owner_id, bool $accessible = false)
|
||||||
{
|
{
|
||||||
$local_user = local_user();
|
$local_user = Session::getLocalUser();
|
||||||
$remote_contact = Session::getRemoteContactID($owner_id);
|
$remote_contact = Session::getRemoteContactID($owner_id);
|
||||||
$acc_sql = '';
|
$acc_sql = '';
|
||||||
|
|
||||||
|
|
|
@ -24,6 +24,7 @@ namespace Friendica\Util;
|
||||||
use DateTime;
|
use DateTime;
|
||||||
use DateTimeZone;
|
use DateTimeZone;
|
||||||
use Friendica\Core\Renderer;
|
use Friendica\Core\Renderer;
|
||||||
|
use Friendica\Core\Session;
|
||||||
use Friendica\Database\DBA;
|
use Friendica\Database\DBA;
|
||||||
use Friendica\DI;
|
use Friendica\DI;
|
||||||
|
|
||||||
|
@ -238,7 +239,7 @@ class Temporal
|
||||||
bool $required = false): string
|
bool $required = false): string
|
||||||
{
|
{
|
||||||
// First day of the week (0 = Sunday)
|
// First day of the week (0 = Sunday)
|
||||||
$firstDay = DI::pConfig()->get(local_user(), 'system', 'first_day_of_week', 0);
|
$firstDay = DI::pConfig()->get(Session::getLocalUser(), 'system', 'first_day_of_week', 0);
|
||||||
|
|
||||||
$lang = substr(DI::l10n()->getCurrentLang(), 0, 2);
|
$lang = substr(DI::l10n()->getCurrentLang(), 0, 2);
|
||||||
|
|
||||||
|
|
|
@ -1,19 +1,36 @@
|
||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* Theme settings
|
* @copyright Copyright (C) 2010-2022, the Friendica project
|
||||||
|
*
|
||||||
|
* @license GNU AGPL version 3 or any later version
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Affero General Public License as
|
||||||
|
* published by the Free Software Foundation, either version 3 of the
|
||||||
|
* License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU Affero General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Affero General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
use Friendica\App;
|
use Friendica\App;
|
||||||
use Friendica\Core\Renderer;
|
use Friendica\Core\Renderer;
|
||||||
|
use Friendica\Core\Session;
|
||||||
use Friendica\DI;
|
use Friendica\DI;
|
||||||
|
|
||||||
function theme_content(App $a)
|
function theme_content(App $a)
|
||||||
{
|
{
|
||||||
if (!local_user()) {
|
if (!Session::getLocalUser()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$colorset = DI::pConfig()->get(local_user(), 'duepuntozero', 'colorset');
|
$colorset = DI::pConfig()->get(Session::getLocalUser(), 'duepuntozero', 'colorset');
|
||||||
$user = true;
|
$user = true;
|
||||||
|
|
||||||
return clean_form($a, $colorset, $user);
|
return clean_form($a, $colorset, $user);
|
||||||
|
@ -21,12 +38,12 @@ function theme_content(App $a)
|
||||||
|
|
||||||
function theme_post(App $a)
|
function theme_post(App $a)
|
||||||
{
|
{
|
||||||
if (! local_user()) {
|
if (! Session::getLocalUser()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($_POST['duepuntozero-settings-submit'])) {
|
if (isset($_POST['duepuntozero-settings-submit'])) {
|
||||||
DI::pConfig()->set(local_user(), 'duepuntozero', 'colorset', $_POST['duepuntozero_colorset']);
|
DI::pConfig()->set(Session::getLocalUser(), 'duepuntozero', 'colorset', $_POST['duepuntozero_colorset']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -59,7 +76,7 @@ function clean_form(App $a, &$colorset, $user)
|
||||||
];
|
];
|
||||||
|
|
||||||
if ($user) {
|
if ($user) {
|
||||||
$color = DI::pConfig()->get(local_user(), 'duepuntozero', 'colorset');
|
$color = DI::pConfig()->get(Session::getLocalUser(), 'duepuntozero', 'colorset');
|
||||||
} else {
|
} else {
|
||||||
$color = DI::config()->get('duepuntozero', 'colorset');
|
$color = DI::config()->get('duepuntozero', 'colorset');
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,6 +21,7 @@
|
||||||
|
|
||||||
use Friendica\App;
|
use Friendica\App;
|
||||||
use Friendica\Core\Renderer;
|
use Friendica\Core\Renderer;
|
||||||
|
use Friendica\Core\Session;
|
||||||
use Friendica\DI;
|
use Friendica\DI;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -34,7 +35,7 @@ function duepuntozero_init(App $a) {
|
||||||
$colorset = null;
|
$colorset = null;
|
||||||
|
|
||||||
if (DI::mode()->has(App\Mode::MAINTENANCEDISABLED)) {
|
if (DI::mode()->has(App\Mode::MAINTENANCEDISABLED)) {
|
||||||
$colorset = DI::pConfig()->get(local_user(), 'duepuntozero', 'colorset');
|
$colorset = DI::pConfig()->get(Session::getLocalUser(), 'duepuntozero', 'colorset');
|
||||||
if (!$colorset)
|
if (!$colorset)
|
||||||
$colorset = DI::config()->get('duepuntozero', 'colorset'); // user setting have priority, then node settings
|
$colorset = DI::config()->get('duepuntozero', 'colorset'); // user setting have priority, then node settings
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,13 +21,14 @@
|
||||||
|
|
||||||
use Friendica\App;
|
use Friendica\App;
|
||||||
use Friendica\Core\Renderer;
|
use Friendica\Core\Renderer;
|
||||||
|
use Friendica\Core\Session;
|
||||||
use Friendica\DI;
|
use Friendica\DI;
|
||||||
|
|
||||||
require_once 'view/theme/frio/php/Image.php';
|
require_once 'view/theme/frio/php/Image.php';
|
||||||
|
|
||||||
function theme_post(App $a)
|
function theme_post(App $a)
|
||||||
{
|
{
|
||||||
if (!local_user()) {
|
if (!Session::getLocalUser()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -47,12 +48,12 @@ function theme_post(App $a)
|
||||||
'always_open_compose',
|
'always_open_compose',
|
||||||
] as $field) {
|
] as $field) {
|
||||||
if (isset($_POST['frio_' . $field])) {
|
if (isset($_POST['frio_' . $field])) {
|
||||||
DI::pConfig()->set(local_user(), 'frio', $field, $_POST['frio_' . $field]);
|
DI::pConfig()->set(Session::getLocalUser(), 'frio', $field, $_POST['frio_' . $field]);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
DI::pConfig()->set(local_user(), 'frio', 'css_modified', time());
|
DI::pConfig()->set(Session::getLocalUser(), 'frio', 'css_modified', time());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -88,13 +89,13 @@ function theme_admin_post(App $a)
|
||||||
|
|
||||||
function theme_content(): string
|
function theme_content(): string
|
||||||
{
|
{
|
||||||
if (!local_user()) {
|
if (!Session::getLocalUser()) {
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
$arr = [
|
$arr = [
|
||||||
'scheme' => DI::pConfig()->get(local_user(), 'frio', 'scheme',
|
'scheme' => DI::pConfig()->get(Session::getLocalUser(), 'frio', 'scheme',
|
||||||
DI::pConfig()->get(local_user(), 'frio', 'schema',
|
DI::pConfig()->get(Session::getLocalUser(), 'frio', 'schema',
|
||||||
DI::config()->get('frio', 'scheme',
|
DI::config()->get('frio', 'scheme',
|
||||||
DI::config()->get('frio', 'schema')
|
DI::config()->get('frio', 'schema')
|
||||||
)
|
)
|
||||||
|
@ -102,15 +103,15 @@ function theme_content(): string
|
||||||
),
|
),
|
||||||
|
|
||||||
'share_string' => '',
|
'share_string' => '',
|
||||||
'scheme_accent' => DI::pConfig()->get(local_user(), 'frio', 'scheme_accent' , DI::config()->get('frio', 'scheme_accent')),
|
'scheme_accent' => DI::pConfig()->get(Session::getLocalUser(), 'frio', 'scheme_accent' , DI::config()->get('frio', 'scheme_accent')),
|
||||||
'nav_bg' => DI::pConfig()->get(local_user(), 'frio', 'nav_bg' , DI::config()->get('frio', 'nav_bg')),
|
'nav_bg' => DI::pConfig()->get(Session::getLocalUser(), 'frio', 'nav_bg' , DI::config()->get('frio', 'nav_bg')),
|
||||||
'nav_icon_color' => DI::pConfig()->get(local_user(), 'frio', 'nav_icon_color' , DI::config()->get('frio', 'nav_icon_color')),
|
'nav_icon_color' => DI::pConfig()->get(Session::getLocalUser(), 'frio', 'nav_icon_color' , DI::config()->get('frio', 'nav_icon_color')),
|
||||||
'link_color' => DI::pConfig()->get(local_user(), 'frio', 'link_color' , DI::config()->get('frio', 'link_color')),
|
'link_color' => DI::pConfig()->get(Session::getLocalUser(), 'frio', 'link_color' , DI::config()->get('frio', 'link_color')),
|
||||||
'background_color' => DI::pConfig()->get(local_user(), 'frio', 'background_color' , DI::config()->get('frio', 'background_color')),
|
'background_color' => DI::pConfig()->get(Session::getLocalUser(), 'frio', 'background_color' , DI::config()->get('frio', 'background_color')),
|
||||||
'contentbg_transp' => DI::pConfig()->get(local_user(), 'frio', 'contentbg_transp' , DI::config()->get('frio', 'contentbg_transp')),
|
'contentbg_transp' => DI::pConfig()->get(Session::getLocalUser(), 'frio', 'contentbg_transp' , DI::config()->get('frio', 'contentbg_transp')),
|
||||||
'background_image' => DI::pConfig()->get(local_user(), 'frio', 'background_image' , DI::config()->get('frio', 'background_image')),
|
'background_image' => DI::pConfig()->get(Session::getLocalUser(), 'frio', 'background_image' , DI::config()->get('frio', 'background_image')),
|
||||||
'bg_image_option' => DI::pConfig()->get(local_user(), 'frio', 'bg_image_option' , DI::config()->get('frio', 'bg_image_option')),
|
'bg_image_option' => DI::pConfig()->get(Session::getLocalUser(), 'frio', 'bg_image_option' , DI::config()->get('frio', 'bg_image_option')),
|
||||||
'always_open_compose' => DI::pConfig()->get(local_user(), 'frio', 'always_open_compose', DI::config()->get('frio', 'always_open_compose', false)),
|
'always_open_compose' => DI::pConfig()->get(Session::getLocalUser(), 'frio', 'always_open_compose', DI::config()->get('frio', 'always_open_compose', false)),
|
||||||
];
|
];
|
||||||
|
|
||||||
return frio_form($arr);
|
return frio_form($arr);
|
||||||
|
@ -118,7 +119,7 @@ function theme_content(): string
|
||||||
|
|
||||||
function theme_admin(): string
|
function theme_admin(): string
|
||||||
{
|
{
|
||||||
if (!local_user()) {
|
if (!Session::getLocalUser()) {
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -34,6 +34,7 @@
|
||||||
* 'overwrites' => Variables which overwriting custom settings
|
* 'overwrites' => Variables which overwriting custom settings
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
use Friendica\Core\Session;
|
||||||
use Friendica\DI;
|
use Friendica\DI;
|
||||||
use Friendica\Util\Strings;
|
use Friendica\Util\Strings;
|
||||||
|
|
||||||
|
@ -42,7 +43,7 @@ function get_scheme_info($scheme)
|
||||||
$theme = DI::app()->getCurrentTheme();
|
$theme = DI::app()->getCurrentTheme();
|
||||||
$themepath = 'view/theme/' . $theme . '/';
|
$themepath = 'view/theme/' . $theme . '/';
|
||||||
if (empty($scheme)) {
|
if (empty($scheme)) {
|
||||||
$scheme = DI::pConfig()->get(local_user(), 'frio', 'scheme', DI::pConfig()->get(local_user(), 'frio', 'schema', '---'));
|
$scheme = DI::pConfig()->get(Session::getLocalUser(), 'frio', 'scheme', DI::pConfig()->get(Session::getLocalUser(), 'frio', 'schema', '---'));
|
||||||
}
|
}
|
||||||
|
|
||||||
$scheme = Strings::sanitizeFilePathItem($scheme);
|
$scheme = Strings::sanitizeFilePathItem($scheme);
|
||||||
|
|
|
@ -215,8 +215,8 @@ function frio_remote_nav(App $a, array &$nav_info)
|
||||||
$fields = ['id', 'url', 'avatar', 'micro', 'name', 'nick', 'baseurl', 'updated'];
|
$fields = ['id', 'url', 'avatar', 'micro', 'name', 'nick', 'baseurl', 'updated'];
|
||||||
if ($a->isLoggedIn()) {
|
if ($a->isLoggedIn()) {
|
||||||
$remoteUser = Contact::selectFirst($fields, ['uid' => $a->getLoggedInUserId(), 'self' => true]);
|
$remoteUser = Contact::selectFirst($fields, ['uid' => $a->getLoggedInUserId(), 'self' => true]);
|
||||||
} elseif (!local_user() && remote_user()) {
|
} elseif (!Session::getLocalUser() && Session::getRemoteUser()) {
|
||||||
$remoteUser = Contact::getById(remote_user(), $fields);
|
$remoteUser = Contact::getById(Session::getRemoteUser(), $fields);
|
||||||
$nav_info['nav']['remote'] = DI::l10n()->t('Guest');
|
$nav_info['nav']['remote'] = DI::l10n()->t('Guest');
|
||||||
} elseif (Profile::getMyURL()) {
|
} elseif (Profile::getMyURL()) {
|
||||||
$remoteUser = Contact::getByURL($homelink, null, $fields);
|
$remoteUser = Contact::getByURL($homelink, null, $fields);
|
||||||
|
@ -233,7 +233,7 @@ function frio_remote_nav(App $a, array &$nav_info)
|
||||||
$server_url = $remoteUser['baseurl'];
|
$server_url = $remoteUser['baseurl'];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!local_user() && !empty($server_url) && !is_null($remoteUser)) {
|
if (!Session::getLocalUser() && !empty($server_url) && !is_null($remoteUser)) {
|
||||||
// user menu
|
// user menu
|
||||||
$nav_info['nav']['usermenu'][] = [$server_url . '/profile/' . $remoteUser['nick'], DI::l10n()->t('Status'), '', DI::l10n()->t('Your posts and conversations')];
|
$nav_info['nav']['usermenu'][] = [$server_url . '/profile/' . $remoteUser['nick'], DI::l10n()->t('Status'), '', DI::l10n()->t('Your posts and conversations')];
|
||||||
$nav_info['nav']['usermenu'][] = [$server_url . '/profile/' . $remoteUser['nick'] . '/profile', DI::l10n()->t('Profile'), '', DI::l10n()->t('Your profile page')];
|
$nav_info['nav']['usermenu'][] = [$server_url . '/profile/' . $remoteUser['nick'] . '/profile', DI::l10n()->t('Profile'), '', DI::l10n()->t('Your profile page')];
|
||||||
|
@ -257,8 +257,8 @@ function frio_display_item(App $a, &$arr)
|
||||||
// Add follow to the item menu
|
// Add follow to the item menu
|
||||||
$followThread = [];
|
$followThread = [];
|
||||||
if (
|
if (
|
||||||
local_user()
|
Session::getLocalUser()
|
||||||
&& in_array($arr['item']['uid'], [0, local_user()])
|
&& in_array($arr['item']['uid'], [0, Session::getLocalUser()])
|
||||||
&& $arr['item']['gravity'] == Item::GRAVITY_PARENT
|
&& $arr['item']['gravity'] == Item::GRAVITY_PARENT
|
||||||
&& !$arr['item']['self']
|
&& !$arr['item']['self']
|
||||||
&& !$arr['item']['mention']
|
&& !$arr['item']['mention']
|
||||||
|
|
|
@ -1,35 +1,52 @@
|
||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* Theme settings
|
* @copyright Copyright (C) 2010-2022, the Friendica project
|
||||||
|
*
|
||||||
|
* @license GNU AGPL version 3 or any later version
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Affero General Public License as
|
||||||
|
* published by the Free Software Foundation, either version 3 of the
|
||||||
|
* License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU Affero General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Affero General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
use Friendica\App;
|
use Friendica\App;
|
||||||
use Friendica\Core\Renderer;
|
use Friendica\Core\Renderer;
|
||||||
|
use Friendica\Core\Session;
|
||||||
use Friendica\DI;
|
use Friendica\DI;
|
||||||
|
|
||||||
function theme_content(App $a) {
|
function theme_content(App $a) {
|
||||||
if (!local_user()) {
|
if (!Session::getLocalUser()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$align = DI::pConfig()->get(local_user(), 'quattro', 'align' );
|
$align = DI::pConfig()->get(Session::getLocalUser(), 'quattro', 'align' );
|
||||||
$color = DI::pConfig()->get(local_user(), 'quattro', 'color' );
|
$color = DI::pConfig()->get(Session::getLocalUser(), 'quattro', 'color' );
|
||||||
$tfs = DI::pConfig()->get(local_user(),"quattro","tfs");
|
$tfs = DI::pConfig()->get(Session::getLocalUser(),"quattro","tfs");
|
||||||
$pfs = DI::pConfig()->get(local_user(),"quattro","pfs");
|
$pfs = DI::pConfig()->get(Session::getLocalUser(),"quattro","pfs");
|
||||||
|
|
||||||
return quattro_form($a,$align, $color, $tfs, $pfs);
|
return quattro_form($a,$align, $color, $tfs, $pfs);
|
||||||
}
|
}
|
||||||
|
|
||||||
function theme_post(App $a) {
|
function theme_post(App $a) {
|
||||||
if (! local_user()) {
|
if (! Session::getLocalUser()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($_POST['quattro-settings-submit'])){
|
if (isset($_POST['quattro-settings-submit'])){
|
||||||
DI::pConfig()->set(local_user(), 'quattro', 'align', $_POST['quattro_align']);
|
DI::pConfig()->set(Session::getLocalUser(), 'quattro', 'align', $_POST['quattro_align']);
|
||||||
DI::pConfig()->set(local_user(), 'quattro', 'color', $_POST['quattro_color']);
|
DI::pConfig()->set(Session::getLocalUser(), 'quattro', 'color', $_POST['quattro_color']);
|
||||||
DI::pConfig()->set(local_user(), 'quattro', 'tfs', $_POST['quattro_tfs']);
|
DI::pConfig()->set(Session::getLocalUser(), 'quattro', 'tfs', $_POST['quattro_tfs']);
|
||||||
DI::pConfig()->set(local_user(), 'quattro', 'pfs', $_POST['quattro_pfs']);
|
DI::pConfig()->set(Session::getLocalUser(), 'quattro', 'pfs', $_POST['quattro_pfs']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,17 +1,34 @@
|
||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* Theme settings
|
* @copyright Copyright (C) 2010-2022, the Friendica project
|
||||||
|
*
|
||||||
|
* @license GNU AGPL version 3 or any later version
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Affero General Public License as
|
||||||
|
* published by the Free Software Foundation, either version 3 of the
|
||||||
|
* License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU Affero General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Affero General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
use Friendica\App;
|
use Friendica\App;
|
||||||
use Friendica\Core\Renderer;
|
use Friendica\Core\Renderer;
|
||||||
|
use Friendica\Core\Session;
|
||||||
use Friendica\DI;
|
use Friendica\DI;
|
||||||
|
|
||||||
require_once __DIR__ . '/theme.php';
|
require_once __DIR__ . '/theme.php';
|
||||||
|
|
||||||
function theme_content(App $a)
|
function theme_content(App $a)
|
||||||
{
|
{
|
||||||
if (!local_user()) {
|
if (!Session::getLocalUser()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -19,7 +36,7 @@ function theme_content(App $a)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$style = DI::pConfig()->get(local_user(), 'vier', 'style');
|
$style = DI::pConfig()->get(Session::getLocalUser(), 'vier', 'style');
|
||||||
|
|
||||||
if ($style == "") {
|
if ($style == "") {
|
||||||
$style = DI::config()->get('vier', 'style');
|
$style = DI::config()->get('vier', 'style');
|
||||||
|
@ -42,18 +59,18 @@ function theme_content(App $a)
|
||||||
|
|
||||||
function theme_post(App $a)
|
function theme_post(App $a)
|
||||||
{
|
{
|
||||||
if (! local_user()) {
|
if (! Session::getLocalUser()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($_POST['vier-settings-submit'])) {
|
if (isset($_POST['vier-settings-submit'])) {
|
||||||
DI::pConfig()->set(local_user(), 'vier', 'style', $_POST['vier_style']);
|
DI::pConfig()->set(Session::getLocalUser(), 'vier', 'style', $_POST['vier_style']);
|
||||||
DI::pConfig()->set(local_user(), 'vier', 'show_pages', $_POST['vier_show_pages']);
|
DI::pConfig()->set(Session::getLocalUser(), 'vier', 'show_pages', $_POST['vier_show_pages']);
|
||||||
DI::pConfig()->set(local_user(), 'vier', 'show_profiles', $_POST['vier_show_profiles']);
|
DI::pConfig()->set(Session::getLocalUser(), 'vier', 'show_profiles', $_POST['vier_show_profiles']);
|
||||||
DI::pConfig()->set(local_user(), 'vier', 'show_helpers', $_POST['vier_show_helpers']);
|
DI::pConfig()->set(Session::getLocalUser(), 'vier', 'show_helpers', $_POST['vier_show_helpers']);
|
||||||
DI::pConfig()->set(local_user(), 'vier', 'show_services', $_POST['vier_show_services']);
|
DI::pConfig()->set(Session::getLocalUser(), 'vier', 'show_services', $_POST['vier_show_services']);
|
||||||
DI::pConfig()->set(local_user(), 'vier', 'show_friends', $_POST['vier_show_friends']);
|
DI::pConfig()->set(Session::getLocalUser(), 'vier', 'show_friends', $_POST['vier_show_friends']);
|
||||||
DI::pConfig()->set(local_user(), 'vier', 'show_lastusers', $_POST['vier_show_lastusers']);
|
DI::pConfig()->set(Session::getLocalUser(), 'vier', 'show_lastusers', $_POST['vier_show_lastusers']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,22 @@
|
||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
|
* @copyright Copyright (C) 2010-2022, the Friendica project
|
||||||
|
*
|
||||||
|
* @license GNU AGPL version 3 or any later version
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Affero General Public License as
|
||||||
|
* published by the Free Software Foundation, either version 3 of the
|
||||||
|
* License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU Affero General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Affero General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
* Name: Vier
|
* Name: Vier
|
||||||
* Version: 1.2
|
* Version: 1.2
|
||||||
* Author: Fabio <http://kirgroup.com/profile/fabrixxm>
|
* Author: Fabio <http://kirgroup.com/profile/fabrixxm>
|
||||||
|
@ -14,6 +31,7 @@ use Friendica\Content\ForumManager;
|
||||||
use Friendica\Core\Addon;
|
use Friendica\Core\Addon;
|
||||||
use Friendica\Core\Renderer;
|
use Friendica\Core\Renderer;
|
||||||
use Friendica\Core\Search;
|
use Friendica\Core\Search;
|
||||||
|
use Friendica\Core\Session;
|
||||||
use Friendica\Database\DBA;
|
use Friendica\Database\DBA;
|
||||||
use Friendica\DI;
|
use Friendica\DI;
|
||||||
use Friendica\Model\Contact;
|
use Friendica\Model\Contact;
|
||||||
|
@ -35,7 +53,7 @@ function vier_init(App $a)
|
||||||
DI::mode()->has(App\Mode::MAINTENANCEDISABLED)
|
DI::mode()->has(App\Mode::MAINTENANCEDISABLED)
|
||||||
&& (
|
&& (
|
||||||
$args->get(0) === 'profile' && $args->get(1) === ($a->getLoggedInUserNickname() ?? '')
|
$args->get(0) === 'profile' && $args->get(1) === ($a->getLoggedInUserNickname() ?? '')
|
||||||
|| $args->get(0) === 'network' && local_user()
|
|| $args->get(0) === 'network' && Session::getLocalUser()
|
||||||
)
|
)
|
||||||
) {
|
) {
|
||||||
vier_community_info();
|
vier_community_info();
|
||||||
|
@ -97,8 +115,8 @@ EOT;
|
||||||
|
|
||||||
function get_vier_config($key, $default = false, $admin = false)
|
function get_vier_config($key, $default = false, $admin = false)
|
||||||
{
|
{
|
||||||
if (local_user() && !$admin) {
|
if (Session::getLocalUser() && !$admin) {
|
||||||
$result = DI::pConfig()->get(local_user(), "vier", $key);
|
$result = DI::pConfig()->get(Session::getLocalUser(), "vier", $key);
|
||||||
if (!is_null($result)) {
|
if (!is_null($result)) {
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
@ -127,7 +145,7 @@ function vier_community_info()
|
||||||
|
|
||||||
// comunity_profiles
|
// comunity_profiles
|
||||||
if ($show_profiles) {
|
if ($show_profiles) {
|
||||||
$contacts = Contact\Relation::getSuggestions(local_user(), 0, 9);
|
$contacts = Contact\Relation::getSuggestions(Session::getLocalUser(), 0, 9);
|
||||||
|
|
||||||
$tpl = Renderer::getMarkupTemplate('ch_directory_item.tpl');
|
$tpl = Renderer::getMarkupTemplate('ch_directory_item.tpl');
|
||||||
if (DBA::isResult($contacts)) {
|
if (DBA::isResult($contacts)) {
|
||||||
|
@ -174,7 +192,7 @@ function vier_community_info()
|
||||||
}
|
}
|
||||||
|
|
||||||
//right_aside FIND FRIENDS
|
//right_aside FIND FRIENDS
|
||||||
if ($show_friends && local_user()) {
|
if ($show_friends && Session::getLocalUser()) {
|
||||||
$nv = [];
|
$nv = [];
|
||||||
$nv['findpeople'] = DI::l10n()->t('Find People');
|
$nv['findpeople'] = DI::l10n()->t('Find People');
|
||||||
$nv['desc'] = DI::l10n()->t('Enter name or interest');
|
$nv['desc'] = DI::l10n()->t('Enter name or interest');
|
||||||
|
@ -193,8 +211,8 @@ function vier_community_info()
|
||||||
}
|
}
|
||||||
|
|
||||||
//Community_Pages at right_aside
|
//Community_Pages at right_aside
|
||||||
if ($show_pages && local_user()) {
|
if ($show_pages && Session::getLocalUser()) {
|
||||||
$aside['$page'] = ForumManager::widget('network/forum', local_user());;
|
$aside['$page'] = ForumManager::widget('network/forum', Session::getLocalUser());;
|
||||||
}
|
}
|
||||||
// END Community Page
|
// END Community Page
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue