<!DOCTYPE html>
<html lang="{% block html_lang %}{{ DEFAULT_LANG }}{% endblock %}">
    <head prefix="og: https://ogp.me/ns{% if article %}/video{% endif %}#"{% if article %} itemscope itemtype="https://schema.org/VideoObject"{% endif %}>
        {% block head %}
            <!-- Meta Base -->
            <meta charset="UTF-8"/>
            <meta http-equiv="X-UA-Compatible" content="IE=edge"/>
            <meta name="viewport" content="width=device-width, initial-scale=1"/>
            <meta name="HandheldFriendly" content="True"/>
            {% block extra_head %}
            {% endblock %}
            <!-- Bootstrap 4.3.1 -->
            <link href="{{ SITEURL }}/{{ THEME_STATIC_DIR }}/css/bootstrap/bootstrap.css" rel="stylesheet"
                  integrity="sha384-63+VK53+oFYHzIqG3ljBEZ1Pr9+l0uKU+6UK4YsgNZtVkXQQtsvr0TRcBxncV0gG"/>
            <!-- Main style -->
            <link href="{{ SITEURL }}/{{ THEME_STATIC_DIR }}/css/styles.css" rel="stylesheet"/>
            <!-- favicon -->
            <link rel="icon" type="image/png" sizes="192x192" href="{{ SITEURL }}/{{ THEME_STATIC_DIR }}/images/favicon/favicon-192x192.png"/>
            <link rel="icon" type="image/png" sizes="96x96" href="{{ SITEURL }}/{{ THEME_STATIC_DIR }}/images/favicon/favicon-96x96.png"/>
            <link rel="icon" type="image/png" sizes="32x32" href="{{ SITEURL }}/{{ THEME_STATIC_DIR }}/images/favicon/favicon-32x32.png"/>
            <link rel="icon" type="image/png" sizes="16x16" href="{{ SITEURL }}/{{ THEME_STATIC_DIR }}/images/favicon/favicon-16x16.png"/>
        {% endblock head %}
    </head>

    <body>

        <div class="container-fluid">

            <div class="row ml-1">
                <header class="fixed-top">
                    <div class="col-md-12">
                        <div class="row mt-2 mb-2">
                            <div class="col-lg-2 align-self-center text-center">
                                <a href="{{ SITEURL }}/" rel="home"><img class="logo" src="{{ SITEURL }}/{{ THEME_STATIC_DIR }}/images/logo.svg" alt="logo"></a>
                            </div>
                            <div class="col-lg-5 align-self-center">
                                <form action="{{ SITEURL }}/buscar.php"><input placeholder="{{ _('Escribe para buscar...') }}" type="search" name="q" required></form>
                            </div>

                            <div class="col-lg-5 menu-profile">
                                <ul>
                                    <li>
                                        <div class="image-profile-menu">
                                            <img src="{{ SITEURL }}/{{ THEME_STATIC_DIR }}/images/videocamera.svg" alt="profile">
                                        </div>
                                    </li>
                                    <li class="ml-2">{{ _('VideoTeca')}}</li>
                                </ul>
                            </div>
                            <!-- End login -->
                        </div>
                    </div>
                </header> <!-- End Header -->
            </div> <!-- End Row -->

            <div class="row mt-5 mt-8">

                <div class="col-md-12">

                    {% block menu_header %}
                        {% if DISPLAY_PAGES_ON_MENU %}
                            <hr>
                            <nav>
                                <ul class="tab">
                                    <li class="{% if output_file == 'index.html' %}active{% endif %}"><a href="{{ SITEURL }}/" class="navbar-item is-tab">{{ _('Inicio') }}</a></li>
                                    {% for p in pages %}
                                        <li class="navbar-item is-tab {% if p == page %} active{% endif %}"><a href="{{ SITEURL }}/{{ p.url }}">{{ p.title }}</a></li>
                                    {% endfor %}
                                    <li class="navbar-item is-tab {% if output_file == ARCHIVES_SAVE_AS %} active {% endif %}"><a href="{{ SITEURL }}/{{ ARCHIVES_URL }}">{{ _('Archivos') }}</a></li>
                                </ul> <!-- End Tabs -->
                            </nav>
                            <hr>
                        {% endif %}
                    {% endblock menu_header %}

                    {%- block content -%}

                        <!-- Main videos -->
                        <main class="row main-videos">

<?php

if(isset($_SERVER['HTTPS'])) {
  if ($_SERVER['HTTPS'] == "on") {
    $examen = "https://{$_SERVER['HTTP_HOST']}/examen";
  }
  else {
    $examen = "examen";
  }
}

echo "<div class='col-sm'><div class='d-flex justify-content-center'><a href='{$examen}'>Examen</a></div></div>";

$index =
  strpos($_SERVER['REQUEST_URI'], 'page/') ?
  '../../php-personal/index.php' :
  'php-personal/index.php';

include_once($index);

$isCookied = isset($_COOKIE['identify'], $_COOKIE['hash']);

if ($isCookied) {
  //index properties
  $post = new Post($db);
  $post->identify = $_COOKIE['identify'];
  $post->hash = $_COOKIE['hash'];
  $isIdentify = $post->identify();

  if (!$isIdentify) {
    echo '<div class="col-sm"><div class="d-flex justify-content-center"><a href="php-personal/frontend/users">Identificarse</a></div></div>';
    return;
  }
}

