Журнал изменений
Replace all setTemplateBasic('fragment-name', ['{%key%}' => val]) calls with $tpl->getHtmlFrag('fragment-name', ['key' => val]) in every affected frontend and admin module. Removes if_flag array wrapper; boolean open/close flags are now passed directly.
Core changes:
- Forum (modules/forum/index.php):
- Migrate 21 calls: forum-cat-wrap×4, forum-cat-basic×2, forum-cat-info, forum-list-wrap×2, forum-list-basic-wrap×2, forum-list-basic, forum-list-info, forum-view-wrap×2, forum-view-basic, forum-view-change×2, forum-all-open×3
- Media (modules/media/index.php):
- Migrate media-select-option×4, media-form-add
- Files + RSS + Whois (modules/files, rss, whois/index.php):
- files: files-add-upload-row, files-add-input-row×3, form-add
- rss: rss-option×2, rss-info-form, rss-read-forms
- whois: 10 whois-* calls (result×2, option, license-form, license-add-button, domain-form, add-form, info-button, output-open, output-line, output-close)
- Shared form-add (auto_links, faq, help, jokes, links, news, pages):
- Each module's add() migrated to form-add fragment
- News + Shop (modules/news, shop/index.php):
- grid-table, grid-table-row, grid-table-cell migrated
- Voting (modules/voting/index.php):
- voting-home-wrap×2, voting-home migrated
- Clients + Content + Contact + Recommend + FAQ (modules/*/index.php):
- Respective fragment calls migrated per module
- Changelog admin (modules/changelog/admin/index.php):
- Admin changelog view migrated to Template runtime
Benefits:
- Legacy setTemplateBasic() fully eliminated from all migrated modules
- Key names normalised (no {%…%} wrappers, no if_flag arrays)
- XSS boundary enforced by template syntax, not scattered htmlspecialchars
Technical notes:
- open/close flag: ['if_flag' => ['open' => bool]] → ['open' => bool]
- Pre-built HTML values (add_menu, filterMarkdown, ajax_rating) → raw {{{ }}}
- forum-view-basic: date/ip/post_count/group corrected to raw {{{ }}} (they carry <span>/<a> HTML, not plain text)
Introduce HTML fragment files for the new Template runtime across all three frontend themes (default, simple, lite). Each fragment corresponds to one setTemplateBasic() slice that has been replaced by getHtmlFrag() in the module PHP layer.
Core changes:
- Admin partials (templates/admin/partials/, templates/*/partials/):
- Add changelog.html partial for admin and all frontend themes
- Frontend fragments — shared across default/simple/lite (templates/*/fragments/):
- faq: faq-quicklinks-open/row/close
- content: content-list-open/basic
- clients: clients-list-open/basic/info
- recommend: recommend-form/mail-link/mail-message/success-text
- contact: contact-form
- whois: whois-result/option/license-form/license-add-button/ domain-form/add-form/info-button/output-open/output-line/output-close
- files: files-add-input-row/upload-row
- rss: rss-option/info-form/read-forms
- media: media-select-option/form-add
- form-add (shared by auto_links, faq, jokes, help, news, links, pages)
- grid: grid-table/row/cell
- voting: voting-home-wrap/home
- forum: forum-all-open/cat-wrap/cat-basic/cat-info/list-wrap/ list-basic-wrap/list-basic/list-info/view-wrap/view-basic/view-change
- Misc UI: action-link, admin-menu, auto-links-, back-button, cat-navi, category-, date-badge, files-download-form, files-external-link, hit-badge, media-link-, media-post-badge, reads-badge, shop-, whois-status
Benefits:
- All fragment variables use {{ }} escaped or {{{ }}} raw consistently
- XSS boundary enforced at template level per project rules
- Three themes share identical fragments; divergence handled per-theme
Technical notes:
- Triple-brace {{{ }}} used for pre-built HTML (add_menu, filterMarkdown, ajax_rating, user_geo_ip, pre-escaped attributes)
- Double-brace {{ }} used for user text, numbers, labels
- if_flag wrapper removed; boolean flags passed directly as bool
Replace all ru.html admin info pages with ru.md equivalents across the admin panel and all module admin sections. Adds a new scheduler info page. Aligns documentation format with the project's Markdown-first content strategy.
Core changes:
- Admin core info pages (admin/info/*/):
- Delete 22 legacy ru.html help files
- Add 23 ru.md replacements (blocks, categories, comments, config, database, editor, favorites, fields, groups, lang, messages, modules, newsletter, privat, ratings, referers, replace, scheduler, security, statistic, template, uploads)
- Update admins/ru.md in place
- Module admin info pages (modules/*/admin/info/):
- Delete 21 legacy ru.html files (account, auto_links, changelog, clients, contact, content, faq, files, forum, help, jokes, links, media, money, news, pages, rss, shop, sitemap, voting, whois)
- Add 21 ru.md replacements
Benefits:
- Consistent Markdown format across all documentation
- Easier diffing and editing of help content
- Enables future tooling that expects .md sources
Technical notes:
- Content migrated verbatim; no structural changes to help text
- Scheduler page is new (no prior HTML equivalent)
Replace all setTemplateWarning calls in changelog module with $tpl->getHtmlFrag('alert', ...) completing the full removal of setTemplateWarning from all modules except basic-changelog slice.
Core changes:
- modules/changelog/admin/index.php:
- changelog(): variable $warnType migrated to is_warn boolean flag
- configsave(): fixed 'warn' token error migrated to direct getHtmlFrag
- modules/changelog/index.php:
- changelog(): variable $warnType migrated to is_warn boolean flag
Benefits:
- setTemplateWarning fully eliminated from all PHP call sites
- Remaining setTemplateBasic('basic-changelog') is a separate slice task
Technical notes:
- basic-changelog template (339 lines) stays in legacy pending its own slice
- form-conf is a stop condition (343-line universal template, per-module split required)
Replace all setTemplateWarning() and setTemplateBasic('title') calls with direct $tpl->getHtmlFrag() calls across admin and modules, removing the dependency on the legacy core/template.php render path for these slices.
Core changes:
- New fragments — alert (templates/*/fragments/alert.html):
- admin: sl_{{ type }} CSS classes (warn/info/atten)
- lite: sl_warn / sl_info CSS classes via is_warn boolean
- default/simple: Bootstrap alert-warning / alert-info via is_warn boolean
- Redirect cases: meta HTTP-refresh tag passed as raw 'meta' variable
- New fragments — title (templates/*/fragments/title.html):
- lite: <h3 class="font mtl">
- default: <h3 class="view-title">
- simple: <h3 class="h4 mb-3">
- Dead if_flag removed from modules/content/index.php
- PHP call sites (62 files):
- admin/index.php + admin/modules/*.php: 60 setTemplateWarning replaced
- modules/**/*.php: 190 setTemplateWarning + 32 setTemplateBasic('title') replaced
- $tpl added to global declarations where missing
- modules/changelog excluded (variable template name, separate task)
Benefits:
- Legacy core/template.php no longer touched for alert and title output
- HTML moved to theme files; PHP passes plain scalar data only
- Each theme renders alert/title with its own CSS conventions
Technical notes:
- open/close wrappers remain in legacy (unclosed HTML pair, bad slice)
- setTemplateWarning still present in modules/changelog only
- All 25 PHPUnit tests pass
Rewrite root-level and docs/ markdown files to reflect the current codebase state, remove outdated scaffolding instructions, and add a new TEMPLATE_STATUS.md reference for the Template engine migration.
Core changes:
- Root docs (CONTRIBUTING.md, README.md, SECURITY.md, UPGRADING.md):
- Removed placeholder setup commands and redundant boilerplate
- Updated prerequisite lists to match actual PHP and extension requirements
- Added Template Runtime Guidance section to CONTRIBUTING.md
- Internal docs (docs/):
- PRINCIPLES.md — updated to reflect Template class architecture decisions
- TEMPLATES.md — heavily trimmed; now describes engine API and directory layout
- TESTS.md — updated test strategy to cover Template bridge PHPUnit suites
- TEMPLATE_STATUS.md (new) — migration status tracker listing implemented engine features and which admin views are running through the new runtime
Benefits:
- Docs match the current codebase rather than an earlier planned state
- New contributors get accurate setup and contribution instructions
- TEMPLATE_STATUS.md provides a clear handover point for future migration work
Technical notes:
- All four root markdown files were significantly shortened (net -2438 lines)
- TEMPLATE_STATUS.md is the authoritative reference for migration progress
Cover the full Template engine pipeline and each migrated admin partial with PHPUnit tests, using an in-process bootstrap that sets up a minimal CMS environment without a database or web server.
Core changes:
- Test bootstrap (tests/Support/ViewTestBootstrap.php):
- Defines required CMS constants (BASE_DIR, FUNC_FILE, ADMIN_FILE, PREFIX_DB)
- Instantiates $tpl as Template('admin') for all test suites
- Provides fixture helpers for creating throwaway template files
- Admin bridge tests (tests/Unit/Admin*BridgeFlowTest.php):
- AdminLoginBridgeFlowTest — verifies login and registration partials render with all required named keys and escape HTML entities correctly
- AdminPreviewBridgeFlowTest — asserts preview partial outputs title and fields
- AdminSearchboxBridgeFlowTest — confirms searchbox partial renders form input
- Engine flow tests (tests/Unit/):
- TemplateBridgeFlowTest — getHtmlPart / getHtmlFrag happy-path and empty-name guard
- TemplateBridgeFallbackTest — missing file, bad name, and path-traversal attempts
- ViewBridgeSmokeTest — compiled cache creation, mtime invalidation, include tag
Benefits:
- Regression safety for every admin partial migrated from setTemplateBasic()
- Engine security assertions block null-byte, dotdot, and symlink bypass attempts
- Tests run without a live CMS install using the in-process bootstrap
Technical notes:
- PHPUnit 10+ compatible; no database fixtures required
- Fixture templates written to sys_get_temp_dir() and cleaned up in tearDown
Delete the shared plugins/bootstrap/ directory now that Bootstrap is bundled inside templates/simple/assets/vendor/bootstrap/ and the default theme carries no Bootstrap dependency at all.
Core changes:
- Removed (plugins/bootstrap/):
- bootstrap.min.css, bootstrap.bundle.min.js, bootstrap-icons.min.css
- fonts/bootstrap-icons.woff2
- index.html
Benefits:
- Eliminates a global shared asset that coupled all themes to one Bootstrap version
- Each theme now owns its vendor dependencies explicitly
Technical notes:
- simple theme ships an identical Bootstrap copy under assets/vendor/bootstrap/
- Any theme that does not need Bootstrap simply omits the vendor directory
Introduce two starter themes under templates/ implementing the canonical engine directory structure (pages, partials, fragments, layouts, assets), providing reusable error pages, login views, alerts, and layout wrappers.
Core changes:
- default theme (templates/default/):
- layouts/bare.html — minimal HTML shell without nav or sidebar
- pages/error.html — styled error page with title and message slots
- partials/login.html, login-logged.html, login-without.html — auth views
- partials/alerts.html — flash message list partial
- fragments/message.html — inline status fragment
- simple theme (templates/simple/):
- layouts/bare.html, layouts/main.html — bare and full-nav layout wrappers
- pages/error.html — lightweight error page
- Same partials and fragment set as default
- assets/css/theme.css, assets/js/theme.js — minimal theme stylesheet and script
- assets/vendor/bootstrap/ — bundled Bootstrap 5 for this theme only
Benefits:
- Demonstrates full engine directory convention for future theme authors
- simple theme ships Bootstrap self-contained, not as a global plugin
- default theme has no JS/CSS dependency, suitable for lightweight deploys
Technical notes:
- Bootstrap vendor files in simple/assets/vendor/ replace the removed global plugin
- Both themes use {{ }} / {{{ }}} syntax and {% if/for/include %} engine tags
Move login, registration, searchbox, and preview from flat HTML files into the structured partials/ directory expected by the Template engine, enabling named-key variable injection and HTML auto-escaping.
Core changes:
- New admin partials (templates/admin/partials/):
- login.html — form with {{ route }}, {{ nickname }}, {{ password }}, {{ captcha }}
- registration.html — full registration form with all named fields
- searchbox.html — search input partial
- preview.html — preview panel with {{ title }}, {{ fields }}, {{ fieldsa/b/c }}
- Removed flat templates (templates/admin/):
- login.html, registration.html, searchbox.html — superseded by partials above
- These were loaded via setTemplateBasic() which is replaced by getHtmlPart()
Benefits:
- Templates now live in the canonical engine directory structure
- Variable names are clean identifiers, not {%placeholder%} strings
- Auto-escaping via {{ }} protects against XSS in admin views
Technical notes:
- preview.html added as a new partial (no previous flat equivalent)
- Partials use {{ var }} for escaped output and {{{ var }}} for raw HTML fields