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