示例#1
0
文件: Fees.php 项目: 4v4t4r/CTF-LCC
 function Open()
 {
     $addwhere = getparents($_GET["cat_id"]);
     $this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeBuildSelect");
     $this->SQL = "SELECT *  " . "FROM settings_charges";
     $this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeExecuteSelect");
     $this->query(CCBuildSQL($this->SQL, $addwhere . " ORDER BY set_id DESC LIMIT 1", $this->Order));
     $this->CCSEventResult = CCGetEvent($this->CCSEvents, "AfterExecuteSelect");
     $this->MoveToPage($this->AbsolutePage);
 }
示例#2
0
function Page_BeforeShow()
{
    //Page_BeforeShow @1-66DC429C
    //Custom Code @32-2A29BDB7
    global $Tpl;
    $finalcat = CCGetFromGet("finalcat", "");
    $ItemNum = CCGetFromGet("Item_Number", "");
    if (CCGetSession("RecentPreviewItem")) {
        $ItemNum = CCGetSession("RecentPreviewItem");
    }
    $cats = "(";
    $db = new clsDBNetConnect();
    $query = "select * from categories where cat_id='" . $finalcat . "'";
    $db->query($query);
    $db->next_record();
    $Tpl->SetVar("category", $finalcat);
    $Tpl->SetVar("cat_name", $db->f("name"));
    $cats .= "cat_id=" . $db->f("cat_id");
    if ($db->f("sub_cat_id") > 0) {
        $cats .= " or ";
        $sub = $db->f("sub_cat_id");
        $query = "select * from categories where cat_id={$sub}";
        $db->query($query);
        $db->next_record();
        $cats .= "cat_id=" . $db->f("cat_id");
        if ($db->f("sub_cat_id") > 0) {
            $cats .= " or ";
            $sub = $db->f("sub_cat_id");
            $query = "select * from categories where cat_id={$sub}";
            $db->query($query);
            $db->next_record();
            $cats .= "cat_id=" . $db->f("cat_id");
            if ($db->f("sub_cat_id") > 0) {
                $cats .= " or ";
                $sub = $db->f("sub_cat_id");
                $query = "select * from categories where cat_id={$sub}";
                $db->query($query);
                $db->next_record();
                $cats .= "cat_id=" . $db->f("cat_id");
                if ($db->f("sub_cat_id") > 0) {
                    $cats .= " or ";
                    $sub = $db->f("sub_cat_id");
                    $query = "select * from categories where cat_id={$sub}";
                    $db->query($query);
                    $db->next_record();
                    $cats .= "cat_id=" . $db->f("cat_id");
                    if ($db->f("sub_cat_id") > 0) {
                        $cats .= " or ";
                        $sub = $db->f("sub_cat_id");
                        $query = "select * from categories where cat_id={$sub}";
                        $db->query($query);
                        $db->next_record();
                        $cats .= "cat_id=" . $db->f("cat_id");
                        if ($db->f("sub_cat_id") > 0) {
                            $cats .= " or ";
                            $sub = $db->f("sub_cat_id");
                            $query = "select * from categories where cat_id={$sub}";
                            $db->query($query);
                            $db->next_record();
                            $cats .= "cat_id=" . $db->f("cat_id");
                        } else {
                            $cats .= ")";
                        }
                    } else {
                        $cats .= ")";
                    }
                } else {
                    $cats .= ")";
                }
            } else {
                $cats .= ")";
            }
        } else {
            $cats .= ")";
        }
    } else {
        $cats .= ")";
    }
    $Tpl->SetBlockVar("Custom_TextArea", "");
    $custtxt = new clsDBNetConnect();
    $query = "select * from custom_textarea where {$cats}";
    $custtxt->query($query);
    if ($custtxt->next_record()) {
        $custtxt->seek();
        $queryfields = "(";
        $count = 0;
        while ($custtxt->next_record()) {
            if ($count > 0) {
                $queryfields .= " or ";
            }
            $queryfields .= "field_id='" . $custtxt->f("id") . "'";
            $textvar[$custtxt->f("id")] = $custtxt->f("template_var");
            $textdesc[$custtxt->f("id")] = $custtxt->f("description");
            $textname[$custtxt->f("id")] = $custtxt->f("name");
            $count++;
        }
        $custtxt->seek();
        $queryfields .= ") and";
        if (!$_POST["closes"] && $_GET["Item_Number"]) {
            $custtxtvalues = new clsDBNetConnect();
            $query = "select * from custom_textarea_values where {$queryfields} ItemNum=" . $ItemNum;
            $custtxtvalues->query($query);
            while ($custtxtvalues->next_record()) {
                $fieldvalues[$custtxtvalues->f("field_id")] = $custtxtvalues->f("value");
            }
        }
        if ($_POST && !$_GET["Item_Number"]) {
            $custtxt->seek();
            while ($custtxt->next_record()) {
                $fieldvalues[$custtxt->f("id")] = $_POST["custtxt_area::" . $textvar[$custtxt->f("id")] . "::" . $custtxt->f("id")];
            }
        }
        $custtxt->seek();
        while ($custtxt->next_record()) {
            $Tpl->SetVar("ta_name", multiline($textname[$custtxt->f("id")]));
            $Tpl->SetVar("ta_description", multiline($textdesc[$custtxt->f("id")]));
            $Tpl->SetVar("ta_var", "custtxt_area::" . $textvar[$custtxt->f("id")] . "::" . $custtxt->f("id"));
            $Tpl->SetVar("ta_value", stripslashes($fieldvalues[$custtxt->f("id")]));
            $Tpl->SetVar("ta_name_" . $custtxt->f("id"), multiline($textname[$custtxt->f("id")]));
            $Tpl->SetVar("ta_description_" . $custtxt->f("id"), multiline($textdesc[$custtxt->f("id")]));
            $Tpl->SetVar("ta_var_" . $custtxt->f("id"), "custtxt_area::" . $textvar[$custtxt->f("id")] . "::" . $custtxt->f("id"));
            $Tpl->SetVar("ta_value_" . $custtxt->f("id"), stripslashes($fieldvalues[$custtxt->f("id")]));
            $Tpl->Parse("Row", True);
        }
        $Tpl->Parse("Custom_TextArea", True);
    }
    //////////////////////////////
    //Custom TextBox
    //////////////////////////////
    $txtvar = "";
    $txtdesc = "";
    $txtname = "";
    $custtxtvalues = "";
    $custtxt = "";
    $fieldvalues = "";
    $Tpl->SetBlockVar("Custom_TextBox", "");
    $custtxt = new clsDBNetConnect();
    $query = "select * from custom_textbox where {$cats}";
    $custtxt->query($query);
    if ($custtxt->next_record()) {
        $custtxt->seek();
        $queryfields = "(";
        $count = 0;
        while ($custtxt->next_record()) {
            if ($count > 0) {
                $queryfields .= " or ";
            }
            $queryfields .= "field_id='" . $custtxt->f("id") . "'";
            $textvar[$custtxt->f("id")] = $custtxt->f("template_var");
            $textdesc[$custtxt->f("id")] = $custtxt->f("description");
            $textname[$custtxt->f("id")] = $custtxt->f("name");
            $count++;
        }
        $custtxt->seek();
        $queryfields .= ") and";
        if ($_GET["Item_Number"] && !$_POST["closes"]) {
            $custtxtvalues = new clsDBNetConnect();
            $query = "select * from custom_textbox_values where {$queryfields} ItemNum=" . $ItemNum;
            $custtxtvalues->query($query);
            while ($custtxtvalues->next_record()) {
                $fieldvalues[$custtxtvalues->f("field_id")] = $custtxtvalues->f("value");
            }
        }
        if ($_POST && !$_GET["Item_Number"]) {
            $custtxt->seek();
            while ($custtxt->next_record()) {
                $fieldvalues[$custtxt->f("id")] = $_POST["custtxt_box::" . $textvar[$custtxt->f("id")] . "::" . $custtxt->f("id")];
            }
        }
        $custtxt->seek();
        while ($custtxt->next_record()) {
            $Tpl->SetVar("tb_name", multiline($textname[$custtxt->f("id")]));
            $Tpl->SetVar("tb_description", multiline($textdesc[$custtxt->f("id")]));
            $Tpl->SetVar("tb_value", stripslashes($fieldvalues[$custtxt->f("id")]));
            $Tpl->SetVar("tb_var", "custtxt_box::" . $textvar[$custtxt->f("id")] . "::" . $custtxt->f("id"));
            $Tpl->SetVar("tb_name_" . $custtxt->f("id"), multiline($textname[$custtxt->f("id")]));
            $Tpl->SetVar("tb_description_" . $custtxt->f("id"), multiline($textdesc[$custtxt->f("id")]));
            $Tpl->SetVar("tb_value_" . $custtxt->f("id"), stripslashes($fieldvalues[$custtxt->f("id")]));
            $Tpl->SetVar("tb_var_" . $custtxt->f("id"), "custtxt_box::" . $textvar[$custtxt->f("id")] . "::" . $custtxt->f("id"));
            $Tpl->Parse("tb_Row", True);
        }
        $Tpl->Parse("Custom_TextBox", True);
    }
    /////////////////////////////////////////////////////////////////
    //Custom DropDown Fields
    /////////////////////////////////////////////////////////////////
    $txtvar = "";
    $txtdesc = "";
    $txtname = "";
    $custtxtvalues = "";
    $custtxt = "";
    $fieldvalues = "";
    $optionlist = "";
    $checked = "";
    $selected = "";
    $Tpl->SetBlockVar("Custom_DropDown", "");
    $custtxt = new clsDBNetConnect();
    $custoptions = new clsDBNetConnect();
    $query = "select * from custom_dropdown where {$cats}";
    $custtxt->query($query);
    if ($custtxt->next_record()) {
        $custtxt->seek();
        $queryfields = "(";
        $count = 0;
        while ($custtxt->next_record()) {
            if ($count > 0) {
                $queryfields .= " or ";
            }
            $query = "select * from custom_dropdown_options where field_id = '" . $custtxt->f("id") . "'";
            $custoptions->query($query);
            if ($_GET["Item_Number"] && !$_POST["custddbox::" . $custtxt->f("template_var") . "::" . $custtxt->f("id")]) {
                $dvalue = new clsDBNetConnect();
                $query = "select * from custom_dropdown_values where ItemNum = {$ItemNum} and field_id = " . $custtxt->f("id");
                $dvalue->query($query);
                if ($dvalue->next_record()) {
                    $selected[$custtxt->f("id")] = $dvalue->f("option_id");
                } else {
                    $selected[$custtxt->f("id")] = "default";
                }
            } elseif ($_POST["custddbox::" . $custtxt->f("template_var") . "::" . $custtxt->f("id")]) {
                $selected[$custtxt->f("id")] = $_POST["custddbox::" . $custtxt->f("template_var") . "::" . $custtxt->f("id")];
            }
            while ($custoptions->next_record()) {
                $checked = "";
                if (!$_GET["Item_Number"] && !$_POST["custddbox::" . $custtxt->f("template_var") . "::" . $custtxt->f("id")] && $custoptions->f("default") == 1 || $custoptions->f("default") == 1 && $selected[$custtxt->f("id")] == "default") {
                    $checked = " selected ";
                } elseif ($custoptions->f("id") == $selected[$custtxt->f("id")]) {
                    $checked = " selected ";
                } else {
                    $checked = "";
                }
                $optionlist[$custtxt->f("id")][] = "<option value=\"" . $custoptions->f("id") . "\"{$checked}>" . $custoptions->f("option") . "</option>\n";
            }
            $queryfields .= "field_id='" . $custtxt->f("id") . "'";
            $textvar[$custtxt->f("id")] = $custtxt->f("template_var");
            $textdesc[$custtxt->f("id")] = $custtxt->f("description");
            $textname[$custtxt->f("id")] = $custtxt->f("name");
            $count++;
        }
        $custtxt->seek();
        $count = 0;
        while ($custtxt->next_record()) {
            $i = 0;
            $builtoptions = "";
            while ($optionlist[$custtxt->f("id")][$i]) {
                $builtoptions .= $optionlist[$custtxt->f("id")][$i];
                $i++;
            }
            $Tpl->SetVar("dd_name", multiline($textname[$custtxt->f("id")]));
            $Tpl->SetVar("dd_description", multiline($textdesc[$custtxt->f("id")]));
            $Tpl->SetVar("dd_var", "custddbox::" . $textvar[$custtxt->f("id")] . "::" . $custtxt->f("id"));
            $Tpl->SetVar("dropdown_Options", $builtoptions);
            $Tpl->SetVar("dd_name_" . $custtxt->f("id"), multiline($textname[$custtxt->f("id")]));
            $Tpl->SetVar("dd_description_" . $custtxt->f("id"), multiline($textdesc[$custtxt->f("id")]));
            $Tpl->SetVar("dd_var_" . $custtxt->f("id"), "custddbox::" . $textvar[$custtxt->f("id")] . "::" . $custtxt->f("id"));
            $Tpl->SetVar("dropdown_Options_" . $custtxt->f("id"), $builtoptions);
            $Tpl->Parse("dd_Row", True);
        }
        $Tpl->Parse("Custom_DropDown", True);
    }
    //////////////////////////////////
    //End Custom Vars/////////////////
    //////////////////////////////////
    global $regcharges;
    $sql = "SELECT * FROM categories WHERE sub_cat_id > '0' ORDER BY weight, name";
    $db = new clsDBNetConnect();
    $db->connect();
    $db->query($sql);
    while ($db->next_record()) {
        $catid = $db->f(0);
        $subid = $db->f(1);
        $name = $db->f(2);
        if ($subid == 1) {
            $inis .= "<OPTION value=\"" . $catid . "\">" . $name . "</OPTION>";
        }
        $dsper .= "catlist[" . $catid . "] = new Array(" . $subid . " , \"" . $name . "\");\r\n";
    }
    $closestCat = getparents($_GET["finalcat"]);
    if (!$closestCat) {
        $closestCat = 1;
    }
    $db2 = new clsDBNetConnect();
    $db2->connect();
    $db2->query("SELECT * FROM lookup_listing_dates WHERE charge_for='1' and cat_id={$closestCat}");
    $dayfees = "";
    while ($db2->next_record()) {
        $dayfees = $dayfees . $db2->f("days") . " Days - <font color='red'>" . $regcharges["currency"] . $db2->f("fee") . "</font><br>";
    }
    $Tpl->SetVar("cats", $dsper);
    $Tpl->SetVar("catbuild", $inis);
    $Tpl->SetVar("dayfees", $dayfees);
    unset($db);
    //End Custom Code
}
示例#3
0
 function clsRecorditems()
 {
     global $FileName;
     global $valid;
     $this->Visible = true;
     $this->Errors = new clsErrors();
     $this->ds = new clsitemsDataSource();
     if ($this->Visible) {
         $this->ComponentName = "items";
         $this->HTMLFormAction = $FileName . "?" . CCAddParam(CCGetQueryString("QueryString", array("Preview")), "ccsForm", $this->ComponentName);
         $CCSForm = CCGetFromGet("ccsForm", "");
         $this->FormSubmitted = $CCSForm == $this->ComponentName;
         $Method = $this->FormSubmitted ? ccsPost : ccsGet;
         $this->category = new clsControl(ccsTextBox, "category", "Category", ccsInteger, "", CCGetRequestParam("category", $Method));
         $this->category->Required = true;
         $this->title = new clsControl(ccsTextBox, "title", "Title", ccsText, "", CCGetRequestParam("title", $Method));
         $this->title->Required = true;
         $this->item_paypal = new clsControl(ccsTextBox, "item_paypal", "item_paypal", ccsText, "", CCGetRequestParam("item_paypal", $Method));
         $this->quantity = new clsControl(ccsTextBox, "quantity", "Quantity", ccsInteger, "", CCGetRequestParam("quantity", $Method));
         $this->ship1 = new clsControl(ccsTextBox, "ship1", "Shipping 1", ccsText, "", CCGetRequestParam("ship1", $Method));
         $this->shipfee1 = new clsControl(ccsTextBox, "shipfee1", "Shipping Fee 1", ccsFloat, "", CCGetRequestParam("shipfee1", $Method));
         $this->ship2 = new clsControl(ccsTextBox, "ship2", "Shipping 2", ccsText, "", CCGetRequestParam("ship2", $Method));
         $this->shipfee2 = new clsControl(ccsTextBox, "shipfee2", "Shipping Fee 2", ccsFloat, "", CCGetRequestParam("shipfee2", $Method));
         $this->ship3 = new clsControl(ccsTextBox, "ship3", "Shipping 3", ccsText, "", CCGetRequestParam("ship3", $Method));
         $this->shipfee3 = new clsControl(ccsTextBox, "shipfee3", "Shipping Fee 3", ccsFloat, "", CCGetRequestParam("shipfee3", $Method));
         $this->ship4 = new clsControl(ccsTextBox, "ship4", "Shipping 4", ccsText, "", CCGetRequestParam("ship4", $Method));
         $this->shipfee4 = new clsControl(ccsTextBox, "shipfee4", "Shipping Fee 4", ccsFloat, "", CCGetRequestParam("shipfee4", $Method));
         $this->ship5 = new clsControl(ccsTextBox, "ship5", "Shipping 5", ccsText, "", CCGetRequestParam("ship5", $Method));
         $this->shipfee5 = new clsControl(ccsTextBox, "shipfee5", "Shipping Fee 5", ccsFloat, "", CCGetRequestParam("shipfee5", $Method));
         $this->asking_price = new clsControl(ccsTextBox, "asking_price", "Asking Price", ccsFloat, "", CCGetRequestParam("asking_price", $Method));
         $this->make_offer = new clsControl(ccsCheckBox, "make_offer", "Make Offer", ccsInteger, "", CCGetRequestParam("make_offer", $Method));
         $this->make_offer->CheckedValue = 1;
         $this->make_offer->UncheckedValue = 0;
         $this->description = new clsControl(ccsTextArea, "description", "Description", ccsMemo, "", CCGetRequestParam("description", $Method));
         $this->image_preview = new clsControl(ccsCheckBox, "image_preview", "Image Preview", ccsInteger, "", CCGetRequestParam("image_preview", $Method));
         $this->image_preview->CheckedValue = 1;
         $this->image_preview->UncheckedValue = 0;
         $this->slide_show = new clsControl(ccsCheckBox, "slide_show", "Slide Show", ccsInteger, "", CCGetRequestParam("slide_show", $Method));
         $this->slide_show->CheckedValue = 1;
         $this->slide_show->UncheckedValue = 0;
         $this->city_town = new clsControl(ccsTextBox, "city_town", "City Town", ccsText, "", CCGetRequestParam("city_town", $Method));
         $this->state_province = new clsControl(ccsTextBox, "state_province", "State", ccsText, "", CCGetRequestParam("state_province", $Method));
         $this->country = new clsControl(ccsListBox, "country", "Country Id", ccsInteger, "", CCGetRequestParam("country", $Method));
         $this->country_ds = new clsDBNetConnect();
         $this->country_ds->SQL = "SELECT *  " . "FROM lookup_countries";
         $country_values = CCGetListValues($this->country_ds, $this->country_ds->SQL, $this->country_ds->Where, $this->country_ds->Order, "country_id", "country_desc");
         $this->country->Values = $country_values;
         if ($valid) {
             $this->fakeuser = new clsControl(ccsListBox, "fakeuser", "Fake User Id", ccsInteger, "", CCGetRequestParam("fakeuser", $Method));
             $this->fakeuser_ds = new clsDBNetConnect();
             $this->fakeuser_ds->SQL = "SELECT *  " . "FROM users";
             $fakeuser_values = CCGetListValues($this->fakeuser_ds, $this->fakeuser_ds->SQL, $this->fakeuser_ds->Where, $this->fakeuser_ds->Order, "user_id", "user_login");
             $this->fakeuser->Values = $fakeuser_values;
             $this->startnow = new clsControl(ccsListBox, "startnow", "startnow", ccsInteger, "", CCGetRequestParam("startnow", $Method));
             $startnow_values = array(array("0", "No"), array("1", "Yes"));
             $this->startnow->Values = $startnow_values;
             $this->addtime = new clsControl(ccsListBox, "addtime", "addtime", ccsInteger, "", CCGetRequestParam("addtime", $Method));
             $addtime_values = array(array("0", "No"), array("1", "Yes"));
             $this->addtime->Values = $addtime_values;
         }
         //$this->close = new clsControl(ccsListBox, "close", "Close", ccsInteger, "", CCGetRequestParam("close", $Method));
         //            $this->close_ds = new clsDBNetConnect();
         //            $this->close_ds->SQL = "SELECT *  " .
         //"FROM lookup_listing_dates";
         //            $country_values = CCGetListValues($this->country_ds, $this->country_ds->SQL, $this->country_ds->Where, $this->country_ds->Order, "date_id", "days");
         //            $this->country->Values = $country_values;
         $this->close = new clsControl(ccsListBox, "close", "Close", ccsInteger, "", CCGetRequestParam("close", $Method));
         $this->close_ds = new clsDBNetConnect();
         $closestCat = getparents($_GET["finalcat"]);
         if (!$closestCat) {
             $closestCat = 1;
         }
         $this->close_ds->SQL = "SELECT *  " . "FROM lookup_listing_dates where cat_id=" . $closestCat;
         $close_values = CCGetListValues($this->close_ds, $this->close_ds->SQL, $this->close_ds->Where, $this->close_ds->Order, "date_id", "days");
         $this->close->Values = $close_values;
         $this->home_featured = new clsControl(ccsListBox, "home_featured", "Home Featured", ccsInteger, "", CCGetRequestParam("home_featured", $Method));
         $home_featured_values = array(array("0", "No"), array("1", "Yes"));
         $this->home_featured->Values = $home_featured_values;
         $this->gallery_featured = new clsControl(ccsListBox, "gallery_featured", "Gallery Featured", ccsInteger, "", CCGetRequestParam("gallery_featured", $Method));
         $gallery_featured_values = array(array("0", "No"), array("1", "Yes"));
         $this->gallery_featured->Values = $gallery_featured_values;
         $this->cat_featured = new clsControl(ccsListBox, "cat_featured", "Cat Featured", ccsInteger, "", CCGetRequestParam("cat_featured", $Method));
         $cat_featured_values = array(array("0", "No"), array("1", "Yes"));
         $this->cat_featured->Values = $cat_featured_values;
         $this->bold = new clsControl(ccsListBox, "bold", "Bold", ccsInteger, "", CCGetRequestParam("bold", $Method));
         $bold_values = array(array("0", "No"), array("1", "Yes"));
         $this->bold->Values = $bold_values;
         $this->background = new clsControl(ccsListBox, "background", "Background", ccsInteger, "", CCGetRequestParam("background", $Method));
         $background_values = array(array("0", "No"), array("1", "Yes"));
         $this->background->Values = $background_values;
         $this->counter = new clsControl(ccsListBox, "counter", "Counter", ccsInteger, "", CCGetRequestParam("counter", $Method));
         $counter_values = array(array("0", "No"), array("1", "Yes"));
         $this->counter->Values = $counter_values;
         $this->ItemNum = new clsControl(ccsHidden, "ItemNum", "Num", ccsInteger, "", CCGetRequestParam("ItemNum", $Method));
         $this->ItemNum->Required = true;
         $this->user_id = new clsControl(ccsHidden, "user_id", "User Id", ccsInteger, "", CCGetRequestParam("user_id", $Method));
         $this->closes = new clsControl(ccsHidden, "closes", "Closes on", ccsInteger, "", CCGetRequestParam("closes", $Method));
         $this->started = new clsControl(ccsHidden, "started", "Started on", ccsInteger, "", CCGetRequestParam("started", $Method));
         $this->status = new clsControl(ccsHidden, "status", "Status", ccsInteger, "", CCGetRequestParam("status", $Method));
         $this->image_five = new clsControl(ccsHidden, "image_five", "Image Five", ccsText, "", CCGetRequestParam("image_five", $Method));
         $this->image_four = new clsControl(ccsHidden, "image_four", "Image Four", ccsText, "", CCGetRequestParam("image_four", $Method));
         $this->image_three = new clsControl(ccsHidden, "image_three", "Image Three", ccsText, "", CCGetRequestParam("image_three", $Method));
         $this->image_two = new clsControl(ccsHidden, "image_two", "Image Two", ccsText, "", CCGetRequestParam("image_two", $Method));
         $this->image_one = new clsControl(ccsHidden, "image_one", "Image One", ccsText, "", CCGetRequestParam("image_one", $Method));
         $this->Update = new clsButton("Update");
         $this->Insert = new clsButton("Insert");
         $this->Preview = new clsButton("Preview");
     }
 }