if (!$isCookied) {
  echo '<div class="col-sm"><div class="d-flex justify-content-center"><a href="php-personal/frontend/users">Identificarse</a></div></div>';
  return;
}

?>

                            <div class="col-md-12">

                                <div class="row">

                                    {% for article in articles_page.object_list %}
                                        <article class="col-md-3 video" itemscope itemtype="https://schema.org/Movie">
                                            <a href="{{ SITEURL }}/{{ article.url }}" title="{{ article.title }}">
                                                <div class="area">
                                                    <div class="mask">

                                                        <div class="vertical-align">
                                                            <i class="soumaicon play"><svg><use href="{{ SITEURL }}/{{ THEME_STATIC_DIR }}/images/svg/master.svg#play"/></svg></i>
                                                            <p>{{ _('Ver ahora')}}</p>
                                                        </div> <!-- End Vertical Align -->

                                                    </div> <!-- End Mask / Hover -->

                                                    {% if article.image %}
                                                        <img itemprop="image" src="{{ SITEURL }}/{{ THEME_STATIC_DIR }}/../wp-content/uploads/article/thumbnail/{{ article.image }}" alt="{{ article.title }}" class="img-fluid">
                                                    {% else %}
                                                        <img itemprop="image" src="{{ SITEURL }}/{{ THEME_STATIC_DIR }}/images/video.png" alt="video" class="img-fluid">
                                                    {% endif %}

                                                    {% if article.time %}
                                                        <!-- <span class="duration">{{ article.time }}</span> -->
                                                    {% else %}
                                                        <!-- <span class="duration">{{ ('00:00') }}</span> -->
                                                    {% endif %}

                                                </div> <!-- End Area -->
                                            </a>

                                            <h2 itemprop="name"><a href="{{ SITEURL }}/{{ article.url }}" rel="bookmark" title="{{ _('Ver %(articulo)s', articulo=article.title|striptags) }}">{{ article.title }}</a></h2>

                                            <!-- post footer -->
                                            {% include "article_info.html" %}
                                            <!-- end of post footer -->

                                        </article> <!-- End Col-md-6 -->
                                    {% endfor %}
                                </div>

                            </div>
                        </main>
                        <!-- End Main Videos -->

                        <!-- Pagination -->
                        {% include "pagination.html" %}
                        <!--/End Pagination -->

                    {%- endblock -%}

                </div>
            </div> <!-- End Row -->
            <hr>
            <footer>
                <ul>
                    <!-- About -->
                    {% if DEFAULT_LANG == 'eo' %}
                        <li><a href="{{ SITEURL }}/pages/acerca-de.html">{{ 'Pri' }}</a></li>
                    {% elif DEFAULT_LANG == 'en' %}
                        <li><a href="{{ SITEURL }}/pages/acerca-de.html">{{ 'About' }}</a></li>
                    {% else %}
                        <li><a href="{{ SITEURL }}/pages/acerca-de.html">{{ 'Acerca de' }}</a></li>
                    {% endif %}
                    <!-- /About -->

                    <!-- Developers -->
                    {% if DEFAULT_LANG == 'eo' %}
                        <li><a href="{{ SITEURL }}/pages/créditos/">{{ 'Kreditoj' }}</a></li>
                    {% elif DEFAULT_LANG == 'en' %}
                        <li><a href="{{ SITEURL }}/pages/créditos/">{{ 'Credits' }}</a></li>
                    {% else %}
                        <li><a href="{{ SITEURL }}/pages/créditos/">{{ 'Créditos' }}</a></li>
                    {% endif %}
                    <!-- /Developers -->
                </ul>
                <ul>
                    <!-- Política de Uso -->
                    {% if DEFAULT_LANG == 'eo' %}
                        <li><a href="{{ SITEURL}}/pages/regularo-pri-uzado.html">{{ _('Política de uso') }}</a></li>
                    {% else %}
                        <li><a href="{{ SITEURL}}/pages/política-de-uso.html">{{ _('Política de uso') }}</a></li>
                    {% endif %}
                    <!-- /Política de Uso -->

                    <!-- LibreJS -->
                    <li><a href="{{ SITEURL }}/pages/librejs.html" data-jslicense="1">{{ _('Licencias de JavaScript') }}</a></li>
                    <!-- /LibreJS -->

                    <!-- source code -->
                    <li><a href="{{ SOURCE_URL }}" rel="noopener noreferrer" target="_blank">{{ _('Código fuente') }}</a></li>
                    <!-- /source code -->
                </ul>

                <h6>Copyleft &copy; 2019 - 2022 {{ SITENAME }} Lbtd.</h6>

                {% if CURRENT_VERSION and CURRENT_BRANCH %}
                    <h6>{{ _('Versión actual:') }} {{ CURRENT_VERSION }} @ {{ CURRENT_BRANCH }}</h6>
                {% endif %}

            </footer> <!-- End Footer -->

        </div>
        {% block extend_js %}
        {% endblock %}

        {% if article %}
            {% if article.js %}
                {% for script in article.js %}
                    {{ script }}
                {% endfor %}
            {% endif %}
        {% endif %}

        {% if page %}
            {% if page.js %}
                {% for script in page.js %}
                    {{ script }}
                {% endfor %}
            {% endif %}
        {% endif %}
    </body>
</html>
