Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
e5ef906
[UPDATE] mute blocknotify
iAmShorty May 22, 2014
6210a1a
[UPDATE] changed behavior and use jQuery
iAmShorty May 23, 2014
9072d94
Create 0.0.10_to_0.0.11.inc.php
iAmShorty May 26, 2014
62ed569
Create 012_shares_archive_update.sql
iAmShorty May 26, 2014
5bbc8ac
Update global.inc.dist.php
iAmShorty May 26, 2014
8dded88
Update version.inc.php
iAmShorty May 26, 2014
7f0f2ff
Update 000_base_structure.sql
iAmShorty May 26, 2014
c4ecd18
[UPDATE] config option for register with valid coin address
iAmShorty May 28, 2014
36d77bb
[UPDATE] changed wiki url
iAmShorty May 28, 2014
61f52f4
Delete 012_shares_archive_update.sql
iAmShorty Jun 3, 2014
bf1091b
Merge pull request #2209 from MPOS/shares-archive-bigint
iAmShorty Jun 3, 2014
691acbd
Merge pull request #2215 from MPOS/coin-address-check
iAmShorty Jun 3, 2014
cfd1bcc
[ADDED] test config
iAmShorty Jun 4, 2014
80909ef
[UPDATE] change loading behavior, check if soundjs can be executed
iAmShorty Jun 4, 2014
fd8cd88
Merge pull request #2201 from iAmShorty/mute-blocknotify
iAmShorty Jun 4, 2014
9a3791b
[UPDATE] hide toggle on mobile devices
iAmShorty Jun 5, 2014
e881eab
[FIX] fixed button size when icon changes
iAmShorty Jun 5, 2014
87150f2
Merge pull request #2226 from MPOS/fixed-sound-toggle
iAmShorty Jun 5, 2014
18621d4
[FIX] shares_archive table
iAmShorty Jun 5, 2014
2839d18
[FIX] dunno, but my editor cutted the end of file
iAmShorty Jun 5, 2014
c381af8
Merge pull request #2228 from MPOS/mysql-table-fix
iAmShorty Jun 5, 2014
5d8fecf
[SECRUITY] Fix XSS vulnerability in API Callback
MPOS123 Jun 10, 2014
9d0e1f2
[FIX] CSRF protection for admin settings/user/news
iAmShorty Jun 5, 2014
1d5e69d
Merge pull request #2227 from MPOS/admin-csrf-protection
TheSerapher Jun 10, 2014
14eb0f5
README update
TheSerapher Jun 10, 2014
44dd97b
[CHANGE] Find max ID first
TheSerapher Jun 15, 2014
22aff8e
Corrected Uppercase 'IDLE' To Match Format
daygle Jun 18, 2014
35d2060
Merge pull request #2244 from daygle/patch-1
iAmShorty Jun 18, 2014
bc7596e
Removed codeship img
TheSerapher Jun 20, 2014
e7f1408
Added some other donation addresses
TheSerapher Jun 20, 2014
4591c1f
[FIX] Fixes #2252
MPOS123 Jun 25, 2014
363b742
Merge pull request #2254 from MPOS/issue-2252
TheSerapher Jun 25, 2014
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
/logs/*

# Test configs
/include/config/global.inc.test.php
/include/config/global.inc.scrypt.php
/include/config/global.inc.sha.php

Expand Down
21 changes: 12 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -15,7 +15,10 @@ Donations to this project are going directly to [TheSerapher](https://github.com

* LTC address: `Lge95QR2frp9y1wJufjUPCycVsg5gLJPW8`
* BTC address: `1HuYK6WPU8o3yWCrAaADDZPRpL5QiXitfv`
* DOGE Address: `D6YtvxFGBmaD8Yq3i8LZsBQVPvCbZwCDzF`
* DOGE address: `DANk8bnc3vHEf7Jthaxq1Xgn1BSiArNdjG`
* 42Coin address: `4VxA6Ht59Mj6ikhA4gDXLiHuAaDCJEvYTZ`
* FST address: `fiRqMgZyhjTN1GSEB3ZxV35JXsE5bjEaQ2`
* FRK address: `FDcgGZjX2B29qevSuiuQVwXhkNhtQT4cEW`
* Cryptsy Trade Key: `6ff7292142463b7b80cbbbdfc52334ba89727b11`

Website Footer
Expand Down Expand Up @@ -79,23 +82,22 @@ The following feature have been implemented so far:

* Fully re-written GUI with [Smarty][2] templates
* Full file based template support
* **NEW** SQL based templates
* Mobile WebUI
* Scrypt, SHA256, VARDIFF Support
* VARDIFF Support
* Reward Systems
* Propotional, PPS and PPLNS
* New Theme
* Live Dashboard
* AJAX Support
* Overhauled API
* Bootstrap
* Web User accounts
* Re-Captcha protected registration form
* Worker accounts
* Worker activity
* Worker hashrates
* Pool statistics
* Block statistics
* Pool donations, fees and block bonuses
* Pool donations, bonuses, fees and block bonuses
* Manual and auto payout
* Transaction list
* Admin Panel
Expand All @@ -105,7 +107,6 @@ The following feature have been implemented so far:
* User Transactions
* News Posts
* Pool Settings
* Templates
* Pool Workers
* User Reports
* Template Overwrite
Expand All @@ -115,9 +116,11 @@ The following feature have been implemented so far:
* Auto Payout
* Manual Payout
* User-to-user Invitation System
* Support for various coins via config
* Support for various coins via coin class and config
* All scrypt coins
* All sha256d coins
* All x11 coins
* Others may be supported by creating a custom coin class

Installation
============
Expand All @@ -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
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 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
Expand Down
4 changes: 3 additions & 1 deletion include/classes/api.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,10 @@ function get_json($data, $force=false) {
)), $force ? JSON_FORCE_OBJECT : 0
);
// 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 $json;
}

Expand Down
2 changes: 1 addition & 1 deletion include/classes/share.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,8 @@ function getMaxArchiveShareId() {
* return array data Returns an array with usernames as keys for easy access
**/
function getArchiveShares($iCount) {
$iMinId = $this->getMinArchiveShareId($iCount);
$iMaxId = $this->getMaxArchiveShareId();
$iMinId = $this->getMinArchiveShareId($iCount);
$stmt = $this->mysqli->prepare("
SELECT
a.id,
Expand Down
6 changes: 3 additions & 3 deletions include/classes/tools.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ public function getOnlineVersions() {
curl_setopt($curl, CURLOPT_HEADER, false);
$data = curl_exec($curl);
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);
$mpos_versions['DB_VERSION'] = $match[1];
$mpos_versions['DB_VERSION'] = @$match[1];
preg_match('/define\(\'CONFIG_VERSION\', \'(.*)\'\);/', $data, $match);
$mpos_versions['CONFIG_VERSION'] = $match[1];
$mpos_versions['CONFIG_VERSION'] = @$match[1];
curl_close($curl);
return $this->memcache->setCache($key, $mpos_versions, 30);
} else {
Expand Down
10 changes: 6 additions & 4 deletions include/classes/user.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -741,9 +741,11 @@ public function register($username, $coinaddress, $password1, $password2, $pin,
$this->setErrorMessage('Username exceeding character limit');
return false;
}
if (!$this->bitcoin->validateaddress($coinaddress)) {
$this->setErrorMessage('Coin address is not valid');
return false;
if (!is_null($coinaddress)) {
if (!$this->bitcoin->validateaddress($coinaddress)) {
$this->setErrorMessage('Coin address is not valid');
return false;
}
}
if (preg_match('/[^a-z_\-0-9]/i', $username)) {
$this->setErrorMessage('Username may only contain alphanumeric characters');
Expand Down Expand Up @@ -841,7 +843,7 @@ public function register($username, $coinaddress, $password1, $password2, $pin,
} else {
$this->setErrorMessage( 'Unable to register' );
$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;
Expand Down
8 changes: 7 additions & 1 deletion include/config/global.inc.dist.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,20 @@
* https://github.com/MPOS/php-mpos/wiki/Config-Setup#wiki-config-version
**/
$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.
* https://github.com/MPOS/php-mpos/wiki/Config-Setup#wiki-config-check
*/
$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
* Debug setting and salts for hashing passwords
Expand Down
32 changes: 20 additions & 12 deletions include/pages/admin/news.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,23 +10,31 @@
// Include markdown library
use \Michelf\Markdown;

if (@$_REQUEST['do'] == 'toggle_active')
if ($news->toggleActive($_REQUEST['id']))
$_SESSION['POPUP'][] = array('CONTENT' => 'News entry changed', 'TYPE' => 'alert alert-success');
if (@$_REQUEST['do'] == 'toggle_active') {
if (!$config['csrf']['enabled'] || $config['csrf']['enabled'] && $csrftoken->valid) {
if ($news->toggleActive($_REQUEST['id'])) {
$_SESSION['POPUP'][] = array('CONTENT' => 'News entry changed', 'TYPE' => 'alert alert-success');
}
}
}

if (@$_REQUEST['do'] == 'add') {
if ($news->addNews($_SESSION['USERDATA']['id'], $_POST['data'])) {
$_SESSION['POPUP'][] = array('CONTENT' => 'News entry added', 'TYPE' => 'alert alert-success');
} else {
$_SESSION['POPUP'][] = array('CONTENT' => 'Failed to add new entry: ' . $news->getError(), 'TYPE' => 'alert alert-danger');
if (!$config['csrf']['enabled'] || $config['csrf']['enabled'] && $csrftoken->valid) {
if ($news->addNews($_SESSION['USERDATA']['id'], $_POST['data'])) {
$_SESSION['POPUP'][] = array('CONTENT' => 'News entry added', 'TYPE' => 'alert alert-success');
} else {
$_SESSION['POPUP'][] = array('CONTENT' => 'Failed to add new entry: ' . $news->getError(), 'TYPE' => 'alert alert-danger');
}
}
}

if (@$_REQUEST['do'] == 'delete') {
if ($news->deleteNews((int)$_REQUEST['id'])) {
$_SESSION['POPUP'][] = array('CONTENT' => 'Succesfully removed news entry', 'TYPE' => 'alert alert-success');
} else {
$_SESSION['POPUP'][] = array('CONTENT' => 'Failed to delete entry: ' . $news->getError(), 'TYPE' => 'alert alert-danger');
if (!$config['csrf']['enabled'] || $config['csrf']['enabled'] && $csrftoken->valid) {
if ($news->deleteNews((int)$_REQUEST['id'])) {
$_SESSION['POPUP'][] = array('CONTENT' => 'Succesfully removed news entry', 'TYPE' => 'alert alert-success');
} else {
$_SESSION['POPUP'][] = array('CONTENT' => 'Failed to delete entry: ' . $news->getError(), 'TYPE' => 'alert alert-danger');
}
}
}

Expand All @@ -38,4 +46,4 @@
}
$smarty->assign("NEWS", $aNews);
$smarty->assign("CONTENT", "default.tpl");
?>
?>
14 changes: 8 additions & 6 deletions include/pages/admin/news_edit.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,18 @@
// Include markdown library
use \Michelf\Markdown;

if (@$_REQUEST['do'] == 'save') {
if ($news->updateNews($_REQUEST['id'], $_REQUEST['header'], $_REQUEST['content'], $_REQUEST['active'])) {
$_SESSION['POPUP'][] = array('CONTENT' => 'News updated', 'TYPE' => 'alert alert-success');
} else {
$_SESSION['POPUP'][] = array('CONTENT' => 'News update failed: ' . $news->getError(), 'TYPE' => 'alert alert-danger');
if (!$config['csrf']['enabled'] || $config['csrf']['enabled'] && $csrftoken->valid) {
if (@$_REQUEST['do'] == 'save') {
if ($news->updateNews($_REQUEST['id'], $_REQUEST['header'], $_REQUEST['content'], $_REQUEST['active'])) {
$_SESSION['POPUP'][] = array('CONTENT' => 'News updated', 'TYPE' => 'alert alert-success');
} else {
$_SESSION['POPUP'][] = array('CONTENT' => 'News update failed: ' . $news->getError(), 'TYPE' => 'alert alert-danger');
}
}
}

// Fetch news entry
$aNews = $news->getEntry($_REQUEST['id']);
$smarty->assign("NEWS", $aNews);
$smarty->assign("CONTENT", "default.tpl");
?>
?>
14 changes: 9 additions & 5 deletions include/pages/admin/settings.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,15 @@
}

if (@$_REQUEST['do'] == 'save' && !empty($_REQUEST['data'])) {
$user->log->log("warn", @$_SESSION['USERDATA']['username']." changed admin settings");
foreach($_REQUEST['data'] as $var => $value) {
$setting->setValue($var, $value);
if (!$config['csrf']['enabled'] || $config['csrf']['enabled'] && $csrftoken->valid) {
$user->log->log("warn", @$_SESSION['USERDATA']['username']." changed admin settings");
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
Expand All @@ -23,4 +27,4 @@

// Tempalte specifics
$smarty->assign("CONTENT", "default.tpl");
?>
?>
42 changes: 22 additions & 20 deletions include/pages/admin/user.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,26 +16,28 @@
$smarty->assign('NOFEE', array('' => '', '0' => 'No', '1' => 'Yes'));

// Catch our JS queries to update some settings
switch (@$_REQUEST['do']) {
case 'lock':
$supress_master = 1;
// Reset user account
if ($user->isLocked($_POST['account_id']) == 0) {
$user->setLocked($_POST['account_id'], 2);
} else {
$user->setLocked($_POST['account_id'], 0);
$user->setUserFailed($_POST['account_id'], 0);
$user->setUserPinFailed($_POST['account_id'], 0);
if (!$config['csrf']['enabled'] || $config['csrf']['enabled'] && $csrftoken->valid) {
switch (@$_REQUEST['do']) {
case 'lock':
$supress_master = 1;
// Reset user account
if ($user->isLocked($_POST['account_id']) == 0) {
$user->setLocked($_POST['account_id'], 2);
} else {
$user->setLocked($_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
Expand Down Expand Up @@ -81,4 +83,4 @@

// Tempalte specifics
$smarty->assign("CONTENT", "default.tpl");
?>
?>
11 changes: 8 additions & 3 deletions include/pages/register/register.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,15 @@
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
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)) {
(!$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');
isset($_POST['coinaddress']) ? $validcoinaddress = $_POST['coinaddress'] : $validcoinaddress = NULL;
if ($config['check_valid_coinaddress'] AND empty($validcoinaddress)) {
$_SESSION['POPUP'][] = array('CONTENT' => 'Please enter a valid Wallet Address', 'TYPE' => 'alert alert-danger');
} 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 {
Expand Down
3 changes: 2 additions & 1 deletion include/smarty_globals.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
$iCurrentPoolHashrate = $statistics->getCurrentHashrate();

// 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
if ( ! $dPersonalHashrateModifier = $setting->getValue('statistics_personal_hashrate_modifier') ) $dPersonalHashrateModifier = 1;
Expand Down Expand Up @@ -63,6 +63,7 @@
'reward' => $config['reward_type'] == 'fixed' ? $config['reward'] : $block->getAverageAmount(),
'price' => $setting->getValue('price'),
'twofactor' => $config['twofactor'],
'coinaddresscheck' => $config['check_valid_coinaddress'],
'csrf' => $config['csrf'],
'config' => array(
'date' => $setting->getValue('system_date_format', '%m/%d/%Y %H:%M:%S'),
Expand Down
2 changes: 1 addition & 1 deletion include/version.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
$defflip = (!cfip()) ? exit(header('HTTP/1.1 401 Unauthorized')) : 1;

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('HASH_VERSION', 1);

Expand Down
4 changes: 4 additions & 0 deletions public/site_assets/bootstrap/css/mpos.css
Original file line number Diff line number Diff line change
Expand Up @@ -620,4 +620,8 @@ div.fade {
color: #F79D00;
}

.toggleSoundButton {
width: 30px;
}

/* End Footer */
4 changes: 2 additions & 2 deletions sql/000_base_structure.sql
Original file line number Diff line number Diff line change
Expand Up @@ -155,8 +155,8 @@ CREATE TABLE IF NOT EXISTS `shares` (
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

CREATE TABLE IF NOT EXISTS `shares_archive` (
`id` int(255) unsigned NOT NULL AUTO_INCREMENT,
`share_id` int(255) unsigned NOT NULL,
`id` bigint(30) unsigned NOT NULL AUTO_INCREMENT,
`share_id` bigint(30) unsigned NOT NULL,
`username` varchar(120) NOT NULL,
`our_result` enum('Y','N') DEFAULT NULL,
`upstream_result` enum('Y','N') DEFAULT NULL,
Expand Down
Loading