delete plugins from server

add delete plugin action
This commit is contained in:
Mitan Omar
2019-05-10 15:29:16 +02:00
committed by GitHub
parent 3cb8a55db9
commit 5b4532a596

View File

@@ -34,10 +34,11 @@ $plugin_enable_link = ADMIN_PATH . '?cp=' . basename(__file__, '.php') . '&am
$plugin_disable_link = ADMIN_PATH . '?cp=' . basename(__file__, '.php') . '&case=disable&' . $GET_FORM_KEY . '&plg=';
$plugin_download_link = ADMIN_PATH . '?cp=' . basename(__file__, '.php') . '&case=download&' . $GET_FORM_KEY . '&plg=';
$plugin_update_link = ADMIN_PATH . '?cp=' . basename(__file__, '.php') . '&case=update&' . $GET_FORM_KEY . '&plg=';
$plugin_delete_folder_link = ADMIN_PATH . '?cp=' . basename(__file__, '.php') . '&case=delete_folder&' . $GET_FORM_KEY . '&plg=';
//check _GET Csrf token
if (! empty($case) && in_array($case, ['install', 'uninstall', 'enable', 'disable' , 'download' , 'update']))
if (! empty($case) && in_array($case, ['install', 'uninstall', 'enable', 'disable' , 'download' , 'update' , 'delete_folder']))
{
if (! kleeja_check_form_key_get('PLUGINS_FORM_KEY'))
{
@@ -610,7 +611,7 @@ switch ($case):
// download or update msg
kleeja_admin_info(
sprintf($lang[ig('update') ? 'PLUGIN_UPDATED' : 'PLUGIN_DOWNLOADED'], $download_plugin),
ADMIN_PATH . '?cp=' . basename(__file__, '.php')
ADMIN_PATH . '?cp=' . basename(__file__, '.php') . '&case=local'
);
exit;
@@ -656,11 +657,29 @@ switch ($case):
if (is_dir($plugin_folder_name))
{
kleeja_unlink($plugin_folder_name);
delete_plugin_folder($plugin_folder_name);
}
redirect($plugin_download_link . $update_plugin . '&update' );
break;
case 'delete_folder':
$plugin_folder = g('plg');
$plugin_folder_name = PATH . KLEEJA_PLUGINS_FOLDER . '/' . $plugin_folder;
if (is_dir($plugin_folder_name))
{
delete_plugin_folder($plugin_folder_name);
}
kleeja_admin_info(
sprintf($lang['PLG_SUCSS_DEL'] , $plugin_folder),
ADMIN_PATH . '?cp=' . basename(__file__, '.php') . '&case=local'
);
break;
endswitch;