예제 #1
0
| Guildsquare
| Copyright (C) 2014 - 2014 Guildsquare
| http://www.guildsquare.com/
+--------------------------------------------------------+
| Project File: Location ajax parsing
| Filename: location.json.php
+--------------------------------------------------------*/
require_once dirname(__FILE__) . '../../../maincore.php';
if (!defined("IN_FUSION")) {
    die("Access Denied");
}
include INCLUDES . "geomap/geomap.inc.php";
$q = $_GET['q'];
$found = 0;
foreach (array_keys($states) as $k) {
    // type the country then output full states
    if (preg_match('/^' . $q . '/', $k, $matches)) {
        $states_list = map_country($states, $k);
        //print_p($states_list);
        echo json_encode($states_list);
        $found = 1;
    }
}
if (!$found) {
    // a longer version
    $region_list = map_region($states);
    if (array_key_exists($q, $region_list)) {
        //print_p($region_list[$q]);
        echo json_encode($region_list[$q]);
    }
}
예제 #2
0
function location_search($q)
{
    $states = array();
    include INCLUDES . "geomap/geomap.inc.php";
    // since search is on user_name.
    $found = 0;
    foreach (array_keys($states) as $k) {
        // type the country then output full states
        if (preg_match('/^' . $q . '/', $k, $matches)) {
            $found = 1;
            $states_list = map_country($states, $k);
            return json_encode($states_list);
        }
    }
    if (!$found) {
        // a longer version
        $region_list = map_region($states);
        if (array_key_exists($q, $region_list)) {
            //print_p($region_list[$q]);
            return json_encode($region_list[$q]);
        }
    }
    return FALSE;
}