Reorganize files into subfolders
This commit is contained in:
parent
50e066e269
commit
5318686626
11
auth.php
11
auth.php
@ -17,13 +17,14 @@
|
||||
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
require_once("helpers/config.php");
|
||||
define("ROOT_DIR", __DIR__);
|
||||
require_once(ROOT_DIR . "/helpers/config.php");
|
||||
$config = new uConfig();
|
||||
|
||||
require_once("lang.php");
|
||||
require_once("helpers/db.php");
|
||||
require_once(ROOT_DIR . "/lang.php");
|
||||
require_once(ROOT_DIR . "/helpers/db.php");
|
||||
$mysqli = uDb::getInstance();
|
||||
require_once($config::$rootDir . "/helpers/user.php");
|
||||
require_once(ROOT_DIR . "/helpers/user.php");
|
||||
|
||||
session_name('ulogger');
|
||||
session_start();
|
||||
@ -57,7 +58,7 @@ if (!$user->isValid && ($config::$require_authentication || defined('headless'))
|
||||
<title>' . $lang["title"] . '</title>
|
||||
<meta http-equiv="Content-type" content="text/html;charset=UTF-8">
|
||||
<meta name="viewport" content="initial-scale=1.0, user-scalable=no">
|
||||
<link rel="stylesheet" type="text/css" href="main.css">
|
||||
<link rel="stylesheet" type="text/css" href="css/main.css">
|
||||
<script type="text/javascript">
|
||||
function focus() {
|
||||
document.forms[0].elements[0].focus();
|
||||
|
@ -29,7 +29,7 @@ function setError(&$response, $message) {
|
||||
}
|
||||
|
||||
define("headless", true);
|
||||
require_once("../auth.php"); // sets $mysqli, $user
|
||||
require_once(dirname(__DIR__) . "/auth.php"); // sets $mysqli, $user
|
||||
|
||||
$action = isset($_REQUEST['action']) ? $_REQUEST['action'] : null;
|
||||
$response = [ 'error' => false ];
|
||||
@ -64,7 +64,7 @@ switch ($action) {
|
||||
setError($response, "missing required parameter");
|
||||
break;
|
||||
}
|
||||
require_once("../helpers/track.php");
|
||||
require_once(ROOT_DIR . "/helpers/track.php");
|
||||
$track = new uTrack();
|
||||
$trackId = $track->add($user->id, $trackName);
|
||||
if ($trackId === false) {
|
||||
@ -94,7 +94,7 @@ switch ($action) {
|
||||
break;
|
||||
}
|
||||
|
||||
require_once("../helpers/position.php");
|
||||
require_once(ROOT_DIR . "/helpers/position.php");
|
||||
$position = new uPosition();
|
||||
$positionId = $position->add($user->id, $trackId,
|
||||
$time, $lat, $lon, $altitude, $speed, $bearing, $accuracy, $provider, $comment, $imageId);
|
||||
|
@ -78,13 +78,11 @@
|
||||
static $units = "metric";
|
||||
|
||||
private static $fileLoaded = false;
|
||||
public static $rootDir;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
public function __construct() {
|
||||
self::$rootDir = dirname(__DIR__);
|
||||
$this->setFromFile();
|
||||
$this->setFromCookies();
|
||||
}
|
||||
@ -93,7 +91,7 @@
|
||||
* Read config values from "/config.php" file
|
||||
*/
|
||||
private function setFromFile() {
|
||||
$configFile = self::$rootDir . "/config.php";
|
||||
$configFile = ROOT_DIR . "/config.php";
|
||||
if (self::$fileLoaded || !file_exists($configFile)) {
|
||||
return;
|
||||
}
|
||||
|
@ -17,7 +17,7 @@
|
||||
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
require_once (__DIR__ . "/config.php");
|
||||
require_once(ROOT_DIR . "/helpers/config.php");
|
||||
|
||||
/**
|
||||
* mysqli wrapper
|
||||
|
@ -17,7 +17,7 @@
|
||||
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
require_once(__DIR__ . "/db.php");
|
||||
require_once(ROOT_DIR . "/helpers/db.php");
|
||||
|
||||
/**
|
||||
* Positions handling
|
||||
|
@ -17,7 +17,7 @@
|
||||
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
require_once(__DIR__ . "/db.php");
|
||||
require_once(ROOT_DIR . "/helpers/db.php");
|
||||
|
||||
/**
|
||||
* Track handling
|
||||
|
@ -16,8 +16,8 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
require_once (__DIR__ . "/config.php");
|
||||
require_once (__DIR__ . "/db.php");
|
||||
require_once (ROOT_DIR . "/helpers/config.php");
|
||||
require_once (ROOT_DIR . "/helpers/db.php");
|
||||
|
||||
/**
|
||||
* User handling routines
|
||||
|
20
index.php
20
index.php
@ -17,9 +17,9 @@
|
||||
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
require_once("auth.php"); // sets $mysqli, $user
|
||||
require_once("helpers/position.php");
|
||||
require_once("helpers/track.php");
|
||||
require_once(__DIR__ . "/auth.php"); // sets $mysqli, $user
|
||||
require_once(ROOT_DIR . "/helpers/position.php");
|
||||
require_once(ROOT_DIR . "/helpers/track.php");
|
||||
|
||||
$displayUserId = NULL;
|
||||
$usersArr = [];
|
||||
@ -57,7 +57,7 @@
|
||||
<title><?= $lang["title"] ?></title>
|
||||
<meta http-equiv="Content-type" content="text/html;charset=UTF-8">
|
||||
<meta name="viewport" content="initial-scale=1.0, user-scalable=no">
|
||||
<link rel="stylesheet" type="text/css" href="main.css">
|
||||
<link rel="stylesheet" type="text/css" href="css/main.css">
|
||||
<script>
|
||||
var interval = '<?= $config::$interval ?>';
|
||||
var userid = '<?= ($displayUserId) ? $displayUserId : -1 ?>';
|
||||
@ -73,19 +73,19 @@
|
||||
var init_longitude = '<?= $config::$init_longitude ?>';
|
||||
var lang = <?= json_encode($lang) ?>;
|
||||
</script>
|
||||
<script type="text/javascript" src="main.js"></script>
|
||||
<script type="text/javascript" src="js/main.js"></script>
|
||||
|
||||
<?php if ($config::$mapapi == "gmaps"): ?>
|
||||
<script type="text/javascript" src="//maps.googleapis.com/maps/api/js<?= !empty($config::$gkey) ? "?key={$config::$gkey}" : "" ?>"></script>
|
||||
<script type="text/javascript" src="api_gmaps.js"></script>
|
||||
<script type="text/javascript" src="js/api_gmaps.js"></script>
|
||||
<?php else: ?>
|
||||
<script type="text/javascript" src="//openlayers.org/api/OpenLayers.js"></script>
|
||||
<script type="text/javascript" src="api_openlayers.js"></script>
|
||||
<script type="text/javascript" src="js/api_openlayers.js"></script>
|
||||
<?php endif; ?>
|
||||
<?php if ($user->isAdmin): ?>
|
||||
<script type="text/javascript" src="admin.js"></script>
|
||||
<script type="text/javascript" src="js/admin.js"></script>
|
||||
<?php endif; ?>
|
||||
<script type="text/javascript" src="pass.js"></script>
|
||||
<script type="text/javascript" src="js/pass.js"></script>
|
||||
<script type="text/javascript" src="//www.google.com/jsapi"></script>
|
||||
<script type="text/javascript">
|
||||
google.load('visualization', '1', { packages:['corechart'] });
|
||||
@ -101,7 +101,7 @@
|
||||
<a href="javascript:void(0);" onclick="userMenu()"><img class="icon" alt="<?= $lang["user"] ?>" src="images/user.svg"> <?= $user->login ?></a>
|
||||
<div id="user_dropdown" class="dropdown">
|
||||
<a href="javascript:void(0)" onclick="changePass()"><img class="icon" alt="<?= $lang["changepass"] ?>" src="images/lock.svg"> <?= $lang["changepass"] ?></a>
|
||||
<a href="logout.php"><img class="icon" alt="<?= $lang["logout"] ?>" src="images/poweroff.svg"> <?= $lang["logout"] ?></a>
|
||||
<a href="utils/logout.php"><img class="icon" alt="<?= $lang["logout"] ?>" src="images/poweroff.svg"> <?= $lang["logout"] ?></a>
|
||||
</div>
|
||||
</div>
|
||||
<?php else: ?>
|
||||
|
@ -58,7 +58,7 @@ function submitUser() {
|
||||
xhr = null;
|
||||
}
|
||||
}
|
||||
xhr.open('POST', 'adduser.php', true);
|
||||
xhr.open('POST', 'utils/adduser.php', true);
|
||||
xhr.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');
|
||||
xhr.send('login=' + login + '&pass=' + pass);
|
||||
return;
|
@ -126,7 +126,7 @@ function loadTrack(userid, trackid, update) {
|
||||
xhr = null;
|
||||
}
|
||||
}
|
||||
xhr.open('GET', 'getpositions.php?trackid=' + trackid + '&userid=' + userid, true);
|
||||
xhr.open('GET', 'utils/getpositions.php?trackid=' + trackid + '&userid=' + userid, true);
|
||||
xhr.send();
|
||||
}
|
||||
|
||||
@ -215,7 +215,7 @@ function getPopupHtml(p, i, count) {
|
||||
}
|
||||
|
||||
function load(type, userid, trackid) {
|
||||
var url = 'download.php?type=' + type + '&userid=' + userid + '&trackid=' + trackid;
|
||||
var url = 'utils/download.php?type=' + type + '&userid=' + userid + '&trackid=' + trackid;
|
||||
window.location.assign(url);
|
||||
}
|
||||
|
||||
@ -305,7 +305,7 @@ function getTracks(userid) {
|
||||
xhr = null;
|
||||
}
|
||||
}
|
||||
xhr.open('GET', 'gettracks.php?userid=' + userid, true);
|
||||
xhr.open('GET', 'utils/gettracks.php?userid=' + userid, true);
|
||||
xhr.send();
|
||||
}
|
||||
|
||||
@ -368,11 +368,11 @@ function loadMapAPI(api) {
|
||||
document.getElementById("map-canvas").innerHTML = '';
|
||||
var url = new Array();
|
||||
if (api == 'gmaps') {
|
||||
url.push('api_gmaps.js');
|
||||
url.push('js/api_gmaps.js');
|
||||
url.push('//maps.googleapis.com/maps/api/js?' + ((gkey !== null) ? ('key=' + gkey + '&') : '') + 'callback=init');
|
||||
}
|
||||
else {
|
||||
url.push('api_openlayers.js');
|
||||
url.push('js/api_openlayers.js');
|
||||
url.push('//openlayers.org/api/OpenLayers.js');
|
||||
}
|
||||
addScript(url[0]);
|
@ -58,7 +58,7 @@ function submitPass() {
|
||||
xhr = null;
|
||||
}
|
||||
}
|
||||
xhr.open('POST', 'changepass.php', true);
|
||||
xhr.open('POST', 'utils/changepass.php', true);
|
||||
xhr.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');
|
||||
xhr.send('oldpass=' + oldpass + '&pass=' + pass);
|
||||
return;
|
5
lang.php
5
lang.php
@ -17,6 +17,7 @@
|
||||
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
|
||||
// available languages
|
||||
$langsArr = [
|
||||
"en" => "English",
|
||||
@ -29,12 +30,12 @@
|
||||
];
|
||||
|
||||
// always load en base
|
||||
require_once("lang/en.php");
|
||||
require_once(ROOT_DIR . "/lang/en.php");
|
||||
|
||||
// override with translated strings if needed
|
||||
// missing strings will be displayed in English
|
||||
if ($config::$lang != "en" && array_key_exists($config::$lang, $langsArr)) {
|
||||
require_once("lang/{$config::$lang}.php");
|
||||
require_once(ROOT_DIR . "/lang/{$config::$lang}.php");
|
||||
}
|
||||
|
||||
?>
|
||||
|
@ -17,7 +17,7 @@
|
||||
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
require_once("auth.php"); // sets $mysqli, $user
|
||||
require_once(dirname(__DIR__) . "/auth.php"); // sets $mysqli, $user
|
||||
|
||||
/**
|
||||
* Exit with xml response
|
@ -17,7 +17,7 @@
|
||||
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
require_once("auth.php"); // sets $mysqli, $user
|
||||
require_once(dirname(__DIR__) . "/auth.php"); // sets $mysqli, $user
|
||||
|
||||
/**
|
||||
* Exit with error message
|
@ -17,8 +17,8 @@
|
||||
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
require_once("auth.php"); // sets $mysqli, $user
|
||||
require_once("helpers/position.php");
|
||||
require_once(dirname(__DIR__) . "/auth.php"); // sets $mysqli, $user
|
||||
require_once(ROOT_DIR . "/helpers/position.php");
|
||||
|
||||
/**
|
||||
* Add kml marker style element
|
@ -17,8 +17,8 @@
|
||||
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
require_once("auth.php"); // sets $mysqli, $user
|
||||
require_once("helpers/position.php");
|
||||
require_once(dirname(__DIR__) . "/auth.php"); // sets $mysqli, $user
|
||||
require_once(ROOT_DIR . "/helpers/position.php");
|
||||
|
||||
$userId = (isset($_REQUEST["userid"]) && is_numeric($_REQUEST["userid"])) ? $_REQUEST["userid"] : NULL;
|
||||
$trackId = (isset($_REQUEST["trackid"]) && is_numeric($_REQUEST["trackid"])) ? $_REQUEST["trackid"] : NULL;
|
@ -17,8 +17,8 @@
|
||||
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
require_once("auth.php"); // sets $mysqli, $user
|
||||
require_once("helpers/track.php");
|
||||
require_once(dirname(__DIR__) . "/auth.php"); // sets $mysqli, $user
|
||||
require_once(ROOT_DIR . "/helpers/track.php");
|
||||
|
||||
$userId = ((isset($_REQUEST["userid"]) && is_numeric($_REQUEST["userid"])) ? $_REQUEST["userid"] : 0);
|
||||
|
@ -25,7 +25,7 @@ if (isset($_COOKIE[session_name('ulogger') ])) {
|
||||
}
|
||||
session_destroy();
|
||||
$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(dirname($_SERVER['SCRIPT_NAME'])) . "/index.php");
|
||||
header("Location: $ssl://$url");
|
||||
|
||||
?>
|
Loading…
x
Reference in New Issue
Block a user