/**
  * 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');
     }
 }
예제 #3
0
$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 -->
        <link rel="shortcut icon" type="image/x-icon" href="<?php 
예제 #4
0
                    </div>
                    <!-- /content -->
                </td>
                <td></td>
            </tr>
        </table>
        <!-- /body -->

        <!-- footer -->
        <table class="footer-wrap">
            <tr>
                <td></td>
                <td class="container">
                    <div class="content" align="center">
                        <p><?php 
echo $translator->trans('noReplyMailFooter');
?>
</p>
                        <p><?php 
echo $translator->trans('mailUnsubscribe', $this->getRequest()->getParam('email'));
?>
</p>
                    </div>
                </td>
                <td></td>
            </tr>
        </table>
        <!-- /footer -->
    </body>
</html>