writable not writeable
This commit is contained in:
parent
25e777ef5e
commit
30673e4786
|
@ -259,7 +259,7 @@ class OC_Filestorage_Shared extends OC_Filestorage {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function is_writeable($path) {
|
public function is_writable($path) {
|
||||||
if($path == "" || $path == "/"){
|
if($path == "" || $path == "/"){
|
||||||
return false;
|
return false;
|
||||||
}elseif (OC_Share::getPermissions($this->datadir.$path) & OC_Share::WRITE) {
|
}elseif (OC_Share::getPermissions($this->datadir.$path) & OC_Share::WRITE) {
|
||||||
|
@ -340,7 +340,7 @@ class OC_Filestorage_Shared extends OC_Filestorage {
|
||||||
}
|
}
|
||||||
|
|
||||||
public function file_put_contents($path, $data) {
|
public function file_put_contents($path, $data) {
|
||||||
if ($this->is_writeable($path)) {
|
if ($this->is_writable($path)) {
|
||||||
$source = $this->getSource($path);
|
$source = $this->getSource($path);
|
||||||
if ($source) {
|
if ($source) {
|
||||||
$storage = OC_Filesystem::getStorage($source);
|
$storage = OC_Filesystem::getStorage($source);
|
||||||
|
@ -384,7 +384,7 @@ class OC_Filestorage_Shared extends OC_Filestorage {
|
||||||
if ($root1 !== $root2) {
|
if ($root1 !== $root2) {
|
||||||
return false;
|
return false;
|
||||||
// Check if both paths have write permission
|
// Check if both paths have write permission
|
||||||
} else if ($this->is_writeable($path1) && $this->is_writeable($path2)) {
|
} else if ($this->is_writable($path1) && $this->is_writable($path2)) {
|
||||||
$oldSource = $this->getSource($path1);
|
$oldSource = $this->getSource($path1);
|
||||||
$newSource = $folders['source'].substr($newTarget, strlen($folders['target']));
|
$newSource = $folders['source'].substr($newTarget, strlen($folders['target']));
|
||||||
if ($oldSource) {
|
if ($oldSource) {
|
||||||
|
@ -414,7 +414,7 @@ class OC_Filestorage_Shared extends OC_Filestorage {
|
||||||
if ($path2 == "" || $path2 == "/") {
|
if ($path2 == "" || $path2 == "/") {
|
||||||
// TODO Construct new shared item or should this not be allowed?
|
// TODO Construct new shared item or should this not be allowed?
|
||||||
} else {
|
} else {
|
||||||
if ($this->is_writeable($path2)) {
|
if ($this->is_writable($path2)) {
|
||||||
$tmpFile = $this->toTmpFile($path1);
|
$tmpFile = $this->toTmpFile($path1);
|
||||||
$result = $this->fromTmpFile($tmpFile, $path2);
|
$result = $this->fromTmpFile($tmpFile, $path2);
|
||||||
if ($result) {
|
if ($result) {
|
||||||
|
@ -444,7 +444,7 @@ class OC_Filestorage_Shared extends OC_Filestorage {
|
||||||
}
|
}
|
||||||
|
|
||||||
public function fromTmpFile($tmpFile, $path) {
|
public function fromTmpFile($tmpFile, $path) {
|
||||||
if ($this->is_writeable($path)) {
|
if ($this->is_writable($path)) {
|
||||||
$source = $this->getSource($path);
|
$source = $this->getSource($path);
|
||||||
if ($source) {
|
if ($source) {
|
||||||
$storage = OC_Filesystem::getStorage($source);
|
$storage = OC_Filesystem::getStorage($source);
|
||||||
|
|
|
@ -33,7 +33,7 @@ $filename = isset($_GET['file']) ? $_GET['file'] : '';
|
||||||
if(!empty($filename))
|
if(!empty($filename))
|
||||||
{
|
{
|
||||||
$path = $dir.'/'.$filename;
|
$path = $dir.'/'.$filename;
|
||||||
if(OC_Filesystem::is_writeable($path))
|
if(OC_Filesystem::is_writable($path))
|
||||||
{
|
{
|
||||||
$mtime = OC_Filesystem::filemtime($path);
|
$mtime = OC_Filesystem::filemtime($path);
|
||||||
$filecontents = OC_Filesystem::file_get_contents($path);
|
$filecontents = OC_Filesystem::file_get_contents($path);
|
||||||
|
|
|
@ -46,7 +46,7 @@ if($path != '' && $mtime != '')
|
||||||
{
|
{
|
||||||
// File same as when opened
|
// File same as when opened
|
||||||
// Save file
|
// Save file
|
||||||
if(OC_Filesystem::is_writeable($path))
|
if(OC_Filesystem::is_writable($path))
|
||||||
{
|
{
|
||||||
OC_Filesystem::file_put_contents($path, $filecontents);
|
OC_Filesystem::file_put_contents($path, $filecontents);
|
||||||
// Clear statcache
|
// Clear statcache
|
||||||
|
|
|
@ -94,7 +94,7 @@ $tmpl = new OC_Template( "files", "index", "user" );
|
||||||
$tmpl->assign( "fileList", $list->fetchPage() );
|
$tmpl->assign( "fileList", $list->fetchPage() );
|
||||||
$tmpl->assign( "breadcrumb", $breadcrumbNav->fetchPage() );
|
$tmpl->assign( "breadcrumb", $breadcrumbNav->fetchPage() );
|
||||||
$tmpl->assign( 'dir', $dir);
|
$tmpl->assign( 'dir', $dir);
|
||||||
$tmpl->assign( 'readonly', !OC_Filesystem::is_writeable($dir));
|
$tmpl->assign( 'readonly', !OC_Filesystem::is_writable($dir));
|
||||||
$tmpl->assign( "files", $files );
|
$tmpl->assign( "files", $files );
|
||||||
$tmpl->assign( 'uploadMaxFilesize', $maxUploadFilesize);
|
$tmpl->assign( 'uploadMaxFilesize', $maxUploadFilesize);
|
||||||
$tmpl->assign( 'uploadMaxHumanFilesize', OC_Helper::humanFileSize($maxUploadFilesize));
|
$tmpl->assign( 'uploadMaxHumanFilesize', OC_Helper::humanFileSize($maxUploadFilesize));
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<?php foreach($_['files'] as $file):
|
<?php foreach($_['files'] as $file):
|
||||||
$write = ($file['writeable']) ? 'true' : 'false';
|
$write = ($file['writable']) ? 'true' : 'false';
|
||||||
$simple_file_size = simple_file_size($file['size']);
|
$simple_file_size = simple_file_size($file['size']);
|
||||||
$simple_size_color = intval(200-$file['size']/(1024*1024)*2); // the bigger the file, the darker the shade of grey; megabytes*2
|
$simple_size_color = intval(200-$file['size']/(1024*1024)*2); // the bigger the file, the darker the shade of grey; megabytes*2
|
||||||
if($simple_size_color<0) $simple_size_color = 0;
|
if($simple_size_color<0) $simple_size_color = 0;
|
||||||
|
|
|
@ -34,7 +34,7 @@ class OC_Filestorage{
|
||||||
public function filetype($path){}
|
public function filetype($path){}
|
||||||
public function filesize($path){}
|
public function filesize($path){}
|
||||||
public function is_readable($path){}
|
public function is_readable($path){}
|
||||||
public function is_writeable($path){}
|
public function is_writable($path){}
|
||||||
public function file_exists($path){}
|
public function file_exists($path){}
|
||||||
public function readfile($path){}
|
public function readfile($path){}
|
||||||
public function filectime($path){}
|
public function filectime($path){}
|
||||||
|
|
|
@ -50,7 +50,7 @@ class OC_Filestorage_Local extends OC_Filestorage{
|
||||||
public function is_readable($path){
|
public function is_readable($path){
|
||||||
return is_readable($this->datadir.$path);
|
return is_readable($this->datadir.$path);
|
||||||
}
|
}
|
||||||
public function is_writeable($path){
|
public function is_writable($path){
|
||||||
return is_writable($this->datadir.$path);
|
return is_writable($this->datadir.$path);
|
||||||
}
|
}
|
||||||
public function file_exists($path){
|
public function file_exists($path){
|
||||||
|
|
|
@ -35,7 +35,7 @@ class OC_Filestorage_Common extends OC_Filestorage {
|
||||||
return $stat['size'];
|
return $stat['size'];
|
||||||
}
|
}
|
||||||
public function is_readable($path){}
|
public function is_readable($path){}
|
||||||
public function is_writeable($path){}
|
public function is_writable($path){}
|
||||||
public function file_exists($path){}
|
public function file_exists($path){}
|
||||||
public function readfile($path) {
|
public function readfile($path) {
|
||||||
$handle = $this->fopen($path, "r");
|
$handle = $this->fopen($path, "r");
|
||||||
|
|
|
@ -333,8 +333,8 @@ class OC_Filesystem{
|
||||||
static public function is_readable($path){
|
static public function is_readable($path){
|
||||||
return self::$defaultInstance->is_readable($path);
|
return self::$defaultInstance->is_readable($path);
|
||||||
}
|
}
|
||||||
static public function is_writeable($path){
|
static public function is_writable($path){
|
||||||
return self::$defaultInstance->is_writeable($path);
|
return self::$defaultInstance->is_writable($path);
|
||||||
}
|
}
|
||||||
static public function file_exists($path){
|
static public function file_exists($path){
|
||||||
return self::$defaultInstance->file_exists($path);
|
return self::$defaultInstance->file_exists($path);
|
||||||
|
|
|
@ -141,8 +141,8 @@ class OC_FilesystemView {
|
||||||
public function is_readable($path){
|
public function is_readable($path){
|
||||||
return $this->basicOperation('is_readable',$path);
|
return $this->basicOperation('is_readable',$path);
|
||||||
}
|
}
|
||||||
public function is_writeable($path){
|
public function is_writable($path){
|
||||||
return $this->basicOperation('is_writeable',$path);
|
return $this->basicOperation('is_writable',$path);
|
||||||
}
|
}
|
||||||
public function file_exists($path){
|
public function file_exists($path){
|
||||||
if($path=='/'){
|
if($path=='/'){
|
||||||
|
@ -166,7 +166,7 @@ class OC_FilesystemView {
|
||||||
return $this->basicOperation('unlink',$path,array('delete'));
|
return $this->basicOperation('unlink',$path,array('delete'));
|
||||||
}
|
}
|
||||||
public function rename($path1,$path2){
|
public function rename($path1,$path2){
|
||||||
if(OC_FileProxy::runPreProxies('rename',$path1,$path2) and $this->is_writeable($path1) and OC_Filesystem::isValidPath($path2)){
|
if(OC_FileProxy::runPreProxies('rename',$path1,$path2) and $this->is_writable($path1) and OC_Filesystem::isValidPath($path2)){
|
||||||
$run=true;
|
$run=true;
|
||||||
OC_Hook::emit( OC_Filesystem::CLASSNAME, OC_Filesystem::signal_rename, array( OC_Filesystem::signal_param_oldpath => $path1 , OC_Filesystem::signal_param_newpath=>$path2, OC_Filesystem::signal_param_run => &$run));
|
OC_Hook::emit( OC_Filesystem::CLASSNAME, OC_Filesystem::signal_rename, array( OC_Filesystem::signal_param_oldpath => $path1 , OC_Filesystem::signal_param_newpath=>$path2, OC_Filesystem::signal_param_run => &$run));
|
||||||
if($run){
|
if($run){
|
||||||
|
|
|
@ -226,7 +226,7 @@ class OC_Util {
|
||||||
$errors[]=array('error'=>'PHP module ctype is not installed.<br/>','hint'=>'Please ask your server administrator to install the module.');
|
$errors[]=array('error'=>'PHP module ctype is not installed.<br/>','hint'=>'Please ask your server administrator to install the module.');
|
||||||
}
|
}
|
||||||
|
|
||||||
if(file_exists(OC::$SERVERROOT."/config/config.php") and !is_writeable(OC::$SERVERROOT."/config/config.php")){
|
if(file_exists(OC::$SERVERROOT."/config/config.php") and !is_writable(OC::$SERVERROOT."/config/config.php")){
|
||||||
$errors[]=array('error'=>"Can't write into config directory 'config'",'hint'=>"You can usually fix this by giving the webserver use write access to the config directory in owncloud");
|
$errors[]=array('error'=>"Can't write into config directory 'config'",'hint'=>"You can usually fix this by giving the webserver use write access to the config directory in owncloud");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue