diff options
author | Michael Gapczynski <mtgap@owncloud.com> | 2013-02-19 19:12:14 -0500 |
---|---|---|
committer | Michael Gapczynski <mtgap@owncloud.com> | 2013-02-19 19:12:14 -0500 |
commit | 702c27b0e63cddb21f483c0a69e899e08b42ec07 (patch) | |
tree | 5235c4b45c2de00c9d5633e25ad5142388587f1f /apps/files_external | |
parent | 037c3ee4ecf6f3ffae0f1707074ac13b234dc1ec (diff) | |
parent | 38782036798dbe0a34995a3fca0aa92583cb9099 (diff) | |
download | nextcloud-server-702c27b0e63cddb21f483c0a69e899e08b42ec07.tar.gz nextcloud-server-702c27b0e63cddb21f483c0a69e899e08b42ec07.zip |
Merge branch 'master' into external_storage_ui_feedback
Conflicts:
apps/files_external/js/settings.js
apps/files_external/lib/smb.php
apps/files_external/templates/settings.php
lib/files/storage/common.php
Diffstat (limited to 'apps/files_external')
-rw-r--r-- | apps/files_external/ajax/addRootCertificate.php | 4 | ||||
-rw-r--r-- | apps/files_external/js/settings.js | 4 | ||||
-rw-r--r-- | apps/files_external/l10n/fi_FI.php | 1 | ||||
-rw-r--r-- | apps/files_external/l10n/tr.php | 6 | ||||
-rw-r--r-- | apps/files_external/lib/amazons3.php | 5 | ||||
-rwxr-xr-x | apps/files_external/lib/config.php | 54 | ||||
-rw-r--r-- | apps/files_external/lib/ftp.php | 4 | ||||
-rw-r--r-- | apps/files_external/lib/google.php | 4 | ||||
-rw-r--r-- | apps/files_external/lib/sftp.php | 9 | ||||
-rw-r--r-- | apps/files_external/lib/smb.php | 2 | ||||
-rw-r--r-- | apps/files_external/lib/streamwrapper.php | 28 | ||||
-rw-r--r-- | apps/files_external/lib/swift.php | 8 | ||||
-rw-r--r-- | apps/files_external/lib/webdav.php | 22 | ||||
-rw-r--r-- | apps/files_external/templates/settings.php | 3 |
14 files changed, 67 insertions, 87 deletions
diff --git a/apps/files_external/ajax/addRootCertificate.php b/apps/files_external/ajax/addRootCertificate.php index ba8a14d2ea1..43fd6752c4a 100644 --- a/apps/files_external/ajax/addRootCertificate.php +++ b/apps/files_external/ajax/addRootCertificate.php @@ -14,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(''); } @@ -37,5 +37,5 @@ if ( $isValid ) { OCP\Util::WARN); } -header('Location: settings/personal.php'); +header('Location:' . OCP\Util::linkToRoute( "settings_personal" )); exit; diff --git a/apps/files_external/js/settings.js b/apps/files_external/js/settings.js index 5dffbce5bdf..be24812869e 100644 --- a/apps/files_external/js/settings.js +++ b/apps/files_external/js/settings.js @@ -62,7 +62,7 @@ OC.MountConfig={ url: OC.filePath('files_external', 'ajax', 'addMountPoint.php'), data: { mountPoint: mountPoint, - class: backendClass, + 'class': backendClass, classOptions: classOptions, mountType: mountType, applicable: applicable, @@ -120,7 +120,7 @@ OC.MountConfig={ url: OC.filePath('files_external', 'ajax', 'addMountPoint.php'), data: { mountPoint: mountPoint, - class: backendClass, + 'class': backendClass, classOptions: classOptions, mountType: mountType, applicable: applicable, 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/tr.php b/apps/files_external/l10n/tr.php index e9a045aab57..bbe6f5b6bec 100644 --- a/apps/files_external/l10n/tr.php +++ b/apps/files_external/l10n/tr.php @@ -1,4 +1,8 @@ <?php $TRANSLATIONS = array( +"Access granted" => "Giriş kabul edildi", +"Grant access" => "Erişim sağlandı", +"Fill out all required fields" => "Doldurulması zorunlu alanları doldur", +"Please provide a valid Dropbox app key and secret." => "Lütfen Dropbox app key ve secret temin ediniz", "External Storage" => "Harici Depolama", "Mount point" => "Bağlama Noktası", "Backend" => "Yönetici", @@ -11,6 +15,8 @@ "Groups" => "Gruplar", "Users" => "Kullanıcılar", "Delete" => "Sil", +"Enable User External Storage" => "Kullanıcılar için Harici Depolamayı Etkinleştir", +"Allow users to mount their own external storage" => "Kullanıcıların kendi harici depolamalarını bağlamalarına izin ver", "SSL root certificates" => "SSL kök sertifikaları", "Import Root Certificate" => "Kök Sertifikalarını İçe Aktar" ); diff --git a/apps/files_external/lib/amazons3.php b/apps/files_external/lib/amazons3.php index d00e9a08231..7bcefd4176c 100644 --- a/apps/files_external/lib/amazons3.php +++ b/apps/files_external/lib/amazons3.php @@ -233,11 +233,6 @@ class AmazonS3 extends \OC\Files\Storage\Common { return false; } - public function free_space($path) { - // Infinite? - return false; - } - public function touch($path, $mtime = null) { if (is_null($mtime)) { $mtime = time(); diff --git a/apps/files_external/lib/config.php b/apps/files_external/lib/config.php index 2f3dbf10691..5e2fd32596a 100755 --- a/apps/files_external/lib/config.php +++ b/apps/files_external/lib/config.php @@ -302,13 +302,21 @@ class OC_Mount_Config { * @return array */ private static function readData($isPersonal) { + $parser = new \OC\ArrayParser(); if ($isPersonal) { - $file = OC_User::getHome(OCP\User::getUser()).'/mount.php'; + $phpFile = OC_User::getHome(OCP\User::getUser()).'/mount.php'; + $jsonFile = OC_User::getHome(OCP\User::getUser()).'/mount.json'; } else { - $file = OC::$SERVERROOT.'/config/mount.php'; + $phpFile = OC::$SERVERROOT.'/config/mount.php'; + $jsonFile = OC::$SERVERROOT.'/config/mount.json'; } - if (is_file($file)) { - $mountPoints = include $file; + if (is_file($jsonFile)) { + $mountPoints = json_decode(file_get_contents($jsonFile), true); + if (is_array($mountPoints)) { + return $mountPoints; + } + } elseif (is_file($phpFile)) { + $mountPoints = $parser->parsePHP(file_get_contents($phpFile)); if (is_array($mountPoints)) { return $mountPoints; } @@ -323,35 +331,11 @@ class OC_Mount_Config { */ private static function writeData($isPersonal, $data) { if ($isPersonal) { - $file = OC_User::getHome(OCP\User::getUser()).'/mount.php'; + $file = OC_User::getHome(OCP\User::getUser()).'/mount.json'; } else { - $file = OC::$SERVERROOT.'/config/mount.php'; - } - $content = "<?php return array (\n"; - if (isset($data[self::MOUNT_TYPE_GROUP])) { - $content .= "\t'group' => array (\n"; - 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),\n"; - } - $content .= "\t),\n"; + $file = OC::$SERVERROOT.'/config/mount.json'; } - if (isset($data[self::MOUNT_TYPE_USER])) { - $content .= "\t'user' => array (\n"; - 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),\n"; - } - $content .= "\t),\n"; - } - $content .= ");\n?>"; + $content = json_encode($data); @file_put_contents($file, $content); } @@ -433,8 +417,12 @@ class OC_Mount_Config { public static function checkDependencies() { $l= new OC_L10N('files_external'); $txt=''; - if(!OC_Mount_Config::checksmbclient()) $txt.=$l->t('<b>Warning:</b> "smbclient" is not installed. Mounting of CIFS/SMB shares is not possible. Please ask your system administrator to install it.').'<br />'; - if(!OC_Mount_Config::checkphpftp()) $txt.=$l->t('<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.').'<br />'; + if(!OC_Mount_Config::checksmbclient()) { + $txt.=$l->t('<b>Warning:</b> "smbclient" is not installed. Mounting of CIFS/SMB shares is not possible. Please ask your system administrator to install it.').'<br />'; + } + if(!OC_Mount_Config::checkphpftp()) { + $txt.=$l->t('<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.').'<br />'; + } return($txt); } diff --git a/apps/files_external/lib/ftp.php b/apps/files_external/lib/ftp.php index fa8698af7ac..8a7375ebe38 100644 --- a/apps/files_external/lib/ftp.php +++ b/apps/files_external/lib/ftp.php @@ -73,7 +73,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+': @@ -94,7 +94,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/google.php b/apps/files_external/lib/google.php index 86d768022a6..ec7de3f3570 100644 --- a/apps/files_external/lib/google.php +++ b/apps/files_external/lib/google.php @@ -268,7 +268,7 @@ class Google extends \OC\Files\Storage\Common { $name .= '.'.$extension; } } - $files[] = $name; + $files[] = basename($name); // Cache entry for future use $this->entries[$name] = $entry; } @@ -603,4 +603,4 @@ class Google extends \OC\Files\Storage\Common { return false; } -}
\ No newline at end of file +} diff --git a/apps/files_external/lib/sftp.php b/apps/files_external/lib/sftp.php index 551a5a64ef2..785eb7dfc42 100644 --- a/apps/files_external/lib/sftp.php +++ b/apps/files_external/lib/sftp.php @@ -7,8 +7,9 @@ */ namespace OC\Files\Storage; -set_include_path(get_include_path() . PATH_SEPARATOR . \OC_App::getAppPath('files_external') . '/3rdparty/phpseclib/phpseclib'); -require('Net/SFTP.php'); +set_include_path(get_include_path() . PATH_SEPARATOR . + \OC_App::getAppPath('files_external') . '/3rdparty/phpseclib/phpseclib'); +require 'Net/SFTP.php'; class SFTP extends \OC\Files\Storage\Common { private $host; @@ -241,10 +242,6 @@ class SFTP extends \OC\Files\Storage\Common { } } - public function free_space($path) { - return -1; - } - public function touch($path, $mtime=null) { try { if (!is_null($mtime)) return false; diff --git a/apps/files_external/lib/smb.php b/apps/files_external/lib/smb.php index e0ec9fa0f8f..961efb1a50a 100644 --- a/apps/files_external/lib/smb.php +++ b/apps/files_external/lib/smb.php @@ -34,7 +34,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); } } else { throw new \Exception(); diff --git a/apps/files_external/lib/streamwrapper.php b/apps/files_external/lib/streamwrapper.php index 7c3ddcf8a2c..4685877f26b 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,35 @@ 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 20af67cb8b6..68c4b48f17c 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"); @@ -294,7 +294,7 @@ class SWIFT extends \OC\Files\Storage\Common{ } private function init(){ - if($this->ready){ + if($this->ready) { return; } $this->ready = true; @@ -482,10 +482,6 @@ class SWIFT extends \OC\Files\Storage\Common{ } } - public function free_space($path) { - return 1024*1024*1024*8; - } - public function touch($path, $mtime=null) { $this->init(); $obj=$this->getObject($path); diff --git a/apps/files_external/lib/webdav.php b/apps/files_external/lib/webdav.php index 2d183c8893d..3ba7c48cd57 100644 --- a/apps/files_external/lib/webdav.php +++ b/apps/files_external/lib/webdav.php @@ -53,7 +53,7 @@ class DAV extends \OC\Files\Storage\Common{ } private function init(){ - if($this->ready){ + if($this->ready) { return; } $this->ready = true; @@ -157,10 +157,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) { @@ -226,7 +226,7 @@ class DAV extends \OC\Files\Storage\Common{ return 0; } } catch(\Exception $e) { - return 0; + return \OC\Files\FREE_SPACE_UNKNOWN; } } @@ -239,13 +239,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'); @@ -260,7 +260,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); @@ -272,7 +272,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); @@ -325,7 +325,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 16ad6c77bae..76d691eedb2 100644 --- a/apps/files_external/templates/settings.php +++ b/apps/files_external/templates/settings.php @@ -24,7 +24,7 @@ <?php endif; ?> </td> <td class="mountPoint"><input type="text" name="mountPoint" - value="<?php echo $mountPoint; ?>" + value="<?php p($mountPoint); ?>" placeholder="<?php echo $l->t('Folder name'); ?>" /></td> <?php if ($mountPoint == ''): ?> <td class="backend"> @@ -154,6 +154,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> |