Beispiel #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();
     }
 }
Beispiel #2
0
 function run($desired)
 {
     global $wpdb;
     $version = get_option('drainhole_version');
     // Here we upgrade from version 1.0, or we are installing as new
     if ($version === false) {
         // Is anything installed from version 1.0
         $result = $wpdb->get_row("SHOW TABLES LIKE 'drainhole_files'");
         // Do we need to migrate anything?
         if ($result != '') {
             // Upgrading from version 1.0 => 1.1
             $this->create_tables_1();
             $this->upgrade_from_0();
             $version = 1;
         } else {
             $this->create_tables_2();
         }
         // Installing from scratch
     }
     // Upgrading from version 1.1.x => 1.2
     if ($version == 1) {
         $this->create_tables_2();
         $this->upgrade_from_1();
     } else {
         if ($version == 2 || $version == 3) {
             $this->create_tables_2();
             $this->upgrade_from_2();
         } else {
             if ($version == 4) {
                 $this->upgrade_from_3();
             }
         }
     }
     DH_Hole::flush();
     update_option('drainhole_version', $desired);
 }
Beispiel #3
0
 function screen_holes()
 {
     if (isset($_POST['create']) && check_admin_referer('drainhole-new_hole')) {
         $_POST = stripslashes_deep($_POST);
         if (($result = DH_Hole::create($_POST)) === true) {
             DH_Hole::flush();
             $this->render_message(__('The Drain Hole was successfully created', 'drain-hole'));
             do_action('drainhole_hole_created');
         } else {
             $this->render_message(__('The Drain Hole was not created - ', 'drain-hole') . $result);
         }
         // Cache the list of holes so we don't need to access the database
         $holes = DH_Hole::get_as_list();
     }
     $base_url = rtrim(get_bloginfo('home'), '/') . '/download';
     $base_directory = $this->realpath(rtrim($_SERVER['DOCUMENT_ROOT'], '/') . '/download') . '/';
     $pager = new DH_Pager($_GET, $_SERVER['REQUEST_URI'], 'name', 'ASC');
     $this->render_admin('holes', array('holes' => DH_Hole::get_all($pager), 'pager' => $pager, 'options' => $this->get_options(), 'base_url' => $base_url, 'base_directory' => $base_directory, 'home' => get_bloginfo('home')));
 }