-
+
+
+
+ {lang.NO_RESULT_USE_SYNC}
+
+
+
+
-
-
-
-
-
-
-
-
-
-{page_nums}
-
-
-
-{H_FORM_KEYS}
-
+
+
\ No newline at end of file
diff --git a/includes/adm/c_files.php b/includes/adm/c_files.php
index a9bbede..20b9d13 100755
--- a/includes/adm/c_files.php
+++ b/includes/adm/c_files.php
@@ -17,6 +17,7 @@ if (! defined('IN_ADMIN'))
//number of images per page
$files_acp_perpage = defined('ACP_FILES_PER_PAGE') ? ACP_FILES_PER_PAGE : 20;
+$current_smt = preg_replace('/[^a-z0-9_]/i', '', g('smt', 'str', ''));
//display
@@ -30,7 +31,7 @@ $url_pg = ig('page') ? '&page=' . g('page', 'int') : '';
$page_action = basename(ADMIN_PATH) . '?cp=' . basename(__file__, '.php') . $url_or . $url_sea . $url_lst;
$ord_action = basename(ADMIN_PATH) . '?cp=' . basename(__file__, '.php') . $url_pg . $url_sea . $url_lst;
$page2_action = basename(ADMIN_PATH) . '?cp=' . basename(__file__, '.php') . $url_or2 . $url_sea . $url_lst;
-$action = $page_action . $url_pg;
+$action = $page_action . $url_pg . ($current_smt == 'delete_by_extension' ? '&smt=delete_by_extension' : '');
$is_search = $affected = false;
$H_FORM_KEYS = kleeja_add_form_key('adm_files');
@@ -133,11 +134,11 @@ if (ip('submit'))
'' . "\n";
$stylee = 'admin_info';
}
-else
+elseif ($current_smt == '')
{
//
-//Delete all user files [only one user]
+ //Delete all user files [only one user]
//
if (ig('deletefiles'))
{
@@ -404,3 +405,90 @@ else
$page_nums = $Pager->print_nums($page_action);
$current_page = $Pager->getCurrentPage();
}
+elseif ($current_smt == 'delete_by_extension')
+{
+ if (ig('fetch_ext_files'))
+ {
+ $query = [
+ 'SELECT' => 'id',
+ 'FROM' => $dbprefix . 'files',
+ 'WHERE' => 'type = \'' . g('fetch_ext_files') . '\''
+ ];
+
+ $SQL->build($query);
+
+ echo $SQL->num_rows();
+
+ exit;
+ }
+
+ if (ip('delete_files'))
+ {
+ $ext = p('selected_extnsion');
+
+ $query = [
+ 'SELECT' => 'id, name, type, size',
+ 'FROM' => $dbprefix . 'files',
+ 'WHERE' => 'type = \'' . $ext . '\''
+ ];
+
+ $SQL->build($query);
+ $deleted_files = [];
+ $fileSizes = 0;
+
+ if ($SQL->num_rows())
+ {
+ while ($file = $SQL->fetch())
+ {
+ $fileLocation = PATH . 'uploads/' . $file['name'];
+ $thumbFileLocation = PATH . 'uploads/thumbs/' . $file['name'];
+
+ if (is_file($fileLocation))
+ {
+ kleeja_unlink($fileLocation);
+ }
+ if (is_file($thumbFileLocation))
+ {
+ kleeja_unlink($thumbFileLocation);
+ }
+ $fileSizes += $file['size'];
+ $deleted_files[] = $file['id'];
+ }
+
+ if (($deletedFileCount = count($deleted_files)) <= 1)
+ {
+ $SQL->query("delete from {$dbprefix}files where id = '$deleted_files[0]'");
+ }
+ else
+ {
+ $SQL->query("delete from {$dbprefix}files where id in (" . implode(',', $deleted_files) . ')');
+ }
+
+ $update_stats = "update {$dbprefix}stats set " . (in_array($ext, ['png','gif','jpg','jpeg', 'bmp']) ? 'imgs = imgs-' . $deletedFileCount : 'files = files-' . $deletedFileCount)
+ . ", sizes = sizes-{$fileSizes}";
+
+
+ $SQL->query($update_stats);
+ }
+
+ kleeja_admin_info($lang['ADMIN_DELETE_FILE_OK'], true, '', true, $action);
+ }
+
+ $available_extensions = [];
+ $query = [
+ 'SELECT' => 'DISTINCT type',
+ 'FROM' => $dbprefix . 'files'
+ ];
+
+ $SQL->build($query);
+
+ while ($ext = $SQL->fetch())
+ {
+ $available_extensions[] = $ext;
+ }
+
+ $no_results = count($available_extensions) == 0;
+}
+$go_menu = [
+ 'delete_by_extension' => ['name'=> $lang['DEL_BY_EXT'], 'link'=> basename(ADMIN_PATH) . '?cp=c_files&smt=delete_by_extension', 'goto'=>'delete_by_extension', 'current'=> $current_smt == 'delete_by_extension'],
+];
diff --git a/includes/style.php b/includes/style.php
index cf9d059..4eef86c 100755
--- a/includes/style.php
+++ b/includes/style.php
@@ -38,6 +38,7 @@ class kleeja_style
$html = file_get_contents($template_path);
$html = $this->_parse($html, $template_name);
+ $html = "\n" . $html;
//use 'b' to force binary mode
if ($filename = @fopen(PATH . 'cache/tpl_' . $this->re_name_tpl($template_name, $style_path) . '.php', 'wb'))
diff --git a/lang/ar/acp.php b/lang/ar/acp.php
index f79b085..a968f7a 100755
--- a/lang/ar/acp.php
+++ b/lang/ar/acp.php
@@ -280,4 +280,8 @@ return [
'CANT_DEL_DEFAULT_STYLE' => 'لا يمكنك حذف الستايل الإفتراضي! قم بتعيين ستايل آخر لتستطيع حذفه.',
'NOTIFICATIONS' => 'تنبيهات',
'KJ_TWEETS' => 'تغريدات كليجا',
+ 'DEL_BY_EXT' => 'حذف الملفات حسب الامتداد',
+ 'SELECT_EXT' => 'حدد الامتداد',
+ 'NO_FILE_WITH_EXT' => 'لا يوجد ملفات موجودة بالملحق المحدد',
+ 'X_FILE_WITH_EXT' => 'يوجد (x) ملفات بالملحق المحدد',
];
diff --git a/lang/en/acp.php b/lang/en/acp.php
index b9d1d9e..ff0ea63 100755
--- a/lang/en/acp.php
+++ b/lang/en/acp.php
@@ -277,4 +277,8 @@ return [
'CANT_DEL_DEFAULT_STYLE' => 'You can not delete the current default style! choose another style to be the default then try again.',
'NOTIFICATIONS' => 'Notifications',
'KJ_TWEETS' => 'Kleeja Tweets',
+ 'DEL_BY_EXT' => 'Delete Files By Extension',
+ 'SELECT_EXT' => 'Select an Extension',
+ 'NO_FILE_WITH_EXT' => 'there is no files exists with the selected extension',
+ 'X_FILE_WITH_EXT' => 'there is (x) files exists with the selected extension',
];