bludit/admin/controllers/configure-plugin.php

51 lines
1.5 KiB
PHP
Raw Normal View History

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'));
2015-07-14 06:41:32 +02:00
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-20 05:14:12 +02:00
Alert::set($Language->g('the-changes-have-been-saved'));
2015-07-14 04:16:28 +02:00
}
// ============================================================================
// Main after POST
// ============================================================================