function indexAction()
 {
     $sql = "SELECT feed_content.feed_id as feed_id, COUNT(content.id) as cnt\n                FROM feed_content\n                LEFT JOIN content ON feed_content.content_id = content.id\n                WHERE feed_content.moderation_flag IS NULL\n                GROUP BY feed_content.feed_id;";
     $res = sql_query($sql);
     for ($i = 0; $row = sql_row_keyed($res, $i); ++$i) {
         $this->count[$row['feed_id']] = $row['cnt'];
         $new_feed = new Feed($row['feed_id']);
         if ($new_feed->user_priv($_SESSION['user'], 'moderate')) {
             $this->feeds[] = $new_feed;
         }
     }
     $this->setTitle('Moderation');
     $this->setSubject('Moderate');
 }
    </div>

<?php
if(isLoggedIn()) {
   $sql = 'SELECT feed_content.feed_id as feed_id, COUNT(content.id) as cnt '.
          'FROM feed_content '.
          'LEFT JOIN content ON feed_content.content_id = content.id '.
          'WHERE feed_content.moderation_flag IS NULL '.
          'GROUP BY feed_content.feed_id;';
   $res = sql_query($sql);

   $more_waiting = 0;
   for($i = 0;$row = sql_row_keyed($res,$i);++$i){
      $count = $row['cnt'];
      $feed = new Feed($row['feed_id']);
      if($feed->user_priv($_SESSION['user'], 'moderate',true)) {
         $mod_feeds[]="<p><a href=\"".ADMIN_URL."/moderate/feed/{$feed->id}\">" . htmlspecialchars($feed->name) . " ({$row['cnt']})</a></p>";
      } else {
         $more_waiting += $row['cnt'];
      }
   }
}
if(isset($mod_feeds) || ($more_waiting && isAdmin())) {
?>
    <div class="alert_box">
	   <div class="alert_box_inset">
        <div class="alert_box_padding">
          <h1><a href="<?=ADMIN_URL?>/moderate">Awaiting Moderation</a></h1>
          <?= isset($mod_feeds) ? join("\n", $mod_feeds) : "Nothing in your feeds." ?>
          <? if ($more_waiting > 0 && isAdmin()) {?>
             <p><a href="<?=ADMIN_URL?>/moderate"><?=$more_waiting?> items in other feeds...</a></p>