예제 #1
0
 /**
  *
  */
 public static function ajax_disableDirectoryListing_callback()
 {
     $issueID = absint($_POST['issueID']);
     $wfIssues = new wfIssues();
     $issue = $wfIssues->getIssueByID($issueID);
     if (!$issue) {
         return array('err' => 1, 'errorMsg' => "We could not find that issue in our database.");
     }
     $wfIssues->deleteIssue($issueID);
     $htaccessPath = wfCache::getHtaccessPath();
     if (!$htaccessPath) {
         return array('err' => 1, 'errorMsg' => "Wordfence could not find your .htaccess file.");
     }
     $fileContents = file_get_contents($htaccessPath);
     if (file_put_contents($htaccessPath, "# Added by Wordfence " . date('r') . "\nOptions -Indexes\n\n" . $fileContents, LOCK_EX)) {
         $uploadPaths = wp_upload_dir();
         if (!wfScanEngine::isDirectoryListingEnabled($uploadPaths['baseurl'])) {
             return array('ok' => 1);
         } else {
             // Revert any changes done to .htaccess
             file_put_contents($htaccessPath, $fileContents, LOCK_EX);
             return array('err' => 1, 'errorMsg' => "Updating the .htaccess did not fix the issue. You may need to add <code>Options -Indexes</code>\nto your httpd.conf if using Apache, or find documentation on how to disable directory listing for your web server.");
         }
     }
     return array('err' => 1, 'errorMsg' => "There was an error writing to your .htaccess file.");
 }
 function delete_issues()
 {
     $wfIssues = new wfIssues();
     $issueID = $_POST['id'];
     $wfIssues->deleteIssue($issueID);
     return array('ok' => 1);
 }
예제 #3
0
 public static function ajax_deleteIssue_callback()
 {
     $wfIssues = new wfIssues();
     $issueID = $_POST['id'];
     $wfIssues->deleteIssue($issueID);
     return array('ok' => 1);
 }