Whitespace fixes in apps
This commit is contained in:
parent
52f2e7112e
commit
0e58800016
|
@ -23,7 +23,7 @@
|
||||||
|
|
||||||
|
|
||||||
// Init owncloud
|
// Init owncloud
|
||||||
|
|
||||||
|
|
||||||
OCP\User::checkAdminUser();
|
OCP\User::checkAdminUser();
|
||||||
|
|
||||||
|
|
|
@ -23,10 +23,10 @@ if($doBreadcrumb) {
|
||||||
$breadcrumb[] = array( "dir" => $pathtohere, "name" => $i );
|
$breadcrumb[] = array( "dir" => $pathtohere, "name" => $i );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$breadcrumbNav = new OCP\Template( "files", "part.breadcrumb", "" );
|
$breadcrumbNav = new OCP\Template( "files", "part.breadcrumb", "" );
|
||||||
$breadcrumbNav->assign( "breadcrumb", $breadcrumb );
|
$breadcrumbNav->assign( "breadcrumb", $breadcrumb );
|
||||||
|
|
||||||
$data['breadcrumb'] = $breadcrumbNav->fetchPage();
|
$data['breadcrumb'] = $breadcrumbNav->fetchPage();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -39,7 +39,7 @@ function progress($notification_code, $severity, $message, $message_code, $bytes
|
||||||
case STREAM_NOTIFY_FILE_SIZE_IS:
|
case STREAM_NOTIFY_FILE_SIZE_IS:
|
||||||
$filesize = $bytes_max;
|
$filesize = $bytes_max;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case STREAM_NOTIFY_PROGRESS:
|
case STREAM_NOTIFY_PROGRESS:
|
||||||
if ($bytes_transferred > 0) {
|
if ($bytes_transferred > 0) {
|
||||||
if (!isset($filesize)) {
|
if (!isset($filesize)) {
|
||||||
|
|
|
@ -11,7 +11,7 @@ OCP\JSON::checkLoggedIn();
|
||||||
|
|
||||||
// Load the files
|
// Load the files
|
||||||
$dir = isset( $_GET['dir'] ) ? $_GET['dir'] : '';
|
$dir = isset( $_GET['dir'] ) ? $_GET['dir'] : '';
|
||||||
$mimetype = isset($_GET['mimetype']) ? $_GET['mimetype'] : '';
|
$mimetype = isset($_GET['mimetype']) ? $_GET['mimetype'] : '';
|
||||||
|
|
||||||
// make filelist
|
// make filelist
|
||||||
$files = array();
|
$files = array();
|
||||||
|
|
|
@ -16,13 +16,12 @@ session_write_close();
|
||||||
if($force or !OC_FileCache::inCache('')) {
|
if($force or !OC_FileCache::inCache('')) {
|
||||||
if(!$checkOnly) {
|
if(!$checkOnly) {
|
||||||
OCP\DB::beginTransaction();
|
OCP\DB::beginTransaction();
|
||||||
|
|
||||||
if(OC_Cache::isFast()) {
|
if(OC_Cache::isFast()) {
|
||||||
//make sure the old fileid's don't mess things up
|
OC_Cache::clear('fileid/'); //make sure the old fileid's don't mess things up
|
||||||
OC_Cache::clear('fileid/');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
OC_FileCache::scan($dir, $eventSource);
|
OC_FileCache::scan($dir,$eventSource);
|
||||||
OC_FileCache::clean();
|
OC_FileCache::clean();
|
||||||
OCP\DB::commit();
|
OCP\DB::commit();
|
||||||
$eventSource->send('success', true);
|
$eventSource->send('success', true);
|
||||||
|
|
|
@ -3,4 +3,3 @@
|
||||||
// see lib/base.php for an example
|
// see lib/base.php for an example
|
||||||
//session_start();
|
//session_start();
|
||||||
$_SESSION['timezone'] = $_GET['time'];
|
$_SESSION['timezone'] = $_GET['time'];
|
||||||
|
|
|
@ -41,5 +41,3 @@ foreach($filesToRemove as $file) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// Init owncloud
|
// Init owncloud
|
||||||
|
|
||||||
|
|
||||||
// Check if we are a user
|
// Check if we are a user
|
||||||
OCP\User::checkLoggedIn();
|
OCP\User::checkLoggedIn();
|
||||||
|
|
|
@ -379,7 +379,7 @@ $(document).ready(function() {
|
||||||
stop: function(e, data) {
|
stop: function(e, data) {
|
||||||
if(data.dataType != 'iframe ') {
|
if(data.dataType != 'iframe ') {
|
||||||
$('#upload input.stop').hide();
|
$('#upload input.stop').hide();
|
||||||
}
|
}
|
||||||
$('#uploadprogressbar').progressbar('value',100);
|
$('#uploadprogressbar').progressbar('value',100);
|
||||||
$('#uploadprogressbar').fadeOut();
|
$('#uploadprogressbar').fadeOut();
|
||||||
}
|
}
|
||||||
|
@ -542,7 +542,7 @@ $(document).ready(function() {
|
||||||
scanFiles();
|
scanFiles();
|
||||||
}
|
}
|
||||||
}, "json");
|
}, "json");
|
||||||
|
|
||||||
var lastWidth = 0;
|
var lastWidth = 0;
|
||||||
var breadcrumbs = [];
|
var breadcrumbs = [];
|
||||||
var breadcrumbsWidth = $('#navigation').get(0).offsetWidth;
|
var breadcrumbsWidth = $('#navigation').get(0).offsetWidth;
|
||||||
|
@ -603,7 +603,7 @@ $(document).ready(function() {
|
||||||
$(window).resize(function() {
|
$(window).resize(function() {
|
||||||
resizeBreadcrumbs(false);
|
resizeBreadcrumbs(false);
|
||||||
});
|
});
|
||||||
|
|
||||||
resizeBreadcrumbs(true);
|
resizeBreadcrumbs(true);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
|
|
||||||
|
|
||||||
// Init owncloud
|
// Init owncloud
|
||||||
|
|
||||||
|
|
||||||
// Check if we are a user
|
// Check if we are a user
|
||||||
OCP\User::checkLoggedIn();
|
OCP\User::checkLoggedIn();
|
||||||
|
|
|
@ -14,6 +14,3 @@
|
||||||
<input type="submit" name="submitFilesAdminSettings" id="submitFilesAdminSettings" value="Save"/>
|
<input type="submit" name="submitFilesAdminSettings" id="submitFilesAdminSettings" value="Save"/>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,7 @@ $(document).ready(function(){
|
||||||
onuncheck:blackListChange,
|
onuncheck:blackListChange,
|
||||||
createText:'...',
|
createText:'...',
|
||||||
});
|
});
|
||||||
|
|
||||||
function blackListChange(){
|
function blackListChange(){
|
||||||
var blackList=$('#encryption_blacklist').val().join(',');
|
var blackList=$('#encryption_blacklist').val().join(',');
|
||||||
OC.AppConfig.setValue('files_encryption','type_blacklist',blackList);
|
OC.AppConfig.setValue('files_encryption','type_blacklist',blackList);
|
||||||
|
|
|
@ -188,7 +188,7 @@ class OC_Crypt {
|
||||||
fclose($handleread);
|
fclose($handleread);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* encrypt data in 8192b sized blocks
|
* encrypt data in 8192b sized blocks
|
||||||
*/
|
*/
|
||||||
|
@ -200,7 +200,7 @@ class OC_Crypt {
|
||||||
}
|
}
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* decrypt data in 8192b sized blocks
|
* decrypt data in 8192b sized blocks
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -64,16 +64,16 @@ class OC_CryptStream{
|
||||||
}
|
}
|
||||||
return is_resource($this->source);
|
return is_resource($this->source);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function stream_seek($offset, $whence=SEEK_SET){
|
public function stream_seek($offset, $whence=SEEK_SET){
|
||||||
$this->flush();
|
$this->flush();
|
||||||
fseek($this->source,$offset,$whence);
|
fseek($this->source,$offset,$whence);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function stream_tell(){
|
public function stream_tell(){
|
||||||
return ftell($this->source);
|
return ftell($this->source);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function stream_read($count){
|
public function stream_read($count){
|
||||||
//$count will always be 8192 https://bugs.php.net/bug.php?id=21641
|
//$count will always be 8192 https://bugs.php.net/bug.php?id=21641
|
||||||
//This makes this function a lot simpler but will breake everything the moment it's fixed
|
//This makes this function a lot simpler but will breake everything the moment it's fixed
|
||||||
|
@ -95,7 +95,7 @@ class OC_CryptStream{
|
||||||
}
|
}
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function stream_write($data){
|
public function stream_write($data){
|
||||||
$length=strlen($data);
|
$length=strlen($data);
|
||||||
$currentPos=ftell($this->source);
|
$currentPos=ftell($this->source);
|
||||||
|
@ -143,11 +143,11 @@ class OC_CryptStream{
|
||||||
public function stream_stat(){
|
public function stream_stat(){
|
||||||
return fstat($this->source);
|
return fstat($this->source);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function stream_lock($mode){
|
public function stream_lock($mode){
|
||||||
flock($this->source,$mode);
|
flock($this->source,$mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function stream_flush(){
|
public function stream_flush(){
|
||||||
return fflush($this->source);
|
return fflush($this->source);
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
class OC_FileProxy_Encryption extends OC_FileProxy{
|
class OC_FileProxy_Encryption extends OC_FileProxy{
|
||||||
private static $blackList=null; //mimetypes blacklisted from encryption
|
private static $blackList=null; //mimetypes blacklisted from encryption
|
||||||
private static $enableEncryption=null;
|
private static $enableEncryption=null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* check if a file should be encrypted during write
|
* check if a file should be encrypted during write
|
||||||
* @param string $path
|
* @param string $path
|
||||||
|
@ -62,7 +62,7 @@ class OC_FileProxy_Encryption extends OC_FileProxy{
|
||||||
$metadata=OC_FileCache_Cached::get($path,'');
|
$metadata=OC_FileCache_Cached::get($path,'');
|
||||||
return isset($metadata['encrypted']) and (bool)$metadata['encrypted'];
|
return isset($metadata['encrypted']) and (bool)$metadata['encrypted'];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function preFile_put_contents($path,&$data){
|
public function preFile_put_contents($path,&$data){
|
||||||
if(self::shouldEncrypt($path)){
|
if(self::shouldEncrypt($path)){
|
||||||
if (!is_resource($data)) {//stream put contents should have been converter to fopen
|
if (!is_resource($data)) {//stream put contents should have been converter to fopen
|
||||||
|
@ -72,7 +72,7 @@ class OC_FileProxy_Encryption extends OC_FileProxy{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function postFile_get_contents($path,$data){
|
public function postFile_get_contents($path,$data){
|
||||||
if(self::isEncrypted($path)){
|
if(self::isEncrypted($path)){
|
||||||
$cached=OC_FileCache_Cached::get($path,'');
|
$cached=OC_FileCache_Cached::get($path,'');
|
||||||
|
@ -80,7 +80,7 @@ class OC_FileProxy_Encryption extends OC_FileProxy{
|
||||||
}
|
}
|
||||||
return $data;
|
return $data;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function postFopen($path,&$result){
|
public function postFopen($path,&$result){
|
||||||
if(!$result){
|
if(!$result){
|
||||||
return $result;
|
return $result;
|
||||||
|
|
|
@ -23,7 +23,7 @@ class Test_Encryption extends UnitTestCase {
|
||||||
$decrypted=OC_Crypt::decrypt($encrypted,$key);
|
$decrypted=OC_Crypt::decrypt($encrypted,$key);
|
||||||
$decrypted=rtrim($decrypted, "\0");
|
$decrypted=rtrim($decrypted, "\0");
|
||||||
$this->assertEqual($decrypted,$chunk);
|
$this->assertEqual($decrypted,$chunk);
|
||||||
|
|
||||||
$encrypted=OC_Crypt::blockEncrypt($source,$key);
|
$encrypted=OC_Crypt::blockEncrypt($source,$key);
|
||||||
$decrypted=OC_Crypt::blockDecrypt($encrypted,$key);
|
$decrypted=OC_Crypt::blockDecrypt($encrypted,$key);
|
||||||
$this->assertNotEqual($encrypted,$source);
|
$this->assertNotEqual($encrypted,$source);
|
||||||
|
@ -56,7 +56,7 @@ class Test_Encryption extends UnitTestCase {
|
||||||
|
|
||||||
function testBinary(){
|
function testBinary(){
|
||||||
$key=uniqid();
|
$key=uniqid();
|
||||||
|
|
||||||
$file=__DIR__.'/binary';
|
$file=__DIR__.'/binary';
|
||||||
$source=file_get_contents($file); //binary file
|
$source=file_get_contents($file); //binary file
|
||||||
$encrypted=OC_Crypt::encrypt($source,$key);
|
$encrypted=OC_Crypt::encrypt($source,$key);
|
||||||
|
|
|
@ -9,18 +9,18 @@
|
||||||
class Test_CryptProxy extends UnitTestCase {
|
class Test_CryptProxy extends UnitTestCase {
|
||||||
private $oldConfig;
|
private $oldConfig;
|
||||||
private $oldKey;
|
private $oldKey;
|
||||||
|
|
||||||
public function setUp(){
|
public function setUp(){
|
||||||
$user=OC_User::getUser();
|
$user=OC_User::getUser();
|
||||||
|
|
||||||
$this->oldConfig=OCP\Config::getAppValue('files_encryption','enable_encryption','true');
|
$this->oldConfig=OCP\Config::getAppValue('files_encryption','enable_encryption','true');
|
||||||
OCP\Config::setAppValue('files_encryption','enable_encryption','true');
|
OCP\Config::setAppValue('files_encryption','enable_encryption','true');
|
||||||
$this->oldKey=isset($_SESSION['enckey'])?$_SESSION['enckey']:null;
|
$this->oldKey=isset($_SESSION['enckey'])?$_SESSION['enckey']:null;
|
||||||
|
|
||||||
|
|
||||||
//set testing key
|
//set testing key
|
||||||
$_SESSION['enckey']=md5(time());
|
$_SESSION['enckey']=md5(time());
|
||||||
|
|
||||||
//clear all proxies and hooks so we can do clean testing
|
//clear all proxies and hooks so we can do clean testing
|
||||||
OC_FileProxy::clearProxies();
|
OC_FileProxy::clearProxies();
|
||||||
OC_Hook::clear('OC_Filesystem');
|
OC_Hook::clear('OC_Filesystem');
|
||||||
|
@ -52,11 +52,11 @@ class Test_CryptProxy extends UnitTestCase {
|
||||||
$original=file_get_contents($file);
|
$original=file_get_contents($file);
|
||||||
|
|
||||||
OC_Filesystem::file_put_contents('/file',$original);
|
OC_Filesystem::file_put_contents('/file',$original);
|
||||||
|
|
||||||
OC_FileProxy::$enabled=false;
|
OC_FileProxy::$enabled=false;
|
||||||
$stored=OC_Filesystem::file_get_contents('/file');
|
$stored=OC_Filesystem::file_get_contents('/file');
|
||||||
OC_FileProxy::$enabled=true;
|
OC_FileProxy::$enabled=true;
|
||||||
|
|
||||||
$fromFile=OC_Filesystem::file_get_contents('/file');
|
$fromFile=OC_Filesystem::file_get_contents('/file');
|
||||||
$this->assertNotEqual($original,$stored);
|
$this->assertNotEqual($original,$stored);
|
||||||
$this->assertEqual(strlen($original),strlen($fromFile));
|
$this->assertEqual(strlen($original),strlen($fromFile));
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
|
|
||||||
class Test_CryptStream extends UnitTestCase {
|
class Test_CryptStream extends UnitTestCase {
|
||||||
private $tmpFiles=array();
|
private $tmpFiles=array();
|
||||||
|
|
||||||
function testStream(){
|
function testStream(){
|
||||||
$stream=$this->getStream('test1','w',strlen('foobar'));
|
$stream=$this->getStream('test1','w',strlen('foobar'));
|
||||||
fwrite($stream,'foobar');
|
fwrite($stream,'foobar');
|
||||||
|
|
|
@ -14,7 +14,7 @@ $fh = fopen($to, 'r');
|
||||||
$data = fread($fh, filesize($to));
|
$data = fread($fh, filesize($to));
|
||||||
fclose($fh);
|
fclose($fh);
|
||||||
if (!strpos($data, 'BEGIN CERTIFICATE')) {
|
if (!strpos($data, 'BEGIN CERTIFICATE')) {
|
||||||
$pem = chunk_split(base64_encode($data), 64, "\n");
|
$pem = chunk_split(base64_encode($data), 64, "\n");
|
||||||
$pem = "-----BEGIN CERTIFICATE-----\n".$pem."-----END CERTIFICATE-----\n";
|
$pem = "-----BEGIN CERTIFICATE-----\n".$pem."-----END CERTIFICATE-----\n";
|
||||||
$fh = fopen($to, 'w');
|
$fh = fopen($to, 'w');
|
||||||
fwrite($fh, $pem);
|
fwrite($fh, $pem);
|
||||||
|
|
|
@ -70,7 +70,7 @@ OC.MountConfig={
|
||||||
|
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
$('.chzn-select').chosen();
|
$('.chzn-select').chosen();
|
||||||
|
|
||||||
$('#selectBackend').live('change', function() {
|
$('#selectBackend').live('change', function() {
|
||||||
var tr = $(this).parent().parent();
|
var tr = $(this).parent().parent();
|
||||||
$('#externalStorage tbody').append($(tr).clone());
|
$('#externalStorage tbody').append($(tr).clone());
|
||||||
|
@ -133,7 +133,7 @@ $(document).ready(function() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return defaultMountPoint+append;
|
return defaultMountPoint+append;
|
||||||
}
|
}
|
||||||
|
|
||||||
$('#externalStorage td').live('change', function() {
|
$('#externalStorage td').live('change', function() {
|
||||||
OC.MountConfig.saveStorage($(this).parent());
|
OC.MountConfig.saveStorage($(this).parent());
|
||||||
|
|
|
@ -29,7 +29,7 @@ class OC_Filestorage_AmazonS3 extends OC_Filestorage_Common {
|
||||||
private $objects = array();
|
private $objects = array();
|
||||||
|
|
||||||
private static $tempFiles = array();
|
private static $tempFiles = array();
|
||||||
|
|
||||||
// TODO options: storage class, encryption server side, encrypt before upload?
|
// TODO options: storage class, encryption server side, encrypt before upload?
|
||||||
|
|
||||||
public function __construct($params) {
|
public function __construct($params) {
|
||||||
|
@ -216,7 +216,7 @@ class OC_Filestorage_AmazonS3 extends OC_Filestorage_Common {
|
||||||
}
|
}
|
||||||
|
|
||||||
public function free_space($path) {
|
public function free_space($path) {
|
||||||
// Infinite?
|
// Infinite?
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,7 @@ class OC_FileStorage_FTP extends OC_FileStorage_StreamWrapper{
|
||||||
private $root;
|
private $root;
|
||||||
|
|
||||||
private static $tempFiles=array();
|
private static $tempFiles=array();
|
||||||
|
|
||||||
public function __construct($params){
|
public function __construct($params){
|
||||||
$this->host=$params['host'];
|
$this->host=$params['host'];
|
||||||
$this->user=$params['user'];
|
$this->user=$params['user'];
|
||||||
|
|
|
@ -119,7 +119,7 @@ class OC_Filestorage_Google extends OC_Filestorage_Common {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private function getFeed($feedUri, $httpMethod, $postData = null) {
|
private function getFeed($feedUri, $httpMethod, $postData = null) {
|
||||||
|
@ -174,7 +174,7 @@ class OC_Filestorage_Google extends OC_Filestorage_Common {
|
||||||
return 'html';
|
return 'html';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function mkdir($path) {
|
public function mkdir($path) {
|
||||||
$collection = dirname($path);
|
$collection = dirname($path);
|
||||||
|
@ -254,7 +254,7 @@ class OC_Filestorage_Google extends OC_Filestorage_Common {
|
||||||
} else if ($entry = $this->getResource($path)) {
|
} else if ($entry = $this->getResource($path)) {
|
||||||
// NOTE: Native resources don't have a file size
|
// NOTE: Native resources don't have a file size
|
||||||
$stat['size'] = $entry->getElementsByTagNameNS('http://schemas.google.com/g/2005', 'quotaBytesUsed')->item(0)->nodeValue;
|
$stat['size'] = $entry->getElementsByTagNameNS('http://schemas.google.com/g/2005', 'quotaBytesUsed')->item(0)->nodeValue;
|
||||||
// if (isset($atime = $entry->getElementsByTagNameNS('http://schemas.google.com/g/2005', 'lastViewed')->item(0)->nodeValue))
|
// if (isset($atime = $entry->getElementsByTagNameNS('http://schemas.google.com/g/2005', 'lastViewed')->item(0)->nodeValue))
|
||||||
// $stat['atime'] = strtotime($entry->getElementsByTagNameNS('http://schemas.google.com/g/2005', 'lastViewed')->item(0)->nodeValue);
|
// $stat['atime'] = strtotime($entry->getElementsByTagNameNS('http://schemas.google.com/g/2005', 'lastViewed')->item(0)->nodeValue);
|
||||||
$stat['mtime'] = strtotime($entry->getElementsByTagName('updated')->item(0)->nodeValue);
|
$stat['mtime'] = strtotime($entry->getElementsByTagName('updated')->item(0)->nodeValue);
|
||||||
$stat['ctime'] = strtotime($entry->getElementsByTagName('published')->item(0)->nodeValue);
|
$stat['ctime'] = strtotime($entry->getElementsByTagName('published')->item(0)->nodeValue);
|
||||||
|
@ -304,7 +304,7 @@ class OC_Filestorage_Google extends OC_Filestorage_Common {
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function file_exists($path) {
|
public function file_exists($path) {
|
||||||
if ($path == '' || $path == '/') {
|
if ($path == '' || $path == '/') {
|
||||||
return true;
|
return true;
|
||||||
|
@ -313,7 +313,7 @@ class OC_Filestorage_Google extends OC_Filestorage_Common {
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function unlink($path) {
|
public function unlink($path) {
|
||||||
// Get resource self link to trash resource
|
// Get resource self link to trash resource
|
||||||
if ($entry = $this->getResource($path)) {
|
if ($entry = $this->getResource($path)) {
|
||||||
|
@ -482,7 +482,7 @@ class OC_Filestorage_Google extends OC_Filestorage_Common {
|
||||||
// TODO Wait for resource entry
|
// TODO Wait for resource entry
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getMimeType($path, $entry = null) {
|
public function getMimeType($path, $entry = null) {
|
||||||
// Entry can be passed, because extension is required for opendir and the entry can't be cached without the extension
|
// Entry can be passed, because extension is required for opendir and the entry can't be cached without the extension
|
||||||
if ($entry == null) {
|
if ($entry == null) {
|
||||||
|
@ -522,7 +522,7 @@ class OC_Filestorage_Google extends OC_Filestorage_Common {
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function free_space($path) {
|
public function free_space($path) {
|
||||||
if ($dom = $this->getFeed('https://docs.google.com/feeds/metadata/default', 'GET')) {
|
if ($dom = $this->getFeed('https://docs.google.com/feeds/metadata/default', 'GET')) {
|
||||||
// NOTE: Native Google Docs resources don't count towards quota
|
// NOTE: Native Google Docs resources don't count towards quota
|
||||||
|
@ -532,9 +532,9 @@ class OC_Filestorage_Google extends OC_Filestorage_Common {
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function touch($path, $mtime = null) {
|
public function touch($path, $mtime = null) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -274,7 +274,7 @@ class OC_FileStorage_SWIFT extends OC_Filestorage_Common{
|
||||||
}
|
}
|
||||||
$this->auth = new CF_Authentication($this->user, $this->token, null, $this->host);
|
$this->auth = new CF_Authentication($this->user, $this->token, null, $this->host);
|
||||||
$this->auth->authenticate();
|
$this->auth->authenticate();
|
||||||
|
|
||||||
$this->conn = new CF_Connection($this->auth);
|
$this->conn = new CF_Connection($this->auth);
|
||||||
|
|
||||||
if(!$this->containerExists($this->root)){
|
if(!$this->containerExists($this->root)){
|
||||||
|
@ -303,7 +303,7 @@ class OC_FileStorage_SWIFT extends OC_Filestorage_Common{
|
||||||
$parentContainer=$this->getContainer(dirname($path));
|
$parentContainer=$this->getContainer(dirname($path));
|
||||||
$this->removeSubContainer($parentContainer,basename($path));
|
$this->removeSubContainer($parentContainer,basename($path));
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->conn->delete_container($this->getContainerName($path));
|
$this->conn->delete_container($this->getContainerName($path));
|
||||||
unset($this->containers[$path]);
|
unset($this->containers[$path]);
|
||||||
return true;
|
return true;
|
||||||
|
@ -410,7 +410,7 @@ class OC_FileStorage_SWIFT extends OC_Filestorage_Common{
|
||||||
case 'rb':
|
case 'rb':
|
||||||
$fp = fopen('php://temp', 'r+');
|
$fp = fopen('php://temp', 'r+');
|
||||||
$obj->stream($fp);
|
$obj->stream($fp);
|
||||||
|
|
||||||
rewind($fp);
|
rewind($fp);
|
||||||
return $fp;
|
return $fp;
|
||||||
case 'w':
|
case 'w':
|
||||||
|
@ -451,7 +451,7 @@ class OC_FileStorage_SWIFT extends OC_Filestorage_Common{
|
||||||
if(is_null($mtime)){
|
if(is_null($mtime)){
|
||||||
$mtime=time();
|
$mtime=time();
|
||||||
}
|
}
|
||||||
|
|
||||||
//emulate setting mtime with metadata
|
//emulate setting mtime with metadata
|
||||||
$obj->metadata['Mtime']=$mtime;
|
$obj->metadata['Mtime']=$mtime;
|
||||||
$obj->sync_metadata();
|
$obj->sync_metadata();
|
||||||
|
|
|
@ -18,7 +18,7 @@ class OC_FileStorage_DAV extends OC_Filestorage_Common{
|
||||||
private $client;
|
private $client;
|
||||||
|
|
||||||
private static $tempFiles=array();
|
private static $tempFiles=array();
|
||||||
|
|
||||||
public function __construct($params){
|
public function __construct($params){
|
||||||
$host = $params['host'];
|
$host = $params['host'];
|
||||||
//remove leading http[s], will be generated in createBaseUri()
|
//remove leading http[s], will be generated in createBaseUri()
|
||||||
|
@ -35,7 +35,7 @@ class OC_FileStorage_DAV extends OC_Filestorage_Common{
|
||||||
if(substr($this->root,-1,1)!='/'){
|
if(substr($this->root,-1,1)!='/'){
|
||||||
$this->root.='/';
|
$this->root.='/';
|
||||||
}
|
}
|
||||||
|
|
||||||
$settings = array(
|
$settings = array(
|
||||||
'baseUri' => $this->createBaseUri(),
|
'baseUri' => $this->createBaseUri(),
|
||||||
'userName' => $this->user,
|
'userName' => $this->user,
|
||||||
|
@ -43,7 +43,7 @@ class OC_FileStorage_DAV extends OC_Filestorage_Common{
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->client = new OC_Connector_Sabre_Client($settings);
|
$this->client = new OC_Connector_Sabre_Client($settings);
|
||||||
|
|
||||||
if($caview = \OCP\Files::getStorage('files_external')) {
|
if($caview = \OCP\Files::getStorage('files_external')) {
|
||||||
$certPath=\OCP\Config::getSystemValue('datadirectory').$caview->getAbsolutePath("").'rootcerts.crt';
|
$certPath=\OCP\Config::getSystemValue('datadirectory').$caview->getAbsolutePath("").'rootcerts.crt';
|
||||||
if (file_exists($certPath)) {
|
if (file_exists($certPath)) {
|
||||||
|
@ -296,4 +296,3 @@ class OC_FileStorage_DAV extends OC_Filestorage_Common{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -80,7 +80,7 @@
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
<br />
|
<br />
|
||||||
|
|
||||||
<?php if (!$_['isAdminPage']): ?>
|
<?php if (!$_['isAdminPage']): ?>
|
||||||
<table id="sslCertificate" data-admin='<?php echo json_encode($_['isAdminPage']); ?>'>
|
<table id="sslCertificate" data-admin='<?php echo json_encode($_['isAdminPage']); ?>'>
|
||||||
<thead>
|
<thead>
|
||||||
|
@ -91,17 +91,17 @@
|
||||||
</thead>
|
</thead>
|
||||||
<tbody width="100%">
|
<tbody width="100%">
|
||||||
<?php foreach ($_['certs'] as $rootCert): ?>
|
<?php foreach ($_['certs'] as $rootCert): ?>
|
||||||
<tr id="<?php echo $rootCert ?>">
|
<tr id="<?php echo $rootCert ?>">
|
||||||
<td class="rootCert"><?php echo $rootCert ?></td>
|
<td class="rootCert"><?php echo $rootCert ?></td>
|
||||||
<td <?php echo ($rootCert != '') ? 'class="remove"' : 'style="visibility:hidden;"'; ?>><img alt="<?php echo $l->t('Delete'); ?>" title="<?php echo $l->t('Delete'); ?>" class="svg action" src="<?php echo image_path('core', 'actions/delete.svg'); ?>" /></td>
|
<td <?php echo ($rootCert != '') ? 'class="remove"' : 'style="visibility:hidden;"'; ?>><img alt="<?php echo $l->t('Delete'); ?>" title="<?php echo $l->t('Delete'); ?>" class="svg action" src="<?php echo image_path('core', 'actions/delete.svg'); ?>" /></td>
|
||||||
</tr>
|
</tr>
|
||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
<input type="file" id="rootcert_import" name="rootcert_import" style="width:230px;">
|
<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'); ?>" />
|
<input type="submit" name="cert_import" value="<?php echo $l->t('Import Root Certificate'); ?>" />
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
|
|
||||||
<?php if ($_['isAdminPage']): ?>
|
<?php if ($_['isAdminPage']): ?>
|
||||||
<br />
|
<br />
|
||||||
<input type="checkbox" name="allowUserMounting" id="allowUserMounting" value="1" <?php if ($_['allowUserMounting'] == 'yes') echo ' checked="checked"'; ?> />
|
<input type="checkbox" name="allowUserMounting" id="allowUserMounting" value="1" <?php if ($_['allowUserMounting'] == 'yes') echo ' checked="checked"'; ?> />
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
* later.
|
* later.
|
||||||
* See the COPYING-README file.
|
* See the COPYING-README file.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
$config=include('apps/files_external/tests/config.php');
|
$config=include('apps/files_external/tests/config.php');
|
||||||
if(!is_array($config) or !isset($config['ftp']) or !$config['ftp']['run']){
|
if(!is_array($config) or !isset($config['ftp']) or !$config['ftp']['run']){
|
||||||
abstract class Test_Filestorage_FTP extends Test_FileStorage{}
|
abstract class Test_Filestorage_FTP extends Test_FileStorage{}
|
||||||
|
@ -26,4 +26,3 @@ if(!is_array($config) or !isset($config['ftp']) or !$config['ftp']['run']){
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -26,7 +26,7 @@ if(!is_array($config) or !isset($config['google']) or !$config['google']['run'])
|
||||||
return;
|
return;
|
||||||
}else{
|
}else{
|
||||||
class Test_Filestorage_Google extends Test_FileStorage {
|
class Test_Filestorage_Google extends Test_FileStorage {
|
||||||
|
|
||||||
private $config;
|
private $config;
|
||||||
|
|
||||||
public function setUp(){
|
public function setUp(){
|
||||||
|
@ -41,4 +41,3 @@ if(!is_array($config) or !isset($config['google']) or !$config['google']['run'])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -21,11 +21,10 @@ if(!is_array($config) or !isset($config['swift']) or !$config['swift']['run']){
|
||||||
$this->instance=new OC_Filestorage_SWIFT($this->config['swift']);
|
$this->instance=new OC_Filestorage_SWIFT($this->config['swift']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function tearDown(){
|
public function tearDown(){
|
||||||
$this->instance->rmdir('');
|
$this->instance->rmdir('');
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -26,4 +26,3 @@ if(!is_array($config) or !isset($config['webdav']) or !$config['webdav']['run'])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4,13 +4,13 @@
|
||||||
$datadir = \OCP\Config::getSystemValue('datadirectory');
|
$datadir = \OCP\Config::getSystemValue('datadirectory');
|
||||||
$currentVersion=OC_Appconfig::getValue('files_sharing', 'installed_version');
|
$currentVersion=OC_Appconfig::getValue('files_sharing', 'installed_version');
|
||||||
if (version_compare($currentVersion, '0.2.2', '<')) {
|
if (version_compare($currentVersion, '0.2.2', '<')) {
|
||||||
if ($handle = opendir($datadir)) {
|
if ($handle = opendir($datadir)) {
|
||||||
while (false !== ($entry = readdir($handle))) {
|
while (false !== ($entry = readdir($handle))) {
|
||||||
$sharedFolder = $datadir.'/'.$entry.'/files/Shared';
|
$sharedFolder = $datadir.'/'.$entry.'/files/Shared';
|
||||||
if ($entry != "." && $entry != ".." && is_dir($sharedFolder)) {
|
if ($entry != "." && $entry != ".." && is_dir($sharedFolder)) {
|
||||||
touch($sharedFolder);
|
touch($sharedFolder);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
closedir($handle);
|
closedir($handle);
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -27,7 +27,7 @@ class OC_Share_Backend_File implements OCP\Share_Backend_File_Dependent {
|
||||||
const FORMAT_OPENDIR = 3;
|
const FORMAT_OPENDIR = 3;
|
||||||
|
|
||||||
private $path;
|
private $path;
|
||||||
|
|
||||||
public function isValidSource($itemSource, $uidOwner) {
|
public function isValidSource($itemSource, $uidOwner) {
|
||||||
$path = OC_FileCache::getPath($itemSource, $uidOwner);
|
$path = OC_FileCache::getPath($itemSource, $uidOwner);
|
||||||
if (OC_Filesystem::file_exists($path)) {
|
if (OC_Filesystem::file_exists($path)) {
|
||||||
|
@ -94,7 +94,7 @@ class OC_Share_Backend_File implements OCP\Share_Backend_File_Dependent {
|
||||||
$files[] = basename($item['file_target']);
|
$files[] = basename($item['file_target']);
|
||||||
}
|
}
|
||||||
return $files;
|
return $files;
|
||||||
}
|
}
|
||||||
return array();
|
return array();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -24,10 +24,10 @@
|
||||||
* Convert target path to source path and pass the function call to the correct storage provider
|
* Convert target path to source path and pass the function call to the correct storage provider
|
||||||
*/
|
*/
|
||||||
class OC_Filestorage_Shared extends OC_Filestorage_Common {
|
class OC_Filestorage_Shared extends OC_Filestorage_Common {
|
||||||
|
|
||||||
private $sharedFolder;
|
private $sharedFolder;
|
||||||
private $files = array();
|
private $files = array();
|
||||||
|
|
||||||
public function __construct($arguments) {
|
public function __construct($arguments) {
|
||||||
$this->sharedFolder = $arguments['sharedFolder'];
|
$this->sharedFolder = $arguments['sharedFolder'];
|
||||||
OC_Util::setupFS4all();
|
OC_Util::setupFS4all();
|
||||||
|
@ -106,17 +106,17 @@ class OC_Filestorage_Shared extends OC_Filestorage_Common {
|
||||||
$internalPath = substr($path, strlen($mountPoint));
|
$internalPath = substr($path, strlen($mountPoint));
|
||||||
return $internalPath;
|
return $internalPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function mkdir($path) {
|
public function mkdir($path) {
|
||||||
if ($path == '' || $path == '/' || !$this->isCreatable(dirname($path))) {
|
if ($path == '' || $path == '/' || !$this->isCreatable(dirname($path))) {
|
||||||
return false;
|
return false;
|
||||||
} else if ($source = $this->getSourcePath($path)) {
|
} else if ($source = $this->getSourcePath($path)) {
|
||||||
$storage = OC_Filesystem::getStorage($source);
|
$storage = OC_Filesystem::getStorage($source);
|
||||||
return $storage->mkdir($this->getInternalPath($source));
|
return $storage->mkdir($this->getInternalPath($source));
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function rmdir($path) {
|
public function rmdir($path) {
|
||||||
if (($source = $this->getSourcePath($path)) && $this->isDeletable($path)) {
|
if (($source = $this->getSourcePath($path)) && $this->isDeletable($path)) {
|
||||||
$storage = OC_Filesystem::getStorage($source);
|
$storage = OC_Filesystem::getStorage($source);
|
||||||
|
@ -124,7 +124,7 @@ class OC_Filestorage_Shared extends OC_Filestorage_Common {
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function opendir($path) {
|
public function opendir($path) {
|
||||||
if ($path == '' || $path == '/') {
|
if ($path == '' || $path == '/') {
|
||||||
$files = OCP\Share::getItemsSharedWith('file', OC_Share_Backend_Folder::FORMAT_OPENDIR);
|
$files = OCP\Share::getItemsSharedWith('file', OC_Share_Backend_Folder::FORMAT_OPENDIR);
|
||||||
|
@ -229,10 +229,10 @@ class OC_Filestorage_Shared extends OC_Filestorage_Common {
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function filectime($path) {
|
public function filectime($path) {
|
||||||
if ($path == '' || $path == '/') {
|
if ($path == '' || $path == '/') {
|
||||||
$ctime = 0;
|
$ctime = 0;
|
||||||
if ($dh = $this->opendir($path)) {
|
if ($dh = $this->opendir($path)) {
|
||||||
while (($filename = readdir($dh)) !== false) {
|
while (($filename = readdir($dh)) !== false) {
|
||||||
$tempctime = $this->filectime($filename);
|
$tempctime = $this->filectime($filename);
|
||||||
|
@ -250,10 +250,10 @@ class OC_Filestorage_Shared extends OC_Filestorage_Common {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function filemtime($path) {
|
public function filemtime($path) {
|
||||||
if ($path == '' || $path == '/') {
|
if ($path == '' || $path == '/') {
|
||||||
$mtime = 0;
|
$mtime = 0;
|
||||||
if ($dh = $this->opendir($path)) {
|
if ($dh = $this->opendir($path)) {
|
||||||
while (($filename = readdir($dh)) !== false) {
|
while (($filename = readdir($dh)) !== false) {
|
||||||
$tempmtime = $this->filemtime($filename);
|
$tempmtime = $this->filemtime($filename);
|
||||||
|
@ -271,7 +271,7 @@ class OC_Filestorage_Shared extends OC_Filestorage_Common {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function file_get_contents($path) {
|
public function file_get_contents($path) {
|
||||||
$source = $this->getSourcePath($path);
|
$source = $this->getSourcePath($path);
|
||||||
if ($source) {
|
if ($source) {
|
||||||
|
@ -284,7 +284,7 @@ class OC_Filestorage_Shared extends OC_Filestorage_Common {
|
||||||
return $storage->file_get_contents($this->getInternalPath($source));
|
return $storage->file_get_contents($this->getInternalPath($source));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function file_put_contents($path, $data) {
|
public function file_put_contents($path, $data) {
|
||||||
if ($source = $this->getSourcePath($path)) {
|
if ($source = $this->getSourcePath($path)) {
|
||||||
// Check if permission is granted
|
// Check if permission is granted
|
||||||
|
@ -302,7 +302,7 @@ class OC_Filestorage_Shared extends OC_Filestorage_Common {
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function unlink($path) {
|
public function unlink($path) {
|
||||||
// Delete the file if DELETE permission is granted
|
// Delete the file if DELETE permission is granted
|
||||||
if (($source = $this->getSourcePath($path)) && $this->isDeletable($path)) {
|
if (($source = $this->getSourcePath($path)) && $this->isDeletable($path)) {
|
||||||
|
@ -311,7 +311,7 @@ class OC_Filestorage_Shared extends OC_Filestorage_Common {
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function rename($path1, $path2) {
|
public function rename($path1, $path2) {
|
||||||
// Renaming/moving is only allowed within shared folders
|
// Renaming/moving is only allowed within shared folders
|
||||||
$pos1 = strpos($path1, '/', 1);
|
$pos1 = strpos($path1, '/', 1);
|
||||||
|
@ -344,7 +344,7 @@ class OC_Filestorage_Shared extends OC_Filestorage_Common {
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function copy($path1, $path2) {
|
public function copy($path1, $path2) {
|
||||||
// Copy the file if CREATE permission is granted
|
// Copy the file if CREATE permission is granted
|
||||||
if ($this->isCreatable(dirname($path2))) {
|
if ($this->isCreatable(dirname($path2))) {
|
||||||
|
|
|
@ -32,13 +32,13 @@ OCP\JSON::callCheck();
|
||||||
$versions = new OCA_Versions\Storage();
|
$versions = new OCA_Versions\Storage();
|
||||||
|
|
||||||
if( $versions->expireAll() ){
|
if( $versions->expireAll() ){
|
||||||
|
|
||||||
OCP\JSON::success();
|
OCP\JSON::success();
|
||||||
die();
|
die();
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
OCP\JSON::error();
|
OCP\JSON::error();
|
||||||
die();
|
die();
|
||||||
|
|
||||||
}
|
}
|
|
@ -9,19 +9,19 @@ if( OCA_Versions\Storage::isversioned( $source ) ) {
|
||||||
$count=5; //show the newest revisions
|
$count=5; //show the newest revisions
|
||||||
$versions = OCA_Versions\Storage::getVersions( $source, $count);
|
$versions = OCA_Versions\Storage::getVersions( $source, $count);
|
||||||
$versionsFormatted = array();
|
$versionsFormatted = array();
|
||||||
|
|
||||||
foreach ( $versions AS $version ) {
|
foreach ( $versions AS $version ) {
|
||||||
$versionsFormatted[] = OCP\Util::formatDate( $version['version'] );
|
$versionsFormatted[] = OCP\Util::formatDate( $version['version'] );
|
||||||
}
|
}
|
||||||
|
|
||||||
$versionsSorted = array_reverse( $versions );
|
$versionsSorted = array_reverse( $versions );
|
||||||
|
|
||||||
if ( !empty( $versionsSorted ) ) {
|
if ( !empty( $versionsSorted ) ) {
|
||||||
OCP\JSON::encodedPrint($versionsSorted);
|
OCP\JSON::encodedPrint($versionsSorted);
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,11 +6,11 @@ if (version_compare($installedVersion, '1.0.2', '<')) {
|
||||||
$users = \OCP\User::getUsers();
|
$users = \OCP\User::getUsers();
|
||||||
$datadir = \OCP\Config::getSystemValue('datadirectory').'/';
|
$datadir = \OCP\Config::getSystemValue('datadirectory').'/';
|
||||||
foreach ($users as $user) {
|
foreach ($users as $user) {
|
||||||
$oldPath = $datadir.$user.'/versions';
|
$oldPath = $datadir.$user.'/versions';
|
||||||
$newPath = $datadir.$user.'/files_versions';
|
$newPath = $datadir.$user.'/files_versions';
|
||||||
if(is_dir($oldPath)) {
|
if(is_dir($oldPath)) {
|
||||||
rename($oldPath, $newPath);
|
rename($oldPath, $newPath);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,20 +5,20 @@
|
||||||
*
|
*
|
||||||
* @author Frank Karlitschek
|
* @author Frank Karlitschek
|
||||||
* @copyright 2012 Frank Karlitschek frank@owncloud.org
|
* @copyright 2012 Frank Karlitschek frank@owncloud.org
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
|
* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
|
||||||
* License as published by the Free Software Foundation; either
|
* License as published by the Free Software Foundation; either
|
||||||
* version 3 of the License, or any later version.
|
* version 3 of the License, or any later version.
|
||||||
*
|
*
|
||||||
* This library is distributed in the hope that it will be useful,
|
* This library is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
|
* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU Lesser General Public
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
OCP\User::checkLoggedIn( );
|
OCP\User::checkLoggedIn( );
|
||||||
|
@ -34,40 +34,40 @@ if ( isset( $_GET['path'] ) ) {
|
||||||
|
|
||||||
// roll back to old version if button clicked
|
// roll back to old version if button clicked
|
||||||
if( isset( $_GET['revert'] ) ) {
|
if( isset( $_GET['revert'] ) ) {
|
||||||
|
|
||||||
if( $versions->rollback( $path, $_GET['revert'] ) ) {
|
if( $versions->rollback( $path, $_GET['revert'] ) ) {
|
||||||
|
|
||||||
$tmpl->assign( 'outcome_stat', 'success' );
|
$tmpl->assign( 'outcome_stat', 'success' );
|
||||||
|
|
||||||
$tmpl->assign( 'outcome_msg', "File {$_GET['path']} was reverted to version ".OCP\Util::formatDate( doubleval($_GET['revert']) ) );
|
$tmpl->assign( 'outcome_msg', "File {$_GET['path']} was reverted to version ".OCP\Util::formatDate( doubleval($_GET['revert']) ) );
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
$tmpl->assign( 'outcome_stat', 'failure' );
|
$tmpl->assign( 'outcome_stat', 'failure' );
|
||||||
|
|
||||||
$tmpl->assign( 'outcome_msg', "File {$_GET['path']} could not be reverted to version ".OCP\Util::formatDate( doubleval($_GET['revert']) ) );
|
$tmpl->assign( 'outcome_msg', "File {$_GET['path']} could not be reverted to version ".OCP\Util::formatDate( doubleval($_GET['revert']) ) );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// show the history only if there is something to show
|
// show the history only if there is something to show
|
||||||
if( OCA_Versions\Storage::isversioned( $path ) ) {
|
if( OCA_Versions\Storage::isversioned( $path ) ) {
|
||||||
|
|
||||||
$count = 999; //show the newest revisions
|
$count = 999; //show the newest revisions
|
||||||
$versions = OCA_Versions\Storage::getVersions( $path, $count);
|
$versions = OCA_Versions\Storage::getVersions( $path, $count);
|
||||||
|
|
||||||
$tmpl->assign( 'versions', array_reverse( $versions ) );
|
$tmpl->assign( 'versions', array_reverse( $versions ) );
|
||||||
|
|
||||||
}else{
|
}else{
|
||||||
|
|
||||||
$tmpl->assign( 'message', 'No old versions available' );
|
$tmpl->assign( 'message', 'No old versions available' );
|
||||||
|
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
|
|
||||||
$tmpl->assign( 'message', 'No path specified' );
|
$tmpl->assign( 'message', 'No path specified' );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$tmpl->printPage( );
|
$tmpl->printPage( );
|
||||||
|
|
|
@ -2,16 +2,16 @@
|
||||||
|
|
||||||
$( document ).ready(function(){
|
$( document ).ready(function(){
|
||||||
//
|
//
|
||||||
$( '#expireAllBtn' ).click(
|
$( '#expireAllBtn' ).click(
|
||||||
|
|
||||||
function( event ) {
|
function( event ) {
|
||||||
|
|
||||||
// Prevent page from reloading
|
// Prevent page from reloading
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
|
|
||||||
// Show loading gif
|
// Show loading gif
|
||||||
$('.expireAllLoading').show();
|
$('.expireAllLoading').show();
|
||||||
|
|
||||||
$.getJSON(
|
$.getJSON(
|
||||||
OC.filePath('files_versions','ajax','expireAll.php'),
|
OC.filePath('files_versions','ajax','expireAll.php'),
|
||||||
function(result){
|
function(result){
|
||||||
|
@ -19,20 +19,20 @@ $( document ).ready(function(){
|
||||||
$('.expireAllLoading').hide();
|
$('.expireAllLoading').hide();
|
||||||
$('#expireAllBtn').html('Expiration successful');
|
$('#expireAllBtn').html('Expiration successful');
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
// Cancel loading
|
// Cancel loading
|
||||||
$('#expireAllBtn').html('Expiration failed');
|
$('#expireAllBtn').html('Expiration failed');
|
||||||
|
|
||||||
// Show Dialog
|
// Show Dialog
|
||||||
OC.dialogs.alert(
|
OC.dialogs.alert(
|
||||||
'Something went wrong, your files may not have been expired',
|
'Something went wrong, your files may not have been expired',
|
||||||
'An error has occurred',
|
'An error has occurred',
|
||||||
function(){
|
function(){
|
||||||
$('#expireAllBtn').html(t('files_versions', 'Expire all versions')+'<img style="display: none;" class="loading" src="'+OC.filePath('core','img','loading.gif')+'" />');
|
$('#expireAllBtn').html(t('files_versions', 'Expire all versions')+'<img style="display: none;" class="loading" src="'+OC.filePath('core','img','loading.gif')+'" />');
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
|
@ -14,7 +14,7 @@ $(document).ready(function(){
|
||||||
FileActions.register('file','History', FileActions.PERMISSION_UPDATE, function(){return OC.imagePath('core','actions/history')},function(filename){
|
FileActions.register('file','History', FileActions.PERMISSION_UPDATE, function(){return OC.imagePath('core','actions/history')},function(filename){
|
||||||
|
|
||||||
if (scanFiles.scanning){return;}//workaround to prevent additional http request block scanning feedback
|
if (scanFiles.scanning){return;}//workaround to prevent additional http request block scanning feedback
|
||||||
|
|
||||||
var file = $('#dir').val()+'/'+filename;
|
var file = $('#dir').val()+'/'+filename;
|
||||||
// Check if drop down is already visible for a different file
|
// Check if drop down is already visible for a different file
|
||||||
if (($('#dropdown').length > 0)) {
|
if (($('#dropdown').length > 0)) {
|
||||||
|
@ -35,7 +35,7 @@ $(document).ready(function(){
|
||||||
function createVersionsDropdown(filename, files) {
|
function createVersionsDropdown(filename, files) {
|
||||||
|
|
||||||
var historyUrl = OC.linkTo('files_versions', 'history.php') + '?path='+encodeURIComponent( $( '#dir' ).val() ).replace( /%2F/g, '/' )+'/'+encodeURIComponent( filename );
|
var historyUrl = OC.linkTo('files_versions', 'history.php') + '?path='+encodeURIComponent( $( '#dir' ).val() ).replace( /%2F/g, '/' )+'/'+encodeURIComponent( filename );
|
||||||
|
|
||||||
var html = '<div id="dropdown" class="drop" data-file="'+files+'">';
|
var html = '<div id="dropdown" class="drop" data-file="'+files+'">';
|
||||||
html += '<div id="private">';
|
html += '<div id="private">';
|
||||||
html += '<select data-placeholder="Saved versions" id="found_versions" class="chzen-select" style="width:16em;">';
|
html += '<select data-placeholder="Saved versions" id="found_versions" class="chzen-select" style="width:16em;">';
|
||||||
|
@ -45,14 +45,14 @@ function createVersionsDropdown(filename, files) {
|
||||||
//html += '<input type="button" value="Revert file" onclick="revertFile()" />';
|
//html += '<input type="button" value="Revert file" onclick="revertFile()" />';
|
||||||
html += '<input type="button" value="All versions..." onclick="window.location=\''+historyUrl+'\'" name="makelink" id="makelink" />';
|
html += '<input type="button" value="All versions..." onclick="window.location=\''+historyUrl+'\'" name="makelink" id="makelink" />';
|
||||||
html += '<input id="link" style="display:none; width:90%;" />';
|
html += '<input id="link" style="display:none; width:90%;" />';
|
||||||
|
|
||||||
if (filename) {
|
if (filename) {
|
||||||
$('tr').filterAttr('data-file',filename).addClass('mouseOver');
|
$('tr').filterAttr('data-file',filename).addClass('mouseOver');
|
||||||
$(html).appendTo($('tr').filterAttr('data-file',filename).find('td.filename'));
|
$(html).appendTo($('tr').filterAttr('data-file',filename).find('td.filename'));
|
||||||
} else {
|
} else {
|
||||||
$(html).appendTo($('thead .share'));
|
$(html).appendTo($('thead .share'));
|
||||||
}
|
}
|
||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: 'GET',
|
type: 'GET',
|
||||||
url: OC.filePath('files_versions', 'ajax', 'getVersions.php'),
|
url: OC.filePath('files_versions', 'ajax', 'getVersions.php'),
|
||||||
|
@ -60,9 +60,9 @@ function createVersionsDropdown(filename, files) {
|
||||||
data: { source: files },
|
data: { source: files },
|
||||||
async: false,
|
async: false,
|
||||||
success: function( versions ) {
|
success: function( versions ) {
|
||||||
|
|
||||||
//alert("helo "+OC.linkTo('files_versions', 'ajax/getVersions.php'));
|
//alert("helo "+OC.linkTo('files_versions', 'ajax/getVersions.php'));
|
||||||
|
|
||||||
if (versions) {
|
if (versions) {
|
||||||
$.each( versions, function(index, row ) {
|
$.each( versions, function(index, row ) {
|
||||||
addVersion( row );
|
addVersion( row );
|
||||||
|
@ -79,9 +79,9 @@ function createVersionsDropdown(filename, files) {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
function revertFile(file, revision) {
|
function revertFile(file, revision) {
|
||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: 'GET',
|
type: 'GET',
|
||||||
url: OC.linkTo('files_versions', 'ajax/rollbackVersion.php'),
|
url: OC.linkTo('files_versions', 'ajax/rollbackVersion.php'),
|
||||||
|
@ -99,16 +99,16 @@ function createVersionsDropdown(filename, files) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function addVersion(revision ) {
|
function addVersion(revision ) {
|
||||||
name=formatDate(revision.version*1000);
|
name=formatDate(revision.version*1000);
|
||||||
var version=$('<option/>');
|
var version=$('<option/>');
|
||||||
version.attr('value',revision.version);
|
version.attr('value',revision.version);
|
||||||
version.text(name);
|
version.text(name);
|
||||||
|
|
||||||
// } else {
|
// } else {
|
||||||
// var checked = ((permissions > 0) ? 'checked="checked"' : 'style="display:none;"');
|
// var checked = ((permissions > 0) ? 'checked="checked"' : 'style="display:none;"');
|
||||||
// var style = ((permissions == 0) ? 'style="display:none;"' : '');
|
// var style = ((permissions == 0) ? 'style="display:none;"' : '');
|
||||||
|
@ -119,11 +119,11 @@ function createVersionsDropdown(filename, files) {
|
||||||
// user += '<label for="'+uid_shared_with+'" '+style+'>can edit</label>';
|
// user += '<label for="'+uid_shared_with+'" '+style+'>can edit</label>';
|
||||||
// user += '</li>';
|
// user += '</li>';
|
||||||
// }
|
// }
|
||||||
|
|
||||||
version.appendTo('#found_versions');
|
version.appendTo('#found_versions');
|
||||||
}
|
}
|
||||||
|
|
||||||
$('#dropdown').show('blind');
|
$('#dropdown').show('blind');
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,14 +11,14 @@ if( isset( $_['message'] ) ) {
|
||||||
}else{
|
}else{
|
||||||
|
|
||||||
if( isset( $_['outcome_stat'] ) ) {
|
if( isset( $_['outcome_stat'] ) ) {
|
||||||
|
|
||||||
echo( '<div id="feedback-messages" class="'.$_['outcome_stat'].'"><h3>'.$_['outcome_msg'] ).'</h3></div><br>';
|
echo( '<div id="feedback-messages" class="'.$_['outcome_stat'].'"><h3>'.$_['outcome_msg'] ).'</h3></div><br>';
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
echo( '<strong>Versions of '.$_['path'] ).'</strong><br>';
|
echo( '<strong>Versions of '.$_['path'] ).'</strong><br>';
|
||||||
echo('<p><em>Revert a file to a previous version by clicking on its revert button</em></p><br />');
|
echo('<p><em>Revert a file to a previous version by clicking on its revert button</em></p><br />');
|
||||||
|
|
||||||
foreach ( $_['versions'] as $v ) {
|
foreach ( $_['versions'] as $v ) {
|
||||||
echo ' ';
|
echo ' ';
|
||||||
echo OCP\Util::formatDate( doubleval($v['version']) );
|
echo OCP\Util::formatDate( doubleval($v['version']) );
|
||||||
|
|
|
@ -23,11 +23,11 @@
|
||||||
|
|
||||||
class OC_USER_WEBDAVAUTH extends OC_User_Backend {
|
class OC_USER_WEBDAVAUTH extends OC_User_Backend {
|
||||||
protected $webdavauth_url;
|
protected $webdavauth_url;
|
||||||
|
|
||||||
public function __construct() {
|
public function __construct() {
|
||||||
$this->webdavauth_url = OC_Config::getValue( "user_webdavauth_url" );
|
$this->webdavauth_url = OC_Config::getValue( "user_webdavauth_url" );
|
||||||
}
|
}
|
||||||
|
|
||||||
public function createUser() {
|
public function createUser() {
|
||||||
// Can't create user
|
// Can't create user
|
||||||
OC_Log::write('OC_USER_WEBDAVAUTH', 'Not possible to create users from web frontend using WebDAV user backend',3);
|
OC_Log::write('OC_USER_WEBDAVAUTH', 'Not possible to create users from web frontend using WebDAV user backend',3);
|
||||||
|
@ -45,14 +45,14 @@ class OC_USER_WEBDAVAUTH extends OC_User_Backend {
|
||||||
OC_Log::write('OC_USER_WEBDAVAUTH', 'Not possible to change password for users from web frontend using WebDAV user backend',3);
|
OC_Log::write('OC_USER_WEBDAVAUTH', 'Not possible to change password for users from web frontend using WebDAV user backend',3);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function checkPassword( $uid, $password ) {
|
public function checkPassword( $uid, $password ) {
|
||||||
|
|
||||||
$url= 'http://'.urlencode($uid).':'.urlencode($password).'@'.$this->webdavauth_url;
|
$url= 'http://'.urlencode($uid).':'.urlencode($password).'@'.$this->webdavauth_url;
|
||||||
$headers = get_headers($url);
|
$headers = get_headers($url);
|
||||||
if($headers==false){
|
if($headers==false){
|
||||||
OC_Log::write('OC_USER_WEBDAVAUTH', 'Not possible to connect to WebDAV Url: "'.$this->webdavauth_url.'" ' ,3);
|
OC_Log::write('OC_USER_WEBDAVAUTH', 'Not possible to connect to WebDAV Url: "'.$this->webdavauth_url.'" ' ,3);
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
}
|
}
|
||||||
$returncode= substr($headers[0], 9, 3);
|
$returncode= substr($headers[0], 9, 3);
|
||||||
|
@ -64,7 +64,7 @@ class OC_USER_WEBDAVAUTH extends OC_User_Backend {
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* we don´t know if a user exists without the password. so we have to return false all the time
|
* we don´t know if a user exists without the password. so we have to return false all the time
|
||||||
*/
|
*/
|
||||||
|
@ -77,7 +77,7 @@ class OC_USER_WEBDAVAUTH extends OC_User_Backend {
|
||||||
*/
|
*/
|
||||||
public function getUsers(){
|
public function getUsers(){
|
||||||
$returnArray = array();
|
$returnArray = array();
|
||||||
|
|
||||||
return $returnArray;
|
return $returnArray;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue