function change_password_changepwd1_AfterUpdate(&$sender)
{
    $change_password_changepwd1_AfterUpdate = true;
    $Component =& $sender;
    $Container =& CCGetParentContainer($sender);
    global $change_password;
    //Compatibility
    //End change_password_changepwd1_AfterUpdate
    //Custom Code @18-2A29BDB7
    // -------------------------
    $dbw = new clsDBconnection1();
    $sql1 = "update users set user_password ='******' where user_id=" . CCGetUserID();
    $dbw->query($sql1);
    //$Result3 = $dbw->next_record();
    if ($dbw->affected_rows() > 0) {
        $change_password->changepwd1->Errors->addError('<div class="alert alert-success">DONE! Password Succesfully Changed! Login with new password to continue...</div>');
        CCLogoutUser();
        CCSetCookie("iRadiologyLogin", "");
    } else {
        $change_password->changepwd1->Errors->addError('<div class="alert">Unable to Change Password! Try Again Later!</div>');
    }
    // -------------------------
    //End Custom Code
    //DEL
    //Close change_password_changepwd1_AfterUpdate @8-7BFDFC76
    return $change_password_changepwd1_AfterUpdate;
}
Esempio n. 2
0
function Page_BeforeShow()
{
    //Page_BeforeShow @1-66DC429C
    //Custom Code @12-2A29BDB7
    global $Tpl;
    global $now;
    global $accounting;
    global $charges;
    global $images;
    global $ttldis;
    global $usertotal;
    global $ttlcal;
    global $item_token;
    $db = new clsDBNetConnect();
    $query = "select tokens from users where user_id=" . CCGetUserID();
    $db->query($query);
    if ($db->next_record()) {
        if ($db->f("tokens") > 0 && !$item_token) {
            $Tpl->SetVar("tokens", "<br><br>You Currently have " . $db->f("tokens") . " 'Free Listing Tokens' in your account.  <br><a href=\"StartListing.php?usetoken=1\">Click Here to use one token and make this listing free!</a>");
        }
    }
    $Tpl->SetVar("ChargeListing", $ttldis);
    $Tpl->SetVar("UserTotal", pricepad($usertotal));
    $finaltotal = $usertotal - $ttlcal;
    $Tpl->SetVar("UserTotalFinal", pricepad($finaltotal));
    //End Custom Code
}
function settings_maintcontent_options_BeforeUpdate(&$sender)
{
    $settings_maintcontent_options_BeforeUpdate = true;
    $Component =& $sender;
    $Container =& CCGetParentContainer($sender);
    global $settings_maintcontent;
    //Compatibility
    //End settings_maintcontent_options_BeforeUpdate
    //Custom Code @16-2A29BDB7
    // -------------------------
    // Write your own code here.
    $settings_maintcontent->options->modified_iduser->SetValue(CCGetUserID());
    // -------------------------
    //End Custom Code
    //Close settings_maintcontent_options_BeforeUpdate @5-9670AD09
    return $settings_maintcontent_options_BeforeUpdate;
}
function products_suite_maintcontent_alm_product_suites_BeforeUpdate(&$sender)
{
    $products_suite_maintcontent_alm_product_suites_BeforeUpdate = true;
    $Component =& $sender;
    $Container =& CCGetParentContainer($sender);
    global $products_suite_maintcontent;
    //Compatibility
    //End products_suite_maintcontent_alm_product_suites_BeforeUpdate
    //Custom Code @31-2A29BDB7
    // -------------------------
    // Write your own code here.
    $products_suite_maintcontent->alm_product_suites->modified_iduser->SetValue(CCGetUserID());
    // -------------------------
    //End Custom Code
    //Close products_suite_maintcontent_alm_product_suites_BeforeUpdate @2-E62CC3A9
    return $products_suite_maintcontent_alm_product_suites_BeforeUpdate;
}
function contacts_subhobbies_maintcontent_alm_customers_contacts_su_BeforeUpdate(&$sender)
{
    $contacts_subhobbies_maintcontent_alm_customers_contacts_su_BeforeUpdate = true;
    $Component =& $sender;
    $Container =& CCGetParentContainer($sender);
    global $contacts_subhobbies_maintcontent;
    //Compatibility
    //End contacts_subhobbies_maintcontent_alm_customers_contacts_su_BeforeUpdate
    //Custom Code @14-2A29BDB7
    // -------------------------
    // Write your own code here.
    $contacts_subhobbies_maintcontent->alm_customers_contacts_su->modified_iduser->SetValue(CCGetUserID());
    // -------------------------
    //End Custom Code
    //Close contacts_subhobbies_maintcontent_alm_customers_contacts_su_BeforeUpdate @2-BEDF7F17
    return $contacts_subhobbies_maintcontent_alm_customers_contacts_su_BeforeUpdate;
}
function resellers_maintcontent_alm_resellers_BeforeUpdate(&$sender)
{
    $resellers_maintcontent_alm_resellers_BeforeUpdate = true;
    $Component =& $sender;
    $Container =& CCGetParentContainer($sender);
    global $resellers_maintcontent;
    //Compatibility
    //End resellers_maintcontent_alm_resellers_BeforeUpdate
    //Custom Code @16-2A29BDB7
    // -------------------------
    // Write your own code here.
    $resellers_maintcontent->alm_resellers->modified_iduser->SetValue(CCGetUserID());
    // -------------------------
    //End Custom Code
    //Close resellers_maintcontent_alm_resellers_BeforeUpdate @2-3EF302A3
    return $resellers_maintcontent_alm_resellers_BeforeUpdate;
}
Esempio n. 7
0
function charges1_charge_OnValidate()
{
    //charges1_charge_OnValidate @10-D55FB1E0
    //Custom Code @22-2A29BDB7
    global $charges1;
    global $accounting;
    global $regcharges;
    global $finalamount;
    $dba = new clsDBNetConnect();
    $dba->connect();
    $dba->query("SELECT * FROM users WHERE user_id='" . CCGetUserID() . "'");
    $dbL = new clsDBNetConnect();
    $dbL->connect();
    while ($dba->next_record()) {
        $clook = $dba->f("country_id");
        $city = $dba->f("city");
        $state = $dba->f("state_id");
        $addr = $dba->f("address1");
        $zip = $dba->f("zip");
        $usid = $dba->f("user_id");
        $email = $dba->f("email");
        $country = CCDLookUp("country_desc", "lookup_countries", "country_id='" . $clook . "'", $dbL);
    }
    $payment_config = array("method" => "cc", "login" => $accounting["authorize"], "tran_key" => $accounting["authorize_tran_key"], "currency_code" => $regcharges["currencycode"]);
    $customer_info = array("first_name" => $charges1->FirstName->GetValue(), "last_name" => $charges1->LastName->GetValue(), "address" => $addr, "city" => $city, "state" => $state, "zip" => $zip, "country" => $country, "cust_id" => $usid, "email" => $email);
    $credit_card_info = array("card_num" => $charges1->CCNumber->GetValue(), "exp_date" => $charges1->ExpDate->GetValue(), "card_code" => $charges1->CardCode->GetValue(), "charge_type" => "AUTH_CAPTURE");
    $payment =& new payment_authorizenet($payment_config);
    $payment->setCustomerIP($_SERVER["REMOTE_ADDR"]);
    $payment->enableCustomerEmails(TRUE);
    $payment->addCustomerInfo($customer_info, "billing");
    $result = $payment->doPayment(rand(), "Classified Ad Listing Fee", $charges1->charge->GetValue(), "no", $credit_card_info);
    if (!$result) {
        $result_code = $payment->response_code;
        // 2 = declined, 3 = error
        if ($result_code == 2) {
            $charges1->charge->Errors->addError("The Card has been declined. Please make sure the Name, CC Number, and Expiration date are correct.");
        }
        if ($result_code == 3) {
            $charges1->charge->Errors->addError("There was an error trying to process your card. Please make sure the Name, CC Number, and Expiration date are correct.");
        }
    }
    $finalamount = $payment->x_amount;
    //End Custom Code
}
function header_lbusername_BeforeShow(&$sender)
{
    $header_lbusername_BeforeShow = true;
    $Component =& $sender;
    $Container =& CCGetParentContainer($sender);
    global $header;
    //Compatibility
    //End header_lbusername_BeforeShow
    //DLookup @3-A9AF6E5C
    global $DBdbConnection;
    $Page = CCGetParentPage($sender);
    $ccs_result = CCDLookUp("fullname", "alm_users", "id = " . CCGetUserID(), $Page->Connections["dbConnection"]);
    $Component->SetValue($ccs_result);
    //End DLookup
    //Custom Code @4-2A29BDB7
    // -------------------------
    // Write your own code here.
    $sender->SetValue(ucwords($sender->GetValue()));
    // -------------------------
    //End Custom Code
    //Close header_lbusername_BeforeShow @2-B95CD6EB
    return $header_lbusername_BeforeShow;
}
Esempio n. 9
0
    function InsertRow()
    {
        global $finalamount;
        global $charges;
        global $EP;
        $this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeInsert");
        $this->ds->charge->SetValue($finalamount);
        $this->ds->FirstName->SetValue($this->FirstName->GetValue());
        $this->ds->LastName->SetValue($this->LastName->GetValue());
        $this->ds->CCNumber->SetValue($this->CCNumber->GetValue());
        $this->ds->ExpDate->SetValue($this->ExpDate->GetValue());
        $this->ds->CardCode->SetValue($this->CardCode->GetValue());
        $this->ds->user_id->SetValue(CCGetUserID());
        $this->ds->date->SetValue(time());
        $this->ds->cause->SetValue("Credit Card Payment--Subscription");
        $this->ds->Insert();
        $this->CCSEventResult = CCGetEvent($this->CCSEvents, "AfterInsert");
        $lookdb = new clsDBNetConnect;
        $lookdb->connect();
        $lookdb->query("SELECT * FROM users WHERE user_login='******'");
                if($lookdb->next_record()) {
                        $ld = array(
                        "first" => $lookdb->f("first_name"),
                        "ID" => $lookdb->f("user_id"),
                        "last" => $lookdb->f("last_name"),
                        "email" => $lookdb->f("email"),
                        "address" => $lookdb->f("address1"),
                        "address2" => $lookdb->f("address2"),
                        "state" => $lookdb->f("state_id"),
                        "zip" => $lookdb->f("zip"),
                        "city" => $lookdb->f("city"),
                        "phonedy" => $lookdb->f("phone_day"),
                        "phoneevn" => $lookdb->f("phone_evn"),
                        "fax" => $lookdb->f("fax"),
                        "ip" => $lookdb->f("ip_insert"),
                        "date_created" => $lookdb->f("date_created"),
                        );
                }
                $EP["EMAIL:PAYMENT_SUBJECT"] = "Credit Card Deposit";
                $EP["EMAIL:PAYMENT_AMOUNT"] = $charges["currency"] . $finalamount;
                $EP["EMAIL:CURRENT_USERNAME"] = CCGetUserLogin();
                $EP["EMAIL:CURRENT_USERID"] = $ld["ID"];
                $EP["EMAIL:CURRENT_USER_FIRST_NAME"] = $ld["first"];
                $EP["EMAIL:CURRENT_USER_LAST_NAME"] = $ld["last"];
                $EP["EMAIL:CURRENT_USER_EMAIL"] = $ld["email"];
                $EP["EMAIL:CURRENT_USER_ADDRESS"] = $ld["address"];
                $EP["EMAIL:CURRENT_USER_ADDRESS2"] = $ld["address2"];
                $EP["EMAIL:CURRENT_USER_STATE"] = $ld["state"];
                $EP["EMAIL:CURRENT_USER_CITY"] = $ld["city"];
                $EP["EMAIL:CURRENT_USER_ZIP"] = $ld["zip"];
                $EP["EMAIL:CURRENT_USER_DAY_PHONE"] = $ld["phonedy"];
                $EP["EMAIL:CURRENT_USER_EVN_PHONE"] = $ld["phoneevn"];
                $EP["EMAIL:CURRENT_USER_FAX"] = $ld["fax"];
                $EP["EMAIL:CURRENT_USER_IP"] = getenv("REMOTE_ADDR");
                $EP["EMAIL:CURRENT_USER__REGISTERED_IP"] = $ld["ip"];
                $EP["EMAIL:CURRENT_USER_DATE_SIGNEDUP"] = date("F j, Y, g:i a", $ld["date_created"]);

            mailout("NewSubscribe", $now["notifyads"], $payer_id, 1000000000, time(), $EP);

        if($this->ds->Errors->Count() > 0)
        {
            echo "Error in Record " . $this->ComponentName . " / Insert Operation";
            $this->ds->Errors->Clear();
            $this->Errors->AddError("Database command error.");
        }
        return ($this->Errors->Count() == 0);
    }
