]> jfr.im git - uguu.git/blob - static/php/classes/Core.php
changes
[uguu.git] / static / php / classes / Core.php
1 <?php
2 /*
3 * Uguu
4 *
5 * @copyright Copyright (c) 2022 Go Johansson (nekunekus) <neku@pomf.se> <github.com/nokonoko>
6 *
7 * This program is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program. If not, see <https://www.gnu.org/licenses/>.
19 */
20
21 namespace Core {
22
23 /**
24 * @property mixed $DB_CONN
25 */
26 class Settings
27 {
28
29 public $DB_MODE;
30 public $DB_PATH;
31 public $DB_USER;
32 public $DB_PASS;
33
34 public $LOG_IP;
35 public $ANTI_DUPE;
36 public $BLACKLIST_DB;
37 public $FILTER_MODE;
38
39 public $FILES_ROOT;
40 public $FILES_RETRIES;
41
42 public $SSL;
43 public $URL;
44
45 public $NAME_LENGTH;
46 public $ID_CHARSET;
47 public $BLOCKED_EXTENSIONS;
48 public $BLOCKED_MIME;
49 public $DOUBLE_DOTS;
50
51 public function __constructSettings()
52 {
53 $settings_array = json_decode(file_get_contents('/Users/go.johansson/PERSONAL_REPOS/Uguu/dist.json'), true);
54 $this->DB_MODE = $settings_array['DB_MODE'];
55 $this->DB_PATH = $settings_array['DB_PATH'];
56 $this->DB_USER = $settings_array['DB_USER'];
57 $this->DB_PASS = $settings_array['DB_PASS'];
58 $this->LOG_IP = $settings_array['LOG_IP'];
59 $this->ANTI_DUPE = $settings_array['ANTI_DUPE'];
60 $this->BLACKLIST_DB = $settings_array['BLACKLIST_DB'];
61 $this->FILTER_MODE = $settings_array['FILTER_MODE'];
62 $this->FILES_ROOT = $settings_array['FILES_ROOT'];
63 $this->FILES_RETRIES = $settings_array['FILES_RETRIES'];
64 $this->SSL = $settings_array['SSL'];
65 $this->URL = $settings_array['URL'];
66 $this->NAME_LENGTH = $settings_array['NAME_LENGTH'];
67 $this->ID_CHARSET = $settings_array['ID_CHARSET'];
68 $this->BLOCKED_EXTENSIONS = $settings_array['BLOCKED_EXTENSIONS'];
69 $this->BLOCKED_MIME = $settings_array['BLOCKED_MIME'];
70 $this->DOUBLE_DOTS = $settings_array['DOUBLE_DOTS'];
71 }
72 }
73
74 class Database extends Settings
75 {
76 public $DB;
77
78 public function __constructDB()
79 {
80 $this->DB = new PDO($this->DB_MODE.':'.$this->DB_PATH, $this->DB_USER, $this->DB_PASS);
81 }
82 }
83 }