friendica/src/Module/BaseSettings.php

137 lines
4.0 KiB
PHP
Raw Normal View History

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