assign('lang', $lang); //Clean variables $requestVarNames = array("store"); cleanGetVars($requestVarNames); $_GET['store'] = intval($_GET['store']); //Validate lat, lng are present (redirect if needed) if($_GET['store']<1){ @header('Location:http://www.carepresto.com/cp/store_locator.php'); die(""); //js backup redirect } //Load template variables $xtpl->assign('styleHref', 'skins/'.$settingsArray['skin'].'/style.css'); $xtpl->assign('skinLoc','skins/'.$settingsArray['skin']); $emailArray = @explode("@", $settingsArray['contactEmail']); $xtpl->assign('siteEmail',sprintf("", $emailArray[0], $emailArray[1])); $xtpl->assign('sitePhone',$settingsArray['contactPhone']); $xtpl->assign('pageTitle', $settingsArray['pageTitle']); $xtpl->assign('metaKeywords', $settingsArray['metaKeywords']); $xtpl->assign('metaDescription', $settingsArray['metaDescription']); //set javascript includes $js = " "; $xtpl->assign('pageScript', $js); $sql = sprintf("select * from stores where id = %s", mysql_real_escape_string($_GET['store'], $mysql->conn)); $result = $mysql->exSql($sql) or die($mysql->debugPrint()); if(mysql_num_rows($result)<1){ @header('Location:http://www.carepresto.com/cp/store_locator.php'); die(""); //js backup redirect } $row = mysql_fetch_assoc($result); $row['greeterpic'] = "uploads/".trim($row['greeterpic']); $row['officepic'] = "uploads/".trim($row['officepic']); $row['officepic01'] = "uploads/".trim($row['officepic01']); $row['officepic02'] = "uploads/".trim($row['officepic02']); $row['officepic03'] = "uploads/".trim($row['officepic03']); //START YELP HEADER // $store = $_GET['store']; if (empty($store)) { header("HTTP/1.1 404 Not Found"); exit; } $dentist = $_GET['dentist']; // pull dentist from DB by store id. Create this function in PHP and // query your database $dentistFromDB = preg_replace('/[\h.]+/', '-', $row['businessName']); // DB returns an empty or no value if (empty($dentistFromDB)) { header("HTTP/1.1 404 Not Found"); exit; } // DB returned value doesn't match the value in URL if ($dentistFromDB != $dentist) { // redirect with 301 to correct // page header ('HTTP/1.1 301 Moved Permanently'); header('Location: /cp/' . $store . '/' . $dentistFromDB); return; } // require_once('OAuth.php'); $CONSUMER_KEY = 'oK695rG7MVx54XdmwEEIqg'; $CONSUMER_SECRET = '65FDOSMNbW8TNByZrcyZ2fbWF1A'; $TOKEN = 'bTvaiSk57goL7ZEGUEQK-PxHR0ytzuHH'; $TOKEN_SECRET = 'ri4Re0IJcvlLyVrTpUn_CTUVSsM'; $API_HOST = 'api.yelp.com'; $DEFAULT_TERM = 'dinner'; $DEFAULT_LOCATION = 'San Francisco, CA'; $SEARCH_LIMIT = 3; $SEARCH_PATH = '/v2/search/'; $BUSINESS_PATH = '/v2/business/'; function request($host, $path) { $unsigned_url = "https://" . $host . $path; // Token object built using the OAuth library $token = new OAuthToken($GLOBALS['TOKEN'], $GLOBALS['TOKEN_SECRET']); // Consumer object built using the OAuth library $consumer = new OAuthConsumer($GLOBALS['CONSUMER_KEY'], $GLOBALS['CONSUMER_SECRET']); // Yelp uses HMAC SHA1 encoding $signature_method = new OAuthSignatureMethod_HMAC_SHA1(); $oauthrequest = OAuthRequest::from_consumer_and_token( $consumer, $token, 'GET', $unsigned_url ); // Sign the request $oauthrequest->sign_request($signature_method, $consumer, $token); // Get the signed URL $signed_url = $oauthrequest->to_url(); // Send Yelp API Call try { $ch = curl_init($signed_url); if (FALSE === $ch) throw new Exception('Failed to initialize'); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_HEADER, 0); $data = curl_exec($ch); if (FALSE === $data) throw new Exception(curl_error($ch), curl_errno($ch)); $http_status = curl_getinfo($ch, CURLINFO_HTTP_CODE); if (200 != $http_status) throw new Exception($data, $http_status); curl_close($ch); } catch(Exception $e) { trigger_error(sprintf( 'Curl failed with error #%d: %s', $e->getCode(), $e->getMessage()), E_USER_ERROR); } return $data; } function get_business($business_id) { $business_path = $GLOBALS['BUSINESS_PATH'] . urlencode($business_id); return request($GLOBALS['API_HOST'], $business_path); } // // // END YELP HEADER //THIS IS TEST INFO for YELP $yelpyon="none"; if($row['displayYelp']=='1') { $yelpyon="block"; $responseBIZ = get_business($row['Yelpid']); $jrespon = json_decode($responseBIZ); $xtpl->assign('yelp', "1"); $xtpl->assign('yelpimg',$jrespon->rating_img_url_large); $xtpl->assign('yelpreviewcount',$jrespon->review_count); $xtpl->assign('yelpsnip',$jrespon->snippet_text); $xtpl->assign('yelpurl',$jrespon->url); } $xtpl->assign('yelpdis',$yelpyon); //THIS IS FOR DISPLAYING THE DENTAL OFFICE IMAGES $opicon="none"; $opicon1="none"; $opicon2="none"; $opicon3="none"; $opicon4="none"; if($row['displayOfficepic']>'0') { $opicon="block"; $opicon1="block"; $xtpl->assign('opic1',$row['officepic']); if($row['displayOfficepic']>'1') { $opicon2="block"; $xtpl->assign('opic2',$row['officepic01']); if($row['displayOfficepic']>'2') { $opicon3="block"; $xtpl->assign('opic3',$row['officepic02']); if($row['displayOfficepic']>'3') { $opicon4="block"; $xtpl->assign('opic4',$row['officepic03']); } } } } $xtpl->assign('officedis',$opicon); $xtpl->assign('officedis1',$opicon1); $xtpl->assign('officedis2',$opicon2); $xtpl->assign('officedis3',$opicon3); $xtpl->assign('officedis4',$opicon4); //This is Fee Schedule Information - hides the rows for procedures that are not performed by a dentist $newexamon="visible"; $implanton="visible"; $crownon="visible"; $bridgeon="visible"; $cavitycompon="visible"; $deepcleaningon="visible"; $dentureson="visible"; $braceson="visible"; $simpextracton="visible"; $invisalignon="visible"; $rootcanalon="visible"; $veneerson="visible"; $whiteningon="visible"; $regcheckupon="visible"; if($row['newexamfee']=='NA') {$newexamon="none";} if($row['implantfee']=='NA') {$implanton="none";} if($row['crownfee']=='NA') {$crownon="none";} if($row['bridgefee']=='NA') {$bridgeon="none";} if($row['cavitycompfee']=='NA') {$cavitycompon="none";} if($row['deepcleaningfee']=='NA') {$deepcleaningon="none";} if($row['denturesfee']=='NA') {$dentureson="none";} if($row['bracesfee']=='NA') {$braceson="none";} if($row['simpextractfee']=='NA') {$simpextracton="none";} if($row['invisalignfee']=='NA') {$invisalignon="none";} if($row['rootcanalfee']=='NA') {$rootcanalon="none";} if($row['veneersfee']=='NA') {$veneerson="none";} if($row['whiteningfee']=='NA') {$whiteningon="none";} if($row['regcheckupfee']=='NA') {$regcheckupon="none";} $xtpl->assign('newexamdis',$newexamon); $xtpl->assign('implantdis',$implanton); $xtpl->assign('crowndis',$crownon); $xtpl->assign('bridgedis',$bridgeon); $xtpl->assign('cavitycompdis',$cavitycompon); $xtpl->assign('deepcleaningdis',$deepcleaningon); $xtpl->assign('denturesdis',$dentureson); $xtpl->assign('bracesdis',$braceson); $xtpl->assign('simpextractdis',$simpextracton); $xtpl->assign('invisaligndis',$invisalignon); $xtpl->assign('rootcanaldis',$rootcanalon); $xtpl->assign('veneersdis',$whiteningon); $xtpl->assign('whiteningdis',$whiteningon); $xtpl->assign('regcheckupdis',$regcheckupon); //Adjust for location of logo $row['logo'] = "uploads/".trim($row['logo']); $row['dentistpic'] = "../cp/uploads/".trim($row['dentistpic']); //Convert new line to br (if needed) if($row['hours']!=""){ $row['hours'] = nl2br($row['hours']); } if($row['education']!=""){ $row['education'] = nl2br($row['education']); } //Assign data to template $xtpl->assign('data', $row); //STACKOVERFLOW ADDED CODE TO CLEAN URL ?> <? print "{$row['businessName']}, {$row['dentistname']} - CarePresto"; ?> " /> " /> " /> " /> " /> " />
parse('main.storelogo'); } } //parse additional store info html (if exits) if(trim($row['pageHTML']) != ""){ $xtpl->parse('main.additionalinfo'); }else{ $xtpl->parse('main.noadditionalinfo'); } //parse hours html (If hours exits) if(trim($row['hours']) != ""){ $xtpl->parse('main.storehours'); }else{ $xtpl->parse('main.nohourslisted'); } //if display website, parse website html if($row['website'] != "" && $row['displayWebsite'] == '1'){ $xtpl->parse('main.websiteHTML'); } //if categories, look up categories if($row['categories'] != ""){ $sql = sprintf("select * from categories where FIND_IN_SET(id,'%s') > 0 order by Title asc",$row['categories']); $cResult = $mysql->exSql($sql) or die($mysql->debugPrint()); $catList = array(); while($cRow = mysql_fetch_assoc($cResult)){ $catList[] = $cRow['Title']; } $xtpl->assign("categorylist",@implode(", ",$catList)); $xtpl->parse('main.categories'); } //if services, look up services if($row['services'] != ""){ $sql = sprintf("select * from services where FIND_IN_SET(id,'%s') > 0 order by Title asc",$row['services']); $sResult = $mysql->exSql($sql) or die($mysql->debugPrint()); $serviceList = array(); while($sRow = mysql_fetch_assoc($sResult)){ $serviceList[] = $sRow['Title']; } $xtpl->assign("servicelist",@implode(", ",$serviceList)); $xtpl->parse('main.services'); } //if dislay weekly ad, parse weekly ad html if($row['displayWeeklyAd'] == '1'){ $xtpl->parse('main.weeklyAdHTML'); } //Google Maps JavaSript $js = "\n"; $js .= ""; $xtpl->assign('googleMapScript', $js); //parse and output to template $xtpl->parse('main'); $xtpl->out('main'); if($settingsRow['enablecaching']=="1"){ require('http://www.carepresto.com/cp/dynamic_cache_footer.php'); } ?>

  Schedule an Appointment


Name:
Email:
Phone:
Preferred Time:
Comments:
 

  Write a Dentist Review


Name:
Email:
Phone:
Zipcode:
Comments: