1653 $headings = '<tr> |
1653 $headings = '<tr> |
1654 <th style="max-width: 50px;"> |
1654 <th style="max-width: 50px;"> |
1655 <a href="' . makeUrlNS('Special', 'Memberlist', $finduser_url . 'letter=' . $startletter . '&sort=uid&orderby=' . $sortorders['uid'], true) . '">#</a> |
1655 <a href="' . makeUrlNS('Special', 'Memberlist', $finduser_url . 'letter=' . $startletter . '&sort=uid&orderby=' . $sortorders['uid'], true) . '">#</a> |
1656 </th> |
1656 </th> |
1657 <th> |
1657 <th> |
1658 <a href="' . makeUrlNS('Special', 'Memberlist', $finduser_url . 'letter=' . $startletter . '&sort=username&orderby=' . $sortorders['username'], true) . '">Username</a> |
1658 <a href="' . makeUrlNS('Special', 'Memberlist', $finduser_url . 'letter=' . $startletter . '&sort=username&orderby=' . $sortorders['username'], true) . '">' . $lang->get('userfuncs_ml_column_username') . '</a> |
1659 </th> |
1659 </th> |
1660 <th> |
1660 <th> |
1661 Title |
1661 ' . $lang->get('userfuncs_ml_column_userlevel') . ' |
1662 </th> |
1662 </th> |
1663 <th> |
1663 <th> |
1664 <a href="' . makeUrlNS('Special', 'Memberlist', $finduser_url . 'letter=' . $startletter . '&sort=email&orderby=' . $sortorders['email'], true) . '">E-mail</a> |
1664 <a href="' . makeUrlNS('Special', 'Memberlist', $finduser_url . 'letter=' . $startletter . '&sort=email&orderby=' . $sortorders['email'], true) . '">' . $lang->get('userfuncs_ml_column_email') . '</a> |
1665 </th> |
1665 </th> |
1666 <th> |
1666 <th> |
1667 <a href="' . makeUrlNS('Special', 'Memberlist', $finduser_url . 'letter=' . $startletter . '&sort=regist&orderby=' . $sortorders['regist'], true) . '">Registered</a> |
1667 <a href="' . makeUrlNS('Special', 'Memberlist', $finduser_url . 'letter=' . $startletter . '&sort=regist&orderby=' . $sortorders['regist'], true) . '">' . $lang->get('userfuncs_ml_column_regtime') . '</a> |
1668 </th> |
1668 </th> |
1669 </tr>'; |
1669 </tr>'; |
1670 |
1670 |
1671 // determine number of rows |
1671 // determine number of rows |
1672 $q = $db->sql_query('SELECT u.user_id FROM '.table_prefix.'users AS u WHERE ' . $username_where . ' AND u.username != \'Anonymous\';'); |
1672 $q = $db->sql_query('SELECT u.user_id FROM '.table_prefix.'users AS u WHERE ' . $username_where . ' AND u.username != \'Anonymous\';'); |
1676 $num_rows = $db->numrows(); |
1676 $num_rows = $db->numrows(); |
1677 $db->free_result(); |
1677 $db->free_result(); |
1678 |
1678 |
1679 if ( !empty($finduser_url) ) |
1679 if ( !empty($finduser_url) ) |
1680 { |
1680 { |
1681 $s = ( $num_rows == 1 ) ? '' : 'es'; |
1681 switch ( $num_rows ) |
1682 echo "<h3 style='float: left;'>Search returned $num_rows match$s</h3>"; |
1682 { |
|
1683 case 0: |
|
1684 $str = $lang->get('userfuncs_ml_msg_matches_zero'); break; |
|
1685 case 1: |
|
1686 $str = $lang->get('userfuncs_ml_msg_matches_one'); break; |
|
1687 default: |
|
1688 $str = $lang->get('userfuncs_ml_msg_matches', array('matches' => $num_rows)); break; |
|
1689 } |
|
1690 echo "<h3>$str</h3>"; |
1683 } |
1691 } |
1684 |
1692 |
1685 // main selector |
1693 // main selector |
1686 $q = $db->sql_unbuffered_query('SELECT u.user_id, u.username, u.reg_time, u.email, u.user_level, u.reg_time, x.email_public FROM '.table_prefix.'users AS u |
1694 $q = $db->sql_unbuffered_query('SELECT u.user_id, u.username, u.reg_time, u.email, u.user_level, u.reg_time, x.email_public FROM '.table_prefix.'users AS u |
1687 LEFT JOIN '.table_prefix.'users_extra AS x |
1695 LEFT JOIN '.table_prefix.'users_extra AS x |
1716 ' . |
1724 ' . |
1717 '<div style="float: left;"> |
1725 '<div style="float: left;"> |
1718 <form action="' . makeUrlNS('Special', 'Memberlist') . '" method="get" onsubmit="if ( !submitAuthorized ) return false;">' |
1726 <form action="' . makeUrlNS('Special', 'Memberlist') . '" method="get" onsubmit="if ( !submitAuthorized ) return false;">' |
1719 . ( urlSeparator == '&' ? '<input type="hidden" name="title" value="' . htmlspecialchars( $paths->page ) . '" />' : '' ) |
1727 . ( urlSeparator == '&' ? '<input type="hidden" name="title" value="' . htmlspecialchars( $paths->page ) . '" />' : '' ) |
1720 . ( $session->sid_super ? '<input type="hidden" name="auth" value="' . $session->sid_super . '" />' : '') |
1728 . ( $session->sid_super ? '<input type="hidden" name="auth" value="' . $session->sid_super . '" />' : '') |
1721 . '<p>Find a member: ' . $template->username_field('finduser') . ' <input type="submit" value="Go" /><br /><small>You may use the following wildcards: * to match multiple characters, ? to match a single character.</small></p>' |
1729 . '<p>' . $lang->get('userfuncs_ml_lbl_finduser') . ' ' . $template->username_field('finduser') . ' <input type="submit" value="' . $lang->get('userfuncs_ml_btn_go') . '" /><br /> |
|
1730 <small>' . $lang->get('userfuncs_ml_tip_wildcard') . '</small></p>' |
1722 . '</form> |
1731 . '</form> |
1723 </div>' // Footer (printed after rows) |
1732 </div>' // Footer (printed after rows) |
1724 ); |
1733 ); |
1725 |
1734 |
1726 if ( $num_rows < 1 ) |
1735 if ( $num_rows < 1 ) |
1727 { |
1736 { |
1728 echo ( isset($_GET['finduser']) ) ? '<p>Sorry - no users that matched your query could be found. Please try some different search terms.</p>' : '<p>Sorry - no users with usernames that start with that letter could be found.</p>'; |
1737 echo ( isset($_GET['finduser']) ) ? '<p>' . $lang->get('userfuncs_ml_err_nousers_find') . '</p>' : |
|
1738 '<p>' . $lang->get('userfuncs_ml_err_nousers') . '</p>'; |
1729 } |
1739 } |
1730 else |
1740 else |
1731 { |
1741 { |
1732 echo $html; |
1742 echo $html; |
1733 } |
1743 } |
1743 class MemberlistFormatter |
1753 class MemberlistFormatter |
1744 { |
1754 { |
1745 function username($username, $row) |
1755 function username($username, $row) |
1746 { |
1756 { |
1747 global $db, $session, $paths, $template, $plugins; // Common objects |
1757 global $db, $session, $paths, $template, $plugins; // Common objects |
|
1758 global $lang; |
|
1759 |
1748 $userpage = $paths->nslist['User'] . sanitize_page_id($username); |
1760 $userpage = $paths->nslist['User'] . sanitize_page_id($username); |
1749 $class = ( isPage($userpage) ) ? ' title="Click to view this user\'s userpage"' : ' class="wikilink-nonexistent" title="This user hasn\'t created a userpage yet, but you can still view profile details by clicking this link."'; |
1761 $class = ( isPage($userpage) ) ? ' title="' . $lang->get('userfuncs_ml_tip_userpage') . '"' : ' class="wikilink-nonexistent" title="' . $lang->get('userfuncs_ml_tip_nouserpage') . '"'; |
1750 $anchor = '<a href="' . makeUrlNS('User', sanitize_page_id($username)) . '"' . $class . '>' . htmlspecialchars($username) . '</a>'; |
1762 $anchor = '<a href="' . makeUrlNS('User', sanitize_page_id($username)) . '"' . $class . '>' . htmlspecialchars($username) . '</a>'; |
1751 if ( $session->user_level >= USER_LEVEL_ADMIN ) |
1763 if ( $session->user_level >= USER_LEVEL_ADMIN ) |
1752 { |
1764 { |
1753 $anchor .= ' <small>- <a href="' . makeUrlNS('Special', 'Administration', 'module=' . $paths->nslist['Admin'] . 'UserManager&src=get&username=' . urlencode($username), true) . '" |
1765 $anchor .= ' <small>- <a href="' . makeUrlNS('Special', 'Administration', 'module=' . $paths->nslist['Admin'] . 'UserManager&src=get&username=' . urlencode($username), true) . '" |
1754 onclick="ajaxAdminUser(\'' . addslashes(htmlspecialchars($username)) . '\'); return false;">Administer user</a></small>'; |
1766 onclick="ajaxAdminUser(\'' . addslashes(htmlspecialchars($username)) . '\'); return false;">' . $lang->get('userfuncs_ml_btn_adminuser') . '</a></small>'; |
1755 } |
1767 } |
1756 return $anchor; |
1768 return $anchor; |
1757 } |
1769 } |
1758 function user_level($level, $row) |
1770 function user_level($level, $row) |
1759 { |
1771 { |
1760 global $db, $session, $paths, $template, $plugins; // Common objects |
1772 global $db, $session, $paths, $template, $plugins; // Common objects |
|
1773 global $lang; |
1761 switch ( $level ) |
1774 switch ( $level ) |
1762 { |
1775 { |
1763 case USER_LEVEL_GUEST: |
1776 case USER_LEVEL_GUEST: |
1764 $s_level = 'Guest'; break; |
1777 $s_level = $lang->get('userfuncs_ml_level_guest'); break; |
1765 case USER_LEVEL_MEMBER: |
1778 case USER_LEVEL_MEMBER: |
1766 case USER_LEVEL_CHPREF: |
1779 case USER_LEVEL_CHPREF: |
1767 $s_level = 'Member'; break; |
1780 $s_level = $lang->get('userfuncs_ml_level_member'); break; |
1768 case USER_LEVEL_MOD: |
1781 case USER_LEVEL_MOD: |
1769 $s_level = 'Moderator'; break; |
1782 $s_level = $lang->get('userfuncs_ml_level_mod'); break; |
1770 case USER_LEVEL_ADMIN: |
1783 case USER_LEVEL_ADMIN: |
1771 $s_level = 'Site administrator'; break; |
1784 $s_level = $lang->get('userfuncs_ml_level_admin'); break; |
1772 default: |
1785 default: |
1773 $s_level = 'Unknown (level ' . $level . ')'; |
1786 $s_level = $lang->get('userfuncs_ml_level_unknown', array( 'level' => $level )); |
1774 } |
1787 } |
1775 return $s_level; |
1788 return $s_level; |
1776 } |
1789 } |
1777 function email($addy, $row) |
1790 function email($addy, $row) |
1778 { |
1791 { |
|
1792 global $lang; |
1779 if ( $row['email_public'] == '1' ) |
1793 if ( $row['email_public'] == '1' ) |
1780 { |
1794 { |
1781 global $email; |
1795 global $email; |
1782 $addy = $email->encryptEmail($addy); |
1796 $addy = $email->encryptEmail($addy); |
1783 return $addy; |
1797 return $addy; |
1784 } |
1798 } |
1785 else |
1799 else |
1786 { |
1800 { |
1787 return '<small><Non-public></small>'; |
1801 return '<small><' . $lang->get('userfuncs_ml_email_nonpublic') . '></small>'; |
1788 } |
1802 } |
1789 } |
1803 } |
1790 /** |
1804 /** |
1791 * Format a time as a reference to a day, with user-friendly "X days ago"/"Today"/"Yesterday" returned when relevant. |
1805 * Format a time as a reference to a day, with user-friendly "X days ago"/"Today"/"Yesterday" returned when relevant. |
1792 * @param int UNIX timestamp |
1806 * @param int UNIX timestamp |
1793 * @return string |
1807 * @return string |
1794 */ |
1808 */ |
1795 |
1809 |
1796 function format_date($time) |
1810 function format_date($time) |
1797 { |
1811 { |
|
1812 global $lang; |
1798 // Our formattting string to pass to date() |
1813 // Our formattting string to pass to date() |
1799 // This should not include minute/second info, only today's date in whatever format suits your fancy |
1814 // This should not include minute/second info, only today's date in whatever format suits your fancy |
1800 $formatstring = 'F j, Y'; |
1815 $formatstring = 'F j, Y'; |
1801 // Today's date |
1816 // Today's date |
1802 $today = date($formatstring); |
1817 $today = date($formatstring); |