summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorBjörn Schießle <schiessle@owncloud.com>2012-09-26 10:50:06 +0200
committerBjörn Schießle <schiessle@owncloud.com>2012-09-26 10:50:06 +0200
commitfcd70246db779c86f715ba7ae736e3a02b8b59fd (patch)
treefbed85f20bf3b1227f97a30af5b40d14f88c20c8 /lib
parentc3c6e52104d7a3979b3a67069652e4d08e5b781e (diff)
parentb4e40b1c21fc3cd465a467278b4960565e07ca0d (diff)
downloadnextcloud-server-fcd70246db779c86f715ba7ae736e3a02b8b59fd.tar.gz
nextcloud-server-fcd70246db779c86f715ba7ae736e3a02b8b59fd.zip
Merge branch 'master' of github.com:owncloud/core
Diffstat (limited to 'lib')
-rw-r--r--lib/base.php4
-rw-r--r--lib/files.php19
-rw-r--r--lib/public/share.php19
3 files changed, 34 insertions, 8 deletions
diff --git a/lib/base.php b/lib/base.php
index 6b4dd789b2f..f6afc8fe2fe 100644
--- a/lib/base.php
+++ b/lib/base.php
@@ -303,14 +303,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/files.php b/lib/files.php
index 052d7988058..ac999a9bd15 100644
--- a/lib/files.php
+++ b/lib/files.php
@@ -108,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/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;
}