*/
/**
* Prints the head element of an HTML page in the public frontend.
*
* @param string $page ID of the current page.
* @param string $title Title of the page.
* @param string $icon The icon of the website.
*
* @return string
*/
function printPublicHead(string $page = "home", string $title = "Home", string $icon = ""):string {
$output = '
";
unset($_SESSION['editHistory']);
}
return $output;
}
/**
* Prints the header element of an HTML page.
*
* @param string $title Title of the page.
*
* @return string
*/
function printPublicHeader(string $title = "Home"):string {
$output = '
' . $title . '
';
return $output;
}
/**
* Prints the finishing elements of public HTML pages.
*
* @return string
*/
function printPublicEnd():string {
$output = '
';
return $output;
}
/**
* This function prints a file (the sidebar, the banner, or the footer) if it is not empty.
*
* @param string $file File name. Must be either aside, banner or footer.
* @param string $elem Encapsulating HTML element.
*
* @return string
*/
function printStaticPagePart(string $file, string $elem):string {
if (!in_array($file, ['footer', 'aside', 'banner'])) {
echo "Trying to access disallowed file.";
}
if (!file_exists(__DIR__ . "/../data/$file.htm") || !filesize(__DIR__ . "/../data/$file.htm") > 5) return "";
$content = file_get_contents(__DIR__ . "/../data/$file.htm");
$output = "
<$elem>
$content
$elem>";
return $output;
}
/**
* This function prints an error page.
*
* @param string $content The error message.
*
* @return string
*/
function printErrorPage(string $content):string {
$output = '
' . $content . '