one_row('SELECT '.COL_AD_TITLE.',userid,feed_code,feed_prop_id,v_255_22,catid,v_255_23,v_255_21,v_255_2,v_255_3,v_255_4,lh_lake_on,gh_club,v_255_35 FROM '. TBL_AD . ' WHERE link_id='.$id); if (!$cid) { echo('Wrong Ad ID - Request Information Message'); exit; } //if(!$subj) $err_msg = $A_LNG['err_subject']; $IS_LHUB_ACC = ($feed_code == LHUB_FEED_ID && $uid == LHUB_UID); $contact_phone = $IS_LHUB_ACC ? '888-933-5253' : $adContactPhone; $mspot = (int)$_POST['mspot']; $a_Agent = $IS_LHUB_ACC ? getMatchingBuyerAgent($mspot, $cid) : []; if($feed_code=='FLEXMLS'){ if(strpos($company_name,FEATURED_COMPANY)===false){ $contact = FEATURED_COMPANY; // TODO: agent's email $adContactEmail = 'joseph@josephcarterrealty.com'; // TODO: Place agent's phone number as well ? $contact_phone = $adContactPhone = '205-717-5253'; } // is this request to a particular agent ? if($_POST['agentId']){ $v = $db->one_assoc('SELECT email,v_255_1,v_255_2,v_255_3 FROM '.TBL_USER.' WHERE id='.(int)$_POST['agentId']); if($v){ $adContactEmail = $v['email']; $contact_phone = $adContactPhone = $v['v_255_2']; $contact = $v['v_255_1'].' '.$v['v_255_3']; } } } if(!$err_msg && $phone){ if(strlen($phone)>16) $err_msg = 'Please use this phone format: 999-999-9999'; elseif(preg_match('@https?://@i', $phone) || preg_match('/\.(?:com|net|org|us)\b/i', $phone)) $err_msg = 'Not a valid phone number'; } if(!$err_msg && ($fname || $lname)){ $name = "$fname $lname"; if(strlen($name)>50 || preg_match('@https?://@i', $name) || preg_match('/\.(?:com|net|org|us)\b/i', $name)) $err_msg = 'Website links are not allowed here. Please submit your full name.'; } if(!$err_msg && $IS_LHUB_ACC && $mspot<=0){ if(!$fname) $err_msg = 'First Name is required'; elseif(!$lname) $err_msg = 'Last Name is required'; elseif(!$phone) $err_msg = 'Phone is required'; else{ require_once __DIR__ . '/libphonenumber/Autoloader.php'; if(!\libphonenumber\isPhoneValid($phone)){ $err_msg = 'Please enter correct phone number'; if($phone[0]!='+') $err_msg.='. Non-US numbers should start with "+" sign'; } } } if(!$err_msg){ if(!$_POST['sms'] && !IsEmail($from)) $err_msg = $A_LNG['req_email']; elseif(preg_match('/<[^>]+>/', $msg)) $err_msg = $A_LNG['err_html_msg']; elseif(preg_match('/[a-zA-Z0-9\_\-]+(\.[a-zA-Z0-9\_\-]+)*\@[a-zA-Z0-9\_\-]+(\.[a-zA-Z0-9\_\-]+)*(\.[a-zA-Z]+)/', $msg)) $err_msg = $A_LNG['err_email_msg']; //elseif(preg_match('@((https?://)?([-\\w]+\\.[-\\w\\.]+)+\\w(:\\d+)?(/([-\\w/_\\.]*(\\?\\S+)?)?)*)@', $msg)) $err_msg = $A_LNG['err_url_msg']; elseif(preg_match('@https?://@i', $msg) || preg_match('/\.(?:com|net|org|us)\b/i', $msg)) $err_msg = $A_LNG['err_url_msg']; elseif(preg_match('/\?{4,}/', $msg)) $err_msg = 'Unacceptable characters in your message. Please call 888-933-5253 for assistance.'; elseif($IS_LHUB_ACC && empty($a_Agent) && empty($_POST['xxTrustedFormCertUrl'])) $err_msg = 'Unknown error. Please try again'; else { $secret = '6Le_wN4UAAAAAP8LfX3Axp2A3oDvW4coC4NdmV2Q'; if(empty($_POST['g-recaptcha-response'])) $err_msg = $A_LNG['err_img_code']; else{ $v = reCaptchaVerify($secret, $_POST['g-recaptcha-response']); if(!$v['success']) $err_msg = $A_LNG['err_img_code']; } //if (!ImageVerify::IsTextOK($_POST['img_text'])) $err_msg = $A_LNG['err_img_code']; } } if (!$err_msg) { if ($db->one_data("SELECT count(*) FROM " . TBL_SEND_MSG_LOG . " WHERE ip='$REMOTE_ADDR' AND date_added>DATE_SUB(NOW(),INTERVAL $SEND_MSG_PERIOD HOUR)") > 16) { $err_msg = "You have reached the maximum number of emails allowed. Please try again later"; SendMail('csv@lakehouse.com,lee@anyprop.com',"DHN: MAX EMAILS ALERT! Attempt from $REMOTE_ADDR (Ad ID: $id, User ID: $uid)",$msg,$from,$fromname); } } if (!$err_msg) { incrementAdEmailHits($id); if($feed_code=='HOMESANDLAND' || $IS_LHUB_ACC){ $email = $adContactEmail; $phonenet = $phoneOwner = ''; } else list($email,$phoneOwner,$phonenet) = $db->one_row('SELECT email,v_255_2,phonenet FROM ' . TBL_USER . ' WHERE id='.$uid); $msg = iconv('utf-8', 'us-ascii//TRANSLIT',$msg); if($_POST['sms']) $inquiry_source = 'Mobile-Text'; else $inquiry_source = DESKTOP_CLIENT ? 'Desktop' : 'Mobile'; $lead_id = insertLead($id, $fromname, $from, $phone, $msg, $_SERVER['REMOTE_ADDR'], $inquiry_source); if ($feed_code == '') $feed_code_info = ''; else { //$DEBUG_LHUB = ($feed_code == LHUB_FEED_ID && $_SERVER['REMOTE_ADDR']==''); $feed_code_info = 'Property courtesy of ' . $feed_code; } // ('Property courtesy of '.$feed_code.'') $REMOTE_ADDR = $_SERVER['REMOTE_ADDR']; $SITE_URL = SITE_URL; $price = number_format($price); $ad_url = hwGetAdURL($id); ProcessSearchFriendlyURLs($ad_url); $email_body = EvalAdvTpl(TPL_PATH . 'send_msg.mail', '$to,$subj,$id,$from,$fromname,$mls,$contact,$addr,$city,$state,$price,$lakename,$golfcourse'. ',$ad_url,$msg,$phone,$REMOTE_ADDR,$SITE_URL,$feed_code_info,$inquiry_source'); //$err_msg = 'A Request for Information e-mail has been sent to the contact for ad #' . $id . '. Thank You.'; if (DESKTOP_CLIENT) { $err_msg = '



Success!

Your request has been sent by email to the contact for this ad #' . $id . '.

Thank You!



'; } else { $err_msg = ''; } $state_id = (int)$db->one_data('SELECT pid FROM '.TBL_CAT.' WHERE id='.$cid); $IS_USA = (0 == $db->one_data('SELECT pid FROM '.TBL_CAT.' WHERE id='.$state_id)); if($IS_LHUB_ACC){ if($IS_USA){ $email_subj = 'Claim This Lead from Your Listing on LakeHouse.com!'; $email_body2 = preg_replace('/.*?/s','',$email_body); $email_body2 = preg_replace('~
Claim Your Listing

Get your leads sent exclusively to you by becoming a MEMBER of LakeHouse.com!

When you CLAIM your listings, your leads are not shared with our Lakehouse Member Agents. Reasons to join:

Call 888-933-5253 or email csv@lakehouse.com for more information.

Click here to review the details of our Listhub integration.



',$email_body2); } else{ $email_subj = 'Buyer Lead from LakeHouse.com'; $email_body = EvalAdvTpl(TPL_PATH . 'send_msg_lhub_non_us.mail', '$to,$subj,$id,$from,$fromname,$mls,$contact,$addr,$city,$state,$price,$lakename,$golfcourse'. ',$ad_url,$msg,$phone,$REMOTE_ADDR,$SITE_URL,$feed_code_info,$inquiry_source'); $email_body2 = $email_body; } } else{ $email_subj = 'Referral from LakeHouse.com'; $email_body2 = $email_body; } $a_em = []; if($mspot>0 && $_POST['sms'] && $IS_LHUB_ACC){} elseif($_POST['sms'] && $phonenet) NotifySMS($id,$phonenet,$phoneOwner,$fromname,$phone,$msg); elseif($IS_LHUB_ACC && $IS_USA){ $a_em['to'] = $email; $a_em['subj'] = $email_subj; $a_em['msg'] = $email_body2; $a_em['from'] = $from; } else{ $bcc = ''; if($feed_code == 'FLEXMLS' && $email != $adContactEmail){ // one of agents' personal listings $bcc = $email; $email = $adContactEmail; // go directly to joseph carter realty agent } SendMail($email, $email_subj, $email_body2, EMAIL_USER_CONTACT, 'LakeHouse.com', $from, $bcc); } $lkh_email = 'lkhseref@lakehouse.com'; $email_subj = 'No Action Required - Listing Agent Copy (source: '.$inquiry_source.')'; SendMail($lkh_email, $email_subj, $email_body2, EMAIL_USER_CONTACT, 'LakeHouse.com', $from); $agent_email = $abbr_state = ''; $show_rc_contact = true; if($feed_code != ''){ if($feed_code==LHUB_FEED_ID){ if($IS_LHUB_ACC){ $email_body = str_replace(['Here is an inquiry regarding','your listing'],['Here is a BUYER AGENT lead from','this listing'],$email_body); $email_body = preg_replace('~query('UPDATE '.TBL_SEND_MSG_LOG.' SET buyer_userid='.$a_Agent['userid']. ',buyer_agent_email="'.$db->quote($agent_email).'",listing_agent_email="'.$db->quote($email).'" WHERE id='.$lead_id); //NotifySMS($id,$v['phonenet'],$v['phone']); //BUYER LEAD House COPY Email $email_subj = 'ListHub Buyer Lead sent to ' . $agent_email . ' (Ad ID: ' . $id . ', User ID: ' . $a_Agent['userid'] . ')'; SendMail($lkh_email, $email_subj, $email_body, EMAIL_USER_CONTACT, 'Lakehouse Customer Service', $from); } else{ //NO BUYER AGENT MATCH $show_rc_contact = false; SendMail('buyerleads@dreamhomenetwork.com', 'Lakehouse inquiry', $email_body, EMAIL_USER_CONTACT, 'Lakehouse Customer Service', $from); /*$abbr_state = LookupAbbrByStateName($state); if(in_array($abbr_state,['CA','WA','OR'])){ $uid = APPLICATION_ENV == 'PROD' ? 307312 : 307312; list($email2,$contact_phone2) = $db->one_row('SELECT email,v_255_2 FROM ' . TBL_USER . ' WHERE id='.$uid); SendMail($email2, 'Buyer Lead from LakeHouse.com', $email_body, EMAIL_USER_CONTACT, 'LakeHouse.com', $from); $contact_phone2 = trim($contact_phone2); if($contact_phone2) $contact_phone = $contact_phone2; $db->query('UPDATE '.TBL_SEND_MSG_LOG.' SET buyer_userid='.$uid.',buyer_agent_email="'.$db->quote($email2).'" WHERE id='.$lead_id); // queue email (moved below) } else{*/ $contact_phone = '817-719-0397

DHN Realty Inc. is our Agent Assignment team. They will be connecting you with a local real estate agent to answer any questions you have or to set up an appointment to view the property. Thank you for using our Dream Home Network to find your perfect home!'; /*$rc = OpCityGetRespCode($fromname,$phone,$from,$id,$feed_prop_id); if(!empty($rc)){ $db->query('UPDATE '.TBL_SEND_MSG_LOG.' SET response_code="'.$db->quote($rc['receipt_id']).'",inquiry_accepted='.(int)$rc['inquiry_accepted']. ',compliance_message="'.$db->quote($rc['compliance_message']).'" WHERE id='.$lead_id); }*/ // override displayed message if (DESKTOP_CLIENT) { $err_msg = '
Your request has been sent to our Agent Assignment Team.

Thank You!

