# HG changeset patch
# User Dan
# Date 1183058800 14400
# Node ID dc8741857bdeb86ddc90893c3c9e028dd36a80e7
# Parent 7e8fd44b36b0a3db9f8915743f9bad227bfbbad1
Finished Special:Preferences/Profile page! Only the wikitext parser cleanup left, yay!
diff -r 7e8fd44b36b0 -r dc8741857bde TODO
--- a/TODO Thu Jun 28 13:49:40 2007 -0400
+++ b/TODO Thu Jun 28 15:26:40 2007 -0400
@@ -1,7 +1,7 @@
Enano Banshee - TODO
------------------------------------------
-[ ] COPPA compliance
+[x] COPPA compliance
[x] Add in Moderators group
[x] Create default ACL rule for mods
[x] Fix invalid HTML in SF.net logo
@@ -15,9 +15,10 @@
[x] SQL exporter: fix structure exporting when an auto column is defined
and it's a named key (see pun_search_words)
[x] Possibly add these fields: AIM, Yahoo, MSN, XMPP messenger icons, then homepage, location, occupation, hobbies, allow public e-mail display
- [ ] Put it in a user_extra table and have an option to enable or disable these fields in the admin panel
+ [x] Put it in a user_extra table [XX NO!! and have an option to enable or disable these fields in the admin panel XX]
[Y] Delay until RC3 or Banshee?
[x] When added, put a box on the user page that shows the information
+ [x] Fields on user's preferences page
[x] Fix "this page" bug in ACL editor
[x] The problem itself got fixed BUT there seem to be deeper problems related to scope selection
This needs to be FIXED and WORKING PERFECTLY in Banshee!
@@ -27,8 +28,8 @@
[x] Register users_extra table in system tables list (already done?)
[x] Trigger form submit on press of enter in Dynano login form
[x] Rewrite the change theme dialog - it's archaic code that hasn't changed since beta 1!
- [ ] Come up with some alternative to the "formatting help" link for 1.1
- [ ] By 1.1, all JWS code should be phased out and removed!
+ [] Come up with some alternative to the "formatting help" link (**IN 1.1**)
+ [] By 1.1, all JWS code should be phased out and removed!
[ ] Get the new page ID cleaner code working 100% perfectly - this is the core of Enano and should be completely bug free
diff -r 7e8fd44b36b0 -r dc8741857bde includes/pageprocess.php
--- a/includes/pageprocess.php Thu Jun 28 13:49:40 2007 -0400
+++ b/includes/pageprocess.php Thu Jun 28 15:26:40 2007 -0400
@@ -560,7 +560,7 @@
if ( !empty($userdata['real_name']) )
{
- echo '
Real name: ' . htmlspecialchars($userdata['real_name']) . ' |
';
+ echo 'Real name: ' . $userdata['real_name'] . ' |
';
}
// Comments
diff -r 7e8fd44b36b0 -r dc8741857bde includes/sessions.php
--- a/includes/sessions.php Thu Jun 28 13:49:40 2007 -0400
+++ b/includes/sessions.php Thu Jun 28 15:26:40 2007 -0400
@@ -71,6 +71,13 @@
var $email;
/**
+ * List of "extra" user information fields (IM handles, etc.)
+ * @var array (associative)
+ */
+
+ var $user_extra;
+
+ /**
* User level of current user
* USER_LEVEL_GUEST: guest
* USER_LEVEL_MEMBER: regular user
@@ -942,6 +949,15 @@
$this->sql('UPDATE '.table_prefix.'session_keys SET time='.time().' WHERE session_key=\''.$keyhash.'\';');
}
+ $user_extra = array();
+ foreach ( array('user_aim', 'user_yahoo', 'user_msn', 'user_xmpp', 'user_homepage', 'user_location', 'user_job', 'user_hobbies', 'email_public') as $column )
+ {
+ $user_extra[$column] = $row[$column];
+ }
+
+ $this->user_extra = $user_extra;
+ // Leave the rest to PHP's automatic garbage collector ;-)
+
$row['password'] = md5($real_pass);
return $row;
}
@@ -1353,6 +1369,17 @@
// We good, create the user
$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 . ' );');
+ // Get user ID and create users_extra entry
+ $q = $this->sql('SELECT user_id FROM '.table_prefix."users WHERE username='$username';");
+ if ( $db->numrows() > 0 )
+ {
+ $row = $db->fetchrow();
+ $db->free_result();
+
+ $user_id =& $row['user_id'];
+ $this->sql('INSERT INTO '.table_prefix.'user_extra(user_id) VALUES(' . $user_id . ');');
+ }
+
// Require the account to be activated?
if ( $coppa )
{
diff -r 7e8fd44b36b0 -r dc8741857bde plugins/SpecialUserPrefs.php
--- a/plugins/SpecialUserPrefs.php Thu Jun 28 13:49:40 2007 -0400
+++ b/plugins/SpecialUserPrefs.php Thu Jun 28 15:26:40 2007 -0400
@@ -403,10 +403,72 @@
{
$real_name = htmlspecialchars($_POST['real_name']);
$real_name = $db->escape($real_name);
+
+ $imaddr_aim = htmlspecialchars($_POST['imaddr_aim']);
+ $imaddr_aim = $db->escape($imaddr_aim);
+
+ $imaddr_msn = htmlspecialchars($_POST['imaddr_msn']);
+ $imaddr_msn = $db->escape($imaddr_msn);
+
+ $imaddr_yahoo = htmlspecialchars($_POST['imaddr_yahoo']);
+ $imaddr_yahoo = $db->escape($imaddr_yahoo);
+
+ $imaddr_xmpp = htmlspecialchars($_POST['imaddr_xmpp']);
+ $imaddr_xmpp = $db->escape($imaddr_xmpp);
+
+ $homepage = htmlspecialchars($_POST['homepage']);
+ $homepage = $db->escape($homepage);
+
+ $location = htmlspecialchars($_POST['location']);
+ $location = $db->escape($location);
+
+ $occupation = htmlspecialchars($_POST['occupation']);
+ $occupation = $db->escape($occupation);
+
+ $hobbies = htmlspecialchars($_POST['hobbies']);
+ $hobbies = $db->escape($hobbies);
+
+ $email_public = ( isset($_POST['email_public']) ) ? '1' : '0';
+
+ $session->real_name = $real_name;
+
+ if ( !preg_match('/@([a-z0-9-]+)(\.([a-z0-9-\.]+))?/', $imaddr_msn) )
+ {
+ $imaddr_msn = "$imaddr_msn@hotmail.com";
+ }
+
+ if ( substr($homepage, 0, 7) != 'http://' )
+ {
+ $homepage = "http://$homepage";
+ }
+
+ if ( !preg_match('/^http:\/\/([a-z0-9-.]+)([A-z0-9@#\$%\&:;<>,\.\?=\+\(\)\[\]_\/\\\\]*?)$/i', $homepage) )
+ {
+ $homepage = '';
+ }
+
+ $session->user_extra['user_aim'] = $imaddr_aim;
+ $session->user_extra['user_msn'] = $imaddr_msn;
+ $session->user_extra['user_xmpp'] = $imaddr_xmpp;
+ $session->user_extra['user_yahoo'] = $imaddr_yahoo;
+ $session->user_extra['user_homepage'] = $homepage;
+ $session->user_extra['user_location'] = $location;
+ $session->user_extra['user_job'] = $occupation;
+ $session->user_extra['user_hobbies'] = $hobbies;
+ $session->user_extra['email_public'] = intval($email_public);
+
$q = $db->sql_query('UPDATE '.table_prefix."users SET real_name='$real_name' WHERE user_id=$session->user_id;");
if ( !$q )
$db->_die();
+ $q = $db->sql_query('UPDATE '.table_prefix."users_extra SET user_aim='$imaddr_aim',user_yahoo='$imaddr_yahoo',user_msn='$imaddr_msn',
+ user_xmpp='$imaddr_xmpp',user_homepage='$homepage',user_location='$location',user_job='$occupation',
+ user_hobbies='$hobbies',email_public=$email_public
+ WHERE user_id=$session->user_id;");
+
+ if ( !$q )
+ $db->_die();
+
echo 'Your profile has been updated.
';
}
echo '