Merge remote-tracking branch 'origin/main'

This commit is contained in:
Bruno Rybársky 2024-02-07 10:47:15 +01:00
commit 928448075b
11 changed files with 461 additions and 336 deletions

BIN
assets/images/favicon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

@ -1,4 +1,33 @@
let UserInfo; let UserInfo = {};
async function handleResponse(data, successMessage, failureMessage) {
const statusMessageContainer = document.getElementById("statusMessageContainer");
const statusMessage = document.createElement("div");
statusMessage.classList.add("status-message");
if (data.Status === 'Success') {
statusMessage.innerText = successMessage;
statusMessage.classList.add("success");
} else {
statusMessage.innerText = failureMessage;
statusMessage.classList.add("failure");
}
statusMessageContainer.appendChild(statusMessage);
// Automatically remove the message after 3 seconds
setTimeout(() => {
statusMessage.style.opacity = "0";
setTimeout(() => {
statusMessage.remove();
}, 500);
}, 2000);
}
async function showDashboardGreeting() {
document.getElementById("welcomeMsg").innerText = `Ahoj, ${UserInfo.FirstName}.`;
}
async function doAction(url, requestData, successMessage, failureMessage, silent = false) { async function doAction(url, requestData, successMessage, failureMessage, silent = false) {
try { try {
const params = new URLSearchParams(); const params = new URLSearchParams();
@ -13,13 +42,13 @@ async function doAction(url, requestData, successMessage, failureMessage, silent
}); });
if (!response.ok) { if (!response.ok) {
throw new Error(`HTTP error! Status: ${response.status}`); console.error(`HTTP error! Status: ${response.status}`);
} }
const data = await response.json(); const data = await response.json();
if (!silent) { if (!silent) {
handleResponse(data, successMessage, failureMessage); await handleResponse(data, successMessage, failureMessage);
} }
return data; return data;
@ -28,9 +57,9 @@ async function doAction(url, requestData, successMessage, failureMessage, silent
} }
} }
function handlePageResponse(data) { async function handlePageResponse(data) {
const navbar = document.getElementById("navbar"); const navbar = document.getElementById("navbar_container");
const pageArea = document.getElementById("pagearea"); const pageArea = document.getElementById("page_container");
if (data.Navigation) { if (data.Navigation) {
navbar.innerHTML = data.Navigation; navbar.innerHTML = data.Navigation;
@ -44,7 +73,7 @@ function handlePageResponse(data) {
} }
} }
function displayList(data, elementId, deleteFunction) { async function displayList(data, elementId, deleteFunction) {
const tableContainer = document.getElementById(elementId); const tableContainer = document.getElementById(elementId);
tableContainer.innerHTML = ""; // Clear previous content tableContainer.innerHTML = ""; // Clear previous content
@ -92,11 +121,11 @@ async function doPageAction(requestData, wantsReturn = false) {
}); });
if (!response.ok) { if (!response.ok) {
throw new Error(`HTTP error! Status: ${response.status}`); console.error(`HTTP error! Status: ${response.status}`);
} }
const data = await response.json(); const data = await response.json();
handlePageResponse(data); await handlePageResponse(data);
if (wantsReturn) { if (wantsReturn) {
return data; return data;
} }
@ -105,7 +134,7 @@ async function doPageAction(requestData, wantsReturn = false) {
} }
} }
function initAjax() { async function initAjax() {
const links = document.querySelectorAll('.navsite_link, .navpage_link'); const links = document.querySelectorAll('.navsite_link, .navpage_link');
links.forEach(function (link) { links.forEach(function (link) {
@ -118,26 +147,36 @@ function initAjax() {
} }
}); });
}); });
onPageLoad(); const toggleButton = document.getElementById("toggle_button")
const navLinks = document.getElementById("navsite_list")
toggleButton.addEventListener('click', () => {
navLinks.classList.toggle("active")
})
await onPageLoad();
} }
document.addEventListener('DOMContentLoaded', initAjax); document.addEventListener('DOMContentLoaded', initAjax);
function onPageLoad(){ async function onPageLoad(){
await restoreUserInfo();
let currentSite = localStorage.getItem("currentSite"); let currentSite = localStorage.getItem("currentSite");
let currentPage = localStorage.getItem("currentPage"); let currentPage = localStorage.getItem("currentPage");
if(currentSite === "home" && currentPage === "settings"){ if(currentSite === "home" && currentPage === "settings"){
if(document.getElementById("user-settings")){ if(document.getElementById("user-settings")){
getUserInfo(); await populateUserInfoFields(UserInfo);
} }
if(document.getElementById("admin-settings")){ if(document.getElementById("admin-settings")){
listActivationCodes(); await listActivationCodes(true);
listUsers(); await listUsers(true);
} }
} }
if(currentSite === "home" && currentPage === "account") {
await showDashboardGreeting();
}
} }
function navigateTo(site, page){ async function navigateTo(site, page){
const data = { const data = {
action: "getPage", action: "getPage",
site: site, site: site,
@ -150,39 +189,46 @@ function navigateTo(site, page){
}); });
} }
function softReload(){ async function softReload(){
let currentSite = localStorage.getItem("currentSite"); let currentSite = localStorage.getItem("currentSite");
let currentPage = localStorage.getItem("currentPage"); let currentPage = localStorage.getItem("currentPage");
navigateTo(currentSite, currentPage); await navigateTo(currentSite, currentPage);
umami.track("softReload"); umami.track("softReload");
} }
function refreshNavbar(){ async function refreshNavbar(){
const data = { const data = {
action: "getNavigation", action: "getNavigation",
}; };
doPageAction(data); await doPageAction(data);
umami.track("refreshNavbar"); umami.track("refreshNavbar");
} }
function logout() { async function logout() {
const data = { const data = {
action: "logout", action: "logout",
}; };
doAction('/account', data, "Logout Successful!", "Logout failed.").then(() => { doAction('/account', data, "Logout Successful!", "Logout failed.")
refreshNavbar(); .then(async () => {
navigateTo("", localStorage.getItem("defaultPage")); await refreshNavbar();
umami.track("logout"); await navigateTo(localStorage.getItem("defaultSite"), localStorage.getItem("defaultPage"));
}); localStorage.clear();
umami.track("logout");
})
.catch((error) => {
// Handle errors if needed
console.error("An error occurred during logout:", error);
});
} }
function login() { async function login() {
const email = document.getElementById("login_email").value; const email = document.getElementById("login_email").value;
const password = document.getElementById("login_password").value; const password = document.getElementById("login_password").value;
doLogin(email, password); await doLogin(email, password);
refreshNavbar(); await getUserInfo();
softReload(); await refreshNavbar();
await softReload();
} }
async function doLogin(email, password) { async function doLogin(email, password) {
@ -196,7 +242,7 @@ async function doLogin(email, password) {
umami.track("login"); umami.track("login");
} }
function register() { async function register() {
const firstName = document.getElementById("register_firstName").value; const firstName = document.getElementById("register_firstName").value;
const lastName = document.getElementById("register_lastName").value; const lastName = document.getElementById("register_lastName").value;
const email = document.getElementById("register_email").value; const email = document.getElementById("register_email").value;
@ -212,7 +258,7 @@ function register() {
activation_token: activationToken, activation_token: activationToken,
}; };
doRegister(data); await doRegister(data);
} }
async function doRegister(requestData) { async function doRegister(requestData) {
@ -222,7 +268,7 @@ async function doRegister(requestData) {
//User settings start //User settings start
function changePassword() { async function changePassword() {
const oldPassword = document.getElementById("changeOldPassword").value; const oldPassword = document.getElementById("changeOldPassword").value;
const newPassword = document.getElementById("changeNewPassword").value; const newPassword = document.getElementById("changeNewPassword").value;
@ -232,7 +278,7 @@ function changePassword() {
new_password: newPassword, new_password: newPassword,
}; };
doChangePassword(data, "Password change Successful!", "Password change failed."); await doChangePassword(data, "Password change Successful!", "Password change failed.");
} }
async function doChangePassword(requestData, successMessage, failureMessage) { async function doChangePassword(requestData, successMessage, failureMessage) {
@ -240,7 +286,7 @@ async function doChangePassword(requestData, successMessage, failureMessage) {
umami.track("passwordChange"); umami.track("passwordChange");
} }
function updateUserProfile() { async function updateUserProfile() {
const firstName = document.getElementById("updateFirstName").value; const firstName = document.getElementById("updateFirstName").value;
const lastName = document.getElementById("updateLastName").value; const lastName = document.getElementById("updateLastName").value;
const nickname = document.getElementById("updateNickname").value; const nickname = document.getElementById("updateNickname").value;
@ -254,11 +300,11 @@ function updateUserProfile() {
minecraft_nick: minecraftNick, minecraft_nick: minecraftNick,
}; };
doAction('/account', data, "Profile update Successful!", "Profile update failed."); await doAction('/account', data, "Profile update Successful!", "Profile update failed.");
umami.track("updateUserProfile"); umami.track("updateUserProfile");
} }
function updateEmail() { async function updateEmail() {
const newEmail = document.getElementById("updateNewEmail").value; const newEmail = document.getElementById("updateNewEmail").value;
const data = { const data = {
@ -266,11 +312,11 @@ function updateEmail() {
email: newEmail, email: newEmail,
}; };
doAction('/account', data, "Email update Successful!", "Email update failed."); await doAction('/account', data, "Email update Successful!", "Email update failed.");
umami.track("updateEmail"); umami.track("updateEmail");
} }
function populateUserInfoFields(userData) { async function populateUserInfoFields(userData) {
document.getElementById("updateFirstName").value = userData.FirstName || ""; document.getElementById("updateFirstName").value = userData.FirstName || "";
document.getElementById("updateLastName").value = userData.LastName || ""; document.getElementById("updateLastName").value = userData.LastName || "";
document.getElementById("updateNickname").value = userData.Nickname || ""; document.getElementById("updateNickname").value = userData.Nickname || "";
@ -278,24 +324,36 @@ function populateUserInfoFields(userData) {
document.getElementById("updateNewEmail").value = userData.Email || ""; document.getElementById("updateNewEmail").value = userData.Email || "";
} }
function getUserInfo() { async function restoreUserInfo(){
for (let i = 0; i < localStorage.length; i++) {
let key = localStorage.key(i);
if (key.startsWith("UserInfo_")){
let keyClean = key.replace("UserInfo_", "");
UserInfo[keyClean] = localStorage.getItem(key);
}
}
}
async function getUserInfo() {
const data = { const data = {
action: "get_user_info", action: "get_user_info",
}; };
const result = doAction('/account', data, "User info retrieved Successfully!", "User info retrieval failed.", true); doAction('/account', data, "User info retrieved Successfully!", "User info retrieval failed.", true) .then((result) => {
if (result && result.Status === "Success") {
if (result && result.Status === "Success") { result.UserInfo.forEach(function callback(value, index) {
populateUserInfoFields(result.UserInfo); localStorage.setItem("UserInfo_" + index, value);
UserInfo = result.UserInfo; UserInfo[index] = value;
} });
}
});
} }
//User settings end //User settings end
//Admin settings start //Admin settings start
function addActivationCodes() { async function addActivationCodes() {
const count = document.getElementById("activationCodeCount").value; const count = document.getElementById("activationCodeCount").value;
const data = { const data = {
@ -303,53 +361,54 @@ function addActivationCodes() {
count: count, count: count,
}; };
const result = doAction('/account', data, "Activation codes added Successfully!", "Activation codes addition failed."); doAction('/account', data, "Activation codes added Successfully!", "Activation codes addition failed.").then((result) => {
displayList(result.ActivationCodes, "codeListTable", deleteActivationCode);
displayList(result.ActivationCodes, "codeListTable", deleteActivationCode); umami.track("addActivationCodes");
umami.track("addActivationCodes"); });
} }
function listUsers() { async function listUsers(silent=false) {
const data = { const data = {
action: "list_users", action: "list_users",
}; };
const result = doAction('/account', data, "User list retrieved Successfully!", "User list retrieval failed."); doAction('/account', data, "User list retrieved Successfully!", "User list retrieval failed.", silent).then((result) => {
if (result && result.Status === "Success") { if (result && result.Status === "Success") {
displayList(result.Users, "userListTable", deleteUser); displayList(result.Users, "userListTable", deleteUser);
} }
});
} }
function listActivationCodes() { async function listActivationCodes(silent=false) {
const data = { const data = {
action: "list_activation_codes", action: "list_activation_codes",
}; };
const result = doAction('/account', data, "Activation code list retrieved Successfully!", "Activation code list retrieval failed."); doAction('/account', data, "Activation code list retrieved Successfully!", "Activation code list retrieval failed.", silent).then((result) => {
displayList(result.ActivationCodes, "codeListTable", deleteActivationCode);
displayList(result.ActivationCodes, "codeListTable", deleteActivationCode); });
} }
function deleteUser(userId) { async function deleteUser(userId) {
const data = { const data = {
action: "delete_user", action: "delete_user",
user_id: userId, user_id: userId,
}; };
doAction('/account', data, "User deleted Successfully!", "User deletion failed."); await doAction('/account', data, "User deleted Successfully!", "User deletion failed.");
listUsers(); await listUsers();
umami.track("deleteUser"); umami.track("deleteUser");
} }
function deleteActivationCode(activationCode) { async function deleteActivationCode(activationCode) {
const data = { const data = {
action: "delete_activation_code", action: "delete_activation_code",
activation_code: activationCode, activation_code: activationCode,
}; };
doAction('/account', data, "Activation code deleted Successfully!", "Activation code deletion failed."); await doAction('/account', data, "Activation code deleted Successfully!", "Activation code deletion failed.");
listActivationCodes(); await listActivationCodes();
umami.track("deleteActivationCode"); umami.track("deleteActivationCode");
} }
//Admin settings end //Admin settings end

@ -1,274 +1,339 @@
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700;800&display=swap'); @import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700;800&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Montserrat:ital,wght@0,100..900;1,100..900&display=swap'); @import url('https://fonts.googleapis.com/css2?family=Montserrat:ital,wght@0,100..900;1,100..900&display=swap');
:root { .dashboard
--primary-bg: rgb(27, 21, 41); {
--secondary-bg: #1a1a1a; height:100%;
--third-bg: #383838; text-align:center;
--primary-text: #d2d6e5; width:100%;
--error: rgb(255, 55, 0);
--primary: #2a9dd6;
--primary-hover: #2489bb;
} }
body { :root
background: linear-gradient(127deg, var(--secondary-bg), var(--primary-bg)) no-repeat fixed; {
background-size: cover; --error:#ff3700;
height: 100%; --primary:#2a9dd6;
--primary-bg:#1b1529;
--primary-hover:#2489bb;
--primary-text:#d2d6e5;
--secondary-bg:#1a1a1a;
--third-bg:#383838;
}
body
{
align-items:center;
background:linear-gradient(127deg,var(--secondary-bg), var(--primary-bg)) no-repeat fixed;
background-size:cover;
color:var(--primary-text);
display:flex;
flex-direction:column;
font-family:\'Poppins\', sans-serif;
height:100%;
margin:0;
min-height:100vh;
min-width:100vw;
padding:0;
width:100%;
}
header h1
{
margin:0;
padding:0;
}
header hr
{
border-color:var(--primary);
opacity:0.5;
width:30%;
}
header ul li
{
list-style:circle;
width:fit-content;
}
header ul
{
display:flex;
flex-direction:column;
gap:0;
text-align:left;
width:fit-content;
}
header
{
align-items:center;
text-align:center;
width:100%;
}
li a
{
color:var(--primary-text);
padding-bottom:.45rem;
position:relative;
text-decoration:none;
transition:all .3s ease;
}
li a:hover::after
{
margin:0 auto;
width:85%;
}
li
{
list-style:none;
}
li.navpage_item
{
padding-left:20px;
padding-right:20px;
}
nav
{
display:flex;
flex-direction:row;
justify-content:space-between;
height: 55px;
}
nav,footer
{
-moz-box-shadow:0 20px 28px 0 rgba(0,0,0,0.6);
-webkit-box-shadow:0 20px 28px 0 rgba(0,0,0,0.6);
background-color:rgba(0,0,0,0.6);
box-shadow:0 20px 28px 0 rgba(0,0,0,0.6);
padding:1.2rem 1rem;
}
table.list-table > tbody,table.list-table > tbody > th,table.list-table > tbody > tr,table.list-table > tbody > tr > td
{
border:2px solid var(--primary);
border-collapse:collapse;
}
ul
{
display:flex;
flex-direction:row;
gap:2.5rem;
list-style:none;
padding-left:0;
}
ul.navpage_list
{
gap:10px;
background-color:var(--third-bg);
border:0 solid transparent;
display:none;
flex-direction:column;
max-height:0;
overflow:hidden;
position:fixed;
transition:max-height .3s ease, border .325s ease;
z-index:2;
}
.back
{
background-color:#2a9dd6;
border-radius:15px;
color:var(--primary-text);
padding:.35rem .65rem;
text-decoration:none;
transition:all .3s ease;
}
.back:hover
{
background-color:var(--primary-hover);
transition:all .3s ease;
}
.feature-list
{
display:block;
margin:auto;
width:fit-content;
}
.feature-list-ul ul
{
margin: 5px auto auto 20px;
}
.navsite_item
{
align-items:center;
justify-content:center;
text-align:center;
width:120px;
}
.navsite_item:hover .navpage_list
{
border:4px solid var(--primary-hover);
display:flex!important;
max-height:200px;
}
.navsite_item:not(:hover) .navpage_list
{
border:0 solid transparent;
max-height:0;
transition-delay:.1s;
}
#navsite_list, .navsite_list
{
display:flex;
flex-direction:row;
width: 100%; width: 100%;
font-family: 'Poppins', sans-serif; gap:3.25rem;
color: var(--primary-text);
margin: 0;
padding: 0;
min-height: 100vh;
min-width: 100vw;
display: flex;
flex-direction: column;
align-items: center;
} }
nav { #toggle_button {
display: flex;
flex-direction: row;
justify-content: space-between;
}
ul {
display: flex;
flex-direction: row;
gap: 2.5rem;
list-style: none;
padding-left: 0;
}
li {
list-style: none;
}
li a {
position: relative;
padding-bottom: 0.45rem;
color: var(--primary-text);
text-decoration: none;
transition: all 0.3s ease;
}
/*li a::after {
content: "";
position: absolute; position: absolute;
height: 4px; right: 1.5rem;
width: 0;
bottom: 0;
left: 0;
background-color: var(--primary);
transition: all 0.3s ease;
border-radius: 15px;
}*/
li a:hover::after {
width: 85%;
margin: 0 auto;
}
.wrapper-40x {
text-align: center;
}
.wrapper-40x h1 {
font-size: 10rem;
margin: 0;
}
.wrapper-40x .error {
color: var(--error);
}
.wrapper-40x h3 {
margin-bottom: 2rem;
}
.error-code {
color: var(--primary);
}
.back {
color: var(--primary-text);
text-decoration: none;
background-color: #2a9dd6;
padding: 0.35rem 0.65rem;
transition: all 0.3s ease;
border-radius: 15px;
}
.back:hover {
transition: all 0.3s ease;
background-color: var(--primary-hover);
}
header {
width: 100%;
align-items: center;
text-align: center;
}
header h1 {
margin: 0;
padding: 0;
}
header a {
color: var(--primary);
}
header hr {
border-color: var(--primary);
opacity: 0.5;
width: 30%;
}
.navsite_list{
display: flex;
flex-direction: row;
gap: 3.25rem;
}
.navpage_list{
display: none; display: none;
flex-direction: column; flex-direction: column;
justify-content: space-between;
width: 2rem;
height: 1.5rem;
} }
.navsite_item { @media (max-width: 1050px) {
justify-content: center; #toggle_button {
align-items: center; display: flex;
text-align: center; }
width: 120px; #navsite_list {
display: none;
position: fixed;
flex-direction: column;
width: 100%;
}
#navsite_list li {
text-align: center;
width: 100%;
}
#navsite_list.active {
display: flex;
-moz-box-shadow:0 20px 28px 0 rgba(0,0,0,0.6);
-webkit-box-shadow:0 20px 28px 0 rgba(0,0,0,0.6);
background-color:rgba(0,0,0,0.6);
box-shadow:0 20px 28px 0 rgba(0,0,0,0.6);
top: 80px;
width: 100%;
}
nav {
flex-direction: column;
align-items: center;
background-color: rgba(0,0,0,0.6);
}
} }
.navsite_item:hover .navpage_list{ #statusMessageContainer{
display: flex !important;
}
.navpage_list {
background-color: var(--third-bg);
margin-top: 10px;
display: flex;
flex-direction: column;
overflow: hidden;
max-height: 0;
border: 0 solid transparent;
transition: max-height 0.3s ease, border 0.325s ease;
position: relative;
z-index: 999;
}
.navsite_item:hover .navpage_list {
max-height: 200px;
border: 4px solid var(--primary-hover);
}
.navsite_item:not(:hover) .navpage_list {
max-height: 0;
border: 0 solid transparent;
transition-delay: 0.1s;
}
li.navpage_item{
padding-left: 20px;
padding-right: 20px;
}
ul.navpage_list{
gap: 10px;
}
header ul {
display: flex;
flex-direction: column;
gap: 0;
text-align: left;
width: fit-content;
}
header ul li {
list-style: circle;
width: fit-content;
}
.feature-list {
margin: auto;
width: fit-content;
display: block;
}
.feature-list-ul {
margin: auto;
}
.feature-list-ul ul {
margin-top: 5px;
margin-left: 20px;
}
#StatusMessage {
display: none;
position: fixed; position: fixed;
top: 20px; top: 80px;
right: 20px; right: 20px;
padding: 10px; z-index: 510;
background-color: var(--third-bg); display: flex;
color: var(--primary-text); flex-direction: column;
border-radius: 5px; }
opacity: 0;
.status-message {
background-color: #dff0d8; /* Success background color */
border: 1px solid #3c763d; /* Success border color */
color: #3c763d; /* Success text color */
padding: 15px;
margin-bottom: 10px;
opacity: 1;
transition: opacity 0.5s ease-in-out; transition: opacity 0.5s ease-in-out;
} }
table.list-table > tbody, table.list-table > tbody > th, table.list-table > tbody > tr, table.list-table > tbody > tr > td { .status-message.failure {
background-color: #f2dede; /* Failure background color */
border: 1px solid #a94442; /* Failure border color */
color: #a94442; /* Failure text color */
}
.wrapper-40x .error
{
color:var(--error);
}
.wrapper-40x h1
{
font-size:10rem;
margin:0;
}
.wrapper-40x h3
{
margin-bottom:2rem;
}
.wrapper-40x
{
text-align:center;
}
#navbar_container
{
position:relative;
z-index:500;
}
#navbar_container,#page_container,#footer_container
{
width:100%;
}
#page_container
{
flex-grow:1;
}
header a,.error-code
{
color:var(--primary);
}
input
{
background-color: var(--third-bg);
border:2px solid var(--primary);
border-radius:50px;
}
button{
border-radius: 50px;
border: 2px solid var(--primary); border: 2px solid var(--primary);
border-collapse: collapse; background: var(--third-bg);
color: var(--primary-text);
width: 175px;
transition-duration: 0.3s;
} }
/* <DASHBOARD STYLING> */ button:hover {
/* ZAČÍNAJ VŠETKO S ".dashboard" */ background: var(--primary);
transition-duration: 0.3s;
.dashboard {
width: 100%;
height: 100%;
text-align: center;
} }
/* </DASHBOARD STYLING> */ .form-container input {
#loginForm input {
border-radius: 50px; border-radius: 50px;
background: none; background: none;
border: 2px solid var(--primary); border: 2px solid var(--primary);
width: 175px; width: 175px;
}
#register_Form input {
border-radius: 50px;
background: none;
border: 2px solid var(--primary);
width: 175px;
}
#pagearea {
flex-grow: 1;
}
#navbar, #footer {
padding: 1.2rem 1rem;
background-color: rgba(0, 0, 0, 0.2);
-webkit-box-shadow: 0 20px 28px 0 rgba(0,0,0,0.2);
-moz-box-shadow: 0 20px 28px 0 rgba(0,0,0,0.2);
box-shadow: 0 20px 28px 0 rgba(0,0,0,0.2);
}
#navbar {
height: 75px !important;
position: relative;
z-index: 500;
}
#navbar, #pagearea, #footer {
width: 100%;
} }

