Server IP : 51.89.169.208 / Your IP : 216.73.216.57 Web Server : Apache System : Linux ns3209505.ip-198-244-202.eu 4.18.0-553.27.1.el8_10.x86_64 #1 SMP Tue Nov 5 04:50:16 EST 2024 x86_64 User : yellowleaf ( 1019) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /home/yellowleaf/public_html/business/ |
Upload File : |
<?php session_start(); header('Content-Type: text/html; charset=UTF-8'); $path = $_SERVER['DOCUMENT_ROOT']; include_once $path.'/connect_db.php'; $request_uri = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? "https" : "http") . "://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]"; $url_components = parse_url($request_uri); parse_str($url_components['query'], $params); $param_page = $params['page']; if($param_page == '1'){ $request_uri = str_replace("?page=1", "", $request_uri); } function short_title_converter($string){ $short_title = ""; $split_string = explode(" ", $string); foreach ($split_string as $key => $value) { if ($key <= 2) { $word = trim($value); if (!preg_match('/[\'^£$%&*()}{@#~?><>,|=_+¬-]/', $word[0])) { $first_char = ucwords($word[0]); }else if(!preg_match('/[\'^£$%&*()}{@#~?><>,|=_+¬-]/', $word[1])){ $first_char = ucwords($word[1]); }else{ $first_char = ""; } $short_title .= $first_char; } } return $short_title; } $mid=ucwords(str_replace('-',' ',addslashes($_GET['mid']))); $id=ucwords(str_replace('-',' ',addslashes($_GET['id']))); if(preg_match("/[0-9]+/", $id) == TRUE){ include_once('towns.php'); die; } // $res_location = $connect->query("SELECT * FROM `locations` WHERE `area_parent_name` = '$id' GROUP BY `area_parent_name` LIMIT 1"); $res_location = $connect->query("SELECT `r_county_name` FROM `towns_new` WHERE `r_county_name` = '$id' GROUP BY `r_county_name` LIMIT 1"); if ($res_location->num_rows == 0) { // include 404 file include_once $path.'/404/index.php'; exit; } $row_location = $res_location->fetch_array(MYSQLI_ASSOC); $loc_page_text = $row_location["page_text"]; $loc_page_title = $row_location["page_title"]; $loc_meta_title = $row_location["meta_title"]; $loc_meta_desc = $row_location["meta_description"]; if (!empty($loc_meta_title)) { $meta_title = $loc_meta_title; }else{ // $meta_title = "Local businesses in $id"; $meta_title = "Business Directory $id - Yellowleaf UK"; } if (!empty($loc_meta_desc)) { $meta_desc = $loc_meta_desc; }else{ $meta_desc = "Find businesses in $id. Search through hundreds of businesses located in $id. Your local $id web directory."; } if (!empty($loc_page_text)) { $page_text = $loc_page_text; }else{ $page_text = ""; } $current_page = addslashes($_GET['page'])?:1; $per_page = addslashes($_GET['show'])?:25; $offset = $per_page * ($current_page - 1); $yadsq3 = $connect->query("SELECT * FROM ads WHERE `county_name`='{$id}' AND `active`='1' ORDER BY adid DESC LIMIT {$per_page} OFFSET $offset ") or die($connect->error); $total = $connect->query("SELECT * FROM ads WHERE `county_name`='{$id}' AND `active`='1' ")->num_rows; // $check = $yadsq3->num_rows; if ($check===0) {header('Location: /'); die; } $check = $yadsq3->num_rows; if ($check===0) { $mresults = ' <form action="" class="business-form"> <div class="search-box search-box-business"> <div class="search-content"> <div class="search-group"> <input type="text" name="q" class="business-autocomplete" placeholder="Taxi, Restaurant or Company Name" autocomplete="off"> </div> <div class="search-group"> <input type="text" name="a" class="location-autocomplete" placeholder="Town e.g London or E14" autocomplete="off"> </div> <button type="submit">Search</button> </div> </div> </form> <h2 class="no-result">No results found</h2>'; } while($row = $yadsq3->fetch_array()){ foreach( $row AS $key => $val ){ $$key = stripslashes( $val ); } $counter++; // pagin counter //$townlist .= $town_name; if($counter<$per_page){ $r_ad_name=strtolower($companyname); $r_ad_name = preg_replace("/[^A-Za-z 0-9]/", "", $r_ad_name); $r_ad_name=str_replace(" "," ",$r_ad_name); $ad_name=str_replace(" ","-",$r_ad_name); $desc = substr(strip_tags($description),0,300); if(strlen($description) > 300){ $desc .= "..."; } $subArea=substr($areas_cover,0,200); if(strlen($str)<200){$Area=$subArea.'...';}else{$Area=$areas_cover;} if ($street2) {$fulladd=ucwords(strtolower("$street1, $street2, $town_name, $county_name, "));} else {$fulladd=ucwords(strtolower("$street1, $town_name, $county_name, "));} if(!$town_name) {$town_name= $county_name;} $mheader = '<a style="font-size:12pt;" href="/pages/'.$adid.'-'.$ad_name.'.html"><b>'.$companyname.', '.$town_name.'</a>';} if ($row["aspect_ratio"] == 1) { $aspect_ratio_class = 'aspect-square'; }else{ $aspect_ratio_class = ''; } $short_title = short_title_converter($companyname); $business_logo_placeholder = '<div class="business-placeholder-image">'.$short_title.'</div>'; $img = $row['image'] && file_exists($path.'/members/uploads/logo/'.$row['image']) ? '<img class="'.$aspect_ratio_class.'" alt="Listing" src="/members/uploads/logo/'.$row['image'].'">' : $business_logo_placeholder; $serv = ''; $serv_more = ''; $serv_more_p = ''; $show_related = ''; $show_related .= $row['cat1'] ? '<a class="business-item-review" href="/near-me/'.makeHyphenString($row['cat1']).'/'.makeHyphenString($row['town_name']).'-in-'.makeHyphenString($row['county_name']).'">'.ucwords($row["cat1"]).' in '.$row["town_name"].'</a>' : ''; $show_related .= $row['cat2'] ? ', <a class="business-item-review" href="/near-me/'.makeHyphenString($row['cat2']).'/'.makeHyphenString($row['town_name']).'-in-'.makeHyphenString($row['county_name']).'">'.ucwords($row["cat2"]).' in '.$row["town_name"].'</a>' : ''; $show_related .= $row['cat3'] ? ', <a class="business-item-review" href="/near-me/'.makeHyphenString($row['cat3']).'/'.makeHyphenString($row['town_name']).'-in-'.makeHyphenString($row['county_name']).'">'.ucwords($row["cat3"]).' in '.$row["town_name"].'</a>' : ''; $style_business_item = ''; if($row['services_products']){ $services_offered = explode(' || ', $row['services_products']); $serv = '<ul class="business-item-features">'; foreach($services_offered as $key => $sa){ $sa = trim($sa); if (!empty($sa)) { if($sa!='.'){ $serv .= '<li>'.ucfirst($sa).'</li>'; } } } $serv .= '</ul>'; // $serv_more .= '<div class="business-item-features" style="display: inline-block; padding-left: 0px!important">Related: <a class="business-item-review" href="/near-me/'.makeHyphenString($row['cat1']).'/'.makeHyphenString($row['town_name']).'-in-'.makeHyphenString($row['county_name']).'">'.$row["cat1"].' in '.$row["town_name"].'</a>, <a class="business-item-review" href="/near-me/'.makeHyphenString($row['cat2']).'/'.makeHyphenString($row['town_name']).'-in-'.makeHyphenString($row['county_name']).'">'.$row["cat2"].' in '.$row["town_name"].'</a>, <a class="business-item-review" href="/near-me/'.makeHyphenString($row['cat2']).'/'.makeHyphenString($row['town_name']).'-in-'.makeHyphenString($row['county_name']).'">'.$row["cat3"].' in '.$row["town_name"].'</a>.</div>'; // $serv_more_p .= '<div id="service_more" class="business-item-features" style="display: inline-block; padding-left: 0px!important">Related: <a class="business-item-review" href="/near-me/'.makeHyphenString($row['cat1']).'/'.makeHyphenString($row['town_name']).'-in-'.makeHyphenString($row['county_name']).'">'.$row["cat1"].' in '.$row["town_name"].'</a>, <a class="business-item-review" href="/near-me/'.makeHyphenString($row['cat2']).'/'.makeHyphenString($row['town_name']).'-in-'.makeHyphenString($row['county_name']).'">'.$row["cat2"].' in '.$row["town_name"].'</a>, <a class="business-item-review" href="/near-me/'.makeHyphenString($row['cat2']).'/'.makeHyphenString($row['town_name']).'-in-'.makeHyphenString($row['county_name']).'">'.$row["cat3"].' in '.$row["town_name"].'</a>.</div>'; if(!empty($show_related)){ $serv_more .= '<div class="business-item-features" style="display: inline-block; padding-left: 0px!important">Related: '.$show_related.'</div>'; $serv_more_p .= '<div id="service_more" class="business-item-features" style="display: inline-block; padding-left: 0px!important">Related: '.$show_related.'</div>'; } } else{ $style_business_item = 'style="display: none"'; // $serv .= '<ul class="business-item-features">No service found.</ul>'; // $serv_more .= '<div class="business-item-features" style="display: inline-block; padding-left: 0px!important">Related: <a class="business-item-review" href="/near-me/'.makeHyphenString($row['cat1']).'/'.makeHyphenString($row['town_name']).'-in-'.makeHyphenString($row['county_name']).'">'.$row["cat1"].' in '.$row["town_name"].'</a>, <a class="business-item-review" href="/near-me/'.makeHyphenString($row['cat2']).'/'.makeHyphenString($row['town_name']).'-in-'.makeHyphenString($row['county_name']).'">'.$row["cat2"].' in '.$row["town_name"].'</a>, <a class="business-item-review" href="/near-me/'.makeHyphenString($row['cat3']).'/'.makeHyphenString($row['town_name']).'-in-'.makeHyphenString($row['county_name']).'">'.$row["cat3"].' in '.$row["town_name"].'</a>.</div>'; // $serv_more_p .= '<div id="service_more" class="business-item-features" style="display: inline-block; padding-left: 0px!important">Related: <a class="business-item-review" href="/near-me/'.makeHyphenString($row['cat1']).'/'.makeHyphenString($row['town_name']).'-in-'.makeHyphenString($row['county_name']).'">'.$row["cat1"].' in '.$row["town_name"].'</a>, <a class="business-item-review" href="/near-me/'.makeHyphenString($row['cat2']).'/'.makeHyphenString($row['town_name']).'-in-'.makeHyphenString($row['county_name']).'">'.$row["cat2"].' in '.$row["town_name"].'</a>, <a class="business-item-review" href="/near-me/'.makeHyphenString($row['cat3']).'/'.makeHyphenString($row['town_name']).'-in-'.makeHyphenString($row['county_name']).'">'.$row["cat3"].' in '.$row["town_name"].'</a>.</div>'; if(!empty($show_related)){ $serv_more .= '<div class="business-item-features" style="display: inline-block; padding-left: 0px!important">Related: '.$show_related.'</div>'; $serv_more_p .= '<div id="service_more" class="business-item-features" style="display: inline-block; padding-left: 0px!important">Related: '.$show_related.'</div>'; } } /** ratings */ $r7 = $connect->query("SELECT * FROM `reviews` WHERE `rev_ad_id` = '{$row['adid']}' AND `rev_spam`='0' ORDER BY rev_id DESC") or die($connect->error); $rev_num_row = $r7->num_rows; $average_rating_html = ''; if($rev_num_row){ unset($ratings); while($rev_row = mysqli_fetch_array($r7)){ $ratings[] = $rev_row['rev_rating']; // company overall review rating $arr_sum = array_sum($ratings); $total_review = count($ratings); $mean = $arr_sum / $rev_num_row; $average_rating = round($mean, 1); $average = round($mean*2)/2; // round to the nearest half for($i=1; $i<=5; $i++){ if($i <= $average){ $average_rating_html .= '<svg fill="#FFCC22"> <use xlink:href="index.svg#star-fill"></use> </svg>'; } else{ $average_rating_html .= '<svg fill="#EEE"> <use xlink:href="index.svg#star-fill"></use> </svg>'; } } } } else{ $total_review = 0; $average = 0; for($i=1; $i<=5; $i++){ $average_rating_html .= '<svg fill="#EEE"> <use xlink:href="index.svg#star-fill"></use> </svg>'; } } // for opening times $add_que_sql = $connect->query("SELECT * FROM opening_hours WHERE opadid ='{$adid}'"); $add_row = $add_que_sql->fetch_assoc(); $current_day = strtolower(date("l")); $opening_status = ''; $opening_at = ''; $closing_at = ''; for($i=0; $i<=7; $i++){ if($i==0){ $future_day = strtolower(date("l", strtotime("+{$i} days"))); $time = explode(" - ", $add_row["$future_day"]); $start = str_replace(".", ":", $time[0]); $end = str_replace(".", ":", $time[1]); $current = date("h:iA"); $start_time = DateTime::createFromFormat('h:iA', $start); $current_time = DateTime::createFromFormat('h:iA', $current); $end_time = DateTime::createFromFormat('h:iA', $end); // echo $start. " ".$current." ".$end; // die(); if ($current_time >= $start_time && $current_time <= $end_time) { $opening_status = 'Open'; $ap = strtolower((substr($end,-2))); $clsing_time = str_ireplace($ap, '', $end).$ap; $closing_at = "Closes at {$clsing_time} Today"; break; } } else{ $future_day = strtolower(date("l", strtotime("+{$i} days"))); if($add_row["$future_day"] != "Closed" && $add_row["$future_day"] != ""){ $time = explode(" - ", $add_row["$future_day"]); $start = str_replace(".", ":", $time[0]); $start = str_replace("AM", " am", $start); $start = str_replace("PM", " pm", $start); $opening_status = 'Closed'; $day = ucfirst($future_day); $opening_at = "Opens on {$day} {$start}"; break; } } } $mresults .= '<div class="business-item"> <div class="business-item-box"> <div class="business-item-image"> '.$img.' </div> <div class="business-item-info"> <a href="/pages/'.$adid.'-'.$ad_name.'.html" class="business-item-title">'.$row['companyname'].''.$addtitle.''.$servtown_name.'</a> <p class="business-item-description">'.$desc.'</p> <div class="business-item-actions"> <button class="button button-yellow button-sm button-icon send-message" data-adid="'.$row['adid'].'"> <svg> <use xlink:href="/business/index.svg#message-line"></use> </svg> Message </button> <a rel="nofollow" href="'.url_display($row['url']).'" class="button button-yellow button-sm button-icon" target="_blank"> <svg> <use xlink:href="/business/index.svg#global-line"></use> </svg> Website </a> <!--<a href="#" class="button button-yellow button-sm button-icon"> <svg> <use xlink:href="/business/index.svg#phone-line"></use> </svg> Call </a>--> </div> <div class="business-item-location"> <svg> <use xlink:href="/business/index.svg#map-pin-line"></use> </svg> <div>'.$fulladd." ".trim($row['postcode']).'.</div> </div> <div class="business-item-status"> <span style="'.(($opening_status == "Open") ? "color: var(--green)" : "" ).'">'.$opening_status.'</span> '.(($opening_status == "Closed") ? $opening_at : $closing_at ).' </div> '.$serv.' '.$serv_more_p.' </div> <div class="business-item-more" style="display: none"> <div class="listing-star-container"> '.$average_rating_html.' </div> <div class="business-item-rating-text"> '.$average.' (<a href="#">'.$total_review.' Rating</a>) </div> <a href="/pages/'.$adid.'-'.$ad_name.'.html#write-review" class="business-item-review">Write a review</a> <a href="/pages/'.$adid.'-'.$ad_name.'.html" class="button button-yellow button-sm">More Info</a> </div> </div> <div class="business-item-bottom"> <div class="business-item-bottom-features" '.$style_business_item.'> <button type="button" class="business-item-bottom-features-header"> Products and services <svg> <use xlink:href="/business/index.svg#arrow-down-line"></use> </svg> </button> <!--<ul class="business-item-features"> <li>Vegetarian Restaurant</li> <li>Vegetarian Restaurant</li> <li>Vegetarian Restaurant</li> <li>Vegetarian Restaurant</li> <li>Vegetarian Restaurant</li> <li>Vegetarian Restaurant</li> </ul>--> '.$serv.' </div> '.$serv_more.' <div class="business-item-bottom-actions"> <a href="#" class="button button-yellow button-sm button-icon send-message" data-adid="'.$row['adid'].'"> <svg> <use xlink:href="/business/index.svg#message-line"></use> </svg> Message </a> <a href="tel:'.$row['tel'].'" class="button button-yellow button-sm button-icon"> <svg> <use xlink:href="/business/index.svg#phone-line"></use> </svg> Call </a> <a rel="nofollow" href="'.url_display($row['url']).'" class="button button-yellow button-sm button-icon" target="_blank"> <svg> <use xlink:href="/business/index.svg#global-line"></use> </svg> Website </a> <a href="/pages/'.$adid.'-'.$ad_name.'.html" class="button button-outline-yellow button-sm">More</a> </div> </div> </div>'; } // echo $townlist; if($total){ $showing_sentence = number_format($total); } $pagination['prev'] = ''; if ($current_page > 1) { $query_string = change_param(['field'=>'page', 'value'=>($current_page - 1)]); $pagination['prev'] = ' <a href="'.$file_path.$query_string.'" class="business-pagination-item"> <svg> <use xlink:href="index.svg#arrow-left-s-line"></use> </svg> </a>'; } $max_pages = ceil($total/$per_page)?:1; $pagination['next'] = ''; if ($total > $offset + $per_page) { $query_string = change_param(['field'=>'page', 'value'=>($current_page + 1)]);// saved url for later use $pagination['next'] = '<a href="'.$file_path.$query_string.'" class="business-pagination-item"> <svg> <use xlink:href="index.svg#arrow-right-s-line"></use> </svg> </a>'; } // if ($check > 0) { // $limit = 5; // $show_max_pages = $limit; // $start_from = 1; // if ($max_pages >= $limit) { // if ($current_page == $show_max_pages && $current_page != $max_pages) { // $start_from = $start_from + 3; // $show_max_pages = $show_max_pages+3; // }else if($current_page > $show_max_pages){ // $start_from = $current_page - 2; // $increase_show_max = $current_page + 2; // if ($increase_show_max > $max_pages) { // $show_max_pages = $max_pages; // if ($current_page == $max_pages) { // $start_from = $max_pages - 4; // } // }else{ // $show_max_pages = $increase_show_max; // } // } // } // for ($i=$start_from; $i <= $show_max_pages; $i++) { // $query_string = change_param(['field'=>'page', 'value'=>$i]); // if ($current_page == $i) { // $page_no .= '<a class="active" href="'.$file_path.$query_string.'">'.$i.'</a>'; // }else{ // $page_no .= '<a href="'.$file_path.$query_string.'">'.$i.'</a>'; // } // } // $pagination_html= $pagination['prev'].$page_no.$pagination['next']; // $pagination_info = "{$current_page} of {$max_pages} page". ($max_pages > 1 ? 's' : ''); // } if ($check > 0) { $limit = 5; $start_from = max(1, $current_page - floor($limit / 2)); $end_at = min($max_pages, $start_from + $limit - 1); // Adjust start_from if at the end of the range if ($end_at - $start_from + 1 < $limit) { $start_from = max(1, $end_at - $limit + 1); } $page_no = ''; for ($i = $start_from; $i <= $end_at; $i++) { $query_string = change_param(['field' => 'page', 'value' => $i]); if ($current_page == $i) { $page_no .= '<a class="active" href="' . $file_path . $query_string . '">' . $i . '</a>'; } else { $page_no .= '<a href="' . $file_path . $query_string . '">' . $i . '</a>'; } } $pagination_html = $pagination['prev'] . $page_no . $pagination['next']; $pagination_info = "{$current_page} of {$max_pages} page" . ($max_pages > 1 ? 's' : ''); } if (!empty($loc_page_title)) { $title = $loc_page_title; }else{ // $title ="Local businesses in $id"; $title ="Business Directory $id"; } if($current_page>1){ $page_no =" Page ".$current_page; } $murl= preg_replace("/\?page\=(.*)/i", "", $_SERVER["REQUEST_URI"]); $remove_id = str_replace('Greater ','',$id); // floating advertise button on right if(isset($_SESSION['ename'])||isset($_COOKIE['yl_user'])){$yleaf_url='/members/';}else{$yleaf_url='/advertise/';} $provided_by_btn='<a style="border:0px;outline:none;" href="'.$yleaf_url.'"> <img src="/img/providedby.png" onmouseover="this.src=\'/img/providedby_hover.png\'" onmouseout="this.src=\'/img/providedby.png\'" style="border:0;outline:none;"> </a>'; if (!$suggest) {$suggest='No location available for this county.';} function _readphp_eval($code) { ob_start(); print eval('?>'. $code); $output = ob_get_contents(); ob_end_clean(); return $output; } /** get locations data */ $location_sql = $connect->query("SELECT *, COUNT(*) as `count` FROM ads WHERE active='1' GROUP BY county_name ORDER BY `county_name` ASC"); // $area_num_rows = $area_sql->num_rows; $location_result = ''; if ($check === 0) { $location_result = '<div class="container"> <h2 class="section-title">Check others locations</h2> <div class="location-wrapper">'; while ($location_row = $location_sql->fetch_assoc()) { $location_name = $location_row['county_name']; $count_business = $location_row['count']; if ($location_name) { //// replacing space with dash /************** displayed on the page *************/ $location_link = strtolower($location_name); $location_link = str_replace(" ", "-", $location_link); $location_result .= '<a href="/business/' . $location_link . '.html" class="location-item" data-tooltip="'.$count_business.' Business">' . $location_name . '</a>'; } } $location_result .= '</div> </div>'; } include "listing.php"; $business_sql = $connect->query("SELECT * FROM ads where active = 1 order by adid desc limit 4"); $latest_business = ''; while ($row = $business_sql->fetch_assoc()) { $business_row = get_listing($row); $b_name = $business_row['companyname']; $b_county_name = $business_row['county_name']; $b_image = $business_row['image']; $r_ad_name=strtolower($b_name); $r_ad_name = preg_replace("/[^A-Za-z 0-9]/", "", $r_ad_name); $r_ad_name=str_replace(" "," ",$r_ad_name); $ad_name=str_replace(" ","-",$r_ad_name); $adid = $business_row['adid']; $short_title = short_title_converter($b_name); $business_logo_placeholder = '<div class="business-placeholder-image">'.$short_title.'</div>'; if ($row["aspect_ratio"] == 1) { $aspect_ratio_class = 'aspect-square'; }else{ $aspect_ratio_class = ''; } if($b_image){ if(file_exists('./members/uploads/logo/'.$b_image)){ $src = '/members/uploads/logo/'.$b_image; $lb_image = '<img class="'.$aspect_ratio_class.'" src="'.$src.'" alt="tshirt photo">'; }else{ $lb_image = $business_logo_placeholder; } }else{ $lb_image = $business_logo_placeholder; } $latest_business .= ' <div class="listing-item"> <div class="listing-header"> <a href="/pages/'.$adid.'-'.$ad_name.'.html" class="listing-image"> '.$lb_image.' </a> </div> <div class="listing-info"> <div class="listing-location"> <svg> <use xlink:href="/homepage/index.svg#location-fill"></use> </svg> '.$b_county_name.' </div> <a href="/pages/'.$adid.'-'.$ad_name.'.html" class="listing-title"> '.$b_name.' </a><br> <div class="listing-rating-star"> <svg> <use xlink:href="/homepage/index.svg#star-fill"></use> </svg> <svg> <use xlink:href="/homepage/index.svg#star-fill"></use> </svg> <svg> <use xlink:href="/homepage/index.svg#star-fill"></use> </svg> <svg> <use xlink:href="/homepage/index.svg#star-fill"></use> </svg> <svg> <use xlink:href="/homepage/index.svg#star-fill"></use> </svg> </div> <div class="listing-action"> <!-- <a href="#"> <svg> <use xlink:href="/homepage/index.svg#phone-fill"></use> </svg> </a> <a href="#" data-toggle="modal" data-target="#popup"> <svg> <use xlink:href="/homepage/index.svg#location-fill"></use> </svg> </a> --> </div> </div> </div> '; } $featureb_sql = $connect->query("SELECT * FROM ads WHERE featured=1 limit 4"); $featured_business = ''; while ($row = $featureb_sql->fetch_assoc()) { $featurebusiness_row = get_listing($row); $fb_name = $featurebusiness_row['companyname']; $fb_county_name = $featurebusiness_row['county_name']; $fb_image = $featurebusiness_row['image']; $fr_ad_name=strtolower($fb_name); $fr_ad_name = preg_replace("/[^A-Za-z 0-9]/", "", $fr_ad_name); $fr_ad_name=str_replace(" "," ",$fr_ad_name); $fad_name=str_replace(" ","-",$fr_ad_name); $fadid = $featurebusiness_row['adid']; $short_title = short_title_converter($fb_name); $business_logo_placeholder = '<div class="business-placeholder-image">'.$short_title.'</div>'; if ($row["aspect_ratio"] == 1) { $aspect_ratio_class = 'aspect-square'; }else{ $aspect_ratio_class = ''; } if(!empty($fb_image)){ if(file_exists('./members/uploads/logo/'.$fb_image)){ $src = '/members/uploads/logo/'.$fb_image; $featured_image = '<img class="'.$aspect_ratio_class.'" src="'.$src.'" alt="tshirt photo">'; }else{ $featured_image =$business_logo_placeholder; } }else{ $featured_image = $business_logo_placeholder; } $featured_business .= ' <div class="listing-item"> <div class="listing-header"> <a href="/pages/'.$fadid.'-'.$fad_name.'.html" class="listing-image"> '.$featured_image.' </a> </div> <div class="listing-info"> <div class="listing-location"> <svg> <use xlink:href="/homepage/index.svg#location-fill"></use> </svg> '.$fb_county_name.' </div> <a href="/pages/'.$fadid.'-'.$fad_name.'.html" class="listing-title"> '.$fb_name.' </a><br> <div class="listing-rating-star"> <svg> <use xlink:href="/homepage/index.svg#star-fill"></use> </svg> <svg> <use xlink:href="/homepage/index.svg#star-fill"></use> </svg> <svg> <use xlink:href="/homepage/index.svg#star-fill"></use> </svg> <svg> <use xlink:href="/homepage/index.svg#star-fill"></use> </svg> <svg> <use xlink:href="/homepage/index.svg#star-fill"></use> </svg> </div> <div class="listing-action"> <!-- <a href="#"> <svg> <use xlink:href="/homepage/index.svg#phone-fill"></use> </svg> </a> <a href="#" data-toggle="modal" data-target="#popup"> <svg> <use xlink:href="/homepage/index.svg#location-fill"></use> </svg> </a> --> </div> </div> </div> '; } $tplbody= file_get_contents("results_tpl.html"); $header= file_get_contents($path.'/header-footer/header.php'); $header = _readphp_eval($header); $footer= file_get_contents($path.'/header-footer/footer.php'); $footer = _readphp_eval($footer); $search_box = file_get_contents("../search_box2.php"); $tplbody = str_replace("{provided_by_btn}", "$provided_by_btn", $tplbody); $tplbody = str_replace("{header}", "$header", $tplbody); $tplbody = str_replace("{footer}", "$footer", $tplbody); //$tplbody = str_replace("{canonical}", "$canonical", $tplbody); $tplbody = str_replace("{title}", $title, $tplbody); $tplbody = str_replace("{meta_title}", $meta_title, $tplbody); $tplbody = str_replace("{meta_desc}", $meta_desc, $tplbody); $tplbody = str_replace("{page_text}", $page_text, $tplbody); $tplbody = str_replace("{meta_url}", $request_uri, $tplbody); $tplbody = str_replace("{page_no}", $page_no, $tplbody); $tplbody = str_replace("{page_info}", $pagination_info, $tplbody); $tplbody = str_replace("{search_box}", $search_box, $tplbody); $tplbody = str_replace("{results}", $mresults, $tplbody); $tplbody = str_replace("{pagin_prev}", $pagin_prev, $tplbody); $tplbody = str_replace("{pagin_next}", $pagin_next, $tplbody); $tplbody = str_replace("{county}", "$remove_id", $tplbody); $tplbody = str_replace("{murl}", "$murl", $tplbody); $tplbody = str_replace("{latest_business}", $latest_business, $tplbody); $tplbody = str_replace("{featured_business}", $featured_business, $tplbody); $tplbody = str_replace("{type}", "$cattype", $tplbody); $tplbody = str_replace("{area_found}", "$area_found", $tplbody); $tplbody = str_replace("{longlat}", "$longlat", $tplbody); $tplbody = str_replace("{version}", "$versionno", $tplbody); $tplbody = str_replace("{suggest}", $suggest, $tplbody); $tplbody = str_replace("{pagin_html}", $pagination_html, $tplbody); $tplbody = str_replace("{locations}", $location_result, $tplbody); $outputline = explode("\n",$tplbody); foreach ($outputline as $line) { if (trim($line)) { echo trim($line); echo " "; } } function highlightWords($string, $cat) { $words=explode(' ',$cat); foreach ( $words as $word ) { $word=trim(quotemeta(stripslashes($word))); $color_pos=1; $string = preg_replace('#([^a-zA-Z0-9])('.$word.')([^a-zA-Z0-9])#Usi', '\1<span style="background-color: #FFFF93">\2</span>\3', $string); $color_pos++; } return $string; } function construct_array($pos){ global $words_array; $words_include=15; for ($i=$words_include;$i>0;$i--) { if(($pos-$i)>=0){$words_array[$pos-$i]=1; } } $words_array[$pos]=1; for ($i=1;$i<=$words_include;$i++) { $words_array[$pos+$i]=1; } } function change_param($info){ global $query_array; $params_temp = $query_array; $key = $info['field']; $value = $info['value']; $is_array = false; if(is_array($params_temp[$key])){ $is_array = true; $array_key = array_search($value, $params_temp[$key]); $params_temp[$key][$array_key] = $value; }else{ $params_temp[$key] = $value; } unset($params_temp['ajax']);unset($params_temp['utm_expid']); // if (($key == 'page' && $value == '1') || $key !== 'page' ) {unset($params_temp['page']);} if ($info['delete']==1 && !$is_array) {unset($params_temp[$key]);} if ($is_array && $info['delete']==1) {unset($params_temp[$key][$array_key]);} $query_string = http_build_query_decoded($params_temp); if($query_string == ""){return '';} return '?'.$query_string ; } function http_build_query_decoded($params){ $query = http_build_query($params); if(strpos($query,'%5B') !== false){ $query = preg_replace('/%5B[0-9]+%5D/simU', '%5B%5D', $query); } return urldecode($query); } function makeHyphenString($string){ return str_replace(" ", "-", strtolower($string)); } function url_display($url){ if(strlen($url)<1){ return "#"; } $chk = preg_match('/^https?:\/\//', $url, $url_check); if(!$chk){ return "https://".$url; } else{ return $url; } } ?>