diff options
author | Robin Appelman <icewind@owncloud.com> | 2012-09-26 17:52:28 +0200 |
---|---|---|
committer | Robin Appelman <icewind@owncloud.com> | 2012-09-26 17:52:28 +0200 |
commit | 88bca9bc49343906b5b498f4d3837002d346b3af (patch) | |
tree | 7a918e09963310c812617df0328b4331edb3b3d2 /lib | |
parent | 522d7df860fb47d3cc56e315850dda2797569ac5 (diff) | |
parent | a7292e897a70a2f7e79f61396d4888cb694f0860 (diff) | |
download | nextcloud-server-88bca9bc49343906b5b498f4d3837002d346b3af.tar.gz nextcloud-server-88bca9bc49343906b5b498f4d3837002d346b3af.zip |
Merge branch 'master' into filesystem
Diffstat (limited to 'lib')
-rw-r--r-- | lib/base.php | 4 | ||||
-rw-r--r-- | lib/cache/xcache.php | 6 | ||||
-rw-r--r-- | lib/connector/sabre/node.php | 10 | ||||
-rw-r--r-- | lib/files.php | 22 | ||||
-rw-r--r-- | lib/filesystemview.php | 2 | ||||
-rw-r--r-- | lib/l10n/da.php | 3 | ||||
-rw-r--r-- | lib/l10n/es_AR.php | 28 | ||||
-rw-r--r-- | lib/l10n/pt_BR.php | 28 | ||||
-rw-r--r-- | lib/public/share.php | 19 | ||||
-rw-r--r-- | lib/search/provider/file.php | 8 |
10 files changed, 112 insertions, 18 deletions
diff --git a/lib/base.php b/lib/base.php index 38568e27490..8a095cbbb61 100644 --- a/lib/base.php +++ b/lib/base.php @@ -309,14 +309,14 @@ class OC{ //set http auth headers for apache+php-cgi work around if (isset($_SERVER['HTTP_AUTHORIZATION']) && preg_match('/Basic\s+(.*)$/i', $_SERVER['HTTP_AUTHORIZATION'], $matches)) { - list($name, $password) = explode(':', base64_decode($matches[1])); + list($name, $password) = explode(':', base64_decode($matches[1]), 2); $_SERVER['PHP_AUTH_USER'] = strip_tags($name); $_SERVER['PHP_AUTH_PW'] = strip_tags($password); } //set http auth headers for apache+php-cgi work around if variable gets renamed by apache if (isset($_SERVER['REDIRECT_HTTP_AUTHORIZATION']) && preg_match('/Basic\s+(.*)$/i', $_SERVER['REDIRECT_HTTP_AUTHORIZATION'], $matches)) { - list($name, $password) = explode(':', base64_decode($matches[1])); + list($name, $password) = explode(':', base64_decode($matches[1]), 2); $_SERVER['PHP_AUTH_USER'] = strip_tags($name); $_SERVER['PHP_AUTH_PW'] = strip_tags($password); } diff --git a/lib/cache/xcache.php b/lib/cache/xcache.php index cecdf46351c..9f380f870b9 100644 --- a/lib/cache/xcache.php +++ b/lib/cache/xcache.php @@ -44,6 +44,12 @@ class OC_Cache_XCache { } public function clear($prefix='') { + if(!function_exists('xcache_unset_by_prefix')) { + function xcache_unset_by_prefix($prefix) { + // Since we can't clear targetted cache, we'll clear all. :( + xcache_clear_cache(XC_TYPE_VAR, 0); + } + } xcache_unset_by_prefix($this->getNamespace().$prefix); return true; } diff --git a/lib/connector/sabre/node.php b/lib/connector/sabre/node.php index ecbbef81292..55fa0dfde66 100644 --- a/lib/connector/sabre/node.php +++ b/lib/connector/sabre/node.php @@ -23,7 +23,9 @@ abstract class OC_Connector_Sabre_Node implements Sabre_DAV_INode, Sabre_DAV_IProperties { const GETETAG_PROPERTYNAME = '{DAV:}getetag'; - + const LASTMODIFIED_PROPERTYNAME_DEPRECIATED = '{DAV:}lastmodified'; // FIXME: keept for the transition period, can be removed for OC 4.5.1 if the sync client update too + const GETLASTMODIFIED_PROPERTYNAME = '{DAV:}getlastmodified'; + /** * The path to the current node * @@ -142,7 +144,6 @@ abstract class OC_Connector_Sabre_Node implements Sabre_DAV_INode, Sabre_DAV_IPr public function updateProperties($properties) { $existing = $this->getProperties(array()); foreach($properties as $propertyName => $propertyValue) { - $propertyName = preg_replace("/^{.*}/", "", $propertyName); // remove leading namespace from property name // If it was null, we need to delete the property if (is_null($propertyValue)) { if(array_key_exists( $propertyName, $existing )) { @@ -150,8 +151,9 @@ abstract class OC_Connector_Sabre_Node implements Sabre_DAV_INode, Sabre_DAV_IPr $query->execute( array( OC_User::getUser(), $this->path, $propertyName )); } } - else { - if( strcmp( $propertyName, "lastmodified") === 0) { + else { //FIXME: first part of if statement can be removed together with the LASTMODIFIED_PROPERTYNAME_DEPRECIATED const for oc4.5.1 if the sync client was updated too + if( strcmp( $propertyName, self::LASTMODIFIED_PROPERTYNAME_DEPRECIATED) === 0 || + strcmp( $propertyName, self::GETLASTMODIFIED_PROPERTYNAME) === 0 ) { $this->touch($propertyValue); } else { if(!array_key_exists( $propertyName, $existing )) { diff --git a/lib/files.php b/lib/files.php index 360614caec9..ac999a9bd15 100644 --- a/lib/files.php +++ b/lib/files.php @@ -47,7 +47,8 @@ class OC_Files { $info = OCP\Share::getItemsSharedWith('file', OC_Share_Backend_File::FORMAT_FILE_APP_ROOT); } else { - $info = OCP\Share::getItemSharedWith('file', '/'.$name, OC_Share_Backend_File::FORMAT_FILE_APP); + $path = substr($path, 7); + $info = OCP\Share::getItemSharedWith('file', $path, OC_Share_Backend_File::FORMAT_FILE_APP); } $info = $info[0]; } @@ -107,7 +108,24 @@ class OC_Files { return $files; } - + public static function searchByMime($mimetype_filter) { + $files = array(); + $dirs_to_check = array(''); + while (!empty($dirs_to_check)) { + // get next subdir to check + $dir = array_pop($dirs_to_check); + $dir_content = self::getDirectoryContent($dir, $mimetype_filter); + foreach($dir_content as $file) { + if ($file['type'] == 'file') { + $files[] = $dir.'/'.$file['name']; + } + else { + $dirs_to_check[] = $dir.'/'.$file['name']; + } + } + } + return $files; + } /** * return the content of a file or return a zip file containning multiply files diff --git a/lib/filesystemview.php b/lib/filesystemview.php index 678e6703cf0..210f9dad55a 100644 --- a/lib/filesystemview.php +++ b/lib/filesystemview.php @@ -451,6 +451,8 @@ class OC_FilesystemView { OC_Filesystem::signal_post_write, array( OC_Filesystem::signal_param_path => $path2) ); + } else { // no real copy, file comes from somewhere else, e.g. version rollback -> just update the file cache without all the other post_write actions + OC_FileCache_Update::update($path2, $this->fakeRoot); } return $result; } diff --git a/lib/l10n/da.php b/lib/l10n/da.php index 5c68174fa07..09124c18290 100644 --- a/lib/l10n/da.php +++ b/lib/l10n/da.php @@ -23,5 +23,6 @@ "last year" => "Sidste år", "years ago" => "år siden", "%s is available. Get <a href=\"%s\">more information</a>" => "%s er tilgængelig. Få <a href=\"%s\">mere information</a>", -"up to date" => "opdateret" +"up to date" => "opdateret", +"updates check is disabled" => "Check for opdateringer er deaktiveret" ); diff --git a/lib/l10n/es_AR.php b/lib/l10n/es_AR.php new file mode 100644 index 00000000000..fd50027d8a1 --- /dev/null +++ b/lib/l10n/es_AR.php @@ -0,0 +1,28 @@ +<?php $TRANSLATIONS = array( +"Help" => "Ayuda", +"Personal" => "Personal", +"Settings" => "Ajustes", +"Users" => "Usuarios", +"Apps" => "Aplicaciones", +"Admin" => "Administración", +"ZIP download is turned off." => "La descarga en ZIP está desactivada.", +"Files need to be downloaded one by one." => "Los archivos deben ser descargados de a uno.", +"Back to Files" => "Volver a archivos", +"Selected files too large to generate zip file." => "Los archivos seleccionados son demasiado grandes para generar el archivo zip.", +"Application is not enabled" => "La aplicación no está habilitada", +"Authentication error" => "Error de autenticación", +"Token expired. Please reload page." => "Token expirado. Por favor, recargá la página.", +"seconds ago" => "hace unos segundos", +"1 minute ago" => "hace 1 minuto", +"%d minutes ago" => "hace %d minutos", +"today" => "hoy", +"yesterday" => "ayer", +"%d days ago" => "hace %d días", +"last month" => "este mes", +"months ago" => "hace meses", +"last year" => "este año", +"years ago" => "hace años", +"%s is available. Get <a href=\"%s\">more information</a>" => "%s está disponible. Conseguí <a href=\"%s\">más información</a>", +"up to date" => "actualizado", +"updates check is disabled" => "comprobar actualizaciones está desactivado" +); diff --git a/lib/l10n/pt_BR.php b/lib/l10n/pt_BR.php new file mode 100644 index 00000000000..1455eabbc94 --- /dev/null +++ b/lib/l10n/pt_BR.php @@ -0,0 +1,28 @@ +<?php $TRANSLATIONS = array( +"Help" => "Ajuda", +"Personal" => "Pessoal", +"Settings" => "Ajustes", +"Users" => "Usuários", +"Apps" => "Aplicações", +"Admin" => "Admin", +"ZIP download is turned off." => "Download ZIP está desligado.", +"Files need to be downloaded one by one." => "Arquivos precisam ser baixados um de cada vez.", +"Back to Files" => "Voltar para Arquivos", +"Selected files too large to generate zip file." => "Arquivos selecionados são muito grandes para gerar arquivo zip.", +"Application is not enabled" => "Aplicação não está habilitada", +"Authentication error" => "Erro de autenticação", +"Token expired. Please reload page." => "Token expirou. Por favor recarregue a página.", +"seconds ago" => "segundos atrás", +"1 minute ago" => "1 minuto atrás", +"%d minutes ago" => "%d minutos atrás", +"today" => "hoje", +"yesterday" => "ontem", +"%d days ago" => "%d dias atrás", +"last month" => "último mês", +"months ago" => "meses atrás", +"last year" => "último ano", +"years ago" => "anos atrás", +"%s is available. Get <a href=\"%s\">more information</a>" => "%s está disponível. Obtenha <a href=\"%s\">mais informações</a>", +"up to date" => "atualizado", +"updates check is disabled" => "checagens de atualização estão desativadas" +); diff --git a/lib/public/share.php b/lib/public/share.php index b215d7f9389..1039d6f0dbf 100644 --- a/lib/public/share.php +++ b/lib/public/share.php @@ -418,11 +418,20 @@ class Share { } public static function setExpirationDate($itemType, $itemSource, $date) { - if ($item = self::getItems($itemType, $itemSource, null, null, \OC_User::getUser(), self::FORMAT_NONE, null, 1, false)) { - error_log('setting'); - $query = \OC_DB::prepare('UPDATE `*PREFIX*share` SET `expiration` = ? WHERE `id` = ?'); - $query->execute(array($date, $item['id'])); - return true; + if ($items = self::getItems($itemType, $itemSource, null, null, \OC_User::getUser(), self::FORMAT_NONE, null, -1, false)) { + if (!empty($items)) { + if ($date == '') { + $date = null; + } else { + $date = new \DateTime($date); + $date = date('Y-m-d H:i', $date->format('U') - $date->getOffset()); + } + $query = \OC_DB::prepare('UPDATE `*PREFIX*share` SET `expiration` = ? WHERE `id` = ?'); + foreach ($items as $item) { + $query->execute(array($date, $item['id'])); + } + return true; + } } return false; } diff --git a/lib/search/provider/file.php b/lib/search/provider/file.php index 50e16457672..135e40667b1 100644 --- a/lib/search/provider/file.php +++ b/lib/search/provider/file.php @@ -15,16 +15,16 @@ class OC_Search_Provider_File extends OC_Search_Provider{ case 'audio': break; case 'text': - $results[]=new OC_Search_Result(basename($file),'',OC_Helper::linkTo( 'files', 'download.php', array('dir' => $file) ),'Text'); + $results[]=new OC_Search_Result(basename($file),'',OC_Helper::linkTo( 'files', 'download.php', array('file' => $file) ),'Text'); break; case 'image': - $results[]=new OC_Search_Result(basename($file),'',OC_Helper::linkTo( 'files', 'download.php', array('dir' => $file) ),'Images'); + $results[]=new OC_Search_Result(basename($file),'',OC_Helper::linkTo( 'files', 'download.php', array('file' => $file) ),'Images'); break; default: if($mime=='application/xml') { - $results[]=new OC_Search_Result(basename($file),'',OC_Helper::linkTo( 'files', 'download.php', array('dir' => $file) ),'Text'); + $results[]=new OC_Search_Result(basename($file),'',OC_Helper::linkTo( 'files', 'download.php', array('file' => $file) ),'Text'); }else{ - $results[]=new OC_Search_Result(basename($file),'',OC_Helper::linkTo( 'files', 'download.php', array('dir' => $file) ),'Files'); + $results[]=new OC_Search_Result(basename($file),'',OC_Helper::linkTo( 'files', 'download.php', array('file' => $file) ),'Files'); } } } |