26 |
26 |
27 // $plugins->attachHook('session_started', 'SpecialUserFuncs_paths_init();'); |
27 // $plugins->attachHook('session_started', 'SpecialUserFuncs_paths_init();'); |
28 |
28 |
29 function SpecialUserFuncs_paths_init() |
29 function SpecialUserFuncs_paths_init() |
30 { |
30 { |
31 global $paths; |
31 register_special_page('Login', 'specialpage_log_in'); |
32 $paths->add_page(Array( |
32 register_special_page('Logout', 'specialpage_log_out'); |
33 'name'=>'specialpage_log_in', |
33 register_special_page('Register', 'specialpage_register'); |
34 'urlname'=>'Login', |
34 register_special_page('Preferences', 'specialpage_preferences'); |
35 'namespace'=>'Special', |
35 register_special_page('Contributions', 'specialpage_contributions'); |
36 'special'=>0,'visible'=>1,'comments_on'=>0,'protected'=>1,'delvotes'=>0,'delvote_ips'=>'', |
36 register_special_page('ChangeStyle', 'specialpage_change_theme'); |
37 )); |
37 register_special_page('ActivateAccount', 'specialpage_activate_account'); |
38 $paths->add_page(Array( |
38 register_special_page('Captcha', 'specialpage_captcha'); |
39 'name'=>'specialpage_log_out', |
39 register_special_page('PasswordReset', 'specialpage_password_reset'); |
40 'urlname'=>'Logout', |
40 register_special_page('Memberlist', 'specialpage_member_list'); |
41 'namespace'=>'Special', |
41 register_special_page('LangExportJSON', 'specialpage_language_export', false); |
42 'special'=>0,'visible'=>1,'comments_on'=>0,'protected'=>1,'delvotes'=>0,'delvote_ips'=>'', |
42 register_special_page('Avatar', 'specialpage_avatar', false); |
43 )); |
|
44 $paths->add_page(Array( |
|
45 'name'=>'specialpage_register', |
|
46 'urlname'=>'Register', |
|
47 'namespace'=>'Special', |
|
48 'special'=>0,'visible'=>1,'comments_on'=>0,'protected'=>1,'delvotes'=>0,'delvote_ips'=>'', |
|
49 )); |
|
50 $paths->add_page(Array( |
|
51 'name'=>'specialpage_preferences', |
|
52 'urlname'=>'Preferences', |
|
53 'namespace'=>'Special', |
|
54 'special'=>0,'visible'=>1,'comments_on'=>0,'protected'=>1,'delvotes'=>0,'delvote_ips'=>'', |
|
55 )); |
|
56 |
|
57 $paths->add_page(Array( |
|
58 'name'=>'specialpage_contributions', |
|
59 'urlname'=>'Contributions', |
|
60 'namespace'=>'Special', |
|
61 'special'=>0,'visible'=>1,'comments_on'=>0,'protected'=>1,'delvotes'=>0,'delvote_ips'=>'', |
|
62 )); |
|
63 |
|
64 $paths->add_page(Array( |
|
65 'name'=>'specialpage_change_theme', |
|
66 'urlname'=>'ChangeStyle', |
|
67 'namespace'=>'Special', |
|
68 'special'=>0,'visible'=>1,'comments_on'=>0,'protected'=>1,'delvotes'=>0,'delvote_ips'=>'', |
|
69 )); |
|
70 |
|
71 $paths->add_page(Array( |
|
72 'name'=>'specialpage_activate_account', |
|
73 'urlname'=>'ActivateAccount', |
|
74 'namespace'=>'Special', |
|
75 'special'=>0,'visible'=>1,'comments_on'=>0,'protected'=>1,'delvotes'=>0,'delvote_ips'=>'', |
|
76 )); |
|
77 |
|
78 $paths->add_page(Array( |
|
79 'name'=>'specialpage_captcha', |
|
80 'urlname'=>'Captcha', |
|
81 'namespace'=>'Special', |
|
82 'special'=>0,'visible'=>1,'comments_on'=>0,'protected'=>1,'delvotes'=>0,'delvote_ips'=>'', |
|
83 )); |
|
84 |
|
85 $paths->add_page(Array( |
|
86 'name'=>'specialpage_password_reset', |
|
87 'urlname'=>'PasswordReset', |
|
88 'namespace'=>'Special', |
|
89 'special'=>0,'visible'=>1,'comments_on'=>0,'protected'=>1,'delvotes'=>0,'delvote_ips'=>'', |
|
90 )); |
|
91 |
|
92 $paths->add_page(Array( |
|
93 'name'=>'specialpage_member_list', |
|
94 'urlname'=>'Memberlist', |
|
95 'namespace'=>'Special', |
|
96 'special'=>0,'visible'=>1,'comments_on'=>0,'protected'=>1,'delvotes'=>0,'delvote_ips'=>'', |
|
97 )); |
|
98 |
|
99 $paths->add_page(Array( |
|
100 'name'=>'specialpage_language_export', |
|
101 'urlname'=>'LangExportJSON', |
|
102 'namespace'=>'Special', |
|
103 'special'=>0,'visible'=>0,'comments_on'=>0,'protected'=>1,'delvotes'=>0,'delvote_ips'=>'', |
|
104 )); |
|
105 |
|
106 $paths->add_page(Array( |
|
107 'name'=>'specialpage_avatar', |
|
108 'urlname'=>'Avatar', |
|
109 'namespace'=>'Special', |
|
110 'special'=>0,'visible'=>0,'comments_on'=>0,'protected'=>1,'delvotes'=>0,'delvote_ips'=>'', |
|
111 )); |
|
112 } |
43 } |
113 |
44 |
114 // function names are IMPORTANT!!! The name pattern is: page_<namespace ID>_<page URLname, without namespace> |
45 // function names are IMPORTANT!!! The name pattern is: page_<namespace ID>_<page URLname, without namespace> |
115 |
46 |
116 $__login_status = ''; |
47 $__login_status = ''; |
1717 <a href="' . makeUrlNS('Special', 'Memberlist', $finduser_url . 'letter=' . $startletter . '&sort=regist&orderby=' . $sortorders['regist'], true) . '">' . $lang->get('userfuncs_ml_column_regtime') . '</a> |
1650 <a href="' . makeUrlNS('Special', 'Memberlist', $finduser_url . 'letter=' . $startletter . '&sort=regist&orderby=' . $sortorders['regist'], true) . '">' . $lang->get('userfuncs_ml_column_regtime') . '</a> |
1718 </th> |
1651 </th> |
1719 </tr>'; |
1652 </tr>'; |
1720 |
1653 |
1721 // determine number of rows |
1654 // determine number of rows |
1722 $q = $db->sql_query('SELECT u.user_id FROM '.table_prefix.'users AS u WHERE ' . $username_where . ' AND u.username != \'Anonymous\';'); |
1655 $q = $db->sql_query('SELECT COUNT(u.user_id) FROM '.table_prefix.'users AS u WHERE ' . $username_where . ' AND u.username != \'Anonymous\';'); |
1723 if ( !$q ) |
1656 if ( !$q ) |
1724 $db->_die(); |
1657 $db->_die(); |
1725 |
1658 |
1726 $num_rows = $db->numrows(); |
1659 list($num_rows) = $db->fetchrow_num(); |
1727 $db->free_result(); |
1660 $db->free_result(); |
1728 |
1661 |
1729 if ( !empty($finduser_url) ) |
1662 if ( !empty($finduser_url) ) |
1730 { |
1663 { |
1731 switch ( $num_rows ) |
1664 switch ( $num_rows ) |
1732 { |
1665 { |
1733 case 0: |
1666 case 0: |
1734 $str = $lang->get('userfuncs_ml_msg_matches_zero'); break; |
1667 $str = ''; /* $lang->get('userfuncs_ml_msg_matches_zero'); */ break; |
1735 case 1: |
1668 case 1: |
1736 $str = $lang->get('userfuncs_ml_msg_matches_one'); break; |
1669 $str = $lang->get('userfuncs_ml_msg_matches_one'); break; |
1737 default: |
1670 default: |
1738 $str = $lang->get('userfuncs_ml_msg_matches', array('matches' => $num_rows)); break; |
1671 $str = $lang->get('userfuncs_ml_msg_matches', array('matches' => $num_rows)); break; |
1739 } |
1672 } |
1740 echo "<h3>$str</h3>"; |
1673 echo "<h3>$str</h3>"; |
1741 } |
1674 } |
1742 |
1675 |
1743 // main selector |
1676 // main selector |
1744 $pgsql_additional_group_by = ( ENANO_DBLAYER == 'PGSQL' ) ? ', u.username, u.reg_time, u.email, u.user_level, u.user_has_avatar, u.avatar_type, x.email_public' : ''; |
1677 $pgsql_additional_group_by = ( ENANO_DBLAYER == 'PGSQL' ) ? ', u.username, u.reg_time, u.email, u.user_level, u.user_has_avatar, u.avatar_type, x.email_public' : ''; |
1745 $q = $db->sql_unbuffered_query('SELECT \'\' AS infobit, u.user_id, u.username, u.reg_time, u.email, u.user_level, u.user_has_avatar, u.avatar_type, x.email_public, COUNT(c.comment_id) AS num_comments FROM '.table_prefix.'users AS u |
1678 $q = $db->sql_query('SELECT \'\' AS infobit, u.user_id, u.username, u.reg_time, u.email, u.user_level, u.user_has_avatar, u.avatar_type, x.email_public, COUNT(c.comment_id) AS num_comments FROM '.table_prefix.'users AS u |
1746 LEFT JOIN '.table_prefix.'users_extra AS x |
1679 LEFT JOIN '.table_prefix.'users_extra AS x |
1747 ON ( u.user_id = x.user_id ) |
1680 ON ( u.user_id = x.user_id ) |
1748 LEFT JOIN ' . table_prefix . 'comments AS c |
1681 LEFT JOIN ' . table_prefix . 'comments AS c |
1749 ON ( u.user_id = c.user_id ) |
1682 ON ( u.user_id = c.user_id ) |
1750 WHERE ' . $username_where . ' AND u.username != \'Anonymous\' |
1683 WHERE ' . $username_where . ' AND u.username != \'Anonymous\' |
1751 GROUP BY u.user_id' . $pgsql_additional_group_by . ' |
1684 GROUP BY u.user_id' . $pgsql_additional_group_by . ' |
1752 ORDER BY ' . $sort_sqllet . ' ' . $target_order . ';'); |
1685 ORDER BY ' . $sort_sqllet . ' ' . $target_order . ' |
|
1686 LIMIT ' . $perpage . ' OFFSET ' . $offset . ';'); |
1753 if ( !$q ) |
1687 if ( !$q ) |
1754 $db->_die(); |
1688 $db->_die(); |
1755 |
1689 |
1756 // formatter parameters |
1690 // formatter parameters |
1757 $formatter = new MemberlistFormatter(); |
1691 $formatter = new MemberlistFormatter(); |
1761 'email' => array($formatter, 'email'), |
1695 'email' => array($formatter, 'email'), |
1762 'reg_time' => array($formatter, 'reg_time'), |
1696 'reg_time' => array($formatter, 'reg_time'), |
1763 'infobit' => array($formatter, 'infobit') |
1697 'infobit' => array($formatter, 'infobit') |
1764 ); |
1698 ); |
1765 |
1699 |
1766 $html = paginate( |
1700 $result_url = makeUrlNS('Special', 'Memberlist', ( str_replace('%', '%%', $finduser_url) ) . 'letter=' . $startletter . '&offset=%s&sort=' . $sortby . '&orderby=' . $target_order ); |
1767 $q, // MySQL result resource |
1701 $paginator = generate_paginator($page, ceil($num_rows / $perpage), $result_url); |
1768 '<tr> |
1702 |
1769 <td class="{_css_class}">{user_id}</td> |
1703 if ( $num_rows > 0 ) |
1770 <td class="{_css_class}" style="text-align: left;">{username}</td> |
1704 { |
1771 <td class="{_css_class}">{user_level}</td> |
1705 if ( $num_rows > $perpage ) |
1772 <td class="{_css_class}">{email}</small></td> |
1706 echo $paginator; |
1773 <td class="{_css_class}">{reg_time}</td> |
1707 |
1774 </tr> |
1708 echo '<div class="tblholder"> |
1775 <tr> |
1709 <table border="0" cellspacing="1" cellpadding="4" style="text-align: center;"> |
1776 <td colspan="5" class="row3" style="text-align: left;"> |
1710 ' . $headings; |
1777 <div id="ml_moreinfo_{user_id}" style="display: none;"> |
1711 |
1778 {infobit} |
1712 $i = 0; |
|
1713 while ( $row = $db->fetchrow($q) ) |
|
1714 { |
|
1715 $i++; |
|
1716 $cls = ( $i % 2 == 0 ) ? 'row2' : 'row1'; |
|
1717 echo '<tr>'; |
|
1718 echo '<td class="' . $cls . '">' . $row['user_id'] . '</td>'; |
|
1719 echo '<td class="' . $cls . '" style="text-align: left;">' . $formatter->username($row['username'], $row) . '</td>'; |
|
1720 echo '<td class="' . $cls . '">' . $formatter->user_level($row['user_level'], $row) . '</td>'; |
|
1721 echo '<td class="' . $cls . '">' . $formatter->email($row['email'], $row) . '</td>'; |
|
1722 echo '<td class="' . $cls . '">' . $formatter->reg_time($row['reg_time'], $row) . '</td>'; |
|
1723 echo '</tr>'; |
|
1724 echo '<tr>'; |
|
1725 echo '<td colspan="5" class="row3" style="text-align: left;"> |
|
1726 <div id="ml_moreinfo_' . $row['user_id'] . '" style="display: none;"> |
|
1727 ' . $formatter->infobit(true, $row) . ' |
1779 </div> |
1728 </div> |
1780 </td> |
1729 </td>'; |
1781 </tr> |
1730 echo '</tr>'; |
1782 ', // TPL code for rows |
1731 } |
1783 $num_rows, // Number of results |
1732 |
1784 makeUrlNS('Special', 'Memberlist', ( str_replace('%', '%%', $finduser_url) ) . 'letter=' . $startletter . '&offset=%s&sort=' . $sortby . '&orderby=' . $target_order ), // Result URL |
1733 echo ' ' . $headings . ' |
1785 $offset, // Start at this number |
|
1786 25, // Results per page |
|
1787 $formatters, // Formatting hooks |
|
1788 '<div class="tblholder"> |
|
1789 <table border="0" cellspacing="1" cellpadding="4" style="text-align: center;"> |
|
1790 ' . $headings . ' |
|
1791 ', // Header (printed before rows) |
|
1792 ' ' . $headings . ' |
|
1793 </table> |
1734 </table> |
1794 </div> |
1735 </div> |
1795 ' . |
1736 '; |
1796 '<div style="float: left;"> |
1737 |
1797 <form action="' . makeUrlNS('Special', 'Memberlist') . '" method="get" onsubmit="if ( !submitAuthorized ) return false;">' |
1738 if ( $num_rows > $perpage ) |
1798 . ( urlSeparator == '&' ? '<input type="hidden" name="title" value="' . htmlspecialchars( $paths->page ) . '" />' : '' ) |
1739 echo $paginator; |
1799 . ( $session->sid_super ? '<input type="hidden" name="auth" value="' . $session->sid_super . '" />' : '') |
|
1800 . '<p>' . $lang->get('userfuncs_ml_lbl_finduser') . ' ' . $template->username_field('finduser') . ' <input type="submit" value="' . $lang->get('userfuncs_ml_btn_go') . '" /><br /> |
|
1801 <small>' . $lang->get('userfuncs_ml_tip_wildcard') . '</small></p>' |
|
1802 . '</form> |
|
1803 </div>' // Footer (printed after rows) |
|
1804 ); |
|
1805 |
|
1806 if ( $num_rows < 1 ) |
|
1807 { |
|
1808 echo ( isset($_GET['finduser']) ) ? '<p>' . $lang->get('userfuncs_ml_err_nousers_find') . '</p>' : |
|
1809 '<p>' . $lang->get('userfuncs_ml_err_nousers') . '</p>'; |
|
1810 } |
1740 } |
1811 else |
1741 else |
1812 { |
1742 { |
1813 echo $html; |
1743 echo '<h2 class="emptymessage">' . $lang->get('log_msg_no_results') . '</h2>'; |
1814 } |
1744 } |
|
1745 |
|
1746 echo '<div style="float: left;"> |
|
1747 <form action="' . makeUrlNS('Special', 'Memberlist') . '" method="get" onsubmit="if ( !submitAuthorized ) return false;">' |
|
1748 . ( urlSeparator == '&' ? '<input type="hidden" name="title" value="' . htmlspecialchars( $paths->page ) . '" />' : '' ) |
|
1749 . ( $session->sid_super ? '<input type="hidden" name="auth" value="' . $session->sid_super . '" />' : '') |
|
1750 . '<p>' . $lang->get('userfuncs_ml_lbl_finduser') . ' ' . $template->username_field('finduser') . ' <input type="submit" value="' . $lang->get('userfuncs_ml_btn_go') . '" /><br /> |
|
1751 <small>' . $lang->get('userfuncs_ml_tip_wildcard') . '</small></p>' |
|
1752 . '</form> |
|
1753 </div>'; |
1815 |
1754 |
1816 $template->footer(); |
1755 $template->footer(); |
1817 } |
1756 } |
1818 |
1757 |
1819 /** |
1758 /** |