/**
  * Build a private RSS feed for the member to monitor reports
  *
  * @access	private
  * @return	void
  */
 private function _buildRSSFeed($data = array(), $report_data)
 {
     $ids = array();
     $this->registry->getClass('class_localization')->loadLanguageFile(array('public_reports'), 'core');
     if (is_array($data) and count($data)) {
         foreach ($data as $user) {
             $ids[] = $user['member_id'];
         }
     }
     if (count($ids) == 0) {
         return;
     }
     require_once IPS_KERNEL_PATH . 'classRss.php';
     $status = array();
     $this->DB->build(array('select' => 'status, is_new, is_complete', 'from' => 'rc_status', 'where' => "is_new=1 OR is_complete=1"));
     $this->DB->execute();
     while ($row = $this->DB->fetch()) {
         if ($row['is_new'] == 1) {
             $status['new'] = $row['status'];
         } elseif ($row['is_complete'] == 1) {
             $status['complete'] = $row['status'];
         }
     }
     //-----------------------------------------
     // Now, we loop over each of the member ids
     //-----------------------------------------
     foreach ($ids as $id) {
         //-----------------------------------------
         // Clear out for new RSS doc and add channel
         //-----------------------------------------
         $rss = new classRss();
         $channel_id = $rss->createNewChannel(array('title' => $this->lang->words['rss_feed_title'], 'link' => $this->settings['board_url'], 'description' => $this->lang->words['reports_rss_desc'], 'pubDate' => $rss->formatDate(time())));
         //-----------------------------------------
         // Now we need to find all open reports for
         // this member
         //-----------------------------------------
         $this->DB->build(array('select' => 'i.*', 'from' => array('rc_reports_index' => 'i'), 'where' => 's.is_active=1', 'add_join' => array(array('from' => array('rc_status' => 's'), 'where' => 's.status=i.status', 'type' => 'left'), array('select' => 'c.my_class, c.mod_group_perm', 'from' => array('rc_classes' => 'c'), 'where' => 'c.com_id=i.rc_class', 'type' => 'left'))));
         $outer = $this->DB->execute();
         while ($r = $this->DB->fetch($outer)) {
             //-----------------------------------------
             // Fix stuff....this is hackish :(
             //-----------------------------------------
             if ($r['my_class'] == 'post') {
                 $r['FORUM_ID'] = $r['exdat1'];
             }
             //-----------------------------------------
             // Found all open reports, can we access?
             //-----------------------------------------
             require_once IPSLib::getAppdir('core') . '/sources/reportPlugins/' . $r['my_class'] . '.php';
             $class = $r['my_class'] . '_plugin';
             $object = new $class($this->registry);
             $notify = $object->getNotificationList(IPSText::cleanPermString($r['mod_group_perm']), $r);
             $pass = false;
             if (is_array($notify['RSS']) and count($notify['RSS'])) {
                 foreach ($notify['RSS'] as $memberAccount) {
                     if ($memberAccount['mem_id'] == $id) {
                         $pass = true;
                         break;
                     }
                 }
             }
             if ($pass) {
                 $url = $this->registry->getClass('reportLibrary')->processUrl(str_replace('&', '&', $r['url']));
                 $rss->addItemToChannel($channel_id, array('title' => $url, 'link' => $url, 'description' => $r['title'], 'content' => $r['title'], 'pubDate' => $rss->formatDate($r['date_updated'])));
             }
         }
         $rss->createRssDocument();
         $this->DB->update('rc_modpref', array('rss_cache' => $rss->rss_document), "mem_id=" . $id);
     }
 }