From 0405edc7984c01b5ef4d6cb4ff5154e8bd4dca11 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rn=20Friedrich=20Dreyer?= Date: Wed, 2 Jan 2013 21:00:50 +0100 Subject: [PATCH 1/4] add translation call for 'Not enough space available' upload error --- apps/files/ajax/upload.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/files/ajax/upload.php b/apps/files/ajax/upload.php index e7823bc4ff..0909a3f077 100644 --- a/apps/files/ajax/upload.php +++ b/apps/files/ajax/upload.php @@ -41,7 +41,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(); } From 3ea9432d43c8a53934ff01c861bde35d22235760 Mon Sep 17 00:00:00 2001 From: Thomas Mueller Date: Wed, 2 Jan 2013 22:15:43 +0100 Subject: [PATCH 2/4] fixing undefined variable $l --- apps/files/ajax/upload.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/apps/files/ajax/upload.php b/apps/files/ajax/upload.php index 0909a3f077..8513736835 100644 --- a/apps/files/ajax/upload.php +++ b/apps/files/ajax/upload.php @@ -13,9 +13,11 @@ if (!isset($_FILES['files'])) { OCP\JSON::error(array('data' => array( 'message' => 'No file was uploaded. Unknown error' ))); exit(); } + +$l=OC_L10N::get('files'); + 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: ') From ea732e5b29939173f1a61ef97c6271a56c70cec4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rn=20Friedrich=20Dreyer?= Date: Thu, 3 Jan 2013 11:57:17 +0100 Subject: [PATCH 3/4] also translate 'No file was uploaded. Unknown error' --- apps/files/ajax/upload.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/files/ajax/upload.php b/apps/files/ajax/upload.php index 0909a3f077..4053cf5f8b 100644 --- a/apps/files/ajax/upload.php +++ b/apps/files/ajax/upload.php @@ -8,14 +8,14 @@ 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: ') From fc64e8ec58961068ae91375325c4f96108ab39b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rn=20Friedrich=20Dreyer?= Date: Thu, 3 Jan 2013 13:31:23 +0100 Subject: [PATCH 4/4] fix error when wrong dir was specified --- apps/files/ajax/upload.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/files/ajax/upload.php b/apps/files/ajax/upload.php index d9960494cc..2a2d935da6 100644 --- a/apps/files/ajax/upload.php +++ b/apps/files/ajax/upload.php @@ -66,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 )));