old boot.php functions replaced in various places
This commit is contained in:
parent
c54bfd423a
commit
11944dda32
20 changed files with 183 additions and 105 deletions
|
@ -1,19 +1,36 @@
|
|||
<?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\Core\Renderer;
|
||||
use Friendica\Core\Session;
|
||||
use Friendica\DI;
|
||||
|
||||
function theme_content(App $a)
|
||||
{
|
||||
if (!local_user()) {
|
||||
if (!Session::getLocalUser()) {
|
||||
return;
|
||||
}
|
||||
|
||||
$colorset = DI::pConfig()->get(local_user(), 'duepuntozero', 'colorset');
|
||||
$colorset = DI::pConfig()->get(Session::getLocalUser(), 'duepuntozero', 'colorset');
|
||||
$user = true;
|
||||
|
||||
return clean_form($a, $colorset, $user);
|
||||
|
@ -21,12 +38,12 @@ function theme_content(App $a)
|
|||
|
||||
function theme_post(App $a)
|
||||
{
|
||||
if (! local_user()) {
|
||||
if (! Session::getLocalUser()) {
|
||||
return;
|
||||
}
|
||||
|
||||
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) {
|
||||
$color = DI::pConfig()->get(local_user(), 'duepuntozero', 'colorset');
|
||||
$color = DI::pConfig()->get(Session::getLocalUser(), 'duepuntozero', 'colorset');
|
||||
} else {
|
||||
$color = DI::config()->get('duepuntozero', 'colorset');
|
||||
}
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
|
||||
use Friendica\App;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\Core\Session;
|
||||
use Friendica\DI;
|
||||
|
||||
/*
|
||||
|
@ -34,7 +35,7 @@ function duepuntozero_init(App $a) {
|
|||
$colorset = null;
|
||||
|
||||
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)
|
||||
$colorset = DI::config()->get('duepuntozero', 'colorset'); // user setting have priority, then node settings
|
||||
}
|
||||
|
|
|
@ -21,13 +21,14 @@
|
|||
|
||||
use Friendica\App;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\Core\Session;
|
||||
use Friendica\DI;
|
||||
|
||||
require_once 'view/theme/frio/php/Image.php';
|
||||
|
||||
function theme_post(App $a)
|
||||
{
|
||||
if (!local_user()) {
|
||||
if (!Session::getLocalUser()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -47,12 +48,12 @@ function theme_post(App $a)
|
|||
'always_open_compose',
|
||||
] as $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
|
||||
{
|
||||
if (!local_user()) {
|
||||
if (!Session::getLocalUser()) {
|
||||
return '';
|
||||
}
|
||||
|
||||
$arr = [
|
||||
'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',
|
||||
DI::config()->get('frio', 'scheme',
|
||||
DI::config()->get('frio', 'schema')
|
||||
)
|
||||
|
@ -102,15 +103,15 @@ function theme_content(): string
|
|||
),
|
||||
|
||||
'share_string' => '',
|
||||
'scheme_accent' => DI::pConfig()->get(local_user(), '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_icon_color' => DI::pConfig()->get(local_user(), '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')),
|
||||
'background_color' => DI::pConfig()->get(local_user(), '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')),
|
||||
'background_image' => DI::pConfig()->get(local_user(), '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')),
|
||||
'always_open_compose' => DI::pConfig()->get(local_user(), 'frio', 'always_open_compose', DI::config()->get('frio', 'always_open_compose', false)),
|
||||
'scheme_accent' => DI::pConfig()->get(Session::getLocalUser(), 'frio', 'scheme_accent' , DI::config()->get('frio', 'scheme_accent')),
|
||||
'nav_bg' => DI::pConfig()->get(Session::getLocalUser(), 'frio', 'nav_bg' , DI::config()->get('frio', 'nav_bg')),
|
||||
'nav_icon_color' => DI::pConfig()->get(Session::getLocalUser(), 'frio', 'nav_icon_color' , DI::config()->get('frio', 'nav_icon_color')),
|
||||
'link_color' => DI::pConfig()->get(Session::getLocalUser(), 'frio', 'link_color' , DI::config()->get('frio', 'link_color')),
|
||||
'background_color' => DI::pConfig()->get(Session::getLocalUser(), 'frio', 'background_color' , DI::config()->get('frio', 'background_color')),
|
||||
'contentbg_transp' => DI::pConfig()->get(Session::getLocalUser(), 'frio', 'contentbg_transp' , DI::config()->get('frio', 'contentbg_transp')),
|
||||
'background_image' => DI::pConfig()->get(Session::getLocalUser(), 'frio', 'background_image' , DI::config()->get('frio', 'background_image')),
|
||||
'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(Session::getLocalUser(), 'frio', 'always_open_compose', DI::config()->get('frio', 'always_open_compose', false)),
|
||||
];
|
||||
|
||||
return frio_form($arr);
|
||||
|
@ -118,7 +119,7 @@ function theme_content(): string
|
|||
|
||||
function theme_admin(): string
|
||||
{
|
||||
if (!local_user()) {
|
||||
if (!Session::getLocalUser()) {
|
||||
return '';
|
||||
}
|
||||
|
||||
|
|
|
@ -34,6 +34,7 @@
|
|||
* 'overwrites' => Variables which overwriting custom settings
|
||||
*/
|
||||
|
||||
use Friendica\Core\Session;
|
||||
use Friendica\DI;
|
||||
use Friendica\Util\Strings;
|
||||
|
||||
|
@ -42,7 +43,7 @@ function get_scheme_info($scheme)
|
|||
$theme = DI::app()->getCurrentTheme();
|
||||
$themepath = 'view/theme/' . $theme . '/';
|
||||
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);
|
||||
|
|
|
@ -215,8 +215,8 @@ function frio_remote_nav(App $a, array &$nav_info)
|
|||
$fields = ['id', 'url', 'avatar', 'micro', 'name', 'nick', 'baseurl', 'updated'];
|
||||
if ($a->isLoggedIn()) {
|
||||
$remoteUser = Contact::selectFirst($fields, ['uid' => $a->getLoggedInUserId(), 'self' => true]);
|
||||
} elseif (!local_user() && remote_user()) {
|
||||
$remoteUser = Contact::getById(remote_user(), $fields);
|
||||
} elseif (!Session::getLocalUser() && Session::getRemoteUser()) {
|
||||
$remoteUser = Contact::getById(Session::getRemoteUser(), $fields);
|
||||
$nav_info['nav']['remote'] = DI::l10n()->t('Guest');
|
||||
} elseif (Profile::getMyURL()) {
|
||||
$remoteUser = Contact::getByURL($homelink, null, $fields);
|
||||
|
@ -233,7 +233,7 @@ function frio_remote_nav(App $a, array &$nav_info)
|
|||
$server_url = $remoteUser['baseurl'];
|
||||
}
|
||||
|
||||
if (!local_user() && !empty($server_url) && !is_null($remoteUser)) {
|
||||
if (!Session::getLocalUser() && !empty($server_url) && !is_null($remoteUser)) {
|
||||
// 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'] . '/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
|
||||
$followThread = [];
|
||||
if (
|
||||
local_user()
|
||||
&& in_array($arr['item']['uid'], [0, local_user()])
|
||||
Session::getLocalUser()
|
||||
&& in_array($arr['item']['uid'], [0, Session::getLocalUser()])
|
||||
&& $arr['item']['gravity'] == Item::GRAVITY_PARENT
|
||||
&& !$arr['item']['self']
|
||||
&& !$arr['item']['mention']
|
||||
|
|
|
@ -1,35 +1,52 @@
|
|||
<?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\Core\Renderer;
|
||||
use Friendica\Core\Session;
|
||||
use Friendica\DI;
|
||||
|
||||
function theme_content(App $a) {
|
||||
if (!local_user()) {
|
||||
if (!Session::getLocalUser()) {
|
||||
return;
|
||||
}
|
||||
|
||||
$align = DI::pConfig()->get(local_user(), 'quattro', 'align' );
|
||||
$color = DI::pConfig()->get(local_user(), 'quattro', 'color' );
|
||||
$tfs = DI::pConfig()->get(local_user(),"quattro","tfs");
|
||||
$pfs = DI::pConfig()->get(local_user(),"quattro","pfs");
|
||||
$align = DI::pConfig()->get(Session::getLocalUser(), 'quattro', 'align' );
|
||||
$color = DI::pConfig()->get(Session::getLocalUser(), 'quattro', 'color' );
|
||||
$tfs = DI::pConfig()->get(Session::getLocalUser(),"quattro","tfs");
|
||||
$pfs = DI::pConfig()->get(Session::getLocalUser(),"quattro","pfs");
|
||||
|
||||
return quattro_form($a,$align, $color, $tfs, $pfs);
|
||||
}
|
||||
|
||||
function theme_post(App $a) {
|
||||
if (! local_user()) {
|
||||
if (! Session::getLocalUser()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (isset($_POST['quattro-settings-submit'])){
|
||||
DI::pConfig()->set(local_user(), 'quattro', 'align', $_POST['quattro_align']);
|
||||
DI::pConfig()->set(local_user(), 'quattro', 'color', $_POST['quattro_color']);
|
||||
DI::pConfig()->set(local_user(), 'quattro', 'tfs', $_POST['quattro_tfs']);
|
||||
DI::pConfig()->set(local_user(), 'quattro', 'pfs', $_POST['quattro_pfs']);
|
||||
DI::pConfig()->set(Session::getLocalUser(), 'quattro', 'align', $_POST['quattro_align']);
|
||||
DI::pConfig()->set(Session::getLocalUser(), 'quattro', 'color', $_POST['quattro_color']);
|
||||
DI::pConfig()->set(Session::getLocalUser(), 'quattro', 'tfs', $_POST['quattro_tfs']);
|
||||
DI::pConfig()->set(Session::getLocalUser(), 'quattro', 'pfs', $_POST['quattro_pfs']);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,17 +1,34 @@
|
|||
<?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\Core\Renderer;
|
||||
use Friendica\Core\Session;
|
||||
use Friendica\DI;
|
||||
|
||||
require_once __DIR__ . '/theme.php';
|
||||
|
||||
function theme_content(App $a)
|
||||
{
|
||||
if (!local_user()) {
|
||||
if (!Session::getLocalUser()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -19,7 +36,7 @@ function theme_content(App $a)
|
|||
return;
|
||||
}
|
||||
|
||||
$style = DI::pConfig()->get(local_user(), 'vier', 'style');
|
||||
$style = DI::pConfig()->get(Session::getLocalUser(), 'vier', 'style');
|
||||
|
||||
if ($style == "") {
|
||||
$style = DI::config()->get('vier', 'style');
|
||||
|
@ -42,18 +59,18 @@ function theme_content(App $a)
|
|||
|
||||
function theme_post(App $a)
|
||||
{
|
||||
if (! local_user()) {
|
||||
if (! Session::getLocalUser()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (isset($_POST['vier-settings-submit'])) {
|
||||
DI::pConfig()->set(local_user(), 'vier', 'style', $_POST['vier_style']);
|
||||
DI::pConfig()->set(local_user(), 'vier', 'show_pages', $_POST['vier_show_pages']);
|
||||
DI::pConfig()->set(local_user(), 'vier', 'show_profiles', $_POST['vier_show_profiles']);
|
||||
DI::pConfig()->set(local_user(), 'vier', 'show_helpers', $_POST['vier_show_helpers']);
|
||||
DI::pConfig()->set(local_user(), 'vier', 'show_services', $_POST['vier_show_services']);
|
||||
DI::pConfig()->set(local_user(), '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', 'style', $_POST['vier_style']);
|
||||
DI::pConfig()->set(Session::getLocalUser(), 'vier', 'show_pages', $_POST['vier_show_pages']);
|
||||
DI::pConfig()->set(Session::getLocalUser(), 'vier', 'show_profiles', $_POST['vier_show_profiles']);
|
||||
DI::pConfig()->set(Session::getLocalUser(), 'vier', 'show_helpers', $_POST['vier_show_helpers']);
|
||||
DI::pConfig()->set(Session::getLocalUser(), 'vier', 'show_services', $_POST['vier_show_services']);
|
||||
DI::pConfig()->set(Session::getLocalUser(), 'vier', 'show_friends', $_POST['vier_show_friends']);
|
||||
DI::pConfig()->set(Session::getLocalUser(), 'vier', 'show_lastusers', $_POST['vier_show_lastusers']);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,22 @@
|
|||
<?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
|
||||
* Version: 1.2
|
||||
* Author: Fabio <http://kirgroup.com/profile/fabrixxm>
|
||||
|
@ -14,6 +31,7 @@ use Friendica\Content\ForumManager;
|
|||
use Friendica\Core\Addon;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\Core\Search;
|
||||
use Friendica\Core\Session;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\DI;
|
||||
use Friendica\Model\Contact;
|
||||
|
@ -35,7 +53,7 @@ function vier_init(App $a)
|
|||
DI::mode()->has(App\Mode::MAINTENANCEDISABLED)
|
||||
&& (
|
||||
$args->get(0) === 'profile' && $args->get(1) === ($a->getLoggedInUserNickname() ?? '')
|
||||
|| $args->get(0) === 'network' && local_user()
|
||||
|| $args->get(0) === 'network' && Session::getLocalUser()
|
||||
)
|
||||
) {
|
||||
vier_community_info();
|
||||
|
@ -97,8 +115,8 @@ EOT;
|
|||
|
||||
function get_vier_config($key, $default = false, $admin = false)
|
||||
{
|
||||
if (local_user() && !$admin) {
|
||||
$result = DI::pConfig()->get(local_user(), "vier", $key);
|
||||
if (Session::getLocalUser() && !$admin) {
|
||||
$result = DI::pConfig()->get(Session::getLocalUser(), "vier", $key);
|
||||
if (!is_null($result)) {
|
||||
return $result;
|
||||
}
|
||||
|
@ -127,7 +145,7 @@ function vier_community_info()
|
|||
|
||||
// comunity_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');
|
||||
if (DBA::isResult($contacts)) {
|
||||
|
@ -174,7 +192,7 @@ function vier_community_info()
|
|||
}
|
||||
|
||||
//right_aside FIND FRIENDS
|
||||
if ($show_friends && local_user()) {
|
||||
if ($show_friends && Session::getLocalUser()) {
|
||||
$nv = [];
|
||||
$nv['findpeople'] = DI::l10n()->t('Find People');
|
||||
$nv['desc'] = DI::l10n()->t('Enter name or interest');
|
||||
|
@ -193,8 +211,8 @@ function vier_community_info()
|
|||
}
|
||||
|
||||
//Community_Pages at right_aside
|
||||
if ($show_pages && local_user()) {
|
||||
$aside['$page'] = ForumManager::widget('network/forum', local_user());;
|
||||
if ($show_pages && Session::getLocalUser()) {
|
||||
$aside['$page'] = ForumManager::widget('network/forum', Session::getLocalUser());;
|
||||
}
|
||||
// END Community Page
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue