MySQL Forums
Forum List  »  Partitioning

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

$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='".$auctionDetails['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' => $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)?"":"";
}
if ($setts['isautoping']==1) doPingOMatic(ucfirst(trim($auctionDetails['itemname'])),$setts['siteurl'].processLink('auctiondetails',array('itemname' => $auctionDetails['itemname'],'id' => $auctionDetails['id'])));
if ($setts['is_tinyurls']==1) tinyurl_builder("a",$auctionDetails['id'],trim($auctionDetails['itemname']));
} else {
echo "<p align=center>$lang[no_more_items_relist_store]</p>";
}
return $mailSent;
}
function browser_detector($which_test) {
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;
$browser_name = "";
$browser_number = "";
$browser_user_agent = (isset($_SERVER['HTTP_USER_AGENT']))?strtolower($_SERVER['HTTP_USER_AGENT']):"";
// values [0] = user agent identifier, lowercase, [1] = dom browser, [2] = shorthand for browser
$a_browser_types[] = array('opera',true,'op');
$a_browser_types[] = array('msie',true,'ie');
$a_browser_types[] = array('konqueror',true,'konq');
$a_browser_types[] = array('safari',true,'saf');
$a_browser_types[] = array('gecko',true,'moz');
$a_browser_types[] = array('mozilla/4',false,'ns4');
for ($i=0; $i<count($a_browser_types); $i++) {
$s_browser = $a_browser_types[$i][0];
$b_dom = $a_browser_types[$i][1];
$browser_name = $a_browser_types[$i][2];
if (stristr($browser_user_agent,$s_browser)) {
if ($browser_name=='moz') $s_browser = 'rv';
$browser_number = browser_version($browser_user_agent,$s_browser);
break;
}}
if ($which_test=='browser') return $browser_name;
else if ($which_test=='number') return $browser_number;
else if ($which_test=='full') {
$a_browser_info = array($browser_name,$browser_number);
if (eregi("linux",$browser_user_agent)) $system = "Linux";
else if (eregi("win32",$browser_user_agent)) $system = "Windows";
else if (eregi("Win 9x 4.0",$browser_user_agent)) $system = "Windows 95";
else if (eregi("Win 9x 4.10",$browser_user_agent)) $system = "Windows 98";
else if (eregi("Win 9x 4.90",$browser_user_agent)) $system = "Windows Me";
else if (eregi("windows 2000",$browser_user_agent)||eregi("(windows nt)( ) {0,1} (5.0)",$browser_user_agent)) $system = "Windows 2000";
else if (eregi("windows ce",$browser_user_agent)||eregi("(windows nt)( ) {0,1} (5.0 build 0)",$browser_user_agent)) $system = "Windows CE";
else if (eregi("(windows nt)( ) {0,1}(5.1)",$browser_user_agent)) $system = "Windows XP";
else if (eregi("(windows nt)( ) {0,1}(5.2)",$browser_user_agent)) $system = "Windows 2003 Server";
else if (eregi("(windows nt)( ) {0,1}(6.0)",$browser_user_agent)) $system = "Windows Vista";
else if (eregi("(windows nt)( ) {0,1}(6.1)",$browser_user_agent)) $system = "Windows 7";
else if (eregi("(win)([0-9]{2})",$browser_user_agent,$regs)||eregi("(windows) ([0-9]{2})",$browser_user_agent,$regs)) $system = "Windows $regs[2]";
else if (eregi("(winnt)([0-9]{1,2}.[0-9]{1,2}) {0,1}",$browser_user_agent,$regs)) $system = "Windows NT";
else if (eregi("(windows nt)( ) {0,1}([0-9]{1,2}.[0-9]{1,2}) {0,1}",$browser_user_agent,$regs)) $system = "Windows NT";
else if (eregi("mac",$browser_user_agent))$system = "Macintosh";
else if (eregi("(mac)( ) {0,1}(9.0)",$browser_user_agent)) $system = "Macintosh OS9";
else if (eregi("(mac)( ) {0,1}(10.0)",$browser_user_agent)) $system = "Macintosh Cheetah";
else if (eregi("(mac)( ) {0,1}(10.1)",$browser_user_agent)) $system = "Macintosh Puma";
else if (eregi("(mac)( ) {0,1}(10.2)",$browser_user_agent)) $system = "Macintosh Jaguar";
else if (eregi("(mac)( ) {0,1}(10.3)",$browser_user_agent)) $system = "Macintosh Panther";
else if (eregi("(mac)( ) {0,1}(10.4)",$browser_user_agent)) $system = "Macintosh Tiger";
else if (eregi("(mac)( ) {0,1}(10.5)",$browser_user_agent)) $system = "Macintosh Leopard";
else if (eregi("(sunos) ([0-9]{1,2}.[0-9]{1,2}) {0,1}",$browser_user_agent,$regs)) $system = "SunOS $regs[2]";
else if (eregi("(beos) r([0-9]{1,2}.[0-9]{1,2}) {0,1}",$browser_user_agent,$regs)) $system = "BeOS $regs[2]";
else if (eregi("freebsd",$browser_user_agent)) $system = "FreeBSD";
else if (eregi("openbsd",$browser_user_agent)) $system = "OpenBSD";
else if (eregi("irix",$browser_user_agent)) $system = "IRIX";
else if (eregi("os/2",$browser_user_agent)) $system = "OS/2";
else if (eregi("plan9",$browser_user_agent)) $system = "Plan9";
else if (eregi("unix",$browser_user_agent)||eregi("hp-ux",$browser_user_agent)||eregi("X11",$browser_user_agent)) $system = "Unix";
else if (eregi("osf",$browser_user_agent)) $system = "OSF";
else if (eregi("up.browser",$browser_user_agent)) $system = "UpOS Mobile";
else if (eregi("up.link",$browser_user_agent)) $system = "UpLink Mobile";
else if (eregi("windows ce",$browser_user_agent)) $system = "Windows CE Mobile";
else if (eregi("iemobile",$browser_user_agent)) $system = "Windows CE Mobile";
else if (eregi("mmp",$browser_user_agent)) $system = "MMP Mobile";
else if (eregi("symbian",$browser_user_agent)) $system = "Symbian Mobile";
else if (eregi("smartphone",$browser_user_agent)) $system = "Smartphone Mobile";
else if (eregi("midp",$browser_user_agent)) $system = "MIDP Mobile";
else if (eregi("wap",$browser_user_agent)) $system = "WAP Mobile";
else if (eregi("phone",$browser_user_agent)) $system = "Phone Mobile";
else if (eregi("vodafone",$browser_user_agent)) $system = "Vodafone Mobile";
else if (eregi("o2",$browser_user_agent)) $system = "O2 Mobile";
else if (eregi("pocket",$browser_user_agent)) $system = "Pocket Mobile";
else if (eregi("mobile",$browser_user_agent)) $system = "Mobile OS";
else if (eregi("pda",$browser_user_agent)) $system = "PDA Mobile";
else if (eregi("psp",$browser_user_agent)) $system = "PSP Mobile";
else $system = "Unknown";
if ($s_membersarea=="Active") mysql_query("UPDATE yspnash_users SET user_browser='".$browser_name."', user_browser_number='".$browser_number."', user_os='".$system."' WHERE id='".$s_memberid."'");
return $a_browser_info;
}}
function browser_version($browser_user_agent,$search_string) {
$string_length = 8;
$browser_number = "";
$start_pos = strpos($browser_user_agent,$search_string);
$start_pos += strlen($search_string)+1;
for ($i=$string_length; $i>0; $i--) {
if (is_numeric(substr($browser_user_agent,$start_pos,$i))) {
$browser_number = substr($browser_user_agent,$start_pos,$i);
break;
}}
return $browser_number;
}
function whoishere($session_id, $session_user_id, $session_ip, $session_page, $session_logged_in=1, $session_admin=0) {
global $lang, $setts;
if (!preg_match('/^[A-Za-z0-9]*$/',$session_id)) $session_id = "";
if ($session_user_id==0) $session_user_id='-1';
$timeoutseconds = 300;
$session_start = time();
$timeout = $session_start-$timeoutseconds;
list($a,$b) = explode("fastreferun=",$session_page);
list($d,$c) = explode("&",$b);
$session_page = $a.$c;
list($a,$b) = explode("fastreferpw=",$session_page);
list($d,$c) = explode("&",$b);
$session_page = $a.$c;
$insertUser = mysql_query("INSERT INTO nash_whoishere (session_id, session_user_id, session_start, session_ip, session_page, session_logged_in, session_admin) VALUES ('".$session_id."','".$session_user_id."','".$session_start."','".$session_ip."','".$session_page."','".$session_logged_in."','".$session_admin."')");
$totalUsersRightNow = getSqlNumber("SELECT DISTINCT session_user_id, session_ip FROM nash_whoishere");
if ($totalUsersRightNow>$setts['nbUserEverOnline']) mysql_query("UPDATE yspnash_gen_setts2 SET nbUserEverOnline='".$totalUsersRightNow."', datetimeUserEverOnline='".date("Y-m-d H:i:s",$session_start)."'");
$deleteUser = mysql_query("DELETE FROM nash_whoishere WHERE session_start<'".$timeout."'");
$nbOnlineUsers = getSqlNumber("SELECT * FROM nash_whoishere WHERE session_page='".$session_page."'"); // tells how many users on this page
if ($users==1) $output = $nbOnlineUsers." ".$lang[nash4721];
else $output = $nbOnlineUsers." ".$lang[nash4720];
return $output;
}
function recentVisitorsPerPage($pagetype, $visitorusername, $visitorid, $ownerid, $loggedin_nonloggedin) {
global $lang, $setts;
if ($loggedin_nonloggedin=="yes") {
$nbRows = getSqlNumber("SELECT * FROM nash_recent_visitors_per_page WHERE page_type='".$pagetype."' AND owner_id='".$ownerid."'");
if ($nbRows==0) $insertRow = mysql_query("INSERT INTO nash_recent_visitors_per_page (page_type, visitors_usernames, visitors_ids, owner_id, nb_visits) VALUES ('".$pagetype."','','','".$ownerid."','0')");
$getRow = getSqlRow("SELECT * FROM nash_recent_visitors_per_page WHERE page_type='".$pagetype."' AND owner_id='".$ownerid."'");
if ($getRow['visitors_usernames']=="") {
$getRow['visitors_usernames'] = $visitorusername;
} else {
$a = explode(",",$getRow['visitors_usernames']);
if (in_array($visitorusername,$a,true)) $getRow['visitors_usernames'] = $getRow['visitors_usernames'];
else $getRow['visitors_usernames'] = $getRow['visitors_usernames'].",".$visitorusername;
}
if ($getRow['visitors_ids']=="") {
$getRow['visitors_ids'] = $visitorid;
} else {
$b = explode(",",$getRow['visitors_ids']);
if (in_array($visitorid,$b,true)) $getRow['visitors_ids'] = $getRow['visitors_ids'];
else $getRow['visitors_ids'] = $getRow['visitors_ids'].",".$visitorid;
}
$updRow = mysql_query("UPDATE nash_recent_visitors_per_page SET visitors_usernames='".$getRow['visitors_usernames']."', visitors_ids='".$getRow['visitors_ids']."', nb_visits=nb_visits+1 WHERE page_type='".$pagetype."' AND owner_id='".$ownerid."'");
$getRow = getSqlRow("SELECT * FROM nash_recent_visitors_per_page WHERE page_type='".$pagetype."' AND owner_id='".$ownerid."'");
$visitors_usernames1 = explode(",",$getRow['visitors_usernames']);
if (count($visitors_usernames1)<10) $counter1 = count($visitors_usernames1);
else $counter1 = 10;
$getRow['visitors_usernames'] = "";
for ($i=0; $i<$counter1; $i++) {
if ($visitors_usernames1[$i]!="") $getRow['visitors_usernames'] .= $visitors_usernames1[$i].",";
}
$getRow['visitors_usernames'] = substr($getRow['visitors_usernames'], 0, -1);
$visitors_ids1 = explode(",",$getRow['visitors_ids']);
if (count($visitors_ids1)<10) $counter2 = count($visitors_ids1);
else $counter2 = 10;
$getRow['visitors_ids'] = "";
for ($k=0; $k<$counter2; $k++) {
if ($visitors_ids1[$k]!="") $getRow['visitors_ids'] .= $visitors_ids1[$k].",";
}
$getRow['visitors_ids'] = substr($getRow['visitors_ids'], 0, -1);
$output = $getRow['visitors_usernames']."[RVPP]".$getRow['visitors_ids']."[RVPP]".$getRow['nb_visits'];
} else {
$nbRows = getSqlNumber("SELECT * FROM nash_recent_visitors_per_page WHERE page_type='".$pagetype."' AND owner_id='".$ownerid."'");
if ($nbRows>0) {
$getRow = getSqlRow("SELECT * FROM nash_recent_visitors_per_page WHERE page_type='".$pagetype."' AND owner_id='".$ownerid."'");
$output = $getRow['visitors_usernames']."[RVPP]".$getRow['visitors_ids']."[RVPP]".$getRow['nb_visits'];
} else {
$output = "";
}}
return $output;
}
function nashValidateCC($Num,$Name,$Expiry_m,$Expiry_y) {
$current_year = date('Y');
if (is_numeric($Expiry_m)&&($Expiry_m>0)&&($Expiry_m<13)&&is_numeric($Expiry_y)&&($Expiry_y>=$current_year)&&($Expiry_y<=($current_year+10))) {
$Name = strtolower($Name);
$GoodCard = true;
$Num = ereg_replace("[^[:digit:]]","",$Num);
switch ($Name) {
case "mastercard":
$GoodCard = ereg("^5[1-5].{14}$",$Num);
break;
case "visa":
$GoodCard = ereg("^4.{15}$|^4.{12}$",$Num);
break;
case "amex":
$GoodCard = ereg("^3[47].{13}$",$Num);
break;
case "discover":
$GoodCard = ereg("^6011.{12}$",$Num);
break;
case "dinersclub":
$GoodCard = ereg("^30[0-5].{11}$|^3[68].{12}$",$Num);
break;
case "jcb":
$GoodCard = ereg("^3.{15}$|^2131|1800.{11}$",$Num);
break;
}
$Num = strrev($Num);
$Total = 0;
for ($x=0; $x<strlen($Num); $x++) {
$digit = substr($Num,$x,1);
if ($x/2!=floor($x/2)) {
$digit *= 2;
if (strlen($digit)==2) $digit = substr($digit,0,1)+substr($digit,1,1);
}
$Total += $digit;
}
if ($GoodCard&&$Total%10==0) {
$result = 1;
if ($Expiry_y==date('Y')&&$Expiry_m<=date('n')) $result = 0;
return $result;
} else {
return 0;
}} else {
return 0;
}}
function nash_cc_encrypt($string,$myprivatekey) {
srand((double) microtime()*1000000);
$td = mcrypt_module_open(MCRYPT_RIJNDAEL_256, "",'cfb', "");
$myprivatekey = substr($myprivatekey, 0, mcrypt_enc_get_key_size($td));
$iv_size = mcrypt_enc_get_iv_size($td);
$iv = mcrypt_create_iv($iv_size, MCRYPT_RAND);
if (mcrypt_generic_init($td, $myprivatekey, $iv)!=-1) {
$c_t = mcrypt_generic($td, $string);
mcrypt_generic_deinit($td);
mcrypt_module_close($td);
$c_t = $iv.$c_t;
return $c_t;
} else {
trigger_error("cc_encrypt(A): Unable to encrypt input", E_USER_NOTICE);
}}
function nash_cc_decrypt($string,$myprivatekey) {
$td = mcrypt_module_open(MCRYPT_RIJNDAEL_256, "",'cfb', "");
$myprivatekey = substr($myprivatekey, 0, mcrypt_enc_get_key_size($td));
$iv_size = mcrypt_enc_get_iv_size($td);
$iv = substr($string,0,$iv_size);
$string = substr($string,$iv_size);
if (mcrypt_generic_init($td, $myprivatekey, $iv)!=-1) {
$c_t = mdecrypt_generic($td, $string);
mcrypt_generic_deinit($td);
mcrypt_module_close($td);
return $c_t;
} else {
trigger_error("cc_decrypt(A): Unable to decrypt input", E_USER_NOTICE);
}}
function positive_number($nr) {
if (ereg("^[0-9]+$", $nr)&&$nr>0) return true;
else return false;
}
function nashdateconvert($date,$func) {
if ($func == 1) {
list($month, $day, $year) = split('[/.-]', $date);
$date = "$year-$month-$day 00:00:00";
return $date;
}}
function replace_for_mod_rewrite(&$s) {
$urlin = array(
"'community.php'",
"'forumslist.php'",
"'groupslist.php'",
"'chatslist.php'",
"'blogslist.php'",
"'contactus.php'",
"'forum.php\?forum=([0-9]*)'",
"'forumtopic.php\?topic=([0-9]*)&boardid=([0-9]*)&start=([0-9]*)'",
"'forumtopic.php\?topic=([0-9]*)&boardid=([0-9]*)'",
"'otheritems.php\?owner=([0-9]*)&nick=([a-zA-Z0-9_\ ]*)'",
"'groupscategory.php\?mcid=([0-9]*)&id=([0-9]*)'",
"'group.php\?id=([0-9]*)'",
"'chat.php\?mcid=([0-9]*)&id=([0-9]*)'",
"'blogshome.php\?blog=([0-9]*)'",
"'blogshome.php\?blog=([0-9]*)&start=([0-9]*)'",
"'blogspermalink.php\?permalink=([0-9]*)&blog=([0-9]*)'"
/*,"'auctiondetails.php\?id=([0-9]*)'",
"'displaynews.php\?id=([0-9]*)'",
"'categories.php\?parent=([0-9]*)&show=subcats&regionX=([0-9]*)'",
"'categories.php\?parent=([0-9]*)&show=subcats'",
"'categories.php\?parent=([0-9]*)'",
"'stores.php'",
"'aboutme.php\?userid=([0-9]*)'",
"'shop.php\?userid=([0-9]*)'",
"'shop.php\?parent=([0-9]*)&userid=([0-9]*)'",
"'wanted.categories.php\?parent=([0-9]*)'",
"'wanteddetails.php\?id=([0-9]*)'",
"'categories.php\?show=subcats'",
"'categories.php\?parent=([0-9]*)&name=([a-zA-Z0-9]*)'"*/
);
$urlout = array(
"community\\1.html",
"forums\\1.html",
"groups\\1.html",
"chats\\1.html",
"blogs\\1.html",
"contact-us\\1.html",
"forum-\\1.html",
"forumtopic-\\1-\\2-\\3.html",
"forumtopic-\\1-\\2.html",
"otheritems-\\1-\\2.html",
"groupcategory-\\1-\\2.html",
"group-\\1.html",
"chat-\\1-\\2.html",
"bloghome-\\1.html",
"bloghome-\\1-\\2.html",
"blogpermalink-\\1-\\2.html"
/*,"auctiondetails-\\1.html",
"displaynews-\\1.html",
"categories-\\1-subcats-\\3-\\4.html",
"categories-\\1-subcats.html",
"categories-\\1.html",
"stores\\1.html",
"aboutme-\\1.html",
"shop-\\1.html",
"shop-\\1-\\2.html",
"wantedcategories-\\1.html",
"wanteddetails-\\1.html",
"categories-subcats\\1.html",
"categories-\\1-\\2.html"*/
);
$s = preg_replace($urlin, $urlout, $s);
return $s;
}
function cacheFetch($url,$age) {
$cacheDir = "cache/";
$filename = $cacheDir.md5($url);
$fetch = true;
if (file_exists($filename)) $fetch = (filemtime($filename)<(time()-$age));
if ($fetch) {
exec("wget -N -O ".$filename." \"".$url."\"");
exec("touch ".$filename);
}
return $filename;
}
function curBidAgainstResPrice($curBid,$resPrice,$percentile) {
$rangeTop = $resPrice;
$range = ($resPrice/100)*$percentile;
$rangeBottom = $resPrice-$range;
if ($curBid<$rangeTop&&$curBid>$rangeBottom) $result = 1;
else $result = 0;
return $result;
}
function getMeTheCountry($remoteaddress) {
$country = getSqlField("SELECT countryCode FROM nash_ip_ban WHERE beginIpNum<=INET_ATON('".$remoteaddress."') AND endIpNum>=INET_ATON('".$remoteaddress."') ORDER BY beginIpNum DESC LIMIT 0,1", "countryCode");
$country = strtolower($country);
if (!$country||$country=="n/a") $showcountry = "us";
else $showcountry = $country;
return $showcountry;
}
function adultItemCheck($auctionid) {
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;
$main_category = getSqlField("SELECT main_category FROM yspnash_auctions WHERE id='".$auctionid."'", "main_category");
$isadultcat = getSqlField("SELECT isadultcat FROM yspnash_categories WHERE id='".$main_category."'", "isadultcat");
if ($isadultcat==0) $aducat = 0;
else $aducat = 1;
if ($aducat==1) {
if ($s_membersarea=="Active") {
$enabled_view_adult = getSqlField("SELECT enabled_view_adult FROM yspnash_users WHERE id='".$s_memberid."'", "enabled_view_adult");
if ($enabled_view_adult==1) $result = 0;
else $result = 1;
} else {
$result = 1;
}} else {
$result = 0;
}
return $result;
}
function button_stock_innova($x) {
if ($x==1) {
$getButtons = mysql_query("SELECT SQL_CACHE btn_name FROM nash_innova_buttons WHERE isactive='1' AND therow='1' ORDER BY theorder");
while($button = mysql_fetch_array($getButtons)) $button_plugin .= "\"".$button['btn_name']."\",";
$result = substr($button_plugin, 0, -1);
} else if ($x==2) {
$getButtons = mysql_query("SELECT SQL_CACHE btn_name FROM nash_innova_buttons WHERE isactive='1' AND therow='2' ORDER BY theorder");
$button_plugin = ",\"BRK\",";
while($button = mysql_fetch_array($getButtons)) $button_plugin .= "\"".$button['btn_name']."\",";
$result = substr($button_plugin, 0, -1);
} else if ($x==3) {
$getButtons = mysql_query("SELECT SQL_CACHE btn_name FROM nash_innova_buttons WHERE isactive='1' AND therow='3' ORDER BY theorder");
$button_plugin = ",\"BRK\",";
while($button = mysql_fetch_array($getButtons)) $button_plugin .= "\"".$button['btn_name']."\",";
$result = substr($button_plugin, 0, -1);
} else {
$result = "";
}
return $result;
}
function button_plugin_tinymce($x) {
if ($x==1) {
$getButtons = mysql_query("SELECT SQL_CACHE btn_name FROM nash_tinymce_buttons WHERE isactive='1' AND isplugin='1' ORDER BY theorder");
while ($button = mysql_fetch_array($getButtons)) $button_plugin .= $button['btn_name'].", ";
$result = substr($button_plugin, 0, -2);
} else {
$result = "";
}
return $result;
}
function button_all_tinymce($x) {
if ($x==1) {
$getButtons = mysql_query("SELECT SQL_CACHE btn_name FROM nash_tinymce_buttons WHERE isactive='1' AND therow='1' ORDER BY theorder");
while($button = mysql_fetch_array($getButtons)) $button_plugin .= $button['btn_name'].", ";
$result = substr($button_plugin, 0, -2);
} else if ($x==2) {
$getButtons = mysql_query("SELECT SQL_CACHE btn_name FROM nash_tinymce_buttons WHERE isactive='1' AND therow='2' ORDER BY theorder");
while($button = mysql_fetch_array($getButtons)) $button_plugin .= $button['btn_name'].", ";
$result = substr($button_plugin, 0, -2);
} else if ($x==3) {
$getButtons = mysql_query("SELECT SQL_CACHE btn_name FROM nash_tinymce_buttons WHERE isactive='1' AND therow='3' ORDER BY theorder");
while($button = mysql_fetch_array($getButtons)) $button_plugin .= $button['btn_name'].", ";
$result = substr($button_plugin, 0, -2);
} else {
$result = "";
}
return $result;
}
function rating_bar($id,$units="",$static="",$enddate) {
global $lang, $setts;
$rating_unitwidth = 30;
$ip = $_SERVER['REMOTE_ADDR'];
if (!$units) $units = 10;
if (!$static) $static = FALSE;
$nbRates = getSqlNumber("SELECT id FROM nash_starratings WHERE id='".$id."'");
if (InStrCount($id,"auc")>0) $type_of_it = "auc";
else if (InStrCount($id,"cla")>0) $type_of_it = "cla";
if ($nbRates==0) $insertRate = mysql_query("INSERT INTO nash_starratings (id, total_votes, total_value, used_ips, type_of_it, enddate) VALUES ('".$id."','0','0','','".$type_of_it."','".$enddate."')");
$getRate = getSqlRow("SELECT * FROM nash_starratings WHERE id='".$id."'");
if ($getRate['total_votes']<1) $count = 0;
else $count = $getRate['total_votes'];
$current_rating = $getRate['total_value'];
$tense = ($count==1)?$lang[nash3222]:$lang[nash3729];
$voted = mysql_num_rows(mysql_query("SELECT used_ips FROM nash_starratings WHERE used_ips LIKE '%".$ip."%' AND id='".$id."'"));
$rating_width = @number_format($current_rating/$count,2)*$rating_unitwidth;
$rating1 = @number_format($current_rating/$count,1);
$rating2 = @number_format($current_rating/$count,2);
if ($static=="static") {
$static_rater = array();
$static_rater[] .= "\n".'<div class="ratingblock">';
$static_rater[] .= '<div id="unit_long'.$id.'">';
$static_rater[] .= '<ul id="unit_ul'.$id.'" class="unit-rating" style="width:'.$rating_unitwidth*$units.'px;">';
$static_rater[] .= '<li class="current-rating" style="width:'.$rating_width.'px;">'.$lang[nash4568].' '.$rating2.'/'.$units.'</li>';
$static_rater[] .= '</ul>';
$static_rater[] .= '<p class="static">'.$lang[nash4568].': <strong>'.$rating1.'</strong>/'.$units.' ('.$count.' '.$tense.' cast) <em>'.$lang[nash4570].' \''.$lang[nash4571].'\'.</em></p>';
$static_rater[] .= '</div>';
$static_rater[] .= '</div>'."\n\n";
return join("\n", $static_rater);
} else {
$rater ="";
$rater .= '<div class="ratingblock">';
$rater .= '<div id="unit_long'.$id.'">';
$rater .= '<ul id="unit_ul'.$id.'" class="unit-rating" style="width:'.$rating_unitwidth*$units.'px;">';
$rater .= '<li class="current-rating" style="width:'.$rating_width.'px;">'.$lang[nash4568].' '.$rating2.'/'.$units.'</li>';
for ($ncount = 1; $ncount <= $units; $ncount++) {
if (!$voted) {
$rater .= '<li><a href="'.$setts['siteurl'].'drawrating_step1.php?j='.$ncount.'&q='.$id.'&t='.$ip.'&c='.$units.'" title="'.$ncount.' '.$lang[nash4572].' '.$units.'" class="r'.$ncount.'-unit rater" rel="nofollow">'.$ncount.'</a></li>';
}}
$ncount=0;
$rater .= '</ul>';
$rater .= '<span';
if ($voted) $rater .= ' class="voted"';
$rater .= '>'.$lang[nash4568].': <strong>'.$rating1.'</strong>/'.$units.' ('.$count.' '.$tense.' '.$lang[nash4569].')';
$rater .= '</span>';
$rater .= '</div>';
$rater .= '</div>';
return $rater;
}}
function convertWonItemsTotal($auctionids) {
if (getSqlNumber("SELECT id FROM yspnash_winners WHERE auctionid in ($auctionids)")>0) {
$result = 0;
$getThem = mysql_query("SELECT amount,auctionid FROM yspnash_winners WHERE auctionid in ($auctionids) ORDER BY purchase_date");
while ($them = mysql_fetch_array($getThem)) {
$currency = getSqlField("SELECT currency FROM yspnash_auctions WHERE id='".$them['auctionid']."'","currency");
if ($currency==""||$currency=="n/a") $currency = "USD";
$converter = getSqlField("SELECT converter FROM yspnash_currencies WHERE symbol='".$currency."'","converter");
if (!$converter||$converter==""||$converter=="n/a") $converter = 1;
$exchange_rate = 1/$converter;
if ($exchange_rate<=0) $exchange_rate = 1;
$result+=$them['amount']*$exchange_rate;
}
$result = round($result,2);
} else {
$result = 0;
}
return $result;
}
function convertSoldItemsTotal($auctionids) {
global $lang, $setts;
if (getSqlNumber("SELECT id FROM yspnash_auctions WHERE id IN ($auctionids)")>0) {
$result1 = 0;
$getThem1 = mysql_query("SELECT SQL_CACHE w.* FROM yspnash_winners w, yspnash_auctions a WHERE w.auctionid=a.id AND a.id in ($auctionids) ORDER BY a.enddate");
while ($them1 = mysql_fetch_array($getThem1)) {
$auction = getSqlRow("SELECT * FROM yspnash_auctions WHERE id='".$them1['auctionid']."'");
$winner = getSqlRow("SELECT * FROM yspnash_users WHERE id='".$them1['buyerid']."'");
if ($setts['issellershipinternational']==1&&$auction['scint']=="Y"&&($auction['postage_costs_ww']>0||($auction['postage_costs_ww_specific']>0&&$auction['postage_costs_ww_country']!=""))) {
$winnerCountry = getSqlField("SELECT country FROM yspnash_users WHERE id='".$winner['id']."'", "country");
$sellerCountry = getSqlField("SELECT country FROM yspnash_users WHERE id='".$auction['ownerid']."'", "country");
if (trim($winnerCountry)!=trim($sellerCountry)) {
$postage_costs_ww_specific = explode("[SEP]",$auction['postage_costs_ww_specific']);
$postage_costs_ww_country = explode("[SEP]",$auction['postage_costs_ww_country']);
$list1 = "";
$list2 = "";
for ($i=0; $i<count($postage_costs_ww_specific); $i++) {
if ($postage_costs_ww_specific[$i]!=""&&$postage_costs_ww_country[$i]!=""&&InStrCount($list2,$postage_costs_ww_specific[$i]."[SEP]")==0&&trim($winnerCountry)==$postage_costs_ww_country[$i]) {
$list1 .= $postage_costs_ww_specific[$i]."[SEP]";
$list2 .= $postage_costs_ww_country[$i]."[SEP]";
$auction['postage_costs_ww'] = $postage_costs_ww_specific[$i];
continue;
}}
$auction['postage_costs'] = $auction['postage_costs_ww'];
}}
if ($setts['issellershipinternational']==1&&$auction['scint']=="Y"&&trim($auction['insurance_ww'])!="") {
$winnerCountry = getSqlField("SELECT country FROM yspnash_users WHERE id='".$winner['id']."'", "country");
$sellerCountry = getSqlField("SELECT country FROM yspnash_users WHERE id='".$auction['ownerid']."'", "country");
if (trim($winnerCountry)!=trim($sellerCountry)) $auction['insurance'] = $auction['insurance_ww'];
}
$totalSale = (($them1['amount']+$auction['postage_costs']+$auction['insurance'])*(($auction['auctiontype']=="dutch"||$auction['auctiontype']=="halfprice")?$them1['quant_req']:1));
if ($auction['currency']==""||$auction['currency']=="n/a") $auction['currency'] = "USD";
$converter1 = getSqlField("SELECT converter FROM yspnash_currencies WHERE symbol='".$auction['currency']."'","converter");
if (!$converter1||$converter1==""||$converter1=="n/a"||$converter1==0) $converter1 = 1;
$converter1 = round($converter1,2);
$exchange_rate1 = 1/$converter1;
if ($exchange_rate1<=0||$auction['currency']==$setts['currency']) $exchange_rate1 = 1;
$result1+=$totalSale*$exchange_rate1;
}
$result = round(($result1),2);
} else {
$result = 0;
}

Options: ReplyQuote


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