本文整理汇总了PHP中API::add方法的典型用法代码示例。如果您正苦于以下问题:PHP API::add方法的具体用法?PHP API::add怎么用?PHP API::add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类API
的用法示例。
在下文中一共展示了API::add方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: sessionCurrency
public static function sessionCurrency()
{
global $CFG;
API::add('Currencies', 'getMain');
$query = API::send();
$main = $query['Currencies']['getMain']['results'][0];
if (empty($_REQUEST['currency']) && empty($_SESSION['currency']) && !empty(User::$info['default_currency'])) {
$_SESSION['currency'] = User::$info['default_currency'];
} elseif (empty($_REQUEST['currency']) && empty($_SESSION['currency']) && empty(User::$info['default_currency'])) {
$_SESSION['currency'] = $main['fiat'];
} elseif (!empty($_REQUEST['currency'])) {
$_SESSION['currency'] = preg_replace("/[^0-9]/", "", $_REQUEST['currency']);
}
if (empty($_REQUEST['c_currency']) && empty($_SESSION['c_currency']) && !empty(User::$info['default_c_currency'])) {
$_SESSION['c_currency'] = User::$info['default_c_currency'];
} elseif (empty($_REQUEST['c_currency']) && empty($_SESSION['c_currency']) && empty(User::$info['default_c_currency'])) {
$_SESSION['c_currency'] = $main['crypto'];
} elseif (!empty($_REQUEST['c_currency'])) {
$_SESSION['c_currency'] = preg_replace("/[^0-9]/", "", $_REQUEST['c_currency']);
}
if ($_SESSION['currency'] && !is_numeric($_SESSION['currency'])) {
$_SESSION['currency'] = $CFG->currencies[strtoupper($_SESSION['currency'])]['id'];
}
if ($CFG->currencies[$_SESSION['c_currency']]['is_crypto'] != 'Y') {
$_SESSION['c_currency'] = $main['crypto'];
}
if ($_SESSION['c_currency'] == $_SESSION['currency']) {
$_SESSION['currency'] = $main['fiat'];
}
return array('currency' => $_SESSION['currency'], 'c_currency' => $_SESSION['c_currency']);
}
示例2: array
$personal->errors[] = Lang::string('login-password-error');
}
if (!empty($_REQUEST['settings']) && !empty($personal->errors)) {
$errors = array();
foreach ($personal->errors as $key => $error) {
if (stristr($error, 'login-required-error')) {
$errors[] = Lang::string('settings-' . str_replace('_', '-', $key)) . ' ' . Lang::string('login-required-error');
} elseif (strstr($error, '-')) {
$errors[] = Lang::string($error);
} else {
$errors[] = $error;
}
}
Errors::$errors = $errors;
} elseif (!empty($_REQUEST['settings']) && empty($personal->errors)) {
API::add('User', 'disableNeverLoggedIn', array($personal->info['pass']));
API::send();
$_SESSION["firstlogin_uniq"] = md5(uniqid(mt_rand(), true));
Link::redirect('account.php?message=settings-personal-message');
} else {
$personal->info['pass'] = false;
}
$_SESSION["firstlogin_uniq"] = md5(uniqid(mt_rand(), true));
$page_title = Lang::string('first-login');
include 'includes/head.php';
?>
<div class="page_title">
<div class="container">
<div class="title"><h1><?php
echo $page_title;
?>
示例3: date_default_timezone_set
$query = API::send();
if (empty($ajax)) {
API::apiUpdateNonce();
}
/* Assign Settings To CFG */
Settings::assign($query['Settings']['get']['results'][0]);
/* Check Login */
User::verifyLogIn($query);
User::logOut(isset($_REQUEST['log_out']));
/* Set Timezone */
date_default_timezone_set($CFG->default_timezone);
$dtz = new DateTimeZone($CFG->default_timezone);
$dtz1 = new DateTime('now', $dtz);
$CFG->timezone_offset = $dtz->getOffset($dtz1);
/* Detect Language */
$CFG->lang_table = $query['Lang']['getTable']['results'][0];
$lang = !empty($_REQUEST['lang']) ? preg_replace("/[^a-z]/", "", strtolower($_REQUEST['lang'])) : false;
if ($lang && in_array($lang, array('en', 'es', 'ru', 'zh'))) {
$CFG->language = $lang;
$_SESSION['language'] = $lang;
if (User::isLoggedIn()) {
API::add('User', 'setLang', array($lang));
}
} elseif (!empty($_SESSION['language'])) {
$CFG->language = $_SESSION['language'];
} elseif (empty($_SESSION['language'])) {
$_SESSION['language'] = 'en';
$CFG->language = 'en';
}
/* Get Currencies */
$CFG->currencies = $query['Currencies']['get']['results'][0];
示例4: chdir
<?php
chdir('..');
$ajax = true;
include '../lib/common.php';
$currency1 = !empty($CFG->currencies[strtoupper($_REQUEST['currency'])]) ? $_REQUEST['currency'] : 'usd';
API::add('Stats', 'getCurrent', array(false, $currency1));
$query = API::send();
$stats = $query['Stats']['getCurrent']['results'][0];
echo json_encode($stats);
示例5: elseif
}
if ($query['error'] == 'security-incorrect-token') {
Errors::add(Lang::string('security-incorrect-token'));
}
}
if ($_REQUEST['action'] == 'delete' && !$query['APIKeys']['delete']['results'][0]) {
Link::redirect('api-access.php?error=delete');
}
if (!is_array(Errors::$errors)) {
if ($_REQUEST['action'] == 'edit') {
Link::redirect('api-access.php?message=edit');
} elseif ($_REQUEST['action'] == 'add') {
$secret = $query['APIKeys']['add']['results'][0];
Messages::add(Lang::string('api-add-message'));
$info_message = str_replace('[secret]', $secret, Lang::string('api-add-show-secret'));
API::add('APIKeys', 'get');
$query = API::send();
$api_keys = $query['APIKeys']['get']['results'][0];
} elseif ($_REQUEST['action'] == 'delete') {
Link::redirect('api-access.php?message=delete');
}
} else {
$request_2fa = true;
}
}
}
if (!empty($_REQUEST['message']) && $_REQUEST['message'] == 'edit') {
Messages::add(Lang::string('api-edit-message'));
} elseif (!empty($_REQUEST['message']) && $_REQUEST['message'] == 'delete') {
Messages::add(Lang::string('api-delete-message'));
} elseif (!empty($_REQUEST['error']) && $_REQUEST['error'] == 'delete') {
示例6: array
if ($passed_uniq) {
if (!$confirmed) {
API::add('Gateways', 'depositPreconditions', array($info));
$query = API::send();
$errors1 = $query['Gateways']['depositPreconditions']['results'][0];
if (!empty($errors1['error'])) {
Errors::add($errors1['error']['message']);
} else {
if (!empty($errors1['offsite'])) {
Link::redirect($errors1['offsite'], $errors1['offsite_vars']);
} else {
$ask_confirm = true;
}
}
} else {
API::add('Gateways', 'processDeposit', array($info));
$query = API::send();
$operations = $query['Gateways']['processDeposit']['results'][0];
if (!empty($operations['error'])) {
Errors::add($operations['error']['message']);
} else {
if ($operations['new_order'] > 0) {
$_SESSION["deposit_uniq"][time()] = md5(uniqid(mt_rand(), true));
if (count($_SESSION["deposit_uniq"]) > 3) {
unset($_SESSION["deposit_uniq"][min(array_keys($_SESSION["deposit_uniq"]))]);
}
Link::redirect('deposit', array('transactions' => $operations['transactions'], 'new_order' => 1));
exit;
}
}
}
示例7: str_replace
if (stristr($error, 'login-required-error')) {
$errors[] = Lang::string('settings-' . str_replace('_', '-', $key)) . ' ' . Lang::string('login-required-error');
} elseif (strstr($error, '-')) {
$errors[] = Lang::string($error);
} else {
$errors[] = $error;
}
}
Errors::$errors = $errors;
} elseif (!empty($_REQUEST['settings']) && empty($personal->errors)) {
if (empty($no_token) && !$request_2fa) {
//$authcode2 = (User::$info['verified_authy'] == 'Y' || User::$info['verified_google'] == 'Y') ? false : $authcode1;
//API::settingsChangeId($authcode2);
//API::token($token1);
API::settingsChangeId($authcode1);
API::add('User', 'changePassword', array($personal->info['pass']));
$query = API::send();
if (!empty($query['error'])) {
if ($query['error'] == 'security-com-error') {
Errors::add(Lang::string('security-com-error'));
}
if ($query['error'] == 'authy-errors') {
Errors::merge($query['authy_errors']);
}
if ($query['error'] == 'request-expired') {
Errors::add(Lang::string('settings-request-expired'));
}
if ($query['error'] == 'security-incorrect-token') {
Errors::add(Lang::string('security-incorrect-token'));
}
}
示例8: array
<?php
include '../lib/common.php';
if (!$_REQUEST['log_out']) {
Link::redirect('index.php');
}
API::add('Content', 'getRecord', array('logged-out'));
$query = API::send();
$page_title = Lang::string('log-out');
$content = $query['Content']['getRecord']['results'][0];
include 'includes/head.php';
?>
<div class="page_title">
<div class="container">
<div class="title"><h1><?php
echo $page_title;
?>
</h1></div>
<div class="pagenation"> <a href="index.php"><?php
echo Lang::string('home');
?>
</a> <i>/</i> <a href="news.php"><?php
echo $page_title;
?>
</a></div>
</div>
</div>
<div class="container">
<div class="content_right">
<h2><?php
echo $content['title'];
示例9: elseif
include '../lib/common.php';
if (User::$info['locked'] == 'Y' || User::$info['deactivated'] == 'Y') {
Link::redirect('settings.php');
} elseif (User::$awaiting_token) {
Link::redirect('verify-token.php');
} elseif (!User::isLoggedIn()) {
Link::redirect('login.php');
}
$page1 = !empty($_REQUEST['page']) ? preg_replace("/[^0-9]/", "", $_REQUEST['page']) : false;
API::add('BankAccounts', 'get');
API::add('BitcoinAddresses', 'get', array(false, false, 1, 1));
API::add('Requests', 'get', array(1));
API::add('Requests', 'get', array(false, $page1, 15));
API::add('Content', 'getRecord', array('deposit-bank-instructions'));
API::add('Content', 'getRecord', array('deposit-no-bank'));
$query = API::send();
$bank_accounts = $query['BankAccounts']['get']['results'][0];
$bitcoin_addresses = $query['BitcoinAddresses']['get']['results'][0];
$key = is_array($bank_accounts) ? key($bank_accounts) : false;
$bank_account = $bank_accounts[$key];
$total = $query['Requests']['get']['results'][0];
$requests = $query['Requests']['get']['results'][1];
$bank_instructions = $bank_account ? $query['Content']['getRecord']['results'][0] : $query['Content']['getRecord']['results'][1];
$bank_account_currency = $CFG->currencies[$bank_account['currency']];
$pagination = $pagination = Content::pagination('deposit.php', $page1, $total, 15, 5, false);
$page_title = Lang::string('deposit');
if (empty($_REQUEST['bypass'])) {
include 'includes/head.php';
?>
<div class="page_title">
示例10: array
<?php
include '../lib/common.php';
$currencies = Settings::sessionCurrency();
$page_title = Lang::string('order-book');
$currency1 = $currencies['currency'];
$c_currency1 = $currencies['c_currency'];
$currency_info = $CFG->currencies[$currency1];
$c_currency_info = $CFG->currencies[$c_currency1];
API::add('Orders', 'get', array(false, false, false, $c_currency1, $currency1, false, false, 1));
API::add('Orders', 'get', array(false, false, false, $c_currency1, $currency1, false, false, false, false, 1));
API::add('Transactions', 'get', array(false, false, 1, $c_currency1, $currency1));
$query = API::send();
$bids = $query['Orders']['get']['results'][0];
$asks = $query['Orders']['get']['results'][1];
$last_transaction = $query['Transactions']['get']['results'][0][0];
$last_trans_currency = $last_transaction['currency'] == $currency_info['id'] ? false : ($last_transaction['currency1'] == $currency_info['id'] ? false : ' (' . $CFG->currencies[$last_transaction['currency1']]['currency'] . ')');
$last_trans_symbol = $currency_info['fa_symbol'];
$last_trans_color = $last_transaction['maker_type'] == 'sell' ? 'price-green' : 'price-red';
include 'includes/head.php';
?>
<div class="page_title">
<div class="container">
<div class="title"><h1><?php
echo $page_title;
?>
</h1></div>
<div class="pagenation"> <a href="index.php"><?php
echo Lang::string('home');
?>
</a> <i>/</i> <a href="order-book.php"><?php
示例11: array
<?php
include '../lib/common.php';
API::add('Content', 'getRecord', array('about'));
$query = API::send();
$content = $query['Content']['getRecord']['results'][0];
$page_title = $content['title'];
include 'includes/head.php';
?>
<div class="page_title">
<div class="container">
<div class="title"><h1><?php
echo $page_title;
?>
</h1></div>
<div class="pagenation"> <a href="<?php
echo Lang::url('index.php');
?>
"><?php
echo Lang::string('home');
?>
</a> <i>/</i> <a href="<?php
echo Lang::url('about.php');
?>
"><?php
echo Lang::string('about');
?>
</a></div>
</div>
</div>
<div class="container">
示例12: ereg_replace
<?php
include '../lib/common.php';
$page1 = !empty($_REQUEST['page']) ? ereg_replace("[^0-9]", "", $_REQUEST['page']) : false;
$bypass = !empty($_REQUEST['bypass']);
API::add('News', 'get', array(1));
API::add('News', 'get', array(false, $page1, 10, 1));
$query = API::send();
$total = $query['News']['get']['results'][0];
$news = $query['News']['get']['results'][1];
$pagination = Content::pagination('press-releases.php', $page1, $total, 10, 5, false);
$page_title = Lang::string('news');
if (!$bypass) {
include 'includes/head.php';
?>
<div class="page_title">
<div class="container">
<div class="title"><h1><?php
echo $page_title;
?>
</h1></div>
<div class="pagenation"> <a href="<?php
echo Lang::url('index.php');
?>
"><?php
echo Lang::string('home');
?>
</a> <i>/</i> <a href="<?php
echo Lang::url('press-releases.php');
?>
"><?php
示例13: elseif
<?php
include '../lib/common.php';
if (User::$awaiting_token) {
Link::redirect('verify-token.php');
} elseif (!User::isLoggedIn()) {
Link::redirect('https://support.1btcxe.com/');
}
API::add('User', 'getInfo', array($_SESSION['session_id']));
$query = API::send();
$user_info = $query['User']['getInfo']['results'][0];
$remote_url = preg_replace("/[^a-z0-9\\/-]/", "", $_REQUEST['url']);
if ($remote_url) {
$remote_url = '&redirect_to=' . urlencode('https://support.1btcxe.com/' . $remote_url);
}
Link::redirect('http://support.1btcxe.com/login/sso?name=' . urlencode(!empty($user_info['first_name']) ? $user_info['first_name'] . ' ' . $user_info['last_name'] : $user_info['user']) . '&email=' . urlencode($user_info['email']) . '&timestamp=' . time() . '&hash=' . hash_hmac('md5', $user_info['first_name'] . ' ' . $user_info['last_name'] . $user_info['email'] . time(), $CFG->helpdesk_key) . $remote_url);
示例14: array
$contact->errors[] = 'Page expired.';
}
if (!empty($_REQUEST['contact']) && is_array($contact->errors)) {
$errors = array();
foreach ($contact->errors as $key => $error) {
if (stristr($error, 'login-required-error')) {
$errors[] = Lang::string('settings-' . str_replace('_', '-', $key)) . ' ' . Lang::string('login-required-error');
} elseif (strstr($error, '-')) {
$errors[] = Lang::string($error);
} else {
$errors[] = $error;
}
}
Errors::$errors = $errors;
} elseif (!empty($_REQUEST['contact']) && !is_array($contact->errors)) {
API::add('SiteEmail', 'contactForm', array($contact->info));
$query = API::send();
Messages::$messages = array(Lang::string('contact-message'));
$show_message = true;
$show_mask = true;
}
$_SESSION["contact_uniq"] = md5(uniqid(mt_rand(), true));
include 'includes/head.php';
?>
<div class="page_title">
<div class="container">
<div class="title"><h1><?php
echo $page_title;
?>
</h1></div>
<div class="pagenation"> <a href="<?php
示例15: array
<?php
include '../lib/common.php';
API::add('Content', 'getRecord', array('anti-fraud'));
$query = API::send();
$content = $query['Content']['getRecord']['results'][0];
$page_title = $content['title'];
include 'includes/head.php';
?>
<div class="page_title">
<div class="container">
<div class="title"><h1><?php
echo $page_title;
?>
</h1></div>
<div class="pagenation"> <a href="index.php"><?php
echo Lang::string('home');
?>
</a> <i>/</i> <a href="anti-fraud.php"><?php
echo $content['title'];
?>
</a></div>
</div>
</div>
<div class="container">
<div class="content_right">
<div class="text"><?php
echo $content['content'];
?>
</div>
</div>