summaryrefslogtreecommitdiffstats
path: root/lib/private
diff options
context:
space:
mode:
authorThomas Mueller <thomas.mueller@tmit.eu>2013-11-24 23:27:44 +0100
committerThomas Mueller <thomas.mueller@tmit.eu>2013-11-24 23:27:44 +0100
commit37b07fe6a9e512214852584fb15056f008509882 (patch)
tree6200a40da93696df4e3e5863308757f4b0b2ece2 /lib/private
parent14332681fc541aca936dcbd6baf7de220734815f (diff)
parenta2d4cd87d05392058d6837e8feea4fffb3e55faa (diff)
downloadnextcloud-server-37b07fe6a9e512214852584fb15056f008509882.tar.gz
nextcloud-server-37b07fe6a9e512214852584fb15056f008509882.zip
Merge branch 'master' into fix-5388-master
Diffstat (limited to 'lib/private')
-rw-r--r--lib/private/files/cache/cache.php2
-rw-r--r--lib/private/files/cache/updater.php2
-rw-r--r--lib/private/files/storage/common.php13
-rw-r--r--lib/private/image.php31
-rwxr-xr-xlib/private/request.php3
5 files changed, 32 insertions, 19 deletions
diff --git a/lib/private/files/cache/cache.php b/lib/private/files/cache/cache.php
index 8c34fa58540..ac50a988e32 100644
--- a/lib/private/files/cache/cache.php
+++ b/lib/private/files/cache/cache.php
@@ -507,7 +507,7 @@ class Cache {
$entry = $this->get($path);
if ($entry && $entry['mimetype'] === 'httpd/unix-directory') {
$id = $entry['fileid'];
- $sql = 'SELECT SUM(`size`), MIN(`size`) FROM `*PREFIX*filecache` '.
+ $sql = 'SELECT SUM(`size`) AS f1, MIN(`size`) AS f2 FROM `*PREFIX*filecache` '.
'WHERE `parent` = ? AND `storage` = ?';
$result = \OC_DB::executeAudited($sql, array($id, $this->getNumericStorageId()));
if ($row = $result->fetchRow()) {
diff --git a/lib/private/files/cache/updater.php b/lib/private/files/cache/updater.php
index da223567001..d45c5e17fc8 100644
--- a/lib/private/files/cache/updater.php
+++ b/lib/private/files/cache/updater.php
@@ -142,7 +142,7 @@ class Updater {
$cache->update($id, array('mtime' => $time, 'etag' => $storage->getETag($internalPath)));
if ($realPath !== '') {
$realPath = dirname($realPath);
- if($realPath === '/') {
+ if($realPath === DIRECTORY_SEPARATOR ) {
$realPath = "";
}
// check storage for parent in case we change the storage in this step
diff --git a/lib/private/files/storage/common.php b/lib/private/files/storage/common.php
index f99bbc9ae5e..678bf419023 100644
--- a/lib/private/files/storage/common.php
+++ b/lib/private/files/storage/common.php
@@ -51,6 +51,19 @@ abstract class Common implements \OC\Files\Storage\Storage {
}
}
+ public function isReadable($path) {
+ // at least check whether it exists
+ // subclasses might want to implement this more thoroughly
+ return $this->file_exists($path);
+ }
+
+ public function isUpdatable($path) {
+ // at least check whether it exists
+ // subclasses might want to implement this more thoroughly
+ // a non-existing file/folder isn't updatable
+ return $this->file_exists($path);
+ }
+
public function isCreatable($path) {
if ($this->is_dir($path) && $this->isUpdatable($path)) {
return true;
diff --git a/lib/private/image.php b/lib/private/image.php
index b5ae1165f8e..7761a3c7737 100644
--- a/lib/private/image.php
+++ b/lib/private/image.php
@@ -414,61 +414,60 @@ class OC_Image {
*/
public function loadFromFile($imagePath=false) {
// exif_imagetype throws "read error!" if file is less than 12 byte
- $absPath = \OC\Files\Filesystem::getLocalFile($imagePath);
- if(!@is_file($absPath) || !file_exists($absPath) || filesize($absPath) < 12 || !is_readable($absPath)) {
+ if(!@is_file($imagePath) || !file_exists($imagePath) || filesize($imagePath) < 12 || !is_readable($imagePath)) {
// Debug output disabled because this method is tried before loadFromBase64?
- OC_Log::write('core', 'OC_Image->loadFromFile, couldn\'t load: '.$absPath, OC_Log::DEBUG);
+ OC_Log::write('core', 'OC_Image->loadFromFile, couldn\'t load: '.$imagePath, OC_Log::DEBUG);
return false;
}
- $iType = exif_imagetype($absPath);
+ $iType = exif_imagetype($imagePath);
switch ($iType) {
case IMAGETYPE_GIF:
if (imagetypes() & IMG_GIF) {
- $this->resource = imagecreatefromgif($absPath);
+ $this->resource = imagecreatefromgif($imagePath);
} else {
OC_Log::write('core',
- 'OC_Image->loadFromFile, GIF images not supported: '.$absPath,
+ 'OC_Image->loadFromFile, GIF images not supported: '.$imagePath,
OC_Log::DEBUG);
}
break;
case IMAGETYPE_JPEG:
if (imagetypes() & IMG_JPG) {
- $this->resource = imagecreatefromjpeg($absPath);
+ $this->resource = imagecreatefromjpeg($imagePath);
} else {
OC_Log::write('core',
- 'OC_Image->loadFromFile, JPG images not supported: '.$absPath,
+ 'OC_Image->loadFromFile, JPG images not supported: '.$imagePath,
OC_Log::DEBUG);
}
break;
case IMAGETYPE_PNG:
if (imagetypes() & IMG_PNG) {
- $this->resource = imagecreatefrompng($absPath);
+ $this->resource = imagecreatefrompng($imagePath);
} else {
OC_Log::write('core',
- 'OC_Image->loadFromFile, PNG images not supported: '.$absPath,
+ 'OC_Image->loadFromFile, PNG images not supported: '.$imagePath,
OC_Log::DEBUG);
}
break;
case IMAGETYPE_XBM:
if (imagetypes() & IMG_XPM) {
- $this->resource = imagecreatefromxbm($absPath);
+ $this->resource = imagecreatefromxbm($imagePath);
} else {
OC_Log::write('core',
- 'OC_Image->loadFromFile, XBM/XPM images not supported: '.$absPath,
+ 'OC_Image->loadFromFile, XBM/XPM images not supported: '.$imagePath,
OC_Log::DEBUG);
}
break;
case IMAGETYPE_WBMP:
if (imagetypes() & IMG_WBMP) {
- $this->resource = imagecreatefromwbmp($absPath);
+ $this->resource = imagecreatefromwbmp($imagePath);
} else {
OC_Log::write('core',
- 'OC_Image->loadFromFile, WBMP images not supported: '.$absPath,
+ 'OC_Image->loadFromFile, WBMP images not supported: '.$imagePath,
OC_Log::DEBUG);
}
break;
case IMAGETYPE_BMP:
- $this->resource = $this->imagecreatefrombmp($absPath);
+ $this->resource = $this->imagecreatefrombmp($imagePath);
break;
/*
case IMAGETYPE_TIFF_II: // (intel byte order)
@@ -497,7 +496,7 @@ class OC_Image {
default:
// this is mostly file created from encrypted file
- $this->resource = imagecreatefromstring(\OC\Files\Filesystem::file_get_contents($imagePath));
+ $this->resource = imagecreatefromstring(\OC\Files\Filesystem::file_get_contents(\OC\Files\Filesystem::getLocalPath($imagePath)));
$iType = IMAGETYPE_PNG;
OC_Log::write('core', 'OC_Image->loadFromFile, Default', OC_Log::DEBUG);
break;
diff --git a/lib/private/request.php b/lib/private/request.php
index df33217f95d..d11e5b16cfe 100755
--- a/lib/private/request.php
+++ b/lib/private/request.php
@@ -9,6 +9,7 @@
class OC_Request {
/**
* @brief Check overwrite condition
+ * @param string $type
* @returns bool
*/
private static function isOverwriteCondition($type = '') {
@@ -99,7 +100,7 @@ class OC_Request {
public static function scriptName() {
$name = $_SERVER['SCRIPT_NAME'];
if (OC_Config::getValue('overwritewebroot', '') !== '' and self::isOverwriteCondition()) {
- $serverroot = str_replace("\\", '/', substr(__DIR__, 0, -4));
+ $serverroot = str_replace("\\", '/', substr(__DIR__, 0, -strlen('lib/private/')));
$suburi = str_replace("\\", "/", substr(realpath($_SERVER["SCRIPT_FILENAME"]), strlen($serverroot)));
$name = OC_Config::getValue('overwritewebroot', '') . $suburi;
}