summaryrefslogtreecommitdiffstats
path: root/lib/files/filesystem.php
diff options
context:
space:
mode:
authorBernhard Posselt <nukeawhale@gmail.com>2013-02-22 07:43:13 -0800
committerBernhard Posselt <nukeawhale@gmail.com>2013-02-22 07:43:13 -0800
commit608ebb59ddab462383fb156189989da6290e04c9 (patch)
tree08e13d0732147bc042fdc2f6caf43a3283079215 /lib/files/filesystem.php
parente8da90d0f45ab870e3d5da6c766159c87bbb1b68 (diff)
parent62c65bc1c857c3a82152cf33694f251a235b8afa (diff)
downloadnextcloud-server-608ebb59ddab462383fb156189989da6290e04c9.tar.gz
nextcloud-server-608ebb59ddab462383fb156189989da6290e04c9.zip
Merge pull request #1859 from owncloud/blacklist-fix
Add OC\Files\Filesystem::isFileBlacklisted
Diffstat (limited to 'lib/files/filesystem.php')
-rw-r--r--lib/files/filesystem.php22
1 files changed, 15 insertions, 7 deletions
diff --git a/lib/files/filesystem.php b/lib/files/filesystem.php
index 8f171283207..401ee8417e5 100644
--- a/lib/files/filesystem.php
+++ b/lib/files/filesystem.php
@@ -224,9 +224,9 @@ class Filesystem {
// Load system mount points
if (is_file(\OC::$SERVERROOT . '/config/mount.php') or is_file(\OC::$SERVERROOT . '/config/mount.json')) {
- if(is_file(\OC::$SERVERROOT . '/config/mount.json')){
+ if (is_file(\OC::$SERVERROOT . '/config/mount.json')) {
$mountConfig = json_decode(file_get_contents(\OC::$SERVERROOT . '/config/mount.json'), true);
- }elseif(is_file(\OC::$SERVERROOT . '/config/mount.php')){
+ } elseif (is_file(\OC::$SERVERROOT . '/config/mount.php')) {
$mountConfig = $parser->parsePHP(file_get_contents(\OC::$SERVERROOT . '/config/mount.php'));
}
if (isset($mountConfig['global'])) {
@@ -263,9 +263,9 @@ class Filesystem {
}
// Load personal mount points
if (is_file($root . '/mount.php') or is_file($root . '/mount.json')) {
- if (is_file($root . '/mount.json')){
+ if (is_file($root . '/mount.json')) {
$mountConfig = json_decode(file_get_contents($root . '/mount.json'), true);
- } elseif (is_file($root . '/mount.php')){
+ } elseif (is_file($root . '/mount.php')) {
$mountConfig = $parser->parsePHP(file_get_contents($root . '/mount.php'));
}
if (isset($mountConfig['user'][$user])) {
@@ -390,21 +390,29 @@ class Filesystem {
* @param array $data from hook
*/
static public function isBlacklisted($data) {
- $blacklist = \OC_Config::getValue('blacklisted_files', array('.htaccess'));
if (isset($data['path'])) {
$path = $data['path'];
} else if (isset($data['newpath'])) {
$path = $data['newpath'];
}
if (isset($path)) {
- $filename = strtolower(basename($path));
- if (in_array($filename, $blacklist)) {
+ if (self::isFileBlacklisted($path)) {
$data['run'] = false;
}
}
}
/**
+ * @param string $filename
+ * @return bool
+ */
+ static public function isFileBlacklisted($filename) {
+ $blacklist = \OC_Config::getValue('blacklisted_files', array('.htaccess'));
+ $filename = strtolower(basename($filename));
+ return (in_array($filename, $blacklist));
+ }
+
+ /**
* following functions are equivalent to their php builtin equivalents for arguments/return values.
*/
static public function mkdir($path) {