mirror of
https://github.com/friendica/friendica
synced 2024-12-22 18:00:16 +00:00
Use router parameters in Admin modules
- Remove 10 @TODO tags # Conflicts: # src/Module/Admin/DBSync.php # src/Module/Admin/Themes/Details.php # src/Module/Admin/Themes/Embed.php
This commit is contained in:
parent
98eb53c20f
commit
2ce15cae1a
8 changed files with 427 additions and 501 deletions
|
@ -34,24 +34,20 @@ class Details extends BaseAdmin
|
|||
{
|
||||
parent::post($parameters);
|
||||
|
||||
$a = DI::app();
|
||||
$addon = Strings::sanitizeFilePathItem($parameters['addon']);
|
||||
|
||||
if ($a->argc > 2) {
|
||||
// @TODO: Replace with parameter from router
|
||||
$addon = $a->argv[2];
|
||||
$addon = Strings::sanitizeFilePathItem($addon);
|
||||
if (is_file('addon/' . $addon . '/' . $addon . '.php')) {
|
||||
include_once 'addon/' . $addon . '/' . $addon . '.php';
|
||||
if (function_exists($addon . '_addon_admin_post')) {
|
||||
$func = $addon . '_addon_admin_post';
|
||||
$func($a);
|
||||
}
|
||||
$redirect = 'admin/addons/' . $addon;
|
||||
|
||||
DI::baseUrl()->redirect('admin/addons/' . $addon);
|
||||
if (is_file('addon/' . $addon . '/' . $addon . '.php')) {
|
||||
include_once 'addon/' . $addon . '/' . $addon . '.php';
|
||||
|
||||
if (function_exists($addon . '_addon_admin_post')) {
|
||||
$func = $addon . '_addon_admin_post';
|
||||
$func(DI::app());
|
||||
}
|
||||
}
|
||||
|
||||
DI::baseUrl()->redirect('admin/addons');
|
||||
DI::baseUrl()->redirect($redirect);
|
||||
}
|
||||
|
||||
public static function content(array $parameters = [])
|
||||
|
@ -62,79 +58,73 @@ class Details extends BaseAdmin
|
|||
|
||||
$addons_admin = Addon::getAdminList();
|
||||
|
||||
if ($a->argc > 2) {
|
||||
// @TODO: Replace with parameter from router
|
||||
$addon = $a->argv[2];
|
||||
$addon = Strings::sanitizeFilePathItem($addon);
|
||||
if (!is_file("addon/$addon/$addon.php")) {
|
||||
notice(DI::l10n()->t('Addon not found.'));
|
||||
Addon::uninstall($addon);
|
||||
DI::baseUrl()->redirect('admin/addons');
|
||||
}
|
||||
|
||||
if (($_GET['action'] ?? '') == 'toggle') {
|
||||
parent::checkFormSecurityTokenRedirectOnError('/admin/addons', 'admin_themes', 't');
|
||||
|
||||
// Toggle addon status
|
||||
if (Addon::isEnabled($addon)) {
|
||||
Addon::uninstall($addon);
|
||||
info(DI::l10n()->t('Addon %s disabled.', $addon));
|
||||
} else {
|
||||
Addon::install($addon);
|
||||
info(DI::l10n()->t('Addon %s enabled.', $addon));
|
||||
}
|
||||
|
||||
DI::baseUrl()->redirect('admin/addons/' . $addon);
|
||||
}
|
||||
|
||||
// display addon details
|
||||
if (Addon::isEnabled($addon)) {
|
||||
$status = 'on';
|
||||
$action = DI::l10n()->t('Disable');
|
||||
} else {
|
||||
$status = 'off';
|
||||
$action = DI::l10n()->t('Enable');
|
||||
}
|
||||
|
||||
$readme = null;
|
||||
if (is_file("addon/$addon/README.md")) {
|
||||
$readme = Markdown::convert(file_get_contents("addon/$addon/README.md"), false);
|
||||
} elseif (is_file("addon/$addon/README")) {
|
||||
$readme = '<pre>' . file_get_contents("addon/$addon/README") . '</pre>';
|
||||
}
|
||||
|
||||
$admin_form = '';
|
||||
if (array_key_exists($addon, $addons_admin)) {
|
||||
require_once "addon/$addon/$addon.php";
|
||||
$func = $addon . '_addon_admin';
|
||||
$func($a, $admin_form);
|
||||
}
|
||||
|
||||
$t = Renderer::getMarkupTemplate('admin/addons/details.tpl');
|
||||
|
||||
return Renderer::replaceMacros($t, [
|
||||
'$title' => DI::l10n()->t('Administration'),
|
||||
'$page' => DI::l10n()->t('Addons'),
|
||||
'$toggle' => DI::l10n()->t('Toggle'),
|
||||
'$settings' => DI::l10n()->t('Settings'),
|
||||
'$baseurl' => DI::baseUrl()->get(true),
|
||||
|
||||
'$addon' => $addon,
|
||||
'$status' => $status,
|
||||
'$action' => $action,
|
||||
'$info' => Addon::getInfo($addon),
|
||||
'$str_author' => DI::l10n()->t('Author: '),
|
||||
'$str_maintainer' => DI::l10n()->t('Maintainer: '),
|
||||
|
||||
'$admin_form' => $admin_form,
|
||||
'$function' => 'addons',
|
||||
'$screenshot' => '',
|
||||
'$readme' => $readme,
|
||||
|
||||
'$form_security_token' => parent::getFormSecurityToken('admin_themes'),
|
||||
]);
|
||||
$addon = Strings::sanitizeFilePathItem($parameters['addon']);
|
||||
if (!is_file("addon/$addon/$addon.php")) {
|
||||
notice(DI::l10n()->t('Addon not found.'));
|
||||
Addon::uninstall($addon);
|
||||
DI::baseUrl()->redirect('admin/addons');
|
||||
}
|
||||
|
||||
DI::baseUrl()->redirect('admin/addons');
|
||||
if (($_GET['action'] ?? '') == 'toggle') {
|
||||
self::checkFormSecurityTokenRedirectOnError('/admin/addons', 'admin_addons', 't');
|
||||
|
||||
// Toggle addon status
|
||||
if (Addon::isEnabled($addon)) {
|
||||
Addon::uninstall($addon);
|
||||
info(DI::l10n()->t('Addon %s disabled.', $addon));
|
||||
} else {
|
||||
Addon::install($addon);
|
||||
info(DI::l10n()->t('Addon %s enabled.', $addon));
|
||||
}
|
||||
|
||||
DI::baseUrl()->redirect('admin/addons/' . $addon);
|
||||
}
|
||||
|
||||
// display addon details
|
||||
if (Addon::isEnabled($addon)) {
|
||||
$status = 'on';
|
||||
$action = DI::l10n()->t('Disable');
|
||||
} else {
|
||||
$status = 'off';
|
||||
$action = DI::l10n()->t('Enable');
|
||||
}
|
||||
|
||||
$readme = null;
|
||||
if (is_file("addon/$addon/README.md")) {
|
||||
$readme = Markdown::convert(file_get_contents("addon/$addon/README.md"), false);
|
||||
} elseif (is_file("addon/$addon/README")) {
|
||||
$readme = '<pre>' . file_get_contents("addon/$addon/README") . '</pre>';
|
||||
}
|
||||
|
||||
$admin_form = '';
|
||||
if (array_key_exists($addon, $addons_admin)) {
|
||||
require_once "addon/$addon/$addon.php";
|
||||
$func = $addon . '_addon_admin';
|
||||
$func($a, $admin_form);
|
||||
}
|
||||
|
||||
$t = Renderer::getMarkupTemplate('admin/addons/details.tpl');
|
||||
|
||||
return Renderer::replaceMacros($t, [
|
||||
'$title' => DI::l10n()->t('Administration'),
|
||||
'$page' => DI::l10n()->t('Addons'),
|
||||
'$toggle' => DI::l10n()->t('Toggle'),
|
||||
'$settings' => DI::l10n()->t('Settings'),
|
||||
'$baseurl' => DI::baseUrl()->get(true),
|
||||
|
||||
'$addon' => $addon,
|
||||
'$status' => $status,
|
||||
'$action' => $action,
|
||||
'$info' => Addon::getInfo($addon),
|
||||
'$str_author' => DI::l10n()->t('Author: '),
|
||||
'$str_maintainer' => DI::l10n()->t('Maintainer: '),
|
||||
|
||||
'$admin_form' => $admin_form,
|
||||
'$function' => 'addons',
|
||||
'$screenshot' => '',
|
||||
'$readme' => $readme,
|
||||
|
||||
'$form_security_token' => self::getFormSecurityToken('admin_addons'),
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -36,91 +36,93 @@ class DBSync extends BaseAdmin
|
|||
|
||||
$a = DI::app();
|
||||
|
||||
$o = '';
|
||||
$action = $parameters['action'] ?? '';
|
||||
$update = $parameters['update'] ?? 0;
|
||||
|
||||
if ($a->argc > 3 && $a->argv[2] === 'mark') {
|
||||
// @TODO: Replace with parameter from router
|
||||
$update = intval($a->argv[3]);
|
||||
if ($update) {
|
||||
DI::config()->set('database', 'update_' . $update, 'success');
|
||||
$curr = DI::config()->get('system', 'build');
|
||||
if (intval($curr) == $update) {
|
||||
DI::config()->set('system', 'build', intval($curr) + 1);
|
||||
switch ($action) {
|
||||
case 'mark':
|
||||
if ($update) {
|
||||
DI::config()->set('database', 'update_' . $update, 'success');
|
||||
$curr = DI::config()->get('system', 'build');
|
||||
if (intval($curr) == $update) {
|
||||
DI::config()->set('system', 'build', intval($curr) + 1);
|
||||
}
|
||||
|
||||
info(DI::l10n()->t('Update has been marked successful'));
|
||||
}
|
||||
info(DI::l10n()->t('Update has been marked successful') . EOL);
|
||||
}
|
||||
DI::baseUrl()->redirect('admin/dbsync');
|
||||
}
|
||||
|
||||
if ($a->argc > 2) {
|
||||
if ($a->argv[2] === 'check') {
|
||||
break;
|
||||
case 'check':
|
||||
// @TODO Seems like a similar logic like Update::check()
|
||||
$retval = DBStructure::update($a->getBasePath(), false, true);
|
||||
if ($retval === '') {
|
||||
$o .= DI::l10n()->t("Database structure update %s was successfully applied.", DB_UPDATE_VERSION) . "<br />";
|
||||
$o = DI::l10n()->t("Database structure update %s was successfully applied.", DB_UPDATE_VERSION) . "<br />";
|
||||
DI::config()->set('database', 'last_successful_update', DB_UPDATE_VERSION);
|
||||
DI::config()->set('database', 'last_successful_update_time', time());
|
||||
} else {
|
||||
$o .= DI::l10n()->t("Executing of database structure update %s failed with error: %s", DB_UPDATE_VERSION, $retval) . "<br />";
|
||||
}
|
||||
if ($a->argv[2] === 'check') {
|
||||
return $o;
|
||||
}
|
||||
} elseif (intval($a->argv[2])) {
|
||||
require_once 'update.php';
|
||||
|
||||
// @TODO: Replace with parameter from router
|
||||
$update = intval($a->argv[2]);
|
||||
|
||||
$func = 'update_' . $update;
|
||||
|
||||
if (function_exists($func)) {
|
||||
$retval = $func();
|
||||
|
||||
if ($retval === Update::FAILED) {
|
||||
$o .= DI::l10n()->t("Executing %s failed with error: %s", $func, $retval);
|
||||
} elseif ($retval === Update::SUCCESS) {
|
||||
$o .= DI::l10n()->t('Update %s was successfully applied.', $func);
|
||||
DI::config()->set('database', $func, 'success');
|
||||
} else {
|
||||
$o .= DI::l10n()->t('Update %s did not return a status. Unknown if it succeeded.', $func);
|
||||
}
|
||||
} else {
|
||||
$o .= DI::l10n()->t('There was no additional update function %s that needed to be called.', $func) . "<br />";
|
||||
DI::config()->set('database', $func, 'success');
|
||||
$o = DI::l10n()->t("Executing of database structure update %s failed with error: %s", DB_UPDATE_VERSION, $retval) . "<br />";
|
||||
}
|
||||
|
||||
return $o;
|
||||
case 'update':
|
||||
require_once 'update.php';
|
||||
|
||||
// @TODO: Replace with parameter from router
|
||||
if ($update) {
|
||||
$func = 'update_' . $update;
|
||||
|
||||
if (function_exists($func)) {
|
||||
$retval = $func();
|
||||
|
||||
if ($retval === Update::FAILED) {
|
||||
$o = DI::l10n()->t("Executing %s failed with error: %s", $func, $retval);
|
||||
} elseif ($retval === Update::SUCCESS) {
|
||||
$o = DI::l10n()->t('Update %s was successfully applied.', $func);
|
||||
DI::config()->set('database', $func, 'success');
|
||||
} else {
|
||||
$o = DI::l10n()->t('Update %s did not return a status. Unknown if it succeeded.', $func);
|
||||
}
|
||||
} else {
|
||||
$o = DI::l10n()->t('There was no additional update function %s that needed to be called.', $func) . "<br />";
|
||||
DI::config()->set('database', $func, 'success');
|
||||
}
|
||||
|
||||
return $o;
|
||||
}
|
||||
|
||||
break;
|
||||
default:
|
||||
$failed = [];
|
||||
$configStmt = DBA::select('config', ['k', 'v'], ['cat' => 'database']);
|
||||
while ($config = DBA::fetch($configStmt)) {
|
||||
$upd = intval(substr($config['k'], 7));
|
||||
if ($upd >= 1139 && $config['v'] != 'success') {
|
||||
$failed[] = $upd;
|
||||
}
|
||||
}
|
||||
DBA::close($configStmt);
|
||||
|
||||
if (!count($failed)) {
|
||||
$o = Renderer::replaceMacros(Renderer::getMarkupTemplate('admin/dbsync/structure_check.tpl'), [
|
||||
'$base' => DI::baseUrl()->get(true),
|
||||
'$banner' => DI::l10n()->t('No failed updates.'),
|
||||
'$check' => DI::l10n()->t('Check database structure'),
|
||||
]);
|
||||
} else {
|
||||
$o = Renderer::replaceMacros(Renderer::getMarkupTemplate('admin/dbsync/failed_updates.tpl'), [
|
||||
'$base' => DI::baseUrl()->get(true),
|
||||
'$banner' => DI::l10n()->t('Failed Updates'),
|
||||
'$desc' => DI::l10n()->t('This does not include updates prior to 1139, which did not return a status.'),
|
||||
'$mark' => DI::l10n()->t("Mark success \x28if update was manually applied\x29"),
|
||||
'$apply' => DI::l10n()->t('Attempt to execute this update step automatically'),
|
||||
'$failed' => $failed
|
||||
]);
|
||||
}
|
||||
|
||||
return $o;
|
||||
}
|
||||
}
|
||||
|
||||
$failed = [];
|
||||
$configStmt = DBA::select('config', ['k', 'v'], ['cat' => 'database']);
|
||||
while ($config = DBA::fetch($configStmt)) {
|
||||
$upd = intval(substr($config['k'], 7));
|
||||
if ($upd >= 1139 && $config['v'] != 'success') {
|
||||
$failed[] = $upd;
|
||||
}
|
||||
}
|
||||
DBA::close($configStmt);
|
||||
|
||||
if (!count($failed)) {
|
||||
$o = Renderer::replaceMacros(Renderer::getMarkupTemplate('admin/dbsync/structure_check.tpl'), [
|
||||
'$base' => DI::baseUrl()->get(true),
|
||||
'$banner' => DI::l10n()->t('No failed updates.'),
|
||||
'$check' => DI::l10n()->t('Check database structure'),
|
||||
]);
|
||||
} else {
|
||||
$o = Renderer::replaceMacros(Renderer::getMarkupTemplate('admin/dbsync/failed_updates.tpl'), [
|
||||
'$base' => DI::baseUrl()->get(true),
|
||||
'$banner' => DI::l10n()->t('Failed Updates'),
|
||||
'$desc' => DI::l10n()->t('This does not include updates prior to 1139, which did not return a status.'),
|
||||
'$mark' => DI::l10n()->t("Mark success \x28if update was manually applied\x29"),
|
||||
'$apply' => DI::l10n()->t('Attempt to execute this update step automatically'),
|
||||
'$failed' => $failed
|
||||
]);
|
||||
}
|
||||
|
||||
return $o;
|
||||
DI::baseUrl()->redirect('admin/dbsync');
|
||||
return '';
|
||||
}
|
||||
}
|
||||
|
|
|
@ -42,13 +42,10 @@ class Queue extends BaseAdmin
|
|||
{
|
||||
parent::content($parameters);
|
||||
|
||||
$a = DI::app();
|
||||
|
||||
// @TODO: Replace with parameter from router
|
||||
$deferred = $a->argc > 2 && $a->argv[2] == 'deferred';
|
||||
$status = $parameters['status'] ?? '';
|
||||
|
||||
// get jobs from the workerqueue table
|
||||
if ($deferred) {
|
||||
if ($status == 'deferred') {
|
||||
$condition = ["NOT `done` AND `retrial` > ?", 0];
|
||||
$sub_title = DI::l10n()->t('Inspect Deferred Worker Queue');
|
||||
$info = DI::l10n()->t("This page lists the deferred worker jobs. This are jobs that couldn't be executed at the first time.");
|
||||
|
|
|
@ -30,116 +30,80 @@ use Friendica\Util\Strings;
|
|||
|
||||
class Details extends BaseAdmin
|
||||
{
|
||||
public static function post(array $parameters = [])
|
||||
{
|
||||
parent::post($parameters);
|
||||
|
||||
$a = DI::app();
|
||||
|
||||
if ($a->argc > 2) {
|
||||
// @TODO: Replace with parameter from router
|
||||
$theme = $a->argv[2];
|
||||
$theme = Strings::sanitizeFilePathItem($theme);
|
||||
if (is_file("view/theme/$theme/config.php")) {
|
||||
require_once "view/theme/$theme/config.php";
|
||||
|
||||
if (function_exists('theme_admin_post')) {
|
||||
theme_admin_post($a);
|
||||
}
|
||||
}
|
||||
|
||||
info(DI::l10n()->t('Theme settings updated.'));
|
||||
|
||||
if (DI::mode()->isAjax()) {
|
||||
return;
|
||||
}
|
||||
|
||||
DI::baseUrl()->redirect('admin/themes/' . $theme);
|
||||
}
|
||||
}
|
||||
|
||||
public static function content(array $parameters = [])
|
||||
{
|
||||
parent::content($parameters);
|
||||
|
||||
$a = DI::app();
|
||||
|
||||
if ($a->argc > 2) {
|
||||
// @TODO: Replace with parameter from router
|
||||
$theme = $a->argv[2];
|
||||
$theme = Strings::sanitizeFilePathItem($theme);
|
||||
if (!is_dir("view/theme/$theme")) {
|
||||
notice(DI::l10n()->t("Item not found."));
|
||||
return '';
|
||||
}
|
||||
|
||||
$isEnabled = in_array($theme, Theme::getAllowedList());
|
||||
if ($isEnabled) {
|
||||
$status = "on";
|
||||
$action = DI::l10n()->t("Disable");
|
||||
} else {
|
||||
$status = "off";
|
||||
$action = DI::l10n()->t("Enable");
|
||||
}
|
||||
|
||||
if (!empty($_GET['action']) && $_GET['action'] == 'toggle') {
|
||||
parent::checkFormSecurityTokenRedirectOnError('/admin/themes', 'admin_themes', 't');
|
||||
|
||||
if ($isEnabled) {
|
||||
Theme::uninstall($theme);
|
||||
info(DI::l10n()->t('Theme %s disabled.', $theme));
|
||||
} elseif (Theme::install($theme)) {
|
||||
info(DI::l10n()->t('Theme %s successfully enabled.', $theme));
|
||||
} else {
|
||||
info(DI::l10n()->t('Theme %s failed to install.', $theme));
|
||||
}
|
||||
|
||||
DI::baseUrl()->redirect('admin/themes/' . $theme);
|
||||
}
|
||||
|
||||
$readme = null;
|
||||
if (is_file("view/theme/$theme/README.md")) {
|
||||
$readme = Markdown::convert(file_get_contents("view/theme/$theme/README.md"), false);
|
||||
} elseif (is_file("view/theme/$theme/README")) {
|
||||
$readme = "<pre>" . file_get_contents("view/theme/$theme/README") . "</pre>";
|
||||
}
|
||||
|
||||
$admin_form = '';
|
||||
if (is_file("view/theme/$theme/config.php")) {
|
||||
require_once "view/theme/$theme/config.php";
|
||||
|
||||
if (function_exists('theme_admin')) {
|
||||
$admin_form = '<iframe onload="resizeIframe(this);" src="/admin/themes/' . $theme . '/embed?mode=minimal" width="100%" height="600px" frameborder="no"></iframe>';
|
||||
}
|
||||
}
|
||||
|
||||
$screenshot = [Theme::getScreenshot($theme), DI::l10n()->t('Screenshot')];
|
||||
if (!stristr($screenshot[0], $theme)) {
|
||||
$screenshot = null;
|
||||
}
|
||||
|
||||
$t = Renderer::getMarkupTemplate('admin/addons/details.tpl');
|
||||
return Renderer::replaceMacros($t, [
|
||||
'$title' => DI::l10n()->t('Administration'),
|
||||
'$page' => DI::l10n()->t('Themes'),
|
||||
'$toggle' => DI::l10n()->t('Toggle'),
|
||||
'$settings' => DI::l10n()->t('Settings'),
|
||||
'$baseurl' => DI::baseUrl()->get(true),
|
||||
'$addon' => $theme,
|
||||
'$status' => $status,
|
||||
'$action' => $action,
|
||||
'$info' => Theme::getInfo($theme),
|
||||
'$function' => 'themes',
|
||||
'$admin_form' => $admin_form,
|
||||
'$str_author' => DI::l10n()->t('Author: '),
|
||||
'$str_maintainer' => DI::l10n()->t('Maintainer: '),
|
||||
'$screenshot' => $screenshot,
|
||||
'$readme' => $readme,
|
||||
|
||||
'$form_security_token' => parent::getFormSecurityToken("admin_themes"),
|
||||
]);
|
||||
$theme = Strings::sanitizeFilePathItem($parameters['theme']);
|
||||
if (!is_dir("view/theme/$theme")) {
|
||||
notice(DI::l10n()->t("Item not found."));
|
||||
return '';
|
||||
}
|
||||
|
||||
DI::baseUrl()->redirect('admin/themes');
|
||||
$isEnabled = in_array($theme, Theme::getAllowedList());
|
||||
if ($isEnabled) {
|
||||
$status = "on";
|
||||
$action = DI::l10n()->t("Disable");
|
||||
} else {
|
||||
$status = "off";
|
||||
$action = DI::l10n()->t("Enable");
|
||||
}
|
||||
|
||||
if (!empty($_GET['action']) && $_GET['action'] == 'toggle') {
|
||||
self::checkFormSecurityTokenRedirectOnError('/admin/themes', 'admin_themes', 't');
|
||||
|
||||
if ($isEnabled) {
|
||||
Theme::uninstall($theme);
|
||||
info(DI::l10n()->t('Theme %s disabled.', $theme));
|
||||
} elseif (Theme::install($theme)) {
|
||||
info(DI::l10n()->t('Theme %s successfully enabled.', $theme));
|
||||
} else {
|
||||
notice(DI::l10n()->t('Theme %s failed to install.', $theme));
|
||||
}
|
||||
|
||||
DI::baseUrl()->redirect('admin/themes/' . $theme);
|
||||
}
|
||||
|
||||
$readme = null;
|
||||
if (is_file("view/theme/$theme/README.md")) {
|
||||
$readme = Markdown::convert(file_get_contents("view/theme/$theme/README.md"), false);
|
||||
} elseif (is_file("view/theme/$theme/README")) {
|
||||
$readme = "<pre>" . file_get_contents("view/theme/$theme/README") . "</pre>";
|
||||
}
|
||||
|
||||
$admin_form = '';
|
||||
if (is_file("view/theme/$theme/config.php")) {
|
||||
require_once "view/theme/$theme/config.php";
|
||||
|
||||
if (function_exists('theme_admin')) {
|
||||
$admin_form = '<iframe onload="resizeIframe(this);" src="/admin/themes/' . $theme . '/embed?mode=minimal" width="100%" height="600px" frameborder="no"></iframe>';
|
||||
}
|
||||
}
|
||||
|
||||
$screenshot = [Theme::getScreenshot($theme), DI::l10n()->t('Screenshot')];
|
||||
if (!stristr($screenshot[0], $theme)) {
|
||||
$screenshot = null;
|
||||
}
|
||||
|
||||
$t = Renderer::getMarkupTemplate('admin/addons/details.tpl');
|
||||
return Renderer::replaceMacros($t, [
|
||||
'$title' => DI::l10n()->t('Administration'),
|
||||
'$page' => DI::l10n()->t('Themes'),
|
||||
'$toggle' => DI::l10n()->t('Toggle'),
|
||||
'$settings' => DI::l10n()->t('Settings'),
|
||||
'$baseurl' => DI::baseUrl()->get(true),
|
||||
'$addon' => $theme,
|
||||
'$status' => $status,
|
||||
'$action' => $action,
|
||||
'$info' => Theme::getInfo($theme),
|
||||
'$function' => 'themes',
|
||||
'$admin_form' => $admin_form,
|
||||
'$str_author' => DI::l10n()->t('Author: '),
|
||||
'$str_maintainer' => DI::l10n()->t('Maintainer: '),
|
||||
'$screenshot' => $screenshot,
|
||||
'$readme' => $readme,
|
||||
|
||||
'$form_security_token' => self::getFormSecurityToken("admin_themes"),
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -30,15 +30,9 @@ class Embed extends BaseAdmin
|
|||
{
|
||||
public static function init(array $parameters = [])
|
||||
{
|
||||
$a = DI::app();
|
||||
|
||||
if ($a->argc > 2) {
|
||||
// @TODO: Replace with parameter from router
|
||||
$theme = $a->argv[2];
|
||||
$theme = Strings::sanitizeFilePathItem($theme);
|
||||
if (is_file("view/theme/$theme/config.php")) {
|
||||
$a->setCurrentTheme($theme);
|
||||
}
|
||||
$theme = Strings::sanitizeFilePathItem($parameters['theme']);
|
||||
if (is_file("view/theme/$theme/config.php")) {
|
||||
DI::app()->setCurrentTheme($theme);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -46,67 +40,49 @@ class Embed extends BaseAdmin
|
|||
{
|
||||
parent::post($parameters);
|
||||
|
||||
$a = DI::app();
|
||||
|
||||
if ($a->argc > 2) {
|
||||
// @TODO: Replace with parameter from router
|
||||
$theme = $a->argv[2];
|
||||
$theme = Strings::sanitizeFilePathItem($theme);
|
||||
if (is_file("view/theme/$theme/config.php")) {
|
||||
$theme = Strings::sanitizeFilePathItem($parameters['theme']);
|
||||
if (is_file("view/theme/$theme/config.php")) {
|
||||
require_once "view/theme/$theme/config.php";
|
||||
if (function_exists('theme_admin_post')) {
|
||||
self::checkFormSecurityTokenRedirectOnError('/admin/themes/' . $theme . '/embed?mode=minimal', 'admin_theme_settings');
|
||||
|
||||
require_once "view/theme/$theme/config.php";
|
||||
|
||||
if (function_exists('theme_admin_post')) {
|
||||
theme_admin_post($a);
|
||||
}
|
||||
theme_admin_post(DI::app());
|
||||
}
|
||||
|
||||
info(DI::l10n()->t('Theme settings updated.'));
|
||||
|
||||
if (DI::mode()->isAjax()) {
|
||||
return;
|
||||
}
|
||||
|
||||
DI::baseUrl()->redirect('admin/themes/' . $theme . '/embed?mode=minimal');
|
||||
}
|
||||
|
||||
if (DI::mode()->isAjax()) {
|
||||
return;
|
||||
}
|
||||
|
||||
DI::baseUrl()->redirect('admin/themes/' . $theme . '/embed?mode=minimal');
|
||||
}
|
||||
|
||||
public static function content(array $parameters = [])
|
||||
{
|
||||
parent::content($parameters);
|
||||
|
||||
$a = DI::app();
|
||||
|
||||
if ($a->argc > 2) {
|
||||
// @TODO: Replace with parameter from router
|
||||
$theme = $a->argv[2];
|
||||
$theme = Strings::sanitizeFilePathItem($theme);
|
||||
if (!is_dir("view/theme/$theme")) {
|
||||
notice(DI::l10n()->t('Unknown theme.'));
|
||||
return '';
|
||||
}
|
||||
|
||||
$admin_form = '';
|
||||
if (is_file("view/theme/$theme/config.php")) {
|
||||
require_once "view/theme/$theme/config.php";
|
||||
|
||||
if (function_exists('theme_admin')) {
|
||||
$admin_form = theme_admin($a);
|
||||
}
|
||||
}
|
||||
|
||||
// Overrides normal theme style include to strip user param to show embedded theme settings
|
||||
Renderer::$theme['stylesheet'] = 'view/theme/' . $theme . '/style.pcss';
|
||||
|
||||
$t = Renderer::getMarkupTemplate('admin/addons/embed.tpl');
|
||||
return Renderer::replaceMacros($t, [
|
||||
'$action' => '/admin/themes/' . $theme . '/embed?mode=minimal',
|
||||
'$form' => $admin_form,
|
||||
'$form_security_token' => parent::getFormSecurityToken("admin_theme_settings"),
|
||||
]);
|
||||
$theme = Strings::sanitizeFilePathItem($parameters['theme']);
|
||||
if (!is_dir("view/theme/$theme")) {
|
||||
notice(DI::l10n()->t('Unknown theme.'));
|
||||
return '';
|
||||
}
|
||||
|
||||
return '';
|
||||
$admin_form = '';
|
||||
if (is_file("view/theme/$theme/config.php")) {
|
||||
require_once "view/theme/$theme/config.php";
|
||||
|
||||
if (function_exists('theme_admin')) {
|
||||
$admin_form = theme_admin(DI::app());
|
||||
}
|
||||
}
|
||||
|
||||
// Overrides normal theme style include to strip user param to show embedded theme settings
|
||||
Renderer::$theme['stylesheet'] = 'view/theme/' . $theme . '/style.pcss';
|
||||
|
||||
$t = Renderer::getMarkupTemplate('admin/addons/embed.tpl');
|
||||
return Renderer::replaceMacros($t, [
|
||||
'$action' => '/admin/themes/' . $theme . '/embed?mode=minimal',
|
||||
'$form' => $admin_form,
|
||||
'$form_security_token' => self::getFormSecurityToken("admin_theme_settings"),
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -101,187 +101,186 @@ class Users extends BaseAdmin
|
|||
{
|
||||
parent::content($parameters);
|
||||
|
||||
$a = DI::app();
|
||||
$action = $parameters['action'] ?? '';
|
||||
$uid = $parameters['uid'] ?? 0;
|
||||
|
||||
if ($a->argc > 3) {
|
||||
// @TODO: Replace with parameter from router
|
||||
$action = $a->argv[2];
|
||||
$uid = $a->argv[3];
|
||||
if ($uid) {
|
||||
$user = User::getById($uid, ['username', 'blocked']);
|
||||
if (!DBA::isResult($user)) {
|
||||
notice('User not found' . EOL);
|
||||
DI::baseUrl()->redirect('admin/users');
|
||||
return ''; // NOTREACHED
|
||||
}
|
||||
}
|
||||
|
||||
switch ($action) {
|
||||
case 'delete':
|
||||
if (local_user() != $uid) {
|
||||
parent::checkFormSecurityTokenRedirectOnError('/admin/users', 'admin_users', 't');
|
||||
// delete user
|
||||
User::remove($uid);
|
||||
switch ($action) {
|
||||
case 'delete':
|
||||
if (local_user() != $uid) {
|
||||
self::checkFormSecurityTokenRedirectOnError('/admin/users', 'admin_users', 't');
|
||||
// delete user
|
||||
User::remove($uid);
|
||||
|
||||
notice(DI::l10n()->t('User "%s" deleted', $user['username']));
|
||||
} else {
|
||||
notice(DI::l10n()->t('You can\'t remove yourself'));
|
||||
notice(DI::l10n()->t('User "%s" deleted', $user['username']));
|
||||
} else {
|
||||
notice(DI::l10n()->t('You can\'t remove yourself'));
|
||||
}
|
||||
break;
|
||||
case 'block':
|
||||
self::checkFormSecurityTokenRedirectOnError('/admin/users', 'admin_users', 't');
|
||||
User::block($uid);
|
||||
notice(DI::l10n()->t('User "%s" blocked', $user['username']));
|
||||
break;
|
||||
case 'unblock':
|
||||
self::checkFormSecurityTokenRedirectOnError('/admin/users', 'admin_users', 't');
|
||||
User::block($uid, false);
|
||||
notice(DI::l10n()->t('User "%s" unblocked', $user['username']));
|
||||
break;
|
||||
case 'allow':
|
||||
self::checkFormSecurityTokenRedirectOnError('/admin/users', 'admin_users', 't');
|
||||
User::allow(Register::getPendingForUser($uid)['hash'] ?? '');
|
||||
notice(DI::l10n()->t('Account approved.'));
|
||||
break;
|
||||
case 'deny':
|
||||
self::checkFormSecurityTokenRedirectOnError('/admin/users', 'admin_users', 't');
|
||||
User::deny(Register::getPendingForUser($uid)['hash'] ?? '');
|
||||
notice(DI::l10n()->t('Registration revoked'));
|
||||
break;
|
||||
default:
|
||||
/* get pending */
|
||||
$pending = Register::getPending();
|
||||
|
||||
$pager = new Pager(DI::l10n(), DI::args()->getQueryString(), 100);
|
||||
|
||||
$valid_orders = [
|
||||
'name',
|
||||
'email',
|
||||
'register_date',
|
||||
'login_date',
|
||||
'last-item',
|
||||
'page-flags'
|
||||
];
|
||||
|
||||
$order = 'name';
|
||||
$order_direction = '+';
|
||||
if (!empty($_GET['o'])) {
|
||||
$new_order = $_GET['o'];
|
||||
if ($new_order[0] === '-') {
|
||||
$order_direction = '-';
|
||||
$new_order = substr($new_order, 1);
|
||||
}
|
||||
break;
|
||||
case 'block':
|
||||
parent::checkFormSecurityTokenRedirectOnError('/admin/users', 'admin_users', 't');
|
||||
User::block($uid);
|
||||
notice(DI::l10n()->t('User "%s" blocked', $user['username']));
|
||||
break;
|
||||
case 'unblock':
|
||||
parent::checkFormSecurityTokenRedirectOnError('/admin/users', 'admin_users', 't');
|
||||
User::block($uid, false);
|
||||
notice(DI::l10n()->t('User "%s" unblocked', $user['username']));
|
||||
break;
|
||||
case 'allow':
|
||||
parent::checkFormSecurityTokenRedirectOnError('/admin/users', 'admin_users', 't');
|
||||
User::allow(Register::getPendingForUser($uid)['hash'] ?? '');
|
||||
notice(DI::l10n()->t('Account approved.'));
|
||||
break;
|
||||
case 'deny':
|
||||
parent::checkFormSecurityTokenRedirectOnError('/admin/users', 'admin_users', 't');
|
||||
User::deny(Register::getPendingForUser($uid)['hash'] ?? '');
|
||||
notice(DI::l10n()->t('Registration revoked'));
|
||||
break;
|
||||
}
|
||||
|
||||
DI::baseUrl()->redirect('admin/users');
|
||||
if (in_array($new_order, $valid_orders)) {
|
||||
$order = $new_order;
|
||||
}
|
||||
}
|
||||
|
||||
$users = User::getList($pager->getStart(), $pager->getItemsPerPage(), 'all', $order, ($order_direction == '-'));
|
||||
|
||||
$adminlist = explode(',', str_replace(' ', '', DI::config()->get('config', 'admin_email')));
|
||||
$_setup_users = function ($e) use ($adminlist) {
|
||||
$page_types = [
|
||||
User::PAGE_FLAGS_NORMAL => DI::l10n()->t('Normal Account Page'),
|
||||
User::PAGE_FLAGS_SOAPBOX => DI::l10n()->t('Soapbox Page'),
|
||||
User::PAGE_FLAGS_COMMUNITY => DI::l10n()->t('Public Forum'),
|
||||
User::PAGE_FLAGS_FREELOVE => DI::l10n()->t('Automatic Friend Page'),
|
||||
User::PAGE_FLAGS_PRVGROUP => DI::l10n()->t('Private Forum')
|
||||
];
|
||||
$account_types = [
|
||||
User::ACCOUNT_TYPE_PERSON => DI::l10n()->t('Personal Page'),
|
||||
User::ACCOUNT_TYPE_ORGANISATION => DI::l10n()->t('Organisation Page'),
|
||||
User::ACCOUNT_TYPE_NEWS => DI::l10n()->t('News Page'),
|
||||
User::ACCOUNT_TYPE_COMMUNITY => DI::l10n()->t('Community Forum'),
|
||||
User::ACCOUNT_TYPE_RELAY => DI::l10n()->t('Relay'),
|
||||
];
|
||||
|
||||
$e['page_flags_raw'] = $e['page-flags'];
|
||||
$e['page-flags'] = $page_types[$e['page-flags']];
|
||||
|
||||
$e['account_type_raw'] = ($e['page_flags_raw'] == 0) ? $e['account-type'] : -1;
|
||||
$e['account-type'] = ($e['page_flags_raw'] == 0) ? $account_types[$e['account-type']] : '';
|
||||
|
||||
$e['register_date'] = Temporal::getRelativeDate($e['register_date']);
|
||||
$e['login_date'] = Temporal::getRelativeDate($e['login_date']);
|
||||
$e['lastitem_date'] = Temporal::getRelativeDate($e['last-item']);
|
||||
$e['is_admin'] = in_array($e['email'], $adminlist);
|
||||
$e['is_deletable'] = (intval($e['uid']) != local_user());
|
||||
$e['deleted'] = ($e['account_removed'] ? Temporal::getRelativeDate($e['account_expires_on']) : False);
|
||||
|
||||
return $e;
|
||||
};
|
||||
|
||||
$tmp_users = array_map($_setup_users, $users);
|
||||
|
||||
// Get rid of dashes in key names, Smarty3 can't handle them
|
||||
// and extracting deleted users
|
||||
|
||||
$deleted = [];
|
||||
$users = [];
|
||||
foreach ($tmp_users as $user) {
|
||||
foreach ($user as $k => $v) {
|
||||
$newkey = str_replace('-', '_', $k);
|
||||
$user[$newkey] = $v;
|
||||
}
|
||||
|
||||
if ($user['deleted']) {
|
||||
$deleted[] = $user;
|
||||
} else {
|
||||
$users[] = $user;
|
||||
}
|
||||
}
|
||||
|
||||
$th_users = array_map(null, [DI::l10n()->t('Name'), DI::l10n()->t('Email'), DI::l10n()->t('Register date'), DI::l10n()->t('Last login'), DI::l10n()->t('Last public item'), DI::l10n()->t('Type')], $valid_orders);
|
||||
|
||||
$t = Renderer::getMarkupTemplate('admin/users.tpl');
|
||||
$o = Renderer::replaceMacros($t, [
|
||||
// strings //
|
||||
'$title' => DI::l10n()->t('Administration'),
|
||||
'$page' => DI::l10n()->t('Users'),
|
||||
'$submit' => DI::l10n()->t('Add User'),
|
||||
'$select_all' => DI::l10n()->t('select all'),
|
||||
'$h_pending' => DI::l10n()->t('User registrations waiting for confirm'),
|
||||
'$h_deleted' => DI::l10n()->t('User waiting for permanent deletion'),
|
||||
'$th_pending' => [DI::l10n()->t('Request date'), DI::l10n()->t('Name'), DI::l10n()->t('Email')],
|
||||
'$no_pending' => DI::l10n()->t('No registrations.'),
|
||||
'$pendingnotetext' => DI::l10n()->t('Note from the user'),
|
||||
'$approve' => DI::l10n()->t('Approve'),
|
||||
'$deny' => DI::l10n()->t('Deny'),
|
||||
'$delete' => DI::l10n()->t('Delete'),
|
||||
'$block' => DI::l10n()->t('Block'),
|
||||
'$blocked' => DI::l10n()->t('User blocked'),
|
||||
'$unblock' => DI::l10n()->t('Unblock'),
|
||||
'$siteadmin' => DI::l10n()->t('Site admin'),
|
||||
'$accountexpired' => DI::l10n()->t('Account expired'),
|
||||
|
||||
'$h_users' => DI::l10n()->t('Users'),
|
||||
'$h_newuser' => DI::l10n()->t('New User'),
|
||||
'$th_deleted' => [DI::l10n()->t('Name'), DI::l10n()->t('Email'), DI::l10n()->t('Register date'), DI::l10n()->t('Last login'), DI::l10n()->t('Last public item'), DI::l10n()->t('Permanent deletion')],
|
||||
'$th_users' => $th_users,
|
||||
'$order_users' => $order,
|
||||
'$order_direction_users' => $order_direction,
|
||||
|
||||
'$confirm_delete_multi' => DI::l10n()->t('Selected users will be deleted!\n\nEverything these users had posted on this site will be permanently deleted!\n\nAre you sure?'),
|
||||
'$confirm_delete' => DI::l10n()->t('The user {0} will be deleted!\n\nEverything this user has posted on this site will be permanently deleted!\n\nAre you sure?'),
|
||||
|
||||
'$form_security_token' => self::getFormSecurityToken('admin_users'),
|
||||
|
||||
// values //
|
||||
'$baseurl' => DI::baseUrl()->get(true),
|
||||
|
||||
'$pending' => $pending,
|
||||
'deleted' => $deleted,
|
||||
'$users' => $users,
|
||||
'$newusername' => ['new_user_name', DI::l10n()->t('Name'), '', DI::l10n()->t('Name of the new user.')],
|
||||
'$newusernickname' => ['new_user_nickname', DI::l10n()->t('Nickname'), '', DI::l10n()->t('Nickname of the new user.')],
|
||||
'$newuseremail' => ['new_user_email', DI::l10n()->t('Email'), '', DI::l10n()->t('Email address of the new user.'), '', '', 'email'],
|
||||
]);
|
||||
|
||||
$o .= $pager->renderFull(DBA::count('user'));
|
||||
|
||||
return $o;
|
||||
}
|
||||
|
||||
/* get pending */
|
||||
$pending = Register::getPending();
|
||||
|
||||
$pager = new Pager(DI::l10n(), DI::args()->getQueryString(), 100);
|
||||
|
||||
$valid_orders = [
|
||||
'name',
|
||||
'email',
|
||||
'register_date',
|
||||
'login_date',
|
||||
'last-item',
|
||||
'page-flags'
|
||||
];
|
||||
|
||||
$order = 'name';
|
||||
$order_direction = '+';
|
||||
if (!empty($_GET['o'])) {
|
||||
$new_order = $_GET['o'];
|
||||
if ($new_order[0] === '-') {
|
||||
$order_direction = '-';
|
||||
$new_order = substr($new_order, 1);
|
||||
}
|
||||
|
||||
if (in_array($new_order, $valid_orders)) {
|
||||
$order = $new_order;
|
||||
}
|
||||
}
|
||||
|
||||
$users = User::getList($pager->getStart(), $pager->getItemsPerPage(), 'all', $order, ($order_direction == '-'));
|
||||
|
||||
$adminlist = explode(',', str_replace(' ', '', DI::config()->get('config', 'admin_email')));
|
||||
$_setup_users = function ($e) use ($adminlist) {
|
||||
$page_types = [
|
||||
User::PAGE_FLAGS_NORMAL => DI::l10n()->t('Normal Account Page'),
|
||||
User::PAGE_FLAGS_SOAPBOX => DI::l10n()->t('Soapbox Page'),
|
||||
User::PAGE_FLAGS_COMMUNITY => DI::l10n()->t('Public Forum'),
|
||||
User::PAGE_FLAGS_FREELOVE => DI::l10n()->t('Automatic Friend Page'),
|
||||
User::PAGE_FLAGS_PRVGROUP => DI::l10n()->t('Private Forum')
|
||||
];
|
||||
$account_types = [
|
||||
User::ACCOUNT_TYPE_PERSON => DI::l10n()->t('Personal Page'),
|
||||
User::ACCOUNT_TYPE_ORGANISATION => DI::l10n()->t('Organisation Page'),
|
||||
User::ACCOUNT_TYPE_NEWS => DI::l10n()->t('News Page'),
|
||||
User::ACCOUNT_TYPE_COMMUNITY => DI::l10n()->t('Community Forum'),
|
||||
User::ACCOUNT_TYPE_RELAY => DI::l10n()->t('Relay'),
|
||||
];
|
||||
|
||||
$e['page_flags_raw'] = $e['page-flags'];
|
||||
$e['page-flags'] = $page_types[$e['page-flags']];
|
||||
|
||||
$e['account_type_raw'] = ($e['page_flags_raw'] == 0) ? $e['account-type'] : -1;
|
||||
$e['account-type'] = ($e['page_flags_raw'] == 0) ? $account_types[$e['account-type']] : '';
|
||||
|
||||
$e['register_date'] = Temporal::getRelativeDate($e['register_date']);
|
||||
$e['login_date'] = Temporal::getRelativeDate($e['login_date']);
|
||||
$e['lastitem_date'] = Temporal::getRelativeDate($e['last-item']);
|
||||
$e['is_admin'] = in_array($e['email'], $adminlist);
|
||||
$e['is_deletable'] = (intval($e['uid']) != local_user());
|
||||
$e['deleted'] = ($e['account_removed'] ? Temporal::getRelativeDate($e['account_expires_on']) : False);
|
||||
|
||||
return $e;
|
||||
};
|
||||
|
||||
$tmp_users = array_map($_setup_users, $users);
|
||||
|
||||
// Get rid of dashes in key names, Smarty3 can't handle them
|
||||
// and extracting deleted users
|
||||
|
||||
$deleted = [];
|
||||
$users = [];
|
||||
foreach ($tmp_users as $user) {
|
||||
foreach ($user as $k => $v) {
|
||||
$newkey = str_replace('-', '_', $k);
|
||||
$user[$newkey] = $v;
|
||||
}
|
||||
|
||||
if ($user['deleted']) {
|
||||
$deleted[] = $user;
|
||||
} else {
|
||||
$users[] = $user;
|
||||
}
|
||||
}
|
||||
|
||||
$th_users = array_map(null, [DI::l10n()->t('Name'), DI::l10n()->t('Email'), DI::l10n()->t('Register date'), DI::l10n()->t('Last login'), DI::l10n()->t('Last public item'), DI::l10n()->t('Type')], $valid_orders);
|
||||
|
||||
$t = Renderer::getMarkupTemplate('admin/users.tpl');
|
||||
$o = Renderer::replaceMacros($t, [
|
||||
// strings //
|
||||
'$title' => DI::l10n()->t('Administration'),
|
||||
'$page' => DI::l10n()->t('Users'),
|
||||
'$submit' => DI::l10n()->t('Add User'),
|
||||
'$select_all' => DI::l10n()->t('select all'),
|
||||
'$h_pending' => DI::l10n()->t('User registrations waiting for confirm'),
|
||||
'$h_deleted' => DI::l10n()->t('User waiting for permanent deletion'),
|
||||
'$th_pending' => [DI::l10n()->t('Request date'), DI::l10n()->t('Name'), DI::l10n()->t('Email')],
|
||||
'$no_pending' => DI::l10n()->t('No registrations.'),
|
||||
'$pendingnotetext' => DI::l10n()->t('Note from the user'),
|
||||
'$approve' => DI::l10n()->t('Approve'),
|
||||
'$deny' => DI::l10n()->t('Deny'),
|
||||
'$delete' => DI::l10n()->t('Delete'),
|
||||
'$block' => DI::l10n()->t('Block'),
|
||||
'$blocked' => DI::l10n()->t('User blocked'),
|
||||
'$unblock' => DI::l10n()->t('Unblock'),
|
||||
'$siteadmin' => DI::l10n()->t('Site admin'),
|
||||
'$accountexpired' => DI::l10n()->t('Account expired'),
|
||||
|
||||
'$h_users' => DI::l10n()->t('Users'),
|
||||
'$h_newuser' => DI::l10n()->t('New User'),
|
||||
'$th_deleted' => [DI::l10n()->t('Name'), DI::l10n()->t('Email'), DI::l10n()->t('Register date'), DI::l10n()->t('Last login'), DI::l10n()->t('Last public item'), DI::l10n()->t('Permanent deletion')],
|
||||
'$th_users' => $th_users,
|
||||
'$order_users' => $order,
|
||||
'$order_direction_users' => $order_direction,
|
||||
|
||||
'$confirm_delete_multi' => DI::l10n()->t('Selected users will be deleted!\n\nEverything these users had posted on this site will be permanently deleted!\n\nAre you sure?'),
|
||||
'$confirm_delete' => DI::l10n()->t('The user {0} will be deleted!\n\nEverything this user has posted on this site will be permanently deleted!\n\nAre you sure?'),
|
||||
|
||||
'$form_security_token' => parent::getFormSecurityToken('admin_users'),
|
||||
|
||||
// values //
|
||||
'$baseurl' => DI::baseUrl()->get(true),
|
||||
|
||||
'$pending' => $pending,
|
||||
'deleted' => $deleted,
|
||||
'$users' => $users,
|
||||
'$newusername' => ['new_user_name', DI::l10n()->t('Name'), '', DI::l10n()->t('Name of the new user.')],
|
||||
'$newusernickname' => ['new_user_nickname', DI::l10n()->t('Nickname'), '', DI::l10n()->t('Nickname of the new user.')],
|
||||
'$newuseremail' => ['new_user_email', DI::l10n()->t('Email'), '', DI::l10n()->t('Email address of the new user.'), '', '', 'email'],
|
||||
]);
|
||||
|
||||
$o .= $pager->renderFull(DBA::count('user'));
|
||||
|
||||
return $o;
|
||||
DI::baseUrl()->redirect('admin/users');
|
||||
return '';
|
||||
}
|
||||
}
|
||||
|
|
|
@ -73,9 +73,7 @@ return [
|
|||
'/blocklist/contact' => [Module\Admin\Blocklist\Contact::class, [R::GET, R::POST]],
|
||||
'/blocklist/server' => [Module\Admin\Blocklist\Server::class, [R::GET, R::POST]],
|
||||
|
||||
'/dbsync[/check]' => [Module\Admin\DBSync::class, [R::GET]],
|
||||
'/dbsync/{update:\d+}' => [Module\Admin\DBSync::class, [R::GET]],
|
||||
'/dbsync/mark/{update:\d+}' => [Module\Admin\DBSync::class, [R::GET]],
|
||||
'/dbsync[/{action}[/{update:\d+}]]' => [Module\Admin\DBSync::class, [R::GET]],
|
||||
|
||||
'/features' => [Module\Admin\Features::class, [R::GET, R::POST]],
|
||||
'/federation' => [Module\Admin\Federation::class, [R::GET]],
|
||||
|
@ -88,7 +86,7 @@ return [
|
|||
|
||||
'/phpinfo' => [Module\Admin\PhpInfo::class, [R::GET]],
|
||||
|
||||
'/queue[/deferred]' => [Module\Admin\Queue::class, [R::GET]],
|
||||
'/queue[/{status}]' => [Module\Admin\Queue::class, [R::GET]],
|
||||
|
||||
'/site' => [Module\Admin\Site::class, [R::GET, R::POST]],
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
|
||||
<ul>
|
||||
<li><a href="{{$baseurl}}/admin/dbsync/mark/{{$f}}">{{$mark}}</a></li>
|
||||
<li><a href="{{$baseurl}}/admin/dbsync/{{$f}}">{{$apply}}</a></li>
|
||||
<li><a href="{{$baseurl}}/admin/dbsync/update/{{$f}}">{{$apply}}</a></li>
|
||||
</ul>
|
||||
|
||||
<hr />
|
||||
|
|
Loading…
Reference in a new issue