aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorrvelices <rv-github@modusoptimus.com>2006-03-07 01:20:02 +0000
committerrvelices <rv-github@modusoptimus.com>2006-03-07 01:20:02 +0000
commit1e7c9034ded97b32a7d79a1ba05b384028ec5081 (patch)
tree1cc9280dc37f96a460e58b03cdb1f67db07bf06a /include
parentaeea83658b248e603a7ffdbebcd14e6665948ee5 (diff)
bug fix: call to undefined session_create in register.php (added function
log_user called from identification and register) bug fix: empty line at the beginning of functions.php disallowed cookies (and hence logging in) git-svn-id: http://piwigo.org/svn/trunk@1068 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to 'include')
-rw-r--r--include/functions_user.inc.php52
1 files changed, 36 insertions, 16 deletions
diff --git a/include/functions_user.inc.php b/include/functions_user.inc.php
index ec4480bfd..af695718a 100644
--- a/include/functions_user.inc.php
+++ b/include/functions_user.inc.php
@@ -82,7 +82,7 @@ SELECT MAX('.$conf['user_fields']['id'].') + 1
FROM '.USERS_TABLE.'
;';
list($next_id) = mysql_fetch_array(pwg_query($query));
-
+
$insert =
array(
$conf['user_fields']['id'] => $next_id,
@@ -93,7 +93,7 @@ SELECT MAX('.$conf['user_fields']['id'].') + 1
include_once(PHPWG_ROOT_PATH.'admin/include/functions.php');
mass_inserts(USERS_TABLE, array_keys($insert), array($insert));
-
+
create_user_infos($next_id);
}
@@ -117,7 +117,7 @@ function getuserdata($user_id, $use_cache)
global $conf;
$userdata = array();
-
+
$query = '
SELECT ';
$is_first = true;
@@ -138,7 +138,7 @@ SELECT ';
FROM '.USERS_TABLE.'
WHERE '.$conf['user_fields']['id'].' = \''.$user_id.'\'
;';
-
+
$row = mysql_fetch_array(pwg_query($query));
while (true)
@@ -159,9 +159,9 @@ SELECT ui.*, uc.*
create_user_infos($user_id);
}
}
-
+
$row = array_merge($row, mysql_fetch_array($result));
-
+
foreach ($row as $key => $value)
{
if (!is_numeric($key))
@@ -194,7 +194,7 @@ DELETE FROM '.USER_CACHE_TABLE.'
WHERE user_id = '.$userdata['id'].'
;';
pwg_query($query);
-
+
$query = '
INSERT INTO '.USER_CACHE_TABLE.'
(user_id,need_update,forbidden_categories)
@@ -307,7 +307,7 @@ SELECT id
$private_array = array_unique($private_array);
}
-
+
// retrieve category ids directly authorized to the user
$query = '
SELECT cat_id
@@ -340,7 +340,7 @@ SELECT cat_id
// where clauses such as "WHERE category_id NOT IN(-1)" will always be
// true.
array_push($forbidden_array, '-1');
-
+
return implode(',', $forbidden_array);
}
@@ -353,7 +353,7 @@ SELECT cat_id
function get_username($user_id)
{
global $conf;
-
+
$query = '
SELECT '.$conf['user_fields']['username'].'
FROM '.USERS_TABLE.'
@@ -368,7 +368,7 @@ SELECT '.$conf['user_fields']['username'].'
{
return false;
}
-
+
return $username;
}
@@ -433,7 +433,7 @@ SELECT COUNT(*)
function create_user_infos($user_id)
{
global $conf;
-
+
list($dbnow) = mysql_fetch_row(pwg_query('SELECT NOW();'));
$insert =
@@ -479,7 +479,7 @@ SELECT name
{
return false;
}
-
+
return $groupname;
}
@@ -496,7 +496,7 @@ SELECT name
function get_language_filepath($filename)
{
global $user, $conf;
-
+
$directories =
array(
PHPWG_ROOT_PATH.'language/'.$user['language'],
@@ -507,13 +507,33 @@ function get_language_filepath($filename)
foreach ($directories as $directory)
{
$filepath = $directory.'/'.$filename;
-
+
if (file_exists($filepath))
{
return $filepath;
}
}
-
+
return false;
}
+
+/*
+ * Performs all required actions for user login
+ * @param int user_id
+ * @param bool remember_me
+ * @return void
+*/
+function log_user($user_id, $remember_me)
+{
+ global $conf;
+ $session_length = $conf['session_length'];
+ if ($remember_me)
+ {
+ $session_length = $conf['remember_me_length'];
+ }
+ session_set_cookie_params($session_length);
+ session_start();
+ $_SESSION['id'] = $user_id;
+}
+
?> \ No newline at end of file