diff --git a/.github/workflows/cypress.yml b/.github/workflows/cypress.yml index e93257f1..4dd8e9dd 100644 --- a/.github/workflows/cypress.yml +++ b/.github/workflows/cypress.yml @@ -22,7 +22,7 @@ jobs: strategy: fail-fast: false matrix: - php-versions: [ '8.1', '8.2', '8.3', '8.4' ] + php-versions: [ '8.1', '8.2', '8.3', '8.4', '8.5' ] ots: ['tfs-1.4', 'canary-3.1.2'] # TODO: add 'tfs-master' (actually doesn't work cause AAC doesn't support reading .env configuration) name: Cypress (PHP ${{ matrix.php-versions }}, ${{ matrix.ots }}) steps: diff --git a/common.php b/common.php index e2bf33fa..0708596b 100644 --- a/common.php +++ b/common.php @@ -148,16 +148,17 @@ if(!IS_CLI) { /** @var array $config */ ini_set('log_errors', 1); -if(@$config['env'] === 'dev' || defined('MYAAC_INSTALL')) { - ini_set('display_errors', 1); - ini_set('display_startup_errors', 1); - error_reporting(E_ALL); -} -else { +if(isset($config['env']) && $config['env'] !== 'dev' && !defined('MYAAC_INSTALL')) { ini_set('display_errors', 0); ini_set('display_startup_errors', 0); error_reporting(E_ALL & ~E_DEPRECATED & ~E_STRICT); } +else { + ini_set('html_errors', 0); + ini_set('display_errors', 1); + ini_set('display_startup_errors', 1); + error_reporting(E_ALL); +} $autoloadFile = VENDOR . 'autoload.php'; if (!is_file($autoloadFile)) { diff --git a/system/migrations/7.php b/system/migrations/7.php index a96ed7c9..5a6a7925 100644 --- a/system/migrations/7.php +++ b/system/migrations/7.php @@ -9,7 +9,7 @@ $up = function () use ($db) { } }; -$up = function () use ($db) { +$down = function () use ($db) { if (!$db->hasColumn(TABLE_PREFIX . 'screenshots', 'name')) { $db->addColumn(TABLE_PREFIX . 'screenshots', 'name', 'VARCHAR(30) NOT NULL'); } diff --git a/system/pages/highscores.php b/system/pages/highscores.php index cec95d15..79d4feee 100644 --- a/system/pages/highscores.php +++ b/system/pages/highscores.php @@ -176,7 +176,9 @@ if (empty($highscores)) { POT::SKILL_FISH => 'skill_fishing', ); - $query->addSelect($skill_ids[$skill] . ' as value'); + $query + ->addSelect($skill_ids[$skill] . ' as value') + ->orderByDesc($skill_ids[$skill] . '_tries'); } else { $query ->join('player_skills', 'player_skills.player_id', '=', 'players.id') @@ -198,11 +200,11 @@ if (empty($highscores)) { if ($skill == POT::SKILL__MAGLEVEL) { $query ->addSelect('players.maglevel as value', 'players.maglevel') - ->orderBy('manaspent'); + ->orderByDesc('manaspent'); } else { // level $query ->addSelect('players.level as value', 'players.experience') - ->orderBy('experience'); + ->orderByDesc('experience'); $list = 'experience'; } } diff --git a/system/src/Validator.php b/system/src/Validator.php index ad9e3e50..7261454e 100644 --- a/system/src/Validator.php +++ b/system/src/Validator.php @@ -342,6 +342,16 @@ class Validator } } + global $hooks; + + $params = ['name' => $name, 'error' => '']; + $hooks->triggerFilter(HOOK_FILTER_VALIDATE_CHARACTER_NEW_NAME, $params); + + if (!empty($params['error'])) { + self::$lastError = $params['error']; + return false; + } + return true; } diff --git a/system/src/global.php b/system/src/global.php index 85f9476d..a140bdde 100644 --- a/system/src/global.php +++ b/system/src/global.php @@ -108,6 +108,7 @@ define('HOOK_FILTER_ROUTES', ++$i); define('HOOK_FILTER_TWIG_DISPLAY', ++$i); define('HOOK_FILTER_TWIG_RENDER', ++$i); define('HOOK_FILTER_THEME_FOOTER', ++$i); +define('HOOK_FILTER_VALIDATE_CHARACTER_NEW_NAME', ++$i); const HOOK_FIRST = HOOK_INIT; define('HOOK_LAST', $i);