config['default_ad_type'].".php"); $vehicle = new classifieds_advertisement_vehicle(); $manufacturers = $vehicle->getdistinct('manufacturer'); $browsemanufacturers = "\n\t\n"; foreach($manufacturers as $keyword) { $_hierarchy = array($keyword, $vscope->config['product_url_string'].'s-for-sale'); $link = $self->generatelink($_hierarchy); # using static link as provided by Rob # $browsemanufacturers .= "\t\t
  • ".$keyword."
  • \n"; $searchparams['manufacturer_options'] .= "\n\t"; } # browse set by static list provided by Rob (email June 9th/08) $browse_man_array = $vscope->config['browse_man_array']; $cols = 4; if($vscope->config['main_product'] == 'RV') $cols = 5; $splitter = ceil(count($browse_man_array) / $cols); $splitter = ($splitter > 1) ? $splitter : 2; $i = 1; foreach($browse_man_array as $keyword) { $_hierarchy = array($keyword, $vscope->config['product_url_string'].'s-for-sale'); $link = $self->generatelink($_hierarchy); if( in_array($config['vehicle_product_code'], array('ATV','SNO','WAT')) ){ $browsemanu_bits[$i] .= "\t\t\n"; }else{ $browsemanu_bits[$i] .= "\t\t\n"; } if($i == $splitter) { $i = 0; } $i++; } if( in_array($config['vehicle_product_code'], array('ATV','SNO','WAT')) ){ $browsemanufacturers .= implode("\n\t\t",$browsemanu_bits); }else{ $browsemanufacturers .= implode("",$browsemanu_bits)."\t\n
    ".$keyword."
    "; } for($i = 1930; $i <= (date('Y') + 1) ;$i++) $fromyears[$i] = "\n\t"; $toyears = array_reverse($fromyears, true); $searchparams['fromyear_options'] = implode($fromyears); $searchparams['toyear_options'] = implode($toyears); $searchparams['country_options'] = country_options(); $searchparams['state_options'] = state_options(); // DON'T FORGET TO ADD THE PAGINATION $pages = 0; /************************************ * collect applicable paid listings ***********************************/ $search = new search(); $classifiedsLandingPage = true; $ip = $_SERVER["HTTP_X_FORWARDED_FOR"]; if(empty($ip)) { $ip = $_SERVER['REMOTE_ADDR']; } $ipData = OA_Geo_GeoIP_getGeo($ip, $vscope->config['geo_target_db']); // Use data from ip if(!empty($ipData['latitude']) && !empty($ipData['longitude'])) { $coords['latitude'] = $ipData['latitude']; $coords['longitude'] = $ipData['longitude']; } //$config['enable_geo_search'] = true; //$coords['latitude'] = 40.878054; //$coords['longitude'] = -75.305066; if($config['enable_geo_search']){ $coords['miles'] = 2000;//$vscope->config['default_miles']; $search->add_criteria('geography', $coords); } //$start = false; //$search->run_search(true, false, false, false, true); $search->fetch_index_listings($config['site_id'], true, true, $config['enable_geo_search']); $paidlist = ""; foreach($search->items as $campaign) { $campaign->getparentclassifieds_advertisement(); $advert = &$campaign->parentclassifieds_advertisement; $campaign->getparentuser(); $campaignuser = &$campaign->parentuser; // check for incoming advertisement detail attributes if($advert->id && in_array($advert->ad_type, $vscope->config['ad_types'])) { include_once("classes/dbo_classifieds_advertisement_{$advert->ad_type}.php"); $params = array('classifieds_advertisement_id' => $advert->id); eval('$ad_detail_collector = new classifieds_advertisement_'.$advert->ad_type.'Collector($params);'); if($ad_detail_collector->items[0]) { $advert_detail = $ad_detail_collector->items[0]; } else { eval('$advert_detail = new classifieds_advertisement_'.$advert->ad_type.'();'); } $manufacturer = cleanstr($advert_detail->manufacturer); } // skip this entry if there's a problem with it's detail data if(empty($advert_detail->id)) continue; $images = new classifieds_imageCollector($advert->id); $image = &$images->items[0]; if($image){ list($subdir_one, $subdir_two) = $image->get_image_sub_directories(); if( in_array($config['vehicle_product_code'], array('ATV','SNO','WAT')) ){ $mainimage = $vscope->config['image_path']."/{$config['default_category_id']}/{$subdir_one}/{$subdir_two}/".$advert->id."/medium/".$image->id.'-'.$image->image_name; }else{ $mainimage = $vscope->config['image_path']."/{$config['default_category_id']}/{$subdir_one}/{$subdir_two}/".$advert->id."/thumbs/".$image->id.'-'.$image->image_name; } if(!is_file("{$vscope->config['image_dir']}/{$vscope->config['default_category_id']}/{$subdir_one}/{$subdir_two}/{$advert->id}/thumbs/{$image->id}-{$image->image_name}")) { $mainimage = "{$vscope->config['image_path']}/{$config['default_category_id']}/_cache/noimage/{$noimageThumb}"; } } elseif(!empty($advert_detail->defaultimage)) { $mainimage = "{$vscope->config['image_path']}/{$config['default_category_id']}/_cache/{$advert_detail->defaultimage}/{$noimageThumb}"; if(!is_file("{$vscope->config['image_dir']}/{$vscope->config['default_category_id']}/_cache/{$advert_detail->defaultimage}/{$noimageThumb}")) { $mainimage = "{$vscope->config['image_path']}/{$config['default_category_id']}/_cache/noimage/{$noimageThumb}"; } }else{ $mainimage = "{$vscope->config['image_path']}/{$config['default_category_id']}/_cache/noimage/{$noimageThumb}"; } if($campaign->status == 'sold') $thisheadline = "".$advert->headline." SOLD"; else $thisheadline = $advert->headline; $item = array( 'link' => $vscope->config['site_url_public'].'/'.$manufacturer.'/'.$advert->headline_link($campaign->identifier), 'name' => $thisheadline, 'description' => $advert->short_description, 'image' => $mainimage, 'date' => date('M/d/Y',strtotime($campaign->startdate)), 'price_formatted' => '$'.str_replace(".00","",number_format($advert->price,2)), 'location' => $advert->locate(), 'escrow' => $campaign->escrow ); if($campaignuser->config['usertype'] == 'seller') { $item['type'] = 'seller'; $item['type_formatted'] = 'Private'; } else { $item['type'] = 'dealer'; $item['type_formatted'] = 'Dealer'; } eval('$paidlist .= "' . load_vs_template('list-bit') . '";'); } /************************************ * collect applicable basic listings ***********************************/ if($config['enable_geo_search']){ $coords['miles'] = 2000;//$vscope->config['default_miles']; $search->add_criteria('geography', $coords); } //$search->run_search(false, false, false, false, false); $search->fetch_index_listings($config['site_id'], false, false, $config['enable_geo_search']); $freelist = ""; foreach($search->items as $campaign) { $campaign->getparentclassifieds_advertisement(); $advert = &$campaign->parentclassifieds_advertisement; $advertlocation = $advert->locate(); $campaign->getparentuser(); $campaignuser = &$campaign->parentuser; // check for incoming advertisement detail attributes if($advert->id && in_array($advert->ad_type, $vscope->config['ad_types'])) { include_once("classes/dbo_classifieds_advertisement_{$advert->ad_type}.php"); $params = array('classifieds_advertisement_id' => $advert->id); eval('$ad_detail_collector = new classifieds_advertisement_'.$advert->ad_type.'Collector($params);'); if($ad_detail_collector->items[0]) { $advert_detail = $ad_detail_collector->items[0]; } else { eval('$advert_detail = new classifieds_advertisement_'.$advert->ad_type.'();'); } $manufacturer = cleanstr($advert_detail->manufacturer); } // skip this entry if there's a problem with it's detail data if(empty($advert_detail->id)) continue; $images = new classifieds_imageCollector($advert->id); $image = &$images->items[0]; if($image) { list($subdir_one, $subdir_two) = $image->get_image_sub_directories(); if( in_array($config['vehicle_product_code'], array('ATV','SNO','WAT')) ){ $mainimage = $vscope->config['image_path']."/{$vscope->config['default_category_id']}/{$subdir_one}/{$subdir_two}/".$advert->id."/medium/".$image->id.'-'.$image->image_name; }else{ $mainimage = $vscope->config['image_path']."/{$vscope->config['default_category_id']}/{$subdir_one}/{$subdir_two}/".$advert->id."/thumbs/".$image->id.'-'.$image->image_name; } if(!is_file("{$vscope->config['image_dir']}/{$vscope->config['default_category_id']}/{$subdir_one}/{$subdir_two}/{$advert->id}/thumbs/{$image->id}-{$image->image_name}")) { $mainimage = "{$vscope->config['image_path']}/{$vscope->config['default_category_id']}/_cache/noimage/{$noimageThumb}"; } } elseif(!empty($advert_detail->defaultimage)) { $mainimage = "{$vscope->config['image_path']}/{$vscope->config['default_category_id']}/_cache/{$advert_detail->defaultimage}/{$noimageThumb}"; if(!is_file("{$vscope->config['image_dir']}/{$vscope->config['default_category_id']}/_cache/{$advert_detail->defaultimage}/{$noimageThumb}")) { $mainimage = "{$vscope->config['image_path']}/{$vscope->config['default_category_id']}/_cache/noimage/{$noimageThumb}"; } } else { $mainimage = "{$vscope->config['image_path']}/{$vscope->config['default_category_id']}/_cache/noimage/{$noimageThumb}"; } if($campaign->status == 'sold') $thisheadline = "".$advert->headline." SOLD"; else $thisheadline = $advert->headline; $item = array( 'link' => $vscope->config['site_url_public'].'/'.$manufacturer.'/'.$advert->headline_link($campaign->identifier), 'name' => $thisheadline, 'description' => $advert->short_description, 'image' => $mainimage, 'date' => date('M/d/Y',strtotime($campaign->startdate)), 'price_formatted' => '$'.str_replace(".00","",number_format($advert->price,2)), 'location' => $advert->locate(), 'escrow' => $campaign->escrow ); if($campaignuser->config['usertype'] == 'seller') { $item['type'] = 'seller'; $item['type_formatted'] = 'Private'; } else { $item['type'] = 'dealer'; $item['type_formatted'] = 'Dealer'; } eval('$freelist .= "' . load_vs_template('list-bit') . '";'); } if($advert_detail && $advert->ad_type) { $advert_detail->manufacturer = ''; $advert_detail->category = ''; $advert_detail->year = ''; $advert_detail->model = ''; $availablemanufacturers = $advert_detail->getdistinct(); foreach($availablemanufacturers AS &$manufacturer) { $manufacturer = str_replace("'", "\'", $manufacturer); } $availablemanufacturers_js = "'".implode("','",$availablemanufacturers)."'"; // pull Detail JavaScripts eval('$detail_scripts = "' . load_vs_template('js-detail-'.$advert->ad_type) . '";'); } // pull Generic code eval('$headelements .= "' . load_vs_template('js-generic') . '";'); $userobj = new users(); $featured_ids = $userobj->searchconfig('usertype=dealer&featured='.$vscope->config['site_id']); $dealerlist = ""; foreach($featured_ids as $id) { $userobj = new users($id); $userobj->getparentcustomer(); $dealer = &$userobj->parentcustomer; // set the dealer logo if(is_file($vscope->config['image_dealers_dir'].'/'.$dealer->getcust_logo())) $logo = $vscope->config['image_dealers_path'].'/'.$dealer->getcust_logo(); else $logo = "images/classifieds/icons/picture-default.gif"; $companyname = $dealer->cust_company; $phone = $dealer->cust_phone; $dealerid = $userobj->id; $link = $self->stringtolink($companyname.'-'.$dealerid, 'dealers', true); eval('$dealerlist .= "' . load_vs_template('dealer-bit') . '";'); } // generate content for page eval('$content = "' . load_vs_template('index') . '";'); //will be updated in page_complete:plugin $pagetitle = "{$vscope->config['main_product']} For Sale: {$vscope->config['main_product']} Classifieds"; $metakeywords = "{$vscope->config['main_product']}s for sale, {$vscope->config['main_product']} classifieds, {$vscope->config['main_product']} trader, used {$vscope->config['main_product']} for sale, {$vscope->config['main_product']} classified"; $metadescription = "{$vscope->config['main_product']}s For Sale: Visit {$vscope->config['main_product']}.com's {$vscope->config['main_product']} classifieds. Used {$vscope->config['main_product']}s listings."; if($plugin = load_plugin("page_complete")){ eval($plugin); } require("../includes/load_wrapper.php");