diff --git a/README.md b/README.md index 33fe647..14bb578 100644 --- a/README.md +++ b/README.md @@ -7,10 +7,10 @@ The only gallery made by a maned wolf ## Special thanks -- Carty: Kickstarting development and SQL/PHP development -- Jeetix: Helping patch holes in some features -- mrHDash, Verg, Fennec, Carty, Jeetix and everyone else for helping with early bug testing -- Phosphor for providing nice SVG icons +* Carty: Kickstarting development and SQL/PHP development +* Jeetix: Helping patch holes in some features +* mrHDash, Verg, Fennec, Carty, Jeetix and everyone else for helping with early bug testing +* Phosphor for providing nice SVG icons ## How to setup ### Downloading & installing @@ -57,16 +57,16 @@ If you run into errors with connecting to the database, you may need to install You first need to head over to ```app/server/conn.php``` and set the correct information, if you're using localhost, this should be the following details: -- localhost -- (username) -- (password) -- Gallery +* localhost +* (username) +* (password) +* Gallery I recommend using a database name such as Gallery, but others should work just as well. I also recommend not using root for this and setting up a user specifically for this, but I will not go through the process of making a such user here. -You will next need to setup the following 5 tables: +You will next need to setup the following 6 tables: #### Images CREATE TABLE images ( @@ -112,6 +112,15 @@ You will next need to setup the following 5 tables: permanent BOOL NOT NULL ); +### Groups + CREATE TABLE groups ( + id INT NOT NULL PRIMARY KEY AUTO_INCREMENT, + image_list VARCHAR(255), + author VARCHAR(50), + last_modified TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP + ); + ### Manifest In the ```app/settings/manifest.json``` you have a list of infomation about your website. You must change ```user_name``` to your prefered name, ```is_testing``` to false (or anything else) as that is used for development and ```upload_max``` to your prefered file size max in MBs. diff --git a/app/image/group.php b/app/image/group.php new file mode 100644 index 0000000..bb223f7 --- /dev/null +++ b/app/image/group.php @@ -0,0 +1,69 @@ +get_ip(); + +/* + |------------------------------------------------------------- + | Image Groups + |------------------------------------------------------------- + | The Long-awaited feature + |------------------------------------------------------------- +*/ +if (isset($_POST['group_submit'])) { + $sql = "SELECT author FROM groups WHERE id= ?"; + + if ($stmt = mysqli_prepare($conn, $sql)) { + // Bind variables to the prepared statement as parameters + mysqli_stmt_bind_param($stmt, "i", $param_user_id); + + $param_user_id = $_POST['group_id']; + + $stmt->execute(); + $query = $stmt->get_result(); + + if ($_SESSION['id'] == $query || $user_info->is_admin($conn, $_SESSION['id'])) { + $sql = "UPDATE groups SET image_list = ? WHERE id = ?"; + + // Checking if databse is doing ok + if ($stmt = mysqli_prepare($conn, $sql)) { + mysqli_stmt_bind_param($stmt, "si", $param_images, $param_id); + + // Setting parameters + $param_images = implode(" ", $_POST['group_images']); + $param_id = $_POST['group_id']; + + // Attempt to execute the prepared statement + if (mysqli_stmt_execute($stmt)) { + ?> + + + + + + -/ + diff --git a/css/main.css b/css/main.css index 87b0b58..581c785 100644 --- a/css/main.css +++ b/css/main.css @@ -582,6 +582,46 @@ nav .btn { text-rendering: optimizeLegibility; } +/* + |------------------------------------------------------------- + | Groups + |------------------------------------------------------------- +*/ +.group-root { + margin-bottom: 1rem; + padding: 0.5rem 0.5rem 0 0.5rem; + width: calc(100% - 1.4rem); + background-color: #151515; + color: #E8E3E3; + border-radius: 0.4rem; + border: 0.2rem solid #8C977D; + box-shadow: 6px 6px 2px rgba(21, 21, 21, 0.4); + transition: outline 0.1s cubic-bezier(0.19, 1, 0.22, 1) transform 0.15s cubic-bezier(0.19, 1, 0.22, 1); +} +.group-root > * { + margin-top: 0; + margin-bottom: 0.5rem; +} +.group-root h1, +.group-root h2, +.group-root h3, +.group-root h4, +.group-root h5 { + font-family: "Lexend Deca", sans-serif; + text-rendering: optimizeLegibility; +} +.group-root p, +.group-root a, +.group-root button, +.group-root input { + font-family: "Secular One", sans-serif; + text-rendering: optimizeLegibility; +} + +.selectedImage { + outline: #8C977D solid 0.3rem; +} + /* |------------------------------------------------------------- | profile diff --git a/css/scss/_body.scss b/css/scss/_body.scss index 369bb17..084e739 100644 --- a/css/scss/_body.scss +++ b/css/scss/_body.scss @@ -398,6 +398,21 @@ @include defaultFont(); } +/* + |------------------------------------------------------------- + | Groups + |------------------------------------------------------------- +*/ +.group-root { + @include defaultDecoration($page-accent); + @include defaultFont(); + + transition: outline 0.1s cubic-bezier(.19, 1, .22, 1) transform 0.15s cubic-bezier(.19, 1, .22, 1); +} +.selectedImage { + outline: $page-accent solid 0.3rem; +} + /* |------------------------------------------------------------- | profile diff --git a/group.php b/group.php new file mode 100644 index 0000000..52907e5 --- /dev/null +++ b/group.php @@ -0,0 +1,179 @@ + + + + + + + + + + + + +
+ execute(); + $query = $stmt->get_result(); + + $group = mysqli_fetch_array($query); + + $image_list = explode(" ", $group['image_list']); + } + } + ?> +

+

By:

+

Made on:

+

Updated on:

+ is_admin($conn, $_SESSION['id'])) { + $privilaged = True; + } else { + $privilaged = False; + } + + if (isset($_GET['mode']) && $_GET['mode'] == "edit") { + if (!$privilaged) header("Location: group.php?id=".$_GET['id']); + + echo ""; + + $image_request = mysqli_query($conn, "SELECT * FROM images"); + echo "
"; + while ($image = mysqli_fetch_array($image_request)) { + if (in_array($image['id'], $image_list)) { + echo ""; + } else { + echo ""; + } + } + echo "
"; + + echo "Cancel"; + } else { + if ($privilaged) echo "Edit"; + } + ?> +
+ + "; + } else { + echo ""; + } + } + + ?> + + + NSFW + + "; + } else { + echo ""; + } + } + } + } + ?> + + + + + \ No newline at end of file diff --git a/index.php b/index.php index d647bc3..56abc26 100644 --- a/index.php +++ b/index.php @@ -63,14 +63,14 @@ // Check for NSFW tag if (str_contains($image['tags'], "nsfw")) { - echo ""; + echo ""; } else { - echo ""; + echo ""; } } ?> diff --git a/profile.php b/profile.php index 4d7b837..cca95d1 100644 --- a/profile.php +++ b/profile.php @@ -22,7 +22,7 @@ } elseif (isset($_GET['user'])) { $user = $user_info->get_user_info($conn, $_GET['user']); - $join_date = new DateTime($user['created_at']);; + $join_date = new DateTime($user['created_at']); ?>
@@ -74,14 +74,14 @@ // Check for NSFW tag if (str_contains($image['tags'], "nsfw")) { - echo ""; + echo ""; } else { - echo ""; + echo ""; } } }