diff -r 000000000000 -r f166d28a778d plugins/AdminAlerts.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/plugins/AdminAlerts.php Sat Nov 29 00:58:09 2008 -0500 @@ -0,0 +1,148 @@ +attachHook('common_post', 'adminalerts_setup();'); + +function adminalerts_setup() +{ + global $db, $session, $paths, $template, $plugins; // Common objects + + // restrict this block to administrators + $content = '{restrict auth_admin}'; + + $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
+ {
+ $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);
+ }
+ $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 .= '