changed direct public access of maniacontrol properties to using getter methods
This commit is contained in:
@ -69,7 +69,7 @@ class StatisticManager {
|
||||
* @return bool
|
||||
*/
|
||||
private function initTables() {
|
||||
$mysqli = $this->maniaControl->database->mysqli;
|
||||
$mysqli = $this->maniaControl->getDatabase()->getMysqli();
|
||||
$query = "CREATE TABLE IF NOT EXISTS `" . self::TABLE_STATMETADATA . "` (
|
||||
`index` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`name` varchar(100) NOT NULL,
|
||||
@ -117,7 +117,7 @@ class StatisticManager {
|
||||
* Store Stats Meta Data from the Database
|
||||
*/
|
||||
private function storeStatMetaData() {
|
||||
$mysqli = $this->maniaControl->database->mysqli;
|
||||
$mysqli = $this->maniaControl->getDatabase()->getMysqli();
|
||||
|
||||
$query = "SELECT * FROM `" . self::TABLE_STATMETADATA . "`;";
|
||||
$result = $mysqli->query($query);
|
||||
@ -202,14 +202,15 @@ class StatisticManager {
|
||||
return $this->getStatsRankingOfSpecialStat($statName, $serverIndex);
|
||||
}
|
||||
|
||||
$mysqli = $this->maniaControl->database->mysqli;
|
||||
$mysqli = $this->maniaControl->getDatabase()->getMysqli();
|
||||
$statId = $this->getStatId($statName);
|
||||
|
||||
$query = "SELECT playerId, serverIndex, value FROM `" . self::TABLE_STATISTICS . "` WHERE statId = {$statId}";
|
||||
$query = "SELECT `playerId`, `serverIndex`, `value` FROM `" . self::TABLE_STATISTICS . "`
|
||||
WHERE `statId` = {$statId} ";
|
||||
if ($minValue >= 0) {
|
||||
$query .= " AND value >= {$minValue}";
|
||||
$query .= "AND `value` >= {$minValue} ";
|
||||
}
|
||||
$query .= " ORDER BY value DESC;";
|
||||
$query .= "ORDER BY `value` DESC;";
|
||||
|
||||
$result = $mysqli->query($query);
|
||||
if (!$result) {
|
||||
@ -490,7 +491,7 @@ class StatisticManager {
|
||||
return intval($hits) / intval($shots);
|
||||
}
|
||||
|
||||
$mysqli = $this->maniaControl->database->mysqli;
|
||||
$mysqli = $this->maniaControl->getDatabase()->getMysqli();
|
||||
$statId = $this->getStatId($statName);
|
||||
|
||||
if (!$statId) {
|
||||
@ -498,9 +499,14 @@ class StatisticManager {
|
||||
}
|
||||
|
||||
if ($serverIndex < 0) {
|
||||
$query = "SELECT SUM(value) as value FROM `" . self::TABLE_STATISTICS . "` WHERE `statId` = " . $statId . " AND `playerId` = " . $playerId . ";";
|
||||
$query = "SELECT SUM(`value`) as `value` FROM `" . self::TABLE_STATISTICS . "`
|
||||
WHERE `statId` = {$statId}
|
||||
AND `playerId` = {$playerId};";
|
||||
} else {
|
||||
$query = "SELECT value FROM `" . self::TABLE_STATISTICS . "` WHERE `statId` = " . $statId . " AND `playerId` = " . $playerId . " AND `serverIndex` = '" . $serverIndex . "';";
|
||||
$query = "SELECT `value` FROM `" . self::TABLE_STATISTICS . "`
|
||||
WHERE `statId` = {$statId}
|
||||
AND `playerId` = {$playerId}
|
||||
AND `serverIndex` = {$serverIndex};";
|
||||
}
|
||||
|
||||
$result = $mysqli->query($query);
|
||||
@ -554,10 +560,10 @@ class StatisticManager {
|
||||
}
|
||||
|
||||
if ($serverIndex) {
|
||||
$serverIndex = $this->maniaControl->server->index;
|
||||
$serverIndex = $this->maniaControl->getServer()->index;
|
||||
}
|
||||
|
||||
$mysqli = $this->maniaControl->database->mysqli;
|
||||
$mysqli = $this->maniaControl->getDatabase()->getMysqli();
|
||||
$query = "INSERT INTO `" . self::TABLE_STATISTICS . "` (
|
||||
`serverIndex`,
|
||||
`playerId`,
|
||||
@ -592,7 +598,7 @@ class StatisticManager {
|
||||
* @return bool
|
||||
*/
|
||||
public function defineStatMetaData($statName, $type = self::STAT_TYPE_INT, $statDescription = '') {
|
||||
$mysqli = $this->maniaControl->database->mysqli;
|
||||
$mysqli = $this->maniaControl->getDatabase()->getMysqli();
|
||||
$query = "INSERT INTO `" . self::TABLE_STATMETADATA . "` (
|
||||
`name`,
|
||||
`type`,
|
||||
|
Reference in New Issue
Block a user