예제 #1
0
 public function getUser($uid, $useCache = true)
 {
     $sql = sprintf("SELECT *, google_auth.name as fullname FROM google_auth LEFT JOIN settings ON google_auth.uid = settings.uid LEFT JOIN geo_cities ON settings.birth_city_id = geo_cities.cty_id WHERE google_auth.uid = %s", $this->qstr($uid));
     $this->sql = $sql;
     if ($useCache) {
         $result = $this->_connMain->CacheExecute(self::CACHESECS_GOOGLEAUTH_USER, $sql);
     } else {
         $result = $this->_connMain->Execute($sql);
     }
     $return = $result->fields;
     if (!empty($return['birth_city_id']) && empty($return['extraDetails'])) {
         $city = findCity($return['birth_city_id']);
         $return = array_merge($return, $city);
     }
     if (empty($result) || $result->EOF || empty($return)) {
         throw new Exception("No User Found.");
     }
     return $return;
 }
예제 #2
0
                if ($pts < 31) {
                    return $class[1];
                } else {
                    if ($pts < 36) {
                        return $class[0];
                    }
                }
            }
        }
    }
}
asort($horo_cities);
$currentPoints = array();
if (!empty($horo_cities)) {
    foreach ($horo_cities as $k => $v) {
        $d = findCity($k);
        $d['dob'] = date('Y-m-d H:i:s');
        $info = findHoroInfo($d);
        $currentPoints[$k] = array('points' => $specific_points[$info[9]], 'nakshatra' => $info['7']);
    }
}
?>

<!-- Date time picker -->
<link rel="stylesheet" type="text/css" href="<?php 
echo HTTPPATH;
?>
/styles/jquery.datetimepicker.css"/>
<style type="text/css">

