Admin Panel Setting to disable/enable AP/MP

This will allow admins to temporarily or permanantly enable and disable
auto and manual payout processing.

Fixes #488
This commit is contained in:
Sebastian Grewe 2013-07-19 11:12:28 +02:00
parent 43923fe4e9
commit 7fce187ab0
6 changed files with 36 additions and 1 deletions

View File

@ -22,6 +22,14 @@ limitations under the License.
// Include all settings and classes
require_once('shared.inc.php');
if ($setting->getValue('disable_ap') == 1) {
$log->logInfo(" auto payout disabled via admin panel");
$monitoring->setStatus($cron_name . "_active", "yesno", 0);
$monitoring->setStatus($cron_name . "_message", "message", "Auto-Payout disabled");
$monitoring->setStatus($cron_name . "_status", "okerror", 1);
exit(0);
}
if ($bitcoin->can_connect() !== true) {
$log->logFatal(" unable to connect to RPC server, exiting");
$monitoring->setStatus($cron_name . "_active", "yesno", 0);
@ -34,7 +42,7 @@ if ($bitcoin->can_connect() !== true) {
$users = $user->getAllAutoPayout();
// Quick summary
$log->logInfo(" found " . count($users) . " queued payout(s)");
if (count($users) > 0) $log->logInfo(" found " . count($users) . " queued payout(s)");
// Go through users and run transactions
if (! empty($users)) {

View File

@ -12,6 +12,8 @@ if ($user->isAuthenticated()) {
case 'cashOut':
if ($setting->getValue('manual_payout_active') == 1) {
$_SESSION['POPUP'][] = array('CONTENT' => 'A manual payout is in progress. Please try again later.', 'TYPE' => 'errormsg');
} else if ($setting->getValue('disable_mp') == 1) {
$_SESSION['POPUP'][] = array('CONTENT' => 'Manual payouts are disabled.', 'TYPE' => 'info');
} else {
$setting->setValue('manual_payout_active', 1);
$continue = true;

View File

@ -20,6 +20,8 @@ if (@$_REQUEST['do'] == 'save' && !empty($_REQUEST['data'])) {
$smarty->assign("MAINTENANCE", $setting->getValue('maintenance'));
$smarty->assign("LOCKREGISTRATION", $setting->getValue('lock_registration'));
$smarty->assign("DISABLEINVITATIONS", $setting->getValue('disable_invitations'));
$smarty->assign("DISABLEAP", $setting->getValue('disable_ap'));
$smarty->assign("DISABLEMP", $setting->getValue('disable_mp'));
// Tempalte specifics
$smarty->assign("CONTENT", "default.tpl");

View File

@ -46,6 +46,7 @@ $aGlobal = array(
'price' => $setting->getValue('price'),
'blockexplorer' => $config['blockexplorer'],
'chaininfo' => $config['chaininfo'],
'disable_mp' => $setting->getValue('disable_mp'),
'config' => array(
'website' => $config['website'],
'accounts' => $config['accounts'],

View File

@ -20,6 +20,7 @@
<input type="submit" class="submit long" value="Update Settings"></form>
{include file="global/block_footer.tpl"}
{if !$GLOBAL.disable_mp}
{include file="global/block_header.tpl" BLOCK_HEADER="Cash Out"}
<ul><li><font color="">Please note: a {$GLOBAL.config.txfee} {$GLOBAL.config.currency} transaction will apply when processing "On-Demand" manual payments</font></li></ul>
<form action="{$smarty.server.PHP_SELF}" method="post">
@ -33,6 +34,7 @@
</tbody></table>
<input type="submit" class="submit mid" value="Cash Out"></form>
{include file="global/block_footer.tpl"}
{/if}
{include file="global/block_header.tpl" BLOCK_HEADER="Change Password"}
<ul><li><font color="">Note: You will be redirected to login on successful completion of a password change</font></li></ul>

View File

@ -40,6 +40,26 @@
</select>
</td>
</tr>
<tr>
<td class="left">Disable Auto Payout</td>
<td class="center"><span id='tt'><img src='{$PATH}/images/questionmark.png' height='15px' width='15px' title='Enable or disable users to invite others. Configuration file defines number of allowed invitations.'></span></td>
<td>
<select name="data[disable_ap]">
<option value="1">Yes</option>
<option value="0"{nocache}{if !$DISABLEAP} selected{/if}{/nocache}>No</option>
</select>
</td>
</tr>
<tr>
<td class="left">Disable Manual Payout</td>
<td class="center"><span id='tt'><img src='{$PATH}/images/questionmark.png' height='15px' width='15px' title='Enable or disable users to invite others. Configuration file defines number of allowed invitations.'></span></td>
<td>
<select name="data[disable_mp]">
<option value="1">Yes</option>
<option value="0"{nocache}{if !$DISABLEMP} selected{/if}{/nocache}>No</option>
</select>
</td>
</tr>
<tr><td class="center" colspan="3"><input type="submit" value="Save" class="submit small" /></td></tr>
</tbody>
</table>