Ejemplo n.º 1
0
function display()
{
    global $miner, $port;
    global $mcast, $mcastexpect;
    global $readonly, $notify, $rigs;
    global $ignorerefresh, $autorefresh;
    global $allowcustompages;
    global $placebuttons;
    global $userlist, $ses;
    $pagesonly = checklogin();
    if ($pagesonly === 'login') {
        return;
    }
    $mcerr = '';
    if ($rigs == null or count($rigs) == 0) {
        if ($mcast === true) {
            $action = 'found';
        } else {
            $action = 'defined';
        }
        minhead();
        otherrow("<td class=bad>No rigs {$action}</td>");
        return;
    } else {
        if ($mcast === true && count($rigs) < $mcastexpect) {
            $mcerr = othrow('<td class=bad>Found ' . count($rigs) . " rigs but expected at least {$mcastexpect}</td>");
        }
    }
    if ($ignorerefresh == false) {
        $ref = trim(getparam('ref', true));
        if ($ref != null && $ref != '') {
            $autorefresh = intval($ref);
        }
    }
    if ($pagesonly !== true) {
        $rig = trim(getparam('rig', true));
        $arg = trim(getparam('arg', true));
        $preprocess = null;
        if ($arg != null and $arg != '') {
            if ($rig != null and $rig != '' and $rig >= 0 and $rig < count($rigs)) {
                $parts = explode(':', $rigs[$rig], 3);
                if (count($parts) >= 1) {
                    $miner = $parts[0];
                    if (count($parts) >= 2) {
                        $port = $parts[1];
                    } else {
                        $port = '';
                    }
                    if ($readonly !== true) {
                        $preprocess = $arg;
                    }
                }
            }
        }
    }
    if ($allowcustompages === true) {
        $pg = urlencode(trim(getparam('pg', true)));
        if ($pagesonly === true) {
            if ($pg !== null && $pg !== '') {
                if ($userlist !== null && isset($userlist['def']) && !in_array($pg, $userlist['def'])) {
                    $pg = null;
                }
            } else {
                if ($userlist !== null && isset($userlist['def'])) {
                    foreach ($userlist['def'] as $pglook) {
                        if (getcsp($pglook) !== false) {
                            $pg = $pglook;
                            break;
                        }
                    }
                }
            }
        }
        if ($pg !== null && $pg !== '') {
            htmlhead($mcerr, false, null, $pg);
            showcustompage($pg);
            return;
        }
    }
    if ($pagesonly === true) {
        onlylogin();
        return;
    }
    if (count($rigs) == 1) {
        $parts = explode(':', $rigs[0], 3);
        if (count($parts) >= 1) {
            $miner = $parts[0];
            if (count($parts) >= 2) {
                $port = $parts[1];
            } else {
                $port = '';
            }
            htmlhead($mcerr, true, 0);
            doOne(0, $preprocess);
        } else {
            minhead($mcerr);
            otherrow('<td class=bad>Invalid "$rigs" array</td>');
        }
        return;
    }
    if ($rig != null and $rig != '' and $rig >= 0 and $rig < count($rigs)) {
        $parts = explode(':', $rigs[$rig], 3);
        if (count($parts) >= 1) {
            $miner = $parts[0];
            if (count($parts) >= 2) {
                $port = $parts[1];
            } else {
                $port = '';
            }
            htmlhead($mcerr, true, 0);
            doOne($rig, $preprocess);
        } else {
            minhead($mcerr);
            otherrow('<td class=bad>Invalid "$rigs" array</td>');
        }
        return;
    }
    htmlhead($mcerr, false, null);
    if ($preprocess != null) {
        process(array($preprocess => $preprocess), $rig);
    }
    if (getcsp('Summary', true) !== false) {
        showcustompage('Summary', true);
    }
}
Ejemplo n.º 2
0
function display()
{
    global $miner, $port;
    global $mcast, $mcastexpect;
    global $readonly, $notify, $rigs;
    global $ignorerefresh, $autorefresh;
    global $allowcustompages, $customsummarypages;
    global $placebuttons;
    global $userlist, $ses;
    $pagesonly = checklogin();
    if ($pagesonly === 'login') {
        return;
    }
    $mcerr = '';
    if ($rigs == null or count($rigs) == 0) {
        if ($mcast === true) {
            $action = 'found';
        } else {
            $action = 'defined';
        }
        minhead();
        otherrow("<td class=bad>No rigs {$action}</td>");
        return;
    } else {
        if ($mcast === true && count($rigs) < $mcastexpect) {
            $mcerr = othrow('<td class=bad>Found ' . count($rigs) . " rigs but expected at least {$mcastexpect}</td>");
        }
    }
    if ($ignorerefresh == false) {
        $ref = trim(getparam('ref', true));
        if ($ref != null && $ref != '') {
            $autorefresh = intval($ref);
        }
    }
    if ($pagesonly !== true) {
        $rig = trim(getparam('rig', true));
        $arg = trim(getparam('arg', true));
        $preprocess = null;
        if ($arg != null and $arg != '') {
            if ($rig != null and $rig != '' and $rig >= 0 and $rig < count($rigs)) {
                $parts = explode(':', $rigs[$rig], 3);
                if (count($parts) >= 2) {
                    $miner = $parts[0];
                    $port = $parts[1];
                    if ($readonly !== true) {
                        $preprocess = $arg;
                    }
                }
            }
        }
    }
    if ($allowcustompages === true) {
        $pg = trim(getparam('pg', true));
        if ($pagesonly === true) {
            if ($pg !== null && $pg !== '') {
                if ($userlist !== null && isset($userlist['def']) && !in_array($pg, $userlist['def'])) {
                    $pg = null;
                }
            } else {
                if ($userlist !== null && isset($userlist['def'])) {
                    foreach ($userlist['def'] as $pglook) {
                        if (isset($customsummarypages[$pglook])) {
                            $pg = $pglook;
                            break;
                        }
                    }
                }
            }
        }
        if ($pg !== null && $pg !== '') {
            htmlhead($mcerr, false, null, $pg);
            showcustompage($pg, $mcerr);
            return;
        }
    }
    if ($pagesonly === true) {
        onlylogin();
        return;
    }
    if (count($rigs) == 1) {
        $parts = explode(':', $rigs[0], 3);
        if (count($parts) >= 2) {
            $miner = $parts[0];
            $port = $parts[1];
            htmlhead($mcerr, true, 0);
            doOne(0, $preprocess);
        } else {
            minhead($mcerr);
            otherrow('<td class=bad>Invalid "$rigs" array</td>');
        }
        return;
    }
    if ($rig != null and $rig != '' and $rig >= 0 and $rig < count($rigs)) {
        $parts = explode(':', $rigs[$rig], 3);
        if (count($parts) >= 2) {
            $miner = $parts[0];
            $port = $parts[1];
            htmlhead($mcerr, true, 0);
            doOne($rig, $preprocess);
        } else {
            minhead($mcerr);
            otherrow('<td class=bad>Invalid "$rigs" array</td>');
        }
        return;
    }
    htmlhead($mcerr, false, null);
    if ($placebuttons == 'top' || $placebuttons == 'both') {
        pagebuttons(null, null);
    }
    if ($preprocess != null) {
        process(array($preprocess => $preprocess), $rig);
    }
    newtable();
    doforeach('version', 'rig summary', array(), array(), true);
    $sum = array('MHS av', 'Getworks', 'Found Blocks', 'Accepted', 'Rejected', 'Discarded', 'Stale', 'Utility', 'Local Work', 'Total MH', 'Work Utility', 'Diff1 Shares', 'Diff1 Work', 'Difficulty Accepted', 'Difficulty Rejected', 'Difficulty Stale');
    doforeach('summary', 'summary information', $sum, array(), false);
    endtable();
    otherrow('<td><br><br></td>');
    newtable();
    doforeach('devs', 'device list', $sum, array('' => '', 'ID' => '', 'Name' => ''), false);
    endtable();
    otherrow('<td><br><br></td>');
    newtable();
    doforeach('pools', 'pool list', $sum, array('' => ''), false);
    endtable();
    if ($placebuttons == 'bot' || $placebuttons == 'both') {
        pagebuttons(null, null);
    }
}
Ejemplo n.º 3
0
function display()
{
    global $miner, $port;
    global $readonly, $notify, $rigs;
    global $ignorerefresh, $autorefresh;
    global $allowcustompages;
    global $placebuttons;
    if ($ignorerefresh == false) {
        $ref = trim(getparam('ref', true));
        if ($ref != null && $ref != '') {
            $autorefresh = intval($ref);
        }
    }
    $rig = trim(getparam('rig', true));
    $arg = trim(getparam('arg', true));
    $preprocess = null;
    if ($arg != null and $arg != '') {
        $num = null;
        if ($rig != null and $rig != '') {
            if ($rig >= 0 and $rig < count($rigs)) {
                $num = $rig;
            }
        } else {
            if (count($rigs) == 0) {
                $num = 0;
            }
        }
        if ($num != null) {
            $parts = explode(':', $rigs[$num], 3);
            if (count($parts) >= 2) {
                $miner = $parts[0];
                $port = $parts[1];
                $preprocess = $arg;
            }
        }
    }
    if ($rigs == null or count($rigs) == 0) {
        otherrow("<td>No rigs defined</td>");
        return;
    }
    if ($allowcustompages === true) {
        $pg = trim(getparam('pg', true));
        if ($pg != null && $pg != '') {
            showcustompage($pg);
            return;
        }
    }
    if (count($rigs) == 1) {
        $parts = explode(':', $rigs[0], 3);
        if (count($parts) >= 2) {
            $miner = $parts[0];
            $port = $parts[1];
            doOne(0, $preprocess);
        } else {
            otherrow('<td>Invalid "$rigs" array</td>');
        }
        return;
    }
    if ($rig != null and $rig != '' and $rig >= 0 and $rig < count($rigs)) {
        $parts = explode(':', $rigs[$rig], 3);
        if (count($parts) >= 2) {
            $miner = $parts[0];
            $port = $parts[1];
            doOne($rig, $preprocess);
        } else {
            otherrow('<td>Invalid "$rigs" array</td>');
        }
        return;
    }
    htmlhead(false, null);
    if ($placebuttons == 'top' || $placebuttons == 'both') {
        pagebuttons(null, null);
    }
    if ($preprocess != null) {
        process(array($preprocess => $preprocess), $rig);
    }
    newtable();
    doforeach('version', 'rig summary', array(), array(), true);
    $sum = array('MHS av', 'Getworks', 'Found Blocks', 'Accepted', 'Rejected', 'Discarded', 'Stale', 'Utility', 'Local Work', 'Total MH');
    doforeach('summary', 'summary information', $sum, array(), false);
    endtable();
    otherrow('<td><br><br></td>');
    newtable();
    doforeach('devs', 'device list', $sum, array('' => '', 'ID' => '', 'Name' => ''), false);
    endtable();
    otherrow('<td><br><br></td>');
    newtable();
    doforeach('pools', 'pool list', $sum, array('' => ''), false);
    endtable();
    if ($placebuttons == 'bot' || $placebuttons == 'both') {
        pagebuttons(null, null);
    }
}