Compare commits
6 Commits
Author | SHA1 | Date | |
---|---|---|---|
994e1030b1 | |||
f66ac02fd8 | |||
dfc58eacb4 | |||
fe71309446 | |||
909dfcb97f | |||
70bee41bb1 |
Before Width: | Height: | Size: 17 KiB |
Before Width: | Height: | Size: 26 KiB |
Before Width: | Height: | Size: 8.5 KiB |
Before Width: | Height: | Size: 2.3 MiB |
Before Width: | Height: | Size: 11 KiB |
BIN
assets/images/mikina.webp
Normal file
After Width: | Height: | Size: 18 KiB |
Before Width: | Height: | Size: 3.4 KiB |
@ -399,14 +399,12 @@ async function updateUserProfile() {
|
||||
const firstName = document.getElementById("updateFirstName").value;
|
||||
const lastName = document.getElementById("updateLastName").value;
|
||||
const nickname = document.getElementById("updateNickname").value;
|
||||
const minecraftNick = document.getElementById("updateMinecraftNick").value;
|
||||
|
||||
const data = {
|
||||
action: "update_user_profile",
|
||||
first_name: firstName,
|
||||
last_name: lastName,
|
||||
nickname: nickname,
|
||||
minecraft_nick: minecraftNick,
|
||||
};
|
||||
|
||||
await doAction('/account', data, "Profile update Successful!", "Profile update failed.", false);
|
||||
@ -431,7 +429,6 @@ async function populateUserInfoFields(userData) {
|
||||
document.getElementById("updateFirstName").value = userData.FirstName || "";
|
||||
document.getElementById("updateLastName").value = userData.LastName || "";
|
||||
document.getElementById("updateNickname").value = userData.Nickname || "";
|
||||
document.getElementById("updateMinecraftNick").value = userData.MinecraftNick || "";
|
||||
document.getElementById("updateNewEmail").value = userData.Email || "";
|
||||
}
|
||||
|
||||
|
@ -240,11 +240,6 @@ ul.navpage_list {
|
||||
|
||||
@media (max-width: 1050px) {
|
||||
|
||||
div#articleslist {
|
||||
width: 100vw !important;
|
||||
left: 0 !important;
|
||||
}
|
||||
|
||||
#toggle_button {
|
||||
display: flex;
|
||||
}
|
||||
@ -381,60 +376,8 @@ button:hover {
|
||||
color: var(--primary-text);
|
||||
}
|
||||
|
||||
header.ye-span:hover + body{
|
||||
background: url('/assets/images/ye.jpg') repeat !important;
|
||||
background-size: 10% !important;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
#articlecreate {
|
||||
position: fixed;
|
||||
border: 5px solid var(--primary);
|
||||
z-index: 5;
|
||||
margin: auto;
|
||||
padding: 40px;
|
||||
background-color: var(--primary-bg);
|
||||
border-radius: 50px;
|
||||
}
|
||||
|
||||
#articlecreate > * {
|
||||
margin: 10px 0;
|
||||
}
|
||||
|
||||
#articlecreateopen {
|
||||
display: none;
|
||||
}
|
||||
|
||||
#articlecreatecontainer{
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100vw;
|
||||
height: 100vh;
|
||||
z-index: 4;
|
||||
backdrop-filter: blur(2px);
|
||||
}
|
||||
|
||||
|
||||
.hidden {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
div#articleslist > article > div.articleinfo > *{
|
||||
width: fit-content;
|
||||
}
|
||||
|
||||
/*noinspection CssUnusedSymbol*/
|
||||
div#articleslist > article > div.articleinfo{
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
}
|
||||
|
||||
div#articleslist>article{
|
||||
border: 4px solid var(--primary);
|
||||
}
|
@ -25,8 +25,7 @@ function endpoint($endpoint_data): array
|
||||
"update_user_profile" => updateUserProfile(
|
||||
$endpoint_data["first_name"],
|
||||
$endpoint_data["last_name"],
|
||||
$endpoint_data["nickname"],
|
||||
$endpoint_data["minecraft_nick"]
|
||||
$endpoint_data["nickname"]
|
||||
),
|
||||
"update_user_email" => updateUserEmail(
|
||||
$endpoint_data["email"]
|
||||
|
@ -1,16 +0,0 @@
|
||||
<?php
|
||||
|
||||
require_once "lib/newsarticle.php";
|
||||
|
||||
function endpoint($endpoint_data): array
|
||||
{
|
||||
|
||||
return match ($endpoint_data["action"]) {
|
||||
"getNewsArticles" => getNewsArticles(),
|
||||
"addNewsArticle" => addNewsArticle(
|
||||
$endpoint_data["title"],
|
||||
$endpoint_data["body"]
|
||||
),
|
||||
default => ["Status" => "Fail", "message" => "Invalid action"],
|
||||
};
|
||||
}
|
@ -1,14 +0,0 @@
|
||||
<?php
|
||||
|
||||
require_once "lib/upload.php";
|
||||
|
||||
function endpoint($endpoint_data): array
|
||||
{
|
||||
|
||||
return match ($endpoint_data["action"]) {
|
||||
"getMyFiles" => listFiles(),
|
||||
"getAllFiles" => listFiles(false),
|
||||
"UploadFiles" => parseIncomingFiles(),
|
||||
default => ["Status" => "Fail", "message" => "Invalid action"],
|
||||
};
|
||||
}
|
@ -68,7 +68,6 @@ function setDefaultSessionData(): void
|
||||
$_SESSION["last_name"] = "";
|
||||
$_SESSION["nickname"] = "";
|
||||
$_SESSION["email"] = "";
|
||||
$_SESSION["minecraft_nickname"] = "";
|
||||
$_SESSION["privilege_level"] = $routerConfig["permissions"]["logged_out"];
|
||||
}
|
||||
|
||||
@ -89,7 +88,7 @@ function verifyPassword($userID, $password): bool
|
||||
function UpdateSession(): void
|
||||
{
|
||||
global $mysqli;
|
||||
$stmt = $mysqli->prepare("SELECT FirstName, LastName, Nickname, Email, MinecraftNick, PrivilegeLevel, LastLoginAt, LoginCount, ClassID, FavoriteColor FROM Users WHERE ID = ? AND isActivated = 1");
|
||||
$stmt = $mysqli->prepare("SELECT FirstName, LastName, Nickname, Email, PrivilegeLevel, LastLoginAt, LoginCount, FavoriteColor FROM Users WHERE ID = ? AND isActivated = 1");
|
||||
$stmt->bind_param("i", $_SESSION["ID"]);
|
||||
$stmt->execute();
|
||||
|
||||
@ -97,24 +96,20 @@ function UpdateSession(): void
|
||||
$last_name = "";
|
||||
$nickname = "";
|
||||
$email = "";
|
||||
$minecraft_nickname = "";
|
||||
$privilege_level = 0;
|
||||
$class_id = 0;
|
||||
$favorite_color = 0;
|
||||
$lastLoginAt = null;
|
||||
$loginCount = 0;
|
||||
$stmt->bind_result($first_name, $last_name, $nickname, $email, $minecraft_nickname, $privilege_level, $lastLoginAt, $loginCount, $class_id, $favorite_color);
|
||||
$stmt->bind_result($first_name, $last_name, $nickname, $email, $privilege_level, $lastLoginAt, $loginCount, $favorite_color);
|
||||
$stmt->fetch();
|
||||
$stmt->close();
|
||||
$_SESSION["first_name"] = $first_name;
|
||||
$_SESSION["last_name"] = $last_name;
|
||||
$_SESSION["nickname"] = $nickname;
|
||||
$_SESSION["email"] = $email;
|
||||
$_SESSION["minecraft_nickname"] = $minecraft_nickname;
|
||||
$_SESSION["privilege_level"] = $privilege_level;
|
||||
$_SESSION["lastLoginAt"] = $lastLoginAt;
|
||||
$_SESSION["loginCount"] = $loginCount;
|
||||
$_SESSION["class_id"] = $class_id;
|
||||
$_SESSION["favorite_color"] = $favorite_color;
|
||||
|
||||
}
|
||||
@ -207,17 +202,17 @@ function changePassword($oldPassword, $newPassword): array
|
||||
|
||||
|
||||
// Function to update user profile
|
||||
function updateUserProfile($firstName, $lastName, $nickname, $minecraft_nickname): array
|
||||
function updateUserProfile($firstName, $lastName, $nickname): array
|
||||
{
|
||||
global $mysqli;
|
||||
$status = ["Status" => "Fail"];
|
||||
|
||||
if (isLoggedIn() && !empty($firstName) && !empty($lastName) && !empty($nickname) && !empty($minecraft_nickname)) {
|
||||
if (isLoggedIn() && !empty($firstName) && !empty($lastName) && !empty($nickname) ) {
|
||||
$userID = $_SESSION["ID"];
|
||||
|
||||
$stmt = $mysqli->prepare("UPDATE Users SET FirstName = ?, LastName = ?, Nickname = ?, MinecraftNick = ? WHERE ID = ?");
|
||||
$stmt = $mysqli->prepare("UPDATE Users SET FirstName = ?, LastName = ?, Nickname = ? WHERE ID = ?");
|
||||
/** @noinspection SpellCheckingInspection */
|
||||
$stmt->bind_param("ssssi", $firstName, $lastName, $nickname, $minecraft_nickname, $userID);
|
||||
$stmt->bind_param("ssssi", $firstName, $lastName, $nickname, $userID);
|
||||
$stmt->execute();
|
||||
|
||||
if ($stmt->affected_rows > 0) {
|
||||
@ -281,7 +276,7 @@ function getUserInfo(): array
|
||||
if(isLoggedIn()) {
|
||||
global $mysqli;
|
||||
$userID = $_SESSION["ID"];
|
||||
$stmt = $mysqli->prepare("SELECT FirstName, LastName, Nickname, Email, MinecraftNick FROM Users WHERE ID = ?");
|
||||
$stmt = $mysqli->prepare("SELECT FirstName, LastName, Nickname, Email FROM Users WHERE ID = ?");
|
||||
$stmt->bind_param("i", $userID);
|
||||
$stmt->execute();
|
||||
|
||||
@ -289,9 +284,8 @@ function getUserInfo(): array
|
||||
$lastName = "";
|
||||
$nickname = "";
|
||||
$email = "";
|
||||
$minecraft_nickname = "";
|
||||
|
||||
$stmt->bind_result($firstName, $lastName, $nickname, $email, $minecraft_nickname);
|
||||
$stmt->bind_result($firstName, $lastName, $nickname, $email);
|
||||
$stmt->fetch();
|
||||
$stmt->close();
|
||||
UpdateSession();
|
||||
@ -302,8 +296,7 @@ function getUserInfo(): array
|
||||
"FirstName" => $firstName,
|
||||
"LastName" => $lastName,
|
||||
"Nickname" => $nickname,
|
||||
"Email" => $email,
|
||||
"MinecraftNick" => $minecraft_nickname
|
||||
"Email" => $email
|
||||
];
|
||||
|
||||
}
|
||||
@ -350,7 +343,7 @@ function listUsers(): array
|
||||
|
||||
if (isUserAdmin()) {
|
||||
$users = [];
|
||||
$result = $mysqli->query("SELECT ID, FirstName, LastName, Nickname, Email, MinecraftNick, PrivilegeLevel, CreatedAt, RegisteredAt, LastLoginAt, LoginCount, CreatedBy FROM Users WHERE isActivated = 1");
|
||||
$result = $mysqli->query("SELECT ID, FirstName, LastName, Nickname, Email, PrivilegeLevel, CreatedAt, RegisteredAt, LastLoginAt, LoginCount, CreatedBy FROM Users WHERE isActivated = 1");
|
||||
|
||||
// Check if the query executed Successfully
|
||||
if ($result) {
|
||||
|
@ -4,7 +4,7 @@
|
||||
|
||||
return [
|
||||
'inlining' => false,
|
||||
'domain' => 'adlerka',
|
||||
'domain' => 'stylehub.adlerka',
|
||||
'tld' => 'top',
|
||||
'default_page' => 'index',
|
||||
'default_site' => 'home',
|
||||
@ -12,7 +12,7 @@
|
||||
'endpoint_dir' => 'endpoints/',
|
||||
'page_dir' => 'pages/',
|
||||
'protocol' => 'https://',
|
||||
'site_prefix' => 'Adlerka',
|
||||
'site_prefix' => 'StyleHub',
|
||||
'permissions' => [
|
||||
'logged_out' => 1,
|
||||
'logged_in_default' => 2,
|
||||
@ -31,9 +31,9 @@
|
||||
'default_permissions' => 255,
|
||||
],
|
||||
'seo' => [
|
||||
'author' => 'Tím AdlerkaTop',
|
||||
'description' => 'Toto je neoficiánla študentská stránka pre Adlerku, kde môžete nájsť plno zaujímavostí.',
|
||||
'keywords' => 'adlerka, alderka, studenti, studentska stranka, web, dev, webdev, web dev, skola, zabava',
|
||||
'author' => 'Guvernér',
|
||||
'description' => 'Toto je stránka Malackého guvernéra.',
|
||||
'keywords' => 'moda, oblecenie, mesto, guverner',
|
||||
'generator' => 'TurboRoute',
|
||||
'robots' => 'follow, index, max-snippet:-1, max-video-preview:-1, max-image-preview:large'
|
||||
]
|
||||
|
@ -1,64 +0,0 @@
|
||||
<?php
|
||||
function getNewsArticles() :array
|
||||
{
|
||||
global $mysqli;
|
||||
|
||||
$output = ["Status" => "Fail"]; // Default Status is "Fail"
|
||||
|
||||
$articles = [];
|
||||
$stmt = $mysqli->prepare("SELECT NewsArticles.ID, NewsArticles.WrittenAt, NewsArticles.WrittenBy, NewsArticles.Title, NewsArticles.Body, NewsArticles.FileList, Users.Nickname FROM NewsArticles INNER JOIN Users ON NewsArticles.WrittenBy = Users.ID WHERE NewsArticles.PrivilegeLevel <= ?;");
|
||||
$id = 0;
|
||||
$writtenAt = "";
|
||||
$writtenBy = 0;
|
||||
$title = "";
|
||||
$body = "";
|
||||
$filelist = 0;
|
||||
$writtenByName = "";
|
||||
|
||||
$stmt->bind_param("i", $_SESSION["privilege_level"]);
|
||||
$stmt->bind_result($id, $writtenAt, $writtenBy, $title, $body, $filelist, $writtenByName);
|
||||
|
||||
$stmt->execute();
|
||||
|
||||
while ($stmt->fetch()) {
|
||||
$articles[] = [
|
||||
'ID' => $id,
|
||||
'WrittenAt' => $writtenAt,
|
||||
'Title' => $title,
|
||||
'Body' => $body,
|
||||
'WrittenByName' =>$writtenByName
|
||||
];
|
||||
}
|
||||
|
||||
// Check if any results were fetched
|
||||
if (!empty($articles)) {
|
||||
$output["Status"] = "Success";
|
||||
$output["Articles"] = $articles;
|
||||
}
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
function addNewsArticle($title="Nazov", $body="Obsah", $privilegeLevel=0) :array
|
||||
{
|
||||
global $mysqli;
|
||||
global $routerConfig;
|
||||
|
||||
|
||||
if ($privilegeLevel == 0){
|
||||
$privilegeLevel = $routerConfig['newsarticle']['default_permissions'];
|
||||
}
|
||||
|
||||
$output = ["Status" => "Fail"]; // Default Status is "Fail"
|
||||
if (isLoggedIn() && $privilegeLevel <= $_SESSION["privilege_level"]) {
|
||||
$query = $mysqli->prepare("INSERT INTO NewsArticles (WrittenBy, Title, Body, FileList, PrivilegeLevel) VALUES (?, ?, ?, 0, ?);");
|
||||
$minpriv = intval($privilegeLevel);
|
||||
$query->bind_param("issi", $_SESSION["ID"], htmlspecialchars($title), htmlspecialchars($body), $minpriv);
|
||||
$query->execute();
|
||||
if ($query->affected_rows > 0) {
|
||||
$output["Status"] = "Success";
|
||||
}
|
||||
$query->close();
|
||||
}
|
||||
return $output;
|
||||
}
|
@ -168,7 +168,6 @@ function getPage($site_name_in = null, $page_name_in = null): string
|
||||
"UserInfo_LastName" => $_SESSION["last_name"],
|
||||
"UserInfo_Nickname" => $_SESSION["nickname"],
|
||||
"UserInfo_Email" => $_SESSION["email"],
|
||||
"UserInfo_MinecraftNick" => $_SESSION["minecraft_nickname"],
|
||||
];
|
||||
}
|
||||
$dynamic_script = generateScriptData($dynamic_script_data);
|
||||
|
189
lib/upload.php
@ -1,189 +0,0 @@
|
||||
<?php
|
||||
|
||||
function makePathSafe($userInput): string
|
||||
{
|
||||
// Keep only alphanumeric characters, underscores, and hyphens
|
||||
$safeString = preg_replace('/[^\w\-]/', '', $userInput);
|
||||
|
||||
// Ensure no path traversal
|
||||
$safeString = str_replace('..', '_', $safeString);
|
||||
|
||||
// Trim leading/trailing underscores
|
||||
$safeString = trim($safeString, '_');
|
||||
|
||||
// Replace directory separator characters with underscores
|
||||
$safeString = str_replace(['/', '\\'], '_', $safeString);
|
||||
|
||||
// Limit length for safety
|
||||
return substr($safeString, 0, 255);
|
||||
}
|
||||
|
||||
function getIncomingFiles(): array
|
||||
{
|
||||
$files = $_FILES;
|
||||
$files2 = [];
|
||||
foreach ($files as $infoArr) {
|
||||
$filesByInput = [];
|
||||
foreach ($infoArr as $key => $valueArr) {
|
||||
if (is_array($valueArr)) { // file input "multiple"
|
||||
foreach ($valueArr as $i => $value) {
|
||||
$filesByInput[$i][$key] = $value;
|
||||
}
|
||||
} else { // -> string, normal file input
|
||||
$filesByInput[] = $infoArr;
|
||||
break;
|
||||
}
|
||||
}
|
||||
$files2 = array_merge($files2, $filesByInput);
|
||||
}
|
||||
$files3 = [];
|
||||
foreach ($files2 as $file) { // let's filter empty & errors
|
||||
if (!$file['error']) $files3[] = $file;
|
||||
}
|
||||
return $files3;
|
||||
}
|
||||
|
||||
function saveUploadedFileInDatabase($filePath, $fileType):bool
|
||||
{
|
||||
global $mysqli;
|
||||
$stmt = $mysqli->prepare("INSERT INTO Files (Path, Type, UploadedBy, UploadedAt) VALUES (?, ?, ?, NOW())");
|
||||
$stmt->bind_param("ssi", $filePath, $fileType, $_SESSION["ID"]);
|
||||
$stmt->execute();
|
||||
$stat = $stmt->affected_rows > 0;
|
||||
$stmt->close();
|
||||
return $stat;
|
||||
}
|
||||
|
||||
function doImageUpload($inFile, $outFile): bool
|
||||
{
|
||||
// Create Imagick object
|
||||
try {
|
||||
$imagick = new Imagick($inFile);
|
||||
} catch (ImagickException $e) {
|
||||
}
|
||||
|
||||
// Set the desired format for reencoding (WebP)
|
||||
try {
|
||||
$imagick->setImageFormat('webp');
|
||||
} catch (ImagickException $e) {
|
||||
}
|
||||
|
||||
// Remove non-essential metadata
|
||||
try {
|
||||
$imagick->stripImage();
|
||||
} catch (ImagickException $e) {
|
||||
}
|
||||
|
||||
// Write the reencoded image to the output file
|
||||
try {
|
||||
$imagick->writeImage($outFile);
|
||||
} catch (ImagickException $e) {
|
||||
}
|
||||
|
||||
// Destroy the Imagick object to free up resources
|
||||
$imagick->destroy();
|
||||
|
||||
// Check if the reencoding was successful
|
||||
if (file_exists($outFile)) {
|
||||
return saveUploadedFileInDatabase($outFile, 'image/webp');
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function listFiles($onlyMine = true):array
|
||||
{
|
||||
$output = ["Status" => "Fail"];
|
||||
require_once "lib/account.php";
|
||||
if(($onlyMine && isLoggedIn()) || (!$onlyMine && isModerator())) {
|
||||
global $mysqli;
|
||||
$query = "SELECT ID, Path, Type, UploadedAt, UploadedBy FROM Files";
|
||||
|
||||
if($onlyMine){
|
||||
$query .= " WHERE UploadedBy = ?";
|
||||
}
|
||||
|
||||
$stmt = $mysqli->prepare($query);
|
||||
if($onlyMine) {
|
||||
$stmt->bind_param("i", $_SESSION["ID"]);
|
||||
}
|
||||
|
||||
$id = 0;
|
||||
$path = "";
|
||||
$type = "";
|
||||
$uploadedAt = "";
|
||||
$uploadedBy = 0;
|
||||
|
||||
$stmt->bind_result($id, $path, $type, $uploadedAt, $uploadedBy);
|
||||
|
||||
$stmt->execute();
|
||||
|
||||
// Fetch the results into the bound variables
|
||||
while ($stmt->fetch()) {
|
||||
$files[] = [
|
||||
'ID' => $id,
|
||||
'Path' => $path,
|
||||
'Type' => $type,
|
||||
'UploadedAt' => $uploadedAt,
|
||||
'UploadedBy' => $uploadedBy,
|
||||
];
|
||||
}
|
||||
|
||||
// Check if any results were fetched
|
||||
if (!empty($files)) {
|
||||
$output["Status"] = "Success";
|
||||
$output["Files"] = $files;
|
||||
}
|
||||
|
||||
$stmt->close();
|
||||
}
|
||||
|
||||
return $output;
|
||||
|
||||
}
|
||||
|
||||
function parseIncomingFiles(): array
|
||||
{
|
||||
$incomingFiles = getIncomingFiles();
|
||||
$success = true;
|
||||
|
||||
foreach ($incomingFiles as $incomingFile) {
|
||||
if ($incomingFile["error"] == 0 && is_file($incomingFile["tmp_name"])) {
|
||||
$type = explode("/", $incomingFile["type"]);
|
||||
if ($type == "image") {
|
||||
$imgFname = pathinfo($incomingFile["name"], PATHINFO_FILENAME);
|
||||
$uploadPath = getUploadPath("image", $imgFname);
|
||||
if (!empty($uploadPath)) {
|
||||
if (!doImageUpload($incomingFile["tmp_name"], $uploadPath)) {
|
||||
$success = false;
|
||||
}
|
||||
} else {
|
||||
$success = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
$output = ["Status" => "Fail"];
|
||||
if($success){
|
||||
$output["Status"] = "Success";
|
||||
}
|
||||
return $output;
|
||||
}
|
||||
|
||||
function getUploadPath($type = "unknown", $filename = "hehe"): string
|
||||
{
|
||||
$type = makePathSafe($type);
|
||||
$id = makePathSafe($_SESSION["ID"]);
|
||||
$date = makePathSafe(date("Y/m/d"));
|
||||
$filename = makePathSafe($filename);
|
||||
$extension = match ($type) {
|
||||
'image' => 'webp',
|
||||
default => 'dummy',
|
||||
};
|
||||
if($extension != "dummy") {
|
||||
return "uploads/$type/$id/$date/$filename.$extension";
|
||||
}
|
||||
else {
|
||||
return "";
|
||||
}
|
||||
}
|
@ -1,7 +1,7 @@
|
||||
<!--suppress HtmlUnknownTag, HtmlUnknownTag -->
|
||||
<page minimal_permission_level="1" secret="no" page_title="Domov"></page>
|
||||
<header>
|
||||
<h1 class="title">Vitaj, na tejto úžasnej stránke</h1>
|
||||
<p>Neoficiálna študentská stránka pre Adlerku</p>
|
||||
<h1 class="title">StyleHub</h1>
|
||||
<p>Vitajte na StyleHube</p>
|
||||
<hr>
|
||||
</header>
|
@ -1,7 +0,0 @@
|
||||
<!--suppress HtmlUnknownTag, HtmlUnknownTag -->
|
||||
<page minimal_permission_level="1" secret="no" page_title="Memes"></page>
|
||||
<header>
|
||||
<h1 class="title">Adlerka Memes</h1>
|
||||
<p>Skoro ako <a href="https://reddit.com/r/adlerka" target="_blank">r/adlerka</a> - ale lepšie.</p>
|
||||
<hr>
|
||||
</header>
|
@ -1,45 +0,0 @@
|
||||
<?php
|
||||
|
||||
require_once "lib/router.php";
|
||||
require_once "lib/newsarticle.php";
|
||||
|
||||
global $routerConfig;
|
||||
|
||||
$output = file_get_contents($routerConfig["template_dir"] . "newsArticles.html");
|
||||
|
||||
$articles_out = "";
|
||||
$articles = [];
|
||||
$articles_tmp = getNewsArticles();
|
||||
if($articles_tmp['Status'] == "Success"){
|
||||
$articles = $articles_tmp["Articles"];
|
||||
}
|
||||
|
||||
$articleTemplate = file_get_contents($routerConfig["template_dir"] . "newsArticle.html");
|
||||
$output = str_replace("__TEMPLATE_FOR_ARTICLE_CONTENT__", $articleTemplate, $output);
|
||||
foreach ($articles as $article){
|
||||
$articleTitle = htmlspecialchars($article["Title"]);
|
||||
$articleBody = htmlspecialchars($article["Body"]);
|
||||
$articleFileList = $article["FileList"];
|
||||
$articleWrittenBy = $article["WrittenBy"];
|
||||
$articleWrittenAt = htmlspecialchars($article["WrittenAt"]);
|
||||
$articleWrittenByName = htmlspecialchars($article["WrittenByName"]);
|
||||
|
||||
$articleTemplate = str_replace("__TEMPLATE_ARTICLE_TITLE__", $articleTitle, $articleTemplate);
|
||||
$articleTemplate = str_replace("__TEMPLATE_ARTICLE_AUTHOR__", $articleWrittenByName, $articleTemplate);
|
||||
$articleTemplate = str_replace("__TEMPLATE_ARTICLE_DATE__", $articleWrittenAt, $articleTemplate);
|
||||
$articleTemplate = str_replace("__TEMPLATE_ARTICLE_BODY__", $articleBody, $articleTemplate);
|
||||
|
||||
$articles_out .= $articleTemplate;
|
||||
}
|
||||
|
||||
$output = str_replace("__TEMPLATE__ARTICLES_HERE__", $articles_out, $output);
|
||||
|
||||
return [
|
||||
"output" => $output,
|
||||
"parameters" =>
|
||||
[
|
||||
"minimal_permission_level" => 1,
|
||||
"secret" => "no",
|
||||
"page_title" => "Novinky"
|
||||
]
|
||||
];
|
@ -1,6 +0,0 @@
|
||||
<!--suppress HtmlUnknownTag, HtmlUnknownTag -->
|
||||
<page minimal_permission_level="2" secret="no" page_title="Zošit"></page>
|
||||
<header>
|
||||
<h1 class="title">Adlerka Zošit</h1>
|
||||
<hr>
|
||||
</header>
|
@ -1,4 +0,0 @@
|
||||
<page minimal_permission_level="2" secret="no" page_title="INFO"></page>
|
||||
|
||||
<h1>Toto sú rozvrhy niektorých Adlerákov</h1>
|
||||
<h2>Zatiaľ hardcoded, potom dorobíme funkcionalitu zbierania dát z Edupage</h2>
|
@ -1,59 +0,0 @@
|
||||
<page minimal_permission_level="2" secret="no" page_title="1.C 2.skupina"></page>
|
||||
|
||||
<h1>Rozvrh 1.C 2.Skupina</h1>
|
||||
<table>
|
||||
<tbody>
|
||||
<tr>
|
||||
<th>0 (7:10 - 7:55)</th>
|
||||
<th>1 (8:00 - 8:45)</th>
|
||||
<th>2 (8:50 - 9:35)</th>
|
||||
<th>3 (9:45 - 10:30)</th>
|
||||
<th>4 (10:50 - 11:35)</th>
|
||||
<th>5 (11:45 - 12:30)</th>
|
||||
<th>6 (12:40 - 13:25)</th>
|
||||
<th>7 (13:30 - 14:15)</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td>MAT</td>
|
||||
<td>ELK</td>
|
||||
<td>SJL</td>
|
||||
<td colspan="2">ZER</td>
|
||||
<td>ANJ</td>
|
||||
<td>MAT</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="3">PRX</td>
|
||||
<td>SJL</td>
|
||||
<td colspan="2">INF</td>
|
||||
<td>ELK</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td>PRO</td>
|
||||
<td>SJL</td>
|
||||
<td>FYZ</td>
|
||||
<td>ANJ</td>
|
||||
<td>MAT</td>
|
||||
<td>ELK</td>
|
||||
<td>TSV</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2"></td>
|
||||
<td colspan="2">PRO</td>
|
||||
<td>ANJ</td>
|
||||
<td>TDK</td>
|
||||
<td>MAT</td>
|
||||
<td>ETV</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td>TDK</td>
|
||||
<td>OBN</td>
|
||||
<td>TSV</td>
|
||||
<td>FYZ</td>
|
||||
<td>PRO</td>
|
||||
<td>DEJ</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
@ -1,59 +0,0 @@
|
||||
<page minimal_permission_level="2" secret="no" page_title="1.C 1.skupina"></page>
|
||||
|
||||
<h1>Rozvrh 1.C 1.Skupina</h1>
|
||||
<table>
|
||||
<tbody>
|
||||
<tr>
|
||||
<th>0 (7:10 - 7:55)</th>
|
||||
<th>1 (8:00 - 8:45)</th>
|
||||
<th>2 (8:50 - 9:35)</th>
|
||||
<th>3 (9:45 - 10:30)</th>
|
||||
<th>4 (10:50 - 11:35)</th>
|
||||
<th>5 (11:45 - 12:30)</th>
|
||||
<th>6 (12:40 - 13:25)</th>
|
||||
<th>7 (13:30 - 14:15)</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td>MAT</td>
|
||||
<td>ELK</td>
|
||||
<td>SJL</td>
|
||||
<td colspan="2">ZER</td>
|
||||
<td>MAT</td>
|
||||
<td>ANJ</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="3">PRX</td>
|
||||
<td>SJL</td>
|
||||
<td colspan="2">INF</td>
|
||||
<td>ELK</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td>PRO</td>
|
||||
<td>SJL</td>
|
||||
<td>TSV</td>
|
||||
<td>FYZ</td>
|
||||
<td>ANJ</td>
|
||||
<td>MAT</td>
|
||||
<td>ELK</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2"></td>
|
||||
<td colspan="2">PRO</td>
|
||||
<td>TDK</td>
|
||||
<td>TSV</td>
|
||||
<td>MAT</td>
|
||||
<td>ETV</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td>ANJ</td>
|
||||
<td>OBN</td>
|
||||
<td>TDK</td>
|
||||
<td>FYZ</td>
|
||||
<td>PRO</td>
|
||||
<td>DEJ</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
@ -1,60 +0,0 @@
|
||||
<page minimal_permission_level="2" secret="no" page_title="1.D 1.skupina"></page>
|
||||
|
||||
<h1>Rozvrh 1.D 1.Skupina</h1>
|
||||
<table>
|
||||
<tbody>
|
||||
<tr>
|
||||
<th>0 (7:10 - 7:55)</th>
|
||||
<th>1 (8:00 - 8:45)</th>
|
||||
<th>2 (8:50 - 9:35)</th>
|
||||
<th>3 (9:45 - 10:30)</th>
|
||||
<th>4 (10:50 - 11:35)</th>
|
||||
<th>5 (11:45 - 12:30)</th>
|
||||
<th>6 (12:40 - 13:25)</th>
|
||||
<th>7 (13:30 - 14:15)</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td>TSV</td>
|
||||
<td colspan="2">PRO</td>
|
||||
<td>MAT</td>
|
||||
<td>TDK</td>
|
||||
<td>PRO</td>
|
||||
<td>SJL</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td>FYZ</td>
|
||||
<td>TDK</td>
|
||||
<td>MAT</td>
|
||||
<td>ELK</td>
|
||||
<td>OBN</td>
|
||||
<td>ANJ</td>
|
||||
<td>ETV</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td>ELK</td>
|
||||
<td>MAT</td>
|
||||
<td>SJL</td>
|
||||
<td>ANJ</td>
|
||||
<td>ELK</td>
|
||||
<td colspan="2">INF</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2"></td>
|
||||
<td colspan="2">ZER</td>
|
||||
<td>MAT</td>
|
||||
<td>FYZ</td>
|
||||
<td>DEJ</td>
|
||||
<td>TSV</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td>SJL</td>
|
||||
<td>ANJ</td>
|
||||
<td>PRO</td>
|
||||
<td colspan="3">PRX</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
@ -1,36 +0,0 @@
|
||||
<!--suppress HtmlUnknownTag, HtmlUnknownTag -->
|
||||
<page minimal_permission_level="1" secret="no" page_title="Domov"></page>
|
||||
<header>
|
||||
<h1 class="title">Vitaj na oficiálnej AdlerkaSMP stránke</h1>
|
||||
<p>Najlepší <a href="https://minecraft.net" style="text-decoration: underline; color: #fff;" target="_blank">Minecraft®™</a> server na Adlerke</p>
|
||||
<hr>
|
||||
<div class="wrapper feature-list">
|
||||
<h2>Čo môžeš očakávať od AdlerkaSMP:</h2>
|
||||
|
||||
<ul class="feature-list-ul">
|
||||
<li>
|
||||
<strong>Vlastné pluginy:</strong>
|
||||
<ul>
|
||||
<li>Plugin 1</li>
|
||||
<li>Plugin 2</li>
|
||||
</ul>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<strong>Kvalitné pluginy:</strong>
|
||||
<ul>
|
||||
<li>Oraxen</li>
|
||||
<li>ModelManager</li>
|
||||
</ul>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<strong>Super admini:</strong>
|
||||
<ul>
|
||||
<li>Robíme celý server.</li>
|
||||
<li>Vďaka nám je AdlerkaSMP<br>bezpečné miesto.</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</header>
|
@ -1,3 +0,0 @@
|
||||
<!--suppress HtmlUnknownTag, HtmlUnknownTag -->
|
||||
<page minimal_permission_level="1" secret="no" page_title="Info"></page>
|
||||
<h1>Vitaj na oficiálnej stránke Informácii o AdlerkaSMP</h1>
|
@ -1 +1 @@
|
||||
<p>Toto nie je oficiálna stránka <span class="ye-span">Adlerky</span>, jedná sa o neoficiálnu študentskú stránku</p>
|
||||
<p>StyleHub je super</p>
|
@ -1,9 +1,5 @@
|
||||
<div class="logo">
|
||||
<picture id="standard-logo">
|
||||
<source media="(min-width:4200px)" srcset="/assets/images/adlerka_256.png">
|
||||
<source media="(min-width:2100px)" srcset="/assets/images/adlerka_128.png">
|
||||
<img src="/assets/images/adlerka_64.png" alt="Adlerka logo" style="width:auto;">
|
||||
</picture>
|
||||
<img src="/assets/images/mikina.webp" alt="Adlerka logo" width="50" height="100" style="width:auto;">
|
||||
</div>
|
||||
<i class="ri-menu-line" id="toggle_button"></i>
|
||||
<ul id="navsite_list">
|
||||
|
@ -1,11 +0,0 @@
|
||||
<article>
|
||||
<h2 class='newstitle'>__TEMPLATE_ARTICLE_TITLE__</h2>
|
||||
<div class="articleinfo">
|
||||
<p class='newsauthor'><i class="ri-user-line"></i>__TEMPLATE_ARTICLE_AUTHOR__</p>
|
||||
<p class='newsdate'><i class="ri-calendar-line"></i>__TEMPLATE_ARTICLE_DATE__</p>
|
||||
</div>
|
||||
<hr>
|
||||
<div class='newsbody'>
|
||||
__TEMPLATE_ARTICLE_BODY__
|
||||
</div>
|
||||
</article>
|
@ -1,22 +0,0 @@
|
||||
<header>
|
||||
<h1 class="title"></h1>
|
||||
<p>Adlerka študentské news</p>
|
||||
<button id="articlecreateopen" onclick="togglearticlecreate()"><i class="ri-add-circle-line"></i></button>
|
||||
</header>
|
||||
|
||||
<template data-template-name="article">
|
||||
__TEMPLATE_FOR_ARTICLE_CONTENT__
|
||||
</template>
|
||||
|
||||
<div id="articleslist">
|
||||
__TEMPLATE__ARTICLES_HERE__
|
||||
</div>
|
||||
|
||||
<div id="articlecreatecontainer" class="hidden">
|
||||
<div id="articlecreate">
|
||||
<input type="text" placeholder="Article Title" id="articletitleinput"><br>
|
||||
<textarea id="articlebodyinput" placeholder="Article Body" rows="20" cols="80"></textarea><br>
|
||||
<input type="number" id="articleprivilegeinput" min="1" value="1" step="1"><br>
|
||||
<button id="articlesubmit" onclick="submitarticle()">Add</button>
|
||||
</div>
|
||||
</div>
|
@ -5,10 +5,9 @@
|
||||
<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/style.css">
|
||||
<link rel="icon" href="/assets/images/favicon.png" type="image/png">
|
||||
<link rel="icon" href="/assets/images/mikina.webp" type="image/png">
|
||||
__TEMPLATE__DYNAMIC__SCRIPT__
|
||||
__TEMPLATE__DYNAMIC__STYLE__
|
||||
<script async src="https://umami.brn.systems/script.js" data-website-id="95e93885-5c19-4cab-ba9b-2f746a316a2a"></script>
|
||||
<script async src="/assets/script.js"></script>
|
||||
<title>__TEMPLATE_PAGE_TITLE__</title>
|
||||
__TEMPLATE_SEO_STUFF__
|
||||
|
@ -16,9 +16,6 @@
|
||||
<label for="updateNickname">Nickname:</label>
|
||||
<input type="text" id="updateNickname" name="updateNickname" required><br>
|
||||
|
||||
<label for="updateMinecraftNick">Minecraft Nick:</label>
|
||||
<input type="text" id="updateMinecraftNick" name="updateMinecraftNick" required><br>
|
||||
|
||||
<button type="button" onclick="updateUserProfile()">Update Profile</button>
|
||||
|
||||
<br><br>
|
||||
|