Journal renders correctly
This commit is contained in:
@@ -10,11 +10,14 @@ require __DIR__ . '/vendor/autoload.php';
|
||||
const MPJ_VERSION = '4.0.0-alpha1';
|
||||
|
||||
(Dotenv::createImmutable(__DIR__))->load();
|
||||
session_start();
|
||||
|
||||
$auth0_session = Auth::client()->getCredentials();
|
||||
if (!is_null($auth0_session)) {
|
||||
$_SESSION['user_id'] = $auth0_session->user['sub'];
|
||||
if (php_sapi_name() != 'cli') {
|
||||
session_start();
|
||||
|
||||
$auth0_session = Auth::client()->getCredentials();
|
||||
if (!is_null($auth0_session)) {
|
||||
$_SESSION['user_id'] = $auth0_session->user['sub'];
|
||||
}
|
||||
}
|
||||
|
||||
Configuration::$pdoDSN = 'sqlite:' . implode(DIRECTORY_SEPARATOR, [__DIR__, 'data', 'mpj.db']);
|
||||
@@ -31,23 +34,6 @@ function is_htmx(): bool
|
||||
return key_exists('HTTP_HX_REQUEST', $_SERVER) && !key_exists('HTTP_HX_HISTORY_RESTORE_REQUEST', $_SERVER);
|
||||
}
|
||||
|
||||
function page_link(string $href, string $text, array $attrs = []): void
|
||||
{
|
||||
echo '<a href="' . $href . '" hx-get="' . $href . '" hx-target="#top" hx-swap=innerHTML hx-push-url=true';
|
||||
foreach ($attrs as $key => $value) echo " $key=\"" . htmlspecialchars($value) . "\"";
|
||||
echo ">$text</a>";
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate a material icon
|
||||
*
|
||||
* @param string $name The name of the material icon
|
||||
* @return string The material icon wrapped in a `span` tag
|
||||
*/
|
||||
function icon(string $name): string {
|
||||
return "<span class=material-icons>$name</span>";
|
||||
}
|
||||
|
||||
function page_head(string $title): void
|
||||
{
|
||||
Layout::htmlHead($title);
|
||||
@@ -57,11 +43,6 @@ function page_head(string $title): void
|
||||
echo '<main role=main>';
|
||||
}
|
||||
|
||||
function bare_head(): void
|
||||
{
|
||||
echo '<!DOCTYPE html><html lang=en><head><title></title></head><body>';
|
||||
}
|
||||
|
||||
function page_foot(): void
|
||||
{
|
||||
echo '</main>';
|
||||
@@ -71,8 +52,3 @@ function page_foot(): void
|
||||
}
|
||||
echo '</body></html>';
|
||||
}
|
||||
|
||||
function bare_foot(): void
|
||||
{
|
||||
echo '</body></html>';
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user