From 9d355f212413d7308f2ce0c3461a53036aa768a9 Mon Sep 17 00:00:00 2001 From: "Konstantin.Popov" Date: Fri, 17 Jan 2014 13:41:51 +0400 Subject: [PATCH 01/33] remove fix for IE9 nav bar width --- core/css/fixes.css | 5 ----- 1 file changed, 5 deletions(-) diff --git a/core/css/fixes.css b/core/css/fixes.css index 4ee854adde..a33afd5cf7 100644 --- a/core/css/fixes.css +++ b/core/css/fixes.css @@ -54,11 +54,6 @@ background-color: #1B314D; } -/* in IE9 the nav bar on the left side is too narrow and leave a white area - original width is 80px */ -.ie9 #navigation { - width: 100px; -} - /* IE8 isn't able to display transparent background. So it is specified using a gradient */ .ie8 #nojavascript { filter: progid:DXImageTransform.Microsoft.gradient(GradientType=0,startColorstr='#4c320000', endColorstr='#4c320000'); /* IE */ From 5f610a1cbc5a97bd4f097111536516f547a94fda Mon Sep 17 00:00:00 2001 From: Thomas Tanghus Date: Fri, 24 Jan 2014 16:40:32 +0100 Subject: [PATCH 02/33] Add missing slash in URLGenerator::getAbsoluteURL(). Refs. #6840 --- lib/private/urlgenerator.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/private/urlgenerator.php b/lib/private/urlgenerator.php index 4e3c110900..e618aef268 100644 --- a/lib/private/urlgenerator.php +++ b/lib/private/urlgenerator.php @@ -147,6 +147,6 @@ class URLGenerator implements IURLGenerator { * @return string the absolute version of the url */ public function getAbsoluteURL($url) { - return \OC_Request::serverProtocol() . '://' . \OC_Request::serverHost() . $url; + return \OC_Request::serverProtocol() . '://' . \OC_Request::serverHost() . '/' . $url; } } From a521949bafdaba0cb94061967b6b8307bbbebc05 Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Mon, 27 Jan 2014 15:41:56 +0100 Subject: [PATCH 03/33] Allow passing a root folder to get the used space from in the quota wrapper --- lib/private/files/storage/wrapper/quota.php | 8 +++++++- lib/private/util.php | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/lib/private/files/storage/wrapper/quota.php b/lib/private/files/storage/wrapper/quota.php index a430e3e461..83a5de5ca3 100644 --- a/lib/private/files/storage/wrapper/quota.php +++ b/lib/private/files/storage/wrapper/quota.php @@ -15,12 +15,18 @@ class Quota extends Wrapper { */ protected $quota; + /** + * @var string $freeSpaceRoot + */ + protected $sizeRoot; + /** * @param array $parameters */ public function __construct($parameters) { $this->storage = $parameters['storage']; $this->quota = $parameters['quota']; + $this->freeSpaceRoot = isset($parameters['root']) ? $parameters['root'] : ''; } protected function getSize($path) { @@ -43,7 +49,7 @@ class Quota extends Wrapper { if ($this->quota < 0) { return $this->storage->free_space($path); } else { - $used = $this->getSize(''); + $used = $this->getSize($this->freeSpaceRoot); if ($used < 0) { return \OC\Files\SPACE_NOT_COMPUTED; } else { diff --git a/lib/private/util.php b/lib/private/util.php index 8aa7a074d0..66a770a33d 100755 --- a/lib/private/util.php +++ b/lib/private/util.php @@ -65,7 +65,7 @@ class OC_Util { $user = $storage->getUser()->getUID(); $quota = OC_Util::getUserQuota($user); if ($quota !== \OC\Files\SPACE_UNLIMITED) { - return new \OC\Files\Storage\Wrapper\Quota(array('storage' => $storage, 'quota' => $quota)); + return new \OC\Files\Storage\Wrapper\Quota(array('storage' => $storage, 'quota' => $quota, 'root' => 'files')); } } From c8207312c73f61b2be4aa8ca1d9ae6a8c33453cf Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Mon, 27 Jan 2014 16:00:10 +0100 Subject: [PATCH 04/33] Fix phpdoc --- lib/private/files/storage/wrapper/quota.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/private/files/storage/wrapper/quota.php b/lib/private/files/storage/wrapper/quota.php index 83a5de5ca3..2fc3119fc7 100644 --- a/lib/private/files/storage/wrapper/quota.php +++ b/lib/private/files/storage/wrapper/quota.php @@ -16,7 +16,7 @@ class Quota extends Wrapper { protected $quota; /** - * @var string $freeSpaceRoot + * @var string $sizeRoot */ protected $sizeRoot; From 20c2aaab00e92d74547ccd6c964102e10ea34cbf Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Mon, 27 Jan 2014 16:26:54 +0100 Subject: [PATCH 05/33] Actually rename the variable --- lib/private/files/storage/wrapper/quota.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/private/files/storage/wrapper/quota.php b/lib/private/files/storage/wrapper/quota.php index 2fc3119fc7..1612740318 100644 --- a/lib/private/files/storage/wrapper/quota.php +++ b/lib/private/files/storage/wrapper/quota.php @@ -26,7 +26,7 @@ class Quota extends Wrapper { public function __construct($parameters) { $this->storage = $parameters['storage']; $this->quota = $parameters['quota']; - $this->freeSpaceRoot = isset($parameters['root']) ? $parameters['root'] : ''; + $this->sizeRoot = isset($parameters['root']) ? $parameters['root'] : ''; } protected function getSize($path) { @@ -49,7 +49,7 @@ class Quota extends Wrapper { if ($this->quota < 0) { return $this->storage->free_space($path); } else { - $used = $this->getSize($this->freeSpaceRoot); + $used = $this->getSize($this->sizeRoot); if ($used < 0) { return \OC\Files\SPACE_NOT_COMPUTED; } else { From 8cc97275200ec9b47d1cd0c38c88c0c076687104 Mon Sep 17 00:00:00 2001 From: Tigran Mkrtchyan Date: Wed, 15 Jan 2014 12:49:47 +0100 Subject: [PATCH 06/33] mount: make location of mount.json configurable do not share users data with config files Signed-off-by: Tigran Mkrtchyan --- apps/files_external/lib/config.php | 6 ++---- config/config.sample.php | 3 +++ lib/private/files/filesystem.php | 10 +++++----- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/apps/files_external/lib/config.php b/apps/files_external/lib/config.php index 01d588b372..3118e1ac68 100755 --- a/apps/files_external/lib/config.php +++ b/apps/files_external/lib/config.php @@ -352,9 +352,8 @@ class OC_Mount_Config { $phpFile = OC_User::getHome(OCP\User::getUser()).'/mount.php'; $jsonFile = OC_User::getHome(OCP\User::getUser()).'/mount.json'; } else { - $datadir = \OC_Config::getValue("datadirectory", \OC::$SERVERROOT . "/data"); $phpFile = OC::$SERVERROOT.'/config/mount.php'; - $jsonFile = $datadir . '/mount.json'; + $jsonFile = \OC_Config::getValue("mount_file", \OC::$SERVERROOT . "/data/mount.json"); } if (is_file($jsonFile)) { $mountPoints = json_decode(file_get_contents($jsonFile), true); @@ -379,8 +378,7 @@ class OC_Mount_Config { if ($isPersonal) { $file = OC_User::getHome(OCP\User::getUser()).'/mount.json'; } else { - $datadir = \OC_Config::getValue("datadirectory", \OC::$SERVERROOT . "/data"); - $file = $datadir . '/mount.json'; + $file = \OC_Config::getValue("mount_file", \OC::$SERVERROOT . "/data/mount.json"); } $content = json_encode($data); @file_put_contents($file, $content); diff --git a/config/config.sample.php b/config/config.sample.php index 01abc58368..5018a781f2 100755 --- a/config/config.sample.php +++ b/config/config.sample.php @@ -250,4 +250,7 @@ $CONFIG = array( /* whether usage of the instance should be restricted to admin users only */ 'singleuser' => false, + + /* where mount.json file should be stored, defaults to data/mount.json */ + 'mount_file' => '', ); diff --git a/lib/private/files/filesystem.php b/lib/private/files/filesystem.php index a83e9aa86d..f5e723afab 100644 --- a/lib/private/files/filesystem.php +++ b/lib/private/files/filesystem.php @@ -320,16 +320,16 @@ class Filesystem { else { self::mount('\OC\Files\Storage\Local', array('datadir' => $root), $user); } - $datadir = \OC_Config::getValue("datadirectory", \OC::$SERVERROOT . "/data"); + $mount_file = \OC_Config::getValue("mount_file", \OC::$SERVERROOT . "/data/mount.json"); //move config file to it's new position if (is_file(\OC::$SERVERROOT . '/config/mount.json')) { - rename(\OC::$SERVERROOT . '/config/mount.json', $datadir . '/mount.json'); + rename(\OC::$SERVERROOT . '/config/mount.json', $mount_file); } // Load system mount points - if (is_file(\OC::$SERVERROOT . '/config/mount.php') or is_file($datadir . '/mount.json')) { - if (is_file($datadir . '/mount.json')) { - $mountConfig = json_decode(file_get_contents($datadir . '/mount.json'), true); + if (is_file(\OC::$SERVERROOT . '/config/mount.php') or is_file($mount_file)) { + if (is_file($mount_file)) { + $mountConfig = json_decode(file_get_contents($mount_file), true); } elseif (is_file(\OC::$SERVERROOT . '/config/mount.php')) { $mountConfig = $parser->parsePHP(file_get_contents(\OC::$SERVERROOT . '/config/mount.php')); } From 3afdcd85e7d61c38ff8df909c317b73c2ed04353 Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Tue, 4 Feb 2014 16:05:12 +0100 Subject: [PATCH 07/33] Add unit test for quote wrapper size root --- tests/lib/files/storage/wrapper/quota.php | 25 ++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/tests/lib/files/storage/wrapper/quota.php b/tests/lib/files/storage/wrapper/quota.php index 87bafb64d4..6610103cc4 100644 --- a/tests/lib/files/storage/wrapper/quota.php +++ b/tests/lib/files/storage/wrapper/quota.php @@ -59,7 +59,7 @@ class Quota extends \Test\Files\Storage\Storage { $this->assertEquals('foobarqwe', $instance->file_get_contents('foo')); } - public function testReturnFalseWhenFopenFailed(){ + public function testReturnFalseWhenFopenFailed() { $failStorage = $this->getMock( '\OC\Files\Storage\Local', array('fopen'), @@ -73,7 +73,7 @@ class Quota extends \Test\Files\Storage\Storage { $this->assertFalse($instance->fopen('failedfopen', 'r')); } - public function testReturnRegularStreamOnRead(){ + public function testReturnRegularStreamOnRead() { $instance = $this->getLimitedStorage(9); // create test file first @@ -92,11 +92,30 @@ class Quota extends \Test\Files\Storage\Storage { fclose($stream); } - public function testReturnQuotaStreamOnWrite(){ + public function testReturnQuotaStreamOnWrite() { $instance = $this->getLimitedStorage(9); $stream = $instance->fopen('foo', 'w+'); $meta = stream_get_meta_data($stream); $this->assertEquals('user-space', $meta['wrapper_type']); fclose($stream); } + + public function testSpaceRoot() { + $storage = $this->getMockBuilder('\OC\Files\Storage\Local')->disableOriginalConstructor()->getMock(); + $cache = $this->getMockBuilder('\OC\Files\Cache\Cache')->disableOriginalConstructor()->getMock(); + $storage->expects($this->once()) + ->method('getCache') + ->will($this->returnValue($cache)); + $storage->expects($this->once()) + ->method('free_space') + ->will($this->returnValue(2048)); + $cache->expects($this->once()) + ->method('get') + ->with('files') + ->will($this->returnValue(array('size' => 50))); + + $instance = new \OC\Files\Storage\Wrapper\Quota(array('storage' => $storage, 'quota' => 1024, 'root' => 'files')); + + $this->assertEquals(1024 - 50, $instance->free_space('')); + } } From f830ad0e47df14e821161c49ab1b52694f74912a Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Tue, 4 Feb 2014 16:28:41 +0100 Subject: [PATCH 08/33] Don't create new thumbnails on the write hook --- lib/private/image.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/private/image.php b/lib/private/image.php index 7761a3c773..a6a2413f59 100644 --- a/lib/private/image.php +++ b/lib/private/image.php @@ -230,7 +230,7 @@ class OC_Image { } /** - * @returns Returns the image resource in any. + * @returns resource Returns the image resource in any. */ public function resource() { return $this->resource; From 2ff0d3a2552ea18e6e73a9de9332f89f723a1495 Mon Sep 17 00:00:00 2001 From: Thomas Tanghus Date: Fri, 7 Feb 2014 17:39:19 +0100 Subject: [PATCH 09/33] Test if $url is already prefixed by '/' --- lib/private/urlgenerator.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/private/urlgenerator.php b/lib/private/urlgenerator.php index e618aef268..60da34f2d6 100644 --- a/lib/private/urlgenerator.php +++ b/lib/private/urlgenerator.php @@ -147,6 +147,7 @@ class URLGenerator implements IURLGenerator { * @return string the absolute version of the url */ public function getAbsoluteURL($url) { - return \OC_Request::serverProtocol() . '://' . \OC_Request::serverHost() . '/' . $url; + $separator = $url[0] === '/' ? '' : '/'; + return \OC_Request::serverProtocol() . '://' . \OC_Request::serverHost() . $separator . $url; } } From d88c6778ff10ae6b0e5b2d40e56ec540a4e9d535 Mon Sep 17 00:00:00 2001 From: Arthur Schiwon Date: Fri, 14 Feb 2014 15:34:22 +0100 Subject: [PATCH 10/33] LDAP: prevent other configuration from being deleted when deleting the first one which has an empty prefix for historical reasons --- apps/user_ldap/lib/helper.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/apps/user_ldap/lib/helper.php b/apps/user_ldap/lib/helper.php index 9727d847d2..7de7fe8667 100644 --- a/apps/user_ldap/lib/helper.php +++ b/apps/user_ldap/lib/helper.php @@ -118,10 +118,16 @@ class Helper { return false; } + $saveOtherConfigurations = ''; + if(empty($prefix)) { + $saveOtherConfigurations = 'AND `Configkey` NOT LIKE \'s%\''; + } + $query = \OCP\DB::prepare(' DELETE FROM `*PREFIX*appconfig` WHERE `configkey` LIKE ? + '.$saveOtherConfigurations.' AND `appid` = \'user_ldap\' AND `configkey` NOT IN (\'enabled\', \'installed_version\', \'types\', \'bgjUpdateGroupsLastRun\') '); From c732764eb5159b893cdb97fc780937a883f48b58 Mon Sep 17 00:00:00 2001 From: Vincent Petry Date: Mon, 3 Feb 2014 18:00:39 +0100 Subject: [PATCH 11/33] Improve users list scrolling performance - fixed JS error when avatar mode is disabled - added spinner at the bottom of the table - scroll detection now happens earlier - single/multiselect init is deferred so that the new rows are first appended into the list (more responsive) and initialized afterwards - disabled users sorting after add (assuming they are always sorted on the server side) --- core/css/multiselect.css | 8 ++++- core/css/styles.css | 12 +++++++ settings/js/users.js | 77 +++++++++++++++++++++++++++------------- 3 files changed, 72 insertions(+), 25 deletions(-) diff --git a/core/css/multiselect.css b/core/css/multiselect.css index 60f2f47e69..8d949e7cdb 100644 --- a/core/css/multiselect.css +++ b/core/css/multiselect.css @@ -48,7 +48,7 @@ ul.multiselectoptions > li input[type='checkbox']:checked+label { font-weight: bold; } -div.multiselect { +div.multiselect, select.multiselect { display: inline-block; max-width: 400px; min-width: 150px; @@ -58,6 +58,12 @@ div.multiselect { vertical-align: bottom; } +/* To make a select look like a multiselect until it's initialized */ +select.multiselect { + height: 30px; + min-width: 113px; +} + div.multiselect.active { background-color: #fff; position: relative; diff --git a/core/css/styles.css b/core/css/styles.css index bee44785f1..cbfab618ec 100644 --- a/core/css/styles.css +++ b/core/css/styles.css @@ -933,3 +933,15 @@ div.crumb:active { opacity:.7; } +.appear { + opacity: 1; + transition: opacity 500ms ease 0s; + -moz-transition: opacity 500ms ease 0s; + -ms-transition: opacity 500ms ease 0s; + -o-transition: opacity 500ms ease 0s; + -webkit-transition: opacity 500ms ease 0s; +} +.appear.transparent { + opacity: 0; +} + diff --git a/settings/js/users.js b/settings/js/users.js index 6886db668b..a6edc02e16 100644 --- a/settings/js/users.js +++ b/settings/js/users.js @@ -85,19 +85,24 @@ var UserList = { add: function (username, displayname, groups, subadmin, quota, sort) { var tr = $('tbody tr').first().clone(); - if (tr.find('div.avatardiv')){ + var subadminsEl; + var subadminSelect; + var groupsSelect; + if (tr.find('div.avatardiv').length){ $('div.avatardiv', tr).avatar(username, 32); } tr.attr('data-uid', username); tr.attr('data-displayName', displayname); tr.find('td.name').text(username); tr.find('td.displayName > span').text(displayname); - var groupsSelect = $('') + + // make them look like the multiselect buttons + // until they get time to really get initialized + groupsSelect = $('') .attr('data-username', username) .data('user-groups', groups); - tr.find('td.groups').empty(); if (tr.find('td.subadmins').length > 0) { - var subadminSelect = $('') .attr('data-username', username) .data('user-groups', groups) .data('subadmin', subadmin); @@ -109,11 +114,10 @@ var UserList = { subadminSelect.append($('')); } }); - tr.find('td.groups').append(groupsSelect); - UserList.applyMultiplySelect(groupsSelect); - if (tr.find('td.subadmins').length > 0) { - tr.find('td.subadmins').append(subadminSelect); - UserList.applyMultiplySelect(subadminSelect); + tr.find('td.groups').empty().append(groupsSelect); + subadminsEl = tr.find('td.subadmins'); + if (subadminsEl.length > 0) { + subadminsEl.append(subadminSelect); } if (tr.find('td.remove img').length === 0 && OC.currentUser !== username) { var rm_img = $('').attr({ @@ -139,11 +143,11 @@ var UserList = { } } $(tr).appendTo('tbody'); + if (sort) { UserList.doSort(); } - quotaSelect.singleSelect(); quotaSelect.on('change', function () { var uid = $(this).parent().parent().attr('data-uid'); var quota = $(this).val(); @@ -153,6 +157,16 @@ var UserList = { } }); }); + + // defer init so the user first sees the list appear more quickly + window.setTimeout(function(){ + quotaSelect.singleSelect(); + UserList.applyMultiplySelect(groupsSelect); + if (subadminSelect) { + UserList.applyMultiplySelect(subadminSelect); + } + }, 0); + return tr; }, // From http://my.opera.com/GreyWyvern/blog/show.dml/1671288 alphanum: function(a, b) { @@ -211,26 +225,34 @@ var UserList = { } UserList.updating = true; $.get(OC.Router.generate('settings_ajax_userlist', { offset: UserList.offset, limit: UserList.usersToLoad }), function (result) { + var loadedUsers = 0; + var trs = []; if (result.status === 'success') { //The offset does not mirror the amount of users available, //because it is backend-dependent. For correct retrieval, //always the limit(requested amount of users) needs to be added. - UserList.offset += UserList.usersToLoad; $.each(result.data, function (index, user) { if($('tr[data-uid="' + user.name + '"]').length > 0) { return true; } var tr = UserList.add(user.name, user.displayname, user.groups, user.subadmin, user.quota, false); - if (index === 9) { - $(tr).bind('inview', function (event, isInView, visiblePartX, visiblePartY) { - $(this).unbind(event); - UserList.update(); - }); - } + tr.addClass('appear transparent'); + trs.push(tr); + loadedUsers++; }); if (result.data.length > 0) { UserList.doSort(); } + else { + UserList.noMoreEntries = true; + } + UserList.offset += loadedUsers; + // animate + setTimeout(function() { + for (var i = 0; i < trs.length; i++) { + trs[i].removeClass('transparent'); + } + }, 0); } UserList.updating = false; }); @@ -239,7 +261,7 @@ var UserList = { applyMultiplySelect: function (element) { var checked = []; var user = element.attr('data-username'); - if ($(element).attr('class') === 'groupsselect') { + if ($(element).hasClass('groupsselect')) { if (element.data('userGroups')) { checked = element.data('userGroups'); } @@ -295,7 +317,7 @@ var UserList = { minWidth: 100 }); } - if ($(element).attr('class') === 'subadminsselect') { + if ($(element).hasClass('subadminsselect')) { if (element.data('subadmin')) { checked = element.data('subadmin'); } @@ -330,17 +352,24 @@ var UserList = { minWidth: 100 }); } - } + }, + + _onScroll: function(e) { + if (!!UserList.noMoreEntries) { + return; + } + if ($(window).scrollTop() + $(window).height() > $(document).height() - 500) { + UserList.update(true); + } + }, }; $(document).ready(function () { UserList.doSort(); UserList.availableGroups = $('#content table').data('groups'); - $('tbody tr:last').bind('inview', function (event, isInView, visiblePartX, visiblePartY) { - OC.Router.registerLoadedCallback(function () { - UserList.update(); - }); + OC.Router.registerLoadedCallback(function() { + $(window).scroll(function(e) {UserList._onScroll(e);}); }); $('select[multiple]').each(function (index, element) { From 58b1dc5e76bb18ebae7e980566153b04cd1c76b2 Mon Sep 17 00:00:00 2001 From: Vincent Petry Date: Tue, 18 Feb 2014 10:52:05 +0100 Subject: [PATCH 12/33] Added loading spinner to users list on scroll --- settings/js/users.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/settings/js/users.js b/settings/js/users.js index a6edc02e16..1028a003bc 100644 --- a/settings/js/users.js +++ b/settings/js/users.js @@ -223,6 +223,7 @@ var UserList = { if (UserList.updating) { return; } + $('table+.loading').css('visibility', 'visible'); UserList.updating = true; $.get(OC.Router.generate('settings_ajax_userlist', { offset: UserList.offset, limit: UserList.usersToLoad }), function (result) { var loadedUsers = 0; @@ -242,9 +243,11 @@ var UserList = { }); if (result.data.length > 0) { UserList.doSort(); + $('table+.loading').css('visibility', 'hidden'); } else { UserList.noMoreEntries = true; + $('table+.loading').remove(); } UserList.offset += loadedUsers; // animate @@ -371,6 +374,7 @@ $(document).ready(function () { OC.Router.registerLoadedCallback(function() { $(window).scroll(function(e) {UserList._onScroll(e);}); }); + $('table').after($('')); $('select[multiple]').each(function (index, element) { UserList.applyMultiplySelect($(element)); From 937a25593b1e342bca2878eb6f45158bee9edd7c Mon Sep 17 00:00:00 2001 From: Jan-Christoph Borchardt Date: Wed, 19 Feb 2014 16:27:38 +0100 Subject: [PATCH 13/33] fix lots of file type icons for archives, js, flash, ics, fonts, code, ... --- ...ascript.png => application-javascript.png} | Bin ...ascript.svg => application-javascript.svg} | 0 ....png => application-x-shockwave-flash.png} | Bin ....svg => application-x-shockwave-flash.svg} | 0 .../{calendar.png => text-calendar.png} | Bin .../{calendar.svg => text-calendar.svg} | 0 lib/private/helper.php | 26 +++++++++++++++++- lib/private/mimetypes.list.php | 12 +++++++- 8 files changed, 36 insertions(+), 2 deletions(-) rename core/img/filetypes/{text-x-javascript.png => application-javascript.png} (100%) rename core/img/filetypes/{text-x-javascript.svg => application-javascript.svg} (100%) rename core/img/filetypes/{flash.png => application-x-shockwave-flash.png} (100%) rename core/img/filetypes/{flash.svg => application-x-shockwave-flash.svg} (100%) rename core/img/filetypes/{calendar.png => text-calendar.png} (100%) rename core/img/filetypes/{calendar.svg => text-calendar.svg} (100%) diff --git a/core/img/filetypes/text-x-javascript.png b/core/img/filetypes/application-javascript.png similarity index 100% rename from core/img/filetypes/text-x-javascript.png rename to core/img/filetypes/application-javascript.png diff --git a/core/img/filetypes/text-x-javascript.svg b/core/img/filetypes/application-javascript.svg similarity index 100% rename from core/img/filetypes/text-x-javascript.svg rename to core/img/filetypes/application-javascript.svg diff --git a/core/img/filetypes/flash.png b/core/img/filetypes/application-x-shockwave-flash.png similarity index 100% rename from core/img/filetypes/flash.png rename to core/img/filetypes/application-x-shockwave-flash.png diff --git a/core/img/filetypes/flash.svg b/core/img/filetypes/application-x-shockwave-flash.svg similarity index 100% rename from core/img/filetypes/flash.svg rename to core/img/filetypes/application-x-shockwave-flash.svg diff --git a/core/img/filetypes/calendar.png b/core/img/filetypes/text-calendar.png similarity index 100% rename from core/img/filetypes/calendar.png rename to core/img/filetypes/text-calendar.png diff --git a/core/img/filetypes/calendar.svg b/core/img/filetypes/text-calendar.svg similarity index 100% rename from core/img/filetypes/calendar.svg rename to core/img/filetypes/text-calendar.svg diff --git a/lib/private/helper.php b/lib/private/helper.php index e5d1fa9b51..9b5bf0652a 100644 --- a/lib/private/helper.php +++ b/lib/private/helper.php @@ -152,7 +152,28 @@ class OC_Helper { public static function mimetypeIcon($mimetype) { $alias = array( 'application/octet-stream' => 'file', // use file icon as fallback - 'application/xml' => 'code/xml', + + 'application/illustrator' => 'image', + 'application/coreldraw' => 'image', + 'application/x-gimp' => 'image', + 'application/x-photoshop' => 'image', + + 'application/x-font-ttf' => 'font', + 'application/font-woff' => 'font', + 'application/vnd.ms-fontobject' => 'font', + + 'application/json' => 'text/code', + 'application/x-php' => 'text/code', + 'application/xml' => 'text/html', + 'text/css' => 'text/code', + + 'application/x-compressed' => 'package/x-generic', + 'application/x-7z-compressed' => 'package/x-generic', + 'application/x-deb' => 'package/x-generic', + 'application/x-rar-compressed' => 'package/x-generic', + 'application/x-tar' => 'package/x-generic', + 'application/zip' => 'package/x-generic', + 'application/msword' => 'x-office/document', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document' => 'x-office/document', 'application/vnd.openxmlformats-officedocument.wordprocessingml.template' => 'x-office/document', @@ -162,6 +183,7 @@ class OC_Helper { 'application/vnd.oasis.opendocument.text-template' => 'x-office/document', 'application/vnd.oasis.opendocument.text-web' => 'x-office/document', 'application/vnd.oasis.opendocument.text-master' => 'x-office/document', + 'application/mspowerpoint' => 'x-office/presentation', 'application/vnd.ms-powerpoint' => 'x-office/presentation', 'application/vnd.openxmlformats-officedocument.presentationml.presentation' => 'x-office/presentation', @@ -173,6 +195,7 @@ class OC_Helper { 'application/vnd.ms-powerpoint.slideshow.macroEnabled.12' => 'x-office/presentation', 'application/vnd.oasis.opendocument.presentation' => 'x-office/presentation', 'application/vnd.oasis.opendocument.presentation-template' => 'x-office/presentation', + 'application/msexcel' => 'x-office/spreadsheet', 'application/vnd.ms-excel' => 'x-office/spreadsheet', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' => 'x-office/spreadsheet', @@ -183,6 +206,7 @@ class OC_Helper { 'application/vnd.ms-excel.sheet.binary.macroEnabled.12' => 'x-office/spreadsheet', 'application/vnd.oasis.opendocument.spreadsheet' => 'x-office/spreadsheet', 'application/vnd.oasis.opendocument.spreadsheet-template' => 'x-office/spreadsheet', + 'application/msaccess' => 'database', ); diff --git a/lib/private/mimetypes.list.php b/lib/private/mimetypes.list.php index 174877d623..7bf061172c 100644 --- a/lib/private/mimetypes.list.php +++ b/lib/private/mimetypes.list.php @@ -24,11 +24,13 @@ * Array mapping file extensions to mimetypes (in alphabetical order). */ return array( + '7z' => 'application/x-7z-compressed', 'accdb'=>'application/msaccess', 'ai' => 'application/illustrator', 'avi'=>'video/x-msvideo', 'bash' => 'text/x-shellscript', 'blend'=>'application/x-blender', + 'bin' => 'application/x-bin', 'cb7' => 'application/x-cbr', 'cba' => 'application/x-cbr', 'cbr' => 'application/x-cbr', @@ -42,11 +44,13 @@ return array( 'cvbdl' => 'application/x-cbr', 'c' => 'text/x-c', 'c++' => 'text/x-c++src', + 'deb' => 'application/x-deb', 'doc'=>'application/msword', 'docx'=>'application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'dot'=>'application/msword', 'dotx'=>'application/vnd.openxmlformats-officedocument.wordprocessingml.template', 'dv'=>'video/dv', + 'eot' => 'application/vnd.ms-fontobject', 'epub' => 'application/epub+zip', 'exe'=>'application/x-ms-dos-executable', 'flac'=>'audio/flac', @@ -61,6 +65,7 @@ return array( 'jpeg'=>'image/jpeg', 'jpg'=>'image/jpeg', 'js'=>'application/javascript', + 'json' => 'application/json', 'keynote'=>'application/x-iwork-keynote-sffkey', 'kra'=>'application/x-krita', 'm2t'=>'video/mp2t', @@ -85,6 +90,7 @@ return array( 'oga'=>'audio/ogg', 'ogg'=>'audio/ogg', 'ogv'=>'video/ogg', + 'otf'=>'font/opentype', 'pages'=>'application/x-iwork-pages-sffpages', 'pdf'=>'application/pdf', 'php'=>'application/x-php', @@ -93,22 +99,26 @@ return array( 'ppt'=>'application/mspowerpoint', 'pptx'=>'application/vnd.openxmlformats-officedocument.presentationml.presentation', 'psd'=>'application/x-photoshop', - 'py'=>'text/x-script.python', + 'py'=>'text/x-python', + 'rar' => 'application/x-rar-compressed', 'reveal' => 'text/reveal', 'sgf' => 'application/sgf', 'sh-lib' => 'text/x-shellscript', 'sh' => 'text/x-shellscript', 'svg'=>'image/svg+xml', + 'swf' => 'application/x-shockwave-flash', 'tar'=>'application/x-tar', 'tar.gz'=>'application/x-compressed', 'tgz'=>'application/x-compressed', 'tiff'=>'image/tiff', 'tif'=>'image/tiff', + 'ttf'=>'application/x-font-ttf', 'txt'=>'text/plain', 'vcard' => 'text/vcard', 'vcf' => 'text/vcard', 'wav'=>'audio/wav', 'webm'=>'video/webm', + 'woff' => 'application/font-woff', 'wmv'=>'video/x-ms-asf', 'xcf'=>'application/x-gimp', 'xls'=>'application/msexcel', From cac4652c10763715fa5cdf46a71b2b8714b865d4 Mon Sep 17 00:00:00 2001 From: Jan-Christoph Borchardt Date: Wed, 19 Feb 2014 16:28:29 +0100 Subject: [PATCH 14/33] coding style: spaces around => --- lib/private/mimetypes.list.php | 132 ++++++++++++++++----------------- 1 file changed, 66 insertions(+), 66 deletions(-) diff --git a/lib/private/mimetypes.list.php b/lib/private/mimetypes.list.php index 7bf061172c..ff2a7ecc48 100644 --- a/lib/private/mimetypes.list.php +++ b/lib/private/mimetypes.list.php @@ -25,11 +25,11 @@ */ return array( '7z' => 'application/x-7z-compressed', - 'accdb'=>'application/msaccess', + 'accdb' => 'application/msaccess', 'ai' => 'application/illustrator', - 'avi'=>'video/x-msvideo', + 'avi' => 'video/x-msvideo', 'bash' => 'text/x-shellscript', - 'blend'=>'application/x-blender', + 'blend' => 'application/x-blender', 'bin' => 'application/x-bin', 'cb7' => 'application/x-cbr', 'cba' => 'application/x-cbr', @@ -40,89 +40,89 @@ return array( 'cc' => 'text/x-c', 'cdr' => 'application/coreldraw', 'cpp' => 'text/x-c++src', - 'css'=>'text/css', + 'css' => 'text/css', 'cvbdl' => 'application/x-cbr', 'c' => 'text/x-c', 'c++' => 'text/x-c++src', 'deb' => 'application/x-deb', - 'doc'=>'application/msword', - 'docx'=>'application/vnd.openxmlformats-officedocument.wordprocessingml.document', - 'dot'=>'application/msword', - 'dotx'=>'application/vnd.openxmlformats-officedocument.wordprocessingml.template', - 'dv'=>'video/dv', + 'doc' => 'application/msword', + 'docx' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', + 'dot' => 'application/msword', + 'dotx' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.template', + 'dv' => 'video/dv', 'eot' => 'application/vnd.ms-fontobject', 'epub' => 'application/epub+zip', - 'exe'=>'application/x-ms-dos-executable', - 'flac'=>'audio/flac', - 'gif'=>'image/gif', - 'gz'=>'application/x-gzip', - 'gzip'=>'application/x-gzip', - 'html'=>'text/html', - 'htm'=>'text/html', - 'ical'=>'text/calendar', - 'ics'=>'text/calendar', + 'exe' => 'application/x-ms-dos-executable', + 'flac' => 'audio/flac', + 'gif' => 'image/gif', + 'gz' => 'application/x-gzip', + 'gzip' => 'application/x-gzip', + 'html' => 'text/html', + 'htm' => 'text/html', + 'ical' => 'text/calendar', + 'ics' => 'text/calendar', 'impress' => 'text/impress', - 'jpeg'=>'image/jpeg', - 'jpg'=>'image/jpeg', - 'js'=>'application/javascript', + 'jpeg' => 'image/jpeg', + 'jpg' => 'image/jpeg', + 'js' => 'application/javascript', 'json' => 'application/json', - 'keynote'=>'application/x-iwork-keynote-sffkey', - 'kra'=>'application/x-krita', - 'm2t'=>'video/mp2t', - 'm4v'=>'video/mp4', + 'keynote' => 'application/x-iwork-keynote-sffkey', + 'kra' => 'application/x-krita', + 'm2t' => 'video/mp2t', + 'm4v' => 'video/mp4', 'markdown' => 'text/markdown', 'mdown' => 'text/markdown', 'md' => 'text/markdown', - 'mdb'=>'application/msaccess', + 'mdb' => 'application/msaccess', 'mdwn' => 'text/markdown', 'mobi' => 'application/x-mobipocket-ebook', - 'mov'=>'video/quicktime', - 'mp3'=>'audio/mpeg', - 'mp4'=>'video/mp4', - 'mpeg'=>'video/mpeg', - 'mpg'=>'video/mpeg', - 'msi'=>'application/x-msi', - 'numbers'=>'application/x-iwork-numbers-sffnumbers', - 'odg'=>'application/vnd.oasis.opendocument.graphics', - 'odp'=>'application/vnd.oasis.opendocument.presentation', - 'ods'=>'application/vnd.oasis.opendocument.spreadsheet', - 'odt'=>'application/vnd.oasis.opendocument.text', - 'oga'=>'audio/ogg', - 'ogg'=>'audio/ogg', - 'ogv'=>'video/ogg', - 'otf'=>'font/opentype', - 'pages'=>'application/x-iwork-pages-sffpages', - 'pdf'=>'application/pdf', - 'php'=>'application/x-php', - 'pl'=>'application/x-pearl', - 'png'=>'image/png', - 'ppt'=>'application/mspowerpoint', - 'pptx'=>'application/vnd.openxmlformats-officedocument.presentationml.presentation', - 'psd'=>'application/x-photoshop', - 'py'=>'text/x-python', + 'mov' => 'video/quicktime', + 'mp3' => 'audio/mpeg', + 'mp4' => 'video/mp4', + 'mpeg' => 'video/mpeg', + 'mpg' => 'video/mpeg', + 'msi' => 'application/x-msi', + 'numbers' => 'application/x-iwork-numbers-sffnumbers', + 'odg' => 'application/vnd.oasis.opendocument.graphics', + 'odp' => 'application/vnd.oasis.opendocument.presentation', + 'ods' => 'application/vnd.oasis.opendocument.spreadsheet', + 'odt' => 'application/vnd.oasis.opendocument.text', + 'oga' => 'audio/ogg', + 'ogg' => 'audio/ogg', + 'ogv' => 'video/ogg', + 'otf' => 'font/opentype', + 'pages' => 'application/x-iwork-pages-sffpages', + 'pdf' => 'application/pdf', + 'php' => 'application/x-php', + 'pl' => 'application/x-pearl', + 'png' => 'image/png', + 'ppt' => 'application/mspowerpoint', + 'pptx' => 'application/vnd.openxmlformats-officedocument.presentationml.presentation', + 'psd' => 'application/x-photoshop', + 'py' => 'text/x-python', 'rar' => 'application/x-rar-compressed', 'reveal' => 'text/reveal', 'sgf' => 'application/sgf', 'sh-lib' => 'text/x-shellscript', 'sh' => 'text/x-shellscript', - 'svg'=>'image/svg+xml', + 'svg' => 'image/svg+xml', 'swf' => 'application/x-shockwave-flash', - 'tar'=>'application/x-tar', - 'tar.gz'=>'application/x-compressed', - 'tgz'=>'application/x-compressed', - 'tiff'=>'image/tiff', - 'tif'=>'image/tiff', - 'ttf'=>'application/x-font-ttf', - 'txt'=>'text/plain', + 'tar' => 'application/x-tar', + 'tar.gz' => 'application/x-compressed', + 'tgz' => 'application/x-compressed', + 'tiff' => 'image/tiff', + 'tif' => 'image/tiff', + 'ttf' => 'application/x-font-ttf', + 'txt' => 'text/plain', 'vcard' => 'text/vcard', 'vcf' => 'text/vcard', - 'wav'=>'audio/wav', - 'webm'=>'video/webm', + 'wav' => 'audio/wav', + 'webm' => 'video/webm', 'woff' => 'application/font-woff', - 'wmv'=>'video/x-ms-asf', - 'xcf'=>'application/x-gimp', - 'xls'=>'application/msexcel', - 'xlsx'=>'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', - 'xml'=>'application/xml', - 'zip'=>'application/zip', + 'wmv' => 'video/x-ms-asf', + 'xcf' => 'application/x-gimp', + 'xls' => 'application/msexcel', + 'xlsx' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', + 'xml' => 'application/xml', + 'zip' => 'application/zip', ); From 16cbfd03834b844019f79d1e5cbdd2756b21aacf Mon Sep 17 00:00:00 2001 From: kondou Date: Wed, 19 Feb 2014 16:44:08 +0100 Subject: [PATCH 15/33] Optimize images --- core/img/filetypes/application-javascript.png | Bin 1340 -> 1243 bytes core/img/filetypes/application-javascript.svg | 91 ++++++++-------- .../application-x-shockwave-flash.png | Bin 954 -> 880 bytes .../application-x-shockwave-flash.svg | 38 +++---- core/img/filetypes/text-calendar.png | Bin 1333 -> 1226 bytes core/img/filetypes/text-calendar.svg | 101 +++++++++--------- 6 files changed, 108 insertions(+), 122 deletions(-) diff --git a/core/img/filetypes/application-javascript.png b/core/img/filetypes/application-javascript.png index 24d09ce978181c4b08b67c879553a75fc3c1e97a..1e1d3140f63cf6bde1b015abd154e351da0d16d7 100644 GIT binary patch delta 1224 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 g(j5tR0sO!92~YZ|W + - + - - - + + + - + - - - + + + - + - + - - - + + + - + - + - - - - + + + + - - - - - + + + + + - + - - + + - + - - - - image/svg+xml - - - - - - - - - - - - - - - + + + + + + + + + + + + + + diff --git a/core/img/filetypes/application-x-shockwave-flash.png b/core/img/filetypes/application-x-shockwave-flash.png index bcde641da3ca196a8212a5b6d91a62013f1430ab..75424f81d68477d9b2744b14a3b36d05d6787538 100644 GIT binary patch delta 10 RcmdnR{()_R^2S_WW&juN1K9uo delta 83 zcmeyswu^m&vIhf8v6E*A2N2Y7q;xPaFmM)lL>4nJ@LmUDMkkHg6+l7B64!{5;QX|b i^2DN4hVt@qz0ADq;^f4FRK5J7^x5xhq&6!0GXnsmnHaAC diff --git a/core/img/filetypes/application-x-shockwave-flash.svg b/core/img/filetypes/application-x-shockwave-flash.svg index cb823703d9..b373fd6512 100644 --- a/core/img/filetypes/application-x-shockwave-flash.svg +++ b/core/img/filetypes/application-x-shockwave-flash.svg @@ -5,56 +5,52 @@ - + - + - - - + + + - + - + - + - + - - - - - - - - - + + + + + - - - + + + diff --git a/core/img/filetypes/text-calendar.png b/core/img/filetypes/text-calendar.png index d85b1db651c258b22d7707dbdf57a19bc92f832a..d5c666a7695a0fa157806dff11aa3113bc0e1f13 100644 GIT binary patch delta 1217 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 diff --git a/core/img/filetypes/text-calendar.svg b/core/img/filetypes/text-calendar.svg index 0016749b93..7d62bb8fa1 100644 --- a/core/img/filetypes/text-calendar.svg +++ b/core/img/filetypes/text-calendar.svg @@ -1,94 +1,89 @@ - + - + - + - + - - - + + + - + - - - + + + - + - - + + - + - - - + + + - + - + - + - + - + - + - + - - - - image/svg+xml - - - - - - - - - - - + + + + + + - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + From 513940f4a4e97a3a46f9becdb24d8c964b92fb86 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Wed, 19 Feb 2014 17:07:29 +0100 Subject: [PATCH 16/33] Correctly redirect to settings page when not selecting cert file for upload Fix #5463 --- apps/files_external/ajax/addRootCertificate.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/files_external/ajax/addRootCertificate.php b/apps/files_external/ajax/addRootCertificate.php index ae349bfcd3..fcd3a617ad 100644 --- a/apps/files_external/ajax/addRootCertificate.php +++ b/apps/files_external/ajax/addRootCertificate.php @@ -4,7 +4,7 @@ OCP\JSON::checkAppEnabled('files_external'); OCP\JSON::callCheck(); if ( ! ($filename = $_FILES['rootcert_import']['name']) ) { - header("Location: settings/personal.php"); + header('Location:' . OCP\Util::linkToRoute( "settings_personal" )); exit; } From 16262e3fd2c00475cc3b43a2684a45cc8ae70829 Mon Sep 17 00:00:00 2001 From: Lukas Reschke Date: Wed, 19 Feb 2014 17:56:12 +0100 Subject: [PATCH 17/33] Move isadmin to template and rename it to oc_isadmin --- core/js/js.js | 1 + core/templates/layout.user.php | 2 +- settings/js/isadmin.php | 20 -------------------- settings/js/users.js | 4 ++-- settings/routes.php | 2 -- settings/templates/users.php | 2 -- 6 files changed, 4 insertions(+), 27 deletions(-) delete mode 100644 settings/js/isadmin.php diff --git a/core/js/js.js b/core/js/js.js index d4d2583f1e..3b3e0e9945 100644 --- a/core/js/js.js +++ b/core/js/js.js @@ -10,6 +10,7 @@ var oc_webroot; var oc_current_user = document.getElementsByTagName('head')[0].getAttribute('data-user'); var oc_requesttoken = document.getElementsByTagName('head')[0].getAttribute('data-requesttoken'); +var oc_isadmin = document.getElementsByTagName('head')[0].getAttribute('data-isAdmin'); window.oc_config = window.oc_config || {}; diff --git a/core/templates/layout.user.php b/core/templates/layout.user.php index bc1c700402..d46f97852c 100644 --- a/core/templates/layout.user.php +++ b/core/templates/layout.user.php @@ -6,7 +6,7 @@ - + <?php p(!empty($_['application'])?$_['application'].' - ':''); diff --git a/settings/js/isadmin.php b/settings/js/isadmin.php deleted file mode 100644 index 13a8ba1d31..0000000000 --- a/settings/js/isadmin.php +++ /dev/null @@ -1,20 +0,0 @@ -<?php -/** - * Copyright (c) 2013 Lukas Reschke <lukas@statuscode.ch> - * This file is licensed under the Affero General Public License version 3 or - * later. - * See the COPYING-README file. - */ - -// Set the content type to Javascript -header("Content-type: text/javascript"); - -// Disallow caching -header("Cache-Control: no-cache, must-revalidate"); -header("Expires: Sat, 26 Jul 1997 05:00:00 GMT"); - -if (OC_User::isAdminUser(OC_User::getUser())) { - echo("var isadmin = true;"); -} else { - echo("var isadmin = false;"); -} diff --git a/settings/js/users.js b/settings/js/users.js index 6886db668b..9872fb27e6 100644 --- a/settings/js/users.js +++ b/settings/js/users.js @@ -248,7 +248,7 @@ var UserList = { if (user === OC.currentUser && group === 'admin') { return false; } - if (!isadmin && checked.length === 1 && checked[0] === group) { + if (!oc_isadmin && checked.length === 1 && checked[0] === group) { return false; } $.post( @@ -280,7 +280,7 @@ var UserList = { }); }; var label; - if (isadmin) { + if (oc_isadmin) { label = t('settings', 'add group'); } else { label = null; diff --git a/settings/routes.php b/settings/routes.php index 60f9d8e100..895a9f5cce 100644 --- a/settings/routes.php +++ b/settings/routes.php @@ -72,5 +72,3 @@ $this->create('settings_ajax_setloglevel', '/settings/ajax/setloglevel.php') ->actionInclude('settings/ajax/setloglevel.php'); $this->create('settings_ajax_setsecurity', '/settings/ajax/setsecurity.php') ->actionInclude('settings/ajax/setsecurity.php'); -$this->create('isadmin', '/settings/js/isadmin.js') - ->actionInclude('settings/js/isadmin.php'); diff --git a/settings/templates/users.php b/settings/templates/users.php index aabda0fac2..937b40611b 100644 --- a/settings/templates/users.php +++ b/settings/templates/users.php @@ -14,8 +14,6 @@ unset($items['admin']); $_['subadmingroups'] = array_flip($items); ?> -<script type="text/javascript" src="<?php print_unescaped(OC_Helper::linkToRoute('isadmin'));?>"></script> - <div id="controls"> <form id="newuser" autocomplete="off"> <input id="newusername" type="text" placeholder="<?php p($l->t('Login Name'))?>" /> <input From b61f0f11c5aa03240d3c18f02a1c790bd43522c0 Mon Sep 17 00:00:00 2001 From: Lukas Reschke <lukas@statuscode.ch> Date: Thu, 20 Feb 2014 10:26:05 +0100 Subject: [PATCH 18/33] Move oc_isadmin to the config JS script --- core/js/config.php | 1 + core/js/js.js | 1 - core/templates/layout.user.php | 2 +- 3 files changed, 2 insertions(+), 2 deletions(-) diff --git a/core/js/config.php b/core/js/config.php index b6875fb73f..6185be523e 100644 --- a/core/js/config.php +++ b/core/js/config.php @@ -24,6 +24,7 @@ foreach(OC_App::getEnabledApps() as $app) { $array = array( "oc_debug" => (defined('DEBUG') && DEBUG) ? 'true' : 'false', + "ox_isadmin" => p(OC_User::isAdminUser(OC_User::getUser()) ? 'true' : 'false'); "oc_webroot" => "\"".OC::$WEBROOT."\"", "oc_appswebroots" => str_replace('\\/', '/', json_encode($apps_paths)), // Ugly unescape slashes waiting for better solution "datepickerFormatDate" => json_encode($l->l('jsdate', 'jsdate')), diff --git a/core/js/js.js b/core/js/js.js index 3b3e0e9945..d4d2583f1e 100644 --- a/core/js/js.js +++ b/core/js/js.js @@ -10,7 +10,6 @@ var oc_webroot; var oc_current_user = document.getElementsByTagName('head')[0].getAttribute('data-user'); var oc_requesttoken = document.getElementsByTagName('head')[0].getAttribute('data-requesttoken'); -var oc_isadmin = document.getElementsByTagName('head')[0].getAttribute('data-isAdmin'); window.oc_config = window.oc_config || {}; diff --git a/core/templates/layout.user.php b/core/templates/layout.user.php index d46f97852c..bc1c700402 100644 --- a/core/templates/layout.user.php +++ b/core/templates/layout.user.php @@ -6,7 +6,7 @@ <!--[if gt IE 9]><html class="ng-csp ie"><![endif]--> <!--[if !IE]><!--><html class="ng-csp"><!--<![endif]--> - <head data-isAdmin="<?php p(OC_User::isAdminUser(OC_User::getUser()) ? 'true' : 'false'); ?>" data-user="<?php p($_['user_uid']); ?>" data-requesttoken="<?php p($_['requesttoken']); ?>"> + <head data-user="<?php p($_['user_uid']); ?>" data-requesttoken="<?php p($_['requesttoken']); ?>"> <title> <?php p(!empty($_['application'])?$_['application'].' - ':''); From ba7a79372a1e7f29f8f9de015fcc8500b6fed8dc Mon Sep 17 00:00:00 2001 From: Lukas Reschke <lukas@statuscode.ch> Date: Thu, 20 Feb 2014 10:28:11 +0100 Subject: [PATCH 19/33] Variable value is expected and not an echoed output --- core/js/config.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/js/config.php b/core/js/config.php index 6185be523e..a9fd9d0109 100644 --- a/core/js/config.php +++ b/core/js/config.php @@ -24,7 +24,7 @@ foreach(OC_App::getEnabledApps() as $app) { $array = array( "oc_debug" => (defined('DEBUG') && DEBUG) ? 'true' : 'false', - "ox_isadmin" => p(OC_User::isAdminUser(OC_User::getUser()) ? 'true' : 'false'); + "ox_isadmin" => OC_User::isAdminUser(OC_User::getUser()) ? 'true' : 'false', "oc_webroot" => "\"".OC::$WEBROOT."\"", "oc_appswebroots" => str_replace('\\/', '/', json_encode($apps_paths)), // Ugly unescape slashes waiting for better solution "datepickerFormatDate" => json_encode($l->l('jsdate', 'jsdate')), From a6fb6abbe015b6c2fa643da94884fc1ec2fdb336 Mon Sep 17 00:00:00 2001 From: Jan-Christoph Borchardt <hey@jancborchardt.net> Date: Thu, 20 Feb 2014 10:34:40 +0100 Subject: [PATCH 20/33] fix filetype icons for gzip, tex, perl, csv, sh --- lib/private/helper.php | 5 +++++ lib/private/mimetypes.list.php | 4 +++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/private/helper.php b/lib/private/helper.php index 9b5bf0652a..1aab2f296e 100644 --- a/lib/private/helper.php +++ b/lib/private/helper.php @@ -163,13 +163,17 @@ class OC_Helper { 'application/vnd.ms-fontobject' => 'font', 'application/json' => 'text/code', + 'application/x-perl' => 'text/code', 'application/x-php' => 'text/code', + 'text/x-shellscript' => 'text/code', 'application/xml' => 'text/html', 'text/css' => 'text/code', + 'application/x-tex' => 'text', 'application/x-compressed' => 'package/x-generic', 'application/x-7z-compressed' => 'package/x-generic', 'application/x-deb' => 'package/x-generic', + 'application/x-gzip' => 'package/x-generic', 'application/x-rar-compressed' => 'package/x-generic', 'application/x-tar' => 'package/x-generic', 'application/zip' => 'package/x-generic', @@ -206,6 +210,7 @@ class OC_Helper { 'application/vnd.ms-excel.sheet.binary.macroEnabled.12' => 'x-office/spreadsheet', 'application/vnd.oasis.opendocument.spreadsheet' => 'x-office/spreadsheet', 'application/vnd.oasis.opendocument.spreadsheet-template' => 'x-office/spreadsheet', + 'text/csv' => 'x-office/spreadsheet', 'application/msaccess' => 'database', ); diff --git a/lib/private/mimetypes.list.php b/lib/private/mimetypes.list.php index ff2a7ecc48..9bd07b8902 100644 --- a/lib/private/mimetypes.list.php +++ b/lib/private/mimetypes.list.php @@ -41,6 +41,7 @@ return array( 'cdr' => 'application/coreldraw', 'cpp' => 'text/x-c++src', 'css' => 'text/css', + 'csv' => 'text/csv', 'cvbdl' => 'application/x-cbr', 'c' => 'text/x-c', 'c++' => 'text/x-c++src', @@ -94,7 +95,7 @@ return array( 'pages' => 'application/x-iwork-pages-sffpages', 'pdf' => 'application/pdf', 'php' => 'application/x-php', - 'pl' => 'application/x-pearl', + 'pl' => 'application/x-perl', 'png' => 'image/png', 'ppt' => 'application/mspowerpoint', 'pptx' => 'application/vnd.openxmlformats-officedocument.presentationml.presentation', @@ -109,6 +110,7 @@ return array( 'swf' => 'application/x-shockwave-flash', 'tar' => 'application/x-tar', 'tar.gz' => 'application/x-compressed', + 'tex' => 'application/x-tex', 'tgz' => 'application/x-compressed', 'tiff' => 'image/tiff', 'tif' => 'image/tiff', From 3e2c56157bfb20fbc48bdf668bd56fb47bd7cc1f Mon Sep 17 00:00:00 2001 From: Jan-Christoph Borchardt <hey@jancborchardt.net> Date: Thu, 20 Feb 2014 11:33:46 +0100 Subject: [PATCH 21/33] reduce width of searchbox on mobile, fix overlap, fix #7282 --- core/css/mobile.css | 20 ++++++++++++++++++++ core/css/styles.css | 10 ++++++---- lib/base.php | 1 + 3 files changed, 27 insertions(+), 4 deletions(-) create mode 100644 core/css/mobile.css diff --git a/core/css/mobile.css b/core/css/mobile.css new file mode 100644 index 0000000000..a4cca6f37f --- /dev/null +++ b/core/css/mobile.css @@ -0,0 +1,20 @@ +@media only screen and (max-width: 600px) { + +/* compress search box on mobile, expand when focused */ +.searchbox input[type="search"] { + width: 17%; + -webkit-transition: width 100ms; + -moz-transition: width 100ms; + -o-transition: width 100ms; + transition: width 100ms; +} +.searchbox input[type="search"]:focus, +.searchbox input[type="search"]:active { + width: 155px; + -webkit-transition: width 100ms; + -moz-transition: width 100ms; + -o-transition: width 100ms; + transition: width 100ms; +} + +} diff --git a/core/css/styles.css b/core/css/styles.css index bee44785f1..c17d0a9bc0 100644 --- a/core/css/styles.css +++ b/core/css/styles.css @@ -205,17 +205,19 @@ textarea:disabled { color: #bbb; } - +/* Searchbox */ .searchbox input[type="search"] { + position: relative; font-size: 1.2em; - padding: .2em .5em .2em 1.5em; + padding-left: 1.5em; background: #fff url('../img/actions/search.svg') no-repeat .5em center; border: 0; - border-radius: 1em; + border-radius: 2em; -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=70)"; filter:alpha(opacity=70); opacity: .7; - margin-top: 10px; + margin-top: 6px; float: right; } + input[type="submit"].enabled { background: #66f866; border: 1px solid #5e5; diff --git a/lib/base.php b/lib/base.php index a5f064bdb4..84177c7ba6 100644 --- a/lib/base.php +++ b/lib/base.php @@ -332,6 +332,7 @@ class OC { } OC_Util::addStyle("styles"); + OC_Util::addStyle("mobile"); OC_Util::addStyle("icons"); OC_Util::addStyle("apps"); OC_Util::addStyle("fixes"); From 169f4cf7ff26932ec1e07bfc3676f22c06859db7 Mon Sep 17 00:00:00 2001 From: Lukas Reschke <lukas@statuscode.ch> Date: Thu, 20 Feb 2014 12:51:15 +0100 Subject: [PATCH 22/33] Fix typo --- core/js/config.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/js/config.php b/core/js/config.php index a9fd9d0109..139c3b6d48 100644 --- a/core/js/config.php +++ b/core/js/config.php @@ -24,7 +24,7 @@ foreach(OC_App::getEnabledApps() as $app) { $array = array( "oc_debug" => (defined('DEBUG') && DEBUG) ? 'true' : 'false', - "ox_isadmin" => OC_User::isAdminUser(OC_User::getUser()) ? 'true' : 'false', + "oc_isadmin" => OC_User::isAdminUser(OC_User::getUser()) ? 'true' : 'false', "oc_webroot" => "\"".OC::$WEBROOT."\"", "oc_appswebroots" => str_replace('\\/', '/', json_encode($apps_paths)), // Ugly unescape slashes waiting for better solution "datepickerFormatDate" => json_encode($l->l('jsdate', 'jsdate')), From 92d57cb5a7de41e576c9cbd3fae70e9802561187 Mon Sep 17 00:00:00 2001 From: Jan-Christoph Borchardt <hey@jancborchardt.net> Date: Thu, 20 Feb 2014 13:36:52 +0100 Subject: [PATCH 23/33] move avatar into clickable area of user menu --- core/css/styles.css | 8 ++++---- core/js/js.js | 4 +++- core/templates/layout.user.php | 6 +++--- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/core/css/styles.css b/core/css/styles.css index c17d0a9bc0..1c80a3ea16 100644 --- a/core/css/styles.css +++ b/core/css/styles.css @@ -37,11 +37,12 @@ body { background:#fefefe; font:normal .8em/1.6em "Helvetica Neue",Helvetica,Ari .header-right { float:right; vertical-align:middle; padding:0.5em; } .header-right > * { vertical-align:middle; } +/* Profile picture in header */ #header .avatardiv { float: left; display: inline-block; + margin-right: 5px; } - #header .avatardiv img { opacity: 1; } @@ -708,12 +709,11 @@ label.infield { cursor:text !important; top:1.05em; left:.85em; } /* USER MENU */ #settings { float: right; - margin-top: 7px; - margin-left: 10px; color: #bbb; } #expand { - padding: 15px 15px 15px 5px; + display: block; + padding: 7px 12px 6px 7px; cursor: pointer; font-weight: bold; } diff --git a/core/js/js.js b/core/js/js.js index d4d2583f1e..59d4880641 100644 --- a/core/js/js.js +++ b/core/js/js.js @@ -860,6 +860,7 @@ function initCore() { // checkShowCredentials(); // $('input#user, input#password').keyup(checkShowCredentials); + // user menu $('#settings #expand').keydown(function(event) { if (event.which === 13 || event.which === 32) { $('#expand').click() @@ -872,7 +873,8 @@ function initCore() { $('#settings #expanddiv').click(function(event){ event.stopPropagation(); }); - $(document).click(function(){//hide the settings menu when clicking outside it + //hide the user menu when clicking outside it + $(document).click(function(){ $('#settings #expanddiv').slideUp(200); }); diff --git a/core/templates/layout.user.php b/core/templates/layout.user.php index bc1c700402..8b9e1e0f4f 100644 --- a/core/templates/layout.user.php +++ b/core/templates/layout.user.php @@ -50,12 +50,12 @@ <div id="logo-claim" style="display:none;"><?php p($theme->getLogoClaim()); ?></div> <div id="settings" class="svg"> <span id="expand" tabindex="0" role="link"> + <?php if ($_['enableAvatars']): ?> + <div class="avatardiv"></div> + <?php endif; ?> <span id="expandDisplayName"><?php p(trim($_['user_displayname']) != '' ? $_['user_displayname'] : $_['user_uid']) ?></span> <img class="svg" alt="" src="<?php print_unescaped(image_path('', 'actions/caret.svg')); ?>" /> </span> - <?php if ($_['enableAvatars']): ?> - <div class="avatardiv"></div> - <?php endif; ?> <div id="expanddiv"> <ul> <?php foreach($_['settingsnavigation'] as $entry):?> From 20b740f8e4674ab16f44127bc809a35b8db24910 Mon Sep 17 00:00:00 2001 From: Jan-Christoph Borchardt <hey@jancborchardt.net> Date: Thu, 20 Feb 2014 13:37:23 +0100 Subject: [PATCH 24/33] do not show display name on mobile when profile picture is present --- core/css/mobile.css | 6 ++++++ core/js/avatar.js | 9 ++++++++- core/js/jquery.avatar.js | 10 +++++++++- settings/js/personal.js | 2 ++ 4 files changed, 25 insertions(+), 2 deletions(-) diff --git a/core/css/mobile.css b/core/css/mobile.css index a4cca6f37f..65c756aa91 100644 --- a/core/css/mobile.css +++ b/core/css/mobile.css @@ -17,4 +17,10 @@ transition: width 100ms; } +/* do not show display name on mobile when profile picture is present */ +#header .avatardiv.avatardiv-shown + #expandDisplayName { + display: none; +} + + } diff --git a/core/js/avatar.js b/core/js/avatar.js index c54c406876..67d6b9b7b9 100644 --- a/core/js/avatar.js +++ b/core/js/avatar.js @@ -1,6 +1,13 @@ $(document).ready(function(){ if (OC.currentUser) { - $('#header .avatardiv').avatar(OC.currentUser, 32, undefined, true); + var callback = function() { + // do not show display name on mobile when profile picture is present + if($('#header .avatardiv').children().length > 0) { + $('#header .avatardiv').addClass('avatardiv-shown'); + } + }; + + $('#header .avatardiv').avatar(OC.currentUser, 32, undefined, true, callback); // Personal settings $('#avatar .avatardiv').avatar(OC.currentUser, 128); } diff --git a/core/js/jquery.avatar.js b/core/js/jquery.avatar.js index 6012eccfad..02a40c088b 100644 --- a/core/js/jquery.avatar.js +++ b/core/js/jquery.avatar.js @@ -39,10 +39,15 @@ * This will behave like the first example, but it will hide the avatardiv, if * it will display the default placeholder. undefined is the ie8fix from * example 4 and can be either true, or false/undefined, to be ignored. + * + * 6. $('.avatardiv').avatar('jdoe', 128, undefined, true, callback); + * This will behave like the above example, but it will call the function + * defined in callback after the avatar is placed into the DOM. + * */ (function ($) { - $.fn.avatar = function(user, size, ie8fix, hidedefault) { + $.fn.avatar = function(user, size, ie8fix, hidedefault, callback) { if (typeof(size) === 'undefined') { if (this.height() > 0) { size = this.height(); @@ -91,6 +96,9 @@ $div.html('<img src="'+url+'">'); } } + if(typeof callback === 'function') { + callback(); + } }); }); }; diff --git a/settings/js/personal.js b/settings/js/personal.js index ef261b50bb..5944272067 100644 --- a/settings/js/personal.js +++ b/settings/js/personal.js @@ -52,9 +52,11 @@ function updateAvatar (hidedefault) { if(hidedefault) { $headerdiv.hide(); + $('#header .avatardiv').removeClass('avatardiv-shown'); } else { $headerdiv.css({'background-color': ''}); $headerdiv.avatar(OC.currentUser, 32, true); + $('#header .avatardiv').addClass('avatardiv-shown'); } $displaydiv.css({'background-color': ''}); $displaydiv.avatar(OC.currentUser, 128, true); From d5690a174e42ad97cf7e9bffa3b62f42b69f6a82 Mon Sep 17 00:00:00 2001 From: Arthur Schiwon <blizzz@owncloud.com> Date: Thu, 20 Feb 2014 14:05:45 +0100 Subject: [PATCH 25/33] LDAP: fix and extend tests --- apps/user_ldap/tests/access.php | 71 ++++++++++++++++++++ apps/user_ldap/tests/user_ldap.php | 101 ++++++++++++++++++++++++++++- 2 files changed, 169 insertions(+), 3 deletions(-) create mode 100644 apps/user_ldap/tests/access.php diff --git a/apps/user_ldap/tests/access.php b/apps/user_ldap/tests/access.php new file mode 100644 index 0000000000..9beb2b9733 --- /dev/null +++ b/apps/user_ldap/tests/access.php @@ -0,0 +1,71 @@ +<?php +/** +* ownCloud +* +* @author Arthur Schiwon +* @copyright 2013 Arthur Schiwon blizzz@owncloud.com +* +* This library is free software; you can redistribute it and/or +* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE +* License as published by the Free Software Foundation; either +* version 3 of the License, or any later version. +* +* This library is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU AFFERO GENERAL PUBLIC LICENSE for more details. +* +* You should have received a copy of the GNU Affero General Public +* License along with this library. If not, see <http://www.gnu.org/licenses/>. +* +*/ + +namespace OCA\user_ldap\tests; + +use \OCA\user_ldap\lib\Access; +use \OCA\user_ldap\lib\Connection; +use \OCA\user_ldap\lib\ILDAPWrapper; + +class Test_Access extends \PHPUnit_Framework_TestCase { + private function getConnecterAndLdapMock() { + static $conMethods; + static $accMethods; + + if(is_null($conMethods) || is_null($accMethods)) { + $conMethods = get_class_methods('\OCA\user_ldap\lib\Connection'); + $accMethods = get_class_methods('\OCA\user_ldap\lib\Access'); + } + $lw = $this->getMock('\OCA\user_ldap\lib\ILDAPWrapper'); + $connector = $this->getMock('\OCA\user_ldap\lib\Connection', + $conMethods, + array($lw, null, null)); + + return array($lw, $connector); + } + + public function testEscapeFilterPartValidChars() { + list($lw, $con) = $this->getConnecterAndLdapMock(); + $access = new Access($con, $lw); + + $input = 'okay'; + $this->assertTrue($input === $access->escapeFilterPart($input)); + } + + public function testEscapeFilterPartEscapeWildcard() { + list($lw, $con) = $this->getConnecterAndLdapMock(); + $access = new Access($con, $lw); + + $input = '*'; + $expected = '\\\\*'; + $this->assertTrue($expected === $access->escapeFilterPart($input)); + } + + public function testEscapeFilterPartEscapeWildcard2() { + list($lw, $con) = $this->getConnecterAndLdapMock(); + $access = new Access($con, $lw); + + $input = 'foo*bar'; + $expected = 'foo\\\\*bar'; + $this->assertTrue($expected === $access->escapeFilterPart($input)); + } +} \ No newline at end of file diff --git a/apps/user_ldap/tests/user_ldap.php b/apps/user_ldap/tests/user_ldap.php index 9193a005ae..8c8d85b3c3 100644 --- a/apps/user_ldap/tests/user_ldap.php +++ b/apps/user_ldap/tests/user_ldap.php @@ -83,6 +83,12 @@ class Test_User_Ldap_Direct extends \PHPUnit_Framework_TestCase { * @return void */ private function prepareAccessForCheckPassword(&$access) { + $access->expects($this->once()) + ->method('escapeFilterPart') + ->will($this->returnCallback(function($uid) { + return $uid; + })); + $access->connection->expects($this->any()) ->method('__get') ->will($this->returnCallback(function($name) { @@ -116,17 +122,34 @@ class Test_User_Ldap_Direct extends \PHPUnit_Framework_TestCase { })); } - public function testCheckPassword() { + public function testCheckPasswordUidReturn() { $access = $this->getAccessMock(); + $this->prepareAccessForCheckPassword($access); $backend = new UserLDAP($access); \OC_User::useBackend($backend); $result = $backend->checkPassword('roland', 'dt19'); $this->assertEquals('gunslinger', $result); + } + + public function testCheckPasswordWrongPassword() { + $access = $this->getAccessMock(); + + $this->prepareAccessForCheckPassword($access); + $backend = new UserLDAP($access); + \OC_User::useBackend($backend); $result = $backend->checkPassword('roland', 'wrong'); $this->assertFalse($result); + } + + public function testCheckPasswordWrongUser() { + $access = $this->getAccessMock(); + + $this->prepareAccessForCheckPassword($access); + $backend = new UserLDAP($access); + \OC_User::useBackend($backend); $result = $backend->checkPassword('mallory', 'evil'); $this->assertFalse($result); @@ -140,9 +163,23 @@ class Test_User_Ldap_Direct extends \PHPUnit_Framework_TestCase { $result = \OCP\User::checkPassword('roland', 'dt19'); $this->assertEquals('gunslinger', $result); + } + + public function testCheckPasswordPublicAPIWrongPassword() { + $access = $this->getAccessMock(); + $this->prepareAccessForCheckPassword($access); + $backend = new UserLDAP($access); + \OC_User::useBackend($backend); $result = \OCP\User::checkPassword('roland', 'wrong'); $this->assertFalse($result); + } + + public function testCheckPasswordPublicAPIWrongUser() { + $access = $this->getAccessMock(); + $this->prepareAccessForCheckPassword($access); + $backend = new UserLDAP($access); + \OC_User::useBackend($backend); $result = \OCP\User::checkPassword('mallory', 'evil'); $this->assertFalse($result); @@ -154,6 +191,12 @@ class Test_User_Ldap_Direct extends \PHPUnit_Framework_TestCase { * @return void */ private function prepareAccessForGetUsers(&$access) { + $access->expects($this->once()) + ->method('escapeFilterPart') + ->will($this->returnCallback(function($search) { + return $search; + })); + $access->expects($this->any()) ->method('getFilterPartForUserSearch') ->will($this->returnCallback(function($search) { @@ -191,28 +234,52 @@ class Test_User_Ldap_Direct extends \PHPUnit_Framework_TestCase { ->will($this->returnArgument(0)); } - public function testGetUsers() { + public function testGetUsersNoParam() { $access = $this->getAccessMock(); $this->prepareAccessForGetUsers($access); $backend = new UserLDAP($access); $result = $backend->getUsers(); $this->assertEquals(3, count($result)); + } + + public function testGetUsersLimitOffset() { + $access = $this->getAccessMock(); + $this->prepareAccessForGetUsers($access); + $backend = new UserLDAP($access); $result = $backend->getUsers('', 1, 2); $this->assertEquals(1, count($result)); + } + + public function testGetUsersLimitOffset2() { + $access = $this->getAccessMock(); + $this->prepareAccessForGetUsers($access); + $backend = new UserLDAP($access); $result = $backend->getUsers('', 2, 1); $this->assertEquals(2, count($result)); + } + + public function testGetUsersSearchWithResult() { + $access = $this->getAccessMock(); + $this->prepareAccessForGetUsers($access); + $backend = new UserLDAP($access); $result = $backend->getUsers('yo'); $this->assertEquals(2, count($result)); + } + + public function testGetUsersSearchEmptyResult() { + $access = $this->getAccessMock(); + $this->prepareAccessForGetUsers($access); + $backend = new UserLDAP($access); $result = $backend->getUsers('nix'); $this->assertEquals(0, count($result)); } - public function testGetUsersViaAPI() { + public function testGetUsersViaAPINoParam() { $access = $this->getAccessMock(); $this->prepareAccessForGetUsers($access); $backend = new UserLDAP($access); @@ -220,15 +287,43 @@ class Test_User_Ldap_Direct extends \PHPUnit_Framework_TestCase { $result = \OCP\User::getUsers(); $this->assertEquals(3, count($result)); + } + + public function testGetUsersViaAPILimitOffset() { + $access = $this->getAccessMock(); + $this->prepareAccessForGetUsers($access); + $backend = new UserLDAP($access); + \OC_User::useBackend($backend); $result = \OCP\User::getUsers('', 1, 2); $this->assertEquals(1, count($result)); + } + + public function testGetUsersViaAPILimitOffset2() { + $access = $this->getAccessMock(); + $this->prepareAccessForGetUsers($access); + $backend = new UserLDAP($access); + \OC_User::useBackend($backend); $result = \OCP\User::getUsers('', 2, 1); $this->assertEquals(2, count($result)); + } + + public function testGetUsersViaAPISearchWithResult() { + $access = $this->getAccessMock(); + $this->prepareAccessForGetUsers($access); + $backend = new UserLDAP($access); + \OC_User::useBackend($backend); $result = \OCP\User::getUsers('yo'); $this->assertEquals(2, count($result)); + } + + public function testGetUsersViaAPISearchEmptyResult() { + $access = $this->getAccessMock(); + $this->prepareAccessForGetUsers($access); + $backend = new UserLDAP($access); + \OC_User::useBackend($backend); $result = \OCP\User::getUsers('nix'); $this->assertEquals(0, count($result)); From d329049e5396cdbd488a9a6a93308d19484b97bd Mon Sep 17 00:00:00 2001 From: Robin Appelman <icewind@owncloud.com> Date: Thu, 20 Feb 2014 14:51:23 +0100 Subject: [PATCH 26/33] Remove no longer needed if statement --- remote.php | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/remote.php b/remote.php index 8e7eaa7963..9e18c8f80a 100644 --- a/remote.php +++ b/remote.php @@ -32,11 +32,7 @@ try { default: OC_Util::checkAppEnabled($app); OC_App::loadApp($app); - if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') { - $file = OC_App::getAppPath($app) .'/'. $parts[1]; - }else{ - $file = OC_App::getAppPath($app) .'/'. $parts[1]; - } + $file = OC_App::getAppPath($app) .'/'. $parts[1]; break; } $baseuri = OC::$WEBROOT . '/remote.php/'.$service.'/'; From d46645846985fe181fcb252bec158624a1ee2957 Mon Sep 17 00:00:00 2001 From: Jan-Christoph Borchardt <hey@jancborchardt.net> Date: Thu, 20 Feb 2014 17:37:48 +0100 Subject: [PATCH 27/33] restrict zooming in to not mangle layout accidentally --- core/templates/layout.user.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/templates/layout.user.php b/core/templates/layout.user.php index 8b9e1e0f4f..9e1555cfe6 100644 --- a/core/templates/layout.user.php +++ b/core/templates/layout.user.php @@ -15,7 +15,7 @@ - + From d9bb21146f1169eb7e5a3617c23695e395aaee91 Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Thu, 20 Feb 2014 18:14:40 +0100 Subject: [PATCH 28/33] fix IE10 viewport sizeing --- core/css/styles.css | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/core/css/styles.css b/core/css/styles.css index 0be0eaf344..22ba60dd2b 100644 --- a/core/css/styles.css +++ b/core/css/styles.css @@ -958,3 +958,8 @@ div.crumb:active { opacity: 0; } +/* for IE10 */ +@-ms-viewport { + width: device-width; +} + From d5739e83d16dd4af1865999180c7867a7f77734f Mon Sep 17 00:00:00 2001 From: Jan-Christoph Borchardt Date: Thu, 20 Feb 2014 18:38:33 +0100 Subject: [PATCH 29/33] remove additional transition rule, reduce width of collapsed search bar --- core/css/mobile.css | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/core/css/mobile.css b/core/css/mobile.css index 65c756aa91..a63aa902d3 100644 --- a/core/css/mobile.css +++ b/core/css/mobile.css @@ -2,7 +2,7 @@ /* compress search box on mobile, expand when focused */ .searchbox input[type="search"] { - width: 17%; + width: 15%; -webkit-transition: width 100ms; -moz-transition: width 100ms; -o-transition: width 100ms; @@ -11,10 +11,6 @@ .searchbox input[type="search"]:focus, .searchbox input[type="search"]:active { width: 155px; - -webkit-transition: width 100ms; - -moz-transition: width 100ms; - -o-transition: width 100ms; - transition: width 100ms; } /* do not show display name on mobile when profile picture is present */ From 1ae6e9ec21415ade8122a05d01dd091091cb4bcd Mon Sep 17 00:00:00 2001 From: Bjoern Schiessle Date: Thu, 20 Feb 2014 18:50:27 +0100 Subject: [PATCH 30/33] add unit test for \OC\URLGenerator::getAbsoluteURL to verify #6935 --- tests/lib/urlgenerator.php | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 tests/lib/urlgenerator.php diff --git a/tests/lib/urlgenerator.php b/tests/lib/urlgenerator.php new file mode 100644 index 0000000000..875a7f0658 --- /dev/null +++ b/tests/lib/urlgenerator.php @@ -0,0 +1,34 @@ + + * This file is licensed under the Affero General Public License version 3 or + * later. + * See the COPYING-README file. + */ + +class Test_Urlgenerator extends PHPUnit_Framework_TestCase { + + + /** + * @small + * @brief test absolute URL construction + * @dataProvider provideURLs + */ + function testGetAbsoluteURL($url, $expectedResult) { + + $urlGenerator = new \OC\URLGenerator(null); + $result = $urlGenerator->getAbsoluteURL($url); + + $this->assertEquals($expectedResult, $result); + } + + public function provideURLs() { + return array( + array("index.php", "http://localhost/index.php"), + array("/index.php", "http://localhost/index.php"), + array("/apps/index.php", "http://localhost/apps/index.php"), + array("apps/index.php", "http://localhost/apps/index.php"), + ); + } +} + From 69325c5eebef1f21b514a5edeb48d71d53815668 Mon Sep 17 00:00:00 2001 From: Lukas Reschke Date: Fri, 21 Feb 2014 08:11:07 +0100 Subject: [PATCH 31/33] Move session_regenerate_id to `login()` --- lib/private/user.php | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/private/user.php b/lib/private/user.php index 08ead71202..a89b7286c1 100644 --- a/lib/private/user.php +++ b/lib/private/user.php @@ -227,6 +227,7 @@ class OC_User { * Log in a user and regenerate a new session - if the password is ok */ public static function login($uid, $password) { + session_regenerate_id(true); return self::getUserSession()->login($uid, $password); } From f7fa8662e21fdb93383e771ba629f82d8344582a Mon Sep 17 00:00:00 2001 From: Lukas Reschke Date: Fri, 21 Feb 2014 08:12:45 +0100 Subject: [PATCH 32/33] Remove `session_id_regenerate` from here Jenkins somewhat complains that there are already sent headers. --- lib/private/user/session.php | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/private/user/session.php b/lib/private/user/session.php index cd03b30205..1740bad5ab 100644 --- a/lib/private/user/session.php +++ b/lib/private/user/session.php @@ -157,7 +157,6 @@ class Session implements Emitter, \OCP\IUserSession { if($user !== false) { if (!is_null($user)) { if ($user->isEnabled()) { - session_regenerate_id(true); $this->setUser($user); $this->setLoginName($uid); $this->manager->emit('\OC\User', 'postLogin', array($user, $password)); From 229356348826402e4dc8090e1a805f278d6c9ad0 Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Fri, 21 Feb 2014 10:02:03 +0100 Subject: [PATCH 33/33] Remove unit tests which causes the filesystem tests to fail --- tests/lib/connector/sabre/file.php | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/tests/lib/connector/sabre/file.php b/tests/lib/connector/sabre/file.php index 50b8711a90..c2f0ffa12d 100644 --- a/tests/lib/connector/sabre/file.php +++ b/tests/lib/connector/sabre/file.php @@ -48,21 +48,6 @@ class Test_OC_Connector_Sabre_File extends PHPUnit_Framework_TestCase { $etag = $file->put('test data'); } - /** - * Test setting name with setName() - */ - public function testSetName() { - // setup - $file = new OC_Connector_Sabre_File('/test.txt'); - $file->fileView = $this->getMock('\OC\Files\View', array('isUpdatable'), array(), '', FALSE); - $file->fileView->expects($this->any())->method('isUpdatable')->withAnyParameters()->will($this->returnValue(true)); - $etag = $file->put('test data'); - $file->setName('/renamed.txt'); - $this->assertTrue($file->fileView->file_exists('/renamed.txt')); - // clean up - $file->delete(); - } - /** * Test setting name with setName() with invalid chars * @expectedException Sabre_DAV_Exception_BadRequest