function get_knowledge_base() { $kb = array(t('Concepts') => array('cryptocurrencies' => array('title' => t("What are cryptocurrencies?"), 'inline' => 'inline_cryptocurrencies'), 'versions' => array('title' => t(":site_name Version History"), 'inline' => 'inline_versions', 'new' => true)), t('Interface') => array('bitcoin_csv' => t("How do I upload a Bitcoin-Qt CSV file?"), 'litecoin_csv' => t("How do I upload a Litecoin-Qt CSV file?"), 'notifications' => array('title' => t("How do automated notifications work?"), 'inline' => 'inline_notifications'), 'managed_graphs' => array('title' => t("How are graphs automatically managed?"), 'inline' => 'inline_managed_graphs'), 'graph_refresh' => array('title' => t("Do graphs live update?"), 'inline' => 'inline_graph_refresh'), 'finance' => array('title' => t("What is :site_name Finance?"), 'inline' => 'inline_finance', 'new' => true)), t('Accounts') => array('add_currency' => array('title' => t("Can you add support for another cryptocurrency?"), 'inline' => 'inline_add_currency'), 'add_fiat' => array('title' => t("Can you add support for another fiat currency?"), 'inline' => 'inline_add_fiat'), 'add_service' => array('title' => t("Can you add support for another exchange/mining pool?"), 'inline' => 'inline_add_service')), t('Notifications') => array('notifications_ticker' => array('title' => t("How do I get notified of exchange rate changes?"), 'inline' => 'inline_notifications_ticker'), 'notifications_reports' => array('title' => t("How do I get notified of changes in my reports?"), 'inline' => 'inline_notifications_reports'), 'notifications_hashrates' => array('title' => t("How do I get notified of changes in my hashrates?"), 'inline' => 'inline_notifications_hashrates')), t('Finance') => array('transaction_creation' => array('title' => t("How are transactions automatically created?"), 'inline' => 'inline_transaction_creation', 'new' => true))); // automatically construct KB for adding accounts through the wizards $wizards = array("Mining pools" => 'mining pool account', "Exchanges" => 'exchange account', "Securities" => 'securities exchange account', "Individual Securities" => 'securities', "Other" => ''); foreach (account_data_grouped() as $label => $group) { if (isset($wizards[$label])) { foreach ($group as $key => $data) { if ($data['disabled']) { continue; } if ($label == 'Individual Securities') { $title = 'How do I add individual ' . get_exchange_name($data['exchange']) . (isset($data['suffix']) ? $data['suffix'] : '') . ($wizards[$label] ? ' ' . $wizards[$label] : '') . '?'; } else { $title = 'How do I add a ' . get_exchange_name($key) . (isset($data['suffix']) ? $data['suffix'] : '') . ($wizards[$label] ? ' ' . $wizards[$label] : '') . '?'; } $kb[t('Accounts')][$key] = array('title' => $title, 'inline' => 'inline_accounts_' . $key, 'new' => in_array($key, get_new_supported_wallets()) || in_array($key, get_new_exchanges()) || in_array($key, get_new_security_exchanges()) || isset($data['exchange']) && in_array($data['exchange'], get_new_security_exchanges())); } } } // sort each section by title foreach ($kb as $label => $group) { uasort($kb[$label], '_sort_get_knowledge_base'); } return $kb; }
} echo "<dt>" . ht($category) . "</dt>\n"; if ($category == "Offsets") { // Offsets have no subcategories; issue #344 continue; } $result = array(); foreach ($datas as $exchange => $data) { if (isset($data['disabled']) && $data['disabled']) { // don't display disabled accounts continue; } if ($category == 'Addresses') { $result[] = $data['title'] . (in_array($data['currency'], get_new_supported_currencies()) ? " <span class=\"new\">" . ht("new") . "</span>" : ""); } else { $new = in_array($exchange, get_new_security_exchanges()) || in_array($exchange, get_new_supported_wallets()) || in_array($exchange, get_new_exchanges()); $result[] = get_exchange_name($exchange) . ($new ? " <span class=\"new\">" . ht("new") . "</span>" : ""); } } $result = array_unique($result); // remove duplicate titles such as Mining Foreman natcasesort($result); echo "<dd>" . implode(", ", $result) . "</dd>\n"; } ?> </dl> </p> <p> <?php echo t("To read account data, you instruct your account provider to enable read-only access via an :api_key,\n and you provide that key to :site_name. Helpful wizards guide you through the steps to add new accounts and addresses.", array(':api_key' => "<i>" . ht("API key") . "</i>"));
throw new Exception("Unknown security type '" . htmlspecialchars($security_type) . "'"); } // get all "new" securities $q = db()->prepare("SELECT * FROM " . $tables[$security_type] . " WHERE created_at > DATE_SUB(NOW(), INTERVAL 7 DAY)"); $q->execute(); $new_securities = array(); while ($sec = $q->fetch()) { $new_securities[$sec['name']] = 1; } } // TODO should refactor this with layout/graphs.php if (isset($def['arg0'])) { $values = $def['arg0'](isset($def['param0']) ? $def['param0'] : false, isset($def['param1']) ? $def['param1'] : false); if ($values) { echo "<h2>" . htmlspecialchars($def['heading']); if ($bits[0] == "securities" && in_array($security_type, get_new_security_exchanges())) { echo " <span class=\"new\">" . ht("new") . "</span>"; } echo "</h2>\n<ul class=\"historical_graphs\">"; if ($graph_key == "external_historical") { echo "<li><a href=\"" . htmlspecialchars(url_for('external')) . "\">" . ht("External API status") . "</a></li>"; } else { foreach ($values as $key => $security) { $title = $security; if (isset($def['title_callback'])) { $callback = $def['title_callback']; $title = $callback($graph_key, $security); } echo "<li><a href=\"" . htmlspecialchars(url_for('historical', array('id' => $graph_key, 'days' => 180, 'name' => $security))) . "\">" . htmlspecialchars($title) . "</a>"; // is this new? if ($bits[0] == "securities" && isset($new_securities[$security])) {