Bug fixes

This commit is contained in:
Michał Gdula 2022-11-17 12:45:43 +00:00
parent 4186a609ef
commit edb9feee97
6 changed files with 71 additions and 32 deletions

View file

@ -1,5 +1,5 @@
{ {
"license": "MIT", "license": "MIT",
"version": "22.11.16", "version": "22.11.17",
"branch": "main" "branch": "main"
} }

View file

@ -19,17 +19,17 @@ if (defined('ROOT') && $_SESSION['id'] == 1) {
'images' => array( 'images' => array(
array('id', 'int(11)', 'NO', 'PRI', '', 'auto_increment'), array('id', 'int(11)', 'NO', 'PRI', '', 'auto_increment'),
array('imagename', 'varchar(255)', 'NO', 'UNI', '', ''), array('imagename', 'varchar(255)', 'NO', 'UNI', '', ''),
array('alt', 'text', 'NO', '', '', ''), array('alt', 'text', 'YES', '', '', ''),
array('tags', 'text', 'NO', '', '', ''), array('tags', 'text', 'YES', '', '', ''),
array('author', 'int(11)', 'NO', '', '', ''), array('author', 'int(11)', 'NO', '', '', ''),
array('last_modified', 'timestamp', 'NO', '', 'CURRENT_TIMESTAMP', 'on update CURRENT_TIMESTAMP'), array('last_modified', 'timestamp', 'NO', '', 'CURRENT_TIMESTAMP', 'on update CURRENT_TIMESTAMP'),
array('upload_date', 'timestamp', 'NO', '', 'CURRENT_TIMESTAMP', '') array('upload_date', 'timestamp', 'NO', '', 'CURRENT_TIMESTAMP', '')
), ),
'users' => array( 'users' => array(
array('id', 'int(11)', 'NO', 'PRI', '', 'auto_increment'), array('id', 'int(11)', 'NO', 'PRI', '', 'auto_increment'),
array('username', 'varchar(255)', 'NO', 'UNI', '', ''), array('username', 'varchar(50)', 'NO', 'UNI', '', ''),
array('password', 'varchar(255)', 'NO', '', '', ''), array('password', 'varchar(255)', 'NO', '', '', ''),
array('pfp_path', 'varchar(255)', 'NO', '', '', ''), array('pfp_path', 'varchar(50)', 'NO', '', '', ''),
array('admin', 'boolean', 'NO', '', 'FALSE', ''), array('admin', 'boolean', 'NO', '', 'FALSE', ''),
array('last_modified', 'timestamp', 'NO', '', 'CURRENT_TIMESTAMP', 'on update CURRENT_TIMESTAMP'), array('last_modified', 'timestamp', 'NO', '', 'CURRENT_TIMESTAMP', 'on update CURRENT_TIMESTAMP'),
array('created_at', 'timestamp', 'NO', '', 'CURRENT_TIMESTAMP', '') array('created_at', 'timestamp', 'NO', '', 'CURRENT_TIMESTAMP', '')
@ -37,6 +37,7 @@ if (defined('ROOT') && $_SESSION['id'] == 1) {
'groups' => array( 'groups' => array(
array('id', 'int(11)', 'NO', 'PRI', '', 'auto_increment'), array('id', 'int(11)', 'NO', 'PRI', '', 'auto_increment'),
array('group_name', 'varchar(255)', 'NO', 'UNI', '', ''), array('group_name', 'varchar(255)', 'NO', 'UNI', '', ''),
array('author', 'varchar(50)', 'NO', '', '', ''),
array('image_list', 'text', 'NO', '', '', ''), array('image_list', 'text', 'NO', '', '', ''),
array('last_modified', 'timestamp', 'NO', '', 'CURRENT_TIMESTAMP', 'on update CURRENT_TIMESTAMP'), array('last_modified', 'timestamp', 'NO', '', 'CURRENT_TIMESTAMP', 'on update CURRENT_TIMESTAMP'),
array('created_at', 'timestamp', 'NO', '', 'CURRENT_TIMESTAMP', '') array('created_at', 'timestamp', 'NO', '', 'CURRENT_TIMESTAMP', '')
@ -56,7 +57,7 @@ if (defined('ROOT') && $_SESSION['id'] == 1) {
'bans' => array( 'bans' => array(
array('id', 'int(11)', 'NO', 'PRI', '', 'auto_increment'), array('id', 'int(11)', 'NO', 'PRI', '', 'auto_increment'),
array('ipaddress', 'varchar(16)', 'NO', '', '', ''), array('ipaddress', 'varchar(16)', 'NO', '', '', ''),
array('reason', 'varchar(255)', 'NO', '', '', ''), array('reason', 'text', 'NO', '', '', ''),
array('time', 'timestamp', 'NO', '', 'CURRENT_TIMESTAMP', ''), array('time', 'timestamp', 'NO', '', 'CURRENT_TIMESTAMP', ''),
array('length', 'int(255)', 'NO', '', '', ''), array('length', 'int(255)', 'NO', '', '', ''),
array('pernament', 'boolean', 'NO', '', 'FALSE', '') array('pernament', 'boolean', 'NO', '', 'FALSE', '')
@ -85,7 +86,8 @@ if (defined('ROOT') && $_SESSION['id'] == 1) {
return $results; return $results;
} }
$table_list = array('images', 'users', 'groups', 'tokens', 'logs', 'bans', 'test'); //$table_list = array('images', 'users', 'groups', 'tokens', 'logs', 'bans', 'test');
$table_list = array('images', 'users', 'groups', 'tokens', 'logs', 'bans');
foreach ($table_list as $table) { foreach ($table_list as $table) {
$error_type = array(); $error_type = array();

View file

@ -21,11 +21,11 @@ if (defined('ROOT') && $_SESSION['id'] == 1) {
); );
} else { } else {
$sql = "CREATE TABLE IF NOT EXISTS images ( $sql = "CREATE TABLE IF NOT EXISTS images (
id INT(11) AUTO_INCREMENT PRIMARY KEY, id INT(11) NOT NULL PRIMARY KEY AUTO_INCREMENT,
imagename VARCHAR(255) NOT NULL UNIQUE, imagename VARCHAR(255) UNIQUE,
alt TEXT NOT NULL, alt TEXT,
tags TEXT NOT NULL, tags TEXT,
author INT(11) NOT NULL, author VARCHAR(50) NOT NULL,
last_modified TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, last_modified TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
upload_date TIMESTAMP DEFAULT CURRENT_TIMESTAMP upload_date TIMESTAMP DEFAULT CURRENT_TIMESTAMP
)"; )";
@ -59,11 +59,11 @@ if (defined('ROOT') && $_SESSION['id'] == 1) {
); );
} else { } else {
$sql = "CREATE TABLE IF NOT EXISTS users ( $sql = "CREATE TABLE IF NOT EXISTS users (
id INT(11) AUTO_INCREMENT PRIMARY KEY, id INT(11) NOT NULL PRIMARY KEY AUTO_INCREMENT,
username VARCHAR(255) NOT NULL UNIQUE, username VARCHAR(50) NOT NULL UNIQUE,
password VARCHAR(255) NOT NULL, password VARCHAR(255) NOT NULL,
pfp_path VARCHAR(255) NOT NULL, pfp_path VARCHAR(50),
admin BOOLEAN NOT NULL DEFAULT FALSE, admin BOOLEAN DEFAULT FALSE,
last_modified TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, last_modified TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
)"; )";
@ -96,10 +96,11 @@ if (defined('ROOT') && $_SESSION['id'] == 1) {
'message'=> 'Found groups table', 'message'=> 'Found groups table',
); );
} else { } else {
$sql = "CREATE TABLE IF NOT EXISTS groups ( $sql = "CREATE TABLE IF NOT EXISTS groups (`
id INT(11) AUTO_INCREMENT PRIMARY KEY, id INT NOT NULL PRIMARY KEY AUTO_INCREMENT,
group_name VARCHAR(255) NOT NULL, group_name TEXT NOT NULL,
image_list VARCHAR(text) NOT NULL, image_list TEXT NOT NULL,
author VARCHAR(50) NOT NULL,
last_modified TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, last_modified TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
)"; )";
@ -133,10 +134,10 @@ if (defined('ROOT') && $_SESSION['id'] == 1) {
); );
} else { } else {
$sql = "CREATE TABLE IF NOT EXISTS logs ( $sql = "CREATE TABLE IF NOT EXISTS logs (
id INT(11) AUTO_INCREMENT PRIMARY KEY, id INT NOT NULL PRIMARY KEY AUTO_INCREMENT,
ipaddress VARCHAR(16) NOT NULL, ipaddress VARCHAR(16) NOT NULL,
action VARCHAR(255) NOT NULL, action TEXT NOT NULL,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP time TIMESTAMP DEFAULT CURRENT_TIMESTAMP
)"; )";
try { try {
@ -167,10 +168,10 @@ if (defined('ROOT') && $_SESSION['id'] == 1) {
'message'=> 'Found bans table', 'message'=> 'Found bans table',
); );
} else { } else {
$sql = "CREATE TABLE IF NOT EXISTS bans ( $sql = "CREATE TABLE IF NOT EXISTS bans (
id INT(11) AUTO_INCREMENT PRIMARY KEY, id INT NOT NULL PRIMARY KEY AUTO_INCREMENT,
ipaddress VARCHAR(16) NOT NULL, ipaddress VARCHAR(16) NOT NULL,
reason VARCHAR(255) NOT NULL, reason TEXT NOT NULL,
time TIMESTAMP DEFAULT CURRENT_TIMESTAMP, time TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
length VARCHAR(255) NOT NULL, length VARCHAR(255) NOT NULL,
permanent BOOLEAN NOT NULL DEFAULT FALSE permanent BOOLEAN NOT NULL DEFAULT FALSE
@ -206,7 +207,7 @@ if (defined('ROOT') && $_SESSION['id'] == 1) {
} else { } else {
$sql = "CREATE TABLE IF NOT EXISTS tokens ( $sql = "CREATE TABLE IF NOT EXISTS tokens (
id INT(11) AUTO_INCREMENT PRIMARY KEY, id INT(11) AUTO_INCREMENT PRIMARY KEY,
code VARCHAR(59) NOT NULL, code VARCHAR(16) NOT NULL,
used BOOLEAN NOT NULL DEFAULT FALSE, used BOOLEAN NOT NULL DEFAULT FALSE,
timestamp TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP timestamp TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
)"; )";
@ -233,6 +234,7 @@ if (defined('ROOT') && $_SESSION['id'] == 1) {
} }
} }
/* TEST TABLE, NOT TO BE USED IN RRODCTION
if (check_database($conn, 'test')) { if (check_database($conn, 'test')) {
$results[] = array( $results[] = array(
'type'=>'success', 'type'=>'success',
@ -244,4 +246,5 @@ if (defined('ROOT') && $_SESSION['id'] == 1) {
'message'=> 'Error creating table tokens: This is a test, you do not need to act on this', 'message'=> 'Error creating table tokens: This is a test, you do not need to act on this',
); );
} }
*/
} }

View file

@ -172,4 +172,38 @@ if (defined('ROOT') && $_SESSION['id'] == 1) {
); );
} }
} }
if (is_file(__DIR__."/../../../usr/conf/msg.json")) {
$results[] = array(
'type'=>'success',
'message'=> 'Found usr/conf/msg.json folder!',
);
} else {
try {
$conf = json_encode(array('welcome'=>array('Welcome to your new Only Legs installation!')));
$conf_new = fopen(__DIR__."/../../../usr/conf/msg.json", "w");
if ($conf_new) {
fwrite($conf_new, $conf);
fclose($conf_new);
$results[] = array(
'type'=>'success',
'message'=> 'Created usr/conf/msg.json file!',
);
} else {
$results[] = array(
'type'=>'critical',
'message'=> 'Error creating usr/conf/msg.json file!',
'fix'=>'manual',
);
}
} catch (Exception $e) {
$results[] = array(
'type'=>'critical',
'message'=> 'Error creating usr/conf/msg.json file: '.$e,
'fix'=>'manual',
);
}
}
} }

View file

@ -701,9 +701,9 @@ nav .btn {
margin: 0 auto; margin: 0 auto;
max-width: 100%; max-width: 100%;
height: 15rem; height: 15rem;
-webkit-animation: uploadGradient 10s ease infinite; -webkit-animation: uploadGradient 10s ease-in-out infinite;
animation: uploadGradient 10s ease infinite; animation: uploadGradient 10s ease-in-out infinite;
background: linear-gradient(-45rad, #000000, #EE7752, #E73C7E, #23A6D5, #23D5AB); background: linear-gradient(-45rad, rgba(0, 0, 0, 0), #121212, rgba(0, 0, 0, 0), #121212);
background-size: 200% 200%; background-size: 200% 200%;
border-radius: 3px; border-radius: 3px;
display: flex; display: flex;

View file

@ -685,8 +685,8 @@
max-width: 100%; max-width: 100%;
height: 15rem; height: 15rem;
animation: uploadGradient 10s ease infinite; animation: uploadGradient 10s ease-in-out infinite;
background: linear-gradient(-45rad, #000000, #EE7752, #E73C7E, #23A6D5, #23D5AB); background: linear-gradient(-45rad, #00000000, #121212, #00000000, #121212);
background-size: 200% 200%; background-size: 200% 200%;
@if calc($rad - 0.5rem) > 0 { @if calc($rad - 0.5rem) > 0 {