mirror of
https://github.com/monstra-cms/monstra.git
synced 2025-08-04 04:07:59 +02:00
Files Manager Improvements - Updates #94
This commit is contained in:
@@ -69,9 +69,9 @@ class FilesmanagerAdmin extends Backend
|
|||||||
|
|
||||||
File::delete($files_path.Request::get('delete_file'));
|
File::delete($files_path.Request::get('delete_file'));
|
||||||
if (!is_file($files_path.Request::get('delete_file'))) {
|
if (!is_file($files_path.Request::get('delete_file'))) {
|
||||||
Notification::set('success', __('File was deleted', 'system'));
|
Notification::set('success', __('File was deleted', 'filesmanager'));
|
||||||
} else {
|
} else {
|
||||||
Notification::set('error', __('File was not deleted', 'system'));
|
Notification::set('error', __('File was not deleted', 'filesmanager'));
|
||||||
}
|
}
|
||||||
Request::redirect($site_url.'/admin/index.php?id=filesmanager&path='.$path);
|
Request::redirect($site_url.'/admin/index.php?id=filesmanager&path='.$path);
|
||||||
|
|
||||||
@@ -87,9 +87,9 @@ class FilesmanagerAdmin extends Backend
|
|||||||
Dir::delete($files_path.Request::get('delete_dir'));
|
Dir::delete($files_path.Request::get('delete_dir'));
|
||||||
|
|
||||||
if (!is_dir($files_path.Request::get('delete_dir'))) {
|
if (!is_dir($files_path.Request::get('delete_dir'))) {
|
||||||
Notification::set('success', __('Directory was deleted', 'system'));
|
Notification::set('success', __('Directory was deleted', 'filesmanager'));
|
||||||
} else {
|
} else {
|
||||||
Notification::set('error', __('Directory was not deleted', 'system'));
|
Notification::set('error', __('Directory was not deleted', 'filesmanager'));
|
||||||
}
|
}
|
||||||
|
|
||||||
Request::redirect($site_url.'/admin/index.php?id=filesmanager&path='.$path);
|
Request::redirect($site_url.'/admin/index.php?id=filesmanager&path='.$path);
|
||||||
@@ -110,7 +110,7 @@ class FilesmanagerAdmin extends Backend
|
|||||||
$rename_to = Request::post('rename_to');
|
$rename_to = Request::post('rename_to');
|
||||||
|
|
||||||
if (empty($rename_to)) {
|
if (empty($rename_to)) {
|
||||||
Notification::set('error', __('Can not be empty', 'system'));
|
Notification::set('error', __('Can not be empty', 'filesmanager'));
|
||||||
Request::redirect($site_url.'/admin/index.php?id=filesmanager&path='.$path);
|
Request::redirect($site_url.'/admin/index.php?id=filesmanager&path='.$path);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -118,21 +118,21 @@ class FilesmanagerAdmin extends Backend
|
|||||||
$rename_to = $files_path . Security::safeName($rename_to).$ext;
|
$rename_to = $files_path . Security::safeName($rename_to).$ext;
|
||||||
|
|
||||||
if (is_dir($rename_to)) {
|
if (is_dir($rename_to)) {
|
||||||
Notification::set('error', __('Directory exists', 'system'));
|
Notification::set('error', __('Directory exists', 'filesmanager'));
|
||||||
Request::redirect($site_url.'/admin/index.php?id=filesmanager&path='.$path);
|
Request::redirect($site_url.'/admin/index.php?id=filesmanager&path='.$path);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is_file($rename_to)) {
|
if (is_file($rename_to)) {
|
||||||
Notification::set('error', __('File exists', 'system'));
|
Notification::set('error', __('File exists', 'filesmanager'));
|
||||||
Request::redirect($site_url.'/admin/index.php?id=filesmanager&path='.$path);
|
Request::redirect($site_url.'/admin/index.php?id=filesmanager&path='.$path);
|
||||||
}
|
}
|
||||||
|
|
||||||
$success = rename($files_path.$rename_from, $rename_to);
|
$success = rename($files_path.$rename_from, $rename_to);
|
||||||
|
|
||||||
if ($success) {
|
if ($success) {
|
||||||
Notification::set('success', __('Renamed successfully', 'system'));
|
Notification::set('success', __('Renamed successfully', 'filesmanager'));
|
||||||
} else {
|
} else {
|
||||||
Notification::set('error', __('Failure', 'system'));
|
Notification::set('error', __('Failure', 'filesmanager'));
|
||||||
}
|
}
|
||||||
Request::redirect($site_url.'/admin/index.php?id=filesmanager&path='.$path);
|
Request::redirect($site_url.'/admin/index.php?id=filesmanager&path='.$path);
|
||||||
|
|
||||||
@@ -151,7 +151,7 @@ class FilesmanagerAdmin extends Backend
|
|||||||
$filepath = $files_path.Security::safeName(basename($_FILES['file']['name'], File::ext($_FILES['file']['name'])), '-', true).'.'.File::ext($_FILES['file']['name']);
|
$filepath = $files_path.Security::safeName(basename($_FILES['file']['name'], File::ext($_FILES['file']['name'])), '-', true).'.'.File::ext($_FILES['file']['name']);
|
||||||
$uploaded = move_uploaded_file($_FILES['file']['tmp_name'], $filepath);
|
$uploaded = move_uploaded_file($_FILES['file']['tmp_name'], $filepath);
|
||||||
if ($uploaded !== false && is_file($filepath)) {
|
if ($uploaded !== false && is_file($filepath)) {
|
||||||
Notification::set('success', __('File was uploaded', 'system'));
|
Notification::set('success', __('File was uploaded', 'filesmanager'));
|
||||||
} else {
|
} else {
|
||||||
$error = 'File was not uploaded';
|
$error = 'File was not uploaded';
|
||||||
}
|
}
|
||||||
@@ -163,7 +163,7 @@ class FilesmanagerAdmin extends Backend
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($error) {
|
if ($error) {
|
||||||
Notification::set('error', __($error, 'system'));
|
Notification::set('error', __($error, 'filesmanager'));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Request::post('dragndrop')) {
|
if (Request::post('dragndrop')) {
|
||||||
@@ -195,9 +195,9 @@ class FilesmanagerAdmin extends Backend
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($error) {
|
if ($error) {
|
||||||
Alert::error(__('Directory was not created', 'system'));
|
Alert::error(__('Directory was not created', 'filesmanager'));
|
||||||
} else {
|
} else {
|
||||||
Alert::success(__('Directory was created', 'system'));
|
Alert::success(__('Directory was created', 'filesmanager'));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -240,7 +240,7 @@ class FilesmanagerAdmin extends Backend
|
|||||||
->assign('fileuploader', array(
|
->assign('fileuploader', array(
|
||||||
'uploadUrl' => $site_url.'/admin/index.php?id=filesmanager&path='.$path,
|
'uploadUrl' => $site_url.'/admin/index.php?id=filesmanager&path='.$path,
|
||||||
'csrf' => Security::token(),
|
'csrf' => Security::token(),
|
||||||
'errorMsg' => __('Upload server error', 'system')
|
'errorMsg' => __('Upload server error', 'filesmanager')
|
||||||
))->display();
|
))->display();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -34,7 +34,7 @@
|
|||||||
<div class="col-md-6">
|
<div class="col-md-6">
|
||||||
<div class="pull-right">
|
<div class="pull-right">
|
||||||
<button class="btn btn-primary" data-toggle="modal" data-target="#createNewDirectory">
|
<button class="btn btn-primary" data-toggle="modal" data-target="#createNewDirectory">
|
||||||
Create New Directory
|
<?php echo __('Create New Directory', 'filesmanager'); ?>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -137,18 +137,18 @@
|
|||||||
<div class="modal-content">
|
<div class="modal-content">
|
||||||
<div class="modal-header">
|
<div class="modal-header">
|
||||||
<a class="close" data-dismiss="modal">×</a>
|
<a class="close" data-dismiss="modal">×</a>
|
||||||
<h4 class="modal-title" id="myModalLabel">Create New Directory</h4>
|
<h4 class="modal-title" id="myModalLabel"><?php echo __('Create New Directory', 'filesmanager'); ?></h4>
|
||||||
</div>
|
</div>
|
||||||
<form role="form" method="POST">
|
<form role="form" method="POST">
|
||||||
<?php echo Form::hidden('csrf', Security::token()); ?>
|
<?php echo Form::hidden('csrf', Security::token()); ?>
|
||||||
<div class="modal-body">
|
<div class="modal-body">
|
||||||
<label for="directoryName">Directory Name</label>
|
<label for="directoryName"><?php echo __('Directory Name', 'filesmanager'); ?></label>
|
||||||
<input type="hidden" name="path" value="<?php echo $path; ?>" />
|
<input type="hidden" name="path" value="<?php echo $path; ?>" />
|
||||||
<input type="text" class="form-control" id="directoryName" name="directory_name" />
|
<input type="text" class="form-control" id="directoryName" name="directory_name" />
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-footer">
|
<div class="modal-footer">
|
||||||
<button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
|
<button type="button" class="btn btn-default" data-dismiss="modal"><?php echo __('Cancel', 'filesmanager'); ?></button>
|
||||||
<button type="submit" class="btn btn-primary">Create</button>
|
<button type="submit" class="btn btn-primary"><?php echo __('Create', 'filesmanager'); ?></button>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
@@ -160,12 +160,11 @@
|
|||||||
<div class="modal-content">
|
<div class="modal-content">
|
||||||
<div class="modal-header">
|
<div class="modal-header">
|
||||||
<a class="close" data-dismiss="modal">×</a>
|
<a class="close" data-dismiss="modal">×</a>
|
||||||
<h4 class="modal-title">Rename</h4>
|
<h4 class="modal-title"><?php echo __('Rename', 'filesmanager'); ?></h4>
|
||||||
</div>
|
</div>
|
||||||
<form role="form" method="POST">
|
<form role="form" method="POST">
|
||||||
<?php echo Form::hidden('csrf', Security::token()); ?>
|
<?php echo Form::hidden('csrf', Security::token()); ?>
|
||||||
<div class="modal-body">
|
<div class="modal-body">
|
||||||
|
|
||||||
<label for="renameTo">
|
<label for="renameTo">
|
||||||
<span id="dirRenameType"><?php echo __('Directory:', 'filesmanager'); ?></span>
|
<span id="dirRenameType"><?php echo __('Directory:', 'filesmanager'); ?></span>
|
||||||
<span id="fileRenameType"><?php echo __('File:', 'filesmanager'); ?></span>
|
<span id="fileRenameType"><?php echo __('File:', 'filesmanager'); ?></span>
|
||||||
@@ -175,10 +174,9 @@
|
|||||||
<input type="hidden" name="rename_type" value="" />
|
<input type="hidden" name="rename_type" value="" />
|
||||||
<input type="hidden" name="rename_from" value="" />
|
<input type="hidden" name="rename_from" value="" />
|
||||||
<input type="text" class="form-control" id="renameTo" name="rename_to" />
|
<input type="text" class="form-control" id="renameTo" name="rename_to" />
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-footer">
|
<div class="modal-footer">
|
||||||
<button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
|
<button type="button" class="btn btn-default" data-dismiss="modal"><?php echo __('Cancel', 'filesmanager'); ?></button>
|
||||||
<button type="submit" class="btn btn-primary"><?php echo __('Rename', 'filesmanager'); ?></button>
|
<button type="submit" class="btn btn-primary"><?php echo __('Rename', 'filesmanager'); ?></button>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
Reference in New Issue
Block a user