aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorRobin Appelman <icewind@owncloud.com>2013-09-12 21:43:35 +0200
committerRobin Appelman <icewind@owncloud.com>2013-09-12 21:43:35 +0200
commitc9d26631592ba58d8026a14e7f637cfe835fa15d (patch)
treeb6bc91006e0207a2e2b26ba5d1205853e0ca7fda /lib
parentb9167196fb331d7197210e4a130e03d32d839b8a (diff)
parentc7ca86799b2608609ead7ecd2d84d0bbd47c6548 (diff)
downloadnextcloud-server-c9d26631592ba58d8026a14e7f637cfe835fa15d.tar.gz
nextcloud-server-c9d26631592ba58d8026a14e7f637cfe835fa15d.zip
Merge branch 'master' into fileapi-foreward
Diffstat (limited to 'lib')
-rw-r--r--lib/app.php8
-rw-r--r--lib/base.php23
-rw-r--r--lib/db.php12
-rw-r--r--lib/files/view.php91
-rw-r--r--lib/helper.php8
-rw-r--r--lib/image.php301
-rw-r--r--lib/l10n/ach.php8
-rw-r--r--lib/l10n/es.php24
-rw-r--r--lib/l10n/es_AR.php22
-rw-r--r--lib/l10n/es_MX.php8
-rw-r--r--lib/l10n/fr.php26
-rw-r--r--lib/l10n/it.php1
-rw-r--r--lib/l10n/ja_JP.php14
-rw-r--r--lib/l10n/nn_NO.php10
-rw-r--r--lib/l10n/nqo.php8
-rw-r--r--lib/l10n/pl.php22
-rw-r--r--lib/l10n/pt_BR.php8
-rw-r--r--lib/l10n/pt_PT.php8
-rw-r--r--lib/l10n/sq.php8
-rw-r--r--lib/ocs/activity.php28
-rw-r--r--lib/ocsclient.php49
-rw-r--r--lib/preview/movies.php8
-rw-r--r--lib/public/preview.php2
-rw-r--r--lib/public/share.php11
-rw-r--r--lib/setup.php2
-rw-r--r--lib/setup/mysql.php2
-rw-r--r--lib/setup/oci.php2
-rw-r--r--lib/setup/postgresql.php2
-rw-r--r--lib/templatelayout.php4
-rw-r--r--lib/user.php2
-rwxr-xr-xlib/util.php512
31 files changed, 691 insertions, 543 deletions
diff --git a/lib/app.php b/lib/app.php
index 8f5dd1d685e..1a0a7e6f9a9 100644
--- a/lib/app.php
+++ b/lib/app.php
@@ -73,11 +73,11 @@ class OC_App{
if (!defined('DEBUG') || !DEBUG) {
if (is_null($types)
- && empty(OC_Util::$core_scripts)
- && empty(OC_Util::$core_styles)) {
- OC_Util::$core_scripts = OC_Util::$scripts;
+ && empty(OC_Util::$coreScripts)
+ && empty(OC_Util::$coreStyles)) {
+ OC_Util::$coreScripts = OC_Util::$scripts;
OC_Util::$scripts = array();
- OC_Util::$core_styles = OC_Util::$styles;
+ OC_Util::$coreStyles = OC_Util::$styles;
OC_Util::$styles = array();
}
}
diff --git a/lib/base.php b/lib/base.php
index b5c12a683ff..ea5adbadc9d 100644
--- a/lib/base.php
+++ b/lib/base.php
@@ -417,7 +417,7 @@ class OC {
}
self::initPaths();
- OC_Util::issetlocaleworking();
+ OC_Util::isSetLocaleWorking();
// set debug mode if an xdebug session is active
if (!defined('DEBUG') || !DEBUG) {
@@ -529,7 +529,7 @@ class OC {
}
// write error into log if locale can't be set
- if (OC_Util::issetlocaleworking() == false) {
+ if (OC_Util::isSetLocaleWorking() == false) {
OC_Log::write('core',
'setting locale to en_US.UTF-8/en_US.UTF8 failed. Support is probably not installed on your system',
OC_Log::ERROR);
@@ -768,7 +768,7 @@ class OC {
if (in_array($_COOKIE['oc_token'], $tokens, true)) {
// replace successfully used token with a new one
OC_Preferences::deleteKey($_COOKIE['oc_username'], 'login_token', $_COOKIE['oc_token']);
- $token = OC_Util::generate_random_bytes(32);
+ $token = OC_Util::generateRandomBytes(32);
OC_Preferences::setValue($_COOKIE['oc_username'], 'login_token', $token, time());
OC_User::setMagicInCookie($_COOKIE['oc_username'], $token);
// login
@@ -808,7 +808,7 @@ class OC {
if (defined("DEBUG") && DEBUG) {
OC_Log::write('core', 'Setting remember login to cookie', OC_Log::DEBUG);
}
- $token = OC_Util::generate_random_bytes(32);
+ $token = OC_Util::generateRandomBytes(32);
OC_Preferences::setValue($userid, 'login_token', $token, time());
OC_User::setMagicInCookie($userid, $token);
} else {
@@ -826,16 +826,11 @@ class OC {
) {
return false;
}
- // don't redo authentication if user is already logged in
- // otherwise session would be invalidated in OC_User::login with
- // session_regenerate_id at every page load
- if (!OC_User::isLoggedIn()) {
- OC_App::loadApps(array('authentication'));
- if (OC_User::login($_SERVER["PHP_AUTH_USER"], $_SERVER["PHP_AUTH_PW"])) {
- //OC_Log::write('core',"Logged in with HTTP Authentication", OC_Log::DEBUG);
- OC_User::unsetMagicInCookie();
- $_SERVER['HTTP_REQUESTTOKEN'] = OC_Util::callRegister();
- }
+ OC_App::loadApps(array('authentication'));
+ if (OC_User::login($_SERVER["PHP_AUTH_USER"], $_SERVER["PHP_AUTH_PW"])) {
+ //OC_Log::write('core',"Logged in with HTTP Authentication", OC_Log::DEBUG);
+ OC_User::unsetMagicInCookie();
+ $_SERVER['HTTP_REQUESTTOKEN'] = OC_Util::callRegister();
}
return true;
}
diff --git a/lib/db.php b/lib/db.php
index ebd012c72f8..f090f474243 100644
--- a/lib/db.php
+++ b/lib/db.php
@@ -330,18 +330,6 @@ class OC_DB {
}
/**
- * @brief Disconnect
- *
- * This is good bye, good bye, yeah!
- */
- public static function disconnect() {
- // Cut connection if required
- if(self::$connection) {
- self::$connection->close();
- }
- }
-
- /**
* @brief saves database schema to xml file
* @param string $file name of file
* @param int $mode
diff --git a/lib/files/view.php b/lib/files/view.php
index 3a1fdd415b3..1037e8f2007 100644
--- a/lib/files/view.php
+++ b/lib/files/view.php
@@ -268,18 +268,18 @@ class View {
$absolutePath = Filesystem::normalizePath($this->getAbsolutePath($path));
if (\OC_FileProxy::runPreProxies('file_put_contents', $absolutePath, $data)
and Filesystem::isValidPath($path)
- and !Filesystem::isFileBlacklisted($path)
+ and !Filesystem::isFileBlacklisted($path)
) {
$path = $this->getRelativePath($absolutePath);
$exists = $this->file_exists($path);
$run = true;
- if ($this->fakeRoot == Filesystem::getRoot() && !Cache\Scanner::isPartialFile($path)) {
+ if ($this->shouldEmitHooks($path)) {
if (!$exists) {
\OC_Hook::emit(
Filesystem::CLASSNAME,
Filesystem::signal_create,
array(
- Filesystem::signal_param_path => $path,
+ Filesystem::signal_param_path => $this->getHookPath($path),
Filesystem::signal_param_run => &$run
)
);
@@ -288,7 +288,7 @@ class View {
Filesystem::CLASSNAME,
Filesystem::signal_write,
array(
- Filesystem::signal_param_path => $path,
+ Filesystem::signal_param_path => $this->getHookPath($path),
Filesystem::signal_param_run => &$run
)
);
@@ -301,18 +301,18 @@ class View {
list ($count, $result) = \OC_Helper::streamCopy($data, $target);
fclose($target);
fclose($data);
- if ($this->fakeRoot == Filesystem::getRoot() && !Cache\Scanner::isPartialFile($path) && $result !== false) {
+ if ($this->shouldEmitHooks($path) && $result !== false) {
if (!$exists) {
\OC_Hook::emit(
Filesystem::CLASSNAME,
Filesystem::signal_post_create,
- array(Filesystem::signal_param_path => $path)
+ array(Filesystem::signal_param_path => $this->getHookPath($path))
);
}
\OC_Hook::emit(
Filesystem::CLASSNAME,
Filesystem::signal_post_write,
- array(Filesystem::signal_param_path => $path)
+ array(Filesystem::signal_param_path => $this->getHookPath($path))
);
}
\OC_FileProxy::runPostProxies('file_put_contents', $absolutePath, $count);
@@ -333,7 +333,7 @@ class View {
}
public function deleteAll($directory, $empty = false) {
- return $this->basicOperation('deleteAll', $directory, array('delete'), $empty);
+ return $this->rmdir($directory);
}
public function rename($path1, $path2) {
@@ -354,21 +354,21 @@ class View {
return false;
}
$run = true;
- if ($this->fakeRoot == Filesystem::getRoot() && (Cache\Scanner::isPartialFile($path1) && !Cache\Scanner::isPartialFile($path2))) {
+ if ($this->shouldEmitHooks() && (Cache\Scanner::isPartialFile($path1) && !Cache\Scanner::isPartialFile($path2))) {
// if it was a rename from a part file to a regular file it was a write and not a rename operation
\OC_Hook::emit(
Filesystem::CLASSNAME, Filesystem::signal_write,
array(
- Filesystem::signal_param_path => $path2,
+ Filesystem::signal_param_path => $this->getHookPath($path2),
Filesystem::signal_param_run => &$run
)
);
- } elseif ($this->fakeRoot == Filesystem::getRoot()) {
+ } elseif ($this->shouldEmitHooks()) {
\OC_Hook::emit(
Filesystem::CLASSNAME, Filesystem::signal_rename,
array(
- Filesystem::signal_param_oldpath => $path1,
- Filesystem::signal_param_newpath => $path2,
+ Filesystem::signal_param_oldpath => $this->getHookPath($path1),
+ Filesystem::signal_param_newpath => $this->getHookPath($path2),
Filesystem::signal_param_run => &$run
)
);
@@ -408,22 +408,22 @@ class View {
}
}
}
- if ($this->fakeRoot == Filesystem::getRoot() && (Cache\Scanner::isPartialFile($path1) && !Cache\Scanner::isPartialFile($path2)) && $result !== false) {
+ if ($this->shouldEmitHooks() && (Cache\Scanner::isPartialFile($path1) && !Cache\Scanner::isPartialFile($path2)) && $result !== false) {
// if it was a rename from a part file to a regular file it was a write and not a rename operation
\OC_Hook::emit(
Filesystem::CLASSNAME,
Filesystem::signal_post_write,
array(
- Filesystem::signal_param_path => $path2,
+ Filesystem::signal_param_path => $this->getHookPath($path2),
)
);
- } elseif ($this->fakeRoot == Filesystem::getRoot() && $result !== false) {
+ } elseif ($this->shouldEmitHooks() && $result !== false) {
\OC_Hook::emit(
Filesystem::CLASSNAME,
Filesystem::signal_post_rename,
array(
- Filesystem::signal_param_oldpath => $path1,
- Filesystem::signal_param_newpath => $path2
+ Filesystem::signal_param_oldpath => $this->getHookPath($path1),
+ Filesystem::signal_param_newpath => $this->getHookPath($path2)
)
);
}
@@ -455,13 +455,13 @@ class View {
}
$run = true;
$exists = $this->file_exists($path2);
- if ($this->fakeRoot == Filesystem::getRoot()) {
+ if ($this->shouldEmitHooks()) {
\OC_Hook::emit(
Filesystem::CLASSNAME,
Filesystem::signal_copy,
array(
- Filesystem::signal_param_oldpath => $path1,
- Filesystem::signal_param_newpath => $path2,
+ Filesystem::signal_param_oldpath => $this->getHookPath($path1),
+ Filesystem::signal_param_newpath => $this->getHookPath($path2),
Filesystem::signal_param_run => &$run
)
);
@@ -470,7 +470,7 @@ class View {
Filesystem::CLASSNAME,
Filesystem::signal_create,
array(
- Filesystem::signal_param_path => $path2,
+ Filesystem::signal_param_path => $this->getHookPath($path2),
Filesystem::signal_param_run => &$run
)
);
@@ -480,7 +480,7 @@ class View {
Filesystem::CLASSNAME,
Filesystem::signal_write,
array(
- Filesystem::signal_param_path => $path2,
+ Filesystem::signal_param_path => $this->getHookPath($path2),
Filesystem::signal_param_run => &$run
)
);
@@ -511,26 +511,26 @@ class View {
list($count, $result) = \OC_Helper::streamCopy($source, $target);
}
}
- if ($this->fakeRoot == Filesystem::getRoot() && $result !== false) {
+ if ($this->shouldEmitHooks() && $result !== false) {
\OC_Hook::emit(
Filesystem::CLASSNAME,
Filesystem::signal_post_copy,
array(
- Filesystem::signal_param_oldpath => $path1,
- Filesystem::signal_param_newpath => $path2
+ Filesystem::signal_param_oldpath => $this->getHookPath($path1),
+ Filesystem::signal_param_newpath => $this->getHookPath($path2)
)
);
if (!$exists) {
\OC_Hook::emit(
Filesystem::CLASSNAME,
Filesystem::signal_post_create,
- array(Filesystem::signal_param_path => $path2)
+ array(Filesystem::signal_param_path => $this->getHookPath($path2))
);
}
\OC_Hook::emit(
Filesystem::CLASSNAME,
Filesystem::signal_post_write,
- array(Filesystem::signal_param_path => $path2)
+ array(Filesystem::signal_param_path => $this->getHookPath($path2))
);
}
return $result;
@@ -621,11 +621,11 @@ class View {
if ($path == null) {
return false;
}
- if (Filesystem::$loaded && $this->fakeRoot == Filesystem::getRoot()) {
+ if ($this->shouldEmitHooks($path)) {
\OC_Hook::emit(
Filesystem::CLASSNAME,
Filesystem::signal_read,
- array(Filesystem::signal_param_path => $path)
+ array(Filesystem::signal_param_path => $this->getHookPath($path))
);
}
list($storage, $internalPath) = Filesystem::resolvePath($absolutePath . $postFix);
@@ -659,7 +659,7 @@ class View {
$absolutePath = Filesystem::normalizePath($this->getAbsolutePath($path));
if (\OC_FileProxy::runPreProxies($operation, $absolutePath, $extraParam)
and Filesystem::isValidPath($path)
- and !Filesystem::isFileBlacklisted($path)
+ and !Filesystem::isFileBlacklisted($path)
) {
$path = $this->getRelativePath($absolutePath);
if ($path == null) {
@@ -675,7 +675,7 @@ class View {
$result = $storage->$operation($internalPath);
}
$result = \OC_FileProxy::runPostProxies($operation, $this->getAbsolutePath($path), $result);
- if (Filesystem::$loaded and $this->fakeRoot == Filesystem::getRoot() && $result !== false) {
+ if ($this->shouldEmitHooks($path) && $result !== false) {
if ($operation != 'fopen') { //no post hooks for fopen, the file stream is still open
$this->runHooks($hooks, $path, true);
}
@@ -686,10 +686,35 @@ class View {
return null;
}
+ /**
+ * get the path relative to the default root for hook usage
+ *
+ * @param string $path
+ * @return string
+ */
+ private function getHookPath($path) {
+ if (!Filesystem::getView()) {
+ return $path;
+ }
+ return Filesystem::getView()->getRelativePath($this->getAbsolutePath($path));
+ }
+
+ private function shouldEmitHooks($path = '') {
+ if ($path && Cache\Scanner::isPartialFile($path)) {
+ return false;
+ }
+ if (!Filesystem::$loaded) {
+ return false;
+ }
+ $defaultRoot = Filesystem::getRoot();
+ return (strlen($this->fakeRoot) >= strlen($defaultRoot)) && (substr($this->fakeRoot, 0, strlen($defaultRoot)) === $defaultRoot);
+ }
+
private function runHooks($hooks, $path, $post = false) {
+ $path = $this->getHookPath($path);
$prefix = ($post) ? 'post_' : '';
$run = true;
- if (Filesystem::$loaded and $this->fakeRoot == Filesystem::getRoot() && !Cache\Scanner::isPartialFile($path)) {
+ if ($this->shouldEmitHooks($path)) {
foreach ($hooks as $hook) {
if ($hook != 'read') {
\OC_Hook::emit(
diff --git a/lib/helper.php b/lib/helper.php
index 5fb8fed3459..1f1ce8451c0 100644
--- a/lib/helper.php
+++ b/lib/helper.php
@@ -232,6 +232,14 @@ class OC_Helper {
self::$mimetypeIcons[$mimetype] = OC::$WEBROOT . '/core/img/filetypes/folder.png';
return OC::$WEBROOT . '/core/img/filetypes/folder.png';
}
+ if ($mimetype === 'dir-shared') {
+ self::$mimetypeIcons[$mimetype] = OC::$WEBROOT . '/core/img/filetypes/folder-shared.png';
+ return OC::$WEBROOT . '/core/img/filetypes/folder-shared.png';
+ }
+ if ($mimetype === 'dir-external') {
+ self::$mimetypeIcons[$mimetype] = OC::$WEBROOT . '/core/img/filetypes/folder-external.png';
+ return OC::$WEBROOT . '/core/img/filetypes/folder-external.png';
+ }
// Icon exists?
if (file_exists(OC::$SERVERROOT . '/core/img/filetypes/' . $icon . '.png')) {
diff --git a/lib/image.php b/lib/image.php
index 840b744ad72..7761a3c7737 100644
--- a/lib/image.php
+++ b/lib/image.php
@@ -25,24 +25,27 @@
*/
class OC_Image {
protected $resource = false; // tmp resource.
- protected $imagetype = IMAGETYPE_PNG; // Default to png if file type isn't evident.
- protected $bit_depth = 24;
- protected $filepath = null;
+ protected $imageType = IMAGETYPE_PNG; // Default to png if file type isn't evident.
+ protected $mimeType = "image/png"; // Default to png
+ protected $bitDepth = 24;
+ protected $filePath = null;
+
+ private $fileInfo;
/**
* @brief Get mime type for an image file.
* @param $filepath The path to a local image file.
* @returns string The mime type if the it could be determined, otherwise an empty string.
*/
- static public function getMimeTypeForFile($filepath) {
+ static public function getMimeTypeForFile($filePath) {
// exif_imagetype throws "read error!" if file is less than 12 byte
- if (filesize($filepath) > 11) {
- $imagetype = exif_imagetype($filepath);
+ if (filesize($filePath) > 11) {
+ $imageType = exif_imagetype($filePath);
}
else {
- $imagetype = false;
+ $imageType = false;
}
- return $imagetype ? image_type_to_mime_type($imagetype) : '';
+ return $imageType ? image_type_to_mime_type($imageType) : '';
}
/**
@@ -50,14 +53,19 @@ class OC_Image {
* @param $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) {
+ public function __construct($imageRef = null) {
//OC_Log::write('core',__METHOD__.'(): start', OC_Log::DEBUG);
if(!extension_loaded('gd') || !function_exists('gd_info')) {
OC_Log::write('core', __METHOD__.'(): GD module not installed', OC_Log::ERROR);
return false;
}
- if(!is_null($imageref)) {
- $this->load($imageref);
+
+ if (\OC_Util::fileInfoLoaded()) {
+ $this->fileInfo = new finfo(FILEINFO_MIME_TYPE);
+ }
+
+ if(!is_null($imageRef)) {
+ $this->load($imageRef);
}
}
@@ -74,7 +82,7 @@ class OC_Image {
* @returns int
*/
public function mimeType() {
- return $this->valid() ? image_type_to_mime_type($this->imagetype) : '';
+ return $this->valid() ? $this->mimeType : '';
}
/**
@@ -157,30 +165,30 @@ class OC_Image {
* @returns bool
*/
- public function save($filepath=null) {
- if($filepath === null && $this->filepath === null) {
+ public function save($filePath=null) {
+ if($filePath === null && $this->filePath === null) {
OC_Log::write('core', __METHOD__.'(): called with no path.', OC_Log::ERROR);
return false;
- } elseif($filepath === null && $this->filepath !== null) {
- $filepath = $this->filepath;
+ } elseif($filePath === null && $this->filePath !== null) {
+ $filePath = $this->filePath;
}
- return $this->_output($filepath);
+ return $this->_output($filePath);
}
/**
* @brief Outputs/saves the image.
*/
- private function _output($filepath=null) {
- if($filepath) {
- if (!file_exists(dirname($filepath)))
- mkdir(dirname($filepath), 0777, true);
- if(!is_writable(dirname($filepath))) {
+ private function _output($filePath=null) {
+ if($filePath) {
+ if (!file_exists(dirname($filePath)))
+ mkdir(dirname($filePath), 0777, true);
+ if(!is_writable(dirname($filePath))) {
OC_Log::write('core',
- __METHOD__.'(): Directory \''.dirname($filepath).'\' is not writable.',
+ __METHOD__.'(): Directory \''.dirname($filePath).'\' is not writable.',
OC_Log::ERROR);
return false;
- } elseif(is_writable(dirname($filepath)) && file_exists($filepath) && !is_writable($filepath)) {
- OC_Log::write('core', __METHOD__.'(): File \''.$filepath.'\' is not writable.', OC_Log::ERROR);
+ } elseif(is_writable(dirname($filePath)) && file_exists($filePath) && !is_writable($filePath)) {
+ OC_Log::write('core', __METHOD__.'(): File \''.$filePath.'\' is not writable.', OC_Log::ERROR);
return false;
}
}
@@ -188,30 +196,30 @@ class OC_Image {
return false;
}
- $retval = false;
- switch($this->imagetype) {
+ $retVal = false;
+ switch($this->imageType) {
case IMAGETYPE_GIF:
- $retval = imagegif($this->resource, $filepath);
+ $retVal = imagegif($this->resource, $filePath);
break;
case IMAGETYPE_JPEG:
- $retval = imagejpeg($this->resource, $filepath);
+ $retVal = imagejpeg($this->resource, $filePath);
break;
case IMAGETYPE_PNG:
- $retval = imagepng($this->resource, $filepath);
+ $retVal = imagepng($this->resource, $filePath);
break;
case IMAGETYPE_XBM:
- $retval = imagexbm($this->resource, $filepath);
+ $retVal = imagexbm($this->resource, $filePath);
break;
case IMAGETYPE_WBMP:
- $retval = imagewbmp($this->resource, $filepath);
+ $retVal = imagewbmp($this->resource, $filePath);
break;
case IMAGETYPE_BMP:
- $retval = imagebmp($this->resource, $filepath, $this->bit_depth);
+ $retVal = imagebmp($this->resource, $filePath, $this->bitDepth);
break;
default:
- $retval = imagepng($this->resource, $filepath);
+ $retVal = imagepng($this->resource, $filePath);
}
- return $retval;
+ return $retVal;
}
/**
@@ -233,7 +241,21 @@ class OC_Image {
*/
function data() {
ob_start();
- $res = imagepng($this->resource);
+ switch ($this->mimeType) {
+ case "image/png":
+ $res = imagepng($this->resource);
+ break;
+ case "image/jpeg":
+ $res = imagejpeg($this->resource);
+ break;
+ case "image/gif":
+ $res = imagegif($this->resource);
+ break;
+ default:
+ $res = imagepng($this->resource);
+ OC_Log::write('core', 'OC_Image->data. Couldn\'t guess mimetype, defaulting to png', OC_Log::INFO);
+ break;
+ }
if (!$res) {
OC_Log::write('core', 'OC_Image->data. Error getting image data.', OC_Log::ERROR);
}
@@ -261,11 +283,11 @@ class OC_Image {
OC_Log::write('core', 'OC_Image->fixOrientation() No image loaded.', OC_Log::DEBUG);
return -1;
}
- if(is_null($this->filepath) || !is_readable($this->filepath)) {
+ if(is_null($this->filePath) || !is_readable($this->filePath)) {
OC_Log::write('core', 'OC_Image->fixOrientation() No readable file path set.', OC_Log::DEBUG);
return -1;
}
- $exif = @exif_read_data($this->filepath, 'IFD0');
+ $exif = @exif_read_data($this->filePath, 'IFD0');
if(!$exif) {
return -1;
}
@@ -351,19 +373,19 @@ class OC_Image {
* @param $imageref The path to a local file, a base64 encoded string or a resource created by an imagecreate* function or a file resource (file handle ).
* @returns An image resource or false on error
*/
- public function load($imageref) {
- if(is_resource($imageref)) {
- if(get_resource_type($imageref) == 'gd') {
- $this->resource = $imageref;
+ public function load($imageRef) {
+ if(is_resource($imageRef)) {
+ if(get_resource_type($imageRef) == 'gd') {
+ $this->resource = $imageRef;
return $this->resource;
- } elseif(in_array(get_resource_type($imageref), array('file', 'stream'))) {
- return $this->loadFromFileHandle($imageref);
+ } elseif(in_array(get_resource_type($imageRef), array('file', 'stream'))) {
+ return $this->loadFromFileHandle($imageRef);
}
- } elseif($this->loadFromFile($imageref) !== false) {
+ } elseif($this->loadFromFile($imageRef) !== false) {
return $this->resource;
- } elseif($this->loadFromBase64($imageref) !== false) {
+ } elseif($this->loadFromBase64($imageRef) !== false) {
return $this->resource;
- } elseif($this->loadFromData($imageref) !== false) {
+ } elseif($this->loadFromData($imageRef) !== false) {
return $this->resource;
} else {
OC_Log::write('core', __METHOD__.'(): couldn\'t load anything. Giving up!', OC_Log::DEBUG);
@@ -390,62 +412,62 @@ class OC_Image {
* @param $imageref The path to a local file.
* @returns An image resource or false on error
*/
- public function loadFromFile($imagepath=false) {
+ public function loadFromFile($imagePath=false) {
// exif_imagetype throws "read error!" if file is less than 12 byte
- if(!@is_file($imagepath) || !file_exists($imagepath) || filesize($imagepath) < 12 || !is_readable($imagepath)) {
+ if(!@is_file($imagePath) || !file_exists($imagePath) || filesize($imagePath) < 12 || !is_readable($imagePath)) {
// Debug output disabled because this method is tried before loadFromBase64?
- OC_Log::write('core', 'OC_Image->loadFromFile, couldn\'t load: '.$imagepath, OC_Log::DEBUG);
+ OC_Log::write('core', 'OC_Image->loadFromFile, couldn\'t load: '.$imagePath, OC_Log::DEBUG);
return false;
}
- $itype = exif_imagetype($imagepath);
- switch($itype) {
+ $iType = exif_imagetype($imagePath);
+ switch ($iType) {
case IMAGETYPE_GIF:
if (imagetypes() & IMG_GIF) {
- $this->resource = imagecreatefromgif($imagepath);
+ $this->resource = imagecreatefromgif($imagePath);
} else {
OC_Log::write('core',
- 'OC_Image->loadFromFile, GIF images not supported: '.$imagepath,
+ 'OC_Image->loadFromFile, GIF images not supported: '.$imagePath,
OC_Log::DEBUG);
}
break;
case IMAGETYPE_JPEG:
if (imagetypes() & IMG_JPG) {
- $this->resource = imagecreatefromjpeg($imagepath);
+ $this->resource = imagecreatefromjpeg($imagePath);
} else {
OC_Log::write('core',
- 'OC_Image->loadFromFile, JPG images not supported: '.$imagepath,
+ 'OC_Image->loadFromFile, JPG images not supported: '.$imagePath,
OC_Log::DEBUG);
}
break;
case IMAGETYPE_PNG:
if (imagetypes() & IMG_PNG) {
- $this->resource = imagecreatefrompng($imagepath);
+ $this->resource = imagecreatefrompng($imagePath);
} else {
OC_Log::write('core',
- 'OC_Image->loadFromFile, PNG images not supported: '.$imagepath,
+ 'OC_Image->loadFromFile, PNG images not supported: '.$imagePath,
OC_Log::DEBUG);
}
break;
case IMAGETYPE_XBM:
if (imagetypes() & IMG_XPM) {
- $this->resource = imagecreatefromxbm($imagepath);
+ $this->resource = imagecreatefromxbm($imagePath);
} else {
OC_Log::write('core',
- 'OC_Image->loadFromFile, XBM/XPM images not supported: '.$imagepath,
+ 'OC_Image->loadFromFile, XBM/XPM images not supported: '.$imagePath,
OC_Log::DEBUG);
}
break;
case IMAGETYPE_WBMP:
if (imagetypes() & IMG_WBMP) {
- $this->resource = imagecreatefromwbmp($imagepath);
+ $this->resource = imagecreatefromwbmp($imagePath);
} else {
OC_Log::write('core',
- 'OC_Image->loadFromFile, WBMP images not supported: '.$imagepath,
+ 'OC_Image->loadFromFile, WBMP images not supported: '.$imagePath,
OC_Log::DEBUG);
}
break;
case IMAGETYPE_BMP:
- $this->resource = $this->imagecreatefrombmp($imagepath);
+ $this->resource = $this->imagecreatefrombmp($imagePath);
break;
/*
case IMAGETYPE_TIFF_II: // (intel byte order)
@@ -474,14 +496,15 @@ class OC_Image {
default:
// this is mostly file created from encrypted file
- $this->resource = imagecreatefromstring(\OC\Files\Filesystem::file_get_contents(\OC\Files\Filesystem::getLocalPath($imagepath)));
- $itype = IMAGETYPE_PNG;
+ $this->resource = imagecreatefromstring(\OC\Files\Filesystem::file_get_contents(\OC\Files\Filesystem::getLocalPath($imagePath)));
+ $iType = IMAGETYPE_PNG;
OC_Log::write('core', 'OC_Image->loadFromFile, Default', OC_Log::DEBUG);
break;
}
if($this->valid()) {
- $this->imagetype = $itype;
- $this->filepath = $imagepath;
+ $this->imageType = $iType;
+ $this->mimeType = image_type_to_mime_type($iType);
+ $this->filePath = $imagePath;
}
return $this->resource;
}
@@ -496,6 +519,9 @@ class OC_Image {
return false;
}
$this->resource = @imagecreatefromstring($str);
+ if ($this->fileInfo) {
+ $this->mimeType = $this->fileInfo->buffer($str);
+ }
if(is_resource($this->resource)) {
imagealphablending($this->resource, false);
imagesavealpha($this->resource, true);
@@ -520,6 +546,9 @@ class OC_Image {
$data = base64_decode($str);
if($data) { // try to load from string data
$this->resource = @imagecreatefromstring($data);
+ if ($this->fileInfo) {
+ $this->mimeType = $this->fileInfo->buffer($data);
+ }
if(!$this->resource) {
OC_Log::write('core', 'OC_Image->loadFromBase64, couldn\'t load', OC_Log::DEBUG);
return false;
@@ -539,16 +568,16 @@ class OC_Image {
* </p>
* @return resource an image resource identifier on success, <b>FALSE</b> on errors.
*/
- private function imagecreatefrombmp($filename) {
- if (!($fh = fopen($filename, 'rb'))) {
- trigger_error('imagecreatefrombmp: Can not open ' . $filename, E_USER_WARNING);
+ private function imagecreatefrombmp($fileName) {
+ if (!($fh = fopen($fileName, 'rb'))) {
+ trigger_error('imagecreatefrombmp: Can not open ' . $fileName, E_USER_WARNING);
return false;
}
// read file header
$meta = unpack('vtype/Vfilesize/Vreserved/Voffset', fread($fh, 14));
// check for bitmap
if ($meta['type'] != 19778) {
- trigger_error('imagecreatefrombmp: ' . $filename . ' is not a bitmap!', E_USER_WARNING);
+ trigger_error('imagecreatefrombmp: ' . $fileName . ' is not a bitmap!', E_USER_WARNING);
return false;
}
// read image header
@@ -559,7 +588,7 @@ class OC_Image {
}
// set bytes and padding
$meta['bytes'] = $meta['bits'] / 8;
- $this->bit_depth = $meta['bits']; //remember the bit depth for the imagebmp call
+ $this->bitDepth = $meta['bits']; //remember the bit depth for the imagebmp call
$meta['decal'] = 4 - (4 * (($meta['width'] * $meta['bytes'] / 4)- floor($meta['width'] * $meta['bytes'] / 4)));
if ($meta['decal'] == 4) {
$meta['decal'] = 0;
@@ -595,7 +624,7 @@ class OC_Image {
$p = 0;
$vide = chr(0);
$y = $meta['height'] - 1;
- $error = 'imagecreatefrombmp: ' . $filename . ' has not enough data!';
+ $error = 'imagecreatefrombmp: ' . $fileName . ' has not enough data!';
// loop through the image data beginning with the lower left corner
while ($y >= 0) {
$x = 0;
@@ -658,7 +687,7 @@ class OC_Image {
break;
default:
trigger_error('imagecreatefrombmp: '
- . $filename . ' has ' . $meta['bits'] . ' bits and this is not supported!',
+ . $fileName . ' has ' . $meta['bits'] . ' bits and this is not supported!',
E_USER_WARNING);
return false;
}
@@ -678,24 +707,24 @@ class OC_Image {
* @param $maxsize The maximum size of either the width or height.
* @returns bool
*/
- public function resize($maxsize) {
+ public function resize($maxSize) {
if(!$this->valid()) {
OC_Log::write('core', __METHOD__.'(): No image loaded', OC_Log::ERROR);
return false;
}
- $width_orig=imageSX($this->resource);
- $height_orig=imageSY($this->resource);
- $ratio_orig = $width_orig/$height_orig;
+ $widthOrig=imageSX($this->resource);
+ $heightOrig=imageSY($this->resource);
+ $ratioOrig = $widthOrig/$heightOrig;
- if ($ratio_orig > 1) {
- $new_height = round($maxsize/$ratio_orig);
- $new_width = $maxsize;
+ if ($ratioOrig > 1) {
+ $newHeight = round($maxSize/$ratioOrig);
+ $newWidth = $maxSize;
} else {
- $new_width = round($maxsize*$ratio_orig);
- $new_height = $maxsize;
+ $newWidth = round($maxSize*$ratioOrig);
+ $newHeight = $maxSize;
}
- $this->preciseResize(round($new_width), round($new_height));
+ $this->preciseResize(round($newWidth), round($newHeight));
return true;
}
@@ -704,8 +733,8 @@ class OC_Image {
OC_Log::write('core', __METHOD__.'(): No image loaded', OC_Log::ERROR);
return false;
}
- $width_orig=imageSX($this->resource);
- $height_orig=imageSY($this->resource);
+ $widthOrig=imageSX($this->resource);
+ $heightOrig=imageSY($this->resource);
$process = imagecreatetruecolor($width, $height);
if ($process == false) {
@@ -715,13 +744,13 @@ class OC_Image {
}
// preserve transparency
- if($this->imagetype == IMAGETYPE_GIF or $this->imagetype == IMAGETYPE_PNG) {
+ if($this->imageType == IMAGETYPE_GIF or $this->imageType == IMAGETYPE_PNG) {
imagecolortransparent($process, imagecolorallocatealpha($process, 0, 0, 0, 127));
imagealphablending($process, false);
imagesavealpha($process, true);
}
- imagecopyresampled($process, $this->resource, 0, 0, 0, 0, $width, $height, $width_orig, $height_orig);
+ imagecopyresampled($process, $this->resource, 0, 0, 0, 0, $width, $height, $widthOrig, $heightOrig);
if ($process == false) {
OC_Log::write('core', __METHOD__.'(): Error resampling process image '.$width.'x'.$height, OC_Log::ERROR);
imagedestroy($process);
@@ -742,19 +771,19 @@ class OC_Image {
OC_Log::write('core', 'OC_Image->centerCrop, No image loaded', OC_Log::ERROR);
return false;
}
- $width_orig=imageSX($this->resource);
- $height_orig=imageSY($this->resource);
- if($width_orig === $height_orig and $size==0) {
+ $widthOrig=imageSX($this->resource);
+ $heightOrig=imageSY($this->resource);
+ if($widthOrig === $heightOrig and $size==0) {
return true;
}
- $ratio_orig = $width_orig/$height_orig;
- $width = $height = min($width_orig, $height_orig);
+ $ratioOrig = $widthOrig/$heightOrig;
+ $width = $height = min($widthOrig, $heightOrig);
- if ($ratio_orig > 1) {
- $x = ($width_orig/2) - ($width/2);
+ if ($ratioOrig > 1) {
+ $x = ($widthOrig/2) - ($width/2);
$y = 0;
} else {
- $y = ($height_orig/2) - ($height/2);
+ $y = ($heightOrig/2) - ($height/2);
$x = 0;
}
if($size>0) {
@@ -772,7 +801,7 @@ class OC_Image {
}
// preserve transparency
- if($this->imagetype == IMAGETYPE_GIF or $this->imagetype == IMAGETYPE_PNG) {
+ if($this->imageType == IMAGETYPE_GIF or $this->imageType == IMAGETYPE_PNG) {
imagecolortransparent($process, imagecolorallocatealpha($process, 0, 0, 0, 127));
imagealphablending($process, false);
imagesavealpha($process, true);
@@ -832,9 +861,9 @@ class OC_Image {
OC_Log::write('core', __METHOD__.'(): No image loaded', OC_Log::ERROR);
return false;
}
- $width_orig=imageSX($this->resource);
- $height_orig=imageSY($this->resource);
- $ratio = $width_orig/$height_orig;
+ $widthOrig=imageSX($this->resource);
+ $heightOrig=imageSY($this->resource);
+ $ratio = $widthOrig/$heightOrig;
$newWidth = min($maxWidth, $ratio*$maxHeight);
$newHeight = min($maxHeight, $maxWidth/$ratio);
@@ -868,7 +897,7 @@ if ( ! function_exists( 'imagebmp') ) {
* @param int $compression [optional]
* @return bool <b>TRUE</b> on success or <b>FALSE</b> on failure.
*/
- function imagebmp($im, $filename='', $bit=24, $compression=0) {
+ function imagebmp($im, $fileName='', $bit=24, $compression=0) {
if (!in_array($bit, array(1, 4, 8, 16, 24, 32))) {
$bit = 24;
}
@@ -879,14 +908,14 @@ if ( ! function_exists( 'imagebmp') ) {
imagetruecolortopalette($im, true, $bits);
$width = imagesx($im);
$height = imagesy($im);
- $colors_num = imagecolorstotal($im);
- $rgb_quad = '';
+ $colorsNum = imagecolorstotal($im);
+ $rgbQuad = '';
if ($bit <= 8) {
- for ($i = 0; $i < $colors_num; $i++) {
+ for ($i = 0; $i < $colorsNum; $i++) {
$colors = imagecolorsforindex($im, $i);
- $rgb_quad .= chr($colors['blue']) . chr($colors['green']) . chr($colors['red']) . "\0";
+ $rgbQuad .= chr($colors['blue']) . chr($colors['green']) . chr($colors['red']) . "\0";
}
- $bmp_data = '';
+ $bmpData = '';
if ($compression == 0 || $bit < 8) {
$compression = 0;
$extra = '';
@@ -904,35 +933,35 @@ if ( ! function_exists( 'imagebmp') ) {
$bin |= $index << $k;
$i++;
}
- $bmp_data .= chr($bin);
+ $bmpData .= chr($bin);
}
- $bmp_data .= $extra;
+ $bmpData .= $extra;
}
}
// RLE8
else if ($compression == 1 && $bit == 8) {
for ($j = $height - 1; $j >= 0; $j--) {
- $last_index = "\0";
- $same_num = 0;
+ $lastIndex = "\0";
+ $sameNum = 0;
for ($i = 0; $i <= $width; $i++) {
$index = imagecolorat($im, $i, $j);
- if ($index !== $last_index || $same_num > 255) {
- if ($same_num != 0) {
- $bmp_data .= chr($same_num) . chr($last_index);
+ if ($index !== $lastIndex || $sameNum > 255) {
+ if ($sameNum != 0) {
+ $bmpData .= chr($same_num) . chr($lastIndex);
}
- $last_index = $index;
- $same_num = 1;
+ $lastIndex = $index;
+ $sameNum = 1;
}
else {
- $same_num++;
+ $sameNum++;
}
}
- $bmp_data .= "\0\0";
+ $bmpData .= "\0\0";
}
- $bmp_data .= "\0\1";
+ $bmpData .= "\0\1";
}
- $size_quad = strlen($rgb_quad);
- $size_data = strlen($bmp_data);
+ $sizeQuad = strlen($rgbQuad);
+ $sizeData = strlen($bmpData);
}
else {
$extra = '';
@@ -940,7 +969,7 @@ if ( ! function_exists( 'imagebmp') ) {
if ($padding % 4 != 0) {
$extra = str_repeat("\0", $padding);
}
- $bmp_data = '';
+ $bmpData = '';
for ($j = $height - 1; $j >= 0; $j--) {
for ($i = 0; $i < $width; $i++) {
$index = imagecolorat($im, $i, $j);
@@ -950,27 +979,27 @@ if ( ! function_exists( 'imagebmp') ) {
$bin |= ($colors['red'] >> 3) << 10;
$bin |= ($colors['green'] >> 3) << 5;
$bin |= $colors['blue'] >> 3;
- $bmp_data .= pack("v", $bin);
+ $bmpData .= pack("v", $bin);
}
else {
- $bmp_data .= pack("c*", $colors['blue'], $colors['green'], $colors['red']);
+ $bmpData .= pack("c*", $colors['blue'], $colors['green'], $colors['red']);
}
}
- $bmp_data .= $extra;
+ $bmpData .= $extra;
}
- $size_quad = 0;
- $size_data = strlen($bmp_data);
- $colors_num = 0;
- }
- $file_header = 'BM' . pack('V3', 54 + $size_quad + $size_data, 0, 54 + $size_quad);
- $info_header = pack('V3v2V*', 0x28, $width, $height, 1, $bit, $compression, $size_data, 0, 0, $colors_num, 0);
- if ($filename != '') {
- $fp = fopen($filename, 'wb');
- fwrite($fp, $file_header . $info_header . $rgb_quad . $bmp_data);
+ $sizeQuad = 0;
+ $sizeData = strlen($bmpData);
+ $colorsNum = 0;
+ }
+ $fileHeader = 'BM' . pack('V3', 54 + $sizeQuad + $sizeData, 0, 54 + $sizeQuad);
+ $infoHeader = pack('V3v2V*', 0x28, $width, $height, 1, $bit, $compression, $sizeData, 0, 0, $colorsNum, 0);
+ if ($fileName != '') {
+ $fp = fopen($fileName, 'wb');
+ fwrite($fp, $fileHeader . $infoHeader . $rgbQuad . $bmpData);
fclose($fp);
return true;
}
- echo $file_header . $info_header. $rgb_quad . $bmp_data;
+ echo $fileHeader . $infoHeader. $rgbQuad . $bmpData;
return true;
}
}
@@ -982,8 +1011,8 @@ if ( ! function_exists( 'exif_imagetype' ) ) {
* @param string $filename
* @return string|boolean
*/
- function exif_imagetype ( $filename ) {
- if ( ( $info = getimagesize( $filename ) ) !== false ) {
+ function exif_imagetype ( $fileName ) {
+ if ( ( $info = getimagesize( $fileName ) ) !== false ) {
return $info[2];
}
return false;
diff --git a/lib/l10n/ach.php b/lib/l10n/ach.php
new file mode 100644
index 00000000000..406ff5f5a26
--- /dev/null
+++ b/lib/l10n/ach.php
@@ -0,0 +1,8 @@
+<?php
+$TRANSLATIONS = array(
+"_%n minute ago_::_%n minutes ago_" => array("",""),
+"_%n hour ago_::_%n hours ago_" => array("",""),
+"_%n day go_::_%n days ago_" => array("",""),
+"_%n month ago_::_%n months ago_" => array("","")
+);
+$PLURAL_FORMS = "nplurals=2; plural=(n > 1);";
diff --git a/lib/l10n/es.php b/lib/l10n/es.php
index 14bbf6f6a13..047d5d955bb 100644
--- a/lib/l10n/es.php
+++ b/lib/l10n/es.php
@@ -1,5 +1,7 @@
<?php
$TRANSLATIONS = array(
+"App \"%s\" can't be installed because it is not compatible with this version of ownCloud." => "La aplicación \"%s\" no puede ser instalada porque no es compatible con esta versión de ownCloud",
+"No app name specified" => "No se ha especificado nombre de la aplicación",
"Help" => "Ayuda",
"Personal" => "Personal",
"Settings" => "Ajustes",
@@ -13,6 +15,18 @@ $TRANSLATIONS = array(
"Back to Files" => "Volver a Archivos",
"Selected files too large to generate zip file." => "Los archivos seleccionados son demasiado grandes para generar el archivo zip.",
"Download the files in smaller chunks, seperately or kindly ask your administrator." => "Descargue los archivos en trozos más pequeños, por separado o solicítelos amablemente su administrador.",
+"No source specified when installing app" => "No se ha especificado origen cuando se ha instalado la aplicación",
+"No href specified when installing app from http" => "No href especificado cuando se ha instalado la aplicación",
+"No path specified when installing app from local file" => "Sin path especificado cuando se ha instalado la aplicación desde el fichero local",
+"Archives of type %s are not supported" => "Ficheros de tipo %s no son soportados",
+"Failed to open archive when installing app" => "Fallo de apertura de fichero mientras se instala la aplicación",
+"App does not provide an info.xml file" => "La aplicación no suministra un fichero info.xml",
+"App can't be installed because of not allowed code in the App" => "La aplicación no puede ser instalada por tener código no autorizado en la aplicación",
+"App can't be installed because it is not compatible with this version of ownCloud" => "La aplicación no se puede instalar porque no es compatible con esta versión de ownCloud",
+"App can't be installed because it contains the <shipped>true</shipped> tag which is not allowed for non shipped apps" => "La aplicación no se puede instalar porque contiene la etiqueta\n<shipped>\ntrue\n</shipped>\nque no está permitida para aplicaciones no distribuidas",
+"App can't be installed because the version in info.xml/version is not the same as the version reported from the app store" => "La aplicación no puede ser instalada por que la versión en info.xml/version no es la misma que la establecida en la app store",
+"App directory already exists" => "El directorio de la aplicación ya existe",
+"Can't create app folder. Please fix permissions. %s" => "No se puede crear la carpeta de la aplicación. Corrija los permisos. %s",
"Application is not enabled" => "La aplicación no está habilitada",
"Authentication error" => "Error de autenticación",
"Token expired. Please reload page." => "Token expirado. Por favor, recarga la página.",
@@ -21,7 +35,7 @@ $TRANSLATIONS = array(
"Images" => "Imágenes",
"%s enter the database username." => "%s ingresar el usuario de la base de datos.",
"%s enter the database name." => "%s ingresar el nombre de la base de datos",
-"%s you may not use dots in the database name" => "%s no se puede utilizar puntos en el nombre de la base de datos",
+"%s you may not use dots in the database name" => "%s puede utilizar puntos en el nombre de la base de datos",
"MS SQL username and/or password not valid: %s" => "Usuario y/o contraseña de MS SQL no válidos: %s",
"You need to enter either an existing account or the administrator." => "Tiene que ingresar una cuenta existente o la del administrador.",
"MySQL username and/or password not valid" => "Usuario y/o contraseña de MySQL no válidos",
@@ -40,13 +54,13 @@ $TRANSLATIONS = array(
"Your web server is not yet properly setup to allow files synchronization because the WebDAV interface seems to be broken." => "Su servidor web aún no está configurado adecuadamente para permitir sincronización de archivos ya que la interfaz WebDAV parece no estar funcionando.",
"Please double check the <a href='%s'>installation guides</a>." => "Por favor, vuelva a comprobar las <a href='%s'>guías de instalación</a>.",
"seconds ago" => "hace segundos",
-"_%n minute ago_::_%n minutes ago_" => array("",""),
-"_%n hour ago_::_%n hours ago_" => array("",""),
+"_%n minute ago_::_%n minutes ago_" => array("Hace %n minuto","Hace %n minutos"),
+"_%n hour ago_::_%n hours ago_" => array("Hace %n hora","Hace %n horas"),
"today" => "hoy",
"yesterday" => "ayer",
-"_%n day go_::_%n days ago_" => array("",""),
+"_%n day go_::_%n days ago_" => array("Hace %n día","Hace %n días"),
"last month" => "mes pasado",
-"_%n month ago_::_%n months ago_" => array("",""),
+"_%n month ago_::_%n months ago_" => array("Hace %n mes","Hace %n meses"),
"last year" => "año pasado",
"years ago" => "hace años",
"Caused by:" => "Causado por:",
diff --git a/lib/l10n/es_AR.php b/lib/l10n/es_AR.php
index 26f1e4ecd5e..f637eb403ed 100644
--- a/lib/l10n/es_AR.php
+++ b/lib/l10n/es_AR.php
@@ -1,5 +1,7 @@
<?php
$TRANSLATIONS = array(
+"App \"%s\" can't be installed because it is not compatible with this version of ownCloud." => "La app \"%s\" no puede ser instalada porque no es compatible con esta versión de ownCloud",
+"No app name specified" => "No fue especificado el nombre de la app",
"Help" => "Ayuda",
"Personal" => "Personal",
"Settings" => "Configuración",
@@ -13,6 +15,18 @@ $TRANSLATIONS = array(
"Back to Files" => "Volver a Archivos",
"Selected files too large to generate zip file." => "Los archivos seleccionados son demasiado grandes para generar el archivo zip.",
"Download the files in smaller chunks, seperately or kindly ask your administrator." => "Descargá los archivos en partes más chicas, de forma separada, o pedíselos al administrador",
+"No source specified when installing app" => "No se especificó el origen al instalar la app",
+"No href specified when installing app from http" => "No se especificó href al instalar la app",
+"No path specified when installing app from local file" => "No se especificó PATH al instalar la app desde el archivo local",
+"Archives of type %s are not supported" => "No hay soporte para archivos de tipo %s",
+"Failed to open archive when installing app" => "Error al abrir archivo mientras se instalaba la app",
+"App does not provide an info.xml file" => "La app no suministra un archivo info.xml",
+"App can't be installed because of not allowed code in the App" => "No puede ser instalada la app por tener código no autorizado",
+"App can't be installed because it is not compatible with this version of ownCloud" => "No se puede instalar la app porque no es compatible con esta versión de ownCloud",
+"App can't be installed because it contains the <shipped>true</shipped> tag which is not allowed for non shipped apps" => "La app no se puede instalar porque contiene la etiqueta <shipped>true</shipped> que no está permitida para apps no distribuidas",
+"App can't be installed because the version in info.xml/version is not the same as the version reported from the app store" => "La app no puede ser instalada porque la versión en info.xml/version no es la misma que la establecida en el app store",
+"App directory already exists" => "El directorio de la app ya existe",
+"Can't create app folder. Please fix permissions. %s" => "No se puede crear el directorio para la app. Corregí los permisos. %s",
"Application is not enabled" => "La aplicación no está habilitada",
"Authentication error" => "Error al autenticar",
"Token expired. Please reload page." => "Token expirado. Por favor, recargá la página.",
@@ -40,13 +54,13 @@ $TRANSLATIONS = array(
"Your web server is not yet properly setup to allow files synchronization because the WebDAV interface seems to be broken." => "Tu servidor web no está configurado todavía para permitir sincronización de archivos porque la interfaz WebDAV parece no funcionar.",
"Please double check the <a href='%s'>installation guides</a>." => "Por favor, comprobá nuevamente la <a href='%s'>guía de instalación</a>.",
"seconds ago" => "segundos atrás",
-"_%n minute ago_::_%n minutes ago_" => array("",""),
-"_%n hour ago_::_%n hours ago_" => array("",""),
+"_%n minute ago_::_%n minutes ago_" => array("Hace %n minuto","Hace %n minutos"),
+"_%n hour ago_::_%n hours ago_" => array("Hace %n hora","Hace %n horas"),
"today" => "hoy",
"yesterday" => "ayer",
-"_%n day go_::_%n days ago_" => array("",""),
+"_%n day go_::_%n days ago_" => array("Hace %n día","Hace %n días"),
"last month" => "el mes pasado",
-"_%n month ago_::_%n months ago_" => array("",""),
+"_%n month ago_::_%n months ago_" => array("Hace %n mes","Hace %n meses"),
"last year" => "el año pasado",
"years ago" => "años atrás",
"Caused by:" => "Provocado por:",
diff --git a/lib/l10n/es_MX.php b/lib/l10n/es_MX.php
new file mode 100644
index 00000000000..15f78e0bce6
--- /dev/null
+++ b/lib/l10n/es_MX.php
@@ -0,0 +1,8 @@
+<?php
+$TRANSLATIONS = array(
+"_%n minute ago_::_%n minutes ago_" => array("",""),
+"_%n hour ago_::_%n hours ago_" => array("",""),
+"_%n day go_::_%n days ago_" => array("",""),
+"_%n month ago_::_%n months ago_" => array("","")
+);
+$PLURAL_FORMS = "nplurals=2; plural=(n != 1);";
diff --git a/lib/l10n/fr.php b/lib/l10n/fr.php
index cfcca28d5f8..da3ec4ce372 100644
--- a/lib/l10n/fr.php
+++ b/lib/l10n/fr.php
@@ -1,15 +1,32 @@
<?php
$TRANSLATIONS = array(
+"App \"%s\" can't be installed because it is not compatible with this version of ownCloud." => "L'application \"%s\" ne peut être installée car elle n'est pas compatible avec cette version de ownCloud.",
+"No app name specified" => "Aucun nom d'application spécifié",
"Help" => "Aide",
"Personal" => "Personnel",
"Settings" => "Paramètres",
"Users" => "Utilisateurs",
"Admin" => "Administration",
+"Failed to upgrade \"%s\"." => "Echec de la mise à niveau \"%s\".",
"web services under your control" => "services web sous votre contrôle",
+"cannot open \"%s\"" => "impossible d'ouvrir \"%s\"",
"ZIP download is turned off." => "Téléchargement ZIP désactivé.",
"Files need to be downloaded one by one." => "Les fichiers nécessitent d'être téléchargés un par un.",
"Back to Files" => "Retour aux Fichiers",
"Selected files too large to generate zip file." => "Les fichiers sélectionnés sont trop volumineux pour être compressés.",
+"Download the files in smaller chunks, seperately or kindly ask your administrator." => "Télécharger les fichiers en parties plus petites, séparément ou demander avec bienveillance à votre administrateur.",
+"No source specified when installing app" => "Aucune source spécifiée pour installer l'application",
+"No href specified when installing app from http" => "Aucun href spécifié pour installer l'application par http",
+"No path specified when installing app from local file" => "Aucun chemin spécifié pour installer l'application depuis un fichier local",
+"Archives of type %s are not supported" => "Les archives de type %s ne sont pas supportées",
+"Failed to open archive when installing app" => "Échec de l'ouverture de l'archive lors de l'installation de l'application",
+"App does not provide an info.xml file" => "L'application ne fournit pas de fichier info.xml",
+"App can't be installed because of not allowed code in the App" => "L'application ne peut être installée car elle contient du code non-autorisé",
+"App can't be installed because it is not compatible with this version of ownCloud" => "L'application ne peut être installée car elle n'est pas compatible avec cette version de ownCloud",
+"App can't be installed because it contains the <shipped>true</shipped> tag which is not allowed for non shipped apps" => "L'application ne peut être installée car elle contient la balise <shipped>true</shipped> qui n'est pas autorisée pour les applications non-diffusées",
+"App can't be installed because the version in info.xml/version is not the same as the version reported from the app store" => "L'application ne peut être installée car la version de info.xml/version n'est identique à celle indiquée sur l'app store",
+"App directory already exists" => "Le dossier de l'application existe déjà",
+"Can't create app folder. Please fix permissions. %s" => "Impossible de créer le dossier de l'application. Corrigez les droits d'accès. %s",
"Application is not enabled" => "L'application n'est pas activée",
"Authentication error" => "Erreur d'authentification",
"Token expired. Please reload page." => "La session a expiré. Veuillez recharger la page.",
@@ -37,15 +54,16 @@ $TRANSLATIONS = array(
"Your web server is not yet properly setup to allow files synchronization because the WebDAV interface seems to be broken." => "Votre serveur web, n'est pas correctement configuré pour permettre la synchronisation des fichiers, car l'interface WebDav ne fonctionne pas comme il faut.",
"Please double check the <a href='%s'>installation guides</a>." => "Veuillez vous référer au <a href='%s'>guide d'installation</a>.",
"seconds ago" => "il y a quelques secondes",
-"_%n minute ago_::_%n minutes ago_" => array("",""),
-"_%n hour ago_::_%n hours ago_" => array("",""),
+"_%n minute ago_::_%n minutes ago_" => array("","il y a %n minutes"),
+"_%n hour ago_::_%n hours ago_" => array("","Il y a %n heures"),
"today" => "aujourd'hui",
"yesterday" => "hier",
-"_%n day go_::_%n days ago_" => array("",""),
+"_%n day go_::_%n days ago_" => array("","il y a %n jours"),
"last month" => "le mois dernier",
-"_%n month ago_::_%n months ago_" => array("",""),
+"_%n month ago_::_%n months ago_" => array("","Il y a %n mois"),
"last year" => "l'année dernière",
"years ago" => "il y a plusieurs années",
+"Caused by:" => "Causé par :",
"Could not find category \"%s\"" => "Impossible de trouver la catégorie \"%s\""
);
$PLURAL_FORMS = "nplurals=2; plural=(n > 1);";
diff --git a/lib/l10n/it.php b/lib/l10n/it.php
index a35027eb962..c3a040048ec 100644
--- a/lib/l10n/it.php
+++ b/lib/l10n/it.php
@@ -23,6 +23,7 @@ $TRANSLATIONS = array(
"App does not provide an info.xml file" => "L'applicazione non fornisce un file info.xml",
"App can't be installed because of not allowed code in the App" => "L'applicazione non può essere installata a causa di codice non consentito al suo interno",
"App can't be installed because it is not compatible with this version of ownCloud" => "L'applicazione non può essere installata poiché non è compatibile con questa versione di ownCloud",
+"App can't be installed because it contains the <shipped>true</shipped> tag which is not allowed for non shipped apps" => "L'applicazione non può essere installata poiché contiene il tag <shipped>true<shipped> che non è permesso alle applicazioni non shipped",
"App can't be installed because the version in info.xml/version is not the same as the version reported from the app store" => "L'applicazione non può essere installata poiché la versione in info.xml/version non è la stessa riportata dall'app store",
"App directory already exists" => "La cartella dell'applicazione esiste già",
"Can't create app folder. Please fix permissions. %s" => "Impossibile creare la cartella dell'applicazione. Correggi i permessi. %s",
diff --git a/lib/l10n/ja_JP.php b/lib/l10n/ja_JP.php
index 902170524b9..2d37001ca19 100644
--- a/lib/l10n/ja_JP.php
+++ b/lib/l10n/ja_JP.php
@@ -1,5 +1,7 @@
<?php
$TRANSLATIONS = array(
+"App \"%s\" can't be installed because it is not compatible with this version of ownCloud." => " \"%s\" アプリは、このバージョンのownCloudと互換性がない為、インストールできません。",
+"No app name specified" => "アプリ名が未指定",
"Help" => "ヘルプ",
"Personal" => "個人",
"Settings" => "設定",
@@ -13,6 +15,18 @@ $TRANSLATIONS = array(
"Back to Files" => "ファイルに戻る",
"Selected files too large to generate zip file." => "選択したファイルはZIPファイルの生成には大きすぎます。",
"Download the files in smaller chunks, seperately or kindly ask your administrator." => "ファイルは、小さいファイルに分割されてダウンロードされます。もしくは、管理者にお尋ねください。",
+"No source specified when installing app" => "アプリインストール時のソースが未指定",
+"No href specified when installing app from http" => "アプリインストール時のhttpの URL が未指定",
+"No path specified when installing app from local file" => "アプリインストール時のローカルファイルのパスが未指定",
+"Archives of type %s are not supported" => "\"%s\"タイプのアーカイブ形式は未サポート",
+"Failed to open archive when installing app" => "アプリをインストール中にアーカイブファイルを開けませんでした。",
+"App does not provide an info.xml file" => "アプリにinfo.xmlファイルが入っていません",
+"App can't be installed because of not allowed code in the App" => "アプリで許可されないコードが入っているのが原因でアプリがインストールできません",
+"App can't be installed because it is not compatible with this version of ownCloud" => "アプリは、このバージョンのownCloudと互換性がない為、インストールできません。",
+"App can't be installed because it contains the <shipped>true</shipped> tag which is not allowed for non shipped apps" => "非shippedアプリには許可されない<shipped>true</shipped>タグが含まれているためにアプリをインストール出来ません。",
+"App can't be installed because the version in info.xml/version is not the same as the version reported from the app store" => "info.xml/versionのバージョンがアプリストアのバージョンと合っていない為、アプリはインストールされません",
+"App directory already exists" => "アプリディレクトリは既に存在します",
+"Can't create app folder. Please fix permissions. %s" => "アプリフォルダを作成出来ませんでした。%s のパーミッションを修正してください。",
"Application is not enabled" => "アプリケーションは無効です",
"Authentication error" => "認証エラー",
"Token expired. Please reload page." => "トークンが無効になりました。ページを再読込してください。",
diff --git a/lib/l10n/nn_NO.php b/lib/l10n/nn_NO.php
index 28b4f7b7d94..d5da8c64415 100644
--- a/lib/l10n/nn_NO.php
+++ b/lib/l10n/nn_NO.php
@@ -10,15 +10,15 @@ $TRANSLATIONS = array(
"Files" => "Filer",
"Text" => "Tekst",
"Your web server is not yet properly setup to allow files synchronization because the WebDAV interface seems to be broken." => "Tenaren din er ikkje enno rett innstilt til å tilby filsynkronisering sidan WebDAV-grensesnittet ser ut til å vera øydelagt.",
-"Please double check the <a href='%s'>installation guides</a>." => "Ver vennleg og dobbeltsjekk <a href='%s'>installasjonsrettleiinga</a>.",
+"Please double check the <a href='%s'>installation guides</a>." => "Ver venleg og dobbeltsjekk <a href='%s'>installasjonsrettleiinga</a>.",
"seconds ago" => "sekund sidan",
-"_%n minute ago_::_%n minutes ago_" => array("",""),
-"_%n hour ago_::_%n hours ago_" => array("",""),
+"_%n minute ago_::_%n minutes ago_" => array("","%n minutt sidan"),
+"_%n hour ago_::_%n hours ago_" => array("","%n timar sidan"),
"today" => "i dag",
"yesterday" => "i går",
-"_%n day go_::_%n days ago_" => array("",""),
+"_%n day go_::_%n days ago_" => array("","%n dagar sidan"),
"last month" => "førre månad",
-"_%n month ago_::_%n months ago_" => array("",""),
+"_%n month ago_::_%n months ago_" => array("","%n månadar sidan"),
"last year" => "i fjor",
"years ago" => "år sidan"
);
diff --git a/lib/l10n/nqo.php b/lib/l10n/nqo.php
new file mode 100644
index 00000000000..e7b09649a24
--- /dev/null
+++ b/lib/l10n/nqo.php
@@ -0,0 +1,8 @@
+<?php
+$TRANSLATIONS = array(
+"_%n minute ago_::_%n minutes ago_" => array(""),
+"_%n hour ago_::_%n hours ago_" => array(""),
+"_%n day go_::_%n days ago_" => array(""),
+"_%n month ago_::_%n months ago_" => array("")
+);
+$PLURAL_FORMS = "nplurals=1; plural=0;";
diff --git a/lib/l10n/pl.php b/lib/l10n/pl.php
index 984043aa0be..4acd735d692 100644
--- a/lib/l10n/pl.php
+++ b/lib/l10n/pl.php
@@ -1,5 +1,7 @@
<?php
$TRANSLATIONS = array(
+"App \"%s\" can't be installed because it is not compatible with this version of ownCloud." => "Aplikacja \"%s\" nie może zostać zainstalowana, ponieważ nie jest zgodna z tą wersją ownCloud.",
+"No app name specified" => "Nie określono nazwy aplikacji",
"Help" => "Pomoc",
"Personal" => "Osobiste",
"Settings" => "Ustawienia",
@@ -13,6 +15,18 @@ $TRANSLATIONS = array(
"Back to Files" => "Wróć do plików",
"Selected files too large to generate zip file." => "Wybrane pliki są zbyt duże, aby wygenerować plik zip.",
"Download the files in smaller chunks, seperately or kindly ask your administrator." => "Pobierz pliki w mniejszy kawałkach, oddzielnie lub poproś administratora o zwiększenie limitu.",
+"No source specified when installing app" => "Nie określono źródła podczas instalacji aplikacji",
+"No href specified when installing app from http" => "Nie określono linku skąd aplikacja ma być zainstalowana",
+"No path specified when installing app from local file" => "Nie określono lokalnego pliku z którego miała być instalowana aplikacja",
+"Archives of type %s are not supported" => "Typ archiwum %s nie jest obsługiwany",
+"Failed to open archive when installing app" => "Nie udało się otworzyć archiwum podczas instalacji aplikacji",
+"App does not provide an info.xml file" => "Aplikacja nie posiada pliku info.xml",
+"App can't be installed because of not allowed code in the App" => "Aplikacja nie może być zainstalowany ponieważ nie dopuszcza kod w aplikacji",
+"App can't be installed because it is not compatible with this version of ownCloud" => "Aplikacja nie może zostać zainstalowana ponieważ jest niekompatybilna z tą wersja ownCloud",
+"App can't be installed because it contains the <shipped>true</shipped> tag which is not allowed for non shipped apps" => "Aplikacja nie może być zainstalowana ponieważ true tag nie jest <shipped>true</shipped> , co nie jest dozwolone dla aplikacji nie wysłanych",
+"App can't be installed because the version in info.xml/version is not the same as the version reported from the app store" => "Nie można zainstalować aplikacji, ponieważ w wersji info.xml/version nie jest taka sama, jak wersja z app store",
+"App directory already exists" => "Katalog aplikacji już isnieje",
+"Can't create app folder. Please fix permissions. %s" => "Nie mogę utworzyć katalogu aplikacji. Proszę popraw uprawnienia. %s",
"Application is not enabled" => "Aplikacja nie jest włączona",
"Authentication error" => "Błąd uwierzytelniania",
"Token expired. Please reload page." => "Token wygasł. Proszę ponownie załadować stronę.",
@@ -40,13 +54,13 @@ $TRANSLATIONS = array(
"Your web server is not yet properly setup to allow files synchronization because the WebDAV interface seems to be broken." => "Serwer internetowy nie jest jeszcze poprawnie skonfigurowany, aby umożliwić synchronizację plików, ponieważ interfejs WebDAV wydaje się być uszkodzony.",
"Please double check the <a href='%s'>installation guides</a>." => "Sprawdź ponownie <a href='%s'>przewodniki instalacji</a>.",
"seconds ago" => "sekund temu",
-"_%n minute ago_::_%n minutes ago_" => array("","",""),
-"_%n hour ago_::_%n hours ago_" => array("","",""),
+"_%n minute ago_::_%n minutes ago_" => array("%n minute temu","%n minut temu","%n minut temu"),
+"_%n hour ago_::_%n hours ago_" => array("%n godzinę temu","%n godzin temu","%n godzin temu"),
"today" => "dziś",
"yesterday" => "wczoraj",
-"_%n day go_::_%n days ago_" => array("","",""),
+"_%n day go_::_%n days ago_" => array("%n dzień temu","%n dni temu","%n dni temu"),
"last month" => "w zeszłym miesiącu",
-"_%n month ago_::_%n months ago_" => array("","",""),
+"_%n month ago_::_%n months ago_" => array("%n miesiąc temu","%n miesięcy temu","%n miesięcy temu"),
"last year" => "w zeszłym roku",
"years ago" => "lat temu",
"Caused by:" => "Spowodowane przez:",
diff --git a/lib/l10n/pt_BR.php b/lib/l10n/pt_BR.php
index a2379ca4883..72bc1f36a1e 100644
--- a/lib/l10n/pt_BR.php
+++ b/lib/l10n/pt_BR.php
@@ -54,13 +54,13 @@ $TRANSLATIONS = array(
"Your web server is not yet properly setup to allow files synchronization because the WebDAV interface seems to be broken." => "Seu servidor web não está configurado corretamente para permitir sincronização de arquivos porque a interface WebDAV parece estar quebrada.",
"Please double check the <a href='%s'>installation guides</a>." => "Por favor, confira os <a href='%s'>guias de instalação</a>.",
"seconds ago" => "segundos atrás",
-"_%n minute ago_::_%n minutes ago_" => array("",""),
-"_%n hour ago_::_%n hours ago_" => array("",""),
+"_%n minute ago_::_%n minutes ago_" => array("","ha %n minutos"),
+"_%n hour ago_::_%n hours ago_" => array("","ha %n horas"),
"today" => "hoje",
"yesterday" => "ontem",
-"_%n day go_::_%n days ago_" => array("",""),
+"_%n day go_::_%n days ago_" => array("","ha %n dias"),
"last month" => "último mês",
-"_%n month ago_::_%n months ago_" => array("",""),
+"_%n month ago_::_%n months ago_" => array("","ha %n meses"),
"last year" => "último ano",
"years ago" => "anos atrás",
"Caused by:" => "Causados ​​por:",
diff --git a/lib/l10n/pt_PT.php b/lib/l10n/pt_PT.php
index c8a2f78cbf5..bf540012249 100644
--- a/lib/l10n/pt_PT.php
+++ b/lib/l10n/pt_PT.php
@@ -40,13 +40,13 @@ $TRANSLATIONS = array(
"Your web server is not yet properly setup to allow files synchronization because the WebDAV interface seems to be broken." => "O seu servidor web não está configurado correctamente para autorizar sincronização de ficheiros, pois o interface WebDAV parece estar com problemas.",
"Please double check the <a href='%s'>installation guides</a>." => "Por favor verifique <a href='%s'>installation guides</a>.",
"seconds ago" => "Minutos atrás",
-"_%n minute ago_::_%n minutes ago_" => array("",""),
-"_%n hour ago_::_%n hours ago_" => array("",""),
+"_%n minute ago_::_%n minutes ago_" => array("","%n minutos atrás"),
+"_%n hour ago_::_%n hours ago_" => array("","%n horas atrás"),
"today" => "hoje",
"yesterday" => "ontem",
-"_%n day go_::_%n days ago_" => array("",""),
+"_%n day go_::_%n days ago_" => array("","%n dias atrás"),
"last month" => "ultímo mês",
-"_%n month ago_::_%n months ago_" => array("",""),
+"_%n month ago_::_%n months ago_" => array("","%n meses atrás"),
"last year" => "ano passado",
"years ago" => "anos atrás",
"Caused by:" => "Causado por:",
diff --git a/lib/l10n/sq.php b/lib/l10n/sq.php
index c2447b7ea23..edaa1df2b86 100644
--- a/lib/l10n/sq.php
+++ b/lib/l10n/sq.php
@@ -36,13 +36,13 @@ $TRANSLATIONS = array(
"Your web server is not yet properly setup to allow files synchronization because the WebDAV interface seems to be broken." => "Serveri web i juaji nuk është konfiguruar akoma për të lejuar sinkronizimin e skedarëve sepse ndërfaqja WebDAV mund të jetë e dëmtuar.",
"Please double check the <a href='%s'>installation guides</a>." => "Ju lutemi kontrolloni mirë <a href='%s'>shoqëruesin e instalimit</a>.",
"seconds ago" => "sekonda më parë",
-"_%n minute ago_::_%n minutes ago_" => array("",""),
-"_%n hour ago_::_%n hours ago_" => array("",""),
+"_%n minute ago_::_%n minutes ago_" => array("","%n minuta më parë"),
+"_%n hour ago_::_%n hours ago_" => array("","%n orë më parë"),
"today" => "sot",
"yesterday" => "dje",
-"_%n day go_::_%n days ago_" => array("",""),
+"_%n day go_::_%n days ago_" => array("","%n ditë më parë"),
"last month" => "muajin e shkuar",
-"_%n month ago_::_%n months ago_" => array("",""),
+"_%n month ago_::_%n months ago_" => array("","%n muaj më parë"),
"last year" => "vitin e shkuar",
"years ago" => "vite më parë",
"Could not find category \"%s\"" => "Kategoria \"%s\" nuk u gjet"
diff --git a/lib/ocs/activity.php b/lib/ocs/activity.php
deleted file mode 100644
index c30e21018d3..00000000000
--- a/lib/ocs/activity.php
+++ /dev/null
@@ -1,28 +0,0 @@
-<?php
-/**
-* ownCloud
-*
-* @author Frank Karlitschek
-* @copyright 2012 Frank Karlitschek frank@owncloud.org
-*
-* This library is free software; you can redistribute it and/or
-* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
-* License as published by the Free Software Foundation; either
-* version 3 of the License, or any later version.
-*
-* This library is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
-*
-* You should have received a copy of the GNU Affero General Public
-* License along with this library. If not, see <http://www.gnu.org/licenses/>.
-*
-*/
-
-class OC_OCS_Activity {
-
- public static function activityGet($parameters){
- // TODO
- }
-}
diff --git a/lib/ocsclient.php b/lib/ocsclient.php
index bd0302a2a81..58636f806be 100644
--- a/lib/ocsclient.php
+++ b/lib/ocsclient.php
@@ -40,16 +40,6 @@ class OC_OCSClient{
return($url);
}
- /**
- * @brief Get the url of the OCS KB server.
- * @returns string of the KB server
- * This function returns the url of the OCS knowledge base server. It´s
- * possible to set it in the config file or it will fallback to the default
- */
- private static function getKBURL() {
- $url = OC_Config::getValue('knowledgebaseurl', 'http://api.apps.owncloud.com/v1');
- return($url);
- }
/**
* @brief Get the content of an OCS url call.
@@ -214,44 +204,5 @@ class OC_OCSClient{
}
- /**
- * @brief Get all the knowledgebase entries from the OCS server
- * @returns array with q and a data
- *
- * This function returns a list of all the knowledgebase entries from the OCS server
- */
- public static function getKnownledgebaseEntries($page, $pagesize, $search='') {
- $kbe = array('totalitems' => 0);
- if(OC_Config::getValue('knowledgebaseenabled', true)) {
- $p = (int) $page;
- $s = (int) $pagesize;
- $searchcmd = '';
- if ($search) {
- $searchcmd = '&search='.urlencode($search);
- }
- $url = OC_OCSClient::getKBURL().'/knowledgebase/data?type=150&page='. $p .'&pagesize='. $s . $searchcmd;
- $xml = OC_OCSClient::getOCSresponse($url);
- $data = @simplexml_load_string($xml);
- if($data===false) {
- OC_Log::write('core', 'Unable to parse knowledgebase content', OC_Log::FATAL);
- return null;
- }
- $tmp = $data->data->content;
- for($i = 0; $i < count($tmp); $i++) {
- $kbe[] = array(
- 'id' => $tmp[$i]->id,
- 'name' => $tmp[$i]->name,
- 'description' => $tmp[$i]->description,
- 'answer' => $tmp[$i]->answer,
- 'preview1' => $tmp[$i]->smallpreviewpic1,
- 'detailpage' => $tmp[$i]->detailpage
- );
- }
- $kbe['totalitems'] = $data->meta->totalitems;
- }
- return $kbe;
- }
-
-
}
diff --git a/lib/preview/movies.php b/lib/preview/movies.php
index e2a1b8edddc..c318137ff0e 100644
--- a/lib/preview/movies.php
+++ b/lib/preview/movies.php
@@ -9,10 +9,10 @@
namespace OC\Preview;
$isShellExecEnabled = !in_array('shell_exec', explode(', ', ini_get('disable_functions')));
-$whichFFMPEG = shell_exec('which ffmpeg');
-$isFFMPEGAvailable = !empty($whichFFMPEG);
+$whichAVCONV = shell_exec('which avconv');
+$isAVCONVAvailable = !empty($whichAVCONV);
-if($isShellExecEnabled && $isFFMPEGAvailable) {
+if($isShellExecEnabled && $isAVCONVAvailable) {
class Movie extends Provider {
@@ -30,7 +30,7 @@ if($isShellExecEnabled && $isFFMPEGAvailable) {
file_put_contents($absPath, $firstmb);
//$cmd = 'ffmpeg -y -i ' . escapeshellarg($absPath) . ' -f mjpeg -vframes 1 -ss 1 -s ' . escapeshellarg($maxX) . 'x' . escapeshellarg($maxY) . ' ' . $tmpPath;
- $cmd = 'ffmpeg -an -y -i ' . escapeshellarg($absPath) . ' -f mjpeg -vframes 1 -ss 1 ' . escapeshellarg($tmpPath);
+ $cmd = 'avconv -an -y -ss 1 -i ' . escapeshellarg($absPath) . ' -f mjpeg -vframes 1 ' . escapeshellarg($tmpPath);
shell_exec($cmd);
diff --git a/lib/public/preview.php b/lib/public/preview.php
index e488eade4da..7588347eccb 100644
--- a/lib/public/preview.php
+++ b/lib/public/preview.php
@@ -22,7 +22,7 @@ class Preview {
* @return image
*/
public static function show($file,$maxX=100,$maxY=75,$scaleup=false) {
- return(\OC_Preview::show($file,$maxX,$maxY,$scaleup));
+ return(\OC\Preview::show($file,$maxX,$maxY,$scaleup));
}
diff --git a/lib/public/share.php b/lib/public/share.php
index b38208bc67f..9ab956d84b9 100644
--- a/lib/public/share.php
+++ b/lib/public/share.php
@@ -140,8 +140,13 @@ class Share {
$source = -1;
$cache = false;
- $view = new \OC\Files\View('/' . $user . '/files/');
- $meta = $view->getFileInfo(\OC\Files\Filesystem::normalizePath($path));
+ $view = new \OC\Files\View('/' . $user . '/files');
+ if ($view->file_exists($path)) {
+ $meta = $view->getFileInfo($path);
+ } else {
+ // if the file doesn't exists yet we start with the parent folder
+ $meta = $view->getFileInfo(dirname($path));
+ }
if($meta !== false) {
$source = $meta['fileid'];
@@ -463,7 +468,7 @@ class Share {
if (isset($oldToken)) {
$token = $oldToken;
} else {
- $token = \OC_Util::generate_random_bytes(self::TOKEN_LENGTH);
+ $token = \OC_Util::generateRandomBytes(self::TOKEN_LENGTH);
}
$result = self::put($itemType, $itemSource, $shareType, $shareWith, $uidOwner, $permissions,
null, $token);
diff --git a/lib/setup.php b/lib/setup.php
index 05a49890976..6bf3c88370f 100644
--- a/lib/setup.php
+++ b/lib/setup.php
@@ -61,7 +61,7 @@ class OC_Setup {
}
//generate a random salt that is used to salt the local user passwords
- $salt = OC_Util::generate_random_bytes(30);
+ $salt = OC_Util::generateRandomBytes(30);
OC_Config::setValue('passwordsalt', $salt);
//write the config file
diff --git a/lib/setup/mysql.php b/lib/setup/mysql.php
index 0cf04fde5a1..d97b6d2602f 100644
--- a/lib/setup/mysql.php
+++ b/lib/setup/mysql.php
@@ -23,7 +23,7 @@ class MySQL extends AbstractDatabase {
$this->dbuser=substr('oc_'.$username, 0, 16);
if($this->dbuser!=$oldUser) {
//hash the password so we don't need to store the admin config in the config file
- $this->dbpassword=\OC_Util::generate_random_bytes(30);
+ $this->dbpassword=\OC_Util::generateRandomBytes(30);
$this->createDBUser($connection);
diff --git a/lib/setup/oci.php b/lib/setup/oci.php
index 86b53de45a4..326d7a00531 100644
--- a/lib/setup/oci.php
+++ b/lib/setup/oci.php
@@ -65,7 +65,7 @@ class OCI extends AbstractDatabase {
//add prefix to the oracle user name to prevent collisions
$this->dbuser='oc_'.$username;
//create a new password so we don't need to store the admin config in the config file
- $this->dbpassword=\OC_Util::generate_random_bytes(30);
+ $this->dbpassword=\OC_Util::generateRandomBytes(30);
//oracle passwords are treated as identifiers:
// must start with aphanumeric char
diff --git a/lib/setup/postgresql.php b/lib/setup/postgresql.php
index 49fcbf0326e..89d328ada19 100644
--- a/lib/setup/postgresql.php
+++ b/lib/setup/postgresql.php
@@ -33,7 +33,7 @@ class PostgreSQL extends AbstractDatabase {
//add prefix to the postgresql user name to prevent collisions
$this->dbuser='oc_'.$username;
//create a new password so we don't need to store the admin config in the config file
- $this->dbpassword=\OC_Util::generate_random_bytes(30);
+ $this->dbpassword=\OC_Util::generateRandomBytes(30);
$this->createDBUser($connection);
diff --git a/lib/templatelayout.php b/lib/templatelayout.php
index 0024c9d4960..0b868a39e49 100644
--- a/lib/templatelayout.php
+++ b/lib/templatelayout.php
@@ -58,7 +58,7 @@ class OC_TemplateLayout extends OC_Template {
if (OC_Config::getValue('installed', false) && $renderas!='error') {
$this->append( 'jsfiles', OC_Helper::linkToRoute('js_config') . $versionParameter);
}
- if (!empty(OC_Util::$core_scripts)) {
+ if (!empty(OC_Util::$coreScripts)) {
$this->append( 'jsfiles', OC_Helper::linkToRemoteBase('core.js', false) . $versionParameter);
}
foreach($jsfiles as $info) {
@@ -71,7 +71,7 @@ class OC_TemplateLayout extends OC_Template {
// Add the css files
$cssfiles = self::findStylesheetFiles(OC_Util::$styles);
$this->assign('cssfiles', array());
- if (!empty(OC_Util::$core_styles)) {
+ if (!empty(OC_Util::$coreStyles)) {
$this->append( 'cssfiles', OC_Helper::linkToRemoteBase('core.css', false) . $versionParameter);
}
foreach($cssfiles as $info) {
diff --git a/lib/user.php b/lib/user.php
index 93c7c9d4cd5..0f6f40aec9a 100644
--- a/lib/user.php
+++ b/lib/user.php
@@ -353,7 +353,7 @@ class OC_User {
* generates a password
*/
public static function generatePassword() {
- return OC_Util::generate_random_bytes(30);
+ return OC_Util::generateRandomBytes(30);
}
/**
diff --git a/lib/util.php b/lib/util.php
index 6195178701b..41f5f1d16be 100755
--- a/lib/util.php
+++ b/lib/util.php
@@ -11,12 +11,18 @@ class OC_Util {
public static $headers=array();
private static $rootMounted=false;
private static $fsSetup=false;
- public static $core_styles=array();
- public static $core_scripts=array();
+ public static $coreStyles=array();
+ public static $coreScripts=array();
- // Can be set up
- public static function setupFS( $user = '' ) {// configure the initial filesystem based on the configuration
- if(self::$fsSetup) {//setting up the filesystem twice can only lead to trouble
+ /**
+ * @brief Can be set up
+ * @param string $user
+ * @return boolean
+ * @description configure the initial filesystem based on the configuration
+ */
+ public static function setupFS( $user = '' ) {
+ //setting up the filesystem twice can only lead to trouble
+ if(self::$fsSetup) {
return false;
}
@@ -37,15 +43,16 @@ class OC_Util {
self::$fsSetup=true;
}
- $CONFIG_DATADIRECTORY = OC_Config::getValue( "datadirectory", OC::$SERVERROOT."/data" );
+ $configDataDirectory = OC_Config::getValue( "datadirectory", OC::$SERVERROOT."/data" );
//first set up the local "root" storage
\OC\Files\Filesystem::initMounts();
if(!self::$rootMounted) {
- \OC\Files\Filesystem::mount('\OC\Files\Storage\Local', array('datadir'=>$CONFIG_DATADIRECTORY), '/');
- self::$rootMounted=true;
+ \OC\Files\Filesystem::mount('\OC\Files\Storage\Local', array('datadir'=>$configDataDirectory), '/');
+ self::$rootMounted = true;
}
- if( $user != "" ) { //if we aren't logged in, there is no use to set up the filesystem
+ //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) {
@@ -56,19 +63,19 @@ class OC_Util {
}
});
}
- $user_dir = '/'.$user.'/files';
- $user_root = OC_User::getHome($user);
- $userdirectory = $user_root . '/files';
- if( !is_dir( $userdirectory )) {
- mkdir( $userdirectory, 0755, true );
+ $userDir = '/'.$user.'/files';
+ $userRoot = OC_User::getHome($user);
+ $userDirectory = $userRoot . '/files';
+ if( !is_dir( $userDirectory )) {
+ mkdir( $userDirectory, 0755, true );
}
//jail the user into his "home" directory
- \OC\Files\Filesystem::init($user, $user_dir);
+ \OC\Files\Filesystem::init($user, $userDir);
$fileOperationProxy = new OC_FileProxy_FileOperations();
OC_FileProxy::register($fileOperationProxy);
- OC_Hook::emit('OC_Filesystem', 'setup', array('user' => $user, 'user_dir' => $user_dir));
+ OC_Hook::emit('OC_Filesystem', 'setup', array('user' => $user, 'user_dir' => $userDir));
}
return true;
}
@@ -85,14 +92,17 @@ class OC_Util {
}
}
+ /**
+ * @return void
+ */
public static function tearDownFS() {
\OC\Files\Filesystem::tearDown();
self::$fsSetup=false;
- self::$rootMounted=false;
+ self::$rootMounted=false;
}
/**
- * get the current installed version of ownCloud
+ * @brief get the current installed version of ownCloud
* @return array
*/
public static function getVersion() {
@@ -102,7 +112,7 @@ class OC_Util {
}
/**
- * get the current installed version string of ownCloud
+ * @brief get the current installed version string of ownCloud
* @return string
*/
public static function getVersionString() {
@@ -110,7 +120,7 @@ class OC_Util {
}
/**
- * get the current installed edition of ownCloud. There is the community
+ * @description get the current installed edition of ownCloud. There is the community
* edition that just returns an empty string and the enterprise edition
* that returns "Enterprise".
* @return string
@@ -120,103 +130,117 @@ class OC_Util {
}
/**
- * add a javascript file
+ * @brief add a javascript file
*
- * @param appid $application
- * @param filename $file
+ * @param string $application
+ * @param filename $file
+ * @return void
*/
public static function addScript( $application, $file = null ) {
- if( is_null( $file )) {
+ if ( is_null( $file )) {
$file = $application;
$application = "";
}
- if( !empty( $application )) {
+ if ( !empty( $application )) {
self::$scripts[] = "$application/js/$file";
- }else{
+ } else {
self::$scripts[] = "js/$file";
}
}
/**
- * add a css file
+ * @brief add a css file
*
- * @param appid $application
- * @param filename $file
+ * @param string $application
+ * @param filename $file
+ * @return void
*/
public static function addStyle( $application, $file = null ) {
- if( is_null( $file )) {
+ if ( is_null( $file )) {
$file = $application;
$application = "";
}
- if( !empty( $application )) {
+ if ( !empty( $application )) {
self::$styles[] = "$application/css/$file";
- }else{
+ } else {
self::$styles[] = "css/$file";
}
}
/**
* @brief Add a custom element to the header
- * @param string tag tag name of the element
+ * @param string $tag tag name of the element
* @param array $attributes array of attributes for the element
* @param string $text the text content for the element
+ * @return void
*/
public static function addHeader( $tag, $attributes, $text='') {
- self::$headers[] = array('tag'=>$tag, 'attributes'=>$attributes, 'text'=>$text);
+ self::$headers[] = array(
+ 'tag'=>$tag,
+ 'attributes'=>$attributes,
+ 'text'=>$text
+ );
}
/**
- * formats a timestamp in the "right" way
+ * @brief formats a timestamp in the "right" way
*
- * @param int timestamp $timestamp
- * @param bool dateOnly option to omit time from the result
+ * @param int $timestamp
+ * @param bool $dateOnly option to omit time from the result
+ * @return string timestamp
+ * @description adjust to clients timezone if we know it
*/
public static function formatDate( $timestamp, $dateOnly=false) {
- if(\OC::$session->exists('timezone')) {//adjust to clients timezone if we know it
+ if(\OC::$session->exists('timezone')) {
$systemTimeZone = intval(date('O'));
- $systemTimeZone=(round($systemTimeZone/100, 0)*60)+($systemTimeZone%100);
- $clientTimeZone=\OC::$session->get('timezone')*60;
- $offset=$clientTimeZone-$systemTimeZone;
- $timestamp=$timestamp+$offset*60;
+ $systemTimeZone = (round($systemTimeZone/100, 0)*60) + ($systemTimeZone%100);
+ $clientTimeZone = \OC::$session->get('timezone')*60;
+ $offset = $clientTimeZone - $systemTimeZone;
+ $timestamp = $timestamp + $offset*60;
}
- $l=OC_L10N::get('lib');
+ $l = OC_L10N::get('lib');
return $l->l($dateOnly ? 'date' : 'datetime', $timestamp);
}
/**
- * check if the current server configuration is suitable for ownCloud
+ * @brief check if the current server configuration is suitable for ownCloud
* @return array arrays with error messages and hints
*/
public static function checkServer() {
// Assume that if checkServer() succeeded before in this session, then all is fine.
- if(\OC::$session->exists('checkServer_suceeded') && \OC::$session->get('checkServer_suceeded'))
+ if(\OC::$session->exists('checkServer_suceeded') && \OC::$session->get('checkServer_suceeded')) {
return array();
+ }
- $errors=array();
+ $errors = array();
$defaults = new \OC_Defaults();
- $web_server_restart= false;
+ $webServerRestart = false;
//check for database drivers
if(!(is_callable('sqlite_open') or class_exists('SQLite3'))
and !is_callable('mysql_connect')
and !is_callable('pg_connect')
and !is_callable('oci_connect')) {
- $errors[]=array('error'=>'No database drivers (sqlite, mysql, or postgresql) installed.',
- 'hint'=>'');//TODO: sane hint
- $web_server_restart= true;
+ $errors[] = array(
+ 'error'=>'No database drivers (sqlite, mysql, or postgresql) installed.',
+ 'hint'=>'' //TODO: sane hint
+ );
+ $webServerRestart = true;
}
- //common hint for all file permissons error messages
+ //common hint for all file permissions error messages
$permissionsHint = 'Permissions can usually be fixed by '
- .'<a href="' . $defaults->getDocBaseUrl() . '/server/5.0/admin_manual/installation/installation_source.html#set-the-directory-permissions" target="_blank">giving the webserver write access to the root directory</a>.';
+ .'<a href="' . $defaults->getDocBaseUrl() . '/server/5.0/admin_manual/installation/installation_source.html'
+ .'#set-the-directory-permissions" target="_blank">giving the webserver write access to the root directory</a>.';
// Check if config folder is writable.
if(!is_writable(OC::$SERVERROOT."/config/") or !is_readable(OC::$SERVERROOT."/config/")) {
$errors[] = array(
'error' => "Can't write into config directory",
'hint' => 'This can usually be fixed by '
- .'<a href="' . $defaults->getDocBaseUrl() . '/server/5.0/admin_manual/installation/installation_source.html#set-the-directory-permissions" target="_blank">giving the webserver write access to the config directory</a>.'
+ .'<a href="' . $defaults->getDocBaseUrl() . '/server/5.0/admin_manual/installation/installation_source.html'
+ .'#set-the-directory-permissions" target="_blank">giving the webserver write access to the config directory</a>.'
);
}
@@ -228,7 +252,8 @@ class OC_Util {
$errors[] = array(
'error' => "Can't write into apps directory",
'hint' => 'This can usually be fixed by '
- .'<a href="' . $defaults->getDocBaseUrl() . '/server/5.0/admin_manual/installation/installation_source.html#set-the-directory-permissions" target="_blank">giving the webserver write access to the apps directory</a> '
+ .'<a href="' . $defaults->getDocBaseUrl() . '/server/5.0/admin_manual/installation/installation_source.html'
+ .'#set-the-directory-permissions" target="_blank">giving the webserver write access to the apps directory</a> '
.'or disabling the appstore in the config file.'
);
}
@@ -243,94 +268,131 @@ class OC_Util {
$errors[] = array(
'error' => "Can't create data directory (".$CONFIG_DATADIRECTORY.")",
'hint' => 'This can usually be fixed by '
- .'<a href="' . $defaults->getDocBaseUrl() . '/server/5.0/admin_manual/installation/installation_source.html#set-the-directory-permissions" target="_blank">giving the webserver write access to the root directory</a>.'
+ .'<a href="' . $defaults->getDocBaseUrl() . '/server/5.0/admin_manual/installation/installation_source.html'
+ .'#set-the-directory-permissions" target="_blank">giving the webserver write access to the root directory</a>.'
);
}
} else if(!is_writable($CONFIG_DATADIRECTORY) or !is_readable($CONFIG_DATADIRECTORY)) {
- $errors[]=array('error'=>'Data directory ('.$CONFIG_DATADIRECTORY.') not writable by ownCloud',
- 'hint'=>$permissionsHint);
+ $errors[] = array(
+ 'error'=>'Data directory ('.$CONFIG_DATADIRECTORY.') not writable by ownCloud',
+ 'hint'=>$permissionsHint
+ );
} else {
$errors = array_merge($errors, self::checkDataDirectoryPermissions($CONFIG_DATADIRECTORY));
}
+
+ $moduleHint = "Please ask your server administrator to install the module.";
// check if all required php modules are present
if(!class_exists('ZipArchive')) {
- $errors[]=array('error'=>'PHP module zip not installed.',
- 'hint'=>'Please ask your server administrator to install the module.');
- $web_server_restart=true;
+ $errors[] = array(
+ 'error'=>'PHP module zip not installed.',
+ 'hint'=>$moduleHint
+ );
+ $webServerRestart = true;
}
if(!class_exists('DOMDocument')) {
- $errors[] = array('error' => 'PHP module dom not installed.',
- 'hint' => 'Please ask your server administrator to install the module.');
- $web_server_restart =true;
+ $errors[] = array(
+ 'error' => 'PHP module dom not installed.',
+ 'hint' => $moduleHint
+ );
+ $webServerRestart =true;
}
if(!function_exists('xml_parser_create')) {
- $errors[] = array('error' => 'PHP module libxml not installed.',
- 'hint' => 'Please ask your server administrator to install the module.');
- $web_server_restart =true;
+ $errors[] = array(
+ 'error' => 'PHP module libxml not installed.',
+ 'hint' => $moduleHint
+ );
+ $webServerRestart = true;
}
if(!function_exists('mb_detect_encoding')) {
- $errors[]=array('error'=>'PHP module mb multibyte not installed.',
- 'hint'=>'Please ask your server administrator to install the module.');
- $web_server_restart=true;
+ $errors[] = array(
+ 'error'=>'PHP module mb multibyte not installed.',
+ 'hint'=>$moduleHint
+ );
+ $webServerRestart = true;
}
if(!function_exists('ctype_digit')) {
- $errors[]=array('error'=>'PHP module ctype is not installed.',
- 'hint'=>'Please ask your server administrator to install the module.');
- $web_server_restart=true;
+ $errors[] = array(
+ 'error'=>'PHP module ctype is not installed.',
+ 'hint'=>$moduleHint
+ );
+ $webServerRestart = true;
}
if(!function_exists('json_encode')) {
- $errors[]=array('error'=>'PHP module JSON is not installed.',
- 'hint'=>'Please ask your server administrator to install the module.');
- $web_server_restart=true;
+ $errors[] = array(
+ 'error'=>'PHP module JSON is not installed.',
+ 'hint'=>$moduleHint
+ );
+ $webServerRestart = true;
}
if(!extension_loaded('gd') || !function_exists('gd_info')) {
- $errors[]=array('error'=>'PHP module GD is not installed.',
- 'hint'=>'Please ask your server administrator to install the module.');
- $web_server_restart=true;
+ $errors[] = array(
+ 'error'=>'PHP module GD is not installed.',
+ 'hint'=>$moduleHint
+ );
+ $webServerRestart = true;
}
if(!function_exists('gzencode')) {
- $errors[]=array('error'=>'PHP module zlib is not installed.',
- 'hint'=>'Please ask your server administrator to install the module.');
- $web_server_restart=true;
+ $errors[] = array(
+ 'error'=>'PHP module zlib is not installed.',
+ 'hint'=>$moduleHint
+ );
+ $webServerRestart = true;
}
if(!function_exists('iconv')) {
- $errors[]=array('error'=>'PHP module iconv is not installed.',
- 'hint'=>'Please ask your server administrator to install the module.');
- $web_server_restart=true;
+ $errors[] = array(
+ 'error'=>'PHP module iconv is not installed.',
+ 'hint'=>$moduleHint
+ );
+ $webServerRestart = true;
}
if(!function_exists('simplexml_load_string')) {
- $errors[]=array('error'=>'PHP module SimpleXML is not installed.',
- 'hint'=>'Please ask your server administrator to install the module.');
- $web_server_restart=true;
+ $errors[] = array(
+ 'error'=>'PHP module SimpleXML is not installed.',
+ 'hint'=>$moduleHint
+ );
+ $webServerRestart = true;
}
- if(floatval(phpversion())<5.3) {
- $errors[]=array('error'=>'PHP 5.3 is required.',
+ if(floatval(phpversion()) < 5.3) {
+ $errors[] = array(
+ 'error'=>'PHP 5.3 is required.',
'hint'=>'Please ask your server administrator to update PHP to version 5.3 or higher.'
- .' PHP 5.2 is no longer supported by ownCloud and the PHP community.');
- $web_server_restart=true;
+ .' PHP 5.2 is no longer supported by ownCloud and the PHP community.'
+ );
+ $webServerRestart = true;
}
if(!defined('PDO::ATTR_DRIVER_NAME')) {
- $errors[]=array('error'=>'PHP PDO module is not installed.',
- 'hint'=>'Please ask your server administrator to install the module.');
- $web_server_restart=true;
+ $errors[] = array(
+ 'error'=>'PHP PDO module is not installed.',
+ 'hint'=>$moduleHint
+ );
+ $webServerRestart = true;
}
if (((strtolower(@ini_get('safe_mode')) == 'on')
|| (strtolower(@ini_get('safe_mode')) == 'yes')
|| (strtolower(@ini_get('safe_mode')) == 'true')
|| (ini_get("safe_mode") == 1 ))) {
- $errors[]=array('error'=>'PHP Safe Mode is enabled. ownCloud requires that it is disabled to work properly.',
- 'hint'=>'PHP Safe Mode is a deprecated and mostly useless setting that should be disabled. Please ask your server administrator to disable it in php.ini or in your webserver config.');
- $web_server_restart=true;
+ $errors[] = array(
+ 'error'=>'PHP Safe Mode is enabled. ownCloud requires that it is disabled to work properly.',
+ 'hint'=>'PHP Safe Mode is a deprecated and mostly useless setting that should be disabled. '
+ .'Please ask your server administrator to disable it in php.ini or in your webserver config.'
+ );
+ $webServerRestart = true;
}
if (get_magic_quotes_gpc() == 1 ) {
- $errors[]=array('error'=>'Magic Quotes is enabled. ownCloud requires that it is disabled to work properly.',
- 'hint'=>'Magic Quotes is a deprecated and mostly useless setting that should be disabled. Please ask your server administrator to disable it in php.ini or in your webserver config.');
- $web_server_restart=true;
+ $errors[] = array(
+ 'error'=>'Magic Quotes is enabled. ownCloud requires that it is disabled to work properly.',
+ 'hint'=>'Magic Quotes is a deprecated and mostly useless setting that should be disabled. '
+ .'Please ask your server administrator to disable it in php.ini or in your webserver config.'
+ );
+ $webServerRestart = true;
}
- if($web_server_restart) {
- $errors[]=array('error'=>'PHP modules have been installed, but they are still listed as missing?',
- 'hint'=>'Please ask your server administrator to restart the web server.');
+ if($webServerRestart) {
+ $errors[] = array(
+ 'error'=>'PHP modules have been installed, but they are still listed as missing?',
+ 'hint'=>'Please ask your server administrator to restart the web server.'
+ );
}
// Cache the result of this function
@@ -357,30 +419,36 @@ class OC_Util {
}
/**
- * Check for correct file permissions of data directory
- * @return array arrays with error messages and hints
- */
+ * @brief Check for correct file permissions of data directory
+ * @paran string $dataDirectory
+ * @return array arrays with error messages and hints
+ */
public static function checkDataDirectoryPermissions($dataDirectory) {
$errors = array();
- if (stristr(PHP_OS, 'WIN')) {
+ if (self::runningOnWindows()) {
//TODO: permissions checks for windows hosts
} else {
$permissionsModHint = 'Please change the permissions to 0770 so that the directory'
.' cannot be listed by other users.';
- $prems = substr(decoct(@fileperms($dataDirectory)), -3);
- if (substr($prems, -1) != '0') {
+ $perms = substr(decoct(@fileperms($dataDirectory)), -3);
+ if (substr($perms, -1) != '0') {
OC_Helper::chmodr($dataDirectory, 0770);
clearstatcache();
- $prems = substr(decoct(@fileperms($dataDirectory)), -3);
- if (substr($prems, 2, 1) != '0') {
- $errors[] = array('error' => 'Data directory ('.$dataDirectory.') is readable for other users',
- 'hint' => $permissionsModHint);
+ $perms = substr(decoct(@fileperms($dataDirectory)), -3);
+ if (substr($perms, 2, 1) != '0') {
+ $errors[] = array(
+ 'error' => 'Data directory ('.$dataDirectory.') is readable for other users',
+ 'hint' => $permissionsModHint
+ );
}
}
}
return $errors;
}
+ /**
+ * @return void
+ */
public static function displayLoginPage($errors = array()) {
$parameters = array();
foreach( $errors as $key => $value ) {
@@ -394,8 +462,8 @@ class OC_Util {
$parameters['user_autofocus'] = true;
}
if (isset($_REQUEST['redirect_url'])) {
- $redirect_url = $_REQUEST['redirect_url'];
- $parameters['redirect_url'] = urlencode($redirect_url);
+ $redirectUrl = $_REQUEST['redirect_url'];
+ $parameters['redirect_url'] = urlencode($redirectUrl);
}
$parameters['alt_login'] = OC_App::getAlternativeLogIns();
@@ -404,7 +472,8 @@ class OC_Util {
/**
- * Check if the app is enabled, redirects to home if not
+ * @brief Check if the app is enabled, redirects to home if not
+ * @return void
*/
public static function checkAppEnabled($app) {
if( !OC_App::isEnabled($app)) {
@@ -416,18 +485,21 @@ class OC_Util {
/**
* Check if the user is logged in, redirects to home if not. With
* redirect URL parameter to the request URI.
+ * @return void
*/
public static function checkLoggedIn() {
// Check if we are a user
if( !OC_User::isLoggedIn()) {
header( 'Location: '.OC_Helper::linkToAbsolute( '', 'index.php',
- array('redirect_url' => OC_Request::requestUri())));
+ array('redirectUrl' => OC_Request::requestUri())
+ ));
exit();
}
}
/**
- * Check if the user is a admin, redirects to home if not
+ * @brief Check if the user is a admin, redirects to home if not
+ * @return void
*/
public static function checkAdminUser() {
if( !OC_User::isAdminUser(OC_User::getUser())) {
@@ -437,7 +509,7 @@ class OC_Util {
}
/**
- * Check if the user is a subadmin, redirects to home if not
+ * @brief Check if the user is a subadmin, redirects to home if not
* @return array $groups where the current user is subadmin
*/
public static function checkSubAdminUser() {
@@ -449,7 +521,8 @@ class OC_Util {
}
/**
- * Redirect to the user default page
+ * @brief Redirect to the user default page
+ * @return void
*/
public static function redirectToDefaultPage() {
if(isset($_REQUEST['redirect_url'])) {
@@ -457,13 +530,11 @@ class OC_Util {
}
else if (isset(OC::$REQUESTEDAPP) && !empty(OC::$REQUESTEDAPP)) {
$location = OC_Helper::linkToAbsolute( OC::$REQUESTEDAPP, 'index.php' );
- }
- else {
- $defaultpage = OC_Appconfig::getValue('core', 'defaultpage');
- if ($defaultpage) {
- $location = OC_Helper::makeURLAbsolute(OC::$WEBROOT.'/'.$defaultpage);
- }
- else {
+ } else {
+ $defaultPage = OC_Appconfig::getValue('core', 'defaultpage');
+ if ($defaultPage) {
+ $location = OC_Helper::makeURLAbsolute(OC::$WEBROOT.'/'.$defaultPage);
+ } else {
$location = OC_Helper::linkToAbsolute( 'files', 'index.php' );
}
}
@@ -472,28 +543,28 @@ class OC_Util {
exit();
}
- /**
- * get an id unique for this instance
- * @return string
- */
- public static function getInstanceId() {
- $id = OC_Config::getValue('instanceid', null);
- if(is_null($id)) {
- // We need to guarantee at least one letter in instanceid so it can be used as the session_name
- $id = 'oc' . OC_Util::generate_random_bytes(10);
- OC_Config::setValue('instanceid', $id);
- }
- return $id;
- }
+ /**
+ * @brief get an id unique for this instance
+ * @return string
+ */
+ public static function getInstanceId() {
+ $id = OC_Config::getValue('instanceid', null);
+ if(is_null($id)) {
+ // We need to guarantee at least one letter in instanceid so it can be used as the session_name
+ $id = 'oc' . self::generateRandomBytes(10);
+ OC_Config::setValue('instanceid', $id);
+ }
+ return $id;
+ }
/**
* @brief Static lifespan (in seconds) when a request token expires.
* @see OC_Util::callRegister()
* @see OC_Util::isCallRegistered()
* @description
- * Also required for the client side to compute the piont in time when to
+ * Also required for the client side to compute the point in time when to
* request a fresh token. The client will do so when nearly 97% of the
- * timespan coded here has expired.
+ * time span coded here has expired.
*/
public static $callLifespan = 3600; // 3600 secs = 1 hour
@@ -513,7 +584,7 @@ class OC_Util {
// Check if a token exists
if(!\OC::$session->exists('requesttoken')) {
// No valid token found, generate a new one.
- $requestToken = self::generate_random_bytes(20);
+ $requestToken = self::generateRandomBytes(20);
\OC::$session->set('requesttoken', $requestToken);
} else {
// Valid token already exists, send it
@@ -534,11 +605,11 @@ class OC_Util {
}
if(isset($_GET['requesttoken'])) {
- $token=$_GET['requesttoken'];
+ $token = $_GET['requesttoken'];
} elseif(isset($_POST['requesttoken'])) {
- $token=$_POST['requesttoken'];
+ $token = $_POST['requesttoken'];
} elseif(isset($_SERVER['HTTP_REQUESTTOKEN'])) {
- $token=$_SERVER['HTTP_REQUESTTOKEN'];
+ $token = $_SERVER['HTTP_REQUESTTOKEN'];
} else {
//no token found.
return false;
@@ -556,11 +627,12 @@ class OC_Util {
/**
* @brief Check an ajax get/post call if the request token is valid. exit if not.
- * Todo: Write howto
+ * @todo Write howto
+ * @return void
*/
public static function callCheck() {
if(!OC_Util::isCallRegistered()) {
- exit;
+ exit();
}
}
@@ -570,14 +642,15 @@ class OC_Util {
* This function is used to sanitize HTML and should be applied on any
* string or array of strings before displaying it on a web page.
*
- * @param string or array of strings
+ * @param string|array of strings
* @return array with sanitized strings or a single sanitized string, depends on the input parameter.
*/
public static function sanitizeHTML( &$value ) {
if (is_array($value)) {
array_walk_recursive($value, 'OC_Util::sanitizeHTML');
} else {
- $value = htmlentities((string)$value, ENT_QUOTES, 'UTF-8'); //Specify encoding for PHP<5.4
+ //Specify encoding for PHP<5.4
+ $value = htmlentities((string)$value, ENT_QUOTES, 'UTF-8');
}
return $value;
}
@@ -599,48 +672,52 @@ class OC_Util {
}
/**
- * Check if the htaccess file is working by creating a test file in the data directory and trying to access via http
+ * @brief Check if the htaccess file is working
+ * @return bool
+ * @description Check if the htaccess file is working by creating a test
+ * file in the data directory and trying to access via http
*/
- public static function ishtaccessworking() {
+ public static function isHtAccessWorking() {
// testdata
- $filename='/htaccesstest.txt';
- $testcontent='testcontent';
+ $fileName = '/htaccesstest.txt';
+ $testContent = 'testcontent';
// creating a test file
- $testfile = OC_Config::getValue( "datadirectory", OC::$SERVERROOT."/data" ).'/'.$filename;
+ $testFile = OC_Config::getValue( "datadirectory", OC::$SERVERROOT."/data" ).'/'.$fileName;
- if(file_exists($testfile)) {// already running this test, possible recursive call
+ if(file_exists($testFile)) {// already running this test, possible recursive call
return false;
}
- $fp = @fopen($testfile, 'w');
- @fwrite($fp, $testcontent);
+ $fp = @fopen($testFile, 'w');
+ @fwrite($fp, $testContent);
@fclose($fp);
// accessing the file via http
- $url = OC_Helper::makeURLAbsolute(OC::$WEBROOT.'/data'.$filename);
+ $url = OC_Helper::makeURLAbsolute(OC::$WEBROOT.'/data'.$fileName);
$fp = @fopen($url, 'r');
$content=@fread($fp, 2048);
@fclose($fp);
// cleanup
- @unlink($testfile);
+ @unlink($testFile);
// does it work ?
- if($content==$testcontent) {
- return(false);
- }else{
- return(true);
+ if($content==$testContent) {
+ return false;
+ } else {
+ return true;
}
}
/**
- * we test if webDAV is working properly
- *
+ * @brief test if webDAV is working properly
+ * @return bool
+ * @description
* The basic assumption is that if the server returns 401/Not Authenticated for an unauthenticated PROPFIND
* the web server it self is setup properly.
*
- * Why not an authenticated PROFIND and other verbs?
+ * Why not an authenticated PROPFIND and other verbs?
* - We don't have the password available
* - We have no idea about other auth methods implemented (e.g. OAuth with Bearer header)
*
@@ -654,7 +731,7 @@ class OC_Util {
);
// save the old timeout so that we can restore it later
- $old_timeout=ini_get("default_socket_timeout");
+ $oldTimeout = ini_get("default_socket_timeout");
// use a 5 sec timeout for the check. Should be enough for local requests.
ini_set("default_socket_timeout", 5);
@@ -668,24 +745,25 @@ class OC_Util {
try {
// test PROPFIND
$client->propfind('', array('{DAV:}resourcetype'));
- } catch(\Sabre_DAV_Exception_NotAuthenticated $e) {
+ } catch (\Sabre_DAV_Exception_NotAuthenticated $e) {
$return = true;
- } catch(\Exception $e) {
+ } catch (\Exception $e) {
OC_Log::write('core', 'isWebDAVWorking: NO - Reason: '.$e->getMessage(). ' ('.get_class($e).')', OC_Log::WARN);
$return = false;
}
// restore the original timeout
- ini_set("default_socket_timeout", $old_timeout);
+ ini_set("default_socket_timeout", $oldTimeout);
return $return;
}
/**
- * Check if the setlocal call doesn't work. This can happen if the right
+ * Check if the setlocal call does not work. This can happen if the right
* local packages are not available on the server.
+ * @return bool
*/
- public static function issetlocaleworking() {
+ public static function isSetLocaleWorking() {
// setlocale test is pointless on Windows
if (OC_Util::runningOnWindows() ) {
return true;
@@ -699,7 +777,7 @@ class OC_Util {
}
/**
- * Check if the PHP module fileinfo is loaded.
+ * @brief Check if the PHP module fileinfo is loaded.
* @return bool
*/
public static function fileInfoLoaded() {
@@ -707,7 +785,8 @@ class OC_Util {
}
/**
- * Check if the ownCloud server can connect to the internet
+ * @brief Check if the ownCloud server can connect to the internet
+ * @return bool
*/
public static function isInternetConnectionWorking() {
// in case there is no internet connection on purpose return false
@@ -720,30 +799,29 @@ class OC_Util {
if ($connected) {
fclose($connected);
return true;
- }else{
-
+ } else {
// second try in case one server is down
$connected = @fsockopen("apps.owncloud.com", 80);
if ($connected) {
fclose($connected);
return true;
- }else{
+ } else {
return false;
}
-
}
-
}
/**
- * Check if the connection to the internet is disabled on purpose
+ * @brief Check if the connection to the internet is disabled on purpose
+ * @return bool
*/
public static function isInternetConnectionEnabled(){
return \OC_Config::getValue("has_internet_connection", true);
}
/**
- * clear all levels of output buffering
+ * @brief clear all levels of output buffering
+ * @return void
*/
public static function obEnd(){
while (ob_get_level()) {
@@ -753,47 +831,47 @@ class OC_Util {
/**
- * @brief Generates a cryptographical secure pseudorandom string
- * @param Int with the length of the random string
+ * @brief Generates a cryptographic secure pseudo-random string
+ * @param Int $length of the random string
* @return String
- * Please also update secureRNG_available if you change something here
+ * Please also update secureRNGAvailable if you change something here
*/
- public static function generate_random_bytes($length = 30) {
-
+ public static function generateRandomBytes($length = 30) {
// Try to use openssl_random_pseudo_bytes
- if(function_exists('openssl_random_pseudo_bytes')) {
- $pseudo_byte = bin2hex(openssl_random_pseudo_bytes($length, $strong));
+ if (function_exists('openssl_random_pseudo_bytes')) {
+ $pseudoByte = bin2hex(openssl_random_pseudo_bytes($length, $strong));
if($strong == true) {
- return substr($pseudo_byte, 0, $length); // Truncate it to match the length
+ return substr($pseudoByte, 0, $length); // Truncate it to match the length
}
}
// Try to use /dev/urandom
- $fp = @file_get_contents('/dev/urandom', false, null, 0, $length);
- if ($fp !== false) {
- $string = substr(bin2hex($fp), 0, $length);
- return $string;
+ if (!self::runningOnWindows()) {
+ $fp = @file_get_contents('/dev/urandom', false, null, 0, $length);
+ if ($fp !== false) {
+ $string = substr(bin2hex($fp), 0, $length);
+ return $string;
+ }
}
// Fallback to mt_rand()
$characters = '0123456789';
$characters .= 'abcdefghijklmnopqrstuvwxyz';
$charactersLength = strlen($characters)-1;
- $pseudo_byte = "";
+ $pseudoByte = "";
// Select some random characters
for ($i = 0; $i < $length; $i++) {
- $pseudo_byte .= $characters[mt_rand(0, $charactersLength)];
+ $pseudoByte .= $characters[mt_rand(0, $charactersLength)];
}
- return $pseudo_byte;
+ return $pseudoByte;
}
/**
* @brief Checks if a secure random number generator is available
* @return bool
*/
- public static function secureRNG_available() {
-
+ public static function secureRNGAvailable() {
// Check openssl_random_pseudo_bytes
if(function_exists('openssl_random_pseudo_bytes')) {
openssl_random_pseudo_bytes(1, $strong);
@@ -803,9 +881,11 @@ class OC_Util {
}
// Check /dev/urandom
- $fp = @file_get_contents('/dev/urandom', false, null, 0, 1);
- if ($fp !== false) {
- return true;
+ if (!self::runningOnWindows()) {
+ $fp = @file_get_contents('/dev/urandom', false, null, 0, 1);
+ if ($fp !== false) {
+ return true;
+ }
}
return false;
@@ -818,11 +898,8 @@ class OC_Util {
* This function get the content of a page via curl, if curl is enabled.
* If not, file_get_element is used.
*/
-
public static function getUrlContent($url){
-
- if (function_exists('curl_init')) {
-
+ if (function_exists('curl_init')) {
$curl = curl_init();
curl_setopt($curl, CURLOPT_HEADER, 0);
@@ -833,10 +910,10 @@ class OC_Util {
curl_setopt($curl, CURLOPT_MAXREDIRS, 10);
curl_setopt($curl, CURLOPT_USERAGENT, "ownCloud Server Crawler");
- if(OC_Config::getValue('proxy', '')<>'') {
+ if(OC_Config::getValue('proxy', '') != '') {
curl_setopt($curl, CURLOPT_PROXY, OC_Config::getValue('proxy'));
}
- if(OC_Config::getValue('proxyuserpwd', '')<>'') {
+ if(OC_Config::getValue('proxyuserpwd', '') != '') {
curl_setopt($curl, CURLOPT_PROXYUSERPWD, OC_Config::getValue('proxyuserpwd'));
}
$data = curl_exec($curl);
@@ -845,7 +922,7 @@ class OC_Util {
} else {
$contextArray = null;
- if(OC_Config::getValue('proxy', '')<>'') {
+ if(OC_Config::getValue('proxy', '') != '') {
$contextArray = array(
'http' => array(
'timeout' => 10,
@@ -860,11 +937,10 @@ class OC_Util {
);
}
-
$ctx = stream_context_create(
$contextArray
);
- $data=@file_get_contents($url, 0, $ctx);
+ $data = @file_get_contents($url, 0, $ctx);
}
return $data;
@@ -877,7 +953,6 @@ class OC_Util {
return (substr(PHP_OS, 0, 3) === "WIN");
}
-
/**
* Handles the case that there may not be a theme, then check if a "default"
* theme exists and take that one
@@ -887,20 +962,19 @@ class OC_Util {
$theme = OC_Config::getValue("theme", '');
if($theme === '') {
-
if(is_dir(OC::$SERVERROOT . '/themes/default')) {
$theme = 'default';
}
-
}
return $theme;
}
/**
- * Clear the opcode cache if one exists
+ * @brief Clear the opcode cache if one exists
* This is necessary for writing to the config file
- * in case the opcode cache doesn't revalidate files
+ * in case the opcode cache does not re-validate files
+ * @return void
*/
public static function clearOpcodeCache() {
// APC
@@ -939,8 +1013,10 @@ class OC_Util {
return $value;
}
- public static function basename($file)
- {
+ /**
+ * @return string
+ */
+ public static function basename($file) {
$file = rtrim($file, '/');
$t = explode('/', $file);
return array_pop($t);