plugins/AdminAlerts.php
author Dan
Sat, 29 Nov 2008 01:21:21 -0500
changeset 1 133e54e4f21d
parent 0 f166d28a778d
child 2 a63e0337a68e
permissions -rwxr-xr-x
Updated header block; plugin now generates content only if current user is an admin (doh, save some resources already)
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
0
f166d28a778d Initial revision.
Dan
parents:
diff changeset
     1
<?php
1
133e54e4f21d Updated header block; plugin now generates content only if current user is an admin (doh, save some resources already)
Dan
parents: 0
diff changeset
     2
/**!info**
133e54e4f21d Updated header block; plugin now generates content only if current user is an admin (doh, save some resources already)
Dan
parents: 0
diff changeset
     3
{
133e54e4f21d Updated header block; plugin now generates content only if current user is an admin (doh, save some resources already)
Dan
parents: 0
diff changeset
     4
  "Plugin Name"  : "Administrators' Alerts",
133e54e4f21d Updated header block; plugin now generates content only if current user is an admin (doh, save some resources already)
Dan
parents: 0
diff changeset
     5
  "Plugin URI"   : "http://enanocms.org/plugin/admin-alerts",
133e54e4f21d Updated header block; plugin now generates content only if current user is an admin (doh, save some resources already)
Dan
parents: 0
diff changeset
     6
  "Description"  : "Provides a sidebar block with information on unapproved comments, inactive users, and pages with deletion votes",
133e54e4f21d Updated header block; plugin now generates content only if current user is an admin (doh, save some resources already)
Dan
parents: 0
diff changeset
     7
  "Author"       : "Dan Fuhry",
133e54e4f21d Updated header block; plugin now generates content only if current user is an admin (doh, save some resources already)
Dan
parents: 0
diff changeset
     8
  "Version"      : "0.1",
133e54e4f21d Updated header block; plugin now generates content only if current user is an admin (doh, save some resources already)
Dan
parents: 0
diff changeset
     9
  "Author URI"   : "http://enanocms.org/"
133e54e4f21d Updated header block; plugin now generates content only if current user is an admin (doh, save some resources already)
Dan
parents: 0
diff changeset
    10
}
133e54e4f21d Updated header block; plugin now generates content only if current user is an admin (doh, save some resources already)
Dan
parents: 0
diff changeset
    11
**!*/
0
f166d28a778d Initial revision.
Dan
parents:
diff changeset
    12
f166d28a778d Initial revision.
Dan
parents:
diff changeset
    13
/*
1
133e54e4f21d Updated header block; plugin now generates content only if current user is an admin (doh, save some resources already)
Dan
parents: 0
diff changeset
    14
 * Administrators' Alerts plugin for Enano CMS
133e54e4f21d Updated header block; plugin now generates content only if current user is an admin (doh, save some resources already)
Dan
parents: 0
diff changeset
    15
 * Version 0.1
133e54e4f21d Updated header block; plugin now generates content only if current user is an admin (doh, save some resources already)
Dan
parents: 0
diff changeset
    16
 * Copyright (C) 2006-2008 Dan Fuhry
0
f166d28a778d Initial revision.
Dan
parents:
diff changeset
    17
 *
f166d28a778d Initial revision.
Dan
parents:
diff changeset
    18
 * This program is Free Software; you can redistribute and/or modify it under the terms of the GNU General Public License
f166d28a778d Initial revision.
Dan
parents:
diff changeset
    19
 * as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
f166d28a778d Initial revision.
Dan
parents:
diff changeset
    20
 *
f166d28a778d Initial revision.
Dan
parents:
diff changeset
    21
 * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
f166d28a778d Initial revision.
Dan
parents:
diff changeset
    22
 * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for details.
f166d28a778d Initial revision.
Dan
parents:
diff changeset
    23
 */
f166d28a778d Initial revision.
Dan
parents:
diff changeset
    24
 
f166d28a778d Initial revision.
Dan
parents:
diff changeset
    25
global $db, $session, $paths, $template, $plugins; // Common objects
f166d28a778d Initial revision.
Dan
parents:
diff changeset
    26
f166d28a778d Initial revision.
Dan
parents:
diff changeset
    27
$plugins->attachHook('common_post', 'adminalerts_setup();');
f166d28a778d Initial revision.
Dan
parents:
diff changeset
    28
f166d28a778d Initial revision.
Dan
parents:
diff changeset
    29
