@@ -12,6 +12,17 @@ require 'user-config.php';
|
||||
|
||||
Data::ensureDb();
|
||||
|
||||
/**
|
||||
* Add a message to be displayed at the top of the page
|
||||
*
|
||||
* @param string $level The level (type) of the message
|
||||
* @param string $message The message itself
|
||||
*/
|
||||
function add_message(string $level, string $message): void {
|
||||
if (!array_key_exists('USER_MSG', $_REQUEST)) $_REQUEST['USER_MSG'] = array();
|
||||
$_REQUEST['USER_MSG'][] = ['level' => $level, 'message' => $message];
|
||||
}
|
||||
|
||||
/**
|
||||
* Render the page title
|
||||
* @param string $title The title of the page being displayed
|
||||
@@ -29,14 +40,19 @@ function page_head(string $title): void {
|
||||
<div><?php
|
||||
if (array_key_exists('FRC_USER_ID', $_REQUEST)) {
|
||||
echo '<a href=/feed?id=new>Add Feed</a>';
|
||||
if ($_REQUEST['FRC_USER_EMAIL'] != 'solouser@example.com') {
|
||||
echo " | {$_REQUEST['FRC_USER_EMAIL']}";
|
||||
}
|
||||
if ($_REQUEST['FRC_USER_EMAIL'] != 'solouser@example.com') echo " | {$_REQUEST['FRC_USER_EMAIL']}";
|
||||
} ?>
|
||||
</div>
|
||||
</header>
|
||||
<main hx-target=this>
|
||||
<?php
|
||||
<main hx-target=this><?php
|
||||
if (array_key_exists('USER_MSG', $_REQUEST)) {
|
||||
foreach ($_REQUEST['USER_MSG'] as $msg) { ?>
|
||||
<div>
|
||||
<?=$msg['level'] == 'INFO' ? '' : "<strong>{$msg['level']}</strong><br>"?>
|
||||
<?=$msg['message']?>
|
||||
</div><?php
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user