<?php
/**
 * /index.php
 * @version 1.3
 * @desc Main index file
 * @author Fándly Gergő Zoltán (gergo@systemtest.tk, systemtest.tk)
 * @copy 2018 Fándly Gergő Zoltán
 * License:
    Systemtest.tk website's.
    Copyright (C) 2018  Fándly Gergő Zoltán

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program 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 General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <https://www.gnu.org/licenses/>.
 **/

require("config/config.php");
require("subs/loader.php");

$view="";
if(isset($_GET['view'])){
    $view=$_GET['view'];
    if($view!="" && $view!="projects" && $view!="repos" && $view!="blog" && $view!="about" && $view!="userarea" && $view!="products" && $view!="contact"){
        $view="";
    }
}
$sub="";
if(isset($_GET['sub'])){
    $sub=$_GET['sub'];
}

loadPart($view, true);

?>

<!DOCTYPE html>
<html>
    <head>
        <title><?php echo (isset($titleExtend)?$titleExtend." :: ":"").($view==""?"":$lang[$view]." :: ").$lang['sitetitle'] ?></title>
        <meta charset="UTF-8">
        <!-- style -->
        <link rel="stylesheet" href="./style/main.css">
        <link rel="stylesheet" media="screen and (max-width: 1024px)" href="./style/mobile.css">
        <link rel="icon" href="./res/logo.png">
        <!-- jQuerry -->
        <script src="//code.jquery.com/jquery-3.2.1.min.js"></script>
        <!-- cookie consent -->
        <link rel="stylesheet" type="text/css" href="//cdnjs.cloudflare.com/ajax/libs/cookieconsent2/3.0.3/cookieconsent.min.css">
        <script src="//cdnjs.cloudflare.com/ajax/libs/cookieconsent2/3.0.3/cookieconsent.min.js"></script>
        <script>
        window.addEventListener("load", function(){
        window.cookieconsent.initialise({
          "palette": {
            "popup": {
              "background": "#000"
            },
            "button": {
              "background": "#f1d600"
            }
          },
          "content": {
            "message": "<?php echo $lang['cookie_message'] ?>",
            "dismiss": "<?php echo $lang['cookie_dismiss'] ?>",
            "link": "<?php echo $lang['cookie_link'] ?>"
          }
        })});
        </script>
        <!-- reCaptcha -->
        <script src="https://www.google.com/recaptcha/api.js"></script>
        <!-- Quill editor -->
        <script src="//cdn.quilljs.com/1.3.6/quill.min.js"></script>
        <link rel="stylesheet" href="//cdn.quilljs.com/1.3.6/quill.snow.css">
        <!-- other stuff -->
        <script src="//cdnjs.cloudflare.com/ajax/libs/jquery-footable/3.1.6/footable.min.js"></script>
        <link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/jquery-footable/3.1.6/footable.standalone.min.css">
        <!-- font awesome -->
        <link rel="stylesheet" href="//use.fontawesome.com/releases/v5.0.9/css/all.css">
        <!-- jsEncrypt -->
        <script src="./script/lib/jsencrypt.min.js"></script>
        <!-- main script -->
        <script src="./script/js.php?load=main"></script>
        <script src="./script/js.php?load=<?php echo $view ?>"></script>
    </head>
    <body>
        <div id="messageOverlay" class="overlay messages" style="display: none" onclick="disposeMessageOverlay()"></div>
        <div id="header" class="header">
            <img class="title" src="./res/title.png" alt="title image">
            <div class="langselect">
                <a href="./?setlang=en_US"><img src="./res/lang/eng.png" alt="english"></a>
                <a href="./?setlang=hu_HU"><img src="./res/lang/hun.png" alt="magyar"></a>
                <a href="./?setlang=ro_RO"><img src="./res/lang/rou.png" alt="romana"></a>
            </div>
            <hr class="breakfloat">
        </div>
        <hr class="placeholder">
        <div id="contentHolder" class="content">
            <div id="menu">
                <ul class="menu">
                    <a onclick="goTo('')"><li><?php echo $lang['index'] ?></li></a>
                    <a onclick="goTo('projects')"><li><?php echo $lang['projects'] ?></li></a>
                    <a onclick="goTo('repos')"><li><?php echo $lang['repos'] ?></li></a>
                    <a onclick="goTo('blog')"><li><?php echo $lang['blog'] ?></li></a>
                    <a onclick="goTo('about')"><li><?php echo $lang['about'] ?></li></a>
                    <a onclick="goTo('userarea')"><li><?php echo $lang['userarea'] ?></li></a>
                    <!--
                    <a onclick="goTo('products')"><li><?php echo $lang['products'] ?></li></a>
                    -->
                    <a onclick="goTo('contact')"><li><?php echo $lang['contact'] ?></li></a>
                </ul>
            </div>
            <div id="content" class="inner">
                <!-- content goes here! -->
                <?php loadPart($view); ?>
            </div>
        </div>
        <hr class="placeholder" style="height: 25em">
        <footer>
            <p>This site and server is owned and maintained by Fándly Gergő</p>
            <p>&copy; Fándly Gergő <?php echo date("Y") ?></p>
            <p>Version <?php echo VERSION ?></p>
            <p>Contact:<br>contact@systemtest.tk</p>
            <a href="#header">TOP</a>
        </footer>
    </body>
</html>
