includes/namespaces/user.php
changeset 1147 7ddd475bc661
parent 1108 c1be67a50d81
child 1227 bdac73ed481e
equal deleted inserted replaced
1146:4a90e6e46937 1147:7ddd475bc661
    80         ));
    80         ));
    81     
    81     
    82     $target_username = preg_replace('/^' . str_replace('/', '\\/', preg_quote($paths->nslist['User'])) . '/', '', $target_username);
    82     $target_username = preg_replace('/^' . str_replace('/', '\\/', preg_quote($paths->nslist['User'])) . '/', '', $target_username);
    83     list($target_username) = explode('/', $target_username);
    83     list($target_username) = explode('/', $target_username);
    84     
    84     
       
    85     $ux_columns = $db->columns_in(table_prefix . 'users_extra');
       
    86     
    85     $output->set_title($this->title);
    87     $output->set_title($this->title);
    86     $q = $db->sql_query('SELECT u.username, u.user_id AS authoritative_uid, u.real_name, u.email, u.reg_time, u.user_has_avatar, u.avatar_type, x.*, COUNT(c.comment_id) AS n_comments
    88     $q = $db->sql_query('SELECT u.username, u.user_id AS authoritative_uid, u.real_name, u.email, u.reg_time, u.user_has_avatar, u.avatar_type, x.*, COUNT(c.comment_id) AS n_comments
    87                            FROM '.table_prefix.'users u
    89                            FROM '.table_prefix.'users u
    88                            LEFT JOIN '.table_prefix.'users_extra AS x
    90                            LEFT JOIN '.table_prefix.'users_extra AS x
    89                              ON ( u.user_id = x.user_id OR x.user_id IS NULL ) 
    91                              ON ( u.user_id = x.user_id OR x.user_id IS NULL ) 
    90                            LEFT JOIN '.table_prefix.'comments AS c
    92                            LEFT JOIN '.table_prefix.'comments AS c
    91                              ON ( ( c.user_id=u.user_id AND c.name=u.username AND c.approved=1 ) OR ( c.comment_id IS NULL AND c.approved IS NULL ) )
    93                              ON ( ( c.user_id=u.user_id AND c.name=u.username AND c.approved=1 ) OR ( c.comment_id IS NULL AND c.approved IS NULL ) )
    92                            WHERE u.username=\'' . $db->escape($target_username) . '\'
    94                            WHERE u.username=\'' . $db->escape($target_username) . '\'
    93                            GROUP BY u.username, u.user_id, u.real_name, u.email, u.reg_time, u.user_has_avatar, u.avatar_type, x.user_id, x.user_aim, x.user_yahoo, x.user_msn, x.user_xmpp, x.user_homepage, x.user_location, x.user_job, x.user_hobbies, x.email_public;');
    95                            GROUP BY u.username, u.user_id, u.real_name, u.email, u.reg_time, u.user_has_avatar, u.avatar_type, x.' . implode(', x.', $ux_columns) . ';');
    94     if ( !$q )
    96     if ( !$q )
    95       $db->_die();
    97       $db->_die();
    96     
    98     
    97     $user_exists = true;
    99     $user_exists = true;
    98     
   100