changeset 31 | dc8741857bde |
parent 30 | 7e8fd44b36b0 |
child 32 | 4d87aad3c4c0 |
30:7e8fd44b36b0 | 31:dc8741857bde |
---|---|
67 * E-mail address of currently logged-in user, or blank if not logged in |
67 * E-mail address of currently logged-in user, or blank if not logged in |
68 * @var string |
68 * @var string |
69 */ |
69 */ |
70 |
70 |
71 var $email; |
71 var $email; |
72 |
|
73 /** |
|
74 * List of "extra" user information fields (IM handles, etc.) |
|
75 * @var array (associative) |
|
76 */ |
|
77 |
|
78 var $user_extra; |
|
72 |
79 |
73 /** |
80 /** |
74 * User level of current user |
81 * User level of current user |
75 * USER_LEVEL_GUEST: guest |
82 * USER_LEVEL_GUEST: guest |
76 * USER_LEVEL_MEMBER: regular user |
83 * USER_LEVEL_MEMBER: regular user |
940 if( $row['auth_level'] > USER_LEVEL_MEMBER ) |
947 if( $row['auth_level'] > USER_LEVEL_MEMBER ) |
941 { |
948 { |
942 $this->sql('UPDATE '.table_prefix.'session_keys SET time='.time().' WHERE session_key=\''.$keyhash.'\';'); |
949 $this->sql('UPDATE '.table_prefix.'session_keys SET time='.time().' WHERE session_key=\''.$keyhash.'\';'); |
943 } |
950 } |
944 |
951 |
952 $user_extra = array(); |
|
953 foreach ( array('user_aim', 'user_yahoo', 'user_msn', 'user_xmpp', 'user_homepage', 'user_location', 'user_job', 'user_hobbies', 'email_public') as $column ) |
|
954 { |
|
955 $user_extra[$column] = $row[$column]; |
|
956 } |
|
957 |
|
958 $this->user_extra = $user_extra; |
|
959 // Leave the rest to PHP's automatic garbage collector ;-) |
|
960 |
|
945 $row['password'] = md5($real_pass); |
961 $row['password'] = md5($real_pass); |
946 return $row; |
962 return $row; |
947 } |
963 } |
948 |
964 |
949 /** |
965 /** |
1350 // Generate a totally random activation key |
1366 // Generate a totally random activation key |
1351 $actkey = sha1 ( microtime() . mt_rand() ); |
1367 $actkey = sha1 ( microtime() . mt_rand() ); |
1352 |
1368 |
1353 // We good, create the user |
1369 // We good, create the user |
1354 $this->sql('INSERT INTO '.table_prefix.'users ( username, password, email, real_name, theme, style, reg_time, account_active, activation_key, user_level, user_coppa ) VALUES ( \''.$username.'\', \''.$password.'\', \''.$email.'\', \''.$real_name.'\', \''.$template->default_theme.'\', \''.$template->default_style.'\', '.time().', '.$active.', \''.$actkey.'\', '.USER_LEVEL_CHPREF.', ' . $coppa_col . ' );'); |
1370 $this->sql('INSERT INTO '.table_prefix.'users ( username, password, email, real_name, theme, style, reg_time, account_active, activation_key, user_level, user_coppa ) VALUES ( \''.$username.'\', \''.$password.'\', \''.$email.'\', \''.$real_name.'\', \''.$template->default_theme.'\', \''.$template->default_style.'\', '.time().', '.$active.', \''.$actkey.'\', '.USER_LEVEL_CHPREF.', ' . $coppa_col . ' );'); |
1371 |
|
1372 // Get user ID and create users_extra entry |
|
1373 $q = $this->sql('SELECT user_id FROM '.table_prefix."users WHERE username='$username';"); |
|
1374 if ( $db->numrows() > 0 ) |
|
1375 { |
|
1376 $row = $db->fetchrow(); |
|
1377 $db->free_result(); |
|
1378 |
|
1379 $user_id =& $row['user_id']; |
|
1380 $this->sql('INSERT INTO '.table_prefix.'user_extra(user_id) VALUES(' . $user_id . ');'); |
|
1381 } |
|
1355 |
1382 |
1356 // Require the account to be activated? |
1383 // Require the account to be activated? |
1357 if ( $coppa ) |
1384 if ( $coppa ) |
1358 { |
1385 { |
1359 $this->admin_activation_request($username); |
1386 $this->admin_activation_request($username); |