commit
b284dfadbc
65
CHANGELOG.md
65
CHANGELOG.md
@ -1,4 +1,67 @@
|
||||
1.0.5 (XXX XXth XXXX)
|
||||
---------------------
|
||||
|
||||
* Fixed worker name scaling issues on mobile devices (Thanks @nrpatten)
|
||||
* Fixed user information table formatting (Thanks @pokari1986)
|
||||
* Fixed empty auto-payout threshold value for accounts page
|
||||
* Removed config disable check popup for admins on all pages
|
||||
* Added blockchain download status for admin feedback (admin setup check)
|
||||
* Added peer state to wallet info state if no peers are connected
|
||||
|
||||
1.0.4 (Jun 19th 2015)
|
||||
---------------------
|
||||
|
||||
* Honor anonymous attribute when sending block finder mails
|
||||
* Display admin warning if no transfer fees are set
|
||||
* Moved admin_checks.php into the admin panel/system/setup
|
||||
* Checks are now loaded individually from pages/admin/checks
|
||||
|
||||
1.0.3 (Apr 29th 2015)
|
||||
---------------------
|
||||
|
||||
* HOTFIX: Database upgrade from `1.0.0` to `1.0.1` did not work as
|
||||
intended
|
||||
|
||||
1.0.2 (Apr 28th 2015)
|
||||
---------------------
|
||||
|
||||
* Allow SSO accross MPOS pools
|
||||
* Added a new config options
|
||||
* `$config['db']['shared']['acounts']`, defaults to `$config['db']['name']`
|
||||
* `$config['db']['shared']['workers']`, defaults to `$config['db']['name']`
|
||||
* `$config['db']['shared']['news']`, defaults to `$config['db']['name']`
|
||||
* Will access `accounts`, `pool_workers` and `news` on shared table
|
||||
* Does not allow splitting `accounts` and `pool_woker` across database hosts
|
||||
* Required `$config['cookie']['domain']` to be set
|
||||
* You need to use the top domain shared between hosts as the setting
|
||||
* e.g. `ltc.thepool.com` and `btc.thepool.com` it has to be `.thepool.com` (NOTE the leading .)
|
||||
* Increased information on `Admin -> Wallet Info`
|
||||
* Added block count to Wallet Status
|
||||
* Added number of accounts to Wallet Status
|
||||
* Added Peer information
|
||||
* Added last 25 transactions
|
||||
* Can be changed via Admin System Settings -> Wallet
|
||||
* Always show all accounts
|
||||
* Updated Auto Payout Threshold to be stored in `coin_address` table
|
||||
* Existing thresholds will be migrated when upgrading
|
||||
* Update to `1.0.1` for the database using the upgrade script supplied in MPOS
|
||||
* Updated Bootstrap to 3.3.4
|
||||
* Updated MorrisJS to 0.5.1
|
||||
* Updated RaphaelJS to 2.1.2
|
||||
* Updated Bootstrap Switch to 3.3.2
|
||||
* Updated CLEditor to 1.4.5
|
||||
* Removed unneeded JS files
|
||||
* Removed unneeded CSS files
|
||||
* Fixed ding for block notifications not playing on Safari
|
||||
* Fixed manual payout warning to show when account balance is too low
|
||||
|
||||
1.0.1 (Apr 15th 2015)
|
||||
---------------------
|
||||
|
||||
* Updated jQuery and SoundJS
|
||||
* Removed unneeded JS files
|
||||
|
||||
1.0.0 (Jan 18th 2015)
|
||||
--------------------
|
||||
---------------------
|
||||
|
||||
* First (non-beta) public release of MPOS
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
[](https://travis-ci.org/MPOS/php-mpos) [](https://scrutinizer-ci.com/g/MPOS/php-mpos/?branch=master) [](https://scrutinizer-ci.com/g/MPOS/php-mpos/?branch=master) master<br />
|
||||
[](https://travis-ci.org/MPOS/php-mpos) [](https://codeclimate.com/github/MPOS/php-mpos) [](https://scrutinizer-ci.com/g/MPOS/php-mpos/?branch=master) [](https://scrutinizer-ci.com/g/MPOS/php-mpos/?branch=master) master<br />
|
||||
[](https://travis-ci.org/MPOS/php-mpos) [](https://scrutinizer-ci.com/g/MPOS/php-mpos/?branch=development) [](https://scrutinizer-ci.com/g/MPOS/php-mpos/?branch=development) development
|
||||
|
||||
|
||||
|
||||
@ -80,4 +80,3 @@ foreach ($aAllBlocks as $iIndex => $aBlock) {
|
||||
}
|
||||
|
||||
require_once('cron_end.inc.php');
|
||||
?>
|
||||
|
||||
@ -22,4 +22,3 @@ limitations under the License.
|
||||
$monitoring->endCronjob($cron_name, 'OK', 0, false, false);
|
||||
$monitoring->setStatus($cron_name . "_runtime", "time", microtime(true) - $cron_start[$cron_name]);
|
||||
$monitoring->setStatus($cron_name . "_endtime", "date", time());
|
||||
?>
|
||||
|
||||
@ -157,8 +157,12 @@ if (empty($aAllBlocks)) {
|
||||
// Notify users
|
||||
$aAccounts = $notification->getNotificationAccountIdByType('new_block');
|
||||
if (is_array($aAccounts)) {
|
||||
|
||||
$finder = $user->getUserName($iAccountId);
|
||||
if ($user->getUserNameAnon($iAccountId) == 1) {
|
||||
$finder = "Anonymous";
|
||||
} else {
|
||||
$finder = $user->getUserName($iAccountId);
|
||||
}
|
||||
|
||||
foreach ($aAccounts as $aData) {
|
||||
$aMailData['height'] = $aBlock['height'];
|
||||
$aMailData['subject'] = 'New Block';
|
||||
@ -178,4 +182,3 @@ if (empty($aAllBlocks)) {
|
||||
}
|
||||
|
||||
require_once('cron_end.inc.php');
|
||||
?>
|
||||
|
||||
@ -75,4 +75,3 @@ if ($setting->getValue('notifications_disable_idle_worker') != 1) {
|
||||
}
|
||||
|
||||
require_once('cron_end.inc.php');
|
||||
?>
|
||||
|
||||
@ -289,4 +289,3 @@ foreach ($aAllBlocks as $iIndex => $aBlock) {
|
||||
}
|
||||
|
||||
require_once('cron_end.inc.php');
|
||||
?>
|
||||
|
||||
@ -200,4 +200,3 @@ if ($aAllBlocks = $block->getAllUnaccounted('ASC')) {
|
||||
$log->logInfo("Completed PPS Payout");
|
||||
|
||||
require_once('cron_end.inc.php');
|
||||
?>
|
||||
|
||||
@ -169,4 +169,3 @@ foreach ($aAllBlocks as $iIndex => $aBlock) {
|
||||
}
|
||||
|
||||
require_once('cron_end.inc.php');
|
||||
?>
|
||||
|
||||
@ -87,5 +87,3 @@ if ($setting->getValue('DB_VERSION') != DB_VERSION || $config['version'] != CONF
|
||||
$log->logFatal('Cronjob is currently disabled due to required upgrades. Import any outstanding SQL files and check your configuration file.');
|
||||
$monitoring->endCronjob($cron_name, 'E0075', 0, true, false);
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
@ -55,4 +55,3 @@ $statistics->getCurrentHashrate() ? $status = 'OK' : $status = 'ERROR';
|
||||
$log->logInfo(sprintf($strLogMask, 'getTopContributors(shares)', number_format(microtime(true) - $start, 3), $status));
|
||||
|
||||
require_once('cron_end.inc.php');
|
||||
?>
|
||||
|
||||
@ -89,4 +89,3 @@ $log->logInfo(sprintf($strLogMask, 'purgeUserStats', $affected, number_format(mi
|
||||
|
||||
// Cron cleanup and monitoring
|
||||
require_once('cron_end.inc.php');
|
||||
?>
|
||||
|
||||
@ -76,4 +76,3 @@ if ($api_keys = $setting->getValue('monitoring_uptimerobot_api_keys')) {
|
||||
$log->logInfo(sprintf($strLogMask, 'Uptime Robot', 'n/a', number_format(microtime(true) - $start, 3), $status, $message));
|
||||
|
||||
require_once('cron_end.inc.php');
|
||||
?>
|
||||
|
||||
@ -1,152 +0,0 @@
|
||||
<?php
|
||||
$defflip = (!cfip()) ? exit(header('HTTP/1.1 401 Unauthorized')) : 1;
|
||||
|
||||
if (@$_SESSION['USERDATA']['is_admin'] && $user->isAdmin(@$_SESSION['USERDATA']['id'])) {
|
||||
if (!include_once(INCLUDE_DIR . '/lib/jsonRPCClient.php')) die('Unable to load libs');
|
||||
$notice = array();
|
||||
$enotice = array();
|
||||
$error = array();
|
||||
|
||||
// setup some basic stuff for checking - getuid/getpwuid not available on mac/windows
|
||||
$apache_user = 'unknown';
|
||||
if (substr_count(strtolower(PHP_OS), 'nix') > 0 || substr_count(strtolower(PHP_OS), 'linux') > 0) {
|
||||
$apache_user = (function_exists('posix_getuid')) ? posix_getuid() : 'unknown';
|
||||
$apache_user = (function_exists('posix_getpwuid')) ? posix_getpwuid($apache_user) : $apache_user;
|
||||
}
|
||||
|
||||
// setup checks
|
||||
// logging
|
||||
if ($config['logging']['enabled']) {
|
||||
if (!is_writable($config['logging']['path'])) {
|
||||
$error[] = "Logging is enabled but we can't write in the logfile path";
|
||||
}
|
||||
}
|
||||
|
||||
// check if memcache isn't available but enabled in config -> error
|
||||
if (!class_exists('Memcached') && $config['memcache']['enabled']) {
|
||||
$error[] = "You have memcached enabled in your config and it's not available as a PHP module. Install the package on your system.";
|
||||
}
|
||||
|
||||
// if it's not enabled, test it if it exists, if it works -> error tell them to enable, -> otherwise notice it's disabled
|
||||
if (!$config['memcache']['enabled']) {
|
||||
if (PHP_OS == 'WINNT') {
|
||||
require_once(CLASS_DIR . 'memcached.class.php');
|
||||
}
|
||||
if (class_exists('Memcached')) {
|
||||
$memcache_test = @new Memcached();
|
||||
if ($config['memcache']['sasl'] === true) {
|
||||
$memcache_test->setOption(Memcached::OPT_BINARY_PROTOCOL, true);
|
||||
$memcache_test->setSaslAuthData($config['memcache']['sasl']['username'], $config['memcache']['sasl']['password']);
|
||||
}
|
||||
$memcache_test_add = @$memcache_test->addServer($config['memcache']['host'], $config['memcache']['port']);
|
||||
$randmctv = rand(5,10);
|
||||
$memcache_test_set = @$memcache_test->set('test_mpos_setval', $randmctv);
|
||||
$memcache_test_get = @$memcache_test->get('test_mpos_setval');
|
||||
}
|
||||
if (class_exists('Memcached') && $memcache_test_get == $randmctv) {
|
||||
$error[] = "You have memcache disabled in the config but it's available and works! Enable it for best performance.";
|
||||
} else {
|
||||
$notice[] = "Memcache is disabled; Almost every linux distro has packages for it, you should be using it if you can.";
|
||||
}
|
||||
}
|
||||
|
||||
// check if htaccess exists
|
||||
if (!file_exists(BASEPATH.".htaccess")) {
|
||||
$htaccess_link = "<a href='https://github.com/MPOS/php-mpos/blob/next/public/.htaccess'>.htaccess</a>";
|
||||
$notice[] = "You don't seem to have a .htaccess in your public folder, if you're using Apache set it up: $htaccess_link";
|
||||
}
|
||||
|
||||
// check if we can write templates/cache and templates/compile -> error
|
||||
if (!is_writable(TEMPLATE_DIR . '/cache')) {
|
||||
$error[] = "templates/cache folder is not writable for uid {$apache_user['name']}";
|
||||
}
|
||||
if (!is_writable(TEMPLATE_DIR . '/compile')) {
|
||||
$error[] = "templates/compile folder is not writable for uid {$apache_user['name']}";
|
||||
}
|
||||
|
||||
// check if we can write the config files, we should NOT be able to -> error
|
||||
if (is_writable(INCLUDE_DIR.'/config/global.inc.php') || is_writable(INCLUDE_DIR.'/config/global.inc.dist.php') ||
|
||||
is_writable(INCLUDE_DIR.'/config/security.inc.php') || is_writable(INCLUDE_DIR.'/config/security.inc.dist.php')) {
|
||||
$error[] = "Your config files <b>SHOULD NOT be writable to this user</b>!";
|
||||
}
|
||||
|
||||
// check if daemon can connect -> error
|
||||
try {
|
||||
if ($bitcoin->can_connect() !== true) {
|
||||
$error[] = "Unable to connect to coin daemon using provided credentials";
|
||||
}
|
||||
else {
|
||||
// validate that the wallet service is not in test mode
|
||||
if ($bitcoin->is_testnet() == true) {
|
||||
$error[] = "The coin daemon service is running as a testnet. Check the TESTNET setting in your coin daemon config and make sure the correct port is set in the MPOS config.";
|
||||
}
|
||||
|
||||
// if coldwallet is not empty, check if the address is valid -> error
|
||||
if (!empty($config['coldwallet']['address'])) {
|
||||
if (!$bitcoin->validateaddress($config['coldwallet']['address']))
|
||||
$error[] = "Your cold wallet address is <u>SET and INVALID</u>";
|
||||
}
|
||||
|
||||
// check if there is more than one account set on wallet
|
||||
$accounts = $bitcoin->listaccounts();
|
||||
if (count($accounts) > 1 && $accounts[''] <= 0) {
|
||||
$error[] = "There are " . count($accounts) . " Accounts set in local Wallet and Default Account has no liquid funds to pay your miners!";
|
||||
}
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
}
|
||||
// check anti DOS protection, we need memcache for that
|
||||
if ($config['mc_antidos'] && !$config['memcache']['enabled']) {
|
||||
$error[] = "mc_antidos is enabled and memcache is not, <u>memcache is required</u> to use this";
|
||||
}
|
||||
|
||||
// poke stratum using gettingstarted details -> enotice
|
||||
if (function_exists('socket_create')) {
|
||||
$host = @gethostbyname($config['gettingstarted']['stratumurl']);
|
||||
$port = $config['gettingstarted']['stratumport'];
|
||||
|
||||
if (isset($host) and
|
||||
isset($port) and
|
||||
($socket=socket_create(AF_INET, SOCK_STREAM, SOL_TCP)) and
|
||||
(socket_set_option($socket, SOL_SOCKET, SO_SNDTIMEO, array('sec' => 3, 'usec' => 0))) and
|
||||
(@socket_connect($socket, $host, $port)))
|
||||
{
|
||||
socket_close($socket);
|
||||
} else {
|
||||
$enotice[] = 'We tried to poke your Stratum server using your $config[\'gettingstarted\'] settings but it didn\'t respond - ' . socket_strerror(socket_last_error());
|
||||
}
|
||||
} else {
|
||||
// Connect via fsockopen as fallback
|
||||
if (! $fp = @fsockopen($config['gettingstarted']['stratumurl'], $config['gettingstarted']['stratumport'], $errCode, $errStr, 1)) {
|
||||
$enotice[] = 'We tried to poke your Stratum server using your $config[\'gettingstarted\'] settings but it didn\'t respond';
|
||||
}
|
||||
@fclose($fp);
|
||||
}
|
||||
|
||||
// security checks
|
||||
// salts too short -> notice, salts default -> error
|
||||
if ((strlen($config['SALT']) < 24) || (strlen($config['SALTY']) < 24) || $config['SALT'] == 'PLEASEMAKEMESOMETHINGRANDOM' || $config['SALTY'] == 'THISSHOULDALSOBERRAANNDDOOM') {
|
||||
if ($config['SALT'] == 'PLEASEMAKEMESOMETHINGRANDOM' || $config['SALTY'] == 'THISSHOULDALSOBERRAANNDDOOM') {
|
||||
$error[] = "You absolutely <u>SHOULD NOT leave your SALT or SALTY default</u> changing them will require registering again";
|
||||
} else {
|
||||
$notice[] = "SALT or SALTY is too short, they should be more than 24 characters and changing them will require registering again";
|
||||
}
|
||||
}
|
||||
|
||||
// display the errors
|
||||
foreach ($enotice as $en) {
|
||||
$_SESSION['POPUP'][] = array('CONTENT' => $en, 'TYPE' => 'alert alert-info');
|
||||
}
|
||||
if (!count($notice) && !count($error)) {
|
||||
$_SESSION['POPUP'][] = array('CONTENT' => 'The config options we checked seem OK', 'TYPE' => 'alert alert-success');
|
||||
} else {
|
||||
foreach ($notice as $n) {
|
||||
$_SESSION['POPUP'][] = array('CONTENT' => $n, 'TYPE' => 'alert alert-warning');
|
||||
}
|
||||
foreach ($error as $e) {
|
||||
$_SESSION['POPUP'][] = array('CONTENT' => $e, 'TYPE' => 'alert alert-danger');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
@ -80,5 +80,3 @@ require_once(CLASS_DIR . '/news.class.php');
|
||||
require_once(CLASS_DIR . '/api.class.php');
|
||||
require_once(INCLUDE_DIR . '/lib/Michelf/Markdown.php');
|
||||
require_once(INCLUDE_DIR . '/lib/scrypt.php');
|
||||
|
||||
?>
|
||||
|
||||
@ -14,6 +14,16 @@ $quickstartlink = "<a href='https://github.com/MPOS/php-mpos/wiki/Quick-Start-Gu
|
||||
if (!include_once(INCLUDE_DIR . '/config/global.inc.dist.php')) die('Unable to load base global config from ['.INCLUDE_DIR. '/config/global.inc.dist.php' . '] - '.$quickstartlink);
|
||||
if (!@include_once(INCLUDE_DIR . '/config/global.inc.php')) die('Unable to load your global config from ['.INCLUDE_DIR. '/config/global.inc.php' . '] - '.$quickstartlink);
|
||||
|
||||
// Check for a shared account database and set to default DB if unset
|
||||
if (!isset($config['db']['shared']['accounts']))
|
||||
$config['db']['shared']['accounts'] = $config['db']['name'];
|
||||
// Check for a shared worker database and set to default DB if unset
|
||||
if (!isset($config['db']['shared']['workers']))
|
||||
$config['db']['shared']['workers'] = $config['db']['name'];
|
||||
// Check for a shared news database and set to default DB if unset
|
||||
if (!isset($config['db']['shared']['news']))
|
||||
$config['db']['shared']['news'] = $config['db']['name'];
|
||||
|
||||
// load our security configs
|
||||
if (!include_once(INCLUDE_DIR . '/config/security.inc.dist.php')) die('Unable to load base security config from ['.INCLUDE_DIR. '/config/security.inc.dist.php' . '] - '.$quickstartlink);
|
||||
if (@file_exists(INCLUDE_DIR . '/config/security.inc.php')) include_once(INCLUDE_DIR . '/config/security.inc.php');
|
||||
@ -43,5 +53,3 @@ $master_template = 'master.tpl';
|
||||
// Load Classes, they name defines the $ variable used
|
||||
// We include all needed files here, even though our templates could load them themself
|
||||
require_once(INCLUDE_DIR . '/autoloader.inc.php');
|
||||
|
||||
?>
|
||||
|
||||
@ -284,4 +284,3 @@ class Base {
|
||||
return $array;
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
@ -66,6 +66,19 @@ class BitcoinWrapper extends BitcoinClient {
|
||||
$dDifficulty = $this->getdifficulty();
|
||||
return $this->memcache->setCache(__FUNCTION__, $dDifficulty * pow(2,32) / $iCurrentPoolHashrate, 30);
|
||||
}
|
||||
public function getblockchaindownload() {
|
||||
$aPeerInfo = $this->getpeerinfo();
|
||||
$aInfo = $this->getinfo();
|
||||
$iStartingHeight = 0;
|
||||
foreach ($aPeerInfo as $aPeerData) {
|
||||
if ($iStartingHeight < $aPeerData['startingheight']) $iStartingHeight = $aPeerData['startingheight'];
|
||||
}
|
||||
if ($iStartingHeight > $aInfo['blocks']) {
|
||||
return number_format(round($aInfo['blocks'] / $iStartingHeight * 100, 2), 2);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
public function getnetworkhashps() {
|
||||
$this->oDebug->append("STA " . __METHOD__, 4);
|
||||
if ($data = $this->memcache->get(__FUNCTION__)) return $data;
|
||||
|
||||
@ -3,7 +3,17 @@ $defflip = (!cfip()) ? exit(header('HTTP/1.1 401 Unauthorized')) : 1;
|
||||
|
||||
class CoinAddress extends Base {
|
||||
protected $table = 'coin_addresses';
|
||||
private $cache = array();
|
||||
|
||||
/**
|
||||
* We allow changing the database for shared accounts across pools
|
||||
* Load the config on construct so we can assign the DB name
|
||||
* @param config array MPOS configuration
|
||||
* @return none
|
||||
**/
|
||||
public function __construct($config) {
|
||||
$this->setConfig($config);
|
||||
$this->table = $this->config['db']['shared']['accounts'] . '.' . $this->table;
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetch users coin address for a currency
|
||||
@ -27,6 +37,29 @@ class CoinAddress extends Base {
|
||||
return $this->sqlError();
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetch users Auto Payout Threshold for a currency
|
||||
* @param UserID int UserID
|
||||
* @return mixed Float value for threshold, false on error
|
||||
**/
|
||||
public function getAPThreshold($userID, $currency=NULL) {
|
||||
if ($currency === NULL) $currency = $this->config['currency'];
|
||||
$this->debug->append("STA " . __METHOD__, 4);
|
||||
$stmt = $this->mysqli->prepare("
|
||||
SELECT ap_threshold
|
||||
FROM " . $this->getTableName() . "
|
||||
WHERE account_id = ? AND currency = ?
|
||||
");
|
||||
if ( $this->checkStmt($stmt) && $stmt->bind_param('is', $userID, $currency) && $stmt->execute() && $result = $stmt->get_result()) {
|
||||
if ($result->num_rows == 1) {
|
||||
return $result->fetch_object()->ap_threshold;
|
||||
}
|
||||
}
|
||||
$this->debug->append("Unable to fetch users auto payout threshold for " . $currency);
|
||||
return $this->sqlError();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Check if a coin address is already set
|
||||
* @param address string Coin Address to check for
|
||||
@ -76,23 +109,24 @@ class CoinAddress extends Base {
|
||||
* Update a coin address record for a user and a currency
|
||||
* @param userID int Account ID
|
||||
* @param address string Coin Address
|
||||
* @param ap_threshold float Threshold for auto payouts for this currency
|
||||
* @param currency string Currency short handle, defaults to config option
|
||||
* @return bool true or false
|
||||
**/
|
||||
public function update($userID, $address, $currency=NULL) {
|
||||
public function update($userID, $address, $ap_threshold, $currency=NULL) {
|
||||
if ($currency === NULL) $currency = $this->config['currency'];
|
||||
if ($address != $this->getCoinAddress($userID) && $this->existsCoinAddress($address)) {
|
||||
$this->setErrorMessage('Unable to update coin address, address already exists');
|
||||
return false;
|
||||
}
|
||||
if ($this->getCoinAddress($userID) != NULL) {
|
||||
$stmt = $this->mysqli->prepare("UPDATE " . $this->getTableName() . " SET coin_address = ? WHERE account_id = ? AND currency = ?");
|
||||
if ( $this->checkStmt($stmt) && $stmt->bind_param('sis', $address, $userID, $currency) && $stmt->execute()) {
|
||||
$stmt = $this->mysqli->prepare("UPDATE " . $this->getTableName() . " SET coin_address = ?, ap_threshold = ? WHERE account_id = ? AND currency = ?");
|
||||
if ( $this->checkStmt($stmt) && $stmt->bind_param('sdis', $address, $ap_threshold, $userID, $currency) && $stmt->execute()) {
|
||||
return true;
|
||||
}
|
||||
} else {
|
||||
$stmt = $this->mysqli->prepare("INSERT INTO " . $this->getTableName() . " (coin_address, account_id, currency) VALUES (?, ?, ?)");
|
||||
if ( $this->checkStmt($stmt) && $stmt->bind_param('sis', $address, $userID, $currency) && $stmt->execute()) {
|
||||
$stmt = $this->mysqli->prepare("INSERT INTO " . $this->getTableName() . " (coin_address, ap_threshold, account_id, currency) VALUES (?, ?, ?, ?)");
|
||||
if ( $this->checkStmt($stmt) && $stmt->bind_param('sdis', $address, $ap_threshold, $userID, $currency) && $stmt->execute()) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@ -100,8 +134,7 @@ class CoinAddress extends Base {
|
||||
}
|
||||
}
|
||||
|
||||
$coin_address = new CoinAddress();
|
||||
$coin_address = new CoinAddress($config);
|
||||
$coin_address->setDebug($debug);
|
||||
$coin_address->setConfig($config);
|
||||
$coin_address->setMysql($mysqli);
|
||||
$coin_address->setErrorCodes($aErrorCodes);
|
||||
|
||||
@ -85,5 +85,3 @@ class CoinBase extends Base {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
@ -9,5 +9,3 @@ $defflip = (!cfip()) ? exit(header('HTTP/1.1 401 Unauthorized')) : 1;
|
||||
class Coin extends CoinBase {
|
||||
protected $target_bits = 16;
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
@ -12,5 +12,3 @@ $defflip = (!cfip()) ? exit(header('HTTP/1.1 401 Unauthorized')) : 1;
|
||||
class Coin extends CoinBase {
|
||||
protected $target_bits = 16;
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
@ -10,5 +10,3 @@ class Coin extends CoinBase {
|
||||
protected $target_bits = 32;
|
||||
protected $coin_value_precision = 20;
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
@ -10,5 +10,3 @@ class Coin extends CoinBase {
|
||||
protected $target_bits = 24;
|
||||
protected $share_difficulty_precision = 4;
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
@ -104,4 +104,3 @@ $csrftoken->setUser($user);
|
||||
$csrftoken->setToken($oToken);
|
||||
$csrftoken->setConfig($config);
|
||||
$csrftoken->setErrorCodes($aErrorCodes);
|
||||
?>
|
||||
|
||||
@ -111,4 +111,3 @@ class Debug {
|
||||
|
||||
// Instantiate this class
|
||||
$debug = new Debug($log, $config['DEBUG']);
|
||||
?>
|
||||
|
||||
@ -139,4 +139,3 @@ $invitation->setUser($user);
|
||||
$invitation->setToken($oToken);
|
||||
$invitation->setConfig($config);
|
||||
$invitation->setErrorCodes($aErrorCodes);
|
||||
?>
|
||||
|
||||
@ -57,4 +57,3 @@ class Logger {
|
||||
}
|
||||
}
|
||||
$log = new Logger($config);
|
||||
?>
|
||||
|
||||
@ -117,4 +117,3 @@ $mail->setSmarty($smarty);
|
||||
$mail->setConfig($config);
|
||||
$mail->setSetting($setting);
|
||||
$mail->setErrorCodes($aErrorCodes);
|
||||
?>
|
||||
|
||||
@ -81,5 +81,3 @@ class MemcacheAntiDos
|
||||
return $new;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
@ -4,6 +4,17 @@ $defflip = (!cfip()) ? exit(header('HTTP/1.1 401 Unauthorized')) : 1;
|
||||
class News extends Base {
|
||||
protected $table = 'news';
|
||||
|
||||
/**
|
||||
* We allow changing the database for shared accounts across pools
|
||||
* Load the config on construct so we can assign the DB name
|
||||
* @param config array MPOS configuration
|
||||
* @return none
|
||||
**/
|
||||
public function __construct($config) {
|
||||
$this->setConfig($config);
|
||||
$this->table = $this->config['db']['shared']['news'] . '.' . $this->table;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get activation status of post
|
||||
* @param id int News ID
|
||||
@ -96,9 +107,8 @@ class News extends Base {
|
||||
}
|
||||
}
|
||||
|
||||
$news = new News();
|
||||
$news = new News($config);
|
||||
$news->setDebug($debug);
|
||||
$news->setMysql($mysqli);
|
||||
$news->setUser($user);
|
||||
$news->setErrorCodes($aErrorCodes);
|
||||
?>
|
||||
|
||||
@ -195,4 +195,3 @@ $notification->setSmarty($smarty);
|
||||
$notification->setConfig($config);
|
||||
$notification->setSetting($setting);
|
||||
$notification->setErrorCodes($aErrorCodes);
|
||||
?>
|
||||
|
||||
@ -67,5 +67,3 @@ $oPayout->setMysql($mysqli);
|
||||
$oPayout->setConfig($config);
|
||||
$oPayout->setToken($oToken);
|
||||
$oPayout->setErrorCodes($aErrorCodes);
|
||||
|
||||
?>
|
||||
|
||||
@ -2,11 +2,6 @@
|
||||
$defflip = (!cfip()) ? exit(header('HTTP/1.1 401 Unauthorized')) : 1;
|
||||
|
||||
class RoundStats extends Base {
|
||||
private $tableTrans = 'transactions';
|
||||
private $tableStats = 'statistics_shares';
|
||||
private $tableBlocks = 'blocks';
|
||||
private $tableUsers = 'accounts';
|
||||
|
||||
/**
|
||||
* Get next block for round stats
|
||||
**/
|
||||
@ -79,7 +74,7 @@ class RoundStats extends Base {
|
||||
b.id, height, blockhash, amount, confirmations, difficulty, FROM_UNIXTIME(time) as time, shares,
|
||||
IF(a.is_anonymous, 'anonymous', a.username) AS finder,
|
||||
ROUND(difficulty * POW(2, 32 - " . $this->coin->getTargetBits() . "), 0) AS estshares,
|
||||
(time - (SELECT time FROM $this->tableBlocks WHERE height < ? ORDER BY height DESC LIMIT 1)) AS round_time
|
||||
(time - (SELECT time FROM " . $this->block->getTableName() . " WHERE height < ? ORDER BY height DESC LIMIT 1)) AS round_time
|
||||
FROM " . $this->block->getTableName() . " as b
|
||||
LEFT JOIN " . $this->user->getTableName() . " AS a ON b.account_id = a.id
|
||||
WHERE b.height = ? LIMIT 1");
|
||||
|
||||
@ -927,4 +927,3 @@ $statistics->setConfig($config);
|
||||
$statistics->setBitcoin($bitcoin);
|
||||
$statistics->setErrorCodes($aErrorCodes);
|
||||
$statistics->setCoin($coin);
|
||||
?>
|
||||
|
||||
@ -35,5 +35,3 @@ class mysqli_strict extends mysqli {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
@ -77,10 +77,14 @@ class Tools extends Base {
|
||||
return 'btce';
|
||||
} else if (preg_match('/cryptsy.com/', $url)) {
|
||||
return 'cryptsy';
|
||||
} else if (preg_match('/cryptopia.co.nz/', $url)) {
|
||||
return 'cryptopia';
|
||||
} else if (preg_match('/cryptorush.in/', $url)) {
|
||||
return 'cryptorush';
|
||||
} else if (preg_match('/mintpal.com/', $url)) {
|
||||
return 'mintpal';
|
||||
} else if (preg_match('/c-cex.com/', $url)) {
|
||||
return 'c-cex';
|
||||
} else if (preg_match('/bittrex.com/', $url)) {
|
||||
return 'bittrex';
|
||||
}
|
||||
@ -112,13 +116,19 @@ class Tools extends Base {
|
||||
case 'cryptsy':
|
||||
return @$aData['return']['markets'][$strCurrency]['lasttradeprice'];
|
||||
break;
|
||||
case 'cryptopia':
|
||||
return @$aData['Data']['LastPrice'];
|
||||
break;
|
||||
case 'cryptorush':
|
||||
return @$aData["$strCurrency/" . $this->config['price']['currency']]['last_trade'];
|
||||
break;
|
||||
case 'mintpal':
|
||||
return @$aData['0']['last_price'];
|
||||
break;
|
||||
case 'bittrex':
|
||||
case 'c-cex':
|
||||
return @$aData['ticker']['lastprice'];
|
||||
break;
|
||||
case 'bittrex':
|
||||
return @$aData['result']['Last'];
|
||||
break;
|
||||
}
|
||||
|
||||
@ -355,7 +355,7 @@ class Transaction extends Base {
|
||||
SELECT
|
||||
a.id,
|
||||
a.username,
|
||||
a.ap_threshold,
|
||||
ca.ap_threshold,
|
||||
ca.coin_address,
|
||||
IFNULL(
|
||||
(
|
||||
@ -371,9 +371,9 @@ class Transaction extends Base {
|
||||
ON t.account_id = a.id
|
||||
LEFT JOIN " . $this->coin_address->getTableName() . " AS ca
|
||||
ON ca.account_id = a.id
|
||||
WHERE t.archived = 0 AND a.ap_threshold > 0 AND ca.coin_address IS NOT NULL AND ca.coin_address != '' AND ca.currency = ?
|
||||
WHERE t.archived = 0 AND ca.ap_threshold > 0 AND ca.coin_address IS NOT NULL AND ca.coin_address != '' AND ca.currency = ?
|
||||
GROUP BY t.account_id
|
||||
HAVING confirmed > a.ap_threshold AND confirmed > " . $this->config['txfee_auto'] . "
|
||||
HAVING confirmed > ca.ap_threshold AND confirmed > " . $this->config['txfee_auto'] . "
|
||||
LIMIT ?");
|
||||
if ($this->checkStmt($stmt) && $stmt->bind_param('si', $this->config['currency'], $limit) && $stmt->execute() && $result = $stmt->get_result())
|
||||
return $result->fetch_all(MYSQLI_ASSOC);
|
||||
@ -446,7 +446,7 @@ class Transaction extends Base {
|
||||
SELECT
|
||||
a.id,
|
||||
a.username,
|
||||
a.ap_threshold,
|
||||
ca.ap_threshold,
|
||||
ca.coin_address,
|
||||
p.id AS payout_id,
|
||||
IFNULL(
|
||||
@ -488,4 +488,3 @@ $transaction->setBlock($block);
|
||||
$transaction->setUser($user);
|
||||
$transaction->setPayout($oPayout);
|
||||
$transaction->setErrorCodes($aErrorCodes);
|
||||
?>
|
||||
|
||||
@ -6,6 +6,17 @@ class User extends Base {
|
||||
private $userID = false;
|
||||
private $user = array();
|
||||
|
||||
/**
|
||||
* We allow changing the database for shared accounts across pools
|
||||
* Load the config on construct so we can assign the DB name
|
||||
* @param config array MPOS configuration
|
||||
* @return none
|
||||
**/
|
||||
public function __construct($config) {
|
||||
$this->setConfig($config);
|
||||
$this->table = $this->config['db']['shared']['accounts'] . '.' . $this->table;
|
||||
}
|
||||
|
||||
// get and set methods
|
||||
private function getHash($string, $version=0, $pepper='') {
|
||||
switch($version) {
|
||||
@ -20,6 +31,9 @@ class User extends Base {
|
||||
public function getUserName($id) {
|
||||
return $this->getSingle($id, 'username', 'id');
|
||||
}
|
||||
public function getUserNameAnon($id) {
|
||||
return $this->getSingle($id, 'is_anonymous', 'id');
|
||||
}
|
||||
public function getUserNameByEmail($email) {
|
||||
return $this->getSingle($email, 'username', 'email', 's');
|
||||
}
|
||||
@ -175,7 +189,7 @@ class User extends Base {
|
||||
return $result->fetch_all(MYSQLI_ASSOC);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Check user login
|
||||
* @param username string Username
|
||||
@ -340,11 +354,11 @@ class User extends Base {
|
||||
$this->debug->append("STA " . __METHOD__, 4);
|
||||
$stmt = $this->mysqli->prepare("
|
||||
SELECT
|
||||
a.id, a.username, ca.coin_address AS coin_address, a.ap_threshold
|
||||
a.id, a.username, ca.coin_address AS coin_address, ca.ap_threshold
|
||||
FROM " . $this->getTableName() . " AS a
|
||||
LEFT JOIN " . $this->coin_address->getTableName() . " AS ca
|
||||
ON a.id = ca.account_id
|
||||
WHERE ap_threshold > 0 AND ca.currency = ?
|
||||
WHERE ca.ap_threshold > 0 AND ca.currency = ?
|
||||
AND ca.coin_address IS NOT NULL
|
||||
");
|
||||
if ( $this->checkStmt($stmt) && $stmt->bind_param('s', $this->config['currency']) && $stmt->execute() && $result = $stmt->get_result()) {
|
||||
@ -544,12 +558,12 @@ class User extends Base {
|
||||
if ($email == 'hidden' || $email == NULL)
|
||||
$email = $this->getUserEmailById($userID);
|
||||
// We passed all validation checks so update the account
|
||||
$stmt = $this->mysqli->prepare("UPDATE $this->table SET ap_threshold = ?, donate_percent = ?, email = ?, timezone = ?, is_anonymous = ? WHERE id = ?");
|
||||
if ($this->checkStmt($stmt) && $stmt->bind_param('ddssii', $threshold, $donate, $email, $timezone, $is_anonymous, $userID) && $stmt->execute()) {
|
||||
$stmt = $this->mysqli->prepare("UPDATE $this->table SET donate_percent = ?, email = ?, timezone = ?, is_anonymous = ? WHERE id = ?");
|
||||
if ($this->checkStmt($stmt) && $stmt->bind_param('dssii', $donate, $email, $timezone, $is_anonymous, $userID) && $stmt->execute()) {
|
||||
$this->log->log("info", $this->getUserName($userID)." updated their account details");
|
||||
// Update coin address too
|
||||
// Update coin address and ap_threshold if coin_address is set
|
||||
if ($address) {
|
||||
if ($this->coin_address->update($userID, $address)) {
|
||||
if ($this->coin_address->update($userID, $address, $threshold)) {
|
||||
return true;
|
||||
}
|
||||
} else {
|
||||
@ -698,12 +712,14 @@ class User extends Base {
|
||||
$stmt = $this->mysqli->prepare("
|
||||
SELECT
|
||||
id AS id, username, pin, api_key, is_admin, is_anonymous, email, timezone, no_fees,
|
||||
IFNULL(donate_percent, '0') as donate_percent, ap_threshold
|
||||
IFNULL(donate_percent, '0') as donate_percent
|
||||
FROM " . $this->getTableName() . "
|
||||
WHERE id = ? LIMIT 0,1");
|
||||
if ($this->checkStmt($stmt) && $stmt->bind_param('i', $userID) && $stmt->execute() && $result = $stmt->get_result()) {
|
||||
$aData = $result->fetch_assoc();
|
||||
$aData['coin_address'] = $this->coin_address->getCoinAddress($userID);
|
||||
if (! $aData['ap_threshold'] = $this->coin_address->getAPThreshold($userID))
|
||||
$aData['ap_threshold'] = 0;
|
||||
$stmt->close();
|
||||
return $aData;
|
||||
}
|
||||
@ -983,13 +999,12 @@ public function isAuthenticated($logout=true) {
|
||||
}
|
||||
|
||||
// Make our class available automatically
|
||||
$user = new User();
|
||||
$user = new User($config);
|
||||
$user->setDebug($debug);
|
||||
$user->setLog($log);
|
||||
$user->setMysql($mysqli);
|
||||
$user->setSalt($config['SALT']);
|
||||
$user->setSmarty($smarty);
|
||||
$user->setConfig($config);
|
||||
$user->setMail($mail);
|
||||
$user->setToken($oToken);
|
||||
$user->setBitcoin($bitcoin);
|
||||
|
||||
@ -4,6 +4,17 @@ $defflip = (!cfip()) ? exit(header('HTTP/1.1 401 Unauthorized')) : 1;
|
||||
class Worker extends Base {
|
||||
protected $table = 'pool_worker';
|
||||
|
||||
/**
|
||||
* We allow changing the database for shared accounts across pools
|
||||
* Load the config on construct so we can assign the DB name
|
||||
* @param config array MPOS configuration
|
||||
* @return none
|
||||
**/
|
||||
public function __construct($config) {
|
||||
$this->setConfig($config);
|
||||
$this->table = $this->config['db']['shared']['workers'] . '.' . $this->table;
|
||||
}
|
||||
|
||||
/**
|
||||
* Update worker list for a user
|
||||
* @param account_id int User ID
|
||||
@ -294,13 +305,11 @@ class Worker extends Base {
|
||||
}
|
||||
}
|
||||
|
||||
$worker = new Worker();
|
||||
$worker = new Worker($config);
|
||||
$worker->setDebug($debug);
|
||||
$worker->setMysql($mysqli);
|
||||
$worker->setMemcache($memcache);
|
||||
$worker->setShare($share);
|
||||
$worker->setConfig($config);
|
||||
$worker->setUser($user);
|
||||
$worker->setErrorCodes($aErrorCodes);
|
||||
$worker->setCoin($coin);
|
||||
?>
|
||||
|
||||
@ -146,6 +146,13 @@ $aSettings['wallet'][] = array(
|
||||
'name' => 'wallet_cold_coins', 'value' => $setting->getValue('wallet_cold_coins'),
|
||||
'tooltip' => 'Amount of coins held in a pools cold wallet.'
|
||||
);
|
||||
$aSettings['wallet'][] = array(
|
||||
'display' => 'Transaction Limit', 'type' => 'text',
|
||||
'size' => 6,
|
||||
'default' => 25,
|
||||
'name' => 'wallet_transaction_limit', 'value' => $setting->getValue('wallet_transaction_limit'),
|
||||
'tooltip' => 'Maximum amount of transactions to list in Admin Wallet Info.'
|
||||
);
|
||||
$aSettings['statistics'][] = array(
|
||||
'display' => 'Ajax Refresh Interval', 'type' => 'select',
|
||||
'options' => array('5' => '5', '10' => '10', '15' => '15', '30' => '30', '60' => '60' ),
|
||||
@ -190,21 +197,21 @@ $aSettings['statistics'][] = array(
|
||||
);
|
||||
$aSettings['statistics'][] = array(
|
||||
'display' => 'Pool Hashrate Modifier', 'type' => 'select',
|
||||
'options' => array( '1' => 'KH/s', '0.001' => 'MH/s', '0.000001' => 'GH/s', '0.000000001' => 'TH/s' ),
|
||||
'options' => array( '1' => 'KH/s', '0.001' => 'MH/s', '0.000001' => 'GH/s', '0.000000001' => 'TH/s', '0.000000000001' => 'PH/s', '0.000000000000001' => 'EH/s' ),
|
||||
'default' => '1',
|
||||
'name' => 'statistics_pool_hashrate_modifier', 'value' => $setting->getValue('statistics_pool_hashrate_modifier'),
|
||||
'tooltip' => 'Auto-adjust displayed pool hashrates to a certain limit.'
|
||||
);
|
||||
$aSettings['statistics'][] = array(
|
||||
'display' => 'Network Hashrate Modifier', 'type' => 'select',
|
||||
'options' => array( '1' => 'KH/s', '0.001' => 'MH/s', '0.000001' => 'GH/s', '0.000000001' => 'TH/s' ),
|
||||
'options' => array( '1' => 'KH/s', '0.001' => 'MH/s', '0.000001' => 'GH/s', '0.000000001' => 'TH/s', '0.000000000001' => 'PH/s', '0.000000000000001' => 'EH/s' ),
|
||||
'default' => '1',
|
||||
'name' => 'statistics_network_hashrate_modifier', 'value' => $setting->getValue('statistics_network_hashrate_modifier'),
|
||||
'tooltip' => 'Auto-adjust displayed network hashrates to a certain limit.'
|
||||
);
|
||||
$aSettings['statistics'][] = array(
|
||||
'display' => 'Personal Hashrate Modifier', 'type' => 'select',
|
||||
'options' => array( '1' => 'KH/s', '0.001' => 'MH/s', '0.000001' => 'GH/s', '0.000000001' => 'TH/s' ),
|
||||
'options' => array( '1' => 'KH/s', '0.001' => 'MH/s', '0.000001' => 'GH/s', '0.000000001' => 'TH/s', '0.000000000001' => 'PH/s', '0.000000000000001' => 'EH/s' ),
|
||||
'default' => '1',
|
||||
'name' => 'statistics_personal_hashrate_modifier', 'value' => $setting->getValue('statistics_personal_hashrate_modifier'),
|
||||
'tooltip' => 'Auto-adjust displayed personal hashrates to a certain limit.'
|
||||
|
||||
@ -78,4 +78,3 @@ $aErrorCodes['E0079'] = 'Wallet does not cover payouts total amount';
|
||||
$aErrorCodes['E0080'] = 'No new unaccounted shares since last run';
|
||||
$aErrorCodes['E0081'] = 'Failed to insert new block into database';
|
||||
$aErrorCodes['E0082'] = 'Block does not supply any usable confirmation information';
|
||||
?>
|
||||
|
||||
@ -6,7 +6,7 @@ $defflip = (!cfip()) ? exit(header('HTTP/1.1 401 Unauthorized')) : 1;
|
||||
* Also the URL to check for the most recent upstream versions available
|
||||
* https://github.com/MPOS/php-mpos/wiki/Config-Setup#wiki-config-version
|
||||
**/
|
||||
$config['version'] = '1.0.0';
|
||||
$config['version'] = '1.0.1';
|
||||
$config['version_url'] = 'https://raw.githubusercontent.com/MPOS/php-mpos/master/include/version.inc.php';
|
||||
|
||||
/**
|
||||
@ -54,6 +54,11 @@ $config['db']['user'] = 'someuser';
|
||||
$config['db']['pass'] = 'somepass';
|
||||
$config['db']['port'] = 3306;
|
||||
$config['db']['name'] = 'mpos';
|
||||
// Disabled by default and set in bootstrap if unset, but left in here so
|
||||
// people know it exists
|
||||
// $config['db']['shared']['accounts'] = $config['db']['name'];
|
||||
// $config['db']['shared']['workers'] = $config['db']['name'];
|
||||
// $config['db']['shared']['news'] = $config['db']['name'];
|
||||
|
||||
/**
|
||||
* Local wallet RPC
|
||||
@ -297,5 +302,3 @@ $config['smarty']['cache_lifetime'] = 30;
|
||||
* https://github.com/MPOS/php-mpos/wiki/Config-Setup#wiki-system-load
|
||||
**/
|
||||
$config['system']['load']['max'] = 10.0;
|
||||
|
||||
?>
|
||||
|
||||
@ -4,4 +4,3 @@ $defflip = (!cfip()) ? exit(header('HTTP/1.1 401 Unauthorized')) : 1;
|
||||
define('STATISTICS_ALL_USER_SHARES', 'STATISTICS_ALL_USER_SHARES');
|
||||
define('STATISTICS_ALL_USER_HASHRATES', 'STATISTICS_ALL_USER_HASHRATES');
|
||||
define('STATISTICS_ROUND_SHARES', 'STATISTICS_ROUND_SHARES');
|
||||
?>
|
||||
|
||||
@ -11,5 +11,3 @@ switch ($config['payout_system']) {
|
||||
}
|
||||
|
||||
$aMonitorCrons = array('statistics','tickerupdate','notifications','tables_cleanup','findblock',$sPayoutSystem,'blockupdate','payouts');
|
||||
|
||||
?>
|
||||
|
||||
@ -59,5 +59,3 @@ $config['twofactor']['options']['changepw'] = true;
|
||||
**/
|
||||
$config['maxfailed']['login'] = 3;
|
||||
$config['maxfailed']['pin'] = 3;
|
||||
|
||||
?>
|
||||
|
||||
@ -17,5 +17,3 @@ if ($mysqli->query('/* MYSQLND_MS_MASTER_SWITCH */SELECT @@global.read_only AS r
|
||||
if (mysqli_connect_errno()) {
|
||||
die("Failed to connect to database");
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
@ -3091,4 +3091,3 @@ class _MarkdownExtra_TmpImpl extends \Michelf\Markdown {
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
|
||||
@ -35,6 +35,3 @@ class MarkdownExtra extends \Michelf\_MarkdownExtra_TmpImpl {
|
||||
# See note above.
|
||||
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
@ -272,6 +272,3 @@ function recaptcha_mailhide_html($pubkey, $privkey, $email) {
|
||||
"' onclick=\"window.open('" . htmlentities ($url) . "', '', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=500,height=300'); return false;\" title=\"Reveal this e-mail address\">...</a>@" . htmlentities ($emailparts [1]);
|
||||
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
|
||||
@ -532,5 +532,3 @@ function word_reverse($str) {
|
||||
}
|
||||
return $ret;
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
@ -31,4 +31,3 @@ function check_acl_access($params, $smarty)
|
||||
break;
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
@ -3,4 +3,3 @@ $defflip = (!cfip()) ? exit(header('HTTP/1.1 401 Unauthorized')) : 1;
|
||||
|
||||
// Tempalte specifics
|
||||
$smarty->assign("CONTENT", "default.tpl");
|
||||
?>
|
||||
|
||||
@ -3,4 +3,3 @@ $defflip = (!cfip()) ? exit(header('HTTP/1.1 401 Unauthorized')) : 1;
|
||||
|
||||
// Tempalte specifics
|
||||
$smarty->assign("CONTENT", "default.tpl");
|
||||
?>
|
||||
|
||||
@ -5,4 +5,3 @@ if ($user->isAuthenticated()) {
|
||||
// Tempalte specifics
|
||||
$smarty->assign("CONTENT", "default.tpl");
|
||||
}
|
||||
?>
|
||||
|
||||
@ -19,5 +19,3 @@ if ($user->isAuthenticated() AND !$setting->getValue('disable_transactionsummary
|
||||
} else {
|
||||
$smarty->assign('CONTENT', 'disabled.tpl');
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
@ -103,7 +103,7 @@ if ($user->isAuthenticated()) {
|
||||
} else if ($config['twofactor']['enabled'] && $config['twofactor']['options']['withdraw'] && !$wf_editable) {
|
||||
$_SESSION['POPUP'][] = array('CONTENT' => 'You have not yet unlocked account withdrawls.', 'TYPE' => 'alert alert-danger');
|
||||
} else if ($aBalance['confirmed'] < $config['mp_threshold']) {
|
||||
$_SESSION['POPUP'][] = array('CONTENT' => 'Payout must be greater or equal than ' . $config['mp_threshold'] . '.', 'TYPE' => 'info');
|
||||
$_SESSION['POPUP'][] = array('CONTENT' => 'Account balance must be >= ' . $config['mp_threshold'] . ' to do a Manual Payout.', 'TYPE' => 'alert alert-warning');
|
||||
} else if (!$coin_address->getCoinAddress($_SESSION['USERDATA']['id'])) {
|
||||
$_SESSION['POPUP'][] = array('CONTENT' => 'You have no payout address set.', 'TYPE' => 'alert alert-danger');
|
||||
} else {
|
||||
@ -181,7 +181,7 @@ if ($config['twofactor']['enabled'] && $user->isAuthenticated()) {
|
||||
$wf_editable = $user->token->isTokenValid($_SESSION['USERDATA']['id'], $wf_token, 7);
|
||||
$wf_sent = $user->token->doesTokenExist('withdraw_funds', $_SESSION['USERDATA']['id']);
|
||||
}
|
||||
|
||||
|
||||
// display token info per each - only when sent and editable or just sent, not by default
|
||||
(!empty($eaprep_sent) && !empty($eaprep_edit)) ? $_SESSION['POPUP'][] = array('CONTENT' => $eaprep_sent, 'TYPE' => 'alert alert-success'):"";
|
||||
(!empty($eaprep_sent) && empty($eaprep_edit)) ? $_SESSION['POPUP'][] = array('CONTENT' => $message_tokensent_invalid.$messages_tokensent_status['ea'], 'TYPE' => 'alert alert-success'):"";
|
||||
@ -206,4 +206,3 @@ $smarty->assign("DONATE_THRESHOLD", $config['donate_threshold']);
|
||||
|
||||
// Tempalte specifics
|
||||
$smarty->assign("CONTENT", "default.tpl");
|
||||
?>
|
||||
|
||||
@ -24,4 +24,3 @@ if ($user->isAuthenticated()) {
|
||||
}
|
||||
}
|
||||
$smarty->assign('CONTENT', 'default.tpl');
|
||||
?>
|
||||
|
||||
@ -35,5 +35,3 @@ if ($user->isAuthenticated()) {
|
||||
$smarty->assign('CONTENT', 'default.tpl');
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
@ -12,4 +12,3 @@ case '1':
|
||||
$smarty->assign("CONTENT", "");
|
||||
break;
|
||||
}
|
||||
?>
|
||||
|
||||
@ -11,4 +11,3 @@ if ($user->isAuthenticated()) {
|
||||
}
|
||||
// Somehow we still need to load this empty template
|
||||
$smarty->assign("CONTENT", "empty");
|
||||
?>
|
||||
|
||||
@ -15,4 +15,3 @@ if ($user->isAuthenticated()) {
|
||||
$smarty->assign('DISABLE_TRANSACTIONSUMMARY', $setting->getValue('disable_transactionsummary'));
|
||||
}
|
||||
$smarty->assign('CONTENT', 'default.tpl');
|
||||
?>
|
||||
|
||||
@ -15,5 +15,3 @@ if (!isset($_GET['token']) || empty($_GET['token'])) {
|
||||
}
|
||||
}
|
||||
$smarty->assign('CONTENT', 'default.tpl');
|
||||
|
||||
?>
|
||||
|
||||
@ -55,6 +55,3 @@ if ($user->isAuthenticated()) {
|
||||
$smarty->assign('CONTENT', 'default.tpl');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
|
||||
@ -9,4 +9,3 @@ if (!$user->isAuthenticated() || !$user->isAdmin($_SESSION['USERDATA']['id'])) {
|
||||
|
||||
// Tempalte specifics
|
||||
$smarty->assign("CONTENT", "");
|
||||
?>
|
||||
|
||||
55
include/pages/admin/checks/check_daemon.inc.php
Normal file
55
include/pages/admin/checks/check_daemon.inc.php
Normal file
@ -0,0 +1,55 @@
|
||||
<?php
|
||||
$defflip = (!cfip()) ? exit(header('HTTP/1.1 401 Unauthorized')) : 1;
|
||||
|
||||
// check if daemon can connect -> error
|
||||
try {
|
||||
if ($bitcoin->can_connect() !== true) {
|
||||
$newerror = array();
|
||||
$newerror['name'] = "Coin daemon";
|
||||
$newerror['level'] = 3;
|
||||
$newerror['description'] = "Unable to connect to coin daemon using provided credentials.";
|
||||
$newerror['configvalue'] = "wallet.*";
|
||||
$newerror['extdesc'] = "We weren't able to connect to your coin daemon using the host/username/password/port given in the config. Check that your coin daemon is running and mpos is configured with the data from your coin daemon config. Your coin daemon may also not yet be fully synced.";
|
||||
$newerror['helplink'] = "https://github.com/MPOS/php-mpos/wiki/Config-Setup#wiki-local-wallet-rpc";
|
||||
$error[] = $newerror;
|
||||
$newerror = null;
|
||||
} else {
|
||||
// validate that the wallet service is not in test mode
|
||||
if ($bitcoin->is_testnet() == true) {
|
||||
$newerror = array();
|
||||
$newerror['name'] = "Coin daemon";
|
||||
$newerror['level'] = 3;
|
||||
$newerror['extdesc'] = "You may have accidentally mistyped the port, or are running the coin daemon in testnet mode. Check your coin daemon config and MPOS config.";
|
||||
$newerror['description'] = "The coin daemon service is running as a testnet. Check the TESTNET setting in your coin daemon config and make sure the correct port is set in the MPOS config.";
|
||||
$newerror['configvalue'] = "wallet.host";
|
||||
$newerror['helplink'] = "https://github.com/MPOS/php-mpos/wiki/Config-Setup#wiki-local-wallet-rpc";
|
||||
$error[] = $newerror;
|
||||
$newerror = null;
|
||||
}
|
||||
// Check if chain is currently downloading
|
||||
if ($dDownloadPercentage = $bitcoin->getblockchaindownload()) {
|
||||
$newerror = array();
|
||||
$newerror['name'] = "Coin daemon";
|
||||
$newerror['level'] = 1;
|
||||
$newerror['extdesc'] = "Your coin daemon is currently downloading the blockchain. Your miners won't be able to connect until this is completed.";
|
||||
$newerror['description'] = "Blockchain download progress is at an estimated $dDownloadPercentage%. It may take a while to complete.";
|
||||
$newerror['configvalue'] = "wallet.host";
|
||||
$newerror['helplink'] = "https://github.com/MPOS/php-mpos/wiki/Config-Setup#wiki-local-wallet-rpc";
|
||||
$error[] = $newerror;
|
||||
$newerror = null;
|
||||
}
|
||||
// check if there is more than one account set on wallet
|
||||
$accounts = $bitcoin->listaccounts();
|
||||
if (count($accounts) > 1 && $accounts[''] <= 0) {
|
||||
$newerror = array();
|
||||
$newerror['name'] = "Coin daemon";
|
||||
$newerror['level'] = 3;
|
||||
$newerror['extdesc'] = "You need at least one account to be able to pay miners! Your coin daemon may not yet be fully synced, see the above link for more details.";
|
||||
$newerror['description'] = "There are " . count($accounts) . " Accounts set in local Wallet and Default Account has no liquid funds to pay your miners!";
|
||||
$newerror['configvalue'] = "wallet.host";
|
||||
$newerror['helplink'] = "https://github.com/MPOS/php-mpos/wiki/Config-Setup#wiki-local-wallet-rpc";
|
||||
$error[] = $newerror;
|
||||
$newerror = null;
|
||||
}
|
||||
}
|
||||
} catch (Exception $e) {}
|
||||
15
include/pages/admin/checks/check_fees.inc.php
Normal file
15
include/pages/admin/checks/check_fees.inc.php
Normal file
@ -0,0 +1,15 @@
|
||||
<?php
|
||||
$defflip = (!cfip()) ? exit(header('HTTP/1.1 401 Unauthorized')) : 1;
|
||||
|
||||
// check if fees are 0 and ap/mp tx fees are also set to 0 -> issue #2424
|
||||
if ($config['fees'] == 0 && ($config['txfee_auto'] == 0 || $config['txfee_manual'] == 0)) {
|
||||
$newerror = array();
|
||||
$newerror['name'] = "Fees and TX Fees 0";
|
||||
$newerror['level'] = 2;
|
||||
$newerror['extdesc'] = "This is an issue that can only occur with both your fees set to 0 and auto or manual tx fees set to 0 as well. It's best to avoid it if possible though, as it can prevent payouts; set the txfee to a small amount to avoid this.";
|
||||
$newerror['description'] = "Having your pool fees set to 0 and tx fees also set to 0 can cause a problem where the wallet cannot payout, consider setting the txfee to a very low amount, ie. 0.0001 to avoid this.";
|
||||
$newerror['configvalue'] = "fees";
|
||||
$newerror['helplink'] = "https://github.com/MPOS/php-mpos/issues/2424";
|
||||
$error[] = $newerror;
|
||||
$newerror = null;
|
||||
}
|
||||
67
include/pages/admin/checks/check_memcache.inc.php
Normal file
67
include/pages/admin/checks/check_memcache.inc.php
Normal file
@ -0,0 +1,67 @@
|
||||
<?php
|
||||
$defflip = (!cfip()) ? exit(header('HTTP/1.1 401 Unauthorized')) : 1;
|
||||
|
||||
// check if memcache isn't available but enabled in config -> error
|
||||
if (!class_exists('Memcached') && $config['memcache']['enabled']) {
|
||||
$newerror = array();
|
||||
$newerror['name'] = "Memcache Config";
|
||||
$newerror['level'] = 3;
|
||||
$newerror['extdesc'] = "Memcache is a service that you run that lets us cache commonly used data and access it quickly. It's highly recommended you <a href='https://github.com/MPOS/php-mpos/wiki/Quick-Start-Guide#requirements-1'>install the service and php packages</a> for your distro.";
|
||||
$newerror['description'] = "You have memcached enabled in your config and it's not available as a PHP module. Install the package on your system.";
|
||||
$newerror['configvalue'] = "memcache.enabled";
|
||||
$newerror['helplink'] = "https://github.com/MPOS/php-mpos/wiki/Config-Setup#wiki-memcache";
|
||||
$error[] = $newerror;
|
||||
$newerror = null;
|
||||
}
|
||||
|
||||
// if it's not enabled, test it if it exists, if it works -> error tell them to enable, -> otherwise notice it's disabled
|
||||
if (!$config['memcache']['enabled']) {
|
||||
if (PHP_OS == 'WINNT') {
|
||||
require_once(CLASS_DIR . 'memcached.class.php');
|
||||
}
|
||||
if (class_exists('Memcached')) {
|
||||
$memcache_test = @new Memcached();
|
||||
if ($config['memcache']['sasl'] === true) {
|
||||
$memcache_test->setOption(Memcached::OPT_BINARY_PROTOCOL, true);
|
||||
$memcache_test->setSaslAuthData($config['memcache']['sasl']['username'], $config['memcache']['sasl']['password']);
|
||||
}
|
||||
$memcache_test_add = @$memcache_test->addServer($config['memcache']['host'], $config['memcache']['port']);
|
||||
$randmctv = rand(5,10);
|
||||
$memcache_test_set = @$memcache_test->set('test_mpos_setval', $randmctv);
|
||||
$memcache_test_get = @$memcache_test->get('test_mpos_setval');
|
||||
}
|
||||
if (class_exists('Memcached') && $memcache_test_get == $randmctv) {
|
||||
$newerror = array();
|
||||
$newerror['name'] = "Memcache Config";
|
||||
$newerror['level'] = 2;
|
||||
$newerror['extdesc'] = "Memcache is a service that you run that lets us cache commonly used data and access it quickly. It's highly recommended you <a href='https://github.com/MPOS/php-mpos/wiki/Quick-Start-Guide#requirements-1'>install the service and php packages</a> for your distro.";
|
||||
$newerror['description'] = "You have memcache disabled in the config but it's available and works! Enable it for best performance.";
|
||||
$newerror['configvalue'] = "memcache.enabled";
|
||||
$newerror['helplink'] = "https://github.com/MPOS/php-mpos/wiki/Config-Setup#wiki-memcache";
|
||||
$error[] = $newerror;
|
||||
$newerror = null;
|
||||
} else {
|
||||
$newerror = array();
|
||||
$newerror['name'] = "Memcache Config";
|
||||
$newerror['level'] = 2;
|
||||
$newerror['extdesc'] = "Memcache is a service that you run that lets us cache commonly used data and access it quickly. It's highly recommended you <a href='https://github.com/MPOS/php-mpos/wiki/Quick-Start-Guide#requirements-1'>install the service and php packages</a> for your distro.";
|
||||
$newerror['description'] = "Memcache is disabled; Almost every linux distro has packages for it, you should be using it if you can.";
|
||||
$newerror['configvalue'] = "memcache.enabled";
|
||||
$newerror['helplink'] = "https://github.com/MPOS/php-mpos/wiki/Config-Setup#wiki-memcache";
|
||||
$error[] = $newerror;
|
||||
$newerror = null;
|
||||
}
|
||||
}
|
||||
|
||||
// check anti DOS protection, we need memcache for that
|
||||
if ($config['mc_antidos'] && !$config['memcache']['enabled']) {
|
||||
$newerror = array();
|
||||
$newerror['name'] = "Memcache Config";
|
||||
$newerror['level'] = 3;
|
||||
$newerror['extdesc'] = "Memcache is a service that you run that lets us cache commonly used data and access it quickly. It's highly recommended you <a href='https://github.com/MPOS/php-mpos/wiki/Quick-Start-Guide#requirements-1'>install the service and php packages</a> for your distro.";
|
||||
$newerror['description'] = "mc_antidos is enabled and memcache is not, <u>memcache is required</u> to use this.";
|
||||
$newerror['configvalue'] = "memcache.enabled";
|
||||
$newerror['helplink'] = "https://github.com/MPOS/php-mpos/wiki/Config-Setup#memcache-rate-limiting";
|
||||
$error[] = $newerror;
|
||||
$newerror = null;
|
||||
}
|
||||
55
include/pages/admin/checks/check_permissions.inc.php
Normal file
55
include/pages/admin/checks/check_permissions.inc.php
Normal file
@ -0,0 +1,55 @@
|
||||
<?php
|
||||
$defflip = (!cfip()) ? exit(header('HTTP/1.1 401 Unauthorized')) : 1;
|
||||
|
||||
if ($config['logging']['enabled']) {
|
||||
// checks to see that the logging path is writable
|
||||
if (!is_writable($config['logging']['path'])) {
|
||||
$newerror = array();
|
||||
$newerror['name'] = "Log path permissions";
|
||||
$newerror['level'] = 3;
|
||||
$newerror['extdesc'] = "In order to log data, we need to be able to write in the logs folder. See the link above for more details.";
|
||||
$newerror['description'] = "Logging is enabled but we can't write in the logfile path.";
|
||||
$newerror['configvalue'] = "logging.path";
|
||||
$newerror['helplink'] = "https://github.com/MPOS/php-mpos/wiki/Quick-Start-Guide#configuration-1";
|
||||
$error[] = $newerror;
|
||||
$newerror = null;
|
||||
}
|
||||
}
|
||||
|
||||
// check if we can write templates/cache and templates/compile -> error
|
||||
if (!is_writable(TEMPLATE_DIR . '/cache')) {
|
||||
$newerror = array();
|
||||
$newerror['name'] = "templates/cache permissions";
|
||||
$newerror['level'] = 3;
|
||||
$newerror['extdesc'] = "In order to cache template data, we need to be able to write in the templates/cache folder. See the link above for more details.";
|
||||
$newerror['description'] = "templates/cache folder is not writable for uid {$apache_user['name']}";
|
||||
$newerror['configvalue'] = "templates/cache folder";
|
||||
$newerror['helplink'] = "https://github.com/MPOS/php-mpos/wiki/Quick-Start-Guide#folder-permissions";
|
||||
$error[] = $newerror;
|
||||
$newerror = null;
|
||||
}
|
||||
if (!is_writable(TEMPLATE_DIR . '/compile')) {
|
||||
$newerror = array();
|
||||
$newerror['name'] = "templates/compile permissions";
|
||||
$newerror['level'] = 3;
|
||||
$newerror['extdesc'] = "In order to cache compiled template data, we need to be able to write in the templates/compile folder. See the link above for more details.";
|
||||
$newerror['description'] = "templates/compile folder is not writable for uid {$apache_user['name']}";
|
||||
$newerror['configvalue'] = "templates/compile folder";
|
||||
$newerror['helplink'] = "https://github.com/MPOS/php-mpos/wiki/Quick-Start-Guide#folder-permissions";
|
||||
$error[] = $newerror;
|
||||
$newerror = null;
|
||||
}
|
||||
|
||||
// check if we can write the config files, we should NOT be able to -> error
|
||||
if (is_writable(INCLUDE_DIR.'/config/global.inc.php') || is_writable(INCLUDE_DIR.'/config/global.inc.dist.php') ||
|
||||
is_writable(INCLUDE_DIR.'/config/security.inc.php') || is_writable(INCLUDE_DIR.'/config/security.inc.dist.php')) {
|
||||
$newerror = array();
|
||||
$newerror['name'] = "Config permissions";
|
||||
$newerror['level'] = 2;
|
||||
$newerror['extdesc'] = "For security purposes, the user your webserver runs as should not be able to write to the config files, only read from them. To fix this, check the ownership and permissions of the include/config files.";
|
||||
$newerror['description'] = "Your config files <b>SHOULD NOT be writable by this user</b>!";
|
||||
$newerror['configvalue'] = "global.inc.php and security.inc.php";
|
||||
$newerror['helplink'] = "https://github.com/MPOS/php-mpos/wiki/Quick-Start-Guide#configuration-1";
|
||||
$error[] = $newerror;
|
||||
$newerror = null;
|
||||
}
|
||||
33
include/pages/admin/checks/check_security.inc.php
Normal file
33
include/pages/admin/checks/check_security.inc.php
Normal file
@ -0,0 +1,33 @@
|
||||
<?php
|
||||
$defflip = (!cfip()) ? exit(header('HTTP/1.1 401 Unauthorized')) : 1;
|
||||
|
||||
// check if password salts are sane
|
||||
if (strlen($config['SALT']) < 24 || strlen($config['SALTY']) < 24 || $config['SALT'] == 'PLEASEMAKEMESOMETHINGRANDOM' || $config['SALTY'] == 'THISSHOULDALSOBERRAANNDDOOM') {
|
||||
$newerror = array();
|
||||
$newerror['name'] = "Password Salts";
|
||||
$newerror['level'] = 2;
|
||||
$newerror['extdesc'] = "Salts are important because they add a random element and 'padding' to passwords and other hashed strings. They should be changed from the default and should not be too short for increased security.";
|
||||
if ($config['SALT'] == 'PLEASEMAKEMESOMETHINGRANDOM' || $config['SALTY'] == 'THISSHOULDALSOBERRAANNDDOOM') {
|
||||
$newerror['description'] = "You absolutely <u>SHOULD NOT leave your SALT or SALTY default</u> changing them will require registering again.";
|
||||
} else {
|
||||
$newerror['description'] = "SALT or SALTY is too short, they should be more than 24 characters and changing them will require registering again.</p>";
|
||||
}
|
||||
$newerror['configvalue'] = "SALT";
|
||||
$newerror['helplink'] = "https://github.com/MPOS/php-mpos/wiki/Config-Setup#wiki-defines--salts";
|
||||
$error[] = $newerror;
|
||||
$newerror = null;
|
||||
}
|
||||
|
||||
// check if htaccess exists
|
||||
if (!file_exists(BASEPATH.".htaccess")) {
|
||||
$newerror = array();
|
||||
$newerror['name'] = ".htaccess";
|
||||
$newerror['level'] = 2;
|
||||
$newerror['extdesc'] = ".htaccess files let you control who/how files are accessed for Apache. If you're using Apache for MPOS, you should be using .htaccess.";
|
||||
$htaccess_link = "<a href='https://github.com/MPOS/php-mpos/blob/next/public/.htaccess'>.htaccess</a>";
|
||||
$newerror['description'] = "You don't seem to have a .htaccess in your public folder, if you're using Apache set it up: $htaccess_link";
|
||||
$newerror['configvalue'] = ".htaccess";
|
||||
$newerror['helplink'] = "https://github.com/MPOS/php-mpos/wiki";
|
||||
$error[] = $newerror;
|
||||
$newerror = null;
|
||||
}
|
||||
40
include/pages/admin/checks/check_stratum.inc.php
Normal file
40
include/pages/admin/checks/check_stratum.inc.php
Normal file
@ -0,0 +1,40 @@
|
||||
<?php
|
||||
$defflip = (!cfip()) ? exit(header('HTTP/1.1 401 Unauthorized')) : 1;
|
||||
|
||||
// poke stratum using gettingstarted details -> enotice
|
||||
if (function_exists('socket_create')) {
|
||||
$host = @gethostbyname($config['gettingstarted']['stratumurl']);
|
||||
$port = $config['gettingstarted']['stratumport'];
|
||||
if (isset($host) and
|
||||
isset($port) and
|
||||
($socket=socket_create(AF_INET, SOCK_STREAM, SOL_TCP)) and
|
||||
(socket_set_option($socket, SOL_SOCKET, SO_SNDTIMEO, array('sec' => 3, 'usec' => 0))) and
|
||||
(@socket_connect($socket, $host, $port)))
|
||||
{
|
||||
socket_close($socket);
|
||||
} else {
|
||||
$newerror = array();
|
||||
$newerror['name'] = "Stratum information";
|
||||
$newerror['level'] = 1;
|
||||
$newerror['extdesc'] = "We tried to connect the stratum server that you set in your gettingstarted config, but an error occured somewhere along the way. Your stratum server may not be running currently, your firewall could be blocking the connection, or your coin daemon may not yet be fully synced, etc.";
|
||||
$newerror['description'] = "We tried to poke your Stratum server using your \$config['gettingstarted'] settings but it didn't respond - " . socket_strerror(socket_last_error()) . ".";
|
||||
$newerror['configvalue'] = "gettingstarted";
|
||||
$newerror['helplink'] = "https://github.com/MPOS/php-mpos/wiki/Config-Setup#wiki-getting-started";
|
||||
$error[] = $newerror;
|
||||
$newerror = null;
|
||||
}
|
||||
} else {
|
||||
// Connect via fsockopen as fallback
|
||||
if (! $fp = @fsockopen($config['gettingstarted']['stratumurl'], $config['gettingstarted']['stratumport'], $errCode, $errStr, 1)) {
|
||||
$newerror = array();
|
||||
$newerror['name'] = "Stratum information";
|
||||
$newerror['level'] = 1;
|
||||
$newerror['extdesc'] = "We tried to connect the stratum server that you set in your gettingstarted config, but an error occured somewhere along the way. Your stratum server may not be running currently, your firewall could be blocking the connection, or your coin daemon may not yet be fully synced, etc.";
|
||||
$newerror['description'] = "We tried to poke your Stratum server using your \$config['gettingstarted'] settings but it didn't respond.";
|
||||
$newerror['configvalue'] = "gettingstarted";
|
||||
$newerror['helplink'] = "https://github.com/MPOS/php-mpos/wiki/Config-Setup#wiki-getting-started";
|
||||
$error[] = $newerror;
|
||||
$newerror = null;
|
||||
}
|
||||
@fclose($fp);
|
||||
}
|
||||
@ -20,7 +20,7 @@ $online_versions = $tools->getOnlineVersions();
|
||||
|
||||
// Fetch version information
|
||||
$version['CURRENT'] = array('DB' => DB_VERSION, 'CONFIG' => CONFIG_VERSION, 'CORE' => MPOS_VERSION);
|
||||
$version['INSTALLED'] = array('DB' => $setting->getValue('DB_VERSION'), 'CONFIG' => $config['version'], 'CORE' => $online_versions['MPOS_VERSION']);
|
||||
$version['INSTALLED'] = array('DB' => $setting->getValue('DB_VERSION'), 'CONFIG' => $config['version'], 'CORE' => MPOS_VERSION);
|
||||
$version['ONLINE'] = array('DB' => $online_versions['DB_VERSION'], 'CONFIG' => $online_versions['CONFIG_VERSION'], 'CORE' => $online_versions['MPOS_VERSION']);
|
||||
|
||||
// Fetch our cron list $aMonitorCrons
|
||||
|
||||
@ -18,4 +18,3 @@ if ($user->isAuthenticated()) {
|
||||
}
|
||||
|
||||
$smarty->assign('CONTENT', 'default.tpl');
|
||||
?>
|
||||
|
||||
@ -21,4 +21,3 @@ if (!$setting->getValue('disable_invitations')) {
|
||||
|
||||
// Tempalte specifics
|
||||
$smarty->assign("CONTENT", "default.tpl");
|
||||
?>
|
||||
|
||||
@ -26,4 +26,3 @@ $smarty->assign("CRONSTATUS", $aCronStatus);
|
||||
|
||||
// Tempalte specifics
|
||||
$smarty->assign("CONTENT", "default.tpl");
|
||||
?>
|
||||
|
||||
@ -46,4 +46,3 @@ foreach ($aNews as $key => $aData) {
|
||||
}
|
||||
$smarty->assign("NEWS", $aNews);
|
||||
$smarty->assign("CONTENT", "default.tpl");
|
||||
?>
|
||||
@ -24,4 +24,3 @@ if (!$config['csrf']['enabled'] || $config['csrf']['enabled'] && $csrftoken->val
|
||||
$aNews = $news->getEntry($_REQUEST['id']);
|
||||
$smarty->assign("NEWS", $aNews);
|
||||
$smarty->assign("CONTENT", "default.tpl");
|
||||
?>
|
||||
@ -38,4 +38,3 @@ if ($setting->getValue('notifications_disable_pool_newsletter', 0) == 1) {
|
||||
}
|
||||
$smarty->assign("CONTENT", "default.tpl");
|
||||
}
|
||||
?>
|
||||
|
||||
@ -19,5 +19,3 @@ $smarty->assign('DISABLE_IDLEWORKERNOTIFICATIONS', $setting->getValue('notificat
|
||||
$smarty->assign('LIMIT', $iLimit);
|
||||
$smarty->assign('WORKERS', $aWorkers);
|
||||
$smarty->assign('CONTENT', 'default.tpl');
|
||||
|
||||
?>
|
||||
|
||||
@ -18,4 +18,3 @@ $smarty->assign("LASTREGISTEREDUSERS", $aLastRegisteredUsers);
|
||||
|
||||
// Tempalte specifics
|
||||
$smarty->assign("CONTENT", "default.tpl");
|
||||
?>
|
||||
|
||||
@ -81,4 +81,3 @@ if ($user->isAuthenticated(false)) {
|
||||
} else {
|
||||
$smarty->assign("CONTENT", "empty");
|
||||
}
|
||||
?>
|
||||
|
||||
@ -27,4 +27,3 @@ $smarty->assign("SETTINGS", $aSettings);
|
||||
|
||||
// Tempalte specifics
|
||||
$smarty->assign("CONTENT", "default.tpl");
|
||||
?>
|
||||
38
include/pages/admin/setup.inc.php
Normal file
38
include/pages/admin/setup.inc.php
Normal file
@ -0,0 +1,38 @@
|
||||
<?php
|
||||
$defflip = (!cfip()) ? exit(header('HTTP/1.1 401 Unauthorized')) : 1;
|
||||
|
||||
// Check user to ensure they are admin
|
||||
if (!$user->isAuthenticated() || !$user->isAdmin($_SESSION['USERDATA']['id'])) {
|
||||
header("HTTP/1.1 404 Page not found");
|
||||
die("404 Page not found");
|
||||
}
|
||||
|
||||
if (@$_SESSION['USERDATA']['is_admin'] && $user->isAdmin(@$_SESSION['USERDATA']['id'])) {
|
||||
if (!include_once(INCLUDE_DIR . '/lib/jsonRPCClient.php')) die('Unable to load libs');
|
||||
$error = array();
|
||||
|
||||
if ($config['skip_config_tests']) {
|
||||
$newerror = array();
|
||||
$newerror['name'] = "Config tests skipped";
|
||||
$newerror['description'] = "Config tests are disabled. Enable them in the global config to run them again.";
|
||||
$newerror['configvalue'] = "skip_config_tests";
|
||||
$newerror['helplink'] = "https://github.com/MPOS/php-mpos/wiki/Config-Setup#config-check";
|
||||
$error[] = $newerror;
|
||||
$newerror = null;
|
||||
} else {
|
||||
// setup some basic stuff for checking - getuid/getpwuid not available on mac/windows
|
||||
$apache_user = 'unknown';
|
||||
if (substr_count(strtolower(PHP_OS), 'nix') > 0 || substr_count(strtolower(PHP_OS), 'linux') > 0) {
|
||||
$apache_user = (function_exists('posix_getuid')) ? posix_getuid() : 'unknown';
|
||||
$apache_user = (function_exists('posix_getpwuid')) ? posix_getpwuid($apache_user) : $apache_user;
|
||||
}
|
||||
|
||||
// we want to load anything in checks/ that is check_*.inc.php
|
||||
foreach(glob(__DIR__."/checks/check_*.inc.php") as $file) {
|
||||
include_once($file);
|
||||
}
|
||||
}
|
||||
$smarty->assign("ERRORS", $error);
|
||||
}
|
||||
|
||||
$smarty->assign("CONTENT", "default.tpl");
|
||||
@ -37,4 +37,3 @@ if (isset($_REQUEST['filter'])) {
|
||||
$smarty->assign('FILTERS', $strFilters);
|
||||
}
|
||||
$smarty->assign('CONTENT', 'default.tpl');
|
||||
?>
|
||||
|
||||
@ -83,4 +83,3 @@ if (isset($_REQUEST['filter'])) {
|
||||
|
||||
// Tempalte specifics
|
||||
$smarty->assign("CONTENT", "default.tpl");
|
||||
?>
|
||||
@ -21,4 +21,3 @@ if (!$smarty->isCached('master.tpl', $smarty_cache_key)) {
|
||||
}
|
||||
|
||||
$smarty->assign('CONTENT', 'default.tpl');
|
||||
?>
|
||||
|
||||
@ -22,6 +22,11 @@ if (!$smarty->isCached('master.tpl', $smarty_cache_key)) {
|
||||
}
|
||||
|
||||
$aGetInfo = $bitcoin->getinfo();
|
||||
$aGetPeerInfo = $bitcoin->getpeerinfo();
|
||||
if ($aGetInfo['connections'] == 0) $aGetInfo['errors'] = 'No peers';
|
||||
# Check if daemon is downloading the blockchain, estimated
|
||||
if ($dDownloadPercentage = $bitcoin->getblockchaindownload()) $aGetInfo['errors'] = "Downloading: $dDownloadPercentage%";
|
||||
$aGetTransactions = $bitcoin->listtransactions('', (int)$setting->getValue('wallet_transaction_limit', 25));
|
||||
if (is_array($aGetInfo) && array_key_exists('newmint', $aGetInfo)) {
|
||||
$dNewmint = $aGetInfo['newmint'];
|
||||
} else {
|
||||
@ -32,6 +37,8 @@ if (!$smarty->isCached('master.tpl', $smarty_cache_key)) {
|
||||
$dAddressCount = 0;
|
||||
$dAccountAddresses = array();
|
||||
$aGetInfo = array('errors' => 'Unable to connect');
|
||||
$aGetPeerInfo = array();
|
||||
$aGetTransactions = array();
|
||||
$dBalance = 0;
|
||||
$dNewmint = -1;
|
||||
$_SESSION['POPUP'][] = array('CONTENT' => 'Unable to connect to wallet RPC service: ' . $bitcoin->can_connect(), 'TYPE' => 'alert alert-danger');
|
||||
@ -48,6 +55,8 @@ if (!$smarty->isCached('master.tpl', $smarty_cache_key)) {
|
||||
|
||||
// Cold wallet balance
|
||||
if (! $dColdCoins = $setting->getValue('wallet_cold_coins')) $dColdCoins = 0;
|
||||
|
||||
// Tempalte specifics
|
||||
$smarty->assign("UNCONFIRMED", $dBlocksUnconfirmedBalance);
|
||||
$smarty->assign("BALANCE", $dBalance);
|
||||
$smarty->assign("ADDRESSCOUNT", $dAddressCount);
|
||||
@ -57,11 +66,11 @@ if (!$smarty->isCached('master.tpl', $smarty_cache_key)) {
|
||||
$smarty->assign("LOCKED", $dLockedBalance);
|
||||
$smarty->assign("NEWMINT", $dNewmint);
|
||||
$smarty->assign("COININFO", $aGetInfo);
|
||||
|
||||
// Tempalte specifics
|
||||
$smarty->assign("PEERINFO", $aGetPeerInfo);
|
||||
$smarty->assign('PRECISION', $coin->getCoinValuePrevision());
|
||||
$smarty->assign("TRANSACTIONS", $aGetTransactions);
|
||||
} else {
|
||||
$debug->append('Using cached page', 3);
|
||||
}
|
||||
|
||||
$smarty->assign("CONTENT", "default.tpl");
|
||||
?>
|
||||
|
||||
@ -9,4 +9,3 @@ $id = $user->checkApiKey(@$_REQUEST['api_key']);
|
||||
|
||||
header('HTTP/1.1 400 Bad Request');
|
||||
die('400 Bad Request');
|
||||
?>
|
||||
|
||||
@ -18,4 +18,3 @@ echo $api->get_json($iBlock);
|
||||
|
||||
// Supress master template
|
||||
$supress_master = 1;
|
||||
?>
|
||||
|
||||
@ -24,4 +24,3 @@ echo $api->get_json($aBlocks);
|
||||
|
||||
// Supress master template
|
||||
$supress_master = 1;
|
||||
?>
|
||||
|
||||
@ -14,4 +14,3 @@ echo $api->get_json($blocks);
|
||||
|
||||
// Supress master template
|
||||
$supress_master = 1;
|
||||
?>
|
||||
|
||||
@ -43,5 +43,3 @@ echo $api->get_json($aCronStatus);
|
||||
|
||||
// Supress master template
|
||||
$supress_master = 1;
|
||||
|
||||
?>
|
||||
|
||||
@ -12,4 +12,3 @@ echo $api->get_json($worker->getCountAllActiveWorkers());
|
||||
|
||||
// Supress master template
|
||||
$supress_master = 1;
|
||||
?>
|
||||
|
||||
@ -119,4 +119,3 @@ $data = array(
|
||||
);
|
||||
|
||||
echo $api->get_json($data);
|
||||
?>
|
||||
|
||||
@ -15,4 +15,3 @@ echo $api->get_json($dDifficulty);
|
||||
|
||||
// Supress master template
|
||||
$supress_master = 1;
|
||||
?>
|
||||
|
||||
@ -16,4 +16,3 @@ echo $api->get_json($dEstimatedTime);
|
||||
|
||||
// Supress master template
|
||||
$supress_master = 1;
|
||||
?>
|
||||
|
||||
@ -18,4 +18,3 @@ echo $api->get_json($data);
|
||||
|
||||
// Supress master template
|
||||
$supress_master = 1;
|
||||
?>
|
||||
|
||||
@ -19,4 +19,3 @@ echo $api->get_json($dPoolHashrate);
|
||||
|
||||
// Supress master template
|
||||
$supress_master = 1;
|
||||
?>
|
||||
|
||||
@ -36,4 +36,3 @@ echo $api->get_json($data);
|
||||
|
||||
// Supress master template
|
||||
$supress_master = 1;
|
||||
?>
|
||||
|
||||
@ -15,4 +15,3 @@ echo json_encode(array('getpoolsharerate' => $statistics->getCurrentShareRate())
|
||||
|
||||
// Supress master template
|
||||
$supress_master = 1;
|
||||
?>
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user