2015-07-14 04:16:28 +02:00
|
|
|
<?php defined('BLUDIT') or die('Bludit CMS.');
|
|
|
|
|
2015-07-14 06:41:32 +02:00
|
|
|
// ============================================================================
|
|
|
|
// Check role
|
|
|
|
// ============================================================================
|
|
|
|
|
|
|
|
if($Login->role()!=='admin') {
|
|
|
|
Alert::set('You do not have sufficient permissions to access this page, contact the administrator.');
|
|
|
|
Redirect::page('admin', 'dashboard');
|
|
|
|
}
|
|
|
|
|
2015-07-14 04:16:28 +02:00
|
|
|
// ============================================================================
|
|
|
|
// Functions
|
|
|
|
// ============================================================================
|
|
|
|
|
|
|
|
// ============================================================================
|
|
|
|
// Main before POST
|
|
|
|
// ============================================================================
|
|
|
|
$_Plugin = false;
|
|
|
|
|
|
|
|
foreach($plugins['all'] as $P)
|
|
|
|
{
|
|
|
|
if($P->className()==$layout['parameters']) {
|
|
|
|
$_Plugin = $P;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Check if the plugin exists.
|
|
|
|
if($_Plugin===false) {
|
|
|
|
Redirect::page('admin', 'plugins');
|
|
|
|
}
|
|
|
|
|
2015-07-14 06:41:32 +02:00
|
|
|
// Check if the plugin has the method form.
|
|
|
|
if($_Plugin->form()===false) {
|
|
|
|
Redirect::page('admin', 'plugins');
|
|
|
|
}
|
|
|
|
|
2015-07-14 04:16:28 +02:00
|
|
|
// ============================================================================
|
|
|
|
// POST Method
|
|
|
|
// ============================================================================
|
|
|
|
|
|
|
|
if( $_SERVER['REQUEST_METHOD'] == 'POST' )
|
|
|
|
{
|
|
|
|
$_Plugin->setDb($_POST);
|
2015-07-14 06:41:32 +02:00
|
|
|
Alert::set('Configuration has been saved successfully');
|
2015-07-14 04:16:28 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
// ============================================================================
|
|
|
|
// Main after POST
|
|
|
|
// ============================================================================
|