コード例 #1
0
ファイル: sucuri.php プロジェクト: sirhair/SH_WP_PluginRepo
 /**
  * Create a folder in the WordPress upload directory where the plugin will
  * store all the temporal or dynamic information.
  *
  * @return void
  */
 public static function create_datastore_folder()
 {
     $directory = SucuriScan::datastore_folder_path();
     if (!file_exists($directory)) {
         @mkdir($directory, 0755, true);
     }
     if (file_exists($directory)) {
         // Create last-logins datastore file.
         sucuriscan_lastlogins_datastore_exists();
         // Create a htaccess file to deny access from all.
         @file_put_contents($directory . '/.htaccess', "Order Deny,Allow\nDeny from all\n", LOCK_EX);
         // Create an index.html to avoid directory listing.
         @file_put_contents($directory . '/index.html', '<!-- Prevent the directory listing. -->', LOCK_EX);
     } else {
         SucuriScanOption::delete_option(':datastore_path');
         SucuriScanInterface::error('Data folder does not exists and could not be created. Try to <a href="' . SucuriScanTemplate::get_url('settings') . '">click this link</a> to see
             if the plugin is able to fix this error automatically, if this message
             reappears you will need to either change the location of the directory from
             the plugin general settings page or create this directory manually and give
             it write permissions: <code>' . $directory . '</code>');
     }
 }
コード例 #2
0
 /**
  * Create a folder in the WordPress upload directory where the plugin will
  * store all the temporal or dynamic information.
  *
  * @return void
  */
 public static function createStorageFolder()
 {
     $directory = SucuriScan::datastore_folder_path();
     if (!file_exists($directory)) {
         @mkdir($directory, 0755, true);
     }
     if (file_exists($directory)) {
         // Create last-logins datastore file.
         sucuriscan_lastlogins_datastore_exists();
         // Create a htaccess file to deny access from all.
         if (!SucuriScanHardening::is_hardened($directory)) {
             SucuriScanHardening::harden_directory($directory);
         }
         // Create an index.html to avoid directory listing.
         @file_put_contents($directory . '/index.html', '<!-- Prevent the directory listing. -->', LOCK_EX);
     }
 }