'; } else { $err_msg = ''; } //} } if($a_em){ // SendMail($a_em['to'], $a_em['subj'], $a_em['msg'], EMAIL_USER_CONTACT, 'LakeHouse.com', $a_em['from']); // queue email $a_sql = []; foreach($a_em as $db_f=>$v) $a_sql[] = '`'.$db_f.'`="'.$db->quote($v).'"'; $db->query('INSERT INTO lhub_outbox SET created=NOW(),site="lh",sfrom="'.EMAIL_USER_CONTACT.'",'.implode(',',$a_sql)); // skip/delay email to $a_em['to'] $a_em = $a_sql = []; } $err_msg.= ''; } if(!$agent_email) $db->query('UPDATE '.TBL_SEND_MSG_LOG.' SET listing_agent_email="'.$db->quote($email).'" WHERE id='.$lead_id); } elseif($feed_code != 'FLEXMLS'){ // HOMESANDLAND (NON-LISTHUB) REFERRAL (IN HOUSE COPY) $feed_email = $db->one_data('SELECT email FROM ' . TBL_FEEDS . ' WHERE feed_code="' . $feed_code . '"'); if(!$feed_email) $feed_email = $email; //pick email from user table (BAREFOOT) if ($feed_email) { //$email_body = EvalAdvTpl(TPL_PATH . 'send_msg.mail', '$to,$subj,$id,$from,$fromname,$mls,$contact,$addr,$msg,$phone,$REMOTE_ADDR,$SITE_URL,$feed_code_info,$inquiry_source'); $email_subj = 'Referral from LakeHouse.com sent to a ' . $feed_code . ' customer - ' . $email . ' (Ad ID: ' . $id . ') ' . $inquiry_source; SendMail($feed_email, $email_subj, $email_body, EMAIL_USER_CONTACT, 'LakeHouse.com', '', $lkh_email); } } } //Send receipt to the person who submitted the form if($IS_LHUB_ACC) $reply_to = EMAIL_USER_CONTACT; else $reply_to = $adContactEmail; $abbr_state = LookupAbbrByStateName($state); // set above if($IS_LHUB_ACC && !$a_Agent && $abbr_state && strlen($abbr_state)!=2){ // non-US $contact_phone = $adContactPhone; $make_call = true; } else{ $make_call = false; } $email_receipt_body = EvalAdvTpl(TPL_PATH . 'send_msg_receipt.mail', '$to,$subj,$id,$from,$fromname,$mls,$contact,$addr,$ad_url,$msg,$phone,$show_rc_contact'. ',$REMOTE_ADDR,$SITE_URL,$feed_code_info,$inquiry_source,$make_call,$contact_phone,$company_name'); if($agent_email) $email_receipt_body = str_ireplace('Advertiser','Buyer Agent',$email_receipt_body); SendMail($from, 'Referral receipt from Lakehouse.com', $email_receipt_body, EMAIL_USER_CONTACT, 'LakeHouse.com', $reply_to); if($_POST['notify']) Add_User_And_Notify_Record($from,$lname,$cid); if(!LOGGED_IN) { /** @var \Lakehouse\Entity\User $user **/ $user = $GLOBALS['lakehouseApp']->getSessionUser(); $user->setV2551($GLOBALS['fname']); $user->setV2553($GLOBALS['lname']); $user->setEmail($GLOBALS['from']); $user->setPhone($GLOBALS['phone']); $GLOBALS['lakehouseApp']->setSessionUser($user); } } } else { /** @var \Lakehouse\Entity\User $user **/ if(LOGGED_IN) $user = $GLOBALS['lakehouseApp']->getCurrentUser(); else $user = $GLOBALS['lakehouseApp']->getSessionUser(); $GLOBALS['fname'] = $GLOBALS['fname'] ?: html_esc($user->getFirstName()); $GLOBALS['lname'] = $GLOBALS['lname'] ?: html_esc($user->getLastName()); $GLOBALS['from'] = $GLOBALS['from'] ?: html_esc($user->getEmail()); $GLOBALS['phone'] = $GLOBALS['phone'] ?: html_esc($user->getPhone()); if(!$GLOBALS['msg']) $GLOBALS['msg'] = 'I am interested in this property.'; } $preview = ($_REQUEST['preview'] == 1); /*if(!$preview && !$_GET['print'] && $_SERVER['HTTP_REFERER'] && strpos($_SERVER['REQUEST_URI'],'page-')!==false){ @file_put_contents(__DIR__ .'/out.log', date('d/m/y H:i:s').' | '.$_SERVER['REMOTE_ADDR'].' | '.$_SERVER['HTTP_USER_AGENT']."\n". $_SERVER['REQUEST_URI'].' | '.(int)MOBILE_CLIENT.' | '.$_SERVER['HTTP_REFERER']."\n\n", FILE_APPEND); }*/ $ql = 'SELECT *,DATE_FORMAT(date,"' . DATE_FMT . '") AS fdate,DATE_FORMAT(updated,"' . DATE_FMT . '") AS fupdated,exp_date=NOW() AND approved="1" AND hw_spons=0 AND lh_enabled=1 AND v_255_15 NOT IN("For Rent","Off Market","SOLD!")'. ' AND v_255_28 RLIKE "^'.$db->quote(GetAltAddressRegExp($addr)).'"'; $newId = $db->one_data($sql); if($newId){ $ad_url = hwGetAdURL($newId); SE_VerifyValidURL($ad_url); // 301 redirect here } } } if (!$a_Ad || (!$preview && !$a_Ad['lh_enabled'])) { // Handle disabled/expired ads with enhanced content handleDisabledOrExpiredAd($a_Ad, $id, empty($a_Ad)); exit; } if (!$a_Ad['approved'] && !$preview) { // disabled link /* ShowHeader(); include(TPL_PATH.'not_approved.htm'); ShowFooter(); */ RedirToLakeOrStatePage($a_Ad['catid']); //header("Location: search.php?s_res=AND&hw_zip_r=70&hw_zip=" . $a_Ad['v_255_27'] . "&hw_redirect=out&hw_id=" . $id . "&hw_type=disabled&hw_cid=" . $a_Ad['catid']); exit; } if ((EN_EXP_DATE && $a_Ad['expired']) && !$preview && $a_Ad['v_255_15']!='Off Market') { // disabled link RedirToLakeOrStatePage($a_Ad['catid']); //header("Location: search.php?s_res=AND&hw_zip_r=70&hw_zip=" . $a_Ad['v_255_27'] . "&hw_redirect=out&hw_id=" . $id . "&hw_type=expired&hw_cid=" . $a_Ad['catid']); exit; } if(empty($ad_url)){ $ad_url = hwGetAdURL($id); // duplicate URLs protection if (!$_GET['print'] && !$preview){ $ad_url = SE_VerifyValidURL($ad_url); } } if(!SE_CRAWL && !$preview) hwSessionSetVar('last_ad',$id); if (!IsBanned($id, HIT_UNBAN)) { incrementAdHits($id); } $cid = $_GET['cid'] = $a_Ad['catid']; $fset_dir_tmp = GetCurFieldsSet(); if ($fset_dir_tmp != $FSET_DIR) { $FSET_DIR = $fset_dir_tmp; $O_LFS->Init(GetFSetFileName('fields.txt')); } $cat_path = GetCatPathCached($cid, 1, 1); $a_catpath = explode(' > ', $cat_path); $lake_name = strip_tags($a_catpath[count($a_catpath)-1]); $street_addr = $a_Ad['v_255_28'] ? $a_Ad['v_255_28'] . ', ' : ''; $ctelephone = $a_Ad['v_255_21'] ? '+'.($a_Ad['phonecode']?$a_Ad['phonecode']:'1').' '.$a_Ad['v_255_21'] : "No Phone"; if($a_Ad['v_255_6'] == '-1') $a_Ad['v_255_6'] = ''; if($a_Ad['v_255_7'] == '-1') $a_Ad['v_255_7'] = ''; if($a_Ad['feed_code']=='LHUB') RemoveLhubAgentWords($a_Ad); $abbr_state = LookupAbbrByStateName($a_Ad['v_255_3']); $GLOBALS['title'] = sprintf($A_LNG['page_title_active_ad'], $a_Ad['v_255_28'], $a_Ad['v_255_2'], $abbr_state, $a_Ad['v_255_27'], $id); $GLOBALS['description'] = sprintf($A_LNG['page_desc_active_ad'], $lake_name, $a_Ad['v_255_5'], $a_Ad['v_255_15'], '$' . number_format($a_Ad['v_255_4']), $a_Ad['v_title'], $id); $keywords = $street_addr . '' . $a_Ad['v_255_2'] . ', ' . $abbr_state . ' ' . $a_Ad['v_255_27'] . ', ' . $a_Ad['v_255_5'] . 's, ' . $lake_name . ' REAL ESTATE, ' . $a_Ad['v_255_2'] . ' REAL ESTATE, ' . $a_Ad['v_255_3'] . ' REAL ESTATE, ' . $a_Ad['v_255_27'] . ' REAL ESTATE, ' . $lake_name . ' LISTINGS, ' . $a_Ad['v_255_2'] . ' LISTINGS, ' . $abbr_state . ' LISTINGS, ' . $a_Ad['v_255_27'] . ' LISTINGS, ' . $lake_name . ' PROPERTIES for sale, ' . $a_Ad['v_255_3'] . ' ' . $a_Ad['v_255_5'] . 's FOR SALE, ' . $a_Ad['v_255_27'] . ' ' . $a_Ad['v_255_5'] . 's FOR SALE, LAKEFRONT, LAKE PROPERTY, LAKEHOMES'; $userid = $a_Ad['userid']; $hits = $a_Ad[COL_AD_HITS]; $date = $a_Ad['fdate']; $updated = $a_Ad['fupdated']; if ($a_Ad['images']) list($images) = explode("\n", $a_Ad['images']); else $images = '../img/no_image.gif'; // 6/30/09 KM. added free ad check to display/not display phone, website, alt av cal. $is_freead = preg_match("/FEE_FREE/i", $a_Ad['hw_pay_plan']); $feed_code = $a_Ad['feed_code']; $lat = $a_Ad['addr_lat']; $lon = $a_Ad['addr_long']; $map_display = $a_Ad['map_display']; $street = $a_Ad['v_255_28']; $city = $a_Ad['v_255_2']; $state = $a_Ad['v_255_3']; $zip = $a_Ad['v_255_27']; $street = str_replace("#", "#", $street); $street = str_replace("'", "'", $street); if ($street) $address = $street . ' ' . $city . "," . $state; else $address = $city . "," . $state; define('EN_BS4', empty($_GET['print']) || $_GET['mobile']); if(EN_BS4){ $tpl_f = TPL_PATH.'more5.htm'; $a_k = array_keys($a_catpath); $a_k[count($a_k)-1] = -1; $cat_path = implode('',array_map(function($k,$v){ return ''; }, $a_k, $a_catpath)); } else $tpl_f = TPL_PATH.'more.htm'; $tpl = new Tpl; $tpl->SetBuf($a_Ad['text_1']); $a_Ad['text_1'] = $tpl->Parse(); if($a_Ad['feed_code']=='FLEXMLS' || $a_Ad['feed_code']=='LHUB'){ $a_open = $db->one_col_array('SELECT CONCAT(DATE_FORMAT(startday,"%c/%e")," ",LEFT(starttime,5)," - ",LEFT(endtime,5)) FROM open_house_event WHERE lid='.$id.' AND startday>=CURDATE()'); // $a_open = ['4/26 13:00 - 15:00', '4/27 13:00 - 15:00']; if($a_open) $a_Ad['text_1'].="

