function init_operations() { if ($this->wp_version < 28 && isset($_GET["page"]) && $_GET["page"] == "index.php" && $this->script == "admin.php") { wp_redirect("index.php"); exit; break; } if (isset($_GET["proupgrade"]) && $_GET["proupgrade"] == "hide") { $this->o["upgrade_to_pro"] = 0; update_option("gd-press-tools", $this->o); wp_redirect(remove_query_arg("proupgrade")); exit; } if (isset($_GET["gda"])) { $gd_action = $_GET["gda"]; if ($gd_action != '') { switch ($gd_action) { case "unsevt": gd_unschedule_event($_GET['time'], $_GET['job'], $_GET['key']); wp_redirect(remove_query_arg(array('time', 'job', 'gda', 'key'), stripslashes($_SERVER['REQUEST_URI']))); exit; break; case "runevt": $job = $_GET['job']; if ($job == "wp_update_plugins") { delete_transient("update_plugins"); } if ($job == "wp_update_themes") { delete_transient("update_themes"); } if ($job == "wp_version_check") { delete_transient("update_core"); } do_action($job); wp_redirect(remove_query_arg(array('job', 'gda'), stripslashes($_SERVER['REQUEST_URI']))); exit; break; case "delrev": $post_id = $_GET["pid"]; $counter = gd_delete_revisions($post_id); $this->o["counter_total_revisions"] += $counter; wp_redirect(remove_query_arg(array('pid', 'gda'), stripslashes($_SERVER['REQUEST_URI']))); exit; break; case "duplicate": $post_id = $_GET["pid"]; $new_id = GDPTDB::duplicate_post($post_id); if ($new_id > 0) { wp_redirect(sprintf("post.php?action=edit&post=%s", $new_id)); } else { wp_redirect(remove_query_arg(array('pid', 'gda'), stripslashes($_SERVER['REQUEST_URI']))); } exit; break; case "tpldrp": $table = $_GET["name"]; gd_db_table_drop($table); wp_redirect(remove_query_arg(array('name', 'gda'), stripslashes($_SERVER['REQUEST_URI']))); exit; break; case "tblemp": $table = $_GET["name"]; gd_db_table_empty($table); wp_redirect(remove_query_arg(array('name', 'gda'), stripslashes($_SERVER['REQUEST_URI']))); exit; break; } } } if (isset($_POST['gdpt_tagger_forced'])) { $this->o["tagger_abort"] = 1; update_option("gd-press-tools", $this->o); $this->s["tagger"]["status"] = "idle"; $this->s["tagger"]["ended"] = time(); update_option("gd-press-tools-status", $this->s); wp_redirect_self(); exit; } if (isset($_POST['gdpt_tagger_stop'])) { $this->o["tagger_abort"] = 1; update_option("gd-press-tools", $this->o); wp_redirect_self(); exit; } if (isset($_POST['gdpt_dbbackup_delete'])) { $files = gdFunctionsGDPT::scan_dir(WP_CONTENT_DIR . "/gdbackup/"); foreach ($files as $fl) { if (substr($fl, 0, 10) == "db_backup_") { unlink(WP_CONTENT_DIR . "/gdbackup/" . $fl); } } wp_redirect_self(); exit; } if (isset($_POST['gdpt_backup_run'])) { $gziped = isset($_POST["backup_compressed"]); $backup = new gdMySQLBackup(GDPTDB::get_tables_names(), WP_CONTENT_DIR . "/gdbackup/", $gziped); $backup->drop_tables = isset($_POST["backup_drop_exists"]); $backup->structure_only = isset($_POST["backup_structure_only"]); $backup->backup(); wp_redirect_self(); exit; } if (isset($_POST['gdpt_tagger_run'])) { if (!isset($this->s["tagger"]) || $this->s["tagger"]["status"] == "idle") { $this->s["tagger"]["status"] = "scheduled"; $this->s["tagger"]["limit"] = $_POST['gdpt_tagger_limit']; $this->s["tagger"]["posts"] = isset($_POST['gdpt_tagger_post']) ? 1 : 0; $this->s["tagger"]["pages"] = isset($_POST['gdpt_tagger_page']) ? 1 : 0; $this->s["tagger"]["start"] = $_POST['gdpt_tagger_start']; $this->s["tagger"]["end"] = $_POST['gdpt_tagger_end']; $this->o["tagger_abort"] = 0; update_option("gd-press-tools-status", $this->s); update_option("gd-press-tools", $this->o); wp_schedule_single_event(time() + 20, 'gdpt_auto_tagger'); wp_redirect_self(); exit; } } if (isset($_POST['gdpt_revisions_delete'])) { $counter = gd_delete_all_revisions(); $this->o["counter_total_revisions"] += $counter; $this->o["tool_revisions_removed"] = date("r"); update_option("gd-press-tools", $this->o); wp_redirect_self(); exit; } if (isset($_POST['gdpt_cmm_set'])) { $cmm_date = $_POST["gdpt_cmm_date"]; $cmm_comments = isset($_POST["gdpt_cmm_comments"]) ? 1 : 0; $cmm_pings = isset($_POST["gdpt_cmm_pings"]) ? 1 : 0; GDPTDB::set_posts_comments_status($cmm_date, $cmm_comments, $cmm_pings); wp_redirect_self(); exit; } if (isset($_POST['gdpt_db_clean'])) { $size = GDPTDB::get_tables_overhead_simple(); $this->o["counter_total_overhead"] += $size; update_option("gd-press-tools", $this->o); gd_optimize_db(); wp_redirect_self(); exit; } if (isset($_POST['gdpt_admin_rss_cache_reset'])) { if ($this->wp_version < 28) { gd_clear_rss_cache(); } else { gd_clear_rss_cache_transient(); } wp_redirect_self(); exit; } if (isset($_POST['gdpt_admin_widget_reset'])) { gd_reset_widgets(); wp_redirect_self(); exit; } if (isset($_POST['gdpt_admin_avatar_scan'])) { update_option('gd-press-tools-avatars', $this->gravatar_folder($this->g)); wp_redirect_self(); exit; } if (isset($_POST['gdpt_admin_rename'])) { $this->status = GDPTDB::rename_account($_POST['gdpt_admin_username']); if ($this->status == "OK") { } wp_redirect_self(); exit; } if (isset($_POST['gdpt_admin_folder_protect'])) { gd_create_protection_files(); wp_redirect_self(); exit; } if (isset($_POST['gdpt_posts_delete'])) { $results = GDPTDB::delete_posts($_POST['gdpt_delposts_date']); $this->status = sprintf(__("Deleted %s posts and %s comments.", "gd-press-tools"), $results["posts"], $results["comments"]); } }
/** * Scans folder and adds all folders to array. * * @param string $path folder path * @return array founded folders in array */ function get_folders($path) { $folders = gdFunctionsGDPT::scan_dir($path); $import = array(); foreach ($folders as $folder) { if (substr($folder, 0, 1) != ".") { if (is_dir($path . $folder . "/")) { $import[] = $folder; } } } return $import; }
return confirm("<?php _e("Are you sure taht you want to EMPTY this table? Operation is not reversible.", "gd-press-tools"); ?> "); } </script> <div class="gdsr"><div class="wrap"> <h2 class="gdptlogopage">GD Press Tools: <?php _e("Database", "gd-press-tools"); ?> </h2> <?php gdpt_upgrade_notice(); $files = $backups = array(); if (is_dir(WP_CONTENT_DIR . "/gdbackup/")) { $files = gdFunctionsGDPT::scan_dir(WP_CONTENT_DIR . "/gdbackup/"); foreach ($files as $fl) { if (substr($fl, 0, 10) == "db_backup_") { $backups[$fl] = WP_CONTENT_URL . "/gdbackup/" . $fl; } } } global $gdpt; $gdpt->backup_folder(); if (!is_dir(WP_CONTENT_DIR . "/gdbackup/")) { ?> <div id="gdnotice" class="gderror"> <p><?php _e("For backup to work, plugin must be able to access backup folder. Plugin has tried to create folders needed and failed. Until you resolved this issue backup will not work.", "gd-press-tools"); ?> <?php