Check blacklist before saving to filesystem

This commit is contained in:
Tom Needham 2012-04-03 22:31:34 +00:00
parent 95c2ac5d58
commit acdce2b1e0
2 changed files with 16 additions and 0 deletions

View File

@ -365,6 +365,9 @@ class OC{
OC_App::loadApps();
}
}
// Check for blacklisted files
OC_Hook::connect('OC_Filesystem','write','OC_Filesystem','isBlacklisted');
//make sure temporary files are cleaned up
register_shutdown_function(array('OC_Helper','cleanTmp'));

View File

@ -298,6 +298,19 @@ class OC_Filesystem{
}
return true;
}
/**
* checks if a file is blacklsited for storage in the filesystem
* @param array $data from hook
*/
static public function isBlacklisted($data){
$blacklist = array('.htaccess');
$filename = strtolower(basename($data['path']));
if(in_array($filename,$blacklist)){
$data['run'] = false;
}
}
/**
* following functions are equivilent to their php buildin equivilents for arguments/return values.
*/