Beispiel #1
0
function id_main_menu()
{
    require 'languages/text_variables.php';
    global $wpdb;
    $super = true;
    if (is_multisite()) {
        $super = is_super_admin();
    }
    $license_key = get_option('id_license_key');
    $is_pro = get_option('is_id_pro', 0);
    $is_basic = get_option('is_id_basic', 0);
    if (isset($_POST['license_key'])) {
        $is_pro = 0;
        $is_basic = 0;
        $license_key = esc_attr($_POST['license_key']);
        update_option('id_license_key', $license_key);
        $validate = id_validate_license($license_key);
        if (isset($validate['response'])) {
            if ($validate['response']) {
                if (isset($validate['download'])) {
                    if ($validate['download'] == '30') {
                        $is_pro = 1;
                    } else {
                        if ($validate['download'] == '1') {
                            $is_basic = 1;
                        }
                    }
                }
            }
        }
        update_option('is_id_pro', $is_pro);
        update_option('is_id_basic', $is_basic);
        if ($is_pro || $is_basic) {
            update_option('was_id_licensed', 1);
        }
        if ($is_pro) {
            update_option('was_id_pro', 1);
        }
    }
    if ($is_pro) {
        $type_msg = __(' IgnitionDeck Enterprise', 'ignitiondeck');
    } else {
        if ($is_basic) {
            $type_msg = __(' IgnitionDeck', 'ignitiondeck');
        }
    }
    $skins = $wpdb->get_row('SELECT theme_choices FROM ' . $wpdb->prefix . 'ign_settings WHERE id="1"');
    if (isset($skins)) {
        $skins = unserialize($skins->theme_choices);
    } else {
        $skins = array();
    }
    $deleted_skin_list = deleted_skin_list($skins);
    if (isset($_POST['add-skin'])) {
        $skin = str_replace('.css', '', $_POST['skin-name']);
        if ($skin !== '') {
            $skins[] = $skin;
            $deleted_skin_list = deleted_skin_list($skins);
            $skins = serialize($skins);
            $sql = $wpdb->prepare('UPDATE ' . $wpdb->prefix . 'ign_settings SET theme_choices=%s WHERE id="1"', $skins);
            $res = $wpdb->query($sql);
        }
    }
    if (isset($_POST['delete-skin'])) {
        $deleted = $_POST['deleted-skin'];
        foreach ($skins as $key => $val) {
            if (strtolower(str_replace(' ', '', $val)) == strtolower(str_replace(' ', '', $deleted))) {
                unset($skins[$key]);
            }
        }
        $deleted_skin_list = deleted_skin_list($skins);
        $skins = serialize($skins);
        $sql = $wpdb->prepare('UPDATE ' . $wpdb->prefix . 'ign_settings SET theme_choices=%s WHERE id="1"', $skins);
        $res = $wpdb->query($sql);
    }
    if (isset($_POST['btnIgnSettings'])) {
        if ($_POST['btnIgnSettings'] == $tr_Add) {
            $sql_insert = "\tINSERT INTO " . $wpdb->prefix . "ign_settings\n\t\t\t\t\t\t\t(\n\t\t\t\t\t\t\t\ttheme_value,\n\t\t\t\t\t\t\t\tprod_page_fb,\n\t\t\t\t\t\t\t\tprod_page_twitter,\n\t\t\t\t\t\t\t\tprod_page_linkedin,\n\t\t\t\t\t\t\t\tprod_page_google,\n\t\t\t\t\t\t\t\tprod_page_pinterest,\n\t\t\t\t\t\t\t\tid_widget_logo_on,\n\t\t\t\t\t\t\t\tid_widget_link,\n\t\t\t\t\t\t\t\ttheme_choices\n\t\t\t\t\t\t\t) VALUES (\t\n\t\t\t\t\t\t\t\t'" . (isset($_POST['theme_value']) ? $_POST['theme_value'] : 'style1') . "',\n\t\t\t\t\t\t\t\t'" . (isset($_POST['prod_page_fb']) ? $_POST['prod_page_fb'] : 0) . "',\n\t\t\t\t\t\t\t\t'" . (isset($_POST['prod_page_twitter']) ? $_POST['prod_page_twitter'] : 0) . "',\n\t\t\t\t\t\t\t\t'" . (isset($_POST['prod_page_linkedin']) ? $_POST['prod_page_linkedin'] : 0) . "',\n\t\t\t\t\t\t\t\t'" . (isset($_POST['prod_page_google']) ? $_POST['prod_page_google'] : 0) . "',\n\t\t\t\t\t\t\t\t'" . (isset($_POST['prod_page_pinterest']) ? $_POST['prod_page_pinterest'] : 0) . "',\n\t\t\t\t\t\t\t\t'" . (isset($_POST['id_widget_logo_on']) ? $_POST['id_widget_logo_on'] : 0) . "',\n\t\t\t\t\t\t\t\t'" . $_POST['id_widget_link'] . "',\n\t\t\t\t\t\t\t\t'" . serialize($skins) . "'\n\t\t\t\t\t\t\t)";
            $wpdb->query($sql_insert);
            update_option('id_settings_notice', 'off');
        } else {
            if ($_POST['btnIgnSettings'] == $tr_Update) {
                $sql_update = "\tUPDATE " . $wpdb->prefix . "ign_settings SET\n\t\t\t\t\t\t\ttheme_value = '" . (isset($_POST['theme_value']) ? $_POST['theme_value'] : 'style1') . "',\n\t\t\t\t\t\t\tprod_page_fb = '" . (isset($_POST['prod_page_fb']) ? $_POST['prod_page_fb'] : 0) . "',\n\t\t\t\t\t\t\tprod_page_twitter = '" . (isset($_POST['prod_page_twitter']) ? $_POST['prod_page_twitter'] : 0) . "',\n\t\t\t\t\t\t\tprod_page_linkedin = '" . (isset($_POST['prod_page_linkedin']) ? $_POST['prod_page_linkedin'] : 0) . "',\n\t\t\t\t\t\t\tprod_page_google = '" . (isset($_POST['prod_page_google']) ? $_POST['prod_page_google'] : 0) . "',\n\t\t\t\t\t\t\tprod_page_pinterest = '" . (isset($_POST['prod_page_pinterest']) ? $_POST['prod_page_pinterest'] : 0) . "',\n\t\t\t\t\t\t\tid_widget_logo_on = '" . (isset($_POST['id_widget_logo_on']) ? $_POST['id_widget_logo_on'] : 0) . "',\n\t\t\t\t\t\t\tid_widget_link = '" . $_POST['id_widget_link'] . "'\n\t\t\t\t\t\t\tWHERE id = '1'";
                $wpdb->query($sql_update);
                update_option('id_settings_notice', 'off');
            }
        }
    }
    if (isset($_POST['btnIgnSettings'])) {
        echo '<div id="message" class="updated">Settings Saved</div>';
    }
    if (isset($_POST['btnActivateScriptPrice'])) {
        $sql_script = "ALTER TABLE `" . $wpdb->prefix . "ign_pay_info` ADD `prod_price` VARCHAR( 200 ) NOT NULL AFTER `product_level`";
        $wpdb->query($sql_script);
        // Getting all the previous records to modify them one by one to update prod_price
        $sql_pay_info = "SELECT * FROM " . $wpdb->prefix . "ign_pay_info";
        $rows_pay_info = $wpdb->get_results($sql_pay_info);
        // Looping through all the purchases and updating the new field accordingly
        foreach ($rows_pay_info as $row_pay_info) {
            // Updating the record
            $sql_update = "UPDATE " . $wpdb->prefix . "ign_pay_info SET prod_price = '" . getProductPrice($row_pay_info->product_level, $row_pay_info->product_id) . "' WHERE id = '" . $row_pay_info->id . "'";
            $wpdb->query($sql_update);
        }
        $message = '<div class="updated fade below-h2" id="message" class="updated"><p>Activated Successfully. You can now change price of product safely.</p></div>';
        echo $message;
    }
    $data = getSettings();
    if (isset($data)) {
        if ($data->id_widget_link == "") {
            $affiliate_link = "http://ignitiondeck.com";
        } else {
            $affiliate_link = $data->id_widget_link;
        }
    } else {
        $affiliate_link = "http://ignitiondeck.com";
    }
    echo '<div class="wrap">
		' . admin_menu_html();
    echo '<br />';
    $sql_products = "SELECT * FROM " . $wpdb->prefix . "ign_products";
    $products = $wpdb->get_results($sql_products);
    $site_url = site_url();
    include_once 'templates/admin/_settingsIgnDeck.php';
}
 protected function setInfoShopp()
 {
     include_once PLUGIN_PATH_SHIPWORKSWORDPRESS . 'functions/shopp/functionsShopp.php';
     if ($this->row['type'] == 'addon') {
         $this->itemID = getAddonSku($this->row);
         $this->productID = $this->row['product'];
         $this->code = getAddonSku($this->row);
         $this->sku = getAddonSku($this->row);
         $this->name = $this->row['name'];
         $this->quantity = $this->row['quantity'];
         $this->price = $this->row['price'];
         $this->unitprice = getAddonPrice($this->row);
         $this->weight = weightFilter(getAddonWeight($this->row));
         $this->unitcost = $this->row['cost'];
     } else {
         if (isVariation($this->row['price'])) {
             $this->itemID = getProductSku($this->row['price']);
             $this->productID = $this->row['price'];
             $this->code = getProductSku($this->row['price']);
             $this->sku = getProductSku($this->row['price']);
             $this->name = $this->row['name'];
             $this->quantity = $this->row['quantity'];
             $this->price = $this->row['price'];
             $this->unitprice = getProductPrice($this->row['price']);
             $this->weight = weightFilter(getWeight($this->price));
             $this->unitcost = $this->row['cost'];
             // On ajoute les attributs
             $attributes = getAttributes($this->row['price']);
             foreach ($attributes as $key => $attribute) {
                 array_push($this->attributes, new Attribute($this->software, $this->date, getAttributeParent($this->row['product'], trim($attribute)), $attribute));
             }
         } else {
             $this->itemID = getProductSku($this->row['price']);
             $this->productID = $this->row['price'];
             $this->code = getProductSku($this->row['price']);
             $this->sku = getProductSku($this->row['price']);
             $this->name = $this->row['name'];
             $this->quantity = $this->row['quantity'];
             $this->price = $this->row['price'];
             $this->unitcost = $this->row['cost'];
             $this->unitprice = getProductPrice($this->row['price']);
             $this->weight = weightFilter(getWeight($this->price));
         }
     }
 }