Autosave: 20260224-121753
This commit is contained in:
parent
f5828280ee
commit
4aeabbd550
@ -3,9 +3,9 @@ require_once __DIR__ . '/../db/config.php';
|
||||
require_once __DIR__ . '/../includes/lang.php';
|
||||
if (session_status() === PHP_SESSION_NONE) session_start();
|
||||
|
||||
// Remove forced simplified Chinese for admin
|
||||
// $lang = 'zh';
|
||||
// $_SESSION['lang'] = 'zh';
|
||||
// Forced simplified Chinese for admin
|
||||
$lang = 'zh';
|
||||
$_SESSION['lang'] = 'zh';
|
||||
|
||||
// Admin check
|
||||
$admin = null;
|
||||
@ -259,23 +259,7 @@ function renderAdminPage($content, $title = '后台管理') {
|
||||
<h5 class="mb-0"><?= $title ?></h5>
|
||||
</div>
|
||||
<div class="d-flex align-items-center gap-3">
|
||||
<!-- Admin Language Switcher -->
|
||||
<div class="dropdown me-2">
|
||||
<button class="btn btn-sm btn-light border dropdown-toggle d-flex align-items-center gap-2" type="button" data-bs-toggle="dropdown">
|
||||
<img src="https://flagcdn.com/w20/<?= $supported_langs[$lang]['flag'] ?>.png" width="16" alt="<?= $lang ?>">
|
||||
<span><?= $supported_langs[$lang]['name'] ?></span>
|
||||
</button>
|
||||
<ul class="dropdown-menu dropdown-menu-end shadow-sm border-0">
|
||||
<?php foreach ($supported_langs as $code => $info): ?>
|
||||
<li>
|
||||
<a class="dropdown-item d-flex align-items-center gap-2" href="?lang=<?= $code ?>">
|
||||
<img src="https://flagcdn.com/w20/<?= $info['flag'] ?>.png" width="16" alt="<?= $code ?>">
|
||||
<?= $info['name'] ?>
|
||||
</a>
|
||||
</li>
|
||||
<?php endforeach; ?>
|
||||
</ul>
|
||||
</div>
|
||||
<!-- Admin Language Switcher Removed -->
|
||||
|
||||
<div class="text-muted small"><?= __('welcome_admin') ?>, <?= htmlspecialchars($admin['username']) ?></div>
|
||||
<div class="position-relative me-2">
|
||||
|
||||
@ -17,32 +17,32 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-2 col-md-4">
|
||||
<h6 class="fw-bold mb-3"><?php echo __('footer_about'); ?></h6>
|
||||
<h6 class="fw-bold mb-3" data-i18n="footer_about"><?php echo __('footer_about'); ?></h6>
|
||||
<ul class="list-unstyled small lh-lg">
|
||||
<li><a href="/about.php" class="text-muted text-decoration-none"><?php echo __('about_us'); ?></a></li>
|
||||
<li><a href="/news.php" class="text-muted text-decoration-none"><?php echo __('news'); ?></a></li>
|
||||
<li><a href="/tos.php" class="text-muted text-decoration-none"><?php echo __('terms'); ?></a></li>
|
||||
<li><a href="/help.php" class="text-muted text-decoration-none"><?php echo __('help'); ?></a></li>
|
||||
<li><a href="/legal.php" class="text-muted text-decoration-none"><?php echo __('privacy'); ?></a></li>
|
||||
<li><a href="/about.php" class="text-muted text-decoration-none" data-i18n="about_us"><?php echo __('about_us'); ?></a></li>
|
||||
<li><a href="/news.php" class="text-muted text-decoration-none" data-i18n="news"><?php echo __('news'); ?></a></li>
|
||||
<li><a href="/tos.php" class="text-muted text-decoration-none" data-i18n="terms"><?php echo __('terms'); ?></a></li>
|
||||
<li><a href="/help.php" class="text-muted text-decoration-none" data-i18n="help"><?php echo __('help'); ?></a></li>
|
||||
<li><a href="/legal.php" class="text-muted text-decoration-none" data-i18n="privacy"><?php echo __('privacy'); ?></a></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="col-lg-2 col-md-4">
|
||||
<h6 class="fw-bold mb-3"><?php echo __('footer_product'); ?></h6>
|
||||
<h6 class="fw-bold mb-3" data-i18n="footer_product"><?php echo __('footer_product'); ?></h6>
|
||||
<ul class="list-unstyled small lh-lg">
|
||||
<li><a href="/binary.php" class="text-muted text-decoration-none"><?php echo __('second_contract'); ?></a></li>
|
||||
<li><a href="/trade.php" class="text-muted text-decoration-none"><?php echo __('spot'); ?></a></li>
|
||||
<li><a href="/contract.php" class="text-muted text-decoration-none"><?php echo __('contract'); ?></a></li>
|
||||
<li><a href="/swap.php" class="text-muted text-decoration-none"><?php echo __('swap'); ?></a></li>
|
||||
<li><a href="/mining.php" class="text-muted text-decoration-none"><?php echo __('mining'); ?></a></li>
|
||||
<li><a href="/binary.php" class="text-muted text-decoration-none" data-i18n="second_contract"><?php echo __('second_contract'); ?></a></li>
|
||||
<li><a href="/trade.php" class="text-muted text-decoration-none" data-i18n="spot"><?php echo __('spot'); ?></a></li>
|
||||
<li><a href="/contract.php" class="text-muted text-decoration-none" data-i18n="contract"><?php echo __('contract'); ?></a></li>
|
||||
<li><a href="/swap.php" class="text-muted text-decoration-none" data-i18n="swap"><?php echo __('swap'); ?></a></li>
|
||||
<li><a href="/mining.php" class="text-muted text-decoration-none" data-i18n="mining"><?php echo __('mining'); ?></a></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="col-lg-2 col-md-4">
|
||||
<h6 class="fw-bold mb-3"><?php echo __('footer_support'); ?></h6>
|
||||
<h6 class="fw-bold mb-3" data-i18n="footer_support"><?php echo __('footer_support'); ?></h6>
|
||||
<ul class="list-unstyled small lh-lg">
|
||||
<li><a href="/support.php" class="text-muted text-decoration-none"><?php echo __('submit_request'); ?></a></li>
|
||||
<li><a href="/api.php" class="text-muted text-decoration-none"><?php echo __('api_doc'); ?></a></li>
|
||||
<li><a href="/fees.php" class="text-muted text-decoration-none"><?php echo __('fee_structure'); ?></a></li>
|
||||
<li><a href="/app.php" class="text-muted text-decoration-none"><?php echo __('app_download'); ?></a></li>
|
||||
<li><a href="/support.php" class="text-muted text-decoration-none" data-i18n="submit_request"><?php echo __('submit_request'); ?></a></li>
|
||||
<li><a href="/api.php" class="text-muted text-decoration-none" data-i18n="api_doc"><?php echo __('api_doc'); ?></a></li>
|
||||
<li><a href="/fees.php" class="text-muted text-decoration-none" data-i18n="fee_structure"><?php echo __('fee_structure'); ?></a></li>
|
||||
<li><a href="/app.php" class="text-muted text-decoration-none" data-i18n="app_download"><?php echo __('app_download'); ?></a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
@ -67,19 +67,19 @@
|
||||
<div class="mobile-nav d-md-none border-top border-secondary bg-surface">
|
||||
<a href="/" class="<?= $_SERVER['PHP_SELF'] == '/index.php' ? 'active' : '' ?>">
|
||||
<i class="bi bi-house-door"></i>
|
||||
<span><?= __('home') ?></span>
|
||||
<span data-i18n="home"><?= __('home') ?></span>
|
||||
</a>
|
||||
<a href="/market.php" class="<?= $_SERVER['PHP_SELF'] == '/market.php' ? 'active' : '' ?>">
|
||||
<i class="bi bi-graph-up"></i>
|
||||
<span><?= __('market_name') ?></span>
|
||||
<span data-i18n="market_name"><?= __('market_name') ?></span>
|
||||
</a>
|
||||
<a href="/trade.php" class="<?= in_array($_SERVER['PHP_SELF'], ['/trade.php', '/contract.php', '/binary.php']) ? 'active' : '' ?>">
|
||||
<i class="bi bi-arrow-left-right"></i>
|
||||
<span><?= __('trading') ?></span>
|
||||
<span data-i18n="trading"><?= __('trading') ?></span>
|
||||
</a>
|
||||
<a href="<?= isset($_SESSION['user_id']) ? '/profile.php' : '/auth/login.php' ?>" class="<?= $_SERVER['PHP_SELF'] == '/profile.php' ? 'active' : '' ?>">
|
||||
<i class="bi bi-wallet2"></i>
|
||||
<span><?= __('assets') ?></span>
|
||||
<span data-i18n="assets"><?= __('assets') ?></span>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
@ -312,6 +312,8 @@ function appendMessageHTML(m) {
|
||||
}
|
||||
if (!displayMsg.includes('chat-img-preview')) displayMsg = displayMsg.replace('<img ', '<img class="chat-img-preview" ');
|
||||
if (displayMsg.includes('src="assets/')) displayMsg = displayMsg.replace('src="assets/', 'src="' + (window.REL_PATH || '') + 'assets/');
|
||||
} else {
|
||||
displayMsg = window.__(text);
|
||||
}
|
||||
let dateObj = time.includes('-') ? new Date(time.replace(/-/g, "/")) : new Date(time);
|
||||
const timeStr = isNaN(dateObj.getTime()) ? '---' : dateObj.toLocaleTimeString('zh-CN', {hour: '2-digit', minute:'2-digit', second: '2-digit'});
|
||||
|
||||
@ -38,6 +38,53 @@ if (isset($_SESSION['user_id'])) {
|
||||
<link href="https://fonts.googleapis.com/css2?family=Noto+Sans+SC:wght@400;500;700;900&family=Inter:wght@400;500;600;700&display=swap" rel="stylesheet">
|
||||
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
|
||||
<script>
|
||||
window.all_translations = <?= json_encode($translations) ?>;
|
||||
window.current_lang = '<?= $lang ?>';
|
||||
window.translations = window.all_translations[window.current_lang] || window.all_translations['en'];
|
||||
window.zh_translations = window.all_translations['zh'];
|
||||
|
||||
window.__ = function(key) {
|
||||
if (!key && key !== 0 && key !== '0') return '';
|
||||
key = String(key);
|
||||
// Check if key is Chinese, try to find mapping
|
||||
if (/[\u4e00-\u9fa5]/.test(key)) {
|
||||
for (const [k, v] of Object.entries(window.zh_translations)) {
|
||||
if (v === key) return window.translations[k] || key;
|
||||
}
|
||||
}
|
||||
return window.translations[key] || key;
|
||||
};
|
||||
|
||||
window.updateUI = function() {
|
||||
window.translations = window.all_translations[window.current_lang] || window.all_translations['en'];
|
||||
document.querySelectorAll('[data-i18n]').forEach(el => {
|
||||
const key = el.getAttribute('data-i18n');
|
||||
if (window.translations[key]) {
|
||||
if (el.tagName === 'INPUT' && (el.type === 'text' || el.type === 'password' || el.type === 'number')) {
|
||||
el.placeholder = window.translations[key];
|
||||
} else {
|
||||
el.innerHTML = window.translations[key];
|
||||
}
|
||||
}
|
||||
});
|
||||
// Update currency names (ensure they stay as OKX style)
|
||||
document.querySelectorAll('[data-coin]').forEach(el => {
|
||||
// Currency abbreviations are NOT translated as per requirement Step 7
|
||||
});
|
||||
};
|
||||
|
||||
window.switchLang = function(code) {
|
||||
window.current_lang = code;
|
||||
window.updateUI();
|
||||
// Update session on server
|
||||
fetch((window.REL_PATH || '') + 'includes/lang_switch.php?lang=' + code)
|
||||
.then(() => {
|
||||
// We can reload to be 100% sure everything (including server-rendered parts) is correct
|
||||
// but the UI already updated for marked elements.
|
||||
location.reload();
|
||||
});
|
||||
};
|
||||
|
||||
window.notify = function(type, title, text) {
|
||||
Swal.fire({
|
||||
icon: type,
|
||||
@ -48,6 +95,29 @@ if (isset($_SESSION['user_id'])) {
|
||||
showConfirmButton: false
|
||||
});
|
||||
};
|
||||
|
||||
// Auto-translate Swal.fire
|
||||
const originalSwalFire = Swal.fire;
|
||||
Swal.fire = function(options) {
|
||||
if (typeof options === 'string') {
|
||||
return originalSwalFire.call(this, window.__(options));
|
||||
}
|
||||
if (typeof options === 'object') {
|
||||
if (options.title) options.title = window.__(options.title);
|
||||
if (options.text) options.text = window.__(options.text);
|
||||
if (options.html && typeof options.html === 'string' && !options.html.includes('<')) {
|
||||
options.html = window.__(options.html);
|
||||
}
|
||||
if (options.confirmButtonText) options.confirmButtonText = window.__(options.confirmButtonText);
|
||||
if (options.cancelButtonText) options.cancelButtonText = window.__(options.cancelButtonText);
|
||||
}
|
||||
return originalSwalFire.apply(this, arguments);
|
||||
};
|
||||
|
||||
const originalAlert = window.alert;
|
||||
window.alert = function(msg) {
|
||||
if (msg) return originalAlert(window.__(msg));
|
||||
};
|
||||
window.APP_ROOT = '<?= (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? "https" : "http") . "://$_SERVER[HTTP_HOST]" ?>';
|
||||
// In case of subdirectory deployment, we can try to guess or let the user define it.
|
||||
// For now, let's assume relative to root is safer if we use a leading slash
|
||||
@ -442,27 +512,24 @@ if (isset($_SESSION['user_id'])) {
|
||||
<span class="logo-text"><?= $site_name ?></span>
|
||||
</a>
|
||||
<nav>
|
||||
<a href="/"><?= __('home') ?></a>
|
||||
<a href="/market.php"><?= __('market') ?></a>
|
||||
<a href="/binary.php"><?= __('second_contract') ?></a>
|
||||
<a href="/trade.php"><?= __('spot') ?></a>
|
||||
<a href="/contract.php"><?= __('contract') ?></a>
|
||||
<a href="/mining.php"><?= __('mining') ?></a>
|
||||
<a href="/swap.php"><?= __('swap') ?></a>
|
||||
<a href="/app.php"><?= __('app_download') ?></a>
|
||||
<a href="/" data-i18n="home"><?= __('home') ?></a>
|
||||
<a href="/market.php" data-i18n="market"><?= __('market') ?></a>
|
||||
<a href="/binary.php" data-i18n="second_contract"><?= __('second_contract') ?></a>
|
||||
<a href="/trade.php" data-i18n="spot"><?= __('spot') ?></a>
|
||||
<a href="/contract.php" data-i18n="contract"><?= __('contract') ?></a>
|
||||
<a href="/mining.php" data-i18n="mining"><?= __('mining') ?></a>
|
||||
<a href="/swap.php" data-i18n="swap"><?= __('swap') ?></a>
|
||||
<a href="/app.php" data-i18n="app_download"><?= __('app_download') ?></a>
|
||||
</nav>
|
||||
<div class="header-right">
|
||||
<div class="lang-switcher">
|
||||
<img src="https://flagcdn.com/w40/<?= $supported_langs[$lang]['flag'] ?>.png" class="flag-icon" alt="<?= $lang ?>">
|
||||
<span><?= $supported_langs[$lang]['name'] ?></span>
|
||||
<span data-i18n="<?= $lang === 'zh' ? 'chinese' : 'english' ?>"><?= $supported_langs[$lang]['name'] ?></span>
|
||||
<div class="lang-dropdown">
|
||||
<?php
|
||||
foreach ($supported_langs as $code => $info):
|
||||
$queryParams = $_GET;
|
||||
$queryParams['lang'] = $code;
|
||||
$newUrl = $_SERVER['PHP_SELF'] . '?' . http_build_query($queryParams);
|
||||
?>
|
||||
<a href="<?= $newUrl ?>">
|
||||
<a href="javascript:void(0)" onclick="switchLang('<?= $code ?>')">
|
||||
<img src="https://flagcdn.com/w40/<?= $info['flag'] ?>.png" class="flag-icon" alt="<?= $code ?>">
|
||||
<?= $info['name'] ?>
|
||||
</a>
|
||||
@ -505,10 +572,10 @@ if (isset($_SESSION['user_id'])) {
|
||||
</div>
|
||||
</div>
|
||||
<div class="dropdown-links">
|
||||
<a href="/profile.php"><i class="bi bi-person"></i> <?= __('personal') ?></a>
|
||||
<a href="/recharge.php"><i class="bi bi-wallet2"></i> <?= __('recharge') ?></a>
|
||||
<a href="/withdraw.php"><i class="bi bi-cash-stack"></i> <?= __('withdraw') ?></a>
|
||||
<a href="/orders.php"><i class="bi bi-list-check"></i> <?= __('orders') ?></a>
|
||||
<a href="/profile.php"><i class="bi bi-person"></i> <span data-i18n="personal"><?= __('personal') ?></span></a>
|
||||
<a href="/recharge.php"><i class="bi bi-wallet2"></i> <span data-i18n="recharge"><?= __('recharge') ?></span></a>
|
||||
<a href="/withdraw.php"><i class="bi bi-cash-stack"></i> <span data-i18n="withdraw"><?= __('withdraw') ?></span></a>
|
||||
<a href="/orders.php"><i class="bi bi-list-check"></i> <span data-i18n="orders"><?= __('orders') ?></span></a>
|
||||
</div>
|
||||
<a href="/auth/logout.php" class="logout-link"><?= __('logout') ?></a>
|
||||
</div>
|
||||
|
||||
@ -14,8 +14,15 @@ $supported_langs = [
|
||||
'vi' => ['name' => 'Tiếng Việt', 'flag' => 'vn']
|
||||
];
|
||||
|
||||
$lang = $_SESSION['lang'] ?? 'en';
|
||||
if (isset($_GET['lang']) && array_key_exists($_GET['lang'], $supported_langs)) {
|
||||
$lang = 'en';
|
||||
if (isset($_SESSION['lang']) && array_key_exists($_SESSION['lang'], $supported_langs)) {
|
||||
$lang = $_SESSION['lang'];
|
||||
}
|
||||
|
||||
// Check if we are in admin area - Force Chinese and prevent switching
|
||||
if (strpos($_SERVER['REQUEST_URI'], '/admin/') !== false) {
|
||||
$lang = 'zh';
|
||||
} elseif (isset($_GET['lang']) && array_key_exists($_GET['lang'], $supported_langs)) {
|
||||
$lang = $_GET['lang'];
|
||||
$_SESSION['lang'] = $lang;
|
||||
}
|
||||
@ -72,12 +79,38 @@ $translations = [
|
||||
'buy_price' => '买入价', 'sell_price' => '卖出价', 'long' => '做多', 'short' => '做空', 'close' => '平仓',
|
||||
'settling' => '结算中...', 'amount_limit_error' => '金额超出限制 (%min% - %max%)', 'settlement_price' => '结算价',
|
||||
'warning' => '警告', 'high' => '最高', 'low' => '最低', 'chinese' => '简体中文', 'english' => 'English',
|
||||
'qr_code' => '二维码', 'bitcoin' => '比特币', 'ethereum' => '以太坊', 'tether' => '泰达币', 'binance_coin' => '币安币',
|
||||
'solana' => '索拉纳', 'ripple' => '瑞波币', 'cardano' => '艾达币', 'dogecoin' => '狗狗币', 'polkadot' => '波卡币',
|
||||
'polygon' => '马蹄币', 'avalanche' => '雪崩币', 'chainlink' => '链克', 'shiba_inu' => '柴犬币', 'tron' => '波场',
|
||||
'bitcoin_cash' => '比特现金', 'litecoin' => '莱特币', 'uniswap' => '独角兽', 'site_title' => '全球领先的数字资产交易平台',
|
||||
'unverified' => '未认证', 0 => '审核中', 'verified' => '已认证', 'real_name' => '实名认证', 'credit_score' => '信用分',
|
||||
'last_price' => '最新价', 'change_24h' => '24小时涨跌', 'vol_24h' => '24小时成交额', 'welcome_back' => '欢迎回来',
|
||||
'qr_code' => '二维码', 'bitcoin' => 'BTC', 'ethereum' => 'ETH', 'tether' => 'USDT', 'binance_coin' => 'BNB',
|
||||
'solana' => 'SOL', 'ripple' => 'XRP', 'cardano' => 'ADA', 'dogecoin' => 'DOGE', 'polkadot' => 'DOT',
|
||||
'polygon' => 'MATIC', 'avalanche' => 'AVAX', 'chainlink' => 'LINK', 'shiba_inu' => 'SHIB', 'tron' => 'TRX',
|
||||
'bitcoin_cash' => 'BCH', 'litecoin' => 'LTC', 'uniswap' => 'UNI', 'site_title' => '全球领先的数字资产交易平台',
|
||||
'unverified' => '未认证', 0 => '审核中', 1 => '已完成', 2 => '已拒绝', 3 => '已成交', 4 => '已取消',
|
||||
'verified' => '已认证', 'real_name' => '实名认证', 'credit_score' => '信用分',
|
||||
'op_success' => '操作成功', 'insufficient_balance' => '余额不足', 'please_login' => '请先登录',
|
||||
'unauthorized' => '未授权访问', 'account_frozen' => '账户已冻结', 'invalid_amount' => '无效金额',
|
||||
'order_success' => '下单成功', 'order_failed' => '下单失败', 'running' => '进行中',
|
||||
'audit_failed' => '审核未通过', 'recharge_rejected' => '充值被拒绝', 'rejected_desc' => '您的充值申请已被系统拒绝。可能是因为凭证不清晰或金额不匹配。',
|
||||
'matching_account' => '正在匹配账户', 'order_generated' => '订单已生成', 'recharge_submitted_desc' => '您的充值申请已提交,系统正在为您匹配专属的收款账户。',
|
||||
'est_matching_time' => '预计匹配时间', 'current_status' => '当前状态', 'getting_details' => '获取详情中',
|
||||
'matching_success' => '匹配成功', 'exclusive_matched' => '专属账户已匹配', 'matched_desc' => '系统已为您分配专属收款账户,请在规定时间内完成转账。',
|
||||
'payment_time_remaining' => '支付剩余时间', 'waiting_details' => '等待详情', 'account_received' => '已收到账户',
|
||||
'transfer_instructions' => '转账说明', 'bank' => '银行/平台', 'operating_instructions' => '操作指南',
|
||||
'note_intro' => '请按照以下步骤操作以确保资金安全:', 'do_not_modify_note' => '请勿修改转账备注', 'save_voucher' => '请保留转账凭证',
|
||||
'note_footer' => '转账完成后,请务必点击下方的“我已付款”按钮。', 'awaiting_review' => '等待审核',
|
||||
'submitted_awaiting' => '已提交,等待审核', 'awaiting_desc' => '您的转账申请已收到,财务人员正在核实中,请耐心等待。',
|
||||
'save_screenshot' => '请保存此页面的截图', 'contact_cs' => '如有疑问请联系客服', 'confirm_back' => '确认返回',
|
||||
'use_real_name' => '请使用实名账户转账', 'amount_match' => '转账金额必须与申请金额完全一致', 'do_not_close' => '匹配过程中请勿关闭此页面',
|
||||
'order_info_lost' => '订单信息丢失,请刷新页面',
|
||||
'waiting_allocation' => '等待分配中', 'recharge_success_title' => '充值成功', 'recharge_success_text' => '您的充值已到账',
|
||||
'hosting' => '托管中', 'today_profit' => '今日收益', 'total_profit' => '累计收益', 'order_count' => '订单数',
|
||||
'btc_mining_pool' => 'BTC 矿池', 'eth_mining_pool' => 'ETH 矿池', 'usdt_mining_pool' => 'USDT 矿池',
|
||||
'bnb_mining_pool' => 'BNB 矿池', 'sol_mining_pool' => 'SOL 矿池', 'avax_mining_pool' => 'AVAX 矿池',
|
||||
'hot' => '热门', 'start_mining' => '开始挖矿', 'final_price_settlement' => '最终以结算时价格为准', 'my_mining_orders' => '我的挖矿订单',
|
||||
'pool_name' => '矿池名称', 'success' => '成功', 'request_failed' => '请求失败', 'invalid_action' => '无效操作',
|
||||
'visitor' => '访客', 'img_msg' => '[图片消息]', 'recharge_apply' => '[充值申请]', 'new_session' => '新会话',
|
||||
'order_not_found' => '订单不存在', 'duplicate_operation' => '请勿重复操作', 'order_reviewed' => '订单已审核通过',
|
||||
'no_pending_order' => '未找到该用户的待处理充值订单',
|
||||
'last_price' => '最新价',
|
||||
'change_24h' => '24小时涨跌', 'vol_24h' => '24小时成交额', 'welcome_back' => '欢迎回来',
|
||||
'forgot_password' => '忘记密码?', 'no_account' => '没有账号?', 'invalid_account_pwd' => '账号或密码错误',
|
||||
'account' => '账号 / 邮箱', 'password' => '密码', 'mobile_number' => '手机号码', 'confirm_password' => '确认密码',
|
||||
'send_code' => '发送验证码', 'email' => '电子邮箱', 'email_placeholder' => '请输入电子邮箱',
|
||||
@ -197,7 +230,32 @@ $translations = [
|
||||
'solana' => 'SOL', 'ripple' => 'XRP', 'cardano' => 'ADA', 'dogecoin' => 'DOGE', 'polkadot' => 'DOT',
|
||||
'polygon' => 'MATIC', 'avalanche' => 'AVAX', 'chainlink' => 'LINK', 'shiba_inu' => 'SHIB', 'tron' => 'TRX',
|
||||
'bitcoin_cash' => 'BCH', 'litecoin' => 'LTC', 'uniswap' => 'UNI', 'site_title' => 'Leading Digital Platform',
|
||||
'unverified' => 'Unverified', 0 => 'Pending', 'verified' => 'Verified', 'real_name' => 'KYC', 'credit_score' => 'Credit',
|
||||
'unverified' => 'Unverified', 0 => 'Pending', 1 => 'Completed', 2 => 'Rejected', 3 => 'Filled', 4 => 'Cancelled',
|
||||
'verified' => 'Verified', 'real_name' => 'KYC', 'credit_score' => 'Credit',
|
||||
'op_success' => 'Success', 'insufficient_balance' => 'Insufficient balance', 'please_login' => 'Please login',
|
||||
'unauthorized' => 'Unauthorized', 'account_frozen' => 'Account frozen', 'invalid_amount' => 'Invalid amount',
|
||||
'order_success' => 'Order success', 'order_failed' => 'Order failed', 'running' => 'Running',
|
||||
'audit_failed' => 'Audit failed', 'recharge_rejected' => 'Recharge rejected', 'rejected_desc' => 'Your recharge has been rejected. Check voucher or amount.',
|
||||
'matching_account' => 'Matching Account', 'order_generated' => 'Order Generated', 'recharge_submitted_desc' => 'Request submitted, matching exclusive account.',
|
||||
'est_matching_time' => 'Est. matching time', 'current_status' => 'Status', 'getting_details' => 'Getting details',
|
||||
'matching_success' => 'Matched', 'exclusive_matched' => 'Exclusive account matched', 'matched_desc' => 'Exclusive account assigned. Please transfer in time.',
|
||||
'payment_time_remaining' => 'Time remaining', 'waiting_details' => 'Waiting for details', 'account_received' => 'Account received',
|
||||
'transfer_instructions' => 'Instructions', 'bank' => 'Bank/Method', 'operating_instructions' => 'Guide',
|
||||
'note_intro' => 'Follow these steps for safety:', 'do_not_modify_note' => 'Do not modify note', 'save_voucher' => 'Save voucher',
|
||||
'note_footer' => 'After transfer, click "I have paid".', 'awaiting_review' => 'Awaiting review',
|
||||
'submitted_awaiting' => 'Submitted, awaiting review', 'awaiting_desc' => 'Received, verifying. Please wait.',
|
||||
'save_screenshot' => 'Save screenshot', 'contact_cs' => 'Contact Support', 'confirm_back' => 'Confirm Back',
|
||||
'use_real_name' => 'Use real name account', 'amount_match' => 'Amount must match exactly', 'do_not_close' => 'Do not close this page',
|
||||
'order_info_lost' => 'Order info lost, please refresh',
|
||||
'waiting_allocation' => 'Waiting allocation', 'recharge_success_title' => 'Success', 'recharge_success_text' => 'Recharge credited',
|
||||
'hosting' => 'Hosting', 'today_profit' => 'Today Profit', 'total_profit' => 'Total Profit', 'order_count' => 'Orders',
|
||||
'btc_mining_pool' => 'BTC Pool', 'eth_mining_pool' => 'ETH Pool', 'usdt_mining_pool' => 'USDT Pool',
|
||||
'bnb_mining_pool' => 'BNB Pool', 'sol_mining_pool' => 'SOL Pool', 'avax_mining_pool' => 'AVAX Pool',
|
||||
'hot' => 'Hot', 'start_mining' => 'Start Mining', 'final_price_settlement' => 'Subject to settlement price', 'my_mining_orders' => 'My Mining Orders',
|
||||
'pool_name' => 'Pool Name', 'success' => 'Success', 'request_failed' => 'Request failed', 'invalid_action' => 'Invalid action',
|
||||
'visitor' => 'Visitor', 'img_msg' => '[Image]', 'recharge_apply' => '[Deposit Request]', 'new_session' => 'New Session',
|
||||
'order_not_found' => 'Order not found', 'duplicate_operation' => 'Duplicate operation', 'order_reviewed' => 'Order reviewed',
|
||||
'no_pending_order' => 'No pending order found',
|
||||
'last_price' => 'Price', 'change_24h' => '24h Change', 'vol_24h' => '24h Volume', 'welcome_back' => 'Welcome',
|
||||
'forgot_password' => 'Forgot?', 'no_account' => 'No account?', 'invalid_account_pwd' => 'Invalid account',
|
||||
'account' => 'Account', 'password' => 'Password', 'mobile_number' => 'Mobile', 'confirm_password' => 'Confirm',
|
||||
@ -313,6 +371,18 @@ foreach(['jp', 'kr', 'de', 'fr', 'es', 'ru', 'tr', 'vi'] as $l) {
|
||||
function __($key) {
|
||||
global $translations, $lang;
|
||||
$fallback = 'en';
|
||||
|
||||
if (empty($key) && $key !== 0 && $key !== '0') return '';
|
||||
|
||||
// If key contains Chinese characters, try to map it back to a key
|
||||
if (is_string($key) && preg_match("/[\x{4e00}-\x{9fa5}]+/u", $key)) {
|
||||
foreach ($translations['zh'] as $k => $v) {
|
||||
if ($v === $key) {
|
||||
return $translations[$lang][$k] ?? ($translations['en'][$k] ?? $key);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $translations[$lang][$key] ?? ($translations[$fallback][$key] ?? $key);
|
||||
}
|
||||
|
||||
|
||||
8
includes/lang_switch.php
Normal file
8
includes/lang_switch.php
Normal file
@ -0,0 +1,8 @@
|
||||
<?php
|
||||
session_start();
|
||||
$lang = $_GET['lang'] ?? 'en';
|
||||
$supported = ['en', 'zh', 'jp', 'kr', 'de', 'fr', 'es', 'ru', 'tr', 'vi'];
|
||||
if (in_array($lang, $supported)) {
|
||||
$_SESSION['lang'] = $lang;
|
||||
}
|
||||
echo json_encode(['success' => true]);
|
||||
@ -12,25 +12,26 @@ if ($user) {
|
||||
// Settle first
|
||||
settleMining($user['id']);
|
||||
|
||||
// 托管中
|
||||
// Staking amount
|
||||
$stmt = db()->prepare("SELECT SUM(amount) FROM staking_records WHERE user_id = ? AND status = 'running'");
|
||||
$stmt->execute([$user['id']]);
|
||||
$stakingAmount = $stmt->fetchColumn() ?: 0;
|
||||
|
||||
// 今日收益
|
||||
// Today profit
|
||||
$stmt = db()->prepare("SELECT SUM(amount) FROM transactions WHERE user_id = ? AND type = 'mining_profit' AND DATE(created_at) = CURDATE()");
|
||||
$stmt->execute([$user['id']]);
|
||||
$todayProfit = $stmt->fetchColumn() ?: 0;
|
||||
|
||||
// 累计收益
|
||||
// Total profit
|
||||
$stmt = db()->prepare("SELECT SUM(total_profit) FROM staking_records WHERE user_id = ?");
|
||||
$stmt->execute([$user['id']]);
|
||||
$totalProfit = $stmt->fetchColumn() ?: 0;
|
||||
|
||||
// 订单数
|
||||
// Order count
|
||||
$stmt = db()->prepare("SELECT COUNT(*) FROM staking_records WHERE user_id = ?");
|
||||
$stmt->execute([$user['id']]);
|
||||
$orderCount = $stmt->fetchColumn() ?: 0;
|
||||
|
||||
}
|
||||
?>
|
||||
<main class="container py-5">
|
||||
|
||||
@ -519,7 +519,7 @@ function finishTransfer() {
|
||||
}
|
||||
});
|
||||
} else {
|
||||
notify('warning', '订单信息丢失,请刷新页面');
|
||||
notify('warning', '<?= __("order_info_lost") ?>');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user