bludit/bl-kernel/admin/controllers/configure-plugin.php

55 lines
1.6 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;
2015-07-28 03:01:52 +02:00
$pluginClassName = $layout['parameters'];
2015-07-14 04:16:28 +02:00
foreach($plugins['all'] as $P)
{
2015-07-28 03:01:52 +02:00
if($P->className()==$pluginClassName) {
2015-07-14 04:16:28 +02:00
$_Plugin = $P;
}
}
// Check if the plugin exists.
if($_Plugin===false) {
Redirect::page('admin', 'plugins');
}
2015-08-01 18:28:47 +02:00
// Check if the plugin has the method form()
2015-08-07 23:33:43 +02:00
if(!method_exists($_Plugin, 'form')) {
2015-08-01 18:28:47 +02:00
Redirect::page('admin', 'plugins');
}
2015-07-14 04:16:28 +02:00
// ============================================================================
// POST Method
// ============================================================================
if( $_SERVER['REQUEST_METHOD'] == 'POST' )
{
$_Plugin->setDb($_POST);
Theme::plugins('afterFormSave');
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
// ============================================================================