@ -104,6 +104,7 @@ function renderPage($page_name = null, $site_name = null): array
} }
} }
$page = str_replace("__DEFAULT_LINK__", "/" . $routerConfig["default_site"] . "/" . $routerConfig["default_page"], $page);
if(!is_string($page)){ if(!is_string($page)){
$page = ""; $page = "";
} }
@ -136,12 +137,23 @@ function getPage($site_name_in = null, $page_name_in = null): string
$page_title = $page_name; $page_title = $page_name;
} }
$dynamic_style = doDynamicStyling(); $dynamic_style = doDynamicStyling();
$dynamic_script = generateScriptData([ $dynamic_script_data = [
"currentPage" => $page_name, "currentPage" => $page_name,
"currentSite" => $site_name, "currentSite" => $site_name,
"currentTitle" => $page_title, "currentTitle" => $page_title,
"defaultPage" => $routerConfig["default_page"], "defaultPage" => $routerConfig["default_page"],
]); "defaultSite" => $routerConfig["default_site"],
];
if(isLoggedIn()){
$dynamic_script_data += [
"UserInfo_FirstName" => $_SESSION["first_name"],
"UserInfo_LastName" => $_SESSION["last_name"],
"UserInfo_Nickname" => $_SESSION["nickname"],
"UserInfo_Email" => $_SESSION["email"],
"UserInfo_MinecraftNick" => $_SESSION["minecraft_nickname"],
];
}
$dynamic_script = generateScriptData($dynamic_script_data);
$navigation = generateNavigation(); $navigation = generateNavigation();

@ -2,5 +2,5 @@
<h2>TY KÁR KAM TO DEŠ</h2> <h2>TY KÁR KAM TO DEŠ</h2>
<h1 class="error-code">403</h1> <h1 class="error-code">403</h1>
<h3><i class="ri-error-warning-line"></i> Našli sme stránku ktorú hľadáš, ale nemáš práva na ňu pristupovať: <span class="error">__TEMPLATE_PAGE_TITLE__</span>. <i class="ri-error-warning-line"></i></h3> <h3><i class="ri-error-warning-line"></i> Našli sme stránku ktorú hľadáš, ale nemáš práva na ňu pristupovať: <span class="error">__TEMPLATE_PAGE_TITLE__</span>. <i class="ri-error-warning-line"></i></h3>
<a href="/index" class="back"><i class="ri-arrow-left-line"></i> SPÄŤ DOMOV</a> <a href="__DEFAULT_LINK__" class="back"><i class="ri-arrow-left-line"></i> SPÄŤ DOMOV</a>
</div> </div>

@ -2,5 +2,5 @@
<h2>TY KÁR KAM TO DEŠ</h2> <h2>TY KÁR KAM TO DEŠ</h2>
<h1 class="error-code">404</h1> <h1 class="error-code">404</h1>
<h3><i class="ri-error-warning-line"></i> Nenašli sme stránku ktorú hľadáš: <span class="error">__TEMPLATE_PAGE_TITLE__</span>. <i class="ri-error-warning-line"></i></h3> <h3><i class="ri-error-warning-line"></i> Nenašli sme stránku ktorú hľadáš: <span class="error">__TEMPLATE_PAGE_TITLE__</span>. <i class="ri-error-warning-line"></i></h3>
<a href="/index" class="back"><i class="ri-arrow-left-line"></i> SPÄŤ DOMOV</a> <a href="__DEFAULT_LINK__" class="back"><i class="ri-arrow-left-line"></i> SPÄŤ DOMOV</a>
</div> </div>

@ -2,5 +2,5 @@
<h2>Niekto to pobabral</h2> <h2>Niekto to pobabral</h2>
<h1 class="error-code">500</h1> <h1 class="error-code">500</h1>
<h3><i class="ri-error-warning-line"></i> Nejaký neschopný vývojár nevedel robiť túto stránku. <i class="ri-error-warning-line"></i></h3> <h3><i class="ri-error-warning-line"></i> Nejaký neschopný vývojár nevedel robiť túto stránku. <i class="ri-error-warning-line"></i></h3>
<a href="/index" class="back"><i class="ri-arrow-left-line"></i> SPÄŤ DOMOV</a> <a href="__DEFAULT_LINK__" class="back"><i class="ri-arrow-left-line"></i> SPÄŤ DOMOV</a>
</div> </div>

@ -1,19 +1,3 @@
<script defer>
async function getUserInfo() {
const data = new URLSearchParams();
data.append("action", "get_user_info");
const result = await doAccountAction(data, null, null, true);
if (result && result.Status === "Success") {
document.getElementById("welcomeMsg").innerText = `Ahoj, ${result.UserInfo.FirstName}.`;
}
}
getUserInfo();
</script>
<div class="dashboard"> <div class="dashboard">
<h1 id="welcomeMsg"></h1> <h1 id="welcomeMsg"></h1>
</div> </div>

@ -1 +1,3 @@
<p>Toto nie je oficiálna stránka Adlerky, jedná sa o neoficiálnu študentskú stránku</p> <footer>
<p>Toto nie je oficiálna stránka Adlerky, jedná sa o neoficiálnu študentskú stránku</p>
</footer>

@ -1,6 +1,7 @@
<nav> <nav>
<div class="logo"><img alt="Adlerka logo" class="standard-logo" width="213" height="50" src="https://www.adlerka.sk/wp-content/uploads/2021/09/Logo_text_Adlerka_modro_cerveno_biele-e1652431356820.png" title="Adlerka"></div> <div class="logo"><img alt="Adlerka logo" class="standard-logo" width="213" height="50" src="https://www.adlerka.sk/wp-content/uploads/2021/09/Logo_text_Adlerka_modro_cerveno_biele-e1652431356820.png" title="Adlerka"></div>
<ul class="navsite_list"> <i class="ri-menu-line" id="toggle_button"></i>
<ul id="navsite_list">
__NAV_PAGES__ __NAV_PAGES__
</ul> </ul>
</nav> </nav>

@ -5,6 +5,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="/assets/3rdparty/fonts/remixicon/remixicon.css"> <link rel="stylesheet" href="/assets/3rdparty/fonts/remixicon/remixicon.css">
<link rel="stylesheet" href="/assets/style.css"> <link rel="stylesheet" href="/assets/style.css">
<link rel="icon" href="/assets/images/favicon.png">
__TEMPLATE__DYNAMIC__SCRIPT__ __TEMPLATE__DYNAMIC__SCRIPT__
__TEMPLATE__DYNAMIC__STYLE__ __TEMPLATE__DYNAMIC__STYLE__
<script async src="https://umami.brn.systems/script.js" data-website-id="95e93885-5c19-4cab-ba9b-2f746a316a2a"></script> <script async src="https://umami.brn.systems/script.js" data-website-id="95e93885-5c19-4cab-ba9b-2f746a316a2a"></script>
@ -12,13 +13,14 @@
<title>Adlerka __TEMPLATE_PAGE_TITLE__</title> <title>Adlerka __TEMPLATE_PAGE_TITLE__</title>
</head> </head>
<body> <body>
<div id="navbar"> <div id="navbar_container">
__TEMPLATE__NAV__ __TEMPLATE__NAV__
</div> </div>
<div id="pagearea"> <div id="statusMessageContainer"></div>
<div id="page_container">
__TEMPLATE__PAGE__ __TEMPLATE__PAGE__
</div> </div>
<div id="footer"> <div id="footer_container">
__TEMPLATE__FOOTER__ __TEMPLATE__FOOTER__
</div> </div>
</body> </body>