From 20e0432de8e635b742415cae58e1466daf7da9b5 Mon Sep 17 00:00:00 2001
From: Jan-Christoph Borchardt
Date: Sun, 28 Oct 2012 12:19:52 +0100
Subject: [PATCH 01/40] add 3rdparty folder to gitignore
---
.gitignore | 1 +
1 file changed, 1 insertion(+)
diff --git a/.gitignore b/.gitignore
index 4749dea19dc..7c0df64b864 100644
--- a/.gitignore
+++ b/.gitignore
@@ -4,6 +4,7 @@ owncloud
config/config.php
config/mount.php
apps/inc.php
+3rdparty
# just sane ignores
.*.sw[po]
From d9ef6da2e49de52a694f1c7684624e68e4de6a21 Mon Sep 17 00:00:00 2001
From: Robin Appelman
Date: Sun, 28 Oct 2012 11:51:54 +0100
Subject: [PATCH 02/40] code style
---
apps/files/js/fileactions.js | 194 ++++++++++++++++++-----------------
1 file changed, 101 insertions(+), 93 deletions(-)
diff --git a/apps/files/js/fileactions.js b/apps/files/js/fileactions.js
index 1cf80352bef..fc7c117cfc4 100644
--- a/apps/files/js/fileactions.js
+++ b/apps/files/js/fileactions.js
@@ -1,96 +1,98 @@
-var FileActions={
- actions:{},
- defaults:{},
- icons:{},
- currentFile:null,
- register:function(mime,name,permissions,icon,action){
- if(!FileActions.actions[mime]){
- FileActions.actions[mime]={};
+var FileActions = {
+ actions: {},
+ defaults: {},
+ icons: {},
+ currentFile: null,
+ register: function (mime, name, permissions, icon, action) {
+ if (!FileActions.actions[mime]) {
+ FileActions.actions[mime] = {};
}
if (!FileActions.actions[mime][name]) {
FileActions.actions[mime][name] = {};
}
FileActions.actions[mime][name]['action'] = action;
FileActions.actions[mime][name]['permissions'] = permissions;
- FileActions.icons[name]=icon;
+ FileActions.icons[name] = icon;
},
- setDefault:function(mime,name){
- FileActions.defaults[mime]=name;
+ setDefault: function (mime, name) {
+ FileActions.defaults[mime] = name;
},
- get:function(mime,type,permissions){
- var actions={};
- if(FileActions.actions.all){
- actions=$.extend( actions, FileActions.actions.all );
+ get: function (mime, type, permissions) {
+ var actions = {};
+ if (FileActions.actions.all) {
+ actions = $.extend(actions, FileActions.actions.all);
}
- if(mime){
- if(FileActions.actions[mime]){
- actions=$.extend( actions, FileActions.actions[mime] );
+ if (mime) {
+ if (FileActions.actions[mime]) {
+ actions = $.extend(actions, FileActions.actions[mime]);
}
- var mimePart=mime.substr(0,mime.indexOf('/'));
- if(FileActions.actions[mimePart]){
- actions=$.extend( actions, FileActions.actions[mimePart] );
+ var mimePart = mime.substr(0, mime.indexOf('/'));
+ if (FileActions.actions[mimePart]) {
+ actions = $.extend(actions, FileActions.actions[mimePart]);
}
}
- if(type){//type is 'dir' or 'file'
- if(FileActions.actions[type]){
- actions=$.extend( actions, FileActions.actions[type] );
+ if (type) {//type is 'dir' or 'file'
+ if (FileActions.actions[type]) {
+ actions = $.extend(actions, FileActions.actions[type]);
}
}
var filteredActions = {};
- $.each(actions, function(name, action) {
+ $.each(actions, function (name, action) {
if (action.permissions & permissions) {
filteredActions[name] = action.action;
}
});
return filteredActions;
},
- getDefault:function(mime,type,permissions){
- if(mime){
- var mimePart=mime.substr(0,mime.indexOf('/'));
+ getDefault: function (mime, type, permissions) {
+ if (mime) {
+ var mimePart = mime.substr(0, mime.indexOf('/'));
}
- var name=false;
- if(mime && FileActions.defaults[mime]){
- name=FileActions.defaults[mime];
- }else if(mime && FileActions.defaults[mimePart]){
- name=FileActions.defaults[mimePart];
- }else if(type && FileActions.defaults[type]){
- name=FileActions.defaults[type];
- }else{
- name=FileActions.defaults.all;
+ var name = false;
+ if (mime && FileActions.defaults[mime]) {
+ name = FileActions.defaults[mime];
+ } else if (mime && FileActions.defaults[mimePart]) {
+ name = FileActions.defaults[mimePart];
+ } else if (type && FileActions.defaults[type]) {
+ name = FileActions.defaults[type];
+ } else {
+ name = FileActions.defaults.all;
}
- var actions=this.get(mime,type,permissions);
+ var actions = this.get(mime, type, permissions);
return actions[name];
},
- display:function(parent){
- FileActions.currentFile=parent;
+ display: function (parent) {
+ FileActions.currentFile = parent;
$('#fileList span.fileactions, #fileList td.date a.action').remove();
- var actions=FileActions.get(FileActions.getCurrentMimeType(),FileActions.getCurrentType(), FileActions.getCurrentPermissions());
- var file=FileActions.getCurrentFile();
- if($('tr').filterAttr('data-file',file).data('renaming')){
+ var actions = FileActions.get(FileActions.getCurrentMimeType(), FileActions.getCurrentType(), FileActions.getCurrentPermissions());
+ var file = FileActions.getCurrentFile();
+ if ($('tr').filterAttr('data-file', file).data('renaming')) {
return;
}
parent.children('a.name').append('');
- var defaultAction=FileActions.getDefault(FileActions.getCurrentMimeType(),FileActions.getCurrentType(), FileActions.getCurrentPermissions());
- for(name in actions){
+ var defaultAction = FileActions.getDefault(FileActions.getCurrentMimeType(), FileActions.getCurrentType(), FileActions.getCurrentPermissions());
+ for (name in actions) {
// NOTE: Temporary fix to prevent rename action in root of Shared directory
if (name == 'Rename' && $('#dir').val() == '/Shared') {
continue;
}
- if((name=='Download' || actions[name]!=defaultAction) && name!='Delete'){
- var img=FileActions.icons[name];
- if(img.call){
- img=img(file);
+ if ((name == 'Download' || actions[name] != defaultAction) && name != 'Delete') {
+ var img = FileActions.icons[name];
+ if (img.call) {
+ img = img(file);
}
- var html='';
- if(img) { html+='
'; }
- html += t('files', name) +'';
- var element=$(html);
- element.data('action',name);
- element.click(function(event){
+ var html = '';
+ if (img) {
+ html += '
';
+ }
+ html += t('files', name) + '';
+ var element = $(html);
+ element.data('action', name);
+ element.click(function (event) {
event.stopPropagation();
event.preventDefault();
- var action=actions[$(this).data('action')];
- var currentFile=FileActions.getCurrentFile();
+ var action = actions[$(this).data('action')];
+ var currentFile = FileActions.getCurrentFile();
FileActions.hide();
action(currentFile);
});
@@ -98,94 +100,100 @@ var FileActions={
parent.find('a.name>span.fileactions').append(element);
}
}
- if(actions['Delete']){
- var img=FileActions.icons['Delete'];
- if(img.call){
- img=img(file);
+ if (actions['Delete']) {
+ var img = FileActions.icons['Delete'];
+ if (img.call) {
+ img = img(file);
}
// NOTE: Temporary fix to allow unsharing of files in root of Shared folder
if ($('#dir').val() == '/Shared') {
var html = '';
} else {
- var html='';
+ var html = '';
}
- var element=$(html);
- if(img){
- element.append($('
'));
+ var element = $(html);
+ if (img) {
+ element.append($('
'));
}
- element.data('action','Delete');
- element.click(function(event){
+ element.data('action', 'Delete');
+ element.click(function (event) {
event.stopPropagation();
event.preventDefault();
- var action=actions[$(this).data('action')];
- var currentFile=FileActions.getCurrentFile();
+ var action = actions[$(this).data('action')];
+ var currentFile = FileActions.getCurrentFile();
FileActions.hide();
action(currentFile);
});
element.hide();
parent.parent().children().last().append(element);
}
- $('#fileList .action').css('-o-transition-property','none');//temporarly disable
- $('#fileList .action').fadeIn(200,function(){
- $('#fileList .action').css('-o-transition-property','opacity');
+ $('#fileList .action').css('-o-transition-property', 'none');//temporarly disable
+ $('#fileList .action').fadeIn(200, function () {
+ $('#fileList .action').css('-o-transition-property', 'opacity');
});
return false;
},
- hide:function(){
- $('#fileList span.fileactions, #fileList td.date a.action').fadeOut(200,function(){
+ hide: function () {
+ $('#fileList span.fileactions, #fileList td.date a.action').fadeOut(200, function () {
$(this).remove();
});
},
- getCurrentFile:function(){
+ getCurrentFile: function () {
return FileActions.currentFile.parent().attr('data-file');
},
- getCurrentMimeType:function(){
+ getCurrentMimeType: function () {
return FileActions.currentFile.parent().attr('data-mime');
},
- getCurrentType:function(){
+ getCurrentType: function () {
return FileActions.currentFile.parent().attr('data-type');
},
- getCurrentPermissions:function() {
+ getCurrentPermissions: function () {
return FileActions.currentFile.parent().data('permissions');
}
};
-$(document).ready(function(){
- if($('#allowZipDownload').val() == 1){
+$(document).ready(function () {
+ if ($('#allowZipDownload').val() == 1) {
var downloadScope = 'all';
} else {
var downloadScope = 'file';
}
- FileActions.register(downloadScope,'Download', OC.PERMISSION_READ, function(){return OC.imagePath('core','actions/download');},function(filename){
- window.location=OC.filePath('files', 'ajax', 'download.php') + '?files='+encodeURIComponent(filename)+'&dir='+encodeURIComponent($('#dir').val());
+ FileActions.register(downloadScope, 'Download', OC.PERMISSION_READ, function () {
+ return OC.imagePath('core', 'actions/download');
+ }, function (filename) {
+ window.location = OC.filePath('files', 'ajax', 'download.php') + '?files=' + encodeURIComponent(filename) + '&dir=' + encodeURIComponent($('#dir').val());
});
});
-FileActions.register('all','Delete', OC.PERMISSION_DELETE, function(){return OC.imagePath('core','actions/delete');},function(filename){
- if(Files.cancelUpload(filename)) {
- if(filename.substr){
- filename=[filename];
+FileActions.register('all', 'Delete', OC.PERMISSION_DELETE, function () {
+ return OC.imagePath('core', 'actions/delete');
+}, function (filename) {
+ if (Files.cancelUpload(filename)) {
+ if (filename.substr) {
+ filename = [filename];
}
- $.each(filename,function(index,file){
- var filename = $('tr').filterAttr('data-file',file);
+ $.each(filename, function (index, file) {
+ var filename = $('tr').filterAttr('data-file', file);
filename.hide();
filename.find('input[type="checkbox"]').removeAttr('checked');
filename.removeClass('selected');
});
procesSelection();
- }else{
+ } else {
FileList.do_delete(filename);
}
$('.tipsy').remove();
});
// t('files', 'Rename')
-FileActions.register('all','Rename', OC.PERMISSION_UPDATE, function(){return OC.imagePath('core','actions/rename');},function(filename){
+FileActions.register('all', 'Rename', OC.PERMISSION_UPDATE, function () {
+ return OC.imagePath('core', 'actions/rename');
+}, function (filename) {
FileList.rename(filename);
});
-FileActions.register('dir','Open', OC.PERMISSION_READ, '', function(filename){
- window.location=OC.linkTo('files', 'index.php') + '?dir='+encodeURIComponent($('#dir').val()).replace(/%2F/g, '/')+'/'+encodeURIComponent(filename);
+FileActions.register('dir', 'Open', OC.PERMISSION_READ, '', function (filename) {
+ window.location = OC.linkTo('files', 'index.php') + '?dir=' + encodeURIComponent($('#dir').val()).replace(/%2F/g, '/') + '/' + encodeURIComponent(filename);
});
-FileActions.setDefault('dir','Open');
+FileActions.setDefault('dir', 'Open');
From fe6b987b3d48a5fc9bab8f4bfdccb99e9605f07a Mon Sep 17 00:00:00 2001
From: Robin Appelman
Date: Sun, 28 Oct 2012 12:47:33 +0100
Subject: [PATCH 03/40] use css to show/hide fileactions
---
apps/files/js/fileactions.js | 30 ++++++++++--------------------
apps/files/js/files.js | 8 --------
core/css/styles.css | 7 ++++---
3 files changed, 14 insertions(+), 31 deletions(-)
diff --git a/apps/files/js/fileactions.js b/apps/files/js/fileactions.js
index fc7c117cfc4..24c8e85656c 100644
--- a/apps/files/js/fileactions.js
+++ b/apps/files/js/fileactions.js
@@ -63,7 +63,6 @@ var FileActions = {
},
display: function (parent) {
FileActions.currentFile = parent;
- $('#fileList span.fileactions, #fileList td.date a.action').remove();
var actions = FileActions.get(FileActions.getCurrentMimeType(), FileActions.getCurrentType(), FileActions.getCurrentPermissions());
var file = FileActions.getCurrentFile();
if ($('tr').filterAttr('data-file', file).data('renaming')) {
@@ -73,15 +72,15 @@ var FileActions = {
var defaultAction = FileActions.getDefault(FileActions.getCurrentMimeType(), FileActions.getCurrentType(), FileActions.getCurrentPermissions());
for (name in actions) {
// NOTE: Temporary fix to prevent rename action in root of Shared directory
- if (name == 'Rename' && $('#dir').val() == '/Shared') {
+ if (name === 'Rename' && $('#dir').val() === '/Shared') {
continue;
}
- if ((name == 'Download' || actions[name] != defaultAction) && name != 'Delete') {
+ if ((name === 'Download' || actions[name] !== defaultAction) && name !== 'Delete') {
var img = FileActions.icons[name];
if (img.call) {
img = img(file);
}
- var html = '';
+ var html = '';
if (img) {
html += '
';
}
@@ -89,14 +88,13 @@ var FileActions = {
var element = $(html);
element.data('action', name);
element.click(function (event) {
+ FileActions.currentFile = $(this).parent().parent().parent();
event.stopPropagation();
event.preventDefault();
var action = actions[$(this).data('action')];
var currentFile = FileActions.getCurrentFile();
- FileActions.hide();
action(currentFile);
});
- element.hide();
parent.find('a.name>span.fileactions').append(element);
}
}
@@ -107,9 +105,9 @@ var FileActions = {
}
// NOTE: Temporary fix to allow unsharing of files in root of Shared folder
if ($('#dir').val() == '/Shared') {
- var html = '';
+ var html = '';
} else {
- var html = '';
+ var html = '';
}
var element = $(html);
if (img) {
@@ -121,22 +119,10 @@ var FileActions = {
event.preventDefault();
var action = actions[$(this).data('action')];
var currentFile = FileActions.getCurrentFile();
- FileActions.hide();
action(currentFile);
});
- element.hide();
parent.parent().children().last().append(element);
}
- $('#fileList .action').css('-o-transition-property', 'none');//temporarly disable
- $('#fileList .action').fadeIn(200, function () {
- $('#fileList .action').css('-o-transition-property', 'opacity');
- });
- return false;
- },
- hide: function () {
- $('#fileList span.fileactions, #fileList td.date a.action').fadeOut(200, function () {
- $(this).remove();
- });
},
getCurrentFile: function () {
return FileActions.currentFile.parent().attr('data-file');
@@ -163,6 +149,10 @@ $(document).ready(function () {
}, function (filename) {
window.location = OC.filePath('files', 'ajax', 'download.php') + '?files=' + encodeURIComponent(filename) + '&dir=' + encodeURIComponent($('#dir').val());
});
+
+ $('#fileList tr').each(function(){
+ FileActions.display($(this).children('td.filename'));
+ });
});
FileActions.register('all', 'Delete', OC.PERMISSION_DELETE, function () {
diff --git a/apps/files/js/files.js b/apps/files/js/files.js
index 549204e8572..2d9ccba424a 100644
--- a/apps/files/js/files.js
+++ b/apps/files/js/files.js
@@ -62,14 +62,6 @@ $(document).ready(function() {
return false;
});
- // Sets the file-action buttons behaviour :
- $('tr').live('mouseenter',function(event) {
- FileActions.display($(this).children('td.filename'));
- });
- $('tr').live('mouseleave',function(event) {
- FileActions.hide();
- });
-
var lastChecked;
// Sets the file link behaviour :
diff --git a/core/css/styles.css b/core/css/styles.css
index a6c10504070..95dceb50dec 100644
--- a/core/css/styles.css
+++ b/core/css/styles.css
@@ -112,10 +112,11 @@ label.infield { cursor: text !important; }
#notification { z-index:101; background-color:#fc4; border:0; padding:0 .7em .3em; display:none; position:fixed; left:50%; top:0; -moz-border-radius-bottomleft:1em; -webkit-border-bottom-left-radius:1em; border-bottom-left-radius:1em; -moz-border-radius-bottomright:1em; -webkit-border-bottom-right-radius:1em; border-bottom-right-radius:1em; }
#notification span { cursor:pointer; font-weight:bold; margin-left:1em; }
-.action, .selectedActions a { -ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=50)"; filter:alpha(opacity=50); opacity:.5; -webkit-transition:opacity 200ms; -moz-transition:opacity 200ms; -o-transition:opacity 200ms; transition:opacity 200ms; }
-.action { width: 16px; height: 16px; }
+tr .action, .selectedActions a { -ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=0)"; filter:alpha(opacity=0); opacity:0; -webkit-transition:opacity 200ms; -moz-transition:opacity 200ms; -o-transition:opacity 200ms; transition:opacity 200ms; }
+tr:hover .action, .selectedActions a { -ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=50)"; filter:alpha(opacity=50); opacity:.5; }
+tr .action { width: 16px; height: 16px; }
.header-action { -ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=80)"; filter:alpha(opacity=80); opacity:.8; }
-.action:hover, .selectedActions a:hover, .header-action:hover { -ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=100)"; filter:alpha(opacity=100); opacity:1; }
+tr:hover .action:hover, .selectedActions a:hover, .header-action:hover { -ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=100)"; filter:alpha(opacity=100); opacity:1; }
table:not(.nostyle) tr { -webkit-transition:background-color 200ms; -moz-transition:background-color 200ms; -o-transition:background-color 200ms; transition:background-color 200ms; }
tbody tr:hover, tr:active { background-color:#f8f8f8; }
From bf3dac05d10ffb18854e73e823a83503099aa77d Mon Sep 17 00:00:00 2001
From: Bernhard Posselt
Date: Sun, 28 Oct 2012 13:27:13 +0100
Subject: [PATCH 04/40] added functions for printing escaped and unescaped
values
---
lib/template.php | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/lib/template.php b/lib/template.php
index 972d75807c7..1ad47cbe52c 100644
--- a/lib/template.php
+++ b/lib/template.php
@@ -21,6 +21,22 @@
*
*/
+/**
+ * Prints an XSS escaped string
+ * @param string $string the string which will be escaped and printed
+ */
+function p($string){
+ print(OC_Util::sanitizeHTML($string));
+}
+
+/**
+ * Prints an unescaped string
+ * @param string $string the string which will be printed as it is
+ */
+function print_unescaped($string){
+ print($string);
+}
+
/**
* @brief make OC_Helper::linkTo available as a simple function
* @param string $app app
From 5b9ba2e0331cdfa986a090c61f33f36eca1a0f33 Mon Sep 17 00:00:00 2001
From: Arthur Schiwon
Date: Sun, 28 Oct 2012 13:45:37 +0100
Subject: [PATCH 05/40] remove whitespaces, no code change
---
lib/util.php | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/lib/util.php b/lib/util.php
index 4ca84ba75af..c49e7cfc234 100755
--- a/lib/util.php
+++ b/lib/util.php
@@ -62,7 +62,7 @@ class OC_Util {
OC_Filesystem::tearDown();
self::$fsSetup=false;
}
-
+
public static function loadUserMountPoints($user) {
$user_dir = '/'.$user.'/files';
$user_root = OC_User::getHome($user);
@@ -74,14 +74,14 @@ class OC_Util {
OC_Filesystem::mount($options['class'], $options['options'], $mountPoint);
}
}
-
+
$mtime=filemtime($user_root.'/mount.php');
$previousMTime=OC_Preferences::getValue($user,'files','mountconfigmtime',0);
if($mtime>$previousMTime) {//mount config has changed, filecache needs to be updated
OC_FileCache::triggerUpdate($user);
OC_Preferences::setValue($user,'files','mountconfigmtime',$mtime);
}
- }
+ }
}
/**
@@ -429,7 +429,7 @@ class OC_Util {
}
return true;
}
-
+
/**
* Redirect to the user default page
*/
From b8a48b55a359bb56f9cdf2d4c8099394d7f0cbb1 Mon Sep 17 00:00:00 2001
From: Arthur Schiwon
Date: Sun, 28 Oct 2012 13:47:53 +0100
Subject: [PATCH 06/40] make sure all filesystem apps are loaded when setupFS
is proceeded, to make sure the emmited setup-hook is received. Fixes #89
---
lib/util.php | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/lib/util.php b/lib/util.php
index c49e7cfc234..f67f8d1fe3f 100755
--- a/lib/util.php
+++ b/lib/util.php
@@ -24,6 +24,11 @@ class OC_Util {
$user = OC_User::getUser();
}
+ // load all filesystem apps before, so no setup-hook gets lost
+ if(!$RUNTIME_NOAPPS) {
+ OC_App::loadApps(array('filesystem'));
+ }
+
// the filesystem will finish when $user is not empty,
// mark fs setup here to avoid doing the setup from loading
// OC_Filesystem
From d7a6b094063a89b8ecce9392a603cb3c3a967db2 Mon Sep 17 00:00:00 2001
From: Georg Ehrke
Date: Sun, 28 Oct 2012 14:11:41 +0100
Subject: [PATCH 07/40] deny the usage of dots in database name
---
core/templates/installation.php | 2 +-
lib/setup.php | 3 +++
2 files changed, 4 insertions(+), 1 deletion(-)
diff --git a/core/templates/installation.php b/core/templates/installation.php
index c0b29ea909d..5a3bd2cc9f0 100644
--- a/core/templates/installation.php
+++ b/core/templates/installation.php
@@ -111,7 +111,7 @@
-
+
diff --git a/lib/setup.php b/lib/setup.php
index a072e00f91e..9231845da51 100644
--- a/lib/setup.php
+++ b/lib/setup.php
@@ -70,6 +70,9 @@ class OC_Setup {
if(empty($options['dbname'])) {
$error[] = "$dbprettyname enter the database name.";
}
+ if(substr_count($options['dbname'], '.') >= 1){
+ $error[] = "$dbprettyname you may not use dots in the database name";
+ }
if($dbtype != 'oci' && empty($options['dbhost'])) {
$error[] = "$dbprettyname set the database host.";
}
From a4a1dad8312db8060009be0dd315cd7b5b1e4fc5 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Bj=C3=B6rn=20Schie=C3=9Fle?=
Date: Sun, 28 Oct 2012 13:47:29 +0100
Subject: [PATCH 08/40] set password if user leaves password field (issue #57)
---
core/js/share.js | 16 +++++++---------
1 file changed, 7 insertions(+), 9 deletions(-)
diff --git a/core/js/share.js b/core/js/share.js
index 7d8799edf51..8d359dd3fcb 100644
--- a/core/js/share.js
+++ b/core/js/share.js
@@ -483,15 +483,13 @@ $(document).ready(function() {
$('#linkPass').toggle('blind');
});
- $('#linkPassText').live('keyup', function(event) {
- if (event.keyCode == 13) {
- var itemType = $('#dropdown').data('item-type');
- var itemSource = $('#dropdown').data('item-source');
- OC.Share.share(itemType, itemSource, OC.Share.SHARE_TYPE_LINK, $(this).val(), OC.PERMISSION_READ, function() {
- $('#linkPassText').val('');
- $('#linkPassText').attr('placeholder', t('core', 'Password protected'));
- });
- }
+ $('#linkPassText').live('focusout', function(event) {
+ var itemType = $('#dropdown').data('item-type');
+ var itemSource = $('#dropdown').data('item-source');
+ OC.Share.share(itemType, itemSource, OC.Share.SHARE_TYPE_LINK, $(this).val(), OC.PERMISSION_READ, function() {
+ $('#linkPassText').val('');
+ $('#linkPassText').attr('placeholder', t('core', 'Password protected'));
+ });
});
$('#expirationCheckbox').live('click', function() {
From f2f2b8ba3b315365591784dcc1c172625768f241 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Bj=C3=B6rn=20Schie=C3=9Fle?=
Date: Sun, 28 Oct 2012 14:57:36 +0100
Subject: [PATCH 09/40] added some visual feedback is password was set
---
core/js/share.js | 1 +
1 file changed, 1 insertion(+)
diff --git a/core/js/share.js b/core/js/share.js
index 8d359dd3fcb..00e5ef3eed6 100644
--- a/core/js/share.js
+++ b/core/js/share.js
@@ -490,6 +490,7 @@ $(document).ready(function() {
$('#linkPassText').val('');
$('#linkPassText').attr('placeholder', t('core', 'Password protected'));
});
+ $('#linkPassText').attr('placeholder', t('core', 'Password protected'));
});
$('#expirationCheckbox').live('click', function() {
From be215a097ae5c4838c7d8928cfab0345d884ed56 Mon Sep 17 00:00:00 2001
From: Arthur Schiwon
Date: Sun, 28 Oct 2012 15:10:15 +0100
Subject: [PATCH 10/40] check if RUNTIME_NOAPPS is set before using it
---
lib/util.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/util.php b/lib/util.php
index f67f8d1fe3f..69f29f12228 100755
--- a/lib/util.php
+++ b/lib/util.php
@@ -25,7 +25,7 @@ class OC_Util {
}
// load all filesystem apps before, so no setup-hook gets lost
- if(!$RUNTIME_NOAPPS) {
+ if(!isset($RUNTIME_NOAPPS) || !$RUNTIME_NOAPPS) {
OC_App::loadApps(array('filesystem'));
}
From 4fd0514f0af9286636c3665d02d10700fd0e3141 Mon Sep 17 00:00:00 2001
From: Georg Ehrke
Date: Sun, 28 Oct 2012 15:20:20 +0100
Subject: [PATCH 11/40] don't move file into subdirectory if a file with the
same name already exists (fixes #92)
---
apps/files/ajax/move.php | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/apps/files/ajax/move.php b/apps/files/ajax/move.php
index ddcda553e3d..db8f59b43d1 100644
--- a/apps/files/ajax/move.php
+++ b/apps/files/ajax/move.php
@@ -12,6 +12,11 @@ $file = stripslashes($_GET["file"]);
$target = stripslashes(urldecode($_GET["target"]));
+if(OC_Filesystem::file_exists($target . '/' . $file)){
+ OCP\JSON::error(array("data" => array( "message" => "Could not move $file - File with this name already exists" )));
+ exit;
+}
+
if(OC_Files::move($dir, $file, $target, $file)) {
OCP\JSON::success(array("data" => array( "dir" => $dir, "files" => $file )));
} else {
From 6bc156ba69f51039300ec1b84abb748518dadf22 Mon Sep 17 00:00:00 2001
From: Robin Appelman
Date: Sun, 28 Oct 2012 16:00:31 +0100
Subject: [PATCH 12/40] add svg mimetype to default htaccess
---
.htaccess | 4 ++++
lib/setup.php | 4 ++++
2 files changed, 8 insertions(+)
diff --git a/.htaccess b/.htaccess
index 11ee1d59f83..a5d51c78087 100755
--- a/.htaccess
+++ b/.htaccess
@@ -19,4 +19,8 @@ RewriteRule ^apps/contacts/carddav.php remote.php/carddav/ [QSA,L]
RewriteRule ^apps/([^/]*)/(.*\.(css|php))$ index.php?app=$1&getfile=$2 [QSA,L]
RewriteRule ^remote/(.*) remote.php [QSA,L]
+
+AddType image/svg+xml svg svgz
+AddEncoding gzip svgz
+
Options -Indexes
diff --git a/lib/setup.php b/lib/setup.php
index 9231845da51..56f66945c2b 100644
--- a/lib/setup.php
+++ b/lib/setup.php
@@ -592,6 +592,10 @@ class OC_Setup {
$content.= "RewriteRule ^apps/([^/]*)/(.*\.(css|php))$ index.php?app=$1&getfile=$2 [QSA,L]\n";
$content.= "RewriteRule ^remote/(.*) remote.php [QSA,L]\n";
$content.= "\n";
+ $content.= "\n";
+ $content.= "AddType image/svg+xml svg svgz\n";
+ $content.= "AddEncoding gzip svgz\n";
+ $content.= "\n";
$content.= "Options -Indexes\n";
@file_put_contents(OC::$SERVERROOT.'/.htaccess', $content); //supress errors in case we don't have permissions for it
From 6695b29053334ab4443564cfedd3823af9b90455 Mon Sep 17 00:00:00 2001
From: Robin Appelman
Date: Sun, 28 Oct 2012 16:00:43 +0100
Subject: [PATCH 13/40] fix running app tests
---
tests/bootstrap.php | 2 --
1 file changed, 2 deletions(-)
diff --git a/tests/bootstrap.php b/tests/bootstrap.php
index 16ed6cdb3c7..f8364b71ef7 100644
--- a/tests/bootstrap.php
+++ b/tests/bootstrap.php
@@ -1,7 +1,5 @@
Date: Sun, 28 Oct 2012 16:03:31 +0100
Subject: [PATCH 14/40] properly replace fileaction icons with pngs when needed
---
apps/files/js/fileactions.js | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/apps/files/js/fileactions.js b/apps/files/js/fileactions.js
index 24c8e85656c..901c685ecb2 100644
--- a/apps/files/js/fileactions.js
+++ b/apps/files/js/fileactions.js
@@ -82,7 +82,7 @@ var FileActions = {
}
var html = '';
if (img) {
- html += '
';
+ html += '
';
}
html += t('files', name) + '';
var element = $(html);
@@ -111,7 +111,7 @@ var FileActions = {
}
var element = $(html);
if (img) {
- element.append($('
'));
+ element.append($('
'));
}
element.data('action', 'Delete');
element.click(function (event) {
From 2248fe9f3e23cbe342a5609119b5424448eb19b8 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Thomas=20M=C3=BCller?=
Date: Sun, 28 Oct 2012 16:33:11 +0100
Subject: [PATCH 15/40] disble breaking test cases for now
---
tests/enable_all.php | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/tests/enable_all.php b/tests/enable_all.php
index 0ea8d231ce8..23a1e8ab68c 100644
--- a/tests/enable_all.php
+++ b/tests/enable_all.php
@@ -10,9 +10,9 @@ require_once __DIR__.'/../lib/base.php';
OC_App::enable('calendar');
OC_App::enable('contacts');
-OC_App::enable('files_archive');
-OC_App::enable('mozilla_sync');
-OC_App::enable('news');
-OC_App::enable('provisioning_api');
+#OC_App::enable('files_archive');
+#OC_App::enable('mozilla_sync');
+#OC_App::enable('news');
+#OC_App::enable('provisioning_api');
#OC_App::enable('user_external');
From b7a02f0c93c2ad8d4bce3b05e8607712810d54b7 Mon Sep 17 00:00:00 2001
From: Felix Moeller
Date: Sun, 28 Oct 2012 18:12:31 +0100
Subject: [PATCH 16/40] NoSpaceAfterComma
first in new branch
---
lib/installer.php | 30 +++++++++++++--------------
lib/util.php | 52 +++++++++++++++++++++++------------------------
2 files changed, 41 insertions(+), 41 deletions(-)
diff --git a/lib/installer.php b/lib/installer.php
index 83d082b804a..8c504fb6129 100644
--- a/lib/installer.php
+++ b/lib/installer.php
@@ -97,7 +97,7 @@ class OC_Installer{
if($archive=OC_Archive::open($path)) {
$archive->extract($extractDir);
} else {
- OC_Log::write('core','Failed to open archive when installing app',OC_Log::ERROR);
+ OC_Log::write('core', 'Failed to open archive when installing app', OC_Log::ERROR);
OC_Helper::rmdirr($extractDir);
if($data['source']=='http') {
unlink($path);
@@ -118,7 +118,7 @@ class OC_Installer{
}
}
if(!is_file($extractDir.'/appinfo/info.xml')) {
- OC_Log::write('core','App does not provide an info.xml file',OC_Log::ERROR);
+ OC_Log::write('core', 'App does not provide an info.xml file', OC_Log::ERROR);
OC_Helper::rmdirr($extractDir);
if($data['source']=='http') {
unlink($path);
@@ -127,8 +127,8 @@ class OC_Installer{
}
$info=OC_App::getAppInfo($extractDir.'/appinfo/info.xml', true);
// check the code for not allowed calls
- if(!OC_Installer::checkCode($info['id'],$extractDir)) {
- OC_Log::write('core','App can\'t be installed because of not allowed code in the App',OC_Log::ERROR);
+ if(!OC_Installer::checkCode($info['id'], $extractDir)) {
+ OC_Log::write('core', 'App can\'t be installed because of not allowed code in the App', OC_Log::ERROR);
OC_Helper::rmdirr($extractDir);
return false;
}
@@ -136,14 +136,14 @@ class OC_Installer{
// check if the app is compatible with this version of ownCloud
$version=OC_Util::getVersion();
if(!isset($info['require']) or ($version[0]>$info['require'])) {
- OC_Log::write('core','App can\'t be installed because it is not compatible with this version of ownCloud',OC_Log::ERROR);
+ OC_Log::write('core', 'App can\'t be installed because it is not compatible with this version of ownCloud', OC_Log::ERROR);
OC_Helper::rmdirr($extractDir);
return false;
}
//check if an app with the same id is already installed
if(self::isInstalled( $info['id'] )) {
- OC_Log::write('core','App already installed',OC_Log::WARN);
+ OC_Log::write('core', 'App already installed', OC_Log::WARN);
OC_Helper::rmdirr($extractDir);
if($data['source']=='http') {
unlink($path);
@@ -154,7 +154,7 @@ class OC_Installer{
$basedir=OC_App::getInstallPath().'/'.$info['id'];
//check if the destination directory already exists
if(is_dir($basedir)) {
- OC_Log::write('core','App directory already exists',OC_Log::WARN);
+ OC_Log::write('core', 'App directory already exists', OC_Log::WARN);
OC_Helper::rmdirr($extractDir);
if($data['source']=='http') {
unlink($path);
@@ -168,14 +168,14 @@ class OC_Installer{
//copy the app to the correct place
if(@!mkdir($basedir)) {
- OC_Log::write('core','Can\'t create app folder. Please fix permissions. ('.$basedir.')',OC_Log::ERROR);
+ OC_Log::write('core', 'Can\'t create app folder. Please fix permissions. ('.$basedir.')', OC_Log::ERROR);
OC_Helper::rmdirr($extractDir);
if($data['source']=='http') {
unlink($path);
}
return false;
}
- OC_Helper::copyr($extractDir,$basedir);
+ OC_Helper::copyr($extractDir, $basedir);
//remove temporary files
OC_Helper::rmdirr($extractDir);
@@ -191,8 +191,8 @@ class OC_Installer{
}
//set the installed version
- OC_Appconfig::setValue($info['id'],'installed_version',OC_App::getAppVersion($info['id']));
- OC_Appconfig::setValue($info['id'],'enabled','no');
+ OC_Appconfig::setValue($info['id'], 'installed_version', OC_App::getAppVersion($info['id']));
+ OC_Appconfig::setValue($info['id'], 'enabled', 'no');
//set remote/public handelers
foreach($info['remote'] as $name=>$path) {
@@ -296,7 +296,7 @@ class OC_Installer{
$enabled = isset($info['default_enable']);
if( $enabled ) {
OC_Installer::installShippedApp($filename);
- OC_Appconfig::setValue($filename,'enabled','yes');
+ OC_Appconfig::setValue($filename, 'enabled', 'yes');
}
}
}
@@ -323,7 +323,7 @@ class OC_Installer{
include OC_App::getAppPath($app)."/appinfo/install.php";
}
$info=OC_App::getAppInfo($app);
- OC_Appconfig::setValue($app,'installed_version',OC_App::getAppVersion($app));
+ OC_Appconfig::setValue($app, 'installed_version', OC_App::getAppVersion($app));
//set remote/public handelers
foreach($info['remote'] as $name=>$path) {
@@ -360,7 +360,7 @@ class OC_Installer{
// check if grep is installed
$grep = exec('which grep');
if($grep=='') {
- OC_Log::write('core','grep not installed. So checking the code of the app "'.$appname.'" was not possible',OC_Log::ERROR);
+ OC_Log::write('core', 'grep not installed. So checking the code of the app "'.$appname.'" was not possible', OC_Log::ERROR);
return true;
}
@@ -370,7 +370,7 @@ class OC_Installer{
$result = exec($cmd);
// bad pattern found
if($result<>'') {
- OC_Log::write('core','App "'.$appname.'" is using a not allowed call "'.$bl.'". Installation refused.',OC_Log::ERROR);
+ OC_Log::write('core', 'App "'.$appname.'" is using a not allowed call "'.$bl.'". Installation refused.', OC_Log::ERROR);
return false;
}
}
diff --git a/lib/util.php b/lib/util.php
index 69f29f12228..789c75f4154 100755
--- a/lib/util.php
+++ b/lib/util.php
@@ -39,7 +39,7 @@ class OC_Util {
$CONFIG_DATADIRECTORY = OC_Config::getValue( "datadirectory", OC::$SERVERROOT."/data" );
//first set up the local "root" storage
if(!self::$rootMounted) {
- OC_Filesystem::mount('OC_Filestorage_Local', array('datadir'=>$CONFIG_DATADIRECTORY),'/');
+ OC_Filesystem::mount('OC_Filestorage_Local', array('datadir'=>$CONFIG_DATADIRECTORY), '/');
self::$rootMounted=true;
}
@@ -81,10 +81,10 @@ class OC_Util {
}
$mtime=filemtime($user_root.'/mount.php');
- $previousMTime=OC_Preferences::getValue($user,'files','mountconfigmtime',0);
+ $previousMTime=OC_Preferences::getValue($user, 'files', 'mountconfigmtime', 0);
if($mtime>$previousMTime) {//mount config has changed, filecache needs to be updated
OC_FileCache::triggerUpdate($user);
- OC_Preferences::setValue($user,'files','mountconfigmtime',$mtime);
+ OC_Preferences::setValue($user, 'files', 'mountconfigmtime', $mtime);
}
}
}
@@ -169,7 +169,7 @@ class OC_Util {
public static function formatDate( $timestamp,$dateOnly=false) {
if(isset($_SESSION['timezone'])) {//adjust to clients timezone if we know it
$systemTimeZone = intval(date('O'));
- $systemTimeZone=(round($systemTimeZone/100,0)*60)+($systemTimeZone%100);
+ $systemTimeZone=(round($systemTimeZone/100, 0)*60)+($systemTimeZone%100);
$clientTimeZone=$_SESSION['timezone']*60;
$offset=$clientTimeZone-$systemTimeZone;
$timestamp=$timestamp+$offset*60;
@@ -196,11 +196,11 @@ class OC_Util {
if($pagestop>$pagecount) $pagestop=$pagecount;
$tmpl = new OC_Template( '', 'part.pagenavi', '' );
- $tmpl->assign('page',$page);
- $tmpl->assign('pagecount',$pagecount);
- $tmpl->assign('pagestart',$pagestart);
- $tmpl->assign('pagestop',$pagestop);
- $tmpl->assign('url',$url);
+ $tmpl->assign('page', $page);
+ $tmpl->assign('pagecount', $pagecount);
+ $tmpl->assign('pagestart', $pagestart);
+ $tmpl->assign('pagestop', $pagestop);
+ $tmpl->assign('url', $url);
return $tmpl;
}
}
@@ -241,24 +241,24 @@ class OC_Util {
//check for correct file permissions
if(!stristr(PHP_OS, 'WIN')) {
$permissionsModHint="Please change the permissions to 0770 so that the directory cannot be listed by other users.";
- $prems=substr(decoct(@fileperms($CONFIG_DATADIRECTORY)),-3);
- if(substr($prems,-1)!='0') {
- OC_Helper::chmodr($CONFIG_DATADIRECTORY,0770);
+ $prems=substr(decoct(@fileperms($CONFIG_DATADIRECTORY)), -3);
+ if(substr($prems, -1)!='0') {
+ OC_Helper::chmodr($CONFIG_DATADIRECTORY, 0770);
clearstatcache();
- $prems=substr(decoct(@fileperms($CONFIG_DATADIRECTORY)),-3);
- if(substr($prems,2,1)!='0') {
- $errors[]=array('error'=>'Data directory ('.$CONFIG_DATADIRECTORY.') is readable for other users
','hint'=>$permissionsModHint);
+ $prems=substr(decoct(@fileperms($CONFIG_DATADIRECTORY)), -3);
+ if(substr($prems, 2, 1)!='0') {
+ $errors[]=array('error'=>'Data directory ('.$CONFIG_DATADIRECTORY.') is readable for other users
', 'hint'=>$permissionsModHint);
}
}
if( OC_Config::getValue( "enablebackup", false )) {
$CONFIG_BACKUPDIRECTORY = OC_Config::getValue( "backupdirectory", OC::$SERVERROOT."/backup" );
- $prems=substr(decoct(@fileperms($CONFIG_BACKUPDIRECTORY)),-3);
- if(substr($prems,-1)!='0') {
- OC_Helper::chmodr($CONFIG_BACKUPDIRECTORY,0770);
+ $prems=substr(decoct(@fileperms($CONFIG_BACKUPDIRECTORY)), -3);
+ if(substr($prems, -1)!='0') {
+ OC_Helper::chmodr($CONFIG_BACKUPDIRECTORY, 0770);
clearstatcache();
- $prems=substr(decoct(@fileperms($CONFIG_BACKUPDIRECTORY)),-3);
- if(substr($prems,2,1)!='0') {
- $errors[]=array('error'=>'Data directory ('.$CONFIG_BACKUPDIRECTORY.') is readable for other users
','hint'=>$permissionsModHint);
+ $prems=substr(decoct(@fileperms($CONFIG_BACKUPDIRECTORY)), -3);
+ if(substr($prems, 2, 1)!='0') {
+ $errors[]=array('error'=>'Data directory ('.$CONFIG_BACKUPDIRECTORY.') is readable for other users
', 'hint'=>$permissionsModHint);
}
}
}
@@ -391,7 +391,7 @@ class OC_Util {
// Check if we are a user
self::checkLoggedIn();
self::verifyUser();
- if(OC_Group::inGroup(OC_User::getUser(),'admin')) {
+ if(OC_Group::inGroup(OC_User::getUser(), 'admin')) {
return true;
}
if(!OC_SubAdmin::isSubAdmin(OC_User::getUser())) {
@@ -467,7 +467,7 @@ class OC_Util {
$id=OC_Config::getValue('instanceid', null);
if(is_null($id)) {
$id=uniqid();
- OC_Config::setValue('instanceid',$id);
+ OC_Config::setValue('instanceid', $id);
}
return $id;
}
@@ -504,10 +504,10 @@ class OC_Util {
// cleanup old tokens garbage collector
// only run every 20th time so we don't waste cpu cycles
- if(rand(0,20)==0) {
+ if(rand(0, 20)==0) {
foreach($_SESSION as $key=>$value) {
// search all tokens in the session
- if(substr($key,0,12)=='requesttoken') {
+ if(substr($key, 0, 12)=='requesttoken') {
// check if static lifespan has expired
if($value+self::$callLifespan