summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorGeorg Ehrke <dev@georgswebsite.de>2012-06-20 13:29:12 +0200
committerGeorg Ehrke <dev@georgswebsite.de>2012-06-20 13:29:12 +0200
commit572dd9fbade253c68f664e4706c57665b5322f43 (patch)
treef71d545ef904a01c0aeb0e6bdee27346673f99d7 /apps
parent5ce0097b6f89dc0a14bb946b8ab457127f00edb1 (diff)
parent1ecbf459c9f181a23f25c8305a6f6ba3c99e7afe (diff)
downloadnextcloud-server-572dd9fbade253c68f664e4706c57665b5322f43.tar.gz
nextcloud-server-572dd9fbade253c68f664e4706c57665b5322f43.zip
Merge branch 'master' into calendar_repeat
Diffstat (limited to 'apps')
-rw-r--r--apps/contacts/js/contacts.js4
-rw-r--r--apps/files_archive/lib/storage.php1
-rw-r--r--apps/files_sharing/sharedstorage.php2
-rw-r--r--apps/files_versions/versions.php66
-rw-r--r--apps/media/js/collection.js10
-rw-r--r--apps/media/lib_scanner.php6
-rw-r--r--apps/user_ldap/group_ldap.php4
-rw-r--r--apps/user_ldap/lib_ldap.php10
8 files changed, 69 insertions, 34 deletions
diff --git a/apps/contacts/js/contacts.js b/apps/contacts/js/contacts.js
index 1408e840f2b..2319334c58b 100644
--- a/apps/contacts/js/contacts.js
+++ b/apps/contacts/js/contacts.js
@@ -1699,5 +1699,7 @@ $(document).ready(function(){
}
$('#contacts_propertymenu_dropdown a').click(propertyMenuItem);
$('#contacts_propertymenu_dropdown a').keydown(propertyMenuItem);
+
+ Contacts.UI.loadHandlers();
+ Contacts.UI.Contacts.update();
});
-Contacts.UI.Contacts.update();
diff --git a/apps/files_archive/lib/storage.php b/apps/files_archive/lib/storage.php
index 86761663611..2f10d6a3e4e 100644
--- a/apps/files_archive/lib/storage.php
+++ b/apps/files_archive/lib/storage.php
@@ -49,6 +49,7 @@ class OC_Filestorage_Archive extends OC_Filestorage_Common{
OC_FakeDirStream::$dirs[$id]=$content;
return opendir('fakedir://'.$id);
}
+ public function readdir($path){}
public function stat($path){
$ctime=filectime($this->path);
$path=$this->stripPath($path);
diff --git a/apps/files_sharing/sharedstorage.php b/apps/files_sharing/sharedstorage.php
index 1a6942ad160..9174334383c 100644
--- a/apps/files_sharing/sharedstorage.php
+++ b/apps/files_sharing/sharedstorage.php
@@ -139,6 +139,8 @@ class OC_Filestorage_Shared extends OC_Filestorage {
}
}
+ public function readdir( $path ) {}
+
public function is_dir($path) {
if ($path == "" || $path == "/") {
return true;
diff --git a/apps/files_versions/versions.php b/apps/files_versions/versions.php
index 44ce7c635aa..6feb0cbb9c7 100644
--- a/apps/files_versions/versions.php
+++ b/apps/files_versions/versions.php
@@ -303,66 +303,88 @@ class Storage {
*/
public static function expireAll() {
- function deleteAll($directory, $empty = false) {
+ function deleteAll( $directory, $empty = false ) {
- if(substr($directory,-1) == "/") {
- $directory = substr($directory,0,-1);
+ // strip leading slash
+ if( substr( $directory, 0, 1 ) == "/" ) {
+
+ $directory = substr( $directory, 1 );
+
+ }
+
+ // strip trailing slash
+ if( substr( $directory, -1) == "/" ) {
+
+ $directory = substr( $directory, 0, -1 );
+
}
- if(!file_exists($directory) || !is_dir($directory)) {
+ $view = new \OC_FilesystemView('');
+
+ if ( !$view->file_exists( $directory ) || !$view->is_dir( $directory ) ) {
return false;
- } elseif(!is_readable($directory)) {
+ } elseif( !$view->is_readable( $directory ) ) {
return false;
} else {
- $directoryHandle = opendir($directory);
+ $foldername = \OCP\Config::getSystemValue('datadirectory') .'/' . \OCP\USER::getUser() .'/' . $directory; // have to set an absolute path for use with PHP's opendir as OC version doesn't work
+
+ $directoryHandle = opendir( $foldername );
- while ($contents = readdir($directoryHandle)) {
+ while ( $contents = $view->readdir( $directoryHandle ) ) {
- if( $contents != '.' && $contents != '..') {
+ if ( $contents != '.' && $contents != '..') {
$path = $directory . "/" . $contents;
- if( is_dir($path) ) {
+ if ( $view->is_dir( $path ) ) {
- deleteAll($path);
+ deleteAll( $path );
} else {
-
- unlink($path);
+
+ $view->unlink( \OCP\USER::getUser() .'/' . $path ); // TODO: make unlink use same system path as is_dir
}
}
}
- closedir( $directoryHandle );
+ //$view->closedir( $directoryHandle ); // TODO: implement closedir in OC_FSV
- if( $empty == false ) {
+ if ( $empty == false ) {
- if(!rmdir($directory)) {
+ if ( !$view->rmdir( $directory ) ) {
return false;
}
- }
+ }
return true;
}
}
+
+ $dir = \OCP\Config::getSystemValue('files_versionsfolder', Storage::DEFAULTFOLDER);
+
+ deleteAll( $dir, true );
+
+// if ( deleteAll( $dir, 1 ) ) {
+//
+// echo "<h1>deleted ok</h1>";
+//
+// } else {
+//
+// echo "<h1>not deleted</h1>";
+//
+// }
- /*
- // FIXME: make this path dynamic
- $dir = '/home/samtuke/owncloud/git/oc5/data/admin/versions';
-
- ( deleteAll( $dir, 1 ) ? return true : return false );
- */
}
diff --git a/apps/media/js/collection.js b/apps/media/js/collection.js
index 03d577c7c98..161fc0c6810 100644
--- a/apps/media/js/collection.js
+++ b/apps/media/js/collection.js
@@ -97,13 +97,13 @@ Collection={
if(artist.name && artist.songs.length>0){
var tr=template.clone().removeClass('template');
if(artist.songs.length>1){
- tr.find('td.title a').text(artist.songs.length+' '+t('media','songs'));
- tr.find('td.album a').text(artist.albums.length+' '+t('media','albums'));
+ tr.find('td.title a').html(artist.songs.length+' '+t('media','songs'));
+ tr.find('td.album a').html(artist.albums.length+' '+t('media','albums'));
}else{
- tr.find('td.title a').text(artist.songs[0].name);
- tr.find('td.album a').text(artist.albums[0].name);
+ tr.find('td.title a').html(artist.songs[0].name);
+ tr.find('td.album a').html(artist.albums[0].name);
}
- tr.find('td.artist a').text(artist.name);
+ tr.find('td.artist a').html(artist.name);
tr.data('artistData',artist);
tr.find('td.artist a').click(function(event){
event.preventDefault();
diff --git a/apps/media/lib_scanner.php b/apps/media/lib_scanner.php
index 82170e5ca82..a8218c3a4d0 100644
--- a/apps/media/lib_scanner.php
+++ b/apps/media/lib_scanner.php
@@ -79,19 +79,19 @@ class OC_MEDIA_SCANNER{
OCP\Util::writeLog('media',"error reading artist tag in '$file'",OCP\Util::WARN);
$artist='unknown';
}else{
- $artist=strip_tags(stripslashes($data['comments']['artist'][0]));
+ $artist=OCP\Util::sanitizeHTML(stripslashes($data['comments']['artist'][0]));
}
if(!isset($data['comments']['album'])){
OCP\Util::writeLog('media',"error reading album tag in '$file'",OCP\Util::WARN);
$album='unknown';
}else{
- $album=strip_tags(stripslashes($data['comments']['album'][0]));
+ $album=OCP\Util::sanitizeHTML(stripslashes($data['comments']['album'][0]));
}
if(!isset($data['comments']['title'])){
OCP\Util::writeLog('media',"error reading title tag in '$file'",OCP\Util::WARN);
$title='unknown';
}else{
- $title=strip_tags(stripslashes($data['comments']['title'][0]));
+ $title=OCP\Util::sanitizeHTML(stripslashes($data['comments']['title'][0]));
}
$size=$data['filesize'];
if (isset($data['comments']['track']))
diff --git a/apps/user_ldap/group_ldap.php b/apps/user_ldap/group_ldap.php
index 78bc5b46566..a3117b5a41e 100644
--- a/apps/user_ldap/group_ldap.php
+++ b/apps/user_ldap/group_ldap.php
@@ -166,7 +166,9 @@ class OC_GROUP_LDAP extends OC_Group_Backend {
$result[] = OC_LDAP::dn2username($ldap_users[0]);
continue;
} else {
- $result[] = OC_LDAP::dn2username($member);
+ if($ocname = OC_LDAP::dn2username($member)){
+ $result[] = $ocname;
+ }
}
}
if(!$isMemberUid) {
diff --git a/apps/user_ldap/lib_ldap.php b/apps/user_ldap/lib_ldap.php
index befdf267bcd..aa104eb5126 100644
--- a/apps/user_ldap/lib_ldap.php
+++ b/apps/user_ldap/lib_ldap.php
@@ -166,11 +166,14 @@ class OC_LDAP {
* @brief returns the internal ownCloud name for the given LDAP DN of the group
* @param $dn the dn of the group object
* @param $ldapname optional, the display name of the object
- * @returns string with with the name to use in ownCloud
+ * @returns string with with the name to use in ownCloud, false on DN outside of search DN
*
* returns the internal ownCloud name for the given LDAP DN of the group
*/
static public function dn2groupname($dn, $ldapname = null) {
+ if(strrpos($dn, self::$ldapBaseGroups) !== (strlen($dn)-strlen(self::$ldapBaseGroups))) {
+ return false;
+ }
return self::dn2ocname($dn, $ldapname, false);
}
@@ -180,9 +183,12 @@ class OC_LDAP {
* @param $ldapname optional, the display name of the object
* @returns string with with the name to use in ownCloud
*
- * returns the internal ownCloud name for the given LDAP DN of the user
+ * returns the internal ownCloud name for the given LDAP DN of the user, false on DN outside of search DN
*/
static public function dn2username($dn, $ldapname = null) {
+ if(strrpos($dn, self::$ldapBaseUsers) !== (strlen($dn)-strlen(self::$ldapBaseUsers))) {
+ return false;
+ }
return self::dn2ocname($dn, $ldapname, true);
}