summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorThomas Mueller <thomas.mueller@tmit.eu>2013-02-07 10:44:28 +0100
committerThomas Mueller <thomas.mueller@tmit.eu>2013-02-07 10:44:28 +0100
commit5788d36c8d1e9869d8a645293805e3b0265ea238 (patch)
tree80045c0eb1687652f956b3bdaccb1c765893d2e1 /lib
parent84f3c8b6cc1060203d807ee65545478ce34f93c4 (diff)
parent35bd7a400d30fb27703d4fa02b107f9629845b7d (diff)
downloadnextcloud-server-5788d36c8d1e9869d8a645293805e3b0265ea238.tar.gz
nextcloud-server-5788d36c8d1e9869d8a645293805e3b0265ea238.zip
Merge branch 'master' into fixing-1354-master
Conflicts: settings/admin.php settings/templates/admin.php
Diffstat (limited to 'lib')
-rw-r--r--lib/app.php9
-rw-r--r--lib/base.php8
-rw-r--r--lib/hook.php22
-rw-r--r--lib/l10n/ru.php1
-rw-r--r--lib/public/share.php8
-rw-r--r--lib/public/util.php4
-rw-r--r--lib/user.php20
-rwxr-xr-xlib/util.php10
8 files changed, 68 insertions, 14 deletions
diff --git a/lib/app.php b/lib/app.php
index fa3e14ce4d2..3a4e21e8cd1 100644
--- a/lib/app.php
+++ b/lib/app.php
@@ -36,6 +36,7 @@ class OC_App{
static private $appTypes = array();
static private $loadedApps = array();
static private $checkedApps = array();
+ static private $altLogin = array();
/**
* @brief loads all apps
@@ -568,6 +569,14 @@ class OC_App{
self::$personalForms[]= $app.'/'.$page.'.php';
}
+ public static function registerLogIn($entry) {
+ self::$altLogin[] = $entry;
+ }
+
+ public static function getAlternativeLogIns() {
+ return self::$altLogin;
+ }
+
/**
* @brief: get a list of all apps in the apps folder
* @return array or app names (string IDs)
diff --git a/lib/base.php b/lib/base.php
index e195d305d5c..113cd569b2e 100644
--- a/lib/base.php
+++ b/lib/base.php
@@ -402,9 +402,11 @@ class OC {
self::initPaths();
- register_shutdown_function(array('OC_Log', 'onShutdown'));
- set_error_handler(array('OC_Log', 'onError'));
- set_exception_handler(array('OC_Log', 'onException'));
+ if (!defined('PHPUNIT_RUN')) {
+ register_shutdown_function(array('OC_Log', 'onShutdown'));
+ set_error_handler(array('OC_Log', 'onError'));
+ set_exception_handler(array('OC_Log', 'onException'));
+ }
// set debug mode if an xdebug session is active
if (!defined('DEBUG') || !DEBUG) {
diff --git a/lib/hook.php b/lib/hook.php
index 4da331bb5d8..e30aefb5e18 100644
--- a/lib/hook.php
+++ b/lib/hook.php
@@ -20,19 +20,22 @@ class OC_Hook{
* TODO: write example
*/
static public function connect( $signalclass, $signalname, $slotclass, $slotname ) {
- // Create the data structure
+ // If we're trying to connect to an emitting class that isn't
+ // yet registered, register it
if( !array_key_exists( $signalclass, self::$registered )) {
self::$registered[$signalclass] = array();
}
- if( !array_key_exists( $signalname, self::$registered[$signalclass] )) {
+ // If we're trying to connect to an emitting method that isn't
+ // yet registered, register it with the emitting class
+ if( !array_key_exists( $signalname, self::$registered[$signalclass] )) {
self::$registered[$signalclass][$signalname] = array();
}
-
- // register hook
+
+ // Connect the hook handler to the requested emitter
self::$registered[$signalclass][$signalname][] = array(
"class" => $slotclass,
"name" => $slotname );
-
+
// No chance for failure ;-)
return true;
}
@@ -49,14 +52,19 @@ class OC_Hook{
* TODO: write example
*/
static public function emit( $signalclass, $signalname, $params = array()) {
- // Return false if there are no slots
+
+ // Return false if no hook handlers are listening to this
+ // emitting class
if( !array_key_exists( $signalclass, self::$registered )) {
return false;
}
+
+ // Return false if no hook handlers are listening to this
+ // emitting method
if( !array_key_exists( $signalname, self::$registered[$signalclass] )) {
return false;
}
-
+
// Call all slots
foreach( self::$registered[$signalclass][$signalname] as $i ) {
try {
diff --git a/lib/l10n/ru.php b/lib/l10n/ru.php
index 3ed55f8e9dc..5ef2cca3be3 100644
--- a/lib/l10n/ru.php
+++ b/lib/l10n/ru.php
@@ -9,6 +9,7 @@
"Files need to be downloaded one by one." => "Файлы должны быть загружены по одному.",
"Back to Files" => "Назад к файлам",
"Selected files too large to generate zip file." => "Выбранные файлы слишком велики, чтобы создать zip файл.",
+"couldn't be determined" => "Невозможно установить",
"Application is not enabled" => "Приложение не разрешено",
"Authentication error" => "Ошибка аутентификации",
"Token expired. Please reload page." => "Токен просрочен. Перезагрузите страницу.",
diff --git a/lib/public/share.php b/lib/public/share.php
index 9aacf5e3449..d46bee26dd4 100644
--- a/lib/public/share.php
+++ b/lib/public/share.php
@@ -721,6 +721,7 @@ class Share {
}
$items = array();
$targets = array();
+ $switchedItems = array();
while ($row = $result->fetchRow()) {
// Filter out duplicate group shares for users with unique targets
if ($row['share_type'] == self::$shareTypeGroupUserUnique && isset($items[$row['parent']])) {
@@ -745,6 +746,7 @@ class Share {
// Switch ids if sharing permission is granted on only one share to ensure correct parent is used if resharing
if (~(int)$items[$id]['permissions'] & PERMISSION_SHARE && (int)$row['permissions'] & PERMISSION_SHARE) {
$items[$row['id']] = $items[$id];
+ $switchedItems[$id] = $row['id'];
unset($items[$id]);
$id = $row['id'];
}
@@ -848,7 +850,11 @@ class Share {
}
}
// Remove collection item
- unset($items[$row['id']]);
+ $toRemove = $row['id'];
+ if (array_key_exists($toRemove, $switchedItems)) {
+ $toRemove = $switchedItems[$toRemove];
+ }
+ unset($items[$toRemove]);
}
}
if (!empty($collectionItems)) {
diff --git a/lib/public/util.php b/lib/public/util.php
index a78a52f326e..968ca891b4c 100644
--- a/lib/public/util.php
+++ b/lib/public/util.php
@@ -59,9 +59,9 @@ class Util {
* @param string $fromname
* @param bool $html
*/
- public static function sendMail( $toaddress, $toname, $subject, $mailtext, $fromaddress, $fromname, $html=0, $altbody='', $ccaddress='', $ccname='', $bcc='') {
+ public static function sendMail( $toaddress, $toname, $subject, $mailtext, $fromaddress, $fromname, $html = 0, $altbody = '', $ccaddress = '', $ccname = '', $bcc = '') {
// call the internal mail class
- \OC_MAIL::send($toaddress, $toname, $subject, $mailtext, $fromaddress, $fromname, $html = 0, $altbody = '', $ccaddress = '', $ccname = '', $bcc = '');
+ \OC_MAIL::send($toaddress, $toname, $subject, $mailtext, $fromaddress, $fromname, $html, $altbody, $ccaddress, $ccname, $bcc);
}
/**
diff --git a/lib/user.php b/lib/user.php
index f953d221543..9dc8cca97a6 100644
--- a/lib/user.php
+++ b/lib/user.php
@@ -275,7 +275,7 @@ class OC_User {
foreach(self::$_usedBackends as $backend) {
if($backend->implementsActions(OC_USER_BACKEND_SET_DISPLAYNAME)) {
if($backend->userExists($uid)) {
- $success |= $backend->setDisplayName($uid, $displayName);
+ $result |= $backend->setDisplayName($uid, $displayName);
}
}
}
@@ -436,6 +436,24 @@ class OC_User {
}
return false;
}
+
+ /**
+ * @brief Check whether user can change his display name
+ * @param $uid The username
+ * @returns true/false
+ *
+ * Check whether a specified user can change his display name
+ */
+ public static function canUserChangeDisplayName($uid) {
+ foreach(self::$_usedBackends as $backend) {
+ if($backend->implementsActions(OC_USER_BACKEND_SET_DISPLAYNAME)) {
+ if($backend->userExists($uid)) {
+ return true;
+ }
+ }
+ }
+ return false;
+ }
/**
* @brief Check if the password is correct
diff --git a/lib/util.php b/lib/util.php
index ae0900d7e84..5f796e7565f 100755
--- a/lib/util.php
+++ b/lib/util.php
@@ -300,6 +300,8 @@ class OC_Util {
$redirect_url = OC_Util::sanitizeHTML($_REQUEST['redirect_url']);
$parameters['redirect_url'] = urlencode($redirect_url);
}
+
+ $parameters['alt_login'] = OC_App::getAlternativeLogIns();
OC_Template::printGuestPage("", "login", $parameters);
}
@@ -563,6 +565,14 @@ class OC_Util {
}
/**
+ * Check if the PHP module fileinfo is loaded.
+ * @return bool
+ */
+ public static function fileInfoLoaded() {
+ return function_exists('finfo_open');
+ }
+
+ /**
* Check if the ownCloud server can connect to the internet
*/
public static function isinternetconnectionworking() {