diff --git a/assets/icons/circle-wavy-green.svg b/assets/icons/circle-wavy-green.svg new file mode 100644 index 0000000..ca218f7 --- /dev/null +++ b/assets/icons/circle-wavy-green.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/icons/circle-wavy.svg b/assets/icons/circle-wavy.svg new file mode 100644 index 0000000..839e559 --- /dev/null +++ b/assets/icons/circle-wavy.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/image.php b/image.php index 84bdd43..39c329c 100644 --- a/image.php +++ b/image.php @@ -1,56 +1,3 @@ -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 -if (isset($image['author'])) { - $get_user = "SELECT * FROM users WHERE id = ".$image['author']; - $user_results = mysqli_query($conn, $get_user); - $user = mysqli_fetch_assoc($user_results); -} -?> - - @@ -64,13 +11,6 @@ if (isset($image['author'])) { - "; - - list($meta_width, $meta_height) = getimagesize($image_path); - echo ""; - echo ""; - - echo ""?> @@ -79,9 +19,6 @@ if (isset($image['author'])) { Something went fuckywucky, please try later"; } + // If ID present pull all image data + if (isset($_GET['id'])) { + $image = get_image_info($conn, $_GET['id']); - /* - Check if the user is an admin session id = 1 - Or the owner of the image, image author == session id + // Check if image is avalible + if (isset($image['imagename'])) { + // Display image + $image_path = "images/".$image['imagename']; + $image_alt = $image['alt']; + } else { + // ID not avalible toast + echo "Could not find image with ID: ".$_GET['id']."
"; - This may not be the best system of doing this, but much better than not having it at all - I plan on adding an array of privilaged users that user with the id of 1 can modify, - sort of like a mod/admin list of users - */ - if (isset($_SESSION['id']) && $image['author'] == $_SESSION['id'] || $_SESSION['id'] == 1) { + // 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 + if (isset($image['author'])) { + $user = get_user_info($conn, $image['author']); + } + + // Check user privilge + if (image_privilage($image['author']) || is_admin($_SESSION['id'])) { $privilaged = True; } else { $privilaged = False; @@ -248,7 +209,7 @@ if (isset($image['author'])) { /* Description athor */ - if (isset($_POST['author_flyout']) && $_SESSION['id'] == 1) { + if (isset($_POST['author_flyout']) && is_admin($_SESSION['id'])) { $header = "Who owns the image?????"; $content = "Enter ID of image owner"; $action = ""; // Edit authro - if ($_SESSION['id'] == 1) { + if (is_admin($_SESSION['id'])) { echo ""; diff --git a/index.php b/index.php index 829c084..d8f4b7c 100644 --- a/index.php +++ b/index.php @@ -13,9 +13,6 @@ Successfully deleted image: ".$_GET['id'].""; @@ -44,18 +41,6 @@ // 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 = clean(trim($_POST['search'])); diff --git a/ui/flyout.php b/ui/flyout.php deleted file mode 100644 index 2310f19..0000000 --- a/ui/flyout.php +++ /dev/null @@ -1,25 +0,0 @@ -"; - // Div Start - echo "".$flyout_content."
"; - } - // Flyout button, not required so must need more information when added - if (isset($flyout_action) && !empty($flyout_action)) { - echo $flyout_action; - } - - // Exit button + Div End - echo " -".$content."
"; + } else { + echo "