Skip to content

Commit 22e8877

Browse files
committed
Merge branch 'development' into coin-rounding-setting
2 parents 9c73e01 + 8cf7c99 commit 22e8877

File tree

14 files changed

+1355
-60
lines changed

14 files changed

+1355
-60
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Description
22
===========
33

4-
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
4+
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 - Be **PATIENT** ... People listed in this channel may currently be inactive but most users there have offline logging of messages. They **will** see your questions and answer if they can. Don't join, ask the question and leave. Sit around if you want answers to your questions!
55

66

77
**NOTE**: This project is still under development and commits are happening on a daily basis.

include/autoloader.inc.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,18 @@
3434
require_once(INCLUDE_DIR . '/lib/swiftmailer/swift_required.php');
3535

3636
// Detect device
37-
if ( PHP_SAPI == 'cli') {
37+
require_once(INCLUDE_DIR . '/lib/Mobile_Detect.php');
38+
$detect = new Mobile_Detect;
39+
40+
if ($detect->isMobile()) {
41+
$theme = $setting->getValue('website_mobile_theme', 'bootstrap');
42+
} else if ( PHP_SAPI == 'cli') {
3843
// Create a new compile folder just for crons
3944
// We call mail templates directly anyway
4045
$theme = 'cron';
4146
} else {
4247
// Use configured theme, fallback to default theme
43-
$setting->getValue('website_theme') ? $theme = $setting->getValue('website_theme') : $theme = 'bootstrap';
48+
$theme = $setting->getValue('website_theme', 'bootstrap');
4449
}
4550
define('THEME', $theme);
4651

include/config/admin_settings.inc.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,13 @@
6969
'name' => 'website_theme', 'value' => $setting->getValue('website_theme'),
7070
'tooltip' => 'The default theme used on your pool.'
7171
);
72+
$aSettings['website'][] = array(
73+
'display' => 'Website mobile theme', 'type' => 'select',
74+
'options' => $aThemes,
75+
'default' => 'bootstrap',
76+
'name' => 'website_mobile_theme', 'value' => $setting->getValue('website_mobile_theme'),
77+
'tooltip' => 'The mobile theme used on your pool.'
78+
);
7279
$aSettings['website'][] = array(
7380
'display' => 'Website Design', 'type' => 'select',
7481
'options' => $aDesigns,

include/lib/Mobile_Detect.php

Lines changed: 1248 additions & 0 deletions
Large diffs are not rendered by default.

include/pages/admin/newsletter.inc.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
$iSuccess = 0;
2121
foreach ($user->getAllAssoc() as $aData) {
2222
$aUserNotificationSettings = $notification->getNotificationSettings($aData['id']);
23-
if ($aData['is_locked'] != 0 || $aUserNotificationSettings['newsletter'] != 1) continue;
23+
if ($aData['is_locked'] != 0 || $aUserNotificationSettings['newsletter'] != 1 || empty($aData['email'])) continue;
2424
$aData['subject'] = $_REQUEST['data']['subject'];
2525
$aData['CONTENT'] = $_REQUEST['data']['content'];
2626
if (!$mail->sendMail('newsletter/body', $aData, true)) {

include/pages/api/public.inc.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,9 @@
1919
'workers' => $worker->getCountAllActiveWorkers(),
2020
'shares_this_round' => $aShares['valid'],
2121
'last_block' => $aLastBlock['height'],
22-
'network_hashrate' => $dNetworkHashrate
22+
'network_hashrate' => $dNetworkHashrate,
23+
'fee' => $config['fees'],
24+
'payout' => $config['payout_system']
2325
)
2426
);
2527

include/pages/login.inc.php

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -18,28 +18,30 @@
1818
}
1919
}
2020

