Add initial files and database migration for ticket pricing system

- Created new directories and index files for controls, factory, and views.
- Added .htaccess files for URL rewriting in layout and images directories.
- Included a logo image in the layout/images directory.
- Implemented load_prices.php to load ticket prices from the database into settings.
- Developed admin panel settings page for enabling ticket sales.
- Created tickets management page in the admin panel to display and edit ticket prices.
- Added upgrade.php for database migrations, including creating the ticket_prices table and adding weekend price column.
This commit is contained in:
2026-02-23 00:17:46 +01:00
parent 58b2373712
commit 238c9ecaed
37 changed files with 2052 additions and 1841 deletions

49
upgrade.php Normal file
View File

@@ -0,0 +1,49 @@
<?php
error_reporting(E_ALL);
ini_set('display_errors', 1);
header('Content-Type: text/plain; charset=utf-8');
require_once 'config.php';
require_once 'libraries/medoo/medoo.php';
$mdb = new medoo([
'database_type' => 'mysql',
'database_name' => $database['name'],
'server' => $database['host'],
'username' => $database['user'],
'password' => $database['password'],
'charset' => 'utf8'
]);
$migrations = [
'ticket_prices' => "CREATE TABLE IF NOT EXISTS ticket_prices (
ticket_id VARCHAR(100) PRIMARY KEY,
price DECIMAL(10,2) DEFAULT NULL,
price_weekend DECIMAL(10,2) DEFAULT NULL,
dynamic_price_day0 DECIMAL(10,2) DEFAULT NULL,
dynamic_price_day1_2 DECIMAL(10,2) DEFAULT NULL,
dynamic_price_day3_7 DECIMAL(10,2) DEFAULT NULL,
updated_at DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8",
'ticket_prices_add_price_weekend' => "ALTER TABLE ticket_prices ADD COLUMN IF NOT EXISTS price_weekend DECIMAL(10,2) DEFAULT NULL AFTER price",
];
$ok = 0;
$errors = 0;
foreach ($migrations as $name => $sql) {
$result = $mdb->query($sql);
if ($result !== false) {
echo "[OK] $name\n";
$ok++;
} else {
$err = $mdb->error();
echo "[BLAD] $name: " . (is_array($err) ? end($err) : $err) . "\n";
$errors++;
}
}
echo "\nGotowe: $ok OK, $errors bledow.\n";