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') {
|
2015-07-20 05:14:12 +02:00
|
|
|
Alert::set($Language->g('you-do-not-have-sufficient-permissions'));
|
2017-05-27 19:46:46 +02:00
|
|
|
Redirect::page('dashboard');
|
2015-07-14 06:41:32 +02:00
|
|
|
}
|
|
|
|
|
2015-07-14 04:16:28 +02:00
|
|
|
// ============================================================================
|
|
|
|
// Functions
|
|
|
|
// ============================================================================
|
|
|
|
|
|
|
|
// ============================================================================
|
|
|
|
// Main before POST
|
|
|
|
// ============================================================================
|
2017-05-27 19:46:46 +02:00
|
|
|
$plugin = false;
|
2015-07-28 03:01:52 +02:00
|
|
|
$pluginClassName = $layout['parameters'];
|
2015-07-14 04:16:28 +02:00
|
|
|
|
2017-05-27 19:46:46 +02:00
|
|
|
// Check if the plugin exists
|
|
|
|
if( isset($plugins['all'][$pluginClassName]) ) {
|
|
|
|
$plugin = $plugins['all'][$pluginClassName];
|
2015-07-14 04:16:28 +02:00
|
|
|
}
|
2017-05-27 19:46:46 +02:00
|
|
|
else {
|
|
|
|
Redirect::page('plugins');
|
2015-07-14 04:16:28 +02:00
|
|
|
}
|
|
|
|
|
2015-08-01 18:28:47 +02:00
|
|
|
// Check if the plugin has the method form()
|
2017-05-27 19:46:46 +02:00
|
|
|
if( !method_exists($plugin, 'form') ) {
|
|
|
|
Redirect::page('plugins');
|
2015-08-01 18:28:47 +02:00
|
|
|
}
|
|
|
|
|
2015-07-14 04:16:28 +02:00
|
|
|
// ============================================================================
|
|
|
|
// POST Method
|
|
|
|
// ============================================================================
|
|
|
|
|
|
|
|
if( $_SERVER['REQUEST_METHOD'] == 'POST' )
|
|
|
|
{
|
2017-05-27 19:46:46 +02:00
|
|
|
$plugin->setDb($_POST);
|
2016-05-30 05:36:13 +02:00
|
|
|
|
2017-05-27 19:46:46 +02:00
|
|
|
// Add to syslog
|
|
|
|
$Syslog->add(array(
|
|
|
|
'dictionaryKey'=>'plugin-configured',
|
|
|
|
'notes'=>$plugin->name()
|
|
|
|
));
|
2016-05-30 05:36:13 +02:00
|
|
|
|
2017-05-27 19:46:46 +02:00
|
|
|
// Create an alert
|
|
|
|
Alert::set( $Language->g('The changes have been saved') );
|
2015-07-14 04:16:28 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
// ============================================================================
|
|
|
|
// Main after POST
|
|
|
|
// ============================================================================
|