summaryrefslogtreecommitdiffstats
path: root/lib/private
diff options
context:
space:
mode:
authorBjoern Schiessle <schiessle@owncloud.com>2013-11-26 00:03:54 +0100
committerBjoern Schiessle <schiessle@owncloud.com>2013-11-26 00:03:54 +0100
commit46dff0677d3eff1aa4da94865e82698229dd71e0 (patch)
tree91b96385b6a5725592bf68169f9d862b007bf14c /lib/private
parentacf74b24f24e1c2ea9e454a1c09f6bcf404f6627 (diff)
parent5310a5924b18849c85b482819c350d72a6d0c67c (diff)
downloadnextcloud-server-46dff0677d3eff1aa4da94865e82698229dd71e0.tar.gz
nextcloud-server-46dff0677d3eff1aa4da94865e82698229dd71e0.zip
Merge branch 'master' into calc_version_size
Diffstat (limited to 'lib/private')
-rw-r--r--lib/private/avatar.php8
-rw-r--r--lib/private/avatarmanager.php26
-rw-r--r--lib/private/connector/sabre/filesplugin.php14
-rw-r--r--lib/private/defaults.php50
-rw-r--r--lib/private/files.php10
-rw-r--r--lib/private/files/cache/cache.php2
-rw-r--r--lib/private/files/cache/updater.php2
-rw-r--r--lib/private/files/storage/common.php39
-rw-r--r--lib/private/files/storage/commontest.php2
-rw-r--r--lib/private/files/storage/home.php17
-rw-r--r--lib/private/files/storage/local.php8
-rw-r--r--lib/private/files/storage/mappedlocal.php8
-rw-r--r--lib/private/preview/movies.php10
-rwxr-xr-xlib/private/request.php16
-rw-r--r--lib/private/server.php12
-rw-r--r--lib/private/updater.php1
-rw-r--r--lib/private/user.php14
-rwxr-xr-xlib/private/util.php45
18 files changed, 215 insertions, 69 deletions
diff --git a/lib/private/avatar.php b/lib/private/avatar.php
index 720740569df..814a9b22bed 100644
--- a/lib/private/avatar.php
+++ b/lib/private/avatar.php
@@ -10,7 +10,7 @@
* This class gets and sets users avatars.
*/
-class OC_Avatar {
+class OC_Avatar implements \OCP\IAvatar {
private $view;
@@ -24,7 +24,7 @@ class OC_Avatar {
/**
* @brief get the users avatar
- * @param $size integer size in px of the avatar, defaults to 64
+ * @param $size integer size in px of the avatar, avatars are square, defaults to 64
* @return boolean|\OC_Image containing the avatar or false if there's no image
*/
public function get ($size = 64) {
@@ -54,7 +54,9 @@ class OC_Avatar {
$img = new OC_Image($data);
$type = substr($img->mimeType(), -3);
- if ($type === 'peg') { $type = 'jpg'; }
+ if ($type === 'peg') {
+ $type = 'jpg';
+ }
if ($type !== 'jpg' && $type !== 'png') {
$l = \OC_L10N::get('lib');
throw new \Exception($l->t("Unknown filetype"));
diff --git a/lib/private/avatarmanager.php b/lib/private/avatarmanager.php
new file mode 100644
index 00000000000..3ca46868ea6
--- /dev/null
+++ b/lib/private/avatarmanager.php
@@ -0,0 +1,26 @@
+<?php
+/**
+ * This file is licensed under the Affero General Public License version 3 or
+ * later.
+ * See the COPYING-README file.
+ */
+
+namespace OC;
+
+use OCP\IAvatarManager;
+
+/*
+ * This class implements methods to access Avatar functionality
+ */
+class AvatarManager implements IAvatarManager {
+
+ /**
+ * @brief return a user specific instance of \OCP\IAvatar
+ * @see \OCP\IAvatar
+ * @param $user string the ownCloud user id
+ * @return \OCP\IAvatar
+ */
+ function getAvatar($user) {
+ return new \OC_Avatar($user);
+ }
+}
diff --git a/lib/private/connector/sabre/filesplugin.php b/lib/private/connector/sabre/filesplugin.php
index 89444cb8d18..65231040fb5 100644
--- a/lib/private/connector/sabre/filesplugin.php
+++ b/lib/private/connector/sabre/filesplugin.php
@@ -78,6 +78,20 @@ class OC_Connector_Sabre_FilesPlugin extends Sabre_DAV_ServerPlugin
* @throws Sabre_DAV_Exception_BadRequest
*/
public function sendFileIdHeader($filePath, Sabre_DAV_INode $node = null) {
+ // chunked upload handling
+ if (isset($_SERVER['HTTP_OC_CHUNKED'])) {
+ list($path, $name) = \Sabre_DAV_URLUtil::splitPath($filePath);
+ $info = OC_FileChunking::decodeName($name);
+ if (!empty($info)) {
+ $filePath = $path . '/' . $info['name'];
+ }
+ }
+
+ // we get the node for the given $filePath here because in case of afterCreateFile $node is the parent folder
+ if (!$this->server->tree->nodeExists($filePath)) {
+ return;
+ }
+ $node = $this->server->tree->getNodeForPath($filePath);
if ($node instanceof OC_Connector_Sabre_Node) {
$fileId = $node->getFileId();
if (!is_null($fileId)) {
diff --git a/lib/private/defaults.php b/lib/private/defaults.php
index 4951c6f50ae..cec9a65c7f3 100644
--- a/lib/private/defaults.php
+++ b/lib/private/defaults.php
@@ -1,15 +1,13 @@
<?php
-/**
- * Default strings and values which differ between the enterprise and the
- * community edition. Use the get methods to always get the right strings.
- */
-
-
if (file_exists(OC::$SERVERROOT . '/themes/' . OC_Util::getTheme() . '/defaults.php')) {
require_once 'themes/' . OC_Util::getTheme() . '/defaults.php';
}
+/**
+ * Default strings and values which differ between the enterprise and the
+ * community edition. Use the get methods to always get the right strings.
+ */
class OC_Defaults {
private $theme;
@@ -48,6 +46,10 @@ class OC_Defaults {
return false;
}
+ /**
+ * Returns the base URL
+ * @return string URL
+ */
public function getBaseUrl() {
if ($this->themeExist('getBaseUrl')) {
return $this->theme->getBaseUrl();
@@ -56,6 +58,10 @@ class OC_Defaults {
}
}
+ /**
+ * Returns the URL where the sync clients are listed
+ * @return string URL
+ */
public function getSyncClientUrl() {
if ($this->themeExist('getSyncClientUrl')) {
return $this->theme->getSyncClientUrl();
@@ -64,6 +70,10 @@ class OC_Defaults {
}
}
+ /**
+ * Returns the documentation URL
+ * @return string URL
+ */
public function getDocBaseUrl() {
if ($this->themeExist('getDocBaseUrl')) {
return $this->theme->getDocBaseUrl();
@@ -72,6 +82,10 @@ class OC_Defaults {
}
}
+ /**
+ * Returns the title
+ * @return string title
+ */
public function getTitle() {
if ($this->themeExist('getTitle')) {
return $this->theme->getTitle();
@@ -80,6 +94,10 @@ class OC_Defaults {
}
}
+ /**
+ * Returns the short name of the software
+ * @return string title
+ */
public function getName() {
if ($this->themeExist('getName')) {
return $this->theme->getName();
@@ -88,6 +106,10 @@ class OC_Defaults {
}
}
+ /**
+ * Returns entity (e.g. company name) - used for footer, copyright
+ * @return string entity name
+ */
public function getEntity() {
if ($this->themeExist('getEntity')) {
return $this->theme->getEntity();
@@ -96,6 +118,10 @@ class OC_Defaults {
}
}
+ /**
+ * Returns slogan
+ * @return string slogan
+ */
public function getSlogan() {
if ($this->themeExist('getSlogan')) {
return $this->theme->getSlogan();
@@ -104,6 +130,10 @@ class OC_Defaults {
}
}
+ /**
+ * Returns logo claim
+ * @return string logo claim
+ */
public function getLogoClaim() {
if ($this->themeExist('getLogoClaim')) {
return $this->theme->getLogoClaim();
@@ -112,6 +142,10 @@ class OC_Defaults {
}
}
+ /**
+ * Returns short version of the footer
+ * @return string short footer
+ */
public function getShortFooter() {
if ($this->themeExist('getShortFooter')) {
$footer = $this->theme->getShortFooter();
@@ -123,6 +157,10 @@ class OC_Defaults {
return $footer;
}
+ /**
+ * Returns long version of the footer
+ * @return string long footer
+ */
public function getLongFooter() {
if ($this->themeExist('getLongFooter')) {
$footer = $this->theme->getLongFooter();
diff --git a/lib/private/files.php b/lib/private/files.php
index 8b4d5c59aee..8b8ff81ec5e 100644
--- a/lib/private/files.php
+++ b/lib/private/files.php
@@ -131,9 +131,11 @@ class OC_Files {
if ($filesize > -1) {
header("Content-Length: ".$filesize);
}
- list($storage) = \OC\Files\Filesystem::resolvePath($filename);
- if ($storage instanceof \OC\Files\Storage\Local) {
- self::addSendfileHeader(\OC\Files\Filesystem::getLocalFile($filename));
+ if ($xsendfile) {
+ list($storage) = \OC\Files\Filesystem::resolvePath(\OC\Files\Filesystem::getView()->getAbsolutePath($filename));
+ if ($storage instanceof \OC\Files\Storage\Local) {
+ self::addSendfileHeader(\OC\Files\Filesystem::getLocalFile($filename));
+ }
}
}
} elseif ($zip or !\OC\Files\Filesystem::file_exists($filename)) {
@@ -251,7 +253,7 @@ class OC_Files {
header("HTTP/1.0 409 Conflict");
OC_Template::printErrorPage(
$l->t('Selected files too large to generate zip file.'),
- $l->t('Download the files in smaller chunks, seperately or kindly ask your administrator.')
+ $l->t('Please download the files separately in smaller chunks or kindly ask your administrator.')
.'<br/><a href="javascript:history.back()">'
. $l->t('Back to Files') . '</a>'
);
diff --git a/lib/private/files/cache/cache.php b/lib/private/files/cache/cache.php
index 8c34fa58540..ac50a988e32 100644
--- a/lib/private/files/cache/cache.php
+++ b/lib/private/files/cache/cache.php
@@ -507,7 +507,7 @@ class Cache {
$entry = $this->get($path);
if ($entry && $entry['mimetype'] === 'httpd/unix-directory') {
$id = $entry['fileid'];
- $sql = 'SELECT SUM(`size`), MIN(`size`) FROM `*PREFIX*filecache` '.
+ $sql = 'SELECT SUM(`size`) AS f1, MIN(`size`) AS f2 FROM `*PREFIX*filecache` '.
'WHERE `parent` = ? AND `storage` = ?';
$result = \OC_DB::executeAudited($sql, array($id, $this->getNumericStorageId()));
if ($row = $result->fetchRow()) {
diff --git a/lib/private/files/cache/updater.php b/lib/private/files/cache/updater.php
index da223567001..d45c5e17fc8 100644
--- a/lib/private/files/cache/updater.php
+++ b/lib/private/files/cache/updater.php
@@ -142,7 +142,7 @@ class Updater {
$cache->update($id, array('mtime' => $time, 'etag' => $storage->getETag($internalPath)));
if ($realPath !== '') {
$realPath = dirname($realPath);
- if($realPath === '/') {
+ if($realPath === DIRECTORY_SEPARATOR ) {
$realPath = "";
}
// check storage for parent in case we change the storage in this step
diff --git a/lib/private/files/storage/common.php b/lib/private/files/storage/common.php
index 3943d667c35..678bf419023 100644
--- a/lib/private/files/storage/common.php
+++ b/lib/private/files/storage/common.php
@@ -51,6 +51,19 @@ abstract class Common implements \OC\Files\Storage\Storage {
}
}
+ public function isReadable($path) {
+ // at least check whether it exists
+ // subclasses might want to implement this more thoroughly
+ return $this->file_exists($path);
+ }
+
+ public function isUpdatable($path) {
+ // at least check whether it exists
+ // subclasses might want to implement this more thoroughly
+ // a non-existing file/folder isn't updatable
+ return $this->file_exists($path);
+ }
+
public function isCreatable($path) {
if ($this->is_dir($path) && $this->isUpdatable($path)) {
return true;
@@ -142,7 +155,7 @@ abstract class Common implements \OC\Files\Storage\Storage {
return false;
} else {
$directoryHandle = $this->opendir($directory);
- if(is_resource($directoryHandle)) {
+ if (is_resource($directoryHandle)) {
while (($contents = readdir($directoryHandle)) !== false) {
if (!\OC\Files\Filesystem::isIgnoredDir($contents)) {
$path = $directory . '/' . $contents;
@@ -165,27 +178,13 @@ abstract class Common implements \OC\Files\Storage\Storage {
}
public function getMimeType($path) {
- if (!$this->file_exists($path)) {
- return false;
- }
if ($this->is_dir($path)) {
return 'httpd/unix-directory';
- }
- $source = $this->fopen($path, 'r');
- if (!$source) {
- return false;
- }
- $head = fread($source, 8192); //8kb should suffice to determine a mimetype
- if ($pos = strrpos($path, '.')) {
- $extension = substr($path, $pos);
+ } elseif ($this->file_exists($path)) {
+ return \OC_Helper::getFileNameMimeType($path);
} else {
- $extension = '';
+ return false;
}
- $tmpFile = \OC_Helper::tmpFile($extension);
- file_put_contents($tmpFile, $head);
- $mime = \OC_Helper::getMimeType($tmpFile);
- unlink($tmpFile);
- return $mime;
}
public function hash($type, $path, $raw = false) {
@@ -227,7 +226,7 @@ abstract class Common implements \OC\Files\Storage\Storage {
private function addLocalFolder($path, $target) {
$dh = $this->opendir($path);
- if(is_resource($dh)) {
+ if (is_resource($dh)) {
while (($file = readdir($dh)) !== false) {
if ($file !== '.' and $file !== '..') {
if ($this->is_dir($path . '/' . $file)) {
@@ -298,7 +297,7 @@ abstract class Common implements \OC\Files\Storage\Storage {
return $this->watcher;
}
- public function getStorageCache(){
+ public function getStorageCache() {
if (!isset($this->storageCache)) {
$this->storageCache = new \OC\Files\Cache\Storage($this);
}
diff --git a/lib/private/files/storage/commontest.php b/lib/private/files/storage/commontest.php
index c3f1eb31955..2394b14a82f 100644
--- a/lib/private/files/storage/commontest.php
+++ b/lib/private/files/storage/commontest.php
@@ -54,7 +54,7 @@ class CommonTest extends \OC\Files\Storage\Common{
return $this->storage->stat($path);
}
public function filetype($path) {
- return $this->storage->filetype($path);
+ return @$this->storage->filetype($path);
}
public function isReadable($path) {
return $this->storage->isReadable($path);
diff --git a/lib/private/files/storage/home.php b/lib/private/files/storage/home.php
index b4ceb8f4f9b..1c2a682f197 100644
--- a/lib/private/files/storage/home.php
+++ b/lib/private/files/storage/home.php
@@ -22,6 +22,12 @@ class Home extends Local {
*/
protected $user;
+ /**
+ * @brief Construct a Home storage instance
+ * @param array $arguments array with "user" containing the
+ * storage owner and "legacy" containing "true" if the storage is
+ * a legacy storage with "local::" URL instead of the new "home::" one.
+ */
public function __construct($arguments) {
$this->user = $arguments['user'];
$datadir = $this->user->getHome();
@@ -40,10 +46,21 @@ class Home extends Local {
return $this->id;
}
+ /**
+ * @return \OC\Files\Cache\HomeCache
+ */
public function getCache($path = '') {
if (!isset($this->cache)) {
$this->cache = new \OC\Files\Cache\HomeCache($this);
}
return $this->cache;
}
+
+ /**
+ * @brief Returns the owner of this home storage
+ * @return \OC\User\User owner of this home storage
+ */
+ public function getUser() {
+ return $this->user;
+ }
}
diff --git a/lib/private/files/storage/local.php b/lib/private/files/storage/local.php
index 5209fabc30a..02e8df4af4e 100644
--- a/lib/private/files/storage/local.php
+++ b/lib/private/files/storage/local.php
@@ -203,14 +203,6 @@ if (\OC_Util::runningOnWindows()) {
return $return;
}
- public function getMimeType($path) {
- if ($this->isReadable($path)) {
- return \OC_Helper::getMimeType($this->datadir . $path);
- } else {
- return false;
- }
- }
-
private function delTree($dir) {
$dirRelative = $dir;
$dir = $this->datadir . $dir;
diff --git a/lib/private/files/storage/mappedlocal.php b/lib/private/files/storage/mappedlocal.php
index ba5ac4191c5..6c37d445867 100644
--- a/lib/private/files/storage/mappedlocal.php
+++ b/lib/private/files/storage/mappedlocal.php
@@ -210,14 +210,6 @@ class MappedLocal extends \OC\Files\Storage\Common{
return $return;
}
- public function getMimeType($path) {
- if($this->isReadable($path)) {
- return \OC_Helper::getMimeType($this->buildPath($path));
- }else{
- return false;
- }
- }
-
private function delTree($dir, $isLogicPath=true) {
$dirRelative=$dir;
if ($isLogicPath) {
diff --git a/lib/private/preview/movies.php b/lib/private/preview/movies.php
index 28f130f7506..ac771deb413 100644
--- a/lib/private/preview/movies.php
+++ b/lib/private/preview/movies.php
@@ -46,17 +46,19 @@ if (!\OC_Util::runningOnWindows()) {
$handle = $fileview->fopen($path, 'rb');
- $firstmb = stream_get_contents($handle, 1048576); //1024 * 1024 = 1048576
+ // we better use 5MB (1024 * 1024 * 5 = 5242880) instead of 1MB.
+ // in some cases 1MB was no enough to generate thumbnail
+ $firstmb = stream_get_contents($handle, 5242880);
file_put_contents($absPath, $firstmb);
if (self::$avconvBinary) {
- $cmd = self::$avconvBinary . ' -an -y -ss 1'.
+ $cmd = self::$avconvBinary . ' -an -y -ss 5'.
' -i ' . escapeshellarg($absPath) .
- ' -f mjpeg -vframes 1 ' . escapeshellarg($tmpPath) .
+ ' -f mjpeg -vframes 1 -vsync 1 ' . escapeshellarg($tmpPath) .
' > /dev/null 2>&1';
}
else {
- $cmd = self::$ffmpegBinary . ' -y -ss 1' .
+ $cmd = self::$ffmpegBinary . ' -y -ss 5' .
' -i ' . escapeshellarg($absPath) .
' -f mjpeg -vframes 1' .
' -s ' . escapeshellarg($maxX) . 'x' . escapeshellarg($maxY) .
diff --git a/lib/private/request.php b/lib/private/request.php
index df33217f95d..7a75bf25208 100755
--- a/lib/private/request.php
+++ b/lib/private/request.php
@@ -9,6 +9,7 @@
class OC_Request {
/**
* @brief Check overwrite condition
+ * @param string $type
* @returns bool
*/
private static function isOverwriteCondition($type = '') {
@@ -99,7 +100,7 @@ class OC_Request {
public static function scriptName() {
$name = $_SERVER['SCRIPT_NAME'];
if (OC_Config::getValue('overwritewebroot', '') !== '' and self::isOverwriteCondition()) {
- $serverroot = str_replace("\\", '/', substr(__DIR__, 0, -4));
+ $serverroot = str_replace("\\", '/', substr(__DIR__, 0, -strlen('lib/private/')));
$suburi = str_replace("\\", "/", substr(realpath($_SERVER["SCRIPT_FILENAME"]), strlen($serverroot)));
$name = OC_Config::getValue('overwritewebroot', '') . $suburi;
}
@@ -135,7 +136,18 @@ class OC_Request {
* @returns string Path info or false when not found
*/
public static function getRawPathInfo() {
- $path_info = substr($_SERVER['REQUEST_URI'], strlen($_SERVER['SCRIPT_NAME']));
+ $requestUri = $_SERVER['REQUEST_URI'];
+ // remove too many leading slashes - can be caused by reverse proxy configuration
+ if (strpos($requestUri, '/') === 0) {
+ $requestUri = '/' . ltrim($requestUri, '/');
+ }
+
+ $scriptName = $_SERVER['SCRIPT_NAME'];
+ // in case uri and script name don't match we better throw an exception
+ if (strpos($requestUri, $scriptName) !== 0) {
+ throw new Exception("REQUEST_URI($requestUri) does not start with the SCRIPT_NAME($scriptName)");
+ }
+ $path_info = substr($requestUri, strlen($scriptName));
// Remove the query string from REQUEST_URI
if ($pos = strpos($path_info, '?')) {
$path_info = substr($path_info, 0, $pos);
diff --git a/lib/private/server.php b/lib/private/server.php
index 65899f3007e..77c3732a9ca 100644
--- a/lib/private/server.php
+++ b/lib/private/server.php
@@ -131,6 +131,9 @@ class Server extends SimpleContainer implements IServerContainer {
$this->registerService('ActivityManager', function($c) {
return new ActivityManager();
});
+ $this->registerService('AvatarManager', function($c) {
+ return new AvatarManager();
+ });
}
/**
@@ -171,6 +174,15 @@ class Server extends SimpleContainer implements IServerContainer {
}
/**
+ * Returns the avatar manager, used for avatar functionality
+ *
+ * @return \OCP\IAvatarManager
+ */
+ function getAvatarManager() {
+ return $this->query('AvatarManager');
+ }
+
+ /**
* Returns the root folder of ownCloud's data directory
*
* @return \OCP\Files\Folder
diff --git a/lib/private/updater.php b/lib/private/updater.php
index 9827d8a8c12..a1b07c5a242 100644
--- a/lib/private/updater.php
+++ b/lib/private/updater.php
@@ -58,6 +58,7 @@ class Updater extends BasicEmitter {
$version['updated'] = \OC_Appconfig::getValue('core', 'lastupdatedat');
$version['updatechannel'] = \OC_Util::getChannel();
$version['edition'] = \OC_Util::getEditionString();
+ $version['build'] = \OC_Util::getBuild();
$versionString = implode('x', $version);
//fetch xml data from updater
diff --git a/lib/private/user.php b/lib/private/user.php
index f15fdf1dbbc..5bd36006750 100644
--- a/lib/private/user.php
+++ b/lib/private/user.php
@@ -54,6 +54,9 @@ class OC_User {
private static $_setupedBackends = array();
+ // bool, stores if a user want to access a resource anonymously, e.g if he opens a public link
+ private static $incognitoMode = false;
+
/**
* @brief registers backend
* @param string $backend name of the backend
@@ -320,6 +323,15 @@ class OC_User {
}
/**
+ * @brief set incognito mode, e.g. if a user wants to open a public link
+ * @param bool $status
+ */
+ public static function setIncognitoMode($status) {
+ self::$incognitoMode = $status;
+
+ }
+
+ /**
* Supplies an attribute to the logout hyperlink. The default behaviour
* is to return an href with '?logout=true' appended. However, it can
* supply any attribute(s) which are valid for <a>.
@@ -354,7 +366,7 @@ class OC_User {
*/
public static function getUser() {
$uid = OC::$session ? OC::$session->get('user_id') : null;
- if (!is_null($uid)) {
+ if (!is_null($uid) && self::$incognitoMode === false) {
return $uid;
} else {
return false;
diff --git a/lib/private/util.php b/lib/private/util.php
index 176eb4bc369..b5c5546da35 100755
--- a/lib/private/util.php
+++ b/lib/private/util.php
@@ -53,16 +53,21 @@ class OC_Util {
//if we aren't logged in, there is no use to set up the filesystem
if( $user != "" ) {
- $quota = self::getUserQuota($user);
- if ($quota !== \OC\Files\SPACE_UNLIMITED) {
- \OC\Files\Filesystem::addStorageWrapper(function($mountPoint, $storage) use ($quota, $user) {
- if ($mountPoint === '/' . $user . '/'){
+ \OC\Files\Filesystem::addStorageWrapper(function($mountPoint, $storage){
+ // set up quota for home storages, even for other users
+ // which can happen when using sharing
+
+ if ($storage instanceof \OC\Files\Storage\Home) {
+ $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));
- } else {
- return $storage;
}
- });
- }
+ }
+
+ return $storage;
+ });
+
$userDir = '/'.$user.'/files';
$userRoot = OC_User::getHome($user);
$userDirectory = $userRoot . '/files';
@@ -353,6 +358,13 @@ class OC_Util {
$errors = array_merge($errors, self::checkDataDirectoryPermissions($CONFIG_DATADIRECTORY));
}
+ if(!OC_Util::isSetLocaleWorking()) {
+ $errors[] = array(
+ 'error' => 'Setting locale to en_US.UTF-8/fr_FR.UTF-8/es_ES.UTF-8/de_DE.UTF-8/ru_RU.UTF-8/pt_BR.UTF-8/it_IT.UTF-8/ja_JP.UTF-8/zh_CN.UTF-8 failed',
+ 'hint' => 'Please install one of theses locales on your system and restart your webserver.'
+ );
+ }
+
$moduleHint = "Please ask your server administrator to install the module.";
// check if all required php modules are present
if(!class_exists('ZipArchive')) {
@@ -847,8 +859,8 @@ class OC_Util {
return true;
}
- $result = setlocale(LC_ALL, 'en_US.UTF-8', 'en_US.UTF8');
- if($result == false) {
+ \Patchwork\Utf8\Bootup::initLocale();
+ if ('' === basename('ยง')) {
return false;
}
return true;
@@ -1099,4 +1111,17 @@ class OC_Util {
$t = explode('/', $file);
return array_pop($t);
}
+
+ /**
+ * A human readable string is generated based on version, channel and build number
+ * @return string
+ */
+ public static function getHumanVersion() {
+ $version = OC_Util::getVersionString().' ('.OC_Util::getChannel().')';
+ $build = OC_Util::getBuild();
+ if(!empty($build) and OC_Util::getChannel() === 'daily') {
+ $version .= ' Build:' . $build;
+ }
+ return $version;
+ }
}