Spáchanie #216fdsaf

This commit is contained in:
Richard Mikloš 2024-01-20 20:04:56 +01:00
parent 9fdd7d72dc
commit 09c32d1be2

@ -50,17 +50,17 @@ $page_data = include_ob($page_file);
$output = file_get_contents("$template_dir/skeleton.html"); $output = file_get_contents("$template_dir/skeleton.html");
$output = str_replace('<template name="navigation">', $nav, $output); $output = str_replace('<template name="navigation">', $nav, $output);
$output = str_replace('<template name="page content">', $page_data, $output);
if (isset($_SESSION['user_id'])) { if (isset($_SESSION['user_id'])) {
$hash = md5(strtolower(trim($_SESSION['user_email']))); $hash = md5(strtolower(trim($_SESSION['user_email'])));
$gravatarUrl = "https://www.gravatar.com/avatar/$hash?s=100"; $gravatarUrl = "https://www.gravatar.com/avatar/$hash?s=100";
$gravatarTag = "<img src='$gravatarUrl' alt='Gravatar Profile Picture'>"; $gravatarTag = "<img src='$gravatarUrl' alt='Gravatar Profile Picture'>";
$page_data = str_replace('<template name="gravatar image">', $gravatarTag, $page_data); $page_data = str_replace('<template name="gravatar image">', $gravatarTag, $page_data);
$page_data = str_replace('<template name="username">', $_SESSION['user_username'], $page_data); $page_data = str_replace('<template name="username">', $_SESSION['user_username'], $page_data);
} }
$page_regex = '/<!--PAGENAME=(.*?)-->/s'; $page_regex = '/<!--PAGENAME=(.*?)-->/s';
if(preg_match($page_regex, $page_data, $matches)){ if(preg_match($page_regex, $page_data, $matches)){
@ -72,6 +72,7 @@ else{
} }
$output = str_replace('<template name="page name">', $page_name, $output); $output = str_replace('<template name="page name">', $page_name, $output);
$output = str_replace('<template name="page content">', $page_data, $output);
echo $output; echo $output;
?> ?>