documentation + base58 fix
This commit is contained in:
@@ -1,15 +1,16 @@
|
||||
<?php
|
||||
|
||||
// ARO version
|
||||
define("VERSION", "0.2b");
|
||||
|
||||
// Amsterdam timezone by default, should probably be moved to config
|
||||
date_default_timezone_set("Europe/Amsterdam");
|
||||
|
||||
|
||||
|
||||
//error_reporting(E_ALL & ~E_NOTICE);
|
||||
error_reporting(0);
|
||||
ini_set('display_errors',"off");
|
||||
|
||||
|
||||
// not accessible directly
|
||||
if(php_sapi_name() !== 'cli'&&substr_count($_SERVER['PHP_SELF'],"/")>1){
|
||||
die("This application should only be run in the main directory /");
|
||||
}
|
||||
@@ -26,6 +27,8 @@ if($_config['db_pass']=="ENTER-DB-PASS") die("Please update your config file and
|
||||
// initial DB connection
|
||||
$db=new DB($_config['db_connect'],$_config['db_user'],$_config['db_pass'],0);
|
||||
if(!$db) die("Could not connect to the DB backend.");
|
||||
|
||||
// checks for php version and extensions
|
||||
if (!extension_loaded("openssl") && !defined("OPENSSL_KEYTYPE_EC")) api_err("Openssl php extension missing");
|
||||
if (!extension_loaded("gmp")) api_err("gmp php extension missing");
|
||||
if (!extension_loaded('PDO')) api_err("pdo php extension missing");
|
||||
@@ -47,10 +50,11 @@ foreach($query as $res){
|
||||
|
||||
|
||||
|
||||
|
||||
// nothing is allowed while in maintenance
|
||||
if($_config['maintenance']==1) api_err("under-maintenance");
|
||||
|
||||
|
||||
// update the db schema, on every git pull or initial install
|
||||
if(file_exists("tmp/db-update")){
|
||||
|
||||
$res=unlink("tmp/db-update");
|
||||
@@ -62,19 +66,22 @@ if(file_exists("tmp/db-update")){
|
||||
echo "Could not access the tmp/db-update file. Please give full permissions to this file\n";
|
||||
}
|
||||
|
||||
// something went wront with the db schema
|
||||
if($_config['dbversion']<2) exit;
|
||||
|
||||
// separate blockchain for testnet
|
||||
if($_config['testnet']==true) $_config['coin'].="-testnet";
|
||||
|
||||
// current hostname
|
||||
$hostname=(!empty($_SERVER['HTTPS'])?'https':'http')."://".$_SERVER['HTTP_HOST'];
|
||||
|
||||
if($hostname!=$_config['hostname']&&$_SERVER['HTTP_HOST']!="localhost"&&$_SERVER['HTTP_HOST']!="127.0.0.1"&&$_SERVER['hostname']!='::1'&&php_sapi_name() !== 'cli'){
|
||||
// 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",array(":hostname"=>$hostname));
|
||||
$_config['hostname']=$hostname;
|
||||
}
|
||||
if(empty($_config['hostname'])||$_config['hostname']=="http://"||$_config['hostname']=="https://") api_err("Invalid hostname");
|
||||
|
||||
|
||||
// run sanity
|
||||
$t=time();
|
||||
if($t-$_config['sanity_last']>$_config['sanity_interval']&& php_sapi_name() !== 'cli') system("php sanity.php > /dev/null 2>&1 &");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user