Permalink
Browse files

Merge pull request #2517 from MPOS/development

UPDATE : Development to Master
  • Loading branch information...
TheSerapher committed Jul 18, 2017
2 parents 2549e40 + 0387451 commit f7f0437174f49ebe97755dbf5421fa37ba5689d2
Showing with 2,034 additions and 15,008 deletions.
  1. +4 −1 .gitignore
  2. +2 −2 .travis.yml
  3. +6 −0 cronjobs/shared.inc.php
  4. +3 −0 include/autoloader.inc.php
  5. +12 −0 include/classes/base.class.php
  6. +11 −0 include/classes/coins/coin_neoscrypt.class.php
  7. +11 −0 include/classes/coins/coin_x13.class.php
  8. +11 −0 include/classes/coins/coin_x15.class.php
  9. +6 −0 include/classes/ipushnotification.interface.php
  10. +2 −2 include/classes/monitoring.class.php
  11. +21 −8 include/classes/notification.class.php
  12. +41 −0 include/classes/push_notification/notifymyandroid.php
  13. +46 −0 include/classes/push_notification/pushover.php
  14. +171 −0 include/classes/pushnotification.class.php
  15. +1 −0 include/classes/transaction.class.php
  16. +1 −1 include/classes/user.class.php
  17. +100 −0 include/classes/usersettings.class.php
  18. +21 −0 include/config/admin_settings.inc.php
  19. +2 −0 include/config/error_codes.inc.php
  20. +23 −1 include/pages/account/notifications.inc.php
  21. +10 −2 include/pages/gettingstarted.inc.php
  22. +11 −1 include/pages/statistics.inc.php
  23. +1 −1 include/pages/statistics/uptime.inc.php
  24. +7 −0 include/smarty_globals.inc.php
  25. +2 −2 include/version.inc.php
  26. +320 −144 public/site_assets/bootstrap/css/bootstrap.css
  27. +1 −1 public/site_assets/bootstrap/css/bootstrap.css.map
  28. +3 −2 public/site_assets/bootstrap/css/bootstrap.min.css
  29. +1 −0 public/site_assets/bootstrap/css/bootstrap.min.css.map
  30. +5 −0 public/site_assets/bootstrap/css/mpos.css
  31. +1 −235 public/site_assets/bootstrap/css/plugins/dataTables/dataTables.bootstrap.css
  32. +99 −0 public/site_assets/bootstrap/css/plugins/metisMenu/metisMenu.css
  33. +136 −57 public/site_assets/bootstrap/css/plugins/social-buttons/social-buttons.css
  34. +2 −2 public/site_assets/bootstrap/font-awesome/css/font-awesome.min.css
  35. BIN public/site_assets/bootstrap/font-awesome/fonts/FontAwesome.otf
  36. BIN public/site_assets/bootstrap/font-awesome/fonts/fontawesome-webfont.eot
  37. +146 −26 public/site_assets/bootstrap/font-awesome/fonts/fontawesome-webfont.svg
  38. BIN public/site_assets/bootstrap/font-awesome/fonts/fontawesome-webfont.ttf
  39. BIN public/site_assets/bootstrap/font-awesome/fonts/fontawesome-webfont.woff
  40. BIN public/site_assets/bootstrap/font-awesome/fonts/fontawesome-webfont.woff2
  41. +4 −4 public/site_assets/bootstrap/js/bootstrap.min.js
  42. +0 −4 public/site_assets/bootstrap/js/jquery-2.1.3.min.js
  43. +0 −1 public/site_assets/bootstrap/js/jquery-2.1.3.min.map
  44. +0 −125 public/site_assets/bootstrap/js/jquery-ui.custom.min.js
  45. +4 −0 public/site_assets/bootstrap/js/jquery.min.js
  46. +1 −0 public/site_assets/bootstrap/js/jquery.min.map
  47. +2 −2 public/site_assets/bootstrap/js/jquery.qrcode.min.js
  48. +11 −0 public/site_assets/bootstrap/js/mpos.js
  49. +8 −245 public/site_assets/bootstrap/js/plugins/dataTables/dataTables.bootstrap.js
  50. +166 −14,013 public/site_assets/bootstrap/js/plugins/dataTables/jquery.dataTables.js
  51. +363 −40 public/site_assets/bootstrap/js/plugins/metisMenu/jquery.metisMenu.js
  52. +3 −3 public/site_assets/bootstrap/js/plugins/morris/morris-0.5.1.min.js
  53. +8 −1 sql/000_base_structure.sql
  54. +134 −68 templates/bootstrap/account/notifications/default.tpl
  55. +2 −0 templates/bootstrap/admin/monitoring/default.tpl
  56. +1 −1 templates/bootstrap/admin/wallet/peers.tpl
  57. +1 −1 templates/bootstrap/admin/wallet/transactions.tpl
  58. +2 −0 templates/bootstrap/dashboard/blocks/default.tpl
  59. +28 −10 templates/bootstrap/dashboard/js/api.tpl
  60. +1 −1 templates/bootstrap/gettingstarted/default.tpl
  61. +4 −0 templates/bootstrap/global/navigation.tpl
  62. +2 −1 templates/bootstrap/master.tpl
  63. 0 templates/bootstrap/start/default.tpl
  64. +5 −0 templates/mail/push_notifications/idle_worker.tpl
  65. +1 −0 templates/mail/push_notifications/new_block.tpl
  66. +1 −0 templates/mail/push_notifications/payout.tpl
  67. +5 −0 templates/mail/push_notifications/success_login.tpl
  68. +37 −0 upgrade/definitions/1.0.1_to_1.0.2.inc.php
