diff options
Diffstat (limited to 'apps/files')
-rw-r--r-- | apps/files/ajax/autocomplete.php | 2 | ||||
-rw-r--r-- | apps/files/ajax/delete.php | 2 | ||||
-rw-r--r-- | apps/files/ajax/download.php | 1 | ||||
-rw-r--r-- | apps/files/ajax/list.php | 2 | ||||
-rw-r--r-- | apps/files/ajax/mimeicon.php | 2 | ||||
-rw-r--r-- | apps/files/ajax/move.php | 2 | ||||
-rw-r--r-- | apps/files/ajax/newfile.php | 58 | ||||
-rw-r--r-- | apps/files/ajax/rawlist.php | 2 | ||||
-rw-r--r-- | apps/files/ajax/rename.php | 2 | ||||
-rw-r--r-- | apps/files/ajax/scan.php | 5 | ||||
-rw-r--r-- | apps/files/ajax/timezone.php | 2 | ||||
-rw-r--r-- | apps/files/ajax/upload.php | 2 | ||||
-rw-r--r-- | apps/files/appinfo/update.php | 11 | ||||
-rw-r--r-- | apps/files/appinfo/version | 2 | ||||
-rw-r--r-- | apps/files/download.php | 1 | ||||
-rw-r--r-- | apps/files/index.php | 3 | ||||
-rw-r--r-- | apps/files/js/filelist.js | 2 | ||||
-rw-r--r-- | apps/files/js/files.js | 36 | ||||
-rw-r--r-- | apps/files/l10n/es.php | 14 | ||||
-rw-r--r-- | apps/files/l10n/it.php | 14 | ||||
-rw-r--r-- | apps/files/l10n/vi.php | 31 | ||||
-rw-r--r-- | apps/files/settings.php | 2 |
22 files changed, 144 insertions, 54 deletions
diff --git a/apps/files/ajax/autocomplete.php b/apps/files/ajax/autocomplete.php index 7ff34da96b3..e504bb24bf8 100644 --- a/apps/files/ajax/autocomplete.php +++ b/apps/files/ajax/autocomplete.php @@ -52,5 +52,3 @@ if(OC_Filesystem::file_exists($base) and OC_Filesystem::is_dir($base)){ } } OCP\JSON::encodedPrint($files); - -?> diff --git a/apps/files/ajax/delete.php b/apps/files/ajax/delete.php index 161d820f735..695f803884e 100644 --- a/apps/files/ajax/delete.php +++ b/apps/files/ajax/delete.php @@ -26,5 +26,3 @@ if($success) { } else { OCP\JSON::error(array("data" => array( "message" => "Could not delete:\n" . $filesWithError ))); } - -?> diff --git a/apps/files/ajax/download.php b/apps/files/ajax/download.php index e9373f5f6ac..b9a4ddaf5e7 100644 --- a/apps/files/ajax/download.php +++ b/apps/files/ajax/download.php @@ -34,4 +34,3 @@ $files = $_GET["files"]; $dir = $_GET["dir"]; OC_Files::get($dir, $files, $_SERVER['REQUEST_METHOD'] == 'HEAD' ? true : false); -?> diff --git a/apps/files/ajax/list.php b/apps/files/ajax/list.php index f0600a179d0..dae0c1a828d 100644 --- a/apps/files/ajax/list.php +++ b/apps/files/ajax/list.php @@ -42,5 +42,3 @@ $list->assign( "files", $files, false ); $data = array('files' => $list->fetchPage()); OCP\JSON::success(array('data' => $data)); - -?> diff --git a/apps/files/ajax/mimeicon.php b/apps/files/ajax/mimeicon.php index 57898cd82d9..80d50f84528 100644 --- a/apps/files/ajax/mimeicon.php +++ b/apps/files/ajax/mimeicon.php @@ -7,5 +7,3 @@ $RUNTIME_NOAPPS=false; print OC_Helper::mimetypeIcon($_GET['mime']); - -?> diff --git a/apps/files/ajax/move.php b/apps/files/ajax/move.php index 56171dd0ed3..3d4003a8edc 100644 --- a/apps/files/ajax/move.php +++ b/apps/files/ajax/move.php @@ -17,5 +17,3 @@ if(OC_Files::move($dir,$file,$target,$file)){ }else{ OCP\JSON::error(array("data" => array( "message" => "Could not move $file" ))); } - -?> diff --git a/apps/files/ajax/newfile.php b/apps/files/ajax/newfile.php index 7236deb65c9..cc9208ad08f 100644 --- a/apps/files/ajax/newfile.php +++ b/apps/files/ajax/newfile.php @@ -1,16 +1,25 @@ <?php // Init owncloud +global $eventSource; +if(!OC_User::isLoggedIn()){ + exit; +} -OCP\JSON::checkLoggedIn(); -OCP\JSON::callCheck(); +session_write_close(); // Get the params -$dir = isset( $_POST['dir'] ) ? stripslashes($_POST['dir']) : ''; -$filename = isset( $_POST['filename'] ) ? stripslashes($_POST['filename']) : ''; -$content = isset( $_POST['content'] ) ? $_POST['content'] : ''; -$source = isset( $_POST['source'] ) ? stripslashes($_POST['source']) : ''; +$dir = isset( $_REQUEST['dir'] ) ? stripslashes($_REQUEST['dir']) : ''; +$filename = isset( $_REQUEST['filename'] ) ? stripslashes($_REQUEST['filename']) : ''; +$content = isset( $_REQUEST['content'] ) ? $_REQUEST['content'] : ''; +$source = isset( $_REQUEST['source'] ) ? stripslashes($_REQUEST['source']) : ''; + +if($source){ + $eventSource=new OC_EventSource(); +}else{ + OC_JSON::callCheck(); +} if($filename == '') { OCP\JSON::error(array("data" => array( "message" => "Empty Filename" ))); @@ -21,22 +30,49 @@ if(strpos($filename,'/')!==false){ exit(); } +function progress($notification_code, $severity, $message, $message_code, $bytes_transferred, $bytes_max){ + static $filesize = 0; + static $lastsize = 0; + global $eventSource; + + switch($notification_code) { + case STREAM_NOTIFY_FILE_SIZE_IS: + $filesize = $bytes_max; + break; + + case STREAM_NOTIFY_PROGRESS: + if ($bytes_transferred > 0) { + if (!isset($filesize)) { + } else { + $progress = (int)(($bytes_transferred/$filesize)*100); + if($progress>$lastsize){//limit the number or messages send + $eventSource->send('progress',$progress); + } + $lastsize=$progress; + } + } + break; + } +} + if($source){ if(substr($source,0,8)!='https://' and substr($source,0,7)!='http://'){ OCP\JSON::error(array("data" => array( "message" => "Not a valid source" ))); exit(); } - $sourceStream=fopen($source,'rb'); + + $ctx = stream_context_create(null, array('notification' =>'progress')); + $sourceStream=fopen($source,'rb', false, $ctx); $target=$dir.'/'.$filename; $result=OC_Filesystem::file_put_contents($target,$sourceStream); if($result){ $mime=OC_Filesystem::getMimetype($target); - OCP\JSON::success(array("data" => array('mime'=>$mime))); - exit(); + $eventSource->send('success',$mime); }else{ - OCP\JSON::error(array("data" => array( "message" => "Error while downloading ".$source. ' to '.$target ))); - exit(); + $eventSource->send('error',"Error while downloading ".$source. ' to '.$target); } + $eventSource->close(); + exit(); }else{ if($content){ if(OC_Filesystem::file_put_contents($dir.'/'.$filename,$content)){ diff --git a/apps/files/ajax/rawlist.php b/apps/files/ajax/rawlist.php index 7cb02f79673..d159f6e152f 100644 --- a/apps/files/ajax/rawlist.php +++ b/apps/files/ajax/rawlist.php @@ -22,5 +22,3 @@ foreach( OC_Files::getdirectorycontent( $dir, $mimetype ) as $i ){ } OCP\JSON::success(array('data' => $files)); - -?> diff --git a/apps/files/ajax/rename.php b/apps/files/ajax/rename.php index 8e98308eb5c..45448279fa1 100644 --- a/apps/files/ajax/rename.php +++ b/apps/files/ajax/rename.php @@ -18,5 +18,3 @@ if( OC_Files::move( $dir, $file, $dir, $newname )) { else{ OCP\JSON::error(array("data" => array( "message" => "Unable to rename file" ))); } - -?> diff --git a/apps/files/ajax/scan.php b/apps/files/ajax/scan.php index 6fcf97688c2..eef38858516 100644 --- a/apps/files/ajax/scan.php +++ b/apps/files/ajax/scan.php @@ -16,6 +16,11 @@ session_write_close(); if($force or !OC_FileCache::inCache('')){ if(!$checkOnly){ OCP\DB::beginTransaction(); + + if(OC_Cache::isFast()){ + OC_Cache::clear('fileid/'); //make sure the old fileid's don't mess things up + } + OC_FileCache::scan($dir,$eventSource); OC_FileCache::clean(); OCP\DB::commit(); diff --git a/apps/files/ajax/timezone.php b/apps/files/ajax/timezone.php index cafb5074ece..0be441a36a2 100644 --- a/apps/files/ajax/timezone.php +++ b/apps/files/ajax/timezone.php @@ -3,4 +3,4 @@ // see lib/base.php for an example //session_start(); $_SESSION['timezone'] = $_GET['time']; -?> +
\ No newline at end of file diff --git a/apps/files/ajax/upload.php b/apps/files/ajax/upload.php index 5553cf5a13e..74e6eb560d8 100644 --- a/apps/files/ajax/upload.php +++ b/apps/files/ajax/upload.php @@ -60,5 +60,3 @@ if(strpos($dir,'..') === false){ } OCP\JSON::error(array('data' => array('error' => $error, "file" => $fileName))); - -?> diff --git a/apps/files/appinfo/update.php b/apps/files/appinfo/update.php index f9953ba4de5..5514aed197f 100644 --- a/apps/files/appinfo/update.php +++ b/apps/files/appinfo/update.php @@ -1,5 +1,16 @@ <?php +// fix webdav properties, remove namespace information between curly bracket (update from OC4 to OC5) +$installedVersion=OCP\Config::getAppValue('files', 'installed_version');
+if (version_compare($installedVersion, '1.1.4', '<')) { + $query = OC_DB::prepare( "SELECT propertyname, propertypath, userid FROM `*PREFIX*properties`" );
+ $result = $query->execute();
+ while( $row = $result->fetchRow()){
+ $query = OC_DB::prepare( 'UPDATE *PREFIX*properties SET propertyname = ? WHERE userid = ? AND propertypath = ?' );
+ $query->execute( array( preg_replace("/^{.*}/", "", $row["propertyname"]),$row["userid"], $row["propertypath"] ));
+ } +} + //update from OC 3 //try to remove remaining files. diff --git a/apps/files/appinfo/version b/apps/files/appinfo/version index 8cfbc905b39..1b87bcd0b09 100644 --- a/apps/files/appinfo/version +++ b/apps/files/appinfo/version @@ -1 +1 @@ -1.1.1
\ No newline at end of file +1.1.4
\ No newline at end of file diff --git a/apps/files/download.php b/apps/files/download.php index 2b5d4e2d876..4e2478d1ad7 100644 --- a/apps/files/download.php +++ b/apps/files/download.php @@ -46,4 +46,3 @@ header('Content-Length: '.OC_Filesystem::filesize($filename)); @ob_end_clean(); OC_Filesystem::readfile( $filename ); -?> diff --git a/apps/files/index.php b/apps/files/index.php index ed36c5edab0..79bed8e357e 100644 --- a/apps/files/index.php +++ b/apps/files/index.php @@ -40,6 +40,7 @@ $dir = isset( $_GET['dir'] ) ? stripslashes($_GET['dir']) : ''; // Redirect if directory does not exist if(!OC_Filesystem::is_dir($dir.'/')) { header('Location: '.$_SERVER['PHP_SELF'].''); + exit(); } $files = array(); @@ -98,5 +99,3 @@ $tmpl->assign( 'uploadMaxFilesize', $maxUploadFilesize); $tmpl->assign( 'uploadMaxHumanFilesize', OCP\Util::humanFileSize($maxUploadFilesize)); $tmpl->assign( 'allowZipDownload', intval(OCP\Config::getSystemValue('allowZipDownload', true))); $tmpl->printPage(); - -?> diff --git a/apps/files/js/filelist.js b/apps/files/js/filelist.js index e6a9a6883af..3645258f98f 100644 --- a/apps/files/js/filelist.js +++ b/apps/files/js/filelist.js @@ -14,7 +14,7 @@ FileList={ var extension=false; } html+='<td class="filename" style="background-image:url('+img+')"><input type="checkbox" />'; - html+='<a class="name" href="download.php?file='+$('#dir').val()+'/'+name+'"><span class="nametext">'+basename + html+='<a class="name" href="download.php?file='+$('#dir').val().replace(/</, '<').replace(/>/, '>')+'/'+name+'"><span class="nametext">'+basename if(extension){ html+='<span class="extension">'+extension+'</span>'; } diff --git a/apps/files/js/files.js b/apps/files/js/files.js index 86c5185bf72..a4e2361feeb 100644 --- a/apps/files/js/files.js +++ b/apps/files/js/files.js @@ -497,23 +497,27 @@ $(document).ready(function() { localName=(localName.match(/:\/\/(.[^/]+)/)[1]).replace('www.',''); } localName = getUniqueName(localName); - $.post( - OC.filePath('files','ajax','newfile.php'), - {dir:$('#dir').val(),source:name,filename:localName}, - function(result){ - if(result.status == 'success'){ - var date=new Date(); - FileList.addFile(localName,0,date); - var tr=$('tr').filterAttr('data-file',localName); - tr.data('mime',result.data.mime); - getMimeIcon(result.data.mime,function(path){ - tr.find('td.filename').attr('style','background-image:url('+path+')'); - }); - }else{ + $('#uploadprogressbar').progressbar({value:0}); + $('#uploadprogressbar').fadeIn(); - } - } - ); + var eventSource=new OC.EventSource(OC.filePath('files','ajax','newfile.php'),{dir:$('#dir').val(),source:name,filename:localName}); + eventSource.listen('progress',function(progress){ + $('#uploadprogressbar').progressbar('value',progress); + }); + eventSource.listen('success',function(mime){ + $('#uploadprogressbar').fadeOut(); + var date=new Date(); + FileList.addFile(localName,0,date); + var tr=$('tr').filterAttr('data-file',localName); + tr.data('mime',mime); + getMimeIcon(mime,function(path){ + tr.find('td.filename').attr('style','background-image:url('+path+')'); + }); + }); + eventSource.listen('error',function(error){ + $('#uploadprogressbar').fadeOut(); + alert(error); + }); break; } var li=$(this).parent(); diff --git a/apps/files/l10n/es.php b/apps/files/l10n/es.php index 67bfb4702e8..506218815bb 100644 --- a/apps/files/l10n/es.php +++ b/apps/files/l10n/es.php @@ -7,8 +7,21 @@ "Missing a temporary folder" => "Falta un directorio temporal", "Failed to write to disk" => "La escritura en disco ha fallado", "Files" => "Archivos", +"Unshare" => "No compartir", +"Delete" => "Eliminado", +"undo deletion" => "deshacer la eliminación", +"generating ZIP-file, it may take some time." => "generando un fichero ZIP, puede llevar un tiempo.", +"Unable to upload your file as it is a directory or has 0 bytes" => "No ha sido posible subir tu archivo porque es un directorio o tiene 0 bytes", +"Upload Error" => "Error al subir el archivo", +"Pending" => "Pendiente", +"Upload cancelled." => "Subida cancelada.", +"Invalid name, '/' is not allowed." => "Nombre no válido, '/' no está permitido.", "Size" => "Tamaño", "Modified" => "Modificado", +"folder" => "carpeta", +"folders" => "carpetas", +"file" => "archivo", +"files" => "archivos", "File handling" => "Tratamiento de archivos", "Maximum upload size" => "Tamaño máximo de subida", "max. possible: " => "máx. posible:", @@ -26,7 +39,6 @@ "Name" => "Nombre", "Share" => "Compartir", "Download" => "Descargar", -"Delete" => "Eliminado", "Upload too large" => "El archivo es demasiado grande", "The files you are trying to upload exceed the maximum size for file uploads on this server." => "Los archivos que estás intentando subir sobrepasan el tamaño máximo permitido por este servidor.", "Files are being scanned, please wait." => "Se están escaneando los archivos, por favor espere.", diff --git a/apps/files/l10n/it.php b/apps/files/l10n/it.php index 82871826c18..0bf113eba1b 100644 --- a/apps/files/l10n/it.php +++ b/apps/files/l10n/it.php @@ -7,8 +7,21 @@ "Missing a temporary folder" => "Cartella temporanea mancante", "Failed to write to disk" => "Scrittura su disco non riuscita", "Files" => "File", +"Unshare" => "Rimuovi condivisione", +"Delete" => "Elimina", +"undo deletion" => "annulla l'eliminazione", +"generating ZIP-file, it may take some time." => "creazione file ZIP, potrebbe richiedere del tempo.", +"Unable to upload your file as it is a directory or has 0 bytes" => "Impossibile inviare il file poiché è una cartella o ha dimensione 0 byte", +"Upload Error" => "Errore di invio", +"Pending" => "In corso", +"Upload cancelled." => "Invio annullato", +"Invalid name, '/' is not allowed." => "Nome non valido", "Size" => "Dimensione", "Modified" => "Modificato", +"folder" => "cartella", +"folders" => "cartelle", +"file" => "file", +"files" => "file", "File handling" => "Gestione file", "Maximum upload size" => "Dimensione massima upload", "max. possible: " => "numero mass.: ", @@ -26,7 +39,6 @@ "Name" => "Nome", "Share" => "Condividi", "Download" => "Scarica", -"Delete" => "Elimina", "Upload too large" => "Il file caricato è troppo grande", "The files you are trying to upload exceed the maximum size for file uploads on this server." => "I file che stai provando a caricare superano la dimensione massima consentita su questo server.", "Files are being scanned, please wait." => "Scansione dei file in corso, attendi", diff --git a/apps/files/l10n/vi.php b/apps/files/l10n/vi.php new file mode 100644 index 00000000000..c2284d5feb9 --- /dev/null +++ b/apps/files/l10n/vi.php @@ -0,0 +1,31 @@ +<?php $TRANSLATIONS = array( +"Files" => "Tập tin", +"Delete" => "Xóa", +"Upload Error" => "Tải lên lỗi", +"Pending" => "Chờ", +"Upload cancelled." => "Hủy tải lên", +"Invalid name, '/' is not allowed." => "Tên không hợp lệ ,không được phép dùng '/'", +"Size" => "Kích cỡ", +"Modified" => "Thay đổi", +"folder" => "folder", +"folders" => "folders", +"file" => "file", +"files" => "files", +"File handling" => "Xử lý tập tin", +"Maximum upload size" => "Kích thước tối đa ", +"Enable ZIP-download" => "Cho phép ZIP-download", +"0 is unlimited" => "0 là không giới hạn", +"Maximum input size for ZIP files" => "Kích thước tối đa cho các tập tin ZIP", +"New" => "Mới", +"Text file" => "Tập tin văn bản", +"Folder" => "Folder", +"From url" => "Từ url", +"Upload" => "Tải lên", +"Cancel upload" => "Hủy upload", +"Nothing in here. Upload something!" => "Không có gì ở đây .Hãy tải lên một cái gì đó !", +"Name" => "Tên", +"Share" => "Chia sẻ", +"Download" => "Tải xuống", +"Upload too large" => "File tải lên quá lớn", +"Files are being scanned, please wait." => "Tập tin đang được quét ,vui lòng chờ." +); diff --git a/apps/files/settings.php b/apps/files/settings.php index e5a66239ebd..cd6dd8c1616 100644 --- a/apps/files/settings.php +++ b/apps/files/settings.php @@ -56,5 +56,3 @@ $tmpl = new OCP\Template( "files", "index", "user" ); $tmpl->assign( 'files', $files ); $tmpl->assign( "breadcrumb", $breadcrumb ); $tmpl->printPage(); - -?> |