diff -r f166d28a778d -r 133e54e4f21d plugins/AdminAlerts.php --- a/plugins/AdminAlerts.php Sat Nov 29 00:58:09 2008 -0500 +++ b/plugins/AdminAlerts.php Sat Nov 29 01:21:21 2008 -0500 @@ -1,17 +1,19 @@ Unapproved comments:
'; - - // unapproved comments - $q = $db->sql_query('SELECT comment_id, page_id, namespace, user_id, name, comment_data, subject, time FROM '.table_prefix.'comments WHERE approved=0 ORDER BY time ASC;'); - if ( !$q ) - $db->_die(); - - if ( $db->numrows() < 1 ) + if ( $session->user_level >= USER_LEVEL_ADMIN ) { - $content .= 'No unapproved comments.'; - } - else - { - $content .= '
- '; - $class = 'row3'; - while ( $row = $db->fetchrow() ) + + $content .= '

Unapproved comments:
'; + + // unapproved comments + $q = $db->sql_query('SELECT comment_id, page_id, namespace, user_id, name, comment_data, subject, time FROM '.table_prefix.'comments WHERE approved=0 ORDER BY time ASC;'); + if ( !$q ) + $db->_die(); + + if ( $db->numrows() < 1 ) + { + $content .= 'No unapproved comments.'; + } + else { - $class = ( $class == 'row1' ) ? 'row3' : 'row1'; - $preview = substr($row['comment_data'], 0, 100); - $preview = htmlspecialchars($preview); - $subj = substr($row['subject'], 0, 20); - if ( $subj != $row['subject'] ) - $subj .= '...'; - $subj = htmlspecialchars($subj); - if ( $row['user_id'] == 1 ) - { - $name_link = htmlspecialchars($row['name']) . ' [G]'; - } - else + $content .= '

+
'; + $class = 'row3'; + while ( $row = $db->fetchrow() ) { - $memberlist_link = makeUrlNS('Special', 'Memberlist', 'finduser=' . urlencode($row['name']), true); - $name = urlencode($row['name']); - $name_link = "$name"; + $class = ( $class == 'row1' ) ? 'row3' : 'row1'; + $preview = substr($row['comment_data'], 0, 100); + $preview = htmlspecialchars($preview); + $subj = substr($row['subject'], 0, 20); + if ( $subj != $row['subject'] ) + $subj .= '...'; + $subj = htmlspecialchars($subj); + if ( $row['user_id'] == 1 ) + { + $name_link = htmlspecialchars($row['name']) . ' [G]'; + } + else + { + $memberlist_link = makeUrlNS('Special', 'Memberlist', 'finduser=' . urlencode($row['name']), true); + $name = urlencode($row['name']); + $name_link = "$name"; + } + + $page_url = makeUrlNS($row['namespace'], sanitize_page_id($row['page_id'])); + $title = get_page_title_ns($row['page_id'], $row['namespace']); + $page_link = "$title"; + $timestamp = date('n/j H:i', intval($row['time'])); + + $content .= ''; } - - $page_url = makeUrlNS($row['namespace'], sanitize_page_id($row['page_id'])); - $title = get_page_title_ns($row['page_id'], $row['namespace']); - $page_link = "$title"; - $timestamp = date('n/j H:i', intval($row['time'])); - - $content .= ''; + $content .= '
'; + + $content .= '' . $subj . ' by ' . $name_link . '
'; + $content .= "$page_link, $timestamp"; + + $content .= '
'; - - $content .= '' . $subj . ' by ' . $name_link . '
'; - $content .= "$page_link, $timestamp"; - - $content .= '
'; + } + $db->free_result(); + + $content .= '

'; + + // Inactive users + + $content .= '

Inactive user accounts:
'; + + $q = $db->sql_query('SELECT username,reg_time FROM '.table_prefix.'users WHERE account_active=0 AND user_id > 1;'); + if ( !$q ) + $db->_die(); + + if ( $db->numrows() < 1 ) + { + $content .= 'No inactive users.'; + } + else + { + $users = array(); + while ( $row = $db->fetchrow() ) + { + $url = makeUrlNS('Special', 'Administration', 'module=' . $paths->nslist['Admin'] . 'UserManager&src=get&username=' . urlencode($row['username']), true); + $uname= htmlspecialchars($row['username']); + $uname_js = addslashes($row['username']); + $link = "$uname"; + $users[] = $link; + } + $content .= implode(', ', $users); } - $content .= ''; + $db->free_result(); + + $content .= '

'; + + // Pages with deletion requests + + $content .= '

Pages voted for deletion:
'; + + $q = $db->sql_query('SELECT name, urlname, namespace, delvotes FROM '.table_prefix.'pages WHERE delvotes > 0 ORDER BY delvotes DESC;'); + if ( !$q ) + $db->_die(); + + if ( $db->numrows() < 1 ) + { + $content .= 'No pages nominated for deletion.'; + } + else + { + $pages = array(); + while ( $row = $db->fetchrow() ) + { + $url = makeUrlNS($row['namespace'], sanitize_page_id($row['urlname']), false, true); + $name = htmlspecialchars($row['name']); + $link = "$name ({$row['delvotes']})"; + $pages[] = $link; + } + $content .= implode("
\n ", $pages); + } + $db->free_result(); + + $content .= '

'; } - $db->free_result(); - - $content .= '

'; - - // Inactive users - - $content .= '

Inactive user accounts:
'; - - $q = $db->sql_query('SELECT username,reg_time FROM '.table_prefix.'users WHERE account_active=0 AND user_id > 1;'); - if ( !$q ) - $db->_die(); - - if ( $db->numrows() < 1 ) - { - $content .= 'No inactive users.'; - } - else - { - $users = array(); - while ( $row = $db->fetchrow() ) - { - $url = makeUrlNS('Special', 'Administration', 'module=' . $paths->nslist['Admin'] . 'UserManager&src=get&username=' . urlencode($row['username']), true); - $uname= htmlspecialchars($row['username']); - $uname_js = addslashes($row['username']); - $link = "$uname"; - $users[] = $link; - } - $content .= implode(', ', $users); - } - $db->free_result(); - - $content .= '

'; - - // Pages with deletion requests - - $content .= '

Pages voted for deletion:
'; - - $q = $db->sql_query('SELECT name, urlname, namespace, delvotes FROM '.table_prefix.'pages WHERE delvotes > 0 ORDER BY delvotes DESC;'); - if ( !$q ) - $db->_die(); - - if ( $db->numrows() < 1 ) - { - $content .= 'No pages nominated for deletion.'; - } - else - { - $pages = array(); - while ( $row = $db->fetchrow() ) - { - $url = makeUrlNS($row['namespace'], sanitize_page_id($row['urlname']), false, true); - $name = htmlspecialchars($row['name']); - $link = "$name ({$row['delvotes']})"; - $pages[] = $link; - } - $content .= implode("
\n ", $pages); - } - $db->free_result(); - - $content .= '

'; $template->sidebar_widget('Administrator alerts', '
' . $content . '
'); }