Esempio n. 1
0
 function delete_files($id)
 {
     if (check_ajax_referer('drainhole-delete_items')) {
         foreach ($_POST['checkall'] as $fileid) {
             DH_File::delete($fileid);
         }
         DH_Hole::flush();
     }
 }
Esempio n. 2
0
File: hole.php Progetto: Jintha/cama
 /**
  * Delete a hole, removing all files (both from the database and the disk)
  *
  * @static
  * @param int $id ID of the hole to delete
  * @return void
  **/
 function delete($id)
 {
     global $wpdb;
     $hole = DH_Hole::get($id);
     $files = DH_File::get_all($id);
     if (count($files) > 0) {
         foreach ($files as $file) {
             DH_File::delete($file->id);
         }
     }
     $options = get_option('drainhole_options');
     if (isset($options['delete_file']) && $options['delete_file'] && is_writable($hole->directory)) {
         @unlink($hole->directory . '/.htaccess');
         @rmdir($hole->directory);
     }
     $wpdb->query("DELETE FROM {$wpdb->prefix}drainhole_holes WHERE id='{$id}'");
 }