Open house: ".implode(', ', $a_open); } $tpl = new Tpl; $args = array( 'PAY_PLAN' => $a_Ad['hw_pay_plan'], 'TPL' => &$tpl, 'TPL_F' => $tpl_f, 'TPL_NO_CELL' => array('rev', 'rate', 'online'), 'EXTRA' => array( 'FEAT' => $a_Ad['pick'], ), ); hwEvent('Ad_ParseDetailsTpl', $args); $tpl_f = $args['TPL_F']; $O_LFS->FillCustomFields($a_Ad); $O_LFS->NextLine2BR(); $O_LFS->FillChkValues(); /*if ($CFG['EN_RATING']) { $z = []; $z['rate_avg'] = $a_Ad['rating']; $z['rate_int'] = intval($z['rate_avg']); if ($z['rate_avg'] - $z['rate_int'] >= 0.5) $z['rate_int'].='_5'; $z['rate_votes'] = $a_Ad['num_votes']; $tpl->AddCell('rate', $z); }*/ if ($CFG['EN_REVIEWS']) { $args = array( 'TPL' => &$tpl, 'ID' => $id, 'EN_REVIEWS' => $CFG['EN_REVIEWS'], ); hwModEvent('Ad_ParseDetailsTpl', $args); } if ($CFG['EN_IMAGES']) { Create_Img_Obj(); $Img_Obj->SetDBKeyVal($id); //$add_images = $Img_Obj->GetImagesArea(GetFSetFileName('hw_img_front.htm'),1,$CFG['THUMB_PER_ROW'],$CFG['EN_THUMB_FILLUP']); //preview parameter for image caching problem //$add_images = $Img_Obj->GetImagesArea(GetFSetFileName('hw_img_front.htm'),1,99,$CFG['EN_THUMB_FILLUP'],0,1); if($images == '../img/no_image.gif') $add_images = ""; elseif(EN_BS4){ $add_images = $Img_Obj->GetImagesArea(TPL_PATH.'hw_img_front5.htm', 1, 99, $CFG['EN_THUMB_FILLUP'], 1, $preview); } elseif(DESKTOP_CLIENT){ //$add_images = $Img_Obj->GetImagesArea(GetFSetFileName('hw_img_front.htm'),1,$CFG['THUMB_PER_ROW'],$CFG['EN_THUMB_FILLUP']); $add_images = $Img_Obj->GetImagesArea(GetFSetFileName('hw_img_front.htm'), 1, 99, $CFG['EN_THUMB_FILLUP'], 0, $preview); } else{ //MOBILE_CLIENT define('LOAD_ROYALSLIDER_JS', true); $add_images = $Img_Obj->GetImagesArea(TPL_PATH.'partial/more_images_mobile.htm', 1, 99, $CFG['EN_THUMB_FILLUP'], 0, $preview); } } $z = []; if ($CFG['EN_ONLINE']) { $cell_id = IsUserOnline($userid) ? 'yes' : 'no'; $tpl->AddCell('online', '', $cell_id); } $tpl_v = compact($O_LFS->GetFVarArr(), 'hits', 'userid', 'cid', 'date', 'updated', 'err_msg', 'abbr_state', 'inquiry_source', 'ad_url', 'cat_path', 'visit_web_site', 'view_telephone', 'view_virtual_tour', 'feed_code', 'feed_code_info', 'from', 'fname', 'lname', 'fromlname', 'phone', 'msg', 'add_images', 'id'); //$tpl_v['image_caption'] = $tpl_v['f_type'].' '.$tpl_v['f_rent_buy']; $tpl_v['f_price_raw'] = $tpl_v['f_price']; $tpl_v['f_price'] = number_format($tpl_v['f_price']); if($tpl_v['f_lake_wf']=='Yes') $tpl_v['f_lake'] = 'Yes'; if($images == '../img/no_image.gif') $tpl_v['img1_url'] = SITE_URL.'img/no_image.gif'; else $tpl_v['img1_url'] = IMAGES_URL.'files/medium/'.hwImgPath($images).$images; /*if(EN_UF && !in_array($feed_code,['HOMESANDLAND',LHUB_FEED_ID])) { $O_UFS = new FieldsSet(TPL_PATH . 'ufields.txt'); $a_User = $db->one_assoc("SELECT * FROM " . TBL_USER . " WHERE id='$userid'"); $username = $a_User['username']; $O_UFS->FillCustomFields($a_User); $O_UFS->NextLine2BR(); $O_UFS->FillChkValues(); $tpl_v = array_merge($tpl_v, compact($O_UFS->GetFVarArr(), 'username')); }*/ if ($_GET['print'] == 'yes') { $add_images = preg_replace('/(.*?)<\/a>/i', '\\1', $add_images); $tpl->Parse(GetFSetFileName('more_print.htm'), $tpl_v, 1); exit; } //if($tpl_v['f_viewtypes'] && stripos($tpl_v['f_viewtypes'],'lake')!==false) $tpl_v['ctype'] = 'Lake'; else $tpl_v['ctype'] = $db->one_data('SELECT ctype FROM '.TBL_CAT.' WHERE id='.$cid); if($tpl_v['ctype']) $tpl_v['ctype'] = ucfirst($tpl_v['ctype']); switch($feed_code){ case '': $tpl_v['feed_code_info'] = ''; break; case 'FLEXMLS': $tpl_v['feed_code_info'] = 'Listing Provided Courtesy of '.$a_Ad['v_255_35']. '
The data for this listing came from the FlexMLS'; break; default: $tpl_v['feed_code_info'] = 'Property courtesy of ' . $feed_code . ''; } if($lat != '0' && $lon != '0'){ $map_alt_include = '
(Open in Google Maps)   '; if(DESKTOP_CLIENT){ $map_alt_include .= '(Bing Map)  '; $map_alt_include .= '(Mapquest Map)'; } }else{ $map_alt_include = '(Open in Google Maps)  '; if(DESKTOP_CLIENT){ $map_alt_include .= '(Bing Map)  '; $map_alt_include .= '(Mapquest Map)'; } } if ($map_display) { $GOOGLE_API_KEY2 = GOOGLE_API_KEY2; $imagePath = SITE_PATH . 'files/static_google_maps/ad/' . $id . '.png'; $imageUrl = 'files/static_google_maps/ad/' . $id . '.png'; if(APPLICATION_ENV == 'PROD') $imageUrl = '//images.lakehouse.com/'.$imageUrl; if ($lat != '0' && $lon != '0') //(!empty($lat) && $lat !='0' && !empty($lon) && !='0') { loadStaticMapByCoord($id, 'ad', $lat, $lon, '15', '400x350', true); $map_include = << .mapboxgl-canvas{position:relative !important} .marker { background-image: url('images/bluehouse_16x14.png'); background-size: cover; width: 20px; height: 18px; cursor: pointer; } #mmenu{ display:none; position: absolute; background: #fff; padding: 5px; font-family: 'Open Sans', sans-serif; } #mmenu input{height:auto} ENDHTML; } else { loadStaticMapByAddress($id, 'ad', $address, '15', '400x350', TRUE); $map_include = << ENDHTML; } if(DESKTOP_CLIENT){ $tpl_v['map_info'] = ' Click on map to activate ' . $map_include . '
'; } else{ //if(MOBILE_CLIENT) $tpl_v['map_info'] = '
Click on map to activate
' . $map_include . '
'; } $tpl_v['map_info'].=''; $tpl_v['map_link'] = '' . $map_link_include_img . '' . $map_link_include . ''; $tpl_v['map_info'] .= ' ' . $map_alt_include . ' '; } else { //DO NOT DISPLAY MAP, JUST THE ALTERNATE MAP LINKS $tpl_v['map_info'] = '
'; $tpl_v['map_link'] = '' . $map_link_include_img . '' . $map_link_include . ''; } if($userid == LHUB_UID) $is_freead = true; $tpl_v['show_website_url'] = (!$is_freead && !empty($f_website)); if ($is_freead) { $tpl_v['view_telephone'] = ""; $tpl_v['view_virtual_tour'] = ""; } else { if ($f_phone == "") $tpl_v['view_telephone'] = ""; else { $tpl_v['view_telephone'] = ' ' . $ctelephone . '
Please say you found it on Lakehouse.com!
'; } if ($f_vtour == "") $tpl_v['view_virtual_tour'] = ""; else { $f_vtournew = addScheme($f_vtour); $tpl_v['view_virtual_tour'] = (' View Video/Virtual Tour'); } } $tpl_v['not_lot'] = (!in_array($tpl_v['f_type'],['Lot','Acreage']) || $tpl_v['f_rooms']>=1); $tpl_v['has_viewtypes'] = (!in_array($tpl_v['f_type'],['Lot','Acreage']) || $tpl_v['f_rooms']>=1); if($tpl_v['f_county'] && $tpl_v['f_country_id']==6561 && stripos($tpl_v['f_county'], ' County') === FALSE && stripos($tpl_v['f_county'], ' Parish') === FALSE && stripos($tpl_v['f_county'], ' Borough') === FALSE ){ $tpl_v['f_county'].= ' County'; } $LHUB = ''; $tpl_v['is_lhub_generic'] = $tpl_v['show_other_listings_link'] = $tpl_v['show_sms_link'] = false; $v = DESKTOP_CLIENT ? 'MOBILE' : 'DESKTOP'; $A_RE = [ '#.*?#s', '##s', ]; if($feed_code == 'HOMESANDLAND' || $feed_code == 'FLEXMLS'){} elseif($feed_code == LHUB_FEED_ID && $userid == LHUB_UID) { $tpl_v['is_lhub_generic'] = true; if($a_Ad['v_255_15']=='Off Market'){ $A_RE = array_merge($A_RE, ['/]+href="#ask_inline_frm.*?<\/a>/is','//is']); $tpl_v['feed_code_info'] = ''; } else{ if($a_Ad['v_255_15'] == 'For Sale') $lhub_status = 'Active'; elseif($a_Ad['v_255_15'] == 'Sale Pending') $lhub_status = 'Pending'; else $lhub_status = $a_Ad['v_255_15']; $LHUB = '"DETAIL_PAGE_VIEWED",{lkey:"'.$a_Ad['feed_prop_id'].'"}'; $tpl_v['feed_code_info'] = 'Listing Agent: '.$a_Ad['v_255_23'].', '.$a_Ad['v_255_35'].', '.$a_Ad['v_255_21'].', '.$a_Ad['brokerage_phone']. ' Listing Site, Listing Status: '.$lhub_status.'
Copyright © 2025 '.MlsNameGet($a_Ad).'. All rights reserved. All information provided by the listing agent/broker is deemed reliable but is not guaranteed and should be independently verified.
'; } } else { $tpl_v['show_other_listings_link'] = true; $phonenet = $db->one_data('SELECT phonenet FROM ' . TBL_USER . ' WHERE id='.$userid); $tpl_v['show_sms_link'] = !empty($phonenet); if ($userid > 0) $tpl_v['posted_num'] = $db->one_data('SELECT count(*) FROM ' . TBL_AD . ' WHERE userid='.$userid. ' AND approved="1" AND exp_date>=NOW() AND ' .WHERE_AD_ENABLED . FilterSpons('', 0)); else $tpl_v['posted_num'] = 0; } $tpl_v['rent_pool'] = ($a_Ad['rent_pool']=='1'); $tpl_v['has_dock'] = ($a_Ad['has_dock']=='1'); $tpl_v['has_pond'] = ($a_Ad['has_pond']=='1'); $tpl_v['HOMEOWNER'] = ($tpl_v['f_brk_own']=='Homeowner'); $agentId = 0; if($feed_code==LHUB_FEED_ID){ if($tpl_v['f_unit_number']){ $pos = strripos($tpl_v['f_address'], ' '.$tpl_v['f_unit_number']); if($pos===false || $pos+strlen($tpl_v['f_unit_number'])+1!=strlen($tpl_v['f_address'])) $tpl_v['f_address'].=' '.$tpl_v['f_unit_number']; } } else{ if($feed_code=='FLEXMLS'){ if(strpos($tpl_v['f_company'],FEATURED_COMPANY)===false){ $tpl_v['f_contact'] = $tpl_v['f_company'] = ''; } if(!empty($_SERVER['HTTP_REFERER']) && preg_match('/-u(\d+)\.html$/', $_SERVER['HTTP_REFERER'], $m) && $userid != $m[1]){ $agentId = $m[1]; if(!empty($tpl_v['f_contact'])) $tpl_v['f_contact'] = $db->one_data('SELECT CONCAT(v_255_1," ",v_255_3) FROM ' . TBL_USER . ' WHERE id=' . $agentId); } } if(!empty($tpl_v['f_contact'])) $tpl_v['f_contact'].= ', '.$tpl_v['f_brk_own']; } $is_lhub_generic = $tpl_v['is_lhub_generic']; // global used in ShowFooter() $SPOTLIGHT_AGENT = []; $foot = ShowFooter(0); // GLOBALS['SPOTLIGHT_AGENT'] needed below is set by ShowFooter() $tpl_v['matched_spotlight'] = false; $tpl_v['mspot'] = 0; // link_id AS f_id, userid, v_255_23 AS f_name, v_255_35 AS f_company, v_255_21 AS f_phone if(APPLICATION_ENV=='TEST') $SPOTLIGHT_AGENT = ['f_id'=>1,'userid'=>1,'f_name'=>'Mary Kay','f_company'=>'Company LTD','f_phone'=>'111111111111']; if(!empty($SPOTLIGHT_AGENT)){ $tpl_v['matched_spotlight'] = true; $tpl_v['mspot'] = $SPOTLIGHT_AGENT['f_id']; if($tpl_v['is_lhub_generic']){ $tpl_v['show_sms_link'] = (bool)$db->one_data('SELECT IF(phonenet<>"",1,0) FROM '.TBL_USER.' WHERE id='.(int)$SPOTLIGHT_AGENT['userid']); } } elseif($a_Ad['v_255_15']=='Off Market'){ $tpl_v['matched_spotlight'] = true; } /*elseif(!empty($NEW_SPOTLIGHT)){ $tpl_v['matched_spotlight'] = true; $tpl_v['mspot'] = -1; }*/ echo str_replace('',''. (($tpl_v['is_lhub_generic'] && !$tpl_v['matched_spotlight'])?'' :'').'', ShowHeader(FALSE,FALSE)); // $tpl_v['agentId'] = $agentId; $tpl_v['waterfront'] = ($tpl_v['f_lake_wf']=='Yes'); $tpl_v['waterview'] = ($tpl_v['f_lake']=='Yes'); $tpl_v['hide_sf'] = ($tpl_v['f_square']=='0'); $tpl_v['hide_year_built'] = ($tpl_v['f_age']==''); $tpl_v['hide_acres'] = ($tpl_v['f_lot_size']>'0.000'); $tpl_v['hide_lot_dimensions'] = ($tpl_v['f_lotsize']==''); $tpl_v['hide_water_frontage'] = ($tpl_v['f_wf_area']==''); $tpl_v['hide_viewtypes'] = ($tpl_v['f_viewtypes']==''); $tpl_v['hide_dock_type'] = ($tpl_v['f_docktype']==''); $tpl_v['hide_dock_desc'] = ($tpl_v['f_dockdesc']==''); $tpl_v['hide_lake_comm'] = ($tpl_v['f_lake_comm_name']==''); $tpl_v['hide_heat'] = ($tpl_v['f_heat_ac']==''); $tpl_v['hide_garage'] = ($tpl_v['f_garage']==''); $tpl_v['hide_siding'] = ($tpl_v['f_siding']==''); $tpl_v['hide_yard'] = ($tpl_v['f_yard']==''); $tpl_v['hide_utilities'] = ($tpl_v['f_utilities']==''); $tpl_v['hide_roof'] = ($tpl_v['f_roof']==''); $tpl_v['hide_roof'] = ($tpl_v['f_roof']=='Unknown'); $tpl_v['hide_stories'] = ($tpl_v['f_stories']==''); $tpl_v['hide_fireplaces'] = ($tpl_v['f_fireplaces']==''); $tpl_v['hide_taxes'] = ($tpl_v['f_taxes']==''); if(!$tpl_v['hide_taxes'] && is_numeric($tpl_v['f_taxes'])) $tpl_v['f_taxes'] = number_format((float)$tpl_v['f_taxes']); $tpl_v['hide_mls'] = ($tpl_v['f_mls']==''); $tpl_v['hide_county'] = ($tpl_v['f_county']==''); $tpl_v['hide_unit_number'] = ($tpl_v['f_unit_number']==''); $tpl_v['hide_hoa'] = ($tpl_v['f_hoa_fee']=='0.0'); if(!$tpl_v['hide_hoa']) $tpl_v['f_hoa_fee'] = number_format((float)$tpl_v['f_hoa_fee']); if($userid == LHUB_UID && $tpl_v['matched_spotlight'] && $a_Ad['v_255_15']!='Off Market'){ /*if(!empty($NEW_SPOTLIGHT)){ echo ' '; $tpl_v['view_telephone'] = ' Please say you found it on Lakehouse.com !'; } else{*/ $buyerAgent = 'Buyer\'s Agent: '.$SPOTLIGHT_AGENT['f_name'] . '
' . $SPOTLIGHT_AGENT['f_company'] . '
'.(!in_array($SPOTLIGHT_AGENT['phonecode'],['','1'])?'+'.$SPOTLIGHT_AGENT['phonecode'].' ':'').$SPOTLIGHT_AGENT['f_phone'] . '
Please say you found it on Lakehouse.com !'; if($LHUB && DESKTOP_CLIENT) $tpl_v['feed_code_info'] = '
'.$buyerAgent.' '.$tpl_v['feed_code_info'].'
'; else $tpl_v['view_telephone'] = ' '.$buyerAgent.'
'; //} } $tpl->SetBuf(preg_replace($A_RE,'',file_get_contents($tpl_f))); if($tpl_v['waterfront'] && $tpl_v['ctype']){ // on Lewis Smith Lake $tpl->BUF = str_replace('Waterfront',$tpl_v['ctype'].'front',$tpl->BUF); } if($tpl_v['waterview'] && $tpl_v['ctype']){ if($feed_code=='FLEXMLS' && $cid == 7){ $tpl_v['f_lake'] = 'Characteristics: Moderate Slope to Water; Shoreline: Year Round Water; Smith Lake Body: Sipsey Fork; Waterfront Footage: 196.8'; $tpl->BUF = str_replace('Waterview','Waterfront features',$tpl->BUF); } else{ $tpl->BUF = str_replace('Waterview',$tpl_v['ctype'].'view',$tpl->BUF); } } $buf = $tpl->Parse('', $tpl_v); ProcessSearchFriendlyURLs($buf); echo $buf; if (strpos($foot, 'list.php?') !== false){ ProcessSearchFriendlyURLs($foot); } $height = ($tpl_v['is_lhub_generic'] && !$tpl_v['matched_spotlight'])?560:430; if(MOBILE_CLIENT) $height+=50; echo str_replace('',' '. (($tpl_v['is_lhub_generic'] && !$tpl_v['matched_spotlight'])?' ':''). (EN_BS4 ? file_get_contents(TPL_PATH.'more5_foot.htm') : ''). '', $foot); // funcs function getMatchingBuyerAgent($mspot, $cid){ global $db; $ql = 'SELECT userid,v_255_21 AS agent_phone,v_255_23 AS agent_name FROM ' . TBL_AD . // ,v_255_22 AS agent_email ' WHERE (0 ' . FilterSpons('', 1, 0) . ') AND approved="1" AND exp_date>=NOW() AND ' .WHERE_AD_ENABLED. ' AND v_255_26 NOT IN("Homeowner","Developer","Auctioneer","Want to Buy","Want to Rent","Property Manager","Sales Associate")'; // v_255_11 in user //,v_255_23 AS agent_name if($mspot>0) $a_Agent = $db->one_assoc($ql.' AND link_id='.$mspot); // or random if(!$a_Agent) $a_Agent = $db->one_assoc($ql.' AND catid='.$cid.' ORDER BY RAND() LIMIT 1'); if(!$a_Agent){ $pid = $db->one_data("SELECT pid FROM " . TBL_CAT . " WHERE id=$cid"); $a_Agent = $db->one_assoc($ql.' AND catid='.$pid.' ORDER BY RAND() LIMIT 1'); } return $a_Agent; } function MlsNameGet($a_Ad){ if(strpos($a_Ad['feed_prop_id'],'-NTREIS-')) return 'North Texas Real Estate Information Systems, Inc'; if(strpos($a_Ad['feed_prop_id'],'-GARMLS-')) return 'Galveston Association of REALTORS®'; return $a_Ad['mls_name'] ? $a_Ad['mls_name'] : 'Multiple Listing Service, Inc'; } function RedirToLakeOrStatePage($cid){ global $db; $amt = $db->one_data('SELECT COUNT(*) FROM ' . TBL_AD . ' WHERE hw_spons=0 AND exp_date>=NOW() AND approved="1" AND ' . WHERE_AD_ENABLED.' AND catid='.$cid); if($amt>0){ $url = '/search.php?cid='.$cid.'&s_res=AND"'; } else{ $pid = $db->one_data('SELECT pid FROM ' . TBL_CAT . ' WHERE id='.$cid); $url = '/browse_map.php?cat='.$pid.'"'; } ProcessSearchFriendlyURLs($url); $url = substr($url,0,-1); header('HTTP/1.1 301 Moved Permanently'); header('Location: '.$url); } /*function OpCityGetRespCode($name,$phone,$email,$id,$feed_prop_id){ global $db; if(APPLICATION_ENV != 'PROD') return []; $isTest = 0;//($_SERVER['REMOTE_ADDR']==''); //if($isTest && filesize('./_opcity.log')>0) return ''; define('OPCITY_API_URL', 'https://api'.($isTest ? '-test' : '').'.opcity.com/inquiry'); define('OPCITY_API_KEY', $isTest ? '8G2SMaeaPtP3VZG3C' : 'ATu-70QSLnrakQO0H'); $a = ['source' => 'lakehouse-revshare','api_version' => '1','idempotency_key' => uuid_v4()]; $v = $db->one_assoc('SELECT v_255_2,v_255_3,v_255_4,v_255_27,v_255_28 FROM '.TBL_AD.' WHERE link_id='.$id); $a['lead'] = [ 'name'=> $name, 'phone'=> $phone, 'email'=> $email, 'tcpa'=> ' ', 'consumer_ip'=> $_SERVER['REMOTE_ADDR'], 'submit_time'=> date('Y-m-d H:i:s'), 'trustedform_cert_url'=> $_POST['xxTrustedFormCertUrl'], 'primary_zip'=> $v['v_255_27'], 'property_zip'=> $v['v_255_27'], 'property_address'=> $v['v_255_28'], 'property_city'=> $v['v_255_2'], 'property_state'=> $v['v_255_3'], 'max_price'=> $v['v_255_4'], 'listhub_metrics_provider_id'=> 'M-5263', 'listhub_listing_key'=> $feed_prop_id, ]; $curl = curl_init(); curl_setopt_array($curl, array( CURLOPT_URL => OPCITY_API_URL, CURLOPT_USERPWD => OPCITY_API_KEY, CURLOPT_RETURNTRANSFER => true, CURLOPT_POSTFIELDS => json_encode($a), CURLOPT_HTTPHEADER => ["Content-Type: application/json"] )); $r = curl_exec($curl); curl_close($curl); if(!$r) return []; $r = json_decode($r, TRUE); if(empty($r['receipt_id']) || empty($r['inquiry_accepted'])){ SendMail(empty($r['receipt_id']) ? 'csv@dreamhomenetwork.com' : 'csv@lakehouse.com', "Opcity Error (Ad ID: $id) - Take Action", print_r($r,true), EMAIL_USER_CONTACT, 'LakeHouse.com'); } //if($isTest) file_put_contents('./_opcity.log',$r['receipt_id']."\n".print_r($r,1)."\n".json_encode($a)."\n\n",FILE_APPEND); return $r; } function uuid_v4() { return sprintf('%04x%04x-%04x-%04x-%04x-%04x%04x%04x', // 32 bits for "time_low" mt_rand(0, 0xffff), mt_rand(0, 0xffff), // 16 bits for "time_mid" mt_rand(0, 0xffff), // 16 bits for "time_hi_and_version", // four most significant bits holds version number 4 mt_rand(0, 0x0fff) | 0x4000, // 16 bits, 8 bits for "clk_seq_hi_res", // 8 bits for "clk_seq_low", // two most significant bits holds zero and one for variant DCE1.1 mt_rand(0, 0x3fff) | 0x8000, // 48 bits for "node" mt_rand(0, 0xffff), mt_rand(0, 0xffff), mt_rand(0, 0xffff) ); }*/ function Add_User_And_Notify_Record($email,$pwd,$cid){ global $db; list($state_id,$cname) = $db->one_row("SELECT pid,name FROM " . TBL_CAT . " WHERE id=$cid"); $state = $db->one_data("SELECT name FROM " . TBL_CAT . " WHERE id=$state_id"); $a_User = $db->one_assoc('SELECT id,pwd FROM '.TBL_USER.' WHERE email="'.$email.'"'); if($a_User){ $user_id = $a_User['id']; $pwd = $a_User['pwd']; } else{ $registered_from = 'lakehouse'; $source = DESKTOP_CLIENT ? 'Desktop' : 'Mobile'; $username = 'xxxxx'; $time = time(); $hw_pay_plan = 'SUB_FREE'; $ql_pp = '[' . $hw_pay_plan . '-' . $time . ']'; $ql = 'INSERT INTO ' . TBL_USER . ' (pwd,email,username,site,v_255_11,v_255_21,disabled,regdate,hw_pay_plan' . ") VALUES ('$pwd','$email','$username','$registered_from','Want to Buy','$source', '" . (EN_APR_USERS ? '1' : '') . "',NOW(),'$ql_pp')"; $db->query($ql); $user_id = $db->insert_id(); $db->query("DELETE FROM " . TBL_REG_CONFIRM . " WHERE email='$email'"); $args = array( 'PP_ID' => $hw_pay_plan, 'ID' => $user_id, 'PP_PREV' => '', 'TIME' => $time, ); hwEvent('PayPlanOn', $args); // immediate custom updates here $args = ['UID' => $user_id]; hwModEvent('onUserAdd', $args); $pwd = 'your last name'; } $an_id = $db->one_data('SELECT id FROM an_search WHERE site_id=0 AND search_type=1 AND user_id='.$user_id.' AND state_id='.$state_id. ' AND enabled=1 AND deleted=0'); if(!$an_id){ // add an auto notify record for state $db->query('INSERT INTO an_search SET user_id='.$user_id.', state_id='.$state_id.', enabled=1, site_id=0, price_low=0, price_high=99999999, price_enabled=1, property_types="0,1,2,3,6,18,4,5", search_type=1, created_at=NOW(), updated_at=NOW(), bedroom=0, bathroom=0, lot_size=0, sleeps=0, sale_status="18,19,20,21"'); $an_id = $db->insert_id(); } // add an auto notify record for lake $db->query('INSERT IGNORE INTO an_search_lake SET an_id='.$an_id.',lake_id='.$cid); if($db->affected_rows()>0){ $email_subj = 'LakeHouse.com New Search Profile'; $email_body = EvalAdvTpl(TPL_PATH . 'send_msg_registered.mail', compact('cname','state','pwd')); SendMail($email,$email_subj,$email_body,EMAIL_USER_CONTACT,'LakeHouse.com'); } } function NotifySMS($lid,$phonenet,$phone,$fromName,$fromPhone,$msg){ if(!$phonenet) return; $A_MOB = ['T-Mobile' => 'tmomail.net', 'Virgin Mobile' => 'vmobl.com', 'AT&T' => 'txt.att.net', 'Sprint' => 'messaging.sprintpcs.com', 'Verizon' => 'vtext.com', 'Tracfone' => 'mmst5.tracfone.com', 'Ting' => 'message.ting.com', 'Boost Mobile' => 'myboostmobile.com', 'U.S. Cellular' => 'email.uscc.net', 'Metro PCS' => 'mymetropcs.com']; if(isset($A_MOB[$phonenet])){ $phone = str_replace('-','',$phone); require_once '/www/phpmailer/class.phpmailer.php'; $mail = new PHPMailer; $mail->IsSMTP(); $mail->Encoding = '7bit'; $mail->AddAddress($phone.'@'.$A_MOB[$phonenet]); $mail->Body = "Lead for listing # $lid on Lakehouse.com\n". //48 "$msg\n". "Reply to $fromName $fromPhone"; $mail->SetFrom(EMAIL_USER_CONTACT, '', false); $mail->Sender = EMAIL_USER_CONTACT; $mail->Send(); } } function RemoveLhubAgentWords(&$a_Ad){ $v = file(TPL_PATH.'db_fields/real_estate/lhub_remove.txt', FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES); $a1 = $a2 = []; foreach(array_keys($v) as $k){ list($a1[$k],$a2[$k]) = explode('|',$v[$k],2); } /*if(!empty($a_Ad['v_255_23'])){ $a1[] = $a_Ad['v_255_23']; $a2[] = ''; }*/ if(!empty($a_Ad['v_255_35'])){ $a1[] = $a_Ad['v_255_35']; $a2[] = ''; } $title = $a_Ad['v_title']; foreach(['v_title','text_1'] as $db_f) $a_Ad[$db_f] = str_replace($a1,$a2,$a_Ad[$db_f]); if($title != $a_Ad['v_title']){ $a_Ad['v_title'] = $a_Ad['lh_lake_on'].' '.$a_Ad['v_255_5'].' '.$a_Ad['v_255_15'].' in '.$a_Ad['v_255_2']; } } function handleDisabledOrExpiredAd($a_Ad, $id, $not_found) { global $db, $title, $description, $keywords; // Check if ad exists in main table first $ad_exists = $db->one_data("SELECT link_id FROM " . TBL_AD . " WHERE link_id = " . (int)$id); if (!$ad_exists) { // Ad not found in main table, check archive $archive_ad = $db->one_assoc("SELECT * FROM ad_archive WHERE link_id = " . (int)$id); if ($archive_ad) { // Extract property details from archived ad $street = $archive_ad['v_255_28']; $city = $archive_ad['v_255_2']; $state = $archive_ad['v_255_3']; $state_id = $archive_ad['state_id']; // Construct full address like in normal flow if ($street && $city && $state) { $property_address = $street . ', ' . $city . ', ' . $state; } elseif ($city && $state) { $property_address = $city . ', ' . $state; } else { $property_address = ''; } // pretty format the last listed date $formatted_last_listed = isset($archive_ad['date']) ? date('F j, Y', strtotime($archive_ad['date'])) : ''; $raw_property_type = isset($archive_ad['PropertyType']) ? $archive_ad['PropertyType'] : ''; $raw_property_subtype = isset($archive_ad['PropertySubType']) ? $archive_ad['PropertySubType'] : ''; $property_type = $raw_property_type . ($raw_property_subtype ? ' - ' . $raw_property_subtype : ''); $last_listed = $formatted_last_listed; $price = isset($archive_ad['v_255_4']) ? $archive_ad['v_255_4'] : ''; $bedrooms = isset($archive_ad['v_255_6']) ? $archive_ad['v_255_6'] : ''; $bathrooms = isset($archive_ad['v_255_7']) ? $archive_ad['v_255_7'] : ''; $stories = isset($archive_ad['v_255_8']) ? $archive_ad['v_255_8'] : ''; $square_feet = isset($archive_ad['v_255_9']) ? $archive_ad['v_255_9'] : ''; $lot_size = isset($archive_ad['v_255_13']) ? $archive_ad['v_255_13'] : ''; $year_built = isset($archive_ad['v_255_10']) ? $archive_ad['v_255_10'] : ''; $viewtypes = isset($archive_ad['viewtypes']) ? $archive_ad['viewtypes'] : ''; $lakeview = isset($archive_ad['v_255_16']) ? $archive_ad['v_255_16'] : ''; $waterfront = isset($archive_ad['v_255_19']) ? $archive_ad['v_255_19'] : ''; // Calculate estimated market price (2.4% annual appreciation) $estimated_price = ''; if ($price && $last_listed) { $years_diff = (time() - strtotime($last_listed)) / (365 * 24 * 60 * 60); $appreciation_rate = 0.024; // 2.4% annual $estimated_price = number_format($price * pow(1 + $appreciation_rate, $years_diff), 0); } $search_city = $city; $search_state = $state; } else { $not_found = true; $property_address = ''; $property_type = ''; $last_listed = ''; $price = ''; $bedrooms = ''; $bathrooms = ''; $square_feet = ''; $lot_size = ''; $year_built = ''; $estimated_price = ''; $search_city = ''; $search_state = ''; $state_id = 0; } } else { // Ad exists but is disabled $street = $a_Ad['v_255_28']; $city = $a_Ad['v_255_2']; $state = $a_Ad['v_255_3']; $state_id = $a_Ad['state_id']; // Construct full address like in normal flow if ($street && $city && $state) { $property_address = $street . ', ' . $city . ', ' . $state; } elseif ($city && $state) { $property_address = $city . ', ' . $state; } else { $property_address = ''; } $raw_property_type = isset($a_Ad['PropertyType']) ? $a_Ad['PropertyType'] : ''; $raw_property_subtype = isset($a_Ad['PropertySubType']) ? $a_Ad['PropertySubType'] : ''; $property_type = $raw_property_type . ($raw_property_subtype ? ' - ' . $raw_property_subtype : ''); $last_listed = isset($a_Ad['date']) ? $a_Ad['date'] : ''; $price = isset($a_Ad['v_255_4']) ? $a_Ad['v_255_4'] : ''; $bedrooms = isset($a_Ad['v_255_6']) ? $a_Ad['v_255_6'] : ''; $bathrooms = isset($a_Ad['v_255_7']) ? $a_Ad['v_255_7'] : ''; $square_feet = isset($a_Ad['v_255_9']) ? $a_Ad['v_255_9'] : ''; $lot_size = isset($a_Ad['v_255_13']) ? $a_Ad['v_255_13'] : ''; $year_built = isset($a_Ad['v_255_10']) ? $a_Ad['v_255_10'] : ''; $viewtypes = isset($a_Ad['viewtypes']) ? $a_Ad['viewtypes'] : ''; $lakeview = isset($a_Ad['v_255_16']) ? $a_Ad['v_255_16'] : ''; $waterfront = isset($a_Ad['v_255_19']) ? $a_Ad['v_255_19'] : ''; $estimated_price = ''; $search_city = $city; $search_state = $state; } // Set up SEO-friendly title and meta if ($property_address) { $title = $property_address . ' - Lake House Property'; $description = 'Property at ' . $property_address . ' - Lake House Real Estate'; $keywords = $property_address . ', lake house, lakefront property, real estate'; } else { $title = 'Property Not Available - Lake House Real Estate'; $description = 'This property is not currently available on our website.'; $keywords = 'lake house, lakefront property, real estate'; } define('EN_BS4', 1); echo str_replace('',''. (($tpl_v['is_lhub_generic'] && !$tpl_v['matched_spotlight'])?'' :'').'', ShowHeader()); // Generate nearby properties using HawkTpl (like mountainhomes) $nearby_tpl = new Tpl; $nearby_tpl->InitArray('nearby_properties'); // Find nearby properties $nearby_homes = findNearbyProperties($state_id, $search_city, $id); if (!empty($nearby_homes)) { foreach ($nearby_homes as $home) { // Lee: Too slow to call ProcessSearchFriendlyURLs() // each time through the loop. Call it once at the end. $property_url = hwGetAdURL($home['link_id']); $property_data = array( 'property_id' => $home['link_id'], 'property_title' => htmlspecialchars($home['v_title'], ENT_QUOTES, 'UTF-8'), 'city' => htmlspecialchars($home['v_255_2'], ENT_QUOTES, 'UTF-8'), // Changed from property_city 'state' => htmlspecialchars($home['v_255_3'], ENT_QUOTES, 'UTF-8'), // Changed from property_state 'price' => '$' . number_format($home['v_255_4']), // Changed from property_price 'property_bedrooms' => htmlspecialchars($home['v_255_6'], ENT_QUOTES, 'UTF-8'), 'property_bathrooms' => htmlspecialchars($home['v_255_7'], ENT_QUOTES, 'UTF-8'), 'property_date' => htmlspecialchars($home['fdate'], ENT_QUOTES, 'UTF-8'), 'property_url' => $property_url ); // Check if property has image $img_data = $home['images']; if ($img_data) { $images = preg_split("/\s/", trim($img_data)); if (!empty($images[0])) { $property_data['has_image'] = true; $property_data['image_url'] = 'files/medium/' . hwImgPath($images[0]) . $images[0]; } } $nearby_tpl->AddCell('nearby_properties', $property_data, 'property'); } // Parse the nearby properties template $template_file = TPL_PATH . 'nearby_properties.htm'; $nearby_content = $nearby_tpl->Parse($template_file, array( 'search_city' => htmlspecialchars($search_city, ENT_QUOTES, 'UTF-8'), 'search_state' => htmlspecialchars($search_state, ENT_QUOTES, 'UTF-8') ), 0); } else { if ($search_city && $search_state) { $nearby_content = '
'; $nearby_content .= '

