# HG changeset patch
# User Dan
# Date 1227939681 18000
# Node ID 133e54e4f21d42a20d7d1adc564b3462a1952514
# Parent f166d28a778d513662c0b842bb46b11ef2889d97
Updated header block; plugin now generates content only if current user is an admin (doh, save some resources already)
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 .= '
';
+
+ $content .= '' . $subj . ' by ' . $name_link . ' '; + $content .= "$page_link, $timestamp"; + + $content .= ' |
';
-
- $content .= '' . $subj . ' by ' . $name_link . ' '; - $content .= "$page_link, $timestamp"; - - $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 .= '
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 .= '
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 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 .= '