function contacts_holidays_maintcontent_alm_contacts_holidays_BeforeUpdate(&$sender)
{
    $contacts_holidays_maintcontent_alm_contacts_holidays_BeforeUpdate = true;
    $Component =& $sender;
    $Container =& CCGetParentContainer($sender);
    global $contacts_holidays_maintcontent;
    //Compatibility
    //End contacts_holidays_maintcontent_alm_contacts_holidays_BeforeUpdate
    //Custom Code @19-2A29BDB7
    // -------------------------
    // Write your own code here.
    $contacts_holidays_maintcontent->alm_contacts_holidays->modified_iduser->SetValue(CCGetUserID());
    //Transforming the way day and month is saved
    $day = $contacts_holidays_maintcontent->alm_contacts_holidays->day_month->GetValue();
    $month = $contacts_holidays_maintcontent->alm_contacts_holidays->day_month1->GetValue();
    $dayMonth = "{$day},{$month}";
    $contacts_holidays_maintcontent->alm_contacts_holidays->hiddaymonth->SetValue($dayMonth);
    // -------------------------
    //End Custom Code
    //Close contacts_holidays_maintcontent_alm_contacts_holidays_BeforeUpdate @3-F481C896
    return $contacts_holidays_maintcontent_alm_contacts_holidays_BeforeUpdate;
}
Esempio n. 11
0
        $query = "select * from used_coupons where user_id = '" . CCGetUserID() . "' and coupon_id = '" . $db->f("id") . "'";
        $db2->query($query);
        if ($db2->next_record()) {
            $error = "You Have Already Used that Coupon";
        }
        $query = "select * from used_coupons where user_id = '" . CCGetUserID() . "' and ItemNum = '" . CCGetSession("RecentItemNum") . "'";
        $db2->query($query);
        if ($db2->next_record()) {
            $error = "You Have Already Used a Coupon on this Listing";
        }
    } else {
        $error = "This Is Not a Valid Coupon";
    }
    if (!$error) {
        $error = "Thank You!  Coupon Code Entered Successfully!  <br><a href=\"StartListing.php\">&lt;&lt;  Return to the \"Start Listing\" page to continue creating your listing!</a>";
        $query = "INSERT INTO used_coupons (`user_id` , `coupon_id` , `date`, `ItemNum`) VALUES ('" . CCGetUserID() . "', '" . $db->f("id") . "' , '" . time() . "', '" . CCGetSession("RecentItemNum") . "')";
        $db->query($query);
    }
    $Tpl->SetVar("error", $error);
} elseif ($_GET["Cancel"]) {
    header("Location: StartListing.php");
    exit;
}
//Show Page @1-8D0414C5
$Header->Show("Header");
$Footer->Show("Footer");
$Tpl->PParse("main", false);
//End Show Page
//Unload Page @1-AB7622EF
$CCSEventResult = CCGetEvent($CCSEvents, "BeforeUnload");
unset($Tpl);
function licensing_customerscontent_licensing_BeforeUpdate(&$sender)
{
    $licensing_customerscontent_licensing_BeforeUpdate = true;
    $Component =& $sender;
    $Container =& CCGetParentContainer($sender);
    global $licensing_customerscontent;
    //Compatibility
    //End licensing_customerscontent_licensing_BeforeUpdate
    //Custom Code @190-2A29BDB7
    // -------------------------
    // Write your own code here.
    $licensing_customerscontent->licensing->modified_iduser->SetValue(CCGetUserID());
    //Changing license status to active when inactive and grant,expdate,expirdate are present
    $grantNo = trim($licensing_customerscontent->licensing->grant_number->GetValue());
    $expDate = $licensing_customerscontent->licensing->expedition_date->GetValue();
    $expirDate = $licensing_customerscontent->licensing->expiration_date->GetValue();
    $licenseStatus = (int) $licensing_customerscontent->licensing->hidlicensestatus->GetValue();
    $licenseType = (int) $licensing_customerscontent->licensing->id_license_type->GetValue();
    if ($licenseStatus == 1 && strlen($grantNo) > 0 && count($expDate) > 1 && count($expirDate) > 1) {
        if ($licenseType == 7 || $licenseType == 12) {
            $licensing_customerscontent->licensing->expiration_date->SetValue("");
        }
        $licensing_customerscontent->licensing->hidlicensestatus->SetValue("2");
        //If the renewal was not activated when created, then will use the expired_license_guid to identify
        //a renewal not activeated yet and the expired license was not archived as well.
        $expiredLicenseGuid = trim($licensing_customerscontent->licensing->hidexpired_license_guid->GetValue());
        if (strlen($expiredLicenseGuid) > 0) {
            $params = array();
            $params["guid"] = $expiredLicenseGuid;
            //A renewal not activeated yet and the expired license was not archived as well,
            //sets expired license as archived
            $products = new Alm\Products();
            $products->setLicenseArchivedByGuid($params);
        }
    } else {
        //if ( ($licenseStatus == 1) && (strlen($grantNo) > 0) && (count($expDate) > 1) &&
        if ($licenseStatus == 1 && ($licenseType == 7 || $licenseType == 12)) {
            $licensing_customerscontent->licensing->expiration_date->SetValue("");
            $licensing_customerscontent->licensing->hidlicensestatus->SetValue("2");
        }
    }
    //Setting expired license to archived when archive_only operation takes place
    $o = $licensing_customerscontent->licensing->hido->GetValue();
    if ($licenseStatus == 3 && $o == "archive_only") {
        $params = array();
        $params["guid"] = $licensing_customerscontent->licensing->hidguid->GetValue();
        $products = new Alm\Products();
        $products->setLicenseArchivedByGuid($params);
    }
    // -------------------------
    //End Custom Code
    //Close licensing_customerscontent_licensing_BeforeUpdate @154-43A03213
    return $licensing_customerscontent_licensing_BeforeUpdate;
}
Esempio n. 13
0
	'icon_27' : '../images/minus.gif'       // junctioin for last opended node

};

</script>
</head>

<body leftmargin="0" topmargin="0" marginheight="0" marginwidth="0">
<div id="links"  style="font-family: Tahoma, Verdana, Geneva, Arial, Helvetica, sans-serif;font-size: 12px;>
<form name="menuform" id="menuform">
<?php 
$queryCount = "select count(*) jums " . "from (select a.p_application_id, d.code from p_application d, p_application_role a, p_app_role b, p_app_user_role c " . "where d.p_application_id = a.p_application_id " . "and a.p_app_role_id = b.p_app_role_id and c.p_app_role_id = b.p_app_role_id " . "and c.p_app_user_id = " . CCGetUserID() . " group by a.p_application_id, d.code " . ")";
$dbConn->query($queryCount);
$dbConn->next_record();
$count = $dbConn->f("jums");
$query = "select rownum as idap, p_application_id, code from " . "(select a.p_application_id, d.code from p_application d, p_application_role a, p_app_role b, p_app_user_role c " . "where d.p_application_id = a.p_application_id " . "and a.p_app_role_id = b.p_app_role_id and c.p_app_role_id = b.p_app_role_id " . "and c.p_app_user_id = " . CCGetUserID() . " group by a.p_application_id, d.code " . ")";
$dbConn->query($query);
?>
	<ul>
<?php 
while ($dbConn->next_record()) {
    $idap = $dbConn->f("idap");
    $p_application_id = $dbConn->f("p_application_id");
    ?>
		<li>
			<a href="#" onclick="show('menu_<?php 
    echo $idap;
    ?>
', <?php 
    echo $count;
    ?>
Esempio n. 14
0
function CCSecurityAccessCheck($GroupsAccess)
{
    $ErrorType = "success";
    if (!strlen(CCGetUserID())) {
        $ErrorType = "notLogged";
    } else {
        $GroupID = CCGetGroupID();
        if (!strlen($GroupID)) {
            $ErrorType = "groupIDNotSet";
        } else {
            if (!CCUserInGroups($GroupID, $GroupsAccess)) {
                $ErrorType = "illegalGroup";
            }
        }
    }
    return $ErrorType;
}
Esempio n. 15
0
}
if ($_POST["saveAddCats"] && $admingroup && $_POST["addcategory"]) {
    $db = new clsDBNetConnect();
    $newcats = explode(";", $_POST["addcategory"]);
    $i = 0;
    while ($newcats[$i]) {
        $newcats[$i] = trim($newcats[$i]);
        if (strlen($newcats[$i]) > 0) {
            $db->query("insert into `categories` set `name` = '" . mysql_escape_string($newcats[$i]) . "', `sub_cat_id` = '" . $_GET["CatID"] . "'");
        }
        $i++;
    }
    header("Location: ViewCat.php?" . CCGetQueryString("QueryString", array()));
}
$itemcatcounts = get_catcounts($_GET["CatID"]);
if (!CCGetUserID() && $_GET["CatID"]) {
    $db = new CLSDBNetConnect();
    $query = "select * from categories where cat_id=" . $_GET["CatID"];
    $db->query($query);
    if ($db->next_record()) {
        if ($db->f("member") == 1) {
            CCSecurityRedirect("1;2", "login.php", "ViewCat.php", CCGetQueryString("QueryString", ""));
        }
    }
}
//End Include Common Files
$page = "Viewing Listings";
global $REMOTE_ADDR;
global $now;
$ip = $REMOTE_ADDR;
$timeout = $now["timeout"];
Esempio n. 16
0
function nop4_BeforeShow(&$sender)
{
    $nop4_BeforeShow = true;
    $Component =& $sender;
    $Container =& CCGetParentContainer($sender);
    global $nop4;
    //Compatibility
    //End nop4_BeforeShow
    //Custom Code @127-2A29BDB7
    // -------------------------
    $db = new clsDBconnection1();
    $sql = "select count(weekday(appointment_date)) as Thursday from result where (WEEKOFYEAR(curdate())) = WEEKOFYEAR(appointment_date) and weekday(appointment_date) = 3 and user_id=" . CCGetUserID();
    $db->query($sql);
    $Result3 = $db->next_record();
    $thur = $db->f('Thursday');
    if ($Result3) {
        $nop4->SetValue($thur);
    } else {
        $nop4->SetValue(0);
    }
    $db->close();
    // -------------------------
    //End Custom Code
    //Close nop4_BeforeShow @123-76F12FC9
    return $nop4_BeforeShow;
}
Esempio n. 17
0
<?php

$check_user_id = CCGetUserID();
if (empty($check_user_id)) {
    echo "<script>\r\n\t\t\ttop.top.location.href='" . $_SERVER["DOCUMENT_ROOT"] . "'/mpd\r\n\t\t</script>\r\n\t\t";
    exit;
}
 function Update()
 {
     global $CCSLocales;
     global $DefaultDateFormat;
     $this->CmdExecution = true;
     $this->cp["password"] = new clsSQLParameter("ctrlpassword_Shadow", ccsText, "", "", $this->password_Shadow->GetValue(true), NULL, false, $this->ErrorBlock);
     $wp = new clsSQLParameters($this->ErrorBlock);
     $wp->AddParameter("1", "expr13", ccsInteger, "", "", CCGetUserID(), "", false);
     if (!$wp->AllParamsSet()) {
         $this->Errors->addError($CCSLocales->GetText("CCS_CustomOperationError_MissingParameters"));
     }
     $this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeBuildUpdate", $this->Parent);
     if (!is_null($this->cp["password"]->GetValue()) and !strlen($this->cp["password"]->GetText()) and !is_bool($this->cp["password"]->GetValue())) {
         $this->cp["password"]->SetValue($this->password_Shadow->GetValue(true));
     }
     $wp->Criterion[1] = $wp->Operation(opEqual, "id", $wp->GetDBValue("1"), $this->ToSQL($wp->GetDBValue("1"), ccsInteger), false);
     $Where = $wp->Criterion[1];
     $this->UpdateFields["password"]["Value"] = $this->cp["password"]->GetDBValue(true);
     $this->SQL = CCBuildUpdate("alm_users", $this->UpdateFields, $this);
     $this->SQL .= strlen($Where) ? " WHERE " . $Where : $Where;
     $this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeExecuteUpdate", $this->Parent);
     if ($this->Errors->Count() == 0 && $this->CmdExecution) {
         $this->query($this->SQL);
         $this->CCSEventResult = CCGetEvent($this->CCSEvents, "AfterExecuteUpdate", $this->Parent);
     }
 }
Esempio n. 19
0
 function InsertRow()
 {
     global $ttlcal;
     global $ttldis;
     $this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeInsert");
     $this->ds->user_id->SetValue(CCGetUserID());
     $this->ds->date->SetValue(time());
     $this->ds->charge->SetValue(0 - $ttlcal);
     $this->ds->cause->SetValue($ttldis);
     $this->ds->Insert();
     $this->CCSEventResult = CCGetEvent($this->CCSEvents, "AfterInsert");
     if ($this->ds->Errors->Count() > 0) {
         echo "Error in Record " . $this->ComponentName . " / Insert Operation";
         $this->ds->Errors->Clear();
         $this->Errors->AddError("Database command error.");
     }
     return $this->Errors->Count() == 0;
 }