21-
if ($setting->getValue('maintenance') && !$user->isAdmin($user->getUserIdByEmail($_POST['username']))) {
22-
$_SESSION['POPUP'][] = array('CONTENT' => 'You are not allowed to login during maintenace.', 'TYPE' => 'info');
23-
} else if (!empty($_POST['username']) && !empty($_POST['password'])) {
24-
// Check if recaptcha is enabled, process form data if valid
25-
if (!$setting->getValue('recaptcha_enabled') || !$setting->getValue('recaptcha_enabled_logins') || ($setting->getValue('recaptcha_enabled') && $setting->getValue('recaptcha_enabled_logins') && $rsp->is_valid)) {
26-
if (!$config['csrf']['enabled'] || $config['csrf']['enabled'] && $csrftoken->valid) {
27-
// check if login is correct
28-
if ($user->checkLogin(@$_POST['username'], @$_POST['password']) ) {
29-
$port = ($_SERVER["SERVER_PORT"] == "80" || $_SERVER["SERVER_PORT"] == "443") ? "" : (":".$_SERVER["SERVER_PORT"]);
30-
$location = (@$_SERVER['HTTPS'] == "on") ? 'https://' : 'http://';
31-
$location .= $_SERVER['SERVER_NAME'] . $port . $_SERVER['SCRIPT_NAME'];
32-
$location.= '?page=dashboard';
33-
if (!headers_sent()) header('Location: ' . $location);
34-
exit('<meta http-equiv="refresh" content="0; url=' . htmlspecialchars($location) . '"/>');
21+
if (!empty($_POST['username']) && !empty($_POST['password'])) {
22+
if ($setting->getValue('maintenance') && !$user->isAdmin($user->getUserIdByEmail($_POST['username']))) {
23+
$_SESSION['POPUP'][] = array('CONTENT' => 'You are not allowed to login during maintenace.', 'TYPE' => 'alert alert-info');
24+
} else {
25+
// Check if recaptcha is enabled, process form data if valid
26+
if (!$setting->getValue('recaptcha_enabled') || !$setting->getValue('recaptcha_enabled_logins') || ($setting->getValue('recaptcha_enabled') && $setting->getValue('recaptcha_enabled_logins') && $rsp->is_valid)) {
27+
if (!$config['csrf']['enabled'] || $config['csrf']['enabled'] && $csrftoken->valid) {
28+
// check if login is correct
29+
if ($user->checkLogin(@$_POST['username'], @$_POST['password']) ) {
30+
$port = ($_SERVER["SERVER_PORT"] == "80" || $_SERVER["SERVER_PORT"] == "443") ? "" : (":".$_SERVER["SERVER_PORT"]);
31+
$location = (@$_SERVER['HTTPS'] == "on") ? 'https://' : 'http://';
32+
$location .= $_SERVER['SERVER_NAME'] . $port . $_SERVER['SCRIPT_NAME'];
33+
$location.= '?page=dashboard';
34+
if (!headers_sent()) header('Location: ' . $location);
35+
exit('<meta http-equiv="refresh" content="0; url=' . htmlspecialchars($location) . '"/>');
36+
} else {
37+
$_SESSION['POPUP'][] = array('CONTENT' => 'Unable to login: '.$user->getError(), 'TYPE' => 'alert alert-danger');
38+
}
3539
} else {
36-
$_SESSION['POPUP'][] = array('CONTENT' => 'Unable to login: '.$user->getError(), 'TYPE' => 'alert alert-danger');
40+
$_SESSION['POPUP'][] = array('CONTENT' => $csrftoken->getErrorWithDescriptionHTML(), 'TYPE' => 'alert alert-warning');
3741
}
3842
} else {
39-
$_SESSION['POPUP'][] = array('CONTENT' => $csrftoken->getErrorWithDescriptionHTML(), 'TYPE' => 'alert alert-warning');
43+
$_SESSION['POPUP'][] = array('CONTENT' => 'Invalid Captcha, please try again.', 'TYPE' => 'alert alert-danger');
4044
}
41-
} else {
42-
$_SESSION['POPUP'][] = array('CONTENT' => 'Invalid Captcha, please try again.', 'TYPE' => 'alert alert-danger');
4345
}
4446
}
4547
// Load login template

scripts/test_email.php

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<?php
2+
3+
// Change to working directory
4+
chdir(dirname(__FILE__));
5+
6+
// Include all settings and classes
7+
require_once('shared.inc.php');
8+
9+
// Send email
10+
$aMailData = array(
11+
'email' => $setting->getValue('system_error_email'),
12+
'subject' => 'Test email from mining pool',
13+
'coinname' => $config['gettingstarted']['coinname'],
14+
'stratumurl' => $config['gettingstarted']['stratumurl'],
15+
'stratumport' => $config['gettingstarted']['stratumport']
16+
);
17+
18+
if (!$mail->sendMail('notifications/test_email', $aMailData))
19+
echo "Failed to send test email" . PHP_EOL;

sql/000_base_structure.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ CREATE TABLE IF NOT EXISTS `transactions` (
242242
CREATE TABLE `statistics_users` (
243243
`id` int(11) NOT NULL AUTO_INCREMENT,
244244
`account_id` int(11) NOT NULL,
245-
`hashrate` int(11) NOT NULL,
245+
`hashrate` bigint(20) unsigned NOT NULL,
246246
`workers` int(11) NOT NULL,
247247
`sharerate` float NOT NULL,
248248
`timestamp` int(11) NOT NULL,

templates/bootstrap/about/pool/default.tpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<div class="panel-body">
88
<ul>
99
<li><b><i>Q: When will I get paid?</b></i></li>
10-
&nbsp;<b>A:</b> This pool uses the follwing payout system.<br>
10+
&nbsp;<b>A:</b> This pool uses the following payout system.<br>
1111
{if $GLOBAL.config.payout_system == 'prop'}
1212
<br>
1313
<b>Proportional (Prop)</b> - The block reward is distributed among miners in proportion to the number of shares they submitted in a round. The expected reward per share depends on the number of shares already submitted in the round.

0 commit comments

Comments
 (0)