Update phpdoc, minor formatting
This commit is contained in:
parent
4c4ca498ca
commit
c46486396c
@ -24,6 +24,7 @@ var popups = new Array();
|
|||||||
var polyOptions;
|
var polyOptions;
|
||||||
var mapOptions;
|
var mapOptions;
|
||||||
var loadedAPI = 'gmaps';
|
var loadedAPI = 'gmaps';
|
||||||
|
|
||||||
function init() {
|
function init() {
|
||||||
google.maps.visualRefresh = true;
|
google.maps.visualRefresh = true;
|
||||||
polyOptions = {
|
polyOptions = {
|
||||||
@ -152,6 +153,7 @@ function addChartEvent(chart) {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
//((52.20105108685229, 20.789387865580238), (52.292069558807135, 21.172192736185707))
|
//((52.20105108685229, 20.789387865580238), (52.292069558807135, 21.172192736185707))
|
||||||
function getBounds() {
|
function getBounds() {
|
||||||
var b = map.getBounds().toString();
|
var b = map.getBounds().toString();
|
||||||
|
@ -27,7 +27,8 @@ var loadedAPI = 'openlayers';
|
|||||||
function init() {
|
function init() {
|
||||||
wgs84 = new OpenLayers.Projection('EPSG:4326'); // from WGS 1984
|
wgs84 = new OpenLayers.Projection('EPSG:4326'); // from WGS 1984
|
||||||
mercator = new OpenLayers.Projection('EPSG:900913'); // to Mercator
|
mercator = new OpenLayers.Projection('EPSG:900913'); // to Mercator
|
||||||
var options = { controls: [
|
var options = {
|
||||||
|
controls: [
|
||||||
new OpenLayers.Control.ArgParser(), // default
|
new OpenLayers.Control.ArgParser(), // default
|
||||||
new OpenLayers.Control.Attribution(), // default
|
new OpenLayers.Control.Attribution(), // default
|
||||||
new OpenLayers.Control.LayerSwitcher(),
|
new OpenLayers.Control.LayerSwitcher(),
|
||||||
|
@ -19,9 +19,15 @@
|
|||||||
|
|
||||||
require_once("auth.php"); // sets $mysqli, $user
|
require_once("auth.php"); // sets $mysqli, $user
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Exit with error message
|
||||||
|
*
|
||||||
|
* @param string $errorMessage Message
|
||||||
|
*/
|
||||||
function exitWithError($errorMessage) {
|
function exitWithError($errorMessage) {
|
||||||
return exitWithStatus(true, $errorMessage);
|
return exitWithStatus(true, $errorMessage);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Exit with xml response
|
* Exit with xml response
|
||||||
* @param boolean $isError Error if true
|
* @param boolean $isError Error if true
|
||||||
|
@ -17,6 +17,12 @@
|
|||||||
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set response error status and message
|
||||||
|
*
|
||||||
|
* @param array $response Respons
|
||||||
|
* @param string $message Message
|
||||||
|
*/
|
||||||
function setError(&$response, $message) {
|
function setError(&$response, $message) {
|
||||||
$response['error'] = true;
|
$response['error'] = true;
|
||||||
$response['message'] = $message;
|
$response['message'] = $message;
|
||||||
|
13
download.php
13
download.php
@ -20,6 +20,13 @@
|
|||||||
require_once("auth.php"); // sets $mysqli, $user
|
require_once("auth.php"); // sets $mysqli, $user
|
||||||
require_once("helpers/position.php");
|
require_once("helpers/position.php");
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add kml marker style element
|
||||||
|
*
|
||||||
|
* @param XMLWriter $xml Writer object
|
||||||
|
* @param string $name Color name
|
||||||
|
* @param string $url Url
|
||||||
|
*/
|
||||||
function addStyle($xml, $name, $url) {
|
function addStyle($xml, $name, $url) {
|
||||||
$xml->startElement("Style");
|
$xml->startElement("Style");
|
||||||
$xml->writeAttribute("id", $name."Style");
|
$xml->writeAttribute("id", $name."Style");
|
||||||
@ -32,6 +39,12 @@ function addStyle($xml, $name, $url) {
|
|||||||
$xml->endElement();
|
$xml->endElement();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Convert seconds to [day], hour, minute, second string
|
||||||
|
*
|
||||||
|
* @param [type] $s Number of seconds
|
||||||
|
* @return string [d ]hhmmss
|
||||||
|
*/
|
||||||
function toHMS($s) {
|
function toHMS($s) {
|
||||||
$d = floor($s / 86400);
|
$d = floor($s / 86400);
|
||||||
$h = floor(($s % 86400) / 3600);
|
$h = floor(($s % 86400) / 3600);
|
||||||
|
@ -17,6 +17,9 @@
|
|||||||
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handles config values
|
||||||
|
*/
|
||||||
class uConfig {
|
class uConfig {
|
||||||
// version number
|
// version number
|
||||||
static $version = "0.2-beta";
|
static $version = "0.2-beta";
|
||||||
@ -77,12 +80,18 @@ class uConfig {
|
|||||||
private static $fileLoaded = false;
|
private static $fileLoaded = false;
|
||||||
public static $rootDir;
|
public static $rootDir;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor
|
||||||
|
*/
|
||||||
public function __construct() {
|
public function __construct() {
|
||||||
self::$rootDir = dirname(__DIR__);
|
self::$rootDir = dirname(__DIR__);
|
||||||
$this->setFromFile();
|
$this->setFromFile();
|
||||||
$this->setFromCookies();
|
$this->setFromCookies();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Read config values from "/config.php" file
|
||||||
|
*/
|
||||||
private function setFromFile() {
|
private function setFromFile() {
|
||||||
$configFile = self::$rootDir . "/config.php";
|
$configFile = self::$rootDir . "/config.php";
|
||||||
if (self::$fileLoaded || !file_exists($configFile)) {
|
if (self::$fileLoaded || !file_exists($configFile)) {
|
||||||
@ -115,6 +124,10 @@ class uConfig {
|
|||||||
self::$public_tracks = true;
|
self::$public_tracks = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Read config values stored in cookies
|
||||||
|
*/
|
||||||
private function setFromCookies() {
|
private function setFromCookies() {
|
||||||
if (isset($_COOKIE["ulogger_api"])) { self::$mapapi = $_COOKIE["ulogger_api"]; }
|
if (isset($_COOKIE["ulogger_api"])) { self::$mapapi = $_COOKIE["ulogger_api"]; }
|
||||||
if (isset($_COOKIE["ulogger_lang"])) { self::$lang = $_COOKIE["ulogger_lang"]; }
|
if (isset($_COOKIE["ulogger_lang"])) { self::$lang = $_COOKIE["ulogger_lang"]; }
|
||||||
|
@ -18,11 +18,26 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
require_once (__DIR__ . "/config.php");
|
require_once (__DIR__ . "/config.php");
|
||||||
|
|
||||||
|
/**
|
||||||
|
* mysqli wrapper
|
||||||
|
*/
|
||||||
class uDb extends mysqli {
|
class uDb extends mysqli {
|
||||||
// singleton instance
|
/**
|
||||||
|
* Singleton instance
|
||||||
|
*
|
||||||
|
* @var mysqli Object instance
|
||||||
|
*/
|
||||||
protected static $instance;
|
protected static $instance;
|
||||||
|
|
||||||
// private constuctor
|
/**
|
||||||
|
* Private constuctor
|
||||||
|
*
|
||||||
|
* @param string $host
|
||||||
|
* @param string $user
|
||||||
|
* @param string $pass
|
||||||
|
* @param string $name
|
||||||
|
*/
|
||||||
private function __construct($host, $user, $pass, $name) {
|
private function __construct($host, $user, $pass, $name) {
|
||||||
parent::__construct($host, $user, $pass, $name);
|
parent::__construct($host, $user, $pass, $name);
|
||||||
if ($this->connect_error) {
|
if ($this->connect_error) {
|
||||||
@ -35,7 +50,9 @@ class uDb extends mysqli {
|
|||||||
$this->set_charset('utf8');
|
$this->set_charset('utf8');
|
||||||
}
|
}
|
||||||
|
|
||||||
// returns singleton instance
|
/**
|
||||||
|
* Returns singleton instance
|
||||||
|
*/
|
||||||
public static function getInstance() {
|
public static function getInstance() {
|
||||||
if (!self::$instance) {
|
if (!self::$instance) {
|
||||||
$config = new uConfig();
|
$config = new uConfig();
|
||||||
|
@ -19,6 +19,9 @@
|
|||||||
|
|
||||||
require_once(__DIR__ . "/db.php");
|
require_once(__DIR__ . "/db.php");
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Positions handling
|
||||||
|
*/
|
||||||
class uPosition {
|
class uPosition {
|
||||||
public $id;
|
public $id;
|
||||||
public $time;
|
public $time;
|
||||||
@ -40,6 +43,10 @@ class uPosition {
|
|||||||
|
|
||||||
private static $db;
|
private static $db;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor
|
||||||
|
* @param integer $positionId Position id
|
||||||
|
*/
|
||||||
public function __construct($positionId = NULL) {
|
public function __construct($positionId = NULL) {
|
||||||
|
|
||||||
self::$db = uDB::getInstance();
|
self::$db = uDB::getInstance();
|
||||||
@ -57,6 +64,23 @@ class uPosition {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add position
|
||||||
|
*
|
||||||
|
* @param int $userId
|
||||||
|
* @param int $trackId
|
||||||
|
* @param int $time Unix time stamp
|
||||||
|
* @param double $lat
|
||||||
|
* @param double $lon
|
||||||
|
* @param double $altitude
|
||||||
|
* @param double $speed
|
||||||
|
* @param double $bearing
|
||||||
|
* @param int $accuracy
|
||||||
|
* @param string $provider
|
||||||
|
* @param string $comment
|
||||||
|
* @param int $imageId
|
||||||
|
* @return int|bool New position id in database, false on error
|
||||||
|
*/
|
||||||
public function add($userId, $trackId, $time, $lat, $lon, $altitude, $speed, $bearing, $accuracy, $provider, $comment, $imageId) {
|
public function add($userId, $trackId, $time, $lat, $lon, $altitude, $speed, $bearing, $accuracy, $provider, $comment, $imageId) {
|
||||||
$positionId = false;
|
$positionId = false;
|
||||||
if (!is_null($lat) && !is_null($lon) && !is_null($time) && !empty($userId) && !empty($trackId)) {
|
if (!is_null($lat) && !is_null($lon) && !is_null($time) && !empty($userId) && !empty($trackId)) {
|
||||||
@ -77,6 +101,12 @@ class uPosition {
|
|||||||
return $positionId;
|
return $positionId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fill class properties with last position data from database
|
||||||
|
* (for given user if specified)
|
||||||
|
*
|
||||||
|
* @param int $userId Optional user id
|
||||||
|
*/
|
||||||
public function getLast($userId = NULL) {
|
public function getLast($userId = NULL) {
|
||||||
if (!empty($userId)) {
|
if (!empty($userId)) {
|
||||||
$where = "WHERE p.user_id = ?";
|
$where = "WHERE p.user_id = ?";
|
||||||
@ -96,6 +126,13 @@ class uPosition {
|
|||||||
$this->loadWithQuery($query, $params);
|
$this->loadWithQuery($query, $params);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get array of all positions
|
||||||
|
*
|
||||||
|
* @param int $userId Optional limit to given user id
|
||||||
|
* @param int $trackId Optional limit to given track id
|
||||||
|
* @return array|bool Array of uPosition positions, false on error
|
||||||
|
*/
|
||||||
public function getAll($userId = NULL, $trackId = NULL) {
|
public function getAll($userId = NULL, $trackId = NULL) {
|
||||||
$rules = [];
|
$rules = [];
|
||||||
if (!empty($userId)) {
|
if (!empty($userId)) {
|
||||||
@ -129,7 +166,12 @@ class uPosition {
|
|||||||
return $positionsArr;
|
return $positionsArr;
|
||||||
}
|
}
|
||||||
|
|
||||||
// haversine distance to target point
|
/**
|
||||||
|
* Calculate distance to target point using haversine formula
|
||||||
|
*
|
||||||
|
* @param uPosition $target Target position
|
||||||
|
* @return int Distance in meters
|
||||||
|
*/
|
||||||
public function distanceTo($target) {
|
public function distanceTo($target) {
|
||||||
$lat1 = deg2rad($this->latitude);
|
$lat1 = deg2rad($this->latitude);
|
||||||
$lon1 = deg2rad($this->longitude);
|
$lon1 = deg2rad($this->longitude);
|
||||||
@ -141,10 +183,22 @@ class uPosition {
|
|||||||
return $bearing * 6371000;
|
return $bearing * 6371000;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Calculate time elapsed since target point
|
||||||
|
*
|
||||||
|
* @param uPosition $target Target position
|
||||||
|
* @return int Number of seconds
|
||||||
|
*/
|
||||||
public function secondsTo($target) {
|
public function secondsTo($target) {
|
||||||
return strtotime($this->time) - strtotime($target->time);
|
return strtotime($this->time) - strtotime($target->time);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Convert database row to uPosition
|
||||||
|
*
|
||||||
|
* @param array $row Row
|
||||||
|
* @return uPosition Position
|
||||||
|
*/
|
||||||
private function rowToObject($row) {
|
private function rowToObject($row) {
|
||||||
$position = new uPosition();
|
$position = new uPosition();
|
||||||
$position->id = $row['id'];
|
$position->id = $row['id'];
|
||||||
@ -166,6 +220,12 @@ class uPosition {
|
|||||||
return $position;
|
return $position;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fill class properties with database query result
|
||||||
|
*
|
||||||
|
* @param string $query Query
|
||||||
|
* @param array|null $bindParams Optional array of bind parameters (types, params)
|
||||||
|
*/
|
||||||
private function loadWithQuery($query, $bindParams = NULL) {
|
private function loadWithQuery($query, $bindParams = NULL) {
|
||||||
$stmt = self::$db->prepare($query);
|
$stmt = self::$db->prepare($query);
|
||||||
if (is_array($bindParams) && ($types = array_shift($bindParams))) {
|
if (is_array($bindParams) && ($types = array_shift($bindParams))) {
|
||||||
|
@ -19,6 +19,9 @@
|
|||||||
|
|
||||||
require_once(__DIR__ . "/db.php");
|
require_once(__DIR__ . "/db.php");
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Track handling
|
||||||
|
*/
|
||||||
class uTrack {
|
class uTrack {
|
||||||
public $id;
|
public $id;
|
||||||
public $userId;
|
public $userId;
|
||||||
@ -29,6 +32,11 @@ class uTrack {
|
|||||||
|
|
||||||
private static $db;
|
private static $db;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor
|
||||||
|
*
|
||||||
|
* @param int $trackId Track id
|
||||||
|
*/
|
||||||
public function __construct($trackId = NULL) {
|
public function __construct($trackId = NULL) {
|
||||||
|
|
||||||
self::$db = uDB::getInstance();
|
self::$db = uDB::getInstance();
|
||||||
@ -46,6 +54,14 @@ class uTrack {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add new track
|
||||||
|
*
|
||||||
|
* @param string $userId User id
|
||||||
|
* @param string $name Name
|
||||||
|
* @param string $comment Optional comment
|
||||||
|
* @return int|bool New track id, false on error
|
||||||
|
*/
|
||||||
public function add($userId, $name, $comment = NULL) {
|
public function add($userId, $name, $comment = NULL) {
|
||||||
$trackId = false;
|
$trackId = false;
|
||||||
if (!empty($userId) && !empty($name)) {
|
if (!empty($userId) && !empty($name)) {
|
||||||
@ -61,6 +77,12 @@ class uTrack {
|
|||||||
return $trackId;
|
return $trackId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get all tracks
|
||||||
|
*
|
||||||
|
* @param int $userId Optional limit to user id
|
||||||
|
* @return array|bool Array of uTrack tracks, false on error
|
||||||
|
*/
|
||||||
public function getAll($userId = NULL) {
|
public function getAll($userId = NULL) {
|
||||||
if (!empty($userId)) {
|
if (!empty($userId)) {
|
||||||
$where = "WHERE user_id='" . self::$db->real_escape_string($userId) ."'";
|
$where = "WHERE user_id='" . self::$db->real_escape_string($userId) ."'";
|
||||||
@ -80,6 +102,12 @@ class uTrack {
|
|||||||
return $trackArr;
|
return $trackArr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Convert database row to uTrack
|
||||||
|
*
|
||||||
|
* @param array $row Row
|
||||||
|
* @return uTrack Track
|
||||||
|
*/
|
||||||
private function rowToObject($row) {
|
private function rowToObject($row) {
|
||||||
$track = new uTrack();
|
$track = new uTrack();
|
||||||
$track->id = $row['id'];
|
$track->id = $row['id'];
|
||||||
|
@ -16,10 +16,12 @@
|
|||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
require_once (__DIR__ . "/config.php");
|
require_once (__DIR__ . "/config.php");
|
||||||
require_once (__DIR__ . "/db.php");
|
require_once (__DIR__ . "/db.php");
|
||||||
|
|
||||||
|
/**
|
||||||
|
* User handling routines
|
||||||
|
*/
|
||||||
class uUser {
|
class uUser {
|
||||||
public $id;
|
public $id;
|
||||||
public $login;
|
public $login;
|
||||||
@ -29,6 +31,11 @@ class uUser {
|
|||||||
|
|
||||||
private static $db;
|
private static $db;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor
|
||||||
|
*
|
||||||
|
* @param string $login Login
|
||||||
|
*/
|
||||||
public function __construct($login = NULL) {
|
public function __construct($login = NULL) {
|
||||||
self::$db = uDB::getInstance();
|
self::$db = uDB::getInstance();
|
||||||
if (!empty($login)) {
|
if (!empty($login)) {
|
||||||
@ -44,6 +51,13 @@ class uUser {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add new user
|
||||||
|
*
|
||||||
|
* @param string $login Login
|
||||||
|
* @param string $hash Password hash
|
||||||
|
* @return int|bool New user id, false on error
|
||||||
|
*/
|
||||||
public function add($login, $hash) {
|
public function add($login, $hash) {
|
||||||
$userid = false;
|
$userid = false;
|
||||||
if (!empty($login) && !empty($hash)) {
|
if (!empty($login) && !empty($hash)) {
|
||||||
@ -59,6 +73,12 @@ class uUser {
|
|||||||
return $userid;
|
return $userid;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set user password
|
||||||
|
*
|
||||||
|
* @param string $hash Hash
|
||||||
|
* @return bool True on success, false otherwise
|
||||||
|
*/
|
||||||
public function setPass($hash) {
|
public function setPass($hash) {
|
||||||
$ret = false;
|
$ret = false;
|
||||||
$sql = "UPDATE users SET password = ? WHERE login = ?";
|
$sql = "UPDATE users SET password = ? WHERE login = ?";
|
||||||
@ -72,14 +92,26 @@ class uUser {
|
|||||||
return $ret;
|
return $ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if given password matches user's one
|
||||||
|
*
|
||||||
|
* @param String $password Password
|
||||||
|
* @return bool True if matches, false otherwise
|
||||||
|
*/
|
||||||
public function validPassword($password) {
|
public function validPassword($password) {
|
||||||
return password_verify($password, $this->hash);
|
return password_verify($password, $this->hash);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Store uUser object in session
|
||||||
|
*/
|
||||||
public function storeInSession() {
|
public function storeInSession() {
|
||||||
$_SESSION['user'] = $this;
|
$_SESSION['user'] = $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fill uUser object properties from session data
|
||||||
|
*/
|
||||||
public function getFromSession() {
|
public function getFromSession() {
|
||||||
if (isset($_SESSION['user'])) {
|
if (isset($_SESSION['user'])) {
|
||||||
$sessionUser = $_SESSION['user'];
|
$sessionUser = $_SESSION['user'];
|
||||||
@ -91,6 +123,11 @@ class uUser {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get all users
|
||||||
|
*
|
||||||
|
* @return array|bool Array of uUser users, false on error
|
||||||
|
*/
|
||||||
public function getAll() {
|
public function getAll() {
|
||||||
$query = "SELECT id, login, password FROM users ORDER BY login";
|
$query = "SELECT id, login, password FROM users ORDER BY login";
|
||||||
$result = self::$db->query($query);
|
$result = self::$db->query($query);
|
||||||
@ -105,6 +142,12 @@ class uUser {
|
|||||||
return $userArr;
|
return $userArr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Convert database row to uUser
|
||||||
|
*
|
||||||
|
* @param array $row Row
|
||||||
|
* @return uUser User
|
||||||
|
*/
|
||||||
private function rowToObject($row) {
|
private function rowToObject($row) {
|
||||||
$user = new uUser();
|
$user = new uUser();
|
||||||
$user->id = $row['id'];
|
$user->id = $row['id'];
|
||||||
@ -115,10 +158,15 @@ class uUser {
|
|||||||
return $user;
|
return $user;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Is given login admin user
|
||||||
|
*
|
||||||
|
* @param string $login Login
|
||||||
|
* @return bool True if admin, false otherwise
|
||||||
|
*/
|
||||||
private function isAdmin($login) {
|
private function isAdmin($login) {
|
||||||
$config = new uConfig();
|
$config = new uConfig();
|
||||||
return (!empty($config::$admin_user) && $config::$admin_user == $login);
|
return (!empty($config::$admin_user) && $config::$admin_user == $login);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
@ -17,7 +17,6 @@
|
|||||||
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
$lang["title"] = "• μlogger •";
|
$lang["title"] = "• μlogger •";
|
||||||
$lang["private"] = "Aby się zalogować musisz podać login i hasło";
|
$lang["private"] = "Aby się zalogować musisz podać login i hasło";
|
||||||
$lang["authfail"] = "błędny login lub hasło";
|
$lang["authfail"] = "błędny login lub hasło";
|
||||||
|
@ -27,4 +27,5 @@ session_destroy();
|
|||||||
$ssl = ((!isset($_SERVER['HTTPS']) || $_SERVER['HTTPS'] == "" || $_SERVER['HTTPS'] == "off") ? "http" : "https");
|
$ssl = ((!isset($_SERVER['HTTPS']) || $_SERVER['HTTPS'] == "" || $_SERVER['HTTPS'] == "off") ? "http" : "https");
|
||||||
$url = str_replace("//", "/", $_SERVER['HTTP_HOST'].dirname($_SERVER['SCRIPT_NAME'])."/index.php");
|
$url = str_replace("//", "/", $_SERVER['HTTP_HOST'].dirname($_SERVER['SCRIPT_NAME'])."/index.php");
|
||||||
header("Location: $ssl://$url");
|
header("Location: $ssl://$url");
|
||||||
|
|
||||||
?>
|
?>
|
34
main.js
34
main.js
@ -178,6 +178,18 @@ function getPopupHtml(p, i, count) {
|
|||||||
} else if (p.provider == 'network') {
|
} else if (p.provider == 'network') {
|
||||||
provider = ' (<img class="icon" alt="' + lang['network'] + '" title="' + lang['network'] + '" src="images/network_dark.svg" />)';
|
provider = ' (<img class="icon" alt="' + lang['network'] + '" title="' + lang['network'] + '" src="images/network_dark.svg" />)';
|
||||||
}
|
}
|
||||||
|
var stats = '';
|
||||||
|
if (latest == 0) {
|
||||||
|
stats =
|
||||||
|
'<div id="pright">' +
|
||||||
|
'<img class="icon" src="images/stats_blue.svg" style="padding-left: 3em;" /><br />' +
|
||||||
|
'<img class="icon" alt="' + lang['ttime'] + '" title="' + lang['ttime'] + '" src="images/time_blue.svg" /> ' +
|
||||||
|
p.totalSeconds.toHMS() + '<br />' +
|
||||||
|
'<img class="icon" alt="' + lang['aspeed'] + '" title="' + lang['aspeed'] + '" src="images/speed_blue.svg" /> ' +
|
||||||
|
((p.totalSeconds > 0) ? ((p.totalMeters / p.totalSeconds).toKmH() * factor_kmh).toFixed() : 0) + ' ' + unit_kmh + '<br />' +
|
||||||
|
'<img class="icon" alt="' + lang['tdistance'] + '" title="' + lang['tdistance'] + '" src="images/distance_blue.svg" /> ' +
|
||||||
|
(p.totalMeters.toKm() * factor_km).toFixed(2) + ' ' + unit_km + '<br />' + '</div>';
|
||||||
|
}
|
||||||
popup =
|
popup =
|
||||||
'<div id="popup">' +
|
'<div id="popup">' +
|
||||||
'<div id="pheader">' +
|
'<div id="pheader">' +
|
||||||
@ -189,18 +201,14 @@ function getPopupHtml(p, i, count) {
|
|||||||
'<div id="pleft">' +
|
'<div id="pleft">' +
|
||||||
'<img class="icon" alt="' + lang['time'] + '" title="' + lang['time'] + '" src="images/calendar_dark.svg" /> ' + date + '<br />' +
|
'<img class="icon" alt="' + lang['time'] + '" title="' + lang['time'] + '" src="images/calendar_dark.svg" /> ' + date + '<br />' +
|
||||||
'<img class="icon" alt="' + lang['time'] + '" title="' + lang['time'] + '" src="images/clock_dark.svg" /> ' + time + '<br />' +
|
'<img class="icon" alt="' + lang['time'] + '" title="' + lang['time'] + '" src="images/clock_dark.svg" /> ' + time + '<br />' +
|
||||||
((p.speed != null)?'<img class="icon" alt="'+lang['speed']+'" title="'+lang['speed']+'" src="images/speed_dark.svg" /> '+(p.speed.toKmH()*factor_kmh)+' '+unit_kmh+'<br />':'')+
|
((p.speed != null) ? '<img class="icon" alt="' + lang['speed'] + '" title="' + lang['speed'] + '" src="images/speed_dark.svg" /> ' +
|
||||||
((p.altitude != null)?'<img class="icon" alt="'+lang['altitude']+'" title="'+lang['altitude']+'" src="images/altitude_dark.svg" /> '+(p.altitude*factor_m).toFixed()+' '+unit_m+'<br />':'')+
|
(p.speed.toKmH() * factor_kmh) + ' ' + unit_kmh + '<br />' : '') +
|
||||||
((p.accuracy != null)?'<img class="icon" alt="'+lang['accuracy']+'" title="'+lang['accuracy']+'" src="images/accuracy_dark.svg" /> '+(p.accuracy*factor_m).toFixed()+' '+unit_m+provider+'<br />':'')+
|
((p.altitude != null) ? '<img class="icon" alt="' + lang['altitude'] + '" title="' + lang['altitude'] + '" src="images/altitude_dark.svg" /> ' +
|
||||||
|
(p.altitude * factor_m).toFixed() + ' ' + unit_m + '<br />' : '') +
|
||||||
|
((p.accuracy != null) ? '<img class="icon" alt="' + lang['accuracy'] + '" title="' + lang['accuracy'] + '" src="images/accuracy_dark.svg" /> ' +
|
||||||
|
(p.accuracy * factor_m).toFixed() + ' ' + unit_m + provider + '<br />' : '') +
|
||||||
'</div>' +
|
'</div>' +
|
||||||
((latest==0)?
|
stats +
|
||||||
('<div id="pright">'+
|
|
||||||
'<img class="icon" src="images/stats_blue.svg" style="padding-left: 3em;" /><br />'+
|
|
||||||
'<img class="icon" alt="'+lang['ttime']+'" title="'+lang['ttime']+'" src="images/time_blue.svg" /> '+p.totalSeconds.toHMS()+'<br />'+
|
|
||||||
'<img class="icon" alt="'+lang['aspeed']+'" title="'+lang['aspeed']+'" src="images/speed_blue.svg" /> '+((p.totalSeconds>0)?((p.totalMeters/p.totalSeconds).toKmH()*factor_kmh).toFixed():0)+' '+unit_kmh+'<br />'+
|
|
||||||
'<img class="icon" alt="'+lang['tdistance']+'" title="'+lang['tdistance']+'" src="images/distance_blue.svg" /> '+(p.totalMeters.toKm()*factor_km).toFixed(2)+' '+unit_km+'<br />'+'</div>')
|
|
||||||
:
|
|
||||||
'')+
|
|
||||||
'<div id="pfooter">' + lang['point'] + ' ' + (i + 1) + ' ' + lang['of'] + ' ' + count + '</div>' +
|
'<div id="pfooter">' + lang['point'] + ' ' + (i + 1) + ' ' + lang['of'] + ' ' + count + '</div>' +
|
||||||
'</div></div>';
|
'</div></div>';
|
||||||
return popup;
|
return popup;
|
||||||
@ -227,7 +235,6 @@ function getNode(p,name) {
|
|||||||
return ((p.getElementsByTagName(name)[0].childNodes[0]) ? p.getElementsByTagName(name)[0].childNodes[0].nodeValue : null);
|
return ((p.getElementsByTagName(name)[0].childNodes[0]) ? p.getElementsByTagName(name)[0].childNodes[0].nodeValue : null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// seconds to (d) H:M:S
|
// seconds to (d) H:M:S
|
||||||
Number.prototype.toHMS = function () {
|
Number.prototype.toHMS = function () {
|
||||||
var s = this;
|
var s = this;
|
||||||
@ -238,10 +245,12 @@ Number.prototype.toHMS = function(){
|
|||||||
|
|
||||||
return ((d > 0) ? (d + ' d ') : '') + (('00' + h).slice(-2)) + ':' + (('00' + m).slice(-2)) + ':' + (('00' + s).slice(-2)) + '';
|
return ((d > 0) ? (d + ' d ') : '') + (('00' + h).slice(-2)) + ':' + (('00' + m).slice(-2)) + ':' + (('00' + s).slice(-2)) + '';
|
||||||
}
|
}
|
||||||
|
|
||||||
// meters to km
|
// meters to km
|
||||||
Number.prototype.toKm = function () {
|
Number.prototype.toKm = function () {
|
||||||
return Math.round(this / 10) / 100;
|
return Math.round(this / 10) / 100;
|
||||||
}
|
}
|
||||||
|
|
||||||
// m/s to km/h
|
// m/s to km/h
|
||||||
Number.prototype.toKmH = function () {
|
Number.prototype.toKmH = function () {
|
||||||
return Math.round(this * 3600 / 10) / 100;
|
return Math.round(this * 3600 / 10) / 100;
|
||||||
@ -369,6 +378,7 @@ function loadMapAPI(api) {
|
|||||||
addScript(url[0]);
|
addScript(url[0]);
|
||||||
waitAndLoad(api, url);
|
waitAndLoad(api, url);
|
||||||
}
|
}
|
||||||
|
|
||||||
var loadTime = 0;
|
var loadTime = 0;
|
||||||
function waitAndLoad(api, url) {
|
function waitAndLoad(api, url) {
|
||||||
// wait till first script loaded
|
// wait till first script loaded
|
||||||
|
Loading…
x
Reference in New Issue
Block a user