changeset 328 | dc838fd61a06 |
parent 326 | ab66d6d1f1f4 |
child 329 | 0437a7cf1acc |
327:c2f4c900c507 | 328:dc838fd61a06 |
---|---|
803 |
803 |
804 function _handle_userpage() |
804 function _handle_userpage() |
805 { |
805 { |
806 global $db, $session, $paths, $template, $plugins; // Common objects |
806 global $db, $session, $paths, $template, $plugins; // Common objects |
807 global $email; |
807 global $email; |
808 global $lang; |
|
808 |
809 |
809 $page_urlname = dirtify_page_id($this->page_id); |
810 $page_urlname = dirtify_page_id($this->page_id); |
810 if ( $this->page_id == $paths->page_id && $this->namespace == $paths->namespace ) |
811 if ( $this->page_id == $paths->page_id && $this->namespace == $paths->namespace ) |
811 { |
812 { |
812 $page_name = ( isset($paths->cpage['name']) ) ? $paths->cpage['name'] : $this->page_id; |
813 $page_name = ( isset($paths->cpage['name']) ) ? $paths->cpage['name'] : $this->page_id; |
837 $page_name = $paths->pages[ $paths->nslist[$this->namespace] . $this->page_id ]['name']; |
838 $page_name = $paths->pages[ $paths->nslist[$this->namespace] . $this->page_id ]['name']; |
838 } |
839 } |
839 |
840 |
840 $template->tpl_strings['PAGE_NAME'] = htmlspecialchars($page_name); |
841 $template->tpl_strings['PAGE_NAME'] = htmlspecialchars($page_name); |
841 |
842 |
842 $q = $db->sql_query('SELECT u.username, u.user_id AS authoritative_uid, u.real_name, u.email, u.reg_time, x.*, COUNT(c.comment_id) AS n_comments |
843 $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 |
843 FROM '.table_prefix.'users u |
844 FROM '.table_prefix.'users u |
844 LEFT JOIN '.table_prefix.'users_extra AS x |
845 LEFT JOIN '.table_prefix.'users_extra AS x |
845 ON ( u.user_id = x.user_id OR x.user_id IS NULL ) |
846 ON ( u.user_id = x.user_id OR x.user_id IS NULL ) |
846 LEFT JOIN '.table_prefix.'comments AS c |
847 LEFT JOIN '.table_prefix.'comments AS c |
847 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 ) ) |
848 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 ) ) |
848 WHERE u.username=\'' . $db->escape($target_username) . '\' |
849 WHERE u.username=\'' . $db->escape($target_username) . '\' |
849 GROUP BY u.username, u.user_id, u.real_name, u.email, u.reg_time,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;'); |
850 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;'); |
850 if ( !$q ) |
851 if ( !$q ) |
851 $db->_die(); |
852 $db->_die(); |
852 |
853 |
853 $user_exists = true; |
854 $user_exists = true; |
854 |
855 |
889 // |
890 // |
890 |
891 |
891 // Basic user info |
892 // Basic user info |
892 |
893 |
893 echo '<tr><th class="subhead">All about ' . htmlspecialchars($target_username) . '</th></tr>'; |
894 echo '<tr><th class="subhead">All about ' . htmlspecialchars($target_username) . '</th></tr>'; |
895 if ( $userdata['user_has_avatar'] == '1' ) |
|
896 { |
|
897 echo '<tr><td class="row1" style="text-align: center;"><img alt="' . $lang->get('usercp_avatar_image_alt', array('username' => $userdata['username'])) . '" src="' . make_avatar_url(intval($userdata['authoritative_uid']), $userdata['avatar_type']) . '" /></td></tr>'; |
|
898 } |
|
894 echo '<tr><td class="row3">Joined: ' . date('F d, Y h:i a', $userdata['reg_time']) . '</td></tr>'; |
899 echo '<tr><td class="row3">Joined: ' . date('F d, Y h:i a', $userdata['reg_time']) . '</td></tr>'; |
895 echo '<tr><td class="row1">Total comments: ' . $userdata['n_comments'] . '</td></tr>'; |
900 echo '<tr><td class="row1">Total comments: ' . $userdata['n_comments'] . '</td></tr>'; |
896 |
901 |
897 if ( !empty($userdata['real_name']) ) |
902 if ( !empty($userdata['real_name']) ) |
898 { |
903 { |