Merge pull request #2219 from MPOS/development

UPDATE : Development to Master
This commit is contained in:
Sebastian Grewe 2014-06-26 11:26:02 +02:00
commit bbe2ff7006
23 changed files with 192 additions and 83 deletions

1
.gitignore vendored
View File

@ -14,6 +14,7 @@
/logs/* /logs/*
# Test configs # Test configs
/include/config/global.inc.test.php
/include/config/global.inc.scrypt.php /include/config/global.inc.scrypt.php
/include/config/global.inc.sha.php /include/config/global.inc.sha.php

View File

@ -1,4 +1,4 @@
Description [ ![Codeship Status for TheSerapher/php-mpos](https://www.codeship.io/projects/40fa7600-61a6-0131-3fd3-367b94dc0d60/status?branch=next)](https://www.codeship.io/projects/12276) Description
=========== ===========
MPOS is a web based Mining Portal for various crypto currencies. It was created by [TheSerapher](https://github.com/TheSerapher) and has hence grown quite large. Recently it was migrated into a Github Organization to make development easier. It's a community driven open source project. Support can be requested on IRC at https://webchat.freenode.net/?channels=#mpos MPOS is a web based Mining Portal for various crypto currencies. It was created by [TheSerapher](https://github.com/TheSerapher) and has hence grown quite large. Recently it was migrated into a Github Organization to make development easier. It's a community driven open source project. Support can be requested on IRC at https://webchat.freenode.net/?channels=#mpos
@ -15,7 +15,10 @@ Donations to this project are going directly to [TheSerapher](https://github.com
* LTC address: `Lge95QR2frp9y1wJufjUPCycVsg5gLJPW8` * LTC address: `Lge95QR2frp9y1wJufjUPCycVsg5gLJPW8`
* BTC address: `1HuYK6WPU8o3yWCrAaADDZPRpL5QiXitfv` * BTC address: `1HuYK6WPU8o3yWCrAaADDZPRpL5QiXitfv`
* DOGE Address: `D6YtvxFGBmaD8Yq3i8LZsBQVPvCbZwCDzF` * DOGE address: `DANk8bnc3vHEf7Jthaxq1Xgn1BSiArNdjG`
* 42Coin address: `4VxA6Ht59Mj6ikhA4gDXLiHuAaDCJEvYTZ`
* FST address: `fiRqMgZyhjTN1GSEB3ZxV35JXsE5bjEaQ2`
* FRK address: `FDcgGZjX2B29qevSuiuQVwXhkNhtQT4cEW`
* Cryptsy Trade Key: `6ff7292142463b7b80cbbbdfc52334ba89727b11` * Cryptsy Trade Key: `6ff7292142463b7b80cbbbdfc52334ba89727b11`
Website Footer Website Footer
@ -79,15 +82,14 @@ The following feature have been implemented so far:
* Fully re-written GUI with [Smarty][2] templates * Fully re-written GUI with [Smarty][2] templates
* Full file based template support * Full file based template support
* **NEW** SQL based templates * VARDIFF Support
* Mobile WebUI
* Scrypt, SHA256, VARDIFF Support
* Reward Systems * Reward Systems
* Propotional, PPS and PPLNS * Propotional, PPS and PPLNS
* New Theme * New Theme
* Live Dashboard * Live Dashboard
* AJAX Support * AJAX Support
* Overhauled API * Overhauled API
* Bootstrap
* Web User accounts * Web User accounts
* Re-Captcha protected registration form * Re-Captcha protected registration form
* Worker accounts * Worker accounts
@ -95,7 +97,7 @@ The following feature have been implemented so far:
* Worker hashrates * Worker hashrates
* Pool statistics * Pool statistics
* Block statistics * Block statistics
* Pool donations, fees and block bonuses * Pool donations, bonuses, fees and block bonuses
* Manual and auto payout * Manual and auto payout
* Transaction list * Transaction list
* Admin Panel * Admin Panel
@ -105,7 +107,6 @@ The following feature have been implemented so far:
* User Transactions * User Transactions
* News Posts * News Posts
* Pool Settings * Pool Settings
* Templates
* Pool Workers * Pool Workers
* User Reports * User Reports
* Template Overwrite * Template Overwrite
@ -115,9 +116,11 @@ The following feature have been implemented so far:
* Auto Payout * Auto Payout
* Manual Payout * Manual Payout
* User-to-user Invitation System * User-to-user Invitation System
* Support for various coins via config * Support for various coins via coin class and config
* All scrypt coins * All scrypt coins
* All sha256d coins * All sha256d coins
* All x11 coins
* Others may be supported by creating a custom coin class
Installation Installation
============ ============
@ -131,7 +134,7 @@ This project was meant to allow users to easily customize the system and templat
If you are just using the system, there will be no need to adjust anything. Things will work out of the box! But if you plan on creating If you are just using the system, there will be no need to adjust anything. Things will work out of the box! But if you plan on creating
your own theme, things are pretty easy: your own theme, things are pretty easy:
* Create a new theme folder in `public/templates/` * Create a new theme folder in `templates/`
* Create a new site_assets folder in `public/site_assets` * Create a new site_assets folder in `public/site_assets`
* Create your own complete custom template or copy from an existing one * Create your own complete custom template or copy from an existing one
* Change your theme in the `Admin Panel` and point it to the newly created folder * Change your theme in the `Admin Panel` and point it to the newly created folder

View File

@ -37,8 +37,10 @@ class Api extends Base {
)), $force ? JSON_FORCE_OBJECT : 0 )), $force ? JSON_FORCE_OBJECT : 0
); );
// JSONP support issue #1700 // JSONP support issue #1700
if (isset($_REQUEST['callback'])) if (isset($_REQUEST['callback']) && ctype_alpha($_REQUEST['callback'])) {
header('Content-type: application/json; charset=utf-8');
return $_REQUEST['callback'] . '(' . $json . ');'; return $_REQUEST['callback'] . '(' . $json . ');';
}
return $json; return $json;
} }

View File

@ -129,8 +129,8 @@ class Share Extends Base {
* return array data Returns an array with usernames as keys for easy access * return array data Returns an array with usernames as keys for easy access
**/ **/
function getArchiveShares($iCount) { function getArchiveShares($iCount) {
$iMinId = $this->getMinArchiveShareId($iCount);
$iMaxId = $this->getMaxArchiveShareId(); $iMaxId = $this->getMaxArchiveShareId();
$iMinId = $this->getMinArchiveShareId($iCount);
$stmt = $this->mysqli->prepare(" $stmt = $this->mysqli->prepare("
SELECT SELECT
a.id, a.id,

View File

@ -18,11 +18,11 @@ class Tools extends Base {
curl_setopt($curl, CURLOPT_HEADER, false); curl_setopt($curl, CURLOPT_HEADER, false);
$data = curl_exec($curl); $data = curl_exec($curl);
preg_match('/define\(\'MPOS_VERSION\', \'(.*)\'\);/', $data, $match); preg_match('/define\(\'MPOS_VERSION\', \'(.*)\'\);/', $data, $match);
$mpos_versions['MPOS_VERSION'] = $match[1]; $mpos_versions['MPOS_VERSION'] = @$match[1];
preg_match('/define\(\'DB_VERSION\', \'(.*)\'\);/', $data, $match); preg_match('/define\(\'DB_VERSION\', \'(.*)\'\);/', $data, $match);
$mpos_versions['DB_VERSION'] = $match[1]; $mpos_versions['DB_VERSION'] = @$match[1];
preg_match('/define\(\'CONFIG_VERSION\', \'(.*)\'\);/', $data, $match); preg_match('/define\(\'CONFIG_VERSION\', \'(.*)\'\);/', $data, $match);
$mpos_versions['CONFIG_VERSION'] = $match[1]; $mpos_versions['CONFIG_VERSION'] = @$match[1];
curl_close($curl); curl_close($curl);
return $this->memcache->setCache($key, $mpos_versions, 30); return $this->memcache->setCache($key, $mpos_versions, 30);
} else { } else {

View File

@ -741,9 +741,11 @@ class User extends Base {
$this->setErrorMessage('Username exceeding character limit'); $this->setErrorMessage('Username exceeding character limit');
return false; return false;
} }
if (!$this->bitcoin->validateaddress($coinaddress)) { if (!is_null($coinaddress)) {
$this->setErrorMessage('Coin address is not valid'); if (!$this->bitcoin->validateaddress($coinaddress)) {
return false; $this->setErrorMessage('Coin address is not valid');
return false;
}
} }
if (preg_match('/[^a-z_\-0-9]/i', $username)) { if (preg_match('/[^a-z_\-0-9]/i', $username)) {
$this->setErrorMessage('Username may only contain alphanumeric characters'); $this->setErrorMessage('Username may only contain alphanumeric characters');
@ -841,7 +843,7 @@ class User extends Base {
} else { } else {
$this->setErrorMessage( 'Unable to register' ); $this->setErrorMessage( 'Unable to register' );
$this->debug->append('Failed to insert user into DB: ' . $this->mysqli->error); $this->debug->append('Failed to insert user into DB: ' . $this->mysqli->error);
if ($stmt->sqlstate == '23000') $this->setErrorMessage( 'Username or email already registered' ); if ($stmt->sqlstate == '23000') $this->setErrorMessage( 'Username, email or Coinaddress already registered' );
return false; return false;
} }
return false; return false;

View File

@ -7,7 +7,7 @@ $defflip = (!cfip()) ? exit(header('HTTP/1.1 401 Unauthorized')) : 1;
* https://github.com/MPOS/php-mpos/wiki/Config-Setup#wiki-config-version * https://github.com/MPOS/php-mpos/wiki/Config-Setup#wiki-config-version
**/ **/
$config['version'] = '0.0.8'; $config['version'] = '0.0.8';
$config['version_url'] = 'https://raw.githubusercontent.com/MPOS/php-mpos/master/public/include/version.inc.php'; $config['version_url'] = 'https://raw.githubusercontent.com/MPOS/php-mpos/master/include/version.inc.php';
/** /**
* Unless you disable this, we'll do a quick check on your config first. * Unless you disable this, we'll do a quick check on your config first.
@ -15,6 +15,12 @@ $config['version_url'] = 'https://raw.githubusercontent.com/MPOS/php-mpos/master
*/ */
$config['skip_config_tests'] = false; $config['skip_config_tests'] = false;
/**
* Unless you disable this, we'll do a check for a valid coin address on registration.
* https://github.com/MPOS/php-mpos/wiki/Config-Setup#check-for-valid-wallet-address
*/
$config['check_valid_coinaddress'] = true;
/** /**
* Defines * Defines
* Debug setting and salts for hashing passwords * Debug setting and salts for hashing passwords

View File

@ -10,23 +10,31 @@ if (!$user->isAuthenticated() || !$user->isAdmin($_SESSION['USERDATA']['id'])) {
// Include markdown library // Include markdown library
use \Michelf\Markdown; use \Michelf\Markdown;
if (@$_REQUEST['do'] == 'toggle_active') if (@$_REQUEST['do'] == 'toggle_active') {
if ($news->toggleActive($_REQUEST['id'])) if (!$config['csrf']['enabled'] || $config['csrf']['enabled'] && $csrftoken->valid) {
$_SESSION['POPUP'][] = array('CONTENT' => 'News entry changed', 'TYPE' => 'alert alert-success'); if ($news->toggleActive($_REQUEST['id'])) {
$_SESSION['POPUP'][] = array('CONTENT' => 'News entry changed', 'TYPE' => 'alert alert-success');
}
}
}
if (@$_REQUEST['do'] == 'add') { if (@$_REQUEST['do'] == 'add') {
if ($news->addNews($_SESSION['USERDATA']['id'], $_POST['data'])) { if (!$config['csrf']['enabled'] || $config['csrf']['enabled'] && $csrftoken->valid) {
$_SESSION['POPUP'][] = array('CONTENT' => 'News entry added', 'TYPE' => 'alert alert-success'); if ($news->addNews($_SESSION['USERDATA']['id'], $_POST['data'])) {
} else { $_SESSION['POPUP'][] = array('CONTENT' => 'News entry added', 'TYPE' => 'alert alert-success');
$_SESSION['POPUP'][] = array('CONTENT' => 'Failed to add new entry: ' . $news->getError(), 'TYPE' => 'alert alert-danger'); } else {
$_SESSION['POPUP'][] = array('CONTENT' => 'Failed to add new entry: ' . $news->getError(), 'TYPE' => 'alert alert-danger');
}
} }
} }
if (@$_REQUEST['do'] == 'delete') { if (@$_REQUEST['do'] == 'delete') {
if ($news->deleteNews((int)$_REQUEST['id'])) { if (!$config['csrf']['enabled'] || $config['csrf']['enabled'] && $csrftoken->valid) {
$_SESSION['POPUP'][] = array('CONTENT' => 'Succesfully removed news entry', 'TYPE' => 'alert alert-success'); if ($news->deleteNews((int)$_REQUEST['id'])) {
} else { $_SESSION['POPUP'][] = array('CONTENT' => 'Succesfully removed news entry', 'TYPE' => 'alert alert-success');
$_SESSION['POPUP'][] = array('CONTENT' => 'Failed to delete entry: ' . $news->getError(), 'TYPE' => 'alert alert-danger'); } else {
$_SESSION['POPUP'][] = array('CONTENT' => 'Failed to delete entry: ' . $news->getError(), 'TYPE' => 'alert alert-danger');
}
} }
} }
@ -38,4 +46,4 @@ foreach ($aNews as $key => $aData) {
} }
$smarty->assign("NEWS", $aNews); $smarty->assign("NEWS", $aNews);
$smarty->assign("CONTENT", "default.tpl"); $smarty->assign("CONTENT", "default.tpl");
?> ?>

View File

@ -10,11 +10,13 @@ if (!$user->isAuthenticated() || !$user->isAdmin($_SESSION['USERDATA']['id'])) {
// Include markdown library // Include markdown library
use \Michelf\Markdown; use \Michelf\Markdown;
if (@$_REQUEST['do'] == 'save') { if (!$config['csrf']['enabled'] || $config['csrf']['enabled'] && $csrftoken->valid) {
if ($news->updateNews($_REQUEST['id'], $_REQUEST['header'], $_REQUEST['content'], $_REQUEST['active'])) { if (@$_REQUEST['do'] == 'save') {
$_SESSION['POPUP'][] = array('CONTENT' => 'News updated', 'TYPE' => 'alert alert-success'); if ($news->updateNews($_REQUEST['id'], $_REQUEST['header'], $_REQUEST['content'], $_REQUEST['active'])) {
} else { $_SESSION['POPUP'][] = array('CONTENT' => 'News updated', 'TYPE' => 'alert alert-success');
$_SESSION['POPUP'][] = array('CONTENT' => 'News update failed: ' . $news->getError(), 'TYPE' => 'alert alert-danger'); } else {
$_SESSION['POPUP'][] = array('CONTENT' => 'News update failed: ' . $news->getError(), 'TYPE' => 'alert alert-danger');
}
} }
} }
@ -22,4 +24,4 @@ if (@$_REQUEST['do'] == 'save') {
$aNews = $news->getEntry($_REQUEST['id']); $aNews = $news->getEntry($_REQUEST['id']);
$smarty->assign("NEWS", $aNews); $smarty->assign("NEWS", $aNews);
$smarty->assign("CONTENT", "default.tpl"); $smarty->assign("CONTENT", "default.tpl");
?> ?>

View File

@ -8,11 +8,15 @@ if (!$user->isAuthenticated() || !$user->isAdmin($_SESSION['USERDATA']['id'])) {
} }
if (@$_REQUEST['do'] == 'save' && !empty($_REQUEST['data'])) { if (@$_REQUEST['do'] == 'save' && !empty($_REQUEST['data'])) {
$user->log->log("warn", @$_SESSION['USERDATA']['username']." changed admin settings"); if (!$config['csrf']['enabled'] || $config['csrf']['enabled'] && $csrftoken->valid) {
foreach($_REQUEST['data'] as $var => $value) { $user->log->log("warn", @$_SESSION['USERDATA']['username']." changed admin settings");
$setting->setValue($var, $value); foreach($_REQUEST['data'] as $var => $value) {
$setting->setValue($var, $value);
}
$_SESSION['POPUP'][] = array('CONTENT' => 'Settings updated', 'TYPE' => 'alert alert-success');
} else {
$_SESSION['POPUP'][] = array('CONTENT' => $csrftoken->getErrorWithDescriptionHTML(), 'TYPE' => 'alert alert-warning');
} }
$_SESSION['POPUP'][] = array('CONTENT' => 'Settings updated', 'TYPE' => 'alert alert-success');
} }
// Load our available settings from configuration // Load our available settings from configuration
@ -23,4 +27,4 @@ $smarty->assign("SETTINGS", $aSettings);
// Tempalte specifics // Tempalte specifics
$smarty->assign("CONTENT", "default.tpl"); $smarty->assign("CONTENT", "default.tpl");
?> ?>

View File

@ -16,26 +16,28 @@ $smarty->assign('LOCKED', array('' => '', '0' => 'No', '1' => 'Yes'));
$smarty->assign('NOFEE', array('' => '', '0' => 'No', '1' => 'Yes')); $smarty->assign('NOFEE', array('' => '', '0' => 'No', '1' => 'Yes'));
// Catch our JS queries to update some settings // Catch our JS queries to update some settings
switch (@$_REQUEST['do']) { if (!$config['csrf']['enabled'] || $config['csrf']['enabled'] && $csrftoken->valid) {
case 'lock': switch (@$_REQUEST['do']) {
$supress_master = 1; case 'lock':
// Reset user account $supress_master = 1;
if ($user->isLocked($_POST['account_id']) == 0) { // Reset user account
$user->setLocked($_POST['account_id'], 2); if ($user->isLocked($_POST['account_id']) == 0) {
} else { $user->setLocked($_POST['account_id'], 2);
$user->setLocked($_POST['account_id'], 0); } else {
$user->setUserFailed($_POST['account_id'], 0); $user->setLocked($_POST['account_id'], 0);
$user->setUserPinFailed($_POST['account_id'], 0); $user->setUserFailed($_POST['account_id'], 0);
$user->setUserPinFailed($_POST['account_id'], 0);
}
break;
case 'fee':
$supress_master = 1;
$user->changeNoFee($_POST['account_id']);
break;
case 'admin':
$supress_master = 1;
$user->changeAdmin($_POST['account_id']);
break;
} }
break;
case 'fee':
$supress_master = 1;
$user->changeNoFee($_POST['account_id']);
break;
case 'admin':
$supress_master = 1;
$user->changeAdmin($_POST['account_id']);
break;
} }
// Gernerate the GET URL for filters // Gernerate the GET URL for filters
@ -81,4 +83,4 @@ if (isset($_REQUEST['filter'])) {
// Tempalte specifics // Tempalte specifics
$smarty->assign("CONTENT", "default.tpl"); $smarty->assign("CONTENT", "default.tpl");
?> ?>

View File

@ -26,10 +26,15 @@ if ($setting->getValue('disable_invitations') && $setting->getValue('lock_regist
if ($setting->getValue('recaptcha_enabled') != 1 || $setting->getValue('recaptcha_enabled_registrations') != 1 || $rsp->is_valid) { if ($setting->getValue('recaptcha_enabled') != 1 || $setting->getValue('recaptcha_enabled_registrations') != 1 || $rsp->is_valid) {
// Check if recaptcha is enabled, process form data if valid or disabled // Check if recaptcha is enabled, process form data if valid or disabled
isset($_POST['token']) ? $token = $_POST['token'] : $token = ''; isset($_POST['token']) ? $token = $_POST['token'] : $token = '';
if ($user->register(@$_POST['username'], @$_POST['coinaddress'], @$_POST['password1'], @$_POST['password2'], @$_POST['pin'], @$_POST['email1'], @$_POST['email2'], @$_POST['tac'], $token)) { isset($_POST['coinaddress']) ? $validcoinaddress = $_POST['coinaddress'] : $validcoinaddress = NULL;
(!$setting->getValue('accounts_confirm_email_disabled')) ? $_SESSION['POPUP'][] = array('CONTENT' => 'Please check your mailbox to activate this account') : $_SESSION['POPUP'][] = array('CONTENT' => 'Account created, please login'); if ($config['check_valid_coinaddress'] AND empty($validcoinaddress)) {
$_SESSION['POPUP'][] = array('CONTENT' => 'Please enter a valid Wallet Address', 'TYPE' => 'alert alert-danger');
} else { } else {
$_SESSION['POPUP'][] = array('CONTENT' => 'Unable to create account: ' . $user->getError(), 'TYPE' => 'alert alert-danger'); if ($user->register(@$_POST['username'], $validcoinaddress, @$_POST['password1'], @$_POST['password2'], @$_POST['pin'], @$_POST['email1'], @$_POST['email2'], @$_POST['tac'], $token)) {
(!$setting->getValue('accounts_confirm_email_disabled')) ? $_SESSION['POPUP'][] = array('CONTENT' => 'Please check your mailbox to activate this account') : $_SESSION['POPUP'][] = array('CONTENT' => 'Account created, please login');
} else {
$_SESSION['POPUP'][] = array('CONTENT' => 'Unable to create account: ' . $user->getError(), 'TYPE' => 'alert alert-danger');
}
} }
} }
} else { } else {

View File

@ -26,7 +26,7 @@ if ( ! $dPoolHashrateModifier = $setting->getValue('statistics_pool_hashrate_mod
$iCurrentPoolHashrate = $statistics->getCurrentHashrate(); $iCurrentPoolHashrate = $statistics->getCurrentHashrate();
// Avoid confusion, ensure our nethash isn't higher than poolhash // Avoid confusion, ensure our nethash isn't higher than poolhash
if ($iCurrentPoolHashrate > $dNetworkHashrate / 1000) $dNetworkHashrate = $iCurrentPoolHashrate; if ($iCurrentPoolHashrate > $dNetworkHashrate / 1000) $dNetworkHashrate = $iCurrentPoolHashrate * 1000;
// Baseline network hashrate for templates // Baseline network hashrate for templates
if ( ! $dPersonalHashrateModifier = $setting->getValue('statistics_personal_hashrate_modifier') ) $dPersonalHashrateModifier = 1; if ( ! $dPersonalHashrateModifier = $setting->getValue('statistics_personal_hashrate_modifier') ) $dPersonalHashrateModifier = 1;
@ -63,6 +63,7 @@ $aGlobal = array(
'reward' => $config['reward_type'] == 'fixed' ? $config['reward'] : $block->getAverageAmount(), 'reward' => $config['reward_type'] == 'fixed' ? $config['reward'] : $block->getAverageAmount(),
'price' => $setting->getValue('price'), 'price' => $setting->getValue('price'),
'twofactor' => $config['twofactor'], 'twofactor' => $config['twofactor'],
'coinaddresscheck' => $config['check_valid_coinaddress'],
'csrf' => $config['csrf'], 'csrf' => $config['csrf'],
'config' => array( 'config' => array(
'date' => $setting->getValue('system_date_format', '%m/%d/%Y %H:%M:%S'), 'date' => $setting->getValue('system_date_format', '%m/%d/%Y %H:%M:%S'),

View File

@ -2,7 +2,7 @@
$defflip = (!cfip()) ? exit(header('HTTP/1.1 401 Unauthorized')) : 1; $defflip = (!cfip()) ? exit(header('HTTP/1.1 401 Unauthorized')) : 1;
define('MPOS_VERSION', '0.0.4'); define('MPOS_VERSION', '0.0.4');
define('DB_VERSION', '0.0.10'); define('DB_VERSION', '0.0.11');
define('CONFIG_VERSION', '0.0.8'); define('CONFIG_VERSION', '0.0.8');
define('HASH_VERSION', 1); define('HASH_VERSION', 1);

View File

@ -620,4 +620,8 @@ div.fade {
color: #F79D00; color: #F79D00;
} }
.toggleSoundButton {
width: 30px;
}
/* End Footer */ /* End Footer */

View File

@ -155,8 +155,8 @@ CREATE TABLE IF NOT EXISTS `shares` (
) ENGINE=InnoDB DEFAULT CHARSET=utf8; ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `shares_archive` ( CREATE TABLE IF NOT EXISTS `shares_archive` (
`id` int(255) unsigned NOT NULL AUTO_INCREMENT, `id` bigint(30) unsigned NOT NULL AUTO_INCREMENT,
`share_id` int(255) unsigned NOT NULL, `share_id` bigint(30) unsigned NOT NULL,
`username` varchar(120) NOT NULL, `username` varchar(120) NOT NULL,
`our_result` enum('Y','N') DEFAULT NULL, `our_result` enum('Y','N') DEFAULT NULL,
`upstream_result` enum('Y','N') DEFAULT NULL, `upstream_result` enum('Y','N') DEFAULT NULL,

View File

@ -13,7 +13,7 @@
{if $DISABLE_IDLEWORKERNOTIFICATIONS|default:"" != 1} {if $DISABLE_IDLEWORKERNOTIFICATIONS|default:"" != 1}
<tr> <tr>
<td> <td>
<label>IDLE Worker</label> <label>Idle Worker</label>
</td> </td>
<td> <td>
<input type="hidden" name="data[idle_worker]" value="0" /> <input type="hidden" name="data[idle_worker]" value="0" />
@ -93,7 +93,7 @@
<td> <td>
{if $NOTIFICATIONS[notification].type == new_block}New Block {if $NOTIFICATIONS[notification].type == new_block}New Block
{else if $NOTIFICATIONS[notification].type == payout}Payout {else if $NOTIFICATIONS[notification].type == payout}Payout
{else if $NOTIFICATIONS[notification].type == idle_worker}IDLE Worker {else if $NOTIFICATIONS[notification].type == idle_worker}Idle Worker
{else if $NOTIFICATIONS[notification].type == success_login}Successful Login {else if $NOTIFICATIONS[notification].type == success_login}Successful Login
{/if} {/if}
</td> </td>

View File

@ -53,7 +53,7 @@
<div class="panel-footer"> <div class="panel-footer">
<div style="text-align:right"> <div style="text-align:right">
<a href='{$smarty.server.SCRIPT_NAME}?page={$smarty.request.page|escape}&action=news_edit&id={$NEWS[news].id}'><i class="fa fa-wrench fa-fw"></i></a>&nbsp; <a href='{$smarty.server.SCRIPT_NAME}?page={$smarty.request.page|escape}&action=news_edit&id={$NEWS[news].id}'><i class="fa fa-wrench fa-fw"></i></a>&nbsp;
<a href='{$smarty.server.SCRIPT_NAME}?page={$smarty.request.page|escape}&action={$smarty.request.action|escape}&do=delete&id={$NEWS[news].id}'><i class="fa fa-trash-o fa-fw"></i></a> <a href='{$smarty.server.SCRIPT_NAME}?page={$smarty.request.page|escape}&action={$smarty.request.action|escape}&do=delete&id={$NEWS[news].id}&ctoken={$CTOKEN|escape|default:""}'><i class="fa fa-trash-o fa-fw"></i></a>
</div> </div>
</div> </div>
</div> </div>
@ -61,4 +61,3 @@
{/section} {/section}
{/nocache} {/nocache}
</div> </div>

View File

@ -3,21 +3,21 @@
$.ajax({ $.ajax({
type: "POST", type: "POST",
url: "{$smarty.server.SCRIPT_NAME}", url: "{$smarty.server.SCRIPT_NAME}",
data: "page={$smarty.request.page|escape}&action={$smarty.request.action|escape}&do=fee&account_id=" + id, data: "page={$smarty.request.page|escape}&action={$smarty.request.action|escape}&do=fee&account_id=" + id + "&ctoken={$smarty.request.ctoken|escape}",
}); });
} }
function storeLock(id) { function storeLock(id) {
$.ajax({ $.ajax({
type: "POST", type: "POST",
url: "{$smarty.server.SCRIPT_NAME}", url: "{$smarty.server.SCRIPT_NAME}",
data: "page={$smarty.request.page|escape}&action={$smarty.request.action|escape}&do=lock&account_id=" + id, data: "page={$smarty.request.page|escape}&action={$smarty.request.action|escape}&do=lock&account_id=" + id + "&ctoken={$smarty.request.ctoken|escape}",
}); });
} }
function storeAdmin(id) { function storeAdmin(id) {
$.ajax({ $.ajax({
type: "POST", type: "POST",
url: "{$smarty.server.SCRIPT_NAME}", url: "{$smarty.server.SCRIPT_NAME}",
data: "page={$smarty.request.page|escape}&action={$smarty.request.action|escape}&do=admin&account_id=" + id, data: "page={$smarty.request.page|escape}&action={$smarty.request.action|escape}&do=admin&account_id=" + id + "&ctoken={$smarty.request.ctoken|escape}",
}); });
} }
</script> </script>
@ -147,4 +147,4 @@
</div> </div>
</div> </div>
</div> </div>
</div> </div>

View File

@ -37,6 +37,11 @@
</tbody> </tbody>
</table> </table>
</div> </div>
<div id="togglesound" class="togglesound">
<div class="panel-footer text-right">
<button id="muteButton" type="button" class="btn-xs btn-success toggleSoundButton"><i class="fa fa-volume-up"></i></button>
</div>
</div>
</div> </div>
</div> </div>
{/if} {/if}

View File

@ -3,10 +3,23 @@
<script> <script>
{literal} {literal}
$(document).ready(function(){ $(document).ready(function(){
var audioPath = "{/literal}{$PATH}{literal}/audio/";
var manifest = [ {id:"ding", src:"ding.ogg"} ]; var canCreateSoundJS = false;
createjs.Sound.alternateExtensionseExtensions = ["mp3"];
createjs.Sound.registerManifest(manifest, audioPath); // check if the default plugins can be loaded, if not, disable button and don't load soundjs
if (!createjs.Sound.initializeDefaultPlugins()) {
$('#togglesound').hide();
// don't create object and hide toggle on mobile devices. must be started inside a touch event, else sound doesn't start
} else if (createjs.Sound.BrowserDetect.isIOS || createjs.Sound.BrowserDetect.isAndroid || createjs.Sound.BrowserDetect.isBlackberry) {
$('#togglesound').hide();
} else {
var audioPath = "{/literal}{$PATH}{literal}/audio/";
var manifest = [ {id:"ding", src:"ding.ogg"} ];
var muteFlag = 1;
createjs.Sound.alternateExtensionseExtensions = ["mp3"];
createjs.Sound.registerManifest(manifest, audioPath);
canCreateSoundJS = true;
}
// Ajax API URL // Ajax API URL
var url_dashboard = "{/literal}{$smarty.server.SCRIPT_NAME}?page=api&action=getdashboarddata&api_key={$GLOBAL.userdata.api_key}&id={$GLOBAL.userdata.id}{literal}"; var url_dashboard = "{/literal}{$smarty.server.SCRIPT_NAME}?page=api&action=getdashboarddata&api_key={$GLOBAL.userdata.api_key}&id={$GLOBAL.userdata.id}{literal}";
@ -165,7 +178,9 @@ $(document).ready(function(){
return; return;
} }
if (blocks[0].height > lastBlock) { if (blocks[0].height > lastBlock) {
createjs.Sound.play('ding'); if(canCreateSoundJS) {
createjs.Sound.play('ding');
}
lastBlock = blocks[0].height; lastBlock = blocks[0].height;
var table_content = '<tbody id="b-blocks">'; var table_content = '<tbody id="b-blocks">';
for (index = 0; index < blocks.length; ++index) { for (index = 0; index < blocks.length; ++index) {
@ -250,6 +265,23 @@ $(document).ready(function(){
} }
}); });
})(); })();
// Mute Button
$('#muteButton').click(function(){
if(muteFlag == 2) {
muteFlag = 1;
createjs.Sound.setMute(false);
$(this).toggleClass("btn-xs btn-danger").toggleClass("btn-xs btn-success");
$(this).find($(".fa")).removeClass('fa-volume-off').addClass('fa-volume-up');
} else {
muteFlag = 2;
createjs.Sound.setMute(true);
$(this).toggleClass("btn-xs btn-success").toggleClass("btn-xs btn-danger");
$(this).find($(".fa")).removeClass('fa-volume-up').addClass('fa-volume-off');
}
});
}); });
{/literal} {/literal}
</script> </script>

