aboutsummaryrefslogtreecommitdiffstats
path: root/lib/files/filesystem.php
diff options
context:
space:
mode:
authorRobin Appelman <icewind@owncloud.com>2013-02-22 16:13:08 +0100
committerRobin Appelman <icewind@owncloud.com>2013-02-22 16:13:08 +0100
commit62c65bc1c857c3a82152cf33694f251a235b8afa (patch)
treee211e308a9cdcd887f33fd6f23ba6c3d8b2106b7 /lib/files/filesystem.php
parent38782036798dbe0a34995a3fca0aa92583cb9099 (diff)
downloadnextcloud-server-62c65bc1c857c3a82152cf33694f251a235b8afa.tar.gz
nextcloud-server-62c65bc1c857c3a82152cf33694f251a235b8afa.zip
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 875a9d6c5ee..36a21288b4d 100644
--- a/lib/files/filesystem.php
+++ b/lib/files/filesystem.php
@@ -221,9 +221,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'])) {
@@ -262,9 +262,9 @@ class Filesystem {
$root = \OC_User::getHome($user);
self::mount('\OC\Files\Storage\Local', array('datadir' => $root), $user);
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])) {
@@ -389,21 +389,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) {