function getMNVotes($testnet = false) { if ($testnet) { $testnetval = "1"; $testnetstr = "testnet"; } else { $testnetval = "0"; $testnetstr = ""; } xecho("Retrieving masternodes votes (testnet={$testnetval}): "); $result = dmn_api_get("/masternodes/votes?testnet={$testnetval}", array(), $response); if ($response['http_code'] == 200) { echo "Fetched..."; $votes = json_decode($result, true); if ($votes === false) { echo " Failed to JSON decode!\n"; die(200); } elseif (!is_array($votes) || !array_key_exists('data', $votes) || !is_array($votes['data'])) { echo " Incorrect data!\n"; die(202); } $votes = $votes['data']; echo " OK (" . count($votes) . " entries)\n"; } else { echo "Failed [" . $response['http_code'] . "]\n"; if ($response['http_code'] != 500) { $result = json_decode($result, true); if ($result !== false) { foreach ($result['messages'] as $num => $msg) { xecho("Error #{$num}: {$msg}\n"); } } } die(201); } $votesyea = 0; $votesnay = 0; $votesabstain = 0; $votestotal = 0; foreach ($votes as $vote) { if ($vote["Vote"] == "Yea") { $votesyea += $vote["VoteCount"]; } elseif ($vote["Vote"] == "Nay") { $votesnay += $vote["VoteCount"]; } else { $votesabstain += $vote["VoteCount"]; } } $votestotal = $votesyea + $votesnay + $votesabstain; xecho("Submitting to RRDtool DB (N:{$votesyea}:{$votesnay}:{$votesabstain}:{$votestotal}): "); // rrdtool create mnvotes2.rrd --start 1431101864 DS:Yea:GAUGE:600:U:U DS:Nay:GAUGE:600:U:U DS:Abstain:GAUGE:600:U:U DS:Total:GAUGE:600:U:U RRA:MAX:0.5:1:600 RRA:MAX:0.5:6:700 RRA:MAX:0.5:24:775 RRA:MAX:0.5:288:797 if (rrd_update("mnvotes2{$testnetstr}.rrd", ["N:{$votesyea}:{$votesnay}:{$votesabstain}:{$votestotal}"])) { echo "OK\n"; } else { echo "Failed\n"; } }
function do_xport($start, $end, $step, $filename, $testnet = false) { if ($testnet) { $testnet = "testnet"; } else { $testnet = ''; } xecho("RRD DB xport ({$start} to {$end} step {$step} {$testnet}): "); $xport = rrd_xport(array("-s", $start, "-e", $end, "--step", $step, "DEF:a=mnvotes2{$testnet}.rrd:Yea:MAX", "DEF:b=mnvotes2{$testnet}.rrd:Nay:MAX", "DEF:c=mnvotes2{$testnet}.rrd:Abstain:MAX", 'XPORT:a:Yea', 'XPORT:b:Nay', 'XPORT:c:Abstain')); if ($xport === false) { echo "Failed!\n"; return false; } else { echo "OK\n"; foreach ($xport["data"] as $key1 => $data1) { foreach ($xport["data"][$key1]["data"] as $key2 => $data2) { if (is_nan($data2)) { $xport["data"][$key1]["data"][$key2] = false; } else { $xport["data"][$key1]["data"][$key2] = intval(round($data2)); } } } } xecho("JSON Encoding output: "); $json = json_encode($xport); if ($json !== false) { echo "OK (" . strlen($json) . " bytes)\n"; xecho("Writing to file: "); if (file_put_contents($filename, $json) !== false) { echo "OK\n"; return true; } else { echo "Error\n"; return false; } } else { echo "Error\n"; return false; } }
<div class="rightPageContainer"> <h1 class="Success">Success</h1><br /> Service group <?php xecho($params['serviceGroup']->getName()); ?> successfully edited. <br /> <a href="index.php?Page_Type=Service_Group&id=<?php echo $params['serviceGroup']->getId(); ?> "> View <?php xecho($params['serviceGroup']->getName()); ?> </a> </div>
<div class="rightPageContainer"> <h1 class="Success">Success</h1><br /> <?php $Site = $params['NewSite']; ?> The following services have been moved to <a href="index.php?Page_Type=Site&id=<?php echo $Site->getId(); ?> "> <?php xecho($Site->getShortName()); ?> </a>: <?php foreach ($params['Services'] as $sep) { echo "<br />" . "<a href=\"index.php?Page_Type=Service&id=" . $sep->getId() . "\">" . xssafe($sep->getHostName()) . "</a> "; } ?> </div>
<?php $property = $params['prop']; $service = $params['service']; ?> <div class="rightPageContainer"> <h1 class="Success">Delete Endpoint Property</h1><br/> <p> Are you sure you want to delete:<br/><br/> Property name: <b><?php xecho($property->getKeyName()); ?> <br/></b> Property value: <b><?php xecho($property->getKeyValue()); ?> <br/></b> </p> <p> Are you sure you wish to continue? </p> <!--<form class="inputForm" method="post" action="index.php?Page_Type=Delete_Endpoint_Property&propertyid=<?php echo $property->getId(); ?> &serviceid=<?php echo $service->getId(); ?> " name="RemoveEndpointProperty">--> <form class="inputForm" method="post" action="index.php?Page_Type=Delete_Endpoint_Property&propertyid=<?php
"> <?php xecho($params['Name']); ?> </a> has been successfully edited as follows: </p> <p> Name: <?php xecho($params['Name']); ?> <br /> Description: <?php xecho($params['Description']); ?> </p> <p> <a href="index.php?Page_Type=Admin_Edit_Scope&id=<?php echo $params['ID']; ?> "> Click here</a> to edit the <?php xecho($params['Name']); ?> scope again. </p> </div>
<base href="<?php echo base_url(); ?> "> <title><?php xecho($site_title); ?> </title> <meta name="description" content="<?php xecho($meta_desc); ?> "> <meta name="keywords" content="<?php xecho($meta_keywords); ?> "> <meta name="viewport" content="width=device-width, initial-scale=1"> <?php if (ENVIRONMENT != 'prouction') { ?> <meta name="robots" content="noindex"> <?php } ?> <link rel="stylesheet" href="<?php echo base_url(); ?>
if (sizeof($numberOfScopes > 0)) { foreach ($params['Scopes'] as $scope) { ?> <tr class="site_table_row_<?php echo $num; ?> "> <td class="site_table" style="width: 90%"> <div style="background-color: inherit;"> <span style="vertical-align: middle;"> <a href="index.php?Page_Type=Admin_Scope&id=<?php echo $scope->getId(); ?> "> <?php xecho($scope->getName()); ?> </a> </span> </div> </td> <?php if (!$params['portalIsReadOnly']) { ?> <td class="site_table"> <script type="text/javascript" src="<?php echo \GocContextPath::getPath(); ?> javascript/confirm.js"></script> <a onclick="return confirmSubmit()" href="index.php?Page_Type=Admin_Remove_Scope&id=<?php echo $scope->getId();
$operations[AT_ADMIN_LOG_UPDATE] = _AT('update_to'); $operations[AT_ADMIN_LOG_DELETE] = _AT('delete_from'); $operations[AT_ADMIN_LOG_INSERT] = _AT('insert_into'); $operations[AT_ADMIN_LOG_REPLACE] = _AT('replace_into'); $operations[AT_ADMIN_LOG_OTHER] = _AT('other'); ?> <form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?> "> <input type="hidden" name="p" value="<?php xecho($_GET['p']); ?> " /> <input type="hidden" name="login" value="<?php xecho($_GET['login']); ?> " /> <div class="input-form"> <div class="row"> <?php echo _AT('date'); ?> <br /> <?php echo $row['time']; ?> </div> <div class="row"> <?php echo _AT('login_name');
<?php $num = 2; foreach ($downtimes as $dt) { ?> <tr class="site_table_row_<?php echo $num; ?> "> <td class="site_table"> <a style="padding-right: 1em;" href="index.php?Page_Type=Downtime&id=<?php echo $dt->getId(); ?> "> <?php xecho($dt->getDescription()); ?> </a> </td> <td class="site_table"><?php echo $dt->getStartDate()->format($dt::DATE_FORMAT); ?> </td> <td class="site_table"><?php echo $dt->getEndDate()->format($dt::DATE_FORMAT); ?> </td> </tr> <?php if ($num == 1) { $num = 2;
<div class="rightPageContainer"> <h1>Error</h1> <br /> <?php if (strpos($params, 'DOCSVN.SERV_KEYPAIRS') || strpos($params, 'DOCSVN.SITE_KEYPAIRS')) { echo "A key value pair already exists with this keyname and keyvalue."; } else { xecho($params); } ?> </div>
<form name="Move_Service" action="index.php?Page_Type=Admin_Move_SEP" method="post" class="inputForm"> <h1>Move Service</h1> <br /> <span class="input_name">New site for selected services</span> <select class="add_edit_form" name="NewSite"> <?php foreach ($params['Sites'] as $Site) { echo "<option value=\"" . $Site->getId() . "\">" . xssafe($Site->getShortName()) . "</option>"; } ?> </select> <span class="input_name">Please select the service(s) to be moved from <?php xecho($params['OldSite']); ?> </span> <select class="Downtime_Select" name="Services[]" size="20" multiple id="Sites" style="margin-left: 0em; width: 38em;"> <?php foreach ($params['Services'] as $sep) { echo "<option value=\"" . $sep->getId() . "\">" . xssafe($sep->getHostName()) . "</option>"; } ?> </select> <br> <input class="input_button" type="submit" value="Move Service" /> </form> </div>
<div style="margin-left: 2em"> <?php foreach ($params['scopes'] as $scopeArray) { ?> <br /> <input type="checkbox" name="SCOPE_IDS[]" value="<?php echo $scopeArray['scope']->getId(); ?> "<?php if ($scopeArray['applied']) { echo ' checked="checked"'; } ?> > <?php xecho($scopeArray['scope']->getName()); ?> <?php } ?> </div> <input class="input_input_hidden" type="hidden" name="ID" value="<?php echo $params['ngi']->getId(); ?> "> <br /> <input class="input_button" type="submit" value="Update NGI"> </form> </div>
function test_condition($p) { global $url; global $topicname; $bret = false; $maxtry = 10; $try = 1; $pattern = 'app=core&module=search§ion=search&do=quick_search&search_app=core&fromsearch=1&search_filter_app%%5Ball%%5D=1&content_title_only=1&search_term=' . $topicname . '%%2527 IN BOOLEAN MODE) AND %s AND MATCH(t.title) AGAINST(%%2527' . $topicname; $post = sprintf($pattern, $p); while (1) { $buff = trim(make_post($url, $post, '', $url)); if (strpos($buff, 'Your search for the term <em><strong>') > 0) { $bret = true; break; } elseif (strpos($buff, 'No results found for') > 0) { break; } elseif (strpos($buff, 'Driver Error</title>') !== false) { die("Sql error! Wrong prefix?\nExiting ... "); } else { xecho("test_condition() - try {$try} - invalid return value ...\n"); xecho("Will wait 30 seconds for flood control. Expect 2-3 tries.\n"); xecho("This is going to take years...\n"); sleep(10); $try++; if ($try > $maxtry) { die("Too many tries - exiting ...\n"); } else { xecho("Trying again - try {$try} ...\n"); } } } return $bret; }
function dmn_blockparse($uname, $testnet, $mnpubkeys, $mndonations, $poolpubkeys, $mnsuperblocks, &$bhws, &$bws, &$btarchive, &$blockarchive, &$txarchive) { xecho("==> Processing {$uname}: "); if (!is_dir("/dev/shm/{$uname}")) { echo "Error 1\n"; return false; } $canparseblocks = is_dir("/dev/shm/{$uname}/tx"); $canparseblocktemplates = is_dir("/dev/shm/{$uname}/bt"); if (!$canparseblocks && !$canparseblocktemplates) { echo "Error 2\n"; return false; } if (!is_dir(DMN_BLOCKPARSER_ARCHIVE . $uname . '/') || !is_dir(DMN_BLOCKPARSER_ARCHIVE . $uname . '/tx/')) { mkdir(DMN_BLOCKPARSER_ARCHIVE . $uname . '/tx/', 0700, true); } if (!is_dir(DMN_BLOCKPARSER_ARCHIVE . $uname . '/bt/')) { mkdir(DMN_BLOCKPARSER_ARCHIVE . $uname . '/bt/', 0700, true); } echo "OK\n"; xecho(" Retrieving available block template files: "); $btfiles = array(); if ($canparseblocktemplates) { if ($handle = opendir("/dev/shm/{$uname}/bt/")) { while (false !== ($entry = readdir($handle))) { if (is_file("/dev/shm/{$uname}/bt/{$entry}")) { if (strlen($entry) > 19 && substr($entry, 0, 14) == 'blocktemplate.' && substr($entry, -5) == '.json') { $btfiles[] = $entry; } } } closedir($handle); } if (count($btfiles) == 0) { echo "None found\n"; } else { echo "OK (" . count($btfiles) . " files)\n"; } sort($btfiles); } else { echo "Folder not found\n"; } xecho(" Retrieving available block files: "); $txfiles = array(); $blockfiles = array(); if ($canparseblocks) { if ($handle = opendir("/dev/shm/{$uname}/")) { while (false !== ($entry = readdir($handle))) { if (is_file("/dev/shm/{$uname}/{$entry}")) { if (strlen($entry) > 11 && substr($entry, 0, 6) == 'block.' && substr($entry, -5) == '.json') { $blockfiles[] = $entry; } } } closedir($handle); } if (count($blockfiles) == 0) { echo "None found\n"; } else { echo "OK (" . count($blockfiles) . " files)\n"; } xecho(" Retrieving available transaction files: "); if ($handle = opendir("/dev/shm/{$uname}/tx/")) { while (false !== ($entry = readdir($handle))) { if (is_file("/dev/shm/{$uname}/tx/{$entry}")) { if (strlen($entry) > 17 && substr($entry, 0, 12) == 'transaction.' && substr($entry, -5) == '.json') { $txfiles[] = $entry; } } } closedir($handle); } if (count($txfiles) == 0) { echo "None found\n"; } else { echo "OK (" . count($txfiles) . " files)\n"; } sort($blockfiles); sort($txfiles); } else { echo "Folder not found\n"; } if (count($txfiles) == 0 && count($btfiles) == 0) { return true; } if (count($btfiles) > 0) { xecho(" Parsing block templates:\n"); $btprotocol = 0; foreach ($btfiles as $btfile) { $blockid = substr($btfile, 14, strlen($btfile) - 19); if (substr_count($blockid, '_') == 2) { $pos1 = strpos($blockid, '_'); $pos2 = strrpos($blockid, '_'); $btprotocol = substr($blockid, $pos1 + 1, $pos2 - $pos1 - 1); $btversion = substr($blockid, $pos2 + 1); $blockid = substr($blockid, 0, $pos1); xecho(" Block template {$blockid} (pv={$btprotocol} v={$btversion}): "); $bt = json_decode(file_get_contents("/dev/shm/{$uname}/bt/{$btfile}"), true); if ($bt !== false && isset($bt) && array_key_exists('payee', $bt)) { echo $bt['payee'] . "\n"; if (array_key_exists('payee_amount', $bt) && array_key_exists('coinbasevalue', $bt)) { $btpam = $bt['payee_amount'] / $bt['coinbasevalue']; } else { $btpam = 0.2; } $bhws[] = array("BlockHeight" => $blockid, "BlockTestNet" => $testnet, "FromNodeUserName" => $uname, "BlockMNPayee" => $bt['payee'], "LastUpdate" => date('Y-m-d H:i:s', $bt['curtime']), "Protocol" => $btprotocol, "BlockMNRatio" => $btpam); $btarchive["/dev/shm/{$uname}/bt/{$btfile}"] = DMN_BLOCKPARSER_ARCHIVE . $uname . '/bt/' . $btfile; } else { echo "Incorrect format\n"; } } } } $blockidlow = -1; $blockidhigh = -1; if (count($blockfiles) > 0 && count($txfiles) > 0) { xecho(" Parsing blocks:\n"); foreach ($blockfiles as $blockfile) { $blockid = substr($blockfile, 6, strlen($blockfile) - 11); xecho(" Block {$blockid}: "); $block = json_decode(file_get_contents("/dev/shm/{$uname}/{$blockfile}"), true); if ($block !== false && isset($block) && array_key_exists('height', $block)) { if ($block['height'] == $blockid) { if ($blockidlow == -1 || $blockid < $blockidlow) { $blockidlow = $blockid; } if ($blockidhigh == -1 || $blockid > $blockidhigh) { $blockidhigh = $blockid; } if (array_key_exists($blockid, $mnsuperblocks[$testnet])) { $issuperblock = 1; } else { $issuperblock = 0; } $blockarchive["/dev/shm/{$uname}/{$blockfile}"] = DMN_BLOCKPARSER_ARCHIVE . $uname . '/' . $blockfile; $gentx = false; foreach ($block['tx'] as $txid => $txhash) { if (in_array("transaction.{$txhash}.json", $txfiles)) { $txarchive["/dev/shm/{$uname}/tx/transaction.{$txhash}.json"] = DMN_BLOCKPARSER_ARCHIVE . $uname . '/tx/' . "transaction.{$txhash}.json"; if (!$gentx) { $tx = json_decode(file_get_contents("/dev/shm/{$uname}/tx/transaction.{$txhash}.json"), true); if (array_key_exists('vin', $tx) && is_array($tx['vin']) && count($tx['vin']) == 1 && is_array($tx['vin'][0]) && array_key_exists('coinbase', $tx['vin'][0])) { $gentx = true; $outcheck = array(); $total = 0; foreach ($tx['vout'] as $voutid => $vout) { if (array_key_exists('scriptPubKey', $vout) && is_array($vout['scriptPubKey']) && array_key_exists('addresses', $vout['scriptPubKey']) && count($vout['scriptPubKey']['addresses']) == 1) { if (array_key_exists($vout['scriptPubKey']['addresses'][0], $outcheck)) { $outcheck[$vout['scriptPubKey']['addresses'][0]] += $vout['value']; } else { $outcheck[$vout['scriptPubKey']['addresses'][0]] = $vout['value']; } $total += $vout['value']; } } if ($testnet == 1) { $mntest1 = $total * 0.5; $mntest1from = $mntest1 - $mntest1 * 0.001; $mntest1to = $mntest1 + $mntest1 * 0.001; $mntest2 = $total * 0.475; $mntest2from = $mntest2 - $mntest2 * 0.001; $mntest2to = $mntest2 + $mntest2 * 0.001; } else { $mntest1 = $total * 0.5; $mntest1from = $mntest1 - $mntest1 * 0.001; $mntest1to = $mntest1 + $mntest1 * 0.001; $mntest2 = $total * 0.475; $mntest2from = $mntest2 - $mntest2 * 0.001; $mntest2to = $mntest2 + $mntest2 * 0.001; } $mnpayee = false; $mnpaid = 0; $mnpaidok = 0; $pooladdr = ''; $pooladdrnum = 0; $poolpaidlast = 0; $foundinlist = false; $mnpayeedonation = 0; $superblockbudgetname = ""; foreach ($outcheck as $address => $value) { if ($issuperblock == 1 && $address == $mnsuperblocks[$testnet][$blockid]["PaymentAddress"]) { $mnpayee = $address; $mnpaid = $value; if ($mnpaid == $mnsuperblocks[$testnet][$blockid]["MonthlyPayment"]) { $mnpaidok = 1; } else { $mnpaidok = 0; } $mnpayeedonation = 0; $superblockbudgetname = $mnsuperblocks[$testnet][$blockid]["BlockProposal"]; } elseif ($issuperblock == 0 && array_key_exists($address, $mnpubkeys)) { $mnpayee = $address; $mnpaid = $value; $mnpaidok = 1; $mnpayeedonation = 0; } elseif ($issuperblock == 0 && array_key_exists($address, $mndonations)) { $mnpayee = $address; $mnpaid = $value; $mnpaidok = 1; $mnpayeedonation = 1; } else { if ($poolpaidlast <= $value) { $poolpaidlast = $value; $pooladdr = $address; $foundinlist = array_key_exists($address, $poolpubkeys); } $pooladdrnum++; } } echo $pooladdr . " - "; if ($pooladdrnum > 2 && !$foundinlist) { $pooladdr = "P2POOL"; } if ($mnpayee !== false) { if (array_key_exists($mnpayee, $mnpubkeys)) { $protocol = $mnpubkeys[$mnpayee]; } else { $protocol = 0; } $bws[] = array("BlockTestNet" => $testnet, "BlockId" => $blockid, "BlockHash" => $block['hash'], "BlockMNPayee" => $mnpayee, "BlockMNValue" => $mnpaid, "BlockSupplyValue" => $total, "BlockMNPayed" => 1, "BlockPoolPubKey" => $pooladdr, "BlockMNProtocol" => $protocol, "BlockTime" => $block['time'], "BlockDifficulty" => $block['difficulty'], "BlockMNPayeeDonation" => $mnpayeedonation, "IsSuperblock" => $issuperblock, "SuperblockBudgetName" => $superblockbudgetname); echo "{$mnpayee} ({$mnpaid} DASH)\n"; } else { $bws[] = array("BlockTestNet" => $testnet, "BlockId" => $blockid, "BlockHash" => $block['hash'], "BlockMNPayee" => '', "BlockMNValue" => 0.0, "BlockSupplyValue" => $total, "BlockMNPayed" => 0, "BlockPoolPubKey" => $pooladdr, "BlockMNProtocol" => 0, "BlockTime" => $block['time'], "BlockDifficulty" => $block['difficulty'], "BlockMNPayeeDonation" => 0, "IsSuperblock" => $issuperblock, "SuperblockBudgetName" => $superblockbudgetname); echo "Unpaid\n"; } } } } } if ($gentx === false) { echo "No generation TX found!\n"; } } else { echo "Height mismatch ({$blockid} / " . $block['height'] . ")\n"; unlink("/dev/shm/{$uname}/{$blockfile}"); } } else { echo "Error\n"; unlink("/dev/shm/{$uname}/{$blockfile}"); } } } return true; }
<form class="inputForm" method="post" action="index.php?Page_Type=Admin_Change_User_Admin_Status" name="editisAdmin"> <input class="input_input_hidden" type="hidden" name="IsAdmin" value="false" /> <input class="input_input_hidden" type="hidden" name="ID" value="<?php echo $params['ID']; ?> " /> <input type="submit" value="Remove <?php xecho($name); ?> 's GOCDB administrator status" class="input_button" onclick="return confirmSubmit()"> </form> <?php } elseif (!$params['IsAdmin']) { ?> <form class="inputForm" method="post" action="index.php?Page_Type=Admin_Change_User_Admin_Status" name="editisAdmin"> <input class="input_input_hidden" type="hidden" name="IsAdmin" value="true" /> <input class="input_input_hidden" type="hidden" name="ID" value="<?php echo $params['ID']; ?> " /> <input type="submit" value="Make <?php xecho($name); ?> a GOCDB administrator" class="input_button" onclick="return confirmSubmit()"> </form> <?php } ?> </div>
</td> <td class="site_table"> <a href="index.php?Page_Type=NGI&id=<?php echo $site->getNGI()->getId(); ?> "> <?php xecho($site->getNGI()->getName()); ?> </a> </td> <td class="site_table"> <?php xecho($site->getInfrastructure()->getName()); ?> </td> </tr> <?php if ($num == 1) { $num = 2; } else { $num = 1; } } ?> </table> <?php } // End of the foreach loop iterating over sites
} elseif ($command == 'stop') { xecho("Stopping {$uname}: "); if (dmn_stop($uname, $conf)) { echo "\n"; die(0); } else { echo "\n"; die(6); } } elseif ($command == 'restart') { if (!is_executable($dashd)) { xecho("Error ({$dashd} is not an executable file)\n"); die(8); } xecho("Restarting {$uname}: "); if (dmn_stop($uname, $conf)) { if (dmn_start($uname, $conf, $dashd, $extra)) { echo "\n"; die(0); } else { echo "\n"; die(5); } } else { echo " Could not stop daemon. Giving up.\n"; die(4); } } else { xecho('Unknown command: ' . $command . "\n"); die(3); }
<div style="overflow: hidden"> <div style="float: left;"> <h1 style="float: left; margin-left: 0em; padding-bottom: 0.3em;"> Downtimes for Service: <br/> <a style="font-family: inherit; font-size: inherit; font-weight: inherit; text-decoration: underline; padding-bottom: inherit; " href="index.php?Page_Type=Service&id=<?php echo $params['se']->getId(); ?> "> <?php xecho($params['se']->getServiceType()->getName()); ?> - <?php xecho($params['se']->getHostName()); ?> </a> </h1> </div> <!-- Downtimes --> <div class="listContainer"> <span class="header" style="vertical-align:middle; float: left; padding-top: 0.9em; padding-left: 1em;">All Downtimes</span> <img src="<?php echo \GocContextPath::getPath(); ?> img/down_arrow.png" height="25px" style="float: right; padding-right: 1em; padding-top: 0.5em; padding-bottom: 0.5em;" /> <table style="clear: both; width: 100%;"> <tr class="site_table_row_1"> <th class="site_table">Description</th>
<?php $this->load->view('header'); ?> </head> <!-- Close HEAD --> <body> <!-- Open Body --> <?php $this->load->view('top_navbar'); ?> <div class="container" id="main-container"> <div class="page-header"> <h1><span class="glyphicon glyphicon-asterisk"></span> <?php xecho($page_title); ?> </h1> </div> <p class="lead"><?php xecho($message); ?> </p> </div> <?php $this->load->view('footer');
$gaps = array(); foreach ($blocks as $blockindex => $block) { if ($prevblock == -1) { } elseif ($prevblock - 1 != $block['BlockId']) { if ($prevblock - $block['BlockId'] > 2) { xecho("Gap found, missing blocks " . ($block['BlockId'] + 1) . " to " . ($prevblock - 1) . "\n"); $gaps[] = $block['BlockId'] + 1 . " " . ($prevblock - 1); } else { xecho("Gap found, missing block " . ($prevblock - 1) . "\n"); $gaps[] = $prevblock - 1; } } $prevblock = $block['BlockId']; } if (count($gaps) == 0) { xecho('No gaps found! (Yeah \\o/)' . "\n"); } else { xecho("De-gapping (" . count($gaps) . " gaps):\n"); foreach ($gaps as $id => $gap) { xecho(sprintf("#%'.03d", $id + 1) . " ({$gap}): "); $output = array(); $result = 0; $lastline = exec(DMN_DIR . "dashblockretrieve p2pool {$gap}", $output, $result); if ($result == 0) { echo "OK"; } else { echo "Error ({$lastline})"; } echo "\n"; } }
function dmn_status($dmnpid) { $mninfolast = array(); $mnlistfinal = array(); $mnlist2final = array(); $mnlastseen = array(); $mnactivesince = array(); $mnpubkeylistfinal = array(); $difficultyfinal = 0; $daemonactive = array(); $protocolinfo = array(); $curprotocol = 0; $oldprotocol = 99999; $wsstatus = array(); xecho('Retrieving status for ' . count($dmnpid) . " nodes\n"); if (!is_dir("/dev/shm/dmnctl")) { if (!mkdir("/dev/shm/dmnctl")) { echo "Failed to create directory.\n"; die(100); } } $tmpdate = date('YmdHis'); $commands = array(); // First check the pid and getinfo for all nodes foreach ($dmnpid as $dmnnum => $dmnpidinfo) { $uname = $dmnpidinfo['uname']; $dmnpid[$dmnnum]['pidstatus'] = dmn_checkpid($dmnpidinfo['pid']); if ($dmnpid[$dmnnum]['pidstatus'] && $dmnpidinfo['currentbin'] != '') { $commands[] = array("status" => 0, "dmnnum" => $dmnnum, "datatype" => "info", "cmd" => "{$uname} getinfo", "file" => "/dev/shm/dmnctl/{$uname}.{$tmpdate}.getinfo.json"); } } // Only vh 3+ foreach ($dmnpid as $dmnnum => $dmnpidinfo) { $uname = $dmnpidinfo['uname']; if ($dmnpidinfo['pidstatus'] && $dmnpidinfo['currentbin'] != '' && $dmnpidinfo['versionhandling'] >= 3) { $commands[] = array("status" => 0, "dmnnum" => $dmnnum, "datatype" => "mnlistfull", "cmd" => $uname . ' "masternode list full"', "file" => "/dev/shm/dmnctl/{$uname}.{$tmpdate}.masternode_list.json"); // v12.1 (vh=4) if ($dmnpidinfo['versionhandling'] >= 4) { $commands[] = array("status" => 0, "dmnnum" => $dmnnum, "datatype" => "mnbudgetshow", "cmd" => $uname . ' "mnbudget list"', "file" => "/dev/shm/dmnctl/{$uname}.{$tmpdate}.mnbudget_show.json"); $commands[] = array("status" => 0, "dmnnum" => $dmnnum, "datatype" => "mnbudgetfinal", "cmd" => $uname . ' "mnfinalbudget list"', "file" => "/dev/shm/dmnctl/{$uname}.{$tmpdate}.mnfinalbudget_show.json"); } else { $commands[] = array("status" => 0, "dmnnum" => $dmnnum, "datatype" => "mnbudgetshow", "cmd" => $uname . ' "mnbudget show"', "file" => "/dev/shm/dmnctl/{$uname}.{$tmpdate}.mnbudget_show.json"); $commands[] = array("status" => 0, "dmnnum" => $dmnnum, "datatype" => "mnbudgetfinal", "cmd" => $uname . ' "mnfinalbudget show"', "file" => "/dev/shm/dmnctl/{$uname}.{$tmpdate}.mnfinalbudget_show.json"); } $commands[] = array("status" => 0, "dmnnum" => $dmnnum, "datatype" => "mnbudgetprojection", "cmd" => $uname . ' "mnbudget projection"', "file" => "/dev/shm/dmnctl/{$uname}.{$tmpdate}.mnbudget_projection.json"); } } // Only vh 2 and below foreach ($dmnpid as $dmnnum => $dmnpidinfo) { $uname = $dmnpidinfo['uname']; if ($dmnpidinfo['pidstatus'] && $dmnpidinfo['currentbin'] != '' && $dmnpidinfo['versionhandling'] <= 2) { $commands[] = array("status" => 0, "dmnnum" => $dmnnum, "datatype" => "mnlist", "cmd" => $uname . ' "masternode list"', "file" => "/dev/shm/dmnctl/{$uname}.{$tmpdate}.masternode_list.json"); $commands[] = array("status" => 0, "dmnnum" => $dmnnum, "datatype" => "mndonation", "cmd" => $uname . ' "masternode list donation"', "file" => "/dev/shm/dmnctl/{$uname}.{$tmpdate}.masternode_list_donation.json"); $commands[] = array("status" => 0, "dmnnum" => $dmnnum, "datatype" => "mnvotes", "cmd" => $uname . ' "masternode list votes"', "file" => "/dev/shm/dmnctl/{$uname}.{$tmpdate}.masternode_list_votes.json"); $commands[] = array("status" => 0, "dmnnum" => $dmnnum, "datatype" => "mnlastseen", "cmd" => $uname . ' "masternode list lastseen"', "file" => "/dev/shm/dmnctl/{$uname}.{$tmpdate}.masternode_list_lastseen.json"); $commands[] = array("status" => 0, "dmnnum" => $dmnnum, "datatype" => "mnpubkey", "cmd" => $uname . ' "masternode list pubkey"', "file" => "/dev/shm/dmnctl/{$uname}.{$tmpdate}.masternode_list_pubkey.json"); $commands[] = array("status" => 0, "dmnnum" => $dmnnum, "datatype" => "mnpose", "cmd" => $uname . ' "masternode list pose"', "file" => "/dev/shm/dmnctl/{$uname}.{$tmpdate}.masternode_list_pose.json"); $commands[] = array("status" => 0, "dmnnum" => $dmnnum, "datatype" => "mnactiveseconds", "cmd" => $uname . ' "masternode list activeseconds"', "file" => "/dev/shm/dmnctl/{$uname}.{$tmpdate}.masternode_list_activeseconds.json"); } } // All vh foreach ($dmnpid as $dmnnum => $dmnpidinfo) { $uname = $dmnpidinfo['uname']; if ($dmnpidinfo['pidstatus'] && $dmnpidinfo['currentbin'] != '') { $commands[] = array("status" => 0, "dmnnum" => $dmnnum, "datatype" => "mncurrent", "cmd" => $uname . ' "masternode current"', "file" => "/dev/shm/dmnctl/{$uname}.{$tmpdate}.masternode_current.json"); $commands[] = array("status" => 0, "dmnnum" => $dmnnum, "datatype" => "spork", "cmd" => $uname . ' "spork show"', "file" => "/dev/shm/dmnctl/{$uname}.{$tmpdate}.spork_show.json"); } } dmn_ctlrpc($commands); xecho("Parsing results...\n"); foreach ($commands as $command) { if ($command['status'] != 2) { $res = false; xecho("Command failed (" . $command['cmd'] . ") [" . $command['result'] . "]\n"); } else { $res = file_get_contents($command['file']); if ($res !== false) { if ($command['datatype'] == 'mnpubkey') { $res = explode(",", substr($res, 1, -1)); $pubkeys = array(); foreach ($res as $line) { $raw = explode(":", $line); if (is_array($raw) && count($raw) == 3) { $ip = substr(trim($raw[0]), 1); $port = substr(trim($raw[1]), 0, -1); $pubkey = substr(trim($raw[2]), 1, -1); $pubkeys[] = array("ip" => $ip, "port" => $port, "pubkey" => $pubkey); } } $res = $pubkeys; } elseif ($command['datatype'] == 'mndonation') { $res = explode(",", substr($res, 1, -1)); $pubkeys = array(); foreach ($res as $line) { $raw = explode(":", $line); if (is_array($raw)) { if (count($raw) == 4) { $ip = substr(trim($raw[0]), 1); $port = substr(trim($raw[1]), 0, -1); $pubkey = substr(trim($raw[2]), 1); $percent = substr(trim($raw[3]), 0, -1); $pubkeys[] = array("ip" => $ip, "port" => $port, "pubkey" => $pubkey, "percent" => intval($percent)); } elseif (count($raw) == 3) { $ip = substr(trim($raw[0]), 1); $port = substr(trim($raw[1]), 0, -1); $pubkey = substr(trim($raw[2]), 1); $pubkeys[] = array("ip" => $ip, "port" => $port, "pubkey" => '', "percent" => 0); } } } $res = $pubkeys; } elseif ($command['datatype'] != 'mncurrent') { $res = json_decode($res, true); if ($res === false) { xecho("Could not decode JSON from " . $command['file'] . "\n"); } if (array_key_exists('result', $res)) { $res = $res['result']; } } } else { xecho("Could not read file: " . $command['file'] . "\n"); } if (!unlink($command['file'])) { xecho("Could not delete file: " . $command['file'] . "\n"); } } $dmnpid[$command['dmnnum']][$command['datatype']] = $res; } $commands = array(); $nbuname = 5; $nbversion = 7; $nbprotocol = 8; $nbblocks = 6; $nbconnections = 4; $nbpid = 3; foreach ($dmnpid as $dmnnum => $dmnpidinfo) { $uname = $dmnpidinfo['uname']; if (strlen($dmnpidinfo['pid']) > $nbpid) { $nbpid = strlen($dmnpidinfo['pid']); } if (strlen($uname) > $nbuname) { $nbuname = strlen($uname); } if (array_key_exists('info', $dmnpidinfo)) { if (strlen($dmnpidinfo['info']['version']) > $nbversion) { $nbversion = strlen($dmnpidinfo['info']['version']); } if (strlen($dmnpidinfo['info']['protocolversion']) > $nbprotocol) { $nbprotocol = strlen($dmnpidinfo['info']['protocolversion']); } if (strlen($dmnpidinfo['info']['blocks']) > $nbblocks) { $nbblocks = strlen($dmnpidinfo['info']['blocks']); } if (strlen($dmnpidinfo['info']['connections']) > $nbconnections) { $nbconnections = strlen($dmnpidinfo['info']['connections']); } } if ($dmnpidinfo['pidstatus'] && $dmnpidinfo['currentbin'] != '') { $commands[] = array("status" => 0, "dmnnum" => $dmnnum, "datatype" => "blockhash", "cmd" => $uname . ' "getblockhash ' . $dmnpidinfo['info']['blocks'] . '"', "file" => "/dev/shm/dmnctl/{$uname}.{$tmpdate}.getblockhash.json"); $commands[] = array("status" => 0, "dmnnum" => $dmnnum, "datatype" => "networkhashps", "cmd" => $uname . ' getnetworkhashps', "file" => "/dev/shm/dmnctl/{$uname}.{$tmpdate}.getnetworkhashps.json"); if ($dmnpidinfo['versionhandling'] >= 3 && array_key_exists("mnbudgetshow", $dmnpidinfo) && is_array($dmnpidinfo["mnbudgetshow"])) { foreach ($dmnpidinfo["mnbudgetshow"] as $mnbudgetid => $mnbudgetdata) { $commands[] = array("status" => 0, "dmnnum" => $dmnnum, "datatype" => "mnbudget-getvotes-" . $mnbudgetid, "cmd" => $uname . ' "mnbudget getvotes ' . $mnbudgetid . '"', "file" => "/dev/shm/dmnctl/{$uname}.{$tmpdate}.mnbudget_getvotes_{$mnbudgetid}.json"); } } } } dmn_ctlrpc($commands); xecho("Parsing results...\n"); foreach ($commands as $command) { if ($command['status'] != 2) { $res = false; } else { $res = file_get_contents($command['file']); if ($res === false) { xecho("Could not read file: " . $command['file'] . "\n"); } if (!unlink($command['file'])) { xecho("Could not delete file: " . $command['file'] . "\n"); } if (strlen($command['datatype']) > 18 && substr($command['datatype'], 0, 18) == 'mnbudget-getvotes-') { $res = json_decode($res, true); if ($res === false) { xecho("Could not decode JSON from " . $command['file'] . "\n"); } if (array_key_exists('result', $res)) { $res = $res['result']; } } } $dmnpid[$command['dmnnum']][$command['datatype']] = $res; } xecho(str_pad("Node", $nbuname) . " " . str_pad("PID", $nbpid) . " ST " . str_pad("Version", $nbversion) . " " . str_pad("Protocol", $nbprotocol) . " " . str_pad("Blocks", $nbblocks) . " " . str_pad("Hash", 64) . " " . str_pad("Conn", $nbconnections) . " V IP\n"); $separator = str_repeat("-", $nbuname + $nbpid + $nbversion + $nbprotocol + $nbblocks + 109) . "\n"; xecho($separator); $networkhashps = false; $networkhashpstest = false; $spork = array(); $mninfo2 = array(); $mnbudgetshow = array(); $mnbudgetprojection = array(array(), array()); $mnbudgetfinal = array(); $mndonationlistfinal = array(); $mnvoteslistfinal = array(); $mnbudgetvotes = array(array(), array()); $dmnpidtorestart = array(); // Go through all nodes foreach ($dmnpid as $dmnnum => $dmnpidinfo) { // Get the uname $uname = $dmnpidinfo['uname']; $conf = $dmnpidinfo['conf']; // Is the node enabled in the configuration $dmnenabled = $conf->getmnctlconfig('enable') == 1; // Get default port if ($dmnpidinfo['conf']->getconfig('testnet') == '1') { $port = 19999; } else { $port = 9999; } // Default values $iponly = ''; $version = 0; $protocol = 0; $blocks = 0; $blockhash = ''; $connections = 0; $country = ''; $countrycode = ''; $spork[$uname] = array(); // Indicate what we are doing xecho(str_pad($uname, $nbuname) . " " . str_pad($dmnpidinfo['pid'], $nbpid, ' ', STR_PAD_LEFT) . " "); // If the process is running if ($dmnpidinfo['pid'] !== false && $dmnpidinfo['currentbin'] != '') { // Spork info if (array_key_exists("spork", $dmnpidinfo)) { $spork[$uname] = $dmnpidinfo['spork']; } else { $spork[$uname] = array(); } // Parse status $dashdinfo = dmn_getstatus($dmnpidinfo['info'], $dmnpidinfo['blockhash']); $blocks = $dashdinfo['blocks']; $blockhash = $dashdinfo['blockhash']; $connections = $dashdinfo['connections']; $difficulty = $dashdinfo['difficulty']; $protocol = $dashdinfo['protocol']; $version = $dashdinfo['version']; // Protocol // Current protocol is the max protocol if ($curprotocol < $protocol) { $curprotocol = $protocol; } // Old protocol is the min protocol if ($oldprotocol > $protocol) { $oldprotocol = $protocol; } // Store the protocol of this node $protocolinfo[$uname] = $protocol; // Store the networkhash if ($dashdinfo['testnet'] == 1) { $networkhashpstest = intval($dmnpidinfo['networkhashps']); } else { $networkhashps = intval($dmnpidinfo['networkhashps']); } // If the version could be retrieved if ($version !== false) { // Our node is active $daemonactive[] = $uname; // Remove the notresponding counter file if (file_exists(DMN_NRCOUNTDIR . "dmnctl-NR-{$uname}-counter")) { unlink(DMN_NRCOUNTDIR . "dmnctl-NR-{$uname}-counter"); } // Retrieve the IP from the node $ip = dmn_getip($dmnpidinfo['pid'], $uname); $dmnip = $ip; $ipexp = explode(':', $ip); $iponly = $ipexp[0]; $country = dmn_getcountry($ip, $countrycode); if ($country === false) { $country = 'Unknown'; $countrycode = '__'; } $port = $ipexp[1]; // Default values $processstatus = 'running'; // Display some feedback echo "OK "; echo str_pad($version, $nbversion, ' ', STR_PAD_LEFT) . " " . str_pad($protocol, $nbprotocol, ' ', STR_PAD_LEFT) . " " . str_pad($blocks, $nbblocks, ' ', STR_PAD_LEFT) . " {$blockhash} " . str_pad($connections, $nbconnections, ' ', STR_PAD_LEFT) . " "; // Store the max difficulty if ($difficulty > $difficultyfinal) { $difficultyfinal = $difficulty; } // Indicates what version handling we are using echo $dmnpidinfo['versionhandling']; // Old version handling (1 & 2) if ($dmnpidinfo['versionhandling'] <= 2) { $mnpose = $dmnpidinfo['mnpose']; $mnlist = $dmnpidinfo['mnlist']; $mncurrentip = $dmnpidinfo['mncurrent']; $mncurrentlist[$uname] = $mncurrentip . ":" . $dashdinfo['testnet']; foreach ($dmnpidinfo['mnlastseen'] as $mnlsip => $data) { $mnlastseen[$uname][$mnlsip . ':' . $dashdinfo['testnet']] = $data; } foreach ($dmnpidinfo['mnactiveseconds'] as $mnlsip => $data) { $mnactivesince[$uname][$mnlsip . ':' . $dashdinfo['testnet']] = $data; } $mndonationlist = $dmnpidinfo['mndonation']; $mnvoteslist = $dmnpidinfo['mnvotes']; $mnpubkeylist = $dmnpidinfo['mnpubkey']; foreach ($mnlist as $ip => $activetrue) { if ($activetrue != 1) { if ($activetrue == "ENABLED" || $activetrue == "PRE_ENABLED") { $active = 1; } else { $active = 0; } } else { $active = $activetrue; } $mnlistfinal["{$ip}:" . $dashdinfo['testnet']][$uname] = array('Status' => $active, 'PoS' => $mnpose[$ip], 'StatusEx' => $activetrue); } if (is_array($mnvoteslist) && count($mnvoteslist) > 0) { foreach ($mnvoteslist as $ip => $vote) { $mnvoteslistfinal["{$ip}:" . $dashdinfo['testnet']][$uname] = $vote; } } foreach ($mnpubkeylist as $data) { $mnpubkeylistfinal[$data["ip"] . ":" . $data["port"] . ":" . $dashdinfo['testnet'] . ":" . $data["pubkey"]] = array("MasternodeIP" => $data["ip"], "MasternodePort" => $data["port"], "MNTestNet" => $dashdinfo['testnet'], "MNPubKey" => $data["pubkey"]); } if (is_array($mndonationlist)) { foreach ($mndonationlist as $donatedata) { $mndonationlistfinal[$donatedata["ip"] . ":" . $donatedata["port"] . ":" . $dashdinfo['testnet'] . ":" . $donatedata["pubkey"]] = array("MasternodeIP" => $donatedata["ip"], "MasternodePort" => $donatedata["port"], "MNTestNet" => $dashdinfo['testnet'], "MNPubKey" => $donatedata["pubkey"], "MNDonationPercentage" => $donatedata["percent"]); } } } elseif ($dmnpidinfo['versionhandling'] >= 3) { // Parse masternode budgets proposals if (is_array($dmnpidinfo['mnbudgetshow'])) { foreach ($dmnpidinfo['mnbudgetshow'] as $mnbudgetid => $mnbudgetdata) { if (array_key_exists($dashdinfo['testnet'] . "-" . $mnbudgetdata["Hash"], $mnbudgetshow)) { if ($mnbudgetshow[$dashdinfo['testnet'] . "-" . $mnbudgetdata["Hash"]]["Yeas"] + $mnbudgetshow[$dashdinfo['testnet'] . "-" . $mnbudgetdata["Hash"]]["Nays"] + $mnbudgetshow[$dashdinfo['testnet'] . "-" . $mnbudgetdata["Hash"]]["Abstains"] < $mnbudgetdata["Yeas"] + $mnbudgetdata["Nays"] + $mnbudgetdata["Abstains"]) { $mnbudgetshow[$dashdinfo['testnet'] . "-" . $mnbudgetdata["Hash"]] = $mnbudgetdata; $mnbudgetshow[$dashdinfo['testnet'] . "-" . $mnbudgetdata["Hash"]]['BudgetId'] = $mnbudgetid; $mnbudgetshow[$dashdinfo['testnet'] . "-" . $mnbudgetdata["Hash"]]["BudgetTesnet"] = $dashdinfo['testnet']; } } else { $mnbudgetshow[$dashdinfo['testnet'] . "-" . $mnbudgetdata["Hash"]] = $mnbudgetdata; $mnbudgetshow[$dashdinfo['testnet'] . "-" . $mnbudgetdata["Hash"]]['BudgetId'] = $mnbudgetid; $mnbudgetshow[$dashdinfo['testnet'] . "-" . $mnbudgetdata["Hash"]]["BudgetTesnet"] = $dashdinfo['testnet']; } if (array_key_exists("mnbudget-getvotes-" . $mnbudgetid, $dmnpidinfo)) { if (!array_key_exists($mnbudgetid, $mnbudgetvotes[$dashdinfo['testnet']])) { $mnbudgetvotes[$dashdinfo['testnet']][$mnbudgetid] = array(); } if (is_array($dmnpidinfo["mnbudget-getvotes-" . $mnbudgetid])) { foreach ($dmnpidinfo["mnbudget-getvotes-" . $mnbudgetid] as $mnbudgetvotehash => $mnbudgetvotedata) { if (array_key_exists($mnbudgetvotehash, $mnbudgetvotes[$dashdinfo['testnet']][$mnbudgetid])) { if ($mnbudgetvotes[$dashdinfo['testnet']][$mnbudgetid][$mnbudgetvotehash]["nTime"] < $mnbudgetvotedata["nTime"]) { $mnbudgetvotes[$dashdinfo['testnet']][$mnbudgetid][$mnbudgetvotehash] = $mnbudgetvotedata; } } else { $mnbudgetvotes[$dashdinfo['testnet']][$mnbudgetid][$mnbudgetvotehash] = $mnbudgetvotedata; } } } } } } // Parse masternode budgets projections if (is_array($dmnpidinfo['mnbudgetprojection'])) { foreach ($dmnpidinfo['mnbudgetprojection'] as $mnbudgetid => $mnbudgetdata) { if (is_array($mnbudgetdata) && array_key_exists("Yeas", $mnbudgetdata) && array_key_exists("Nays", $mnbudgetdata) && array_key_exists("Abstains", $mnbudgetdata)) { if (array_key_exists($mnbudgetdata["Hash"], $mnbudgetprojection[$dashdinfo['testnet']])) { if ($mnbudgetprojection[$dashdinfo['testnet']][$mnbudgetdata["Hash"]]["Yeas"] + $mnbudgetprojection[$dashdinfo['testnet']][$mnbudgetdata["Hash"]]["Nays"] + $mnbudgetprojection[$dashdinfo['testnet']][$mnbudgetdata["Hash"]]["Abstains"] < $mnbudgetdata["Yeas"] + $mnbudgetdata["Nays"] + $mnbudgetdata["Abstains"]) { $mnbudgetprojection[$dashdinfo['testnet']][$mnbudgetdata["Hash"]] = $mnbudgetdata; $mnbudgetprojection[$dashdinfo['testnet']][$mnbudgetdata["Hash"]]['BudgetId'] = $mnbudgetid; $mnbudgetprojection[$dashdinfo['testnet']][$mnbudgetdata["Hash"]]["BudgetTesnet"] = $dashdinfo['testnet']; } } else { $mnbudgetprojection[$dashdinfo['testnet']][$mnbudgetdata["Hash"]] = $mnbudgetdata; $mnbudgetprojection[$dashdinfo['testnet']][$mnbudgetdata["Hash"]]['BudgetId'] = $mnbudgetid; $mnbudgetprojection[$dashdinfo['testnet']][$mnbudgetdata["Hash"]]["BudgetTesnet"] = $dashdinfo['testnet']; } } } } // Parse masternode final budget if (is_array($dmnpidinfo['mnbudgetfinal'])) { foreach ($dmnpidinfo['mnbudgetfinal'] as $mnbudgetid => $mnbudgetdata) { if (array_key_exists($dashdinfo['testnet'] . "-" . $mnbudgetdata["Hash"], $mnbudgetfinal) && array_key_exists("VoteCount", $mnbudgetfinal[$dashdinfo['testnet'] . "-" . $mnbudgetdata["Hash"]])) { if ($mnbudgetfinal[$dashdinfo['testnet'] . "-" . $mnbudgetdata["Hash"]]["VoteCount"] < $mnbudgetdata["VoteCount"]) { $mnbudgetfinal[$dashdinfo['testnet'] . "-" . $mnbudgetdata["Hash"]] = $mnbudgetdata; $mnbudgetfinal[$dashdinfo['testnet'] . "-" . $mnbudgetdata["Hash"]]['BudgetName'] = $mnbudgetid; $mnbudgetfinal[$dashdinfo['testnet'] . "-" . $mnbudgetdata["Hash"]]["BudgetTesnet"] = $dashdinfo['testnet']; } } else { $mnbudgetfinal[$dashdinfo['testnet'] . "-" . $mnbudgetdata["Hash"]] = $mnbudgetdata; $mnbudgetfinal[$dashdinfo['testnet'] . "-" . $mnbudgetdata["Hash"]]['BudgetName'] = $mnbudgetid; $mnbudgetfinal[$dashdinfo['testnet'] . "-" . $mnbudgetdata["Hash"]]["BudgetTesnet"] = $dashdinfo['testnet']; } } } // Parse the masternode list $mn3listfull = $dmnpidinfo['mnlistfull']; foreach ($mn3listfull as $mn3output => $mn3data) { // Remove all extra spaces $mn3data = trim($mn3data); do { $rcount = 0; $mn3data = str_replace(" ", " ", $mn3data, $rcount); } while ($rcount > 0); // Store each value separated by spaces if ($dmnpidinfo['versionhandling'] == 3) { list($mn3status, $mn3protocol, $mn3pubkey, $mn3ipport, $mn3lastseen, $mn3activeseconds, $mn3lastpaid) = explode(" ", $mn3data); } else { list($mn3status, $mn3protocol, $mn3pubkey, $mn3lastseen, $mn3activeseconds, $mn3lastpaid, $mn4lastpaidblock, $mn3ipport) = explode(" ", $mn3data); } // Handle the IPs if (substr($mn3ipport, 0, 1) == "[") { // IPv6 list($mn3ip, $mn3port) = explode("]:", substr($mn3ipport, 1, strlen($mn3ipport) - 1)); } else { // IPv4 $test = explode(":", $mn3ipport); if (!array_key_exists(1, $test)) { var_dump($mn3ipport); } list($mn3ip, $mn3port) = $test; } if (array_key_exists($mn3output . "-" . $dashdinfo['testnet'], $mninfo2)) { if ($mn3lastseen < $mninfo2[$mn3output . "-" . $dashdinfo['testnet']]["MasternodeLastSeen"]) { $mninfo2[$mn3output . "-" . $dashdinfo['testnet']]["MasternodeLastSeen"] = intval($mn3lastseen); } if ($mn3activeseconds < $mninfo2[$mn3output . "-" . $dashdinfo['testnet']]["MasternodeActiveSeconds"]) { $mninfo2[$mn3output . "-" . $dashdinfo['testnet']]["MasternodeActiveSeconds"] = intval($mn3activeseconds); } if ($mn3lastpaid > $mninfo2[$mn3output . "-" . $dashdinfo['testnet']]["MasternodeLastPaid"]) { $mninfo2[$mn3output . "-" . $dashdinfo['testnet']]["MasternodeLastPaid"] = intval($mn3lastpaid); } } else { $mninfo2[$mn3output . "-" . $dashdinfo['testnet']] = array("MasternodeProtocol" => intval($mn3protocol), "MasternodePubkey" => $mn3pubkey, "MasternodeIP" => $mn3ip, "MasternodePort" => $mn3port, "MasternodeLastSeen" => intval($mn3lastseen), "MasternodeActiveSeconds" => intval($mn3activeseconds), "MasternodeLastPaid" => $mn3lastpaid); } if ($mn3status == "ENABLED" || $mn3status == "PRE_ENABLED") { $active = 1; } else { $active = 0; } $mnlist2final[$mn3output . "-" . $dashdinfo['testnet']][$uname] = array('Status' => $active, 'StatusEx' => $mn3status); } } echo " {$dmnip}\n"; } elseif ($dmnenabled) { $iponly = $dmnpidinfo['conf']->getconfig('bind'); $ip = "{$iponly}:{$port}"; $country = dmn_getcountry($ip, $countrycode); if ($country === false) { $country = 'Unknown'; $countrycode = '__'; } $processstatus = 'notresponding'; $dmnpidtorestart[$dmnnum] = $dmnpidinfo; echo "NR " . str_repeat(" ", 96) . "{$ip}\n"; } else { $processstatus = 'disabled'; echo "--\n"; } } elseif ($dmnenabled) { // Remove the notresponding counter file if (file_exists(DMN_NRCOUNTDIR . "dmnctl-NR-{$uname}-counter")) { unlink(DMN_NRCOUNTDIR . "dmnctl-NR-{$uname}-counter"); } $iponly = $dmnpidinfo['conf']->getconfig('bind'); $ip = "{$iponly}:{$port}"; $country = dmn_getcountry($ip, $countrycode); if ($country === false) { $country = 'Unknown'; $countrycode = '__'; } $processstatus = 'stopped'; echo "NS " . str_repeat(" ", 96) . "{$ip}\n"; } else { // Remove the notresponding counter file if (file_exists(DMN_NRCOUNTDIR . "dmnctl-NR-{$uname}-counter")) { unlink(DMN_NRCOUNTDIR . "dmnctl-NR-{$uname}-counter"); } $processstatus = 'disabled'; echo "--\n"; } $wsstatus[$uname] = array("ProcessStatus" => $processstatus, "Version" => $version, "Protocol" => $protocol, "Blocks" => $blocks, "LastBlockHash" => $blockhash, "Connections" => $connections, "IP" => $iponly, "Port" => $port, "Country" => $country, "CountryCode" => $countrycode, "Spork" => $spork[$uname]); } xecho($separator); ksort($mnpubkeylistfinal, SORT_NATURAL); $mnlastseenfinal = array(); foreach ($mnlastseen as $uname => $mnlastseenlist) { foreach ($mnlastseenlist as $ip => $lastseentimestamp) { if (array_key_exists($ip, $mnlastseenfinal) && $mnlastseenfinal[$ip] > $lastseentimestamp || !array_key_exists($ip, $mnlastseenfinal)) { $mnlastseenfinal[$ip] = $lastseentimestamp; } } } ksort($mnlastseenfinal, SORT_NATURAL); $mnactivesincefinal = array(); foreach ($mnactivesince as $uname => $mnactivesincelist) { foreach ($mnactivesincelist as $ip => $activeseconds) { if (array_key_exists($ip, $mnactivesincefinal) && $mnactivesincefinal[$ip] < $activeseconds || !array_key_exists($ip, $mnactivesincefinal)) { $mnactivesincefinal[$ip] = $activeseconds; } } } ksort($mnactivesincefinal, SORT_NATURAL); $mncountinactive = 0; $mncountactive = 0; foreach ($mnlistfinal as $ip => $info) { $inactiveresult = true; foreach ($info as $uname => $mnactive) { $inactiveresult = $inactiveresult && ($mnactive == 0 || $mnactive === false); } if ($inactiveresult) { $mncountinactive++; } else { $mncountactive++; } } $mninfodel = array(); foreach ($mninfolast as $ip) { if (!array_key_exists($ip, $mnlistfinal)) { $info = explode(":", $ip); $mninfodel[] = array('ip' => $info[0], 'port' => $info[1]); } } $mncount = $mncountinactive + $mncountactive; if (count($mnlistfinal) > 0) { ksort($mnlistfinal, SORT_NATURAL); $estpayoutdaily = round(dmn_getpayout($mncountactive, $dashdinfo['difficulty']), 2); } else { $estpayoutdaily = '???'; } // echo "Total Masternodes: $mncount/$mncountinactive Est.Payout: $estpayoutdaily DASH/day (diff=$difficultyfinal)\n"; if (count($wsstatus) > 0) { $wsmninfo = array(); $wsmnlist = array(); foreach ($mnlistfinal as $ip => $mninfo) { $ipport = explode(":", $ip); $mnip = $ipport[0]; $mnport = $ipport[1]; $mntestnet = $ipport[2]; if (array_key_exists($ip, $mnactivesincefinal)) { $mnactiveseconds = $mnactivesincefinal[$ip]; } else { $mnactiveseconds = 0; } if (array_key_exists($ip, $mnlastseenfinal)) { $mnlastseen = $mnlastseenfinal[$ip]; } else { $mnlastseen = 0; } $mncountry = dmn_getcountry($ip, $mncountrycode); if ($mncountry === false) { $mncountry = 'Unknown'; $mncountrycode = '__'; } $wsmninfo[] = array("MasternodeIP" => $mnip, "MasternodePort" => $mnport, "MNTestNet" => $mntestnet, "MNActiveSeconds" => $mnactiveseconds, "MNLastSeen" => $mnlastseen, "MNCountry" => $mncountry, "MNCountryCode" => $mncountrycode); foreach ($mninfo as $mnuname => $mnactive) { if ($mnactive['Status'] == 1) { if (array_key_exists($mnuname, $mncurrentlist) && $ip == $mncurrentlist[$uname]) { $mnstatus = 'current'; } else { $mnstatus = 'active'; } } elseif ($mnactive['Status'] === false) { $mnstatus = 'unlisted'; } else { $mnstatus = 'inactive'; } $wsmnlist[] = array("MasternodeIP" => $mnip, "MasternodePort" => $mnport, "MNTestNet" => $mntestnet, "FromNodeUName" => $mnuname, "MasternodeStatus" => $mnstatus, "MasternodeStatusPoS" => $mnactive['PoS'], "MasternodeStatusEx" => $mnactive['StatusEx']); } } $wsmnpubkeys = array(); foreach ($mnpubkeylistfinal as $key => $data) { $wsmnpubkeys[] = $data; } $wsmndonation = array(); foreach ($mndonationlistfinal as $key => $data) { $wsmndonation[] = $data; } $wsmnvotes = array(); foreach ($mnvoteslistfinal as $ip => $mnvotesinfo) { $ipport = explode(":", $ip); $mnip = $ipport[0]; $mnport = $ipport[1]; $mntestnet = $ipport[2]; foreach ($mnvotesinfo as $mnuname => $mnvote) { $wsmnvotes[] = array("MasternodeIP" => $mnip, "MasternodePort" => $mnport, "MNTestNet" => $mntestnet, "FromNodeUName" => $mnuname, "MasternodeVote" => $mnvote); } } // v12 handling / VersionHandling = 3 $wsmninfo2 = array(); foreach ($mninfo2 as $output => $mninfo) { list($mnoutputhash, $mnoutputindex, $mntestnet) = explode("-", $output); $wsmninfo2[] = array("MasternodeOutputHash" => $mnoutputhash, "MasternodeOutputIndex" => $mnoutputindex, "MasternodeTestNet" => $mntestnet, "MasternodeProtocol" => $mninfo["MasternodeProtocol"], "MasternodePubkey" => $mninfo["MasternodePubkey"], "MasternodeIP" => $mninfo["MasternodeIP"], "MasternodePort" => $mninfo["MasternodePort"], "MasternodeLastSeen" => $mninfo["MasternodeLastSeen"], "MasternodeActiveSeconds" => $mninfo["MasternodeActiveSeconds"], "MasternodeLastPaid" => $mninfo["MasternodeLastPaid"]); } $wsmnlist2 = array(); foreach ($mnlist2final as $output => $mninfo) { list($mnoutputhash, $mnoutputindex, $mntestnet) = explode("-", $output); foreach ($mninfo as $mnuname => $mnactive) { if ($mnactive['Status'] == 1) { $mnstatus = 'active'; } elseif ($mnactive['Status'] === false) { $mnstatus = 'unlisted'; } else { $mnstatus = 'inactive'; } $wsmnlist2[] = array("MasternodeOutputHash" => $mnoutputhash, "MasternodeOutputIndex" => $mnoutputindex, "MasternodeTestNet" => $mntestnet, "FromNodeUName" => $mnuname, "MasternodeStatus" => $mnstatus, "MasternodeStatusEx" => $mnactive['StatusEx']); } } $wsmnbudgetshow = array(); foreach ($mnbudgetshow as $budgetinfo) { $wsmnbudgetshow[] = $budgetinfo; } $wsmnbudgetvotes = array(); foreach ($mnbudgetvotes as $testnet => $mnbudgetvotesdata) { foreach ($mnbudgetvotesdata as $budgetid => $mnbudgetvotesdata2) { foreach ($mnbudgetvotesdata2 as $mnvotehash => $mnbudgetvotesdata3) { list($mnoutputhash, $mnoutputindex) = explode("-", $mnvotehash); $wsmnbudgetvotes[] = array('BudgetTestnet' => intval($testnet), 'BudgetId' => $budgetid, 'MasternodeOutputHash' => $mnoutputhash, 'MasternodeOutputIndex' => intval($mnoutputindex), 'VoteHash' => $mnbudgetvotesdata3["nHash"], 'VoteValue' => $mnbudgetvotesdata3["Vote"], 'VoteTime' => $mnbudgetvotesdata3["nTime"], 'VoteIsValid' => $mnbudgetvotesdata3["fValid"]); } } } $wsmnbudgetprojection = array(); foreach ($mnbudgetprojection as $mnbudgetdata) { foreach ($mnbudgetdata as $budgetinfo) { $wsmnbudgetprojection[] = $budgetinfo; } } $wsmnbudgetfinal = array(); foreach ($mnbudgetfinal as $budgetinfo) { $wsmnbudgetfinal[] = $budgetinfo; } xecho("Submitting status via webservice (" . count($wsstatus) . " entries): "); $response = ''; $payload = array('nodes' => $wsstatus, 'mninfo' => $wsmninfo, 'mninfo2' => $wsmninfo2, 'mnpubkeys' => $wsmnpubkeys, 'mndonation' => $wsmndonation, 'mnlist' => $wsmnlist, 'mnlist2' => $wsmnlist2, 'mnvotes' => $wsmnvotes, 'mnbudgetshow' => $wsmnbudgetshow, 'mnbudgetfinal' => $wsmnbudgetfinal, 'mnbudgetvotes' => $wsmnbudgetvotes, 'mnbudgetprojection' => $wsmnbudgetprojection, 'stats' => array(0 => array('networkhashps' => $networkhashps), 1 => array('networkhashps' => $networkhashpstest))); $contentraw = dmn_cmd_post('ping', $payload, $response); if (strlen($contentraw) > 0) { $content = json_decode($contentraw, true); if ($response['http_code'] >= 200 && $response['http_code'] <= 299) { echo "Success (" . $response['http_code'] . ")\n"; if (is_array($content["data"])) { xecho("+ Nodes: "); if ($content["data"]["nodes"] === false) { echo "Failed!\n"; } else { echo $content["data"]["nodes"] . "\n"; } xecho("+ Masternodes Info (<=v0.11): "); if ($content["data"]["mninfo"] === false) { echo "Failed!\n"; } else { echo $content["data"]["mninfo"] . "\n"; } xecho("+ Masternodes Info (>=v0.12): "); if ($content["data"]["mninfo2"] === false) { echo "Failed!\n"; } else { echo $content["data"]["mninfo2"] . "\n"; } xecho("+ Masternodes Pubkeys (<=v0.11): "); if ($content["data"]["mnpubkeys"] === false) { echo "Failed!\n"; } else { echo $content["data"]["mnpubkeys"] . "\n"; } xecho("+ Masternodes Donations (<=v0.11): "); if ($content["data"]["mndonation"] === false) { echo "Failed!\n"; } else { echo $content["data"]["mndonation"] . "\n"; } xecho("+ Masternodes List (<=v0.11): "); if ($content["data"]["mnlist"] === false) { echo "Failed!\n"; } else { echo $content["data"]["mnlist"] . "\n"; } xecho("+ Masternodes List (>=v0.12): "); if ($content["data"]["mnlist2"] === false) { echo "Failed!\n"; } else { echo $content["data"]["mnlist2"] . "\n"; } xecho("+ Masternodes Portcheck: "); if ($content["data"]["portcheck"] === false) { echo "Failed!\n"; } else { echo $content["data"]["portcheck"] . "\n"; } xecho("+ Masternodes Votes: "); if ($content["data"]["mnvotes"] === false) { echo "Failed!\n"; } else { echo $content["data"]["mnvotes"] . "\n"; } xecho("+ Spork: "); if ($content["data"]["spork"] === false) { echo "Failed!\n"; } else { echo $content["data"]["spork"] . "\n"; } xecho("+ Stats (Mainnet): "); if ($content["data"]["stats"] === false) { echo "Failed!\n"; } else { echo $content["data"]["stats"] . "\n"; } xecho("+ Stats (Testnet): "); if ($content["data"]["stats2"] === false) { echo "Failed!\n"; } else { echo $content["data"]["stats2"] . "\n"; } xecho("+ Budget (Show): "); if ($content["data"]["mnbudgetshow"] === false) { echo "Failed!\n"; } else { echo $content["data"]["mnbudgetshow"] . "\n"; } xecho("+ Budget (Projection): "); if ($content["data"]["mnbudgetprojection"] === false) { echo "Failed!\n"; } else { echo $content["data"]["mnbudgetprojection"] . "\n"; } xecho("+ Budget (Votes): "); if ($content["data"]["mnbudgetvotes"] === false) { echo "Failed!\n"; } else { echo $content["data"]["mnbudgetvotes"] . "\n"; } xecho("+ Final Budget): "); if ($content["data"]["mnbudgetfinal"] === false) { echo "Failed!\n"; } else { echo $content["data"]["mnbudgetfinal"] . "\n"; } } } elseif ($response['http_code'] >= 400 && $response['http_code'] <= 499) { echo "Error (" . $response['http_code'] . ": " . $content['message'] . ")\n"; } else { echo "Unknown (" . $response['http_code'] . ")\n"; var_dump($response); var_dump($contentraw); } } else { echo "Error (empty result) [HTTP CODE " . $response['http_code'] . "]\n"; } } if (count($dmnpidtorestart) > 0) { dmn_restartfrozen($dmnpidtorestart); } }
} if ($resdone > 0) { if ($resdone == 9) { echo "OK"; } else { echo "Partial"; } echo " ({$resdone} values retrieved)\n"; } else { echo "NOK\n"; } } else { echo "Failed (JSON)\n"; } } else { echo "Failed (GET)\n"; } xecho("Submitting to web service: "); $payload = array("thirdparties" => $tp); $content = dmn_cmd_post('/thirdparties', $payload, $response); var_dump($content); if (strlen($content) > 0) { $content = json_decode($content, true); if ($response['http_code'] >= 200 && $response['http_code'] <= 299) { echo "Success (" . $content['data']['thirdparties'] . ")\n"; } elseif ($response['http_code'] >= 400 && $response['http_code'] <= 499) { echo "Error (" . $response['http_code'] . ": " . $content['message'] . ")\n"; } } else { echo "Error (empty result) [HTTP CODE " . $response['http_code'] . "]\n"; }
<div class="rightPageContainer"> <h1 class="Success">Success</h1> New Service group <?php xecho($params['sg']->getName()); ?> successfully created. <br /> <a href="index.php?Page_Type=Service_Group&id=<?php echo $params['sg']->getId(); ?> "> View <?php xecho($params['sg']->getName()); ?> </a> </div>
$rpclist = explode(' ', $rpccommand); $rpcparams = array(); for ($x = 1; $x < count($rpclist); $x++) { if (ctype_digit($rpclist[$x])) { $rpcparams[] = intval($rpclist[$x]); } elseif (is_numeric($rpclist[$x])) { $rpcparams[] = floatval($rpclist[$x]); } else { $rpcparams[] = $rpclist[$x]; } } $rpccommand = $rpclist[0]; $result = call_user_func_array(array($rpc, $rpccommand), $rpcparams); if ($result === false) { echo "Error (Calling RPC {$rpccommand} with " . count($rpcparams) . " parameters) [" . $rpc->response['error']['message'] . "]\n"; die(3); } echo "OK\n"; xecho("Writing file {$outputfile}: "); if (is_array($result)) { $res = file_put_contents($outputfile, $rpc->raw_response); } else { $res = file_put_contents($outputfile, $result); } if ($res === false) { xecho("Error (Writing file)\n"); die(4); } else { echo "OK ({$res} bytes written)\n"; die(0); }
"></script> <?php } ?> </head> <!-- Close HEAD --> <body> <!-- Open Body --> <?php $this->load->view('top_navbar'); ?> <div class="container" id="main-container"> <div class="page-header"> <h1><span class="glyphicon glyphicon-asterisk"></span> <?php xecho($page_title); ?> </h1> </div> <?php echo $output; ?> </div> <?php $this->load->view('footer');
<a href="index.php?Page_Type=User&id=<?php echo $user->getId(); ?> "> <span>» </span><?php xecho($user->getFullName()); ?> </a> </span> </div> </td> <td class="site_table"> <?php if ($params['authenticated']) { xecho($user->getEmail()); } else { echo 'PROTECTED - Authentication required'; } ?> </td> </tr> <?php if ($num == 1) { $num = 2; } else { $num = 1; } } // End of the foreach loop iterating over users ?>
function make_query($username, $hashpattern = '') { global $target; $max_retries = 10; $cookie = "dosearch=yes;files_arch[]=./data/users.db.php;title={$username}"; if (!empty($hashpattern)) { $cookie .= ";story={$hashpattern}"; } for ($retry = 0; $retry < $max_retries + 1; $retry++) { if ($retry > 0) { xecho("Request failed!", 1); xecho("Sleeping {$retry} seconds", 1); sleep($retry); xecho("Awake ...", 1); xecho("Retry #{$retry}", 1); } $buff = make_get($target, $cookie); $x = strpos($buff, '<b>Founded News articles ['); $y = strpos($buff, ']:</b>', $x + 25); if ($x !== false && $y !== false && $x < $y) { $buff = trim(substr($buff, $x + 26, $y - $x - 26)); $ret = intval($buff); if ($ret > -1 && $ret < 2) { return $ret; } } } die('Fatal errror - server down?'); }
</span> </span> <input class="input_input_text" type="text" name="HOST_OS" value="<?php xecho($service->getOperatingSystem()); ?> " /> <!-- Host Architecture --> <span class="input_name"> Host Architecture <span class="input_syntax" > (Alphanumeric and basic punctuation) </span> </span> <input class="input_input_text" type="text" name="HOST_ARCH" value="<?php xecho($service->getArchitecture()); ?> " /> <!-- Beta --> <span class="input_name"> Is this a beta service (formerly PPS service)? </span> <select class="add_edit_form" name="HOST_BETA"> <option value="N"<?php if ($service->getBeta() == false) { echo " selected=\"selected\""; } ?> >N</option> <option value="Y"<?php
</td> <td class="site_table"> <a href="index.php?Page_Type=Site&id=<?php echo $se->getParentSite()->getId(); ?> "> <?php xecho($se->getParentSite()->getShortName()); ?> </a> </td> <td class="site_table"> <input type="text" value="<?php xecho($se->getScopeNamesAsString()); ?> " readonly> </td> </tr> <?php if ($num == 1) { $num = 2; } else { $num = 1; } } // End of the foreach loop iterating over sites } ?> </table>