Add PHPDocs generated by ChatGPT,
add additional clarification to some functions, add addNewsComment function and API, currently untested and not implemented in the client, fix a bunch of stuff that PHPStorm pointed out
This commit is contained in:
@@ -1,8 +1,16 @@
|
||||
<?php
|
||||
require_once "lib/account.php";
|
||||
|
||||
|
||||
function generateSitemap(): void{
|
||||
/**
|
||||
* Generates an XML sitemap as a string for a website, considering only pages that the current session
|
||||
* has sufficient privileges to access. It scans directories specified in the router configuration
|
||||
* for .html and .php files, and constructs a sitemap entry for each accessible page based on their
|
||||
* required permission levels. This function returns the sitemap as a string and
|
||||
* sets the appropriate header for XML content.
|
||||
*
|
||||
* @global array $routerConfig The global configuration array containing directory paths and default settings.
|
||||
* @return string The XML sitemap content, properly formatted in accordance with the sitemap protocol.
|
||||
*/
|
||||
function generateSitemap(): string{
|
||||
global $routerConfig;
|
||||
|
||||
$site_dirs = array_diff(scandir($routerConfig["page_dir"]), array('.', '..'));
|
||||
@@ -54,5 +62,5 @@ function generateSitemap(): void{
|
||||
$sitemap .= '</urlset>' . PHP_EOL;
|
||||
|
||||
header('Content-type: application/xml');
|
||||
echo $sitemap;
|
||||
return $sitemap;
|
||||
}
|
Reference in New Issue
Block a user