mirror of
https://github.com/Fluffy-Bean/image-gallery.git
synced 2025-06-11 04:43:11 +00:00
Moving to conf.json from manifest.json
This commit is contained in:
parent
3b24876900
commit
b3dbc2cb65
11 changed files with 113 additions and 119 deletions
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"license": "GPL 3.0",
|
||||
"version": "22.10.20",
|
||||
"version": "22.11.01",
|
||||
"branch": "main"
|
||||
}
|
26
app/app.php
26
app/app.php
|
@ -378,7 +378,7 @@ class Setup {
|
|||
mkdir("usr/conf");
|
||||
}
|
||||
|
||||
if (!is_file(__DIR__."/../usr/conf/manifest.json")) {
|
||||
if (!is_file(__DIR__."/../usr/conf/conf.json")) {
|
||||
$manifest = array(
|
||||
"website_name" => "Only Legs",
|
||||
"website_description" => "A simple PHP gallery with multiple users in mind",
|
||||
|
@ -392,7 +392,7 @@ class Setup {
|
|||
"allowed_extensions" => array("jpg", "jpeg", "png", "webp")
|
||||
)
|
||||
);
|
||||
file_put_contents(__DIR__."/../usr/conf/manifest.json", json_encode($manifest));
|
||||
file_put_contents(__DIR__."/../usr/conf/conf.json", json_encode($manifest));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -402,17 +402,25 @@ class Sanity {
|
|||
{
|
||||
$results = array();
|
||||
|
||||
if (!is_file(__DIR__."/../usr/conf/manifest.json")) {
|
||||
$results[] = array('type'=>'critical', 'message'=>'manifest.json is missing');
|
||||
if (!is_file(__DIR__."/../usr/conf/msg.json")) {
|
||||
$results[] = array('type'=>'warning', 'message'=>'msg.json is missing');
|
||||
}
|
||||
|
||||
if (!is_file(__DIR__."/../usr/conf/conf.json")) {
|
||||
if (is_file(__DIR__."/../usr/conf/manifest.json")) {
|
||||
$results[] = array('type'=>'critical', 'message'=>'manifest.json is deprecated, please rename it to conf.json');
|
||||
} else {
|
||||
$results[] = array('type'=>'critical', 'message'=>'conf.json is missing, using conf.default.json instead');
|
||||
}
|
||||
} else {
|
||||
$manifest = json_decode(file_get_contents(__DIR__."/../usr/conf/manifest.json"), true);
|
||||
$manifest = json_decode(file_get_contents(__DIR__."/../usr/conf/conf.json"), true);
|
||||
|
||||
if (empty($manifest['user_name']) || $manifest['user_name'] == "[your name]") {
|
||||
$results[] = array('type'=>'warning', 'message'=>'manifest.json is missing your name');
|
||||
$results[] = array('type'=>'warning', 'message'=>'conf.json is missing your name');
|
||||
}
|
||||
if ($manifest['upload']['rename_on_upload']) {
|
||||
if (empty($manifest['upload']['rename_to'])) {
|
||||
$results[] = array('type'=>'critical', 'message'=>'manifest.json doesnt know what to rename your files to');
|
||||
$results[] = array('type'=>'critical', 'message'=>'conf.json doesnt know what to rename your files to');
|
||||
} else {
|
||||
$rename_to = $manifest['upload']['rename_to'];
|
||||
$rename_rate = 0;
|
||||
|
@ -426,9 +434,9 @@ class Sanity {
|
|||
if (str_contains($rename_to, '{{username}}') || str_contains($rename_to, '{{userid}}')) $rename_rate += 1;
|
||||
|
||||
if ($rename_rate < 2) {
|
||||
$results[] = array('type'=>'critical', 'message'=>'You will encounter errors when uploading images due to filenames, update your manifest.json');
|
||||
$results[] = array('type'=>'critical', 'message'=>'You will encounter errors when uploading images due to filenames, update your conf.json');
|
||||
} elseif ($rename_rate < 5 && $rename_rate > 2) {
|
||||
$results[] = array('type'=>'warning', 'message'=>'You may encounter errors when uploading images due to filenames, concider modifying your manifest.json');
|
||||
$results[] = array('type'=>'warning', 'message'=>'You may encounter errors when uploading images due to filenames, concider modifying your conf.json');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,8 +5,8 @@ require_once dirname(__DIR__)."/app/conn.php";
|
|||
require_once dirname(__DIR__)."/app/app.php";
|
||||
require_once dirname(__DIR__)."/app/settings.php";
|
||||
|
||||
ini_set('post_max_size', $upload_conf['max_filesize']."M");
|
||||
ini_set('upload_max_filesize', ($upload_conf['upload_max'] + 1)."M");
|
||||
ini_set('post_max_size', $upload_conf['max_filesize']);
|
||||
ini_set('upload_max_filesize', $upload_conf['max_filesize']);
|
||||
|
||||
if ($user_settings['is_testing']) {
|
||||
ini_set('display_errors', 1);
|
||||
|
|
|
@ -8,7 +8,22 @@
|
|||
| the default background and accent colour
|
||||
|-------------------------------------------------------------
|
||||
*/
|
||||
$user_settings = json_decode(file_get_contents(__DIR__."/../usr/conf/manifest.json"), true);
|
||||
$user_settings = json_decode(file_get_contents(__DIR__."/../usr/conf/conf.json"), true);
|
||||
|
||||
if (!is_file(__DIR__."/../usr/conf/conf.json")) {
|
||||
$settings = json_decode(file_get_contents(__DIR__."/../usr/conf/conf.json"), true);
|
||||
} else {
|
||||
$settings = json_decode(file_get_contents(__DIR__."/../usr/conf.default.json"), true);
|
||||
}
|
||||
|
||||
if (!is_file(__DIR__."/../usr/conf/msg.json")) {
|
||||
$user_welcome = json_decode(file_get_contents(__DIR__."/../usr/conf/msg.json"), true);
|
||||
$user_welcome = $user_welcome['welcome'];
|
||||
} else {
|
||||
$user_welcome = array('Welcome to your new Only Legs installation! You can change this message in the settings page.');
|
||||
}
|
||||
|
||||
|
||||
$web_info = json_decode(file_get_contents(__DIR__."/app.json"), true);
|
||||
|
||||
$upload_conf = $user_settings["upload"];
|
Loading…
Add table
Add a link
Reference in a new issue