Difference between revisions for Users / Eo Ny / dev
| Version1 | Version2 | ||
|---|---|---|---|
| 1 | == HTTP Class Technical Documentation == | 1 | == HTTP Class Technical Documentation == |
| 2 | 2 | ||
| 3 | {{toc numerate=1}} | ||
| 3 | === Overview === | 4 | === Overview === |
| 4 | 5 | ||
| 5 | The ##Http## class (##src/class/http.php##) is a core component of the WackoWiki system responsible for handling HTTP request/response processing, session management, caching, and security features. This class acts as a bridge between the web server and the wiki engine. | 6 | The ##Http## class (##src/class/http.php##) is a core component of the WackoWiki system responsible for handling HTTP request/response processing, session management, caching, and security features. This class acts as a bridge between the web server and the wiki engine. |
| … | … | … | … |
| 111 | 112 | ||
| 112 | ---- | 113 | ---- |
| 113 | 114 | ||
| 114 |
===== |
115 | =====##store_cache(): void##===== |
| 115 | Saves the generated page content to cache file. | 116 | Saves the generated page content to cache file. |
| 116 | 117 | ||
| 117 | **Features:** | 118 | **Features:** |
| … | … | … | … |
| 121 | - Only executes if caching flag is set and user is anonymous | 122 | - Only executes if caching flag is set and user is anonymous |
| 122 | 123 | ||
| 123 | **Example:** | 124 | **Example:** |
| 124 |
%% |
125 | %%(hl php) |
| 125 | // Called at end of page rendering | 126 | // Called at end of page rendering |
| 126 | $http->store_cache(); | 127 | $http->store_cache(); |
| 127 | %% | 128 | %% |
| … | … | … | … |
| 551 | 552 | ||
| 552 | ---- | 553 | ---- |
| 553 | 554 | ||
| 554 | === Constants Used === | 555 | ===Constants Used=== |
| 555 | 556 | ||
| 556 | 557 | #| | |
| 558 | *| Constant | Type | Purpose |* | ||
| 559 | || ##IN_WACKO## | bool | Security check (exit if not defined) || | ||
| 560 | || ##CHMOD_SAFE## | int | File permissions for cache files || | ||
| 561 | || ##CHMOD_FILE## | int | File permissions for config cache || | ||
| 562 | || ##CACHE_PAGE_DIR## | string | Page cache directory || | ||
| 563 | || ##CACHE_SESSION_DIR## | string | Session cache directory || | ||
| 564 | || ##CACHE_CONFIG_DIR## | string | Config cache directory || | ||
| 565 | || ##CONFIG_DIR## | string | Configuration directory || | ||
| 566 | || ##LANG_DIR## | string | Language files directory || | ||
| 567 | || ##DAYSECS## | int | Seconds in a day (86400) || | ||
| 568 | || ##HTTP_404## | string | Path to 404 error page || | ||
| 569 | || ##HTTP_403## | string | Path to 403 error page || | ||
| 570 | |# | ||
| 571 | |||
| 572 | ---- | ||
| 557 | 573 | ||
| 558 | === Workflow Examples === | 574 | === Workflow Examples === |
| 559 | 575 | ||
| 560 |
==== |
576 | ====Example 1: Handling a GET Request==== |
| 561 |
|
577 | |
| 562 |
%% |
578 | %%(hl php) |
| 563 | // In main wiki entry point | 579 | // In main wiki entry point |
| 564 | $http = new Http($db); | 580 | $http = new Http($db); |
| 565 | $http->session(0); // Start session | 581 | $http->session(0); // Start session |