RewriteEngine On
- #RewriteBase /myaac/
+ #RewriteBase /myaac/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
diff --git a/.travis.yml b/.travis.yml
deleted file mode 100644
index eba123be..00000000
--- a/.travis.yml
+++ /dev/null
@@ -1,18 +0,0 @@
-
-language: php
-php:
- - 7.1
- - 7.2
- - 7.3
- - 7.4
- - 8.0
-
-cache:
- directories:
- - $HOME/.composer/cache
-
-before_script:
- - composer require php-parallel-lint/php-parallel-lint --no-suggest --no-progress --no-interaction --no-ansi --quiet --optimize-autoloader
-
-script:
- - php vendor/bin/parallel-lint --no-progress --no-colors --exclude vendor --exclude "system/libs/pot/OTS_DB_PDOQuery.php" .
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 21f6405c..399eba44 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,6 +1,6 @@
# Changelog
-## [0.9.0-alpha - x.x.2023]
+## [0.9.0-alpha - 02.06.2023]
Minimum PHP version for this release is 7.2.5.
@@ -12,9 +12,10 @@ Minimum PHP version for this release is 7.2.5.
* new Admin Bar showed on top when admin logged in
* new page: Server Data, to reload server data
* new pages: mass account & teleport tools
- * editable changelogs
+ * changelogs editor
* revised Accounts & Players editors
* option to add/modify menus with plugins
+ * option to enable/disable plugins
* better, updated TinyMCE editor (v6.x)
* with option to upload images
* list of open source libraries used in project
@@ -29,11 +30,12 @@ Minimum PHP version for this release is 7.2.5.
* support for Account Number
* suggest account number option
* many new functions, hooks and configurables
+* better Exception Handler (Whoops - https://github.com/filp/whoops)
+* add Cypress testing
### Changed
* Composer is now used for external libraries like: Twig, PHPMailer, fast-route etc.
* mail support is disabled on fresh install, can be manually enabled by user
-* don't show PHP errors on prod
* disable add php pages in admin panel for security. Option to disable plugins upload
* visitors counter shows now user browser, and also if its bot
* changes in required and optional PHP extensions
@@ -43,6 +45,7 @@ Minimum PHP version for this release is 7.2.5.
* Highscores
* frags works for TFS 1.x
* cached
+ * creatures
* moved pages to Twig:
* experience stages
* update player_deaths entries on name change
diff --git a/CREDITS b/CREDITS
index 404de30c..878310df 100644
--- a/CREDITS
+++ b/CREDITS
@@ -1,3 +1,3 @@
* Gesior.pl (2007 - 2008)
-* Slawkens (2009 - 2022)
+* Slawkens (2009 - 2023)
* Contributors listed in CONTRIBUTORS.txt
diff --git a/admin/includes/functions.php b/admin/includes/functions.php
index ab604f76..620272f5 100644
--- a/admin/includes/functions.php
+++ b/admin/includes/functions.php
@@ -1 +1,2 @@
-
\ No newline at end of file
+
diff --git a/admin/pages/phpinfo.php b/admin/pages/phpinfo.php
index bc747a2d..43942bfd 100644
--- a/admin/pages/phpinfo.php
+++ b/admin/pages/phpinfo.php
@@ -16,4 +16,4 @@ if (!function_exists('phpinfo')) { ?>
-
+
diff --git a/admin/pages/players.php b/admin/pages/players.php
index d9a5dece..b32d5445 100644
--- a/admin/pages/players.php
+++ b/admin/pages/players.php
@@ -10,7 +10,7 @@
defined('MYAAC') or die('Direct access not allowed!');
$title = 'Player editor';
-$player_base = BASE_URL . 'admin/?p=players';
+$player_base = ADMIN_URL . '?p=players';
$use_datatable = true;
require_once LIBS . 'forum.php';
diff --git a/admin/pages/statistics.php b/admin/pages/statistics.php
index 17d8118f..b740c217 100644
--- a/admin/pages/statistics.php
+++ b/admin/pages/statistics.php
@@ -36,4 +36,3 @@ $twig->display('admin.statistics.html.twig', array(
'account_type' => (USE_ACCOUNT_NAME ? 'name' : 'number'),
'points' => $points
));
-?>
\ No newline at end of file
diff --git a/admin/pages/version.php b/admin/pages/version.php
index e643e728..64f673c8 100644
--- a/admin/pages/version.php
+++ b/admin/pages/version.php
@@ -47,4 +47,3 @@ function version_revert($version)
$release = $version;
return $major . '.' . $minor . '.' . $release;
}*/
-?>
diff --git a/admin/tools/phpinfo.php b/admin/tools/phpinfo.php
index 96a9aad9..cd043279 100644
--- a/admin/tools/phpinfo.php
+++ b/admin/tools/phpinfo.php
@@ -13,4 +13,3 @@ if(!function_exists('phpinfo'))
die('phpinfo() disabled on this web server.');
phpinfo();
-?>
diff --git a/common.php b/common.php
index 4f104e91..267ca591 100644
--- a/common.php
+++ b/common.php
@@ -26,7 +26,7 @@
if (version_compare(phpversion(), '7.2.5', '<')) die('PHP version 7.2.5 or higher is required.');
const MYAAC = true;
-const MYAAC_VERSION = '0.9.0-dev';
+const MYAAC_VERSION = '0.10.0-dev';
const DATABASE_VERSION = 36;
const TABLE_PREFIX = 'myaac_';
define('START_TIME', microtime(true));
@@ -138,11 +138,9 @@ if(!IS_CLI) {
define('SERVER_URL', 'http' . (isset($_SERVER['HTTPS'][0]) && strtolower($_SERVER['HTTPS']) === 'on' ? 's' : '') . '://' . $baseHost);
define('BASE_URL', SERVER_URL . BASE_DIR . '/');
- define('ADMIN_URL', SERVER_URL . BASE_DIR . '/admin/');
+ define('ADMIN_URL', SERVER_URL . BASE_DIR . '/' . ADMIN_PANEL_FOLDER . '/');
//define('CURRENT_URL', BASE_URL . $_SERVER['REQUEST_URI']);
-
- require SYSTEM . 'exception.php';
}
$autoloadFile = VENDOR . 'autoload.php';
diff --git a/composer.json b/composer.json
index cd16bf18..b1300e34 100644
--- a/composer.json
+++ b/composer.json
@@ -12,5 +12,8 @@
"erusev/parsedown": "^1.7",
"nikic/fast-route": "^1.3",
"matomo/device-detector": "^6.0"
+ },
+ "require-dev": {
+ "filp/whoops": "^2.15"
}
}
diff --git a/cypress.config.js b/cypress.config.js
new file mode 100644
index 00000000..97f47c41
--- /dev/null
+++ b/cypress.config.js
@@ -0,0 +1,9 @@
+const { defineConfig } = require("cypress");
+
+module.exports = defineConfig({
+ e2e: {
+ setupNodeEvents(on, config) {
+ // implement node event listeners here
+ },
+ },
+});
diff --git a/cypress/e2e/1-install.cy.js b/cypress/e2e/1-install.cy.js
new file mode 100644
index 00000000..84a8f51b
--- /dev/null
+++ b/cypress/e2e/1-install.cy.js
@@ -0,0 +1,75 @@
+describe('Install MyAAC', () => {
+ beforeEach(() => {
+ // Cypress starts out with a blank slate for each test
+ // so we must tell it to visit our website with the `cy.visit()` command.
+ // Since we want to visit the same URL at the start of all our tests,
+ // we include it in our beforeEach function so that it runs before each test
+ cy.visit(Cypress.env('URL'))
+ })
+
+ it('Go through installer', () => {
+ cy.visit(Cypress.env('URL') + '/install/?step=welcome')
+ cy.wait(1000)
+
+ cy.screenshot('install-welcome')
+
+ // step 1 - Welcome
+ cy.get('select[name="lang"]').select('en')
+
+ //cy.get('input[type=button]').contains('Next ยป').click()
+
+ cy.get('form').submit()
+
+ // step 2 - License
+ // just skip
+ cy.contains('GNU/GPL License');
+ cy.get('form').submit()
+
+ // step 3 - Requirements
+ cy.contains('Requirements check');
+
+ cy.get('#step').then(elem => {
+ elem.val('config');
+ });
+
+ cy.get('form').submit()
+
+ // step 4 - Configuration
+ cy.contains('Basic configuration');
+
+ cy.get('#vars_server_path').click().clear().type(Cypress.env('SERVER_PATH'))
+ cy.get('#vars_mail_admin').click().clear().type('noone@example.net')
+
+ cy.get('[type="checkbox"]').uncheck() // usage statistics uncheck
+
+ cy.wait(1000)
+
+ cy.get('form').submit()
+
+ // check if there is any error
+
+
+ // step 5 - Import Schema
+ cy.contains('Import MySQL schema');
+
+ // AAC is not installed yet, this message should not come
+ cy.contains('Seems AAC is already installed. Skipping importing MySQL schema..').should('not.exist')
+
+ cy.contains('[class="alert alert-success"]', 'Local configuration has been saved into file: config.local.php').should('be.visible')
+
+ cy.get('form').submit()
+
+ // step 6 - Admin Account
+ cy.get('#vars_email').click().clear().type('admin@my-aac.org')
+ cy.get('#vars_account').click().clear().type('admin')
+ cy.get('#vars_password').click().clear().type('test1234')
+ cy.get('#vars_password_confirm').click().clear().type('test1234')
+ cy.get('#vars_player_name').click().clear().type('Admin')
+
+ cy.get('form').submit()
+
+ cy.contains('[class="alert alert-success"]', 'Congratulations', { timeout: 30000 }).should('be.visible')
+
+ cy.screenshot('install-finish')
+ })
+})
diff --git a/cypress/e2e/2-create-account.cy.js b/cypress/e2e/2-create-account.cy.js
new file mode 100644
index 00000000..9fc95cb0
--- /dev/null
+++ b/cypress/e2e/2-create-account.cy.js
@@ -0,0 +1,33 @@
+describe('Create Account Page', () => {
+ beforeEach(() => {
+ // Cypress starts out with a blank slate for each test
+ // so we must tell it to visit our website with the `cy.visit()` command.
+ // Since we want to visit the same URL at the start of all our tests,
+ // we include it in our beforeEach function so that it runs before each test
+ cy.visit(Cypress.env('URL') + '/index.php/account/create')
+ })
+
+ it('Create Test Account', () => {
+ cy.screenshot('create-account-page')
+
+ cy.get('#account_input').type('tester')
+ cy.get('#email').type('tester@example.com')
+
+ cy.get('#password').type('test1234')
+ cy.get('#password2').type('test1234')
+
+ cy.get('#character_name').type('Slaw')
+
+ cy.get('#sex1').check()
+ cy.get('#vocation1').check()
+ cy.get('#accept_rules').check()
+
+ cy.get('#createaccount').submit()
+
+ // no errors please
+ cy.contains('The Following Errors Have Occurred:').should('not.exist')
+
+ // ss of post page
+ cy.screenshot('create-account-page-post')
+ })
+})
diff --git a/cypress/fixtures/example.json b/cypress/fixtures/example.json
new file mode 100644
index 00000000..02e42543
--- /dev/null
+++ b/cypress/fixtures/example.json
@@ -0,0 +1,5 @@
+{
+ "name": "Using fixtures to represent data",
+ "email": "hello@cypress.io",
+ "body": "Fixtures are a great way to mock data for responses to routes"
+}
diff --git a/cypress/support/commands.js b/cypress/support/commands.js
new file mode 100644
index 00000000..66ea16ef
--- /dev/null
+++ b/cypress/support/commands.js
@@ -0,0 +1,25 @@
+// ***********************************************
+// This example commands.js shows you how to
+// create various custom commands and overwrite
+// existing commands.
+//
+// For more comprehensive examples of custom
+// commands please read more here:
+// https://on.cypress.io/custom-commands
+// ***********************************************
+//
+//
+// -- This is a parent command --
+// Cypress.Commands.add('login', (email, password) => { ... })
+//
+//
+// -- This is a child command --
+// Cypress.Commands.add('drag', { prevSubject: 'element'}, (subject, options) => { ... })
+//
+//
+// -- This is a dual command --
+// Cypress.Commands.add('dismiss', { prevSubject: 'optional'}, (subject, options) => { ... })
+//
+//
+// -- This will overwrite an existing command --
+// Cypress.Commands.overwrite('visit', (originalFn, url, options) => { ... })
\ No newline at end of file
diff --git a/cypress/support/e2e.js b/cypress/support/e2e.js
new file mode 100644
index 00000000..0e7290a1
--- /dev/null
+++ b/cypress/support/e2e.js
@@ -0,0 +1,20 @@
+// ***********************************************************
+// This example support/e2e.js is processed and
+// loaded automatically before your test files.
+//
+// This is a great place to put global configuration and
+// behavior that modifies Cypress.
+//
+// You can change the location of this file or turn off
+// automatically serving support files with the
+// 'supportFile' configuration option.
+//
+// You can read more here:
+// https://on.cypress.io/configuration
+// ***********************************************************
+
+// Import commands.js using ES2015 syntax:
+import './commands'
+
+// Alternatively you can use CommonJS syntax:
+// require('./commands')
\ No newline at end of file
diff --git a/index.php b/index.php
index 5f887570..34f42069 100644
--- a/index.php
+++ b/index.php
@@ -163,6 +163,7 @@ if(setting('core.backward_support')) {
$config['site'] = &$config;
$config['server'] = &$config['lua'];
$config['site']['shop_system'] = $config['gifts_system'];
+ $config['site']['gallery_page'] = true;
if(!isset($config['vdarkborder']))
$config['vdarkborder'] = '#505050';
diff --git a/install/includes/config.php b/install/includes/config.php
index 380fff7d..5d9ae07a 100644
--- a/install/includes/config.php
+++ b/install/includes/config.php
@@ -38,4 +38,3 @@ if(!isset($error) || !$error) {
$error = true;
}
}
-?>
\ No newline at end of file
diff --git a/install/index.php b/install/index.php
index 7de02a06..0cbcd658 100644
--- a/install/index.php
+++ b/install/index.php
@@ -26,13 +26,13 @@ $twig = new Twig_Environment($twig_loader, array(
));
// load installation status
-$step = isset($_POST['step']) ? $_POST['step'] : 'welcome';
+$step = $_REQUEST['step'] ?? 'welcome';
$install_status = array();
if(file_exists(CACHE . 'install.txt')) {
$install_status = unserialize(file_get_contents(CACHE . 'install.txt'));
- if(!isset($_POST['step'])) {
+ if(!isset($_REQUEST['step'])) {
$step = isset($install_status['step']) ? $install_status['step'] : '';
}
}
diff --git a/install/steps/2-license.php b/install/steps/2-license.php
index e84ce0e6..4976dd70 100644
--- a/install/steps/2-license.php
+++ b/install/steps/2-license.php
@@ -5,4 +5,3 @@ $twig->display('install.license.html.twig', array(
'license' => file_get_contents(BASE . 'LICENSE'),
'buttons' => next_buttons()
));
-?>
diff --git a/install/steps/4-config.php b/install/steps/4-config.php
index b1555201..325b97f1 100644
--- a/install/steps/4-config.php
+++ b/install/steps/4-config.php
@@ -18,4 +18,3 @@ $twig->display('install.config.html.twig', array(
'errors' => isset($errors) ? $errors : null,
'buttons' => next_buttons()
));
-?>
\ No newline at end of file
diff --git a/install/steps/5-database.php b/install/steps/5-database.php
index 7fb1969b..b97dca4f 100644
--- a/install/steps/5-database.php
+++ b/install/steps/5-database.php
@@ -111,7 +111,7 @@ if(!$error) {
diff --git a/install/steps/7-finish.php b/install/steps/7-finish.php
index 656c60fe..f6e1f6c2 100644
--- a/install/steps/7-finish.php
+++ b/install/steps/7-finish.php
@@ -122,18 +122,21 @@ else {
));
if(!isset($_SESSION['installed'])) {
- $report_url = 'https://my-aac.org/report_install.php?v=' . MYAAC_VERSION . '&b=' . urlencode(BASE_URL);
- if (function_exists('curl_version'))
- {
- $curl = curl_init();
- curl_setopt($curl, CURLOPT_URL, $report_url);
- curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
- curl_exec($curl);
- curl_close($curl);
- }
- else if (ini_get('allow_url_fopen') ) {
- file_get_contents($report_url);
+ if (!array_key_exists('CI', getenv())) {
+ $report_url = 'https://my-aac.org/report_install.php?v=' . MYAAC_VERSION . '&b=' . urlencode(BASE_URL);
+ if (function_exists('curl_version'))
+ {
+ $curl = curl_init();
+ curl_setopt($curl, CURLOPT_URL, $report_url);
+ curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
+ curl_exec($curl);
+ curl_close($curl);
+ }
+ else if (ini_get('allow_url_fopen') ) {
+ file_get_contents($report_url);
+ }
}
+
$_SESSION['installed'] = true;
}
diff --git a/install/template/template.php b/install/template/template.php
index 862a97af..8f015f79 100644
--- a/install/template/template.php
+++ b/install/template/template.php
@@ -4,14 +4,14 @@
MyAAC -
-
+
-
+
@@ -28,10 +28,10 @@
if ($step == $value) {
$progress = ($i == 6) ? 100 : $i * 16;
}
-
- echo '
' . ++$i . '. ' . $locale['step_' . $value] . '';
+
+ echo '' . ++$i . '. ' . $locale['step_' . $value] . '';
}
-
+
?>
@@ -71,4 +71,4 @@
-