commit
226aec8d56
@ -1 +1 @@ |
||||
Subproject commit a13af72fbe8983686fc47489a750e60319f68ac2 |
||||
Subproject commit 2d59ac4f7bd354d9ea7ebea05f863d9f50ccb6ee |
||||
@ -1,26 +1,41 @@ |
||||
<?php |
||||
|
||||
// Init owncloud |
||||
|
||||
/** |
||||
* ownCloud - Core |
||||
* |
||||
* @author Morris Jobke |
||||
* @copyright 2013 Morris Jobke morris.jobke@gmail.com |
||||
* |
||||
* This library is free software; you can redistribute it and/or |
||||
* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE |
||||
* License as published by the Free Software Foundation; either |
||||
* version 3 of the License, or any later version. |
||||
* |
||||
* This library is distributed in the hope that it will be useful, |
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
* GNU AFFERO GENERAL PUBLIC LICENSE for more details. |
||||
* |
||||
* You should have received a copy of the GNU Affero General Public |
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>. |
||||
* |
||||
*/ |
||||
|
||||
OCP\JSON::checkLoggedIn(); |
||||
OCP\JSON::callCheck(); |
||||
|
||||
// Get data |
||||
$dir = stripslashes($_GET["dir"]); |
||||
$file = stripslashes($_GET["file"]); |
||||
$newname = stripslashes($_GET["newname"]); |
||||
|
||||
$l = OC_L10N::get('files'); |
||||
$files = new \OCA\Files\App( |
||||
\OC\Files\Filesystem::getView(), |
||||
\OC_L10n::get('files') |
||||
); |
||||
$result = $files->rename( |
||||
$_GET["dir"], |
||||
$_GET["file"], |
||||
$_GET["newname"] |
||||
); |
||||
|
||||
if ( $newname !== '.' and ($dir != '' || $file != 'Shared') and $newname !== '.') { |
||||
$targetFile = \OC\Files\Filesystem::normalizePath($dir . '/' . $newname); |
||||
$sourceFile = \OC\Files\Filesystem::normalizePath($dir . '/' . $file); |
||||
if(\OC\Files\Filesystem::rename($sourceFile, $targetFile)) { |
||||
OCP\JSON::success(array("data" => array( "dir" => $dir, "file" => $file, "newname" => $newname ))); |
||||
} else { |
||||
OCP\JSON::error(array("data" => array( "message" => $l->t("Unable to rename file") ))); |
||||
} |
||||
}else{ |
||||
OCP\JSON::error(array("data" => array( "message" => $l->t("Unable to rename file") ))); |
||||
} |
||||
if($result['success'] === true){ |
||||
OCP\JSON::success(array('data' => $result['data'])); |
||||
} else { |
||||
OCP\JSON::error(array('data' => $result['data'])); |
||||
} |
||||
@ -0,0 +1,3 @@ |
||||
<?php $TRANSLATIONS = array( |
||||
"Download" => "Download" |
||||
); |
||||
@ -1,23 +1,74 @@ |
||||
<?php $TRANSLATIONS = array( |
||||
"Could not move %s - File with this name already exists" => "Klarte ikkje å flytta %s – det finst allereie ei fil med dette namnet", |
||||
"Could not move %s" => "Klarte ikkje å flytta %s", |
||||
"No file was uploaded. Unknown error" => "Ingen filer lasta opp. Ukjend feil", |
||||
"There is no error, the file uploaded with success" => "Ingen feil, fila vart lasta opp", |
||||
"The uploaded file exceeds the upload_max_filesize directive in php.ini: " => "Fila du lasta opp er større enn det «upload_max_filesize» i php.ini tillater: ", |
||||
"The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form" => "Den opplasta fila er større enn variabelen MAX_FILE_SIZE i HTML-skjemaet", |
||||
"The uploaded file was only partially uploaded" => "Fila vart berre delvis lasta opp", |
||||
"No file was uploaded" => "Ingen filer vart lasta opp", |
||||
"Missing a temporary folder" => "Manglar ei mellombels mappe", |
||||
"Failed to write to disk" => "Klarte ikkje å skriva til disk", |
||||
"Not enough storage available" => "Ikkje nok lagringsplass tilgjengeleg", |
||||
"Invalid directory." => "Ugyldig mappe.", |
||||
"Files" => "Filer", |
||||
"Share" => "Del", |
||||
"Delete permanently" => "Slett for godt", |
||||
"Delete" => "Slett", |
||||
"Rename" => "Endra namn", |
||||
"Pending" => "Under vegs", |
||||
"{new_name} already exists" => "{new_name} finst allereie", |
||||
"replace" => "byt ut", |
||||
"suggest name" => "føreslå namn", |
||||
"cancel" => "avbryt", |
||||
"replaced {new_name} with {old_name}" => "bytte ut {new_name} med {old_name}", |
||||
"undo" => "angre", |
||||
"perform delete operation" => "utfør sletting", |
||||
"1 file uploading" => "1 fil lastar opp", |
||||
"files uploading" => "filer lastar opp", |
||||
"'.' is an invalid file name." => "«.» er eit ugyldig filnamn.", |
||||
"File name cannot be empty." => "Filnamnet kan ikkje vera tomt.", |
||||
"Invalid name, '\\', '/', '<', '>', ':', '\"', '|', '?' and '*' are not allowed." => "Ugyldig namn, «\\», «/», «<», «>», «:», «\"», «|», «?» og «*» er ikkje tillate.", |
||||
"Your storage is full, files can not be updated or synced anymore!" => "Lagringa di er full, kan ikkje lenger oppdatera eller synkronisera!", |
||||
"Your storage is almost full ({usedSpacePercent}%)" => "Lagringa di er nesten full ({usedSpacePercent} %)", |
||||
"Your download is being prepared. This might take some time if the files are big." => "Gjer klar nedlastinga di. Dette kan ta ei stund viss filene er store.", |
||||
"Unable to upload your file as it is a directory or has 0 bytes" => "Klarte ikkje å lasta opp fila sidan ho er ei mappe eller er på 0 byte", |
||||
"Not enough space available" => "Ikkje nok lagringsplass tilgjengeleg", |
||||
"Upload cancelled." => "Opplasting avbroten.", |
||||
"File upload is in progress. Leaving the page now will cancel the upload." => "Fila lastar no opp. Viss du forlèt sida no vil opplastinga bli avbroten.", |
||||
"URL cannot be empty." => "URL-en kan ikkje vera tom.", |
||||
"Invalid folder name. Usage of 'Shared' is reserved by Owncloud" => "Ugyldig mappenamn. Mappa «Shared» er reservert av ownCloud", |
||||
"Error" => "Feil", |
||||
"Name" => "Namn", |
||||
"Size" => "Storleik", |
||||
"Modified" => "Endra", |
||||
"1 folder" => "1 mappe", |
||||
"{count} folders" => "{count} mapper", |
||||
"1 file" => "1 fil", |
||||
"{count} files" => "{count} filer", |
||||
"Unable to rename file" => "Klarte ikkje å endra filnamnet", |
||||
"Upload" => "Last opp", |
||||
"File handling" => "Filhandtering", |
||||
"Maximum upload size" => "Maksimal opplastingsstorleik", |
||||
"max. possible: " => "maks. moglege:", |
||||
"Needed for multi-file and folder downloads." => "Naudsynt for fleirfils- og mappenedlastingar.", |
||||
"Enable ZIP-download" => "Skru på ZIP-nedlasting", |
||||
"0 is unlimited" => "0 er ubegrensa", |
||||
"Maximum input size for ZIP files" => "Maksimal storleik for ZIP-filer", |
||||
"Save" => "Lagre", |
||||
"New" => "Ny", |
||||
"Text file" => "Tekst fil", |
||||
"Folder" => "Mappe", |
||||
"From link" => "Frå lenkje", |
||||
"Deleted files" => "Sletta filer", |
||||
"Cancel upload" => "Avbryt opplasting", |
||||
"You don’t have write permissions here." => "Du har ikkje skriverettar her.", |
||||
"Nothing in here. Upload something!" => "Ingenting her. Last noko opp!", |
||||
"Download" => "Last ned", |
||||
"Unshare" => "Udel", |
||||
"Upload too large" => "For stor opplasting", |
||||
"The files you are trying to upload exceed the maximum size for file uploads on this server." => "Filene du prøver å laste opp er større enn maksgrensa til denne tenaren." |
||||
"The files you are trying to upload exceed the maximum size for file uploads on this server." => "Filene du prøver å laste opp er større enn maksgrensa til denne tenaren.", |
||||
"Files are being scanned, please wait." => "Skannar filer, ver venleg og vent.", |
||||
"Current scanning" => "Køyrande skanning", |
||||
"Upgrading filesystem cache..." => "Oppgraderer mellomlageret av filsystemet …" |
||||
); |
||||
|
||||
@ -0,0 +1,44 @@ |
||||
<?php $TRANSLATIONS = array( |
||||
"Could not move %s" => "%s يۆتكىيەلمەيدۇ", |
||||
"No file was uploaded. Unknown error" => "ھېچقانداق ھۆججەت يۈكلەنمىدى. يوچۇن خاتالىق", |
||||
"No file was uploaded" => "ھېچقانداق ھۆججەت يۈكلەنمىدى", |
||||
"Missing a temporary folder" => "ۋاقىتلىق قىسقۇچ كەم.", |
||||
"Failed to write to disk" => "دىسكىغا يازالمىدى", |
||||
"Not enough storage available" => "يېتەرلىك ساقلاش بوشلۇقى يوق", |
||||
"Files" => "ھۆججەتلەر", |
||||
"Share" => "ھەمبەھىر", |
||||
"Delete permanently" => "مەڭگۈلۈك ئۆچۈر", |
||||
"Delete" => "ئۆچۈر", |
||||
"Rename" => "ئات ئۆزگەرت", |
||||
"Pending" => "كۈتۈۋاتىدۇ", |
||||
"{new_name} already exists" => "{new_name} مەۋجۇت", |
||||
"replace" => "ئالماشتۇر", |
||||
"suggest name" => "تەۋسىيە ئات", |
||||
"cancel" => "ۋاز كەچ", |
||||
"undo" => "يېنىۋال", |
||||
"1 file uploading" => "1 ھۆججەت يۈكلىنىۋاتىدۇ", |
||||
"files uploading" => "ھۆججەت يۈكلىنىۋاتىدۇ", |
||||
"Not enough space available" => "يېتەرلىك بوشلۇق يوق", |
||||
"Upload cancelled." => "يۈكلەشتىن ۋاز كەچتى.", |
||||
"File upload is in progress. Leaving the page now will cancel the upload." => "ھۆججەت يۈكلەش مەشغۇلاتى ئېلىپ بېرىلىۋاتىدۇ. Leaving the page now will cancel the upload.", |
||||
"Error" => "خاتالىق", |
||||
"Name" => "ئاتى", |
||||
"Size" => "چوڭلۇقى", |
||||
"Modified" => "ئۆزگەرتكەن", |
||||
"1 folder" => "1 قىسقۇچ", |
||||
"1 file" => "1 ھۆججەت", |
||||
"{count} files" => "{count} ھۆججەت", |
||||
"Unable to rename file" => "ھۆججەت ئاتىنى ئۆزگەرتكىلى بولمايدۇ", |
||||
"Upload" => "يۈكلە", |
||||
"Save" => "ساقلا", |
||||
"New" => "يېڭى", |
||||
"Text file" => "تېكىست ھۆججەت", |
||||
"Folder" => "قىسقۇچ", |
||||
"Deleted files" => "ئۆچۈرۈلگەن ھۆججەتلەر", |
||||
"Cancel upload" => "يۈكلەشتىن ۋاز كەچ", |
||||
"Nothing in here. Upload something!" => "بۇ جايدا ھېچنېمە يوق. Upload something!", |
||||
"Download" => "چۈشۈر", |
||||
"Unshare" => "ھەمبەھىرلىمە", |
||||
"Upload too large" => "يۈكلەندىغىنى بەك چوڭ", |
||||
"Upgrading filesystem cache..." => "ھۆججەت سىستېما غەملىكىنى يۈكسەلدۈرۈۋاتىدۇ…" |
||||
); |
||||
@ -1,3 +1,4 @@ |
||||
<?php $TRANSLATIONS = array( |
||||
"Error" => "ایرر" |
||||
"Error" => "ایرر", |
||||
"Unshare" => "شئیرنگ ختم کریں" |
||||
); |
||||
|
||||
@ -0,0 +1,79 @@ |
||||
<?php |
||||
|
||||
/** |
||||
* ownCloud - Core |
||||
* |
||||
* @author Morris Jobke |
||||
* @copyright 2013 Morris Jobke morris.jobke@gmail.com |
||||
* |
||||
* This library is free software; you can redistribute it and/or |
||||
* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE |
||||
* License as published by the Free Software Foundation; either |
||||
* version 3 of the License, or any later version. |
||||
* |
||||
* This library is distributed in the hope that it will be useful, |
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
* GNU AFFERO GENERAL PUBLIC LICENSE for more details. |
||||
* |
||||
* You should have received a copy of the GNU Affero General Public |
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>. |
||||
* |
||||
*/ |
||||
|
||||
|
||||
namespace OCA\Files; |
||||
|
||||
class App { |
||||
private $l10n; |
||||
private $view; |
||||
|
||||
public function __construct($view, $l10n) { |
||||
$this->view = $view; |
||||
$this->l10n = $l10n; |
||||
} |
||||
|
||||
/** |
||||
* rename a file |
||||
* |
||||
* @param string $dir |
||||
* @param string $oldname |
||||
* @param string $newname |
||||
* @return array |
||||
*/ |
||||
public function rename($dir, $oldname, $newname) { |
||||
$result = array( |
||||
'success' => false, |
||||
'data' => NULL |
||||
); |
||||
|
||||
// rename to "/Shared" is denied |
||||
if( $dir === '/' and $newname === 'Shared' ) { |
||||
$result['data'] = array( |
||||
'message' => $this->l10n->t("Invalid folder name. Usage of 'Shared' is reserved by ownCloud") |
||||
); |
||||
} elseif( |
||||
// rename to "." is denied |
||||
$newname !== '.' and |
||||
// rename of "/Shared" is denied |
||||
!($dir === '/' and $oldname === 'Shared') and |
||||
// THEN try to rename |
||||
$this->view->rename($dir . '/' . $oldname, $dir . '/' . $newname) |
||||
) { |
||||
// successful rename |
||||
$result['success'] = true; |
||||
$result['data'] = array( |
||||
'dir' => $dir, |
||||
'file' => $oldname, |
||||
'newname' => $newname |
||||
); |
||||
} else { |
||||
// rename failed |
||||
$result['data'] = array( |
||||
'message' => $this->l10n->t('Unable to rename file') |
||||
); |
||||
} |
||||
return $result; |
||||
} |
||||
|
||||
} |
||||
@ -0,0 +1,117 @@ |
||||
<?php |
||||
|
||||
/** |
||||
* ownCloud - Core |
||||
* |
||||
* @author Morris Jobke |
||||
* @copyright 2013 Morris Jobke morris.jobke@gmail.com |
||||
* |
||||
* This library is free software; you can redistribute it and/or |
||||
* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE |
||||
* License as published by the Free Software Foundation; either |
||||
* version 3 of the License, or any later version. |
||||
* |
||||
* This library is distributed in the hope that it will be useful, |
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
* GNU AFFERO GENERAL PUBLIC LICENSE for more details. |
||||
* |
||||
* You should have received a copy of the GNU Affero General Public |
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>. |
||||
* |
||||
*/ |
||||
|
||||
class Test_OC_Files_App_Rename extends \PHPUnit_Framework_TestCase { |
||||
|
||||
function setUp() { |
||||
// mock OC_L10n |
||||
$l10nMock = $this->getMock('\OC_L10N', array('t'), array(), '', false); |
||||
$l10nMock->expects($this->any()) |
||||
->method('t') |
||||
->will($this->returnArgument(0)); |
||||
$viewMock = $this->getMock('\OC\Files\View', array('rename', 'normalizePath'), array(), '', false); |
||||
$viewMock->expects($this->any()) |
||||
->method('normalizePath') |
||||
->will($this->returnArgument(0)); |
||||
$viewMock->expects($this->any()) |
||||
->method('rename') |
||||
->will($this->returnValue(true)); |
||||
$this->files = new \OCA\Files\App($viewMock, $l10nMock); |
||||
} |
||||
|
||||
/** |
||||
* @brief test rename of file/folder named "Shared" |
||||
*/ |
||||
function testRenameSharedFolder() { |
||||
$dir = '/'; |
||||
$oldname = 'Shared'; |
||||
$newname = 'new_name'; |
||||
|
||||
$result = $this->files->rename($dir, $oldname, $newname); |
||||
$expected = array( |
||||
'success' => false, |
||||
'data' => array('message' => 'Unable to rename file') |
||||
); |
||||
|
||||
$this->assertEquals($expected, $result); |
||||
} |
||||
|
||||
/** |
||||
* @brief test rename of file/folder named "Shared" |
||||
*/ |
||||
function testRenameSharedFolderInSubdirectory() { |
||||
$dir = '/test'; |
||||
$oldname = 'Shared'; |
||||
$newname = 'new_name'; |
||||
|
||||
$result = $this->files->rename($dir, $oldname, $newname); |
||||
$expected = array( |
||||
'success' => true, |
||||
'data' => array( |
||||
'dir' => $dir, |
||||
'file' => $oldname, |
||||
'newname' => $newname |
||||
) |
||||
); |
||||
|
||||
$this->assertEquals($expected, $result); |
||||
} |
||||
|
||||
/** |
||||
* @brief test rename of file/folder to "Shared" |
||||
*/ |
||||
function testRenameFolderToShared() { |
||||
$dir = '/'; |
||||
$oldname = 'oldname'; |
||||
$newname = 'Shared'; |
||||
|
||||
$result = $this->files->rename($dir, $oldname, $newname); |
||||
$expected = array( |
||||
'success' => false, |
||||
'data' => array('message' => "Invalid folder name. Usage of 'Shared' is reserved by ownCloud") |
||||
); |
||||
|
||||
$this->assertEquals($expected, $result); |
||||
} |
||||
|
||||
/** |
||||
* @brief test rename of file/folder |
||||
*/ |
||||
function testRenameFolder() { |
||||
$dir = '/'; |
||||
$oldname = 'oldname'; |
||||
$newname = 'newname'; |
||||
|
||||
$result = $this->files->rename($dir, $oldname, $newname); |
||||
$expected = array( |
||||
'success' => true, |
||||
'data' => array( |
||||
'dir' => $dir, |
||||
'file' => $oldname, |
||||
'newname' => $newname |
||||
) |
||||
); |
||||
|
||||
$this->assertEquals($expected, $result); |
||||
} |
||||
} |
||||
@ -1,7 +1,7 @@ |
||||
<?php $TRANSLATIONS = array( |
||||
"Encryption" => "Encriptatge", |
||||
"File encryption is enabled." => "L'encriptació de fitxers està activada.", |
||||
"The following file types will not be encrypted:" => "Els tipus de fitxers següents no s'encriptaran:", |
||||
"Exclude the following file types from encryption:" => "Exclou els tipus de fitxers següents de l'encriptatge:", |
||||
"Encryption" => "Xifrat", |
||||
"File encryption is enabled." => "El xifrat de fitxers està activat.", |
||||
"The following file types will not be encrypted:" => "Els tipus de fitxers següents no es xifraran:", |
||||
"Exclude the following file types from encryption:" => "Exclou els tipus de fitxers següents del xifratge:", |
||||
"None" => "Cap" |
||||
); |
||||
|
||||
@ -0,0 +1,7 @@ |
||||
<?php $TRANSLATIONS = array( |
||||
"Encryption" => "Amgryptiad", |
||||
"File encryption is enabled." => "Galluogwyd amgryptio ffeiliau.", |
||||
"The following file types will not be encrypted:" => "Ni fydd ffeiliau o'r math yma'n cael eu hamgryptio:", |
||||
"Exclude the following file types from encryption:" => "Eithrio'r mathau canlynol o ffeiliau rhag cael eu hamgryptio:", |
||||
"None" => "Dim" |
||||
); |
||||
@ -0,0 +1,7 @@ |
||||
<?php $TRANSLATIONS = array( |
||||
"Encryption" => "شىفىرلاش", |
||||
"File encryption is enabled." => "ھۆججەت شىفىرلاش قوزغىتىلدى.", |
||||
"The following file types will not be encrypted:" => "تۆۋەندىكى ھۆججەت تىپلىرى شىفىرلانمايدۇ:", |
||||
"Exclude the following file types from encryption:" => "تۆۋەندىكى ھۆججەت تىپلىرى شىفىرلاشنىڭ سىرتىدا:", |
||||
"None" => "يوق" |
||||
); |
||||
@ -1,5 +1,5 @@ |
||||
<?php $TRANSLATIONS = array( |
||||
"Groups" => "مجموعات", |
||||
"Users" => "المستخدمين", |
||||
"Delete" => "حذف" |
||||
"Delete" => "إلغاء" |
||||
); |
||||
|
||||
@ -1,4 +1,5 @@ |
||||
<?php $TRANSLATIONS = array( |
||||
"Groups" => "Grwpiau", |
||||
"Users" => "Defnyddwyr", |
||||
"Delete" => "Dileu" |
||||
); |
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue