include 'functions.php';
#Initialize our php session, and check if it should be deleted
$sessions = 1;
session_start();
if (isset($_POST['logout'])) {
    session_destroy();
    $sessions = 0;
}
#Read data from the json's
$editor_uri = read_json_list("uri");
$editor_title_tabbar = read_json_list("title_tabbar");
$editor_title_in_page = read_json_list("title_in_page");
$editor_content = read_json_list("content");
$editor_creation = read_json_list("creation");
$editor_kind = read_json_list("kind");
$editor_meta = read_json_list("meta");
#Check for post data, if present assign them to variables.
if (isset($_POST['editor'])) {
    $post_uri = $_POST["page_uri"];
    $post_title_tabbar = $_POST["page_title_tabbar"];
    $post_title_in_page = $_POST["page_title_in_page"];
    $post_content = $_POST["page_content"];
    $post_creation = date("y-m-d h:i:s");
    $post_kind = $_POST["page_kind"];
    #$post_meta=	          	$_POST["page_meta"];
}
if (isset($_POST["delete"])) {
    $post_delete = $_POST["delete"];
}
$pagecount = count($editor_uri);
$check_complete = 0;
<?php

$page = ltrim($request_uri, "forum/");
$forumUri = read_json_list("forum/forumUri");
$forumContent = read_json_list("forum/forumContent");
$forumUriCount = count($forumUri);
for ($i = 0; $i < $forumUriCount; $i++) {
    if ($forumUri[$i] == $page) {
        $pageNumber = $i;
    }
}
if ($page == "") {
    $page = "Home";
}
$forum_plugin_content = "";
if ($page != "Home") {
    for ($i = 0; $i < count($forumContent[$pageNumber][2]); $i++) {
        $forum_plugin_content .= "\n    <div class='postClass'>\n      <div class='left'>\n        <div id='name'>" . $forumContent[$pageNumber][2][$i][0] . "</div>\n        <div id='date'>" . $forumContent[$pageNumber][2][$i][1] . "</div><br>\n      </div>\n      <div id='post'>" . $forumContent[$pageNumber][2][$i][2] . "</div>\n    </div>\n    ";
    }
    $forum_plugin_content .= '<br><i>Thread created on: ' . $forumContent[$pageNumber][1] . '</i>';
} else {
    for ($i = 1; $i < count($forumContent); $i++) {
        $forum_plugin_content .= "\n    <div class='pageList'>\n      <div id='name'>\n        <a href='" . $set_url . '/' . $request_uri . '/' . $forumUri[$i] . "'>" . $forumContent[$i][0] . "</a>\n      </div>\n      <div id='posts'>\n        " . count($forumContent[$i][2]) . "\n      </div>\n      <div id='date'>\n        " . $forumContent[$i][1] . "\n      </div>\n    </div><br>";
    }
}
#$forum_plugin_content .= $forumContent[$pageNumber][3][][0];
$title_in_page[$page_number] = $forumContent[$pageNumber][0];
$title_tabbar[$page_number] = "Nogax Forum - {$pageName}";
$forum_plugin_head = "<link rel='stylesheet' href='{$set_url}/plugins/forum_plugin/css/forum.css'/>";
#$forum_plugin_content=$forumContent[$pageNumber];
$forum_plugin_pagePrefix = "forum";
#██║     ██║   ██║██║  ██║██╔══╝
#╚██████╗╚██████╔╝██████╔╝███████╗
# ╚═════╝ ╚═════╝ ╚═════╝ ╚══════╝
#------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
#This code includes the needed php files which include the functions and the settings of the CMS
include 'functions.php';
#---------------------------------------------------------------------------------------------------------------------------------------
#This code reads the files in which the pages are saved, and passes that on to further code
$uri = read_json_list("uri");
$title_tabbar = read_json_list("title_tabbar");
$title_in_page = read_json_list("title_in_page");
$content = read_json_list("content");
$creation = read_json_list("creation");
#The Answer to Life, the Universe and Everything
$kind = read_json_list("kind");
$meta = read_json_list("meta");
#---------------------------------------------------------------------------------------------------------------------------------------
#This line of code counts the number of pages
$pagecount = count($uri);
#---------------------------------------------------------------------------------------------------------------------------------------
#This code looks what page is requested, and passes that on to further code
$request_uri = ltrim(ltrim(rtrim($_SERVER['REQUEST_URI'], "\\/"), "\\/"), "beta");
for ($i = 0; $i < $pagecount; $i++) {
    if ($uri[$i] == $request_uri) {
        $page_number = $i;
    }
}
#---------------------------------------------------------------------------------------------------------------------------------------
#This part of the code sets the correct php response codes, emitting this code might stop your content from being displayed or might stop it from being indexed by search engines like google (this means that you couldn't be found in the internet)
if (date('d:m') == "01:04") {
    http_response_code(418);