mirror of
https://github.com/monstra-cms/monstra.git
synced 2025-08-04 04:07:59 +02:00
System Plugin: csrf vulnerability resolved
This commit is contained in:
37
plugins/box/system/system.admin.php
Normal file → Executable file
37
plugins/box/system/system.admin.php
Normal file → Executable file
@@ -66,19 +66,26 @@
|
|||||||
|
|
||||||
// Create Sitemap
|
// Create Sitemap
|
||||||
// -------------------------------------
|
// -------------------------------------
|
||||||
if (Request::get('sitemap')) {
|
if (Request::get('sitemap') == 'create') {
|
||||||
if ('create' == Request::get('sitemap')) {
|
|
||||||
|
if (Security::check(Request::get('token'))) {
|
||||||
|
|
||||||
Notification::set('success', __('Sitemap created', 'system'));
|
Notification::set('success', __('Sitemap created', 'system'));
|
||||||
|
|
||||||
Sitemap::create();
|
Sitemap::create();
|
||||||
|
|
||||||
Request::redirect('index.php?id=system');
|
Request::redirect('index.php?id=system');
|
||||||
}
|
|
||||||
|
} else { die('csrf detected!'); }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Delete temporary files
|
// Delete temporary files
|
||||||
// -------------------------------------
|
// -------------------------------------
|
||||||
if (Request::get('temporary_files')) {
|
if (Request::get('temporary_files') == 'delete') {
|
||||||
if ('delete' == Request::get('temporary_files')) {
|
|
||||||
|
if (Security::check(Request::get('token'))) {
|
||||||
|
|
||||||
$namespaces = Dir::scan(CACHE);
|
$namespaces = Dir::scan(CACHE);
|
||||||
if (count($namespaces) > 0) {
|
if (count($namespaces) > 0) {
|
||||||
@@ -104,13 +111,19 @@
|
|||||||
// Set maintenance state on or off
|
// Set maintenance state on or off
|
||||||
// -------------------------------------
|
// -------------------------------------
|
||||||
if (Request::get('maintenance')) {
|
if (Request::get('maintenance')) {
|
||||||
if ('on' == Request::get('maintenance')) {
|
|
||||||
Option::update('maintenance_status', 'on');
|
if (Security::check(Request::get('token'))) {
|
||||||
Request::redirect('index.php?id=system');
|
|
||||||
}
|
if ('on' == Request::get('maintenance')) {
|
||||||
if ('off' == Request::get('maintenance')) {
|
Option::update('maintenance_status', 'on');
|
||||||
Option::update('maintenance_status', 'off');
|
Request::redirect('index.php?id=system');
|
||||||
Request::redirect('index.php?id=system');
|
}
|
||||||
|
|
||||||
|
if ('off' == Request::get('maintenance')) {
|
||||||
|
Option::update('maintenance_status', 'off');
|
||||||
|
Request::redirect('index.php?id=system');
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
8
plugins/box/system/views/backend/index.view.php
Normal file → Executable file
8
plugins/box/system/views/backend/index.view.php
Normal file → Executable file
@@ -4,12 +4,12 @@
|
|||||||
|
|
||||||
<?php if (Notification::get('success')) Alert::success(Notification::get('success')); ?>
|
<?php if (Notification::get('success')) Alert::success(Notification::get('success')); ?>
|
||||||
|
|
||||||
<?php echo Html::anchor(__('Create sitemap', 'system'), 'index.php?id=system&sitemap=create', array('class' => 'btn')).Html::nbsp(2); ?>
|
<?php echo Html::anchor(__('Create sitemap', 'system'), 'index.php?id=system&sitemap=create&token='.Security::token(), array('class' => 'btn')).Html::nbsp(2); ?>
|
||||||
<?php echo Html::anchor(__('Delete temporary files', 'system'), 'index.php?id=system&temporary_files=delete', array('class' => 'btn')).Html::nbsp(2); ?>
|
<?php echo Html::anchor(__('Delete temporary files', 'system'), 'index.php?id=system&temporary_files=delete&token='.Security::token(), array('class' => 'btn')).Html::nbsp(2); ?>
|
||||||
<?php if ('off' == Option::get('maintenance_status', 'system')) { ?>
|
<?php if ('off' == Option::get('maintenance_status', 'system')) { ?>
|
||||||
<?php echo Html::anchor(__('Maintenance Mode On', 'system'), 'index.php?id=system&maintenance=on', array('class' => 'btn')); ?>
|
<?php echo Html::anchor(__('Maintenance Mode On', 'system'), 'index.php?id=system&maintenance=on&token='.Security::token(), array('class' => 'btn')); ?>
|
||||||
<?php } else { ?>
|
<?php } else { ?>
|
||||||
<?php echo Html::anchor(__('Maintenance Mode Off', 'system'), 'index.php?id=system&maintenance=off', array('class' => 'btn btn-danger')); ?>
|
<?php echo Html::anchor(__('Maintenance Mode Off', 'system'), 'index.php?id=system&maintenance=off&token='.Security::token(), array('class' => 'btn btn-danger')); ?>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
<?php Action::run('admin_system_extra_buttons'); ?>
|
<?php Action::run('admin_system_extra_buttons'); ?>
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user