.custom-date-style {
예제 #3
0
$defaultPage = 'home';
$page = $defaultPage;
if (!empty($_GET['p'])) {
    $page = $_GET['p'];
}
$page .= '.php';
$pageTitle = 'World Cities';
ob_start();
if ($host !== 'mkgalaxy.com' && empty($_SESSION['sub_city_location'])) {
    $params['where'] = sprintf(" AND d.domain = %s AND d.status = 1", $modelGeneral->qstr($_SERVER['HTTP_HOST']));
    $params['fields'] = ' d.*, c.*, s.name as state, ci.name as country';
    $params['cacheTime'] = 60 * 60 * 24;
    $tableName = 'z_domains as d LEFT JOIN geo_cities as c ON d.city_id = c.cty_id LEFT JOIN geo_states as s ON c.sta_id = s.sta_id LEFT JOIN geo_countries as ci ON c.con_id = ci.con_id';
    $cityData = $modelGeneral->getDetails($tableName, 1, $params);
    if (!empty($cityData[0])) {
        $cityDataMore = findCity($cityData[0]['city_id']);
        $_SESSION['sub_city_location']['url'] = $cityDataMore['url'];
        $_SESSION['sub_city_location']['title'] = $cityDataMore['city'];
        $_SESSION['sub_city_location']['id'] = $cityData[0]['city_id'];
        header("Location: " . $_SESSION['sub_city_location']['url']);
        exit;
    }
}
if (!empty($_GET['locationFind']) && isset($_GET['q'])) {
    $tmp = explode('/', $_GET['q']);
    $tmp = array_filter($tmp);
    if (empty($tmp)) {
        include 'mods/home.php';
    } else {
        $path = implode('/', $tmp);
        if (file_exists('mods/' . $path . '.php')) {
예제 #4
0
function updatePoints($id, $id2)
{
    if (empty($id) || empty($id2)) {
        return false;
    }
    if ($id == $id2) {
        //return false;
    }
    //$modelGeneral = new Models_General();
    global $modelGeneral;
    $return = array();
    $params = array();
    $t = 60 * 60 * 24 * 365 * 5;
    $params['where'] = sprintf(" AND ((user1 = %s AND user2 = %s) OR (user1 = %s AND user2 = %s))", $modelGeneral->qstr($id), $modelGeneral->qstr($id2), $modelGeneral->qstr($id2), $modelGeneral->qstr($id), $t);
    $check = $modelGeneral->getDetails('user_points', 1, $params);
    if (empty($check)) {
        $modelGeneral->clearCache($modelGeneral->sql);
    }
    if (!empty($check)) {
        foreach ($check as $k => $v) {
            $return[$v['user1']][$v['user2']]['points'] = $v['points'];
            $return[$v['user1']][$v['user2']]['results'] = $v['results'];
        }
        return $return;
    }
    //getting points from api
    $params = array();
    $params['where'] = sprintf(" AND (settings.uid = %s OR settings.uid = %s)", $modelGeneral->qstr($id), $modelGeneral->qstr($id2));
    $settingsDetail = $modelGeneral->getDetails('settings LEFT JOIN geo_cities ON settings.birth_city_id = geo_cities.cty_id', 1, $params, $t);
    if (count($settingsDetail) == 1) {
        $settingsDetail[1] = $settingsDetail[0];
    }
    if (count($settingsDetail) == 2) {
        $sql = $modelGeneral->sql;
        if (empty($settingsDetail[0]['extraDetails'])) {
            $tmp = findCity($settingsDetail[0]['cty_id']);
            $settingsDetail[0] = array_merge($settingsDetail[0], $tmp);
        }
        if (empty($settingsDetail[1]['extraDetails'])) {
            $tmp = findCity($settingsDetail[1]['cty_id']);
            $settingsDetail[1] = array_merge($settingsDetail[1], $tmp);
        }
        if (!empty($settingsDetail[0]['dob']) && !empty($settingsDetail[1]['dob']) && !empty($settingsDetail[0]['birth_city_id']) && !empty($settingsDetail[1]['birth_city_id'])) {
            $Kundali = new Library_Kundali();
            //fetching for first user
            $fromDate = getDateTime($settingsDetail[0]['dob']);
            $toDate = getDateTime($settingsDetail[1]['dob']);
            $returnArrFrom = $Kundali->precalculate($fromDate['month'], $fromDate['day'], $fromDate['year'], $fromDate['hour'], $fromDate['minute'], $settingsDetail[0]['zone_h'], $settingsDetail[0]['zone_m'], $settingsDetail[0]['lon_h'], $settingsDetail[0]['lon_m'], $settingsDetail[0]['lat_h'], $settingsDetail[0]['lat_m'], $settingsDetail[0]['dst'], $settingsDetail[0]['lon_e'], $settingsDetail[0]['lat_s']);
            $returnArrTo = $Kundali->precalculate($toDate['month'], $toDate['day'], $toDate['year'], $toDate['hour'], $toDate['minute'], $settingsDetail[0]['zone_h'], $settingsDetail[1]['zone_m'], $settingsDetail[1]['lon_h'], $settingsDetail[1]['lon_m'], $settingsDetail[1]['lat_h'], $settingsDetail[1]['lat_m'], $settingsDetail[1]['dst'], $settingsDetail[1]['lon_e'], $settingsDetail[1]['lat_s']);
            $pts = $Kundali->getpoints($returnArrFrom[9], $returnArrTo[9]);
            $finalPoints = array('points' => $pts, 'result' => $Kundali->interpret($pts));
            $d = array();
            $d['user1'] = $settingsDetail[0]['uid'];
            $d['user2'] = $settingsDetail[1]['uid'];
            $d['points'] = $finalPoints['points'];
            $d['results'] = $finalPoints['result'];
            $v = array('from' => $returnArrFrom, 'to' => $returnArrTo, 'pts' => $pts, 'result' => $finalPoints);
            $d['details'] = json_encode($v);
            $modelGeneral->addDetails('user_points', $d);
            $return[$d['user1']][$d['user2']]['points'] = $d['points'];
            $return[$d['user1']][$d['user2']]['results'] = $d['results'];
            //fetching for second user
            $fromDate = getDateTime($settingsDetail[1]['dob']);
            $toDate = getDateTime($settingsDetail[0]['dob']);
            $returnArrFrom = $Kundali->precalculate($fromDate['month'], $fromDate['day'], $fromDate['year'], $fromDate['hour'], $fromDate['minute'], $settingsDetail[1]['zone_h'], $settingsDetail[1]['zone_m'], $settingsDetail[1]['lon_h'], $settingsDetail[1]['lon_m'], $settingsDetail[1]['lat_h'], $settingsDetail[1]['lat_m'], $settingsDetail[1]['dst'], $settingsDetail[1]['lon_e'], $settingsDetail[1]['lat_s']);
            $returnArrTo = $Kundali->precalculate($toDate['month'], $toDate['day'], $toDate['year'], $toDate['hour'], $toDate['minute'], $settingsDetail[0]['zone_h'], $settingsDetail[0]['zone_m'], $settingsDetail[0]['lon_h'], $settingsDetail[0]['lon_m'], $settingsDetail[0]['lat_h'], $settingsDetail[0]['lat_m'], $settingsDetail[0]['dst'], $settingsDetail[0]['lon_e'], $settingsDetail[0]['lat_s']);
            $pts = $Kundali->getpoints($returnArrFrom[9], $returnArrTo[9]);
            $finalPoints = array('points' => $pts, 'result' => $Kundali->interpret($pts));
            $d = array();
            $d['user1'] = $settingsDetail[1]['uid'];
            $d['user2'] = $settingsDetail[0]['uid'];
            $d['points'] = $finalPoints['points'];
            $d['results'] = $finalPoints['result'];
            $v = array('from' => $returnArrFrom, 'to' => $returnArrTo, 'pts' => $pts, 'result' => $finalPoints);
            $d['details'] = json_encode($v);
            $modelGeneral->addDetails('user_points', $d);
            $return[$d['user1']][$d['user2']]['points'] = $d['points'];
            $return[$d['user1']][$d['user2']]['results'] = $d['results'];
            $modelGeneral->clearCache($sql);
        }
    }
    return $return;
}
예제 #5
0
      <td>extraDetails</td>
      <td>lat_h</td>
      <td>lat_m</td>
      <td>lat_s</td>
      <td>lon_h</td>
      <td>lon_m</td>
      <td>lon_e</td>
      <td>zone_h</td>
      <td>zone_m</td>
      <td>dst</td>
      <td>rawOffset</td>
      <td>dstOffset</td>
    </tr>
    <?php 
    do {
        $row_rsView2 = findCity($row_rsView['cty_id']);
        ?>
      <tr>
        <td><?php 
        echo $row_rsView2['cty_id'];
        ?>
</td>
        <td><?php 
        echo $row_rsView2['sta_id'];
        ?>
</td>
        <td><?php 
        echo $row_rsView2['con_id'];
        ?>
</td>
        <td><?php 
예제 #6
0
         throw new Exception('lng is missing');
     }
     $return['data'] = nearbyCities($_GET['lat'], $_GET['lng']);
     break;
 case 'cityMatch':
     if (empty($_GET['lat'])) {
         throw new Exception('lat is missing');
     }
     if (empty($_GET['lng'])) {
         throw new Exception('lng is missing');
     }
     $data = array_values(nearbyCities($_GET['lat'], $_GET['lng'], $radius = 100, $order = 'distance', $limit = 1));
     if (empty($data[0])) {
         throw new Exception('no city found');
     }
     $return['data'] = $return['data'] = findCity($data[0]['cty_id']);
     break;
 case 'findCity':
     if (empty($_GET['q'])) {
         throw new Exception('search Term q is missing');
     }
     $return['data'] = findCitySearch($_GET['q']);
     break;
 case 'match':
     if (empty($_REQUEST['from'])) {
         throw new Exception('from is missing');
     }
     if (empty($_REQUEST['to'])) {
         throw new Exception('to is missing');
     }
     $return['data'] = match($_REQUEST['from'], $_REQUEST['to']);
예제 #7
0
<?php

if (empty($_GET['city_id'])) {
    header("Location: " . HTTPPATH);
    exit;
}
$city_id = $_GET['city_id'];
$globalCity = findCity($city_id);
if (empty($globalCity)) {
    header("Location: " . HTTPPATH);
    exit;
}
$pageTitle = $globalCity['pageTitle'];
$currentURL = $globalCity['url'];
//setting cookie
setcookie('redirect_url', $currentURL, time() + 60 * 60 * 24 * 365, '/');
$_COOKIE['redirect_url'] = $currentURL;
//setting cookie
$_SESSION['last_location']['url'] = $currentURL;
$_SESSION['last_location']['title'] = $globalCity['city'];
$_SESSION['last_location']['id'] = $city_id;
$cityOwner = false;
$stateOwner = false;
$countryOwner = false;
//getting city information
$params = array();
$params['cacheTime'] = 3600 * 24;
$params['fields'] = '*, a.name as fullname, c.name as name';
$params['where'] = 'AND o.cty_id = ' . $modelGeneral->qstr($globalCity['id']);
//$params['where'] .= 'AND a.uid = '.$modelGeneral->qstr($_SESSION['user']['id']);
$params['where'] .= ' AND o.expiry_date > NOW() AND o.subs_expiry_date > NOW() AND o.status = 1';
예제 #8
0
        case 'matchCityId':
            if (empty($_GET['from']['city_id'])) {
                throw new Exception('from city_id is missing');
            }
            if (empty($_GET['from']['dob'])) {
                throw new Exception('from dob is missing');
            }
            if (empty($_GET['to']['city_id'])) {
                throw new Exception('to city_id is missing');
            }
            if (empty($_GET['to']['dob'])) {
                throw new Exception('to dob is missing');
            }
            $return['data']['points'] = array();
            $dataFrom2 = $return['data']['from'] = findCity($_GET['from']['city_id']);
            $dataFrom2['dob'] = $_GET['from']['dob'];
            $return['data']['from']['horo'] = findHoroInfo($dataFrom2);
            $dataTo2 = $return['data']['to'] = findCity($_GET['to']['city_id']);
            $dataTo2['dob'] = $_GET['to']['dob'];
            $return['data']['to']['horo'] = findHoroInfo($dataTo2);
            $return['data']['points'] = getPoints($return['data']['from']['horo'][9], $return['data']['to']['horo'][9]);
            break;
    }
} catch (Exception $e) {
    $return['success'] = 0;
    $return['error'] = 1;
    $return['errorMessage'] = $e->getMessage();
}
$return['get'] = $_GET;
//$return['actions'] = array('findcitybyid' => array('city_id'), 'nearby' => array('lat', 'lng'), 'cityMatch' => array('lat', 'lng'), 'match' => array('from', 'to'), 'findCity' => array('q'), 'matchMultiple' => array('data'), 'naks' => array('lat', 'lng', 'dob'), 'naksMatch' => array('naks1', 'naks2'));
echo json_encode($return);