aboutsummaryrefslogtreecommitdiffstats
path: root/include/functions_user.inc.php
diff options
context:
space:
mode:
authorrvelices <rv-github@modusoptimus.com>2006-10-19 21:53:18 +0000
committerrvelices <rv-github@modusoptimus.com>2006-10-19 21:53:18 +0000
commitdbadd4defb870c09664ea4178951d72f5d2ada3b (patch)
tree1be0384c8b46d8ae3d62011da08b11700c6c1716 /include/functions_user.inc.php
parent2a8b727d4bc92af070e8f80b1aeb94a659554a68 (diff)
put back the redirect function as it was in branch 1.6 (still not working perfectly with the auto_login)
git-svn-id: http://piwigo.org/svn/trunk@1567 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to 'include/functions_user.inc.php')
-rw-r--r--include/functions_user.inc.php27
1 files changed, 14 insertions, 13 deletions
diff --git a/include/functions_user.inc.php b/include/functions_user.inc.php
index ba085127f..978739ca5 100644
--- a/include/functions_user.inc.php
+++ b/include/functions_user.inc.php
@@ -458,7 +458,7 @@ function create_user_infos($user_id)
{
$status = 'normal';
}
-
+
$insert =
array(
'user_id' => $user_id,
@@ -522,12 +522,13 @@ function get_language_filepath($filename)
{
global $user, $conf;
- $directories =
- array(
- PHPWG_ROOT_PATH.'language/'.$user['language'],
- PHPWG_ROOT_PATH.'language/'.$conf['default_language'],
- PHPWG_ROOT_PATH.'language/'.PHPWG_DEFAULT_LANGUAGE
- );
+ $directories = array();
+ if ( isset($user['language']) )
+ {
+ $directories[] = PHPWG_ROOT_PATH.'language/'.$user['language'];
+ }
+ $directories[] = PHPWG_ROOT_PATH.'language/'.$conf['default_language'];
+ $directories[] = PHPWG_ROOT_PATH.'language/'.PHPWG_DEFAULT_LANGUAGE;
foreach ($directories as $directory)
{
@@ -556,13 +557,13 @@ function log_user($user_id, $remember_me)
{
// search for an existing auto_login_key
$query = '
-SELECT auto_login_key
+SELECT auto_login_key
FROM '.USERS_TABLE.'
WHERE '.$conf['user_fields']['id'].' = '.$user_id.'
;';
-
+
$auto_login_key = current(mysql_fetch_assoc(pwg_query($query)));
- if (empty($auto_login_key))
+ if (empty($auto_login_key))
{
$auto_login_key = base64_encode(md5(uniqid(rand(), true)));
$query = '
@@ -574,7 +575,7 @@ UPDATE '.USERS_TABLE.'
}
$cookie = array('id' => $user_id, 'key' => $auto_login_key);
setcookie($conf['remember_me_name'],
- serialize($cookie),
+ serialize($cookie),
time()+$conf['remember_me_length'],
cookie_path()
);
@@ -590,7 +591,7 @@ UPDATE '.USERS_TABLE.'
* Performs auto-connexion when cookie remember_me exists
* @return void
*/
-function auto_login() {
+function auto_login() {
global $conf;
// must remove slash added in include/common.inc.php
@@ -612,7 +613,7 @@ SELECT auto_login_key
{
setcookie($conf['remember_me_name'], '', 0, cookie_path());
redirect(make_index_url());
- }
+ }
}
/*