mirror of
https://github.com/kleeja-official/kleeja.git
synced 2025-12-14 20:19:43 +01:00
add file informations after uploading the files
This commit is contained in:
2
.gitignore
vendored
2
.gitignore
vendored
@@ -15,7 +15,7 @@ uploads/thumbs/*
|
||||
!uploads/thumbs/.htaccess
|
||||
styles/*
|
||||
!styles/bootstrap/*
|
||||
!styles/default/*
|
||||
!/styles/bootstrap/js/script.js
|
||||
!styles/index.html
|
||||
.DS_Store
|
||||
*/.DS_Store
|
||||
|
||||
22
do.php
22
do.php
@@ -31,7 +31,7 @@ if (ig('id') || ig('filename'))
|
||||
is_array($plugin_run_result = Plugins::getInstance()->run('begin_download_id_filename', get_defined_vars())) ? extract($plugin_run_result) : null; //run hook
|
||||
|
||||
$query = [
|
||||
'SELECT' => 'f.id, f.real_filename, f.name, f.folder, f.size, f.time, f.uploads, f.type',
|
||||
'SELECT' => 'f.id, f.real_filename, f.about, f.name, f.folder, f.size, f.time, f.uploads, f.type',
|
||||
'FROM' => "{$dbprefix}files f",
|
||||
'LIMIT' => '1',
|
||||
];
|
||||
@@ -84,13 +84,23 @@ if (ig('id') || ig('filename'))
|
||||
$size = $file_info['size'];
|
||||
$time = $file_info['time'];
|
||||
$uploads = $file_info['uploads'];
|
||||
$about_file = ! in_array($file_info['about'], ['', null]) ? $file_info['about'] : $lang['FILE_NO_INFO'];
|
||||
|
||||
|
||||
$fname2 = str_replace('.', '-', htmlspecialchars($name));
|
||||
$name = $real_filename != '' ? str_replace('.' . $type, '', htmlspecialchars($real_filename)) : $name;
|
||||
$name = strlen($name) > 70 ? substr($name, 0, 70) . '...' : $name;
|
||||
$fusername = $config['user_system'] == 1 && $file_info['fuserid'] > -1 ? $file_info['fusername'] : false;
|
||||
$userfolder = $config['siteurl'] . ($config['mod_writer'] ? 'fileuser-' . $file_info['fuserid'] . '.html' : 'ucp.php?go=fileuser&id=' . $file_info['fuserid']);
|
||||
$fname2 = str_replace('.', '-', htmlspecialchars($name));
|
||||
$name = $real_filename != '' ? str_replace('.' . $type, '', htmlspecialchars($real_filename)) : $name;
|
||||
$name = strlen($name) > 70 ? substr($name, 0, 70) . '...' : $name;
|
||||
$fusername = $config['user_system'] == 1 && $file_info['fuserid'] > -1 ? $file_info['fusername'] : false;
|
||||
$userfolder = $config['siteurl'] . ($config['mod_writer'] ? 'fileuser-' . $file_info['fuserid'] . '.html' : 'ucp.php?go=fileuser&id=' . $file_info['fuserid']);
|
||||
$isFileOwnerOfFounder = $fusername == $usrcp->name() || $usrcp->get_data('founder')['founder'] == 1;
|
||||
|
||||
if (ip('change_file_about') && $isFileOwnerOfFounder)
|
||||
{
|
||||
$newAbout = (String) p('about') != '' ? (string) p('about') : null;
|
||||
$SQL->query("UPDATE {$dbprefix}files SET about = \"{$newAbout}\" WHERE id = {$file_info['id']}");
|
||||
|
||||
exit;
|
||||
}
|
||||
|
||||
if (ig('filename'))
|
||||
{
|
||||
|
||||
@@ -16,9 +16,9 @@ if (! defined('IN_COMMON'))
|
||||
|
||||
|
||||
|
||||
define('KLEEJA_VERSION', '3.1.6');
|
||||
define('KLEEJA_VERSION', '3.1.7');
|
||||
|
||||
define('KLEEJA_DB_VERSION', '9');
|
||||
define('KLEEJA_DB_VERSION', '10');
|
||||
|
||||
// Kleeja min requirements
|
||||
define('MIN_PHP_VERSION', '7.0');
|
||||
|
||||
@@ -32,3 +32,7 @@ $update_schema[9]['sql'] = [
|
||||
// function () {
|
||||
// },
|
||||
// ];
|
||||
|
||||
$update_schema[10]['sql'] = [
|
||||
'about_files' => "ALTER TABLE `{$dbprefix}files` ADD `about` LONGTEXT NULL DEFAULT NULL AFTER `real_filename`;",
|
||||
];
|
||||
@@ -279,4 +279,7 @@ return [
|
||||
'EMAIL_CHANGE_REQ_PASS' => 'لتغيير بريدك الإلكتروني يجب أن تقوم بكتابة كلمة مرورك الحالية.',
|
||||
'DRAG_AND_DROP' => 'جر وأسقط ملف هنا للرفع…',
|
||||
'OR_MANUAL_SELECT' => 'أو قم بالضغط هنا <em>لإختيار</em> ملف يدوياً..',
|
||||
'ABOUT_FILE' => 'معلومات الملف',
|
||||
'FILE_NO_INFO' => 'لم يتم العثور على معلومات حول هذا الملف',
|
||||
'SAVE' => 'حفظ',
|
||||
];
|
||||
|
||||
@@ -282,4 +282,7 @@ return [
|
||||
'EMAIL_CHANGE_REQ_PASS' => 'In order to change your email address, It\'s required to type your current password.',
|
||||
'DRAG_AND_DROP' => 'Drop a file inside…',
|
||||
'OR_MANUAL_SELECT' => 'Or click here to <em>Select</em> a file manually..',
|
||||
'ABOUT_FILE' => 'File Information',
|
||||
'FILE_NO_INFO' => 'No Information found about this file',
|
||||
'SAVE' => 'Save',
|
||||
];
|
||||
|
||||
@@ -64,6 +64,26 @@
|
||||
|
||||
</div>
|
||||
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<div class="d-flex justify-content-between p-1">
|
||||
{lang.ABOUT_FILE}
|
||||
<IF NAME="isFileOwnerOfFounder">
|
||||
<a href="javascript: void(0)" id="about_edit_save" class="btn btn-primary btn-sm py-0">{lang.EDIT}</a>
|
||||
</IF>
|
||||
</div>
|
||||
</div>
|
||||
<div class="list-group list-group-flush">
|
||||
<div class="card">
|
||||
<div id="about_holder" class="card-body">
|
||||
<p id="about_content">{about_file}</p>
|
||||
<div class="form-group" >
|
||||
<textarea class="form-control" id="edit_textarea" style="display: none;" rows="3"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
@@ -85,5 +105,32 @@ function ti()
|
||||
document.getElementById("url").innerHTML = '<p class="download"><a href="{url_file}" target="_blank" class="btn btn-outline-primary btn-lg">{lang.CLICK_DOWN}<\/a><br /><span class="badge badge-default">{size}<\/span><\/p>';
|
||||
}
|
||||
}
|
||||
|
||||
let about_edit_save = document.getElementById('about_edit_save');
|
||||
let about_content = document.getElementById('about_content');
|
||||
let edit_textarea = document.getElementById('edit_textarea');
|
||||
|
||||
about_edit_save.onclick = () => {
|
||||
switch (about_edit_save.textContent) {
|
||||
case '{lang.SAVE}':
|
||||
about_content.innerHTML = edit_textarea.value == '' ? '{lang.FILE_NO_INFO}' : edit_textarea.value;
|
||||
about_content.style.display = '';
|
||||
edit_textarea.style.display = 'none';
|
||||
about_edit_save.innerHTML = '{lang.EDIT}';
|
||||
ajaxRemote('POST', 'http://kleeja.me.to/do.php?id={id}', 'change_file_about=1&about=' + edit_textarea.value, (request) => {})
|
||||
|
||||
break;
|
||||
|
||||
case '{lang.EDIT}':
|
||||
edit_textarea.value = about_content.textContent == '{lang.FILE_NO_INFO}' ? '' : about_content.textContent;
|
||||
about_content.style.display = 'none';
|
||||
edit_textarea.style.display = '';
|
||||
about_edit_save.innerHTML = '{lang.SAVE}'
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
//-->
|
||||
</script>
|
||||
|
||||
@@ -39,6 +39,7 @@
|
||||
|
||||
<script type="text/javascript" src="{STYLE_PATH}js/jquery.min.js"></script>
|
||||
<script type="text/javascript" src="{STYLE_PATH}js/bootstrap.min.js"></script>
|
||||
<script type="text/javascript" src="{STYLE_PATH}js/script.js"></script>
|
||||
|
||||
<!-- don't ever delete this -->
|
||||
{run_queue}
|
||||
|
||||
Reference in New Issue
Block a user