|
|
@@ -1,10 +1,13 @@
|
|
|
<?php
|
|
|
|
|
|
+require "settings.php";
|
|
|
+
|
|
|
function add_maintainer( $api ) {
|
|
|
/**
|
|
|
* @param string $api Provided Torn API string
|
|
|
* @return array XID and name of maintainer
|
|
|
*/
|
|
|
+ global $db_path;
|
|
|
$maintainer = array(0, '?');
|
|
|
$url = "https://api.torn.com/user/?key=";
|
|
|
$url .= $api;
|
|
|
@@ -17,7 +20,7 @@ function add_maintainer( $api ) {
|
|
|
} else {
|
|
|
$pdo = null;
|
|
|
try {
|
|
|
- $pdo = new PDO("sqlite:" . './slork.sqlite');
|
|
|
+ $pdo = new PDO("sqlite:" . "${db_path}/slork.sqlite");
|
|
|
} catch (PDOException $e) {
|
|
|
// handle the exception here
|
|
|
}
|
|
|
@@ -42,9 +45,10 @@ function get_maintainer( $id ) {
|
|
|
* @param string $id Maintainer's XID
|
|
|
* @return array XID and name of maintainer
|
|
|
*/
|
|
|
+ global $db_path;
|
|
|
$pdo = null;
|
|
|
try {
|
|
|
- $pdo = new PDO("sqlite:" . './slork.sqlite');
|
|
|
+ $pdo = new PDO("sqlite:" . "${db_path}/slork.sqlite");
|
|
|
} catch (PDOException $e) {
|
|
|
// handle the exception here
|
|
|
}
|
|
|
@@ -60,9 +64,10 @@ function get_maintainer( $id ) {
|
|
|
}
|
|
|
|
|
|
function add_player( $maintainer, $player ) {
|
|
|
+ global $db_path;
|
|
|
$pdo = null;
|
|
|
try {
|
|
|
- $pdo = new PDO("sqlite:" . './slork.sqlite');
|
|
|
+ $pdo = new PDO("sqlite:" . "${db_path}/slork.sqlite");
|
|
|
} catch (PDOException $e) {
|
|
|
// handle the exception here
|
|
|
}
|
|
|
@@ -100,9 +105,10 @@ QUERY;
|
|
|
}
|
|
|
|
|
|
function delete_player( $player ) {
|
|
|
+ global $db_path;
|
|
|
$pdo = null;
|
|
|
try {
|
|
|
- $pdo = new PDO("sqlite:" . './slork.sqlite');
|
|
|
+ $pdo = new PDO("sqlite:" . "${db_path}/slork.sqlite");
|
|
|
} catch (PDOException $e) {
|
|
|
// handle the exception here
|
|
|
}
|
|
|
@@ -127,9 +133,10 @@ function delete_player( $player ) {
|
|
|
}
|
|
|
|
|
|
function store_player_properties( $player, $maintainer, $properties ) {
|
|
|
+ global $db_path;
|
|
|
$pdo = null;
|
|
|
try {
|
|
|
- $pdo = new PDO("sqlite:" . './slork.sqlite');
|
|
|
+ $pdo = new PDO("sqlite:" . "${db_path}/slork.sqlite");
|
|
|
} catch (PDOException $e) {
|
|
|
// handle the exception here
|
|
|
}
|
|
|
@@ -157,9 +164,10 @@ function store_player_properties( $player, $maintainer, $properties ) {
|
|
|
}
|
|
|
|
|
|
function get_property( $maintainer, $player, $property ) {
|
|
|
+ global $db_path;
|
|
|
$pdo = null;
|
|
|
try {
|
|
|
- $pdo = new PDO("sqlite:" . './slork.sqlite');
|
|
|
+ $pdo = new PDO("sqlite:" . "${db_path}/slork.sqlite");
|
|
|
} catch (PDOException $e) {
|
|
|
// handle the exception here
|
|
|
}
|