Esempio n. 20
0
function items_BeforeShow()
{
    //items_BeforeShow @4-10DCF469
    //Custom Code @7-2A29BDB7
    global $Tpl;
    global $itemvars;
    global $items;
    global $newvars;
    global $currency;
    global $emails1;
    global $joinJS;
    global $admingroup;
    global $editorCSS;
    global $PHP_SELF;
    if (CCGetFromGet("ItemNum", "") || CCGetFromGet("PreviewNum", "")) {
        $db = new clsDBNetConnect();
        $db->connect();
        $SQL = "SELECT * FROM items WHERE ItemNum=" . CCGetFromGet("ItemNum", "");
        if (CCGetFromGet("PreviewNum", "")) {
            $SQL = "SELECT * FROM items_preview WHERE ItemNum=" . CCGetFromGet("PreviewNum", "");
        }
        $db->query($SQL);
        $Result = $db->next_record();
        if ($Result) {
            $itemvars = array("ItemNum" => $db->f(ItemNum), "category" => $db->f(category), "user_id" => $db->f(user_id), "title" => $db->f(title), "status" => $db->f(status), "end_reason" => $db->f(end_reason), "started" => $db->f(started), "closes" => $db->f(closes), "image_preview" => $db->f(image_preview), "slide_show" => $db->f(slide_show), "counter" => $db->f(counter), "added_description" => $db->f("added_description"), "dateadded" => $db->f("dateadded"), "make_offer" => $db->f(make_offer), "image_one" => $db->f(image_one), "image_two" => $db->f(image_two), "image_three" => $db->f(image_three), "image_four" => $db->f(image_four), "image_five" => $db->f(image_five), "asking_price" => $db->f(asking_price), "quantity" => $db->f(quantity), "city_town" => $db->f(city_town), "state_province" => $db->f(state_province), "country" => $db->f("country"), "ship1" => $db->f("ship1"), "shipfee1" => $db->f("shipfee1"), "ship2" => $db->f("ship2"), "shipfee2" => $db->f("shipfee2"), "ship3" => $db->f("ship3"), "shipfee3" => $db->f("shipfee3"), "ship4" => $db->f("ship4"), "shipfee4" => $db->f("shipfee4"), "ship5" => $db->f("ship5"), "shipfee5" => $db->f("shipfee5"), "item_paypal" => $db->f("item_paypal"), "hits" => $db->f(hits));
            if (!CCGetUserID()) {
                $mustbe = "<table class=\"ct\" width=\"80%\" cellspacing=\"1\" cellpadding=\"1\">\n\n        <tr>\n\n          <td bgcolor=\"#ffffff\" align=\"middle\" valign=\"bottom\">\n            <form method=\"post\" action=\"login.php?ret_link=" . $_SERVER["REQUEST_URI"] . "&type=notLogged&ccsForm=Login\" name=\"Login\">\n\n              <font class=\"fhf\">Login To Ask A Question</font>\n\n              <table cellpadding=\"5\" cellspacing=\"1\" class=\"ft\">\n                <tr>\n\n                  <td></td>\n\n                </tr>\n\n                <tr>\n\n                  <td align=\"right\"><b>Username:</b>&nbsp;</td>\n\n                  <td align=\"left\"><input name=\"login\" value=\"\" maxlength=\"100\" class=\"input\">&nbsp;</td>\n\n                </tr>\n\n                <tr>\n\n                  <td align=\"right\"><b>Password:</b>&nbsp;</td>\n\n                  <td align=\"left\"><input type=\"password\" name=\"password\" value=\"\" maxlength=\"100\" class=\"input\">&nbsp;<a href=\"login.php\">Forgot Password</a></td>\n\n                </tr>\n\n                <tr>\n\n                  <td align=\"middle\" colspan=\"2\">\n\n                    <input name=\"DoLogin\" type=\"submit\" value=\"Login\" class=\"button\">&nbsp;</td>\n\n                </tr>\n\n                <tr>\n\n                   <td align=\"middle\" colspan=\"2\">\n\n                   New Users:&nbsp;<a href=\"register.php\">Register</a>\n\n                   </td>\n\n                </tr>\n\n              </table>\n\n            </form>\n\n           </td>\n\n        </tr>\n\n      </table>";
            }
            if (!CCGetUserID() && $itemvars["make_offer"] == 1) {
                $mustbeoffer = "<b>You must be logged in to make an offer</b>";
            }
            if (CCGetUserID() && $itemvars["status"] == 1 && $itemvars["item_paypal"] != "") {
                $Tpl->SetVar("item_paypal", "&nbsp;&nbsp;<a href=\"confirm.php?what=buynowPayPal&ItemNum=" . $itemvars["ItemNum"] . "\"><B>Buy Now</b></a>");
            }
            if (!CCGetUserID() && $itemvars["make_offer"] == 1 && $itemvars["status"] == 1 && $itemvars["item_paypal"] == "") {
                $Tpl->SetVar("makeoffer", "&nbsp;&nbsp;<a href=\"login.php?ret_link=ViewItem.php?ItemNum=" . $itemvars["ItemNum"] . "&type=notLogged\">Login to Make an Offer<a>");
                $Tpl->SetVar("item_paypal", "");
            }
            if (!CCGetUserID() && $itemvars["make_offer"] == 1 && $itemvars["status"] == 1 && $itemvars["item_paypal"] != "") {
                $Tpl->SetVar("makeoffer", "&nbsp;&nbsp;<a href=\"login.php?ret_link=ViewItem.php?ItemNum=" . $itemvars["ItemNum"] . "&type=notLogged\">Login to Buy this Item Or Make an Offer<a>");
                $Tpl->SetVar("item_paypal", "");
            }
            $Tpl->SetVar("NotLogged", $mustbe);
            $Tpl->SetVar("NotLogged2", $mustbeoffer);
            $ldb = new clsDBNetConnect();
            $ldb->connect();
            $ldb2 = new clsDBNetConnect();
            $ldb2->connect();
            $ldb3 = new clsDBNetConnect();
            $ldb3->connect();
            $ldb4 = new clsDBNetConnect();
            $ldb4->connect();
            $ldb5 = new clsDBNetConnect();
            $ldb5->connect();
            $ldb->query("SELECT name, sub_cat_id, cat_id FROM categories WHERE cat_id=" . $itemvars["category"]);
            if ($ldb->next_record()) {
                $newvars["catlist"] = "<a href=\"ViewCat.php?CatID=" . $ldb->f("cat_id") . "\">" . $ldb->f("name") . "</a>";
                $ldb2->query("SELECT name, sub_cat_id, cat_id FROM categories WHERE cat_id=" . $ldb->f("sub_cat_id"));
                if ($ldb2->next_record()) {
                    $newvars["catlist"] = "<a href=\"ViewCat.php?CatID=" . $ldb2->f("cat_id") . "\">" . $ldb2->f("name") . "</a> > " . $newvars["catlist"];
                    $ldb3->query("SELECT name, sub_cat_id, cat_id FROM categories WHERE cat_id=" . $ldb2->f("sub_cat_id"));
                    if ($ldb3->next_record()) {
                        $newvars["catlist"] = "<a href=\"ViewCat.php?CatID=" . $ldb3->f("cat_id") . "\">" . $ldb3->f("name") . "</a> > " . $newvars["catlist"];
                        $ldb4->query("SELECT name, sub_cat_id, cat_id FROM categories WHERE cat_id=" . $ldb3->f("sub_cat_id"));
                        if ($ldb4->next_record()) {
                            $newvars["catlist"] = "<a href=\"ViewCat.php?CatID=" . $ldb4->f("cat_id") . "\">" . $ldb4->f("name") . "</a> > " . $newvars["catlist"];
                            $ldb5->query("SELECT name, sub_cat_id, cat_id FROM categories WHERE cat_id=" . $ldb4->f("sub_cat_id"));
                            if ($ldb5->next_record()) {
                                $newvars["catlist"] = "<a href=\"ViewCat.php?CatID=" . $ldb5->f("cat_id") . "\">" . $ldb5->f("name") . "</a> > " . $newvars["catlist"];
                            }
                        }
                    }
                }
            }
            $newvars["category"] = CCDLookUP("name", "categories", "cat_id=" . $itemvars["category"], $db);
            $newvars["categoryid"] = CCDLookUP("sub_cat_id", "categories", "cat_id=" . $itemvars["category"], $db);
            $newvars["categoryparent"] = CCDLookUP("name", "categories", "cat_id=" . $newvars["categoryid"], $db);
            if ($newvars["categoryparent"]) {
                $newvars["categoryparent"] = "<a href=\"ViewCat.php?CatID=" . $newvars["categoryid"] . "\">" . $newvars["categoryparent"] . "</a> >> ";
            }
            $newvars["sellerid"] = $itemvars["user_id"];
            $newvars["seller"] = CCDLookUP("user_login", "users", "user_id=" . $itemvars["user_id"], $db);
            if ($itemvars["status"] == 1) {
                $newvars["status"] = "Open";
            }
            if ($itemvars["status"] == 2) {
                $newvars["status"] = "Closed";
            }
            if ($itemvars["status"] == 0) {
                $newvars["status"] = "This Item has not been started yet";
            }
            $newvars["preview_image"] = "<img src=\"images/blank.jpg\">";
            $newvars["cellbreaker2"] = "";
            $newvars["cellbreaker1"] = "</td><td class=\"data\">";
            //if(itemvars["image_preview"] == 1){
            if ($itemvars["image_five"] != "") {
                $newvars["preview_image"] = thumbnail($itemvars["image_five"], 225, 225, 0, 0);
                $newvars["cellbreaker2"] = "</td><td class=\"data\">";
                $newvars["cellbreaker1"] = "";
                $newvars["imageFive"] = "<tr><td align=\"center\"><img src=\"" . $itemvars["image_five"] . "\"></td></tr>";
            }
            if ($itemvars["image_four"] != "") {
                $newvars["preview_image"] = thumbnail($itemvars["image_four"], 225, 225, 0, 0);
                $newvars["cellbreaker2"] = "</td><td class=\"data\">";
                $newvars["cellbreaker1"] = "";
                $newvars["imageFour"] = "<tr><td align=\"center\"><img src=\"" . $itemvars["image_four"] . "\"></td></tr>";
            }
            if ($itemvars["image_three"] != "") {
                $newvars["preview_image"] = thumbnail($itemvars["image_three"], 225, 225, 0, 0);
                $newvars["cellbreaker2"] = "</td><td class=\"data\">";
                $newvars["cellbreaker1"] = "";
                $newvars["imageThree"] = "<tr><td align=\"center\"><img src=\"" . $itemvars["image_three"] . "\"></td></tr>";
            }
            if ($itemvars["image_two"] != "") {
                $newvars["preview_image"] = thumbnail($itemvars["image_two"], 225, 225, 0, 0);
                $newvars["cellbreaker2"] = "</td><td class=\"data\">";
                $newvars["cellbreaker1"] = "";
                $newvars["imageTwo"] = "<tr><td align=\"center\"><img src=\"" . $itemvars["image_two"] . "\"></td></tr>";
            }
            if ($itemvars["image_one"] != "") {
                $newvars["preview_image"] = thumbnail($itemvars["image_one"], 225, 225, 0, 0);
                $newvars["cellbreaker2"] = "</td><td class=\"data\">";
                $newvars["cellbreaker1"] = "";
                $newvars["imageOne"] = "<tr><td align=\"center\"><img src=\"" . $itemvars["image_one"] . "\"></td></tr>";
            }
            //}
            $javafirst = 0;
            $javalast = 0;
            if ($itemvars["image_five"] != "") {
                $imreturn = thumbnail($itemvars["image_five"], 225, 225, 0, 1);
                $imreturn2 = thumbnail($itemvars["image_five"], 100, 100, 0, 1);
                $imreturn3 = thumbnail($itemvars["image_five"], 350, 350, 0, 1);
                $sone = explode("^", $imreturn);
                $sone2 = explode("^", $imreturn2);
                $sone3 = explode("^", $imreturn3);
                if ($javalast == 0) {
                    $endatt = "\n";
                    $javalast = 1;
                } elseif ($javalast == 1) {
                    $endatt = ",\n";
                }
                $newvars["slidesrc"] = "\"{$sone['0']}\"" . $endatt . $newvars["slidesrc"];
                $newvars["slideht"] = "\"{$sone['1']}\"" . $endatt . $newvars["slideht"];
                $newvars["slidewt"] = "\"{$sone['2']}\"" . $endatt . $newvars["slidewt"];
                $newvars["slideht2"] = "\"{$sone2['1']}\"" . $endatt . $newvars["slideht2"];
                $newvars["slidewt2"] = "\"{$sone2['2']}\"" . $endatt . $newvars["slidewt2"];
                $newvars["slideht3"] = "\"{$sone3['1']}\"" . $endatt . $newvars["slideht3"];
                $newvars["slidewt3"] = "\"{$sone3['2']}\"" . $endatt . $newvars["slidewt3"];
                unset($imreturn);
                unset($sone);
            }
            if ($itemvars["image_four"] != "") {
                $imreturn = thumbnail($itemvars["image_four"], 225, 225, 0, 1);
                $imreturn2 = thumbnail($itemvars["image_four"], 100, 100, 0, 1);
                $imreturn3 = thumbnail($itemvars["image_four"], 350, 350, 0, 1);
                $sone = explode("^", $imreturn);
                $sone2 = explode("^", $imreturn2);
                $sone3 = explode("^", $imreturn3);
                if ($javalast == 0) {
                    $endatt = "\n";
                    $javalast = 1;
                } elseif ($javalast == 1) {
                    $endatt = ",\n";
                }
                $newvars["slidesrc"] = "\"{$sone['0']}\"" . $endatt . $newvars["slidesrc"];
                $newvars["slideht"] = "\"{$sone['1']}\"" . $endatt . $newvars["slideht"];
                $newvars["slidewt"] = "\"{$sone['2']}\"" . $endatt . $newvars["slidewt"];
                $newvars["slideht2"] = "\"{$sone2['1']}\"" . $endatt . $newvars["slideht2"];
                $newvars["slidewt2"] = "\"{$sone2['2']}\"" . $endatt . $newvars["slidewt2"];
                $newvars["slideht3"] = "\"{$sone3['1']}\"" . $endatt . $newvars["slideht3"];
                $newvars["slidewt3"] = "\"{$sone3['2']}\"" . $endatt . $newvars["slidewt3"];
                unset($imreturn);
                unset($sone);
            }
            if ($itemvars["image_three"] != "") {
                $imreturn = thumbnail($itemvars["image_three"], 225, 225, 0, 1);
                $imreturn2 = thumbnail($itemvars["image_three"], 100, 100, 0, 1);
                $imreturn3 = thumbnail($itemvars["image_three"], 350, 350, 0, 1);
                $sone = explode("^", $imreturn);
                $sone2 = explode("^", $imreturn2);
                $sone3 = explode("^", $imreturn3);
                if ($javalast == 0) {
                    $endatt = "\n";
                    $javalast = 1;
                } elseif ($javalast == 1) {
                    $endatt = ",\n";
                }
                $newvars["slidesrc"] = "\"{$sone['0']}\"" . $endatt . $newvars["slidesrc"];
                $newvars["slideht"] = "\"{$sone['1']}\"" . $endatt . $newvars["slideht"];
                $newvars["slidewt"] = "\"{$sone['2']}\"" . $endatt . $newvars["slidewt"];
                $newvars["slideht2"] = "\"{$sone2['1']}\"" . $endatt . $newvars["slideht2"];
                $newvars["slidewt2"] = "\"{$sone2['2']}\"" . $endatt . $newvars["slidewt2"];
                $newvars["slideht3"] = "\"{$sone3['1']}\"" . $endatt . $newvars["slideht3"];
                $newvars["slidewt3"] = "\"{$sone3['2']}\"" . $endatt . $newvars["slidewt3"];
                unset($imreturn);
                unset($sone);
            }
            if ($itemvars["image_two"] != "") {
                $imreturn = thumbnail($itemvars["image_two"], 225, 225, 0, 1);
                $imreturn2 = thumbnail($itemvars["image_two"], 100, 100, 0, 1);
                $imreturn3 = thumbnail($itemvars["image_two"], 350, 350, 0, 1);
                $sone = explode("^", $imreturn);
                $sone2 = explode("^", $imreturn2);
                $sone3 = explode("^", $imreturn3);
                if ($javalast == 0) {
                    $endatt = "\n";
                    $javalast = 1;
                } elseif ($javalast == 1) {
                    $endatt = ",\n";
                }
                $newvars["slidesrc"] = "\"{$sone['0']}\"" . $endatt . $newvars["slidesrc"];
                $newvars["slideht"] = "\"{$sone['1']}\"" . $endatt . $newvars["slideht"];
                $newvars["slidewt"] = "\"{$sone['2']}\"" . $endatt . $newvars["slidewt"];
                $newvars["slideht2"] = "\"{$sone2['1']}\"" . $endatt . $newvars["slideht2"];
                $newvars["slidewt2"] = "\"{$sone2['2']}\"" . $endatt . $newvars["slidewt2"];
                $newvars["slideht3"] = "\"{$sone3['1']}\"" . $endatt . $newvars["slideht3"];
                $newvars["slidewt3"] = "\"{$sone3['2']}\"" . $endatt . $newvars["slidewt3"];
                unset($imreturn);
                unset($sone);
            }
            if ($itemvars["image_one"] != "") {
                $imreturn = thumbnail($itemvars["image_one"], 225, 225, 0, 1);
                $imreturn2 = thumbnail($itemvars["image_one"], 100, 100, 0, 1);
                $imreturn3 = thumbnail($itemvars["image_one"], 350, 350, 0, 1);
                $sone = explode("^", $imreturn);
                $sone2 = explode("^", $imreturn2);
                $sone3 = explode("^", $imreturn3);
                if ($javalast == 0) {
                    $endatt = "\n";
                    $javalast = 1;
                } elseif ($javalast == 1) {
                    $endatt = ",\n";
                }
                $newvars["slidesrc"] = "\"{$sone['0']}\"" . $endatt . $newvars["slidesrc"];
                $newvars["slideht"] = "\"{$sone['1']}\"" . $endatt . $newvars["slideht"];
                $newvars["slidewt"] = "\"{$sone['2']}\"" . $endatt . $newvars["slidewt"];
                $newvars["slideht2"] = "\"{$sone2['1']}\"" . $endatt . $newvars["slideht2"];
                $newvars["slidewt2"] = "\"{$sone2['2']}\"" . $endatt . $newvars["slidewt2"];
                $newvars["slideht3"] = "\"{$sone3['1']}\"" . $endatt . $newvars["slideht3"];
                $newvars["slidewt3"] = "\"{$sone3['2']}\"" . $endatt . $newvars["slidewt3"];
                unset($imreturn);
                unset($sone);
            }
            if ($itemvars["slide_show"] == 1) {
                $sliderun = "1";
                $newvars["cellbreaker2"] = "</td><td class=\"data\">";
                $newvars["cellbreaker1"] = "";
                $newvars["preview_image"] = "<table width=\"235\" align=\"center\" valign=\"middle\" class=\"ct\" height=\"235\" border=\"1\"><tr><td align=\"center\" valign=\"middle\" class=\"ltdt\">" . $newvars["preview_image"] . "\n</td></tr>\n</table>\n<table class=\"ct\" width=\"235\"><tr bgcolor=\"#FFFFFF\">\n<td align=\"center\" width=\"33%\"><a href=\"javascript:chgImg(-1)\"><img src=\"images/prev.gif\" border=\"0\"></a></td>\n<td align=\"center\" width=\"33%\"><a href=\"javascript:auto()\"><img src=\"images/play.gif\" border=\"0\"></a></td>\n<td align=\"center\" width=\"33%\"><a href=\"javascript:chgImg(1)\"><img src=\"images/next.gif\" border=\"0\"></a></td>\n</tr>\n</table>";
            } elseif ($itemvars["image_preview"] == 1) {
                $sliderun = "0";
                $newvars["preview_image"] = "<table width=\"235\" align=\"center\" valign=\"middle\" class=\"ct\" height=\"235\" border=\"1\"><tr><td align=\"center\" valign=\"middle\" class=\"ltdt\">" . $newvars["preview_image"] . "\n</td></tr>\n</table>\n<table width=\"235\"><tr>\n<td align=\"right\"></td>\n<td align=\"center\"></td>\n<td align=\"left\"></td>\n</tr>\n</table>";
            } else {
                $sliderun = "0";
                $newvars["preview_image"] = "<img src=\"images/blank.jpg\">";
            }
            $theday = getdate($itemvars["started"]);
            $startdate = $theday["weekday"] . ", " . $theday["month"] . " " . $theday["mday"] . ", " . $theday["year"];
            $newvars["started"] = $startdate;
            unset($theday);
            $theday = getdate($itemvars["closes"]);
            $enddate = $theday["weekday"] . ", " . $theday["month"] . " " . $theday["mday"] . ", " . $theday["year"];
            $newvars["closes"] = $enddate;
            if ($itemvars["city_town"] != "") {
                $newvars["city_town"] = $itemvars["city_town"] . ", ";
            }
            if ($itemvars["make_offer"] == 0 || $itemvars["make_offer"] == "" || $itemvars["make_offer"] == NULL) {
                $emails1->Visible = false;
            }
            $newvars["thiscat"] = "<a href=\"ViewCat.php?CatID=" . $itemvars["category"] . "\">" . $newvars["category"] . "</a>";
            $hits = "";
            if ($itemvars["counter"] == 1) {
                $hits = $itemvars["hits"];
            }
            if ($itemvars["dateadded"] != "" and $itemvars["added_description"] != "") {
                $newvars["dateadded"] = "<b>On " . date("F j, Y", $itemvars["dateadded"]) . ", " . $newvars["seller"] . " added:";
            }
            if ($itemvars["country"] != "") {
                $cnt = new clsDBNetConnect();
                $cnt->connect();
                $countryi = CCDLookUP("country_desc", "lookup_countries", "country_id=" . $itemvars["country"], $cnt);
            }
            //*********************************//
            //Get Custom Category template Vars//
            //*********************************//
            $cats = "(";
            $db = new clsDBNetConnect();
            $query = "select * from categories where cat_id='" . $itemvars["category"] . "'";
            $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");
                                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 .= ")";
            }
            /////////////////////////////////
            //Send Custom TextArea Plugins //
            /////////////////////////////////
            $custtxt = new clsDBNetConnect();
            $query = "select * from custom_textarea where {$cats}";
            $custtxt->query($query);
            $queryfields = "(";
            $count = 0;
            while ($custtxt->next_record()) {
                if ($count > 0) {
                    $queryfields .= " or ";
                }
                $queryfields .= "field_id='" . $custtxt->f("id") . "'";
                $fields[$custtxt->f("id")] = $custtxt->f("template_var");
                $count++;
            }
            $queryfields .= ") and";
            if ($queryfields != "() and") {
                $query = "select * from custom_textarea_values where {$queryfields} ItemNum=" . $itemvars["ItemNum"];
                $custtxt->query($query);
                while ($custtxt->next_record()) {
                    //AdminEdit	abilities section
                    if ($admingroup) {
                        $editorCSS .= "\n#ta_" . $fields[$custtxt->f("field_id")] . "_" . $custtxt->f("field_id") . "_View {\n\nborder: 1px solid #fff;\n\npadding: top:8px;\n\nwidth: 500px;\n\nmax-width: 100%;\n\nvalign: center;\n\n}\n\n\n\n#ta_" . $fields[$custtxt->f("field_id")] . "_" . $custtxt->f("field_id") . "_View:hover {\n\n\tbackground-color: #ffcccc;\n\n\tborder-color: #ccc;\n\n}\n\n#ta_" . $fields[$custtxt->f("field_id")] . "_" . $custtxt->f("field_id") . "_Edit {\n\n\twidth: 100%;\n\n\tborder: 1px solid #fff;\n\n\tpadding: 1px;\n\n\tbackground-color: #eeeeee;\n\n\tvalign: center;\n\n}\n";
                        $joinJS .= "join(\"ta_" . $fields[$custtxt->f("field_id")] . "_" . $custtxt->f("field_id") . "_\", true)\n";
                        $Tpl->SetVar($fields[$custtxt->f("field_id")], "\n<DIV id=\"ta_" . $fields[$custtxt->f("field_id")] . "_" . $custtxt->f("field_id") . "_View\">\n" . stripslashes($custtxt->f("value")) . "\n</div>\n" . "<textarea id=\"ta_" . $fields[$custtxt->f("field_id")] . "_" . $custtxt->f("field_id") . "_Edit\" class=\"inplace\" tabindex=\"1\" name=\"ta_" . $fields[$custtxt->f("field_id")] . "_" . $custtxt->f("field_id") . "_Edit\"></textarea>\n");
                    } else {
                        $Tpl->SetVar($fields[$custtxt->f("field_id")], stripslashes($custtxt->f("value")));
                    }
                }
            }
            /////////////////////////////////
            //Send Custom TextBox Plugins  //
            /////////////////////////////////
            $fields = "";
            $custtxt = new clsDBNetConnect();
            $query = "select * from custom_textbox where {$cats}";
            $custtxt->query($query);
            $queryfields = "(";
            $count = 0;
            while ($custtxt->next_record()) {
                if ($count > 0) {
                    $queryfields .= " or ";
                }
                $queryfields .= "field_id='" . $custtxt->f("id") . "'";
                $fields[$custtxt->f("id")] = $custtxt->f("template_var");
                $count++;
            }
            $queryfields .= ") and";
            if ($queryfields != "() and") {
                $query = "select * from custom_textbox_values where {$queryfields} ItemNum=" . $itemvars["ItemNum"];
                $custtxt->query($query);
                while ($custtxt->next_record()) {
                    //AdminEdit	abilities section
                    if ($admingroup) {
                        $editorCSS .= "\n#tb_" . $fields[$custtxt->f("field_id")] . "_" . $custtxt->f("field_id") . "_View {\n\nborder: 1px solid #fff;\n\npadding: top:8px;\n\nwidth: 500px;\n\nmax-width: 100%;\n\nvalign: center;\n\n}\n\n\n\n#tb_" . $fields[$custtxt->f("field_id")] . "_" . $custtxt->f("field_id") . "_View:hover {\n\n\tbackground-color: #ffcccc;\n\n\tborder-color: #ccc;\n\n}\n\n#tb_" . $fields[$custtxt->f("field_id")] . "_" . $custtxt->f("field_id") . "_Edit {\n\n\twidth: 100%;\n\n\tborder: 1px solid #fff;\n\n\tpadding: 1px;\n\n\tbackground-color: #eeeeee;\n\n\tvalign: center;\n\n}\n";
                        $joinJS .= "join(\"tb_" . $fields[$custtxt->f("field_id")] . "_" . $custtxt->f("field_id") . "_\", true)\n";
                        $Tpl->SetVar($fields[$custtxt->f("field_id")], "\n<DIV id=\"tb_" . $fields[$custtxt->f("field_id")] . "_" . $custtxt->f("field_id") . "_View\">\n" . stripslashes($custtxt->f("value")) . "\n</div>\n" . "<textarea id=\"tb_" . $fields[$custtxt->f("field_id")] . "_" . $custtxt->f("field_id") . "_Edit\" class=\"inplace\" tabindex=\"1\" name=\"tb_" . $fields[$custtxt->f("field_id")] . "_" . $custtxt->f("field_id") . "_Edit\"></textarea>\n");
                    } else {
                        $Tpl->SetVar($fields[$custtxt->f("field_id")], stripslashes($custtxt->f("value")));
                    }
                }
            }
            //////////////////////////////////
            //Send Custom DropDown Plugins  //
            //////////////////////////////////
            $fields = "";
            $custtxt = new clsDBNetConnect();
            $query = "select * from custom_dropdown where {$cats}";
            $custtxt->query($query);
            $queryfields = "(";
            $count = 0;
            while ($custtxt->next_record()) {
                if ($count > 0) {
                    $queryfields .= " or ";
                }
                $queryfields .= "field_id='" . $custtxt->f("id") . "'";
                $fields[$custtxt->f("id")] = $custtxt->f("template_var");
                $count++;
            }
            $queryfields .= ")";
            if ($queryfields != "()") {
                $query = "select * from custom_dropdown_options where {$queryfields}";
                $custtxt->query($query);
                while ($custtxt->next_record()) {
                    $value[$custtxt->f("id")] = $custtxt->f("option");
                }
                $queryfields .= " and";
                $query = "select * from custom_dropdown_values where {$queryfields} ItemNum=" . $itemvars["ItemNum"];
                $custtxt->query($query);
                while ($custtxt->next_record()) {
                    $Tpl->SetVar($fields[$custtxt->f("field_id")], stripslashes($value[$custtxt->f("option_id")]));
                }
            }
            if ($itemvars["ship1"]) {
                $Tpl->SetBlockVar("shipping", "");
                $i = 1;
                $ship = "";
                while ($itemvars["ship{$i}"]) {
                    $ship .= "\t\t\t<tr>\n";
                    //ADMIN EDIT ABILITY SECTION
                    if ($admingroup) {
                        $editorCSS .= "\n#ship" . $i . "View {\n\nborder: 1px solid #fff;\n\npadding: top:8px;\n\nwidth: 500px;\n\nmax-width: 100%;\n\nvalign: center;\n\n}\n\n\n\n#ship" . $i . "View:hover {\n\n\tbackground-color: #ffcccc;\n\n\tborder-color: #ccc;\n\n}\n\n#ship" . $i . "Edit {\n\n\twidth: 100%;\n\n\tborder: 1px solid #fff;\n\n\tpadding: 1px;\n\n\tbackground-color: #eeeeee;\n\n\tvalign: center;\n\n}\n";
                        $editorCSS .= "\n#shipfee" . $i . "View {\n\nborder: 1px solid #fff;\n\npadding: top:8px;\n\nwidth: 500px;\n\nmax-width: 100%;\n\nvalign: center;\n\n}\n\n\n\n#shipfee" . $i . "View:hover {\n\n\tbackground-color: #ffcccc;\n\n\tborder-color: #ccc;\n\n}\n\n#shipfee" . $i . "Edit {\n\n\twidth: 100%;\n\n\tborder: 1px solid #fff;\n\n\tpadding: 1px;\n\n\tbackground-color: #eeeeee;\n\n\tvalign: center;\n\n}\n";
                        $joinJS .= "join(\"shipfee" . $i . "\", true)\n";
                        $joinJS .= "join(\"ship" . $i . "\", true)\n";
                        $ship .= "\t\t\t\t<td width=\"20%\">";
                        $ship .= "\n<DIV id=\"ship" . $i . "View\">\n" . $itemvars["ship{$i}"] . "\n</div>\n" . "<textarea id=\"ship" . $i . "Edit\" class=\"inplace\" tabindex=\"1\" name=\"ship" . $i . "Edit\"></textarea>\n";
                        $ship .= "</td>\n";
                        $ship .= "\t\t\t\t<td width=\"80%\">";
                        $ship .= "\n<DIV id=\"shipfee" . $i . "View\">\n" . $itemvars["shipfee{$i}"] . "\n</div>\n" . "<textarea id=\"shipfee" . $i . "Edit\" class=\"inplace\" tabindex=\"1\" name=\"shipfee" . $i . "Edit\"></textarea>\n";
                        $ship .= "</td>\n";
                    } else {
                        ///NOT ADMIN EDITABLE
                        $ship .= "\t\t\t\t<td width=\"20%\">" . $itemvars["ship{$i}"] . "</td>\n";
                        $ship .= "\t\t\t\t<td width=\"80%\">" . $itemvars["shipfee{$i}"] . "</td>\n";
                    }
                    $ship .= "\t\t\t</tr>\n";
                    $i++;
                }
                $Tpl->setVar("shippingoptions", $ship);
                $Tpl->parse("shipping", "");
            }
            $subsc_memb = subscription_membership($newvars["sellerid"], "icontext", "&nbsp;&nbsp;");
            if ($_GET["PreviewNum"]) {
                $Tpl->setblockvar("Preview", "");
                $Tpl->setvar("finalcat", $itemvars["category"]);
                $Tpl->setvar("ItemNum", $itemvars["ItemNum"]);
                $Tpl->parse("Preview", True);
            }
            if ($admingroup) {
                //Title AdminEdit
                $editorCSS .= "\n.inspector {\n\tfont-size: 11px;\n}\n\n#titleView {\n\nborder: 1px solid #fff;\n\npadding: top:8px;\n\nwidth: 500px;\n\nmax-width: 100%;\n\nvalign: center;\n\n}\n\n\n\n#titleView:hover {\n\n\tbackground-color: #ffcccc;\n\n\tborder-color: #ccc;\n\n}\n\n#titleEdit {\n\n\twidth: 100%;\n\n\tborder: 1px solid #fff;\n\n\tpadding: 1px;\n\n\tbackground-color: #eeeeee;\n\n\tvalign: center;\n\n}\n";
                $joinJS .= "join(\"title\", true)\n";
                $itemvars["title2"] = "\n<DIV id=\"titleView\">\n" . $itemvars["title"] . "\n</div>\n" . "<textarea id=\"titleEdit\" class=\"inplace\" tabindex=\"1\" name=\"titleEdit\"></textarea>\n";
                //Added Description AdminEdit
                if ($itemvars["added_description"]) {
                    $editorCSS .= "\n#added_descriptionView {\n\nborder: 1px solid #fff;\n\npadding: top:8px;\n\nwidth: 500px;\n\nmax-width: 100%;\n\nvalign: center;\n\n}\n\n\n\n#added_descriptionView:hover {\n\n\tbackground-color: #ffcccc;\n\n\tborder-color: #ccc;\n\n}\n\n#added_descriptionEdit {\n\n\twidth: 100%;\n\n\tborder: 1px solid #fff;\n\n\tpadding: 1px;\n\n\tbackground-color: #eeeeee;\n\n\tvalign: center;\n\n}\n";
                    $joinJS .= "join(\"added_description\", true)\n";
                    $itemvars["added_description"] = "\n<DIV id=\"added_descriptionView\">\n" . $itemvars["added_description"] . "\n</div>\n" . "<textarea id=\"added_descriptionEdit\" class=\"inplace\" tabindex=\"1\" name=\"added_descriptionEdit\"></textarea>\n";
                }
                //Asking Price AdminEdit
                $editorCSS .= "\n#asking_priceView {\n\nborder: 1px solid #fff;\n\npadding: top:8px;\n\nwidth: 500px;\n\nmax-width: 100%;\n\nvalign: center;\n\n}\n\n\n\n#asking_priceView:hover {\n\n\tbackground-color: #ffcccc;\n\n\tborder-color: #ccc;\n\n}\n\n#asking_priceEdit {\n\n\twidth: 100%;\n\n\tborder: 1px solid #fff;\n\n\tpadding: 1px;\n\n\tbackground-color: #eeeeee;\n\n\tvalign: center;\n\n}\n";
                $joinJS .= "join(\"asking_price\", true)\n";
                $itemvars["asking_price"] = "\n<DIV id=\"asking_priceView\">\n" . $itemvars["asking_price"] . "\n</div>\n" . "<textarea id=\"asking_priceEdit\" class=\"inplace\" tabindex=\"1\" name=\"asking_priceEdit\"></textarea>\n";
                //City_Town AdminEdit
                $editorCSS .= "\n#city_townView {\n\nborder: 1px solid #fff;\n\npadding: top:8px;\n\nwidth: 500px;\n\nmax-width: 100%;\n\nvalign: center;\n\n}\n\n\n\n#city_townView:hover {\n\n\tbackground-color: #ffcccc;\n\n\tborder-color: #ccc;\n\n}\n\n#city_townEdit {\n\n\twidth: 100%;\n\n\tborder: 1px solid #fff;\n\n\tpadding: 1px;\n\n\tbackground-color: #eeeeee;\n\n\tvalign: center;\n\n}\n";
                $joinJS .= "join(\"city_town\", true)\n";
                $newvars["city_town"] = "\n<DIV id=\"city_townView\">\n" . $itemvars["city_town"] . "\n</div>\n" . "<textarea id=\"city_townEdit\" class=\"inplace\" tabindex=\"1\" name=\"city_townEdit\"></textarea>\n";
                //State_Province AdminEdit
                $editorCSS .= "\n#state_provinceView {\n\nborder: 1px solid #fff;\n\npadding: top:8px;\n\nwidth: 500px;\n\nmax-width: 100%;\n\nvalign: center;\n\n}\n\n\n\n#state_provinceView:hover {\n\n\tbackground-color: #ffcccc;\n\n\tborder-color: #ccc;\n\n}\n\n#state_provinceEdit {\n\n\twidth: 100%;\n\n\tborder: 1px solid #fff;\n\n\tpadding: 1px;\n\n\tbackground-color: #eeeeee;\n\n\tvalign: center;\n\n}\n";
                $joinJS .= "join(\"state_province\", true)\n";
                $itemvars["state_province"] = "\n<DIV id=\"state_provinceView\">\n" . $itemvars["state_province"] . "\n</div>\n" . "<textarea id=\"state_provinceEdit\" class=\"inplace\" tabindex=\"1\" name=\"state_provinceEdit\"></textarea>\n";
                //quantity AdminEdit
                $editorCSS .= "\n#quantityView {\n\nborder: 1px solid #fff;\n\npadding: top:8px;\n\nwidth: 500px;\n\nmax-width: 100%;\n\nvalign: center;\n\n}\n\n\n\n#quantityView:hover {\n\n\tbackground-color: #ffcccc;\n\n\tborder-color: #ccc;\n\n}\n\n#quantityEdit {\n\n\twidth: 100%;\n\n\tborder: 1px solid #fff;\n\n\tpadding: 1px;\n\n\tbackground-color: #eeeeee;\n\n\tvalign: center;\n\n}\n";
                $joinJS .= "join(\"quantity\", true)\n";
                $itemvars["quantity"] = "\n<DIV id=\"quantityView\">\n" . $itemvars["quantity"] . "\n</div>\n" . "<textarea id=\"quantityEdit\" class=\"inplace\" tabindex=\"1\" name=\"quantityEdit\"></textarea>\n";
                $catoptions = "";
                $catlist = new clsDBNetConnect();
                $catlist->query("select * from categories where sub_cat_id=1");
                while ($catlist->next_record()) {
                    if ($itemvars["category"] == $catlist->f("cat_id")) {
                        $selected = " selected";
                    }
                    $catoptions .= "<option value=\"" . $catlist->f("cat_id") . "\"{$selected}>" . $catlist->f("name") . "</option>";
                    $selected = "";
                    $catlist2 = new clsDBNetConnect();
                    $catlist2->query("select * from categories where sub_cat_id=" . $catlist->f("cat_id"));
                    while ($catlist2->next_record()) {
                        if ($itemvars["category"] == $catlist2->f("cat_id")) {
                            $selected = " selected";
                        }
                        $catoptions .= "<option value=\"" . $catlist2->f("cat_id") . "\"{$selected}>--" . $catlist2->f("name") . "</option>";
                        $selected = "";
                        $catlist3 = new clsDBNetConnect();
                        $catlist3->query("select * from categories where sub_cat_id=" . $catlist2->f("cat_id"));
                        while ($catlist3->next_record()) {
                            if ($itemvars["category"] == $catlist3->f("cat_id")) {
                                $selected = " selected";
                            }
                            $catoptions .= "<option value=\"" . $catlist3->f("cat_id") . "\"{$selected}>----" . $catlist3->f("name") . "</option>";
                            $selected = "";
                            $catlist4 = new clsDBNetConnect();
                            $catlist4->query("select * from categories where sub_cat_id=" . $catlist3->f("cat_id"));
                            while ($catlist4->next_record()) {
                                if ($itemvars["category"] == $catlist4->f("cat_id")) {
                                    $selected = " selected";
                                }
                                $catoptions .= "<option value=\"" . $catlist4->f("cat_id") . "\"{$selected}>------" . $catlist4->f("name") . "</option>";
                                $selected = "";
                                $catlist5 = new clsDBNetConnect();
                                $catlist5->query("select * from categories where sub_cat_id=" . $catlist4->f("cat_id"));
                                while ($catlist5->next_record()) {
                                    if ($itemvars["category"] == $catlist5->f("cat_id")) {
                                        $selected = " selected";
                                    }
                                    $catoptions .= "<option value=\"" . $catlist5->f("cat_id") . "\"{$selected}>--------" . $catlist5->f("name") . "</option>";
                                    $selected = "";
                                    $catlist6 = new clsDBNetConnect();
                                    $catlist6->query("select * from categories where sub_cat_id=" . $catlist5->f("cat_id"));
                                    while ($catlist6->next_record()) {
                                        if ($itemvars["category"] == $catlist6->f("cat_id")) {
                                            $selected = " selected";
                                        }
                                        $catoptions .= "<option value=\"" . $catlist6->f("cat_id") . "\"{$selected}>----------" . $catlist6->f("name") . "</option>";
                                        $selected = "";
                                    }
                                }
                            }
                        }
                    }
                }
                $QueryString = CCGetQueryString("QueryString", array());
                $AdminMenu = <<<EOD
    
<script>
\t\tfunction toggleDisplayadminrow() {
\t\t\tif (document.getElementById) {
\t\t\t\tif(document.getElementById("adminrow").style.display=="block") {
\t\t\t\t\tdocument.getElementById("adminrow").style.display="none";
\t\t\t\t\tdocument.getElementById("adminrow_icon").src="images/expand.gif";
\t\t\t\t}
\t\t\t\telse {
\t\t\t\t\tdocument.getElementById("adminrow").style.display="block";
\t\t\t\t\tdocument.getElementById("adminrow_icon").src="images/minimize.gif";
\t\t\t\t}
\t\t\t}
\t\t}
\t</script>
\t<table width="100%" border="0">
\t<tr><td>
\t<img id="adminrow_icon" src="images/expand.gif" width="16" height="16" onclick="javascript:toggleDisplayadminrow();" onmouseover="javascript:this.style.cursor='hand';"><b> -- Expand FrontEnd Admin Menu</b>
\t</td></tr>
\t<table id="adminrow" style="display:none;" width="100%">
\t<tr><td>
\t<form name="AdminMenu" method="POST" action="ViewItem.php?{$QueryString}">
\tMove Item to Categories: <select name="movecategory">{$catoptions}</select><br>
\t<br><input class="inspector" type="submit" value="Move to Selected Category" name="saveMoveCats"/>
\t</form>
\tOther 'In Place' edits on this page:  Most Fields on this Page can be Double Clicked and Edited.
\t<ul><li><b>Edit-In-Place - </b>The majority of the text fields on this page can be edited in place, just double click on them, then click 'Save Changes'<br>
\tThe 'Title', 'Quantity', 'Asking Price', 'Location', 'Description', 'Added Description', 'Shipping Options', and 'Custom Text Area/Box' fields can be edited here, any other fileds must be edited from the Listings section in siteadmin.</li>
\t</ul><hr>
\t</td></tr></table>
\t</table>
EOD;
                $savebutton = <<<EOD
\t<tr>
      <td align="center" colspan="2">
  \t  <input type="submit" name="SaveChanges" title="Save Changes" value="Save Changes">
  \t  </td>
  \t</tr>
EOD;
                if ($itemvars["status"] == 99) {
                    $approve = <<<EOD
\t\t<tr>
      \t\t<td align="center" colspan="2" bgcolor="lightgrey">
  \t  \t\t<a href="ViewItem.php?{$QueryString}&approved=1">CLICK HERE TO MARK THIS LISTING AS 'APPROVED' AND START IT</a>
  \t  \t\t</td>
  \t\t</tr>
EOD;
                }
                $Tpl->SetVar("approve", $approve);
                $Tpl->SetVar("SaveButton", $savebutton);
                $Tpl->SetVar("AdminMenu", $AdminMenu);
            }
            $Tpl->SetVar("make_offer_form", $outform);
            $Tpl->SetVar("added_description", $itemvars["added_description"]);
            $Tpl->SetVar("dateadded", $newvars["dateadded"]);
            $Tpl->SetVar("title", $itemvars["title"]);
            $Tpl->SetVar("title2", $itemvars["title2"]);
            $Tpl->SetVar("categoryparent", $newvars["catlist"]);
            $Tpl->SetVar("ItemNum", $itemvars["ItemNum"]);
            $Tpl->SetVar("category", $newvars["category"]);
            $Tpl->SetVar("thiscat", "");
            $Tpl->SetVar("askingprice", $itemvars["asking_price"]);
            $Tpl->SetVar("quantity", $itemvars["quantity"]);
            $Tpl->SetVar("seller", $newvars["seller"]);
            $Tpl->SetVar("sellerid", $newvars["sellerid"]);
            $Tpl->SetVar("UserRating", "<a href=\"Feedback.php?user_id=" . $newvars["sellerid"] . "\">(" . Getfeedbacktotal($newvars["sellerid"]) . ")</a>");
            $Tpl->SetVar("subscriptions", $subsc_memb);
            $Tpl->SetVar("end_reason", $itemvars["end_reason"]);
            $Tpl->SetVar("started", $newvars["started"]);
            $Tpl->SetVar("closes", $newvars["closes"]);
            $Tpl->SetVar("initial_image", $newvars["preview_image"]);
            $Tpl->SetVar("cellbreaker1", $newvars["cellbreaker1"]);
            $Tpl->SetVar("cellbreaker2", $newvars["cellbreaker2"]);
            $Tpl->SetVar("city_town", $newvars["city_town"]);
            $Tpl->SetVar("state_province", $itemvars["state_province"]);
            $Tpl->SetVar("country", $countryi);
            $Tpl->SetVar("hits", $hits);
            $Tpl->SetVar("status", $newvars["status"]);
            $Tpl->SetVar("imageOne", $newvars["imageOne"]);
            $Tpl->SetVar("imageTwo", $newvars["imageTwo"]);
            $Tpl->SetVar("imageThree", $newvars["imageThree"]);
            $Tpl->SetVar("imageFour", $newvars["imageFour"]);
            $Tpl->SetVar("imageFive", $newvars["imageFive"]);
            $Tpl->SetVar("imgarray", $newvars["slidesrc"]);
            $Tpl->SetVar("imgarrayht", $newvars["slideht"]);
            $Tpl->SetVar("imgarraywd", $newvars["slidewt"]);
            $Tpl->SetVar("imgarrayht2", $newvars["slideht2"]);
            $Tpl->SetVar("imgarraywd2", $newvars["slidewt2"]);
            $Tpl->SetVar("imgarrayht3", $newvars["slideht3"]);
            $Tpl->SetVar("imgarraywd3", $newvars["slidewt3"]);
            $Tpl->SetVar("Loader", $sliderun);
            //{imageOne}{imageTwo}{imageThree}{imageFour}{imageFive} //HTML Usage
            unset($db);
            unset($SQL);
            unset($Result);
            $itemvars["hits"]++;
            $db = new clsDBNetConnect();
            $db->connect();
            if (CCGetFromGet("ItemNum", "")) {
                $SQL = "UPDATE items SET hits=" . $itemvars["hits"] . " WHERE ItemNum=" . $itemvars["ItemNum"];
                $db->query($SQL);
            }
            unset($db);
            unset($SQL);
        }
    }
    //End Custom Code
}
function contacts_maintcontent_alm_customers_contacts_BeforeUpdate(&$sender)
{
    $contacts_maintcontent_alm_customers_contacts_BeforeUpdate = true;
    $Component =& $sender;
    $Container =& CCGetParentContainer($sender);
    global $contacts_maintcontent;
    //Compatibility
    //End contacts_maintcontent_alm_customers_contacts_BeforeUpdate
    //Custom Code @30-2A29BDB7
    // -------------------------
    // Write your own code here.
    $contacts_maintcontent->alm_customers_contacts->modified_iduser->SetValue(CCGetUserID());
    $preferred_color = CCGetFromPost("preferred_color", array());
    $preferred_color_list = "";
    foreach ($preferred_color as $color) {
        $preferred_color_list .= $color . ",";
    }
    $hobbies = CCGetFromPost("hobbies", array());
    $hobbies_list = "";
    foreach ($hobbies as $hobby) {
        $hobbies_list .= $hobby . ",";
    }
    $notify_holidays = CCGetFromPost("notify_holidays", array());
    $notify_holidays_list = "";
    foreach ($notify_holidays as $holiday) {
        $notify_holidays_list .= $holiday . ",";
    }
    $contacts_maintcontent->alm_customers_contacts->preferred_color->SetValue($preferred_color_list);
    $contacts_maintcontent->alm_customers_contacts->hidhobbies->SetValue($hobbies_list);
    $contacts_maintcontent->alm_customers_contacts->notify_holidays->SetValue($notify_holidays_list);
    // -------------------------
    //End Custom Code
    //Close contacts_maintcontent_alm_customers_contacts_BeforeUpdate @2-B83BE41A
    return $contacts_maintcontent_alm_customers_contacts_BeforeUpdate;
}
Esempio n. 22
0
 function clsRecordV_SUBMITTER($RelativePath, &$Parent)
 {
     global $FileName;
     global $CCSLocales;
     global $DefaultDateFormat;
     $this->Visible = true;
     $this->Parent =& $Parent;
     $this->RelativePath = $RelativePath;
     $this->Errors = new clsErrors();
     $this->ErrorBlock = "Record V_SUBMITTER/Error";
     $this->DataSource = new clsV_SUBMITTERDataSource($this);
     $this->ds =& $this->DataSource;
     $this->ReadAllowed = true;
     if ($this->Visible) {
         $this->ComponentName = "V_SUBMITTER";
         $this->Attributes = new clsAttributes($this->ComponentName . ":");
         $CCSForm = explode(":", CCGetFromGet("ccsForm", ""), 2);
         if (sizeof($CCSForm) == 1) {
             $CCSForm[1] = "";
         }
         list($FormName, $FormMethod) = $CCSForm;
         $this->EditMode = $FormMethod == "Edit";
         $this->FormEnctype = "application/x-www-form-urlencoded";
         $this->FormSubmitted = $FormName == $this->ComponentName;
         $Method = $this->FormSubmitted ? ccsPost : ccsGet;
         $this->Button_Update =& new clsButton("Button_Update", $Method, $this);
         $this->Button_Delete =& new clsButton("Button_Delete", $Method, $this);
         $this->SUBMIT_DATE =& new clsControl(ccsTextBox, "SUBMIT_DATE", "SUBMIT_DATE", ccsText, "", CCGetRequestParam("SUBMIT_DATE", $Method, NULL), $this);
         $this->INTERACTIVE_MESSAGE =& new clsControl(ccsTextArea, "INTERACTIVE_MESSAGE", "INTERACTIVE_MESSAGE", ccsText, "", CCGetRequestParam("INTERACTIVE_MESSAGE", $Method, NULL), $this);
         $this->SENT_MESSAGE =& new clsControl(ccsTextArea, "SENT_MESSAGE", "SENT_MESSAGE", ccsText, "", CCGetRequestParam("SENT_MESSAGE", $Method, NULL), $this);
         $this->ERROR_MESSAGE =& new clsControl(ccsTextArea, "ERROR_MESSAGE", "ERROR_MESSAGE", ccsText, "", CCGetRequestParam("ERROR_MESSAGE", $Method, NULL), $this);
         $this->WARNING =& new clsControl(ccsTextArea, "WARNING", "WARNING", ccsText, "", CCGetRequestParam("WARNING", $Method, NULL), $this);
         $this->CURR_DOC_ID =& new clsControl(ccsTextBox, "CURR_DOC_ID", "CURR_DOC_ID", ccsFloat, "", CCGetRequestParam("CURR_DOC_ID", $Method, NULL), $this);
         $this->CURR_DOC_TYPE_ID =& new clsControl(ccsTextBox, "CURR_DOC_TYPE_ID", "CURR_DOC_TYPE_ID", ccsFloat, "", CCGetRequestParam("CURR_DOC_TYPE_ID", $Method, NULL), $this);
         $this->CURR_PROC_ID =& new clsControl(ccsTextBox, "CURR_PROC_ID", "CURR_PROC_ID", ccsFloat, "", CCGetRequestParam("CURR_PROC_ID", $Method, NULL), $this);
         $this->CURR_CTL_ID =& new clsControl(ccsTextBox, "CURR_CTL_ID", "CURR_CTL_ID", ccsFloat, "", CCGetRequestParam("CURR_CTL_ID", $Method, NULL), $this);
         $this->PREV_DOC_ID =& new clsControl(ccsTextBox, "PREV_DOC_ID", "PREV_DOC_ID", ccsFloat, "", CCGetRequestParam("PREV_DOC_ID", $Method, NULL), $this);
         $this->PREV_DOC_TYPE_ID =& new clsControl(ccsTextBox, "PREV_DOC_TYPE_ID", "PREV_DOC_TYPE_ID", ccsFloat, "", CCGetRequestParam("PREV_DOC_TYPE_ID", $Method, NULL), $this);
         $this->PREV_PROC_ID =& new clsControl(ccsTextBox, "PREV_PROC_ID", "PREV_PROC_ID", ccsFloat, "", CCGetRequestParam("PREV_PROC_ID", $Method, NULL), $this);
         $this->PREV_CTL_ID =& new clsControl(ccsTextBox, "PREV_CTL_ID", "PREV_CTL_ID", ccsFloat, "", CCGetRequestParam("PREV_CTL_ID", $Method, NULL), $this);
         $this->SLOT_1 =& new clsControl(ccsTextBox, "SLOT_1", "SLOT_1", ccsText, "", CCGetRequestParam("SLOT_1", $Method, NULL), $this);
         $this->SLOT_2 =& new clsControl(ccsTextBox, "SLOT_2", "SLOT_2", ccsText, "", CCGetRequestParam("SLOT_2", $Method, NULL), $this);
         $this->SLOT_3 =& new clsControl(ccsTextBox, "SLOT_3", "SLOT_3", ccsText, "", CCGetRequestParam("SLOT_3", $Method, NULL), $this);
         $this->SLOT_4 =& new clsControl(ccsTextBox, "SLOT_4", "SLOT_4", ccsText, "", CCGetRequestParam("SLOT_4", $Method, NULL), $this);
         $this->SLOT_5 =& new clsControl(ccsTextBox, "SLOT_5", "SLOT_5", ccsText, "", CCGetRequestParam("SLOT_5", $Method, NULL), $this);
         $this->USER_ID_DOC =& new clsControl(ccsTextBox, "USER_ID_DOC", "USER_ID_DOC", ccsFloat, "", CCGetRequestParam("USER_ID_DOC", $Method, NULL), $this);
         $this->USER_ID_DONOR =& new clsControl(ccsTextBox, "USER_ID_DONOR", "USER_ID_DONOR", ccsFloat, "", CCGetRequestParam("USER_ID_DONOR", $Method, NULL), $this);
         $this->USER_ID_LOGIN =& new clsControl(ccsTextBox, "USER_ID_LOGIN", "USER_ID_LOGIN", ccsFloat, "", CCGetRequestParam("USER_ID_LOGIN", $Method, NULL), $this);
         $this->USER_ID_TAKEN =& new clsControl(ccsTextBox, "USER_ID_TAKEN", "USER_ID_TAKEN", ccsFloat, "", CCGetRequestParam("USER_ID_TAKEN", $Method, NULL), $this);
         $this->IS_CREATE_DOC =& new clsControl(ccsTextBox, "IS_CREATE_DOC", "IS_CREATE_DOC", ccsText, "", CCGetRequestParam("IS_CREATE_DOC", $Method, NULL), $this);
         $this->IS_MANUAL =& new clsControl(ccsTextBox, "IS_MANUAL", "IS_MANUAL", ccsText, "", CCGetRequestParam("IS_MANUAL", $Method, NULL), $this);
         $this->CURR_PROC_STATUS =& new clsControl(ccsTextBox, "CURR_PROC_STATUS", "CURR_PROC_STATUS", ccsText, "", CCGetRequestParam("CURR_PROC_STATUS", $Method, NULL), $this);
         $this->CURR_DOC_STATUS =& new clsControl(ccsTextBox, "CURR_DOC_STATUS", "CURR_DOC_STATUS", ccsText, "", CCGetRequestParam("CURR_DOC_STATUS", $Method, NULL), $this);
         $this->MESSAGE =& new clsControl(ccsTextBox, "MESSAGE", "MESSAGE", ccsText, "", CCGetRequestParam("MESSAGE", $Method, NULL), $this);
         $this->IS_VIEW_ONLY =& new clsControl(ccsTextBox, "IS_VIEW_ONLY", "IS_VIEW_ONLY", ccsText, "", CCGetRequestParam("IS_VIEW_ONLY", $Method, NULL), $this);
         $this->JENIS =& new clsControl(ccsTextBox, "JENIS", "JENIS", ccsText, "", CCGetRequestParam("JENIS", $Method, NULL), $this);
         $this->RETURN_MESSAGE =& new clsControl(ccsTextBox, "RETURN_MESSAGE", "RETURN_MESSAGE", ccsText, "", CCGetRequestParam("RETURN_MESSAGE", $Method, NULL), $this);
         $this->lusername =& new clsControl(ccsLabel, "lusername", "lusername", ccsText, "", CCGetRequestParam("lusername", $Method, NULL), $this);
         $this->SUBMITTER_ID =& new clsControl(ccsTextBox, "SUBMITTER_ID", "SUBMITTER_ID", ccsFloat, "", CCGetRequestParam("SUBMITTER_ID", $Method, NULL), $this);
         $this->NTASK =& new clsControl(ccsLabel, "NTASK", "NTASK", ccsText, "", CCGetRequestParam("NTASK", $Method, NULL), $this);
         $this->NTASK->HTML = true;
         $this->STS =& new clsControl(ccsListBox, "STS", "STS", ccsFloat, "", CCGetRequestParam("STS", $Method, NULL), $this);
         $this->STS->DSType = dsSQL;
         $this->STS->DataSource = new clsDBConnSIKP();
         $this->STS->ds =& $this->STS->DataSource;
         list($this->STS->BoundColumn, $this->STS->TextColumn, $this->STS->DBFormat) = array("p_status_list_id", "code", "");
         $this->STS->DataSource->SQL = "select p_status_list_id, code \n" . "from v_document_workflow_status";
         $this->STS->DataSource->Order = "";
         $this->Button_Reject =& new clsButton("Button_Reject", $Method, $this);
         $this->Button_Back =& new clsButton("Button_Back", $Method, $this);
         if (!$this->FormSubmitted) {
             if (!is_array($this->SUBMIT_DATE->Value) && !strlen($this->SUBMIT_DATE->Value) && $this->SUBMIT_DATE->Value !== false) {
                 $this->SUBMIT_DATE->SetText(date("d-M-Y"));
             }
             if (!is_array($this->CURR_DOC_ID->Value) && !strlen($this->CURR_DOC_ID->Value) && $this->CURR_DOC_ID->Value !== false) {
                 $this->CURR_DOC_ID->SetText(CCGetRequestParam("CURR_DOC_ID", ccsGet, NULL));
             }
             if (!is_array($this->CURR_DOC_TYPE_ID->Value) && !strlen($this->CURR_DOC_TYPE_ID->Value) && $this->CURR_DOC_TYPE_ID->Value !== false) {
                 $this->CURR_DOC_TYPE_ID->SetText(CCGetRequestParam("CURR_DOC_TYPE_ID", ccsGet, NULL));
             }
             if (!is_array($this->CURR_PROC_ID->Value) && !strlen($this->CURR_PROC_ID->Value) && $this->CURR_PROC_ID->Value !== false) {
                 $this->CURR_PROC_ID->SetText(CCGetRequestParam("CURR_PROC_ID", ccsGet, NULL));
             }
             if (!is_array($this->CURR_CTL_ID->Value) && !strlen($this->CURR_CTL_ID->Value) && $this->CURR_CTL_ID->Value !== false) {
                 $this->CURR_CTL_ID->SetText(CCGetRequestParam("CURR_CTL_ID", ccsGet, NULL));
             }
             if (!is_array($this->PREV_DOC_ID->Value) && !strlen($this->PREV_DOC_ID->Value) && $this->PREV_DOC_ID->Value !== false) {
                 $this->PREV_DOC_ID->SetText(CCGetRequestParam("PREV_PROC_ID", ccsGet, NULL));
             }
             if (!is_array($this->PREV_DOC_TYPE_ID->Value) && !strlen($this->PREV_DOC_TYPE_ID->Value) && $this->PREV_DOC_TYPE_ID->Value !== false) {
                 $this->PREV_DOC_TYPE_ID->SetText(CCGetRequestParam("PREV_DOC_TYPE_ID", ccsGet, NULL));
             }
             if (!is_array($this->PREV_PROC_ID->Value) && !strlen($this->PREV_PROC_ID->Value) && $this->PREV_PROC_ID->Value !== false) {
                 $this->PREV_PROC_ID->SetText(CCGetRequestParam("PREV_PROC_ID", ccsGet, NULL));
             }
             if (!is_array($this->PREV_CTL_ID->Value) && !strlen($this->PREV_CTL_ID->Value) && $this->PREV_CTL_ID->Value !== false) {
                 $this->PREV_CTL_ID->SetText(CCGetRequestParam("PREV_CTL_ID", ccsGet, NULL));
             }
             if (!is_array($this->SLOT_1->Value) && !strlen($this->SLOT_1->Value) && $this->SLOT_1->Value !== false) {
                 $this->SLOT_1->SetText(CCGetRequestParam("SLOT_1", ccsGet, NULL));
             }
             if (!is_array($this->SLOT_2->Value) && !strlen($this->SLOT_2->Value) && $this->SLOT_2->Value !== false) {
                 $this->SLOT_2->SetText(CCGetRequestParam("SLOT_2", ccsGet, NULL));
             }
             if (!is_array($this->SLOT_3->Value) && !strlen($this->SLOT_3->Value) && $this->SLOT_3->Value !== false) {
                 $this->SLOT_3->SetText(CCGetRequestParam("SLOT_3", ccsGet, NULL));
             }
             if (!is_array($this->SLOT_4->Value) && !strlen($this->SLOT_4->Value) && $this->SLOT_4->Value !== false) {
                 $this->SLOT_4->SetText(CCGetRequestParam("SLOT_4", ccsGet, NULL));
             }
             if (!is_array($this->SLOT_5->Value) && !strlen($this->SLOT_5->Value) && $this->SLOT_5->Value !== false) {
                 $this->SLOT_5->SetText(CCGetRequestParam("SLOT_5", ccsGet, NULL));
             }
             if (!is_array($this->USER_ID_DOC->Value) && !strlen($this->USER_ID_DOC->Value) && $this->USER_ID_DOC->Value !== false) {
                 $this->USER_ID_DOC->SetText(CCGetRequestParam("USER_ID_DOC", ccsGet, NULL));
             }
             if (!is_array($this->USER_ID_DONOR->Value) && !strlen($this->USER_ID_DONOR->Value) && $this->USER_ID_DONOR->Value !== false) {
                 $this->USER_ID_DONOR->SetText(CCGetRequestParam("USER_ID_DONOR", ccsGet, NULL));
             }
             if (!is_array($this->USER_ID_LOGIN->Value) && !strlen($this->USER_ID_LOGIN->Value) && $this->USER_ID_LOGIN->Value !== false) {
                 $this->USER_ID_LOGIN->SetText(CCGetUserID());
             }
             if (!is_array($this->USER_ID_TAKEN->Value) && !strlen($this->USER_ID_TAKEN->Value) && $this->USER_ID_TAKEN->Value !== false) {
                 $this->USER_ID_TAKEN->SetText(CCGetRequestParam("USER_ID_TAKEN", ccsGet, NULL));
             }
             if (!is_array($this->IS_CREATE_DOC->Value) && !strlen($this->IS_CREATE_DOC->Value) && $this->IS_CREATE_DOC->Value !== false) {
                 $this->IS_CREATE_DOC->SetText(CCGetRequestParam("IS_CREATE_DOC", ccsGet, NULL));
             }
             if (!is_array($this->IS_MANUAL->Value) && !strlen($this->IS_MANUAL->Value) && $this->IS_MANUAL->Value !== false) {
                 $this->IS_MANUAL->SetText(CCGetRequestParam("IS_MANUAL", ccsGet, NULL));
             }
             if (!is_array($this->CURR_PROC_STATUS->Value) && !strlen($this->CURR_PROC_STATUS->Value) && $this->CURR_PROC_STATUS->Value !== false) {
                 $this->CURR_PROC_STATUS->SetText(CCGetRequestParam("CURR_PROC_STATUS", ccsGet, NULL));
             }
             if (!is_array($this->CURR_DOC_STATUS->Value) && !strlen($this->CURR_DOC_STATUS->Value) && $this->CURR_DOC_STATUS->Value !== false) {
                 $this->CURR_DOC_STATUS->SetText(CCGetRequestParam("CURR_DOC_STATUS", ccsGet, NULL));
             }
             if (!is_array($this->MESSAGE->Value) && !strlen($this->MESSAGE->Value) && $this->MESSAGE->Value !== false) {
                 $this->MESSAGE->SetText(CCGetRequestParam("MESSAGE", ccsGet, NULL));
             }
             if (!is_array($this->IS_VIEW_ONLY->Value) && !strlen($this->IS_VIEW_ONLY->Value) && $this->IS_VIEW_ONLY->Value !== false) {
                 $this->IS_VIEW_ONLY->SetText(CCGetRequestParam("IS_VIEW_ONLY", ccsGet, NULL));
             }
             if (!is_array($this->JENIS->Value) && !strlen($this->JENIS->Value) && $this->JENIS->Value !== false) {
                 $this->JENIS->SetText(CCGetRequestParam("JENIS", ccsGet, NULL));
             }
             if (!is_array($this->SUBMITTER_ID->Value) && !strlen($this->SUBMITTER_ID->Value) && $this->SUBMITTER_ID->Value !== false) {
                 $this->SUBMITTER_ID->SetText(-99999);
             }
         }
         if (!is_array($this->lusername->Value) && !strlen($this->lusername->Value) && $this->lusername->Value !== false) {
             $this->lusername->SetText(CCGetUserLogin());
         }
     }
 }
