Exemplo n.º 1
0
 /**
  * If we have disabled an account, it should not appear in {@link get_external_apis()}.
  */
 function testDisabledAccountsArentExternalAPIs()
 {
     $account_data_grouped = account_data_grouped();
     $external_apis = get_external_apis();
     $this->assertGreaterThan(0, count($account_data_grouped['Mining pools']));
     foreach ($account_data_grouped['Mining pools'] as $key => $data) {
         if ($data['disabled']) {
             $this->assertFalse(isset($external_apis['Mining pool wallets'][$key]), "Did not expect disabled mining pool wallet '{$key}' in external APIs");
         }
     }
     $this->assertGreaterThan(0, count($account_data_grouped['Exchanges']));
     foreach ($account_data_grouped['Exchanges'] as $key => $data) {
         if ($data['disabled']) {
             $this->assertFalse(isset($external_apis['Exchange wallets'][$key]), "Did not expect disabled exchange wallet '{$key}' in external APIs");
         }
     }
     $this->assertGreaterThan(0, count($account_data_grouped['Securities']));
     foreach ($account_data_grouped['Securities'] as $key => $data) {
         if ($data['disabled']) {
             $this->assertFalse(isset($external_apis['Security exchanges'][$key]), "Did not expect disabled mining pool wallet '{$key}' in external APIs");
         }
     }
 }
Exemplo n.º 2
0
require __DIR__ . "/../layout/templates.php";
$messages = array();
$errors = array();
page_header("Admin: Show Explorers", "page_admin_show_explorers");
?>

<h1>Currency Explorers</h1>

<p class="backlink"><a href="<?php 
echo htmlspecialchars(url_for('admin'));
?>
">&lt; Back to Site Status</a></p>

<ul>
<?php 
$grouped = account_data_grouped();
$external = get_external_apis();
foreach ($grouped['Addresses'] as $key => $data) {
    echo "<li><span style=\"display: inline-block; min-width: 250px;\">";
    echo get_currency_abbr($data['currency']);
    echo " using " . $external['Address balances'][$key];
    echo " using " . $external['Address balances'][$key]['link'];
    echo ":</span> ";
    echo crypto_address($data['currency'], 'example');
    echo "</li>";
}
?>
</ul>

<?php 
page_footer();
Exemplo n.º 3
0
/**
 * Return a list of external API status keys to external API status titles;
 * titles are obtained by stripping HTML. It might be better to refactor this
 * so that titles are the default and HTML is added later.
 */
function get_external_apis_titles()
{
    $apis = get_external_apis();
    $result = array();
    foreach ($apis as $group => $data) {
        foreach ($data as $key => $title) {
            $result[$key] = preg_replace('#<[^>]+?>#im', '', $title['link']) . translate_external_api_group_to_suffix($group) . " API";
        }
    }
    // sort by title
    asort($result);
    return $result;
}