Adding Json config

This commit is contained in:
Michał 2022-09-08 13:29:45 +00:00
parent 8713a6321a
commit b261368a9b
18 changed files with 285 additions and 519 deletions

View file

@ -2,14 +2,14 @@
<html> <html>
<head> <head>
<?php include __DIR__."/ui/header.php"; ?> <?php include "ui/header.php"; ?>
</head> </head>
<body> <body>
<?php <?php
include __DIR__."/ui/required.php"; include "ui/required.php";
include __DIR__."/ui/nav.php"; include "ui/nav.php";
?> ?>
<div class="about-root"> <div class="about-root">
@ -53,7 +53,7 @@
<p>To mrHDash...</p> <p>To mrHDash...</p>
</div> </div>
<?php include __DIR__."/ui/footer.php"; ?> <?php include "ui/footer.php"; ?>
</body> </body>
</html> </html>

View file

@ -15,15 +15,26 @@
if (isset($_SESSION["loggedin"]) && $_SESSION["loggedin"] === true) { if (isset($_SESSION["loggedin"]) && $_SESSION["loggedin"] === true) {
?> ?>
<div class="account-root"> <div class="account-root">
<h2>Account settings</h2> <h2>Settings</h2>
<h3 class='space-top'>Account</h3>
<p>Resetting your password regularly is a good way of keeping your account safe</p>
<a class='btn btn-bad' href='password-reset.php'><img class='svg' src='assets/icons/password.svg'>Reset Password</a>
<br> <br>
<p>Don't leave! I'm with the science team!</p>
<a class='btn btn-bad' href='app/account/logout.php'><img class='svg' src='assets/icons/sign-out.svg'>Logout</a>
</div>
<?php <?php
if ($_SESSION["id"] == 1) { if ($_SESSION["id"] == 1) {
echo "<h3>Invite Codes</h3>"; ?>
<div class="admin-root">
<h2>Admin controlls</h2>
<br>
<h3>Invite Codes</h3>
<?php
$token_request = mysqli_query($conn, "SELECT * FROM tokens WHERE used = 0"); $token_request = mysqli_query($conn, "SELECT * FROM tokens WHERE used = 0");
while ($token = mysqli_fetch_array($token_request)) { while ($token = mysqli_fetch_array($token_request)) {
?> ?>
<!-- Button that's displayed with the invite code --> <br>
<button onclick='copyCode()' class='btn btn-neutral'><?php echo $token['code']; ?></button> <button onclick='copyCode()' class='btn btn-neutral'><?php echo $token['code']; ?></button>
<script> <script>
function copyCode() { function copyCode() {
@ -33,17 +44,20 @@
</script> </script>
<?php <?php
} }
}
?> ?>
<br> <br>
<h3 class='space-top'>Danger ahead</h3> <h3>Database info</h3>
<p>Resetting your password regularly is a good way of keeping your account safe</p> <?php
<a class='btn btn-bad' href='password-reset.php'><img class='svg' src='assets/icons/password.svg'>Reset Password</a> echo "<p>Address: ".$database['ip'].":".$database['port']."</p>";
<br> echo "<p>Username: ".$database['username']."</p>";
<p>Don't leave! I'm with the science team!</p> echo "<p>Password: Not displayed</p>";
<a class='btn btn-bad' href='app/account/logout.php'><img class='svg' src='assets/icons/sign-out.svg'>Logout</a> echo "<p>Database: ".$database['database']."</p>";
?>
</div> </div>
<?php <?php
}
?>
<?php
} else { } else {
?> ?>
<div class="login-root"> <div class="login-root">

View file

@ -28,14 +28,14 @@ if (isset($_POST['submit'])) {
if (mysqli_stmt_execute($stmt)) { if (mysqli_stmt_execute($stmt)) {
?> ?>
<script> <script>
sniffleAdd('Success!!!', 'The Author has been updated successfully! You may need to refresh the page to see the new information.', 'var(--green)', '<?php echo $root_dir; ?>assets/icons/check.svg'); sniffleAdd('Success!!!', 'The Author has been updated successfully! You may need to refresh the page to see the new information.', 'var(--green)', 'assets/icons/check.svg');
flyoutClose(); flyoutClose();
</script> </script>
<?php <?php
} else { } else {
?> ?>
<script> <script>
sniffleAdd('Oopsie....', 'An error occured on the servers', 'var(--red)', '<?php echo $root_dir; ?>assets/icons/cross.svg'); sniffleAdd('Oopsie....', 'An error occured on the servers', 'var(--red)', 'assets/icons/cross.svg');
flyoutClose(); flyoutClose();
</script> </script>
<?php <?php
@ -44,7 +44,7 @@ if (isset($_POST['submit'])) {
} else { } else {
?> ?>
<script> <script>
sniffleAdd('Denied', 'Sussy wussy.', 'var(--red)', '<?php echo $root_dir; ?>assets/icons/cross.svg'); sniffleAdd('Denied', 'Sussy wussy.', 'var(--red)', 'assets/icons/cross.svg');
flyoutClose(); flyoutClose();
</script> </script>
<?php <?php

View file

@ -40,14 +40,14 @@ if (isset($_POST['submit'])) {
if (mysqli_stmt_execute($stmt)) { if (mysqli_stmt_execute($stmt)) {
?> ?>
<script> <script>
sniffleAdd('Success!!!', 'Description has been updated successfully! You may need to refresh the page to see the new information.', 'var(--green)', '<?php echo $root_dir; ?>assets/icons/check.svg'); sniffleAdd('Success!!!', 'Description has been updated successfully! You may need to refresh the page to see the new information.', 'var(--green)', 'assets/icons/check.svg');
flyoutClose(); flyoutClose();
</script> </script>
<?php <?php
} else { } else {
?> ?>
<script> <script>
sniffleAdd('Error :c', 'An error occured on the servers', 'var(--red)', '<?php echo $root_dir; ?>assets/icons/cross.svg'); sniffleAdd('Error :c', 'An error occured on the servers', 'var(--red)', 'assets/icons/cross.svg');
flyoutClose(); flyoutClose();
</script> </script>
<?php <?php
@ -55,7 +55,7 @@ if (isset($_POST['submit'])) {
} else { } else {
?> ?>
<script> <script>
sniffleAdd('Error :c', 'An error occured on the servers', 'var(--red)', '<?php echo $root_dir; ?>assets/icons/cross.svg'); sniffleAdd('Error :c', 'An error occured on the servers', 'var(--red)', 'assets/icons/cross.svg');
flyoutClose(); flyoutClose();
</script> </script>
<?php <?php
@ -63,7 +63,7 @@ if (isset($_POST['submit'])) {
} else { } else {
?> ?>
<script> <script>
sniffleAdd('Denied', 'It seems that you do not have the right permitions to edit this image.', 'var(--red)', '<?php echo $root_dir; ?>assets/icons/cross.svg'); sniffleAdd('Denied', 'It seems that you do not have the right permitions to edit this image.', 'var(--red)', 'assets/icons/cross.svg');
flyoutClose(); flyoutClose();
</script> </script>
<?php <?php

View file

@ -45,14 +45,14 @@ if (isset($_POST['submit'])) {
if (mysqli_stmt_execute($stmt)) { if (mysqli_stmt_execute($stmt)) {
?> ?>
<script> <script>
sniffleAdd('Success!!!', 'Tags have been modified successfully! You may need to refresh the page to see the new information.', 'var(--green)', '<?php echo $root_dir; ?>assets/icons/check.svg'); sniffleAdd('Success!!!', 'Tags have been modified successfully! You may need to refresh the page to see the new information.', 'var(--green)', 'assets/icons/check.svg');
flyoutClose(); flyoutClose();
</script> </script>
<?php <?php
} else { } else {
?> ?>
<script> <script>
sniffleAdd('Error :c', 'An error occured on the servers', 'var(--red)', '<?php echo $root_dir; ?>assets/icons/cross.svg'); sniffleAdd('Error :c', 'An error occured on the servers', 'var(--red)', 'assets/icons/cross.svg');
flyoutClose(); flyoutClose();
</script> </script>
<?php <?php
@ -60,7 +60,7 @@ if (isset($_POST['submit'])) {
} else { } else {
?> ?>
<script> <script>
sniffleAdd('Error :c', 'An error occured on the servers', 'var(--red)', '<?php echo $root_dir; ?>assets/icons/cross.svg'); sniffleAdd('Error :c', 'An error occured on the servers', 'var(--red)', 'assets/icons/cross.svg');
flyoutClose(); flyoutClose();
</script> </script>
<?php <?php
@ -68,7 +68,7 @@ if (isset($_POST['submit'])) {
} else { } else {
?> ?>
<script> <script>
sniffleAdd('Denied', 'It seems that you do not have the right permitions to modify tags here.', 'var(--red)', '<?php echo $root_dir; ?>assets/icons/cross.svg'); sniffleAdd('Denied', 'It seems that you do not have the right permitions to modify tags here.', 'var(--red)', 'assets/icons/cross.svg');
flyoutClose(); flyoutClose();
</script> </script>
<?php <?php

View file

@ -5,13 +5,33 @@
In the future I want this section to be configurable, but that'll require some work to be done. In the future I want this section to be configurable, but that'll require some work to be done.
For now it's hard-coded, shouldn't be an issue as most people wont be changing this often anyway For now it's hard-coded, shouldn't be an issue as most people wont be changing this often anyway
*/ */
// Setting up connection variables
$conn_ip = "192.168.0.79:3306"; $conn_ip = "192.168.0.79:3306";
$conn_username = "uwu"; $conn_username = "uwu";
$conn_password = "fennec621"; $conn_password = "fennec621";
$conn_database = "gallery"; $conn_database = "gallery";
/*
$conn_ip = $database['ip'].":".$database['port'];
$conn_username = $database['username'];
$conn_password = $database['password'];
$conn_database = $database['database'];
echo $_SERVER['DOCUMENT_ROOT'].dirname($_SERVER['SCRIPT_NAME']);
echo $_SERVER['PHP_SELF'];
*/
$conn = mysqli_connect($conn_ip, $conn_username, $conn_password , $conn_database); $conn = mysqli_connect($conn_ip, $conn_username, $conn_password , $conn_database);
if ($conn->connect_error) { if ($conn->connect_error) {
echo "<script>sniffleAdd('Error','Could not make a connection to the server, please try again later','var(--red)','".$root_dir."../../assets/icons/warning.svg')</script>"; ?>
<script>
sniffleAdd('Error','Could not make a connection to the server, please try again later','var(--red)','assets/icons/warning.svg');
</script>
<?php
} }
/*
Start session
This is important as most pages use the PHP session and will complain if its not possible to access.
*/
session_start();

29
app/settings/settings.php Normal file
View file

@ -0,0 +1,29 @@
<?php
/*
|-------------------------------------------------------------
| Settings (decode)
|-------------------------------------------------------------
| This is for decoding the settings Json, used throughout
| most of the website. Used for settings things such as
| the default background and accent colour
|-------------------------------------------------------------
*/
$user_import = file_get_contents("app/settings/user_settings.json");
$user_settings = json_decode($user_import, true);
foreach ($user_settings->data as $settings_list) {
foreach ($settings_list->website as $website) {
foreach ($website->database as $database) {
}
foreach ($website->debug as $debug) {
}
foreach ($website->plugins as $plugins) {
}
}
}
$database = $user_settings["website"]["database"];
$debug = $user_settings["website"]["debug"];
$plugins = $user_settings["website"]["plugins"];

View file

@ -0,0 +1,50 @@
{
"website": {
"name": "Only Legs",
"description": "A simple gallery with multiple users in mind",
"welcome_msg": [
"*internal screaming*",
"Don't forget to drink water!",
"Bruh",
"Fluffy made this!",
"maybe",
"I'm gay",
"I wish we were better strangers.",
"<span style='color:#ffff00;'>Just like Minecraft!</span>",
"If I were you, I'd run now",
"This is the part where I kill you",
"SILICA GEL \"DO NOT EAT\".",
"This was supposed to be a simple project",
"AAAAAAAAAAAAAAAAAAAA",
"Let me out",
"nice",
"I'm glad you're here",
"The weather is dry",
"Need me a man 👀",
"Gods die too.",
"Eat hotchip and lie"
],
"license":"GPL 3.0",
"database": {
"ip": "192.168.0.79",
"port": "3306",
"username": "uwu",
"password": "fennec621",
"database": "gallery"
},
"debug": {
"testing": true,
"version": "22.09.08"
}
},
"plugins": {
"sniffle": {
"location": "Sniffle/sniffle.js",
"using": true
},
"flyout": {
"location": "Flyout/flyout.js",
"using": true
}
}
}

View file

@ -172,6 +172,31 @@ nav .btn {
margin-bottom: 1rem; margin-bottom: 1rem;
} }
.gallery-order {
margin-bottom: 1rem;
display: flex;
flex-direction: row;
}
.gallery-order h1,
.gallery-order h2,
.gallery-order h3,
.gallery-order h4,
.gallery-order h5 {
font-family: "Lexend Deca", sans-serif;
}
.gallery-order p,
.gallery-order a,
.gallery-order button,
.gallery-order input {
font-family: "Secular One", sans-serif;
}
.gallery-order > * {
margin-right: 0.5rem;
}
.gallery-order > *:last-child {
margin-right: 0;
}
.gallery-root { .gallery-root {
margin-bottom: 1rem; margin-bottom: 1rem;
padding: 0.25rem; padding: 0.25rem;
@ -528,11 +553,34 @@ nav .btn {
font-family: "Secular One", sans-serif; font-family: "Secular One", sans-serif;
} }
/* .admin-root {
|------------------------------------------------------------- margin-bottom: 1rem;
| SIGNUP padding: 0.5rem 0.5rem 0 0.5rem;
|------------------------------------------------------------- width: calc(100% - 1.4rem);
*/ background-color: #151515;
color: #E8E3E3;
border-radius: 0rem;
border: 0.2rem solid #8C977D;
box-shadow: 6px 6px 2px rgba(21, 21, 21, 0.5333333333);
}
.admin-root > * {
margin-top: 0;
margin-bottom: 0.5rem;
}
.admin-root h1,
.admin-root h2,
.admin-root h3,
.admin-root h4,
.admin-root h5 {
font-family: "Lexend Deca", sans-serif;
}
.admin-root p,
.admin-root a,
.admin-root button,
.admin-root input {
font-family: "Secular One", sans-serif;
}
.signup-root { .signup-root {
margin-bottom: 1rem; margin-bottom: 1rem;
padding: 0.5rem 0.5rem 0 0.5rem; padding: 0.5rem 0.5rem 0 0.5rem;
@ -562,11 +610,6 @@ nav .btn {
font-family: "Secular One", sans-serif; font-family: "Secular One", sans-serif;
} }
/*
|-------------------------------------------------------------
| LOGIN
|-------------------------------------------------------------
*/
.login-root { .login-root {
margin-bottom: 1rem; margin-bottom: 1rem;
padding: 0.5rem 0.5rem 0 0.5rem; padding: 0.5rem 0.5rem 0 0.5rem;

349
css/normalize.css vendored
View file

@ -1,349 +0,0 @@
/*! normalize.css v8.0.1 | MIT License | github.com/necolas/normalize.css */
/* Document
========================================================================== */
/**
* 1. Correct the line height in all browsers.
* 2. Prevent adjustments of font size after orientation changes in iOS.
*/
html {
line-height: 1.15; /* 1 */
-webkit-text-size-adjust: 100%; /* 2 */
}
/* Sections
========================================================================== */
/**
* Remove the margin in all browsers.
*/
body {
margin: 0;
}
/**
* Render the `main` element consistently in IE.
*/
main {
display: block;
}
/**
* Correct the font size and margin on `h1` elements within `section` and
* `article` contexts in Chrome, Firefox, and Safari.
*/
h1 {
font-size: 2em;
margin: 0.67em 0;
}
/* Grouping content
========================================================================== */
/**
* 1. Add the correct box sizing in Firefox.
* 2. Show the overflow in Edge and IE.
*/
hr {
box-sizing: content-box; /* 1 */
height: 0; /* 1 */
overflow: visible; /* 2 */
}
/**
* 1. Correct the inheritance and scaling of font size in all browsers.
* 2. Correct the odd `em` font sizing in all browsers.
*/
pre {
font-family: monospace, monospace; /* 1 */
font-size: 1em; /* 2 */
}
/* Text-level semantics
========================================================================== */
/**
* Remove the gray background on active links in IE 10.
*/
a {
background-color: transparent;
}
/**
* 1. Remove the bottom border in Chrome 57-
* 2. Add the correct text decoration in Chrome, Edge, IE, Opera, and Safari.
*/
abbr[title] {
border-bottom: none; /* 1 */
text-decoration: underline; /* 2 */
text-decoration: underline dotted; /* 2 */
}
/**
* Add the correct font weight in Chrome, Edge, and Safari.
*/
b,
strong {
font-weight: bolder;
}
/**
* 1. Correct the inheritance and scaling of font size in all browsers.
* 2. Correct the odd `em` font sizing in all browsers.
*/
code,
kbd,
samp {
font-family: monospace, monospace; /* 1 */
font-size: 1em; /* 2 */
}
/**
* Add the correct font size in all browsers.
*/
small {
font-size: 80%;
}
/**
* Prevent `sub` and `sup` elements from affecting the line height in
* all browsers.
*/
sub,
sup {
font-size: 75%;
line-height: 0;
position: relative;
vertical-align: baseline;
}
sub {
bottom: -0.25em;
}
sup {
top: -0.5em;
}
/* Embedded content
========================================================================== */
/**
* Remove the border on images inside links in IE 10.
*/
img {
border-style: none;
}
/* Forms
========================================================================== */
/**
* 1. Change the font styles in all browsers.
* 2. Remove the margin in Firefox and Safari.
*/
button,
input,
optgroup,
select,
textarea {
font-family: inherit; /* 1 */
font-size: 100%; /* 1 */
line-height: 1.15; /* 1 */
margin: 0; /* 2 */
}
/**
* Show the overflow in IE.
* 1. Show the overflow in Edge.
*/
button,
input { /* 1 */
overflow: visible;
}
/**
* Remove the inheritance of text transform in Edge, Firefox, and IE.
* 1. Remove the inheritance of text transform in Firefox.
*/
button,
select { /* 1 */
text-transform: none;
}
/**
* Correct the inability to style clickable types in iOS and Safari.
*/
button,
[type="button"],
[type="reset"],
[type="submit"] {
-webkit-appearance: button;
}
/**
* Remove the inner border and padding in Firefox.
*/
button::-moz-focus-inner,
[type="button"]::-moz-focus-inner,
[type="reset"]::-moz-focus-inner,
[type="submit"]::-moz-focus-inner {
border-style: none;
padding: 0;
}
/**
* Restore the focus styles unset by the previous rule.
*/
button:-moz-focusring,
[type="button"]:-moz-focusring,
[type="reset"]:-moz-focusring,
[type="submit"]:-moz-focusring {
outline: 1px dotted ButtonText;
}
/**
* Correct the padding in Firefox.
*/
fieldset {
padding: 0.35em 0.75em 0.625em;
}
/**
* 1. Correct the text wrapping in Edge and IE.
* 2. Correct the color inheritance from `fieldset` elements in IE.
* 3. Remove the padding so developers are not caught out when they zero out
* `fieldset` elements in all browsers.
*/
legend {
box-sizing: border-box; /* 1 */
color: inherit; /* 2 */
display: table; /* 1 */
max-width: 100%; /* 1 */
padding: 0; /* 3 */
white-space: normal; /* 1 */
}
/**
* Add the correct vertical alignment in Chrome, Firefox, and Opera.
*/
progress {
vertical-align: baseline;
}
/**
* Remove the default vertical scrollbar in IE 10+.
*/
textarea {
overflow: auto;
}
/**
* 1. Add the correct box sizing in IE 10.
* 2. Remove the padding in IE 10.
*/
[type="checkbox"],
[type="radio"] {
box-sizing: border-box; /* 1 */
padding: 0; /* 2 */
}
/**
* Correct the cursor style of increment and decrement buttons in Chrome.
*/
[type="number"]::-webkit-inner-spin-button,
[type="number"]::-webkit-outer-spin-button {
height: auto;
}
/**
* 1. Correct the odd appearance in Chrome and Safari.
* 2. Correct the outline style in Safari.
*/
[type="search"] {
-webkit-appearance: textfield; /* 1 */
outline-offset: -2px; /* 2 */
}
/**
* Remove the inner padding in Chrome and Safari on macOS.
*/
[type="search"]::-webkit-search-decoration {
-webkit-appearance: none;
}
/**
* 1. Correct the inability to style clickable types in iOS and Safari.
* 2. Change font properties to `inherit` in Safari.
*/
::-webkit-file-upload-button {
-webkit-appearance: button; /* 1 */
font: inherit; /* 2 */
}
/* Interactive
========================================================================== */
/*
* Add the correct display in Edge, IE 10+, and Firefox.
*/
details {
display: block;
}
/*
* Add the correct display in all browsers.
*/
summary {
display: list-item;
}
/* Misc
========================================================================== */
/**
* Add the correct display in IE 10+.
*/
template {
display: none;
}
/**
* Add the correct display in IE 10.
*/
[hidden] {
display: none;
}

View file

@ -26,6 +26,22 @@
} }
} }
.gallery-order {
@include defaultFont();
margin-bottom: 1rem;
display: flex;
flex-direction: row;
& > * {
margin-right: 0.5rem;
}
& > *:last-child {
margin-right: 0;
}
}
.gallery-root { .gallery-root {
margin-bottom: 1rem; margin-bottom: 1rem;
padding: 0.25rem; padding: 0.25rem;
@ -263,24 +279,16 @@
@include defaultDecoration($green); @include defaultDecoration($green);
@include defaultFont(); @include defaultFont();
} }
.admin-root {
/* @include defaultDecoration($green);
|------------------------------------------------------------- @include defaultFont();
| SIGNUP }
|-------------------------------------------------------------
*/
.signup-root { .signup-root {
@include defaultDecoration($green); @include defaultDecoration($green);
@include defaultFont(); @include defaultFont();
// By default its hidden, in place is login // By default its hidden, in place is login
display: none; display: none;
} }
/*
|-------------------------------------------------------------
| LOGIN
|-------------------------------------------------------------
*/
.login-root { .login-root {
@include defaultDecoration($green); @include defaultDecoration($green);
@include defaultFont(); @include defaultFont();

View file

@ -1,36 +0,0 @@
{
"name": "Only Legs",
"description": "A simple gallery with multiple users in mind",
"welcome_msg": [
"*internal screaming*",
"Don't forget to drink water!",
"Bruh",
"Fluffy made this!",
"maybe",
"I'm gay",
"I wish we were better strangers.",
"<span style='color:#ffff00;'>Just like Minecraft!</span>",
"If I were you, I'd run now",
"This is the part where I kill you",
"SILICA GEL \"DO NOT EAT\".",
"This was supposed to be a simple project",
"AAAAAAAAAAAAAAAAAAAA",
"Let me out",
"nice",
"I'm glad you're here",
"The weather is dry",
"Need me a man 👀",
"Gods die too.",
"Eat hotchip and lie"
],
"database": {
"ip": "192.168.0.79",
"port": "3306",
"username": "uwu",
"password": "fennec621",
"database": "gallery"
},
"testing": true,
"version": "15.08.22",
"license":"GPL 3.0"
}

View file

@ -2,7 +2,7 @@
<html> <html>
<head> <head>
<?php include __DIR__."/ui/header.php"; ?> <?php include "ui/header.php"; ?>
</head> </head>
@ -18,8 +18,13 @@
| many rewrites and hours of learning.... | many rewrites and hours of learning....
|------------------------------------------------------------- |-------------------------------------------------------------
*/ */
include __DIR__."/ui/required.php"; include "ui/required.php";
include __DIR__."/ui/nav.php"; include "ui/nav.php";
include "app/image/get_image_info.php";
include "app/image/image_privilage.php";
include "app/format/string_to_tags.php";
/* /*
@ -372,7 +377,7 @@
} }
?> ?>
<?php include __DIR__."/ui/footer.php"; ?> <?php include "ui/footer.php"; ?>
</body> </body>
</html> </html>

View file

@ -2,18 +2,18 @@
<html> <html>
<head> <head>
<?php include __DIR__."/ui/header.php"; ?> <?php include "ui/header.php"; ?>
</head> </head>
<body> <body>
<?php <?php
include __DIR__."/ui/required.php"; include "ui/required.php";
include __DIR__."/ui/nav.php"; include "ui/nav.php";
?> ?>
<script> <script>
if (params.del == "true") { if (params.del == "true") {
sniffleAdd("Image Deleted", "Successfully deleted image: <?php echo $_GET['id']; ?>", "var(--green)", "<?php echo $root_dir ?>assets/icons/trash.svg"); sniffleAdd("Image Deleted", "Successfully deleted image: <?php echo $_GET['id']; ?>", "var(--green)", "assets/icons/trash.svg");
} }
</script> </script>
@ -40,14 +40,19 @@ include __DIR__."/ui/nav.php";
} }
// Random welcome message // Random welcome message
$import_welcome = file_get_contents("default.json"); $welcome_message = $user_settings['website']['welcome_msg'];
$import_decode = json_decode($import_welcome, true);
$welcome_message = $import_decode['welcome_msg'];
echo "<p>".$welcome_message[array_rand($welcome_message, 1)]."</p>"; echo "<p>".$welcome_message[array_rand($welcome_message, 1)]."</p>";
?> ?>
</div> </div>
<div class="gallery-root flex-left"> <!--
<div class="gallery-order">
<button class="btn btn-neutral">Grid</button>
<button class="btn btn-neutral">List</button>
</div>
-->
<div class="gallery-root">
<?php <?php
// Reading images from table // Reading images from table
$image_request = mysqli_query($conn, "SELECT * FROM swag_table ORDER BY id DESC"); $image_request = mysqli_query($conn, "SELECT * FROM swag_table ORDER BY id DESC");
@ -79,6 +84,6 @@ include __DIR__."/ui/nav.php";
</div> </div>
<?php include __DIR__."/ui/footer.php"; ?> <?php include "ui/footer.php"; ?>
</body> </body>
</html> </html>

View file

@ -1,18 +1,9 @@
<?php
if (is_file("index.php")) {
$root_dir = "";
} else {
$root_dir = "../";
}
?>
<meta charset="utf-8"> <meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<title><?php echo $setup_json['website']['name']; ?></title> <title><?php echo $user_settings['website']['name']; ?></title>
<!-- Stylesheets --> <!-- Stylesheets -->
<link rel="stylesheet" href="<?php echo $root_dir; ?>css/main.css"> <link rel="stylesheet" href="css/main.css">
<link rel="stylesheet" href="<?php echo $root_dir; ?>css/normalise.css">
<!-- Google Fonts --> <!-- Google Fonts -->
@ -27,9 +18,9 @@ if (is_file("index.php")) {
</script> </script>
<!-- Sniffle script! --> <!-- Sniffle script! -->
<script src="<?php echo $root_dir; ?>Sniffle/sniffle.js"></script> <script src="Sniffle/sniffle.js"></script>
<link rel='stylesheet' href='<?php echo $root_dir; ?>Sniffle/sniffle.css'> <link rel='stylesheet' href='Sniffle/sniffle.css'>
<!-- Flyout script! --> <!-- Flyout script! -->
<script src="<?php echo $root_dir; ?>Flyout/flyout.js"></script> <script src="Flyout/flyout.js"></script>
<link rel='stylesheet' href='<?php echo $root_dir; ?>Flyout/flyout.css'> <link rel='stylesheet' href='Flyout/flyout.css'>

View file

@ -1,19 +1,19 @@
<nav class="nav-root flex-left"> <nav class="nav-root flex-left">
<div class="nav-name flex-left"> <div class="nav-name flex-left">
<p><?php echo $setup_json['name']; ?></p> <p><?php echo $user_settings['website']['name']; ?></p>
</div> </div>
<div class="nav-links flex-left"> <div class="nav-links flex-left">
<a class='btn' href='<?php echo $root_dir; ?>index.php'><img class='svg' src='<?php echo $root_dir; ?>assets/icons/house.svg'><span class='nav-hide'>Home</span></a> <a class='btn' href='index.php'><img class='svg' src='assets/icons/house.svg'><span class='nav-hide'>Home</span></a>
<hr> <hr>
<a class='btn' href='<?php echo $root_dir; ?>search.php'><img class='svg' src='<?php echo $root_dir; ?>assets/icons/binoculars.svg'><span class='nav-hide'>Search</span></a> <a class='btn' href='search.php'><img class='svg' src='assets/icons/binoculars.svg'><span class='nav-hide'>Search</span></a>
<hr> <hr>
<?php <?php
if (loggedin()) { if (loggedin()) {
echo "<a class='btn' href='".$root_dir."upload.php'><img class='svg' src='".$root_dir."assets/icons/upload.svg'><span class='nav-hide'>Upload</span></a>"; echo "<a class='btn' href='upload.php'><img class='svg' src='assets/icons/upload.svg'><span class='nav-hide'>Upload</span></a>";
echo "<hr>"; echo "<hr>";
echo "<a class='btn' href='".$root_dir."/account.php'><img class='svg' src='".$root_dir."assets/icons/user-circle.svg'><span class='nav-hide'>".substr($_SESSION["username"], 0, 15)."</span></a>"; echo "<a class='btn' href='account.php'><img class='svg' src='assets/icons/user-circle.svg'><span class='nav-hide'>".substr($_SESSION["username"], 0, 15)."</span></a>";
} else { } else {
echo "<a class='btn' href='".$root_dir."/account.php'><img class='svg' src='".$root_dir."assets/icons/sign-in.svg'><span class='nav-hide'>Login</span></a>"; echo "<a class='btn' href='account.php'><img class='svg' src='assets/icons/sign-in.svg'><span class='nav-hide'>Login</span></a>";
} }
?> ?>
</div> </div>

View file

@ -1,53 +1,39 @@
<?php <?php
/*
User defined settings
*/
include "app/settings/settings.php";
if ($debug["testing"]) {
/* /*
Used for testing, do not use this in production Used for testing, do not use this in production
*/ */
ini_set('display_errors', 1); ini_set('display_errors', 1);
ini_set('display_startup_errors', 1); ini_set('display_startup_errors', 1);
error_reporting(E_ERROR | E_PARSE | E_NOTICE);; error_reporting(E_ERROR | E_PARSE | E_NOTICE);
?>
<script>
sniffleAdd('Notice', 'This website is currently in a testing state, bugs may occur', 'var(--red)', 'assets/icons/cross.svg');
</script>
<?php
}
/*
Start session
This is important as most pages use the PHP session and will complain if its not possible to access.
*/
session_start();
/*
Check which directory user is in
I don't know if theres a better way of doing this? If there is please let me know
*/
if (is_file("index.php")) { if (is_file("index.php")) {
$root_dir = ""; $root_dir = "";
} else { } else {
$root_dir = "../"; $root_dir = "../";
} }
$import_json = file_get_contents($root_dir."default.json");
$setup_json = json_decode($import_json, true);
/* /*
Connect to the server Connect to the server
*/ */
include $root_dir."app/server/conn.php"; include "app/server/conn.php";
include "app/server/secrete.php";
/* include "app/account/get_info.php";
Add functions include "app/account/is_admin.php";
*/ include "app/account/login_status.php";
include $root_dir."app/account/get_info.php";
include $root_dir."app/account/is_admin.php";
include $root_dir."app/account/login_status.php";
include $root_dir."app/format/string_to_tags.php";
include $root_dir."app/image/get_image_info.php";
include $root_dir."app/image/image_privilage.php";
include $root_dir."app/server/secrete.php";
?> ?>
<script> <script>
/* /*

View file

@ -2,7 +2,7 @@
<html> <html>
<head> <head>
<?php include __DIR__."/ui/header.php"; ?> <?php include "ui/header.php"; ?>
<!-- Upload Script --> <!-- Upload Script -->
<script> <script>
@ -51,8 +51,8 @@
<body> <body>
<?php <?php
include __DIR__."/ui/required.php"; include "ui/required.php";
include __DIR__."/ui/nav.php"; include "ui/nav.php";
// Check if user is logged in // Check if user is logged in
if (!loggedin()) { if (!loggedin()) {
@ -76,7 +76,7 @@
</form> </form>
</div> </div>
<?php include __DIR__."/ui/footer.php"; ?> <?php include "ui/footer.php"; ?>
</body> </body>
</html> </html>