MySQL Forums
Forum List  »  Partitioning

Re: Do I have to re write querries when Partitioning?
Posted by: john hango
Date: September 05, 2010 07:47PM

function processLink($baseUrl, $varArray = NULL) {
global $lang, $setts;
//Y /1,auctiondetails
//N /auctiondetails.php?id=1
(string) $output = NULL;
if (eregi('Y', $setts['is_mod_rewrite'])) {
while (list($key,$value) = each($varArray)) {
$sanitizedValue = sanitizeVar($value);
$output .= $sanitizedValue.','.$key.',';
}
$output .= $baseUrl;
} else {
$output = $baseUrl.'.php';
if ($varArray) {
$output .= '?';
while (list($key,$value) = each($varArray)) {
if ($key=="id") $sanitizedValue = sanitizeVar2($value);
else $sanitizedValue = sanitizeVar($value);
$output .= $key.'='.$sanitizedValue.'&';
}}
$output = substr($output,0,-1);
}
return $output;
}
function displayNavButtons($btn='next') {
global $lang, $setts;
$nextstep = '<input name="nextstep" type="submit" id="nextstep" value="'.(($btn=='next')?$lang[nextstep]:$lang[submit]).'"> ';
$prevstep = '<input name="prevstep" type="submit" id="prevstep" value="'.$lang[prevstep].'"> ';
$output = ($setts['sell_nav_position']==1)?$prevstep.' &nbsp; '.$nextstep:$nextstep.' &nbsp; '.$prevstep;
return $output;
}
function isUrl($url) {
$pattern = '/^(http|https|ftp):\/\/([A-Z0-9][A-Z0-9_-]*(?:\.[A-Z0-9][A-Z0-9_-]*)+):?(\d+)?\/?/i';
$output = (preg_match($pattern, $url))?TRUE:FALSE;
return $output;
}
function immediatePaymentProcess($buyer_id,$seller_id,$auction_id,$insurance_value,$inAdmin=FALSE) {
global $lang,$setts,$fee,$timeNowMysql,$s_membersarea,$s_memberlastaccess,$s_memberid,$s_membername,$s_memberusern,$s_password,$s_sms_phone_number,$s_sms_message,$s_syidescription,$s_nb_items_per_page,$s_is_myfolders,$s_option,$s_charity_id,$s_scatid,$s_sstep,$s_llistin,$s_ageOkToBid,$s_memberzip,$s_memberland,$s_accsusp,$s_is_guest,$s_is_seller,$s_auctionid_refresh,$s_buynow_refresh,$s_buynow_timeout,$s_sess_lang,$s_table_to_modify,$s_slandid,$s_landname,$s_landflag,$s_mygateza_merch_id,$s_mygateza_app_id,$s_mygateza_currency,$s_setcom_email,$s_setcom_username,$s_setcom_pw,$s_setcom_currency,$s_label_comment1,$s_label_comment2,$s_label_comment3,$s_label_comment4,$s_label_comment5,$s_comment1,$s_comment2,$s_comment3,$s_comment4,$s_comment5,$s_quantity,$s_pagseguro_token,$s_show_msg,$s_showcountry,$s_nrs2;
$filePath = ($inAdmin)?"../":"";
$auctionTemp = getSqlRow("SELECT * FROM yspnash_auctions WHERE id='".$auction_id."' AND active=1");
if ($auctionTemp['closed']==1&&$auctionTemp['is_start_on_first_bid']==1) {
$closed = 0;
$startDate = $timeNowMysql;
$closingdate = closingdate($startDate,$auctionTemp['duration']);
$updateAuction = mysql_query("UPDATE yspnash_auctions SET startdate='".$startDate."', enddate='".$closingdate."', closed='".$closed."' WHERE id='".$auction_id."'");
$auctionTemp = getSqlRow("SELECT * FROM yspnash_auctions WHERE id='".$auction_id."' AND active=1");
}
if ($auctionTemp['closed']==1) {
echo $lang[bnimpossibleauctclosed];
} else if ($s_quantity>$auctionTemp['quantity']) {
echo "$lang[err_more]";
} else if ($s_quantity<=$auctionTemp['quantity']) {
if ($_POST['quantity']>0) {
$amount = $s_quantity*$auctionTemp['bnvalue'];
$add_desc = " x ".$s_quantity;
} else {
$amount = $auctionTemp['bnvalue'];
$add_desc = "";
}
if (($s_comment1!=""&&$setts['is_comment1']==1)||($s_comment2!=""&&$setts['is_comment2']==1)||($s_comment3!=""&&$setts['is_comment3']==1)||($s_comment4!=""&&$setts['is_comment4']==1)||($s_comment5!=""&&$setts['is_comment5']==1)) $insertComment1 = mysql_query("INSERT INTO nash_checkout_user_comments (auction_id, seller_id, buyer_id, label_comment1, label_comment2, label_comment3, label_comment4, label_comment5, comment1, comment2, comment3, comment4, comment5) VALUES ('".$auctionTemp['id']."','".$auctionTemp['ownerid']."','".$s_memberid."','".$s_label_comment1."','".$s_label_comment2."','".$s_label_comment3."','".$s_label_comment4."','".$s_label_comment5."','".remSpecialChars($s_comment1)."','".remSpecialChars($s_comment2)."','".remSpecialChars($s_comment3)."','".remSpecialChars($s_comment4)."','".remSpecialChars($s_comment5)."')") or die(mysql_error());
$category_id = getMainCat($auctionTemp['category']);
$category_id = (getSqlNumber("SELECT category_id FROM yspnash_fees WHERE category_id='".$category_id."'")>0)?$category_id:0;
$destination_type = $auctionTemp['listin'];
if ($destination_type==""||$destination_type=="auction") $destination_type = 0;
else if ($destination_type=="store") $destination_type = 1;
else if ($destination_type=="both") $destination_type = 2;
$destination_type = (getSqlNumber("SELECT destination_type FROM yspnash_fees WHERE destination_type='".$destination_type."'")>0)?$destination_type:0;
$fee = getSqlRow("SELECT * FROM yspnash_fees WHERE category_id='".$category_id."' AND destination_type='".$destination_type."'");
$payerId = (eregi('s',$fee['endauction_fee_applies']))?$auctionTemp['ownerid']:$buyer_id;
$prefSeller = "N";
if ($setts['pref_sellers']=="Y") $prefSeller = getSqlField("SELECT preferred_seller FROM yspnash_users WHERE id='".$payerId."'","preferred_seller");
if ($fee['is_endauction_fee']=="Y"&&!freeFees($payerId)) {
$exchange_rate = 1;
$auction_currency = getSqlField("SELECT currency FROM yspnash_auctions WHERE id='".$auctionTemp['id']."'","currency");
if (trim($setts['currency'])!=trim($auction_currency)) $exchange_rate = 1/getSqlField("SELECT converter FROM yspnash_currencies WHERE symbol = '".trim($auction_currency)."'","converter");
if ($exchange_rate<=0) $exchange_rate = 1;
$tmp = getSqlField("SELECT payment_mode FROM yspnash_users WHERE id='".$payerId."'","payment_mode");
if ($setts['account_mode_personal']==1) $account_mode_local = ($tmp)?2:1;
else $account_mode_local = $setts['account_mode'];
if ($account_mode_local==2) {
$feeAmount = 0;
$endauctionFee = getSqlRow("SELECT * FROM yspnash_fees_tiers WHERE fee_from<=".$amount." AND fee_to>".$amount." AND fee_type='endauction' AND category_id='".$category_id."' AND destination_type='".$destination_type."'");
if ($endauctionFee['calc_type']=="percent") {
$feeAmount += ($endauctionFee['fee_amount']/100)*$amount*$exchange_rate;
$invoiceAmount = ($endauctionFee['fee_amount']/100)*$amount*$exchange_rate;
} else {
$feeAmount += $endauctionFee['fee_amount'];
$invoiceAmount = $endauctionFee['fee_amount'];
}
$feeAmount = applyVat($feeAmount,$payerId);
$invoiceAmount = applyVat($invoiceAmount,$payerId);
$feeAmount = calcReduction($feeAmount,$prefSeller);
$invoiceAmount = calcReduction($invoiceAmount,$prefSeller);
$newBalance = getSqlField("SELECT balance FROM yspnash_users WHERE id='".$payerId."'","balance");
$newBalance += $feeAmount;
$currentTime = time();
$insertInvoice = mysql_query("INSERT INTO yspnash_invoices (userid,auctionid,feename,feevalue,feedate,balance) VALUES ('".$payerId."','".$auctionTemp['id']."','".$lang[nash1050]."','".$invoiceAmount."','".$currentTime."','".$newBalance."')") or die(mysql_error());
$payment_status = "confirmed";
$active = 1;
$updateSellerBalance = mysql_query("UPDATE yspnash_users SET balance=balance+".$feeAmount." WHERE id='".$payerId."'");
if ($endauctionFee['shared_percent']>0) {
$todayn = date("Y-m-d H:i:s", time());
$refee5 = getSqlRow("SELECT * FROM yspnash_users WHERE id='".$auctionTemp['ownerid']."'");
$referid4 = getSqlRow("SELECT * FROM nash_referrals WHERE referredusern='".$refee5['username']."'");
if ($referid4) {
$refee4 = getSqlRow("SELECT * FROM yspnash_users WHERE id='".$referid4['referrerid']."'");
$num=1;
$referid3 = getSqlRow("SELECT * FROM nash_referrals WHERE referredusern='".$refee4['username']."'");
}
if ($referid3) {
$refee3 = getSqlRow("SELECT * FROM yspnash_users WHERE id='".$referid3['referrerid']."'");
$num=2;
$referid2 = getSqlRow("SELECT * FROM nash_referrals WHERE referredusern='".$refee3['username']."'");
}
if ($referid2) {
$refee2 = getSqlRow("SELECT * FROM yspnash_users WHERE id='".$referid2['referrerid']."'");
$num=3;
$referid1 = getSqlRow("SELECT * FROM nash_referrals WHERE referredusern='".$refee2['username']."'");
}
if ($referid1) {
$refee1 = getSqlRow("SELECT * FROM yspnash_users WHERE id='".$referid1['referrerid']."'");
$num=4;
}
if (!$num||$num==0||$num=="") $num=1;
$endauction_commission = (($invoiceAmount/100)*$endauctionFee['shared_percent'])/$num;
if ($num==1) {
$newComTotal4 = $refee4['endauction_commission']+$endauction_commission;
if ($referid4['is_approved']==1) {
$insertCommission = mysql_query("INSERT INTO nash_referrals_fee_commissions (com_type, referrer_id, referee_id, sold_item_id, com_date, com_amount, com_total) VALUES ('endauction','".$refee4['id']."','".$auctionTemp['ownerid']."','".$auctionTemp['id']."','".$todayn."','".$endauction_commission."','".$newComTotal4."')");
$updateCommission = mysql_query("UPDATE yspnash_users SET endauction_commission=endauction_commission+".$endauction_commission." WHERE id='".$refee4['id']."'");
}}
if ($num==2) {
$newComTotal4 = $refee4['endauction_commission']+$endauction_commission;
if ($referid4['is_approved']==1) {
$insertCommission = mysql_query("INSERT INTO nash_referrals_fee_commissions (com_type, referrer_id, referee_id, sold_item_id, com_date, com_amount, com_total) VALUES ('endauction','".$refee4['id']."','".$auctionTemp['ownerid']."','".$auctionTemp['id']."','".$todayn."','".$endauction_commission."','".$newComTotal4."')");
$updateCommission = mysql_query("UPDATE yspnash_users SET endauction_commission=endauction_commission+".$endauction_commission." WHERE id='".$refee4['id']."'");
}
$newComTotal3 = $refee3['endauction_commission']+$endauction_commission;
if ($referid3['is_approved']==1) {
$insertCommission = mysql_query("INSERT INTO nash_referrals_fee_commissions (com_type, referrer_id, referee_id, sold_item_id, com_date, com_amount, com_total) VALUES ('endauction','".$refee3['id']."','".$auctionTemp['ownerid']."','".$auctionTemp['id']."','".$todayn."','".$endauction_commission."','".$newComTotal3."')");
$updateCommission = mysql_query("UPDATE yspnash_users SET endauction_commission=endauction_commission+".$endauction_commission." WHERE id='".$refee3['id']."'");
}}
if ($num==3) {
$newComTotal4 = $refee4['endauction_commission']+$endauction_commission;
if ($referid4['is_approved']==1) {
$insertCommission = mysql_query("INSERT INTO nash_referrals_fee_commissions (com_type, referrer_id, referee_id, sold_item_id, com_date, com_amount, com_total) VALUES ('endauction','".$refee4['id']."','".$auctionTemp['ownerid']."','".$auctionTemp['id']."','".$todayn."','".$endauction_commission."','".$newComTotal4."')");
$updateCommission = mysql_query("UPDATE yspnash_users SET endauction_commission=endauction_commission+".$endauction_commission." WHERE id='".$refee4['id']."'");
}
$newComTotal3 = $refee3['endauction_commission']+$endauction_commission;
if ($referid3['is_approved']==1) {
$insertCommission = mysql_query("INSERT INTO nash_referrals_fee_commissions (com_type, referrer_id, referee_id, sold_item_id, com_date, com_amount, com_total) VALUES ('endauction','".$refee3['id']."','".$auctionTemp['ownerid']."','".$auctionTemp['id']."','".$todayn."','".$endauction_commission."','".$newComTotal3."')");
$updateCommission = mysql_query("UPDATE yspnash_users SET endauction_commission=endauction_commission+".$endauction_commission." WHERE id='".$refee3['id']."'");
}
$newComTotal2 = $refee2['endauction_commission']+$endauction_commission;
if ($referid2['is_approved']==1) {
$insertCommission = mysql_query("INSERT INTO nash_referrals_fee_commissions (com_type, referrer_id, referee_id, sold_item_id, com_date, com_amount, com_total) VALUES ('endauction','".$refee2['id']."','".$auctionTemp['ownerid']."','".$auctionTemp['id']."','".$todayn."','".$endauction_commission."','".$newComTotal2."')");
$updateCommission = mysql_query("UPDATE yspnash_users SET endauction_commission=endauction_commission+".$endauction_commission." WHERE id='".$refee2['id']."'");
}}
if ($num==4) {
$newComTotal4 = $refee4['endauction_commission']+$endauction_commission;
if ($referid4['is_approved']==1) {
$insertCommission = mysql_query("INSERT INTO nash_referrals_fee_commissions (com_type, referrer_id, referee_id, sold_item_id, com_date, com_amount, com_total) VALUES ('endauction','".$refee4['id']."','".$auctionTemp['ownerid']."','".$auctionTemp['id']."','".$todayn."','".$endauction_commission."','".$newComTotal4."')");
$updateCommission = mysql_query("UPDATE yspnash_users SET endauction_commission=endauction_commission+".$endauction_commission." WHERE id='".$refee4['id']."'");
}
$newComTotal3 = $refee3['endauction_commission']+$endauction_commission;
if ($referid3['is_approved']==1) {
$insertCommission = mysql_query("INSERT INTO nash_referrals_fee_commissions (com_type, referrer_id, referee_id, sold_item_id, com_date, com_amount, com_total) VALUES ('endauction','".$refee3['id']."','".$auctionTemp['ownerid']."','".$auctionTemp['id']."','".$todayn."','".$endauction_commission."','".$newComTotal3."')");
$updateCommission = mysql_query("UPDATE yspnash_users SET endauction_commission=endauction_commission+".$endauction_commission." WHERE id='".$refee3['id']."'");
}
$newComTotal2 = $refee2['endauction_commission']+$endauction_commission;
if ($referid2['is_approved']==1) {
$insertCommission = mysql_query("INSERT INTO nash_referrals_fee_commissions (com_type, referrer_id, referee_id, sold_item_id, com_date, com_amount, com_total) VALUES ('endauction','".$refee2['id']."','".$auctionTemp['ownerid']."','".$auctionTemp['id']."','".$todayn."','".$endauction_commission."','".$newComTotal2."')");
$updateCommission = mysql_query("UPDATE yspnash_users SET endauction_commission=endauction_commission+".$endauction_commission." WHERE id='".$refee2['id']."'");
}
$newComTotal1 = $refee1['endauction_commission']+$endauction_commission;
if ($referid1['is_approved']==1) {
$insertCommission = mysql_query("INSERT INTO nash_referrals_fee_commissions (com_type, referrer_id, referee_id, sold_item_id, com_date, com_amount, com_total) VALUES ('endauction','".$refee1['id']."','".$auctionTemp['ownerid']."','".$auctionTemp['id']."','".$todayn."','".$endauction_commission."','".$newComTotal1."')");
$updateCommission = mysql_query("UPDATE yspnash_users SET endauction_commission=endauction_commission+".$endauction_commission." WHERE id='".$refee1['id']."'");
}}}} else {
$payment_status = "unconfirmed";
$active = 0;
}} else {
$payment_status = "confirmed";
$active = 1;
}
if ($s_quantity==$auctionTemp['quantity']) {
$closeAuction = mysql_query("UPDATE yspnash_auctions SET closed=1,maxbid='".$auctionTemp['bnvalue']."',enddate='".$timeNowMysql."' WHERE id='".$auctionTemp['id']."'");
delcatcount($auctionTemp['category'],$auctionTemp['id']);
delcatcount($auctionTemp['addlcategory'],$auctionTemp['id']);
$delStarRatings = mysql_query("DELETE FROM nash_starratings WHERE id='auc".$auctionTemp['id']."'");
if ($auctionTemp['auto_relist']=="Y"&&$auctionTemp['auto_relist_nb']>0&&($auctionTemp['auto_relist_bids']=="Y"||$auctionTemp['nrbids']==0)) {
$itemListedIn = getSqlField("SELECT listin FROM yspnash_auctions WHERE id='".$auctionTemp['id']."'","listin");
$userStore = getSqlRow("SELECT aboutpage_type, store_active, store_account_type FROM yspnash_users WHERE id='".$auctionTemp['ownerid']."'");
if ($setts['enable_start_on_first_bid']==1) $nbStoreItems = getSqlNumber("SELECT id FROM yspnash_auctions WHERE ((closed=1 AND is_start_on_first_bid=1) OR closed=0) AND ownerid='".$auctionTemp['ownerid']."' AND active='1' AND deleted!='1' AND listin!='auction'");
else $nbStoreItems = getSqlNumber("SELECT id FROM yspnash_auctions WHERE closed=0 AND ownerid='".$auctionTemp['ownerid']."' AND active='1' AND deleted!='1' AND listin!='auction'");
$storeActive = FALSE;
if ($userStore['aboutpage_type']==2&&$userStore['store_active']==1) {
if ($userStore['store_account_type']==0) {
$storeActive = TRUE;
} else {
$maxStoreItems = getSqlField("SELECT store_nb_items FROM yspnash_fees_tiers WHERE id='".$userStore['store_account_type']."'","store_nb_items");
if ($maxStoreItems!="n/a"&&$maxStoreItems!=""&&$maxStoreItems>$nbStoreItems) $storeActive = TRUE;
}}
$canList = FALSE;
if ($itemListedIn!="store") {
$canList = TRUE;
} else {
if ($storeActive) $canList = TRUE;
else $canList = FALSE;
}
if ($canList&&!$auctionTemp['is_relisted']) {
$today = date("Y-m-d H:i:s", time());
$closingdate = closingdate($today,$auctionTemp['duration']);
$relistAuction = mysql_query("INSERT INTO yspnash_auctions (itemname, description, picpath, quantity, auctiontype, bidstart, bidend, bidstart_original, rp, rpvalue, bn, bnvalue, bi, bivalue, duration, country, zip, sc,scint, pm, main_category, category, active, payment_status, startdate, enddate, closed, keywords, maxbid, ownerid, hpfeat, catfeat, bolditem, hlitem, private, currency, postage_costs, insurance, type_service, isswap, isverify, subitemname, sc_insurance, sc_type_service, estimated_weight_lbs, estimated_weight_oz, package_size_length, package_size_width, package_size_height, odd_shaped_package, handling_fee, calculated, declVal, combine_shipp, main_region, region_suburbs, template, iconit, counter_style, acceptdirectpayment, addlcategory, shipping_details, hpfeat_desc, listin, accept_payment_systems, apply_vat, auto_relist, auto_relist_bids, endtime_type, videofile_path, listing_type, offer_range_min, offer_range_max, auto_relist_nb, charity_id, charity_gets, chacha, postage_costs_ww, insurance_ww, combine_shipp_ww, type_service_ww, shipping_details_ww, digdel_path, reserveadv_timelimit, itemAddress, itemCity, itemState, myfolder_id, retail_price, postage_costs_ww_specific, postage_costs_ww_country, pa_bidders, return_policy, return_policy_ww, enlpicitem, is_start_on_first_bid, hpfeatplus, catfeatplus, list_till_sold, immediatePayment, crazy_auctiontype, tax_amt, forpickuponly) SELECT itemname, description, picpath, quantity, auctiontype, bidstart, bidend, bidstart_original, rp, rpvalue, bn, bnvalue, bi, bivalue, duration, country, zip, sc,scint, pm, main_category, category, active, payment_status, startdate, enddate, closed, keywords, maxbid, ownerid, hpfeat, catfeat, bolditem, hlitem, private, currency, postage_costs, insurance, type_service, isswap, isverify, subitemname, sc_insurance, sc_type_service, estimated_weight_lbs, estimated_weight_oz, package_size_length, package_size_width, package_size_height, odd_shaped_package, handling_fee, calculated, declVal, combine_shipp, main_region, region_suburbs, template, iconit, counter_style, acceptdirectpayment, addlcategory, shipping_details, hpfeat_desc, listin, accept_payment_systems, apply_vat, auto_relist, auto_relist_bids, endtime_type, videofile_path, listing_type, offer_range_min, offer_range_max, auto_relist_nb, charity_id, charity_gets, chacha, postage_costs_ww, insurance_ww, combine_shipp_ww, type_service_ww, shipping_details_ww, digdel_path, reserveadv_timelimit, itemAddress, itemCity, itemState, myfolder_id, retail_price, postage_costs_ww_specific, postage_costs_ww_country, pa_bidders, return_policy, return_policy_ww, enlpicitem, is_start_on_first_bid, hpfeatplus, catfeatplus, list_till_sold, immediatePayment, crazy_auctiontype, tax_amt, forpickuponly FROM yspnash_auctions AS b WHERE b.id='".$auctionTemp['id']."'") or die(mysql_error());
$newId = mysql_insert_id();
$bidstart_original = getSqlField("SELECT bidstart_original FROM yspnash_auctions WHERE id='".$newId."'","bidstart_original");
if ($bidstart_original!="n/a"&&$bidstart_original!=""&&$bidstart_original>0) mysql_query("UPDATE yspnash_auctions SET bidstart='".$bidstart_original."' WHERE id='".$newId."'");
mysql_query("UPDATE yspnash_auctions SET is_relisted=1 WHERE id='".$auctionTemp['id']."'");
$getCustomFields = mysql_query("SELECT SQL_CACHE * FROM yspnash_fields_data WHERE auctionid='".$auctionTemp['id']."'");
while ($relistFld = mysql_fetch_array($getCustomFields)) {
$relistCustomFields = mysql_query("INSERT INTO yspnash_fields_data (auctionid,ownerid,boxid,boxvalue,active) VALUES ('".$newId."','".$relistFld['ownerid']."','".$relistFld['boxid']."','".$relistFld['boxvalue']."','".$relistFld['active']."')") or die(mysql_error());
}
$getImages = mysql_query("SELECT SQL_CACHE * FROM yspnash_auction_images WHERE auctionid='".$auctionTemp['id']."'") or die(mysql_error());
$addCnt = 0;
while ($relistAddImages=mysql_fetch_array($getImages)) {
if (file_exists($relistAddImages['name'])&&InStrCount($relistAddImages['name'],"http")==0) {
$fileExtension = getFileExtension($relistAddImages['name']);
$sourceImg = $relistAddImages['name'];
$destinationImg = "uplimg/".date('Y')."_a".$newId."_addpic".$addCnt.".".$fileExtension;
$isCopied = @copy($filePath.$sourceImg,$filePath.$destinationImg);
$addImage[$addCnt] = mysql_query("INSERT INTO yspnash_auction_images (name, auctionid) VALUES ('".$destinationImg."','".$newId."')") or die(mysql_error());
if ($setts['is_remote_pic_linkage']==1) {
$insertImageID = mysql_insert_id();
$imName = $destinationImg;
$isFTP = ftp_file($imName,$destinationImg);
if ($isFTP) {
//if (file_exists($imName)) unlink($imName);
$remotePicName = $setts['remote_pic_linkage'].$destinationImg;
$updateImage = mysql_query("UPDATE yspnash_auction_images SET name='".$remotePicName."' WHERE id='".$insertImageID."'");
}}
} else if (InStrCount($relistAddImages['name'],"http")>0) {
$addImage[$addCnt] = mysql_query("INSERT INTO yspnash_auction_images (name, auctionid) VALUES ('".$relistAddImages['name']."','".$newId."')") or die(mysql_error());
if ($setts['is_remote_pic_linkage']==1) {
$insertImageID = mysql_insert_id();
$imName = $destinationImg;
$isFTP = ftp_file($imName,$destinationImg);
if ($isFTP) {
//if (file_exists($imName)) unlink($imName);
$remotePicName = $setts['remote_pic_linkage'].$destinationImg;
$updateImage = mysql_query("UPDATE yspnash_auction_images SET name='".$remotePicName."' WHERE id='".$insertImageID."'");
}}}
$addCnt++;
}
$mainPicRelist = getSqlField("SELECT picpath FROM yspnash_auctions WHERE id='".$newId."'","picpath");
if ($mainPicRelist!=""&&$mainPicRelist!="n/a") {
if (file_exists($mainPicRelist)) {
$fileExtension = getFileExtension($mainPicRelist);
$sourceImg = $mainPicRelist;
$destinationImg = "uplimg/".date('Y')."_cma".$newId."_mainpic.".$fileExtension;
$isCopied = @copy($filePath.$sourceImg,$filePath.$destinationImg);
$updateAuctionPic = mysql_query("UPDATE yspnash_auctions SET picpath='".$destinationImg."' WHERE id='".$newId."'") or die(mysql_error());
if ($setts['is_remote_pic_linkage']==1) {
$imName = $destinationImg;
$isFTP = ftp_file($imName,$destinationImg);
if ($isFTP) {
//if (file_exists($imName)) unlink($imName);
$remotePicName = $setts['remote_pic_linkage'].$destinationImg;
$updateAuctionPic = mysql_query("UPDATE yspnash_auctions SET picpath='".$remotePicName."' WHERE id='".$newId."'");
}}}}
$videoRelist = getSqlField("SELECT videofile_path FROM yspnash_auctions WHERE id='".$newId."'","videofile_path");
if (!empty($videoRelist)) {
$fileExtension = getFileExtension($videoRelist);
$videoName = "a".$newId."_video.".$fileExtension;
$isUpload = uploadFile($filePath.$videoRelist,$videoName,$filePath."uplimg/");
if ($isUpload) $updateAuctionVideo = mysql_query("UPDATE yspnash_auctions SET videofile_path='uplimg/".$videoName."' WHERE id='".$newId."'") or die(mysql_error());
}
$digdelRelist = getSqlField("SELECT digdel_path FROM yspnash_auctions WHERE id='".$newId."'","digdel_path");
if (!empty($digdelRelist)) {
$tempNumber = md5(uniqid(rand(2, 999999999)));
$thisOwnerid = getSqlField("SELECT ownerid FROM yspnash_auctions WHERE id='".$newId."'","ownerid");
$fileExtension = getFileExtension($digdelRelist);
$digdelName = date('Y')."_".$thisOwnerid."_".$tempNumber."_digdel.".$fileExtension;
$isUpload = uploadFile($filePath.$digdelRelist,$digdelName,$filePath."downloads/");
if ($isUpload) $updateAuctionDigdel = mysql_query("UPDATE yspnash_auctions SET digdel_path='downloads/".$digdelName."' WHERE id='".$newId."'") or die(mysql_error());
}
$nbAddImages = getSqlNumber("SELECT * FROM yspnash_auction_images WHERE auctionid='".$newId."'");
$auctionTemp = getSqlRow("SELECT * FROM yspnash_auctions WHERE id='".$newId."' AND active=1");
$topay = "";
$category_id = getMainCat($auctionTemp['category']);
$category_id = (getSqlNumber("SELECT category_id FROM yspnash_fees WHERE category_id='".$category_id."'")>0)?$category_id:0;
$destination_type = $auctionTemp['listin'];
if ($destination_type==""||$destination_type=="auction") $destination_type = 0;
else if ($destination_type=="store") $destination_type = 1;
else if ($destination_type=="both") $destination_type = 2;
$destination_type = (getSqlNumber("SELECT destination_type FROM yspnash_fees WHERE destination_type='".$destination_type."'")>0)?$destination_type:0;
$fee = getSqlRow("SELECT * FROM yspnash_fees WHERE category_id='".$category_id."' AND destination_type='".$destination_type."'");
if ($fee['is_setup_fee']=="Y") $topay.="Auction Setup Fee; ";
if ($fee['is_pic_fee']=="Y"&&$fee['val_pic_fee']>0&&$nbAddImages>0) $topay.="Image Gallery Fee; ";
if ($fee['is_hlitem_fee']=="Y"&&$fee['val_hlitem_fee']>0&&$auctionTemp['hlitem']=="Y"&&$setts['hl_item']==1) $topay.="Highlighted Item Fee; ";
if ($fee['is_bolditem_fee']=="Y"&&$fee['val_bolditem_fee']>0&&$auctionTemp['bolditem']=="Y"&&$setts['bold_item']==1) $topay.="Bold Item Fee; ";
if ($fee['is_enlpic_fee']=="Y"&&$fee['val_enlpic_fee']>0&&$auctionTemp['enlpicitem']=="Y"&&$setts['enlpic_item']==1) $topay.="Enlarge Picture Item Fee; ";
if ($fee['is_hpfeat_fee']=="Y"&&$fee['val_hpfeat_fee']>0&&$auctionTemp['hpfeat']=="Y"&&$setts['hp_feat']==1) $topay.="Home Page Featured Item Fee; ";
if ($fee['is_catfeat_fee']=="Y"&&$fee['val_catfeat_fee']>0&&$auctionTemp['catfeat']=="Y"&&$setts['cat_feat']==1) $topay.="Category Page Featured Item Fee; ";
if ($fee['is_hpfeatplus_fee']=="Y"&&$fee['val_hpfeatplus_fee']>0&&$auctionTemp['hpfeatplus']=="Y"&&$setts['ishpfeatplus']=="Y") $topay.="Home Page Featured-Plus Item Fee; ";
if ($fee['is_catfeatplus_fee']=="Y"&&$fee['val_catfeatplus_fee']>0&&$auctionTemp['catfeatplus']=="Y"&&$setts['iscatfeatplus']=="Y") $topay.="Category Featured-Plus Item Fee; ";
if ($fee['is_rp_fee']=="Y"&&$fee['val_rp_fee']>0&&$auctionTemp['rp']=="Y"&&$auctionTemp['rpvalue']>0) $topay.="Reserve Price Fee; ";
if ($fee['second_cat_fee']>0&&$auctionTemp['addlcategory']>0) {
$topay.="Second Category Fee; ";
$issecondcat = "Y";
} else {
$issecondcat = "N";
}
if ($fee['bin_fee']>0&&$auctionTemp['bn']=="Y"&&$auctionTemp['bnvalue']>0) $topay.="Buy It Now Fee; ";
if ($fee['lts_fee']>0&&$auctionTemp['endtime']=="lts"&&$auctionTemp['list_till_sold']==1) {
$topay.="List-Till-Sold Fee; ";
$isltsfee = "Y";
}
if ($fee['digdel_fee']>0&&!empty($auctionTemp['digdel_path'])) {
$topay.="Digital Delivery Fee; ";
$isdigdelfee = "Y";
}
if ($fee['counterstyle_fee']>0&&$auctionTemp['counter_style']>1) $topay.="Counter Style Fee; ";
if ($fee['listingdesigner_fee']>0&&$auctionTemp['template']>0) $topay.="Listing Designer Fee; ";
if ($fee['subtitleit_fee']>0&&$auctionTemp['subname']!="") $topay.="Subtitle Fee; ";
if ($fee['iconit_fee']>0&&$auctionTemp['iconit']!="000") $topay.="Listing Icon Fee; ";
if ($fee['is_dur_fee']=="Y") {
$val_dur_fee = getSqlField("SELECT val_dur_fee FROM yspnash_auction_durations WHERE days='".$auctionTemp['duration']."'","val_dur_fee");
if ($val_dur_fee>0&&$val_dur_fee!="n/a") {
$topay.="Listing Duration Fee; ";
$durfee = "Y_".$val_dur_fee;
}}
if ($fee['videofile_fee']>0&&!empty($auctionTemp['videofile_path'])) {
$topay.="Movie Upload Fee; ";
$ismoviefee = "Y";
}
$hlitem_chg = ($setts['hl_item']==1)?$auctionTemp['hlitem']:"N";
$bolditem_chg = ($setts['bold_item']==1)?$auctionTemp['bolditem']:"N";
$enlpicitem_chg = ($setts['enlpic_item']==1)?$auctionTemp['enlpicitem']:"N";
$hpfeat_chg = ($setts['hp_feat']==1)?$auctionTemp['hpfeat']:"N";
$catfeat_chg = ($setts['cat_feat']==1)?$auctionTemp['catfeat']:"N";
$hpfeatplus_chg = ($setts['ishpfeatplus']=="Y")?$auctionTemp['hpfeatplus']:"N";
$catfeatplus_chg = ($setts['iscatfeatplus']=="Y")?$auctionTemp['catfeatplus']:"N";
$qu_a = getSqlField("SELECT quantity FROM yspnash_auctions WHERE id='".$newId."'","quantity");
$qu_b = getSqlField("SELECT SUM(quant_offered) AS quant_o FROM yspnash_winners WHERE auctionid='".$auctionTemp['id']."'","quant_o");
$qu_total = $qu_a+$qu_b;
$qu_total = ($auctionTemp['auctiontype']=="dutch"||$auctionTemp['auctiontype']=="halfprice")?$qu_total:1;
$listIn = ($storeActive)?$itemListedIn:"auction";
$relistAuctionDets_1 = mysql_query("UPDATE yspnash_auctions SET startdate='".$timeNowMysql."', enddate='".$closingdate."', duration='".$auctionTemp['duration']."', closed=0, nrbids=0, maxbid=0, quantity='".$qu_total."', hlitem='".$hlitem_chg."', bolditem='".$bolditem_chg."', enlpicitem='".$enlpicitem_chg."', hpfeat='".$hpfeat_chg."', catfeat='".$catfeat_chg."', hpfeatplus='".$hpfeatplus_chg."', catfeatplus='".$catfeatplus_chg."', listin='".$listIn."', clicks=0, auto_relist_nb=auto_relist_nb-1 WHERE id='".$newId."'") or die(mysql_error());
$isFee = array(
'hpfeat' => $hpfeat_chg,
'catfeat' => $catfeat_chg,
'hpfeatplus' => $hpfeatplus_chg,
'catfeatplus' => $catfeatplus_chg,
'bold' => $bolditem_chg,
'enlpic' => $enlpicitem_chg,
'hl' => $hlitem_chg,
'rp' => $auctionTemp['rp'],
'pic_count' => $nbAddImages,
'secondcat' => $issecondcat,
'bin' => $auctionTemp['bn'],
'digdelfee' => $isdigdelfee,
'lts' => $isltsfee,
'durfee' => $durfee,
'counterstyle' => $auctionTemp['counter_style'],
'listingdesigner' => $auctionTemp['template'],
'subtitleit' => $auctionTemp['subname'],
'iconit' => $auctionTemp['iconit'],
'videofee' => $ismoviefee,
'catfeat_secondcat' => $auctionTemp['addlcategory']
);
if ($topay!=""&&!freeFees($auctionTemp['ownerid'])&&$fee['relist_fee_reduction']<100) {
$tmp = getSqlField("SELECT payment_mode FROM yspnash_users WHERE id='".$auctionTemp['ownerid']."'","payment_mode");
if ($setts['account_mode_personal']==1) $account_mode_local = ($tmp)?2:1;
else $account_mode_local = $setts['account_mode'];
if ($account_mode_local==2) {
setupFee($auctionTemp['bidstart'],$auctionTemp['currency'],$auctionTemp['id'],$isFee,FALSE,FALSE,'',$auctionTemp['category'],FALSE,FALSE,$destination_type);
$payment_status = "confirmed";
$active = 1;
} else {
$payment_status = "unconfirmed";
$active = 0;
}} else {
$payment_status = "confirmed";
$active = 1;
addcatcount($auctionTemp['category'],$auctionTemp['id']);
addcatcount($auctionTemp['addlcategory'],$auctionTemp['id']);
}
$relistAuctionDets_2 = mysql_query("UPDATE yspnash_auctions SET active='".$active."',payment_status='".$payment_status."' WHERE id='".$newId."'");
auctionApproval($newId, $auctionTemp['ownerid']);
$keywords = getSqlField("SELECT keywords FROM yspnash_auctions WHERE id='".$newId."'","keywords");
$getKeywords = mysql_query("SELECT SQL_CACHE * FROM yspnash_keywords_watch");
while ($keywordsW = mysql_fetch_array($getKeywords)) {
if (eregi($keywordsW['keyword'],$keywords)) {
$userId = $keywordsW['bidderid'];
$auctionId = $newId;
$keyword = $keywordsW['keyword'];
include_once("mails/keywordmatch.php");
}}
$userId = $auctionTemp['ownerid'];
$auctionId = $newId;
if ($nbRelistedAuctions>3) {
if (!$mailSent) include_once("mails/confirmtosellermultipleauctions.php");
$mailSent = TRUE;
} else {
include_once("mails/confirmtoseller.php");
if ($auctionTemp['chacha']=="Y"&&$setts['enable_charitysys']==1) include_once("mails/copytocharity.php");
}
deleteAuction($auctionTemp['id']);
if ($setts['istwitter']==1&&$setts['twitter_username']!=""&&$setts['twitter_password']!="") {
$curTwitter = new twitter($setts['twitter_username'],$setts['twitter_password']);
$part1 = $setts['siteurl'].processLink('auctiondetails',array('itemname' => $auctionTemp['itemname'],'id' => $auctionTemp['id']))." ";
$part2 = strtoupper($auctionTemp['itemname']);
$part3 = " - ".$lang[nash5331]." ";
$part4 = $setts['siteurl'];
list($a,$b) = explode("://",$part4);
$part4 = substr($b,0,-1);
$count_part2 = strlen($part2);
$count_part3 = strlen($part3);
$count_part4 = strlen($part4);
$count_parts = ($count_part2+$count_part3+$count_part4);
if ($count_parts>140) $part2 = substr($part2,0,-($count_parts-140));
$parts = $part1.$part2.$part3.$part4;
if (strlen($parts)>0) echo ($curTwitter->setStatus($parts)==true)?"":"";
}
$twitterDetails = getSqlRow("SELECT u.istwitter,u.twitter_username,u.twitter_password FROM yspnash_users AS u, yspnash_auctions AS a WHERE u.id=a.ownerid AND a.id='".$auctionTemp['id']."'");
if ($twitterDetails['istwitter']==1&&$twitterDetails['twitter_username']!=""&&$twitterDetails['twitter_password']!="") {
$curTwitter = new twitter($twitterDetails['twitter_username'],$twitterDetails['twitter_password']);
$part1 = $setts['siteurl'].processLink('auctiondetails',array('itemname' => $auctionTemp['itemname'],'id' => $auctionTemp['id']))." ";
$part2 = strtoupper($auctionTemp['itemname']);
$part3 = " - ".$lang[nash5331]." ";
$part4 = $setts['siteurl'];
list($a,$b) = explode("://",$part4);
$part4 = substr($b,0,-1);
$count_part2 = strlen($part2);
$count_part3 = strlen($part3);
$count_part4 = strlen($part4);
$count_parts = ($count_part2+$count_part3+$count_part4);
if ($count_parts>140) $part2 = substr($part2,0,-($count_parts-140));
$parts = $part1.$part2.$part3.$part4;
if (strlen($parts)>0) echo ($curTwitter->setStatus($parts)==true)?"":"";
}
if ($setts['isautoping']==1) doPingOMatic(ucfirst(trim($auctionTemp['itemname'])),$setts['siteurl'].processLink('auctiondetails',array('itemname' => $auctionTemp['itemname'],'id' => $auctionTemp['id'])));
if ($setts['is_tinyurls']==1) tinyurl_builder("a",$auctionTemp['id'],trim($auctionTemp['itemname']));
}}}
if ($auctionTemp['auctiontype']=="dutch"||$auctionTemp['auctiontype']=="halfprice") $subtractItem = mysql_query("UPDATE yspnash_auctions SET quantity=quantity-'".$s_quantity."' WHERE id='".$auctionTemp['id']."'");
$saveWinner = mysql_query("INSERT INTO yspnash_winners (sellerid, buyerid ,amount, auctionid, auctiontype, quant_req, quant_offered, active, payment_status, bnpurchase, purchase_date, flag_paid, directpayment_paid) VALUES ('".$auctionTemp['ownerid']."','".$buyer_id."','".$auctionTemp['bnvalue']."','".$auctionTemp['id']."','".$auctionTemp['auctiontype']."','".$s_quantity."', '".$auctionTemp['quantity']."','".$active."','".$payment_status."','1','".time()."','1','1')");
$winnerid = mysql_insert_id();
$addSale = mysql_query("UPDATE yspnash_users SET items_sold=items_sold+1 WHERE id='".$auctionTemp['ownerid']."'");
$addPurchase = mysql_query("UPDATE yspnash_users SET items_bought=items_bought+1 WHERE id='".$buyer_id."'");
$sellerUsername = getSqlField("SELECT * FROM yspnash_users WHERE id='".$auctionTemp['ownerid']."'","username");
$buyerUsername = getSqlField("SELECT * FROM yspnash_users WHERE id='".$buyer_id."'","username");
$prepareFeedbackForSeller = mysql_query("INSERT INTO yspnash_feedbacks (userid,usernick,fromid,submitted,auctionid,type) VALUES ('".$auctionTemp['ownerid']."','".$sellerUsername."','".$buyer_id."',0,'".$auctionTemp['id']."','sale')");
$prepareFeedbackForBuyer = mysql_query("INSERT INTO yspnash_feedbacks (userid,usernick,fromid,submitted,auctionid,type) VALUES ('".$buyer_id."','".$buyerUsername."','".$auctionTemp['ownerid']."',0,'".$auctionTemp['id']."','purchase')");
if ($setts['ref_crt_amt_on_refee_item_win_switch']==1) {
$getRefer = getSqlRow("SELECT * FROM nash_referrals WHERE referredusern='".$s_memberusern."'");
if ($getRefer) {
$updReferMainBalance = mysql_query("UPDATE yspnash_users SET balance=balance-'".$setts['refer_crt_amt_on_refee_item_win']."' WHERE id='".$getRefer['referrerid']."'");
$updReferCreditBalance = mysql_query("UPDATE yspnash_users SET ref_credit_balance=ref_credit_balance+'".$setts['refer_crt_amt_on_refee_item_win']."' WHERE id='".$getRefer['referrerid']."'");
$updRevTotal = mysql_query("UPDATE nash_referrals SET refer_rev_total=refer_rev_total+'".$setts['refer_crt_amt_on_refee_item_win']."' WHERE referredusern='".$s_memberusern."'");
}}
$sellerId = $auctionTemp['ownerid'];
$buyerId = $buyer_id;
$auctionId = $auctionTemp['id'];
include_once("mails/notifysellerbuynow.php");
include_once("mails/notifybuyerbuynow.php");
}}
function auctionRelist($relistId,$userId,$auctionDuration=0,$nbRelistedAuctions=0,$mailSent=FALSE,$chargeFees=TRUE,$showMessage=FALSE,$autoRelisted=FALSE,$inAdmin=FALSE) {
global $lang, $setts, $fee, $timeNowMysql;
$relistOption = 1;
//$relistOption = 2;
$filePath = ($inAdmin)?"../":"";
$currentAuction = getSqlRow("SELECT * FROM yspnash_auctions WHERE id='".$relistId."' AND ownerid='".$userId."'");
$itemListedIn = $currentAuction['listin'];
$userStore = getSqlRow("SELECT aboutpage_type, store_active, store_account_type FROM yspnash_users WHERE id='".$userId."'");
$nbStoreItems = getSqlNumber("SELECT id FROM yspnash_auctions WHERE ownerid='".$userId."' AND active='1' AND closed=0 AND deleted!='1' AND listin!='auction'");
$storeActive = FALSE;
if ($userStore['aboutpage_type']==2&&$userStore['store_active']==1) {
if ($userStore['store_account_type']==0) {
$storeActive = TRUE;
} else {
$maxStoreItems = getSqlField("SELECT store_nb_items FROM yspnash_fees_tiers WHERE id='".$userStore['store_account_type']."'","store_nb_items");
if (is_numeric($maxStoreItems)&&$maxStoreItems>$nbStoreItems) $storeActive=TRUE;
}}
$canList = FALSE;
if ($itemListedIn!="store") $canList = TRUE;
else $canList = ($storeActive)?TRUE:FALSE;
if ($canList) {
if ($currentAuction['endtime_type']!='duration') {
$actual_duration = daysleft($currentAuction['startdate'],"")/86400;
$getDurations = mysql_query("SELECT SQL_CACHE * FROM yspnash_auction_durations");
$difference = -1;
while ($a_duration = mysql_fetch_array($getDurations)) {
$new_difference = abs($actual_duration - $a_duration['days']);
if ($difference<0||$difference>$new_difference) {
$auctionDuration = $a_duration['days'];
$difference = $new_difference;
}}}
$duration = ($auctionDuration>0)?$auctionDuration:$currentAuction['duration'];
$today = date("Y-m-d H:i:s", time());
$closingdate = closingdate($today,$duration);
if ($relistOption==1) {
$relistAuction[$relist_counter] = mysql_query("INSERT INTO yspnash_auctions (itemname, description, picpath, quantity, auctiontype, bidstart, bidend, bidstart_original, rp, rpvalue, bn, bnvalue, bi, bivalue, duration, country, zip, sc,scint, pm, main_category, category, active, payment_status, startdate, enddate, closed, keywords, maxbid, ownerid, hpfeat, catfeat, bolditem, hlitem, private, currency, postage_costs, insurance, type_service, isswap, isverify, subitemname, sc_insurance, sc_type_service, estimated_weight_lbs, estimated_weight_oz, package_size_length, package_size_width, package_size_height, odd_shaped_package, handling_fee, calculated, declVal, combine_shipp, main_region, region_suburbs, template, iconit, counter_style, acceptdirectpayment, addlcategory, shipping_details, hpfeat_desc, listin, accept_payment_systems, apply_vat, auto_relist, auto_relist_bids, endtime_type, videofile_path, listing_type, offer_range_min, offer_range_max, auto_relist_nb, charity_id, charity_gets, chacha, postage_costs_ww, insurance_ww, combine_shipp_ww, type_service_ww, shipping_details_ww, digdel_path, reserveadv_timelimit, itemAddress, itemCity, itemState, myfolder_id, retail_price, postage_costs_ww_specific, postage_costs_ww_country, pa_bidders, return_policy, return_policy_ww, enlpicitem, is_start_on_first_bid, hpfeatplus, catfeatplus, list_till_sold, immediatePayment, crazy_auctiontype, tax_amt, forpickuponly) SELECT itemname, description, picpath, quantity, auctiontype, bidstart, bidend, bidstart_original, rp, rpvalue, bn, bnvalue, bi, bivalue, duration, country, zip, sc,scint, pm, main_category, category, active, payment_status, startdate, enddate, closed, keywords, maxbid, ownerid, hpfeat, catfeat, bolditem, hlitem, private, currency, postage_costs, insurance, type_service, isswap, isverify, subitemname, sc_insurance, sc_type_service, estimated_weight_lbs, estimated_weight_oz, package_size_length, package_size_width, package_size_height, odd_shaped_package, handling_fee, calculated, declVal, combine_shipp, main_region, region_suburbs, template, iconit, counter_style, acceptdirectpayment, addlcategory, shipping_details, hpfeat_desc, listin, accept_payment_systems, apply_vat, auto_relist, auto_relist_bids, endtime_type, videofile_path, listing_type, offer_range_min, offer_range_max, auto_relist_nb, charity_id, charity_gets, chacha, postage_costs_ww, insurance_ww, combine_shipp_ww, type_service_ww, shipping_details_ww, digdel_path, reserveadv_timelimit, itemAddress, itemCity, itemState, myfolder_id, retail_price, postage_costs_ww_specific, postage_costs_ww_country, pa_bidders, return_policy, return_policy_ww, enlpicitem, is_start_on_first_bid, hpfeatplus, catfeatplus, list_till_sold, immediatePayment, crazy_auctiontype, tax_amt, forpickuponly FROM yspnash_auctions b WHERE b.id='".$relistId."'");
$newId = mysql_insert_id();
$bidstart_original = getSqlField("SELECT bidstart_original FROM yspnash_auctions WHERE id='".$newId."'","bidstart_original");
if ($bidstart_original!="n/a"&&$bidstart_original!=""&&$bidstart_original>0) mysql_query("UPDATE yspnash_auctions SET bidstart='".$bidstart_original."' WHERE id='".$newId."'");
$getItemKeywords = getSqlRow("SELECT * FROM yspnash_auctions WHERE id='".$newId."'");
$getItemRegionNames = getSqlRow("SELECT * FROM nash_regions_and_suburbs WHERE id='".$getItemKeywords['main_region']."'");
$getItemSuburbNames = getSqlRow("SELECT * FROM nash_regions_and_suburbs WHERE id='".$getItemKeywords['region_suburbs']."'");
$uniteKeywordsAndItemNumber = trim($getItemKeywords['keywords']." ".$newId." ".$getItemKeywords['zip']." ".$getItemKeywords['main_region']." ".$getItemKeywords['region_suburbs']." ".$getItemRegionNames['name']." ".$getItemSuburbNames['name']);
$uptKeywords = mysql_query("UPDATE yspnash_auctions SET keywords='".$uniteKeywordsAndItemNumber."' WHERE id='".$newId."'");
$getCustomFields = mysql_query("SELECT SQL_CACHE * FROM yspnash_fields_data WHERE auctionid='".$relistId."'");
while ($relistFld = mysql_fetch_array($getCustomFields)) {
$relistCustomFields = mysql_query("INSERT INTO yspnash_fields_data (auctionid,ownerid,boxid,boxvalue,active,boxcaption) VALUES ('".$newId."','".$relistFld['ownerid']."','".$relistFld['boxid']."','".$relistFld['boxvalue']."','".$relistFld['active']."','".$relistFld['boxcaption']."')");
}
$getImages = mysql_query("SELECT SQL_CACHE * FROM yspnash_auction_images WHERE auctionid='".$relistId."'");
$addCnt = 0;
while ($relistAddImages = mysql_fetch_array($getImages)) {
if (file_exists($relistAddImages['name'])&&InStrCount($relistAddImages['name'],"http")==0) {
$fileExtension = getFileExtension($relistAddImages['name']);
$sourceImg = $relistAddImages['name'];
$destinationImg = date('Y')."_a".$newId."_addpic".$addCnt.".".$fileExtension;
$isCopied = @copy($filePath.$sourceImg,$filePath."uplimg/".$destinationImg);
$addImage[$addCnt++] = mysql_query("INSERT INTO yspnash_auction_images (name, auctionid) VALUES ('uplimg/".$destinationImg."','".$newId."')");
} else if (InStrCount($relistAddImages['name'],"http")>0) {
$addImage[$addCnt++] = mysql_query("INSERT INTO yspnash_auction_images (name, auctionid) VALUES ('".$relistAddImages['name']."','".$newId."')");
}}
$mainPicRelist = getSqlField("SELECT picpath FROM yspnash_auctions WHERE id='".$newId."'","picpath");
if ($mainPicRelist!=""&&$mainPicRelist!="n/a") {
if (file_exists($mainPicRelist)) {
$fileExtension = getFileExtension($mainPicRelist);
$sourceImg = $mainPicRelist;
$destinationImg = date('Y')."_cma".$newId."_mainpic.".$fileExtension;
$isCopied = @copy($filePath.$sourceImg,$filePath."uplimg/".$destinationImg);
$updateAuctionPic = mysql_query("UPDATE yspnash_auctions SET picpath='uplimg/".$destinationImg."' WHERE id='".$newId."'");
}}
$videoRelist = getSqlField("SELECT videofile_path FROM yspnash_auctions WHERE id='".$newId."'","videofile_path");
if (!empty($videoRelist)) {
$fileExtension = getFileExtension($videoRelist);
$videoName = "a".$newId."_video.".$fileExtension;
$isUpload = uploadFile($filePath.$videoRelist,$videoName,$filePath."uplimg/", FALSE, $filePath);
if ($isUpload) $updateAuctionVideo = mysql_query("UPDATE yspnash_auctions SET videofile_path='uplimg/".$videoName."' WHERE id='".$newId."'");
}
$digdelRelist = getSqlField("SELECT digdel_path FROM yspnash_auctions WHERE id='".$newId."'","digdel_path");
if (!empty($digdelRelist)) {
$tempNumber = md5(uniqid(rand(2, 999999999)));
$thisOwnerid = getSqlField("SELECT ownerid FROM yspnash_auctions WHERE id='".$newId."'", "ownerid");
$fileExtension = getFileExtension($digdelRelist);
$digdelName = date('Y')."_".$thisOwnerid."_".$tempNumber."_digdel.".$fileExtension;
$isUpload = uploadFile($filePath.$digdelRelist,$digdelName,$filePath."downloads/", FALSE, $filePath);
if ($isUpload) $updateAuctionDigdel = mysql_query("UPDATE yspnash_auctions SET digdel_path='downloads/".$digdelName."' WHERE id='".$newId."'");
}
} else {
$newId = $relistId;
}
$nbAddImages = getSqlNumber("SELECT * FROM yspnash_auction_images WHERE auctionid='".$newId."'");
$auctionDetails = getSqlRow("SELECT * FROM yspnash_auctions WHERE id='".$newId."'");
$topay = "";
$category_id = getMainCat($auctionDetails['category']);
$category_id = (getSqlNumber("SELECT category_id FROM yspnash_fees WHERE category_id='".$category_id."'")>0)?$category_id:0;
$destination_type = $auctionDetails['listin'];
if ($destination_type==""||$destination_type=="auction") $destination_type = 0;
else if ($destination_type=="store") $destination_type = 1;
else if ($destination_type=="both") $destination_type = 2;
$destination_type = (getSqlNumber("SELECT destination_type FROM yspnash_fees WHERE destination_type='".$destination_type."'")>0)?$destination_type:0;
$fee = getSqlRow("SELECT * FROM yspnash_fees WHERE category_id='".$category_id."' AND destination_type='".$destination_type."'");
if ($fee['is_setup_fee']=="Y") $topay.="Auction Setup Fee; ";
if ($fee['is_pic_fee']=="Y"&&$fee['val_pic_fee']>0&&$nbAddImages>0) $topay.="Image Gallery Fee; ";
if ($fee['is_hlitem_fee']=="Y"&&$fee['val_hlitem_fee']>0&&$auctionDetails['hlitem']=="Y"&&$setts['hl_item']==1) $topay.="Highlighted Item Fee; ";
if ($fee['is_bolditem_fee']=="Y"&&$fee['val_bolditem_fee']>0&&$auctionDetails['bolditem']=="Y"&&$setts['bold_item']==1) $topay.="Bold Item Fee; ";
if ($fee['is_enlpic_fee']=="Y"&&$fee['val_enlpic_fee']>0&&$auctionDetails['enlpicitem']=="Y"&&$setts['enlpic_item']==1) $topay.="Enlarge Picture Item Fee; ";
if ($fee['is_hpfeat_fee']=="Y"&&$fee['val_hpfeat_fee']>0&&$auctionDetails['hpfeat']=="Y"&&$setts['hp_feat']==1) $topay.="Home Page Featured Fee; ";
if ($fee['is_catfeat_fee']=="Y"&&$fee['val_catfeat_fee']>0&&$auctionDetails['catfeat']=="Y"&&$setts['cat_feat']==1) $topay.="Category Page Feature Fee; ";
if ($fee['is_hpfeatplus_fee']=="Y"&&$fee['val_hpfeatplus_fee']>0&&$auctionDetails['hpfeatplus']=="Y"&&$setts['ishpfeatplus']=="Y") $topay.="Home Page Featured-Plus Fee; ";
if ($fee['is_catfeatplus_fee']=="Y"&&$fee['val_catfeatplus_fee']>0&&$auctionDetails['catfeatplus']=="Y"&&$setts['iscatfeatplus']=="Y") $topay.="Category Feature-Plus Fee; ";
if ($fee['is_rp_fee']=="Y"&&$fee['val_rp_fee']>0&&$auctionDetails['rp']=="Y"&&$auctionDetails['rpvalue']>0) $topay.="Reserve Price Fee; ";
if ($fee['second_cat_fee']>0&&$auctionDetails['addlcategory']>0) {
$topay.="Second Category Fee; ";
$issecondcat = "Y";
} else $issecondcat = "N";
if ($fee['bin_fee']>0&&$auctionDetails['bn']=="Y"&&$auctionDetails['bnvalue']>0) $topay.="Buy It Now Fee; ";
if ($fee['lts_fee']>0&&$auctionDetails['endtime']=="lts"&&$auctionDetails['list_till_sold']==1) {
$topay.="List-Till-Sold Fee; ";
$isltsfee = "Y";
}
if ($fee['digdel_fee']>0&&!empty($auctionDetails['digdel_path'])) {
$topay.="Digital Delivery Fee; ";
$isdigdelfee = "Y";
}
if ($fee['counterstyle_fee']>0&&$auctionDetails['counter_style']>1) $topay.="Counter Style Fee; ";
if ($fee['listingdesigner_fee']>0&&$auctionDetails['template']>0) $topay.="Listing Designer Fee; ";
if ($fee['subtitleit_fee']>0&&$auctionDetails['subname']!="") $topay.="Subtitle Fee; ";
if ($fee['iconit_fee']>0&&$auctionDetails['iconit']!="000") $topay.="Listing Icon Fee; ";
if ($fee['is_dur_fee']=="Y") {
$val_dur_fee = getSqlField("SELECT val_dur_fee FROM yspnash_auction_durations WHERE days='".$auctionDetails['duration']."'","val_dur_fee");
if ($val_dur_fee>0&&$val_dur_fee!="n/a") {
$topay.="Listing Duration Fee; ";
$durfee = "Y_".$val_dur_fee;
}}
if ($fee['videofile_fee']>0&&!empty($auctionDetails['videofile_path'])) {
$topay.="Movie Upload Fee; ";
$ismoviefee = "Y";
}
$hlitem_chg = ($setts['hl_item']==1)?$auctionDetails['hlitem']:"N";
$bolditem_chg = ($setts['bold_item']==1)?$auctionDetails['bolditem']:"N";
$enlpicitem_chg = ($setts['enlpic_item']==1)?$auctionDetails['enlpicitem']:"N";
$hpfeat_chg = ($setts['hp_feat']==1)?$auctionDetails['hpfeat']:"N";
$catfeat_chg = ($setts['cat_feat']==1)?$auctionDetails['catfeat']:"N";
$hpfeatplus_chg = ($setts['ishpfeatplus']=="Y")?$auctionDetails['hpfeatplus']:"N";
$catfeatplus_chg = ($setts['iscatfeatplus']=="Y")?$auctionDetails['catfeatplus']:"N";
$qu_a = getSqlField("SELECT quantity FROM yspnash_auctions WHERE id='".$newId."'","quantity");
$qu_b = getSqlField("SELECT sum(quant_offered) AS quant_o FROM yspnash_winners WHERE auctionid='".$relistId."'", "quant_o");
$qu_total = $qu_a + $qu_b;
$qu_total = ($auctionDetails['auctiontype']=="dutch"||$auctionDetails['auctiontype']=="halfprice")?$qu_total:1;
$listIn = ($storeActive)?$itemListedIn:"auction";
$relist_query = "UPDATE yspnash_auctions SET ";
(array) $relist_field = NULL;
$relist_field[] = "startdate = '".$timeNowMysql."'";
$relist_field[] = "enddate = '".$closingdate."'";
$relist_field[] = "duration = '".$duration."'";
$relist_field[] = "closed = '0'";
$relist_field[] = "nrbids = '0'";
$relist_field[] = "maxbid = '0'";
$relist_field[] = "endtime_type = 'duration'";
$relist_field[] = "quantity = '".$qu_total."'";
$relist_field[] = "hlitem = '".$hlitem_chg."'";
$relist_field[] = "bolditem = '".$bolditem_chg."'";
$relist_field[] = "enlpicitem = '".$enlpicitem_chg."'";
$relist_field[] = "hpfeat = '".$hpfeat_chg."'";
$relist_field[] = "catfeat = '".$catfeat_chg."'";
$relist_field[] = "hpfeatplus = '".$hpfeatplus_chg."'";
$relist_field[] = "catfeatplus = '".$catfeatplus_chg."'";
$relist_field[] = "listin = '".$listIn."'";
$relist_field[] = "clicks = '0'";
$isFee = array(
'hpfeat' => $hpfeat_chg,
'catfeat' => $catfeat_chg,
'hpfeatplus' => $hpfeatplus_chg,
'catfeatplus' => $catfeatplus_chg,
'bold' => $bolditem_chg,
'enlpic' => $enlpicitem_chg,
'hl' => $hlitem_chg,
'rp' => $auctionDetails['rp'],
'pic_count' => $nbAddImages,
'secondcat' => $issecondcat,
'bin' => $auctionDetails['bn'],
'lts' => $isltsfee,
'digdelfee' => $isdigdelfee,
'durfee' => $durfee,
'counterstyle' => $auctionDetails['counter_style'],
'listingdesigner' => $auctionDetails['template'],
'subtitleit' => $auctionDetails['subname'],
'iconit' => $auctionDetails['iconit'],
'videofee' => $ismoviefee,
'catfeat_secondcat' => $auctionDetails['addlcategory']
);
if ($chargeFees&&!empty($topay)&&!freeFees($auctionDetails['ownerid'])&&$fee['relist_fee_reduction']<100) {
$tmp = getSqlField("SELECT payment_mode FROM yspnash_users WHERE id='".$userId."'","payment_mode");
if ($setts['account_mode_personal']==1) $account_mode_local = ($tmp)?2:1;
else $account_mode_local = $setts['account_mode'];
if ($account_mode_local==2) {
setupFee($auctionDetails['bidstart'],$auctionDetails['currency'],$auctionDetails['id'],$isFee,FALSE,FALSE,"",$auctionDetails['category'],$showMessage,FALSE,$destination_type);
$payment_status = "confirmed";
$active = 1;
} else {
$payment_status = "unconfirmed";
$active = 0;
}} else {
$payment_status = "confirmed";
$active = 1;
addcatcount($auctionDetails['category'],$auctionDetails['id']);
addcatcount($auctionDetails['addlcategory'],$auctionDetails['id']);
}
$relist_field[] = "active = '".$active."'";
$relist_field[] = "payment_status = '".$payment_status."'";
if ($autoRelisted) $relist_field[] = "auto_relist_nb=auto_relist_nb-1";
$relist_query .= implode(', ', $relist_field);
$relist_query .= " WHERE id='".$newId."' AND ownerid='".$userId."' ";
$relist_process = mysql_query($relist_query);
auctionApproval($newId, $auctionDetails['ownerid']);
$keywords = getSqlField("SELECT keywords FROM yspnash_auctions WHERE id='".$newId."'","keywords");
$getKeywords = mysql_query("SELECT SQL_CACHE * FROM yspnash_keywords_watch");
while ($keywordsW = mysql_fetch_array($getKeywords)) {
if (eregi($keywordsW['keyword'],$keywords)) {
$userId = $keywordsW['bidderid'];
$auctionId = $newId;
$keyword = $keywordsW['keyword'];
include_once($filePath."mails/keywordmatch.php");
}}
$auctionId = $newId;
if ($nbRelistedAuctions>3) {
if (!$mailSent) include_once($filePath."mails/confirmtosellermultipleauctions.php");
$mailSent = TRUE;
} else {
include_once($filePath."mails/confirmtoseller.php");
if ($auctionDetails['chacha']=="Y"&&$setts['enable_charitysys']==1) include_once("mails/copytocharity.php");
}
if ($relistOption==1) deleteAuction($relistId,FALSE,TRUE,TRUE);
if ($setts['istwitter']==1&&$setts['twitter_username']!=""&&$setts['twitter_password']!="") {
$curTwitter = new twitter($setts['twitter_username'],$setts['twitter_password']);
$part1 = $setts['siteurl'].processLink('auctiondetails',array('itemname' => $auctionDetails['itemname'],'id' => $auctionDetails['id']))." ";
$part2 = strtoupper($auctionDetails['itemname']);
$part3 = " - ".$lang[nash5331]." ";
$part4 = $setts['siteurl'];
list($a,$b) = explode("://",$part4);
$part4 = substr($b,0,-1);
$count_part2 = strlen($part2);
$count_part3 = strlen($part3);
$count_part4 = strlen($part4);
$count_parts = ($count_part2+$count_part3+$count_part4);
if ($count_parts>140) $part2 = substr($part2,0,-($count_parts-140));
$parts = $part1.$part2.$part3.$part4;
if (strlen($parts)>0) echo ($curTwitter->setStatus($parts)==true)?"":"";

Options: ReplyQuote


Subject
Views
Written By
Posted
Re: Do I have to re write querries when Partitioning?
9629
September 05, 2010 07:47PM
1692
September 06, 2010 11:38PM
2326
September 06, 2010 11:39PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.