";
-
- // Replacement "no image" image and description
- $image_path = "assets/no_image.png";
- $image_alt = "No image could be found, sowwy";
+ return "No information provided.";
}
-} else {
- // No ID toast
- //echo "
No ID present
";
-
- // Replacement "no image" image and description
- //$image_path = "assets/no_image.png";
- //$image_alt = "No image could be found, sowwy";
-}
-
-
-/*
- Get all user details
-
- This gets the user info from the image
-*/
-if (isset($image['author'])) {
- $user = get_user_info($conn, $image['author']);
-}
-
-/*
- Check user privilge
-
- This requires the user to be logged in or an admin
-*/
-if (image_privilage($image['author']) || is_admin($_SESSION['id'])) {
- $privilaged = True;
-} else {
- $privilaged = False;
}
?>
@@ -79,7 +32,63 @@ if (image_privilage($image['author']) || is_admin($_SESSION['id'])) {
-
+ Could not find image with ID: ".$_GET['id']."";
+
+ // Replacement "no image" image and description
+ $image_path = "assets/no_image.png";
+ $image_alt = "No image could be found, sowwy";
+ }
+ } else {
+ // No ID toast
+ //echo "
No ID present
";
+
+ // Replacement "no image" image and description
+ //$image_path = "assets/no_image.png";
+ //$image_alt = "No image could be found, sowwy";
+ }
+
+
+ /*
+ Get all user details
+
+ This gets the user info from the image
+ */
+ if (isset($image['author'])) {
+ $user = get_user_info($conn, $image['author']);
+ }
+
+ /*
+ Check user privilge
+
+ This requires the user to be logged in or an admin
+ */
+ if (image_privilage($image['author']) || is_admin($_SESSION['id'])) {
+ $privilaged = True;
+ } else {
+ $privilaged = False;
+ }
+
+ include"ui/nav.php"; ?>
- ");
- }
- }
-
- /*
- Tags Confirm
- */
- if (isset($_POST['tags_confirm']) && $privilaged) {
- // Unset all the variables, needed by flyout
- unset($header, $content, $action);
-
- // Clean tags before adding
- function clean($string) {
- // Change to lowercase
- $string = strtolower($string);
- // Replace hyphens
- $string = str_replace('-', '_', $string);
- // Regex
- $string = preg_replace('/[^A-Za-z0-9\_ ]/', '', $string);
- // Return string
- return preg_replace('/ +/', ' ', $string);
- }
-
- // Clean input
- $tags_string = tag_clean(trim($_POST['add_tags']));
-
- // getting ready forSQL asky asky
- $sql = "UPDATE swag_table SET tags=? WHERE id=?";
-
- // Checking if databse is doing ok
- if ($stmt = mysqli_prepare($conn, $sql)) {
- mysqli_stmt_bind_param($stmt, "si", $param_tags, $param_id);
-
- // Setting parameters
- $param_tags = $tags_string;
- $param_id = $image["id"];
-
- // Attempt to execute the prepared statement
- if (mysqli_stmt_execute($stmt)) {
- header("Location:image.php?id=".$image["id"]."&update=success");
- } else {
- header("Location:image.php?id=".$image["id"]."&update=error");
- }
- }
- }
-
- /*
- Description athor
- */
- if (isset($_POST['author_flyout']) && is_admin($_SESSION['id'])) {
- $header = "Who owns the image?????";
- $content = "Enter ID of image owner";
- $action = "";
-
- flyout($header, $content, $action);
- }
- /*
- Author confirm
- */
- if (isset($_POST['author_confirm']) && is_admin($_SESSION['id'])) {
- // Unset all the variables, needed by flyout
- unset($header, $content, $action);
-
- // getting ready forSQL asky asky
- $sql = "UPDATE swag_table SET author=? WHERE id=?";
-
- // Checking if databse is doing ok
- if ($stmt = mysqli_prepare($conn, $sql)) {
- mysqli_stmt_bind_param($stmt, "si", $param_author, $param_id);
-
- // Setting parameters
- $param_author = $_POST['update_author'];
- $param_id = $image["id"];
-
- // Attempt to execute the prepared statement
- if (mysqli_stmt_execute($stmt)) {
- header("Location:image.php?id=".$image["id"]."&update=success");
- } else {
- header("Location:image.php?id=".$image["id"]."&update=error");
- }
- }
- }
- ?>
-
- ";
- ?>
+ ' src='' alt=''>
@@ -314,13 +208,12 @@ if (image_privilage($image['author']) || is_admin($_SESSION['id'])) {
var header = "Enter new Description/Alt";
var description = "Whatcha gonna put in there 👀";
var actionBox = "\
";
flyoutShow(header, description, actionBox);
});
-
$("#descriptionConfirm").submit(function(event) {
event.preventDefault();
var descriptionInput = $("#descriptionInput").val();
diff --git a/index.php b/index.php
index c6503c2..06e8d0f 100644
--- a/index.php
+++ b/index.php
@@ -43,35 +43,6 @@
}
-
-
-
- ";
-
- flyout($header, $content, $action);
- }
- /*
- Search Confirm
- */
- if (isset($_POST['search_confirm'])) {
- // Unset all the variables, needed by flyout
- unset($header, $content, $action);
-
- // Clean input
- $tags_string = tag_clean(trim($_POST['search']));
-
- header("Location:index.php?q=".$tags_string);
- }
- if (isset($_GET["q"])) {
- echo "
diff --git a/ui/functions.php b/ui/functions.php
index e11239b..b3d9bbc 100644
--- a/ui/functions.php
+++ b/ui/functions.php
@@ -1,190 +1 @@
- At the bottom of the HTML document
-*/
-function flyout($header, $content, $action) {
- // Used for background dimming
- echo "";
- // Div Start
- echo "
";
-
- // Header for the flyout, must be included
- if (isset($header) && !empty($header)) {
- echo "
".$header."
";
- } else {
- echo "
Header
";
- }
-
- // Flyout content, must be included!!!!
- if (isset($content) && !empty($content)) {
- echo "
".$content."
";
- } else {
- echo "
Description
";
- }
-
- // Flyout button, not required so must need more information when added
- if (isset($action) && !empty($action)) {
- echo $action;
- }
-
- // Exit button + Div End
- echo "
-
";
-
- // Must be included with flyout.php
- echo "";
-}
-
-
-/*
- Notification of an action done, takes in min 3 inputs:
-
- Text is the text that shows up on the notification
- Takes in string input
-
- Level is the level of the notification
- high is a good response or the colour green
- low is a bad response or the colour red
- default is a neutral response or the colour black/gray
-
- returns notification html including classes
-
- ===== Programmers note ==============================
- I made this so I didn't have to remake the html
- portion of the notification, it was annoying.
- This also allows for expanding the system later on!
- =====================================================
-*/
-function notify($text, $level) {
- if ($level == "high") {
- $text_string = "
";
- }
-
- return $text_string;
-}
diff --git a/ui/required.php b/ui/required.php
index 838f2b4..1a72f8d 100644
--- a/ui/required.php
+++ b/ui/required.php
@@ -25,18 +25,18 @@ if (is_file("index.php")) {
include $root_dir."app/server/conn.php";
/*
- Include functions
-
- Maybe I should put all the functions in this file? Dunno
+ Add functions
*/
-include $root_dir."ui/functions.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";
-/*
- Notification system
+include $root_dir."app/format/string_to_tags.php";
- This is the notification system used by the website. Probably a little too much for what its used for
-*/
-echo "";
+include $root_dir."app/image/get_image_info.php";
+include $root_dir."app/image/image_privilage.php";
+
+include $root_dir."app/server/secrete.php";
?>