MySQL Forums
Forum List  »  Partitioning

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

function eventType($type) {
global $lang, $setts;
if ($type=="Other") $result.="<img align=absmiddle src=\"".$setts['siteurl']."images/purpleS.gif\" border=\"0\" title=\"$lang[nash314]\">";
if ($type=="Party") $result.="<img align=absmiddle src=\"".$setts['siteurl']."images/greenS.gif\" border=\"0\" title=\"$lang[nash315]\">";
if ($type=="Meeting") $result.="<img align=absmiddle src=\"".$setts['siteurl']."images/yellowS.gif\" border=\"0\" title=\"$lang[nash316]\">";
if ($type=="Online discussion") $result.="<img align=absmiddle src=\"".$setts['siteurl']."images/blueS.gif\" border=\"0\" title=\"$lang[nash317]\">";
if ($type=="Class") $result.="<img align=absmiddle src=\"".$setts['siteurl']."images/redS.gif\" border=\"0\" title=\"$lang[nash318]\">";
return $result;
}
function eventPeriodic($periodic) {
global $lang, $setts;
if ($periodic==0) $result.="$lang[nash319]";
if ($periodic==1) $result.="$lang[nash320]";
if ($periodic==2) $result.="$lang[nash321]";
if ($periodic==3) $result.="$lang[nash322]";
if ($periodic==4) $result.="$lang[nash323]";
if ($periodic==5) $result.="$lang[nash324]";
if ($periodic==6) $result.="$lang[nash325]";
return $result;
}
function setMinBid($value,$autoIncrement,$incrementValue,$auctiontype) {
if ($auctiontype=="reverse") {
if ($autoIncrement==0) {
$getDecreasers = mysql_query("SELECT SQL_CACHE * FROM nash_reverse_bidding");
while ($decreaser = mysql_fetch_array($getDecreasers)) {
if ($value>=$decreaser['bid_from']&&$value<=$decreaser['bid_to']) {
$minimumBid = ($value-$decreaser['decreaser']);
}}} else {
$minimumBid = ($value-$incrementValue);
}} else {
if ($autoIncrement==0) {
$getIncrements = mysql_query("SELECT SQL_CACHE * FROM yspnash_bid_increments");
while ($increment = mysql_fetch_array($getIncrements)) {
if ($value>=$increment['bfrom']&&$value<=$increment['bto']) {
$minimumBid = ($value+$increment['increment']);
}}} else {
$minimumBid = ($value+$incrementValue);
}}
if ($minimumBid<=0) $minimumBid = 0.01;
return $minimumBid;
}
function deleteConfirm($oklink,$cancellink) {
global $lang;
$output = "<table width=\"70%\" border=\"0\" align=\"center\" cellpadding=\"4\" cellspacing=\"2\" class=\"border\">\n";
$output.= "<tr class=\"c2\">\n";
$output.= "<td colspan=\"2\" align=\"center\" class=\"contentfont\">".$lang[areyousure]."</td>\n";
$output.= "</tr>\n";
$output.= "<tr class=\"c3\">\n";
$output.= "<td width=\"50%\" align=\"center\" class=\"submenu\"><a href=\"".$oklink."&confirmed=yes\"><strong>".$lang[yes]."</strong></a></td>\n";
$output.= "<td align=\"center\" class=\"submenu\"><a href=\"".$cancellink."\"><strong>".$lang[no]."</strong></a></td>\n";
$output.= "</tr>\n";
$output.= "</table>";
return $output;
}
function hiddenItem($categoryId) {}
function checkbanned($bannedadr,$type) {
$query = mysql_query("SELECT SQL_CACHE * FROM yspnash_banned WHERE bannedadr='".$bannedadr."' AND type='".$type."'");
$isbanned=mysql_num_rows($query);
if ($isbanned>0) return true;
else return false;
}
$htmlfontOpen = "<p><font face=\"Verdana, Arial, Helvetica\" size=\"2\">";
$htmlfontClose = "</font></p>";
function htmlmail($to, $subject, $msg, $sender, $hmsg="", $sendMail=TRUE) {
global $siteurl, $setts, $htmlfontOpen, $htmlfontClose, $currentVersionYsp, $bcc_me;
$tz = date("Z");
$tzs = ($tz<0)?"-":"+";
$tz = abs($tz);
$tz = ($tz/3600)*100 + ($tz%3600)/60;
$sendDate = sprintf("%s %s%04d", date("D, j M Y H:i:s"), $tzs, $tz);
$uniq_id = md5(uniqid(time()));
if ($hmsg=="") $hmsg = $msg;
$htmlmsg.="<!--\n$msg\n-->\n";
if ($setts['is_sitelogo_in_emails']==1) $htmlmsg.="<html><body><img src=\"".$setts['siteurl']."images/sitelogo.gif\">".$htmlfontOpen.$hmsg.$htmlfontClose."</body></html>";
else $htmlmsg.="<html><body>".$htmlfontOpen.$hmsg.$htmlfontClose."</body></html>";
if ($setts['mailer']=="sendmail"&&$sendMail) {
$header="";
$header.="Date: ".$sendDate."\n";
$header.="Return-Path: ".$sender."\n";
$header.="To: ".$to."\n";
$header.="From: ".$setts['sitename']." <".$sender.">\n";
if ($setts['bcc']=="Y"&&$bcc_me=="") $header.="Bcc: ".$setts['adminemail']."\n";
$header.="Reply-to: ".$sender."\n";
$header.="Subject: ".$subject."\n";
$header.=sprintf("Message-ID: <%s@%s>%s", $uniq_id, $_SERVER['SERVER_NAME'], "\n");
$header.="X-Priority: 3\n";
$header.="X-Mailer: ".$setts['sitename']." [version ".$currentVersionYsp."]\n";
$header.="MIME-Version: 1.0\n";
$header.="Content-Transfer-Encoding: 7bit\n";
$header.=sprintf("Content-Type: %s; charset=\"%s\"","text/html","utf-8");
$header.= "\n\n";
if ($sender != "") $sendmail=sprintf("%s -oi -f %s -t", $setts['sendmail_path'], $sender);
else $sendmail=sprintf("%s -oi -t", $setts['sendmail_path']);
if (!@$mail=popen($sendmail, "w")) echo "Could not execute: ".$setts['sendmail_path'];
fputs($mail, $header);
fputs($mail, $htmlmsg);
$result = pclose($mail) >> 8 & 0xFF;
if ($result!=0) echo "Could not execute: ".$setts['sendmail_path'];
} else if ($setts['mailer']=="mail"&&$sendMail) {
$boundary[1]="b1_".$uniq_id;
$boundary[2]="b2_".$uniq_id;
$header="";
$header.="Date: ".$sendDate."\n";
$header.="Return-Path: ".$sender."\n";
$header.="From: ".$setts['sitename']." <".$sender.">\n";
if ($setts['bcc']=="Y"&&$bcc_me=="") $header.="Bcc: ".$setts['adminemail']."\n";
$header.="Reply-to: ".$sender."\n";
$header.=sprintf("Message-ID: <%s@%s>%s", $uniq_id, $_SERVER['SERVER_NAME'], "\n");
$header.="X-Priority: 3\n";
$header.="X-Mailer: ".$setts['sitename']." [version ".$currentVersionYsp."]\n";
$header.="MIME-Version: 1.0\n";
$header.="Content-Transfer-Encoding: 7bit\n";
$header.=sprintf("Content-Type: %s; charset=\"%s\"","text/html","utf-8");
$params = sprintf("-oi -f %s",$sender);
if (strlen(ini_get("safe_mode"))<1) {
$old_from = ini_get("sendmail_from");
ini_set("sendmail_from",$sender);
$result=@mail($to, $subject, $htmlmsg, $header, $params);
} else {
$result=@mail($to, $subject, $htmlmsg, $header);
}
if (isset($old_from)) ini_set("sendmail_from",$old_from);
if (!$result) {
$slipout = "Following problems cause the mail sending failed:";
if (trim($to)=="") $slipout.="<br />Email address is corrupt or empty.";
if (trim($subject)=="") $slipout.="<br />Email subject is corrupt or empty.";
if (trim($htmlmsg)=="") $slipout.="<br />Email message is corrupt or empty.";
if (trim($header)=="") $slipout.="<br />Email header is corrupt or missing.";
if (trim($params)=="") $slipout.="<br />Email params are corrupt or missing.";
echo $slipout;
}}
$bcc_me = "";
}
if ($s_memberid>0) {
$set = 0;
mysql_query("CREATE TABLE IF NOT EXISTS `yspnash_iphistory` (`memberid` INT NOT NULL,`time1` INT NOT NULL,`time2` INT NOT NULL,`ip` VARCHAR(20) NOT NULL)");
$getIPrecord = getSqlRow("SELECT * FROM yspnash_iphistory WHERE memberid='".$s_memberid."' ORDER BY time1 DESC LIMIT 1");
$nbIPrecords = getSqlNumber("SELECT * FROM yspnash_iphistory WHERE memberid='".$s_memberid."' ORDER BY time1 DESC");
if ($nbIPrecords>0) {
if ($getIPrecord['ip']==$_SERVER['REMOTE_ADDR']) {
$updIPrecord = mysql_query("UPDATE yspnash_iphistory SET time2='".time()."' WHERE time1='".$getIPrecord['time1']."' AND ip='".$getIPrecord['ip']."' AND memberid='".$s_memberid."'");
$set = 1;
}}
if ($set==0) $insIPrecord = mysql_query("INSERT INTO yspnash_iphistory VALUES ('".$s_memberid."','".time()."','0','".$_SERVER['REMOTE_ADDR']."')");
}
function addcatcount($catid, $auctionid=0) {
$cnt = 0;
$canAdd = TRUE;
if (getSqlField("SELECT listin FROM yspnash_auctions WHERE id='".$auctionid."'","listin") == "store") $canAdd = FALSE;
if ($catid>0&&$canAdd) {
$croot = $catid;
while ($croot>0) {
$crw = getSqlRow("SELECT parent FROM yspnash_categories WHERE id='$croot'");
$addcount[$cnt++] = mysql_query("UPDATE yspnash_categories SET items_counter=items_counter+1 WHERE id='$croot'");
$croot = $crw['parent'];
}}}
function delcatcount($catid, $auctionid=0) {
$cnt = 0;
$canDel = TRUE;
if (getSqlField("SELECT listin FROM yspnash_auctions WHERE id='".$auctionid."'","listin") == "store") $canDel = FALSE;
if ($catid>0&&$canDel) {
$croot = $catid;
while ($croot>0) {
$crw = getSqlRow("SELECT parent FROM yspnash_categories WHERE id='$croot'");
$delcount[$cnt++] = mysql_query("UPDATE yspnash_categories SET items_counter=items_counter-1 WHERE id='".$croot."'");
$croot = $crw['parent'];
}}}
function counterAddUser($user_id) {
$get_auctions = mysql_query("SELECT SQL_CACHE id,category,addlcategory FROM yspnash_auctions WHERE ownerid='".$user_id."' AND active=0 AND closed=0 AND deleted!=1");
while ($auction = mysql_fetch_array($get_auctions)) {
addcatcount($auction['category'], $auction['id']);
addcatcount($auction['addlcategory'], $auction['id']);
}
$get_wanted_ads = mysql_query("SELECT SQL_CACHE category,addlcategory FROM yspnash_wanted_ads WHERE ownerid='".$user_id."' AND active=0 AND closed=0 AND deleted!=1");
while ($wantedAd = mysql_fetch_array($get_wanted_ads)) {
addwantedcount($wantedAd['category']);
addwantedcount($wantedAd['addlcategory']);
}
$get_class_ads = mysql_query("SELECT SQL_CACHE category,addlcategory FROM nash_classified WHERE ownerid='".$user_id."' AND active=0 AND closed=0 AND deleted!=1");
while ($classAd = mysql_fetch_array($get_class_ads)) {
addclasscount($classAd['category']);
addclasscount($classAd['addlcategory']);
}}
function counterRemUser($user_id) {
$get_auctions = mysql_query("SELECT SQL_CACHE id,category,addlcategory FROM yspnash_auctions WHERE ownerid='".$user_id."' AND active=1 AND closed=0 AND deleted!=1");
while ($auction = mysql_fetch_array($get_auctions)) {
delcatcount($auction['category'],$auction['id']);
delcatcount($auction['addlcategory'],$auction['id']);
}
$get_wanted_ads = mysql_query("SELECT SQL_CACHE category,addlcategory FROM yspnash_wanted_ads WHERE ownerid='".$user_id."' AND active=1 AND closed=0 AND deleted!=1");
while ($wantedAd = mysql_fetch_array($get_wanted_ads)) {
delwantedcount($wantedAd['category']);
delwantedcount($wantedAd['addlcategory']);
}
$get_class_ads = mysql_query("SELECT SQL_CACHE category,addlcategory FROM nash_classified WHERE ownerid='".$user_id."' AND active=1 AND closed=0 AND deleted!=1");
while ($classAd = mysql_fetch_array($get_class_ads)) {
delclassifiedcount($classAd['category']);
delclassifiedcount($classAd['addlcategory']);
}}
function calcReduction($amount,$prefSeller,$voucherCode="",$feeType="",$relistReduction=0) {
global $lang, $setts;
$voucher = checkSetupVoucher(trim($voucherCode),trim($feeType));
if ($prefSeller=="N") {
$reduction = 0;
} else {
$prefSeller = trim($prefSeller);
$pref_seller_reduction = mysql_query("SELECT SQL_CACHE * FROM MOD_T_preferred_reduction WHERE type='".$prefSeller."'");
$reduction = mysql_fetch_array($pref_seller_reduction);
$reduction = $reduction['pref_seller_reduction']/100;
}
$result = $amount-($amount*$reduction);
if ($voucher['valid']) $result = $result-($result*($voucher['reduction']/100));
$result = $result-($result*($relistReduction/100));
return $result;
}
function calcHighBid($auctionid) {
$auctiontype = getSqlField("SELECT auctiontype FROM yspnash_auctions WHERE id='".$auctionid."'","auctiontype");
$order_desc = ($auctiontype=="reverse")?"DESC":"ASC";
$order_asc = ($auctiontype=="reverse")?"ASC":"DESC";
$getHighBids = mysql_query("SELECT SQL_CACHE * FROM yspnash_bids WHERE auctionid='".$auctionid."' ORDER BY bidamount ".$order_desc."");
$isBids = mysql_num_rows($getHighBids);
if ($isBids>0) {
$cnt = 0;
while ($bids = mysql_fetch_array($getHighBids)) {
$bidId[$cnt] = $bids['id'];
$bidderId[$cnt] = $bids['bidderid'];
$bidAmount[$cnt] = $bids['bidamount'];
$bidProxy[$cnt] = $bids['proxy'];
$bidQuant[$cnt] = $bids['quantity'];
$cnt++;
}
$auction = getSqlRow("SELECT rp,rpvalue FROM yspnash_auctions WHERE id='".$auctionid."'");
$reserve = ($auction['rp']=="Y")?$auction['rpvalue']:0;
$reserve = ($bidAmount[$cnt]<$reserve)?0:$reserve;
$cnt--;
$deletedBids = 0;
$highBidId = 0;
while ($cnt>0) {
if ($bidderId[$cnt]==$bidderId[$cnt-1]&&$bidAmount[$cnt-1]>=$reserve) {
$isDel = getSqlNumber("SELECT id FROM yspnash_bids WHERE id='".$bidId[$cnt]."' AND quantity='".$bidQuant[$cnt]."' AND proxy='".$bidProxy[$cnt]."'");
mysql_query("DELETE FROM yspnash_bids WHERE id='".$bidId[$cnt]."' AND quantity='".$bidQuant[$cnt]."' AND proxy='".$bidProxy[$cnt]."'");
if ($isDel) {
mysql_query("DELETE FROM yspnash_bids_history WHERE bidid='".$bidId[$cnt]."'");
$highBidId = $bidId[$cnt-1];
$highBidAmount = $bidAmount[$cnt-1];
$deletedBids++;
}}
$cnt--;
}
if ($highBidId>0) {
$setHighBid = mysql_query("UPDATE yspnash_bids SET outbid=0, invalid=0 WHERE id='".$highBidId."'");
$updateAuction = mysql_query("UPDATE yspnash_auctions SET maxbid='".$highBidAmount."', nrbids=nrbids-".$deletedBids." WHERE id='".$auctionid."'");
}
$nbActiveBids = getSqlNumber("SELECT id FROM yspnash_bids WHERE outbid=0 AND invalid=0 AND auctionid='".$auctionid."'");
if ($nbActiveBids==0) $highestBid = getSqlField("SELECT id FROM yspnash_bids WHERE auctionid='".$auctionid."' ORDER BY bidamount ".$order_asc.", id DESC LIMIT 0,1","id");
$activateBid = mysql_query("UPDATE yspnash_bids SET outbid=0,invalid=0 WHERE id='".$highestBid."'");
$nbBids = getSqlNumber("SELECT * FROM yspnash_bids WHERE auctionid='".$auctionid."'");
if ($nbBids==1&&$reserve==0) {
$auction = getSqlRow("SELECT rp,rpvalue FROM yspnash_auctions WHERE id='".$auctionid."'");
$reserve = ($auction['rp']=="Y")?$auction['rpvalue']:0;
$bidStart = getSqlField("SELECT bidstart FROM yspnash_auctions WHERE id='".$auctionid."'","bidstart");
$bidId = getSqlField("SELECT id FROM yspnash_bids WHERE auctionid='".$auctionid."'","id");
$bidProxy = getSqlField("SELECT proxy FROM yspnash_bids WHERE id='".$bidId."'","proxy");
$bidToSet = ($reserve>0&&$bidProxy>=$reserve)?$reserve:$bidStart;
$updateBid = mysql_query("UPDATE yspnash_bids SET bidamount='".$bidToSet."' WHERE auctionid='".$auctionid."'");
$updateBidHistory = mysql_query("UPDATE yspnash_bids_history SET amount='".$bidToSet."' WHERE auctionid='".$auctionid."'");
$updateAuction = mysql_query("UPDATE yspnash_auctions SET maxbid='".$bidToSet."' WHERE id='".$auctionid."'");
}
$highestBid = getSqlRow("SELECT auctionid,bidderid,bidamount,proxy FROM yspnash_bids WHERE outbid=0 AND invalid=0 AND auctionid='".$auctionid."' ORDER BY bidamount ".$order_asc.", proxy ".$order_asc." LIMIT 0,1");
if ($highestBid['proxy']>0) {
$isProxy = getSqlNumber("SELECT id FROM yspnash_proxybid WHERE auctionid='".$auctionid."'");
if ($isProxy>0) $updateProxy = mysql_query("UPDATE yspnash_proxybid SET bidderid='".$highestBid['bidderid']."',bidamount='".$highestBid['proxy']."' WHERE auctionid='".$auctionid."'");
else $insertProxy = mysql_query("INSERT INTO yspnash_proxybid (auctionid, bidderid, bidamount) VALUES ('".$auctionid."','".$highestBid['bidderid']."','".$highestBid['proxy']."')");
}
$aDets = getSqlRow("SELECT id,auctiontype FROM yspnash_auctions WHERE id='".$auctionid."'");
if ($aDets['auctiontype']=="dutch"||$aDets['auctiontype']=="halfprice") {
$outbid_bids = mysql_query("UPDATE yspnash_bids SET outbid=1 WHERE auctionid='".$aDets['id']."' AND outbid=0 AND invalid=0");
$o_cnt=0;
$getAllOutBids = mysql_query("SELECT SQL_CACHE * FROM yspnash_bids WHERE auctionid='".$aDets['id']."' AND deleted!='1' ORDER BY id DESC");
$nbOutBids = mysql_num_rows($getAllOutBids);
while ($allOutBids = mysql_fetch_array($getAllOutBids)) {
$outbid_id[$o_cnt] = $allOutBids['id'];
$outbid_quantity[$o_cnt] = $allOutBids['quantity'];
$o_cnt++;
}
$rem_qnt = $aDets['quantity'];
for ($i=0; $i<$o_cnt; $i++) {
if ($rem_qnt>0) $act_Bid[$i] = mysql_query("UPDATE yspnash_bids SET outbid='0' WHERE id='".$outbid_id[$i]."'");
$rem_qnt-=$outbid_quantity[$i];
}
$lowestActiveBid = getSqlField("SELECT proxy FROM yspnash_bids WHERE auctionid='".$auctionid."' AND invalid='0' AND outbid='0' AND deleted!='1' ORDER BY proxy ASC LIMIT 0,1","proxy");
$nbBidders = getSqlNumber("SELECT id FROM yspnash_bids WHERE auctionid='".$auctionid."' AND invalid='0' AND outbid='0' AND deleted!='1' GROUP BY bidderid");
if ($nbBidders==1) $lowestActiveBid = getSqlField("SELECT bidstart FROM yspnash_auctions WHERE id='".$auctionid."'","bidstart");
$equalizeActiveBids = mysql_query("UPDATE yspnash_bids SET bidamount='".$lowestActiveBid."' WHERE auctionid='".$auctionid."' AND invalid='0' AND bidamount>'".$lowestActiveBid."' AND deleted!='1'");
$getAB = mysql_query("SELECT SQL_CACHE id, bidamount FROM yspnash_bids WHERE auctionid='".$auctionid."'");
while ($updHist = mysql_fetch_array($getAB)) {
$updBH[$ucnt] = mysql_query("UPDATE yspnash_bids_history SET amount='".$updHist['bidamount']."' WHERE bidid='".$updHist['id']."'");
}
$updateMaxBid = mysql_query("UPDATE yspnash_auctions SET maxbid='".$lowestActiveBid."' WHERE id='".$auctionid."'");
}} else {
$updateAuction = mysql_query("UPDATE yspnash_auctions SET maxbid='0' WHERE id='".$auctionid."'");
}
$nb_bids = getSqlNumber("SELECT id FROM yspnash_bids WHERE auctionid='".$auctionid."'");
$updnbids = mysql_query("UPDATE yspnash_auctions SET nrbids=".$nb_bids." WHERE id='".$auctionid."'");
$remDeleteFlag = mysql_query("UPDATE yspnash_bids SET deleted=0 WHERE outbid=0 AND invalid=0");
}
function freeFees($userId) {
global $lang, $setts;
$prefSeller = getSqlField("SELECT preferred_seller FROM yspnash_users WHERE id='".$userId."'","preferred_seller");
if ($setts['pref_sellers']=="Y"&&$setts['pref_sellers_reduction']>=100&&$prefSeller=="Y") $freeFee = TRUE;
else $freeFee = FALSE;
return $freeFee;
}
function showFeedback($rate) {
global $lang, $setts;
if ($rate<3) echo "<img src=\"".$setts['siteurl']."images/iconNegFB_16x16.gif\" border=\"0\" align=\"absmiddle\" title=\"".$lang[negative]."\">";
else if ($rate==3) echo "<img src=\"".$setts['siteurl']."images/iconNeuFB_16x16.gif\" border=\"0\" align=\"absmiddle\" title=\"".$lang[neutral]."\">";
else if ($rate>3) echo "<img src=\"".$setts['siteurl']."images/iconPosFB_16x16.gif\" border=\"0\" align=\"absmiddle\" title=\"".$lang[positive]."\">";
}
function calcFeedback($userid, $feedbackType="") {
global $lang, $setts;
if (getSqlField("SELECT enable_fbprivate FROM yspnash_users WHERE id='".$userid."'", "enable_fbprivate")==0) {
$addQuery = "";
if ($feedbackType!="") $addQuery = " AND type='".$feedbackType."'";
$getFeedbacks = mysql_query("SELECT SQL_CACHE * FROM yspnash_feedbacks WHERE userid='".$userid."' AND submitted=1".$addQuery);
while ($fb = mysql_fetch_array($getFeedbacks)) {
if ($fb['rate']>=3) $fbPositive++;
else if ($fb['rate']<3) $fbNegative++;
}
$fbTotal = ($fbPositive+$fbNegative);
if ($fbTotal==0) $fbTotal = 1;
$toReturn = number_format(($fbPositive*100/$fbTotal),2,".",",")."%";
} else {
$toReturn = "";
}
return $toReturn;
}
function getMainCat($parent,$table='yspnash_categories') {
if ($parent>0) {
$cat = $parent;
$cntr = 0;
while ($cat>0) {
$category = $cat;
$cat = getSqlField("SELECT parent FROM $table WHERE id='".$cat."'","parent");
}}
return $category;
}
function getMainCatInClassads($parent,$table='nash_categories_classads') {
if ($parent>0) {
$cat = $parent;
$cntr = 0;
while ($cat>0) {
$category = $cat;
$cat = getSqlField("SELECT parent FROM $table WHERE id='".$cat."'","parent");
}}
return $category;
}
function underTime($auctionId) {
global $lang, $setts;
$auction = getSqlRow("SELECT enddate FROM yspnash_auctions WHERE id='".$auctionId."'");
$timeLeft = daysleft($auction['enddate'],$setts['date_format']);
$isTime = $timeLeft-(60*60*12);//12 hours
if ($isTime<=0) return FALSE;
else return TRUE;
}
function applyVat($amount,$userid) {
global $lang, $setts;
$vatExempted = "Y";
if ($setts['vat_rate']>0) $vatExempted = getSqlField("SELECT vat_exempted FROM yspnash_users WHERE id='".$userid."'","vat_exempted");
if ($vatExempted=="Y") $amountResulted = $amount;
else $amountResulted = $amount+$amount*($setts['vat_rate']/100);
return $amountResulted;
}
function createField($boxId,$selectedValue,$table='yspnash_fields') {
$getValues = mysql_query("SELECT SQL_CACHE * FROM $table WHERE boxid='".$boxId."' ORDER BY boxorder ASC");
$boxtype = getSqlField("SELECT boxtype FROM $table WHERE boxid='".$boxId."' LIMIT 0,1","boxtype");
$mandatory = getSqlField("SELECT mandatory FROM $table WHERE boxid='".$boxId."' LIMIT 0,1","mandatory");
$mandatbox = ($mandatory==1)?" id=\"mandatobox".$boxId."\"":"";
$htmlOutput = "";
if ($boxtype=="text") {
$htmlOutput = "<input type=\"text\" name=\"box".$boxId."\"".$mandatbox." value=\"".$selectedValue."\" size=\"20\" maxlength=\"30\" style=\"width: 300\">";
} else if ($boxtype=="textarea") {
$htmlOutput = "<textarea name=\"box".$boxId."\"".$mandatbox." cols=\"40\" rows=\"5\" style=\"width: 300px;\">".$selectedValue."</textarea>";
} else if ($boxtype=="list") {
$htmlOutput = "<select name=\"box".$boxId."\"".$mandatbox." style=\"width: 300px;\">\n";
while ($fields = mysql_fetch_array($getValues)) $htmlOutput .= "<option value=\"".$fields['boxvalue']."\"".(($fields['boxvalue']==$selectedValue)?" selected":"").">".$fields['boxcaption']."</option>";
$htmlOutput .= "</select>";
} else if ($boxtype=="radio") {
while ($fields = mysql_fetch_array($getValues)) $htmlOutput .= "<input type=\"radio\" name=\"box".$boxId."\"".$mandatbox." value=\"".$fields['boxvalue']."\"".(($fields['boxvalue']==$selectedValue)?" checked":"")."> ".$fields['boxcaption'];
} else if ($boxtype=="checkbox") {
while ($fields = mysql_fetch_array($getValues)) {
if ($selectedValue=="") $selectedValue = array();
$htmlOutput .= "<input type=\"checkbox\" name=\"box".$boxId."[]\"".$mandatbox." value=\"".$fields['boxvalue']."\"".((@in_array($fields['boxvalue'],$selectedValue))?" checked":"")."> ".$fields['boxcaption'];
}}
return $htmlOutput;
}
function createSearchField($boxId,$selectedValue,$table='yspnash_fields') {
$getValues = mysql_query("SELECT SQL_CACHE * FROM $table WHERE boxid='".$boxId."' ORDER BY boxorder ASC");
$boxtype = getSqlField("SELECT boxtype FROM $table WHERE boxid='".$boxId."' LIMIT 0,1","boxtype");
$htmlOutput = "";
if ($boxtype=="text") {
$htmlOutput = "<input type=\"text\" name=\"box".$boxId."\" value=\"".$selectedValue."\" size=\"20\" maxlength=\"30\" style=\"width: 165\">";
} else if ($boxtype=="textarea") {
$htmlOutput = "<textarea name=\"box".$boxId."\" cols=\"40\" rows=\"5\" style=\"width: 165\">".$selectedValue."</textarea>";
} else if ($boxtype=="list") {
$htmlOutput = "<select name=\"box".$boxId."\" style=\"width: 165\">\n";
while ($fields = mysql_fetch_array($getValues)) {
$htmlOutput .= "<option value=\"".$fields['boxvalue']."\" ".(($fields['boxvalue']==$selectedValue)?"selected":"").">".$fields['boxcaption']."</option>";
}
$htmlOutput .= "</select>";
} else if ($boxtype=="radio") {
while ($fields = mysql_fetch_array($getValues)) {
$htmlOutput .= "<input type=\"radio\" name=\"box".$boxId."\" value=\"".$fields['boxvalue']."\" ".(($fields['boxvalue']==$selectedValue)?"checked":"")."> ".$fields['boxcaption'];
}
} else if ($boxtype=="checkbox") {
while ($fields = mysql_fetch_array($getValues)) {
if ($selectedValue == "") $selectedValue = array();
$htmlOutput .= "<input type=\"checkbox\" name=\"box".$boxId."[]\" value=\"".$fields['boxvalue']."\" ".((in_array($fields['boxvalue'],$selectedValue))?"checked":"")."> ".$fields['boxcaption'];
}}
return $htmlOutput;
}
if ($setts['enable_ra']=="Y"&&$fee['is_signup_fee']=="Y"&&$fee['val_signup_fee']>0) $fullyActivate = mysql_query("UPDATE yspnash_users SET mailactivated='1' WHERE active='1' AND payment_status='confirmed' AND mailactivated='0'");
function retractBid($auctionid,$bidderid) {
global $lang, $setts;
if ($setts['enable_bid_retraction']=="Y") {
$nbBids = getSqlNumber("SELECT id FROM yspnash_bids WHERE auctionid='".$auctionid."' AND bidderid='".$bidderid."'");
$getBids = mysql_query("SELECT SQL_CACHE * FROM yspnash_bids WHERE auctionid='".$auctionid."' AND bidderid='".$bidderid."'");
while ($bids = mysql_fetch_array($getBids)) $delBidHistory = mysql_query("DELETE FROM yspnash_bids_history WHERE bidid='".$bids['id']."' AND auctionid='".$auctionid."'");
$delBid = mysql_query("DELETE FROM yspnash_bids WHERE auctionid='".$auctionid."' AND bidderid='".$bidderid."'");
$delProxyBid = mysql_query("DELETE FROM yspnash_proxybid WHERE auctionid='".$auctionid."' AND bidderid='".$bidderid."'");
$updateAuction = mysql_query("UPDATE yspnash_auctions SET nrbids=nrbids-".$nbBids." WHERE id='".$auctionid."'");
$updateBidder = mysql_query("UPDATE yspnash_users SET nb_retracted_bids=nb_retracted_bids+1 WHERE id='".$bidderid."'");
calcHighBid($auctionid);
} else {
echo "<p class=contentfont>".$lang[operation_impossible]."</p>";
}}
if ($s_memberid>0&&$s_accsusp==0) $s_membersarea = "Active";
//start of updating sessions
$_SESSION[$setts['pk']."_sessioner"] = base64_encode(nash_cc_encrypt($s_membersarea."[XAX]".$s_memberlastaccess."[XAX]".$s_memberid."[XAX]".$s_membername."[XAX]".$s_memberusern."[XAX]".$s_password."[XAX]".$s_sms_phone_number."[XAX]".$s_sms_message."[XAX]".$s_syidescription."[XAX]".$s_nb_items_per_page."[XAX]".$s_is_myfolders."[XAX]".$s_option."[XAX]".$s_charity_id."[XAX]".$s_scatid."[XAX]".$s_sstep."[XAX]".$s_llistin."[XAX]".$s_ageOkToBid."[XAX]".$s_memberzip."[XAX]".$s_memberland."[XAX]".$s_accsusp."[XAX]".$s_is_guest."[XAX]".$s_is_seller."[XAX]".$s_auctionid_refresh."[XAX]".$s_buynow_refresh."[XAX]".$s_buynow_timeout."[XAX]".$s_sess_lang."[XAX]".$s_table_to_modify."[XAX]".$s_slandid."[XAX]".$s_landname."[XAX]".$s_landflag."[XAX]".$s_mygateza_merch_id."[XAX]".$s_mygateza_app_id."[XAX]".$s_mygateza_currency."[XAX]".$s_setcom_email."[XAX]".$s_setcom_username."[XAX]".$s_setcom_pw."[XAX]".$s_setcom_currency."[XAX]".$s_label_comment1."[XAX]".$s_label_comment2."[XAX]".$s_label_comment3."[XAX]".$s_label_comment4."[XAX]".$s_label_comment5."[XAX]".$s_comment1."[XAX]".$s_comment2."[XAX]".$s_comment3."[XAX]".$s_comment4."[XAX]".$s_comment5."[XAX]".$s_quantity."[XAX]".$s_pagseguro_token."[XAX]".$s_show_msg."[XAX]".$s_showcountry."[XAX]".$s_nrs2,$setts['myprivatekey']));
//end of updating sessions
function addwantedcount($catid) {
$cnt = 0;
if ($catid>0) {
$croot = $catid;
while ($croot>0) {
$crw = getSqlRow("SELECT parent FROM yspnash_categories WHERE id='$croot'");
$addcount[$cnt++] = mysql_query("UPDATE yspnash_categories SET wanted_counter=wanted_counter+1 WHERE id='$croot'");
$croot = $crw['parent'];
}}}
function delwantedcount($catid) {
$cnt = 0;
if ($catid>0) {
$croot = $catid;
while ($croot>0) {
$crw = getSqlRow("SELECT parent FROM yspnash_categories WHERE id='$croot'");
$delcount[$cnt++] = mysql_query("UPDATE yspnash_categories SET wanted_counter=wanted_counter-1 WHERE id='$croot'");
$croot = $crw['parent'];
}}}
function addclasscount($catid) {
$cnt = 0;
if ($catid>0) {
$croot = $catid;
while ($croot>0) {
$crw = getSqlRow("SELECT parent FROM nash_categories_classads WHERE id='$croot'");
$addcount[$cnt++] = mysql_query("UPDATE nash_categories_classads SET classified_counter=classified_counter+1 WHERE id='$croot'");
$croot = $crw['parent'];
}}}
function delclassifiedcount($catid) {
$cnt = 0;
if ($catid>0) {
$croot = $catid;
while ($croot>0) {
$crw = getSqlRow("SELECT parent FROM nash_categories_classads WHERE id='$croot'");
$delcount[$cnt++] = mysql_query("UPDATE nash_categories_classads SET classified_counter=classified_counter-1 WHERE id='$croot'");
$croot = $crw['parent'];
}}}
function showPaidFlag($flag) {
global $lang;
switch ($flag) {
case 0:
$output = "<span class=redfont><strong>".$lang[flag_paid_unpaid]."</strong></span>";
break;
case 1:
$output = "<span class=greenfont><strong>".$lang[flag_paid_paid]."</strong></span>";
break;
}
return $output;
}
function showStatusFlag($flag) {
global $lang;
return $lang['flag_status_'.$flag];
}
function auctionListedIn($auctionId,$alwaysShow=FALSE) {
global $lang;
$auction = getSqlRow("SELECT ownerid, listin FROM yspnash_auctions WHERE id='".$auctionId."'");
$storeEnabled = getSqlField("SELECT aboutpage_type FROM yspnash_users WHERE id='".$auction['ownerid']."'","aboutpage_type");
$listed_in = "";
if ($storeEnabled==2||$alwaysShow) {
if ($auction['listin']=="auction") $listed_in = "[ ".$lang[listed_on_site]." ]";
else if ($auction['listin']=="store") $listed_in = "[ ".$lang[listed_in_store]." ]";
else if ($auction['listin']=="both") $listed_in = "[ ".$lang[listed_in_both]." ]";
}
return $listed_in;
}
function storeAccountType($storeAccId) {
global $lang, $setts, $fee;
$result = array();
if (!$storeAccId) {
$result['store_nb_items'] = 0;
$result['fee_amount'] = 0;
$result['store_recurring'] = 0;
$result['store_valid'] = ($fee['is_store_fee']=="N"||getSqlNumber("SELECT id FROM yspnash_fees_tiers WHERE fee_type='store'")==0)?1:0;
} else {
$getStore = mysql_query("SELECT SQL_CACHE * FROM yspnash_fees_tiers WHERE id='".$storeAccId."'");
$isStore = mysql_num_rows($getStore);
if ($isStore>0) {
$storeValues = mysql_fetch_array($getStore);
$result['store_name'] = $storeValues['store_name'];
$result['store_nb_items'] = $storeValues['store_nb_items'];
$result['fee_amount'] = $storeValues['fee_amount'];
$result['store_recurring'] = $storeValues['store_recurring'];
$result['isfeatstoretype'] = $storeValues['isfeatstoretype'];
$result['iscustomcatsstore'] = $storeValues['iscustomcatsstore'];
$result['store_condition'] = $storeValues['store_condition'];
$result['store_valid'] = 1;
} else {
$result['store_valid'] = 0;
}}
return $result;
}
function userPicmanAccountType($userPickmanAccId) {
global $lang, $setts, $fee;
$result = array();
if (!$userPickmanAccId) {
$result['picman_megabytes'] = 0;
$result['fee_amount'] = 0;
$result['picman_recurring'] = 0;
if ($fee['is_picman_fee']==0||getSqlNumber("SELECT id FROM yspnash_fees_tiers WHERE fee_type='picman'")==0) $result['picman_valid'] = 1;
else $result['picman_valid'] = 0;
} else {
$getSubscription = mysql_query("SELECT SQL_CACHE * FROM yspnash_fees_tiers WHERE id='".$userPickmanAccId."'");
$isSubscription = mysql_num_rows($getSubscription);
if ($isSubscription) {
$subscriptionValues = mysql_fetch_array($getSubscription);
$result['picman_name'] = $subscriptionValues['picman_name'];
$result['picman_megabytes'] = $subscriptionValues['picman_megabytes'];
$result['fee_amount'] = $subscriptionValues['fee_amount'];
$result['picman_recurring'] = $subscriptionValues['picman_recurring'];
$result['picman_valid'] = 1;
} else {
$result['picman_valid'] = 0;
}}
return $result;
}
function checkSignupVoucher($voucher_code) {
$valid = false;
$currentTime = time();
$getVoucher = mysql_query("SELECT SQL_CACHE id FROM yspnash_vouchers WHERE voucher_code='".$voucher_code."' AND regdate<='".$currentTime."' AND (expdate='0' OR expdate>='".$currentTime."') AND (usesleft>0 OR nbuses=0) AND active='1' AND hidden='0'");
$isVoucher = mysql_num_rows($getVoucher);
$voucher = mysql_fetch_array($getVoucher);
if ($isVoucher>0) {
if ($voucher['nbuses']>0) $updateVoucher=mysql_query("UPDATE yspnash_vouchers SET usesleft=usesleft-1 WHERE id='".$voucher['id']."'");
$valid = true;
}
return $valid;
}
function checkSetupVoucher($voucher_code,$fee_type="") {
global $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;
$result = array();
$result['valid'] = false;
$result['reduction'] = 0;
$result['nbuses'] = 0;
$result['id'] = 0;
$result['voucher_type'] = 0;
$addQuery = "";
if ($fee_type!="") $addQuery = " AND (assignto='' OR assignto=';all;' OR assignto LIKE '%".$fee_type."%')";
$currentTime = time();
$getVoucher = mysql_query("SELECT SQL_CACHE id,nbuses,reduction,voucher_type FROM yspnash_vouchers WHERE voucher_code='".$voucher_code."' AND regdate<='".$currentTime."' AND (expdate='0' OR expdate>='".$currentTime."') AND (usesleft>0 OR nbuses=0) AND (assigned_users='' OR assigned_users LIKE '%".$s_memberusern."%')".$addQuery." AND active='1' AND hidden='0'");
$isVoucher = mysql_num_rows($getVoucher);
$voucher = mysql_fetch_array($getVoucher);
if ($isVoucher>0) {
$result['valid'] = true;
$result['reduction'] = $voucher['reduction'];
$result['nbuses'] = $voucher['nbuses'];
$result['id'] = $voucher['id'];
$result['voucher_type'] = $voucher['voucher_type'];
}
return $result;
}
function getFileExtension($input_file) {
$file_array = explode(".",$input_file);
$nb_array = count($file_array);
$ext_cnt = count($file_array) - 1;
$extension = ($nb_array<=1)?"":$file_array[$ext_cnt];
$extension = strtolower($extension);
if ($extension!="gif"&&$extension!="jpg"&&$extension!="jpeg"&&$extension!="png"&&$extension!="bmp"&&$extension!="avi"&&$extension!="mpg"&&$extension!="mpeg"&&$extension!="mpe"&&$extension!="mov"&&$extension!="swf"&&$extension!="nsv"&&$extension!="w64"&&$extension!="wmv"&&$extension!="mp3"&&$extension!="wav") $extension="img";
return $extension;
}
function getFileExtension2($input_file) {
$file_array = explode(".",$input_file);
$nb_array = count($file_array);
$ext_cnt = count($file_array) - 1;
$extension = ($nb_array<=1)?"":$file_array[$ext_cnt];
$extension = strtolower($extension);
if ($extension!="zip"&&$extension!="rar"&&$extension!="sit"&&$extension!="ttf"&&$extension!="pdf"&&$extension!="doc"&&$extension!="xls"&&$extension!="ppt") $extension="nasher";
return $extension;
}
function fileUploadError($uploadError) {
global $lang;
switch ($uploadError) {
case 1:
$output = $lang[fileuplerr1];
break;
case 2:
$output = $lang[fileuplerr2];
break;
case 3:
$output = $lang[fileuplerr3];
break;
case 4:
$output = $lang[fileuplerr4];
break;
case 5:
$output = $lang[fileuplerr5];
break;
default:
$output = $lang[fileuplerr6];
}
return $output;
}
function unpaidItemDisputeReason($DisputeReason) {
global $lang;
if ($DisputeReason==1) $result = $lang[nash1360];
else if ($DisputeReason==2) $result = $lang[nash1361];
else $result = "";
return $result;
}
function unpaidItemDisputeExplanation($DisputeExplanation) {
global $lang;
if ($DisputeExplanation==11) $result=$lang[nash328];
else if ($DisputeExplanation==12) $result=$lang[nash329];
else if ($DisputeExplanation==13) $result=$lang[nash330];
else if ($DisputeExplanation==14) $result=$lang[nash331];
else if ($DisputeExplanation==15) $result=$lang[nash332];
else if ($DisputeExplanation==16) $result=$lang[nash333];
else if ($DisputeExplanation==17) $result=$lang[nash334];
else if ($DisputeExplanation==21) $result=$lang[nash335];
else if ($DisputeExplanation==22) $result=$lang[nash336];
else if ($DisputeExplanation==23) $result=$lang[nash337];
else if ($DisputeExplanation==24) $result=$lang[nash338];
else if ($DisputeExplanation==25) $result=$lang[nash339];
else if ($DisputeExplanation==26) $result=$lang[nash334];
else $result = "";
return $result;
}
function nonReceivedItemDisputeReason($DisputeReason1) {
global $lang;
if ($DisputeReason1==1) $result = $lang[nash1408];
else if ($DisputeReason1==2) $result = $lang[nash1409];
else $result = "";
return $result;
}
function nonReceivedPaymentType($PaymentType1) {
global $lang;
if ($PaymentType1==1) $result=$lang[nash1412];
else if ($PaymentType1==2) $result="PayPal";
else if ($PaymentType1==3) $result="Worldpay";
else if ($PaymentType1==4) $result="2Checkout";
else if ($PaymentType1==5) $result="Nochex";
else if ($PaymentType1==6) $result="Ikobo";
else if ($PaymentType1==7) $result="Protx";
else if ($PaymentType1==8) $result="Authorize.Net";
else if ($PaymentType1==9) $result="Moneybookers";
else if ($PaymentType1==10) $result="ANZeGate";
else if ($PaymentType1==11) $result="Google Checkout";
else if ($PaymentType1==12) $result="PayGate";
else if ($PaymentType1==13) $result="Paypal Direct Payment";
else if ($PaymentType1==14) $result="PayemQuick";
else if ($PaymentType1==15) $result="AlertPay";
else if ($PaymentType1==16) $result="Setcom";
else if ($PaymentType1==17) $result="EAWallet";
else if ($PaymentType1==18) $result="JaPayit";
else if ($PaymentType1==100) $result=$lang[nash1413];
else if ($PaymentType1==101) $result=$lang[nash1414];
else if ($PaymentType1==102) $result=$lang[nash1415];
else if ($PaymentType1==103) $result=$lang[nash1416];
else if ($PaymentType1==104) $result=$lang[nash1417];
else if ($PaymentType1==105) $result=$lang[nash1418];
else if ($PaymentType1==106) $result=$lang[nash1419];
else if ($PaymentType1==107) $result=$lang[nash1420];
else if ($PaymentType1==108) $result=$lang[nash1421];
else if ($PaymentType1==109) $result=$lang[nash1422];
else if ($PaymentType1==110) $result=$lang[nash1423];
else $result = "";
return $result;
}
function nonReceivedPaymentMonth($PaymentMonth1) {
global $lang;
if ($PaymentMonth1==1) $result=$lang[nash354];
else if ($PaymentMonth1==2) $result=$lang[nash355];
else if ($PaymentMonth1==3) $result=$lang[nash356];
else if ($PaymentMonth1==4) $result=$lang[nash357];
else if ($PaymentMonth1==5) $result=$lang[nash358];
else if ($PaymentMonth1==6) $result=$lang[nash359];
else if ($PaymentMonth1==7) $result=$lang[nash360];
else if ($PaymentMonth1==8) $result=$lang[nash361];
else if ($PaymentMonth1==9) $result=$lang[nash362];
else if ($PaymentMonth1==10) $result=$lang[nash363];
else if ($PaymentMonth1==11) $result=$lang[nash364];
else if ($PaymentMonth1==12) $result=$lang[nash365];
else $result = "";
return $result;
}
function nonReceivedPaymentDay($PaymentDay1) {
global $lang;
if ($PaymentDay1==1) $result="1";
else if ($PaymentDay1==2) $result="2";
else if ($PaymentDay1==3) $result="3";
else if ($PaymentDay1==4) $result="4";
else if ($PaymentDay1==5) $result="5";
else if ($PaymentDay1==6) $result="6";
else if ($PaymentDay1==7) $result="7";
else if ($PaymentDay1==8) $result="8";
else if ($PaymentDay1==9) $result="9";
else if ($PaymentDay1==10) $result="10";
else if ($PaymentDay1==11) $result="11";
else if ($PaymentDay1==12) $result="12";
else if ($PaymentDay1==13) $result="13";
else if ($PaymentDay1==14) $result="14";
else if ($PaymentDay1==15) $result="15";
else if ($PaymentDay1==16) $result="16";
else if ($PaymentDay1==17) $result="17";
else if ($PaymentDay1==18) $result="18";
else if ($PaymentDay1==19) $result="19";
else if ($PaymentDay1==20) $result="20";
else if ($PaymentDay1==21) $result="21";
else if ($PaymentDay1==22) $result="22";
else if ($PaymentDay1==23) $result="23";
else if ($PaymentDay1==24) $result="24";
else if ($PaymentDay1==25) $result="25";
else if ($PaymentDay1==26) $result="26";
else if ($PaymentDay1==27) $result="27";
else if ($PaymentDay1==28) $result="28";
else if ($PaymentDay1==29) $result="29";
else if ($PaymentDay1==30) $result="30";
else if ($PaymentDay1==31) $result="31";
else $result = "";
return $result;
}
if ($s_auctionid_refresh>0) {
$auct_submitted = getSqlNumber("SELECT id FROM yspnash_auctions WHERE id='".$s_auctionid_refresh."'");
if ($auct_submitted && $_REQUEST['step']!="step3") $s_auctionid_refresh = 0;
}
if ($s_buynow_refresh&&!eregi("buynow.php",$_SERVER['PHP_SELF'])) $s_buynow_refresh = FALSE;
//start of updating sessions
$_SESSION[$setts['pk']."_sessioner"] = base64_encode(nash_cc_encrypt($s_membersarea."[XAX]".$s_memberlastaccess."[XAX]".$s_memberid."[XAX]".$s_membername."[XAX]".$s_memberusern."[XAX]".$s_password."[XAX]".$s_sms_phone_number."[XAX]".$s_sms_message."[XAX]".$s_syidescription."[XAX]".$s_nb_items_per_page."[XAX]".$s_is_myfolders."[XAX]".$s_option."[XAX]".$s_charity_id."[XAX]".$s_scatid."[XAX]".$s_sstep."[XAX]".$s_llistin."[XAX]".$s_ageOkToBid."[XAX]".$s_memberzip."[XAX]".$s_memberland."[XAX]".$s_accsusp."[XAX]".$s_is_guest."[XAX]".$s_is_seller."[XAX]".$s_auctionid_refresh."[XAX]".$s_buynow_refresh."[XAX]".$s_buynow_timeout."[XAX]".$s_sess_lang."[XAX]".$s_table_to_modify."[XAX]".$s_slandid."[XAX]".$s_landname."[XAX]".$s_landflag."[XAX]".$s_mygateza_merch_id."[XAX]".$s_mygateza_app_id."[XAX]".$s_mygateza_currency."[XAX]".$s_setcom_email."[XAX]".$s_setcom_username."[XAX]".$s_setcom_pw."[XAX]".$s_setcom_currency."[XAX]".$s_label_comment1."[XAX]".$s_label_comment2."[XAX]".$s_label_comment3."[XAX]".$s_label_comment4."[XAX]".$s_label_comment5."[XAX]".$s_comment1."[XAX]".$s_comment2."[XAX]".$s_comment3."[XAX]".$s_comment4."[XAX]".$s_comment5."[XAX]".$s_quantity."[XAX]".$s_pagseguro_token."[XAX]".$s_show_msg."[XAX]".$s_showcountry."[XAX]".$s_nrs2,$setts['myprivatekey']));
//end of updating sessions
$addApprovalQuery = "";
(int)$countLimit = 20;//20 auctions per load
if ($setts['enable_auctions_approval']=="N") {
$approvedCats = ($setts['approval_categories']!="")?substr($setts['approval_categories'],0,-1):"";
$addApprovalQuery = ($approvedCats!="")?" AND (a.category IN (".$approvedCats.") OR a.addlcategory IN (".$approvedCats.") OR u.auction_approval='Y')":"";
} else if ($setts['enable_auctions_approval']=="YMINUSBIN") {
$addApprovalQuery = " AND a.bn!='Y'";
}
if ($addApprovalQuery!="") {
$approvalQuery = "SELECT a.id, a.category, a.addlcategory, a.ownerid FROM yspnash_auctions a, yspnash_users u WHERE a.approved=0 AND a.active=1 AND u.id=a.ownerid AND a.count_in_progress=0 AND (a.closed=0 OR a.enddate>'".$timeNowMysql."')".$addApprovalQuery." LIMIT 0,".$countLimit;
$getApprAucts = mysql_query($approvalQuery);
while ($apprAuct = mysql_fetch_array($getApprAucts)) {
$query_a = mysql_query("UPDATE yspnash_auctions SET active=0, count_in_progress=1 WHERE id='".$apprAuct['id']."'");
$aTemp = getSqlRow("SELECT category, addlcategory FROM yspnash_auctions WHERE id='".$apprAuct['id']."'");
delcatcount($aTemp['category'], $apprAuct['id']);
delcatcount($aTemp['addlcategory'], $apprAuct['id']);
$query_b = mysql_query("UPDATE yspnash_auctions SET count_in_progress=0 WHERE id='".$apprAuct['id']."'");
$userId = $apprAuct['ownerid'];
$auctionId = $apprAuct['id'];
include_once($fileRoot."mails/auctionapprovaluser.php");
include_once($fileRoot."mails/auctionapprovaladmin.php");
}}

