function accept()
 {
     list($files, $ids) = $this->_getFilesAndIds($this->_accepts);
     parent::setLogStatus($ids, 'accepted');
     parent::removeFromFilesystemTable($files);
     $this->_accepts = array();
     return true;
 }
 function fix()
 {
     if (empty($this->_fixes)) {
         return 0;
     }
     list($files, $ids) = $this->_getFilesAndIds($this->_fixes);
     $newFiles = array();
     $rollback = false;
     foreach ($files as $dir) {
         if (!is_dir($dir)) {
             continue;
         }
         $indexFile = JPath::clean($dir . DS . 'index.html');
         if (JFile::exists($indexFile)) {
             continue;
         }
         $fixFile = new JD_File($indexFile);
         // Try to write the file
         if (!$fixFile->write($this->indexHTMLContents)) {
             $this->setError($fixFile->getError());
             $rollback = true;
             break;
         }
         $newFiles[] = $indexFile;
     }
     if ($rollback) {
         foreach ($newFiles as $file) {
             if (JFile::exists($file)) {
                 JFile::delete($file);
             }
         }
         $this->_fixes = array();
         return false;
     }
     parent::refreshFilesystemTable($newFiles);
     parent::setLogStatus($ids, 'fixed');
     $this->_fixes = array();
     return count($newFiles);
 }
 /**
  * Assumes that log records 'issue' field contains key=value that can be used for creating rules.
  * @return int number of succesfully added exceptions
  */
 function makeException()
 {
     $ids = array();
     foreach ($this->_exceptions as $k => $item) {
         if (is_numeric($item)) {
             $ids[] = $item;
         }
     }
     $logModel =& JModel::getInstance('Log', 'JDefenderModel');
     $logModel->setState('id', $ids);
     $records = $logModel->getData();
     if (empty($records)) {
         $records = array();
     }
     // Add exception rules
     $row =& JTable::getInstance('Rule', 'Table');
     $fixedIds = array();
     foreach ($records as $rec) {
         $vars = explode("=", $rec->issue);
         $extension = explode('::', $rec->extension);
         if (2 != count($vars)) {
             continue;
         }
         $row->id = null;
         $row->rule = $vars[0];
         // The key
         $row->family = $log->type;
         $row->type = 'none';
         $row->action = 'ignore';
         $row->published = 1;
         $row->component = @$extension[0] == 'component' ? @$extension[2] : '*';
         if ($row->check() && $row->store()) {
             $fixedIds[] = $rec->id;
         } else {
             $this->setError($row->getError());
         }
     }
     parent::setLogStatus($fixedIds, 'added_to_exceptions');
     $this->_exceptions = array();
     return count($fixedIds);
 }