max(array_keys($arr)): return false; break; default: return strlen(implode($search, array_slice($arr, 0, $offset))); } } function canonise ($typ,$summblock,$link) { global $temp_robs,$pfile,$search_title,$search_link,$sres_id,$temp_pub_prod,$types,$temp_glossary; // $args = explode("&",str_replace("act=recsumm","",$_SERVER["QUERY_STRING"])); $args= explode("&",str_replace("&","&",$link)); if ($summblock){ if ($temp_glossary['incr']==0){ $reps = array("pageid","regid","show","r","c","for","global","limit","order","whr","urlid"); } else { $reps = array("pageid","regid","show","r","c","global","limit","order","whr","urlid"); } } else { $reps = array("pageid","regid","lv","show","r","c","for","sresid","global","limit","order","catid","whr","urlid","id"); } foreach($args as $arg){ $val = explode("=",$arg); if (!in_array($val[0],$reps) && $val[1] != ""){ $comb[$val[0]] = $val[1]; } } switch ($typ){ case "byprice": case "price": if ($comb['pfr'] != "" && $comb['pto'] !="") { if ($comb['fr'] % $types[$temp_pub_prod]['num2'] == 1 && $comb['to'] -$comb['fr'] == $types[$temp_pub_prod]['num2']-1) { if (floor($comb['fr'] /$types[$temp_pub_prod]['num2']) > 0){ $comb['pg']= floor($comb['fr'] /$types[$temp_pub_prod]['num2'])+1; } else { $comb['pg']= ""; } $comb['fr']=""; $comb['to']=""; } } break; default: if ($comb['fr'] % $types[$temp_pub_prod]['num2'] == 1 && $comb['to'] -$comb['fr'] == $types[$temp_pub_prod]['num2']-1) { if (floor($comb['fr'] /$types[$temp_pub_prod]['num2']) > 0){ $comb['pg']= floor($comb['fr'] /$types[$temp_pub_prod]['num2'])+1; } else { $comb['pg']= ""; } $comb['fr']=""; $comb['to']=""; } } if ($comb['act']=="recsumm"){ $comb['act']="";} if ($comb['prodnm']!=""){ $comb['nm']=$comb['prodnm'];$comb['prodnm']="";} asort($comb); if ($temp_glossary['incr'] > 0) { $canonical = $temp_robs[$pfile][2]."?glossary=".$comb['glossary']; $comb['glossary']=""; arsort($comb); } elseif ($summblock){ $canonical = $temp_robs[$pfile][3]."?for="; } else { $canonical = $temp_robs[$pfile][2]."?for="; } if ($temp_glossary['incr'] == 0) { if ($comb['for'] != "") { $canonical .= $comb['for']; } else { $canonical .= urlencode($search_link); } // if ($sres_id > 0) { // $canonical .= "&sresid=$sres_id"; // } } foreach($comb as $arg => $val){ if ($val != ""){ $canonical .= "&$arg=$val"; } } return strtolower($canonical); } function get_types(){ global $types; if (!$types){ $SQLstr = "select * from h_type where type_subtype = 1"; $result=MYSQL_QUERY($SQLstr); if ($result) { while($row = mysql_fetch_array($result, MYSQL_ASSOC)) { $id = $row["type_id"]; $blocktypes[$id] = 1; } } $SQLstr = "select * from h_type where type_disabled < 1 and type_type > 1"; $result=MYSQL_QUERY($SQLstr); if ($result) { while($row = mysql_fetch_array($result, MYSQL_ASSOC)) { if ($blocktypes[$row['type_type']] != 1){ $id = $row["type_id"]; $types[$id]['code'] = $row["type_code"]; $types[$id]['name'] = $row["type_name"]; $types[$id]['parent'] = $row["type_type"]; $types[$id]['display'] = $row["type_display"]; $types[$id]['order'] = $row["type_show_order"]; for ($i=0;$i<10;$i++){ $types[$id]['alpha'.$i] = $row["type_a".$i]; $types[$id]['num'.$i] = $row["type_n".$i]; } } } } } } function load_adv($row){ global $types; global $adv_id,$adv_nm,$adv_title,$adv_short_desc,$adv_long_desc,$adv_webiste,$adv_par_id,$adv_par_desc,$adv_priority,$adv_jump,$adv_direct_link, $adv_page,$adv_my_ref,$adv_your_ref,$adv_type,$adv_keywords,$adv_banner_img,$adv_logo_img,$adv_logo2,$adv_logo3,$adv_link_display,$adv_link_type, $adv_word_group,$adv_word_group2,$adv_link,$adv_visible,$adv_status,$adv_banner_link,$adv_logo_link,$adv_program,$adv_jump_file, $adv_full_jump,$jumplink,$adv_my_ref2,$adv_my_ref3,$adv_my_ref4,$adv_my_ref5 ; global $huburl; $odds= array("\r", "\n", "\r\n","\w","\t"); $adv_id= $row['adv_id']; $adv_nm= trim(str_replace($odds,"",$row['adv_name'])); if ($adv_nm != ""){ $adv_short_desc= trim(str_replace($odds,"",treat($row['adv_short_desc']))); $adv_long_desc= trim(str_replace($odds,"",treat($row['adv_long_desc']))); $adv_website= $row['adv_website']; $adv_page= $row['adv_page']; $adv_priority= $row['adv_priority']; $adv_my_ref= treat($row['adv_my_ref']); $adv_my_ref2= treat($row['adv_my_ref2']); $adv_my_ref3= treat($row['adv_my_ref3']); $adv_my_ref4= treat($row['adv_my_ref4']); $adv_my_ref5= treat($row['adv_my_ref5']); $adv_your_ref= treat($row['adv_your_ref']); $adv_type = $row['adv_type']; $adv_status = $row['adv_status']; $adv_visible = $row['adv_visible']; $adv_program = $row['adv_program']; $adv_keywords= $row['adv_keywords']; $adv_banner_img= $row['adv_banner_img']; $adv_banner_link= $row['adv_banner_link']; $adv_logo_img= $row['adv_logo_img']; $adv_logo2= $row['adv_logo2']; $adv_logo3= $row['adv_logo3']; $adv_logo_link= $row['adv_logo_link']; $adv_link_display= $row['adv_link_display']; $adv_link_type= $row['adv_link_type']; $adv_jump_file = strtolower(str_replace(" ","_","$adv_nm $adv_id")).".htm"; $adv_jump_file = str_replace("&","and",$adv_jump_file); $adv_full_jump = "$huburl/advertisers/". strtolower(substr($adv_nm,0,1))."/$adv_jump_file"; $adv_jump = $adv_jump_file; $adv_word_group= $row['adv_primary_wg_id']; $adv_word_group2= $row['adv_secondary_wg_id']; if ($adv_type == ADVERT){ $SQLstr ="select * from h_links,h_advertiser where link_type = 'ada' and link_secondary_id = $adv_id and adv_id=link_primary_id"; $result=MYSQL_QUERY($SQLstr); if ($result){ $row2 = mysql_fetch_array($result); $adv_par_id = $row2['link_primary_id']; if ($adv_par_id > 0){ $adv_par_desc = trim(str_replace($odds,"",$row2['adv_short_desc'])); if ($row2['adv_visible']!= 1){ $adv_visible= 0; } if ($adv_logo_img== ""){ $adv_logo_img= $row2['adv_logo_img']; } if ($adv_logo2== ""){ $adv_logo2= $row2['adv_logo2']; } if ($adv_logo3== ""){ $adv_logo3= $row2['adv_logo3']; } if ($adv_logo_link== ""){ $adv_logo_link= $row2['adv_logo_link']; } if ($adv_link_display== ""){ $adv_link_display= $row2['adv_link_display']; } if ($adv_link== ""){ $adv_link= $row2['adv_link']; } if ($adv_link_type== ""){ $adv_link_type= $row2['adv_link_type']; } if ($adv_page== ""){ $par_adv_page= $row2['adv_page']; } $adv_my_ref= treat($row2['adv_my_ref']); $adv_my_ref2= treat($row2['adv_my_ref2']); $adv_my_ref3= treat($row2['adv_my_ref3']); $adv_my_ref4= treat($row2['adv_my_ref4']); $adv_my_ref5= treat($row2['adv_my_ref5']); if ($adv_short_desc== ""){ $adv_short_desc= trim(str_replace($odds,"",treat($row2['adv_short_desc']))); } $adv_program= $row2['adv_program']; } } } if ($adv_page != "" && !strpos($adv_page,"shoppingdirectory")>0) { $adv_link = $adv_page; } if ($adv_link == "" || strpos($adv_link,"shoppingdirectory")>0) { if ($par_adv_page != "" && !strpos($par_adv_page,"shoppingdirectory")>0) { $adv_link = $par_adv_page; } elseif ($adv_my_ref != ""){ $adv_link = $types[$adv_program]['alpha3']; } elseif ($adv_logo_link != "") { $adv_link = $adv_logo_link ; } elseif ($adv_banner_link != "") { $adv_link = $adv_banner_link; } else { } } $adv_direct_link = $adv_link; if (strlen($adv_logo_link) < 5) { $adv_logo_link = $adv_link; } if (strlen($adv_banner_link) < 5) { $adv_banner_link = $adv_link; } if ($adv_link_type==0) { $adv_link_type = 100; } $adv_link = "http://***domain***/shop.php?typ=1&sresid=***sresid***&pageid=***pageid***&urlid=***urlid***&regid=***region***&advid=$adv_id&ref=".$adv_jump; $dir = $types[$adv_link_type]['alpha3']; } } function get_adv($aid){ global $commondir,$huburl; global $adv_id,$adv_nm,$adv_title,$adv_short_desc,$adv_long_desc,$adv_webiste,$adv_par_id,$adv_par_desc,$adv_priority,$adv_jump, $adv_page,$adv_my_ref,$adv_your_ref,$adv_type,$adv_keywords,$adv_banner_img,$adv_logo_img,$adv_logo2,$adv_logo3,$adv_link_display,$adv_link_type, $adv_word_group,$adv_word_group2,$adv_link,$adv_visible,$adv_status,$adv_banner_link,$adv_logo_link,$adv_program,$adv_jump_file, $adv_full_jump,$jumplink,$adv_my_ref2,$adv_my_ref3,$adv_my_ref4,$adv_my_ref5 ; $SQLstr = "select * from h_advertiser where adv_id = '$aid'"; $result=MYSQL_QUERY($SQLstr); if ($result) { $row = mysql_fetch_array($result); load_adv($row); return true; } else { return false; } } function get_wg_info($wg_id){ global $cat_id,$cat_word_id,$cat_page,$cat_title,$cat_link,$cat_name,$cat_short_desc,$cat_long_desc,$cat_status,$cat_visible, $cat_par_id,$cat_par_source_id,$cat_par_name,$tdcat,$cat_tdcat,$cat_pub_cat,$cat_par_pub_cat,$cat_type,$cat_par_type, $wg_name,$wg_word_id,$wg_disp,$wg_par_id,$wg_page,$wg_type,$wg_bg_img,$wg_page_img,$wg_logo_img,$wg_keywords,$wg_brands,$wg_template,$wg_css,$wg_link,$wg_info ,$wg_search_filter ,$wg_long_disp ,$wg_long_desc ,$wg_desc ,$wg_img1, $wg_img2 ,$wg_img3 ,$wg_catfilter ,$wg_catpriority,$wg_ppc,$wg_visible,$lastwg ; $SQLstr = "select * from h_word, h_word_groups where word_id = wg_word_id and wg_id = $wg_id "; //echo $SQLstr; $result=MYSQL_QUERY($SQLstr); $row = mysql_fetch_array($result); $wg_par_id= $row['wg_par_id']; $wg_bg_img= $row['wg_bg_img']; $wg_page_img= $row['wg_page_img']; $wg_logo_img= $row['wg_logo_img']; $wg_brands= $row['wg_brands']; $wg_page= $row['wg_page']; $wg_type= $row['wg_type']; $wg_template= $row['wg_template']; $wg_search_filter = $row['wg_search_filter']; if ($wg_id != $row['word_id']) { $SQLstr = "select * from h_word where word_id = $wg_id "; $result=MYSQL_QUERY($SQLstr); $row = mysql_fetch_array($result); } $tdcat = explode($row['word_td_cat_id'],":"); $wg_word_id = $row['word_id']; $wg_long_disp = $row['word_long_disp']; $wg_long_desc = $row['word_long_desc']; $wg_desc = $row['word_desc']; $wg_img1 = $row['word_img1']; $wg_img2 = $row['word_img2']; $wg_img3 = $row['word_img3']; $wg_css = $row['word_css']; $wg_catfilter = $row['word_cat_filter']; $wg_catpriority = $row['word_cat_priority']; $wg_keywords= $row['word_keywords']; $wg_disp = $row['word_text']; $wg_name= $row['word_word']; $wg_ppc= $row['word_ppc']; $wg_visible= $row['word_visible']; if ($wg_search_filter == ""){ $wg_search_filter = $row['word_search_filter']; } $wg_link = $row['word_link']; if ($wg_link > 0 ) { for ($i =1; $i<9;$i++){ $wg_info['a'.$i] = treat($types[$wg_link]['alpha'.$i]); $wg_info['n'.$i] = $types[$wg_link]['num'.$i]; } } else { $wg_info = ""; } $SQLstr = "select * from h_word where word_id = $wg_id "; $result=MYSQL_QUERY($SQLstr); $row = mysql_fetch_array($result); $tdcat = $row['word_td_cat_id']; $cat_name = $row['word_word']; $cat_disp = $row['word_text']; if ($cat_disp != ""){ $cat_name = $cat_disp; } else { $cat_name= ucfirst(trim(str_replace($odds,"",$row['word_word']))); } } function get_cat_info($ct_id){ global $cat_id,$cat_word_id,$cat_page,$cat_title,$cat_link,$cat_name,$cat_short_desc,$cat_long_desc,$cat_status,$cat_visible, $cat_par_id,$cat_par_source_id,$cat_par_name,$tdcat,$cat_tdcat,$cat_pub_cat,$cat_par_pub_cat,$cat_type,$cat_par_type,$cat_par_word_id,$cat_word_id; $SQLstr = "select * from h_word, h_wg_words where wgw_id = $ct_id and word_id = wgw_word_id "; $result=MYSQL_QUERY($SQLstr); if ($result){ $row = mysql_fetch_array($result); $cat_name= ucfirst(trim(str_replace($odds,"",$row['word_word']))); $cat_id= $row['wgw_id']; $cat_disp = $row['word_text']; $wgid = $row['wgw_wg_id']; $cat_word_id = $row['wgw_wg_id']; if ($cat_disp != ""){ $cat_name = $cat_disp; } else { $cat_name= ucfirst(trim(str_replace($odds,"",$row['word_word']))); } $cat_tdcat = explode(":",$row['word_td_cat_id']); } if ($wgid > 0){ $SQLstr = "select * from h_word, h_wg_words where word_id = $wgid and wgw_wg_id = $wgid and wgw_word_id = $wgid"; $result=MYSQL_QUERY($SQLstr); $row = mysql_fetch_array($result); $cat_par_id= $row['wgw_id']; $cat_par_word_id= $row['wgw_wg_id']; $cat_par_name= ucfirst($row['word_word']); }else { $cat_par_id= $cat_id; $cat_par_word_id = $cat_word_id; $cat_par_name= $cat_name; } } function get_cat_word_info($ct_id){ global $cat_id,$cat_word_id,$cat_page,$cat_title,$cat_link,$cat_name,$cat_short_desc,$cat_long_desc,$cat_status,$cat_visible, $cat_par_id,$cat_par_source_id,$cat_par_name,$tdcat,$cat_tdcat,$cat_pub_cat,$cat_par_pub_cat,$cat_type,$cat_par_type,$cat_par_word_id,$cat_word_id; $SQLstr = "select * from h_word, h_wg_words where wgw_wg_id = $ct_id and word_id = wgw_word_id "; // test for parent/subcategpry being the same first $result=MYSQL_QUERY($SQLstr); $row = mysql_fetch_array($result); if ($row['wgw_wg_id'] != $ct_id) { $SQLstr = "select * from h_word, h_wg_words where wgw_word_id = $ct_id and word_id = wgw_word_id "; $result=MYSQL_QUERY($SQLstr); $row = mysql_fetch_array($result); $cat_name= ucfirst(trim(str_replace($odds,"",$row['word_word']))); $cat_word_id= $row['wgw_word_id']; $cat_disp = $row['word_text']; if ($cat_disp != ""){ $cat_name = $cat_disp; } else { $cat_name= ucfirst(trim(str_replace($odds,"",$row['word_word']))); } $cat_par_id = $row['wgw_wg_id']; $SQLstr = "select * from h_word, h_word_groups where wg_id = $cat_par_id and word_id = wg_word_id "; $result=MYSQL_QUERY($SQLstr); $row = mysql_fetch_array($result); $cat_par_word_id= $row['word_id']; } else { $cat_name= ucfirst(trim(str_replace($odds,"",$row['word_word']))); $cat_word_id= $row['wgw_word_id']; $cat_disp = $row['word_text']; if ($cat_disp != ""){ $cat_name = $cat_disp; } else { $cat_name= ucfirst(trim(str_replace($odds,"",$row['word_word']))); } $cat_par_id = $row['wgw_id']; $SQLstr = "select * from h_word, h_wg_words where wgw_word_id = $cat_id and word_id = wgw_word_id "; $result=MYSQL_QUERY($SQLstr); $row = mysql_fetch_array($result); $cat_par_word_id= $ct_id; } } function get_template($tmp_id){ global $types,$temp_name, $temp_file,$temp_page_file, $temp_id, $temp_css, $temp_listing, $temp_advert, $temp_logos,$temp_menu,$temp_max_ads ,$temp_max_cat_ads, $temp_prod, $temp_pub_prod, $temp_pub_prod2,$temp_background,$temp_robots,$temp_privacy,$temp_aboutus,$temp_logo ,$temp_max_prods,$temp_content_format,$temp_max_pic_width,$temp_extension,$temp_directories,$temp_extra_pages,$temp_extra_files,$temp_contact ,$temp_pub_searches,$temp_searchbox,$temp_page_type, $temp_listing, $temp_static, $temp_shop,$temp_shop_2,$temp_shop_single,$temp_shop_wish,$temp_shop_summ ,$temp_pub_prod_extra,$temp_version ,$temp_table ,$temp_additional,$temp_meta,$temp_shop_promo; if ($tmp_id == '') { $tmp_id = 0; } $SQLstr = "select * from h_template where template_id = '$tmp_id'"; $result=MYSQL_QUERY($SQLstr); if ($result) { $row = mysql_fetch_array($result); load_template($row); return true; } else { return false; } } function load_template($row) { global $types,$temp_name, $temp_file,$temp_page_file, $temp_id, $temp_css, $temp_listing, $temp_advert, $temp_logos,$temp_menu,$temp_max_ads ,$temp_max_cat_ads, $temp_prod, $temp_pub_prod, $temp_pub_prod2,$temp_background,$temp_robots,$temp_privacy,$temp_aboutus,$temp_logo ,$temp_max_prods,$temp_content_format,$temp_max_pic_width,$temp_extension,$temp_directories,$temp_extra_pages,$temp_extra_files,$temp_contact ,$temp_pub_searches,$temp_searchbox,$temp_page_type, $temp_listing, $temp_static, $temp_shop,$temp_shop_2,$temp_shop_single,$temp_shop_wish,$temp_shop_summ ,$temp_pub_prod_extra,$temp_version,$temp_table ,$temp_additional,$temp_meta,$temp_shop_promo,$temp_robs,$temp_live; $temp_name = $row['template_name']; $temp_id = $row['template_id']; $temp_file = $row['template_file']; $temp_table = $row['template_table']; $temp_page_file = $row['template_page_file']; $temp_contact = $row['template_contact']; $temp_css = $row['template_css']; $temp_version = $row['template_version']; $temp_page_type = $row['template_def_page']; $temp_listing = $row['template_listing']; $temp_advert = $row['template_advert']; $temp_logos = $row['template_logos']; $temp_menu = $row['template_menu']; $temp_prod = $row['template_prod']; $temp_static = $row['template_static']; $temp_shop = $row['template_shop']; $temp_shop = $row['template_shop']; $temp_shop_2 = $types[$temp_shop]['num2']; $temp_shop_single = $types[$temp_shop]['num3']; $temp_shop_wish = $types[$temp_shop]['num4']; $temp_shop_summ = $types[$temp_shop]['num5']; $temp_shop_promo = $types[$temp_shop]['num6']; $temp_pub_prod = $row['template_pub_prod']; $temp_pub_prod2 = $row['template_prod']; $temp_pub_prod_extra = $row['template_pub_prod_extra']; $temp_max_ads = $row['template_max_ads']; $temp_max_cat_ads = $row['template_max_cat_ads']; $temp_max_prods = $row['template_max_prods']; $temp_content_format= $row['template_content_format']; $temp_max_pic_width = $row['template_max_pic_width']; $temp_extra_pages = $row['template_extra_pages']; $temp_extra_files = $row['template_extra_files']; $temp_extension = $row['template_extension']; $temp_directories = $row['template_directories']; $temp_background = $row['template_background']; $temp_logo = $row['template_logo']; $temp_live = $row['template_live']; $temp_aboutus = $row['template_aboutus']; $temp_robots = $row['template_robots']; $temp_privacy = $row['template_privacy']; $temp_pub_searches= $row['template_searches']; $temp_searchbox= $row['template_searchbox']; for ($i=0;$i<10;$i++){ $temp_additional[$i]= $row['template_additional'.$i]; } $robs = explode(":::",$types[$temp_live]['alpha1']); foreach ($robs as $rob){ $i = explode(";;;",$rob); $temp_robs[$i[0]][0]=$i[1]; $temp_robs[$i[0]][1]=$i[2]; $temp_robs[$i[0]][2]=$i[3]; $temp_robs[$i[0]][3]=$i[4]; if ($temp_robs[$i[0]][2] == "") { $temp_robs[$i[0]][2] = $i[0]; } if ($temp_robs[$i[0]][3] == "") { $temp_robs[$i[0]][3] = $i[0]; } } } function get_url($url_id){ global $uid, $nm, $title, $subtitle, $css, $dir, $keywords, $prod_keywords, $adv_keywords, $desc, $page, $domain, $type, $visible, $big_logo, $small_logo, $template, $root,$url_directories,$ug_id,$imagedir, $verify, $pub_keywords,$brand_keywords, $insert1,$insert2,$insert3,$insert4,$insert5,$insert6,$insert7,$insert8,$insert9,$insert10,$columns,$advct,$html,$banner, $ref1,$ref2,$ref3,$ref4,$ref5,$url_status,$word_group,$word_group2,$tdcat,$tdurl,$showpages,$reldt,$head_inserts; $SQLstr = "select * from h_url where url_id = '$url_id'"; $result=MYSQL_QUERY($SQLstr); if ($result) { $row = mysql_fetch_array($result); load_url($row); return true; } else { return false; } } function load_url($row) { global $uid, $nm, $title, $subtitle, $css, $dir, $keywords, $prod_keywords, $adv_keywords, $desc, $page, $domain, $type, $visible, $big_logo, $small_logo, $template, $root,$url_directories,$ug_id,$imagedir, $verify, $pub_keywords,$brand_keywords, $insert1,$insert2,$insert3,$insert4,$insert5,$insert6,$insert7,$insert8,$insert9,$insert10,$columns,$advct,$html,$banner, $ref1,$ref2,$ref3,$ref4,$ref5,$url_status,$word_group,$word_group2,$tdcat,$tdurl,$showpages,$reldt,$head_inserts; global $types; $uid = $row['url_id']; $nm = $row['url_name']; $title = ucfirst($row['url_title']); $ug_id = $row['url_ug_id']; $url_status= $row['url_status']; $subtitle = ucfirst($row['url_subtitle']); $css = $row['url_css']; $word_group= $row['url_word_group_id']; $word_group2= $row['url_word_group_id2']; $dir = $row['url_dir']; $advct = $row['url_adv_count']; $html = $row['url_html']; $links = $row['url_links']; $dir = $row['url_dir']; $url_directories = $row['url_directories']; $head = $row['url_head']; $foot = $row['url_foot']; $root = $row['url_root']; $keywords = $row['url_keywords']; $verify = $row['url_verify']; $prod_keywords = $row['url_prod_keywords']; $tdurl = $row['url_td_id']; $adv_keywords = $row['url_adv_keywords']; $pub_keywords = $row['url_pub_keywords']; $desc = $row['url_description']; $page = $row['url_content_page']; $domain = strtolower($row['url_domain']); if (strpos($domain,"www") ===false){ $tes = str_replace(".co.uk","",$domain); if (strpos($tes,".") ===false){ $domain = "www.".$domain; } } $type = $row['url_type']; if ($types[$type]['alpha1'] == "showpages"){ $showpages = "ON"; } $template = $row['url_template']; $big_logo = $row['url_big_logo']; $small_logo = $row['url_small_logo']; $visible = $row['url_visible']; $insert1 = $row['url_insert1']; $insert2 = $row['url_insert2']; $insert3 = $row['url_insert3']; $insert4 = $row['url_insert4']; $insert5 = $row['url_insert5']; $insert6 = $row['url_insert6']; $insert7 = $row['url_insert7']; $insert8 = $row['url_insert8']; $insert9 = $row['url_insert9']; $insert10 = $row['url_insert10']; $ref1 = $row['url_ref1']; $ref2 = $row['url_ref2']; $ref3 = $row['url_ref3']; $ref4 = $row['url_ref4']; $ref5 = $row['url_ref5']; $columns = $row['url_columns']; } function prod_img($thumb,$url,$alt,$wd,$align,$cls){ global $imagedir; if($thumb!=''){ if($wd != ''){ $wdt = "height=\"$wd\""; } $hide = "target=\"_blank\""; if($url != ''){ $href = ""; $href2 = ""; } if($wd != ''){ $wdt = "height=\"$wd\""; } if ($cls =="") { $cls ="prodimg"; } if (strpos($thumb,"http://")===false){ return "$href\"$alt\"$href2"; } else { return "$href\"$alt\"$href2"; } } } function clean_prod($ret){ global $myprod,$advused,$types,$ct,$temp_pub_prod,$imagedir,$sres_id,$basket,$version,$search_title,$search_link; global $adv_id,$adv_nm,$adv_title,$adv_short_desc,$adv_long_desc,$adv_webiste,$adv_par_id,$adv_par_desc,$adv_priority,$adv_jump, $adv_page,$adv_my_ref,$adv_your_ref,$adv_type,$adv_keywords,$adv_banner_img,$adv_logo_img,$adv_logo2,$adv_logo3,$adv_link_display,$adv_link_type, $adv_word_group,$adv_word_group2,$adv_link,$adv_visible,$adv_status,$adv_banner_link,$adv_logo_link,$adv_program,$adv_jump_file, $adv_full_jump,$jumplink,$adv_my_ref2,$adv_my_ref3,$adv_my_ref4,$adv_my_ref5 ; $ret = str_replace("***count***",$ct,$ret); //$ret = str_replace("class=proda","class=\"producta\"",$ret); //$ret = str_replace("class=prodb","class=\"productb\"",$ret); //$ret = str_replace("class=prodc","class=\"productc\"",$ret); $desclen = $types [$temp_pub_prod] ['num7']; $namelen = $types [$temp_pub_prod] ['num6']; //if (strpos($ret,"***adv") !==false || strpos($types [$adv_program] ['alpha4'],"***adv") !== false){ // think this should be out be adv_program is not a known value and assume that adv always referenced if ($advused[$myprod['pub_adv']]['adv_nm'] == ""){ get_adv($myprod['pub_adv']); $advused[$myprod['pub_adv']]['adv_nm'] = $adv_nm; $advused[$myprod['pub_adv']]['adv_page'] = $adv_page; $advused[$myprod['pub_adv']]['adv_logo_img'] = $adv_logo_img; $advused[$myprod['pub_adv']]['adv_logo2'] = $adv_logo2; $advused[$myprod['pub_adv']]['adv_logo3'] = $adv_logo3; $advused[$myprod['pub_adv']]['adv_link_display'] = $adv_link_display; $advused[$myprod['pub_adv']]['adv_my_ref'] = $adv_my_ref; $advused[$myprod['pub_adv']]['adv_my_ref2'] = $adv_my_ref2; $advused[$myprod['pub_adv']]['adv_my_ref3'] = $adv_my_ref3; $advused[$myprod['pub_adv']]['adv_my_ref4'] = $adv_my_ref4; $advused[$myprod['pub_adv']]['adv_my_ref5'] = $adv_my_ref5; $advused[$myprod['pub_adv']]['adv_short_desc'] = $adv_short_desc; $advused[$myprod['pub_adv']]['adv_program'] = $adv_program; $advused[$myprod['pub_adv']]['adv_link'] = $adv_link; $advused[$myprod['pub_adv']]['adv_logo_link'] = $adv_logo_link; $advused[$myprod['pub_adv']]['adv_banner_link'] = $adv_banner_link; } else { $adv_nm=$advused[$myprod['pub_adv']]['adv_nm']; $adv_page=$advused[$myprod['pub_adv']]['adv_page']; $adv_logo_img=$advused[$myprod['pub_adv']]['adv_logo_img']; $adv_logo2=$advused[$myprod['pub_adv']]['adv_logo2']; $adv_logo3=$advused[$myprod['pub_adv']]['adv_logo3']; $adv_link_display=$advused[$myprod['pub_adv']]['adv_link_display']; $adv_my_ref=$advused[$myprod['pub_adv']]['adv_my_ref']; $adv_my_ref2=$advused[$myprod['pub_adv']]['adv_my_ref2']; $adv_my_ref3=$advused[$myprod['pub_adv']]['adv_my_ref3']; $adv_my_ref4=$advused[$myprod['pub_adv']]['adv_my_ref4']; $adv_my_ref5=$advused[$myprod['pub_adv']]['adv_my_ref5']; $adv_short_desc=$advused[$myprod['pub_adv']]['adv_short_desc']; $adv_program=$advused[$myprod['pub_adv']]['adv_program']; $adv_link=$advused[$myprod['pub_adv']]['adv_link']; $adv_logo_link=$advused[$myprod['pub_adv']]['adv_logo_link']; $adv_banner_link=$advused[$myprod['pub_adv']]['adv_banner_link']; } //} $tdesc = treat($myprod['desc']); $ret = str_replace ( "***addtobasket2***", $basket, $ret ); $ret = str_replace ( "***addtobasket***", $basket, $ret ); $ret = str_replace ( "***proddesc***", $tdesc, $ret ); $ret = str_replace ( "***prodfulldesc***", $tdesc, $ret ); $ret = str_replace ( "***prodshortdesc***", substr($tdesc,0,$desclen)." ...", $ret ); $ret = str_replace ( "***prodrawdesc***", $myprod['desc'], $ret ); $ret = str_replace ( "***prodfullrawdesc***", $myprod['desc'], $ret ); $ret = str_replace ( "***prodid***", $myprod['id'], $ret ); $ret = str_replace("***prodproductid***",$myprod['product_id'],$ret); $tname = treat($myprod['name']); // assume that name has not been squashed $ret = str_replace ( "***prodname***",$tname, $ret ); $ret = str_replace ( "***prodcleanname***",$myprod['name'], $ret ); /* $ret = str_replace ( "***prodname***",$myprod['name'], $ret ); $ret = str_replace ( "***prodcleanname***",$tname, $ret ); */ $ret = str_replace ( "***produrlname***", urlencode(strtolower($tname)), $ret ); $ret = str_replace ( "***prodshortname***", substr($tname,0,$namelen), $ret ); //$ret = str_replace ( "***prodshortname***", substr($myprod['name'],0,$namelen), $ret ); if (strpos($ret,"***prodencode") !== false){ $ret = str_replace ( "***prodencodefulldesc***", encodequotes($tdesc), $ret ); $ret = str_replace ( "***prodencodedesc***", encodequotes($tdesc), $ret ); $ret = str_replace ( "***prodencodename***", encodequotes($tname), $ret ); } $ret = str_replace("***prodtext***",$myprod['text'],$ret); $ret = str_replace ( "***prodanchor***", str_replace ( " ", "_", $prodtitle ), $ret ); $ret = str_replace ( "***prodprice***",$myprod['price'], $ret ); $ret = str_replace ( "***prodclasslist***", strtolower($myprod['model']), $ret ); if (strpos($ret,"***prodpic***") !==false){ $ret = str_replace("***prodpic***",prod_img($myprod['image'],"***proddeeplink***",$myprod['name'],'',"left"),$ret); } if (strpos($ret,"***prodpicc***") !==false){ $ret = str_replace("***prodpicc***",prod_img($myprod['image'],"***proddeeplink***",$myprod['name'],'',"middle"),$ret); } if ($types [$adv_program] ['alpha4'] != ""){ $myprod['link'] = str_replace("***prodlink***",$myprod['link'],treat($types [$adv_program] ['alpha4'])); } if (strpos($ret,"***proddeeplink***") !== false || strpos($ret,"***prodlink***") !== false) { if (strpos($myprod['link'],"***adv") !==false){ if (strpos($myprod['link'],"***advmyref***")!== false){ $myprod['link'] = str_replace ("***advmyref***", "$adv_my_ref", $myprod['link'] ); } if (strpos($myprod['link'],"***advmyref2***")!== false){ $myprod['link'] = str_replace ("***advmyref2***", "$adv_my_ref2", $myprod['link'] ); } if (strpos($myprod['link'],"***advmy")!== false){ if (strpos($myprod['link'],"***advmyref3***")!== false){ $myprod['link'] = str_replace ("***advmyref3***", "$adv_my_ref3", $myprod['link'] ); } if (strpos($myprod['link'],"***advmyref4***")!== false){ $myprod['link'] = str_replace ("***advmyref4***", "$adv_my_ref4", $myprod['link'] ); } if (strpos($myprod['link'],"***advmyref5***")!== false){ $myprod['link'] = str_replace ("***advmyref5***", "$adv_my_ref5", $myprod['link'] ); } if (strpos($myprod['link'],"***advmy")!== false){ if (strpos($myprod['link'],"***advmyref***") !==false){ $myprod['link'] = str_replace ("***advmyref***", "$adv_my_ref", $myprod['link'] ); } if (strpos($myprod['link'],"***advmyref2***") !==false){ $myprod['link'] = str_replace ("***advmyref2***", "$adv_my_ref2", $myprod['link'] ); } if (strpos($myprod['link'],"***advmyref3***") !==false){ $myprod['link'] = str_replace ( "***advmyref3***", "$adv_my_ref3", $myprod['link'] ); } if (strpos($myprod['link'],"***advmyref4***") !==false){ $myprod['link'] = str_replace ( "***advmyref4***", "$adv_my_ref4", $myprod['link'] ); } if (strpos($myprod['link'],"***advmyref5***") !==false){ $myprod['link'] = str_replace ( "***advmyref5***", "$adv_my_ref5", $myprod['link'] ); } } } } $myprod['link'] = str_replace ( "***prodid***", $myprod['id'], $myprod['link'] ); $myprod['link'] = str_replace ("***prodproductid***",$myprod['product_id'],$myprod['link']); $myprod['link'] = str_replace ( "***prodname***",$tname, $myprod['link'] ); $myprod['link'] = str_replace ( "***prodcleanname***",$myprod['name'], $myprod['link'] ); /* $myprod['link'] = str_replace ( "***prodname***",$myprod['name'], $myprod['link'] ); $myprod['link'] = str_replace ( "***prodcleanname***",$tname, $myprod['link'] ); */ $myprod['link'] = str_replace ( "***produrlname***", urlencode(strtolower($tname)), $myprod['link'] ); $myprod['link'] = str_replace ( "***prodshortname***", substr($tname,0,$namelen), $myprod['link'] ); if (strpos($myprod['link'],"shop.php?") !==false){ // $myprod['link'] = urlencode($myprod['link']); $ret = str_replace("***proddeeplink***",$myprod['link'],$ret); $ret = str_replace("***prodlink***",$myprod['link'],$ret); } else{ $ret = str_replace("***proddeeplink***","http://$domain/shop.php?typ=2&sresid=$sresid&advid=".$myprod['pub_adv']."&pageid=1&prodid=".$myprod['product_id']."&regid=***region***&ref=".urlencode($myprod['link']),$ret); $ret = str_replace("***prodlink***","http://$domain/shop.php?typ=2&sresid=$sresid&advid=".$myprod['pub_adv']."&pageid=1&prodid=".$myprod['product_id']."&regid=***region***&ref=".urlencode($myprod['link']),$ret); } // $ret = str_replace("***proddeeplink***","http://$domain/shop.php?typ=2&sresid=$sres_id&advid=".$myprod['pub_adv']."&pageid=1&prodid=".$myprod['product_id']."&regid=***region***&ref=".$myprod['link'],$ret); // $ret = str_replace("***prodlink***","http://$domain/shop.php?typ=2&sresid=$sres_id&advid=".$myprod['pub_adv']."&pageid=1&prodid=".$myprod['product_id']."&regid=***region***&ref=".$myprod['link'],$ret); } //$ret = str_replace("***proddeeplink2***","shop.php?typ=3&sresid=$sres_id&advid=".$myprod['pub_adv']."&pageid=1&prodid=".$myprod['product_id']."&regid=***region***&ref=".$myprod['link2'],$ret); //$ret = str_replace("***proddeeplink2***","shop.php?typ=3&sresid=$sres_id&advid=".$myprod['pub_adv']."&ref=".$myprod['link2'],$ret); $ret = str_replace("***proddeeplink2***","shop.php?typ=3&nm=".urlencode(strtolower($myprod['name']))."&sresid=$sres_id&lv=***live***&advid=".$myprod['pub_adv']."&prodid=".$myprod['id'], $ret ); $ret = str_replace("***prodlink2***",$myprod['link2'],$ret); $ret = str_replace ( "***proditemlink***", "***thisscript***?for=".urlencode(strtolower($search_link))."&txt=".urlencode(strtolower($myprod['name']))."&typ=item&lv=***live***",$ret); //$ret = str_replace ( "***proditemlink***", "***thisscript***?nm=".urlencode(strtolower($myprod['name']))."&typ=item&sresid=$sres_id",$ret); $ret = str_replace ( "***proditemidlink***", "***thisscript***?nm=".urlencode(strtolower($myprod['name']))."&typ=item&prodid=".$myprod['id'],$ret); $ret = str_replace("***prodlinkdisp***",$myprod['name'],$ret); $ret = str_replace("***prodimage***",$myprod['image'],$ret); $ret = str_replace("***prodthumb***",$myprod['thumb'],$ret); $ret = str_replace("***prodmain***",$myprod['mainpic'],$ret); if (strpos($ret,"***adv") !==false){ $ret = str_replace ( "***advname***", sq($adv_nm), $ret ); $ret = str_replace ( "***advcleanname***", sq($adv_nm), $ret ); $ret = str_replace ( "***advpage***", $adv_page, $ret ); $ret = str_replace ( "***advid***", $myprod['pub_adv'], $ret ); if (strpos($ret,"***advlogo") !==false){ if (strpos($ret,"***advlogoright***") !==false){ $ret = str_replace ( "***advlogoright***", prod_img($adv_logo_img,"","","","right"), $ret ); } if (strpos($ret,"***advlogoright2***") !==false){ $ret = str_replace ( "***advlogoright2***", prod_img($adv_logo2,"","","","right"), $ret ); } if (strpos($ret,"***advlogoright3***") !==false){ $ret = str_replace ( "***advlogoright3***", prod_img($adv_logo3,"","","","right"), $ret ); } if (strpos($ret,"***advlogo***") !==false){ $ret = str_replace ( "***advlogo***", prod_img($adv_logo_img,$adv_link,$adv_link_display,"",""), $ret ); } if (strpos($ret,"***advlogo2***") !==false){ $ret = str_replace ( "***advlogo2***", prod_img($adv_logo2,$adv_link,$adv_link_display,"",""), $ret ); } if (strpos($ret,"***advlogo3***") !==false){ $ret = str_replace ( "***advlogo3***", prod_img($adv_logo3,$adv_link,$adv_link_display,"",""), $ret ); } } if (strpos($ret,"***advonly") !==false){ if (strpos($ret,"***advonlylogo***") !==false){ $ret = str_replace ( "***advonlylogo***", prod_img($adv_logo_img,"","","",""), $ret ); } if (strpos($ret,"***advonlylogo2***") !==false){ $ret = str_replace ( "***advonlylogo2***", prod_img($adv_logo2,"","","",""), $ret ); } if (strpos($ret,"***advonlylogo3***") !==false){ $ret = str_replace ( "***advonlylogo3***", prod_img($adv_logo3,"","","",""), $ret ); } } $ret = str_replace ( "***advlinkdisp***", $adv_link_disp, $ret ); if ($version['_advimagedir'] != ""){ $ret = str_replace ( "***advimg***", $version['_advimagedir']."/$adv_logo_img", $ret ); $ret = str_replace ( "***advimg2***", $version['_advimagedir']."/$adv_logo2", $ret ); $ret = str_replace ( "***advimg3***", $version['_advimagedir']."/$adv_logo3", $ret ); } elseif ($version['advimagedir'] != ""){ $ret = str_replace ( "***advimg***", "http://".$version['advimagedir']."/$adv_logo_img", $ret ); $ret = str_replace ( "***advimg2***", "http://".$version['advimagedir']."/$adv_logo2", $ret ); $ret = str_replace ( "***advimg3***", "http://".$version['advimagedir']."/$adv_logo3", $ret ); } elseif ($version['pubimagedir'] != ""){ $ret = str_replace ( "***advimg***", "http://".$version['pubimagedir']."/$adv_logo_img", $ret ); $ret = str_replace ( "***advimg2***", "http://".$version['pubimagedir']."/$adv_logo2", $ret ); $ret = str_replace ( "***advimg3***", "http://".$version['pubimagedir']."/$adv_logo3", $ret ); } else { $ret = str_replace ( "***advimg***", "http://".$imagedir."/$adv_logo_img", $ret ); $ret = str_replace ( "***advimg2***", "http://".$imagedir."/$adv_logo2", $ret ); $ret = str_replace ( "***advimg3***", "http://".$imagedir."/$adv_logo3", $ret ); } $ret = str_replace ( "***advlink***", $adv_link, $ret ); $ret = str_replace ( "***advlogolink***", $adv_logo_link, $ret ); $ret = str_replace ( "***advbannerlink***", $adv_banner_link, $ret ); $ret = str_replace ( "***advshortdesc***", $adv_short_desc, $ret ); $ret = str_replace ( "***advprogram***", $adv_program, $ret ); $ret = str_replace ( "***myaffid***", $types [$adv_program] ['alpha2'], $ret ); $ret = str_replace ( "***advmyref***", $adv_my_ref, $ret ); if (strpos($ret,"***advmyref")>0){ $ret = str_replace ( "***advmyref2***", $adv_my_ref2, $ret ); $ret = str_replace ( "***advmyref3***", $adv_my_ref3, $ret ); $ret = str_replace ( "***advmyref4***", $adv_my_ref4, $ret ); $ret = str_replace ( "***advmyref5***", $adv_my_ref5, $ret ); } } return $ret; } function clean_adv($txt){ global $adv_id,$adv_nm,$adv_title,$adv_short_desc,$adv_long_desc,$adv_webiste,$adv_par_id,$adv_par_desc,$adv_priority,$adv_jump, $adv_page,$adv_my_ref,$adv_your_ref,$adv_type,$adv_keywords,$adv_banner_img,$adv_logo_img,$adv_logo2,$adv_logo3,$adv_link_display,$adv_link_type, $adv_word_group,$adv_word_group2,$adv_link,$adv_visible,$adv_status,$adv_banner_link,$adv_logo_link,$adv_program,$adv_jump_file, $adv_full_jump,$jumplink,$adv_my_ref2,$adv_my_ref3,$adv_my_ref4,$adv_my_ref5,$version ; $ret = str_replace ( "***advname***", $adv_nm, $txt ); $ret = str_replace ( "***advcleanname***", sq($adv_nm), $ret ); $ret = str_replace ( "***advpage***", $adv_page, $ret ); if (strpos($ret,"***advlogo") !==false){ if (strpos($ret,"***advlogoright***") !==false){ $ret = str_replace ( "***advlogoright***", prod_img($adv_logo_img,"","","","right"), $ret ); } if (strpos($ret,"***advlogoright2***") !==false){ $ret = str_replace ( "***advlogoright2***", prod_img($adv_logo2,"","","","right"), $ret ); } if (strpos($ret,"***advlogoright3***") !==false){ $ret = str_replace ( "***advlogoright3***", prod_img($adv_logo3,"","","","right"), $ret ); } if (strpos($ret,"***advlogo***") !==false){ $ret = str_replace ( "***advlogo***", prod_img($adv_logo_img,$adv_link,$adv_link_display,"",""), $ret ); } if (strpos($ret,"***advlogo2***") !==false){ $ret = str_replace ( "***advlogo2***", prod_img($adv_logo2,$adv_link,$adv_link_display,"",""), $ret ); } if (strpos($ret,"***advlogo3***") !==false){ $ret = str_replace ( "***advlogo3***", prod_img($adv_logo3,$adv_link,$adv_link_display,"",""), $ret ); } } if (strpos($ret,"***advonly") !==false){ if (strpos($ret,"***advonlylogo***") !==false){ $ret = str_replace ( "***advonlylogo***", prod_img($adv_logo_img,"","","",""), $ret ); } if (strpos($ret,"***advonlylogo2***") !==false){ $ret = str_replace ( "***advonlylogo2***", prod_img($adv_logo2,"","","",""), $ret ); } if (strpos($ret,"***advonlylogo3***") !==false){ $ret = str_replace ( "***advonlylogo3***", prod_img($adv_logo3,"","","",""), $ret ); } } $ret = str_replace ( "***advlinkdisp***", $adv_link_disp, $ret ); if ($version['_advimagedir'] != ""){ $ret = str_replace ( "***advimg***", $version['_advimagedir']."/$adv_logo_img", $ret ); $ret = str_replace ( "***advimg2***", $version['_advimagedir']."/$adv_logo2", $ret ); $ret = str_replace ( "***advimg3***", $version['_advimagedir']."/$adv_logo3", $ret ); } elseif ($version['advimagedir'] != ""){ $ret = str_replace ( "***advimg***", "http://".$version['advimagedir']."/$adv_logo_img", $ret ); $ret = str_replace ( "***advimg2***", "http://".$version['advimagedir']."/$adv_logo2", $ret ); $ret = str_replace ( "***advimg3***", "http://".$version['advimagedir']."/$adv_logo3", $ret ); } elseif ($version['pubimagedir'] != ""){ $ret = str_replace ( "***advimg***", "http://".$version['pubimagedir']."/$adv_logo_img", $ret ); $ret = str_replace ( "***advimg2***", "http://".$version['pubimagedir']."/$adv_logo2", $ret ); $ret = str_replace ( "***advimg3***", "http://".$version['pubimagedir']."/$adv_logo3", $ret ); } else { $ret = str_replace ( "***advimg***", "http://".$imagedir."/$adv_logo_img", $ret ); $ret = str_replace ( "***advimg2***", "http://".$imagedir."/$adv_logo2", $ret ); $ret = str_replace ( "***advimg3***", "http://".$imagedir."/$adv_logo3", $ret ); } $ret = str_replace ( "***advlink***", $adv_link, $ret ); $ret = str_replace ( "***advlogolink***", $adv_logo_link, $ret ); $ret = str_replace ( "***advbannerlink***", $adv_banner_link, $ret ); $ret = str_replace ( "***advshortdesc***", $adv_short_desc, $ret ); $ret = str_replace ( "***advpardesc***", $adv_par_desc, $ret ); $ret = str_replace ( "***advprogram***", $adv_program, $ret ); $ret = str_replace ( "***myaffid***", $types [$adv_program] ['alpha2'], $ret ); $ret = str_replace ( "***advmyref***", $adv_my_ref, $ret ); $ret = str_replace ( "***advmyref2***", $adv_my_ref2, $ret ); $ret = str_replace ( "***advmyref3***", $adv_my_ref3, $ret ); $ret = str_replace ( "***advmyref4***", $adv_my_ref4, $ret ); $ret = str_replace ( "***advmyref5***", $adv_my_ref5, $ret ); return $ret; } function render_atoz($link){ global $act,$id,$typ,$tfr,$live,$pg,$only; // $link = block_link_atoz(); $ret = ""; for ($i=1; $i<27; $i++){ $letter = strtoupper(chr($i+64)); $ret.= ""; } $ret .= "
$letter
"; return $ret; } function make_adv_block($wg,$fmt,$temp,$blk,$atoz,$let){ global $types,$temp_logos,$temp_advert,$temp_advert2; global $commondir,$huburl; global $adv_id,$adv_nm,$adv_title,$adv_short_desc,$adv_long_desc,$adv_webiste,$adv_par_id,$adv_par_desc,$adv_priority,$adv_jump, $adv_page,$adv_my_ref,$adv_your_ref,$adv_type,$adv_keywords,$adv_banner_img,$adv_logo_img,$adv_logo2,$adv_logo3,$adv_link_display,$adv_link_type, $adv_word_group,$adv_word_group2,$adv_link,$adv_visible,$adv_status,$adv_banner_link,$adv_logo_link,$adv_program,$adv_jump_file, $adv_full_jump,$jumplink,$adv_my_ref2,$adv_my_ref3,$adv_my_ref4,$adv_my_ref5 ; global $cat_id,$cat_word_id,$cat_page,$cat_title,$cat_link,$cat_name,$cat_short_desc,$cat_long_desc,$cat_status,$cat_visible, $cat_par_id,$cat_par_source_id,$cat_par_name,$tdcat,$cat_tdcat,$cat_pub_cat,$cat_par_pub_cat,$cat_type,$cat_par_type; if (strpos($wg,":::") !== FALSE){ $scat = explode(":::",$wg); $cats = explode(",",$scat[1]); $wg=$cats[0]; } $thislist=""; $ct = 0; switch ($fmt){ case "a": case "2": $fmt =1; break; case "b": case "3": $fmt=2; break; case "c": case "4": $fmt =0; $temp = "adv2"; break; case "d": case "5": $fmt=1; $temp = "adv2"; break; case "e": case "6": $fmt =2; $temp = "adv2"; break; default: $fmt=0; } switch ($temp){ case "logos": case "logo": $temp =$temp_logos; break; case "adv2": $temp =$temp_advert2; break; case "adv": case "advs": default: $temp =$temp_advert; break; } $one = $fmt*3+1; $two = $one + 1; $three = $two + 1; $body = $types [$temp] ['alpha'.$two]; $tail = $types [$temp] ['alpha'.$three]; $head = $types [$temp] ['alpha'.$one]; if ($cols < 1) $cols = $types [$temp] ['num'.$two]; if ($rows < 1) $rows = $types [$temp] ['num'.$three]; if ($cols < 1){ $cols = 1; } if ($rows < 1){ $rows = 1; } if ($atoz=true){ $itmct = 50; $rows = 50; }else{ $itmct = $rows* $cols; } if (is_numeric($blk)){ $st = ($blk-1)*$itmct; $ed = $itmct*2; if ($atoz=true){ $ord = "and adv_name like '$let%' group by adv_id order by adv_name "; } else { $ord = " group by adv_id order by adv_priority desc limit $st, $ed"; } } else { if ($atoz=true){ $ord = "and adv_name like '$let%' group by adv_id order by adv_name "; } else { $ord = " group by adv_id order by rand() limit 1, ".$itmct*2; } } $isrow = strpos(treat($body)," 0 ){ $result = str_replace("***catname***",$cat_name,$result); $result = str_replace("***catparname***",$cat_name,$result); $result = str_replace("***catid***",$cat_id,$result); $result = str_replace("***newwindow***",treat($types[199]['alpha2']),$result); } else { return false; } return $result; } ?>Server unreachable"); MYSQL_SELECT_DB($database) or die ( "

