/**
  * Redirects the user to the admin login page, if the user is not logged in, yet.
  *
  * If the user is logged in already redirect the user to the Admincenter.
  *
  * @param array $pluginData
  */
 public function __construct(array $pluginData)
 {
     $request = $pluginData['request'];
     if (isset($pluginData['config'])) {
         $config = $pluginData['config'];
         $userId = null;
         if (isset($_SESSION['user_id'])) {
             $userId = (int) $_SESSION['user_id'];
         }
         $userMapper = new UserMapper();
         $translator = new \Ilch\Translator();
         $user = $userMapper->getUserById($userId);
         if ($config->get('maintenance_mode') && !$request->isAdmin()) {
             if (empty($user)) {
                 $pluginData['layout']->setFile('modules/admin/layouts/maintenance');
             } else {
                 if (!$user->isAdmin()) {
                     $pluginData['layout']->setFile('modules/admin/layouts/maintenance');
                 }
             }
             $_SESSION['messages'][] = array('text' => $translator->trans('siteMaintenanceMode'), 'type' => 'danger');
         }
     }
     if ($request->isAdmin() && $request->getControllerName() !== 'login' && !\Ilch\Registry::get('user')) {
         /*
          * User is not logged in yet but wants to go to the admincenter, redirect him to the login.
          */
         $pluginData['controller']->redirect(array('module' => 'admin', 'controller' => 'login', 'action' => 'index'));
     } elseif ($request->getModuleName() === 'admin' && $request->getControllerName() === 'login' && $request->getActionName() !== 'logout' && \Ilch\Registry::get('user')) {
         /*
          * User is logged in but wants to go to the login, redirect him to the admincenter.
          */
         $pluginData['controller']->redirect(array('module' => 'admin', 'controller' => 'index', 'action' => 'index'));
     }
 }
 /**
  * Redirects the user to the default forum page, if the user has no access.
  *
  * @param array $pluginData
  */
 public function __construct(array $pluginData)
 {
     $request = $pluginData['request'];
     if ($request->getParam('access')) {
         $translator = new \Ilch\Translator();
         $_SESSION['messages'][] = array('text' => $translator->trans('noAccessForum'), 'type' => 'danger');
     }
 }
<?php

$config = \Ilch\Registry::get('config');
$translator = new \Ilch\Translator();
$translator->load(APPLICATION_PATH . '/modules/admin/translations/');
$maintenanceTime = $config->get('maintenance_date');
$date = new \Ilch\Date();
?>

<!DOCTYPE html>
<html lang="de">
    <head>
        <title><?php 
echo $config->get('page_title');
?>
 - <?php 
echo $translator->trans('maintenanceMode');
?>
</title>

        <!-- META -->
        <meta charset="utf-8">
        <meta name="description" content="<?php 
echo $config->get('page_title');
?>
 - <?php 
echo $translator->trans('maintenanceMode');
?>
">

        <!-- FAVICON -->
Exemple #4
0
<?php

$config = \Ilch\Registry::get('config');
$translator = new \Ilch\Translator();
$translator->load(APPLICATION_PATH . '/modules/newsletter/translations/');
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <meta name="viewport" content="width=device-width" />
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
        <title><?php 
echo $config->get('page_title');
?>
</title>
        <style>
        /* -------------------------------------
            GLOBAL
        ------------------------------------- */
        * {
            margin: 0;
            padding: 0;
            font-family: "Helvetica Neue", "Helvetica", Helvetica, Arial, sans-serif;
            font-size: 100%;
            line-height: 1.3;
        }

        img {
            max-width: 100%;
        }