mirror of
https://github.com/GOSTSec/sgminer
synced 2025-01-23 04:54:26 +00:00
Merge pull request #233 from kanoi/master
miner.php enhancements: refresh, restart, font configurable
This commit is contained in:
commit
e30e2f783a
111
miner.php
111
miner.php
@ -3,6 +3,7 @@ session_start();
|
|||||||
#
|
#
|
||||||
global $miner, $port, $readonly, $notify, $rigs, $socktimeoutsec;
|
global $miner, $port, $readonly, $notify, $rigs, $socktimeoutsec;
|
||||||
global $checklastshare, $hidefields;
|
global $checklastshare, $hidefields;
|
||||||
|
global $ignorerefresh, $changerefresh, $autorefresh;
|
||||||
#
|
#
|
||||||
# Don't touch these 2 - see $rigs below
|
# Don't touch these 2 - see $rigs below
|
||||||
$miner = null;
|
$miner = null;
|
||||||
@ -50,6 +51,14 @@ $socktimeoutsec = 10;
|
|||||||
#$hidefields = array('POOL.URL' => 1, 'POOL.User' => 1);
|
#$hidefields = array('POOL.URL' => 1, 'POOL.User' => 1);
|
||||||
$hidefields = array();
|
$hidefields = array();
|
||||||
#
|
#
|
||||||
|
# Auto-refresh of the page (in seconds)
|
||||||
|
# $ignorerefresh = true/false always ignore refresh parameters
|
||||||
|
# $changerefresh = true/false show buttons to change the value
|
||||||
|
# $autorefresh = default value, 0 means dont auto-refresh
|
||||||
|
$ignorerefresh = false;
|
||||||
|
$changerefresh = true;
|
||||||
|
$autorefresh = 0;
|
||||||
|
#
|
||||||
$here = $_SERVER['PHP_SELF'];
|
$here = $_SERVER['PHP_SELF'];
|
||||||
#
|
#
|
||||||
global $tablebegin, $tableend, $warnfont, $warnoff, $dfmt;
|
global $tablebegin, $tableend, $warnfont, $warnoff, $dfmt;
|
||||||
@ -60,6 +69,11 @@ $warnfont = '<font color=red><b>';
|
|||||||
$warnoff = '</b></font>';
|
$warnoff = '</b></font>';
|
||||||
$dfmt = 'H:i:s j-M-Y \U\T\CP';
|
$dfmt = 'H:i:s j-M-Y \U\T\CP';
|
||||||
#
|
#
|
||||||
|
global $miner_font_family, $miner_font_size;
|
||||||
|
#
|
||||||
|
$miner_font_family = 'verdana,arial,sans';
|
||||||
|
$miner_font_size = '13pt';
|
||||||
|
#
|
||||||
# This below allows you to put your own settings into a seperate file
|
# This below allows you to put your own settings into a seperate file
|
||||||
# so you don't need to update miner.php with your preferred settings
|
# so you don't need to update miner.php with your preferred settings
|
||||||
# every time a new version is released
|
# every time a new version is released
|
||||||
@ -76,9 +90,24 @@ $showndate = false;
|
|||||||
global $rigerror;
|
global $rigerror;
|
||||||
$rigerror = array();
|
$rigerror = array();
|
||||||
#
|
#
|
||||||
function htmlhead($checkapi)
|
function htmlhead($checkapi, $rig)
|
||||||
{
|
{
|
||||||
|
global $miner_font_family, $miner_font_size;
|
||||||
global $error, $readonly, $here;
|
global $error, $readonly, $here;
|
||||||
|
global $ignorerefresh, $autorefresh;
|
||||||
|
|
||||||
|
$paramrig = '';
|
||||||
|
if ($rig != null && $rig != '')
|
||||||
|
$paramrig = "&rig=$rig";
|
||||||
|
|
||||||
|
if ($ignorerefresh == true || $autorefresh == 0)
|
||||||
|
$refreshmeta = '';
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$url = "$here?ref=$autorefresh$paramrig";
|
||||||
|
$refreshmeta = "\n<meta http-equiv='refresh' content='$autorefresh;url=$url'>";
|
||||||
|
}
|
||||||
|
|
||||||
if ($readonly === false && $checkapi === true)
|
if ($readonly === false && $checkapi === true)
|
||||||
{
|
{
|
||||||
$access = api('privileged');
|
$access = api('privileged');
|
||||||
@ -87,28 +116,31 @@ function htmlhead($checkapi)
|
|||||||
|| $access['STATUS']['STATUS'] != 'S')
|
|| $access['STATUS']['STATUS'] != 'S')
|
||||||
$readonly = true;
|
$readonly = true;
|
||||||
}
|
}
|
||||||
?>
|
$miner_font = "font-family:$miner_font_family; font-size:$miner_font_size;";
|
||||||
<html><head><title>Mine</title>
|
|
||||||
|
echo "<html><head>$refreshmeta
|
||||||
|
<title>Mine</title>
|
||||||
<style type='text/css'>
|
<style type='text/css'>
|
||||||
td { color:blue; font-family:verdana,arial,sans; font-size:13pt; }
|
td { color:blue; $miner_font }
|
||||||
td.h { color:blue; font-family:verdana,arial,sans; font-size:13pt; background:#d0ffff }
|
td.h { color:blue; $miner_font background:#d0ffff }
|
||||||
td.err { color:black; font-family:verdana,arial,sans; font-size:13pt; background:#ff3050 }
|
td.err { color:black; $miner_font background:#ff3050 }
|
||||||
td.warn { color:black; font-family:verdana,arial,sans; font-size:13pt; background:#ffb050 }
|
td.warn { color:black; $miner_font background:#ffb050 }
|
||||||
td.sta { color:green; font-family:verdana,arial,sans; font-size:13pt; }
|
td.sta { color:green; $miner_font }
|
||||||
td.tot { color:blue; font-family:verdana,arial,sans; font-size:13pt; background:#fff8f2 }
|
td.tot { color:blue; $miner_font background:#fff8f2 }
|
||||||
td.lst { color:blue; font-family:verdana,arial,sans; font-size:13pt; background:#ffffdd }
|
td.lst { color:blue; $miner_font background:#ffffdd }
|
||||||
</style>
|
</style>
|
||||||
</head><body bgcolor=#ecffff>
|
</head><body bgcolor=#ecffff>
|
||||||
<script type='text/javascript'>
|
<script type='text/javascript'>
|
||||||
function pr(a,m){if(m!=null){if(!confirm(m+'?'))return}window.location="<?php echo $here ?>"+a}
|
function pr(a,m){if(m!=null){if(!confirm(m+'?'))return}window.location='$here?ref=$autorefresh'+a}\n";
|
||||||
<?php
|
|
||||||
|
if ($ignorerefresh == false)
|
||||||
|
echo "function prr(a){if(a){v=document.getElementById('refval').value}else{v=0}window.location='$here?ref='+v+'$paramrig'}\n";
|
||||||
|
|
||||||
if ($readonly === false && $checkapi === true)
|
if ($readonly === false && $checkapi === true)
|
||||||
{
|
{
|
||||||
?>
|
echo "function prc(a,m){pr('&arg='+a,m)}
|
||||||
function prc(a,m){pr('?arg='+a,m)}
|
|
||||||
function prs(a,r){var c=a.substr(3);var z=c.split('|',2);var m=z[0].substr(0,1).toUpperCase()+z[0].substr(1)+' GPU '+z[1];prc(a+'&rig='+r,m)}
|
function prs(a,r){var c=a.substr(3);var z=c.split('|',2);var m=z[0].substr(0,1).toUpperCase()+z[0].substr(1)+' GPU '+z[1];prc(a+'&rig='+r,m)}
|
||||||
function prs2(a,n,r){var v=document.getElementById('gi'+n).value;var c=a.substr(3);var z=c.split('|',2);var m='Set GPU '+z[1]+' '+z[0].substr(0,1).toUpperCase()+z[0].substr(1)+' to '+v;prc(a+','+v+'&rig='+r,m)}
|
function prs2(a,n,r){var v=document.getElementById('gi'+n).value;var c=a.substr(3);var z=c.split('|',2);var m='Set GPU '+z[1]+' '+z[0].substr(0,1).toUpperCase()+z[0].substr(1)+' to '+v;prc(a+','+v+'&rig='+r,m)}\n";
|
||||||
<?php
|
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
</script>
|
</script>
|
||||||
@ -778,7 +810,7 @@ function doforeach($cmd, $des, $sum, $head, $datetime)
|
|||||||
foreach ($dthead as $name => $x)
|
foreach ($dthead as $name => $x)
|
||||||
{
|
{
|
||||||
if ($item == 'STATUS' && $name == '')
|
if ($item == 'STATUS' && $name == '')
|
||||||
echo "<td align=right><input type=button value='Rig $rig' onclick='pr(\"?rig=$rig\",null)'></td>";
|
echo "<td align=right><input type=button value='Rig $rig' onclick='pr(\"&rig=$rig\",null)'></td>";
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (isset($row[$name]))
|
if (isset($row[$name]))
|
||||||
@ -861,7 +893,7 @@ function doforeach($cmd, $des, $sum, $head, $datetime)
|
|||||||
if ($rig === 'total')
|
if ($rig === 'total')
|
||||||
echo "<td align=right class=tot>Total:</td>";
|
echo "<td align=right class=tot>Total:</td>";
|
||||||
else
|
else
|
||||||
echo "<td align=right><input type=button value='Rig $rig' onclick='pr(\"?rig=$rig\",null)'></td>";
|
echo "<td align=right><input type=button value='Rig $rig' onclick='pr(\"&rig=$rig\",null)'></td>";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -884,27 +916,42 @@ function doforeach($cmd, $des, $sum, $head, $datetime)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
#
|
#
|
||||||
|
function refreshbuttons()
|
||||||
|
{
|
||||||
|
global $readonly;
|
||||||
|
global $ignorerefresh, $changerefresh, $autorefresh;
|
||||||
|
|
||||||
|
if ($ignorerefresh == false && $changerefresh == true)
|
||||||
|
{
|
||||||
|
echo ' ';
|
||||||
|
echo "<input type=button value='Refresh:' onclick='prr(true)'>";
|
||||||
|
echo "<input type=text name='refval' id='refval' size=2 value='$autorefresh'>";
|
||||||
|
echo "<input type=button value='Off' onclick='prr(false)'>";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#
|
||||||
function doOne($rig, $preprocess)
|
function doOne($rig, $preprocess)
|
||||||
{
|
{
|
||||||
global $error, $readonly, $notify;
|
global $error, $readonly, $notify, $rigs;
|
||||||
global $rigs;
|
|
||||||
|
|
||||||
htmlhead(true);
|
htmlhead(true, $rig);
|
||||||
|
|
||||||
$error = null;
|
$error = null;
|
||||||
|
|
||||||
echo "<tr><td><table cellpadding=0 cellspacing=0 border=0><tr><td>";
|
echo "<tr><td><table cellpadding=0 cellspacing=0 border=0><tr><td>";
|
||||||
echo "<input type=button value='Refresh' onclick='pr(\"?rig=$rig\",null)'></td>";
|
echo "<input type=button value='Refresh' onclick='pr(\"&rig=$rig\",null)'></td>";
|
||||||
if (count($rigs) > 1)
|
if (count($rigs) > 1)
|
||||||
echo "<td><input type=button value='Summary' onclick='pr(\"\",null)'></td>";
|
echo "<td><input type=button value='Summary' onclick='pr(\"\",null)'></td>";
|
||||||
echo "<td width=100%> </td><td>";
|
echo "<td width=100%> </td><td nowrap>";
|
||||||
if ($readonly === false)
|
if ($readonly === false)
|
||||||
{
|
{
|
||||||
$msg = 'Quit CGMiner';
|
$rg = '';
|
||||||
if (count($rigs) > 1)
|
if (count($rigs) > 1)
|
||||||
$msg .= " Rig $rig";
|
$rg = " Rig $rig";
|
||||||
echo "<input type=button value='Quit' onclick='prc(\"quit&rig=$rig\",\"$msg\")'>";
|
echo "<input type=button value='Restart' onclick='prc(\"restart&rig=$rig\",\"Restart CGMiner$rg\")'>";
|
||||||
|
echo " <input type=button value='Quit' onclick='prc(\"quit&rig=$rig\",\"Quit CGMiner$rg\")'>";
|
||||||
}
|
}
|
||||||
|
refreshbuttons();
|
||||||
echo "</td></tr></table></td></tr>";
|
echo "</td></tr></table></td></tr>";
|
||||||
|
|
||||||
if ($preprocess != null)
|
if ($preprocess != null)
|
||||||
@ -930,6 +977,14 @@ function display()
|
|||||||
global $tablebegin, $tableend;
|
global $tablebegin, $tableend;
|
||||||
global $miner, $port;
|
global $miner, $port;
|
||||||
global $error, $readonly, $notify, $rigs;
|
global $error, $readonly, $notify, $rigs;
|
||||||
|
global $ignorerefresh, $autorefresh;
|
||||||
|
|
||||||
|
if ($ignorerefresh == false)
|
||||||
|
{
|
||||||
|
$ref = trim(getparam('ref', true));
|
||||||
|
if ($ref != null && $ref != '')
|
||||||
|
$autorefresh = intval($ref);
|
||||||
|
}
|
||||||
|
|
||||||
$rig = trim(getparam('rig', true));
|
$rig = trim(getparam('rig', true));
|
||||||
|
|
||||||
@ -998,10 +1053,12 @@ function display()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
htmlhead(false);
|
htmlhead(false, null);
|
||||||
|
|
||||||
echo "<tr><td><table cellpadding=0 cellspacing=0 border=0><tr><td>";
|
echo "<tr><td><table cellpadding=0 cellspacing=0 border=0><tr><td>";
|
||||||
echo "<input type=button value='Refresh' onclick='pr(\"\",null)'>";
|
echo "<input type=button value='Refresh' onclick='pr(\"\",null)'>";
|
||||||
|
echo "<td width=100%> </td><td nowrap>";
|
||||||
|
refreshbuttons();
|
||||||
echo "</td></tr></table></td></tr>";
|
echo "</td></tr></table></td></tr>";
|
||||||
|
|
||||||
if ($preprocess != null)
|
if ($preprocess != null)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user