mirror of
https://github.com/Fluffy-Bean/image-gallery.git
synced 2024-12-28 02:16:17 +00:00
Finish writing README and fix table names
This commit is contained in:
parent
4005bc2d87
commit
6fee1e3b57
25
README.md
25
README.md
|
@ -1,7 +1,7 @@
|
|||
# OnlyLegs!
|
||||
The only gallery made by a maned wolf.
|
||||
|
||||
## How to use
|
||||
## How to setup
|
||||
### Downloading & installing
|
||||
#### Path
|
||||
Download this project and move it into your website(s) folder. Usually under ```/var/www/html/``` on Linux.
|
||||
|
@ -29,9 +29,9 @@ I also recommend not using root for this and setting up a user specifically for
|
|||
You will next need to setup the following 5 tables:
|
||||
|
||||
#### Images
|
||||
```CREATE TABLE images ( id INT NOT NULL PRIMARY KEY AUTO_INCREMENT, imagename VARCHAR(50) UNIQUE, alt VARCHAR(255), tags VARCHAR(255), alt VARCHAR(50), modified TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, upload TIMESTAMP DEFAULT CURRENT_TIMESTAMP );```
|
||||
```CREATE TABLE images ( id INT NOT NULL PRIMARY KEY AUTO_INCREMENT, imagename VARCHAR(50) UNIQUE, alt VARCHAR(255), tags VARCHAR(255), alt VARCHAR(50), last_modified TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, upload_date TIMESTAMP DEFAULT CURRENT_TIMESTAMP );```
|
||||
#### Users
|
||||
```CREATE TABLE users ( id INT NOT NULL PRIMARY KEY AUTO_INCREMENT, usernname VARCHAR(50) NOT NULL UNIQUE, password VARCHAR(255) NOT NULL, admin bool, modified TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP );```
|
||||
```CREATE TABLE users ( id INT NOT NULL PRIMARY KEY AUTO_INCREMENT, usernname VARCHAR(50) NOT NULL UNIQUE, password VARCHAR(255) NOT NULL, admin bool, last_modified TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP );```
|
||||
#### Tokens
|
||||
```CREATE TABLE tokens ( id INT NOT NULL PRIMARY KEY AUTO_INCREMENT, code VARCHAR(50) NOT NULL, used BOOL, used_at VARCHAR(50) NOT NULL );```
|
||||
#### Logs
|
||||
|
@ -39,8 +39,25 @@ You will next need to setup the following 5 tables:
|
|||
#### Bans
|
||||
```CREATE TABLE bans ( id INT NOT NULL PRIMARY KEY AUTO_INCREMENT, ipaddress VARCHAR(16) NOT NULL, reason VARCHAR(255), time TIMESTAMP DEFAULT CURRENT_TIMESTAMP, length VARCHAR(255) NOT NULL, permanent BOOL NOT NULL ); ```
|
||||
|
||||
|
||||
### 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 as that is used for development and ```upload_max``` to your prefered file size max in MBs.
|
||||
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.
|
||||
|
||||
### Creating an account
|
||||
For now, there is no automated way of doing this, so you will have to go into your database on a terminal and type the following command ```INSERT INTO tokens (code, used) VALUES('UserToken', False)```. You have now made a token that you can use to make an account with.
|
||||
|
||||
Head over to the Login section off the app and click the Need an account button, from there you can enter your own details. Once you get to the token section enter ```UserToken```. And with that, you have now set up your own image gallery!
|
||||
|
||||
## Usage
|
||||
### Admin
|
||||
As an admin, you can do things such as modifying other people's posts, reseting users passwords and checking logs for sussy behaviour. With that, use these tools with respect to others and don't abuse them.
|
||||
|
||||
If you trust someone enough, you can set them to a moderator through the settings > users > toggle admin. You can tell who is an admin by the green highlight to the left of their name.
|
||||
|
||||
### Images
|
||||
Uploading images is as simple as choosing the image you want to upload, then clicking upload! Keep in mind that not all formats play well as this gallery uses Imagik to generate thumbnails and preview images, so images such as GIFs do not work as of now. Supported file formats include JPG, JPEG, PNG and WEBP.
|
||||
|
||||
You should also keep in mind the file size, by default images of 20MBs should be able to get uploaded. But if you run into issues, either raise the file size in the ```manifest.json``` or locate your ```php.ini``` on your webserver and raise the ```upload_max_filesize``` and ```post_max_size``` to a same or greater value.
|
||||
|
||||
## License
|
||||
This project is under the GNU v3 License
|
||||
|
|
|
@ -199,7 +199,7 @@
|
|||
<p><?php echo $user['username']; ?></p>
|
||||
<?php
|
||||
$user_time = new DateTime($user['created_at']);
|
||||
echo "<p>" . $user_time->format('Y-m-d H:i:s T') . " | " . $diff->time($user['created_at']) . "</p>";
|
||||
echo "<p>" . $user_time->format('Y-m-d H:i:s T') . " | " . $diff->time($user['last_modified']) . "</p>";
|
||||
|
||||
if ($user['id'] == 1) {
|
||||
?>
|
||||
|
|
|
@ -28,6 +28,6 @@
|
|||
"license":"GPL 3.0",
|
||||
"version": "22.09.20",
|
||||
"user_name": "Michal",
|
||||
"is_testing": true,
|
||||
"is_testing": "true",
|
||||
"upload_max": "20"
|
||||
}
|
13
image.php
13
image.php
|
@ -23,9 +23,11 @@
|
|||
|
||||
use App\Account;
|
||||
use App\Image;
|
||||
use App\Diff;
|
||||
|
||||
$image_info = new Image;
|
||||
$user_info = new Account;
|
||||
$diff = new Diff();
|
||||
|
||||
/*
|
||||
|-------------------------------------------------------------
|
||||
|
@ -186,13 +188,12 @@
|
|||
echo "<p>ID: ".$image['id']."</p>";
|
||||
}
|
||||
|
||||
// Last time image was updated
|
||||
$update_time = new DateTime($image['upload']);
|
||||
echo "<p id='updateTime'>Last updated: ".$update_time->format('d/m/Y H:i:s T')."</p>";
|
||||
$upload_time = new DateTime($image['upload_date']);
|
||||
echo "<p id='updateTime'>Uploaded at: ".$upload_time->format('d/m/Y H:i:s T')."</p>";
|
||||
?>
|
||||
<script>
|
||||
// Updating time to Viewers local
|
||||
var updateDate = new Date('<?php echo $update_time->format('m/d/Y H:i:s T'); ?>');
|
||||
var updateDate = new Date('<?php echo $upload_time->format('m/d/Y H:i:s T'); ?>');
|
||||
var format = {year: 'numeric',
|
||||
month: 'short',
|
||||
day: 'numeric',
|
||||
|
@ -202,8 +203,10 @@
|
|||
|
||||
updateDate = updateDate.toLocaleDateString('en-GB', format);
|
||||
|
||||
$("#updateTime").html("Last updated: "+updateDate);
|
||||
$("#updateTime").html("Uploaded at: "+updateDate);
|
||||
</script>
|
||||
|
||||
<p>Last Modified: <?php echo $diff->time($image['last_modified']); ?></p>
|
||||
</div>
|
||||
<div>
|
||||
<?php
|
||||
|
|
|
@ -1,35 +1,3 @@
|
|||
<?php
|
||||
/*
|
||||
User defined settings
|
||||
*/
|
||||
require_once dirname(__DIR__)."/app/settings/settings.php";
|
||||
|
||||
ini_set('post_max_size', $user_settings['upload_max']."M");
|
||||
ini_set('upload_max_filesize', ($user_settings['upload_max'] + 1)."M");
|
||||
|
||||
if ($user_settings['is_testing']) {
|
||||
ini_set('display_errors', 1);
|
||||
ini_set('display_startup_errors', 1);
|
||||
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
|
||||
}
|
||||
|
||||
/*
|
||||
Connect to the server
|
||||
*/
|
||||
require_once dirname(__DIR__)."/app/server/conn.php";
|
||||
require_once dirname(__DIR__)."/app/server/secrete.php";
|
||||
|
||||
/*
|
||||
Classes
|
||||
*/
|
||||
require_once dirname(__DIR__)."/app/app.php";
|
||||
|
||||
?>
|
||||
<!--
|
||||
Used by Sniffle to add Notifications
|
||||
Div can be displayed all time as it has no width or height initself
|
||||
|
@ -57,7 +25,7 @@ require_once dirname(__DIR__)."/app/app.php";
|
|||
everything can always be accessed
|
||||
-->
|
||||
<a id="back-to-top" href="#">
|
||||
<img src="<?php echo $root_dir; ?>assets/icons/caret-up.svg">
|
||||
<img src="assets/icons/caret-up.svg">
|
||||
</a>
|
||||
<script>
|
||||
button = document.getElementById("back-to-top");
|
||||
|
@ -77,4 +45,37 @@ require_once dirname(__DIR__)."/app/app.php";
|
|||
Required so main objects are centered when NAV
|
||||
is in mobile view
|
||||
-->
|
||||
<div class="nav-mobile"></div>
|
||||
<div class="nav-mobile"></div>
|
||||
|
||||
<?php
|
||||
/*
|
||||
User defined settings
|
||||
*/
|
||||
require_once dirname(__DIR__)."/app/settings/settings.php";
|
||||
|
||||
ini_set('post_max_size', $user_settings['upload_max']."M");
|
||||
ini_set('upload_max_filesize', ($user_settings['upload_max'] + 1)."M");
|
||||
|
||||
if ($user_settings['is_testing'] == "true") {
|
||||
ini_set('display_errors', 1);
|
||||
ini_set('display_startup_errors', 1);
|
||||
error_reporting(E_ERROR | E_PARSE | E_NOTICE);
|
||||
?>
|
||||
<script>
|
||||
sniffleAdd('Notice', 'This website is currently in a testing state', 'var(--red)', 'assets/icons/cross.svg');
|
||||
</script>
|
||||
<?php
|
||||
}
|
||||
|
||||
/*
|
||||
Connect to the server
|
||||
*/
|
||||
require_once dirname(__DIR__)."/app/server/conn.php";
|
||||
require_once dirname(__DIR__)."/app/server/secrete.php";
|
||||
|
||||
/*
|
||||
Classes
|
||||
*/
|
||||
require_once dirname(__DIR__)."/app/app.php";
|
||||
|
||||
?>
|
Loading…
Reference in a new issue