コード例 #1
0
function gcb_submenu()
{
    //we do not use backup popups, not yet at least
    /*
      
        //do not show or process anything if prompt is showing
        if(defined('PROMPT_SHOWING')) {
          if(isset($_GET['prompt_v2'])) {
            //we have been prompted, but asked to continue without backup
            update_option('gcb_update_prompt_v2',1);
            //re-run update
            gcb_check_update();
            
          } elseif(isset($_GET['prompt_v2_download'])) {
          //we have been prompted, and now downloading the backup     
           echo gcb::show_backup_download(); 
           return; 
          } else {
            echo gcb::prompt_table_deletion();
            return;
          }
        }*/
    $msg = "";
    if (isset($_POST["gcb_delete"])) {
        if (isset($_POST["gcb_del"]) && is_array($_POST["gcb_del"])) {
            foreach ($_POST["gcb_del"] as $bd) {
                gcb::delete_entry(intval($bd));
            }
            //refresh the map
            gcb::refresh_map();
            $msg = "Deleted!";
        }
    }
    if (isset($_POST["gcb_unin"])) {
        if (isset($_POST["ch_unin"])) {
            update_option("gcb_complete_uninstall", "yes");
        } else {
            update_option("gcb_complete_uninstall", "no");
        }
    }
    if (isset($_POST["gcb_import"])) {
        //importing files
        $msg = gcb_import();
    }
    if (isset($_POST["gcb_save"])) {
        $name = $_POST["gcb_name"];
        $value = htmlspecialchars($_POST['gcbvalue']);
        $entry_data = array("name" => $name, "description" => htmlspecialchars($_POST['gcb_description']), "value" => $value, "custom_id" => htmlspecialchars(sanitize_title_with_dashes($_POST['gcb_custom_id'])), "type" => htmlspecialchars($_POST['gcb_type']));
        if (strlen($name) && strlen($value)) {
            if (isset($_POST["update_it"])) {
                gcb::update_entry($entry_data, intval($_POST["update_it"]));
                $msg = "Entry updated!";
            } else {
                gcb::add_entry($entry_data);
                $msg = "Entry inserted!";
            }
        } else {
            $msg = "Name and Content are mandatory!";
        }
    }
    echo gcb::main_page($msg);
}
コード例 #2
0
function gcb_settings_submenu()
{
    echo gcb::main_page($msg, "settings", $udid);
}
コード例 #3
0
function gcb_submenu()
{
    global $wpdb;
    $msg = "";
    if (isset($_POST["gcb_delete"])) {
        if (isset($_POST["gcb_del"]) && is_array($_POST["gcb_del"])) {
            foreach ($_POST["gcb_del"] as $bd) {
                $wpdb->query("delete from " . $wpdb->prefix . "gcb where id=" . intval($bd) . " limit 1");
            }
            $msg = "Deleted!";
        }
    }
    if (isset($_POST["gcb_unin"])) {
        if (isset($_POST["ch_unin"])) {
            update_option("gcb_complete_uninstall", "yes");
        } else {
            update_option("gcb_complete_uninstall", "no");
        }
    }
    if (isset($_POST["gcb_import"])) {
        //importing files
        $msg = gcb_import();
    }
    if (isset($_POST["gcb_save"])) {
        $name = $_POST["gcb_name"];
        $description = mysql_real_escape_string(htmlspecialchars($_POST['gcb_description']));
        $type = mysql_real_escape_string(htmlspecialchars($_POST['gcb_type']));
        $value = mysql_real_escape_string(htmlspecialchars($_POST['gcb_value']));
        if (strlen($name) && strlen($value)) {
            if (isset($_POST["update_it"])) {
                $wpdb->query("update " . $wpdb->prefix . "gcb set name='" . $name . "',\r\r\n                         description='" . $description . "',\r\r\n                         value='" . $value . "',\r\r\n                         type='" . $type . "' \r\r\n                        where id=" . intval($_POST["update_it"] . " limit 1"));
                $msg = "Entry updated!";
            } else {
                $wpdb->query("insert into " . $wpdb->prefix . "gcb (name,description,value,type) VALUES ('" . $name . "','" . $description . "','" . $value . "','" . $type . "')");
                $msg = "Entry inserted!";
            }
        } else {
            $msg = "Name and Content are mandatory!";
        }
    }
    echo gcb::main_page($msg);
}