function auctionApproval($auctionId,$userId,$adminPath="") {
global $setts, $timeNowMysql;
$auction = getSqlRow("SELECT id, category, addlcategory, approved, active, closed, enddate, bn FROM yspnash_auctions WHERE id='".$auctionId."' AND ownerid='".$userId."'");
$approvedCats = ','.$setts['approval_categories'].',';
$isApprovalUser = getSqlField("SELECT auction_approval FROM yspnash_users WHERE id='".$userId."'", "auction_approval");
$isApprovalCats = (eregi($auction['category'],$approvedCats)||eregi($auction['addlcategory'],$approvedCats))?'Y':'N';
$isApproval = ($isApprovalUser=="Y"||$isApprovalCats=="Y"||$setts['enable_auctions_approval']=="Y"||($setts['enable_auctions_approval']=="YMINUSBIN"&&$auction['bn']!="Y"))?'Y':'N';
if ($isApproval=="Y") {
if ($auction['approved']==0&&$auction['enddate']>$timeNowMysql&&$auction['active']==1) {
$inactivateAuction = mysql_query("UPDATE yspnash_auctions SET active=0 WHERE id='".$auction['id']."'");
if ($auction['closed']==0) {
delcatcount($auction['category'], $auction['id']);
delcatcount($auction['addlcategory'], $auction['id']);
}
include_once($adminPath."mails/auctionapprovaluser.php");
include_once($adminPath."mails/auctionapprovaladmin.php");
}
} else {
$approveAuction = mysql_query("UPDATE yspnash_auctions SET approved=1 WHERE id='".$auction['id']."'");
}}
function offerRange($offer_range_min, $offer_range_max, $currency) {
global $lang;
if (!$offer_range_min) $offer_range_min = 0;
if (!$offer_range_max) $offer_range_max = 0;
$output = $lang[from]." ".displayAmount($offer_range_min, $currency, "YES");
if ($offer_range_max) $output .= " ".$lang[to]." ".displayAmount($offer_range_max, $currency, "YES");
return $output;
}
$currentTimeOffset = time()+getSqlField("SELECT value FROM yspnash_timesettings WHERE active='selected'","value")*3600;
function sanitizeVar($value) {
if (!is_numeric($value)) {
$value = ereg_replace("[^A-Za-z0-9 ]", "", $value);
$value = eregi_replace('amp','and',$value);
$value = eregi_replace('quot','',$value);
$value = eregi_replace('039','',$value);
$value = eregi_replace(' ','-',$value);
}
return $value;
}
function sanitizeVar2($value) {
$value = ereg_replace("[^A-Za-z0-9 ]", "", $value);
$value = eregi_replace('amp','and',$value);
$value = eregi_replace('quot','',$value);
$value = eregi_replace(' ','-',$value);
return $value;
}

Options: ReplyQuote


Subject
Views
Written By
Posted
Re: Do I have to re write querries when Partitioning?
1834
September 05, 2010 07:45PM
1450
September 06, 2010 11:38PM
1934
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.