2015-06-10 23:27:04 -03:00
|
|
|
<?php defined('BLUDIT') or die('Bludit CMS.');
|
|
|
|
|
|
|
|
// ============================================================================
|
|
|
|
// Check role
|
|
|
|
// ============================================================================
|
|
|
|
|
|
|
|
if($Login->role()!=='admin') {
|
2015-07-20 00:14:12 -03:00
|
|
|
Alert::set($Language->g('you-do-not-have-sufficient-permissions'));
|
2017-05-27 19:46:46 +02:00
|
|
|
Redirect::page('dashboard');
|
2015-06-10 23:27:04 -03:00
|
|
|
}
|
|
|
|
|
|
|
|
// ============================================================================
|
|
|
|
// Functions
|
|
|
|
// ============================================================================
|
|
|
|
|
2015-08-02 21:49:12 -03:00
|
|
|
// ============================================================================
|
|
|
|
// Main before POST
|
|
|
|
// ============================================================================
|
|
|
|
|
2015-06-10 23:27:04 -03:00
|
|
|
// ============================================================================
|
|
|
|
// POST Method
|
|
|
|
// ============================================================================
|
|
|
|
|
|
|
|
// ============================================================================
|
2015-08-02 21:49:12 -03:00
|
|
|
// Main after POST
|
2015-06-10 23:27:04 -03:00
|
|
|
// ============================================================================
|
2015-06-12 01:00:04 -03:00
|
|
|
$pluginClassName = $layout['parameters'];
|
|
|
|
|
2017-06-18 22:44:07 +02:00
|
|
|
// Check if the plugin exists
|
|
|
|
if( isset($plugins['all'][$pluginClassName]) ) {
|
|
|
|
$plugin = $plugins['all'][$pluginClassName];
|
|
|
|
|
|
|
|
// Install plugin
|
|
|
|
if( $plugin->install() ) {
|
|
|
|
// Add to syslog
|
|
|
|
$Syslog->add(array(
|
|
|
|
'dictionaryKey'=>'plugin-installed',
|
|
|
|
'notes'=>$plugin->name()
|
|
|
|
));
|
|
|
|
|
|
|
|
// Create an alert
|
|
|
|
Alert::set($Language->g('Plugin installed'));
|
2015-07-27 22:01:52 -03:00
|
|
|
}
|
|
|
|
}
|
2015-06-12 01:00:04 -03:00
|
|
|
|
2017-05-27 19:46:46 +02:00
|
|
|
Redirect::page('plugins');
|