2019-05-13 01:38:15 -04:00
|
|
|
<?php
|
2020-02-09 09:45:36 -05:00
|
|
|
/**
|
2022-01-02 02:27:47 -05:00
|
|
|
* @copyright Copyright (C) 2010-2022, the Friendica project
|
2020-02-09 09:45:36 -05:00
|
|
|
*
|
|
|
|
* @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/>.
|
|
|
|
*
|
|
|
|
*/
|
2019-05-13 01:38:15 -04:00
|
|
|
|
|
|
|
namespace Friendica\Module;
|
|
|
|
|
|
|
|
use Friendica\BaseModule;
|
|
|
|
use Friendica\Content\Feature;
|
|
|
|
use Friendica\Core\Renderer;
|
2019-12-15 16:34:11 -05:00
|
|
|
use Friendica\DI;
|
2019-05-13 01:38:15 -04:00
|
|
|
|
2020-01-22 23:14:14 -05:00
|
|
|
class BaseSettings extends BaseModule
|
2019-05-13 01:38:15 -04:00
|
|
|
{
|
2021-11-21 14:06:36 -05:00
|
|
|
public static function createAside()
|
2019-05-13 01:38:15 -04:00
|
|
|
{
|
|
|
|
$tpl = Renderer::getMarkupTemplate('settings/head.tpl');
|
2019-12-30 14:02:09 -05:00
|
|
|
DI::page()['htmlhead'] .= Renderer::replaceMacros($tpl, [
|
2020-01-18 14:52:34 -05:00
|
|
|
'$ispublic' => DI::l10n()->t('everybody')
|
2019-05-13 01:38:15 -04:00
|
|
|
]);
|
|
|
|
|
|
|
|
$tabs = [];
|
|
|
|
|
|
|
|
$tabs[] = [
|
2020-01-18 14:52:34 -05:00
|
|
|
'label' => DI::l10n()->t('Account'),
|
2019-05-13 01:38:15 -04:00
|
|
|
'url' => 'settings',
|
2021-07-25 11:23:37 -04:00
|
|
|
'selected' => ((DI::args()->getArgc() == 1) && (DI::args()->getArgv() === 'settings') ? 'active' : ''),
|
2019-05-13 01:38:15 -04:00
|
|
|
'accesskey' => 'o',
|
|
|
|
];
|
|
|
|
|
|
|
|
$tabs[] = [
|
2020-01-18 14:52:34 -05:00
|
|
|
'label' => DI::l10n()->t('Two-factor authentication'),
|
2019-05-13 01:38:15 -04:00
|
|
|
'url' => 'settings/2fa',
|
2021-07-25 11:23:37 -04:00
|
|
|
'selected' => ((DI::args()->getArgc() > 1) && (DI::args()->getArgv()[1] === '2fa') ? 'active' : ''),
|
2022-06-19 00:30:00 -04:00
|
|
|
'accesskey' => '2',
|
2019-05-13 01:38:15 -04:00
|
|
|
];
|
|
|
|
|
|
|
|
$tabs[] = [
|
2019-10-27 10:08:14 -04:00
|
|
|
'label' => DI::l10n()->t('Profile'),
|
|
|
|
'url' => 'settings/profile',
|
2021-07-25 11:23:37 -04:00
|
|
|
'selected' => ((DI::args()->getArgc() > 1) && (DI::args()->getArgv()[1] === 'profile') ? 'active' : ''),
|
2019-05-13 01:38:15 -04:00
|
|
|
'accesskey' => 'p',
|
|
|
|
];
|
|
|
|
|
|
|
|
if (Feature::get()) {
|
|
|
|
$tabs[] = [
|
2020-01-18 14:52:34 -05:00
|
|
|
'label' => DI::l10n()->t('Additional features'),
|
2019-05-13 01:38:15 -04:00
|
|
|
'url' => 'settings/features',
|
2021-07-25 11:23:37 -04:00
|
|
|
'selected' => ((DI::args()->getArgc() > 1) && (DI::args()->getArgv()[1] === 'features') ? 'active' : ''),
|
2019-05-13 01:38:15 -04:00
|
|
|
'accesskey' => 't',
|
|
|
|
];
|
|
|
|
}
|
|
|
|
|
|
|
|
$tabs[] = [
|
2020-01-18 14:52:34 -05:00
|
|
|
'label' => DI::l10n()->t('Display'),
|
2019-05-13 01:38:15 -04:00
|
|
|
'url' => 'settings/display',
|
2021-07-25 11:23:37 -04:00
|
|
|
'selected' => ((DI::args()->getArgc() > 1) && (DI::args()->getArgv()[1] === 'display') ? 'active' : ''),
|
2019-05-13 01:38:15 -04:00
|
|
|
'accesskey' => 'i',
|
|
|
|
];
|
|
|
|
|
|
|
|
$tabs[] = [
|
2020-01-18 14:52:34 -05:00
|
|
|
'label' => DI::l10n()->t('Social Networks'),
|
2019-05-13 01:38:15 -04:00
|
|
|
'url' => 'settings/connectors',
|
2021-07-25 11:23:37 -04:00
|
|
|
'selected' => ((DI::args()->getArgc() > 1) && (DI::args()->getArgv()[1] === 'connectors') ? 'active' : ''),
|
2019-05-13 01:38:15 -04:00
|
|
|
'accesskey' => 'w',
|
|
|
|
];
|
|
|
|
|
|
|
|
$tabs[] = [
|
2020-01-18 14:52:34 -05:00
|
|
|
'label' => DI::l10n()->t('Addons'),
|
2019-05-13 01:38:15 -04:00
|
|
|
'url' => 'settings/addon',
|
2021-07-25 11:23:37 -04:00
|
|
|
'selected' => ((DI::args()->getArgc() > 1) && (DI::args()->getArgv()[1] === 'addon') ? 'active' : ''),
|
2019-05-13 01:38:15 -04:00
|
|
|
'accesskey' => 'l',
|
|
|
|
];
|
|
|
|
|
|
|
|
$tabs[] = [
|
2020-02-19 02:09:29 -05:00
|
|
|
'label' => DI::l10n()->t('Manage Accounts'),
|
2019-10-09 22:17:09 -04:00
|
|
|
'url' => 'settings/delegation',
|
2021-07-25 11:23:37 -04:00
|
|
|
'selected' => ((DI::args()->getArgc() > 1) && (DI::args()->getArgv()[1] === 'delegation') ? 'active' : ''),
|
2019-05-13 01:38:15 -04:00
|
|
|
'accesskey' => 'd',
|
|
|
|
];
|
|
|
|
|
|
|
|
$tabs[] = [
|
2020-01-18 14:52:34 -05:00
|
|
|
'label' => DI::l10n()->t('Connected apps'),
|
2019-05-13 01:38:15 -04:00
|
|
|
'url' => 'settings/oauth',
|
2021-07-25 11:23:37 -04:00
|
|
|
'selected' => ((DI::args()->getArgc() > 1) && (DI::args()->getArgv()[1] === 'oauth') ? 'active' : ''),
|
2019-05-13 01:38:15 -04:00
|
|
|
'accesskey' => 'b',
|
|
|
|
];
|
|
|
|
|
|
|
|
$tabs[] = [
|
2020-01-18 14:52:34 -05:00
|
|
|
'label' => DI::l10n()->t('Export personal data'),
|
2019-11-02 07:44:46 -04:00
|
|
|
'url' => 'settings/userexport',
|
2021-07-25 11:23:37 -04:00
|
|
|
'selected' => ((DI::args()->getArgc() > 1) && (DI::args()->getArgv()[1] === 'userexport') ? 'active' : ''),
|
2019-05-13 01:38:15 -04:00
|
|
|
'accesskey' => 'e',
|
|
|
|
];
|
|
|
|
|
|
|
|
$tabs[] = [
|
2020-01-18 14:52:34 -05:00
|
|
|
'label' => DI::l10n()->t('Remove account'),
|
2022-11-07 23:58:21 -05:00
|
|
|
'url' => 'settings/removeme',
|
|
|
|
'selected' => static::class === Settings\RemoveMe::class ? 'active' : '',
|
2019-05-13 01:38:15 -04:00
|
|
|
'accesskey' => 'r',
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
|
|
$tabtpl = Renderer::getMarkupTemplate("generic_links_widget.tpl");
|
2019-12-30 14:02:09 -05:00
|
|
|
DI::page()['aside'] = Renderer::replaceMacros($tabtpl, [
|
2020-01-18 14:52:34 -05:00
|
|
|
'$title' => DI::l10n()->t('Settings'),
|
2019-05-13 01:38:15 -04:00
|
|
|
'$class' => 'settings-widget',
|
|
|
|
'$items' => $tabs,
|
|
|
|
]);
|
2021-11-21 14:06:36 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
protected function content(array $request = []): string
|
|
|
|
{
|
|
|
|
$a = DI::app();
|
|
|
|
|
|
|
|
static::createAside();
|
2021-11-14 17:13:47 -05:00
|
|
|
|
|
|
|
return '';
|
2019-05-13 01:38:15 -04:00
|
|
|
}
|
|
|
|
}
|