Files
MokoJoomHero/src/offline.php
T
Jonathan Miller 761915d540 feat(template): scaffold Joomla 5 template structure
Convert repo from empty module scaffold to a complete Joomla 5 site
template with manifest, index/error/offline/component pages, Web Asset
Manager config, CSS custom-property stylesheet, language files, and
11 module positions including a hero section.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-05-16 14:33:30 -05:00

135 lines
3.9 KiB
PHP

<?php
/* Copyright (C) 2026 Moko Consulting <hello@mokoconsulting.tech>
*
* This file is part of a Moko Consulting project.
*
* SPDX-License-Identifier: GPL-3.0-or-later
*
* FILE INFORMATION
* DEFGROUP: MokoJoomHero.Template
* INGROUP: MokoJoomHero
* REPO: https://github.com/mokoconsulting-tech/MokoJoomHero
* PATH: /src/offline.php
* VERSION: 01.00.01
* BRIEF: Offline page template — shown when the site is taken offline via Global Configuration
*/
defined('_JEXEC') or die;
use Joomla\CMS\Factory;
use Joomla\CMS\Helper\AuthenticationHelper;
use Joomla\CMS\HTML\HTMLHelper;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Router\Route;
use Joomla\CMS\Uri\Uri;
/** @var Joomla\CMS\Document\HtmlDocument $this */
$app = Factory::getApplication();
// Offline message from Global Configuration
$offline_message = $app->get('offline_message', Text::_('JOFFLINE_MESSAGE'));
// Extra login methods
$extra_buttons = AuthenticationHelper::getLoginButtons('form-login');
?>
<!DOCTYPE html>
<html lang="<?php echo $this->language; ?>" dir="<?php echo $this->direction; ?>">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title><?php echo htmlspecialchars($app->get('sitename'), ENT_QUOTES, 'UTF-8'); ?> — <?php echo Text::_('JOFFLINE'); ?></title>
<link rel="stylesheet" href="<?php echo Uri::root(true); ?>/templates/tpl_mokojoomhero/css/template.css">
<jdoc:include type="head" />
<style>
.offline-page {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
min-height: 100vh;
text-align: center;
padding: 2rem;
}
.offline-message {
font-size: 1.25rem;
color: #555;
margin: 0 0 2rem;
max-width: 600px;
}
.offline-login {
max-width: 400px;
width: 100%;
padding: 2rem;
border: 1px solid #ddd;
border-radius: 8px;
}
.offline-login .form-group {
margin-bottom: 1rem;
text-align: left;
}
.offline-login label {
display: block;
margin-bottom: 0.25rem;
font-weight: 600;
}
.offline-login input[type="text"],
.offline-login input[type="password"] {
width: 100%;
padding: 0.5rem;
border: 1px solid #ccc;
border-radius: 4px;
}
.offline-login button {
width: 100%;
padding: 0.75rem;
background: var(--brand-color, #1a73e8);
color: #fff;
border: none;
border-radius: 4px;
cursor: pointer;
font-size: 1rem;
}
</style>
</head>
<body class="site offline">
<div class="offline-page">
<h1><?php echo htmlspecialchars($app->get('sitename'), ENT_QUOTES, 'UTF-8'); ?></h1>
<jdoc:include type="message" />
<p class="offline-message"><?php echo htmlspecialchars($offline_message, ENT_QUOTES, 'UTF-8'); ?></p>
<div class="offline-login">
<h2><?php echo Text::_('JLOGIN'); ?></h2>
<form action="<?php echo Route::_('index.php', true); ?>" method="post" id="form-login">
<div class="form-group">
<label for="username"><?php echo Text::_('JGLOBAL_USERNAME'); ?></label>
<input type="text" name="username" id="username" required>
</div>
<div class="form-group">
<label for="password"><?php echo Text::_('JGLOBAL_PASSWORD'); ?></label>
<input type="password" name="password" id="password" required>
</div>
<button type="submit"><?php echo Text::_('JLOGIN'); ?></button>
<input type="hidden" name="option" value="com_users">
<input type="hidden" name="task" value="user.login">
<input type="hidden" name="return" value="<?php echo base64_encode(Uri::base()); ?>">
<?php echo HTMLHelper::_('form.token'); ?>
</form>
<?php if (!empty($extra_buttons)) : ?>
<div class="offline-login-extra">
<?php foreach ($extra_buttons as $button) : ?>
<div class="mt-1">
<a class="btn btn-secondary w-100" href="<?php echo $button['url']; ?>">
<?php echo htmlspecialchars($button['label'], ENT_QUOTES, 'UTF-8'); ?>
</a>
</div>
<?php endforeach; ?>
</div>
<?php endif; ?>
</div>
</div>
</body>
</html>