Nothing important, just some comments and small code style fixes

This commit is contained in:
slawkens 2023-06-19 08:03:47 +02:00
parent dcf9a45974
commit b09adc836d
5 changed files with 15 additions and 8 deletions

View File

@ -116,5 +116,4 @@ defined('MYAAC') or die('Direct access not allowed!');
'<li>MySQL is not configured propertly in <i>config.lua</i>.</li>' . '<li>MySQL is not configured propertly in <i>config.lua</i>.</li>' .
'<li>MySQL server is not running.</li>' . '<li>MySQL server is not running.</li>' .
'</ul>' . $error->getMessage()); '</ul>' . $error->getMessage());
} }

View File

@ -7,11 +7,10 @@
* @copyright 2019 MyAAC * @copyright 2019 MyAAC
* @link https://my-aac.org * @link https://my-aac.org
*/ */
defined('MYAAC') or die('Direct access not allowed!');
use Twig\Loader\ArrayLoader as Twig_ArrayLoader; use Twig\Loader\ArrayLoader as Twig_ArrayLoader;
defined('MYAAC') or die('Direct access not allowed!');
function message($message, $type, $return) function message($message, $type, $return)
{ {
if(IS_CLI) { if(IS_CLI) {
@ -798,7 +797,7 @@ function get_plugins()
$ret = array(); $ret = array();
$path = PLUGINS; $path = PLUGINS;
foreach(scandir($path, 0) as $file) { foreach(scandir($path, SCANDIR_SORT_ASCENDING) as $file) {
$file_ext = pathinfo($file, PATHINFO_EXTENSION); $file_ext = pathinfo($file, PATHINFO_EXTENSION);
$file_name = pathinfo($file, PATHINFO_FILENAME); $file_name = pathinfo($file, PATHINFO_FILENAME);
if ($file === '.' || $file === '..' || $file === 'disabled' || $file === 'example.json' || $file_ext !== 'json' || is_dir($path . $file)) if ($file === '.' || $file === '..' || $file === 'disabled' || $file === 'example.json' || $file_ext !== 'json' || is_dir($path . $file))

View File

@ -23,7 +23,7 @@ else
} }
$password_strlen = strlen($new_password); $password_strlen = strlen($new_password);
if($new_password != $new_password2) { if($new_password != $new_password2) {
$errors[] = "The new passwords do not match!"; $errors[] = 'The new passwords do not match!';
} }
if(empty($errors)) { if(empty($errors)) {
@ -31,6 +31,7 @@ else
$errors[] = Validator::getLastError(); $errors[] = Validator::getLastError();
} }
/** @var OTS_Account $account_logged */
$old_password = encrypt(($config_salt_enabled ? $account_logged->getCustomField('salt') : '') . $old_password); $old_password = encrypt(($config_salt_enabled ? $account_logged->getCustomField('salt') : '') . $old_password);
if($old_password != $account_logged->getPassword()) { if($old_password != $account_logged->getPassword()) {
$errors[] = "Current password is incorrect!"; $errors[] = "Current password is incorrect!";
@ -79,5 +80,3 @@ else
setSession('password', $new_password); setSession('password', $new_password);
} }
} }
?>

View File

@ -45,6 +45,7 @@ foreach($groupList as $id => $group)
$members = array(); $members = array();
foreach($group_members as $member) foreach($group_members as $member)
{ {
/** @var OTS_Player $member */
if(!admin() && $member->isHidden()) if(!admin() && $member->isHidden())
continue; continue;

View File

@ -21,6 +21,9 @@ if(config('status_enabled') === false) {
return; return;
} }
/**
* @var array $config
*/
$status_ip = $config['lua']['ip']; $status_ip = $config['lua']['ip'];
if(isset($config['lua']['statusProtocolPort'])) { if(isset($config['lua']['statusProtocolPort'])) {
$config['lua']['loginPort'] = $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; $fetch_from_db = true;
/**
* @var Cache $cache
*/
if($cache->enabled()) if($cache->enabled())
{ {
$tmp = ''; $tmp = '';
@ -67,6 +73,9 @@ if($cache->enabled())
if($fetch_from_db) if($fetch_from_db)
{ {
// get info 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%"'); $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 if($status_query->rowCount() <= 0) // empty, just insert it
{ {