summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMaksymilian Jopek <maks@jopek.eu>2022-03-16 23:20:59 +0100
committerMaksymilian Jopek <maks@jopek.eu>2022-03-16 23:20:59 +0100
commitbf7852bccce954aff2d7c94161f4d301a0f29684 (patch)
treefc3f2aac4f843990b02992e02903df22857a1928
downloadmlos-bf7852bccce954aff2d7c94161f4d301a0f29684.tar.gz
mlos-bf7852bccce954aff2d7c94161f4d301a0f29684.tar.zst
mlos-bf7852bccce954aff2d7c94161f4d301a0f29684.zip
Initial commit w/ v1.0.0
-rw-r--r--.gitignore25
-rw-r--r--api/add.php55
-rw-r--r--api/change-order.php26
-rw-r--r--api/export.php43
-rw-r--r--api/remove.php19
-rw-r--r--composer.json5
-rw-r--r--composer.lock706
-rw-r--r--favicon.svg15
-rw-r--r--imgs/<br>thinkpad.pngbin0 -> 74515 bytes
-rw-r--r--imgs/artix.pngbin0 -> 172380 bytes
-rw-r--r--imgs/ring.pngbin0 -> 40517 bytes
-rw-r--r--imgs/wiedzmin.pngbin0 -> 54020 bytes
-rw-r--r--imgs/🙊.pngbin0 -> 34517 bytes
-rw-r--r--index.html76
-rw-r--r--index.php106
-rw-r--r--package.json14
-rw-r--r--pnpm-lock.yaml324
-rw-r--r--src/data.php38
-rw-r--r--src/db.xml30
-rw-r--r--src/main.js83
-rw-r--r--src/main.ts67
-rw-r--r--src/style.css25
-rwxr-xr-xstart4
-rw-r--r--tsconfig.json17
24 files changed, 1678 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..ccc5729
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,25 @@
+# Logs
+logs
+*.log
+npm-debug.log*
+yarn-debug.log*
+yarn-error.log*
+pnpm-debug.log*
+lerna-debug.log*
+
+node_modules
+dist
+dist-ssr
+*.local
+vendor
+
+# Editor directories and files
+.vscode/*
+!.vscode/extensions.json
+.idea
+.DS_Store
+*.suo
+*.ntvs*
+*.njsproj
+*.sln
+*.sw?
diff --git a/api/add.php b/api/add.php
new file mode 100644
index 0000000..b2e4c2d
--- /dev/null
+++ b/api/add.php
@@ -0,0 +1,55 @@
+<?php
+$req_keys = ["name", "author", "thumbnail", "magazine"];
+header("Location: " . $_SERVER["HTTP_REFERER"]);
+foreach ($req_keys as $key) {
+ if (!isset($_POST[$key])) {
+ http_response_code(400);
+ exit(0);
+ }
+}
+$path = "/home/maks/school/clientApps/mlos/src/db.xml";
+require_once "/home/maks/school/clientApps/mlos/src/data.php";
+
+$name = $_POST["name"];
+$author = $_POST["author"];
+$thumbnail = $_POST["thumbnail"];
+$magazine = $_POST["magazine"];
+$id = $_POST["id"];
+
+$doc = get_doc();
+error_log("ID: " . $id);
+
+if ($id) {
+ $xpath = new DOMXpath($doc);
+ $game = $xpath->query('//game[@id="' . $id . '"]')->item(0);
+ var_dump($game);
+ var_dump($game->getElementsByTagName);
+ $xpath->query('//game[@id="' . $id . '"]/name')->item(0)->nodeValue = $name;
+ $xpath->query('//game[@id="' . $id . '"]/author')->item(0)->nodeValue = $author;
+ $xpath->query('//game[@id="' . $id . '"]/thumbnail')->item(0)->nodeValue = $thumbnail;
+ $xpath->query('//game[@id="' . $id . '"]/magazine')->item(0)->nodeValue = $magazine;
+} else {
+ $root = $doc->getElementsByTagName("root")->item(0);
+ $game = $doc->createElement("game", "");
+
+ $mid = $doc->getElementsByTagName("mid")->item(0);
+ $game->setAttribute("id", $mid->nodeValue);
+ $mid->nodeValue = intval($mid->nodeValue) + 1;
+
+ $count = $doc->getElementsByTagName("count")->item(0);
+ $count->nodeValue = intval($count->nodeValue) + 1;
+ $game->setAttribute("order", $count->nodeValue);
+
+ $name = $doc->createElement("name", $name);
+ $author = $doc->createElement("author", $author);
+ $thumbnail = $doc->createElement("thumbnail", $thumbnail);
+ $magazine = $doc->createElement("magazine", $magazine);
+ $game->append($name);
+ $game->append($author);
+ $game->append($thumbnail);
+ $game->append($magazine);
+
+ $root->appendChild($game);
+}
+
+$doc->save($path);
diff --git a/api/change-order.php b/api/change-order.php
new file mode 100644
index 0000000..b498605
--- /dev/null
+++ b/api/change-order.php
@@ -0,0 +1,26 @@
+<?php
+if (empty($_POST["old-order"]) || empty($_POST["new-order"])) {
+ http_response_code(400);
+ error_log("not enough post");
+ exit(0);
+}
+$path = "/home/maks/school/clientApps/mlos/src/db.xml";
+require_once "/home/maks/school/clientApps/mlos/src/data.php";
+
+$old_order = $_POST["old-order"];
+$new_order = $_POST["new-order"];
+$count = $doc->getElementsByTagName("count")->item(0)->nodeValue;
+if ($new_order === strval(intval($count) + 1) || $new_order === "0") {
+ exit();
+}
+$doc = get_doc();
+$xpath = new DOMXpath($doc);
+$old_game = $xpath->query('//game[@order="' . $old_order . '"]')->item(0);
+$new_game = $xpath->query('//game[@order="' . $new_order . '"]')->item(0);
+$old_game->setAttribute("order", $new_order);
+$new_game->setAttribute("order", $old_order);
+
+// check for first
+
+$doc->save($path);
+header("Location: " . $_SERVER["HTTP_REFERER"]);
diff --git a/api/export.php b/api/export.php
new file mode 100644
index 0000000..77e36a2
--- /dev/null
+++ b/api/export.php
@@ -0,0 +1,43 @@
+<?php
+require_once '../vendor/autoload.php';
+require_once '../src/data.php';
+
+[$data, $count] = get_data();
+
+use PhpOffice\PhpSpreadsheet\Spreadsheet;
+use PhpOffice\PhpSpreadsheet\Writer\Xlsx;
+use PhpOffice\PhpSpreadsheet\Worksheet\Drawing;
+
+header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
+header('Content-Disposition: attachment;filename="mlos-data.xlsx"');
+header('Cache-Control: max-age=0');
+
+$spreadsheet = new Spreadsheet();
+$active_sheet = $spreadsheet->getActiveSheet();
+
+$active_sheet->setCellValue('A1', "Name");
+$active_sheet->setCellValue('B1', "Author");
+$active_sheet->setCellValue('C1', "Magazine");
+$row = 2;
+foreach ($data as $d) {
+ $active_sheet->setCellValue('A' . $row, $d["name"]);
+
+ $drawing = new Drawing();
+ $drawing->setName($d["name"]);
+ $drawing->setPath("../imgs/" . $d["thumbnail"]);
+ $drawing->setHeight(200);
+
+ $comment = $active_sheet->getComment('A' . $row);
+ $comment->setBackgroundImage($drawing);
+ $comment->setSizeAsBackgroundImage();
+
+
+ $active_sheet->setCellValue('B' . $row, $d["author"]);
+ $active_sheet->setCellValue('C' . $row, $d["magazine"]);
+ $row++;
+}
+
+$writer = new Xlsx($spreadsheet);
+$writer->save('php://output');
+
+$spreadsheet->disconnectWorksheets();
diff --git a/api/remove.php b/api/remove.php
new file mode 100644
index 0000000..65f1a82
--- /dev/null
+++ b/api/remove.php
@@ -0,0 +1,19 @@
+<?php
+if (empty($_POST["id"])) {
+ http_response_code(400);
+ exit(0);
+}
+$path = "/home/maks/school/clientApps/mlos/src/db.xml";
+require_once "/home/maks/school/clientApps/mlos/src/data.php";
+
+$id = $_POST["id"];
+$doc = get_doc();
+$xpath = new DOMXpath($doc);
+$game = $xpath->query('//game[@id="' . $id . '"]')->item(0);
+$game->parentNode->removeChild($game);
+
+$count = $doc->getElementsByTagName("count")->item(0);
+$count->nodeValue = intval($count->nodeValue) - 1;
+
+$doc->save($path);
+header("Location: " . $_SERVER["HTTP_REFERER"]);
diff --git a/composer.json b/composer.json
new file mode 100644
index 0000000..509eee8
--- /dev/null
+++ b/composer.json
@@ -0,0 +1,5 @@
+{
+ "require": {
+ "phpoffice/phpspreadsheet": "^1.22"
+ }
+}
diff --git a/composer.lock b/composer.lock
new file mode 100644
index 0000000..40330c0
--- /dev/null
+++ b/composer.lock
@@ -0,0 +1,706 @@
+{
+ "_readme": [
+ "This file locks the dependencies of your project to a known state",
+ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
+ "This file is @generated automatically"
+ ],
+ "content-hash": "e442471d898d555cab75123cc5bc6f4a",
+ "packages": [
+ {
+ "name": "ezyang/htmlpurifier",
+ "version": "v4.14.0",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/ezyang/htmlpurifier.git",
+ "reference": "12ab42bd6e742c70c0a52f7b82477fcd44e64b75"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/ezyang/htmlpurifier/zipball/12ab42bd6e742c70c0a52f7b82477fcd44e64b75",
+ "reference": "12ab42bd6e742c70c0a52f7b82477fcd44e64b75",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.2"
+ },
+ "type": "library",
+ "autoload": {
+ "files": [
+ "library/HTMLPurifier.composer.php"
+ ],
+ "psr-0": {
+ "HTMLPurifier": "library/"
+ },
+ "exclude-from-classmap": [
+ "/library/HTMLPurifier/Language/"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "LGPL-2.1-or-later"
+ ],
+ "authors": [
+ {
+ "name": "Edward Z. Yang",
+ "email": "admin@htmlpurifier.org",
+ "homepage": "http://ezyang.com"
+ }
+ ],
+ "description": "Standards compliant HTML filter written in PHP",
+ "homepage": "http://htmlpurifier.org/",
+ "keywords": [
+ "html"
+ ],
+ "support": {
+ "issues": "https://github.com/ezyang/htmlpurifier/issues",
+ "source": "https://github.com/ezyang/htmlpurifier/tree/v4.14.0"
+ },
+ "time": "2021-12-25T01:21:49+00:00"
+ },
+ {
+ "name": "maennchen/zipstream-php",
+ "version": "2.1.0",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/maennchen/ZipStream-PHP.git",
+ "reference": "c4c5803cc1f93df3d2448478ef79394a5981cc58"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/maennchen/ZipStream-PHP/zipball/c4c5803cc1f93df3d2448478ef79394a5981cc58",
+ "reference": "c4c5803cc1f93df3d2448478ef79394a5981cc58",
+ "shasum": ""
+ },
+ "require": {
+ "myclabs/php-enum": "^1.5",
+ "php": ">= 7.1",
+ "psr/http-message": "^1.0",
+ "symfony/polyfill-mbstring": "^1.0"
+ },
+ "require-dev": {
+ "ext-zip": "*",
+ "guzzlehttp/guzzle": ">= 6.3",
+ "mikey179/vfsstream": "^1.6",
+ "phpunit/phpunit": ">= 7.5"
+ },
+ "type": "library",
+ "autoload": {
+ "psr-4": {
+ "ZipStream\\": "src/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Paul Duncan",
+ "email": "pabs@pablotron.org"
+ },
+ {
+ "name": "Jonatan Männchen",
+ "email": "jonatan@maennchen.ch"
+ },
+ {
+ "name": "Jesse Donat",
+ "email": "donatj@gmail.com"
+ },
+ {
+ "name": "András Kolesár",
+ "email": "kolesar@kolesar.hu"
+ }
+ ],
+ "description": "ZipStream is a library for dynamically streaming dynamic zip files from PHP without writing to the disk at all on the server.",
+ "keywords": [
+ "stream",
+ "zip"
+ ],
+ "support": {
+ "issues": "https://github.com/maennchen/ZipStream-PHP/issues",
+ "source": "https://github.com/maennchen/ZipStream-PHP/tree/master"
+ },
+ "funding": [
+ {
+ "url": "https://opencollective.com/zipstream",
+ "type": "open_collective"
+ }
+ ],
+ "time": "2020-05-30T13:11:16+00:00"
+ },
+ {
+ "name": "markbaker/complex",
+ "version": "3.0.1",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/MarkBaker/PHPComplex.git",
+ "reference": "ab8bc271e404909db09ff2d5ffa1e538085c0f22"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/MarkBaker/PHPComplex/zipball/ab8bc271e404909db09ff2d5ffa1e538085c0f22",
+ "reference": "ab8bc271e404909db09ff2d5ffa1e538085c0f22",
+ "shasum": ""
+ },
+ "require": {
+ "php": "^7.2 || ^8.0"
+ },
+ "require-dev": {
+ "dealerdirect/phpcodesniffer-composer-installer": "^0.7.0",
+ "phpcompatibility/php-compatibility": "^9.0",
+ "phpunit/phpunit": "^7.0 || ^8.0 || ^9.3",
+ "squizlabs/php_codesniffer": "^3.4"
+ },
+ "type": "library",
+ "autoload": {
+ "psr-4": {
+ "Complex\\": "classes/src/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Mark Baker",
+ "email": "mark@lange.demon.co.uk"
+ }
+ ],
+ "description": "PHP Class for working with complex numbers",
+ "homepage": "https://github.com/MarkBaker/PHPComplex",
+ "keywords": [
+ "complex",
+ "mathematics"
+ ],
+ "support": {
+ "issues": "https://github.com/MarkBaker/PHPComplex/issues",
+ "source": "https://github.com/MarkBaker/PHPComplex/tree/3.0.1"
+ },
+ "time": "2021-06-29T15:32:53+00:00"
+ },
+ {
+ "name": "markbaker/matrix",
+ "version": "3.0.0",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/MarkBaker/PHPMatrix.git",
+ "reference": "c66aefcafb4f6c269510e9ac46b82619a904c576"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/MarkBaker/PHPMatrix/zipball/c66aefcafb4f6c269510e9ac46b82619a904c576",
+ "reference": "c66aefcafb4f6c269510e9ac46b82619a904c576",
+ "shasum": ""
+ },
+ "require": {
+ "php": "^7.1 || ^8.0"
+ },
+ "require-dev": {
+ "dealerdirect/phpcodesniffer-composer-installer": "^0.7.0",
+ "phpcompatibility/php-compatibility": "^9.0",
+ "phpdocumentor/phpdocumentor": "2.*",
+ "phploc/phploc": "^4.0",
+ "phpmd/phpmd": "2.*",
+ "phpunit/phpunit": "^7.0 || ^8.0 || ^9.3",
+ "sebastian/phpcpd": "^4.0",
+ "squizlabs/php_codesniffer": "^3.4"
+ },
+ "type": "library",
+ "autoload": {
+ "psr-4": {
+ "Matrix\\": "classes/src/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Mark Baker",
+ "email": "mark@demon-angel.eu"
+ }
+ ],
+ "description": "PHP Class for working with matrices",
+ "homepage": "https://github.com/MarkBaker/PHPMatrix",
+ "keywords": [
+ "mathematics",
+ "matrix",
+ "vector"
+ ],
+ "support": {
+ "issues": "https://github.com/MarkBaker/PHPMatrix/issues",
+ "source": "https://github.com/MarkBaker/PHPMatrix/tree/3.0.0"
+ },
+ "time": "2021-07-01T19:01:15+00:00"
+ },
+ {
+ "name": "myclabs/php-enum",
+ "version": "1.8.3",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/myclabs/php-enum.git",
+ "reference": "b942d263c641ddb5190929ff840c68f78713e937"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/myclabs/php-enum/zipball/b942d263c641ddb5190929ff840c68f78713e937",
+ "reference": "b942d263c641ddb5190929ff840c68f78713e937",
+ "shasum": ""
+ },
+ "require": {
+ "ext-json": "*",
+ "php": "^7.3 || ^8.0"
+ },
+ "require-dev": {
+ "phpunit/phpunit": "^9.5",
+ "squizlabs/php_codesniffer": "1.*",
+ "vimeo/psalm": "^4.6.2"
+ },
+ "type": "library",
+ "autoload": {
+ "psr-4": {
+ "MyCLabs\\Enum\\": "src/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "PHP Enum contributors",
+ "homepage": "https://github.com/myclabs/php-enum/graphs/contributors"
+ }
+ ],
+ "description": "PHP Enum implementation",
+ "homepage": "http://github.com/myclabs/php-enum",
+ "keywords": [
+ "enum"
+ ],
+ "support": {
+ "issues": "https://github.com/myclabs/php-enum/issues",
+ "source": "https://github.com/myclabs/php-enum/tree/1.8.3"
+ },
+ "funding": [
+ {
+ "url": "https://github.com/mnapoli",
+ "type": "github"
+ },
+ {
+ "url": "https://tidelift.com/funding/github/packagist/myclabs/php-enum",
+ "type": "tidelift"
+ }
+ ],
+ "time": "2021-07-05T08:18:36+00:00"
+ },
+ {
+ "name": "phpoffice/phpspreadsheet",
+ "version": "1.22.0",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/PHPOffice/PhpSpreadsheet.git",
+ "reference": "3a9e29b4f386a08a151a33578e80ef1747037a48"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/PHPOffice/PhpSpreadsheet/zipball/3a9e29b4f386a08a151a33578e80ef1747037a48",
+ "reference": "3a9e29b4f386a08a151a33578e80ef1747037a48",
+ "shasum": ""
+ },
+ "require": {
+ "ext-ctype": "*",
+ "ext-dom": "*",
+ "ext-fileinfo": "*",
+ "ext-gd": "*",
+ "ext-iconv": "*",
+ "ext-libxml": "*",
+ "ext-mbstring": "*",
+ "ext-simplexml": "*",
+ "ext-xml": "*",
+ "ext-xmlreader": "*",
+ "ext-xmlwriter": "*",
+ "ext-zip": "*",
+ "ext-zlib": "*",
+ "ezyang/htmlpurifier": "^4.13",
+ "maennchen/zipstream-php": "^2.1",
+ "markbaker/complex": "^3.0",
+ "markbaker/matrix": "^3.0",
+ "php": "^7.3 || ^8.0",
+ "psr/http-client": "^1.0",
+ "psr/http-factory": "^1.0",
+ "psr/simple-cache": "^1.0"
+ },
+ "require-dev": {
+ "dealerdirect/phpcodesniffer-composer-installer": "dev-master",
+ "dompdf/dompdf": "^1.0",
+ "friendsofphp/php-cs-fixer": "^3.2",
+ "jpgraph/jpgraph": "^4.0",
+ "mpdf/mpdf": "8.0.17",
+ "phpcompatibility/php-compatibility": "^9.3",
+ "phpstan/phpstan": "^1.1",
+ "phpstan/phpstan-phpunit": "^1.0",
+ "phpunit/phpunit": "^8.5 || ^9.0",
+ "squizlabs/php_codesniffer": "^3.6",
+ "tecnickcom/tcpdf": "^6.4"
+ },
+ "suggest": {
+ "dompdf/dompdf": "Option for rendering PDF with PDF Writer (doesn't yet support PHP8)",
+ "jpgraph/jpgraph": "Option for rendering charts, or including charts with PDF or HTML Writers",
+ "mpdf/mpdf": "Option for rendering PDF with PDF Writer",
+ "tecnickcom/tcpdf": "Option for rendering PDF with PDF Writer (doesn't yet support PHP8)"
+ },
+ "type": "library",
+ "autoload": {
+ "psr-4": {
+ "PhpOffice\\PhpSpreadsheet\\": "src/PhpSpreadsheet"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Maarten Balliauw",
+ "homepage": "https://blog.maartenballiauw.be"
+ },
+ {
+ "name": "Mark Baker",
+ "homepage": "https://markbakeruk.net"
+ },
+ {
+ "name": "Franck Lefevre",
+ "homepage": "https://rootslabs.net"
+ },
+ {
+ "name": "Erik Tilt"
+ },
+ {
+ "name": "Adrien Crivelli"
+ }
+ ],
+ "description": "PHPSpreadsheet - Read, Create and Write Spreadsheet documents in PHP - Spreadsheet engine",
+ "homepage": "https://github.com/PHPOffice/PhpSpreadsheet",
+ "keywords": [
+ "OpenXML",
+ "excel",
+ "gnumeric",
+ "ods",
+ "php",
+ "spreadsheet",
+ "xls",
+ "xlsx"
+ ],
+ "support": {
+ "issues": "https://github.com/PHPOffice/PhpSpreadsheet/issues",
+ "source": "https://github.com/PHPOffice/PhpSpreadsheet/tree/1.22.0"
+ },
+ "time": "2022-02-18T12:57:07+00:00"
+ },
+ {
+ "name": "psr/http-client",
+ "version": "1.0.1",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/php-fig/http-client.git",
+ "reference": "2dfb5f6c5eff0e91e20e913f8c5452ed95b86621"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/php-fig/http-client/zipball/2dfb5f6c5eff0e91e20e913f8c5452ed95b86621",
+ "reference": "2dfb5f6c5eff0e91e20e913f8c5452ed95b86621",
+ "shasum": ""
+ },
+ "require": {
+ "php": "^7.0 || ^8.0",
+ "psr/http-message": "^1.0"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "1.0.x-dev"
+ }
+ },
+ "autoload": {
+ "psr-4": {
+ "Psr\\Http\\Client\\": "src/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "PHP-FIG",
+ "homepage": "http://www.php-fig.org/"
+ }
+ ],
+ "description": "Common interface for HTTP clients",
+ "homepage": "https://github.com/php-fig/http-client",
+ "keywords": [
+ "http",
+ "http-client",
+ "psr",
+ "psr-18"
+ ],
+ "support": {
+ "source": "https://github.com/php-fig/http-client/tree/master"
+ },
+ "time": "2020-06-29T06:28:15+00:00"
+ },
+ {
+ "name": "psr/http-factory",
+ "version": "1.0.1",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/php-fig/http-factory.git",
+ "reference": "12ac7fcd07e5b077433f5f2bee95b3a771bf61be"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/php-fig/http-factory/zipball/12ac7fcd07e5b077433f5f2bee95b3a771bf61be",
+ "reference": "12ac7fcd07e5b077433f5f2bee95b3a771bf61be",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=7.0.0",
+ "psr/http-message": "^1.0"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "1.0.x-dev"
+ }
+ },
+ "autoload": {
+ "psr-4": {
+ "Psr\\Http\\Message\\": "src/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "PHP-FIG",
+ "homepage": "http://www.php-fig.org/"
+ }
+ ],
+ "description": "Common interfaces for PSR-7 HTTP message factories",
+ "keywords": [
+ "factory",
+ "http",
+ "message",
+ "psr",
+ "psr-17",
+ "psr-7",
+ "request",
+ "response"
+ ],
+ "support": {
+ "source": "https://github.com/php-fig/http-factory/tree/master"
+ },
+ "time": "2019-04-30T12:38:16+00:00"
+ },
+ {
+ "name": "psr/http-message",
+ "version": "1.0.1",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/php-fig/http-message.git",
+ "reference": "f6561bf28d520154e4b0ec72be95418abe6d9363"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/php-fig/http-message/zipball/f6561bf28d520154e4b0ec72be95418abe6d9363",
+ "reference": "f6561bf28d520154e4b0ec72be95418abe6d9363",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.3.0"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "1.0.x-dev"
+ }
+ },
+ "autoload": {
+ "psr-4": {
+ "Psr\\Http\\Message\\": "src/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "PHP-FIG",
+ "homepage": "http://www.php-fig.org/"
+ }
+ ],
+ "description": "Common interface for HTTP messages",
+ "homepage": "https://github.com/php-fig/http-message",
+ "keywords": [
+ "http",
+ "http-message",
+ "psr",
+ "psr-7",
+ "request",
+ "response"
+ ],
+ "support": {
+ "source": "https://github.com/php-fig/http-message/tree/master"
+ },
+ "time": "2016-08-06T14:39:51+00:00"
+ },
+ {
+ "name": "psr/simple-cache",
+ "version": "1.0.1",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/php-fig/simple-cache.git",
+ "reference": "408d5eafb83c57f6365a3ca330ff23aa4a5fa39b"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/php-fig/simple-cache/zipball/408d5eafb83c57f6365a3ca330ff23aa4a5fa39b",
+ "reference": "408d5eafb83c57f6365a3ca330ff23aa4a5fa39b",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.3.0"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "1.0.x-dev"
+ }
+ },
+ "autoload": {
+ "psr-4": {
+ "Psr\\SimpleCache\\": "src/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "PHP-FIG",
+ "homepage": "http://www.php-fig.org/"
+ }
+ ],
+ "description": "Common interfaces for simple caching",
+ "keywords": [
+ "cache",
+ "caching",
+ "psr",
+ "psr-16",
+ "simple-cache"
+ ],
+ "support": {
+ "source": "https://github.com/php-fig/simple-cache/tree/master"
+ },
+ "time": "2017-10-23T01:57:42+00:00"
+ },
+ {
+ "name": "symfony/polyfill-mbstring",
+ "version": "v1.25.0",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/symfony/polyfill-mbstring.git",
+ "reference": "0abb51d2f102e00a4eefcf46ba7fec406d245825"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/0abb51d2f102e00a4eefcf46ba7fec406d245825",
+ "reference": "0abb51d2f102e00a4eefcf46ba7fec406d245825",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=7.1"
+ },
+ "provide": {
+ "ext-mbstring": "*"
+ },
+ "suggest": {
+ "ext-mbstring": "For best performance"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-main": "1.23-dev"
+ },
+ "thanks": {
+ "name": "symfony/polyfill",
+ "url": "https://github.com/symfony/polyfill"
+ }
+ },
+ "autoload": {
+ "files": [
+ "bootstrap.php"
+ ],
+ "psr-4": {
+ "Symfony\\Polyfill\\Mbstring\\": ""
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Nicolas Grekas",
+ "email": "p@tchwork.com"
+ },
+ {
+ "name": "Symfony Community",
+ "homepage": "https://symfony.com/contributors"
+ }
+ ],
+ "description": "Symfony polyfill for the Mbstring extension",
+ "homepage": "https://symfony.com",
+ "keywords": [
+ "compatibility",
+ "mbstring",
+ "polyfill",
+ "portable",
+ "shim"
+ ],
+ "support": {
+ "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.25.0"
+ },
+ "funding": [
+ {
+ "url": "https://symfony.com/sponsor",
+ "type": "custom"
+ },
+ {
+ "url": "https://github.com/fabpot",
+ "type": "github"
+ },
+ {
+ "url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
+ "type": "tidelift"
+ }
+ ],
+ "time": "2021-11-30T18:21:41+00:00"
+ }
+ ],
+ "packages-dev": [],
+ "aliases": [],
+ "minimum-stability": "stable",
+ "stability-flags": [],
+ "prefer-stable": false,
+ "prefer-lowest": false,
+ "platform": [],
+ "platform-dev": [],
+ "plugin-api-version": "2.2.0"
+}
diff --git a/favicon.svg b/favicon.svg
new file mode 100644
index 0000000..de4aedd
--- /dev/null
+++ b/favicon.svg
@@ -0,0 +1,15 @@
+<svg width="410" height="404" viewBox="0 0 410 404" fill="none" xmlns="http://www.w3.org/2000/svg">
+<path d="M399.641 59.5246L215.643 388.545C211.844 395.338 202.084 395.378 198.228 388.618L10.5817 59.5563C6.38087 52.1896 12.6802 43.2665 21.0281 44.7586L205.223 77.6824C206.398 77.8924 207.601 77.8904 208.776 77.6763L389.119 44.8058C397.439 43.2894 403.768 52.1434 399.641 59.5246Z" fill="url(#paint0_linear)"/>
+<path d="M292.965 1.5744L156.801 28.2552C154.563 28.6937 152.906 30.5903 152.771 32.8664L144.395 174.33C144.198 177.662 147.258 180.248 150.51 179.498L188.42 170.749C191.967 169.931 195.172 173.055 194.443 176.622L183.18 231.775C182.422 235.487 185.907 238.661 189.532 237.56L212.947 230.446C216.577 229.344 220.065 232.527 219.297 236.242L201.398 322.875C200.278 328.294 207.486 331.249 210.492 326.603L212.5 323.5L323.454 102.072C325.312 98.3645 322.108 94.137 318.036 94.9228L279.014 102.454C275.347 103.161 272.227 99.746 273.262 96.1583L298.731 7.86689C299.767 4.27314 296.636 0.855181 292.965 1.5744Z" fill="url(#paint1_linear)"/>
+<defs>
+<linearGradient id="paint0_linear" x1="6.00017" y1="32.9999" x2="235" y2="344" gradientUnits="userSpaceOnUse">
+<stop stop-color="#41D1FF"/>
+<stop offset="1" stop-color="#BD34FE"/>
+</linearGradient>
+<linearGradient id="paint1_linear" x1="194.651" y1="8.81818" x2="236.076" y2="292.989" gradientUnits="userSpaceOnUse">
+<stop stop-color="#FFEA83"/>
+<stop offset="0.0833333" stop-color="#FFDD35"/>
+<stop offset="1" stop-color="#FFA800"/>
+</linearGradient>
+</defs>
+</svg>
diff --git a/imgs/<br>thinkpad.png b/imgs/<br>thinkpad.png
new file mode 100644
index 0000000..32e264e
--- /dev/null
+++ b/imgs/<br>thinkpad.png
Binary files differ
diff --git a/imgs/artix.png b/imgs/artix.png
new file mode 100644
index 0000000..14abb0a
--- /dev/null
+++ b/imgs/artix.png
Binary files differ
diff --git a/imgs/ring.png b/imgs/ring.png
new file mode 100644
index 0000000..74ce417
--- /dev/null
+++ b/imgs/ring.png
Binary files differ
diff --git a/imgs/wiedzmin.png b/imgs/wiedzmin.png
new file mode 100644
index 0000000..ccf9982
--- /dev/null
+++ b/imgs/wiedzmin.png
Binary files differ
diff --git a/imgs/🙊.png b/imgs/🙊.png
new file mode 100644
index 0000000..5425cc0
--- /dev/null
+++ b/imgs/🙊.png
Binary files differ
diff --git a/index.html b/index.html
new file mode 100644
index 0000000..a9e21d1
--- /dev/null
+++ b/index.html
@@ -0,0 +1,76 @@
+<!DOCTYPE html>
+<html lang="en">
+
+<head>
+ <meta charset="UTF-8" />
+ <link rel="icon" type="image/svg+xml" href="favicon.svg" />
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
+ <title>Markup Language of Saddness</title>
+</head>
+
+<body>
+ <header>
+ <button type="button"><a href="?a=2">Positions</a></button>
+ <button type="button"><a href="?a=1">Preview</a></button>
+ </header>
+ <table>
+ <thead>
+ <tr>
+ <th></th>
+ <th>Game name</th>
+ <th>Thumbnail</th>
+ <th>Author</th>
+ <th>Magazine</th>
+ <th></th>
+ </tr>
+ </thead>
+ <tbody>
+ <!-- <tr> -->
+ <!-- <form action="api/remove.php" method="post"> -->
+ <!-- <td><input type="submit" onclick="edit(event)" value="E" data-id="1"></td> -->
+ <!-- <td data-id="1">aaa</td> -->
+ <!-- <td data-id="1"><img -->
+ <!-- src="https://imgs.search.brave.com/KqHJJsmXK8iQNxtSGxWy2TljZv7KDdyCz9o6iGYoFRk/rs:fit:1200:1200:1/g:ce/aHR0cHM6Ly93d3cu/bGFrZXN1cGVyaW9y/LmNvbS9kb3dubG9h/ZHMvNzE1MC9kb3du/bG9hZC80MDFwYy5i/aG00LmpwZz9jYj1k/M2NiNTE1NzA5YjFl/M2IwMjc5YzBkMDZi/YWU4YzRiNCZ3PTEy/MDA" -->
+ <!-- width="200"></td> -->
+ <!-- <td data-id="1">aaa</td> -->
+ <!-- <td data-id="1">aaane</td> -->
+ <!-- <td><input type="submit" value="Remove" data-id="1"></td> -->
+ <!-- <input type="hidden" name="id" value="1" data-id="1" /> -->
+ <!-- </form> -->
+ <!-- </tr> -->
+ <tr>
+ <form action="api/remove.php" method="post">
+ <td><input type="submit" onclick="edit(event)" value="E" data-id="1"></td>
+ <td data-id="1">aaa</td>
+ <td data-id="1">aaaail</td>
+ <td data-id="1">aaa</td>
+ <td data-id="1">aaane</td>
+ <td><input type="submit" value="Remove" data-id="1"></td>
+ </form>
+ </tr>
+ <tr>
+ <form action="api/remove.php" method="post">
+ <td><input type="submit" onclick="edit(event)" value="E" data-id="2"></td>
+ <td data-id="2">aaa</td>
+ <td data-id="2">aaaail</td>
+ <td data-id="2">aaa</td>
+ <td data-id="2">aaane</td>
+ <td><input type="submit" value="Remove" data-id="2"></td>
+ </form>
+ </tr>
+ <!-- <tr> -->
+ <!-- <form action="api/add.php" method="post"> -->
+ <!-- <td></td> -->
+ <!-- <td><input type="text" name="name"></td> -->
+ <!-- <td><input type="text" name="thumbnail"></td> -->
+ <!-- <td><input type="text" name="author"></td> -->
+ <!-- <td><input type="text" name="magazine"></td> -->
+ <!-- <td><input type="submit" value="Add"></td> -->
+ <!-- </form> -->
+ <!-- </tr> -->
+ </tbody>
+ </table>
+ <script type="module" src="/src/main.ts"></script>
+</body>
+
+</html>
diff --git a/index.php b/index.php
new file mode 100644
index 0000000..ea19837
--- /dev/null
+++ b/index.php
@@ -0,0 +1,106 @@
+<!DOCTYPE html>
+<html lang="en">
+
+<head>
+ <meta charset="UTF-8" />
+ <link rel="icon" type="image/svg+xml" href="favicon.svg" />
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
+ <title>Markup Language of Saddness</title>
+ <link rel="stylesheet" href="src/style.css" />
+</head>
+
+<?php
+require_once "src/data.php";
+[$data, $count] = get_data();
+function is_pos(): bool
+{
+ return $_GET["m"] === "pos" || $_GET["m"] === "" || !$_GET["m"];
+}
+?>
+
+<body>
+ <header>
+ <button type="button"><a href="?m=pos">Positions</a></button>
+ <button type="button"><a href="?m=pre">Preview</a></button>
+ </header>
+ <table>
+ <thead>
+ <tr>
+ <th></th>
+ <th></th>
+ <th>Game name</th>
+ <th>Thumbnail</th>
+ <th>Author</th>
+ <th>Magazine</th>
+ <th></th>
+ <th></th>
+ </tr>
+ </thead>
+ <tbody>
+ <?php if (is_pos()) { ?>
+ <?php foreach ($data as $d) { ?>
+ <tr>
+ <form action="api/change-order.php" method="post">
+ <td>
+ <?php if ($d["order"] !== $count) { ?>
+ <input type="hidden" name="old-order" value="<?= $d["order"] ?>">
+ <input type="hidden" name="new-order" value="<?= intval($d["order"]) + 1 ?>">
+ <input type="submit" value="pos -" />
+ <?php } ?>
+ </td>
+ </form>
+ <form action="api/remove.php" method="post">
+ <td><input type="submit" onclick="edit(event)" value="E" data-id="<?= $d['id'] ?>"></td>
+ <td data-id="<?= $d['id'] ?>"><?= htmlspecialchars($d["name"]) ?></td>
+ <td data-id="<?= $d['id'] ?>"><?= htmlspecialchars($d["thumbnail"]) ?></td>
+ <td data-id="<?= $d['id'] ?>"><?= htmlspecialchars($d["author"]) ?></td>
+ <td data-id="<?= $d['id'] ?>"><?= $d["magazine"] ?></td>
+ <td><input type="submit" value="Remove" data-id="<?= $d['id'] ?>"></td>
+ <input type="hidden" name="id" value="<?= $d['id'] ?>" data-id="<?= $d['id'] ?>" />
+ </form>
+ <form action="api/change-order.php" method="post">
+ <td>
+ <?php if ($d["order"] !== "1") { ?>
+ <input type="hidden" name="old-order" value="<?= $d["order"] ?>">
+ <input type="hidden" name="new-order" value="<?= intval($d["order"]) - 1 ?>">
+ <input type="submit" value="pos +" />
+ <?php } ?>
+ </td>
+ </form>
+ </tr>
+ <?php } ?>
+ <?php } ?>
+ <?php if ($_GET["m"] === "pre") { ?>
+ <?php foreach ($data as $d) { ?>
+ <tr>
+ <form action="api/remove.php" method="post">
+ <td></td>
+ <td data-id="<?= $d['id'] ?>"><?= htmlspecialchars($d["name"]) ?></td>
+ <td data-id="<?= $d['id'] ?>"><img src="/imgs/<?= htmlspecialchars($d["thumbnail"]) ?>" width="200" /></td>
+ <td data-id="<?= $d['id'] ?>"><?= htmlspecialchars($d["author"]) ?></td>
+ <td data-id="<?= $d['id'] ?>"><?= $d["magazine"] ?></td>
+ <td></td>
+ </form>
+ </tr>
+ <?php } ?>
+ <?php } ?>
+ <?php if (is_pos()) { ?>
+ <tr>
+ <form action="api/add.php" method="post">
+ <td></td>
+ <td></td>
+ <td><input type="text" name="name"></td>
+ <td><input type="text" name="thumbnail"></td>
+ <td><input type="text" name="author"></td>
+ <td><input type="text" name="magazine"></td>
+ <td><input type="submit" value="Add"></td>
+ </form>
+ </tr>
+ <?php } ?>
+ </tbody>
+ </table>
+ <a href="/api/export.php">Export to xlsx</a>
+ <script src="/src/main.js"></script>
+</body>
+
+</html>
diff --git a/package.json b/package.json
new file mode 100644
index 0000000..1882668
--- /dev/null
+++ b/package.json
@@ -0,0 +1,14 @@
+{
+ "name": "mlos",
+ "private": true,
+ "version": "0.0.0",
+ "scripts": {
+ "dev": "vite",
+ "build": "tsc && vite build",
+ "preview": "vite preview"
+ },
+ "devDependencies": {
+ "typescript": "^4.5.4",
+ "vite": "^2.8.0"
+ }
+}
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
new file mode 100644
index 0000000..3503365
--- /dev/null
+++ b/pnpm-lock.yaml
@@ -0,0 +1,324 @@
+lockfileVersion: 5.3
+
+specifiers:
+ typescript: ^4.5.4
+ vite: ^2.8.0
+
+devDependencies:
+ typescript: 4.6.2
+ vite: 2.8.6
+
+packages:
+
+ /esbuild-android-64/0.14.25:
+ resolution: {integrity: sha512-L5vCUk7TzFbBnoESNoXjU3x9+/+7TDIE/1mTfy/erAfvZAqC+S3sp/Qa9wkypFMcFvN9FzvESkTlpeQDolREtQ==}
+ engines: {node: '>=12'}
+ cpu: [x64]
+ os: [android]
+ requiresBuild: true
+ dev: true
+ optional: true
+
+ /esbuild-android-arm64/0.14.25:
+ resolution: {integrity: sha512-4jv5xPjM/qNm27T5j3ZEck0PvjgQtoMHnz4FzwF5zNP56PvY2CT0WStcAIl6jNlsuDdN63rk2HRBIsO6xFbcFw==}
+ engines: {node: '>=12'}
+ cpu: [arm64]
+ os: [android]
+ requiresBuild: true
+ dev: true
+ optional: true
+
+ /esbuild-darwin-64/0.14.25:
+ resolution: {integrity: sha512-TGp8tuudIxOyWd1+8aYPxQmC1ZQyvij/AfNBa35RubixD0zJ1vkKHVAzo0Zao1zcG6pNqiSyzfPto8vmg0s7oA==}
+ engines: {node: '>=12'}
+ cpu: [x64]
+ os: [darwin]
+ requiresBuild: true
+ dev: true
+ optional: true
+
+ /esbuild-darwin-arm64/0.14.25:
+ resolution: {integrity: sha512-oTcDgdm0MDVEmw2DWu8BV68pYuImpFgvWREPErBZmNA4MYKGuBRaCiJqq6jZmBR1x+3y1DWCjez+5uLtuAm6mw==}
+ engines: {node: '>=12'}
+ cpu: [arm64]
+ os: [darwin]
+ requiresBuild: true
+ dev: true
+ optional: true
+
+ /esbuild-freebsd-64/0.14.25:
+ resolution: {integrity: sha512-ueAqbnMZ8arnuLH8tHwTCQYeptnHOUV7vA6px6j4zjjQwDx7TdP7kACPf3TLZLdJQ3CAD1XCvQ2sPhX+8tacvQ==}
+ engines: {node: '>=12'}
+ cpu: [x64]
+ os: [freebsd]
+ requiresBuild: true
+ dev: true
+ optional: true
+
+ /esbuild-freebsd-arm64/0.14.25:
+ resolution: {integrity: sha512-+ZVWud2HKh+Ob6k/qiJWjBtUg4KmJGGmbvEXXW1SNKS7hW7HU+Zq2ZCcE1akFxOPkVB+EhOty/sSek30tkCYug==}
+ engines: {node: '>=12'}
+ cpu: [arm64]
+ os: [freebsd]
+ requiresBuild: true
+ dev: true
+ optional: true
+
+ /esbuild-linux-32/0.14.25:
+ resolution: {integrity: sha512-3OP/lwV3kCzEz45tobH9nj+uE4ubhGsfx+tn0L26WAGtUbmmcRpqy7XRG/qK7h1mClZ+eguIANcQntYMdYklfw==}
+ engines: {node: '>=12'}
+ cpu: [ia32]
+ os: [linux]
+ requiresBuild: true
+ dev: true
+ optional: true
+
+ /esbuild-linux-64/0.14.25:
+ resolution: {integrity: sha512-+aKHdHZmX9qwVlQmu5xYXh7GsBFf4TWrePgeJTalhXHOG7NNuUwoHmketGiZEoNsWyyqwH9rE5BC+iwcLY30Ug==}
+ engines: {node: '>=12'}
+ cpu: [x64]
+ os: [linux]
+ requiresBuild: true
+ dev: true
+ optional: true
+
+ /esbuild-linux-arm/0.14.25:
+ resolution: {integrity: sha512-aTLcE2VBoLydL943REcAcgnDi3bHtmULSXWLbjtBdtykRatJVSxKMjK9YlBXUZC4/YcNQfH7AxwVeQr9fNxPhw==}
+ engines: {node: '>=12'}
+ cpu: [arm]
+ os: [linux]
+ requiresBuild: true
+ dev: true
+ optional: true
+
+ /esbuild-linux-arm64/0.14.25:
+ resolution: {integrity: sha512-UxfenPx/wSZx55gScCImPtXekvZQLI2GW3qe5dtlmU7luiqhp5GWPzGeQEbD3yN3xg/pHc671m5bma5Ns7lBHw==}
+ engines: {node: '>=12'}
+ cpu: [arm64]
+ os: [linux]
+ requiresBuild: true
+ dev: true
+ optional: true
+
+ /esbuild-linux-mips64le/0.14.25:
+ resolution: {integrity: sha512-wLWYyqVfYx9Ur6eU5RT92yJVsaBGi5RdkoWqRHOqcJ38Kn60QMlcghsKeWfe9jcYut8LangYZ98xO1LxIoSXrQ==}
+ engines: {node: '>=12'}
+ cpu: [mips64el]
+ os: [linux]
+ requiresBuild: true
+ dev: true
+ optional: true
+
+ /esbuild-linux-ppc64le/0.14.25:
+ resolution: {integrity: sha512-0dR6Csl6Zas3g4p9ULckEl8Mo8IInJh33VCJ3eaV1hj9+MHGdmDOakYMN8MZP9/5nl+NU/0ygpd14cWgy8uqRw==}
+ engines: {node: '>=12'}
+ cpu: [ppc64]
+ os: [linux]
+ requiresBuild: true
+ dev: true
+ optional: true
+
+ /esbuild-linux-riscv64/0.14.25:
+ resolution: {integrity: sha512-J4d20HDmTrgvhR0bdkDhvvJGaikH3LzXQnNaseo8rcw9Yqby9A90gKUmWpfwqLVNRILvNnAmKLfBjCKU9ajg8w==}
+ engines: {node: '>=12'}
+ cpu: [riscv64]
+ os: [linux]
+ requiresBuild: true
+ dev: true
+ optional: true
+
+ /esbuild-linux-s390x/0.14.25:
+ resolution: {integrity: sha512-YI2d5V6nTE73ZnhEKQD7MtsPs1EtUZJ3obS21oxQxGbbRw1G+PtJKjNyur+3t6nzHP9oTg6GHQ3S3hOLLmbDIQ==}
+ engines: {node: '>=12'}
+ cpu: [s390x]
+ os: [linux]
+ requiresBuild: true
+ dev: true
+ optional: true
+
+ /esbuild-netbsd-64/0.14.25:
+ resolution: {integrity: sha512-TKIVgNWLUOkr+Exrye70XTEE1lJjdQXdM4tAXRzfHE9iBA7LXWcNtVIuSnphTqpanPzTDFarF0yqq4kpbC6miA==}
+ engines: {node: '>=12'}
+ cpu: [x64]
+ os: [netbsd]
+ requiresBuild: true
+ dev: true
+ optional: true
+
+ /esbuild-openbsd-64/0.14.25:
+ resolution: {integrity: sha512-QgFJ37A15D7NIXBTYEqz29+uw3nNBOIyog+3kFidANn6kjw0GHZ0lEYQn+cwjyzu94WobR+fes7cTl/ZYlHb1A==}
+ engines: {node: '>=12'}
+ cpu: [x64]
+ os: [openbsd]
+ requiresBuild: true
+ dev: true
+ optional: true
+
+ /esbuild-sunos-64/0.14.25:
+ resolution: {integrity: sha512-rmWfjUItYIVlqr5EnTH1+GCxXiBOC42WBZ3w++qh7n2cS9Xo0lO5pGSG2N+huOU2fX5L+6YUuJ78/vOYvefeFw==}
+ engines: {node: '>=12'}
+ cpu: [x64]
+ os: [sunos]
+ requiresBuild: true
+ dev: true
+ optional: true
+
+ /esbuild-windows-32/0.14.25:
+ resolution: {integrity: sha512-HGAxVUofl3iUIz9W10Y9XKtD0bNsK9fBXv1D55N/ljNvkrAYcGB8YCm0v7DjlwtyS6ws3dkdQyXadbxkbzaKOA==}
+ engines: {node: '>=12'}
+ cpu: [ia32]
+ os: [win32]
+ requiresBuild: true
+ dev: true
+ optional: true
+
+ /esbuild-windows-64/0.14.25:
+ resolution: {integrity: sha512-TirEohRkfWU9hXLgoDxzhMQD1g8I2mOqvdQF2RS9E/wbkORTAqJHyh7wqGRCQAwNzdNXdg3JAyhQ9/177AadWA==}
+ engines: {node: '>=12'}
+ cpu: [x64]
+ os: [win32]
+ requiresBuild: true
+ dev: true
+ optional: true
+
+ /esbuild-windows-arm64/0.14.25:
+ resolution: {integrity: sha512-4ype9ERiI45rSh+R8qUoBtaj6kJvUOI7oVLhKqPEpcF4Pa5PpT3hm/mXAyotJHREkHpM87PAJcA442mLnbtlNA==}
+ engines: {node: '>=12'}
+ cpu: [arm64]
+ os: [win32]
+ requiresBuild: true
+ dev: true
+ optional: true
+
+ /esbuild/0.14.25:
+ resolution: {integrity: sha512-4JHEIOMNFvK09ziiL+iVmldIhLbn49V4NAVo888tcGFKedEZY/Y8YapfStJ6zSE23tzYPKxqKwQBnQoIO0BI/Q==}
+ engines: {node: '>=12'}
+ hasBin: true
+ requiresBuild: true
+ optionalDependencies:
+ esbuild-android-64: 0.14.25
+ esbuild-android-arm64: 0.14.25
+ esbuild-darwin-64: 0.14.25
+ esbuild-darwin-arm64: 0.14.25
+ esbuild-freebsd-64: 0.14.25
+ esbuild-freebsd-arm64: 0.14.25
+ esbuild-linux-32: 0.14.25
+ esbuild-linux-64: 0.14.25
+ esbuild-linux-arm: 0.14.25
+ esbuild-linux-arm64: 0.14.25
+ esbuild-linux-mips64le: 0.14.25
+ esbuild-linux-ppc64le: 0.14.25
+ esbuild-linux-riscv64: 0.14.25
+ esbuild-linux-s390x: 0.14.25
+ esbuild-netbsd-64: 0.14.25
+ esbuild-openbsd-64: 0.14.25
+ esbuild-sunos-64: 0.14.25
+ esbuild-windows-32: 0.14.25
+ esbuild-windows-64: 0.14.25
+ esbuild-windows-arm64: 0.14.25
+ dev: true
+
+ /fsevents/2.3.2:
+ resolution: {integrity: sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==}
+ engines: {node: ^8.16.0 || ^10.6.0 || >=11.0.0}
+ os: [darwin]
+ requiresBuild: true
+ dev: true
+ optional: true
+
+ /function-bind/1.1.1:
+ resolution: {integrity: sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==}
+ dev: true
+
+ /has/1.0.3:
+ resolution: {integrity: sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==}
+ engines: {node: '>= 0.4.0'}
+ dependencies:
+ function-bind: 1.1.1
+ dev: true
+
+ /is-core-module/2.8.1:
+ resolution: {integrity: sha512-SdNCUs284hr40hFTFP6l0IfZ/RSrMXF3qgoRHd3/79unUTvrFO/JoXwkGm+5J/Oe3E/b5GsnG330uUNgRpu1PA==}
+ dependencies:
+ has: 1.0.3
+ dev: true
+
+ /nanoid/3.3.1:
+ resolution: {integrity: sha512-n6Vs/3KGyxPQd6uO0eH4Bv0ojGSUvuLlIHtC3Y0kEO23YRge8H9x1GCzLn28YX0H66pMkxuaeESFq4tKISKwdw==}
+ engines: {node: ^10 || ^12 || ^13.7 || ^14 || >=15.0.1}
+ hasBin: true
+ dev: true
+
+ /path-parse/1.0.7:
+ resolution: {integrity: sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==}
+ dev: true
+
+ /picocolors/1.0.0:
+ resolution: {integrity: sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ==}
+ dev: true
+
+ /postcss/8.4.8:
+ resolution: {integrity: sha512-2tXEqGxrjvAO6U+CJzDL2Fk2kPHTv1jQsYkSoMeOis2SsYaXRO2COxTdQp99cYvif9JTXaAk9lYGc3VhJt7JPQ==}
+ engines: {node: ^10 || ^12 || >=14}
+ dependencies:
+ nanoid: 3.3.1
+ picocolors: 1.0.0
+ source-map-js: 1.0.2
+ dev: true
+
+ /resolve/1.22.0:
+ resolution: {integrity: sha512-Hhtrw0nLeSrFQ7phPp4OOcVjLPIeMnRlr5mcnVuMe7M/7eBn98A3hmFRLoFo3DLZkivSYwhRUJTyPyWAk56WLw==}
+ hasBin: true
+ dependencies:
+ is-core-module: 2.8.1
+ path-parse: 1.0.7
+ supports-preserve-symlinks-flag: 1.0.0
+ dev: true
+
+ /rollup/2.70.0:
+ resolution: {integrity: sha512-iEzYw+syFxQ0X9RefVwhr8BA2TNJsTaX8L8dhyeyMECDbmiba+8UQzcu+xZdji0+JQ+s7kouQnw+9Oz5M19XKA==}
+ engines: {node: '>=10.0.0'}
+ hasBin: true
+ optionalDependencies:
+ fsevents: 2.3.2
+ dev: true
+
+ /source-map-js/1.0.2:
+ resolution: {integrity: sha512-R0XvVJ9WusLiqTCEiGCmICCMplcCkIwwR11mOSD9CR5u+IXYdiseeEuXCVAjS54zqwkLcPNnmU4OeJ6tUrWhDw==}
+ engines: {node: '>=0.10.0'}
+ dev: true
+
+ /supports-preserve-symlinks-flag/1.0.0:
+ resolution: {integrity: sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==}
+ engines: {node: '>= 0.4'}
+ dev: true
+
+ /typescript/4.6.2:
+ resolution: {integrity: sha512-HM/hFigTBHZhLXshn9sN37H085+hQGeJHJ/X7LpBWLID/fbc2acUMfU+lGD98X81sKP+pFa9f0DZmCwB9GnbAg==}
+ engines: {node: '>=4.2.0'}
+ hasBin: true
+ dev: true
+
+ /vite/2.8.6:
+ resolution: {integrity: sha512-e4H0QpludOVKkmOsRyqQ7LTcMUDF3mcgyNU4lmi0B5JUbe0ZxeBBl8VoZ8Y6Rfn9eFKYtdXNPcYK97ZwH+K2ug==}
+ engines: {node: '>=12.2.0'}
+ hasBin: true
+ peerDependencies:
+ less: '*'
+ sass: '*'
+ stylus: '*'
+ peerDependenciesMeta:
+ less:
+ optional: true
+ sass:
+ optional: true
+ stylus:
+ optional: true
+ dependencies:
+ esbuild: 0.14.25
+ postcss: 8.4.8
+ resolve: 1.22.0
+ rollup: 2.70.0
+ optionalDependencies:
+ fsevents: 2.3.2
+ dev: true
diff --git a/src/data.php b/src/data.php
new file mode 100644
index 0000000..aaf9d88
--- /dev/null
+++ b/src/data.php
@@ -0,0 +1,38 @@
+<?php
+function get_node_value($from, string $name): string
+{
+ return $from->getElementsByTagName($name)->item(0)->nodeValue;
+}
+function get_doc(): DOMDocument
+{
+ $doc = new DOMDocument();
+ $path = "/home/maks/school/clientApps/mlos/src/db.xml";
+ $doc->load($path);
+ return $doc;
+}
+function get_data(): array
+{
+ $doc = get_doc();
+ $out = [];
+ $games = $doc->getElementsByTagName("game");
+ $i = 0;
+ while ($game = $games->item($i++)) {
+ $out[] = [
+ "id" => $game->getAttribute("id"),
+ "order" => $game->getAttribute("order"),
+ "name" => get_node_value($game, "name"),
+ "thumbnail" => get_node_value($game, "thumbnail"),
+ "author" => get_node_value($game, "author"),
+ "magazine" => get_node_value($game, "magazine"),
+ ];
+ }
+ usort($out, function ($a, $b) {
+ return $a["order"] - $b["order"];
+ });
+ return [$out, $doc->getElementsByTagName("count")->item(0)->nodeValue];
+}
+
+$doc = get_doc();
+$xpath = new DOMXpath($doc);
+$game = $xpath->query('//game[@id="2"]/name')->item(0);
+// var_dump($game);
diff --git a/src/db.xml b/src/db.xml
new file mode 100644
index 0000000..7579d72
--- /dev/null
+++ b/src/db.xml
@@ -0,0 +1,30 @@
+<?xml version="1.0"?>
+<root>
+ <mid>12</mid>
+ <count>5</count>
+ <game id="1" order="4">
+ <name>Wiedzmi&#x144;</name>
+ <thumbnail>wiedzmin.png</thumbnail>
+ <author>&#x104;ndrzej S&#x119;pkiewicz</author>
+ <magazine>Fantastyka</magazine>
+ </game>
+ <game id="2" order="2">
+ <name>W&#x142;adca pier&#x15B;cieni</name>
+ <thumbnail>ring.png</thumbnail>
+ <author>Tolkien Sapkowski</author>
+ <magazine>CDAction 1999</magazine>
+ </game>
+ <game id="3" order="3">
+ <name>Artix</name>
+ <thumbnail>artix.png</thumbnail>
+ <author>NotSoArchDev</author>
+ <magazine>Torvalds 1987</magazine>
+ </game>
+ <game id="4" order="1">
+ <name>&#x1F976;</name>
+ <author>&#x1F911;</author>
+ <thumbnail>&#x1F64A;.png</thumbnail>
+ <magazine>&#x1F64A;</magazine>
+ </game>
+
+<game id="11" order="5"><name>&lt;b&gt;Thinkpad&lt;/b&gt;</name><author>&lt;b&gt;Lenovo&lt;/b&gt;</author><thumbnail>&lt;br&gt;thinkpad.png</thumbnail><magazine>&lt;b&gt;Intel(R)&lt;/b&gt;</magazine></game></root>
diff --git a/src/main.js b/src/main.js
new file mode 100644
index 0000000..db9a00f
--- /dev/null
+++ b/src/main.js
@@ -0,0 +1,83 @@
+//import './style.css';
+function edit(e) {
+ e.preventDefault();
+ const tar = e.target;
+ const form = tar.parentNode;
+ form.onseeked;
+ const id = tar.dataset.id;
+ const tds = document.querySelectorAll(`[data-id="${id}"]`);
+ const names = ["name", "thumbnail", "author", "magazine",];
+ tds.forEach((el, i) => {
+ if (el.tagName === "TD") {
+ const v = el.innerHTML;
+ el.innerHTML = `<input name="${names[i]}" value="${v}">`;
+ }
+ else if (el === tar) {
+ el.style.display = "none";
+ }
+ else {
+ const iel = el;
+ if (iel.type !== "hidden") {
+ iel.value = "Save";
+ el.onclick = e => save(e, tds);
+ }
+ }
+ });
+}
+//@ts-expect-error
+window.edit = edit;
+async function save(e, tds) {
+ console.log(tds);
+ const tar = e.target;
+ const body = new FormData();
+ e.preventDefault();
+ let i = 0;
+ tds.forEach((el) => {
+ if (el.tagName === "TD") {
+ const v = el.firstChild.value;
+
+ if (i === 3)
+ el.innerHTML = v;
+ else
+ el.innerText = v;
+
+ switch (i) {
+ case 0:
+ body.append("name", v);
+ break;
+ case 1:
+ body.append("thumbnail", v);
+ break;
+ case 2:
+ body.append("author", v);
+ break;
+ case 3:
+ body.append("magazine", v);
+ break;
+ }
+ i++;
+ }
+ else if (el === tar) {
+ const iel = el;
+ iel.value = "Remove";
+ iel.onclick = null;
+ }
+ else {
+ const iel = el;
+ if (iel.type === "hidden") {
+ body.append(iel.name, iel.value);
+ }
+ else {
+ iel.style.display = "";
+ }
+ }
+ });
+ console.log(await (await fetch("api/add.php", {
+ method: "POST",
+ headers: {
+ // "Content-Type": "multipart/form-data",
+ },
+ body
+ })).text());
+}
+//# sourceMappingURL=main.js.map
diff --git a/src/main.ts b/src/main.ts
new file mode 100644
index 0000000..c4b616b
--- /dev/null
+++ b/src/main.ts
@@ -0,0 +1,67 @@
+import './style.css'
+
+function edit(e: PointerEvent) {
+ e.preventDefault();
+ const tar = e.target as HTMLInputElement;
+ const form = tar.parentNode as HTMLFormElement
+ form.onseeked
+ const id = tar.dataset.id;
+ const tds = document.querySelectorAll(`[data-id="${id}"]`) as NodeListOf<HTMLElement>
+ const names = ["name", "thumbnail", "author", "magazine",]
+ tds.forEach((el, i) => {
+ if (el.tagName === "TD") {
+ const v = el.innerHTML;
+ el.innerHTML = `<input name="${names[i]}" value="${v}">`
+ } else if (el === tar) {
+ el.style.display = "none"
+ } else {
+ const iel = (el as HTMLInputElement)
+ if (iel.type !== "hidden") {
+ iel.value = "Save"
+ el.onclick = e => save(e, tds);
+ }
+ }
+ })
+}
+//@ts-expect-error
+window.edit = edit;
+
+async function save(e: MouseEvent, tds: NodeListOf<HTMLElement>) {
+ console.log(tds)
+ const tar = e.target as HTMLInputElement
+ const body = new FormData();
+ e.preventDefault();
+ let i = 0;
+ tds.forEach((el) => {
+ if (el.tagName === "TD") {
+ const v = (el.firstChild as HTMLInputElement).value;
+ el.innerHTML = v
+ switch (i) {
+ case 0: body.append("name", v); break;
+ case 1: body.append("thumbnail", v); break;
+ case 2: body.append("author", v); break;
+ case 3: body.append("magazine", v); break;
+ }
+ i++;
+ } else if (el === tar) {
+ const iel = (el as HTMLInputElement)
+ iel.value = "Remove"
+ iel.onclick = null;
+ } else {
+ const iel = (el as HTMLInputElement)
+ if (iel.type === "hidden") {
+ body.append(iel.name, iel.value);
+ } else {
+ iel.style.display = ""
+ }
+ }
+ })
+ await fetch("api/add.php", {
+ method: "POST",
+ headers: {
+ "Content-Type": "multipart/form-data",
+ },
+ body
+ });
+}
+
diff --git a/src/style.css b/src/style.css
new file mode 100644
index 0000000..bbcdf49
--- /dev/null
+++ b/src/style.css
@@ -0,0 +1,25 @@
+header {
+ display: flex;
+ justify-content: center;
+ padding: 20px;
+}
+table {
+ margin: 0 auto;
+ border-spacing: 15px;
+}
+td {
+ margin: 100px;
+}
+header button {
+ font-size: 1em;
+ padding: 10px;
+}
+html {
+ font-family: Avenir, Helvetica, Arial, sans-serif;
+ -webkit-font-smoothing: antialiased;
+ -moz-osx-font-smoothing: grayscale;
+ /* text-align: center; */
+ color: #2c3e50;
+ font-size: 2em;
+ /* margin-top: 60px; */
+}
diff --git a/start b/start
new file mode 100755
index 0000000..5176169
--- /dev/null
+++ b/start
@@ -0,0 +1,4 @@
+#!/bin/sh
+#st -e pnpm dev &
+st -e php -S 0.0.0.0:8000 &
+lvim .
diff --git a/tsconfig.json b/tsconfig.json
new file mode 100644
index 0000000..6f1941d
--- /dev/null
+++ b/tsconfig.json
@@ -0,0 +1,17 @@
+{
+ "compilerOptions": {
+ "target": "ESNext",
+ "useDefineForClassFields": true,
+ "module": "ESNext",
+ "lib": ["ESNext", "DOM"],
+ "moduleResolution": "Node",
+ "strict": true,
+ "sourceMap": true,
+ "resolveJsonModule": true,
+ "esModuleInterop": true,
+ "noUnusedLocals": true,
+ "noUnusedParameters": true,
+ "noImplicitReturns": true
+ },
+ "include": ["src"]
+}