Esempio n. 23
0
}
if ($_GET["save"]) {
    $db = new clsDBNetConnect();
    $query = "update search_history set `save` = '1' where user_id = '" . CCGetUserID() . "' and id = '" . $_GET["save"] . "'";
    $db->query($query);
}
if ($_POST["save_sched"]) {
    $nextrun = 86400 * $_POST["frequency"];
    $nextrun = $nextrun + time();
    if ($_POST["sched"]) {
        $sched = 1;
    } else {
        $sched = 0;
    }
    $db = new clsDBNetConnect();
    $query = "update search_history set `sched` = '{$sched}', `frequency` = '" . $_POST["frequency"] . "', `nextrun` = {$nextrun}  where user_id = '" . CCGetUserID() . "' and id = '" . $_POST["id"] . "'";
    $db->query($query);
}
class clsGridsearch
{
    //search class @17-DDF99D24
    //Variables @17-4A3EDCD6
    // Public variables
    var $ComponentName;
    var $Visible;
    var $Errors;
    var $ds;
    var $PageSize;
    var $SorterName = "";
    var $SorterDirection = "";
    var $PageNumber;
Esempio n. 24
0
 function Show()
 {
     global $Tpl;
     global $FileName;
     $Error = "";
     if (!$this->Visible) {
         return;
     }
     $this->ds->open();
     $RecordBlock = "Record " . $this->ComponentName;
     $Tpl->block_path = $RecordBlock;
     if ($this->EditMode) {
         if ($this->Errors->Count() == 0) {
             if ($this->ds->Errors->Count() > 0) {
                 echo "Error in Record watchlist";
             } else {
                 if ($this->ds->next_record()) {
                     $this->ds->SetValues();
                     if (!$this->FormSubmitted) {
                         $lookupdb = new clsDBNetConnect();
                         $lookupdb->connect();
                         if (CCGetFromGet("ItemNum", "")) {
                             $newtitle = CCDLookUp("title", "items", "ItemNum='" . CCGetFromGet("ItemNum", "") . "'", $lookupdb);
                         }
                         $this->ItemTitle->SetValue($newtitle);
                         $this->itemID->SetValue(CCGetFromGet("ItemNum", ""));
                         $this->user_id->SetValue(CCGetUserID());
                         unset($lookupdb);
                     }
                 } else {
                     $this->EditMode = false;
                 }
             }
         }
     }
     $this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeShow");
     if ($this->FormSubmitted) {
         $Error .= $this->ItemTitle->Errors->ToString();
         $Error .= $this->itemID->Errors->ToString();
         $Error .= $this->user_id->Errors->ToString();
         $Error .= $this->Errors->ToString();
         $Error .= $this->ds->Errors->ToString();
         $Tpl->SetVar("Error", $Error);
         $Tpl->Parse("Error", false);
     }
     $Tpl->SetVar("Action", $this->HTMLFormAction);
     $this->Insert->Visible = !$this->EditMode;
     $lookupdb = new clsDBNetConnect();
     $lookupdb->connect();
     if (CCGetFromGet("ItemNum", "")) {
         $newtitle = CCDLookUp("title", "items", "ItemNum='" . CCGetFromGet("ItemNum", "") . "'", $lookupdb);
     }
     $this->ItemTitle->SetValue($newtitle);
     $this->itemID->SetValue(CCGetFromGet("ItemNum", ""));
     $this->user_id->SetValue(CCGetUserID());
     unset($lookupdb);
     $this->ItemTitle->Show();
     $this->Insert->Show();
     $this->Cancel->Show();
     $this->itemID->Show();
     $this->user_id->Show();
     $Tpl->parse("", false);
     $Tpl->block_path = "";
 }
function companies_viewcontent_alm_customers_BeforeUpdate(&$sender)
{
    $companies_viewcontent_alm_customers_BeforeUpdate = true;
    $Component =& $sender;
    $Container =& CCGetParentContainer($sender);
    global $companies_viewcontent;
    //Compatibility
    //End companies_viewcontent_alm_customers_BeforeUpdate
    //Custom Code @28-2A29BDB7
    // -------------------------
    // Write your own code here.
    $userid = CCGetUserID();
    $businesspartner = CCGetFromPost("businesspartner", array());
    $businesspartner_list = "";
    foreach ($businesspartner as $partner) {
        $businesspartner_list .= $partner . ",";
    }
    $companies_viewcontent->alm_customers->businesspartner->SetValue($businesspartner_list);
    $companies_viewcontent->alm_customers->modified_iduser->SetValue($userid);
    // -------------------------
    //End Custom Code
    //Close companies_viewcontent_alm_customers_BeforeUpdate @2-99222B37
    return $companies_viewcontent_alm_customers_BeforeUpdate;
}
function companies_list_alm_customers_ds_BeforeExecuteSelect(&$sender)
{
    $companies_list_alm_customers_ds_BeforeExecuteSelect = true;
    $Component =& $sender;
    $Container =& CCGetParentContainer($sender);
    global $companies_list;
    //Compatibility
    //End companies_list_alm_customers_ds_BeforeExecuteSelect
    //Custom Code @26-2A29BDB7
    // -------------------------
    // Write your own code here.
    //Special search for contacts since its stored on a separate table
    $where = trim($companies_list->alm_customers->ds->Where);
    $search = trim(CCGetFromGet("s_search", ""));
    if (strlen($search) > 0) {
        $sql = "select customer_id from alm_customers_contacts where contact like '%{$search}%' ";
        $db = new clsDBdbConnection();
        $db->query($sql);
        $id = "0";
        while ($db->next_record()) {
            $id .= $db->f("customer_id") . ",";
        }
        $id = trim($id, ",");
        $db->close();
        if (strlen($where) > 0) {
            //The parenthesis is needed to properly filter the search and users own customers
            $where = "( {$where} ";
            $where .= " or id in ({$id}) ) ";
        } else {
            $where .= " id in ({$id}) ";
        }
        $companies_list->alm_customers->ds->Where = $where;
    }
    //Filtering grid content for users group
    if (CCGetGroupID() == 1) {
        $userid = CCGetUserID();
        if (strlen($where) > 0) {
            $where .= " and assigned_to = {$userid} ";
        } else {
            $where .= " assigned_to = {$userid} ";
        }
        $companies_list->alm_customers->ds->Where = $where;
    }
    // -------------------------
    //End Custom Code
    //Close companies_list_alm_customers_ds_BeforeExecuteSelect @5-F8608223
    return $companies_list_alm_customers_ds_BeforeExecuteSelect;
}
Esempio n. 27
0
function buildpage($id)
{
    global $Tpl;
    global $now;
    global $accounting;
    global $regcharges;
    $db = new clsDBNetConnect();
    $query = "select * from subscription_plans where id = " . $id;
    $db->query($query);
    if ($db->next_record()) {
        $id = $db->f("id");
        $title = $db->f("title");
        $description = $db->f("description");
        $group = $db->f("group");
        $duration = $db->f("duration");
        $unlimited = $db->f("unlimited");
        $price = $db->f("price");
        $recurring = $db->f("recurring");
        if ($recurring == 1) {
            $recurring = "Yes";
        } else {
            $recurring = "No";
        }
        if ($unlimited) {
            $duration = 9999;
        }
        $intro = $db->f("intro");
        $intro_duration = $db->f("intro_duration");
        $intro_price = $db->f("intro_price");
        $paypal = $db->f("paypal");
        $authnet = $db->f("authnet");
        $co2 = $db->f("co2");
        $active = $db->f("active");
        $icon = $db->f("icon");
        $date_added = $db->f("date_added");
        if ($active) {
            if ($paypal && $recurring == "No") {
                $paypallink = "https://www.paypal.com/cgi-bin/webscr?cmd=_xclick&business=" . urlencode($accounting["paypal"]) . "&return=" . urlencode($now["homeurl"]) . "&no_note=1&currency_code=" . $regcharges["currencycode"] . "&notify_url=" . urlencode($now["homeurl"]) . "paypalipn.php&custom=" . CCGetUserID() . "&amount=" . $price . "&item_name=" . urlencode($now["sitename"] . "-Subscription") . "&item_number=" . $id;
                $Tpl->SetBlockVar("PayPal", "");
                $Tpl->setVar("paypallink", $paypallink);
                $Tpl->Parse("PayPal", True);
            }
            if ($paypal && $recurring == "Yes") {
                $days = $duration;
                $duration2 = "&p3=" . $days . "&t3=D";
                if ($days > 90 && $days < 730 && $days != 365 && $days != 730 && $db->f("recurring") == 1) {
                    $days = round($days / 30, 0);
                    $duration2 = "&p3=" . $days . "&t3=M";
                } elseif ($days > 730 && $db->f("recurring") == 1 || $days == 365 || $days == 730) {
                    $days = round($days / 365, 0);
                    $duration2 = "&p3=" . $days . "&t3=Y";
                }
                $rdays = $intro_duration;
                if ($rdays) {
                    $intro_duration2 = "&p1=" . $rdays . "&t1=D";
                }
                if ($rdays > 90 && $rdays < 730 && $rdays != 365 && $rdays != 730 && $db->f("recurring") == 1) {
                    $rdays = round($rdays / 30, 0);
                    $intro_duration2 = "&p1=" . $rdays . "&t1=M";
                } elseif ($rdays > 730 && $db->f("recurring") == 1 || $rdays == 365 || $rdays == 730) {
                    $rdays = round($rdays / 365, 0);
                    $intro_duration2 = "&p1=" . $rdays . "&t1=Y";
                }
                $paypallink = "https://www.paypal.com/cgi-bin/webscr?cmd=_xclick-subscriptions&business=" . urlencode($accounting["paypal"]) . "&return=" . urlencode($now["homeurl"]) . "&no_note=1&currency_code=" . $regcharges["currencycode"] . "&notify_url=" . urlencode($now["homeurl"]) . "paypalipn.php&custom=" . CCGetUserID() . "&amount=" . $intro_price . "&item_name=" . urlencode($now["sitename"] . "-Subscription") . "&item_number=" . $id . "&a1=" . $intro_price . $intro_duration2 . "&a3=" . $price . $duration2;
                if ($intro) {
                    $Tpl->SetBlockVar("intro", "");
                    $Tpl->setVar("currency", $regcharges["currency"]);
                    $Tpl->setVar("intro_price", $intro_price);
                    $Tpl->setVar("intro_duration", $intro_duration);
                    $Tpl->Parse("intro", True);
                }
                $Tpl->SetBlockVar("PayPal", "");
                $Tpl->setVar("paypallink", $paypallink);
                $Tpl->Parse("PayPal", True);
            }
            if ($co2) {
            }
            if ($authnet && $paypal) {
                $Tpl->SetBlockVar("or", "");
                $Tpl->Parse("or", True);
            }
            $Tpl->setVar("id", $id);
            $Tpl->setVar("title", $title);
            $Tpl->setVar("description", $description);
            $Tpl->setVar("price", $price);
            if ($unlimited) {
                $duration = "Unlimited";
            }
            $Tpl->setVar("duration", $duration);
            $Tpl->setVar("recurring", $recurring);
            $Tpl->setVar("intro_duration", $intro_duration);
            $Tpl->setVar("date_added", $date_added);
            $Tpl->setVar("icon", $icon);
        }
    }
}
Esempio n. 28
0
function freesubsc($id)
{
    CCSecurityRedirect("1;2", "login.php", "ViewSubscriptions.php", CCGetQueryString("QueryString", ""));
    $db = new clsDBNetConnect();
    $query = "select * from subscription_plans where id = " . $id . " and price = '0.00'";
    $db->query($query);
    if ($db->next_record()) {
        subscribe(CCGetUserID(), $id, "0.00");
    }
    header("Location: myaccount.php");
}
Esempio n. 29
0
 function Show()
 {
     global $Tpl;
     global $now;
     if (!$this->Visible) {
         return;
     }
     $ShownRecords = 0;
     $this->ds->Parameters["sesUserID"] = CCGetSession("UserID");
     $this->ds->Prepare();
     $this->ds->Open();
     $GridBlock = "Grid " . $this->ComponentName;
     $Tpl->block_path = $GridBlock;
     $this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeShow");
     $is_next_record = $this->ds->next_record();
     if ($is_next_record && $ShownRecords < $this->PageSize) {
         do {
             $this->ds->SetValues();
             $Tpl->block_path = $GridBlock . "/Row";
             $this->comment->SetValue($this->ds->comment->GetValue());
             $twodays = $this->ds->date->GetValue();
             $theday = getdate($twodays);
             $lastofyear = substr($theday["year"], -2);
             $enddate = $theday["mon"] . "/" . $theday["mday"] . "/" . $lastofyear;
             $this->date->SetValue(date("F j, Y, g:i a", $this->ds->date->GetValue()));
             if ($this->ds->doing_rating->GetValue() != "" && is_numeric($this->ds->doing_rating->GetValue()) && $this->ds->doing_rating->GetValue() != 1000000000) {
                 $lookupdb = new clsDBNetConnect();
                 $lookupdb->connect();
                 $thename = CCDLookUp("user_login", "users", "user_id='" . $this->ds->doing_rating->GetValue() . "'", $lookupdb);
                 $this->doing_rating->SetValue($thename);
                 unset($lookupdb);
             } else {
                 $this->doing_rating->SetValue($now["sitename"]);
             }
             $this->id->SetValue($this->ds->id->GetValue());
             $this->ItemNum->SetValue($this->ds->ItemNum->GetValue());
             if ($this->ds->rating->GetValue() == 1) {
                 $this->rating->SetValue("<img src=\"images/positive.gif\">");
             }
             if ($this->ds->rating->GetValue() == 0) {
                 $this->rating->SetValue("<img src=\"images/neutral.gif\">");
             }
             if ($this->ds->rating->GetValue() == -1) {
                 $this->rating->SetValue("<img src=\"images/negative.gif\">");
             }
             if ($this->ds->buysell->GetValue() == 1) {
                 $this->buysell->SetValue("Buyer");
             }
             if ($this->ds->buysell->GetValue() == 0) {
                 $this->buysell->SetValue("Seller");
             }
             $this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeShowRow");
             $this->comment->Show();
             $this->date->Show();
             $this->doing_rating->Show();
             $this->buysell->Show();
             $this->id->Show();
             $this->ItemNum->Show();
             $this->rating->Show();
             $counter = new clsDBNetConnect();
             $query = "select * from feedback where `counter` = '" . $this->ds->id->GetValue() . "'";
             $counter->query($query);
             if ($counter->next_record()) {
                 $Tpl->SetBlockVar("counter", "");
                 $Tpl->setVar("countercomment", stripslashes($counter->f("comment")));
                 $Tpl->setVar("countericon", "<img src=\"images/CounterComment.gif\">");
                 $Tpl->setVar("counterlink", "");
                 $Tpl->parse("counter", "");
             } else {
                 $Tpl->SetBlockVar("counter", "");
                 $Tpl->setVar("countercomment", "");
                 $Tpl->setVar("countericon", "");
                 if (CCGetUserID() == $_GET["user_id"]) {
                     $Tpl->setVar("counterlink", "<a href=\"RateUser.php?id=" . $this->ds->id->GetValue() . "\">&nbsp;&nbsp;&nbsp;&nbsp;<i>Comment on this rating</i></a>");
                 }
             }
             $Tpl->block_path = $GridBlock;
             $Tpl->parse("Row", true);
             $ShownRecords++;
             $is_next_record = $this->ds->next_record();
         } while ($is_next_record && $ShownRecords < $this->PageSize);
     } else {
         $Tpl->parse("NoRecords", false);
     }
     $this->Navigator->TotalPages = $this->ds->PageCount();
     $this->Sorter_doing_rating->Show();
     $this->Sorter_date->Show();
     $this->Navigator->Show();
     $Tpl->parse("", false);
     $Tpl->block_path = "";
 }
Esempio n. 30
0
function GetGroupDiscount($fee)
{
    $user_id = CCGetUserID();
    $groups = new clsDBNetConnect();
    $query = "select gp.id, gp.title, gp.listing_discount from groups gp, groups_users ug where ug.user_id = {$user_id} and ug.group_id = gp.id order by listing_discount DESC limit 1";
    $groups->query($query);
    if ($groups->next_record()) {
        $return["id"] = $groups->f("id");
        $return["title"] = $groups->f("title");
        $return["listing_discount"] = $groups->f("listing_discount") * 100;
        $return["total"] = round($fee - $fee * $groups->f("listing_discount"), 2);
        return $return;
    }
}