config
This commit is contained in:
@@ -59,6 +59,20 @@ foreach ($query as $res) {
|
||||
$_config[$res['cfg']] = trim($res['val']);
|
||||
}
|
||||
|
||||
// current hostname
|
||||
$hostname = (!empty($_SERVER['HTTPS']) ? 'https' : 'http')."://".san_host($_SERVER['HTTP_HOST']);
|
||||
// set the hostname to the current one
|
||||
if ($hostname != $_config['hostname'] && $_SERVER['HTTP_HOST'] != "localhost" && $_SERVER['HTTP_HOST'] != "127.0.0.1" && $_SERVER['hostname'] != '::1' && php_sapi_name() !== 'cli' && ($_config['allow_hostname_change'] != false || empty($_config['hostname']))) {
|
||||
$db->run("UPDATE config SET val=:hostname WHERE cfg='hostname' LIMIT 1", [":hostname" => $hostname]);
|
||||
$_config['hostname'] = $hostname;
|
||||
}
|
||||
|
||||
// Getting extra configs from the database
|
||||
$query = $db->run("SELECT cfg, val FROM config");
|
||||
foreach ($query as $res) {
|
||||
$_config[$res['cfg']] = trim($res['val']);
|
||||
}
|
||||
|
||||
// nothing is allowed while in maintenance
|
||||
if ($_config['maintenance'] == 1) {
|
||||
api_err("under-maintenance");
|
||||
@@ -93,13 +107,7 @@ if ($_config['testnet'] == true) {
|
||||
$_config['coin'] .= "-testnet";
|
||||
}
|
||||
|
||||
// current hostname
|
||||
$hostname = (!empty($_SERVER['HTTPS']) ? 'https' : 'http')."://".san_host($_SERVER['HTTP_HOST']);
|
||||
// set the hostname to the current one
|
||||
if ($hostname != $_config['hostname'] && $_SERVER['HTTP_HOST'] != "localhost" && $_SERVER['HTTP_HOST'] != "127.0.0.1" && $_SERVER['hostname'] != '::1' && php_sapi_name() !== 'cli' && ($_config['allow_hostname_change'] != false || empty($_config['hostname']))) {
|
||||
$db->run("UPDATE config SET val=:hostname WHERE cfg='hostname' LIMIT 1", [":hostname" => $hostname]);
|
||||
$_config['hostname'] = $hostname;
|
||||
}
|
||||
|
||||
if (empty($_config['hostname']) || $_config['hostname'] == "http://" || $_config['hostname'] == "https://") {
|
||||
api_err("Invalid hostname");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user