function adminalerts_setup()
f166d28a778d Initial revision.
Dan
parents:
diff changeset
    30
{
f166d28a778d Initial revision.
Dan
parents:
diff changeset
    31
  global $db, $session, $paths, $template, $plugins; // Common objects
f166d28a778d Initial revision.
Dan
parents:
diff changeset
    32
  
f166d28a778d Initial revision.
Dan
parents:
diff changeset
    33
  // restrict this block to administrators
f166d28a778d Initial revision.
Dan
parents:
diff changeset
    34
  $content = '{restrict auth_admin}';
f166d28a778d Initial revision.
Dan
parents:
diff changeset
    35
  
1
133e54e4f21d Updated header block; plugin now generates content only if current user is an admin (doh, save some resources already)
Dan
parents: 0
diff changeset
    36
  if ( $session->user_level >= USER_LEVEL_ADMIN )
0
f166d28a778d Initial revision.
Dan
parents:
diff changeset
    37
  {
1
133e54e4f21d Updated header block; plugin now generates content only if current user is an admin (doh, save some resources already)
Dan
parents: 0
diff changeset
    38
    
133e54e4f21d Updated header block; plugin now generates content only if current user is an admin (doh, save some resources already)
Dan
parents: 0
diff changeset
    39
    $content .= '<p style="margin: 0; padding: 0;"><b>Unapproved comments:</b><br />';
133e54e4f21d Updated header block; plugin now generates content only if current user is an admin (doh, save some resources already)
Dan
parents: 0
diff changeset
    40
    
133e54e4f21d Updated header block; plugin now generates content only if current user is an admin (doh, save some resources already)
Dan
parents: 0
diff changeset
    41
    // unapproved comments
133e54e4f21d Updated header block; plugin now generates content only if current user is an admin (doh, save some resources already)
Dan
parents: 0
diff changeset
    42
    $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;');
133e54e4f21d Updated header block; plugin now generates content only if current user is an admin (doh, save some resources already)
Dan
parents: 0
diff changeset
    43
    if ( !$q )
133e54e4f21d Updated header block; plugin now generates content only if current user is an admin (doh, save some resources already)
Dan
parents: 0
diff changeset
    44
      $db->_die();
133e54e4f21d Updated header block; plugin now generates content only if current user is an admin (doh, save some resources already)
Dan
parents: 0
diff changeset
    45
    
133e54e4f21d Updated header block; plugin now generates content only if current user is an admin (doh, save some resources already)
Dan
parents: 0
diff changeset
    46
    if ( $db->numrows() < 1 )
133e54e4f21d Updated header block; plugin now generates content only if current user is an admin (doh, save some resources already)
Dan
parents: 0
diff changeset
    47
    {
133e54e4f21d Updated header block; plugin now generates content only if current user is an admin (doh, save some resources already)
Dan
parents: 0
diff changeset
    48
      $content .= 'No unapproved comments.';
133e54e4f21d Updated header block; plugin now generates content only if current user is an admin (doh, save some resources already)
Dan
parents: 0
diff changeset
    49
    }
133e54e4f21d Updated header block; plugin now generates content only if current user is an admin (doh, save some resources already)
Dan
parents: 0
diff changeset
    50
    else
0
f166d28a778d Initial revision.
Dan
parents:
diff changeset
    51
    {
1
133e54e4f21d Updated header block; plugin now generates content only if current user is an admin (doh, save some resources already)
Dan
parents: 0
diff changeset
    52
      $content .= '<div class="tblholder" style="max-height: 100px; clip: rect(0px,auto,auto,0px); overflow: auto;">
133e54e4f21d Updated header block; plugin now generates content only if current user is an admin (doh, save some resources already)
Dan
parents: 0
diff changeset
    53
                   <table border="0" cellspacing="1" cellpadding="2">';
133e54e4f21d Updated header block; plugin now generates content only if current user is an admin (doh, save some resources already)
Dan
parents: 0
diff changeset
    54
      $class = 'row3';
133e54e4f21d Updated header block; plugin now generates content only if current user is an admin (doh, save some resources already)
Dan
parents: 0
diff changeset
    55
      while ( $row = $db->fetchrow() )
0
f166d28a778d Initial revision.
Dan
parents:
diff changeset
    56
      {
1
133e54e4f21d Updated header block; plugin now generates content only if current user is an admin (doh, save some resources already)
Dan
parents: 0
diff changeset
    57
        $class = ( $class == 'row1' ) ? 'row3' : 'row1';
133e54e4f21d Updated header block; plugin now generates content only if current user is an admin (doh, save some resources already)
Dan
parents: 0
diff changeset
    58
        $preview = substr($row['comment_data'], 0, 100);
133e54e4f21d Updated header block; plugin now generates content only if current user is an admin (doh, save some resources already)
Dan
parents: 0
diff changeset
    59
        $preview = htmlspecialchars($preview);
133e54e4f21d Updated header block; plugin now generates content only if current user is an admin (doh, save some resources already)
Dan
parents: 0
diff changeset
    60
        $subj = substr($row['subject'], 0, 20);
133e54e4f21d Updated header block; plugin now generates content only if current user is an admin (doh, save some resources already)
Dan
parents: 0
diff changeset
    61
        if ( $subj != $row['subject'] )
133e54e4f21d Updated header block; plugin now generates content only if current user is an admin (doh, save some resources already)
Dan
parents: 0
diff changeset
    62
          $subj .= '...';
133e54e4f21d Updated header block; plugin now generates content only if current user is an admin (doh, save some resources already)
Dan
parents: 0
diff changeset
    63
        $subj = htmlspecialchars($subj);
133e54e4f21d Updated header block; plugin now generates content only if current user is an admin (doh, save some resources already)
Dan
parents: 0
diff changeset
    64
        if ( $row['user_id'] == 1 )
133e54e4f21d Updated header block; plugin now generates content only if current user is an admin (doh, save some resources already)
Dan
parents: 0
diff changeset
    65
        {
133e54e4f21d Updated header block; plugin now generates content only if current user is an admin (doh, save some resources already)
Dan
parents: 0
diff changeset
    66
          $name_link = htmlspecialchars($row['name']) . ' [G]';
133e54e4f21d Updated header block; plugin now generates content only if current user is an admin (doh, save some resources already)
Dan
parents: 0
diff changeset
    67
        }
133e54e4f21d Updated header block; plugin now generates content only if current user is an admin (doh, save some resources already)
Dan
parents: 0
diff changeset
    68
        else
133e54e4f21d Updated header block; plugin now generates content only if current user is an admin (doh, save some resources already)
Dan
parents: 0
diff changeset
    69
        {
133e54e4f21d Updated header block; plugin now generates content only if current user is an admin (doh, save some resources already)
Dan
parents: 0
diff changeset
    70
          $memberlist_link = makeUrlNS('Special', 'Memberlist', 'finduser=' . urlencode($row['name']), true);
133e54e4f21d Updated header block; plugin now generates content only if current user is an admin (doh, save some resources already)
Dan
parents: 0
diff changeset
    71
          $name = urlencode($row['name']);
133e54e4f21d Updated header block; plugin now generates content only if current user is an admin (doh, save some resources already)
Dan
parents: 0
diff changeset
    72
          $name_link = "<a href=\"$memberlist_link\">$name</a>";
133e54e4f21d Updated header block; plugin now generates content only if current user is an admin (doh, save some resources already)
Dan
parents: 0
diff changeset
    73
        }
133e54e4f21d Updated header block; plugin now generates content only if current user is an admin (doh, save some resources already)
Dan
parents: 0
diff changeset
    74
        
133e54e4f21d Updated header block; plugin now generates content only if current user is an admin (doh, save some resources already)
Dan
parents: 0
diff changeset
    75
        $page_url = makeUrlNS($row['namespace'], sanitize_page_id($row['page_id']));
133e54e4f21d Updated header block; plugin now generates content only if current user is an admin (doh, save some resources already)
Dan
parents: 0
diff changeset
    76
        $title    = get_page_title_ns($row['page_id'], $row['namespace']);
133e54e4f21d Updated header block; plugin now generates content only if current user is an admin (doh, save some resources already)
Dan
parents: 0
diff changeset
    77
        $page_link = "<a href=\"$page_url#do:comments\">$title</a>";
133e54e4f21d Updated header block; plugin now generates content only if current user is an admin (doh, save some resources already)
Dan
parents: 0
diff changeset
    78
        $timestamp = date('n/j H:i', intval($row['time']));
133e54e4f21d Updated header block; plugin now generates content only if current user is an admin (doh, save some resources already)
Dan
parents: 0
diff changeset
    79
        
133e54e4f21d Updated header block; plugin now generates content only if current user is an admin (doh, save some resources already)
Dan
parents: 0
diff changeset
    80
        $content .= '<tr><td title="' . $preview . '" class="' . $class . '">';
133e54e4f21d Updated header block; plugin now generates content only if current user is an admin (doh, save some resources already)
Dan
parents: 0
diff changeset
    81
        
133e54e4f21d Updated header block; plugin now generates content only if current user is an admin (doh, save some resources already)
Dan
parents: 0
diff changeset
    82
        $content .= '<b>' . $subj . '</b> by ' . $name_link . '<br />';
133e54e4f21d Updated header block; plugin now generates content only if current user is an admin (doh, save some resources already)
Dan
parents: 0
diff changeset
    83
        $content .= "$page_link, $timestamp";
133e54e4f21d Updated header block; plugin now generates content only if current user is an admin (doh, save some resources already)
Dan
parents: 0
diff changeset
    84
        
133e54e4f21d Updated header block; plugin now generates content only if current user is an admin (doh, save some resources already)
Dan
parents: 0
diff changeset
    85
        $content .= '</td></tr>';
0
f166d28a778d Initial revision.
Dan
parents:
diff changeset
    86
      }
1
133e54e4f21d Updated header block; plugin now generates content only if current user is an admin (doh, save some resources already)
Dan
parents: 0
diff changeset
    87
      $content .= '</table></div>';
133e54e4f21d Updated header block; plugin now generates content only if current user is an admin (doh, save some resources already)
Dan
parents: 0
diff changeset
    88
    }
133e54e4f21d Updated header block; plugin now generates content only if current user is an admin (doh, save some resources already)
Dan
parents: 0
diff changeset
    89
    $db->free_result();
133e54e4f21d Updated header block; plugin now generates content only if current user is an admin (doh, save some resources already)
Dan
parents: 0
diff changeset
    90
    
133e54e4f21d Updated header block; plugin now generates content only if current user is an admin (doh, save some resources already)
Dan
parents: 0
diff changeset
    91
    $content .= '</p>';
133e54e4f21d Updated header block; plugin now generates content only if current user is an admin (doh, save some resources already)
Dan
parents: 0
diff changeset
    92
    
133e54e4f21d Updated header block; plugin now generates content only if current user is an admin (doh, save some resources already)
Dan
parents: 0
diff changeset
    93
    // Inactive users
133e54e4f21d Updated header block; plugin now generates content only if current user is an admin (doh, save some resources already)
Dan
parents: 0
diff changeset
    94
    
133e54e4f21d Updated header block; plugin now generates content only if current user is an admin (doh, save some resources already)
Dan
parents: 0
diff changeset
    95
    $content .= '<p style="margin: 3px 0 0 0; padding: 0;"><b>Inactive user accounts:</b><br />';
133e54e4f21d Updated header block; plugin now generates content only if current user is an admin (doh, save some resources already)
Dan
parents: 0
diff changeset
    96
    
133e54e4f21d Updated header block; plugin now generates content only if current user is an admin (doh, save some resources already)
Dan
parents: 0
diff changeset
    97
    $q = $db->sql_query('SELECT username,reg_time FROM '.table_prefix.'users WHERE account_active=0 AND user_id > 1;');
133e54e4f21d Updated header block; plugin now generates content only if current user is an admin (doh, save some resources already)
Dan
parents: 0
diff changeset
    98
    if ( !$q )
133e54e4f21d Updated header block; plugin now generates content only if current user is an admin (doh, save some resources already)
Dan
parents: 0
diff changeset
    99
      $db->_die();
133e54e4f21d Updated header block; plugin now generates content only if current user is an admin (doh, save some resources already)
Dan
parents: 0
diff changeset
   100
    
133e54e4f21d Updated header block; plugin now generates content only if current user is an admin (doh, save some resources already)
Dan
parents: 0
diff changeset
   101
    if ( $db->numrows() < 1 )
133e54e4f21d Updated header block; plugin now generates content only if current user is an admin (doh, save some resources already)
Dan
parents: 0
diff changeset
   102
    {
133e54e4f21d Updated header block; plugin now generates content only if current user is an admin (doh, save some resources already)
Dan
parents: 0
diff changeset
   103
      $content .= 'No inactive users.';
133e54e4f21d Updated header block; plugin now generates content only if current user is an admin (doh, save some resources already)
Dan
parents: 0
diff changeset
   104
    }
133e54e4f21d Updated header block; plugin now generates content only if current user is an admin (doh, save some resources already)
Dan
parents: 0
diff changeset
   105
    else
133e54e4f21d Updated header block; plugin now generates content only if current user is an admin (doh, save some resources already)
Dan
parents: 0
diff changeset
   106
    {
133e54e4f21d Updated header block; plugin now generates content only if current user is an admin (doh, save some resources already)
Dan
parents: 0
diff changeset
   107
      $users = array();
133e54e4f21d Updated header block; plugin now generates content only if current user is an admin (doh, save some resources already)
Dan
parents: 0
diff changeset
   108
      while ( $row = $db->fetchrow() )
133e54e4f21d Updated header block; plugin now generates content only if current user is an admin (doh, save some resources already)
Dan
parents: 0
diff changeset
   109
      {
133e54e4f21d Updated header block; plugin now generates content only if current user is an admin (doh, save some resources already)
Dan
parents: 0
diff changeset
   110
        $url  = makeUrlNS('Special', 'Administration', 'module=' . $paths->nslist['Admin'] . 'UserManager&src=get&username=' . urlencode($row['username']), true);
133e54e4f21d Updated header block; plugin now generates content only if current user is an admin (doh, save some resources already)
Dan
parents: 0
diff changeset
   111
        $uname= htmlspecialchars($row['username']);
133e54e4f21d Updated header block; plugin now generates content only if current user is an admin (doh, save some resources already)
Dan
parents: 0
diff changeset
   112
        $uname_js = addslashes($row['username']);
133e54e4f21d Updated header block; plugin now generates content only if current user is an admin (doh, save some resources already)
Dan
parents: 0
diff changeset
   113
        $link = "<a href=\"$url\" onclick=\"ajaxAdminUser('$uname_js'); return false;\">$uname</a>";
133e54e4f21d Updated header block; plugin now generates content only if current user is an admin (doh, save some resources already)
Dan
parents: 0
diff changeset
   114
        $users[] = $link;
133e54e4f21d Updated header block; plugin now generates content only if current user is an admin (doh, save some resources already)
Dan
parents: 0
diff changeset
   115
      }
133e54e4f21d Updated header block; plugin now generates content only if current user is an admin (doh, save some resources already)
Dan
parents: 0
diff changeset
   116
      $content .= implode(', ', $users);
0
f166d28a778d Initial revision.
Dan
parents:
diff changeset
   117
    }
1
133e54e4f21d Updated header block; plugin now generates content only if current user is an admin (doh, save some resources already)
Dan
parents: 0
diff changeset
   118
    $db->free_result();
133e54e4f21d Updated header block; plugin now generates content only if current user is an admin (doh, save some resources already)
Dan
parents: 0
diff changeset
   119
    
133e54e4f21d Updated header block; plugin now generates content only if current user is an admin (doh, save some resources already)
Dan
parents: 0
diff changeset
   120
    $content .= '</p>';
133e54e4f21d Updated header block; plugin now generates content only if current user is an admin (doh, save some resources already)
Dan
parents: 0
diff changeset
   121
    
133e54e4f21d Updated header block; plugin now generates content only if current user is an admin (doh, save some resources already)
Dan
parents: 0
diff changeset
   122
    // Pages with deletion requests
133e54e4f21d Updated header block; plugin now generates content only if current user is an admin (doh, save some resources already)
Dan
parents: 0
diff changeset
   123
    
133e54e4f21d Updated header block; plugin now generates content only if current user is an admin (doh, save some resources already)
Dan
parents: 0
diff changeset
   124
    $content .= '<p style="margin: 3px 0 0 0; padding: 0;"><b>Pages voted for deletion:</b><br />';
133e54e4f21d Updated header block; plugin now generates content only if current user is an admin (doh, save some resources already)
Dan
parents: 0
diff changeset
   125
    
133e54e4f21d Updated header block; plugin now generates content only if current user is an admin (doh, save some resources already)
Dan
parents: 0
diff changeset
   126
    $q = $db->sql_query('SELECT name, urlname, namespace, delvotes FROM '.table_prefix.'pages WHERE delvotes > 0 ORDER BY delvotes DESC;');
133e54e4f21d Updated header block; plugin now generates content only if current user is an admin (doh, save some resources already)
Dan
parents: 0
diff changeset
   127
    if ( !$q )
133e54e4f21d Updated header block; plugin now generates content only if current user is an admin (doh, save some resources already)
Dan
parents: 0
diff changeset
   128
      $db->_die();
133e54e4f21d Updated header block; plugin now generates content only if current user is an admin (doh, save some resources already)
Dan
parents: 0
diff changeset
   129
    
133e54e4f21d Updated header block; plugin now generates content only if current user is an admin (doh, save some resources already)
Dan
parents: 0
diff changeset
   130
    if ( $db->numrows() < 1 )
133e54e4f21d Updated header block; plugin now generates content only if current user is an admin (doh, save some resources already)
Dan
parents: 0
diff changeset
   131
    {
133e54e4f21d Updated header block; plugin now generates content only if current user is an admin (doh, save some resources already)
Dan
parents: 0
diff changeset
   132
      $content .= 'No pages nominated for deletion.';
133e54e4f21d Updated header block; plugin now generates content only if current user is an admin (doh, save some resources already)
Dan
parents: 0
diff changeset
   133
    }
133e54e4f21d Updated header block; plugin now generates content only if current user is an admin (doh, save some resources already)
Dan
parents: 0
diff changeset
   134
    else
133e54e4f21d Updated header block; plugin now generates content only if current user is an admin (doh, save some resources already)
Dan
parents: 0
diff changeset
   135
    {
133e54e4f21d Updated header block; plugin now generates content only if current user is an admin (doh, save some resources already)
Dan
parents: 0
diff changeset
   136
      $pages = array();
133e54e4f21d Updated header block; plugin now generates content only if current user is an admin (doh, save some resources already)
Dan
parents: 0
diff changeset
   137
      while ( $row = $db->fetchrow() )
133e54e4f21d Updated header block; plugin now generates content only if current user is an admin (doh, save some resources already)
Dan
parents: 0
diff changeset
   138
      {
133e54e4f21d Updated header block; plugin now generates content only if current user is an admin (doh, save some resources already)
Dan
parents: 0
diff changeset
   139
        $url = makeUrlNS($row['namespace'], sanitize_page_id($row['urlname']), false, true);
133e54e4f21d Updated header block; plugin now generates content only if current user is an admin (doh, save some resources already)
Dan
parents: 0
diff changeset
   140
        $name = htmlspecialchars($row['name']);
133e54e4f21d Updated header block; plugin now generates content only if current user is an admin (doh, save some resources already)
Dan
parents: 0
diff changeset
   141
        $link = "<a href=\"$url\">$name</a> ({$row['delvotes']})";
133e54e4f21d Updated header block; plugin now generates content only if current user is an admin (doh, save some resources already)
Dan
parents: 0
diff changeset
   142
        $pages[] = $link;
133e54e4f21d Updated header block; plugin now generates content only if current user is an admin (doh, save some resources already)
Dan
parents: 0
diff changeset
   143
      }
133e54e4f21d Updated header block; plugin now generates content only if current user is an admin (doh, save some resources already)
Dan
parents: 0
diff changeset
   144
      $content .= implode("<br />\n      ", $pages);
133e54e4f21d Updated header block; plugin now generates content only if current user is an admin (doh, save some resources already)
Dan
parents: 0
diff changeset
   145
    }
133e54e4f21d Updated header block; plugin now generates content only if current user is an admin (doh, save some resources already)
Dan
parents: 0
diff changeset
   146
    $db->free_result();
133e54e4f21d Updated header block; plugin now generates content only if current user is an admin (doh, save some resources already)
Dan
parents: 0
diff changeset
   147
    
133e54e4f21d Updated header block; plugin now generates content only if current user is an admin (doh, save some resources already)
Dan
parents: 0
diff changeset
   148
    $content .= '</p>';
0
f166d28a778d Initial revision.
Dan
parents:
diff changeset
   149
  }
f166d28a778d Initial revision.
Dan
parents:
diff changeset
   150
  
f166d28a778d Initial revision.
Dan
parents:
diff changeset
   151
  $template->sidebar_widget('Administrator alerts', '<div style="padding: 5px; font-size: smaller;">' . $content . '</div>');
f166d28a778d Initial revision.
Dan
parents:
diff changeset
   152
}
f166d28a778d Initial revision.
Dan
parents:
diff changeset
   153
f166d28a778d Initial revision.
Dan
parents:
diff changeset
   154
?>