private function makePt()
 {
     include __DIR__ . '/../../lib/settings.inc.php';
     include_once __DIR__ . '/../../lib/language.inc.php';
     $langArray = available_languages();
     $oldFileArr = explode('xxkgfj8ipzxx', file_get_contents($dynstylepath . 'ptPromo.inc-' . $lang . '.php'));
     $region = new GetRegions();
     $newPt = powerTrailBase::writePromoPt4mainPage($oldFileArr[1]);
     $regions = $region->GetRegion($newPt['centerLatitude'], $newPt['centerLongitude']);
     foreach ($langArray as $language) {
         $this->makePtContent($newPt, $language, $dynstylepath, $regions);
     }
 }
示例#2
0
             // dla logu po obecnym
             $km_logu[$najblizszy_log_pozniej['id']] = sprintf("%.2f", calcDistance($wspolrzedneNS, $wspolrzedneWE, $najblizszy_log_pozniej['latitude'], $najblizszy_log_pozniej['longitude']));
             sql("UPDATE `cache_moved` SET `km`='&1' WHERE id = '&2'", $km_logu[$najblizszy_log_pozniej['id']], $najblizszy_log_pozniej['id']);
             sql("UPDATE `cache_moved` SET `km`='&1' WHERE id = '&2'", $km_logu[$najblizszy_log_wczesniej['id']], $najblizszy_log_wczesniej['id']);
             // wyliczenie dystansu dla obecnego logu.
             $dystans = sprintf("%.2f", calcDistance($najblizszy_log_wczesniej['latitude'], $najblizszy_log_wczesniej['longitude'], $wspolrzedneNS, $wspolrzedneWE));
             //print $dystans;
         }
     }
     //
     // insert into table cache_moved
     sql("INSERT INTO `cache_moved`(`id`,\n                                                     `cache_id`,\n                                                     `user_id`,\n                                                     `log_id`,\n                                                     `date`,\n                                                     `longitude`,\n                                                     `latitude`,\n                                                     `km`)\n                                             VALUES ('',\n                                                     '&1',\n                                                     '&2',\n                                                     '&3',\n                                                     '&4',\n                                                     '&5',\n                                                     '&6',\n                                                     '&7'\n                                                    )", sql_escape($cache_id), $usr['userid'], $last_id_4_mobile_moved, $log_date, $wspolrzedneWE, $wspolrzedneNS, $dystans);
     // update main cache coordinates
     sql("UPDATE `caches` SET `longitude` = '&2', `latitude` = '&3'  WHERE `cache_id`='&1'", sql_escape($cache_id), $wspolrzedneWE, $wspolrzedneNS);
     // get new region (names and codes) from coordinates and put it into database.
     $region = new GetRegions();
     $regiony = $region->GetRegion($wspolrzedneNS, $wspolrzedneWE);
     sql("UPDATE `cache_location` SET adm1 = '&2', adm3 = '&3', code1='&4', code3='&5' WHERE cache_id = '&1'", sql_escape($cache_id), $regiony['adm1'], $regiony['adm3'], $regiony['code1'], $regiony['code3']);
 }
 // mobilne by Łza - koniec
 //inc cache stat and "last found"
 $rs = sql("SELECT `founds`, `notfounds`, `notes`, `last_found` FROM `caches` WHERE `cache_id`='&1'", sql_escape($cache_id));
 $record = sql_fetch_array($rs);
 $last_found = '';
 if ($log_type == 1 || $log_type == 7) {
     $dlog_date = mktime($log_date_hour, $log_date_min, 0, $log_date_month, $log_date_day, $log_date_year);
     if ($record['last_found'] == NULL) {
         $last_found = ', `last_found`=\'' . sql_escape(date('Y-m-d H:i:s', $dlog_date)) . '\'';
     } elseif (strtotime($record['last_found']) < $dlog_date) {
         $last_found = ', `last_found`=\'' . sql_escape(date('Y-m-d H:i:s', $dlog_date)) . '\'';
     }
<?php

require_once __DIR__ . '/lib/ClassPathDictionary.php';
spl_autoload_register(function ($className) {
    include_once ClassPathDictionary::getClassPath($className);
});
session_start();
//ajaxRetreiveRegionByCoordinates.php
if (!isset($_SESSION['user_id'])) {
    print 'no hacking please!';
    exit;
}
require_once __DIR__ . '/GetRegions.php';
$latitude = $_REQUEST['lat'];
$longitude = $_REQUEST['lon'];
$region = new GetRegions();
$regiony = $region->GetRegion($latitude, $longitude);
echo json_encode($regiony);
//print '<pre>';
//var_dump($regiony);