aboutsummaryrefslogtreecommitdiffstats
path: root/apps/files/ajax
diff options
context:
space:
mode:
Diffstat (limited to 'apps/files/ajax')
-rw-r--r--apps/files/ajax/move.php5
-rw-r--r--apps/files/ajax/rename.php8
-rw-r--r--apps/files/ajax/upload.php11
3 files changed, 13 insertions, 11 deletions
diff --git a/apps/files/ajax/move.php b/apps/files/ajax/move.php
index 5612716b7e4..4ebc3f42d9f 100644
--- a/apps/files/ajax/move.php
+++ b/apps/files/ajax/move.php
@@ -11,14 +11,15 @@ $dir = stripslashes($_GET["dir"]);
$file = stripslashes($_GET["file"]);
$target = stripslashes(rawurldecode($_GET["target"]));
+$l=OC_L10N::get('files');
if(OC_Filesystem::file_exists($target . '/' . $file)) {
- OCP\JSON::error(array("data" => array( "message" => "Could not move $file - File with this name already exists" )));
+ OCP\JSON::error(array("data" => array( "message" => $l->t("Could not move %s - File with this name already exists", array($file)) )));
exit;
}
if(OC_Files::move($dir, $file, $target, $file)) {
OCP\JSON::success(array("data" => array( "dir" => $dir, "files" => $file )));
} else {
- OCP\JSON::error(array("data" => array( "message" => "Could not move $file" )));
+ OCP\JSON::error(array("data" => array( "message" => $l->t("Could not move %s", array($file)) )));
}
diff --git a/apps/files/ajax/rename.php b/apps/files/ajax/rename.php
index 45448279fa1..89b4d4bba73 100644
--- a/apps/files/ajax/rename.php
+++ b/apps/files/ajax/rename.php
@@ -12,9 +12,9 @@ $file = stripslashes($_GET["file"]);
$newname = stripslashes($_GET["newname"]);
// Delete
-if( OC_Files::move( $dir, $file, $dir, $newname )) {
+if( $newname !== '.' and OC_Files::move( $dir, $file, $dir, $newname )) {
OCP\JSON::success(array("data" => array( "dir" => $dir, "file" => $file, "newname" => $newname )));
-}
-else{
- OCP\JSON::error(array("data" => array( "message" => "Unable to rename file" )));
+} else {
+ $l=OC_L10N::get('files');
+ OCP\JSON::error(array("data" => array( "message" => $l->t("Unable to rename file") )));
}
diff --git a/apps/files/ajax/upload.php b/apps/files/ajax/upload.php
index e7823bc4ffb..2a2d935da6c 100644
--- a/apps/files/ajax/upload.php
+++ b/apps/files/ajax/upload.php
@@ -8,14 +8,15 @@ OCP\JSON::setContentTypeHeader('text/plain');
OCP\JSON::checkLoggedIn();
OCP\JSON::callCheck();
+$l=OC_L10N::get('files');
if (!isset($_FILES['files'])) {
- OCP\JSON::error(array('data' => array( 'message' => 'No file was uploaded. Unknown error' )));
+ OCP\JSON::error(array('data' => array( 'message' => $l->t( 'No file was uploaded. Unknown error' ))));
exit();
}
+
foreach ($_FILES['files']['error'] as $error) {
if ($error != 0) {
- $l=OC_L10N::get('files');
$errors = array(
UPLOAD_ERR_OK=>$l->t('There is no error, the file uploaded with success'),
UPLOAD_ERR_INI_SIZE=>$l->t('The uploaded file exceeds the upload_max_filesize directive in php.ini: ')
@@ -41,7 +42,7 @@ foreach($files['size'] as $size) {
$totalSize+=$size;
}
if($totalSize>OC_Filesystem::free_space($dir)) {
- OCP\JSON::error(array('data' => array( 'message' => 'Not enough space available' )));
+ OCP\JSON::error(array('data' => array( 'message' => $l->t( 'Not enough space available' ))));
exit();
}
@@ -65,7 +66,7 @@ if(strpos($dir, '..') === false) {
OCP\JSON::encodedPrint($result);
exit();
} else {
- $error='invalid dir';
+ $error=$l->t( 'Invalid directory.' );
}
-OCP\JSON::error(array('data' => array('error' => $error, 'file' => $fileName)));
+OCP\JSON::error(array('data' => array('message' => $error )));