Skip to content

Commit 27391e6

Browse files
committed
Merge pull request #2117 from MPOS/development
UPDATE : Development to Master
2 parents 3f615a6 + 81f632c commit 27391e6

File tree

633 files changed

+23648
-2190
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

633 files changed

+23648
-2190
lines changed

.gitignore

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
11
# Local Config
2-
/public/include/config/global.inc.php
3-
/public/include/config/security.inc.php
2+
/include/config/global.inc.php
3+
/include/config/security.inc.php
44

55
# Templates
6-
/public/templates/compile/*.php
7-
/public/templates/compile/**
8-
/public/templates/cache/*.php
9-
/public/templates/cache/**
6+
/templates/compile/*.php
7+
/templates/compile/**
8+
/templates/cache/*.php
9+
/templates/cache/**
1010

1111
# Logs
1212
/cronjobs/logs
1313
/cronjobs/logs/**.txt.*.gz
1414
/logs/*
1515

1616
# Test configs
17-
public/include/config/global.inc.scrypt.php
18-
public/include/config/global.inc.sha.php
17+
/include/config/global.inc.scrypt.php
18+
/include/config/global.inc.sha.php
1919

2020
# IDE Settings
2121
/.idea/*

.htaccess

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
11
ErrorDocument 404 /public/index.php?page=error&action=404
22
RedirectMatch 404 /logs(/|$)
3-
Options -Indexes
3+
RedirectMatch 404 /templates(/|$)
4+
RedirectMatch 404 /include(/|$)
5+
RedirectMatch 404 /scripts(/|$)
6+
RedirectMatch 404 /sql(/|$)
7+
RedirectMatch 404 /upgrade(/|$)
8+
RedirectMatch 404 /cronjobs(/|$)
9+
RedirectMatch 404 /tests(/|$)
10+
Options -Indexes

cronjobs/logs/README.md

Lines changed: 0 additions & 1 deletion
This file was deleted.

cronjobs/payouts.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,9 @@
6969
foreach ($aManualPayouts as $aUserData) $dMPTotalAmount += $aUserData['confirmed'];
7070
if ($dMPTotalAmount > $dWalletBalance) {
7171
$log->logError(" Wallet does not cover MP payouts - Payout: " . $dMPTotalAmount . " - Balance: " . $dWalletBalance);
72-
$monitoring->endCronjob($cron_name, 'E0079', 0, true);
72+
$monitoring->endCronjob($cron_name, 'E0079', 1, true);
7373
}
74-
74+
7575
$log->logInfo("Manual Payout Sum: " . $dMPTotalAmount . " | Liquid Assets: " . $dWalletBalance . " | Wallet Balance: " . ($dWalletBalance + $dBlocksUnconfirmedBalance) . " | Unconfirmed: " . $dBlocksUnconfirmedBalance);
7676
$log->logInfo(' found ' . count($aManualPayouts) . ' queued manual payouts');
7777
$mask = ' | %-10.10s | %-25.25s | %-20.20s | %-40.40s | %-20.20s |';
@@ -156,9 +156,9 @@
156156
foreach ($aAutoPayouts as $aUserData) $dAPTotalAmount += $aUserData['confirmed'];
157157
if ($dAPTotalAmount > $dWalletBalance) {
158158
$log->logError(" Wallet does not cover AP payouts - Payout: " . $dAPTotalAmount . " - Balance: " . $dWalletBalance);
159-
$monitoring->endCronjob($cron_name, 'E0079', 0, true);
159+
$monitoring->endCronjob($cron_name, 'E0079', 1, true);
160160
}
161-
161+
162162
$log->logInfo("Auto Payout Sum: " . $dAPTotalAmount . " | Liquid Assets: " . $dWalletBalance . " | Wallet Balance: " . ($dWalletBalance + $dBlocksUnconfirmedBalance) . " | Unconfirmed: " . $dBlocksUnconfirmedBalance);
163163
$log->logInfo(' found ' . count($aAutoPayouts) . ' queued auto payouts');
164164
$mask = ' | %-10.10s | %-25.25s | %-20.20s | %-40.40s | %-20.20s |';

cronjobs/pplns_payout.php

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -115,30 +115,30 @@
115115
// Add archived shares to users current shares, if we have any in archive
116116
if (is_array($aArchiveShares)) {
117117
$log->logDebug('Found shares in archive to match PPLNS target, calculating per-user shares');
118-
$strLogMask = "| %-20.20s | %15.15s | %15.15s | %15.15s | %15.15s | %15.15s | %15.15s |";
119-
$log->logDebug(sprintf($strLogMask, 'Username', 'Round Valid', 'Archive Valid', 'Total Valid', 'Round Invalid', 'Archive Invalid', 'Total Invalid'));
118+
$strLogMask = "| %5.5s | %-20.20s | %15.15s | %15.15s | %15.15s | %15.15s | %15.15s | %15.15s |";
119+
$log->logDebug(sprintf($strLogMask, 'ID', 'Username', 'Round Valid', 'Archive Valid', 'Total Valid', 'Round Invalid', 'Archive Invalid', 'Total Invalid'));
120120
foreach($aAccountShares as $key => $aData) {
121-
if (array_key_exists($aData['username'], $aArchiveShares)) {
122-
$log->logDebug(sprintf($strLogMask, $aData['username'],
123-
$aAccountShares[$key]['valid'], $aArchiveShares[$aData['username']]['valid'], ($aAccountShares[$key]['valid'] + $aArchiveShares[$aData['username']]['valid']),
124-
$aAccountShares[$key]['invalid'], $aArchiveShares[$aData['username']]['invalid'], ($aAccountShares[$key]['invalid'] + $aArchiveShares[$aData['username']]['invalid']))
121+
if (array_key_exists(strtolower($aData['username']), $aArchiveShares)) {
122+
$log->logDebug(sprintf($strLogMask, $aData['id'], $aData['username'],
123+
$aAccountShares[$key]['valid'], $aArchiveShares[strtolower($aData['username'])]['valid'], ($aAccountShares[$key]['valid'] + $aArchiveShares[strtolower($aData['username'])]['valid']),
124+
$aAccountShares[$key]['invalid'], $aArchiveShares[strtolower($aData['username'])]['invalid'], ($aAccountShares[$key]['invalid'] + $aArchiveShares[strtolower($aData['username'])]['invalid']))
125125
);
126-
$aAccountShares[$key]['valid'] += $aArchiveShares[$aData['username']]['valid'];
127-
$aAccountShares[$key]['invalid'] += $aArchiveShares[$aData['username']]['invalid'];
126+
$aAccountShares[$key]['valid'] += $aArchiveShares[strtolower($aData['username'])]['valid'];
127+
$aAccountShares[$key]['invalid'] += $aArchiveShares[strtolower($aData['username'])]['invalid'];
128128
}
129129
}
130130
// reverse payout
131131
if ($config['pplns']['reverse_payout']) {
132132
$log->logDebug('Reverse payout enabled, adding shelved shares for all users');
133133
$aSharesData = NULL;
134134
foreach($aAccountShares as $key => $aData) {
135-
$aSharesData[$aData['username']] = $aData;
135+
$aSharesData[strtolower($aData['username'])] = $aData;
136136
}
137137
// Add users from archive not in current round
138138
$strLogMask = "| %-20.20s | %15.15s | %15.15s |";
139139
$log->logDebug(sprintf($strLogMask, 'Username', 'Shelved Valid', 'Shelved Invalid'));
140140
foreach($aArchiveShares as $key => $aArchData) {
141-
if (!array_key_exists($aArchData['account'], $aSharesData)) {
141+
if (!array_key_exists(strtolower($aArchData['account']), $aSharesData)) {
142142
$log->logDebug(sprintf($strLogMask, $aArchData['account'], $aArchData['valid'], $aArchData['invalid']));
143143
$aArchData['username'] = $aArchData['account'];
144144
$aSharesData[$aArchData['account']] = $aArchData;

cronjobs/shared.inc.php

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ function cfip() { return (@defined('SECURITY')) ? 1 : 0; }
3535

3636
// MODIFY THIS
3737
// We need to find our include files so set this properly
38-
define("BASEPATH", "../public/");
38+
define("BASEPATH", dirname(__FILE__) . "/");
3939

4040
/*****************************************************
4141
* No need to change beyond this point *
@@ -48,14 +48,8 @@ function cfip() { return (@defined('SECURITY')) ? 1 : 0; }
4848
$cron_name = basename($_SERVER['PHP_SELF'], '.php');
4949

5050
// Include our configuration (holding defines for the requires)
51-
require_once(BASEPATH . 'include/config/global.inc.dist.php');
52-
require_once(BASEPATH . 'include/config/global.inc.php');
53-
54-
require_once(BASEPATH . 'include/config/security.inc.dist.php');
55-
@include_once(BASEPATH . 'include/config/security.inc.php');
56-
57-
require_once(BASEPATH . 'include/bootstrap.php');
58-
require_once(BASEPATH . 'include/version.inc.php');
51+
require_once(BASEPATH . '../include/bootstrap.php');
52+
require_once(BASEPATH . '../include/version.inc.php');
5953

6054
// Command line switches
6155
array_shift($argv);
@@ -69,7 +63,7 @@ function cfip() { return (@defined('SECURITY')) ? 1 : 0; }
6963
}
7064

7165
// Load 3rd party logging library for running crons
72-
$log = KLogger::instance( 'logs/' . $cron_name, KLogger::INFO );
66+
$log = KLogger::instance( BASEPATH . '../logs/' . $cron_name, KLogger::INFO );
7367
$log->LogDebug('Starting ' . $cron_name);
7468

7569
// Load the start time for later runtime calculations for monitoring

public/include/admin_checks.php renamed to include/admin_checks.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,10 @@
5353
}
5454

5555
// check if we can write templates/cache and templates/compile -> error
56-
if (!is_writable(THEME_DIR.'/cache')) {
56+
if (!is_writable(TEMPLATE_DIR . '/cache')) {
5757
$error[] = "templates/cache folder is not writable for uid {$apache_user['name']}";
5858
}
59-
if (!is_writable(THEME_DIR.'/compile')) {
59+
if (!is_writable(TEMPLATE_DIR . '/compile')) {
6060
$error[] = "templates/compile folder is not writable for uid {$apache_user['name']}";
6161
}
6262

public/include/autoloader.inc.php renamed to include/autoloader.inc.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
require_once(CLASS_DIR . '/base.class.php');
1818
require_once(CLASS_DIR . '/coins/coin_base.class.php');
1919
require_once(CLASS_DIR . '/setting.class.php');
20+
require_once(INCLUDE_DIR . '/version.inc.php');
21+
if (PHP_OS == 'WINNT') require_once(CLASS_DIR . '/memcached.class.php');
2022

2123
// Now decide on which coin class to load and instantiate
2224
if (file_exists(CLASS_DIR . '/coins/coin_' . $config['algorithm'] . '.class.php')) {

public/include/bootstrap.php renamed to include/bootstrap.php

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,20 @@
33
// Used for performance calculations
44
$dStartTime = microtime(true);
55

6-
define('INCLUDE_DIR', BASEPATH . 'include');
6+
define('INCLUDE_DIR', BASEPATH . '../include');
77
define('CLASS_DIR', INCLUDE_DIR . '/classes');
88
define('PAGES_DIR', INCLUDE_DIR . '/pages');
9-
define('THEME_DIR', BASEPATH . 'templates');
9+
define('TEMPLATE_DIR', BASEPATH . '../templates');
1010

1111
$quickstartlink = "<a href='https://github.com/MPOS/php-mpos/wiki/Quick-Start-Guide' title='MPOS Quick Start Guide'>Quick Start Guide</a>";
1212

1313
// Include our configuration (holding defines for the requires)
14-
if (!include_once(BASEPATH . 'include/config/global.inc.dist.php')) die('Unable to load base global config from ['.BASEPATH . 'include/config/global.inc.dist.php' . '] - '.$quickstartlink);
15-
if (!@include_once(BASEPATH . 'include/config/global.inc.php')) die('Unable to load your global config from ['.BASEPATH . 'include/config/global.inc.php' . '] - '.$quickstartlink);
14+
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);
15+
if (!@include_once(INCLUDE_DIR . '/config/global.inc.php')) die('Unable to load your global config from ['.INCLUDE_DIR. '/config/global.inc.php' . '] - '.$quickstartlink);
1616

1717
// load our security configs
18-
if (!include_once(BASEPATH . 'include/config/security.inc.dist.php')) die('Unable to load base security config from ['.BASEPATH . 'include/config/security.inc.dist.php' . '] - '.$quickstartlink);
19-
if (@file_exists(BASEPATH . 'include/config/security.inc.php')) include_once(BASEPATH . 'include/config/security.inc.php');
18+
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);
19+
if (@file_exists(INCLUDE_DIR . '/config/security.inc.php')) include_once(INCLUDE_DIR . '/config/security.inc.php');
2020

2121
// start our session, we need it for smarty caching
2222
session_set_cookie_params(time()+$config['cookie']['duration'], $config['cookie']['path'], $config['cookie']['domain'], $config['cookie']['secure'], $config['cookie']['httponly']);
@@ -29,11 +29,19 @@
2929
}
3030
@setcookie(session_name(), session_id(), time()+$config['cookie']['duration'], $config['cookie']['path'], $config['cookie']['domain'], $config['cookie']['secure'], $config['cookie']['httponly']);
3131

32+
// Set the timezone if a user has it set, default UTC
33+
if (isset($_SESSION['USERDATA']['timezone'])) {
34+
$aTimezones = DateTimeZone::listIdentifiers();
35+
date_default_timezone_set($aTimezones[$_SESSION['USERDATA']['timezone']]);
36+
} else {
37+
date_default_timezone_set('UTC');
38+
}
39+
3240
// Our default template to load, pages can overwrite this later
3341
$master_template = 'master.tpl';
3442

3543
// Load Classes, they name defines the $ variable used
3644
// We include all needed files here, even though our templates could load them themself
3745
require_once(INCLUDE_DIR . '/autoloader.inc.php');
3846

39-
?>
47+
?>
File renamed without changes.

0 commit comments

Comments
 (0)