Add option to move data root

This commit is contained in:
Alexander Rosenberg 2024-09-15 01:13:02 -07:00
parent 97618f25c1
commit c1e725e891
Signed by: Zander671
GPG Key ID: 5FD0394ADBD72730
3 changed files with 15 additions and 2 deletions

View File

@ -2,6 +2,8 @@
/* Copyright (C) 2021 Alexander Rosenberg
* This file is AGPL v3. See LICENSE file for more information
*/
require 'options.php';
class Album {
private const PATH_PREFIX = 'albums';
private const THUMB_PREFIX = 'thumbnails';
@ -66,7 +68,8 @@ class Album {
}
function get_path() {
return $this::PATH_PREFIX . '/' . $this->name;
return AM_OPTIONS['root'] . '/' . $this::PATH_PREFIX . '/'
. $this->name;
}
function get_title() {

View File

@ -2,7 +2,9 @@
/* Copyright (C) 2021 Alexander Rosenberg
* This file is AGPL v3. See LICENSE file for more information
*/
const CONFIG_PATH = 'config.json';
require 'options.php';
const CONFIG_PATH = AM_OPTIONS[root] . '/config.json';
function display_error_message($msg, $html_tags = '') {
echo '<div ' . $html_tags . ' class=".error-message">' . htmlspecialchars($msg, ENT_QUOTES | ENT_HTML5) . '</div>';

8
root/options.php Normal file
View File

@ -0,0 +1,8 @@
<?php
/* Copyright (C) 2021 Alexander Rosenberg
* This file is AGPL v3. See LICENSE file for more information
*/
const AM_OPTIONS = [
"root" => "/path/to/root",
];
?>