View
@@ -37,4 +37,7 @@
/vendor/
tests/_output/*
tests/_output/*
# NetBeans Project Directory
/nbproject/*
View
@@ -18,7 +18,7 @@ branches:
install:
- wget http://selenium-release.storage.googleapis.com/2.42/selenium-server-standalone-2.42.2.jar
- composer global require "fxp/composer-asset-plugin:1.0.0-beta2"
- composer global require "fxp/composer-asset-plugin:~1.1.1"
- composer install
@@ -38,4 +38,4 @@ script:
after_script:
- wget https://scrutinizer-ci.com/ocular.phar
- php ocular.phar code-coverage:upload --format=php-clover tests/_output/coverage.xml
- php ocular.phar code-coverage:upload --format=php-clover tests/_output/coverage.xml
View
@@ -69,6 +69,12 @@ function cfip() { return (@defined('SECURITY')) ? 1 : 0; }
// Load the start time for later runtime calculations for monitoring
$cron_start[$cron_name] = microtime(true);
// Skip all crons if admin enabled pool maintenance
if ($setting->getValue('maintenance')) {
$log->logInfo('Cronjobs disabled due to pool maintenance');
$monitoring->endCronjob($cron_name, 'E0083', 2, true, false);
}
// Check if our cron is activated
if ($monitoring->isDisabled($cron_name)) {
$log->logFatal('Cronjob is currently disabled due to errors, use -f option to force running cron.');
@@ -78,5 +78,8 @@
require_once(CLASS_DIR . '/roundstats.class.php');
require_once(CLASS_DIR . '/news.class.php');
require_once(CLASS_DIR . '/api.class.php');
require_once(CLASS_DIR . '/usersettings.class.php');
require_once(CLASS_DIR . '/ipushnotification.interface.php');
require_once(CLASS_DIR . '/pushnotification.class.php');
require_once(INCLUDE_DIR . '/lib/Michelf/Markdown.php');
require_once(INCLUDE_DIR . '/lib/scrypt.php');
@@ -16,6 +16,8 @@ class Base {
public function getTableName() {
return $this->table;
}
protected $debug;
public function setDebug($debug) {
$this->debug = $debug;
}
@@ -25,9 +27,13 @@ public function setCoin($coin) {
public function setCoinAddress($coin_address) {
$this->coin_address = $coin_address;
}
public $log;
public function setLog($log) {
$this->log = $log;
}
protected $mysqli;
public function setMysql($mysqli) {
$this->mysqli = $mysqli;
}
@@ -40,6 +46,10 @@ public function setSalt($salt) {
public function setSalty($salt) {
$this->salty = $salt;
}
/**
* @var Smarty
*/
var $smarty;
public function setSmarty($smarty) {
$this->smarty = $smarty;
}
@@ -52,6 +62,8 @@ public function setSessionManager($session) {
public function setConfig($config) {
$this->config = $config;
}
protected $aErrorCodes;
public function setErrorCodes(&$aErrorCodes) {
$this->aErrorCodes =& $aErrorCodes;
}
@@ -0,0 +1,11 @@
<?php
$defflip = (!cfip()) ? exit(header('HTTP/1.1 401 Unauthorized')) : 1;
/**
* We extend our CoinBase class
* No need to change anything, base class supports
* scrypt and sha256d
**/
class Coin extends CoinBase {
protected $target_bits = 16;
}
@@ -0,0 +1,11 @@
<?php
$defflip = (!cfip()) ? exit(header('HTTP/1.1 401 Unauthorized')) : 1;
/**
* We extend our CoinBase class
* No need to change anything, base class supports
* scrypt and sha256d
**/
class Coin extends CoinBase {
protected $target_bits = 24;
protected $share_difficulty_precision = 4;
}
@@ -0,0 +1,11 @@
<?php
$defflip = (!cfip()) ? exit(header('HTTP/1.1 401 Unauthorized')) : 1;
/**
* We extend our CoinBase class
* No need to change anything, base class supports
* scrypt and sha256d
**/
class Coin extends CoinBase {
protected $target_bits = 24;
protected $share_difficulty_precision = 4;
}
@@ -0,0 +1,6 @@
<?php
interface IPushNotification {
public static function getName();
public static function getParameters();
public function notify($message, $severity, $event);
}
@@ -12,7 +12,7 @@ class Monitoring extends Base {
public function storeUptimeRobotStatus() {
if ($api_keys = $this->setting->getValue('monitoring_uptimerobot_api_keys')) {
$aJSONData = array();
$url = 'http://api.uptimerobot.com';
$url = 'https://api.uptimerobot.com';
$aMonitors = explode(',', $api_keys);
foreach ($aMonitors as $aData) {
$temp = explode('|', $aData);
@@ -131,7 +131,7 @@ public function endCronjob($cron_name, $msgCode, $exitCode=0, $fatal=false, $mai
$this->setErrorMessage('Failed to send mail notification');
}
if ($fatal) {
if ($exitCode != 0) $this->setStatus($cron_name . "_disabled", "yesno", 1);
if ($exitCode == 1) $this->setStatus($cron_name . "_disabled", "yesno", 1);
exit($exitCode);
}
}
@@ -149,14 +149,27 @@ public function sendNotification($account_id, $strType, $aMailData) {
return false;
}
// Check if this user wants strType notifications
$stmt = $this->mysqli->prepare("SELECT account_id FROM $this->tableSettings WHERE type = ? AND active = 1 AND account_id = ?");
if ($stmt && $stmt->bind_param('si', $strType, $account_id) && $stmt->execute() && $stmt->bind_result($id) && $stmt->fetch()) {
if ($stmt->close() && $this->sendMail('notifications/' . $strType, $aMailData) && $this->addNotification($account_id, $strType, $aMailData)) {
return true;
} else {
$this->setErrorMessage('SendMail call failed: ' . $this->getError());
return false;
}
$stmt = $this->mysqli->prepare("SELECT type FROM $this->tableSettings WHERE type IN (?, ?) AND active = 1 AND account_id = ?");
if ($stmt && $stmt->bind_param('ssi', $strType, substr('push_'.$strType, 0, 15), $account_id) && $stmt->execute() && $result = $stmt->get_result()) {
$types = array_map(function($a){ return reset($a);}, $result->fetch_all(MYSQLI_ASSOC));
$stmt->close();
$result = true;
foreach ($types as $type){
if (strpos($type, 'push_') === 0){
if (PushNotification::Instance() instanceof PushNotification){
$result &= PushNotification::Instance()->sendNotification($account_id, $strType, $aMailData);
}
} else {
$result &= $this->sendMail('notifications/' . $strType, $aMailData);
}
}
if ($result){
$this->addNotification($account_id, $strType, $aMailData);
return true;
} else {
$this->setErrorMessage('SendMail call failed: ' . $this->getError());
return false;
}
} else {
$this->setErrorMessage('User disabled ' . $strType . ' notifications');
return true;
@@ -0,0 +1,41 @@
<?php
class Notifications_NotifyMyAndroid implements IPushNotification {
private $apiKey;
public function __construct($apikey){
$this->apiKey = $apikey;
}
static $priorities = array(
0 => 'info',
2 => 'error',
);
public static function getName(){
return "notifymyandroid.com";
}
public static function getParameters(){
return array(
'apikey' => 'API key',
);
}
public function notify($message, $severity = 'info', $event = null){
curl_setopt_array($ch = curl_init(), array(
CURLOPT_URL => "https://www.notifymyandroid.com/publicapi/notify",
CURLOPT_POST => true,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POSTFIELDS => http_build_query($data = array(
"apikey" => $this->apiKey,
"application" => "CryptoGlance",
"description" => $message,
"content-type" => "text/html",
"event" => $event,
"priority" => array_search($severity, self::$priorities),
)),
));
curl_exec($ch);
curl_close($ch);
}
}
@@ -0,0 +1,46 @@
<?php
class Notifications_Pushover implements IPushNotification {
private $token;
private $user;
public function __construct($token, $user){
$this->token = $token;
$this->user = $user;
}
static $priorities = array(
0 => 'info',
1 => 'warning',
2 => 'error',
);
public static function getName(){
return "pushover.net";
}
public static function getParameters(){
return array(
'token' => 'API Token/Key',
'user' => 'Your User Key',
);
}
public function notify($message, $severity = 'info', $event = null){
curl_setopt_array($ch = curl_init(), array(
CURLOPT_URL => "https://api.pushover.net/1/messages.json",
CURLOPT_POST => true,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POSTFIELDS => http_build_query($data = array(
"token" => $this->token,
"user" => $this->user,
"message" => $code = strip_tags(preg_replace('/<([\/]?)span[^>]*>/i', '<\1b>', $message), "<b><i><u><a><font><p><br>"),
"title" => strip_tags($event),
"priority" => (int)array_search($severity, self::$priorities),
"timestamp" => time(),
"html" => preg_match('/<[^>]+>/', $code),
)),
));
curl_exec($ch);
curl_close($ch);
}
}
Oops, something went wrong.

0 comments on commit f7f0437

Please sign in to comment.