View File

@ -22,11 +22,13 @@
<span class="input-group-addon"><i class="fa fa-user fa-fw"></i></span> <span class="input-group-addon"><i class="fa fa-user fa-fw"></i></span>
<input type="text" class="form-control" name="username" placeholder="Username" value="{$smarty.post.username|escape|default:""}" size="15" maxlength="20" required> <input type="text" class="form-control" name="username" placeholder="Username" value="{$smarty.post.username|escape|default:""}" size="15" maxlength="20" required>
</div> </div>
{if $GLOBAL.coinaddresscheck|default:"1"}
<label>Coin Address</label> <label>Coin Address</label>
<div class="input-group input-group-sm"> <div class="input-group input-group-sm">
<span class="input-group-addon"><i class="fa fa-money fa-fw"></i></span> <span class="input-group-addon"><i class="fa fa-money fa-fw"></i></span>
<input type="text" name="coinaddress" placeholder="Coin Address" class="form-control" value="{$smarty.post.coinaddress|escape|default:""}" size="15" required> <input type="text" name="coinaddress" placeholder="Coin Address" class="form-control" value="{$smarty.post.coinaddress|escape|default:""}" size="15" required>
</div> </div>
{/if}
<label>Password</label> (<span id="pw_strength">Strength</span>) <label>Password</label> (<span id="pw_strength">Strength</span>)
<div class="input-group input-group-sm"> <div class="input-group input-group-sm">
<span class="input-group-addon"><i class="fa fa-key fa-fw"></i></span> <span class="input-group-addon"><i class="fa fa-key fa-fw"></i></span>

