Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorRobin Appelman <icewind1991@gmail.com>2011-06-22 14:50:57 +0400
committerRobin Appelman <icewind1991@gmail.com>2011-06-22 14:50:57 +0400
commit83958ebd4be58c64b23a3e9535f4246faeff8f4a (patch)
tree169321f7bb32e315c6a33ce139b799efdc224da4 /lib
parentc0af177223f5ebd74614b775121ea7f3497d25a5 (diff)
add oc_user::getUser to get the user id of the loggedin user
Diffstat (limited to 'lib')
-rw-r--r--lib/base.php2
-rw-r--r--lib/l10n.php4
-rw-r--r--lib/user.php13
3 files changed, 16 insertions, 3 deletions
diff --git a/lib/base.php b/lib/base.php
index e93c4712727..0453e272a4b 100644
--- a/lib/base.php
+++ b/lib/base.php
@@ -142,7 +142,7 @@ class OC_UTIL {
// If we are not forced to load a specific user we load the one that is logged in
if( $user == "" && OC_USER::isLoggedIn()){
- $user = $_SESSION['user_id'];
+ $user = OC_USER::getUser();
}
if( $user != "" ){ //if we aren't logged in, there is no use to set up the filesystem
diff --git a/lib/l10n.php b/lib/l10n.php
index ff0238241a6..053c6fbc10e 100644
--- a/lib/l10n.php
+++ b/lib/l10n.php
@@ -200,8 +200,8 @@ class OC_L10N{
else{
$available=self::findAvailableLanguages( $app );
}
- if( isset($_SESSION['user_id']) && $_SESSION['user_id'] && OC_PREFERENCES::getValue( $_SESSION['user_id'], 'core', 'lang' )){
- $lang = OC_PREFERENCES::getValue( $_SESSION['user_id'], 'core', 'lang' );
+ if( OC_USER::getUser() && OC_PREFERENCES::getValue( OC_USER::getUser(), 'core', 'lang' )){
+ $lang = OC_PREFERENCES::getValue( OC_USER::getUser(), 'core', 'lang' );
self::$language = $lang;
if( array_search( $lang, $available ) !== false ){
return $lang;
diff --git a/lib/user.php b/lib/user.php
index 2e11a30e85e..7eafef924a8 100644
--- a/lib/user.php
+++ b/lib/user.php
@@ -232,6 +232,19 @@ class OC_USER {
}
/**
+ * @brief get the user idea of the user currently logged in.
+ * @return string uid or false
+ */
+ public static function getUser(){
+ if( isset($_SESSION['user_id']) AND $_SESSION['user_id'] ){
+ return $_SESSION['user_id'];
+ }
+ else{
+ return false;
+ }
+ }
+
+ /**
* @brief Autogenerate a password
* @returns string
*