<!DOCTYPE html>
<html lang="<?= $this->language ?>">
<head>

  <meta charset="<?= $this->charset ?>">
  <title><?= $this->title ?> - Contao Open Source CMS <?= VERSION ?></title>
  <base href="<?= $this->base ?>">
  <meta name="generator" content="Contao Open Source CMS">
  <meta name="viewport" content="width=device-width,initial-scale=1.0">
  <meta name="referrer" content="origin">

  <link rel="stylesheet" href="<?php
    $objCombiner = new Combiner();
    $objCombiner->add('assets/mootools/stylect/css/stylect.css');
    $objCombiner->add('system/themes/'. $this->theme .'/basic.css');
    $objCombiner->add('system/themes/'. $this->theme .'/login.css');
    echo $objCombiner->getCombinedFile();
  ?>">
  <!--[if IE]><link rel="stylesheet" href="<?= TL_ASSETS_URL ?>system/themes/<?= $this->theme ?>/iefixes.css"><![endif]-->
  <?= $this->stylesheets ?>

  <script><?= $this->getLocaleString() ?></script>
  <script src="<?php
    $objCombiner = new Combiner();
    $objCombiner->add('assets/mootools/core/' . $GLOBALS['TL_ASSETS']['MOOTOOLS'] . '/mootools.js', $GLOBALS['TL_ASSETS']['MOOTOOLS']);
    $objCombiner->add('assets/mootools/stylect/js/stylect.js');
    $objCombiner->add('assets/mootools/mootao/Mootao.js');
    $objCombiner->add('assets/contao/js/core.js');
    echo $objCombiner->getCombinedFile();
  ?>"></script>
  <script><?= $this->getDateString() ?></script>
  <?= $this->javascripts ?>
  <!--[if lt IE 9]><script src="<?= TL_ASSETS_URL ?>assets/html5shiv/<?= $GLOBALS['TL_ASSETS']['HTML5SHIV'] ?>/html5shiv.min.js"></script><![endif]-->

</head>
<body class="<?= $this->ua ?>">

  <!--[if lte IE 6]>
    <div id="ie6warning"><?= $this->ie6warning ?></div>
  <![endif]-->

  <div id="header">
    <h1>Contao Open Source CMS <?= VERSION ?></h1>
  </div>

  <div id="container">

    <div id="main">
      <h2><?= $this->headline ?></h2>
      <form action="<?= $this->action ?>" class="tl_login_form" method="post">
        <div class="formbody">
          <input type="hidden" name="FORM_SUBMIT" value="tl_login">
          <input type="hidden" name="REQUEST_TOKEN" value="<?= REQUEST_TOKEN ?>">
          <?= $this->messages ?>
          <?php if ($this->noCookies): ?>
            <p class="tl_error"><?= $this->noCookies ?></p>
          <?php endif; ?>
          <table class="tl_login_table">
            <tr>
              <td<?= $this->uClass ?>><label for="username"><?= $this->username ?></label></td>
              <td style="text-align:right"><input type="text" name="username" id="username" class="tl_text" value="<?= $this->curUsername ?>" autocapitalize="off" required></td>
            </tr>
            <tr>
              <td<?= $this->pClass ?>><label for="password"><?= $this->password ?></label></td>
              <td style="text-align:right"><input type="password" name="password" id="password" class="tl_text" value="" required></td>
            </tr>
            <tr>
              <td><label for="language"><?= $this->userLanguage ?></label></td>
              <td style="text-align:right">
                <select name="language" id="language" class="tl_select">
                  <option value=""><?= $this->default ?></option>
                  <option value="">---</option>
                  <?php foreach ($this->languages as $key=>$lang): ?>
                    <option value="<?= specialchars($key) ?>"><?= $lang ?></option>
                  <?php endforeach; ?>
                </select>
              </td>
            </tr>
          </table>
          <div class="tl_login_submit_container">
            <input type="submit" name="login" id="login" class="tl_submit" value="<?= $this->loginButton ?>">
          </div>
        </div>
      </form>
      <div id="tl_license">
        <p>Contao Open Source CMS :: Copyright ©2005-<?= date('Y') ?> by Leo Feyer :: Extensions are copyright of their respective owners :: Visit <a href="https://contao.org" target="_blank">contao.org</a> for more information :: Obstructing the appearance of this notice is prohibited by law!</p>
        <p>Contao is distributed in the hope that it will be useful but WITHOUT ANY WARRANTY. Without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. Contao is free software. You can redistribute it and/or modify it under the terms of the GNU/LGPL as published by the Free Software Foundation.</p>
      </div>
      <p id="go_to_frontend"><a href="<?= $this->frontendFile ?>" class="footer_preview" title="<?= $this->feLink ?>"><?= $this->feLink ?></a></p>
    </div>
  </div>

  <script>
    window.addEvent('domready', function() {
      if (parent.frames[0] && parent.frames[0].name == 'switch') {
        parent.location.reload();
      }
      $('username').focus();
    });
  </script>

  <?php if (!$this->disableCron): ?>
    <script>
      new Request({
        url:'system/cron/cron.txt',
        onComplete: function(txt) {
          if (!txt) txt = 0;
          if (parseInt(txt) < (Date.now()/1000 - 300)) {
            new Request({url:'system/cron/cron.php'}).send();
          }
        }
      }).send();
    </script>
  <?php endif; ?>

</body>
</html>