View File

@ -0,0 +1,31 @@
<?php
function run_0011() {
// Ugly but haven't found a better way
global $setting, $config, $user, $mysqli;
// Version information
$db_version_old = '0.0.10'; // What version do we expect
$db_version_new = '0.0.11'; // What is the new version we wish to upgrade to
$db_version_now = $setting->getValue('DB_VERSION'); // Our actual version installed
// Upgrade specific variables
$aSql[] = "ALTER TABLE `shares_archive` CHANGE `id` `id` BIGINT(30) unsigned NOT NULL AUTO_INCREMENT";
$aSql[] = "ALTER TABLE `shares_archive` CHANGE `share_id` `share_id` BIGINT(30) unsigned NOT NULL";
$aSql[] = "UPDATE " . $setting->getTableName() . " SET value = '0.0.11' WHERE name = 'DB_VERSION'";
if ($db_version_now == $db_version_old && version_compare($db_version_now, DB_VERSION, '<')) {
// Run the upgrade
echo '- Starting database migration to version ' . $db_version_new . PHP_EOL;
foreach ($aSql as $sql) {
echo '- Preparing: ' . $sql . PHP_EOL;
$stmt = $mysqli->prepare($sql);
if ($stmt && $stmt->execute()) {
echo '- success' . PHP_EOL;
} else {
echo '- failed: ' . $mysqli->error . PHP_EOL;
exit(1);
}
}
}
}
?>