summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorMichael Gapczynski <mtgap@owncloud.com>2013-03-07 17:14:34 -0500
committerMichael Gapczynski <mtgap@owncloud.com>2013-03-07 17:14:34 -0500
commit48265643446f71abc1bf903ae822c746d5938865 (patch)
tree8a66504c8dd0997a9cc8aa7631eea834667ee20a /lib
parent4cb5cb9693a2b5d13905079f2ba7c6300c26d9b2 (diff)
parent0aa6c1b163c582011f695510b0048e31479eb8a4 (diff)
downloadnextcloud-server-48265643446f71abc1bf903ae822c746d5938865.tar.gz
nextcloud-server-48265643446f71abc1bf903ae822c746d5938865.zip
Merge branch 'master' into shared-folder-etags
Conflicts: apps/files_sharing/lib/sharedstorage.php
Diffstat (limited to 'lib')
-rw-r--r--lib/base.php4
-rw-r--r--lib/connector/sabre/directory.php4
-rw-r--r--lib/files.php13
-rw-r--r--lib/files/mount.php26
-rw-r--r--lib/files/view.php2
-rw-r--r--lib/group.php8
-rw-r--r--lib/group/backend.php2
-rw-r--r--lib/public/share.php2
-rw-r--r--lib/template.php5
-rwxr-xr-xlib/util.php30
10 files changed, 70 insertions, 26 deletions
diff --git a/lib/base.php b/lib/base.php
index bffae36261e..59b861ffce1 100644
--- a/lib/base.php
+++ b/lib/base.php
@@ -277,6 +277,10 @@ class OC {
OC_Log::write('core',
'starting upgrade from ' . $installedVersion . ' to ' . $currentVersion,
OC_Log::DEBUG);
+ $minimizerCSS = new OC_Minimizer_CSS();
+ $minimizerCSS->clearCache();
+ $minimizerJS = new OC_Minimizer_JS();
+ $minimizerJS->clearCache();
OC_Util::addscript('update');
$tmpl = new OC_Template('', 'update', 'guest');
$tmpl->assign('version', OC_Util::getVersionString());
diff --git a/lib/connector/sabre/directory.php b/lib/connector/sabre/directory.php
index 953692f80a9..6ccb54b79ab 100644
--- a/lib/connector/sabre/directory.php
+++ b/lib/connector/sabre/directory.php
@@ -107,7 +107,9 @@ class OC_Connector_Sabre_Directory extends OC_Connector_Sabre_Node implements Sa
public function createDirectory($name) {
$newPath = $this->path . '/' . $name;
- \OC\Files\Filesystem::mkdir($newPath);
+ if(!\OC\Files\Filesystem::mkdir($newPath)) {
+ throw new Sabre_DAV_Exception_Forbidden('Could not create directory '.$newPath);
+ }
}
diff --git a/lib/files.php b/lib/files.php
index b594b78c4b7..447ffb50577 100644
--- a/lib/files.php
+++ b/lib/files.php
@@ -49,8 +49,9 @@ class OC_Files {
isset($_SERVER['MOD_X_ACCEL_REDIRECT_ENABLED'])) {
$xsendfile = true;
}
- if(strpos($files, ';')) {
- $files=explode(';', $files);
+
+ if (count($files) == 1) {
+ $files = $files[0];
}
if (is_array($files)) {
@@ -77,7 +78,13 @@ class OC_Files {
}
}
$zip->close();
- $name = basename($dir) . '.zip';
+ $basename = basename($dir);
+ if ($basename) {
+ $name = $basename . '.zip';
+ } else {
+ $name = 'owncloud.zip';
+ }
+
set_time_limit($executionTime);
} elseif (\OC\Files\Filesystem::is_dir($dir . '/' . $files)) {
self::validateZipDownload($dir, $files);
diff --git a/lib/files/mount.php b/lib/files/mount.php
index 6e99d8eabb4..1c9382d78e7 100644
--- a/lib/files/mount.php
+++ b/lib/files/mount.php
@@ -176,10 +176,12 @@ class Mount {
}
/**
+ * Find mounts by storage id
+ *
* @param string $id
- * @return \OC\Files\Storage\Storage[]
+ * @return Mount[]
*/
- public static function findById($id) {
+ public static function findByStorageId($id) {
if (strlen($id) > 64) {
$id = md5($id);
}
@@ -191,4 +193,24 @@ class Mount {
}
return $result;
}
+
+ /**
+ * Find mounts by numeric storage id
+ *
+ * @param string $id
+ * @return Mount
+ */
+ public static function findByNumericId($id) {
+ $query = \OC_DB::prepare('SELECT `id` FROM `*PREFIX*storages` WHERE `numeric_id` = ?');
+ $result = $query->execute(array($id))->fetchOne();
+ if ($result) {
+ $id = $result;
+ foreach (self::$mounts as $mount) {
+ if ($mount->getStorageId() === $id) {
+ return $mount;
+ }
+ }
+ }
+ return false;
+ }
}
diff --git a/lib/files/view.php b/lib/files/view.php
index 3e2cb080e1d..4ed3234552e 100644
--- a/lib/files/view.php
+++ b/lib/files/view.php
@@ -960,7 +960,7 @@ class View {
*/
public function getPath($id) {
list($storage, $internalPath) = Cache\Cache::getById($id);
- $mounts = Mount::findById($storage);
+ $mounts = Mount::findByStorageId($storage);
foreach ($mounts as $mount) {
/**
* @var \OC\Files\Mount $mount
diff --git a/lib/group.php b/lib/group.php
index 88f0a2a032c..d1a830730b7 100644
--- a/lib/group.php
+++ b/lib/group.php
@@ -294,7 +294,13 @@ class OC_Group {
public static function displayNamesInGroup($gid, $search = '', $limit = -1, $offset = 0) {
$displayNames=array();
foreach(self::$_usedBackends as $backend) {
- $displayNames = array_merge($backend->displayNamesInGroup($gid, $search, $limit, $offset), $displayNames);
+ if($backend->implementsActions(OC_GROUP_BACKEND_GET_DISPLAYNAME)) {
+ $displayNames = array_merge($backend->displayNamesInGroup($gid, $search, $limit, $offset), $displayNames);
+ } else {
+ $users = $backend->usersInGroup($gid, $search, $limit, $offset);
+ $names = array_combine($users, $users);
+ $displayNames = array_merge($names, $displayNames);
+ }
}
return $displayNames;
}
diff --git a/lib/group/backend.php b/lib/group/backend.php
index 26a784efb28..2e17b5d0b7f 100644
--- a/lib/group/backend.php
+++ b/lib/group/backend.php
@@ -33,6 +33,7 @@ define('OC_GROUP_BACKEND_CREATE_GROUP', 0x00000001);
define('OC_GROUP_BACKEND_DELETE_GROUP', 0x00000010);
define('OC_GROUP_BACKEND_ADD_TO_GROUP', 0x00000100);
define('OC_GROUP_BACKEND_REMOVE_FROM_GOUP', 0x00001000);
+define('OC_GROUP_BACKEND_GET_DISPLAYNAME', 0x00010000);
/**
* Abstract base class for user management
@@ -43,6 +44,7 @@ abstract class OC_Group_Backend implements OC_Group_Interface {
OC_GROUP_BACKEND_DELETE_GROUP => 'deleteGroup',
OC_GROUP_BACKEND_ADD_TO_GROUP => 'addToGroup',
OC_GROUP_BACKEND_REMOVE_FROM_GOUP => 'removeFromGroup',
+ OC_GROUP_BACKEND_GET_DISPLAYNAME => 'displayNamesInGroup',
);
/**
diff --git a/lib/public/share.php b/lib/public/share.php
index 57fcd936ac6..3e5af467d67 100644
--- a/lib/public/share.php
+++ b/lib/public/share.php
@@ -809,7 +809,7 @@ class Share {
} else {
$select = '`*PREFIX*share`.`id`, `item_type`, `item_source`, `item_target`,
`*PREFIX*share`.`parent`, `share_type`, `share_with`, `uid_owner`,
- `file_source`, `path`, `file_target`, `permissions`, `stime`, `expiration`, `token`';
+ `file_source`, `path`, `file_target`, `permissions`, `stime`, `expiration`, `token`, `storage`';
}
} else {
$select = '*';
diff --git a/lib/template.php b/lib/template.php
index 398f9de0655..434c1e9e990 100644
--- a/lib/template.php
+++ b/lib/template.php
@@ -519,12 +519,13 @@ class OC_Template{
/**
* @brief Print a fatal error page and terminates the script
* @param string $error The error message to show
- * @param string $hint An option hint message
+ * @param string $hint An optional hint message
+ * Warning: All data passed to $hint needs to get sanitized using OC_Util::sanitizeHTML
*/
public static function printErrorPage( $error_msg, $hint = '' ) {
$content = new OC_Template( '', 'error', 'error' );
$errors = array(array('error' => $error_msg, 'hint' => $hint));
- $content->assign( 'errors', $errors, false );
+ $content->assign( 'errors', $errors );
$content->printPage();
die();
}
diff --git a/lib/util.php b/lib/util.php
index c7916b9e774..489fd309355 100755
--- a/lib/util.php
+++ b/lib/util.php
@@ -172,7 +172,7 @@ class OC_Util {
if(!(is_callable('sqlite_open') or class_exists('SQLite3'))
and !is_callable('mysql_connect')
and !is_callable('pg_connect')) {
- $errors[]=array('error'=>'No database drivers (sqlite, mysql, or postgresql) installed.<br/>',
+ $errors[]=array('error'=>'No database drivers (sqlite, mysql, or postgresql) installed.',
'hint'=>'');//TODO: sane hint
$web_server_restart= true;
}
@@ -218,74 +218,74 @@ class OC_Util {
}
// check if all required php modules are present
if(!class_exists('ZipArchive')) {
- $errors[]=array('error'=>'PHP module zip not installed.<br/>',
+ $errors[]=array('error'=>'PHP module zip not installed.',
'hint'=>'Please ask your server administrator to install the module.');
$web_server_restart= false;
}
if(!class_exists('DOMDocument')) {
- $errors[] = array('error' => 'PHP module dom not installed.<br/>',
+ $errors[] = array('error' => 'PHP module dom not installed.',
'hint' => 'Please ask your server administrator to install the module.');
$web_server_restart = false;
}
if(!function_exists('xml_parser_create')) {
- $errors[] = array('error' => 'PHP module libxml not installed.<br/>',
+ $errors[] = array('error' => 'PHP module libxml not installed.',
'hint' => 'Please ask your server administrator to install the module.');
$web_server_restart = false;
}
if(!function_exists('mb_detect_encoding')) {
- $errors[]=array('error'=>'PHP module mb multibyte not installed.<br/>',
+ $errors[]=array('error'=>'PHP module mb multibyte not installed.',
'hint'=>'Please ask your server administrator to install the module.');
$web_server_restart= false;
}
if(!function_exists('ctype_digit')) {
- $errors[]=array('error'=>'PHP module ctype is not installed.<br/>',
+ $errors[]=array('error'=>'PHP module ctype is not installed.',
'hint'=>'Please ask your server administrator to install the module.');
$web_server_restart= false;
}
if(!function_exists('json_encode')) {
- $errors[]=array('error'=>'PHP module JSON is not installed.<br/>',
+ $errors[]=array('error'=>'PHP module JSON is not installed.',
'hint'=>'Please ask your server administrator to install the module.');
$web_server_restart= false;
}
if(!function_exists('imagepng')) {
- $errors[]=array('error'=>'PHP module GD is not installed.<br/>',
+ $errors[]=array('error'=>'PHP module GD is not installed.',
'hint'=>'Please ask your server administrator to install the module.');
$web_server_restart= false;
}
if(!function_exists('gzencode')) {
- $errors[]=array('error'=>'PHP module zlib is not installed.<br/>',
+ $errors[]=array('error'=>'PHP module zlib is not installed.',
'hint'=>'Please ask your server administrator to install the module.');
$web_server_restart= false;
}
if(!function_exists('iconv')) {
- $errors[]=array('error'=>'PHP module iconv is not installed.<br/>',
+ $errors[]=array('error'=>'PHP module iconv is not installed.',
'hint'=>'Please ask your server administrator to install the module.');
$web_server_restart= false;
}
if(!function_exists('simplexml_load_string')) {
- $errors[]=array('error'=>'PHP module SimpleXML is not installed.<br/>',
+ $errors[]=array('error'=>'PHP module SimpleXML is not installed.',
'hint'=>'Please ask your server administrator to install the module.');
$web_server_restart= false;
}
if(floatval(phpversion())<5.3) {
- $errors[]=array('error'=>'PHP 5.3 is required.<br/>',
+ $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= false;
}
if(!defined('PDO::ATTR_DRIVER_NAME')) {
- $errors[]=array('error'=>'PHP PDO module is not installed.<br/>',
+ $errors[]=array('error'=>'PHP PDO module is not installed.',
'hint'=>'Please ask your server administrator to install the module.');
$web_server_restart= false;
}
if(ini_get('safe_mode')) {
- $errors[]=array('error'=>'PHP Safe Mode is enabled. ownCloud requires that it is disabled to work properly.<br/>',
+ $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= false;
}
if($web_server_restart) {
- $errors[]=array('error'=>'PHP modules have been installed, but they are still listed as missing?<br/>',
+ $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.');
}