########################################################################################
# PHP STORE LOCATOR SCRIPT (phpscriptindex.com, phpstorelocatorscript.com)
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
# NOTICE: (C) DB DESIGN 2007, DO NOT COPY OR DISTRIBUTE CODE WITH OUT PERMISSION
# Code is NOT open source and subject to a software license agreement. You are
# allowed to modify the software to meet the needs of your domain in accordance with
# the software license agreement.
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
# SUPPORT: phpstorelocatorscript.com, phpscriptindex.com/support/
# EMAIL SUPPORT: phpsales@gmail.com Monday - Friday 10:00am to 5:00pm EST
########################################################################################
###########################################################
# Store Locator PHP File
###########################################################
//check for installation redirect
if(filesize('sladmin/includes/config.php')==0){
header("Location: installfiles/install.php");
}
//validate install files are removed (if installed)
if(is_dir('installfiles')){
die("Please remove /installfiles directory to view page.");
}
//Fetch Settings
require('fetch_settings.php');
//Detect Mobile Phone Device
$isMobile = false;
$userAgent = strtolower($_SERVER['HTTPS_USER_AGENT']);
$mobileAgents = array("iphone","android","webos","ipod","blackberry");
$mobileAgent = "";
for($i=0;$iassign('settingsrow',$settingsRow);
//Fetch language support
require(LANGFILE);
$xtpl->assign('lang', $lang);
//Define Template Vars
$xtpl->assign('styleHref', 'skins/'.$settingsArray['skin'].($isMobile?'/style_mobile.css':'/style.css'));
$xtpl->assign('formAction', 'store_locator_results.php');
$xtpl->assign('formMethod', 'GET');
$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('countryIso', $settingsArray['countryIso']);
$xtpl->assign('pageTitle', $settingsArray['pageTitle']);
$xtpl->assign('metaKeywords', $settingsArray['metaKeywords']);
$xtpl->assign('metaDescription', $settingsArray['metaDescription']);
//Build Page Script
$js = "\n";
$js .= "\n";
if(!$isMobile){//load non mobile script
//$js .= "\n";
$js .= "\n";
$js .= "\n";
$js .= "\n";
$js .= "\n";
$js .= "\n";
$js .= "\n";
}else{//load mobile script
$js .= "\n";
$js .= "\n";
$js .= "\n";
$js .= "\n";
$js .= "\n";
}
//Load Localize Script (if needed, non moible)
if($settingsRow['enablelocal']=="1" && !$isMobile){//requires script loading of google maps v3 above
$js .= "\n";
}
//Display Google Geomap (if enabled)
if($settingsRow['enablegeomap']=="1"){
$js .= "\n";
$js .= "\n";
$xtpl->parse('main.geomap');
}
//Assign Page Script to template
$xtpl->assign('pageScript', $js);
//Fetch countries
$sql = "select * from countries where iso is not null and iso != '' order by name asc";
$result = $mysql->exSql($sql) or die($mysql->debugPrint());
while($row = mysql_fetch_assoc($result)){
if(DEFAULTLANG!=CURRENTLANG){
$translatedText = fetchTranslation(CURRENTLANG,DEFAULTLANG, sprintf("country-%s", $row['iso']), $row['name']);
$row['name'] = $translatedText;
}
if($row['iso'] == $settingsArray['countryIso']){
$row['selected'] = "selected";
}
$xtpl->assign('country', $row);
$xtpl->parse('main.countryisooption1');
$xtpl->parse('main.countryisooption2');
}
//Fetch categories
$sql = "select * from categories order by Title asc";
$result = $mysql->exSql($sql) or die($mysql->debugPrint());
while($row = mysql_fetch_assoc($result)){
if(DEFAULTLANG!=CURRENTLANG){
$translatedText = fetchTranslation(CURRENTLANG,DEFAULTLANG, sprintf("cat-%s", $row['id']), $row['Title']);
$row['Title'] = $translatedText;
}
$xtpl->assign('category', $row);
$xtpl->parse('main.categories1');
$xtpl->parse('main.categories2');
}
//Fetch services
$sql = "select * from services order by Title asc";
$result = $mysql->exSql($sql) or die($mysql->debugPrint());
while($row = mysql_fetch_assoc($result)){
if(DEFAULTLANG!=CURRENTLANG){
$translatedText = fetchTranslation(CURRENTLANG,DEFAULTLANG, sprintf("serv-%s", $row['id']), $row['Title']);
$row['Title'] = $translatedText;
}
$xtpl->assign('service', $row);
$xtpl->parse('main.services1');
$xtpl->parse('main.services2');
}
//Parse template and output
$xtpl->parse('main');
$xtpl->out('main');
//Save cached version of page (if needed)
if($settingsRow['enablecaching']=="1"){
require('dynamic_cache_footer.php');
}
?>