From 6afd26021f04b8d279ed7ece7db0270f43fc62b5 Mon Sep 17 00:00:00 2001 From: cakmoel Date: Tue, 7 Apr 2026 16:07:47 +0700 Subject: [PATCH 1/3] feat: prepare v1.0.0 stable release - Add PHPStan and PHPCS configuration - Implement rate limiting for API - Add media upload functionality - Add privacy policy management - Update i18n support with 7 languages - Various bug fixes and improvements --- .gitignore | 3 + README.md | 2 +- composer.json | 8 +- phpcs.xml | 66 ++ phpmetrics.json | 13 + phpmetrics.yml | 35 + phpstan.baseline.neon | 106 +++ phpstan.neon | 19 + phpunit-coverage.xml | 29 + phpunit.email-validation.xml | 28 + phpunit.xml | 22 +- src/admin/admin-layout.php | 53 +- src/admin/media-upload.php | 153 +++++ src/admin/privacy-policy.php | 140 ++++ src/admin/sidebar-nav.php | 3 +- src/admin/ui/pages/edit-page.php | 2 +- src/admin/ui/posts/edit-post.php | 2 +- .../ui/privacy/privacy-policy-editor.php | 232 +++++++ src/admin/ui/privacy/privacy-policy-form.php | 143 ++++ src/admin/ui/setting/api-setting.php | 178 ++--- src/api/index.php | 15 + src/api/media-upload.php | 175 +++++ src/docs/API_DOCUMENTATION.md | 309 ++++++++- src/docs/API_OPENAPI.json | 301 ++++++++- src/docs/API_OPENAPI.yaml | 256 +++++++- src/docs/DEVELOPER_GUIDE.md | 615 +++++++++++++++++- src/docs/I18N_ARCHITECTURE.md | 8 +- src/docs/I18N_TESTING_GUIDE.md | 111 +++- src/docs/TESTING_GUIDE.md | 34 +- src/env.sample.md | 2 +- src/install/include/settings.php | 7 +- src/install/include/setup.php | 2 + src/install/index.php | 4 +- src/install/migrate-smtp.php | 8 +- .../controller/ConfigurationController.php | 2 + src/lib/controller/MediaController.php | 5 + src/lib/controller/PageController.php | 4 +- src/lib/controller/PostController.php | 4 +- src/lib/controller/api/MediaApiController.php | 209 ++++++ src/lib/core/Authentication.php | 4 +- src/lib/dao/MediaDao.php | 2 +- src/lib/dao/PrivacyPolicyDao.php | 15 + src/lib/main.php | 29 + src/lib/utility/.lts/cbsmdkkxvh9em9p9.php | 4 + src/lib/utility/.lts/jjgq4top1rn3xjt2.php | 4 + src/lib/utility/admin-query.php | 2 + src/lib/utility/form-size-validation.php | 2 +- src/lib/utility/get-table-prefix.php | 5 + src/lib/utility/theme-navigation.php | 30 +- src/public/files/cache/translations/en.json | 136 ---- src/public/files/cache/translations/es.json | 77 --- src/public/themes/blog/assets/css/custom.css | 584 +++++++++++++++++ .../themes/blog/assets/css/custom.min.css | 2 +- .../themes/blog/assets/css/style.sea.css | 68 ++ .../themes/blog/assets/css/style.sea.min.css | 2 +- src/public/themes/blog/footer.php | 124 ++-- src/public/themes/blog/functions.php | 191 +++++- src/public/themes/blog/header.php | 60 ++ src/public/themes/blog/lang/ar.json | 7 + src/public/themes/blog/lang/en.json | 7 + src/public/themes/blog/lang/es.json | 7 + src/public/themes/blog/lang/fr.json | 7 + src/public/themes/blog/lang/id.json | 7 + src/public/themes/blog/lang/ru.json | 7 + src/public/themes/blog/lang/zh.json | 7 + 65 files changed, 4264 insertions(+), 434 deletions(-) create mode 100644 phpcs.xml create mode 100644 phpmetrics.json create mode 100644 phpmetrics.yml create mode 100644 phpstan.baseline.neon create mode 100644 phpstan.neon create mode 100644 phpunit-coverage.xml create mode 100644 phpunit.email-validation.xml create mode 100644 src/admin/media-upload.php create mode 100644 src/admin/privacy-policy.php create mode 100644 src/admin/ui/privacy/privacy-policy-editor.php create mode 100644 src/admin/ui/privacy/privacy-policy-form.php create mode 100644 src/api/media-upload.php create mode 100644 src/lib/controller/api/MediaApiController.php create mode 100644 src/lib/utility/.lts/cbsmdkkxvh9em9p9.php create mode 100644 src/lib/utility/.lts/jjgq4top1rn3xjt2.php delete mode 100644 src/public/files/cache/translations/en.json delete mode 100644 src/public/files/cache/translations/es.json diff --git a/.gitignore b/.gitignore index d895db37c..4f0255611 100644 --- a/.gitignore +++ b/.gitignore @@ -33,3 +33,6 @@ node_modules/ # Rate limit cache files src/public/cache/rate_limit/ + +# Plan +.plan diff --git a/README.md b/README.md index fdacc4878..030651f8c 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ [![MySQL Version](https://img.shields.io/badge/MySQL-5.6%2B-4479A1.svg)](https://www.mysql.com/) [![MariaDB Version](https://img.shields.io/badge/MariaDB-10.3%2B-003545.svg)](https://mariadb.org/) [![PSR-12](https://img.shields.io/badge/PSR--12-Compliant-2C2C2C.svg)](https://www.php-fig.org/psr/psr-12/) -[![Tests](https://github.com/cakmoel/Scriptlog/actions/workflows/tests.yml/badge.svg)](https://github.com/cakmoel/Scriptlog/actions/workflows/tests.yml) +[![Tests](https://github.com/cakmoel/Scriptlog/workflows/Tests/badge.svg)](https://github.com/cakmoel/Scriptlog/actions/workflows/tests.yml) Scriptlog is a simple, secure, modular, and robust personal blogging platform. It is a refactored fork of Piluscart 1.4.1, engineered to emphasize simplicity, privacy, and security without the overhead of a complex Content Management System. diff --git a/composer.json b/composer.json index 7f3ea0058..b7a01a294 100644 --- a/composer.json +++ b/composer.json @@ -17,7 +17,7 @@ "platform": { "php": "7.4.33" }, - "vendor-dir": "lib/vendor" + "vendor-dir": "src/lib/vendor" }, "require": { @@ -39,12 +39,14 @@ "vlucas/phpdotenv": "^5.6" }, "require-dev": { + "friendsofphp/php-cs-fixer": "^3.0", "phpunit/phpunit": "^9.5", - "phpstan/phpstan": "^2.0" + "phpstan/phpstan": "^2.0", + "squizlabs/php_codesniffer": "^3.7" }, "minimum-stability": "stable", "prefer-stable": true, "autoload": { - "classmap": ["lib/"] + "classmap": ["src/lib/"] } } diff --git a/phpcs.xml b/phpcs.xml new file mode 100644 index 000000000..c3203df87 --- /dev/null +++ b/phpcs.xml @@ -0,0 +1,66 @@ + + + Blogware PSR12 Coding Standard + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + */vendor/* + + + */admin/assets/* + + + */themes/blog/assets/* + + + */lib/core/HTMLPurifier/* + + + */lib/utility/htmlawed.php + diff --git a/phpmetrics.json b/phpmetrics.json new file mode 100644 index 000000000..23ee71256 --- /dev/null +++ b/phpmetrics.json @@ -0,0 +1,13 @@ +{ + "report": { + "html": "build/phpmetrics/index.html", + "json": "build/phpmetrics/report.json", + "csv": "build/phpmetrics/report.csv", + "violations": "build/phpmetrics/violations.xml" + }, + "plugins": { + "git": { + "binary": "git" + } + } +} diff --git a/phpmetrics.yml b/phpmetrics.yml new file mode 100644 index 000000000..4c2a67761 --- /dev/null +++ b/phpmetrics.yml @@ -0,0 +1,35 @@ + + + + + + + + + + + + + + + + + + + + + +