No nearby properties found in ' . htmlspecialchars($search_city, ENT_QUOTES, 'UTF-8') . ', ' . htmlspecialchars($search_state, ENT_QUOTES, 'UTF-8') . '.

'; $nearby_content .= '

Try expanding your search area or contact us for assistance.

'; $nearby_content .= '
'; } } // Need to call this so all the out.php?id= links are converted to // search friendly URLs. (also the page-id.html links) ProcessSearchFriendlyURLs($nearby_content); // Create the main content with enhanced information $main_content = '
'; if ($property_address) { $main_content .= '

' . htmlspecialchars($property_address, ENT_QUOTES, 'UTF-8') . '

'; // Display property details if available (like mountainhomes) if ($property_type || $last_listed || $price || $estimated_price || $bedrooms || $bathrooms || $square_feet || $lot_size || $year_built || $stories || $viewtypes || $lakeview == 'Yes' || $waterfront == 'Yes') { $main_content .= '
'; $main_content .= '

Property Details

'; $main_content .= '
'; if ($property_type) { $main_content .= '
Property Type: ' . htmlspecialchars($property_type, ENT_QUOTES, 'UTF-8') . '
'; } if ($last_listed) { $main_content .= '
Last Listed: ' . htmlspecialchars($last_listed, ENT_QUOTES, 'UTF-8') . '
'; } if ($price) { $main_content .= '
Last Asking Price: $' . htmlspecialchars($price, ENT_QUOTES, 'UTF-8') . '
'; } if ($estimated_price) { $main_content .= '
Estimated Market Price: $' . htmlspecialchars($estimated_price, ENT_QUOTES, 'UTF-8') . '
'; } if ($bedrooms) { $main_content .= '
Bedrooms: ' . htmlspecialchars($bedrooms, ENT_QUOTES, 'UTF-8') . '
'; } if ($bathrooms) { $main_content .= '
Bathrooms: ' . htmlspecialchars($bathrooms, ENT_QUOTES, 'UTF-8') . '
'; } if ($stories) { $main_content .= '
Stories: ' . htmlspecialchars($stories, ENT_QUOTES, 'UTF-8') . '
'; } if ($viewtypes) { $main_content .= '
View Types: ' . htmlspecialchars($viewtypes, ENT_QUOTES, 'UTF-8') . '
'; } if ($lakeview == 'Yes') { $main_content .= '
Lake View: Yes
'; } if ($waterfront == 'Yes') { $main_content .= '
Waterfront: Yes
'; } if ($square_feet) { $main_content .= '
Square Feet: ' . htmlspecialchars($square_feet, ENT_QUOTES, 'UTF-8') . '
'; } if ($lot_size) { $main_content .= '
Lot Size: ' . htmlspecialchars($lot_size, ENT_QUOTES, 'UTF-8') . '
'; } if ($year_built) { $main_content .= '
Year Built: ' . htmlspecialchars($year_built, ENT_QUOTES, 'UTF-8') . '
'; } $main_content .= '
'; $main_content .= '
'; } } if ($not_found) { // Format the expiration date to be more user-friendly $formatted_exp_date = ''; if (isset($archive_ad['exp_date']) && $archive_ad['exp_date']) { $formatted_exp_date = date('F j, Y', strtotime($archive_ad['exp_date'])); // Mention the full street address in the message below $main_content .= '