Database non existent

"); if ($version['loaded'] != 1) { $version['loaded'] = 1; $version['system']="H"; $version['dbsystem']="localhost"; define ("DEFAULTTEMPLATE", "10"); get_types(); if ($types[0]['num1'] > 0){ $std = explode("\n",$types[$types[0]['num1']]['alpha1']); foreach($std as $op){ list($it,$val) = explode(";;;",$op); switch ($it){ case "email": $email = trim($val); break; case "email2": $email2 = trim($val); break; case "imagedir": $imagedir = trim($val); break; case "huburl": $huburl = trim($val); break; case "commondir": $commondir = trim($val); break; case "basedir": $basedir = trim($val); break; case "countdir": $countdir = trim($val); break; case "ipaddr": $ipaddr = trim($val); break; case "homedir": $homedir = trim($val); break; default: echo "Host load error $it $val"; die(); } } $std = explode("\n",$types[$types[0]['num1']]['alpha2']); foreach($std as $op){ list($it,$val) = explode(";;;",$op); $version[$it] = trim($val); } } else { $email = "info@splashweb.co.uk"; $email2 = "nigel@redoblong.co.uk"; $imagedir = "pub.harpooned.co.uk/images"; $huburl = "http://www.harpoon.co.uk"; $commondir= "http://pub.harpooned.co.uk/common"; $basedir = "/home/default/harpooned.co.uk/user/htdocs/pub"; $ipaddr = "88.208.245.194"; $shadow=false; define ("DEFAULTTEMPLATE", "14"); } } ?> 0){ $num[$i] = $types[$temp_additional[1]]['num'.$i]; list ($type[$i],$head[$i],$body[$i],$tail[$i]) = explode(":::",treat($types[$temp_additional[1]]['alpha'.$i])); if ($type[$i] ==$format){ $order[0] = $i; } } $ad= $types[$temp_additional[1]]['num9']; if ($types[$temp_additional[$ad]]['num'.$i]>0){ list ($type[$i],$head[$i],$body[$i],$tail[$i]) = explode(":::",treat($types[$temp_additional[$ad]]['alpha'.$i])); if ($type[$i] ==$format){ $order[0] = $i+10; } } } } foreach ($order as $i){ switch ($i){ case($i<9): $temp = 1; $of = $i; break; case($i>10 && $i<20): $temp = $types[$temp_additional[1]]['num9']; $of = $i-10; break; case($i>20 && $i<30): $temp = $types[$temp_additional[1]]['num9']; $temp = $types[$temp_additional[$temp]]['num9']; $of = $i-20; break; } if ($types[$temp_additional[$temp]]['num'.$of]>0){ $num[$i] = $types[$temp_additional[$temp]]['num'.$of]; // orig list ($type[$i],$head[$i],$body[$i],$tail[$i],$blockno[$i],$starttext[$i],$prevtext[$i],$nexttext[$i],$lasttext[$i],$stdtext[$i],$starttext2[$i],$prevtext2[$i],$nexttext2[$i],$lasttext2[$i]) = explode(":::",treat($types[$temp_additional[$temp]]['alpha'.$of])); $tret = explode(":::",$types[$temp_additional[$temp]]['alpha'.$of]); $type[$i] = treat($tret[0]); $head[$i] = treat($tret[1]); $body[$i] = treat($tret[2]); $tail[$i] = treat($tret[3]); switch ($type[$i]){ case "filter": $blockno[$i] = $tret; // just to allow it dro pthrou later on. $alttail[$i] = treat($tret[3]); $tail[$i] = treat($tret[4]); $icols[$i] = $tret[5]; // cols internal to a filter display $irows[$i] = $tret[6]; $cols[$i] = $tret[7]; // cols of filter dispay $rows[$i] = $tret[8]; $istarttext[$i] = treat($tret[9]); $imidtext[$i] = treat($tret[10]); $iendtext[$i] = treat($tret[11]); $starttext[$i] = treat($tret[12]); $midtext[$i] = treat($tret[13]); $endtext[$i] = treat($tret[14]); $include[$i] = treat($tret[15]); $prog1[$i] = treat($tret[16]); // not used in generat $prog2[$i] = treat($tret[17]); // is used in generate break; case "title": $prog1[$i] = treat($tret[5]); // not used in generat $prog2[$i] = treat($tret[6]); // is used in generate break; case "cat": $blockno[$i] = treat($tret[4]); case "price": $prog1[$i] = treat($tret[4]); // not used in generat $prog2[$i] = treat($tret[5]); // is used in generate //$tail[$i] = treat($tret[5]); //echo "
$i. ".$prog2[$i]; //print_r($tret); break; case "num": default: $blockno[$i] = treat($tret[4]); if($tret[4] != ""){ $starttext[$i] = treat($tret[5]); $prevtext[$i] = treat($tret[6]); $nexttext[$i] = treat($tret[7]); $lasttext[$i] = treat($tret[8]); $stdtext[$i] = treat($tret[9]); $starttext2[$i] = treat($tret[10]); $prevtext2[$i] = treat($tret[11]); $nexttext2[$i] = treat($tret[12]); $lasttext2[$i] = treat($tret[13]); $prog1[$i] = treat($tret[14]); // not used in generat $prog2[$i] = treat($tret[15]); // is used in generate } } $res[$i] = $head[$i]; if ($formats[$type[$i]] < 1){ $formats[$type[$i]] = $i; } switch($type[$i]){ case "num": if ($temp_pub_prod > 0 ){ $incr = $types[$temp_pub_prod]['num2']; } elseif ($temp_glossary['incr'] > 0) { $incr = $temp_glossary['incr']; } $thispage = floor($fr / $incr)+1; if ($count%$incr == 0){ $lastpage = floor($count / $incr); } else { $lastpage = floor($count / $incr)+1; } if ($blockno[$i] > 0) { if ($fr > ($count-($blockno[$i]*$incr/2))){ $endpos = floor($count/$incr); $stpos = $endpos-$blockno[$i]; } else { $stpos = round($fr/$incr) - $blockno[$i]/2; if ($stpos < 0){ $stpos = 0; } $endpos = $stpos + $blockno[$i]; } if ($stpos < 0){ $stpos = 0; $endpos = $stpos + $blockno[$i]; } if ($endpos > floor($count/$incr)-1) { $endpos = floor($count/$incr); if ($count % $incr == 0){ $endpos--; } } } else { $stpos = 0; $endpos = floor($count/$incr)-1; } for ($j=$stpos;$j<=$endpos;$j++){ if (($j-$stpos)%$num[$i]==0 && $j > $stpos) { $res[$i] .= "\n"; } $start = $j*$incr+1; $end = min($start +$incr-1,$sres_analysis['count']); $before =$gap; $after=$gap2; if($start == $fr) { if ($link != "" || $fullresults == true) { $before = $beforeimg; $after = $afterimg; } } if ($blockno[$i] > 0) { if ($j == $stpos){ if ($j == $stpos && $fr > 1){ $pageno = $starttext[$i]; if ($pageno != ""){ $itm = $body[$i]; $itm = str_replace("***link***",$link,$itm); $itm = str_replace("***pagetext***",$pageno,$itm); $itm = str_replace("***start***",1,$itm); $itm = str_replace("***end***",$incr,$itm); $itm = str_replace("***beforeimage***","",$itm); $itm = str_replace("***afterimage***","",$itm); $itm = str_replace("***pageno***",1,$itm); $res[$i] .= $itm; } $pageno = $prevtext[$i]; if ($pageno != ""){ $itm = $body[$i]; $itm = str_replace("***link***",$link,$itm); $itm = str_replace("***pagetext***",$pageno,$itm); $itm = str_replace("***start***",$fr-$incr,$itm); $itm = str_replace("***end***",$fr-1,$itm); $itm = str_replace("***beforeimage***","",$itm); $itm = str_replace("***afterimage***","",$itm); $itm = str_replace("***pageno***",$thispage-1,$itm); $res[$i] .= $itm; } } else { $pageno = $starttext2[$i]; if ($pageno != ""){ $itm = $body[$i]; $st = strpos($itm,"",$st)+1; $st3 = strpos($itm,"",$st)+1; $st3 = strpos($itm,"",$st)+1; $st3 = strpos($itm," 0) { $pageno = $j; if ($pageno == $endpos){ $laststart = (floor($count/$incr))*$incr+1; if ($laststart > $count){ $laststart = $count - $incr +1; } if ($start != $fr){ $pageno = $nexttext[$i]; if ($pageno != ""){ $itm = $body[$i]; $itm = str_replace("***link***",$link,$itm); $itm = str_replace("***pagetext***",$pageno,$itm); $itm = str_replace("***start***",$fr+$incr,$itm); $ed =$fr+$incr+$incr-1; if ($ed > $count) { $ed = $count; } $itm = str_replace("***end***",$ed,$itm); $itm = str_replace("***beforeimage***","",$itm); $itm = str_replace("***afterimage***","",$itm); $itm = str_replace("***pageno***",$thispage+1,$itm); $res[$i] .= $itm; } $pageno = $lasttext[$i]; if ($pageno != ""){ $itm = $body[$i]; $itm = str_replace("***link***",$link,$itm); $itm = str_replace("***pagetext***",$pageno,$itm); $itm = str_replace("***start***",$laststart,$itm); $itm = str_replace("***end***", $count, $itm); $itm = str_replace("***beforeimage***","",$itm); $itm = str_replace("***afterimage***","",$itm); $itm = str_replace("***pageno***",$lastpage,$itm); $res[$i] .= $itm; } } else { $pageno = $nexttext2[$i]; if ($pageno != ""){ $itm = $body[$i]; $st = strpos($itm,"",$st)+1; $st3 = strpos($itm," $count) { $ed = $count; } $itm = str_replace("***end***",$ed,$itm); $itm = str_replace("***beforeimage***","",$itm); $itm = str_replace("***afterimage***","",$itm); $itm = str_replace("***pageno***",$thispage+1,$itm); $res[$i] .= $itm; } $pageno = $lasttext2[$i]; if ($pageno != ""){ $itm = $body[$i]; $st = strpos($itm,"",$st)+1; $st3 = strpos($itm,"0){ $res[$i] .= $itm; } } } $counter=1; break; case "filter": $thisct=0; // if ($cols[$i]>0){ // $res[$i]= $starttext[$i]; // } else { $res[$i]= ""; // } foreach($sres_analysis['filter'] as $ftyp => $tr){ $oktocont = true; if ($cols[$i] > 0 && $include[$i] != ""){ if ($subtype != "" && strtolower($subtype) != strtolower($ftyp)){ $oktocont = false; } if (strpos(",".$include[$i].",",",$ftyp,") === false){ $oktocont = false; } } if ($ftyp != "" && $tr != "" && $oktocont) { $cnt = 0; $thisct++; $res[$i] .= $head[$i]; $res[$i] = str_replace("***title***",sq($ftyp),$res[$i]); $res[$i] = str_replace("***urltitle***",urlencode(strtolower(sq($ftyp))),$res[$i]); $res[$i] = str_replace("***count***",$thisct,$res[$i]); $more = false; foreach($tr as $tar){ if ($cnt <= $num[$i] || $all){ if (!$all && $icols[$i] && $cnt>=$icols[$i]*$irows[$i]) { $more = true; break; } list($nm,$ct,$item1,$item2,$item3,$item4,$item5,$item6,$item7,$item8,$item9) = explode(":",$tar); // echo $nm; if($nm != ""){ $counter++; $cnt++; $nm = treat(treat($nm)); $itm = $body[$i]; $itm = str_replace("***urltitle***",urlencode(strtolower(sq($ftyp))),$itm); $itm = str_replace("***urlname***",urlencode(strtolower(sq($nm))),$itm); $itm = str_replace("***name***",sq($nm),$itm); $itm = str_replace("***item1***",$item1,$itm); $itm = str_replace("***item2***",$item2,$itm); $itm = str_replace("***item3***",$item3,$itm); $itm = str_replace("***item4***",$item4,$itm); $itm = str_replace("***item5***",$item5,$itm); $itm = str_replace("***item6***",$item6,$itm); $itm = str_replace("***item7***",$item7,$itm); $itm = str_replace("***item8***",$item8,$itm); $itm = str_replace("***item9***",$item9,$itm); $itm = str_replace("***count***",$ct,$itm); // $itm = str_replace("***id***",$id,$itm); $res[$i] .= $itm; if ($icols[$i] >0 && $cnt%$irows[$i] == 0){ $res[$i] .= $imidtext[$i]; } } } else { $more = true; break; } } if (!is_numeric($blockno[$i]) && $blockno[$i]!="" && $more && !$all){ $res[$i] .= $alttail[$i]; } else { $res[$i] .= $tail[$i]; } if ($cols[$i] >0 && $thisct%$cols[$i] ==0 && $include[$i] == ""){ $res[$i] .= $midtext[$i]; } $res[$i] = str_replace("***title***",sq($ftyp),$res[$i]); $res[$i] = str_replace("***urltitle***",urlencode(strtolower(sq($ftyp))),$res[$i]); if ($include[$i] != ""){ $ordres[$ftyp] = $res[$i]; $res[$i] = ""; } } if ($cols[$i] >0 && $thisct>=$cols[$i]*$rows[$i]){ break; } } if ($include[$i] != ""){ $res[$i]=""; $ord = explode(",",$include[$i]); $ct = 0; foreach ($ord as $it){ if ($ordres[$it] != ""){ $res[$i].=$ordres[$it]; $ct++; if ($cols[$i] >0 && $ct%$cols[$i]==0){ $res[$i] .= $midtext[$i]; } } } $ordres = ""; } if ($cols[$i]>0){ $res[$i]= $starttext[$i].$res[$i].$endtext[$i]; } break; case "cat": case "adv": case "title": case "brand": default: if ($starttext[$i]> 0){ $cols = $starttext[$i]; $rows= $prevtext[$i]; $hed = $nexttext[$i] ; $mid = $lasttext[$i] ; $tal = $stdtext[$i] ; if ($prog1[$i]== ""){ $prog1[$i] = $starttext2[$i]; $prog2[$i] = $prevtext2[$i]; } $num[$i] = $cols*$rows-1; $res[$i] .= $hed; } $counter = 0; $more=false; foreach($sres_analysis[$type[$i]."s"] as $tar){ if ($counter <= $num[$i] || $all){ list($nm,$ct,$id) = explode(":",$tar); if($nm != ""){ $counter++; $nm = str_replace("*c*",":",$nm); switch ($type[$i]){ case "adv": get_adv($nm); $nm = $adv_nm; $id = $adv_id; $pic1 = $adv_logo_img; $pic2 = $adv_logo2; $pic3 = $adv_logo3; break; case "cat": $catset = true; $id = $nm; get_wg_info($nm); $nm = $cat_name; break; default: $nm = treat(treat(treat($nm))); } $itm = $body[$i]; $itm = str_replace("***name***",$nm,$itm); $itm = str_replace("***count***",$ct,$itm); $itm = str_replace("***img1***",sq($pic1),$itm); $itm = str_replace("***img2***",sq($pic2),$itm); $itm = str_replace("***img3***",sq($pic3),$itm); $itm = str_replace("***text***",urlencode(strtolower($nm)),$itm); $itm = str_replace("***pageid***",0,$itm); $itm = str_replace("***id***",$id,$itm); $res[$i] .= $itm; if ($cols> 0 && $counter%$cols==0){ $res[$i] .= $mid; } } } else { $more=true; break; } } if ($cols> 0 ){ $res[$i] .= $tal; } break; } if ($type[$i]!="filter"){ if (!is_numeric($blockno[$i]) && $blockno[$i]!="" && (!$more || $all)){ $res[$i] .= $blockno[$i]; } else { $res[$i] .= $tail[$i]; } } $res[$i] = str_replace("***type***",$type[$i],$res[$i]); $res[$i] = str_replace("***pound***","£",$res[$i]); $res[$i] = str_replace("***totalproducts***",$count,$res[$i]); $res[$i] = str_replace("***totalpages***",ceil($count/$incr),$res[$i]); $res[$i] = str_replace("***currentpage***",ceil($fr/$incr),$res[$i]); if ($linkedsearch){ $res[$i] = str_replace("***thescript***",$prog2[$i],$res[$i]); } else { $res[$i] = str_replace("***thescript***",$prog1[$i],$res[$i]); } if ($counter ==0){ $res[$i]=""; } } $result .= $res[$i]; } if (!$catset){ get_wg_info($sres_cat); } $result = str_replace("***sresid***",$sres_id,$result); $result = str_replace("***searchid***",$search_id,$result); return $result; } function analyze_results(){ global $analysis,$prod_filter,$myprod; $analysis['set'] =1; $analysis['total']['total']++; $analysis['brand'][strtolower(sq($myprod['brand']))]++; $analysis['title'][sq(str_replace(":","*c*",$myprod['name']))]++; $analysis['cat'][$myprod['pub_cat']]++; $analysis['adv'][$myprod['pub_adv']]++; $analysis['price']['incrs'][floor($myprod['price']/$analysis['price']['incr'])]++; if ($prod_price > $analysis['price']['high']){ $analysis['price']['high'] = $myprod['price']; } if ($prod_price < $analysis['price']['low']){ $analysis['price']['low'] =$myprod['price']; } } function complete_analysis(){ global $analysis,$types,$temp_live; if ($analysis['set']==1){ $analysis['price']['slots'] = $types[$temp_live]['num6']; $res .= "".$analysis['total']['total']; $res .= "".$analysis['price']['slots']; $res .= "".$analysis['price']['low']; $res .= "".$analysis['price']['high']; $res .= "".$analysis['price']['incr']; arsort($analysis['brand']); $res .= ""; foreach ($analysis['brand'] as $k => $br){ if ($k != ""){ $res .="$k:$br"; } } arsort($analysis['cat']); $res .= ""; foreach ($analysis['cat'] as $k => $br){ $res .="$k:$br"; } arsort($analysis['adv']); $res .= ""; foreach ($analysis['adv'] as $k => $br){ $res .="$k:$br"; } arsort($analysis['title']); $res .= ""; foreach ($analysis['title'] as $k => $br){ // if ($br> 1){ $res .="".sq($k).":$br"; // } else { // break; // } } $res .= ""; $res .= ""; ksort($analysis['price']['incrs']); foreach ($analysis['price']['incrs'] as $k => $br){ $res .="$k:$br"; } $res .= ""; } $analysis = $res; } function start_analysis($hi){ global $analysis,$search_filter,$types,$temp_live; $analysis = ""; $analysis['set'] =0; $num = $types[$temp_live]['num6']; switch ($hi){ case ($hi < $num *10): $rund = 0; break; case ($hi < $num *100): $rund = -1; break; case ($hi < $num *1000): $rund = -2; break; } $analysis['price']['incr'] = round($hi/$num,$rund); $analysis['price']['high'] = $hi; $analysis['price']['low'] = 0; for ($i=0;$i < $types[$temp_live]['num6'];$i++){ $analysis['price']['incrs'][$i] = 0; } if ($search_filter != ""){ $filters = explode(":::",$types[$search_filter]['alpha1']); foreach ($filters as $filter){ $i = explode(";;;",$filter); $typ = $i[0]; $fil = $i[1]; $cond = explode(",",$i[2]); foreach ($cond as $c){ $analysis['filter'][$typ][$fil][$c]=0; } } } } function get_url_searches($id){ $SQLstr = "select s.link_secondary_id as sresid from h_links as p, h_links as s where p.link_primary_id = $id and p.link_type='upg' and p.link_secondary_id =s.link_primary_id and s.link_type='pse'"; $result=MYSQL_QUERY($SQLstr); while($row = mysql_fetch_array($result, MYSQL_ASSOC)) { $ret[] = $row["sresid"]; } return $ret; } ?>