summaryrefslogtreecommitdiffstats
path: root/apps/files_external
diff options
context:
space:
mode:
authorThomas Mueller <thomas.mueller@tmit.eu>2013-02-17 09:41:37 +0100
committerThomas Mueller <thomas.mueller@tmit.eu>2013-02-17 09:41:37 +0100
commit325746ae45506dad6003f55fe951243be9db3c77 (patch)
tree526975163d93bce4b3cecd389ad9a6649769cfed /apps/files_external
parent808a13922c8bc002e697f3bbe84be70a2c715cf6 (diff)
parent0f8058cb12ed97dba45ab8b2f48b7321662bbd2e (diff)
downloadnextcloud-server-325746ae45506dad6003f55fe951243be9db3c77.tar.gz
nextcloud-server-325746ae45506dad6003f55fe951243be9db3c77.zip
Merge branch 'master' into fix-googledrive
Diffstat (limited to 'apps/files_external')
-rw-r--r--apps/files_external/ajax/addRootCertificate.php3
-rw-r--r--apps/files_external/ajax/dropbox.php2
-rw-r--r--apps/files_external/ajax/google.php2
-rw-r--r--apps/files_external/ajax/removeMountPoint.php10
-rw-r--r--apps/files_external/js/settings.js4
-rw-r--r--apps/files_external/l10n/fi_FI.php1
-rw-r--r--apps/files_external/l10n/hi.php3
-rwxr-xr-xapps/files_external/lib/config.php4
-rw-r--r--apps/files_external/lib/ftp.php4
-rw-r--r--apps/files_external/lib/smb.php12
-rw-r--r--apps/files_external/lib/streamwrapper.php24
-rw-r--r--apps/files_external/lib/swift.php4
-rw-r--r--apps/files_external/lib/webdav.php20
-rw-r--r--apps/files_external/templates/settings.php3
14 files changed, 57 insertions, 39 deletions
diff --git a/apps/files_external/ajax/addRootCertificate.php b/apps/files_external/ajax/addRootCertificate.php
index 2f67e801b2c..7794238ab36 100644
--- a/apps/files_external/ajax/addRootCertificate.php
+++ b/apps/files_external/ajax/addRootCertificate.php
@@ -1,6 +1,7 @@
<?php
OCP\JSON::checkAppEnabled('files_external');
+OCP\JSON::callCheck();
if ( ! ($filename = $_FILES['rootcert_import']['name']) ) {
header("Location: settings/personal.php");
@@ -13,7 +14,7 @@ fclose($fh);
$filename = $_FILES['rootcert_import']['name'];
$view = new \OC\Files\View('/'.\OCP\User::getUser().'/files_external/uploads');
-if (!$view->file_exists('')){
+if (!$view->file_exists('')) {
$view->mkdir('');
}
diff --git a/apps/files_external/ajax/dropbox.php b/apps/files_external/ajax/dropbox.php
index 58c41d69062..bc9821c62ec 100644
--- a/apps/files_external/ajax/dropbox.php
+++ b/apps/files_external/ajax/dropbox.php
@@ -4,6 +4,8 @@ require_once 'Dropbox/autoload.php';
OCP\JSON::checkAppEnabled('files_external');
OCP\JSON::checkLoggedIn();
+OCP\JSON::callCheck();
+
if (isset($_POST['app_key']) && isset($_POST['app_secret'])) {
$oauth = new Dropbox_OAuth_Curl($_POST['app_key'], $_POST['app_secret']);
if (isset($_POST['step'])) {
diff --git a/apps/files_external/ajax/google.php b/apps/files_external/ajax/google.php
index c76c7618e4d..70adcb2c2ad 100644
--- a/apps/files_external/ajax/google.php
+++ b/apps/files_external/ajax/google.php
@@ -4,6 +4,8 @@ require_once 'Google/common.inc.php';
OCP\JSON::checkAppEnabled('files_external');
OCP\JSON::checkLoggedIn();
+OCP\JSON::callCheck();
+
$consumer = new OAuthConsumer('anonymous', 'anonymous');
$sigMethod = new OAuthSignatureMethod_HMAC_SHA1();
if (isset($_POST['step'])) {
diff --git a/apps/files_external/ajax/removeMountPoint.php b/apps/files_external/ajax/removeMountPoint.php
index aa446426202..2f5dbcfdbac 100644
--- a/apps/files_external/ajax/removeMountPoint.php
+++ b/apps/files_external/ajax/removeMountPoint.php
@@ -3,6 +3,15 @@
OCP\JSON::checkAppEnabled('files_external');
OCP\JSON::callCheck();
+if (!isset($_POST['isPersonal']))
+ return;
+if (!isset($_POST['mountPoint']))
+ return;
+if (!isset($_POST['mountType']))
+ return;
+if (!isset($_POST['applicable']))
+ return;
+
if ($_POST['isPersonal'] == 'true') {
OCP\JSON::checkLoggedIn();
$isPersonal = true;
@@ -10,4 +19,5 @@ if ($_POST['isPersonal'] == 'true') {
OCP\JSON::checkAdminUser();
$isPersonal = false;
}
+
OC_Mount_Config::removeMountPoint($_POST['mountPoint'], $_POST['mountType'], $_POST['applicable'], $isPersonal);
diff --git a/apps/files_external/js/settings.js b/apps/files_external/js/settings.js
index 172ef097fbf..12690395270 100644
--- a/apps/files_external/js/settings.js
+++ b/apps/files_external/js/settings.js
@@ -47,7 +47,7 @@ OC.MountConfig={
oldUsers.splice($.inArray(applicable, oldUsers), 1);
}
}
- $.post(OC.filePath('files_external', 'ajax', 'addMountPoint.php'), { mountPoint: mountPoint, class: backendClass, classOptions: classOptions, mountType: mountType, applicable: applicable, isPersonal: isPersonal });
+ $.post(OC.filePath('files_external', 'ajax', 'addMountPoint.php'), { mountPoint: mountPoint, 'class': backendClass, classOptions: classOptions, mountType: mountType, applicable: applicable, isPersonal: isPersonal });
});
var mountType = 'group';
$.each(oldGroups, function(index, applicable) {
@@ -61,7 +61,7 @@ OC.MountConfig={
var isPersonal = true;
var mountType = 'user';
var applicable = OC.currentUser;
- $.post(OC.filePath('files_external', 'ajax', 'addMountPoint.php'), { mountPoint: mountPoint, class: backendClass, classOptions: classOptions, mountType: mountType, applicable: applicable, isPersonal: isPersonal });
+ $.post(OC.filePath('files_external', 'ajax', 'addMountPoint.php'), { mountPoint: mountPoint, 'class': backendClass, classOptions: classOptions, mountType: mountType, applicable: applicable, isPersonal: isPersonal });
}
return true;
}
diff --git a/apps/files_external/l10n/fi_FI.php b/apps/files_external/l10n/fi_FI.php
index 8c7381db71d..120c190790b 100644
--- a/apps/files_external/l10n/fi_FI.php
+++ b/apps/files_external/l10n/fi_FI.php
@@ -3,6 +3,7 @@
"Error configuring Dropbox storage" => "Virhe Dropbox levyn asetuksia tehtäessä",
"Grant access" => "Salli pääsy",
"Fill out all required fields" => "Täytä kaikki vaaditut kentät",
+"Please provide a valid Dropbox app key and secret." => "Anna kelvollinen Dropbox-sovellusavain ja salainen vastaus.",
"Error configuring Google Drive storage" => "Virhe Google Drive levyn asetuksia tehtäessä",
"<b>Warning:</b> \"smbclient\" is not installed. Mounting of CIFS/SMB shares is not possible. Please ask your system administrator to install it." => "<b>Varoitus:</b> \"smbclient\" ei ole asennettuna. CIFS-/SMB-jakojen liittäminen ei ole mahdollista. Pyydä järjestelmän ylläpitäjää asentamaan smbclient.",
"<b>Warning:</b> The FTP support in PHP is not enabled or installed. Mounting of FTP shares is not possible. Please ask your system administrator to install it." => "<b>Varoitus:</b> PHP:n FTP-tuki ei ole käytössä tai sitä ei ole asennettu. FTP-jakojen liittäminen ei ole mahdollista. Pyydä järjestelmän ylläpitäjää ottamaan FTP-tuki käyttöön.",
diff --git a/apps/files_external/l10n/hi.php b/apps/files_external/l10n/hi.php
new file mode 100644
index 00000000000..0482efc4b23
--- /dev/null
+++ b/apps/files_external/l10n/hi.php
@@ -0,0 +1,3 @@
+<?php $TRANSLATIONS = array(
+"Users" => "उपयोगकर्ता"
+);
diff --git a/apps/files_external/lib/config.php b/apps/files_external/lib/config.php
index d78c69e83db..44e668a09c0 100755
--- a/apps/files_external/lib/config.php
+++ b/apps/files_external/lib/config.php
@@ -310,7 +310,7 @@ class OC_Mount_Config {
foreach ($data[self::MOUNT_TYPE_GROUP] as $group => $mounts) {
$content .= "\t\t'".$group."' => array (\n";
foreach ($mounts as $mountPoint => $mount) {
- $content .= "\t\t\t'".addcslashes($mountPoint,"'")."' => ".str_replace("\n", '', var_export($mount, true)).", \n";
+ $content .= "\t\t\t'".addcslashes($mountPoint, "'")."' => ".str_replace("\n", '', var_export($mount, true)).", \n";
}
$content .= "\t\t),\n";
@@ -322,7 +322,7 @@ class OC_Mount_Config {
foreach ($data[self::MOUNT_TYPE_USER] as $user => $mounts) {
$content .= "\t\t'".$user."' => array (\n";
foreach ($mounts as $mountPoint => $mount) {
- $content .= "\t\t\t'".addcslashes($mountPoint,"'")."' => ".str_replace("\n", '', var_export($mount, true)).",\n";
+ $content .= "\t\t\t'".addcslashes($mountPoint, "'")."' => ".str_replace("\n", '', var_export($mount, true)).",\n";
}
$content .= "\t\t),\n";
}
diff --git a/apps/files_external/lib/ftp.php b/apps/files_external/lib/ftp.php
index 9a27b63323a..9b6c037bb57 100644
--- a/apps/files_external/lib/ftp.php
+++ b/apps/files_external/lib/ftp.php
@@ -68,7 +68,7 @@ class FTP extends \OC\Files\Storage\StreamWrapper{
case 'ab':
//these are supported by the wrapper
$context = stream_context_create(array('ftp' => array('overwrite' => true)));
- return fopen($this->constructUrl($path),$mode, false,$context);
+ return fopen($this->constructUrl($path), $mode, false, $context);
case 'r+':
case 'w+':
case 'wb+':
@@ -89,7 +89,7 @@ class FTP extends \OC\Files\Storage\StreamWrapper{
$this->getFile($path, $tmpFile);
}
self::$tempFiles[$tmpFile]=$path;
- return fopen('close://'.$tmpFile,$mode);
+ return fopen('close://'.$tmpFile, $mode);
}
return false;
}
diff --git a/apps/files_external/lib/smb.php b/apps/files_external/lib/smb.php
index 96778b0b2e1..62f6591d25a 100644
--- a/apps/files_external/lib/smb.php
+++ b/apps/files_external/lib/smb.php
@@ -33,7 +33,7 @@ class SMB extends \OC\Files\Storage\StreamWrapper{
$this->share='/'.$this->share;
}
if(substr($this->share, -1, 1)=='/') {
- $this->share = substr($this->share,0,-1);
+ $this->share = substr($this->share, 0, -1);
}
}
@@ -45,7 +45,10 @@ class SMB extends \OC\Files\Storage\StreamWrapper{
if (substr($path, -1)=='/') {
$path=substr($path, 0, -1);
}
- return 'smb://'.$this->user.':'.$this->password.'@'.$this->host.$this->share.$this->root.$path;
+ $path = urlencode($path);
+ $user = urlencode($this->user);
+ $pass = urlencode($this->password);
+ return 'smb://'.$user.':'.$pass.'@'.$this->host.$this->share.$this->root.$path;
}
public function stat($path) {
@@ -59,11 +62,6 @@ class SMB extends \OC\Files\Storage\StreamWrapper{
}
}
- public function filetype($path) {
- // using opendir causes the same amount of requests and caches the content of the folder in one go
- return (bool)@$this->opendir($path) ? 'dir' : 'file';
- }
-
/**
* check if a file or folder has been updated since $time
* @param string $path
diff --git a/apps/files_external/lib/streamwrapper.php b/apps/files_external/lib/streamwrapper.php
index 7c3ddcf8a2c..a631e7ce06a 100644
--- a/apps/files_external/lib/streamwrapper.php
+++ b/apps/files_external/lib/streamwrapper.php
@@ -12,7 +12,7 @@ abstract class StreamWrapper extends \OC\Files\Storage\Common{
private $ready = false;
protected function init(){
- if($this->ready){
+ if($this->ready) {
return;
}
$this->ready = true;
@@ -71,39 +71,39 @@ abstract class StreamWrapper extends \OC\Files\Storage\Common{
return $succes;
}
- public function fopen($path,$mode) {
+ public function fopen($path, $mode) {
$this->init();
- return fopen($this->constructUrl($path),$mode);
+ return fopen($this->constructUrl($path), $mode);
}
public function free_space($path) {
return 0;
}
- public function touch($path,$mtime=null) {
+ public function touch($path, $mtime=null) {
$this->init();
if(is_null($mtime)) {
- $fh = $this->fopen($path,'a');
- fwrite($fh,'');
+ $fh = $this->fopen($path, 'a');
+ fwrite($fh, '');
fclose($fh);
} else {
return false;//not supported
}
}
- public function getFile($path,$target) {
+ public function getFile($path, $target) {
$this->init();
- return copy($this->constructUrl($path),$target);
+ return copy($this->constructUrl($path), $target);
}
- public function uploadFile($path,$target) {
+ public function uploadFile($path, $target) {
$this->init();
- return copy($path,$this->constructUrl($target));
+ return copy($path, $this->constructUrl($target));
}
- public function rename($path1,$path2) {
+ public function rename($path1, $path2) {
$this->init();
- return rename($this->constructUrl($path1),$this->constructUrl($path2));
+ return rename($this->constructUrl($path1), $this->constructUrl($path2));
}
public function stat($path) {
diff --git a/apps/files_external/lib/swift.php b/apps/files_external/lib/swift.php
index cbf2007052b..0fd6fa143b8 100644
--- a/apps/files_external/lib/swift.php
+++ b/apps/files_external/lib/swift.php
@@ -210,7 +210,7 @@ class SWIFT extends \OC\Files\Storage\Common{
return false;
} else {
$fh=fopen($tmpFile, 'a');
- fwrite($fh,$name . "\n");
+ fwrite($fh, $name . "\n");
}
} catch(\Exception $e) {
file_put_contents($tmpFile, $name . "\n");
@@ -290,7 +290,7 @@ class SWIFT extends \OC\Files\Storage\Common{
}
private function init(){
- if($this->ready){
+ if($this->ready) {
return;
}
$this->ready = true;
diff --git a/apps/files_external/lib/webdav.php b/apps/files_external/lib/webdav.php
index 2a953ac63f4..039a07b1ef2 100644
--- a/apps/files_external/lib/webdav.php
+++ b/apps/files_external/lib/webdav.php
@@ -49,7 +49,7 @@ class DAV extends \OC\Files\Storage\Common{
}
private function init(){
- if($this->ready){
+ if($this->ready) {
return;
}
$this->ready = true;
@@ -153,10 +153,10 @@ class DAV extends \OC\Files\Storage\Common{
public function unlink($path) {
$this->init();
- return $this->simpleResponse('DELETE', $path, null ,204);
+ return $this->simpleResponse('DELETE', $path, null, 204);
}
- public function fopen($path,$mode) {
+ public function fopen($path, $mode) {
$this->init();
$path=$this->cleanPath($path);
switch($mode) {
@@ -235,13 +235,13 @@ class DAV extends \OC\Files\Storage\Common{
$this->client->proppatch($path, array('{DAV:}lastmodified' => $mtime));
}
- public function getFile($path,$target) {
+ public function getFile($path, $target) {
$this->init();
- $source=$this->fopen($path,'r');
- file_put_contents($target,$source);
+ $source=$this->fopen($path, 'r');
+ file_put_contents($target, $source);
}
- public function uploadFile($path,$target) {
+ public function uploadFile($path, $target) {
$this->init();
$source=fopen($path, 'r');
@@ -256,7 +256,7 @@ class DAV extends \OC\Files\Storage\Common{
curl_close ($curl);
}
- public function rename($path1,$path2) {
+ public function rename($path1, $path2) {
$this->init();
$path1=$this->cleanPath($path1);
$path2=$this->root.$this->cleanPath($path2);
@@ -268,7 +268,7 @@ class DAV extends \OC\Files\Storage\Common{
}
}
- public function copy($path1,$path2) {
+ public function copy($path1, $path2) {
$this->init();
$path1=$this->cleanPath($path1);
$path2=$this->root.$this->cleanPath($path2);
@@ -321,7 +321,7 @@ class DAV extends \OC\Files\Storage\Common{
}
}
- private function simpleResponse($method,$path,$body,$expected) {
+ private function simpleResponse($method, $path, $body, $expected) {
$path=$this->cleanPath($path);
try {
$response=$this->client->request($method, $path, $body);
diff --git a/apps/files_external/templates/settings.php b/apps/files_external/templates/settings.php
index 78ca1c87fee..d7a4dd5150d 100644
--- a/apps/files_external/templates/settings.php
+++ b/apps/files_external/templates/settings.php
@@ -83,7 +83,7 @@
<select class="chzn-select"
multiple style="width:20em;"
data-placeholder="<?php echo $l->t('None set'); ?>">
- <option value="all"><?php echo $l->t('All Users'); ?></option>
+ <option value="all" <?php if (isset($mount['applicable']['users']) && in_array('all', $mount['applicable']['users'])) echo 'selected="selected"';?> ><?php echo $l->t('All Users'); ?></option>
<optgroup label="<?php echo $l->t('Groups'); ?>">
<?php foreach ($_['groups'] as $group): ?>
<option value="<?php echo $group; ?>(group)"
@@ -149,6 +149,7 @@
<?php endforeach; ?>
</tbody>
</table>
+ <input type="hidden" name="requesttoken" value="<?php echo $_['requesttoken']; ?>">
<input type="file" id="rootcert_import" name="rootcert_import" style="width:230px;">
<input type="submit" name="cert_import" value="<?php echo $l->t('Import Root Certificate'); ?>" />
</fieldset>