diff --git a/system/libs/forum.php b/system/libs/forum.php index 648a9d99..4922a9c3 100644 --- a/system/libs/forum.php +++ b/system/libs/forum.php @@ -11,7 +11,7 @@ defined('MYAAC') or die('Direct access not allowed!'); $configForumTablePrefix = config('forum_table_prefix'); -if(!empty(trim($configForumTablePrefix))) { +if(null !== $configForumTablePrefix && !empty(trim($configForumTablePrefix))) { if(!in_array($configForumTablePrefix, array('myaac_', 'z_'))) { throw new RuntimeException('Invalid value for forum_table_prefix in config.php. Can be only: "myaac_" or "z_".'); } @@ -322,4 +322,4 @@ class Forum return $hasAccess; } } -?> \ No newline at end of file +?> diff --git a/system/libs/pot/OTS_Account.php b/system/libs/pot/OTS_Account.php index beed47dd..e68f8034 100644 --- a/system/libs/pot/OTS_Account.php +++ b/system/libs/pot/OTS_Account.php @@ -31,7 +31,7 @@ * @property-read int $access Access level. * @tutorial POT/Accounts.pkg */ -class OTS_Account extends OTS_Row_DAO implements IteratorAggregate, Countable +class OTS_Account extends OTS_Row_DAO implements Countable { /** * Account data. @@ -1033,7 +1033,7 @@ class OTS_Account extends OTS_Row_DAO implements IteratorAggregate, Countable * @throws PDOException On PDO operation error. * @return int Count of players. */ - public function count() + public function count(): int { return $this->getPlayersList()->count(); } diff --git a/system/libs/pot/OTS_Base_List.php b/system/libs/pot/OTS_Base_List.php index c3df55df..144d5ad7 100644 --- a/system/libs/pot/OTS_Base_List.php +++ b/system/libs/pot/OTS_Base_List.php @@ -36,7 +36,7 @@ * @property-write int $offset Sets OFFSET clause. * @property-write OTS_SQLFilter $filter Sets filter for list SQL query. */ -abstract class OTS_Base_List implements IOTS_DAO, Iterator, Countable +abstract class OTS_Base_List implements IOTS_DAO, Countable { /** * Database connection. @@ -203,7 +203,7 @@ abstract class OTS_Base_List implements IOTS_DAO, Iterator, Countable * * @throws PDOException On PDO operation error. */ - public function rewind() + public function rewind(): void { $this->rows = $this->db->query( $this->getSQL() )->fetchAll(); } @@ -211,7 +211,7 @@ abstract class OTS_Base_List implements IOTS_DAO, Iterator, Countable /** * Moves to next row. */ - public function next() + public function next(): void { next($this->rows); } @@ -231,7 +231,7 @@ abstract class OTS_Base_List implements IOTS_DAO, Iterator, Countable * * @return bool Does next row exist. */ - public function valid() + public function valid(): bool { return key($this->rows) !== null; } @@ -243,7 +243,7 @@ abstract class OTS_Base_List implements IOTS_DAO, Iterator, Countable * @return int Number of rows. * @throws PDOException On PDO operation error. */ - public function count() + public function count(): int { return $this->db->query( $this->getSQL(true) )->fetchColumn(); } diff --git a/system/libs/pot/OTS_DB_PDOQuery_PHP71.php b/system/libs/pot/OTS_DB_PDOQuery_PHP71.php index 3bb91a46..b6406b9a 100644 --- a/system/libs/pot/OTS_DB_PDOQuery_PHP71.php +++ b/system/libs/pot/OTS_DB_PDOQuery_PHP71.php @@ -5,7 +5,7 @@ trait OTS_DB_PDOQuery /** * @return PDOStatement */ - public function query(?string $query = null, ?int $fetchMode = null, mixed ...$fetchModeArgs) + public function query(?string $query = null, ?int $fetchMode = null, mixed ...$fetchModeArgs): PDOStatement { return $this->doQuery($query, $fetchMode, ...$fetchModeArgs); } diff --git a/system/libs/pot/OTS_Group.php b/system/libs/pot/OTS_Group.php index 819d8b50..54b44f49 100644 --- a/system/libs/pot/OTS_Group.php +++ b/system/libs/pot/OTS_Group.php @@ -26,7 +26,7 @@ * @property-read int $id Row ID. * @property-read OTS_Players_List $playersList List of members of this group. */ -class OTS_Group extends OTS_Row_DAO implements IteratorAggregate, Countable +class OTS_Group extends OTS_Row_DAO implements Countable { /** * Group data. @@ -552,7 +552,7 @@ class OTS_Group extends OTS_Row_DAO implements IteratorAggregate, Countable * @throws PDOException On PDO operation error. * @return int Count of players. */ - public function count() + public function count(): int { return $this->getPlayersList()->count(); } diff --git a/system/libs/pot/OTS_Groups_List.php b/system/libs/pot/OTS_Groups_List.php index 083615de..59440ecf 100644 --- a/system/libs/pot/OTS_Groups_List.php +++ b/system/libs/pot/OTS_Groups_List.php @@ -14,7 +14,7 @@ * @package POT * @version 0.1.3 */ -class OTS_Groups_List implements IteratorAggregate, Countable +class OTS_Groups_List implements Countable { /** * Groups. @@ -41,7 +41,7 @@ class OTS_Groups_List implements IteratorAggregate, Countable $info['access'] = $group['name']; $this->groups[$group['id']] = new OTS_Group($info); } - + return; } @@ -50,7 +50,7 @@ class OTS_Groups_List implements IteratorAggregate, Countable global $config; $file = $config['data_path'] . 'XML/groups.xml'; } - + if(!@file_exists($file)) { error('Error: Cannot load groups.xml. More info in system/logs/error.log file.'); log_append('error.log', '[OTS_Groups_List.php] Fatal error: Cannot load groups.xml (' . $file . '). It doesnt exist.'); @@ -99,7 +99,7 @@ class OTS_Groups_List implements IteratorAggregate, Countable log_append('error.log', '[OTS_Groups_List.php] Fatal error: Cannot load groups.xml (' . $file . '). Error: ' . print_r(error_get_last(), true)); return; } - + // loads groups foreach($groups->getElementsByTagName('group') as $group) { @@ -157,7 +157,7 @@ class OTS_Groups_List implements IteratorAggregate, Countable if($id > $group_id) $group_id = $id; } - + return $group_id; } @@ -210,7 +210,7 @@ class OTS_Groups_List implements IteratorAggregate, Countable * @since 0.1.5 * @return int Amount of all groups. */ - public function count() + public function count(): int { return count($this->groups); } diff --git a/system/libs/pot/OTS_Guild.php b/system/libs/pot/OTS_Guild.php index 27e3e102..4cafc0c3 100644 --- a/system/libs/pot/OTS_Guild.php +++ b/system/libs/pot/OTS_Guild.php @@ -30,7 +30,7 @@ * @property-write IOTS_GuildAction $requestsDriver Membership requests handler. * @tutorial POT/Guilds.pkg */ -class OTS_Guild extends OTS_Row_DAO implements IteratorAggregate, Countable +class OTS_Guild extends OTS_Row_DAO implements Countable { /** * Guild data. @@ -723,7 +723,7 @@ class OTS_Guild extends OTS_Row_DAO implements IteratorAggregate, Countable * @throws PDOException On PDO operation error. * @return int Count of ranks. */ - public function count() + public function count(): int { return $this->getGuildRanksList()->count(); } diff --git a/system/libs/pot/OTS_GuildRank.php b/system/libs/pot/OTS_GuildRank.php index 24e1478c..4518eaa6 100644 --- a/system/libs/pot/OTS_GuildRank.php +++ b/system/libs/pot/OTS_GuildRank.php @@ -25,7 +25,7 @@ * @property-read int $id Row ID. * @property-read OTS_Players_List $playersList List of members with this rank. */ -class OTS_GuildRank extends OTS_Row_DAO implements IteratorAggregate, Countable +class OTS_GuildRank extends OTS_Row_DAO implements Countable { /** * Rank data. @@ -410,7 +410,7 @@ class OTS_GuildRank extends OTS_Row_DAO implements IteratorAggregate, Countable * @throws PDOException On PDO operation error. * @return int Count of players. */ - public function count() + public function count(): int { return $this->getPlayersList()->count(); }