From b09adc836d9a292e775552d0d7c8f6ce292d39fb Mon Sep 17 00:00:00 2001 From: slawkens Date: Mon, 19 Jun 2023 08:03:47 +0200 Subject: [PATCH] Nothing important, just some comments and small code style fixes --- system/database.php | 1 - system/functions.php | 5 ++--- system/pages/account/change_password.php | 7 +++---- system/pages/team.php | 1 + system/status.php | 9 +++++++++ 5 files changed, 15 insertions(+), 8 deletions(-) diff --git a/system/database.php b/system/database.php index 4ca57a77..33c0e81a 100644 --- a/system/database.php +++ b/system/database.php @@ -116,5 +116,4 @@ defined('MYAAC') or die('Direct access not allowed!'); '
  • MySQL is not configured propertly in config.lua.
  • ' . '
  • MySQL server is not running.
  • ' . '' . $error->getMessage()); - } \ No newline at end of file diff --git a/system/functions.php b/system/functions.php index 6c8d615e..fc0d3c7f 100644 --- a/system/functions.php +++ b/system/functions.php @@ -7,11 +7,10 @@ * @copyright 2019 MyAAC * @link https://my-aac.org */ +defined('MYAAC') or die('Direct access not allowed!'); use Twig\Loader\ArrayLoader as Twig_ArrayLoader; -defined('MYAAC') or die('Direct access not allowed!'); - function message($message, $type, $return) { if(IS_CLI) { @@ -798,7 +797,7 @@ function get_plugins() $ret = array(); $path = PLUGINS; - foreach(scandir($path, 0) as $file) { + foreach(scandir($path, SCANDIR_SORT_ASCENDING) as $file) { $file_ext = pathinfo($file, PATHINFO_EXTENSION); $file_name = pathinfo($file, PATHINFO_FILENAME); if ($file === '.' || $file === '..' || $file === 'disabled' || $file === 'example.json' || $file_ext !== 'json' || is_dir($path . $file)) diff --git a/system/pages/account/change_password.php b/system/pages/account/change_password.php index 37ff7f32..48959141 100644 --- a/system/pages/account/change_password.php +++ b/system/pages/account/change_password.php @@ -23,7 +23,7 @@ else } $password_strlen = strlen($new_password); if($new_password != $new_password2) { - $errors[] = "The new passwords do not match!"; + $errors[] = 'The new passwords do not match!'; } if(empty($errors)) { @@ -31,6 +31,7 @@ else $errors[] = Validator::getLastError(); } + /** @var OTS_Account $account_logged */ $old_password = encrypt(($config_salt_enabled ? $account_logged->getCustomField('salt') : '') . $old_password); if($old_password != $account_logged->getPassword()) { $errors[] = "Current password is incorrect!"; @@ -78,6 +79,4 @@ else )); setSession('password', $new_password); } -} - -?> \ No newline at end of file +} \ No newline at end of file diff --git a/system/pages/team.php b/system/pages/team.php index b08dafad..855bb629 100644 --- a/system/pages/team.php +++ b/system/pages/team.php @@ -45,6 +45,7 @@ foreach($groupList as $id => $group) $members = array(); foreach($group_members as $member) { + /** @var OTS_Player $member */ if(!admin() && $member->isHidden()) continue; diff --git a/system/status.php b/system/status.php index 7b10a1aa..86cba2ed 100644 --- a/system/status.php +++ b/system/status.php @@ -21,6 +21,9 @@ if(config('status_enabled') === false) { return; } +/** + * @var array $config + */ $status_ip = $config['lua']['ip']; if(isset($config['lua']['statusProtocolPort'])) { $config['lua']['loginPort'] = $config['lua']['statusProtocolPort']; @@ -54,6 +57,9 @@ elseif(!isset($status_port[0])) // try 7171 if no ip specified } $fetch_from_db = true; +/** + * @var Cache $cache + */ if($cache->enabled()) { $tmp = ''; @@ -67,6 +73,9 @@ if($cache->enabled()) if($fetch_from_db) { // get info from db + /** + * @var OTS_DB_MySQL $db + */ $status_query = $db->query('SELECT `name`, `value` FROM `' . TABLE_PREFIX . 'config` WHERE ' . $db->fieldName('name') . ' LIKE "%status%"'); if($status_query->rowCount() <= 0) // empty, just insert it {