diff options
Diffstat (limited to 'apps/files_external')
-rw-r--r-- | apps/files_external/ajax/addMountPoint.php | 4 | ||||
-rw-r--r-- | apps/files_external/ajax/addRootCertificate.php | 1 | ||||
-rw-r--r-- | apps/files_external/ajax/removeMountPoint.php | 4 | ||||
-rwxr-xr-x | apps/files_external/lib/dropbox.php | 2 | ||||
-rw-r--r-- | apps/files_external/lib/google.php | 9 | ||||
-rw-r--r-- | apps/files_external/lib/smb.php | 2 | ||||
-rw-r--r-- | apps/files_external/lib/webdav.php | 20 | ||||
-rw-r--r-- | apps/files_external/templates/settings.php | 2 | ||||
-rw-r--r-- | apps/files_external/tests/amazons3.php | 3 | ||||
-rw-r--r-- | apps/files_external/tests/ftp.php | 1 | ||||
-rw-r--r-- | apps/files_external/tests/google.php | 1 | ||||
-rw-r--r-- | apps/files_external/tests/smb.php | 1 | ||||
-rw-r--r-- | apps/files_external/tests/swift.php | 1 | ||||
-rw-r--r-- | apps/files_external/tests/webdav.php | 1 |
14 files changed, 20 insertions, 32 deletions
diff --git a/apps/files_external/ajax/addMountPoint.php b/apps/files_external/ajax/addMountPoint.php index 549cb6a3427..e08f805942f 100644 --- a/apps/files_external/ajax/addMountPoint.php +++ b/apps/files_external/ajax/addMountPoint.php @@ -1,6 +1,8 @@ <?php OCP\JSON::checkAppEnabled('files_external'); +OCP\JSON::callCheck(); + if ($_POST['isPersonal'] == 'true') { OCP\JSON::checkLoggedIn(); $isPersonal = true; @@ -9,5 +11,3 @@ if ($_POST['isPersonal'] == 'true') { $isPersonal = false; } OC_Mount_Config::addMountPoint($_POST['mountPoint'], $_POST['class'], $_POST['classOptions'], $_POST['mountType'], $_POST['applicable'], $isPersonal); - -?> diff --git a/apps/files_external/ajax/addRootCertificate.php b/apps/files_external/ajax/addRootCertificate.php index c5f49a82d36..d28a7d24b2d 100644 --- a/apps/files_external/ajax/addRootCertificate.php +++ b/apps/files_external/ajax/addRootCertificate.php @@ -5,6 +5,7 @@ OCP\JSON::checkAppEnabled('files_external'); $view = \OCP\Files::getStorage("files_external"); $from = $_FILES['rootcert_import']['tmp_name']; $path = \OCP\Config::getSystemValue('datadirectory').$view->getAbsolutePath("").'uploads/'; +if(!file_exists($path)) mkdir($path,0700,true); $to = $path.$_FILES['rootcert_import']['name']; move_uploaded_file($from, $to); diff --git a/apps/files_external/ajax/removeMountPoint.php b/apps/files_external/ajax/removeMountPoint.php index b77b306bcb5..aa446426202 100644 --- a/apps/files_external/ajax/removeMountPoint.php +++ b/apps/files_external/ajax/removeMountPoint.php @@ -1,6 +1,8 @@ <?php OCP\JSON::checkAppEnabled('files_external'); +OCP\JSON::callCheck(); + if ($_POST['isPersonal'] == 'true') { OCP\JSON::checkLoggedIn(); $isPersonal = true; @@ -9,5 +11,3 @@ if ($_POST['isPersonal'] == 'true') { $isPersonal = false; } OC_Mount_Config::removeMountPoint($_POST['mountPoint'], $_POST['mountType'], $_POST['applicable'], $isPersonal); - -?> diff --git a/apps/files_external/lib/dropbox.php b/apps/files_external/lib/dropbox.php index 35663d431f8..c849db38433 100755 --- a/apps/files_external/lib/dropbox.php +++ b/apps/files_external/lib/dropbox.php @@ -208,7 +208,7 @@ class OC_Filestorage_Dropbox extends OC_Filestorage_Common { if (isset(self::$tempFiles[$tmpFile])) { $handle = fopen($tmpFile, 'r'); try { - $response = $this->dropbox->putFile(self::$tempFiles[$tmpFile], $handle); + $this->dropbox->putFile(self::$tempFiles[$tmpFile], $handle); unlink($tmpFile); } catch (Exception $exception) { diff --git a/apps/files_external/lib/google.php b/apps/files_external/lib/google.php index 41b560ae84e..2ad85d09d5f 100644 --- a/apps/files_external/lib/google.php +++ b/apps/files_external/lib/google.php @@ -178,7 +178,7 @@ class OC_Filestorage_Google extends OC_Filestorage_Common { if ($collection == '/' || $collection == '\.' || $collection == '.') { $uri = 'https://docs.google.com/feeds/default/private/full'; // Get parent content link - } else if ($dom = $this->getResource(basename($dir))) { + } else if ($dom = $this->getResource(basename($collection))) { $uri = $dom->getElementsByTagName('content')->item(0)->getAttribute('src'); } if (isset($uri)) { @@ -341,7 +341,7 @@ class OC_Filestorage_Google extends OC_Filestorage_Common { break; } } - $title = basename($path); + $title = basename($path2); // Construct post data $postData = '<?xml version="1.0" encoding="UTF-8"?>'; $postData .= '<entry xmlns="http://www.w3.org/2005/Atom" xmlns:docs="http://schemas.google.com/docs/2007" xmlns:gd="http://schemas.google.com/g/2005" gd:etag='.$etag.'>'; @@ -352,13 +352,13 @@ class OC_Filestorage_Google extends OC_Filestorage_Common { } else { // Move to different collection if ($collectionEntry = $this->getResource($collection)) { - $feedUri = $colelctionEntry->getElementsByTagName('content')->item(0)->getAttribute('src'); + $feedUri = $collectionEntry->getElementsByTagName('content')->item(0)->getAttribute('src'); // Construct post data $postData = '<?xml version="1.0" encoding="UTF-8"?>'; $postData .= '<entry xmlns="http://www.w3.org/2005/Atom">'; $postData .= '<id>'.$entry->getElementsByTagName('id')->item(0).'</id>'; $postData .= '</entry>'; - $this->sendRequest($uri, 'POST', $postData); + $this->sendRequest($feedUri, 'POST', $postData); return true; } } @@ -424,7 +424,6 @@ class OC_Filestorage_Google extends OC_Filestorage_Common { } } if (!isset($uploadUri) && $entry) { - $etag = $entry->getAttribute('gd:etag'); $links = $entry->getElementsByTagName('link'); foreach ($links as $link) { if ($link->getAttribute('rel') == 'http://schemas.google.com/g/2005#resumable-create-media') { diff --git a/apps/files_external/lib/smb.php b/apps/files_external/lib/smb.php index 5e34deb2337..8a5e993b1d0 100644 --- a/apps/files_external/lib/smb.php +++ b/apps/files_external/lib/smb.php @@ -15,8 +15,6 @@ class OC_FileStorage_SMB extends OC_FileStorage_StreamWrapper{ private $root; private $share; - private static $tempFiles=array(); - public function __construct($params){ $this->host=$params['host']; $this->user=$params['user']; diff --git a/apps/files_external/lib/webdav.php b/apps/files_external/lib/webdav.php index ea6ca65b976..84d64b65193 100644 --- a/apps/files_external/lib/webdav.php +++ b/apps/files_external/lib/webdav.php @@ -45,7 +45,10 @@ class OC_FileStorage_DAV extends OC_Filestorage_Common{ $this->client = new OC_Connector_Sabre_Client($settings); if($caview = \OCP\Files::getStorage('files_external')) { - $this->client->setCurlSettings(array(CURLOPT_CAINFO => \OCP\Config::getSystemValue('datadirectory').$caview->getAbsolutePath("").'rootcerts.crt')); + $certPath=\OCP\Config::getSystemValue('datadirectory').$caview->getAbsolutePath("").'rootcerts.crt'; + if (file_exists($certPath)) { + $this->client->addTrustedCertificates($certPath); + } } //create the root folder if necesary $this->mkdir(''); @@ -74,16 +77,11 @@ class OC_FileStorage_DAV extends OC_Filestorage_Common{ $path=$this->cleanPath($path); try{ $response=$this->client->propfind($path, array(),1); - $stripLength=strlen($this->root)+strlen($path); $id=md5('webdav'.$this->root.$path); OC_FakeDirStream::$dirs[$id]=array(); - $skip = true; - foreach($response as $file=>$data){ - // Skip the first file, because it is the current directory - if ($skip) { - $skip = false; - continue; - } + $files=array_keys($response); + array_shift($files);//the first entry is the current directory + foreach($files as $file){ $file = urldecode(basename($file)); OC_FakeDirStream::$dirs[$id][]=$file; } @@ -117,7 +115,7 @@ class OC_FileStorage_DAV extends OC_Filestorage_Common{ public function file_exists($path){ $path=$this->cleanPath($path); try{ - $response=$this->client->propfind($path, array('{DAV:}resourcetype')); + $this->client->propfind($path, array('{DAV:}resourcetype')); return true;//no 404 exception }catch(Exception $e){ return false; @@ -198,7 +196,7 @@ class OC_FileStorage_DAV extends OC_Filestorage_Common{ $mtime=time(); } $path=$this->cleanPath($path); - $this->client->proppatch($path, array('{DAV:}lastmodified' => $mtime,)); + $this->client->proppatch($path, array('{DAV:}lastmodified' => $mtime)); } public function getFile($path,$target){ diff --git a/apps/files_external/templates/settings.php b/apps/files_external/templates/settings.php index 3d65e9b7473..e8bc94790dc 100644 --- a/apps/files_external/templates/settings.php +++ b/apps/files_external/templates/settings.php @@ -1,4 +1,4 @@ -<form id="files_external" method="post" enctype="multipart/form-data" action="/owncloud/?app=files_external&getfile=ajax%2FaddRootCertificate.php"> +<form id="files_external" method="post" enctype="multipart/form-data" action="<?php echo OCP\Util::linkTo('files_external', 'ajax/addRootCertificate.php'); ?>"> <fieldset class="personalblock"> <legend><strong><?php echo $l->t('External Storage'); ?></strong></legend> <table id="externalStorage" data-admin='<?php echo json_encode($_['isAdminPage']); ?>'> diff --git a/apps/files_external/tests/amazons3.php b/apps/files_external/tests/amazons3.php index d0084c94afd..b9b4cf65bd6 100644 --- a/apps/files_external/tests/amazons3.php +++ b/apps/files_external/tests/amazons3.php @@ -45,6 +45,3 @@ if (!is_array($config) or !isset($config['amazons3']) or !$config['amazons3']['r } } } - -?> - diff --git a/apps/files_external/tests/ftp.php b/apps/files_external/tests/ftp.php index 68481b4e66b..97796bca128 100644 --- a/apps/files_external/tests/ftp.php +++ b/apps/files_external/tests/ftp.php @@ -13,7 +13,6 @@ if(!is_array($config) or !isset($config['ftp']) or !$config['ftp']['run']){ }else{ class Test_Filestorage_FTP extends Test_FileStorage { private $config; - private $id; public function setUp(){ $id=uniqid(); diff --git a/apps/files_external/tests/google.php b/apps/files_external/tests/google.php index 08116f0e748..806db5a6aaa 100644 --- a/apps/files_external/tests/google.php +++ b/apps/files_external/tests/google.php @@ -28,7 +28,6 @@ if(!is_array($config) or !isset($config['google']) or !$config['google']['run']) class Test_Filestorage_Google extends Test_FileStorage { private $config; - private $id; public function setUp(){ $id=uniqid(); diff --git a/apps/files_external/tests/smb.php b/apps/files_external/tests/smb.php index e1495b7480d..001ef842276 100644 --- a/apps/files_external/tests/smb.php +++ b/apps/files_external/tests/smb.php @@ -14,7 +14,6 @@ if(!is_array($config) or !isset($config['smb']) or !$config['smb']['run']){ }else{ class Test_Filestorage_SMB extends Test_FileStorage { private $config; - private $id; public function setUp(){ $id=uniqid(); diff --git a/apps/files_external/tests/swift.php b/apps/files_external/tests/swift.php index f0bde6ed605..1520c9473d3 100644 --- a/apps/files_external/tests/swift.php +++ b/apps/files_external/tests/swift.php @@ -13,7 +13,6 @@ if(!is_array($config) or !isset($config['swift']) or !$config['swift']['run']){ }else{ class Test_Filestorage_SWIFT extends Test_FileStorage { private $config; - private $id; public function setUp(){ $id=uniqid(); diff --git a/apps/files_external/tests/webdav.php b/apps/files_external/tests/webdav.php index 144659819b6..14abbef2cbf 100644 --- a/apps/files_external/tests/webdav.php +++ b/apps/files_external/tests/webdav.php @@ -13,7 +13,6 @@ if(!is_array($config) or !isset($config['webdav']) or !$config['webdav']['run']) }else{ class Test_Filestorage_DAV extends Test_FileStorage { private $config; - private $id; public function setUp(){ $id=uniqid(); |