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 @@
+.
+*
+*/
+
+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));
diff --git a/config/config.sample.php b/config/config.sample.php
index 9f47ee3294..9c5eca8a5e 100755
--- a/config/config.sample.php
+++ b/config/config.sample.php
@@ -53,6 +53,9 @@ $CONFIG = array(
/* The optional authentication for the proxy to use to connect to the internet. The format is: [username]:[password] */
"proxyuserpwd" => "",
+/* List of trusted domains, to prevent host header poisoning ownCloud is only using these Host headers */
+'trusted_domains' => array('demo.owncloud.org'),
+
/* Theme to use for ownCloud */
"theme" => "",
@@ -264,6 +267,9 @@ $CONFIG = array(
/* whether usage of the instance should be restricted to admin users only */
'singleuser' => false,
+/* all css and js files will be served by the web server statically in one js file and ons css file*/
+'asset-pipeline.enabled' => false,
+
/* where mount.json file should be stored, defaults to data/mount.json */
'mount_file' => '',
);
diff --git a/core/ajax/preview.php b/core/ajax/preview.php
index a1267d6f5c..526719e8a1 100644
--- a/core/ajax/preview.php
+++ b/core/ajax/preview.php
@@ -7,34 +7,39 @@
*/
\OC_Util::checkLoggedIn();
-$file = array_key_exists('file', $_GET) ? (string) $_GET['file'] : '';
-$maxX = array_key_exists('x', $_GET) ? (int) $_GET['x'] : '36';
-$maxY = array_key_exists('y', $_GET) ? (int) $_GET['y'] : '36';
-$scalingUp = array_key_exists('scalingup', $_GET) ? (bool) $_GET['scalingup'] : true;
+$file = array_key_exists('file', $_GET) ? (string)$_GET['file'] : '';
+$maxX = array_key_exists('x', $_GET) ? (int)$_GET['x'] : '36';
+$maxY = array_key_exists('y', $_GET) ? (int)$_GET['y'] : '36';
+$scalingUp = array_key_exists('scalingup', $_GET) ? (bool)$_GET['scalingup'] : true;
+$always = array_key_exists('forceIcon', $_GET) ? (bool)$_GET['forceIcon'] : true;
-if($file === '') {
+if ($file === '') {
//400 Bad Request
\OC_Response::setStatus(400);
\OC_Log::write('core-preview', 'No file parameter was passed', \OC_Log::DEBUG);
exit;
}
-if($maxX === 0 || $maxY === 0) {
+if ($maxX === 0 || $maxY === 0) {
//400 Bad Request
\OC_Response::setStatus(400);
\OC_Log::write('core-preview', 'x and/or y set to 0', \OC_Log::DEBUG);
exit;
}
-try{
+try {
$preview = new \OC\Preview(\OC_User::getUser(), 'files');
- $preview->setFile($file);
- $preview->setMaxX($maxX);
- $preview->setMaxY($maxY);
- $preview->setScalingUp($scalingUp);
+ if (!$always and !$preview->isMimeSupported(\OC\Files\Filesystem::getMimeType($file))) {
+ \OC_Response::setStatus(404);
+ } else {
+ $preview->setFile($file);
+ $preview->setMaxX($maxX);
+ $preview->setMaxY($maxY);
+ $preview->setScalingUp($scalingUp);
+ }
$preview->show();
-}catch(\Exception $e) {
+} catch (\Exception $e) {
\OC_Response::setStatus(500);
\OC_Log::write('core', $e->getmessage(), \OC_Log::DEBUG);
-}
\ No newline at end of file
+}
diff --git a/core/css/icons.css b/core/css/icons.css
index 2dc3508412..027a3f8557 100644
--- a/core/css/icons.css
+++ b/core/css/icons.css
@@ -1,4 +1,4 @@
-.icon {
+[class^="icon-"], [class*=" icon-"] {
background-repeat: no-repeat;
background-position: center;
}
@@ -66,7 +66,8 @@
.icon-delete {
background-image: url('../img/actions/delete.svg');
}
-.icon-delete-hover {
+.icon-delete:hover,
+.icon-delete:focus {
background-image: url('../img/actions/delete-hover.svg');
}
@@ -226,6 +227,12 @@
.icon-folder {
background-image: url('../img/places/folder.svg');
}
+.icon-filetype-text {
+ background-image: url('../img/filetypes/text.svg');
+}
+.icon-filetype-folder {
+ background-image: url('../img/filetypes/folder.svg');
+}
.icon-home {
background-image: url('../img/places/home.svg');
diff --git a/core/css/mobile.css b/core/css/mobile.css
new file mode 100644
index 0000000000..a63aa902d3
--- /dev/null
+++ b/core/css/mobile.css
@@ -0,0 +1,22 @@
+@media only screen and (max-width: 600px) {
+
+/* compress search box on mobile, expand when focused */
+.searchbox input[type="search"] {
+ width: 15%;
+ -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;
+}
+
+/* do not show display name on mobile when profile picture is present */
+#header .avatardiv.avatardiv-shown + #expandDisplayName {
+ display: none;
+}
+
+
+}
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 01c2f89b9c..082d2c714c 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;
}
@@ -218,17 +219,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;
@@ -402,11 +405,9 @@ input[name="adminpass-clone"] { padding-left:1.8em; width:11.7em !important; }
/* General new input field look */
#body-login input[type="text"],
#body-login input[type="password"],
-#body-login input[type="email"] {
- border: 1px solid #323233;
- border-radius: 5px;
-}
-#body-login input[type='submit'] {
+#body-login input[type="email"],
+#body-login input[type="submit"] {
+ border: none;
border-radius: 5px;
}
@@ -719,12 +720,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;
}
@@ -946,3 +946,20 @@ 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;
+}
+
+/* for IE10 */
+@-ms-viewport {
+ width: device-width;
+}
+
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/config.php b/core/js/config.php
index b6875fb73f..7e23f3e2e4 100644
--- a/core/js/config.php
+++ b/core/js/config.php
@@ -10,12 +10,15 @@
header("Content-type: text/javascript");
// Disallow caching
-header("Cache-Control: no-cache, must-revalidate");
-header("Expires: Sat, 26 Jul 1997 05:00:00 GMT");
+header("Cache-Control: no-cache, must-revalidate");
+header("Expires: Sat, 26 Jul 1997 05:00:00 GMT");
// Enable l10n support
$l = OC_L10N::get('core');
+// Enable OC_Defaults support
+$defaults = new OC_Defaults();
+
// Get the config
$apps_paths = array();
foreach(OC_App::getEnabledApps() as $app) {
@@ -24,6 +27,7 @@ foreach(OC_App::getEnabledApps() as $app) {
$array = array(
"oc_debug" => (defined('DEBUG') && DEBUG) ? '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')),
@@ -57,11 +61,30 @@ $array = array(
"firstDay" => json_encode($l->l('firstday', 'firstday')) ,
"oc_config" => json_encode(
array(
- 'session_lifetime' => \OCP\Config::getSystemValue('session_lifetime', ini_get('session.gc_maxlifetime')),
- 'session_keepalive' => \OCP\Config::getSystemValue('session_keepalive', true)
+ 'session_lifetime' => \OCP\Config::getSystemValue('session_lifetime', ini_get('session.gc_maxlifetime')),
+ 'session_keepalive' => \OCP\Config::getSystemValue('session_keepalive', true),
+ 'version' => implode('.', OC_Util::getVersion()),
+ 'versionstring' => OC_Util::getVersionString(),
+ )
+ ),
+ "oc_defaults" => json_encode(
+ array(
+ 'entity' => $defaults->getEntity(),
+ 'name' => $defaults->getName(),
+ 'title' => $defaults->getTitle(),
+ 'baseUrl' => $defaults->getBaseUrl(),
+ 'syncClientUrl' => $defaults->getSyncClientUrl(),
+ 'docBaseUrl' => $defaults->getDocBaseUrl(),
+ 'slogan' => $defaults->getSlogan(),
+ 'logoClaim' => $defaults->getLogoClaim(),
+ 'shortFooter' => $defaults->getShortFooter(),
+ 'longFooter' => $defaults->getLongFooter()
)
)
- );
+);
+
+// Allow hooks to modify the output values
+OC_Hook::emit('\OCP\Config', 'js', array('array' => &$array));
// Echo it
foreach ($array as $setting => $value) {
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('
![]('+url+')
');
}
}
+ if(typeof callback === 'function') {
+ callback();
+ }
});
});
};
diff --git a/core/js/js.js b/core/js/js.js
index d4d2583f1e..21ccee0f1d 100644
--- a/core/js/js.js
+++ b/core/js/js.js
@@ -467,6 +467,34 @@ OC.search.lastResults={};
OC.addStyle.loaded=[];
OC.addScript.loaded=[];
+OC.msg={
+ startSaving:function(selector){
+ OC.msg.startAction(selector, t('core', 'Saving...'));
+ },
+ finishedSaving:function(selector, data){
+ OC.msg.finishedAction(selector, data);
+ },
+ startAction:function(selector, message){
+ $(selector)
+ .html( message )
+ .removeClass('success')
+ .removeClass('error')
+ .stop(true, true)
+ .show();
+ },
+ finishedAction:function(selector, data){
+ if( data.status === "success" ){
+ $(selector).html( data.data.message )
+ .addClass('success')
+ .stop(true, true)
+ .delay(3000)
+ .fadeOut(900);
+ }else{
+ $(selector).html( data.data.message ).addClass('error');
+ }
+ }
+};
+
OC.Notification={
queuedNotifications: [],
getDefaultNotificationFunction: null,
@@ -860,6 +888,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 +901,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);
});
@@ -987,6 +1017,17 @@ OC.set=function(name, value) {
context[tail]=value;
};
+// fix device width on windows phone
+(function() {
+ if ("-ms-user-select" in document.documentElement.style && navigator.userAgent.match(/IEMobile\/10\.0/)) {
+ var msViewportStyle = document.createElement("style");
+ msViewportStyle.appendChild(
+ document.createTextNode("@-ms-viewport{width:auto!important}")
+ );
+ document.getElementsByTagName("head")[0].appendChild(msViewportStyle);
+ }
+})();
+
/**
* select a range in an input field
* @link http://stackoverflow.com/questions/499126/jquery-set-cursor-position-in-text-area
diff --git a/core/js/oc-dialogs.js b/core/js/oc-dialogs.js
index f4e3ec0144..d1bcb4659b 100644
--- a/core/js/oc-dialogs.js
+++ b/core/js/oc-dialogs.js
@@ -293,7 +293,7 @@ var OCdialogs = {
conflict.find('.replacement .size').text(humanFileSize(replacement.size));
conflict.find('.replacement .mtime').text(formatDate(replacement.lastModifiedDate));
}
- var path = getPathForPreview(original.name);
+ var path = original.directory + '/' +original.name;
Files.lazyLoadPreview(path, original.mime, function(previewpath){
conflict.find('.original .icon').css('background-image','url('+previewpath+')');
}, 96, 96, original.etag);
diff --git a/core/js/tags.js b/core/js/tags.js
index 16dd3d4bf9..bc6d7b4e07 100644
--- a/core/js/tags.js
+++ b/core/js/tags.js
@@ -25,11 +25,11 @@ OC.Tags= {
});
self.deleteButton = {
text: t('core', 'Delete'),
- click: function() {self._deleteTags(self, type, self._selectedIds())},
+ click: function() {self._deleteTags(self, type, self._selectedIds())}
};
self.addButton = {
text: t('core', 'Add'),
- click: function() {self._addTag(self, type, self.$taginput.val())},
+ click: function() {self._addTag(self, type, self.$taginput.val())}
};
self._fillTagList(type, self.$taglist);
@@ -349,5 +349,5 @@ OC.Tags= {
console.warn(response);
});
}
-}
+};
diff --git a/core/js/tests/specHelper.js b/core/js/tests/specHelper.js
index 1848d08354..b119324058 100644
--- a/core/js/tests/specHelper.js
+++ b/core/js/tests/specHelper.js
@@ -63,6 +63,7 @@ window.oc_config = {
session_lifetime: 600 * 1000,
session_keepalive: false
};
+window.oc_defaults = {};
// global setup for all tests
(function setupTests() {
diff --git a/core/lostpassword/controller.php b/core/lostpassword/controller.php
index fd20c6ba24..c858696885 100644
--- a/core/lostpassword/controller.php
+++ b/core/lostpassword/controller.php
@@ -69,7 +69,7 @@ class Controller {
$defaults = new \OC_Defaults();
\OC_Mail::send($email, $_POST['user'], $l->t('%s password reset', array($defaults->getName())), $msg, $from, $defaults->getName());
} catch (Exception $e) {
- \OC_Template::printErrorPage( 'A problem occurs during sending the e-mail please contact your administrator.');
+ \OC_Template::printErrorPage( $l->t('A problem has occurred whilst sending the email, please contact your administrator.') );
}
self::displayLostPasswordPage(false, true);
} else {
diff --git a/core/minimizer.php b/core/minimizer.php
deleted file mode 100644
index eeeddf86a8..0000000000
--- a/core/minimizer.php
+++ /dev/null
@@ -1,15 +0,0 @@
-output($files, $service);
-}
-else if ($service == 'core.js') {
- $minimizer = new OC_Minimizer_JS();
- $files = OC_TemplateLayout::findJavascriptFiles(OC_Util::$coreScripts);
- $minimizer->output($files, $service);
-}
diff --git a/core/routes.php b/core/routes.php
index f8454877e0..aea788bdc6 100644
--- a/core/routes.php
+++ b/core/routes.php
@@ -100,9 +100,6 @@ $this->create('core_avatar_post_cropped', '/avatar/cropped')
->action('OC\Core\Avatar\Controller', 'postCroppedAvatar');
// Not specifically routed
-$this->create('app_css', '/apps/{app}/{file}')
- ->requirements(array('file' => '.*.css'))
- ->action('OC', 'loadCSSFile');
$this->create('app_index_script', '/apps/{app}/')
->defaults(array('file' => 'index.php'))
//->requirements(array('file' => '.*.php'))
diff --git a/core/templates/installation.php b/core/templates/installation.php
index d3adb34f41..d9f3c38ab1 100644
--- a/core/templates/installation.php
+++ b/core/templates/installation.php
@@ -67,7 +67,7 @@
0): ?>
diff --git a/core/templates/layout.user.php b/core/templates/layout.user.php
index 44413f5a2a..3d89750348 100644
--- a/core/templates/layout.user.php
+++ b/core/templates/layout.user.php
@@ -15,7 +15,7 @@
-
+
@@ -51,12 +51,12 @@
getLogoClaim()); ?>
+
+
+
-
-
-
diff --git a/lib/base.php b/lib/base.php
index a5f064bdb4..49cbb1279d 100644
--- a/lib/base.php
+++ b/lib/base.php
@@ -284,10 +284,6 @@ class OC {
if (self::needUpgrade()) {
if ($showTemplate && !OC_Config::getValue('maintenance', false)) {
OC_Config::setValue('theme', '');
- $minimizerCSS = new OC_Minimizer_CSS();
- $minimizerCSS->clearCache();
- $minimizerJS = new OC_Minimizer_JS();
- $minimizerJS->clearCache();
OC_Util::addScript('config'); // needed for web root
OC_Util::addScript('update');
$tmpl = new OC_Template('', 'update.admin', 'guest');
@@ -332,6 +328,7 @@ class OC {
}
OC_Util::addStyle("styles");
+ OC_Util::addStyle("mobile");
OC_Util::addStyle("icons");
OC_Util::addStyle("apps");
OC_Util::addStyle("fixes");
@@ -724,11 +721,6 @@ class OC {
$app = OC::$REQUESTEDAPP;
$file = OC::$REQUESTEDFILE;
$param = array('app' => $app, 'file' => $file);
- // Handle app css files
- if (substr($file, -3) == 'css') {
- self::loadCSSFile($param);
- return;
- }
// Handle redirect URL for logged in users
if (isset($_REQUEST['redirect_url']) && OC_User::isLoggedIn()) {
@@ -760,7 +752,8 @@ class OC {
OC_Preferences::deleteKey(OC_User::getUser(), 'login_token', $_COOKIE['oc_token']);
}
OC_User::logout();
- header("Location: " . OC::$WEBROOT . '/');
+ // redirect to webroot and add slash if webroot is empty
+ header("Location: " . OC::$WEBROOT.(empty(OC::$WEBROOT) ? '/' : ''));
} else {
if (is_null($file)) {
$param['file'] = 'index.php';
@@ -795,19 +788,6 @@ class OC {
return false;
}
- public static function loadCSSFile($param) {
- $app = $param['app'];
- $file = $param['file'];
- $app_path = OC_App::getAppPath($app);
- if (file_exists($app_path . '/' . $file)) {
- $app_web_path = OC_App::getAppWebPath($app);
- $filepath = $app_web_path . '/' . $file;
- $minimizer = new OC_Minimizer_CSS();
- $info = array($app_path, $app_web_path, $file);
- $minimizer->output(array($info), $filepath);
- }
- }
-
protected static function handleLogin() {
OC_App::loadApps(array('prelogin'));
$error = array();
diff --git a/lib/private/app.php b/lib/private/app.php
index 47f983cce3..048d4d4aeb 100644
--- a/lib/private/app.php
+++ b/lib/private/app.php
@@ -69,17 +69,6 @@ class OC_App{
}
ob_end_clean();
- if (!defined('DEBUG') || !DEBUG) {
- if (is_null($types)
- && empty(OC_Util::$coreScripts)
- && empty(OC_Util::$coreStyles)) {
- OC_Util::$coreScripts = OC_Util::$scripts;
- OC_Util::$scripts = array();
- OC_Util::$coreStyles = OC_Util::$styles;
- OC_Util::$styles = array();
- }
- }
- // return
return true;
}
diff --git a/lib/private/db/mdb2schemamanager.php b/lib/private/db/mdb2schemamanager.php
index c050d47b49..aaf2ea543b 100644
--- a/lib/private/db/mdb2schemamanager.php
+++ b/lib/private/db/mdb2schemamanager.php
@@ -82,6 +82,9 @@ class MDB2SchemaManager {
$platform = $this->conn->getDatabasePlatform();
foreach($schemaDiff->changedTables as $tableDiff) {
$tableDiff->name = $platform->quoteIdentifier($tableDiff->name);
+ foreach($tableDiff->changedColumns as $column) {
+ $column->oldColumnName = $platform->quoteIdentifier($column->oldColumnName);
+ }
}
if ($generateSql) {
diff --git a/lib/private/defaults.php b/lib/private/defaults.php
index 0b97497baa..59630cda5c 100644
--- a/lib/private/defaults.php
+++ b/lib/private/defaults.php
@@ -174,4 +174,11 @@ class OC_Defaults {
return $footer;
}
+ public function buildDocLinkToKey($key) {
+ if ($this->themeExist('buildDocLinkToKey')) {
+ return $this->theme->buildDocLinkToKey($key);
+ }
+ return $this->getDocBaseUrl() . '/server/6.0/go.php?to=' . $key;
+ }
+
}
diff --git a/lib/private/files.php b/lib/private/files.php
index 656d6f044c..7e7a27f48d 100644
--- a/lib/private/files.php
+++ b/lib/private/files.php
@@ -21,22 +21,39 @@
*
*/
+// TODO: get rid of this using proper composer packages
+require_once 'mcnetic/phpzipstreamer/ZipStreamer.php';
+
+class GET_TYPE {
+ const FILE = 1;
+ const ZIP_FILES = 2;
+ const ZIP_DIR = 3;
+}
+
/**
- * Class for fileserver access
+ * Class for file server access
*
*/
class OC_Files {
- static $tmpFiles = array();
-
- static public function getFileInfo($path, $includeMountPoints = true){
- return \OC\Files\Filesystem::getFileInfo($path, $includeMountPoints);
- }
/**
- * @param string $path
+ * @param string $filename
+ * @param string $name
+ * @param bool $zip
*/
- static public function getDirectoryContent($path){
- return \OC\Files\Filesystem::getDirectoryContent($path);
+ private static function sendHeaders($filename, $name, $zip = false) {
+ OC_Response::setContentDispositionHeader($name, 'attachment');
+ header('Content-Transfer-Encoding: binary');
+ OC_Response::disableCaching();
+ if ($zip) {
+ header('Content-Type: application/zip');
+ } else {
+ $filesize = \OC\Files\Filesystem::filesize($filename);
+ header('Content-Type: '.\OC\Files\Filesystem::getMimeType($filename));
+ if ($filesize > -1) {
+ header("Content-Length: ".$filesize);
+ }
+ }
}
/**
@@ -54,97 +71,50 @@ class OC_Files {
$xsendfile = true;
}
- if (is_array($files) && count($files) == 1) {
+ if (is_array($files) && count($files) === 1) {
$files = $files[0];
}
if (is_array($files)) {
- self::validateZipDownload($dir, $files);
- $executionTime = intval(ini_get('max_execution_time'));
- set_time_limit(0);
- $zip = new ZipArchive();
- $filename = OC_Helper::tmpFile('.zip');
- if ($zip->open($filename, ZIPARCHIVE::CREATE | ZIPARCHIVE::OVERWRITE)!==true) {
- $l = OC_L10N::get('lib');
- throw new Exception($l->t('cannot open "%s"', array($filename)));
- }
- foreach ($files as $file) {
- $file = $dir . '/' . $file;
- if (\OC\Files\Filesystem::is_file($file)) {
- $tmpFile = \OC\Files\Filesystem::toTmpFile($file);
- self::$tmpFiles[] = $tmpFile;
- $zip->addFile($tmpFile, basename($file));
- } elseif (\OC\Files\Filesystem::is_dir($file)) {
- self::zipAddDir($file, $zip);
- }
- }
- $zip->close();
- if ($xsendfile) {
- $filename = OC_Helper::moveToNoClean($filename);
- }
+ $get_type = GET_TYPE::ZIP_FILES;
$basename = basename($dir);
if ($basename) {
$name = $basename . '.zip';
} else {
$name = 'download.zip';
}
-
- set_time_limit($executionTime);
- } elseif (\OC\Files\Filesystem::is_dir($dir . '/' . $files)) {
- self::validateZipDownload($dir, $files);
- $executionTime = intval(ini_get('max_execution_time'));
- set_time_limit(0);
- $zip = new ZipArchive();
- $filename = OC_Helper::tmpFile('.zip');
- if ($zip->open($filename, ZIPARCHIVE::CREATE | ZIPARCHIVE::OVERWRITE)!==true) {
- $l = OC_L10N::get('lib');
- throw new Exception($l->t('cannot open "%s"', array($filename)));
- }
- $file = $dir . '/' . $files;
- self::zipAddDir($file, $zip);
- $zip->close();
- if ($xsendfile) {
- $filename = OC_Helper::moveToNoClean($filename);
- }
- // downloading root ?
- if ($files === '') {
- $name = 'download.zip';
- } else {
- $name = $files . '.zip';
- }
- set_time_limit($executionTime);
+
+ $filename = $dir . '/' . $name;
} else {
- $zip = false;
$filename = $dir . '/' . $files;
- $name = $files;
+ if (\OC\Files\Filesystem::is_dir($dir . '/' . $files)) {
+ $get_type = GET_TYPE::ZIP_DIR;
+ // downloading root ?
+ if ($files === '') {
+ $name = 'download.zip';
+ } else {
+ $name = $files . '.zip';
+ }
+
+ } else {
+ $get_type = GET_TYPE::FILE;
+ $name = $files;
+ }
+ }
+
+ if ($get_type === GET_TYPE::FILE) {
+ $zip = false;
if ($xsendfile && OC_App::isEnabled('files_encryption')) {
$xsendfile = false;
}
+ } else {
+ self::validateZipDownload($dir, $files);
+ $zip = new ZipStreamer(false);
}
OC_Util::obEnd();
if ($zip or \OC\Files\Filesystem::isReadable($filename)) {
- OC_Response::setContentDispositionHeader($name, 'attachment');
- header('Content-Transfer-Encoding: binary');
- OC_Response::disableCaching();
- if ($zip) {
- ini_set('zlib.output_compression', 'off');
- header('Content-Type: application/zip');
- header('Content-Length: ' . filesize($filename));
- self::addSendfileHeader($filename);
- }else{
- $filesize = \OC\Files\Filesystem::filesize($filename);
- header('Content-Type: '.\OC\Files\Filesystem::getMimeType($filename));
- if ($filesize > -1) {
- header("Content-Length: ".$filesize);
- }
- if ($xsendfile) {
- list($storage) = \OC\Files\Filesystem::resolvePath(\OC\Files\Filesystem::getView()->getAbsolutePath($filename));
- if ($storage->isLocal()) {
- self::addSendfileHeader(\OC\Files\Filesystem::getLocalFile($filename));
- }
- }
- }
- } elseif ($zip or !\OC\Files\Filesystem::file_exists($filename)) {
+ self::sendHeaders($filename, $name, $zip);
+ } elseif (!\OC\Files\Filesystem::file_exists($filename)) {
header("HTTP/1.0 404 Not Found");
$tmpl = new OC_Template('', '404', 'guest');
$tmpl->assign('file', $name);
@@ -157,23 +127,36 @@ class OC_Files {
return ;
}
if ($zip) {
- $handle = fopen($filename, 'r');
- if ($handle) {
- $chunkSize = 8 * 1024; // 1 MB chunks
- while (!feof($handle)) {
- echo fread($handle, $chunkSize);
- flush();
+ $executionTime = intval(ini_get('max_execution_time'));
+ set_time_limit(0);
+ if ($get_type === GET_TYPE::ZIP_FILES) {
+ foreach ($files as $file) {
+ $file = $dir . '/' . $file;
+ if (\OC\Files\Filesystem::is_file($file)) {
+ $fh = \OC\Files\Filesystem::fopen($file, 'r');
+ $zip->addFileFromStream($fh, basename($file));
+ fclose($fh);
+ } elseif (\OC\Files\Filesystem::is_dir($file)) {
+ self::zipAddDir($file, $zip);
+ }
}
+ } elseif ($get_type === GET_TYPE::ZIP_DIR) {
+ $file = $dir . '/' . $files;
+ self::zipAddDir($file, $zip);
}
- if (!$xsendfile) {
- unlink($filename);
- }
- }else{
- \OC\Files\Filesystem::readfile($filename);
- }
- foreach (self::$tmpFiles as $tmpFile) {
- if (file_exists($tmpFile) and is_file($tmpFile)) {
- unlink($tmpFile);
+ $zip->finalize();
+ set_time_limit($executionTime);
+ } else {
+ if ($xsendfile) {
+ /** @var $storage \OC\Files\Storage\Storage */
+ list($storage) = \OC\Files\Filesystem::resolvePath($filename);
+ if ($storage->isLocal()) {
+ self::addSendfileHeader(\OC\Files\Filesystem::getLocalFile($filename));
+ } else {
+ \OC\Files\Filesystem::readfile($filename);
+ }
+ } else {
+ \OC\Files\Filesystem::readfile($filename);
}
}
}
@@ -186,10 +169,10 @@ class OC_Files {
header("X-Sendfile: " . $filename);
}
if (isset($_SERVER['MOD_X_SENDFILE2_ENABLED'])) {
- if (isset($_SERVER['HTTP_RANGE']) &&
+ if (isset($_SERVER['HTTP_RANGE']) &&
preg_match("/^bytes=([0-9]+)-([0-9]*)$/", $_SERVER['HTTP_RANGE'], $range)) {
$filelength = filesize($filename);
- if ($range[2] == "") {
+ if ($range[2] === "") {
$range[2] = $filelength - 1;
}
header("Content-Range: bytes $range[1]-$range[2]/" . $filelength);
@@ -199,7 +182,7 @@ class OC_Files {
header("X-Sendfile: " . $filename);
}
}
-
+
if (isset($_SERVER['MOD_X_ACCEL_REDIRECT_ENABLED'])) {
header("X-Accel-Redirect: " . $filename);
}
@@ -207,22 +190,27 @@ class OC_Files {
/**
* @param string $dir
- * @param ZipArchive $zip
+ * @param ZipStreamer $zip
+ * @param string $internalDir
*/
public static function zipAddDir($dir, $zip, $internalDir='') {
$dirname=basename($dir);
- $zip->addEmptyDir($internalDir.$dirname);
+ $rootDir = $internalDir.$dirname;
+ if (!empty($rootDir)) {
+ $zip->addEmptyDir($rootDir);
+ }
$internalDir.=$dirname.='/';
// prevent absolute dirs
$internalDir = ltrim($internalDir, '/');
- $files=OC_Files::getDirectoryContent($dir);
+
+ $files=\OC\Files\Filesystem::getDirectoryContent($dir);
foreach($files as $file) {
$filename=$file['name'];
$file=$dir.'/'.$filename;
if(\OC\Files\Filesystem::is_file($file)) {
- $tmpFile=\OC\Files\Filesystem::toTmpFile($file);
- OC_Files::$tmpFiles[]=$tmpFile;
- $zip->addFile($tmpFile, $internalDir.$filename);
+ $fh = \OC\Files\Filesystem::fopen($file, 'r');
+ $zip->addFileFromStream($fh, $internalDir.$filename);
+ fclose($fh);
}elseif(\OC\Files\Filesystem::is_dir($file)) {
self::zipAddDir($file, $zip, $internalDir);
}
@@ -232,8 +220,8 @@ class OC_Files {
/**
* checks if the selected files are within the size constraint. If not, outputs an error page.
*
- * @param string $dir
- * @param files $files
+ * @param string $dir
+ * @param array | string $files
*/
static function validateZipDownload($dir, $files) {
if (!OC_Config::getValue('allowZipDownload', true)) {
@@ -280,8 +268,8 @@ class OC_Files {
/**
* set the maximum upload size limit for apache hosts using .htaccess
*
- * @param int size filesisze in bytes
- * @return false on failure, size on success
+ * @param int $size file size in bytes
+ * @return bool false on failure, size on success
*/
static function setUploadLimit($size) {
//don't allow user to break his config -- upper boundary
@@ -297,11 +285,12 @@ class OC_Files {
}
//don't allow user to break his config -- broken or malicious size input
- if (intval($size) == 0) {
+ if (intval($size) === 0) {
return false;
}
- $htaccess = @file_get_contents(OC::$SERVERROOT . '/.htaccess'); //supress errors in case we don't have permissions for
+ //suppress errors in case we don't have permissions for
+ $htaccess = @file_get_contents(OC::$SERVERROOT . '/.htaccess');
if (!$htaccess) {
return false;
}
@@ -319,7 +308,7 @@ class OC_Files {
if ($content !== null) {
$htaccess = $content;
}
- if ($hasReplaced == 0) {
+ if ($hasReplaced === 0) {
$htaccess .= "\n" . $setting;
}
}
diff --git a/lib/private/files/cache/cache.php b/lib/private/files/cache/cache.php
index 4cab461914..9b18257088 100644
--- a/lib/private/files/cache/cache.php
+++ b/lib/private/files/cache/cache.php
@@ -166,6 +166,16 @@ class Cache {
*/
public function getFolderContents($folder) {
$fileId = $this->getId($folder);
+ return $this->getFolderContentsById($fileId);
+ }
+
+ /**
+ * get the metadata of all files stored in $folder
+ *
+ * @param int $fileId the file id of the folder
+ * @return array
+ */
+ public function getFolderContentsById($fileId) {
if ($fileId > -1) {
$sql = 'SELECT `fileid`, `storage`, `path`, `parent`, `name`, `mimetype`, `mimepart`, `size`, `mtime`,
`storage_mtime`, `encrypted`, `unencrypted_size`, `etag`
diff --git a/lib/private/files/filesystem.php b/lib/private/files/filesystem.php
index 952f9f9feb..6478854eae 100644
--- a/lib/private/files/filesystem.php
+++ b/lib/private/files/filesystem.php
@@ -320,7 +320,8 @@ class Filesystem {
else {
self::mount('\OC\Files\Storage\Local', array('datadir' => $root), $user);
}
- $mount_file = \OC_Config::getValue("mount_file", \OC::$SERVERROOT . "/data/mount.json");
+ $datadir = \OC_Config::getValue("datadirectory", \OC::$SERVERROOT . "/data");
+ $mount_file = \OC_Config::getValue("mount_file", $datadir . "/mount.json");
//move config file to it's new position
if (is_file(\OC::$SERVERROOT . '/config/mount.json')) {
@@ -760,7 +761,7 @@ class Filesystem {
*
* @param string $directory path under datadirectory
* @param string $mimetype_filter limit returned content to this mimetype or mimepart
- * @return array
+ * @return \OC\Files\FileInfo[]
*/
public static function getDirectoryContent($directory, $mimetype_filter = '') {
return self::$defaultInstance->getDirectoryContent($directory, $mimetype_filter);
diff --git a/lib/private/files/storage/common.php b/lib/private/files/storage/common.php
index d4dca780ff..9e826dd619 100644
--- a/lib/private/files/storage/common.php
+++ b/lib/private/files/storage/common.php
@@ -140,43 +140,6 @@ abstract class Common implements \OC\Files\Storage\Storage {
return $result;
}
- /**
- * @brief Deletes all files and folders recursively within a directory
- * @param string $directory The directory whose contents will be deleted
- * @param bool $empty Flag indicating whether directory will be emptied
- * @returns bool
- *
- * @note By default the directory specified by $directory will be
- * deleted together with its contents. To avoid this set $empty to true
- */
- public function deleteAll($directory, $empty = false) {
- $directory = trim($directory, '/');
- if (!$this->is_dir($directory) || !$this->isReadable($directory)) {
- return false;
- } else {
- $directoryHandle = $this->opendir($directory);
- if (is_resource($directoryHandle)) {
- while (($contents = readdir($directoryHandle)) !== false) {
- if (!\OC\Files\Filesystem::isIgnoredDir($contents)) {
- $path = $directory . '/' . $contents;
- if ($this->is_dir($path)) {
- $this->deleteAll($path);
- } else {
- $this->unlink($path);
- }
- }
- }
- }
- if ($empty === false) {
- if (!$this->rmdir($directory)) {
- return false;
- }
- }
- return true;
- }
-
- }
-
public function getMimeType($path) {
if ($this->is_dir($path)) {
return 'httpd/unix-directory';
diff --git a/lib/private/files/storage/wrapper/quota.php b/lib/private/files/storage/wrapper/quota.php
index 1bcdca7f47..26c952e694 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 $sizeRoot
+ */
+ protected $sizeRoot;
+
/**
* @param array $parameters
*/
public function __construct($parameters) {
$this->storage = $parameters['storage'];
$this->quota = $parameters['quota'];
+ $this->sizeRoot = isset($parameters['root']) ? $parameters['root'] : '';
}
/**
@@ -46,7 +52,7 @@ class Quota extends Wrapper {
if ($this->quota < 0) {
return $this->storage->free_space($path);
} else {
- $used = $this->getSize('');
+ $used = $this->getSize($this->sizeRoot);
if ($used < 0) {
return \OC\Files\SPACE_NOT_COMPUTED;
} else {
diff --git a/lib/private/files/view.php b/lib/private/files/view.php
index 530aa8f751..2dbbf5b88c 100644
--- a/lib/private/files/view.php
+++ b/lib/private/files/view.php
@@ -413,7 +413,7 @@ class View {
$result = $this->copy($path1, $path2);
if ($result === true) {
list($storage1, $internalPath1) = Filesystem::resolvePath($absolutePath1 . $postFix1);
- $result = $storage1->deleteAll($internalPath1);
+ $result = $storage1->unlink($internalPath1);
}
} else {
$source = $this->fopen($path1 . $postFix1, 'r');
@@ -534,6 +534,8 @@ class View {
$source = $this->fopen($path1 . $postFix1, 'r');
$target = $this->fopen($path2 . $postFix2, 'w');
list($count, $result) = \OC_Helper::streamCopy($source, $target);
+ fclose($source);
+ fclose($target);
}
}
if ($this->shouldEmitHooks() && $result !== false) {
@@ -880,12 +882,13 @@ class View {
$watcher->checkUpdate($internalPath);
}
+ $folderId = $cache->getId($internalPath);
$files = array();
- $contents = $cache->getFolderContents($internalPath); //TODO: mimetype_filter
+ $contents = $cache->getFolderContents($internalPath, $folderId); //TODO: mimetype_filter
foreach ($contents as $content) {
$files[] = new FileInfo($path . '/' . $content['name'], $storage, $content['path'], $content);
}
- $permissions = $permissionsCache->getDirectoryPermissions($cache->getId($internalPath), $user);
+ $permissions = $permissionsCache->getDirectoryPermissions($folderId, $user);
$ids = array();
foreach ($files as $i => $file) {
diff --git a/lib/private/helper.php b/lib/private/helper.php
index 1aab2f296e..d8c4650f66 100644
--- a/lib/private/helper.php
+++ b/lib/private/helper.php
@@ -64,7 +64,7 @@ class OC_Helper {
*/
public static function linkToDocs($key) {
$theme = new OC_Defaults();
- return $theme->getDocBaseUrl() . '/server/6.0/go.php?to=' . $key;
+ return $theme->buildDocLinkToKey($key);
}
/**
diff --git a/lib/private/image.php b/lib/private/image.php
index 42685ddab5..da32aa4760 100644
--- a/lib/private/image.php
+++ b/lib/private/image.php
@@ -41,8 +41,7 @@ class OC_Image {
// exif_imagetype throws "read error!" if file is less than 12 byte
if (filesize($filePath) > 11) {
$imageType = exif_imagetype($filePath);
- }
- else {
+ } else {
$imageType = false;
}
return $imageType ? image_type_to_mime_type($imageType) : '';
@@ -50,7 +49,7 @@ class OC_Image {
/**
* @brief Constructor.
- * @param $imageref The path to a local file, a base64 encoded string or a resource created by an imagecreate* function.
+ * @param string|resource $imageref The path to a local file, a base64 encoded string or a resource created by an imagecreate* function.
* @returns bool False on error
*/
public function __construct($imageRef = null) {
@@ -115,13 +114,11 @@ class OC_Image {
case 3:
case 4: // Not tested
return $this->width();
- break;
case 5: // Not tested
case 6:
case 7: // Not tested
case 8:
return $this->height();
- break;
}
return $this->width();
}
@@ -140,13 +137,11 @@ class OC_Image {
case 3:
case 4: // Not tested
return $this->height();
- break;
case 5: // Not tested
case 6:
case 7: // Not tested
case 8:
return $this->width();
- break;
}
return $this->height();
}
@@ -197,7 +192,6 @@ class OC_Image {
return false;
}
- $retVal = false;
switch($this->imageType) {
case IMAGETYPE_GIF:
$retVal = imagegif($this->resource, $filePath);
@@ -231,7 +225,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;
@@ -264,8 +258,8 @@ class OC_Image {
}
/**
- * @returns Returns a base64 encoded string suitable for embedding in a VCard.
- */
+ * @return string - base64 encoded, which is suitable for embedding in a VCard.
+ */
function __toString() {
return base64_encode($this->data());
}
@@ -307,43 +301,33 @@ class OC_Image {
$o = $this->getOrientation();
OC_Log::write('core', 'OC_Image->fixOrientation() Orientation: '.$o, OC_Log::DEBUG);
$rotate = 0;
- $flip = false;
switch($o) {
case -1:
return false; //Nothing to fix
- break;
case 1:
$rotate = 0;
- $flip = false;
break;
case 2: // Not tested
$rotate = 0;
- $flip = true;
break;
case 3:
$rotate = 180;
- $flip = false;
break;
case 4: // Not tested
$rotate = 180;
- $flip = true;
break;
case 5: // Not tested
$rotate = 90;
- $flip = true;
break;
case 6:
//$rotate = 90;
$rotate = 270;
- $flip = false;
break;
case 7: // Not tested
$rotate = 270;
- $flip = true;
break;
case 8:
$rotate = 90;
- $flip = false;
break;
}
if($rotate) {
@@ -367,6 +351,7 @@ class OC_Image {
return false;
}
}
+ return false;
}
/**
@@ -599,9 +584,9 @@ class OC_Image {
$meta['imagesize'] = $meta['filesize'] - $meta['offset'];
// in rare cases filesize is equal to offset so we need to read physical size
if ($meta['imagesize'] < 1) {
- $meta['imagesize'] = @filesize($filename) - $meta['offset'];
+ $meta['imagesize'] = @filesize($fileName) - $meta['offset'];
if ($meta['imagesize'] < 1) {
- trigger_error('imagecreatefrombmp: Can not obtain filesize of ' . $filename . '!', E_USER_WARNING);
+ trigger_error('imagecreatefrombmp: Can not obtain filesize of ' . $fileName . '!', E_USER_WARNING);
return false;
}
}
@@ -947,7 +932,7 @@ if ( ! function_exists( 'imagebmp') ) {
$index = imagecolorat($im, $i, $j);
if ($index !== $lastIndex || $sameNum > 255) {
if ($sameNum != 0) {
- $bmpData .= chr($same_num) . chr($lastIndex);
+ $bmpData .= chr($sameNum) . chr($lastIndex);
}
$lastIndex = $index;
$sameNum = 1;
diff --git a/lib/private/mimetypes.list.php b/lib/private/mimetypes.list.php
index 9bd07b8902..a216414c9d 100644
--- a/lib/private/mimetypes.list.php
+++ b/lib/private/mimetypes.list.php
@@ -31,6 +31,7 @@ return array(
'bash' => 'text/x-shellscript',
'blend' => 'application/x-blender',
'bin' => 'application/x-bin',
+ 'bmp' => 'image/bmp',
'cb7' => 'application/x-cbr',
'cba' => 'application/x-cbr',
'cbr' => 'application/x-cbr',
diff --git a/lib/private/minimizer.php b/lib/private/minimizer.php
deleted file mode 100644
index db522de74d..0000000000
--- a/lib/private/minimizer.php
+++ /dev/null
@@ -1,64 +0,0 @@
-contentType);
- OC_Response::enableCaching();
- $etag = $this->generateETag($files);
- $cache_key .= '-'.$etag;
-
- $gzout = false;
- $cache = OC_Cache::getGlobalCache();
- if (!OC_Request::isNoCache() && (!defined('DEBUG') || !DEBUG)) {
- OC_Response::setETagHeader($etag);
- $gzout = $cache->get($cache_key.'.gz');
- }
-
- if (!$gzout) {
- $out = $this->minimizeFiles($files);
- $gzout = gzencode($out);
- $cache->set($cache_key.'.gz', $gzout);
- OC_Response::setETagHeader($etag);
- }
- // on some systems (e.g. SLES 11, but not Ubuntu) mod_deflate and zlib compression will compress the output twice.
- // This results in broken core.css and core.js. To avoid it, we switch off zlib compression.
- // Since mod_deflate is still active, Apache will compress what needs to be compressed, i.e. no disadvantage.
- if(function_exists('apache_get_modules') && ini_get('zlib.output_compression') && in_array('mod_deflate', apache_get_modules())) {
- ini_set('zlib.output_compression', 'Off');
- }
- if ($encoding = OC_Request::acceptGZip()) {
- header('Content-Encoding: '.$encoding);
- $out = $gzout;
- } else {
- $out = gzdecode($gzout);
- }
- header('Content-Length: '.strlen($out));
- echo $out;
- }
-
- public function clearCache() {
- $cache = OC_Cache::getGlobalCache();
- $cache->clear('core.css');
- $cache->clear('core.js');
- }
-}
-
-if (!function_exists('gzdecode')) {
- function gzdecode($data, $maxlength=null, &$filename='', &$error='')
- {
- if (strcmp(substr($data, 0, 9),"\x1f\x8b\x8\0\0\0\0\0\0")) {
- return null; // Not the GZIP format we expect (See RFC 1952)
- }
- return gzinflate(substr($data, 10, -8));
- }
-}
diff --git a/lib/private/minimizer/css.php b/lib/private/minimizer/css.php
deleted file mode 100644
index 8d130572e2..0000000000
--- a/lib/private/minimizer/css.php
+++ /dev/null
@@ -1,38 +0,0 @@
-getAppConfig();
$appConfig->setValue('core', 'installedat', microtime(true));
$appConfig->setValue('core', 'lastupdatedat', microtime(true));
- $appConfig->setValue('core', 'remote_core.css', '/core/minimizer.php');
- $appConfig->setValue('core', 'remote_core.js', '/core/minimizer.php');
OC_Group::createGroup('admin');
OC_Group::addToGroup($username, 'admin');
@@ -148,7 +147,7 @@ class OC_Setup {
$content.= "RewriteRule ^.well-known/host-meta /public.php?service=host-meta [QSA,L]\n";
$content.= "RewriteRule ^.well-known/carddav /remote.php/carddav/ [R]\n";
$content.= "RewriteRule ^.well-known/caldav /remote.php/caldav/ [R]\n";
- $content.= "RewriteRule ^apps/([^/]*)/(.*\.(css|php))$ index.php?app=$1&getfile=$2 [QSA,L]\n";
+ $content.= "RewriteRule ^apps/([^/]*)/(.*\.(php))$ index.php?app=$1&getfile=$2 [QSA,L]\n";
$content.= "RewriteRule ^remote/(.*) remote.php [QSA,L]\n";
$content.= "\n";
$content.= "\n";
diff --git a/lib/private/template/cssresourcelocator.php b/lib/private/template/cssresourcelocator.php
index 8e7831ca54..e26daa2582 100644
--- a/lib/private/template/cssresourcelocator.php
+++ b/lib/private/template/cssresourcelocator.php
@@ -22,7 +22,7 @@ class CSSResourceLocator extends ResourceLocator {
$app = substr($style, 0, strpos($style, '/'));
$style = substr($style, strpos($style, '/')+1);
$app_path = \OC_App::getAppPath($app);
- $app_url = $this->webroot . '/index.php/apps/' . $app;
+ $app_url = \OC_App::getAppWebPath($app);
if ($this->appendIfExist($app_path, $style.$this->form_factor.'.css', $app_url)
|| $this->appendIfExist($app_path, $style.'.css', $app_url)
) {
diff --git a/lib/private/templatelayout.php b/lib/private/templatelayout.php
index 7bca5bc483..af17adb11c 100644
--- a/lib/private/templatelayout.php
+++ b/lib/private/templatelayout.php
@@ -1,4 +1,11 @@
* This file is licensed under the Affero General Public License version 3 or
@@ -57,35 +64,38 @@ class OC_TemplateLayout extends OC_Template {
} else {
parent::__construct('core', 'layout.base');
}
+
$versionParameter = '?v=' . md5(implode(OC_Util::getVersion()));
- // Add the js files
- $jsfiles = self::findJavascriptFiles(OC_Util::$scripts);
- $this->assign('jsfiles', array(), false);
- if (OC_Config::getValue('installed', false) && $renderas!='error') {
+ $useAssetPipeline = OC_Config::getValue('asset-pipeline.enabled', false);
+ if ($useAssetPipeline) {
+
$this->append( 'jsfiles', OC_Helper::linkToRoute('js_config') . $versionParameter);
- }
- if (!empty(OC_Util::$coreScripts)) {
- $this->append( 'jsfiles', OC_Helper::linkToRemoteBase('core.js', false) . $versionParameter);
- }
- foreach($jsfiles as $info) {
- $root = $info[0];
- $web = $info[1];
- $file = $info[2];
- $this->append( 'jsfiles', $web.'/'.$file . $versionParameter);
- }
- // Add the css files
- $cssfiles = self::findStylesheetFiles(OC_Util::$styles);
- $this->assign('cssfiles', array());
- if (!empty(OC_Util::$coreStyles)) {
- $this->append( 'cssfiles', OC_Helper::linkToRemoteBase('core.css', false) . $versionParameter);
- }
- foreach($cssfiles as $info) {
- $root = $info[0];
- $web = $info[1];
- $file = $info[2];
+ $this->generateAssets();
- $this->append( 'cssfiles', $web.'/'.$file . $versionParameter);
+ } else {
+
+ // Add the js files
+ $jsfiles = self::findJavascriptFiles(OC_Util::$scripts);
+ $this->assign('jsfiles', array(), false);
+ if (OC_Config::getValue('installed', false) && $renderas!='error') {
+ $this->append( 'jsfiles', OC_Helper::linkToRoute('js_config') . $versionParameter);
+ }
+ foreach($jsfiles as $info) {
+ $web = $info[1];
+ $file = $info[2];
+ $this->append( 'jsfiles', $web.'/'.$file . $versionParameter);
+ }
+
+ // Add the css files
+ $cssfiles = self::findStylesheetFiles(OC_Util::$styles);
+ $this->assign('cssfiles', array());
+ foreach($cssfiles as $info) {
+ $web = $info[1];
+ $file = $info[2];
+
+ $this->append( 'cssfiles', $web.'/'.$file . $versionParameter);
+ }
}
}
@@ -116,4 +126,57 @@ class OC_TemplateLayout extends OC_Template {
$locator->find($scripts);
return $locator->getResources();
}
+
+ public function generateAssets()
+ {
+ $jsFiles = self::findJavascriptFiles(OC_Util::$scripts);
+ $jsHash = self::hashScriptNames($jsFiles);
+
+ if (!file_exists("assets/$jsHash.js")) {
+ $jsFiles = array_map(function ($item) {
+ $root = $item[0];
+ $file = $item[2];
+ return new FileAsset($root . '/' . $file, array(), $root, $file);
+ }, $jsFiles);
+ $jsCollection = new AssetCollection($jsFiles);
+ $jsCollection->setTargetPath("assets/$jsHash.js");
+
+ $writer = new AssetWriter(\OC::$SERVERROOT);
+ $writer->writeAsset($jsCollection);
+ }
+
+ $cssFiles = self::findStylesheetFiles(OC_Util::$styles);
+ $cssHash = self::hashScriptNames($cssFiles);
+
+ if (!file_exists("assets/$cssHash.css")) {
+ $cssFiles = array_map(function ($item) {
+ $root = $item[0];
+ $file = $item[2];
+ $assetPath = $root . '/' . $file;
+ $sourceRoot = \OC::$SERVERROOT;
+ $sourcePath = substr($assetPath, strlen(\OC::$SERVERROOT));
+ return new FileAsset($assetPath, array(new CssRewriteFilter()), $sourceRoot, $sourcePath);
+ }, $cssFiles);
+ $cssCollection = new AssetCollection($cssFiles);
+ $cssCollection->setTargetPath("assets/$cssHash.css");
+
+ $writer = new AssetWriter(\OC::$SERVERROOT);
+ $writer->writeAsset($cssCollection);
+ }
+
+ $this->append('jsfiles', OC_Helper::linkTo('assets', "$jsHash.js"));
+ $this->append('cssfiles', OC_Helper::linkTo('assets', "$cssHash.css"));
+ }
+
+ private static function hashScriptNames($files)
+ {
+ $files = array_map(function ($item) {
+ $root = $item[0];
+ $file = $item[2];
+ return $root . '/' . $file;
+ }, $files);
+
+ sort($files);
+ return hash('md5', implode('', $files));
+ }
}
diff --git a/lib/private/updater.php b/lib/private/updater.php
index 764a0f1412..f05d5038b7 100644
--- a/lib/private/updater.php
+++ b/lib/private/updater.php
@@ -102,6 +102,20 @@ class Updater extends BasicEmitter {
$this->log->debug('starting upgrade from ' . $installedVersion . ' to ' . $currentVersion, array('app' => 'core'));
}
$this->emit('\OC\Updater', 'maintenanceStart');
+
+ /*
+ * START CONFIG CHANGES FOR OLDER VERSIONS
+ */
+ if (version_compare($currentVersion, '6.90.1', '<')) {
+ // Add the overwriteHost config if it is not existant
+ // This is added to prevent host header poisoning
+ \OC_Config::setValue('trusted_domains', \OC_Config::getValue('trusted_domains', array(\OC_Request::serverHost())));
+ }
+ /*
+ * STOP CONFIG CHANGES FOR OLDER VERSIONS
+ */
+
+
try {
\OC_DB::updateDbFromStructure(\OC::$SERVERROOT . '/db_structure.xml');
$this->emit('\OC\Updater', 'dbUpgrade');
@@ -162,3 +176,4 @@ class Updater extends BasicEmitter {
$this->emit('\OC\Updater', 'filecacheDone');
}
}
+
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);
}
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));
diff --git a/lib/private/util.php b/lib/private/util.php
index b785643652..920161949a 100755
--- a/lib/private/util.php
+++ b/lib/private/util.php
@@ -11,8 +11,6 @@ class OC_Util {
public static $headers=array();
private static $rootMounted=false;
private static $fsSetup=false;
- public static $coreStyles=array();
- public static $coreScripts=array();
/**
* @brief Can be set up
@@ -65,7 +63,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'));
}
}
diff --git a/lib/public/share.php b/lib/public/share.php
index ebc555dba5..2fed41488c 100644
--- a/lib/public/share.php
+++ b/lib/public/share.php
@@ -1250,7 +1250,21 @@ class Share {
// Remove root from file source paths if retrieving own shared items
if (isset($uidOwner) && isset($row['path'])) {
if (isset($row['parent'])) {
- $row['path'] = '/Shared/'.basename($row['path']);
+ $query = \OC_DB::prepare('SELECT `file_target` FROM `*PREFIX*share` WHERE `id` = ?');
+ $parentResult = $query->execute(array($row['parent']));
+ if (\OC_DB::isError($result)) {
+ \OC_Log::write('OCP\Share', 'Can\'t select parent: ' .
+ \OC_DB::getErrorMessage($result) . ', select=' . $select . ' where=' . $where,
+ \OC_Log::ERROR);
+ } else {
+ $parentRow = $parentResult->fetchRow();
+ $splitPath = explode('/', $row['path']);
+ $tmpPath = '/Shared' . $parentRow['file_target'];
+ foreach (array_slice($splitPath, 2) as $pathPart) {
+ $tmpPath = $tmpPath . '/' . $pathPart;
+ }
+ $row['path'] = $tmpPath;
+ }
} else {
if (!isset($mounts[$row['storage']])) {
$mountPoints = \OC\Files\Filesystem::getMountByNumericId($row['storage']);
diff --git a/settings/admin.php b/settings/admin.php
index c0e4570658..42477bfc1c 100755
--- a/settings/admin.php
+++ b/settings/admin.php
@@ -21,6 +21,16 @@ $entries=OC_Log_Owncloud::getEntries(3);
$entriesremain = count(OC_Log_Owncloud::getEntries(4)) > 3;
$tmpl->assign('loglevel', OC_Config::getValue( "loglevel", 2 ));
+$tmpl->assign('mail_domain', OC_Config::getValue( "mail_domain", '' ));
+$tmpl->assign('mail_from_address', OC_Config::getValue( "mail_from_address", '' ));
+$tmpl->assign('mail_smtpmode', OC_Config::getValue( "mail_smtpmode", '' ));
+$tmpl->assign('mail_smtpsecure', OC_Config::getValue( "mail_smtpsecure", '' ));
+$tmpl->assign('mail_smtphost', OC_Config::getValue( "mail_smtphost", '' ));
+$tmpl->assign('mail_smtpport', OC_Config::getValue( "mail_smtpport", '' ));
+$tmpl->assign('mail_smtpauthtype', OC_Config::getValue( "mail_smtpauthtype", '' ));
+$tmpl->assign('mail_smtpauth', OC_Config::getValue( "mail_smtpauth", false ));
+$tmpl->assign('mail_smtpname', OC_Config::getValue( "mail_smtpname", '' ));
+$tmpl->assign('mail_smtppassword', OC_Config::getValue( "mail_smtppassword", '' ));
$tmpl->assign('entries', $entries);
$tmpl->assign('entriesremain', $entriesremain);
$tmpl->assign('htaccessworking', $htaccessworking);
diff --git a/settings/admin/controller.php b/settings/admin/controller.php
new file mode 100644
index 0000000000..a075d77436
--- /dev/null
+++ b/settings/admin/controller.php
@@ -0,0 +1,93 @@
+.
+*/
+
+namespace OC\Settings\Admin;
+
+class Controller {
+ /**
+ * Set mail settings
+ */
+ public static function setMailSettings() {
+ \OC_Util::checkAdminUser();
+ \OCP\JSON::callCheck();
+
+ $l = \OC_L10N::get('settings');
+
+ $smtp_settings = array(
+ 'mail_domain' => null,
+ 'mail_from_address' => null,
+ 'mail_smtpmode' => array('sendmail', 'smtp', 'qmail', 'php'),
+ 'mail_smtpsecure' => array('', 'ssl', 'tls'),
+ 'mail_smtphost' => null,
+ 'mail_smtpport' => null,
+ 'mail_smtpauthtype' => array('LOGIN', 'PLAIN', 'NTLM'),
+ 'mail_smtpauth' => true,
+ 'mail_smtpname' => null,
+ 'mail_smtppassword' => null,
+ );
+
+ foreach ($smtp_settings as $setting => $validate) {
+ if (!$validate) {
+ if (!isset($_POST[$setting]) || $_POST[$setting] === '') {
+ \OC_Config::deleteKey( $setting );
+ } else {
+ \OC_Config::setValue( $setting, $_POST[$setting] );
+ }
+ }
+ else if (is_bool($validate)) {
+ if (!empty($_POST[$setting])) {
+ \OC_Config::setValue( $setting, (bool) $_POST[$setting] );
+ } else {
+ \OC_Config::deleteKey( $setting );
+ }
+ }
+ else if (is_array($validate)) {
+ if (!isset($_POST[$setting]) || $_POST[$setting] === '') {
+ \OC_Config::deleteKey( $setting );
+ } else if (in_array($_POST[$setting], $validate)) {
+ \OC_Config::setValue( $setting, $_POST[$setting] );
+ } else {
+ $message = $l->t('Invalid value supplied for %s', array(self::getFieldname($setting, $l)));
+ \OC_JSON::error( array( "data" => array( "message" => $message)) );
+ exit;
+ }
+ }
+ }
+
+ \OC_JSON::success(array("data" => array( "message" => $l->t("Saved") )));
+ }
+
+ /**
+ * Get the field name to use it in error messages
+ *
+ * @param $setting string
+ * @param $l \OC_L10N
+ * @return string
+ */
+ public static function getFieldname($setting, $l) {
+ switch ($setting) {
+ case 'mail_smtpmode':
+ return $l->t( 'Send mode' );
+ case 'mail_smtpsecure':
+ return $l->t( 'Encryption' );
+ case 'mail_smtpauthtype':
+ return $l->t( 'Authentification method' );
+ }
+ }
+}
diff --git a/settings/ajax/decryptall.php b/settings/ajax/decryptall.php
index d7c104ab15..4782a4cfc8 100644
--- a/settings/ajax/decryptall.php
+++ b/settings/ajax/decryptall.php
@@ -24,6 +24,8 @@ if ($result !== false) {
$successful = false;
}
+ $util->closeEncryptionSession();
+
if ($successful === true) {
\OCP\JSON::success(array('data' => array('message' => 'Files decrypted successfully')));
} else {
diff --git a/settings/css/settings.css b/settings/css/settings.css
index 8a96885b78..a47e7bf656 100644
--- a/settings/css/settings.css
+++ b/settings/css/settings.css
@@ -61,7 +61,12 @@ td.remove { width:1em; padding-right:1em; }
tr:hover>td.password>span, tr:hover>td.displayName>span { margin:0; cursor:pointer; }
tr:hover>td.remove>a, tr:hover>td.password>img,tr:hover>td.displayName>img, tr:hover>td.quota>img { visibility:visible; cursor:pointer; }
tr:hover>td.remove>a { float:right; }
-li.selected { background-color:#ddd; }
+
+li.selected,
+#leftcontent li.selected {
+ background-color: #ddd;
+}
+
table.grid { width:100%; }
#rightcontent { padding-left: 10px; }
div.quota {
@@ -150,6 +155,18 @@ span.connectionwarning {color:#933; font-weight:bold; }
input[type=radio] { width:1em; }
table.shareAPI td { padding-bottom: 0.8em; }
+#mail_settings p label:first-child {
+ display: inline-block;
+ width: 300px;
+ text-align: right;
+}
+#mail_settings p select:nth-child(2) {
+ width: 143px;
+}
+#mail_smtpport {
+ width: 40px;
+}
+
/* HELP */
.pressed {background-color:#DDD;}
diff --git a/settings/js/admin.js b/settings/js/admin.js
index e957bd68f1..5ea6a5af2d 100644
--- a/settings/js/admin.js
+++ b/settings/js/admin.js
@@ -34,4 +34,38 @@ $(document).ready(function(){
$('#security').change(function(){
$.post(OC.filePath('settings','ajax','setsecurity.php'), { enforceHTTPS: $('#forcessl').val() },function(){} );
});
+
+ $('#mail_smtpauth').change(function() {
+ if (!this.checked) {
+ $('#mail_credentials').addClass('hidden');
+ } else {
+ $('#mail_credentials').removeClass('hidden');
+ }
+ });
+
+ $('#mail_smtpmode').change(function() {
+ if ($(this).val() !== 'smtp') {
+ $('#setting_smtpauth').addClass('hidden');
+ $('#setting_smtphost').addClass('hidden');
+ $('#mail_smtpsecure_label').addClass('hidden');
+ $('#mail_smtpsecure').addClass('hidden');
+ $('#mail_credentials').addClass('hidden');
+ } else {
+ $('#setting_smtpauth').removeClass('hidden');
+ $('#setting_smtphost').removeClass('hidden');
+ $('#mail_smtpsecure_label').removeClass('hidden');
+ $('#mail_smtpsecure').removeClass('hidden');
+ if ($('#mail_smtpauth').attr('checked')) {
+ $('#mail_credentials').removeClass('hidden');
+ }
+ }
+ });
+
+ $('#mail_settings').change(function(){
+ OC.msg.startSaving('#mail_settings .msg');
+ var post = $( "#mail_settings" ).serialize();
+ $.post(OC.Router.generate('settings_mail_settings'), post, function(data){
+ OC.msg.finishedSaving('#mail_settings .msg', data);
+ });
+ });
});
diff --git a/settings/js/apps.js b/settings/js/apps.js
index 2c6f77d931..3dbc8a2f7c 100644
--- a/settings/js/apps.js
+++ b/settings/js/apps.js
@@ -207,12 +207,24 @@ OC.Settings.Apps = OC.Settings.Apps || {
a.prepend(filename);
a.prepend(img);
li.append(a);
- // append the new app as last item in the list (.push is from sticky footer)
+
+ // append the new app as last item in the list
+ // (.push is from sticky footer)
$('#apps .wrapper .push').before(li);
- // scroll the app navigation down so the newly added app is seen
- $('#navigation').animate({ scrollTop: $('#navigation').height() }, 'slow');
- // draw attention to the newly added app entry by flashing it twice
- container.children('li[data-id="'+entry.id+'"]').animate({opacity:.3}).animate({opacity:1}).animate({opacity:.3}).animate({opacity:1});
+
+ // scroll the app navigation down
+ // so the newly added app is seen
+ $('#navigation').animate({
+ scrollTop: $('#navigation').height()
+ }, 'slow');
+
+ // draw attention to the newly added app entry
+ // by flashing it twice
+ container.children('li[data-id="' + entry.id + '"]')
+ .animate({opacity: 0.3})
+ .animate({opacity: 1})
+ .animate({opacity: 0.3})
+ .animate({opacity: 1});
if (!SVGSupport() && entry.icon.match(/\.svg$/i)) {
$(img).addClass('svg');
@@ -248,6 +260,8 @@ $(document).ready(function(){
var item = tgt.is('li') ? $(tgt) : $(tgt).parent();
var app = item.data('app');
OC.Settings.Apps.loadApp(app);
+ $('#leftcontent .selected').removeClass('selected');
+ item.addClass('selected');
}
return false;
});
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 @@
-
- * 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/personal.js b/settings/js/personal.js
index ef261b50bb..98bfe7132d 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);
@@ -313,25 +315,3 @@ OC.Encryption.msg={
}
}
};
-
-OC.msg={
- startSaving:function(selector){
- $(selector)
- .html( t('settings', 'Saving...') )
- .removeClass('success')
- .removeClass('error')
- .stop(true, true)
- .show();
- },
- finishedSaving:function(selector, data){
- if( data.status === "success" ){
- $(selector).html( data.data.message )
- .addClass('success')
- .stop(true, true)
- .delay(3000)
- .fadeOut(900);
- }else{
- $(selector).html( data.data.message ).addClass('error');
- }
- }
-};
diff --git a/settings/js/users.js b/settings/js/users.js
index 6886db668b..160d0a8d9d 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 = $('
-
t('Abort')); ?>
+
t('Cancel')); ?>
t('Choose as profile image')); ?>
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);
?>
-
-