本文整理汇总了PHP中get_site_config函数的典型用法代码示例。如果您正苦于以下问题:PHP get_site_config函数的具体用法?PHP get_site_config怎么用?PHP get_site_config使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_site_config函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: crypto_curl_init
/**
* Extends {@link #curl_init()} to also set {@code CURLOPT_TIMEOUT}
* and {@code CURLOPT_CONNECTTIMEOUT} appropriately.
*/
function crypto_curl_init()
{
$ch = curl_init();
curl_setopt($ch, CURLOPT_TIMEOUT, get_site_config('get_contents_timeout'));
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, get_site_config('get_contents_timeout'));
return $ch;
}
示例2: getPackageJsonVersion
function getPackageJsonVersion()
{
$version = get_site_config('openclerk_version');
if (!preg_match("#^[0-9]+\\.[0-9]+\\.[0-9]+\$#", $version)) {
$version = $version . ".0";
}
return $version;
}
示例3: isJobsDisabled
function isJobsDisabled(Logger $logger)
{
if (!get_site_config('jobs_enabled')) {
$logger->info("Running jobs is disabled");
return true;
}
return false;
}
示例4: findJob
/**
* Find a job that belongs to the system user.
*/
function findJob(Connection $db, Logger $logger)
{
if ($this->isJobsDisabled($logger)) {
return false;
}
$q = $db->prepare("SELECT * FROM jobs WHERE user_id = ? AND " . $this->defaultFindJobQuery() . " LIMIT 1");
$q->execute(array(get_site_config('system_user_id')));
return $q->fetch();
}
示例5: crypto_address
/**
* Return a HTML link for inspecting a given cryptocurrency address.
*/
function crypto_address($currency, $address)
{
foreach (\DiscoveredComponents\Currencies::getAddressCurrencies() as $cur) {
if ($cur === $currency) {
$instance = \DiscoveredComponents\Currencies::getInstance($cur);
return "<span class=\"address " . $currency . "_address\"><code>" . htmlspecialchars($address) . "</code>\n <a class=\"inspect\" href=\"" . htmlspecialchars($instance->getBalanceURL($address)) . "\" title=\"Inspect with " . htmlspecialchars($instance->getExplorerName()) . "\">?</a>\n </span>";
}
}
foreach (get_blockchain_currencies() as $explorer => $currencies) {
foreach ($currencies as $cur) {
if ($cur == $currency) {
return "<span class=\"address " . $currency . "_address\"><code>" . htmlspecialchars($address) . "</code>\n <a class=\"inspect\" href=\"" . htmlspecialchars(sprintf(get_site_config($currency . "_address_url"), $address)) . "\" title=\"Inspect with " . htmlspecialchars($explorer) . "\">?</a>\n </span>";
}
}
}
return htmlspecialchars($address);
}
示例6: check_heavy_request
/**
* We're about to perform a computationally intense task that is visible
* or accessible to the public - this method will check the current user
* IP and make sure this IP isn't requesting too many things at once.
*
* If login does not work, make sure that you have set database_timezone
* correctly.
*/
function check_heavy_request()
{
if (get_site_config("heavy_requests_seconds") >= 0) {
$q = db()->prepare("SELECT * FROM heavy_requests WHERE user_ip=?");
$q->execute(array(user_ip()));
if ($heavy = $q->fetch()) {
// too many requests?
// assumes the database and server times are in sync
if (strtotime($heavy['last_request']) > strtotime("-" . get_site_config("heavy_requests_seconds") . " seconds")) {
throw new BlockedException(t("You are making too many requests at once: please wait at least :seconds.", array(':seconds' => plural("second", get_site_config("heavy_requests_seconds")))));
} else {
// update database
$q = db()->prepare("UPDATE heavy_requests SET last_request=NOW() WHERE user_ip=?");
$q->execute(array(user_ip()));
}
} else {
// insert into database
$q = db()->prepare("INSERT INTO heavy_requests SET last_request=NOW(), user_ip=?");
$q->execute(array(user_ip()));
}
}
}
示例7: findJobs
/**
* Get a list of all jobs that need to be queued, as an array of associative
* arrays with (job_type, arg_id, [user_id]).
*
* This could use e.g. {@link JobTypeFinder}
*/
function findJobs(Connection $db, Logger $logger)
{
$logger->info("Creating temporary table");
$q = $db->prepare("CREATE TABLE temp (\n created_at_day INT NOT NULL,\n INDEX(created_at_day)\n )");
$q->execute();
$logger->info("Inserting into temporary table");
$q = $db->prepare("INSERT INTO temp (SELECT created_at_day FROM ticker WHERE exchange = 'average' GROUP BY created_at_day)");
$q->execute();
$logger->info("Querying");
$q = $db->prepare("SELECT created_at_day, min(created_at) as date, count(*) as c\n FROM ticker\n WHERE exchange <> 'average' AND exchange <> 'themoneyconverter' and is_daily_data=1 and created_at_day not in (SELECT created_at_day FROM temp)\n GROUP BY created_at_day");
$q->execute();
$missing = $q->fetchAll();
$logger->info("Dropping temporary table");
$q = $db->prepare("DROP TABLE temp");
$q->execute();
$logger->info("Found " . number_format(count($missing)) . " days of missing average data");
$result = array();
foreach ($missing as $row) {
$logger->info("Average data for " . $row['date'] . " can be reconstructed from " . number_format($row['c']) . " ticker instances");
$result[] = array('job_type' => 'missing_average', 'arg_id' => $row['created_at_day'], 'user_id' => get_site_config('system_user_id'));
}
return $result;
}
示例8: getTitle
}
function getTitle()
{
return $this->title;
}
function load()
{
require __DIR__ . "/../locale/" . $this->key . ".php";
return $result;
}
}
$locales = array('de' => 'German', 'fr' => 'French', 'jp' => 'Japanese', 'ru' => 'Russian', 'zh' => 'Chinese');
foreach ($locales as $locale => $title) {
I18n::addAvailableLocale(new GenericLocale($locale, $title));
}
I18n::addDefaultKeys(array(':site_name' => get_site_config('site_name')));
// set locale as necessary
if (isset($_COOKIE["locale"]) && in_array($_COOKIE["locale"], array_keys(I18n::getAvailableLocales()))) {
I18n::setLocale($_COOKIE["locale"]);
}
\Openclerk\Events::on('i18n_missing_string', function ($data) {
$locale = $data['locale'];
$key = $data['key'];
log_uncaught_exception(new LocaleException("Locale '{$locale}': Missing key '{$key}'"));
});
/**
* Helper function to mark strings that need to be translated on the client-side.
*/
function ct($s)
{
// do not do any translation here - we have to do it on the client side!
示例9: t
?>
</h1>
<?php
if (user_logged_in() && ($user = get_user(user_id()))) {
if ($user['is_premium']) {
?>
<div class="success success_float">
<?php
echo t("Thank you for supporting :site_name with :premium!", array(':premium' => link_to(url_for('user#user_premium'), ht("your premium account"))));
?>
<br>
<?php
echo t("Your premium account expires in :time.", array(":time" => recent_format_html($user['premium_expires'], " ago", "")));
?>
</div>
<?php
}
}
?>
<p>
<?php
$result = array();
foreach (get_site_config('premium_currencies') as $currency) {
$result[] = get_currency_name($currency);
}
echo t("You can support :site_name by purchasing a\n\tpremium account with :currencies currencies. You will also get access to exclusive, premium-only functionality such as\n\tvastly increased limits on the number of addresses and accounts you may track at once,\n\tand advanced reporting and notification functionality. Your jobs and reports will also have higher priority over free users.", array(":currencies" => implode_english($result)));
?>
</p>
示例10: has_expected_user_graph_hash
function has_expected_user_graph_hash($hash, $user)
{
$q = db()->prepare("SELECT * FROM user_valid_keys WHERE user_id=?");
$q->execute(array($user['id']));
while ($key = $q->fetch()) {
if ($hash === md5(get_site_config('user_graph_hash_salt') . ":" . $user['id'] . ":" . $key['user_key'])) {
return true;
}
}
return false;
}
示例11: define
* This always executes (no job framework) so it should be used sparingly or as necessary.
*
* Arguments (in command line, use "-" for no argument):
* $key/1 required the automated key
*/
define('USE_MASTER_DB', true);
// always use the master database for selects!
require __DIR__ . "/../inc/global.php";
require __DIR__ . "/_batch.php";
require_batch_key();
batch_header("Batch cleanup balances", "batch_cleanup_balances");
crypto_log("Current time: " . date('r'));
// find all ticker data that needs to be inserted into the graph_data table
// TODO currently all database dates and PHP logic is based on server side timezone, not GMT/UTC
// database values need to all be modified to GMT before we can add '+00:00' for example
$cutoff_date = date('Y-m-d', strtotime(get_site_config('archive_balances_data'))) . ' 23:59:59';
// +00:00';
$summary_date_prefix = " 00:00:00";
// +00:00
crypto_log("Cleaning up balances data earlier than " . htmlspecialchars($cutoff_date) . " into summaries...");
$q = db_master()->prepare("SELECT * FROM balances WHERE created_at <= :date ORDER BY created_at ASC");
$q->execute(array("date" => $cutoff_date));
// we're going to store this all in memory, because at least that way we don't have to
// execute logic twice
$stored = array();
$count = 0;
while ($balance = $q->fetch()) {
$count++;
if ($count % 100 == 0) {
crypto_log("Processed " . number_format($count) . "...");
}
示例12: htmlspecialchars
<div class="instructions_safe">
<h2>Is it safe to provide <?php
echo htmlspecialchars(get_site_config('site_name'));
?>
a <?php
echo $account_data['exchange_name'];
?>
API key?</h2>
<ul>
<li>At the time of writing, a <?php
echo $account_data['exchange_name'];
?>
API key can only be used to retrieve account balances and worker status;
it should not be possible to perform transactions or change user details using the API key.</li>
<li>Your <?php
echo $account_data['exchange_name'];
?>
API keys will <i>never</i> be displayed on the <?php
echo htmlspecialchars(get_site_config('site_name'));
?>
site, even if you have logged in.</li>
<li>At the time of writing, it is not possible to change or reset your <?php
echo $account_data['exchange_name'];
?>
API key.</li>
</ul>
</div>
示例13: foreach
foreach ($coins as $coin) {
?>
<tr class="<?php
echo in_array($coin['id'], $my_coins) ? "voted-coin" : "";
?>
">
<td class=""><?php
echo htmlspecialchars($coin['code']);
?>
</td>
<td class=""><?php
echo htmlspecialchars($coin['title']);
?>
</td>
<td class="number"><?php
echo number_format($coin['total_votes'] * get_site_config('vote_coins_multiplier'));
?>
</td>
<td class="number"><?php
echo number_format($coin['total_users']);
?>
</td>
<?php
if (user_logged_in()) {
?>
<td class="buttons">
<input type="checkbox" name="coins[]" value="<?php
echo htmlspecialchars($coin['id']);
?>
"<?php
echo in_array($coin['id'], $my_coins) ? " checked " : "";
示例14: get_html_premium_prices
/**
* @return a HTML string that can be used in an e-mail, listing all prices
*/
function get_html_premium_prices()
{
$prices = array();
foreach (get_site_config('premium_currencies') as $currency) {
$prices[] = " " . get_currency_abbr($currency) . ": " . number_format_autoprecision(get_premium_price($currency, 'monthly')) . " " . get_currency_abbr($currency) . "/month, or " . number_format_autoprecision(get_premium_price($currency, 'yearly')) . " " . get_currency_abbr($currency) . "/year" . (get_site_config('premium_' . $currency . '_discount') ? " (" . (int) (get_site_config('premium_' . $currency . '_discount') * 100) . "% off)" : "");
}
return implode("<br>\n", $prices);
}
示例15: require_get
<?php
$email = require_get("email", false);
$hash = require_get("hash", false);
// check hash
if ($hash !== md5(get_site_config('unsubscribe_salt') . $email)) {
throw new Exception(t("Invalid hash - please recheck the link in your e-mail."));
}
// if any accounts have a password enabled, they simply cannot unsubscribe until they have at least one
// openid identity
$q = db()->prepare("SELECT * FROM users WHERE email=?");
$q->execute(array($email));
$users = $q->fetchAll();
$has_identity = false;
foreach ($users as $user) {
$q = db()->prepare("SELECT * FROM user_passwords WHERE user_id=?");
$q->execute(array($user['id']));
$password_hash = $q->fetch();
if ($password_hash) {
$q = db()->prepare("SELECT * FROM user_openid_identities WHERE user_id=? LIMIT 1");
$q->execute(array($user['id']));
$has_identity = $q->fetch();
$q = db()->prepare("SELECT * FROM user_oauth2_identities WHERE user_id=? LIMIT 1");
$q->execute(array($user['id']));
$has_oauth2 = $q->fetch();
if (!$has_identity || !$has_oauth2) {
require __DIR__ . "/../layout/templates.php";
page_header(t("Unsubscribe unsuccessful"), "page_unsubscribe");
?>
<h1><?php
echo ht("Unsubscribe unsuccessful");