Merge pull request #90 from MitanOmar/auto-updater

add action ( delete plugin from server )
This commit is contained in:
Abdulrahman ☕️
2019-05-11 01:41:05 +03:00
committed by GitHub
4 changed files with 28 additions and 4 deletions

View File

@@ -98,6 +98,7 @@
<h5 class="mt-0 mb-1 pull-(lang.DIR==ltr?left:right)">{{name}}</h5>
<a class="btn btn-primary pull-(lang.DIR==ltr?right:left)" href="{plugin_install_link}{{name}}" title="{lang.ENABLE}" onclick="javascript:return confirm_form('{lang.PLUGIN_CONFIRM_ADD}');"><i class="fa fa-download" title="{lang.ENABLE}"></i></a>
<a class="btn btn-danger pull-(lang.DIR==ltr?right:left)" href="{plugin_delete_folder_link}{{name}}" title="{lang.DELETE}" onclick="javascript:return confirm_form('{lang.PLG_DEL_CONFIRM}');"><i class="fa fa-trash" title="{lang.DELETE}"></i></a>
</div>
</li>
</LOOP>
@@ -196,4 +197,4 @@
</LOOP>
</ul>
</IF>
</IF>

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') . '&amp;case=disable&amp;' . $GET_FORM_KEY . '&amp;plg=';
$plugin_download_link = ADMIN_PATH . '?cp=' . basename(__file__, '.php') . '&amp;case=download&amp;' . $GET_FORM_KEY . '&amp;plg=';
$plugin_update_link = ADMIN_PATH . '?cp=' . basename(__file__, '.php') . '&amp;case=update&amp;' . $GET_FORM_KEY . '&amp;plg=';
$plugin_delete_folder_link = ADMIN_PATH . '?cp=' . basename(__file__, '.php') . '&amp;case=delete_folder&amp;' . $GET_FORM_KEY . '&amp;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') . '&amp;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 . '&amp;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') . '&amp;case=local'
);
break;
endswitch;

View File

@@ -298,4 +298,6 @@ return [
//3.0.3
'NOTIFICATIONS' => 'تنبيهات',
'KJ_TWEETS' => 'تغريدات كليجا' ,
'PLG_SUCSS_DEL' => 'تم حذف مجلد الاضافة "%s" بنجاح!' ,
'PLG_DEL_CONFIRM' => 'سوف تقوم بحذف مجلد الاضافة' ,
];

View File

@@ -288,4 +288,6 @@ return [
//3.0.3
'NOTIFICATIONS' => 'Notifications',
'KJ_TWEETS' => 'Kleeja Tweets' ,
'PLG_SUCSS_DEL' => 'the Folder of plugin "%s" is deleted successfuly !!' ,
'PLG_DEL_CONFIRM' => 'You will delete the plugin folder' ,
];