summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorRobin Appelman <icewind@owncloud.com>2014-02-21 15:43:54 +0100
committerRobin Appelman <icewind@owncloud.com>2014-02-21 15:43:54 +0100
commitf86dffd56c0971372900d1f4a9fba879e69952e7 (patch)
treeb00b49696fafcd763c8918a5f10e7f3d0b134ec0 /lib
parentd1c392d9adc28f17ef90eb3e515f9622159c64b9 (diff)
parentaa0bcf7ba45d004b0c0226fd07696f9f224f9c1c (diff)
downloadnextcloud-server-f86dffd56c0971372900d1f4a9fba879e69952e7.tar.gz
nextcloud-server-f86dffd56c0971372900d1f4a9fba879e69952e7.zip
Merge branch 'master' into recursive-mkdir-local
Diffstat (limited to 'lib')
-rw-r--r--lib/base.php1
-rw-r--r--lib/private/files/filesystem.php10
-rw-r--r--lib/private/files/storage/wrapper/quota.php8
-rw-r--r--lib/private/helper.php31
-rw-r--r--lib/private/image.php2
-rw-r--r--lib/private/mimetypes.list.php140
-rw-r--r--lib/private/urlgenerator.php3
-rw-r--r--lib/private/user.php1
-rw-r--r--lib/private/user/session.php1
-rwxr-xr-xlib/private/util.php2
10 files changed, 124 insertions, 75 deletions
diff --git a/lib/base.php b/lib/base.php
index a5f064bdb4b..84177c7ba6c 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");
diff --git a/lib/private/files/filesystem.php b/lib/private/files/filesystem.php
index b6102f5c245..952f9f9febf 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'));
}
diff --git a/lib/private/files/storage/wrapper/quota.php b/lib/private/files/storage/wrapper/quota.php
index 1bcdca7f47a..26c952e694a 100644
--- a/lib/private/files/storage/wrapper/quota.php
+++ b/lib/private/files/storage/wrapper/quota.php
@@ -16,11 +16,17 @@ 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/helper.php b/lib/private/helper.php
index e5d1fa9b513..1aab2f296e1 100644
--- a/lib/private/helper.php
+++ b/lib/private/helper.php
@@ -152,7 +152,32 @@ 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-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',
+
'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 +187,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 +199,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 +210,8 @@ 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/image.php b/lib/private/image.php
index 42685ddab5c..17caaa012f5 100644
--- a/lib/private/image.php
+++ b/lib/private/image.php
@@ -231,7 +231,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;
diff --git a/lib/private/mimetypes.list.php b/lib/private/mimetypes.list.php
index 174877d623b..9bd07b89023 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(
- 'accdb'=>'application/msaccess',
+ '7z' => 'application/x-7z-compressed',
+ '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',
'cbr' => 'application/x-cbr',
@@ -38,81 +40,91 @@ return array(
'cc' => 'text/x-c',
'cdr' => 'application/coreldraw',
'cpp' => 'text/x-c++src',
- 'css'=>'text/css',
+ 'css' => 'text/css',
+ 'csv' => 'text/csv',
'cvbdl' => 'application/x-cbr',
'c' => 'text/x-c',
'c++' => 'text/x-c++src',
- 'doc'=>'application/msword',
- 'docx'=>'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
- 'dot'=>'application/msword',
- 'dotx'=>'application/vnd.openxmlformats-officedocument.wordprocessingml.template',
- 'dv'=>'video/dv',
+ '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',
- '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',
- 'keynote'=>'application/x-iwork-keynote-sffkey',
- 'kra'=>'application/x-krita',
- 'm2t'=>'video/mp2t',
- 'm4v'=>'video/mp4',
+ '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',
'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',
- '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-script.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-perl',
+ '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',
- 'tar'=>'application/x-tar',
- 'tar.gz'=>'application/x-compressed',
- 'tgz'=>'application/x-compressed',
- 'tiff'=>'image/tiff',
- 'tif'=>'image/tiff',
- 'txt'=>'text/plain',
+ 'svg' => 'image/svg+xml',
+ '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',
+ 'ttf' => 'application/x-font-ttf',
+ 'txt' => 'text/plain',
'vcard' => 'text/vcard',
'vcf' => 'text/vcard',
- 'wav'=>'audio/wav',
- 'webm'=>'video/webm',
- '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',
+ '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',
);
diff --git a/lib/private/urlgenerator.php b/lib/private/urlgenerator.php
index 4e3c1109000..60da34f2d6e 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;
}
}
diff --git a/lib/private/user.php b/lib/private/user.php
index 08ead712028..a89b7286c10 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 cd03b30205f..1740bad5abe 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 b7856436527..d3b682daa5c 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'));
}
}