include_once 'addon/' . $addon . '/' . $addon . '.php';
if (function_exists($addon . '_addon_admin_post')) {
+ self::checkFormSecurityTokenRedirectOnError($redirect, 'admin_addons_details');
+
$func = $addon . '_addon_admin_post';
$func(DI::app());
}
}
if (($_GET['action'] ?? '') == 'toggle') {
- self::checkFormSecurityTokenRedirectOnError('/admin/addons', 'admin_addons', 't');
+ self::checkFormSecurityTokenRedirectOnError('/admin/addons', 'admin_addons_details', 't');
// Toggle addon status
if (Addon::isEnabled($addon)) {
'$screenshot' => '',
'$readme' => $readme,
- '$form_security_token' => self::getFormSecurityToken('admin_addons'),
+ '$form_security_token' => self::getFormSecurityToken('admin_addons_details'),
]);
}
}
// reload active themes
if (!empty($_GET['action'])) {
- parent::checkFormSecurityTokenRedirectOnError('/admin/addons', 'admin_addons', 't');
+ self::checkFormSecurityTokenRedirectOnError('/admin/addons', 'admin_addons', 't');
switch ($_GET['action']) {
case 'reload':
'$addons' => $addons,
'$pcount' => count($addons),
'$noplugshint' => DI::l10n()->t('There are currently no addons available on your node. You can find the official addon repository at %1$s and might find other interesting addons in the open addon registry at %2$s', 'https://github.com/friendica/friendica-addons', 'http://addons.friendi.ca'),
- '$form_security_token' => parent::getFormSecurityToken('admin_addons'),
+ '$form_security_token' => self::getFormSecurityToken('admin_addons'),
]);
}
}
{
parent::post($parameters);
+ self::checkFormSecurityTokenRedirectOnError('/admin/blocklist/contact', 'admin_contactblock');
+
$contact_url = $_POST['contact_url'] ?? '';
$block_reason = $_POST['contact_block_reason'] ?? '';
$contacts = $_POST['contacts'] ?? [];
- parent::checkFormSecurityTokenRedirectOnError('/admin/blocklist/contact', 'admin_contactblock');
-
if (!empty($_POST['page_contactblock_block'])) {
$contact_id = Model\Contact::getIdForURL($contact_url);
if ($contact_id) {
'$h_newblock' => DI::l10n()->t('Block New Remote Contact'),
'$th_contacts' => [DI::l10n()->t('Photo'), DI::l10n()->t('Name'), DI::l10n()->t('Reason')],
- '$form_security_token' => parent::getFormSecurityToken('admin_contactblock'),
+ '$form_security_token' => self::getFormSecurityToken('admin_contactblock'),
// values //
'$baseurl' => DI::baseUrl()->get(true),
return;
}
- parent::checkFormSecurityTokenRedirectOnError('/admin/blocklist/server', 'admin_blocklist');
+ self::checkFormSecurityTokenRedirectOnError('/admin/blocklist/server', 'admin_blocklist');
if (!empty($_POST['page_blocklist_save'])) {
// Add new item to blocklist
'$entries' => $blocklistform,
'$baseurl' => DI::baseUrl()->get(true),
'$confirm_delete' => DI::l10n()->t('Delete entry from blocklist?'),
- '$form_security_token' => parent::getFormSecurityToken("admin_blocklist")
+ '$form_security_token' => self::getFormSecurityToken("admin_blocklist")
]);
}
}
{
parent::post($parameters);
- parent::checkFormSecurityTokenRedirectOnError('/admin/features', 'admin_manage_features');
+ self::checkFormSecurityTokenRedirectOnError('/admin/features', 'admin_manage_features');
$features = Feature::get(false);
$tpl = Renderer::getMarkupTemplate('admin/features.tpl');
$o = Renderer::replaceMacros($tpl, [
- '$form_security_token' => parent::getFormSecurityToken("admin_manage_features"),
+ '$form_security_token' => self::getFormSecurityToken("admin_manage_features"),
'$baseurl' => DI::baseUrl()->get(true),
'$title' => DI::l10n()->t('Manage Additional Features'),
'$features' => $features,
return;
}
- parent::checkFormSecurityTokenRedirectOnError('/admin/item/delete', 'admin_deleteitem');
+ self::checkFormSecurityTokenRedirectOnError('/admin/item/delete', 'admin_deleteitem');
if (!empty($_POST['page_deleteitem_submit'])) {
$guid = trim(Strings::escapeTags($_POST['deleteitemguid']));
'$intro1' => DI::l10n()->t('On this page you can delete an item from your node. If the item is a top level posting, the entire thread will be deleted.'),
'$intro2' => DI::l10n()->t('You need to know the GUID of the item. You can find it e.g. by looking at the display URL. The last part of http://example.com/display/123456 is the GUID, here 123456.'),
'$deleteitemguid' => ['deleteitemguid', DI::l10n()->t("GUID"), '', DI::l10n()->t("The GUID of the item you want to delete."), 'required', 'autofocus'],
- '$form_security_token' => parent::getFormSecurityToken("admin_deleteitem")
+ '$form_security_token' => self::getFormSecurityToken("admin_deleteitem")
]);
}
}
{
parent::post($parameters);
- if (!empty($_POST['page_logs'])) {
- parent::checkFormSecurityTokenRedirectOnError('/admin/logs', 'admin_logs');
+ if (empty($_POST['page_logs'])) {
+ return;
+ }
- $logfile = (!empty($_POST['logfile']) ? Strings::escapeTags(trim($_POST['logfile'])) : '');
- $debugging = !empty($_POST['debugging']);
- $loglevel = ($_POST['loglevel'] ?? '') ?: LogLevel::ERROR;
+ self::checkFormSecurityTokenRedirectOnError('/admin/logs', 'admin_logs');
- if (is_file($logfile) &&
- !is_writeable($logfile)) {
- notice(DI::l10n()->t('The logfile \'%s\' is not writable. No logging possible', $logfile));
- return;
- }
+ $logfile = (!empty($_POST['logfile']) ? Strings::escapeTags(trim($_POST['logfile'])) : '');
+ $debugging = !empty($_POST['debugging']);
+ $loglevel = ($_POST['loglevel'] ?? '') ?: LogLevel::ERROR;
- DI::config()->set('system', 'logfile', $logfile);
- DI::config()->set('system', 'debugging', $debugging);
- DI::config()->set('system', 'loglevel', $loglevel);
+ if (is_file($logfile) &&
+ !is_writeable($logfile)) {
+ notice(DI::l10n()->t('The logfile \'%s\' is not writable. No logging possible', $logfile));
+ return;
}
- info(DI::l10n()->t("Log settings updated."));
+ DI::config()->set('system', 'logfile', $logfile);
+ DI::config()->set('system', 'debugging', $debugging);
+ DI::config()->set('system', 'loglevel', $loglevel);
+
DI::baseUrl()->redirect('admin/logs');
}
'$debugging' => ['debugging', DI::l10n()->t("Enable Debugging"), DI::config()->get('system', 'debugging'), ""],
'$logfile' => ['logfile', DI::l10n()->t("Log file"), DI::config()->get('system', 'logfile'), DI::l10n()->t("Must be writable by web server. Relative to your Friendica top-level directory.")],
'$loglevel' => ['loglevel', DI::l10n()->t("Log level"), DI::config()->get('system', 'loglevel'), "", $log_choices],
- '$form_security_token' => parent::getFormSecurityToken("admin_logs"),
+ '$form_security_token' => self::getFormSecurityToken("admin_logs"),
'$phpheader' => DI::l10n()->t("PHP logging"),
'$phphint' => DI::l10n()->t("To temporarily enable logging of PHP errors and warnings you can prepend the following to the index.php file of your installation. The filename set in the 'error_log' line is relative to the friendica top-level directory and must be writeable by the web server. The option '1' for 'log_errors' and 'display_errors' is to enable these options, set to '0' to disable them."),
'$phplogcode' => "error_reporting(E_ERROR | E_WARNING | E_PARSE);\nini_set('error_log','php.out');\nini_set('log_errors','1');\nini_set('display_errors', '1');",
'$relay_server_tags' => ['relay_server_tags', DI::l10n()->t('Server tags'), DI::config()->get('system', 'relay_server_tags'), DI::l10n()->t('Comma separated list of tags for the "tags" subscription.')],
'$relay_user_tags' => ['relay_user_tags', DI::l10n()->t('Allow user tags'), DI::config()->get('system', 'relay_user_tags', true), DI::l10n()->t('If enabled, the tags from the saved searches will used for the "tags" subscription in addition to the "relay_server_tags".')],
- '$form_security_token' => parent::getFormSecurityToken('admin_site'),
+ '$form_security_token' => self::getFormSecurityToken('admin_site'),
'$relocate_button' => DI::l10n()->t('Start Relocation'),
]);
}
// reload active themes
if (!empty($_GET['action'])) {
- parent::checkFormSecurityTokenRedirectOnError(DI::baseUrl()->get() . '/admin/themes', 'admin_themes', 't');
+ self::checkFormSecurityTokenRedirectOnError(DI::baseUrl()->get() . '/admin/themes', 'admin_themes', 't');
switch ($_GET['action']) {
case 'reload':
'$noplugshint' => DI::l10n()->t('No themes found on the system. They should be placed in %1$s', '<code>/view/themes</code>'),
'$experimental' => DI::l10n()->t('[Experimental]'),
'$unsupported' => DI::l10n()->t('[Unsupported]'),
- '$form_security_token' => parent::getFormSecurityToken('admin_themes'),
+ '$form_security_token' => self::getFormSecurityToken('admin_themes'),
]);
}
}
{
parent::post($parameters);
- parent::checkFormSecurityTokenRedirectOnError('/admin/tos', 'admin_tos');
-
if (empty($_POST['page_tos'])) {
return;
}
+ self::checkFormSecurityTokenRedirectOnError('/admin/tos', 'admin_tos');
+
$displaytos = !empty($_POST['displaytos']);
$displayprivstatement = !empty($_POST['displayprivstatement']);
$tostext = (!empty($_POST['tostext']) ? strip_tags(trim($_POST['tostext'])) : '');
'$preview' => DI::l10n()->t('Privacy Statement Preview'),
'$privtext' => $tos->privacy_complete,
'$tostext' => ['tostext', DI::l10n()->t('The Terms of Service'), DI::config()->get('system', 'tostext'), DI::l10n()->t('Enter the Terms of Service for your node here. You can use BBCode. Headers of sections should be [h2] and below.')],
- '$form_security_token' => parent::getFormSecurityToken('admin_tos'),
+ '$form_security_token' => self::getFormSecurityToken('admin_tos'),
'$submit' => DI::l10n()->t('Save Settings'),
]);
}
{
parent::post($parameters);
+ self::checkFormSecurityTokenRedirectOnError('/admin/users', 'admin_users');
+
$pending = $_POST['pending'] ?? [];
$users = $_POST['user'] ?? [];
$nu_name = $_POST['new_user_name'] ?? '';
$nu_email = $_POST['new_user_email'] ?? '';
$nu_language = DI::config()->get('system', 'language');
- parent::checkFormSecurityTokenRedirectOnError('/admin/users', 'admin_users');
-
if ($nu_name !== '' && $nu_email !== '' && $nu_nickname !== '') {
try {
User::createMinimal($nu_name, $nu_email, $nu_nickname, $nu_language);
{{if $admin_form}}
<h3>{{$settings}}</h3>
<form method="post" action="{{$baseurl}}/admin/{{$function}}/{{$addon}}">
+ <input type="hidden" name="form_security_token" value="{{$form_security_token}}">
{{$admin_form nofilter}}
</form>
{{/if}}