-
Notifications
You must be signed in to change notification settings - Fork 1
/
initializations.php
executable file
·143 lines (128 loc) · 5.84 KB
/
initializations.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
<?php
if (!defined('NELLIEL_VERSION'))
{
die("NOPE.AVI");
}
if (ini_get('date.timezone') === '')
{
date_default_timezone_set('UTC');
}
define('ASSETS_DIR', 'assets');
define('STYLES_DIR', 'styles');
define('ICON_SETS_DIR', 'icon_sets');
define('IMAGES_DIR', 'imagez');
define('SCRIPTS_DIR', 'scripts');
if($_SERVER['SERVER_PORT'] != 80 && empty($_SERVER['HTTPS']))
{
define('BASE_DOMAIN', $_SERVER['SERVER_NAME'] . ':' . $_SERVER['SERVER_PORT']);
}
else
{
define('BASE_DOMAIN', $_SERVER['SERVER_NAME']);
}
define('MAIN_SCRIPT', 'imgboard.php');
define('MAIN_INDEX', 'index');
define('PAGE_EXT', '.html');
define('JSON_EXT', '.json');
define('ASSETS_TABLE', 'nelliel_assets');
define('BANS_TABLE', 'nelliel_bans');
define('BOARD_DATA_TABLE', 'nelliel_board_data');
define('BOARD_DEFAULTS_TABLE', 'nelliel_board_defaults');
define('CAPTCHA_TABLE', 'nelliel_captcha');
define('CITES_TABLE', 'nelliel_cites');
define('FILE_FILTERS_TABLE', 'nelliel_file_filters');
define('FILETYPES_TABLE', 'nelliel_filetypes');
define('LOGIN_ATTEMPTS_TABLE', 'nelliel_login_attempts');
define('NEWS_TABLE', 'nelliel_news');
define('PERMISSIONS_TABLE', 'nelliel_permissions');
define('REPORTS_TABLE', 'nelliel_reports');
define('ROLE_PERMISSIONS_TABLE', 'nelliel_role_permissions');
define('ROLES_TABLE', 'nelliel_roles');
define('SITE_CONFIG_TABLE', 'nelliel_site_config');
define('TEMPLATES_TABLE', 'nelliel_templates');
define('USER_ROLES_TABLE', 'nelliel_user_roles');
define('USERS_TABLE', 'nelliel_users');
define('VERSIONS_TABLE', 'nelliel_version');
define('CONFIG_FILE_PATH', BASE_PATH . 'configuration/');
define('CACHE_FILE_PATH', FILES_PATH . 'cache/');
define('TEMPLATES_FILE_PATH', FILES_PATH . 'templates/');
define('PLUGINS_FILE_PATH', FILES_PATH . 'plugins/');
define('LANGUAGES_FILE_PATH', FILES_PATH . 'languages/');
define('LOCALE_FILE_PATH', LANGUAGES_FILE_PATH . 'locale/');
define('STYLES_FILE_PATH', BASE_PATH . ASSETS_DIR . '/' . STYLES_DIR . '/');
define('ICON_SETS_FILE_PATH', BASE_PATH . ASSETS_DIR . '/' . ICON_SETS_DIR . '/');
define('WAT_FILE_PATH', INCLUDE_PATH . 'wat/');
define('SCRIPTS_WEB_PATH', ASSETS_DIR . '/' . SCRIPTS_DIR . '/');
define('IMAGES_WEB_PATH', ASSETS_DIR . '/' . IMAGES_DIR . '/');
define('STYLES_WEB_PATH', ASSETS_DIR . '/' . STYLES_DIR . '/');
define('ICON_SETS_WEB_PATH', ASSETS_DIR . '/' . ICON_SETS_DIR . '/');
define('BASE_WEB_PATH', pathinfo($_SERVER['PHP_SELF'], PATHINFO_DIRNAME) . '/');
define('SQLITE_DB_DEFAULT_PATH', FILES_PATH);
define('BASE_HONEYPOT_FIELD1', 'display_signature'); // Honeypot field name
define('BASE_HONEYPOT_FIELD2', 'signature'); // Honeypot field name
define('BASE_HONEYPOT_FIELD3', 'website'); // Honeypot field name
define('DEFAULT_TEXTDOMAIN_BIND', LANGUAGES_FILE_PATH . 'locale');
// Set default values here in case the config is missing something
$base_config['defaultadmin'] = '';
$base_config['defaultadmin_pass'] = '';
$base_config['tripcode_pepper'] = 'sodiumz';
$base_config['directory_perm'] = '0775';
$base_config['file_perm'] = '0664';
$base_config['use_internal_cache'] = true;
$base_config['default_locale'] = 'en_US';
$base_config['enable_plugins'] = true;
$base_config['secure_session_only'] = false;
$crypt_config['password_algorithm'] = 'BCRYPT';
$crypt_config['password_bcrypt_cost'] = 12;
$crypt_config['argon2_memory_cost'] = 1024;
$crypt_config['argon2_time_cost'] = 2;
$crypt_config['argon2_threads'] = 2;
require_once CONFIG_FILE_PATH . 'config.php';
define('DEFAULTADMIN', $base_config['defaultadmin']);
define('DEFAULTADMIN_PASS', $base_config['defaultadmin_pass']);
define('DIRECTORY_PERM', $base_config['directory_perm']);
define('FILE_PERM', $base_config['file_perm']);
define('USE_INTERNAL_CACHE', $base_config['use_internal_cache']);
define('USE_MUSTACHE_CACHE', $base_config['use_mustache_cache']);
define('DEFAULT_LOCALE', $base_config['default_locale']);
define('ENABLE_PLUGINS', $base_config['enable_plugins']);
define('SECURE_SESSION_ONLY', $base_config['secure_session_only']);
define('SQLTYPE', $db_config['sqltype']);
define('MYSQL_DB', $db_config['mysql_db']);
define('MYSQL_HOST', $db_config['mysql_host']);
define('MYSQL_PORT', $db_config['mysql_port']);
define('MYSQL_USER', $db_config['mysql_user']);
define('MYSQL_PASS', $db_config['mysql_pass']);
define('MYSQL_ENCODING', $db_config['mysql_encoding']);
define('MARIADB_DB', $db_config['mariadb_db']);
define('MARIADB_HOST', $db_config['mariadb_host']);
define('MARIADB_PORT', $db_config['mariadb_port']);
define('MARIADB_USER', $db_config['mariadb_user']);
define('MARIADB_PASS', $db_config['mariadb_pass']);
define('MARIADB_ENCODING', $db_config['mariadb_encoding']);
define('POSTGRESQL_DB', $db_config['postgresql_db']);
define('POSTGRESQL_HOST', $db_config['postgresql_host']);
define('POSTGRESQL_PORT', $db_config['postgresql_port']);
define('POSTGRESQL_USER', $db_config['postgresql_user']);
define('POSTGRESQL_PASS', $db_config['postgresql_password']);
define('POSTGRESQL_SCHEMA', $db_config['postgresql_schema']);
define('POSTGRESQL_ENCODING', $db_config['postgresql_encoding']);
define('SQLITE_DB_NAME', $db_config['sqlite_db_name']);
define('SQLITE_DB_PATH', $db_config['sqlite_db_path']);
define('SQLITE_ENCODING', $db_config['sqlite_encoding']);
define('NEL_PASSWORD_PREFERRED_ALGORITHM', $crypt_config['password_algorithm']);
define('NEL_PASSWORD_BCRYPT_COST', $crypt_config['password_bcrypt_cost']);
define('NEL_PASSWORD_ARGON2_MEMORY_COST', $crypt_config['password_argon2_memory_cost']);
define('NEL_PASSWORD_ARGON2_TIME_COST', $crypt_config['password_argon2_time_cost']);
define('NEL_PASSWORD_ARGON2_THREADS', $crypt_config['password_argon2_threads']);
$setup = new \Nelliel\Setup\Setup();
$setup->checkGenerated();
if(file_exists(CONFIG_FILE_PATH . 'generated.php'))
{
include_once CONFIG_FILE_PATH . 'generated.php';
define('TRIPCODE_PEPPER', $generated['tripcode_pepper']);
}
unset($generated);
unset($base_config);
unset($db_config);
unset($crypt_config);