mirror of
https://github.com/slawkens/myaac.git
synced 2025-04-27 01:39:22 +02:00

* Fix alert class name * feature: csrf protection * Cosmetics * Fix token generate * Admin Panel: changelogs csrf protection * news/id route * Refactor admin newses + add csrf * Use admin.links instead * Admin panel: Pages csrf * Menus: better csrf + add success message on reset colors * Plugins csrf * Move definitions * add info function, same as note($message) * Update mailer.php * Fix new page/news links * clear_cache & maintenance csrf * Formatting * Fix news type * Fix changelog link * Add new changelog link * More info to confirm dialog * This is always true
44 lines
804 B
PHP
44 lines
804 B
PHP
<?php
|
|
const MYAAC_ADMIN = true;
|
|
|
|
require '../../common.php';
|
|
require SYSTEM . 'functions.php';
|
|
require SYSTEM . 'init.php';
|
|
require SYSTEM . 'login.php';
|
|
|
|
// event system
|
|
require_once SYSTEM . 'hooks.php';
|
|
$hooks = new Hooks();
|
|
$hooks->load();
|
|
|
|
if(!admin()) {
|
|
http_response_code(500);
|
|
die('Access denied.');
|
|
}
|
|
|
|
csrfProtect();
|
|
|
|
if (!isset($_REQUEST['plugin'])) {
|
|
http_response_code(500);
|
|
die('Please enter plugin name.');
|
|
}
|
|
|
|
if (!isset($_POST['settings'])) {
|
|
http_response_code(500);
|
|
die('Please enter settings.');
|
|
}
|
|
|
|
$settings = Settings::getInstance();
|
|
|
|
$success = $settings->save($_REQUEST['plugin'], $_POST['settings']);
|
|
|
|
$errors = $settings->getErrors();
|
|
if (count($errors) > 0) {
|
|
http_response_code(500);
|
|
die(implode('<br/>', $errors));
|
|
}
|
|
|
|
if ($success) {
|
|
echo 'Saved at ' . date('H:i');
|
|
}
|