Пример #1
0
function findCity($city_id, $nearbyResults = false)
{
    $geo = new Models_Geo();
    global $modelGeneral;
    $cityDetails = $geo->cityDetail($city_id);
    if (empty($cityDetails)) {
        return false;
    }
    $cityDetails['sql'] = $geo->sql;
    $lat = !empty($cityDetails['latitude']) ? $cityDetails['latitude'] : null;
    $lon = !empty($cityDetails['longitude']) ? $cityDetails['longitude'] : null;
    $radius = 30;
    $order = 'distance';
    $limit = 30;
    if ($nearbyResults) {
        if (empty($lat) || empty($lon)) {
            $cityDetails['nearby'] = array();
        } else {
            $cityDetails['nearby'] = $geo->get_nearby_cities($lat, $lon, $radius, $order, $limit);
        }
    }
    if (empty($cityDetails['extraDetails'])) {
        $etc = fetchCityXtraDetails($lat, $lon);
        if (!empty($etc)) {
            $d = array();
            $d['extraDetails'] = json_encode($etc);
            $d['lat_h'] = $etc['location']['lat_h'];
            $d['lat_m'] = $etc['location']['lat_m'];
            $d['lat_s'] = $etc['location']['lat_s'];
            $d['lon_h'] = $etc['location']['lon_h'];
            $d['lon_m'] = $etc['location']['lon_m'];
            $d['lon_e'] = $etc['location']['lon_e'];
            $d['zone_h'] = $etc['location']['zone_h'];
            $d['zone_m'] = $etc['location']['zone_m'];
            $d['dst'] = $etc['location']['dst'];
            $d['rawOffset'] = $etc['timezone']['rawOffset'];
            $d['dstOffset'] = $etc['timezone']['dstOffset'];
            $cityDetails = array_merge($cityDetails, $d);
            $where = sprintf('cty_id = %s', $modelGeneral->qstr($cityDetails['id']));
            $modelGeneral->updateDetails('geo_cities', $d, $where);
            $modelGeneral->clearCache($cityDetails['sql']);
        }
    } else {
        $etc = json_decode($cityDetails['extraDetails'], 1);
    }
    $cityDetails['etc'] = $etc;
    $cityDetails['url'] = HTTPPATH . '/city-' . url_name_v2($cityDetails['city']) . '-' . $cityDetails['id'];
    $cityDetails['pageTitle'] = $cityDetails['city'] . ', ' . $cityDetails['statename'] . ', ' . $cityDetails['countryname'];
    return $cityDetails;
}
Пример #2
0
function makecityurl($city_id, $city)
{
    return HTTPPATH . '/city-' . url_name_v2($city) . '-' . $city_id;
}
Пример #3
0
$str .= '<b>Longitude: </b>' . $globalCity['longitude'] . '<br />';
if (!empty($globalCity['etc']['timezone']['timezoneId'])) {
    $str .= '<b>TimeZone: </b>' . $globalCity['etc']['timezone']['timezoneId'] . '<br />';
}
if (isset($globalCity['etc']['location']['dst'])) {
    $str .= '<b>Daylight Saving: </b>' . ($globalCity['etc']['location']['dst'] == 1 ? 'Yes' : 'No') . '<br />';
}
if (!empty($cityOwnerDetails)) {
    $str .= '<b>City Moderator: </b><br />' . $cityOwnerDetails['fullname'] . '<br />';
}
if (!empty($stateOwnerDetails)) {
    $str .= '<b>State Moderator: </b><br />' . $stateOwnerDetails['fullname'] . '<br />';
}
if (!empty($countryOwnerDetails)) {
    $str .= '<b>Country Moderator: </b><br />' . $countryOwnerDetails['fullname'] . '<br />';
}
$str .= '<br />';
if (empty($ownerDetails)) {
    //$str .= '<a href="'.$currentURL.'/city/moderator/apply">Become City Moderator</a>';
}
$str .= '</div>';
$pageDynamicNavigationItem = $str;
//nearby
if (!empty($globalCity['nearby'])) {
    $str = '';
    foreach ($globalCity['nearby'] as $nearby) {
        $url = HTTPPATH . '/city-' . url_name_v2($nearby['name']) . '-' . $nearby['cty_id'];
        $str .= '<a href="' . $url . '">' . $nearby['name'] . '</a> (' . $nearby['distance'] . ' mi)<br />';
    }
    $pageDynamicNearby = $str;
}
Пример #4
0
<?php

if (empty($_GET['city_id']) && !empty($_GET['city'])) {
    header("Location: " . HTTPPATH . "/locations/searchResult?q=" . $_GET['city']);
    exit;
}
if (empty($_GET['city_id'])) {
    header("Location: " . HTTPPATH . "/locations/country");
    exit;
}
$city_id = $_GET['city_id'];
$url = APIHTTPPATH . '/locations/citydetail.php?id=' . $city_id;
$cityList = curlget($url);
$cityList = json_decode($cityList, 1);
if (empty($cityList[0])) {
    header("Location: " . HTTPPATH . "/locations/country");
    exit;
}
$url = HTTPPATH . '/city-' . url_name_v2($cityList[0]['city']) . '-' . $cityList[0]['id'];
header("Location: " . $url);
exit;
Пример #5
0
    $cities = new Cities();
    $list = $cities->getList();
} catch (Exception $e) {
}
?>
<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<title>Untitled Document</title>
</head>

<body>

<h1>Cities</h1>
<?php 
foreach ($list as $city) {
    ?>
<div><a href="<?php 
    echo 'http://mkgalaxy.com/city-' . url_name_v2($city['name']) . '-' . $city['cty_id'];
    ?>
" target="_blank"><?php 
    echo $city['name'];
    ?>
</a></div>
<?php 
}
?>
<p>&nbsp;</p>
</body>
</html>
Пример #6
0
         $d['keyword'] = $s;
         $d['kw_url_lookup'] = $sURL;
         $d['created_on'] = date('Y-m-d H:i:s');
         $d['ip'] = $_SERVER['REMOTE_ADDR'];
         $d['views'] = 0;
         $d['status'] = 1;
         $d['new'] = 1;
         $q = $sURL;
         $id = $CMSActivities->addDetails('short_keywords', $d);
     }
     $url = 'http://cms-' . $q . '.' . BASEDOMAIN;
     header("Location: " . $url);
     exit;
 }
 $ciVal = !empty($_GET['ciVal']) ? trim($_GET['ciVal']) : '';
 $ciValURL = !empty($_GET['ciVal']) ? url_name_v2(trim($_GET['ciVal'])) : '';
 if (!empty($ciVal)) {
     $tmpDetails = $CMSActivities->getKeywordURL($ciValURL);
     if (!empty($tmpDetails)) {
         $id = $tmpDetails['keyword_id'];
         $q = $tmpDetails['kw_url_lookup'];
     } else {
         $d = array();
         $d['keyword'] = $ciVal;
         $d['kw_url_lookup'] = $ciValURL;
         $d['created_on'] = date('Y-m-d H:i:s');
         $d['ip'] = $_SERVER['REMOTE_ADDR'];
         $d['views'] = 0;
         $d['status'] = 1;
         $d['new'] = 1;
         $q = $sURL;