' . htmlspecialchars($property_address, ENT_QUOTES, 'UTF-8') . ' was off market as of ' . htmlspecialchars($formatted_exp_date, ENT_QUOTES, 'UTF-8') . '.

'; } } else { $main_content .= '

This property is not currently enabled for this website.

'; } if ($property_address) { $main_content .= '

'; if ($not_found) { // $main_content .= 'The property at ' . htmlspecialchars($property_address, ENT_QUOTES, 'UTF-8') . ' has been removed from our database.'; } else { $main_content .= 'The property at ' . htmlspecialchars($property_address, ENT_QUOTES, 'UTF-8') . ' is not currently enabled for this website. Please call 888-933-5253 for assistance.'; } $main_content .= '

'; } else { $main_content .= '

'; if ($not_found) { $main_content .= 'Ad # ' . $id . ' does not exist in our database.'; } else { $main_content .= 'Ad # ' . $id . ' is not enabled for this website. Please call 888-933-5253 for assistance.'; } $main_content .= '

'; } $main_content .= '
'; // Add the nearby properties content $main_content .= $nearby_content; // Add the call-to-action $main_content .= '
'; $main_content .= 'Contact one of our Real Estate Specialists in the area you are searching, for the latest mortgage rates, home prices and to help you SELL your lake house or to BUY one. We make it convenient and easy to find thousands of lakefront, lake view, lake access, lake homes for sale, lake cabins, cottages, lake lots, retirement homes, second homes, weekend homes, vacation getaways, home sites, acreage, land, riverfront, canal front, timeshares, lakeside condos, town homes and more in one place.'; $main_content .= '
'; // Output content directly (like mountainhomes) echo $main_content; ShowFooter(); exit; } function findNearbyProperties($state_id, $search_city, $exclude_id) { global $db; if (!$state_id || !$search_city) { return array(); } // First try to find listings in the same city $sql = 'SELECT link_id, images, v_title, v_255_2, v_255_3, v_255_4, v_255_6, v_255_7, v_255_9 as sqft, v_255_13 as lot_size, DATE_FORMAT(date,"' . DATE_FMT . '") AS fdate FROM ' . TBL_AD . ' WHERE approved="1" AND exp_date>=NOW() AND ' . WHERE_AD_ENABLED . ' AND state_id = ' . (int)$state_id . ' AND v_255_2 = "' . $db->quote($search_city) . '" AND link_id != ' . (int)$exclude_id . ' ORDER BY link_id DESC LIMIT 6'; $res = $db->query($sql); $available_homes = array(); while ($row = $db->fetch_assoc($res)) { $available_homes[] = $row; } // If no city matches, try state if (empty($available_homes)) { $sql = 'SELECT link_id, images,v_title, v_255_2, v_255_3, v_255_4, v_255_6, v_255_7, v_255_9 as sqft, v_255_13 as lot_size, DATE_FORMAT(date,"' . DATE_FMT . '") AS fdate FROM ' . TBL_AD . ' WHERE approved="1" AND exp_date>=NOW() AND ' . WHERE_AD_ENABLED . ' AND state_id = ' . (int)$state_id . ' AND link_id != ' . (int)$exclude_id . ' ORDER BY link_id DESC LIMIT 6'; $res = $db->query($sql); $available_homes = array(); while ($row = $db->fetch_assoc($res)) { $available_homes[] = $row; } } return $available_homes; }