[UPDATE] set if motd can be hidden by users

This commit is contained in:
iAmShorty 2014-05-07 13:09:14 +02:00
parent 86c247d0a3
commit ced839f5cf
3 changed files with 103 additions and 1 deletions

View File

@ -27,6 +27,13 @@ $aSettings['website'][] = array(
'name' => 'system_motd_style', 'value' => $setting->getValue('system_motd_style'),
'tooltip' => 'Set the Style what MOTD looks like.'
);
$aSettings['website'][] = array(
'display' => 'MOTD Dismiss', 'type' => 'select',
'options' => array( 0 => 'No', 1 => 'Yes' ),
'default' => 0,
'name' => 'system_motd_dismiss', 'value' => $setting->getValue('system_motd_dismiss'),
'tooltip' => 'Set if users can hide MOTD.'
);
$aSettings['website'][] = array(
'display' => 'Website Name', 'type' => 'text',
'size' => 25,

View File

@ -188,6 +188,11 @@ if (@$_SESSION['USERDATA']['id']) {
if ($setting->getValue('maintenance'))
$_SESSION['POPUP'][] = array('CONTENT' => 'This pool is currently in maintenance mode.', 'TYPE' => 'alert alert-warning');
if ($motd = $setting->getValue('system_motd')) {
if ($setting->getValue('system_motd_dismiss')) {
$motd_dismiss = "yes";
} else {
$motd_dismiss = "no";
}
switch ($setting->getValue('system_motd_style', 0)) {
case 0:
$motd_style = "alert-success";
@ -204,7 +209,7 @@ if ($motd = $setting->getValue('system_motd')) {
default:
$motd_style = "alert-info";
}
$_SESSION['POPUP'][] = array('CONTENT' => $motd, 'DISMISS' => 'yes', 'ID' => 'motd', 'TYPE' => 'alert ' . $motd_style . '');
$_SESSION['POPUP'][] = array('CONTENT' => $motd, 'DISMISS' => $motd_dismiss, 'ID' => 'motd', 'TYPE' => 'alert ' . $motd_style . '');
}
// check for deprecated theme

90
scripts/force_payout.php Normal file
View File

@ -0,0 +1,90 @@
#!/usr/bin/php
<?php
/* script to force payout */
// Change to working directory
chdir(dirname(__FILE__));
// Include all settings and classes
require_once('shared.inc.php');
$options = getopt("abph");
isset($options['a']) ? $allUsers = true : $allUsers = false;
isset($options['b']) ? $balancedUsers = true : $balancedUsers = false;
isset($options['p']) ? $payoutUsers = true : $payoutUsers = false;
if (isset($options['h'])) {
echo "Usage " . basename($argv[0]) . " [-a] [-b] [-p] [-h] :" . PHP_EOL;
echo " -h : Show this help" . PHP_EOL;
echo " -p : Payout all Users with valid Coin Addresses and Balance" . PHP_EOL;
echo " -b : Show only pool users with confirmed balance" . PHP_EOL;
exit(0);
}
// Load 3rd party logging library for running crons
$log = KLogger::instance( BASEPATH . '../logs/forced_payout', KLogger::INFO );
$log->logInfo("Starting Forced Payout...");
// Check and see if the sendmany RPC method is available
// This does not test if it actually works too!
$sendmanyAvailable = ((strpos($bitcoin->help('sendmany'), 'unknown') === FALSE) ? true : false);
if ($sendmanyAvailable)
$log->logDebug(' sendmany available in coind help command');
// Fetch all users
$users = $user->getAllAssoc();
if (!$payoutUsers) {
$mask = "| %6s | %20s | %30s | %20s | %15s |";
$log->logInfo(sprintf($mask, 'ID', 'Username', 'eMail', 'Last Login', 'Balance'));
} else {
$mask = "| %20s | %15s | %50s |";
$log->logInfo(sprintf($mask, 'Username', 'Balance', 'Transaction ID'));
}
$totalSavings = 0;
foreach ($users as $user) {
$id = $user['id'];
$username = $user['username'];
$lastLogin = $user['last_login'];
$coinAddress = $user['coin_address'];
$mailAddress = $user['email'];
// get balances
$balances = $transaction->getBalance($id);
$confirmedBalance = $balances['confirmed'];
$totalSavings += $confirmedBalance;
if(($balancedUsers || $payoutUsers) && $confirmedBalance == 0)
continue;
if ($payoutUsers) {
if ($bitcoin->validateaddress($coinAddress)) {
$transaction_id = 0;
$log->logInfo(sprintf($mask, $username, round($confirmedBalance,8), $transaction_id));
} else {
$log->logFatal(' unable to payout user ' . $username . ', no valid payout address');
/*
$subject = "Account at " . $setting->getValue('website_name') . "!";
$body = "Hi ". $username .",\n\nWe have discovered \
your Payout Address as invalid and you have a Balance of ". $confirmedBalance . " " . $config['currency'] . " left on our Pool. \n
Please set a valid Payout Address at " . . " so we can send the Coins you have mined at our Pool \n\nCheers";
if (mail($mailAddress, $subject, $body)) {
echo("Email successfully sent!");
} else {
echo("Email delivery failed...");
}
*/
}
} else {
$log->logInfo(sprintf($mask, $id, $username, $mailAddress, strftime("%Y-%m-%d %H:%M:%S", $lastLogin), round($confirmedBalance,8)));
}
}
?>