Remove unused references to mysqli object
This commit is contained in:
parent
8dd1dba649
commit
27a7fbe45d
4
auth.php
4
auth.php
@ -22,8 +22,6 @@ require_once(ROOT_DIR . "/helpers/config.php");
|
|||||||
$config = new uConfig();
|
$config = new uConfig();
|
||||||
|
|
||||||
require_once(ROOT_DIR . "/lang.php");
|
require_once(ROOT_DIR . "/lang.php");
|
||||||
require_once(ROOT_DIR . "/helpers/db.php");
|
|
||||||
$mysqli = uDb::getInstance();
|
|
||||||
require_once(ROOT_DIR . "/helpers/user.php");
|
require_once(ROOT_DIR . "/helpers/user.php");
|
||||||
|
|
||||||
session_name('ulogger');
|
session_name('ulogger');
|
||||||
@ -92,7 +90,6 @@ if (!$user->isValid && ($config::$require_authentication || defined('headless'))
|
|||||||
</body>
|
</body>
|
||||||
</html>';
|
</html>';
|
||||||
}
|
}
|
||||||
$mysqli->close();
|
|
||||||
exit();
|
exit();
|
||||||
} else {
|
} else {
|
||||||
// username submited
|
// username submited
|
||||||
@ -126,7 +123,6 @@ if (!$user->isValid && ($config::$require_authentication || defined('headless'))
|
|||||||
header("Location: $ssl://$url$error");
|
header("Location: $ssl://$url$error");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$mysqli->close();
|
|
||||||
exit();
|
exit();
|
||||||
}
|
}
|
||||||
/* end of authentication */
|
/* end of authentication */
|
||||||
|
@ -29,7 +29,7 @@ function setError(&$response, $message) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
define("headless", true);
|
define("headless", true);
|
||||||
require_once(dirname(__DIR__) . "/auth.php"); // sets $mysqli, $user
|
require_once(dirname(__DIR__) . "/auth.php"); // sets $user
|
||||||
|
|
||||||
$action = isset($_REQUEST['action']) ? $_REQUEST['action'] : null;
|
$action = isset($_REQUEST['action']) ? $_REQUEST['action'] : null;
|
||||||
$response = [ 'error' => false ];
|
$response = [ 'error' => false ];
|
||||||
@ -105,8 +105,6 @@ switch ($action) {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
$mysqli->close();
|
|
||||||
|
|
||||||
header('Content-Type: application/json');
|
header('Content-Type: application/json');
|
||||||
echo json_encode($response);
|
echo json_encode($response);
|
||||||
exit();
|
exit();
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
* 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__ . "/auth.php"); // sets $mysqli, $user
|
require_once(__DIR__ . "/auth.php"); // sets $user
|
||||||
require_once(ROOT_DIR . "/helpers/position.php");
|
require_once(ROOT_DIR . "/helpers/position.php");
|
||||||
require_once(ROOT_DIR . "/helpers/track.php");
|
require_once(ROOT_DIR . "/helpers/track.php");
|
||||||
|
|
||||||
@ -49,7 +49,6 @@
|
|||||||
$displayTrackId = NULL;
|
$displayTrackId = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
$mysqli->close();
|
|
||||||
?>
|
?>
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html>
|
<html>
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
* 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(dirname(__DIR__) . "/auth.php"); // sets $mysqli, $user
|
require_once(dirname(__DIR__) . "/auth.php"); // sets $user
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Exit with error message
|
* Exit with error message
|
||||||
@ -47,7 +47,6 @@
|
|||||||
$xml->endElement();
|
$xml->endElement();
|
||||||
$xml->endDocument();
|
$xml->endDocument();
|
||||||
$xml->flush();
|
$xml->flush();
|
||||||
$mysqli->close();
|
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
* 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(dirname(__DIR__) . "/auth.php"); // sets $mysqli, $user, $config
|
require_once(dirname(__DIR__) . "/auth.php"); // sets $user, $config
|
||||||
require_once(ROOT_DIR . "/helpers/position.php");
|
require_once(ROOT_DIR . "/helpers/position.php");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -59,7 +59,6 @@ $trackId = (isset($_REQUEST["trackid"]) && is_numeric($_REQUEST["trackid"])) ? (
|
|||||||
|
|
||||||
if (!$config::$public_tracks && !$user->isAdmin && $user->id !== $userId) {
|
if (!$config::$public_tracks && !$user->isAdmin && $user->id !== $userId) {
|
||||||
// unauthorized
|
// unauthorized
|
||||||
$mysqli->close();
|
|
||||||
exit();
|
exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -84,7 +83,6 @@ if ($trackId && $userId) {
|
|||||||
$positionsArr = [];
|
$positionsArr = [];
|
||||||
$positionsArr = $position->getAll($userId, $trackId);
|
$positionsArr = $position->getAll($userId, $trackId);
|
||||||
if (empty($positionsArr)) {
|
if (empty($positionsArr)) {
|
||||||
$mysqli->close();
|
|
||||||
exit();
|
exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -227,5 +225,4 @@ if ($trackId && $userId) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
$mysqli->close();
|
|
||||||
?>
|
?>
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
* 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(dirname(__DIR__) . "/auth.php"); // sets $mysqli, $user, $config
|
require_once(dirname(__DIR__) . "/auth.php"); // sets $user, $config
|
||||||
require_once(ROOT_DIR . "/helpers/position.php");
|
require_once(ROOT_DIR . "/helpers/position.php");
|
||||||
|
|
||||||
$userId = (isset($_REQUEST["userid"]) && is_numeric($_REQUEST["userid"])) ? (int) $_REQUEST["userid"] : NULL;
|
$userId = (isset($_REQUEST["userid"]) && is_numeric($_REQUEST["userid"])) ? (int) $_REQUEST["userid"] : NULL;
|
||||||
@ -74,5 +74,4 @@ if ($userId) {
|
|||||||
$xml->flush();
|
$xml->flush();
|
||||||
}
|
}
|
||||||
|
|
||||||
$mysqli->close();
|
|
||||||
?>
|
?>
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
* 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(dirname(__DIR__) . "/auth.php"); // sets $mysqli, $user, $config
|
require_once(dirname(__DIR__) . "/auth.php"); // sets $user, $config
|
||||||
require_once(ROOT_DIR . "/helpers/track.php");
|
require_once(ROOT_DIR . "/helpers/track.php");
|
||||||
|
|
||||||
$userId = (isset($_REQUEST["userid"]) && is_numeric($_REQUEST["userid"])) ? (int) $_REQUEST["userid"] : NULL;
|
$userId = (isset($_REQUEST["userid"]) && is_numeric($_REQUEST["userid"])) ? (int) $_REQUEST["userid"] : NULL;
|
||||||
@ -51,5 +51,4 @@ if ($userId) {
|
|||||||
$xml->flush();
|
$xml->flush();
|
||||||
}
|
}
|
||||||
|
|
||||||
$mysqli->close();
|
|
||||||
?>
|
?>
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
* 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(dirname(__DIR__) . "/auth.php"); // sets $mysqli, $user
|
require_once(dirname(__DIR__) . "/auth.php"); // sets $user
|
||||||
require_once(ROOT_DIR . "/helpers/track.php");
|
require_once(ROOT_DIR . "/helpers/track.php");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -56,17 +56,14 @@
|
|||||||
switch ($action) {
|
switch ($action) {
|
||||||
|
|
||||||
case 'update':
|
case 'update':
|
||||||
if (empty($trackName)) {
|
if (empty($trackName) || $track->update($trackName) === false) {
|
||||||
exitWithStatus(true, $lang["servererror"]);
|
exitWithStatus(true, $lang["servererror"]);
|
||||||
}
|
}
|
||||||
if ($track->update($trackName) === false) {
|
|
||||||
exitWithStatus(true, $mysqli->error);
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'delete':
|
case 'delete':
|
||||||
if ($track->delete() === false) {
|
if ($track->delete() === false) {
|
||||||
exitWithStatus(true, $mysqli->error);
|
exitWithStatus(true, $lang["servererror"]);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
* 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(dirname(__DIR__) . "/auth.php"); // sets $mysqli, $user
|
require_once(dirname(__DIR__) . "/auth.php"); // sets $user
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Exit with xml response
|
* Exit with xml response
|
||||||
@ -52,30 +52,24 @@
|
|||||||
|
|
||||||
switch ($action) {
|
switch ($action) {
|
||||||
case 'add':
|
case 'add':
|
||||||
if (empty($pass)) {
|
|
||||||
exitWithStatus(true, $lang["servererror"]);
|
|
||||||
}
|
|
||||||
if ($aUser->isValid) {
|
if ($aUser->isValid) {
|
||||||
exitWithStatus(true, $lang["userexists"]);
|
exitWithStatus(true, $lang["userexists"]);
|
||||||
}
|
}
|
||||||
if ($aUser->add($login, $pass) === false) {
|
if (empty($pass) || $aUser->add($login, $pass) === false) {
|
||||||
exitWithStatus(true, $mysqli->error);
|
exitWithStatus(true, $lang["servererror"]);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'update':
|
case 'update':
|
||||||
// update password
|
// update password
|
||||||
if (empty($pass)) {
|
if (empty($pass) || $aUser->setPass($pass) === false) {
|
||||||
exitWithStatus(true, $lang["servererror"]);
|
exitWithStatus(true, $lang["servererror"]);
|
||||||
}
|
}
|
||||||
if ($aUser->setPass($pass) === false) {
|
|
||||||
exitWithStatus(true, $mysqli->error);
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'delete':
|
case 'delete':
|
||||||
if ($aUser->delete() === false) {
|
if ($aUser->delete() === false) {
|
||||||
exitWithStatus(true, $mysqli->error);
|
exitWithStatus(true, $lang["servererror"]);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user