Permalink
Browse files

A bunch of changes to allow translation via gettext. Not finished yet.

  • Loading branch information...
1 parent 38b71ec commit 075131dfe0c1ced40ae5b348160cce8a150f576d @dooglus committed Sep 11, 2011
Showing with 233 additions and 163 deletions.
  1. +8 −4 404.php
  2. +12 −11 add_cash.php
  3. +13 −11 commission.php
  4. +1 −1 db.php
  5. +56 −39 deposit.php
  6. +1 −1 errors.php
  7. +15 −15 footer.php
  8. +9 −10 freeze.php
  9. +3 −3 header.php
  10. +25 −0 htdocs/config.php
  11. +26 −16 login.php
  12. +64 −52 util.php
View
12 404.php
@@ -1,10 +1,14 @@
<div class='content_box'>
- <h3>Page Not Found</h3>
-
+ <h3><?php echo _("Page Not Found"); ?></h3>
<p>
- Sorry, but <a href="<?php echo getenv("REQUEST_URI") ?>">that page</a> no longer exists.
+<?php printf(_("Sorry, but %sthat page%s no longer exists."),
+ sprintf('<a href="%s">', getenv("REQUEST_URI")),
+ "</a>"); ?>
</p>
<p>
- <center><img width='300' src="/images/tumblbeasts/tb_sign1.png" /><br/><small>thanks to <a target="_blank" href="http://TheOatmeal.com/">Matthew Inman</a> for the image</small></center>
+ <center><img width='300' src="/images/tumblbeasts/tb_sign1.png" /><br/><small>
+<?php printf(_("thanks to %sMatthew Inman%s for the image"),
+ '<a target="_blank" href="http://TheOatmeal.com/">',
+ "</a>"); ?></small></center>
</p>
</div>
View
23 add_cash.php
@@ -31,8 +31,8 @@ function show_similar_codes($reference)
if ($score >= 50) {
if ($first) {
$first = false;
- echo "<p>Did you mean one of these? Higher percentage = closer match.</p>\n";
- echo "<p>Click an entry to copy it to the form below, then click 'Deposit' again.</p>\n";
+ echo "<p>" . _("Did you mean one of these? Higher percentage = closer match.") . "</p>\n";
+ echo "<p>" . _("Click an entry to copy it to the form below, then click 'Deposit' again.") . "</p>\n";
echo "<table class='display_data'>\n";
}
echo "<tr",
@@ -56,7 +56,7 @@ function show_similar_codes($reference)
}
echo "<div class='content_box'>\n";
-echo "<h3>Deposit cash</h3>\n";
+echo "<h3>" . _("Deposit cash") . "</h3>\n";
if (!$is_admin) throw new Error("GTFO", "How did you get here?");
@@ -78,15 +78,16 @@ function show_similar_codes($reference)
VALUES ('DEPOS', '" . CURRENCY . "', $user, $amount_internal)
";
do_query($query);
- echo "<p><span style='font-weight: bold;'>added request to deposit $amount " . CURRENCY .
- " to user $user's purse (reference $reference)</span></p>\n";
- echo "<p>deposit should show up in their account <string>in a minute or two</strong></p>\n";
- echo "<p>make another deposit?</p>\n";
+ printf("<p><span style='font-weight: bold;'>" . _("added request to deposit %s to user %s's purse (reference %s)") . "</span></p>\n",
+ ($amount . " " . CURRENCY), $user, $reference);
+ echo "<p>" . _("deposit should show up in their account") . " <string>" . _("in a minute or two") . "</strong></p>\n";
+ echo "<p>" . _("make another deposit?") . "</p>\n";
$amount= $reference = '';
} else {
- echo "<p>'$reference' isn't a valid reference code\n";
+ printf("<p>" . _("'%s' isn't a valid reference code") . "</p>\n",
+ $reference);
show_similar_codes($reference);
- echo "<p>try again?</p>\n";
+ echo "<p>" . _("try again?") . "</p>\n";
}
} else
$amount = $reference = '';
@@ -95,10 +96,10 @@ function show_similar_codes($reference)
<input type='hidden' name='csrf_token' value="<?php echo $_SESSION['csrf_token']; ?>" />
<input type='hidden' name='deposit_cash' value='true' />
- <label for='reference'>Reference</label>
+ <label for='reference'><?php echo _("Reference"); ?></label>
<input id='reference' type='text' name='reference' value='<?php echo $reference; ?>'/>
- <label for='amount'>Amount</label>
+ <label for='amount'><?php echo _("Amount"); ?></label>
<input id='amount' type='text' name='amount' value='<?php echo $amount; ?>' />
<input type='submit' value='Deposit' />
View
24 commission.php
@@ -14,7 +14,7 @@ function active_table_cell($uid, $txid, $orderid, $sub, $amount, $precision)
echo "</div>\n";
echo "<div class='content_box'>\n";
-echo "<h3>Commission</h3>\n";
+echo "<h3>" . _("Commission") . "</h3>\n";
$query = "
SELECT txid,
@@ -50,12 +50,12 @@ function active_table_cell($uid, $txid, $orderid, $sub, $amount, $precision)
echo "<th style='text-align: center;' colspan=2>BTC</th>";
echo "</tr>";
echo "<tr>";
- echo "<th>TID</th>";
- echo "<th>Got</th>";
- echo "<th>Fee</th>";
- echo "<th>Got</th>";
- echo "<th>Fee</th>";
- echo "<th>Date</th>";
+ echo "<th>" . _("TID") . "</th>";
+ echo "<th>" . _("Got") . "</th>";
+ echo "<th>" . _("Fee") . "</th>";
+ echo "<th>" . _("Got") . "</th>";
+ echo "<th>" . _("Fee") . "</th>";
+ echo "<th>" . _("Date") . "</th>";
echo "</tr>";
}
@@ -111,10 +111,12 @@ function active_table_cell($uid, $txid, $orderid, $sub, $amount, $precision)
}
$commissions = fetch_balances('1');
-echo "<p>In the commission purse, there is ",
- internal_to_numstr($commissions[CURRENCY], FIAT_PRECISION), " " . CURRENCY . " and ",
- internal_to_numstr($commissions['BTC'], BTC_PRECISION), " BTC.\n";
-echo "Hopefully that matches with the totals shown above.</p>\n";
+printf("<p>" . _("In the commission purse, there is %s %s and %s %s.") . "\n",
+ internal_to_numstr($commissions[CURRENCY], FIAT_PRECISION),
+ CURRENCY,
+ internal_to_numstr($commissions['BTC'], BTC_PRECISION),
+ "BTC");
+echo _("Hopefully that matches with the totals shown above.") . "</p>\n";
?>
<script type="text/javascript">
var tx = [];
View
2 db.php
@@ -12,7 +12,7 @@ function do_query($query)
// echo "query: $query<br/>\n";
$result = mysql_query($query);
if (!$result)
- throw new Error("MySQL Error", mysql_error());
+ throw new Error(_("MySQL Error"), mysql_error());
return $result;
}
function has_results($result)
View
95 deposit.php
@@ -21,7 +21,7 @@ function show_deposit_voucher_form($code = '')
{ ?>
<p>
<form action='' class='indent_form' method='post'>
- <label for='input_code'>Voucher</label>
+ <label for='input_code'><?php echo _("Voucher"); ?></label>
<input type='text' onClick='select();' autocomplete='off' id='input_code' name='code' value='<?php echo $code; ?>' />
<input type='hidden' name='csrf_token' value="<?php echo $_SESSION['csrf_token']; ?>" />
<input type='submit' value='Submit' />
@@ -32,16 +32,16 @@ function show_deposit_voucher_form($code = '')
if (isset($_POST['code'])) {
echo "<div class='content_box'>\n";
- echo "<h3>Deposit Voucher</h3>\n";
+ echo "<h3>" . _("Deposit Voucher") . "</h3>\n";
$code = post('code', '-');
try {
redeem_voucher($code, $is_logged_in);
- echo "<p>got any more?</p>\n";
+ echo "<p>" . _("got any more?") . "</p>\n";
show_deposit_voucher_form($code);
} catch (Exception $e) {
$message = $e->getMessage();
- echo "<p>error: $message</p>\n";
- echo "<p>try again?</p>\n";
+ echo "<p>" . _("error") . ": $message</p>\n";
+ echo "<p>" . _("try again?") . "</p>\n";
show_deposit_voucher_form($code);
}
echo "</div>\n";
@@ -67,68 +67,85 @@ function show_deposit_voucher_form($code = '')
?>
<div class='content_box'>
- <h3>Deposit Voucher</h3>
- <p>It's possible to withdraw BTC or <?php echo CURRENCY; ?> as 'vouchers' on the
+ <h3><?php echo _("Deposit Voucher"); ?></h3>
+ <p><?php printf(
+ _("It's possible to withdraw BTC or %s as 'vouchers' on the
withdraw page. These vouchers can be given to other exchange
- users and redeemed here.
+ users and redeemed here."), CURRENCY); ?>
</p>
- <p>
- If you have received a voucher for this exchange, please
- copy/paste the voucher code into the box below to redeem it.
+ <p><?php printf(
+ _("If you have received a voucher for this exchange, please
+ copy/paste the voucher code into the box below to redeem it.")); ?>
</p>
- <p>
- We also accept MTGOX-<?php echo CURRENCY; ?>-... vouchers for instant transfers
- of <?php echo CURRENCY; ?> from MtGox to this exchange.
+ <p><?php printf(
+ _("We also accept MTGOX-%s-... vouchers for instant transfers
+ of %s from MtGox to this exchange."), CURRENCY, CURRENCY); ?>
</p>
<?php show_deposit_voucher_form(); ?>
</div>
<div class='content_box'>
- <h3>Deposit <?php echo CURRENCY; ?></h3>
- <p><b>Depositing is free by bank deposit (EFT). You are responsible for paying any incurred fees. If your deposit is insufficient to cover bank fees then it will be denied.</b></p>
- <p>You will need to quote <?php echo $deposref; ?> in the transaction's reference field.</p>
+ <h3><?php echo _("Deposit") . " " . CURRENCY; ?></h3>
+ <p><b><?php echo _("Depositing is free by bank deposit (EFT). You are responsible for paying any incurred fees. If your deposit is insufficient to cover bank fees then it will be denied."); ?></b></p>
+ <p><?php printf(_("You will need to quote <strong>%s</strong> in the transaction's reference field."), $deposref); ?></p>
<table class='display_data'>
<tr>
- <td>Account title:</td>
- <td>High Net Worth Property PTY LTD</td>
+ <td><?php echo _("Account title") . ":"; ?></td>
+ <td><?php echo DEPOSIT_BANK_ACCOUNT_TITLE; ?></td>
</tr>
<tr>
- <td>Bank:</td>
- <td>ANZ</td>
+ <td><?php echo _("Bank") . ":"; ?></td>
+ <td><?php echo DEPOSIT_BANK_NAME; ?></td>
</tr>
<tr>
- <td>Account number:</td>
- <td>2034-65422</td>
+ <td><?php echo _("Account number") . ":"; ?></td>
+ <td><?php echo DEPOSIT_BANK_ACCOUNT_NUMBER; ?></td>
</tr>
<tr>
- <td>BSB:</td>
- <td>014-506</td>
+ <td><?php echo _("BSB") . ":"; ?></td>
+ <td><?php echo DEPOSIT_BANK_BRANCH_ID; ?></td>
</tr>
<tr>
- <td>Reference:</td>
+ <td><?php echo _("Reference") . ":"; ?></td>
<td><?php echo $deposref; ?></td>
</tr>
</table>
- <p>Allow 3-5 working days for payments to pass through clearing.</p>
- <p><b>Online Banking select your bank below to login.</b></p>
- <p><a href="https://www.my.commbank.com.au/netbank/Logon/Logon.aspx" target="_blank" >CBA</a> - <a href="https://www.anz.com/INETBANK/bankmain.asp" target="_blank" >ANZ</a> -
- <a href="https://online.westpac.com.au/esis/Login/SrvPage/?h3&app=wol&referrer=http%3A%2F%2Fwww.westpac.com.au%2FHomepageAlternative%2F" target="_blank" >WESTPAC</a> -
- <a href="https://ib.nab.com.au/nabib/index.jsp" target="_blank" >NAB</a> -
- <a href="http://www.google.com.au/" target="_blank" >Other</a></p>
- <br>
+ <p><?php echo _("Allow 3-5 working days for payments to pass through clearing."); ?></p>
+ <p><b><?php echo _("Online Banking select your bank below to login."); ?></b></p>
+ <p>
+ <a target="_blank"
+ href="https://www.my.commbank.com.au/netbank/Logon/Logon.aspx"
+ >CBA</a>
+ -
+ <a target="_blank"
+ href="https://www.anz.com/INETBANK/bankmain.asp"
+ >ANZ</a>
+ -
+ <a target="_blank"
+ href="https://online.westpac.com.au/esis/Login/SrvPage/?h3&app=wol&referrer=http%3A%2F%2Fwww.westpac.com.au%2FHomepageAlternative%2F"
+ >WESTPAC</a>
+ -
+ <a target="_blank"
+ href="https://ib.nab.com.au/nabib/index.jsp"
+ >NAB</a>
+ -
+ <a target="_blank"
+ href="http://www.google.com.au/"
+ >Other</a>
+ </p><br/>
<strong><p>For fast 24Hr clearing visit any ANZ bank to deposit funds.</p></strong>
- <p>(you will be required to use your<strong><a href="?page=profile"> 'User ID'</a></strong> as reference)</p></br>
+ <p>(you will be required to use your<strong><a href="?page=profile"> 'User ID'</a></strong> as reference)</p><br/>
</div>
<div class='content_box'>
- <h3>Deposit BTC</h3>
+ <h3><?php echo _("Deposit"); ?> BTC</h3>
<?php
if ($addy) {
- echo " <p>You can deposit to <b>$addy</b></p>\n";
- echo " <p>The above address is specific to your account. Each time you deposit, a new address will be generated for you.</p>\n";
- echo " <p>It takes ", CONFIRMATIONS_FOR_DEPOSIT, " confirmations before funds are added to your account.</p>\n";
+ echo " <p>" . sprintf(_("You can deposit to %s"), "<b>$addy</b>") . "</p>\n";
+ echo " <p>" . _("The above address is specific to your account. Each time you deposit, a new address will be generated for you.") . "</p>\n";
+ echo " <p>" . sprintf(_("It takes %s confirmations before funds are added to your account."), CONFIRMATIONS_FOR_DEPOSIT) . "</p>\n";
} else
- echo " <p>We are currently experiencing trouble connecting to the Bitcoin network. Please try again in a few minutes.</p>\n";
+ echo " <p>" . _("We are currently experiencing trouble connecting to the Bitcoin network. Please try again in a few minutes.") . "</p>\n";
echo "</div>\n";
}
View
2 errors.php
@@ -94,7 +94,7 @@ function report_exception($e, $severity)
$message = $e->getMessage();
$file = $e->getFile();
$line = $e->getLine();
- report("Exception: $file $line\n==== $title ====\n$message\n================", $severity);
+ report(_("Exception") . ": $file $line\n==== $title ====\n$message\n================", $severity);
}
function reporting_error_handler($errno, $errstr, $errfile, $errline)
View
30 footer.php
@@ -19,21 +19,21 @@ function show_links($is_logged_in, $is_admin)
$show_duo = !$row['use_duo'];
}
- if (!$is_logged_in) show_link('login', 'Login', 'Begin here' );
- show_link ('trade', 'Trade', 'Buy and sell' );
- if ($is_logged_in) show_link('profile', 'Profile', 'Dox on you' );
- if ($is_logged_in) show_link('statement', 'Statement', 'Chronological ledger' );
- if ($is_logged_in) show_link('deposit', 'Deposit', 'Top up your account' );
- if ($is_logged_in) show_link('withdraw', 'Withdraw', 'Take out money' );
- show_link ('orderbook', 'Orderbook', 'Show orders' );
- if ($show_duo) show_link('turn_on_duo', 'Security', 'Use two-factor authentification');
- show_link ('help', 'Help', 'Seek support' );
- if ($is_admin) show_link('users', 'Users', 'Show registered users', 1);
- if ($is_admin) show_link('add_cash', 'Add cash', 'Deposit using bank statement', 1);
- if ($is_admin) show_link('commission', 'Commission', 'Show commission statement', 1);
- if ($is_admin) show_link('bank', 'Bank', 'Show bank statement &amp; pending withdrawals',1);
- if ($is_admin) show_link('freeze', 'Freeze', 'Stop activity on the exchange',1);
- if ($is_logged_in) show_link('logout', 'Logout', 'End this session' );
+ if (!$is_logged_in) show_link('login', _('Login'), _('Begin here') );
+ show_link ('trade', _('Trade'), _('Buy and sell') );
+ if ($is_logged_in) show_link('profile', _('Profile'), _('Dox on you') );
+ if ($is_logged_in) show_link('statement', _('Statement'), _('Chronological ledger') );
+ if ($is_logged_in) show_link('deposit', _('Deposit'), _('Top up your account') );
+ if ($is_logged_in) show_link('withdraw', _('Withdraw'), _('Take out money') );
+ show_link ('orderbook', _('Orderbook'), _('Show orders') );
+ if ($show_duo) show_link('turn_on_duo', _('Security'), _('Use two-factor authentification') );
+ show_link ('help', _('Help'), _('Seek support') );
+ if ($is_admin) show_link('users', _('Users'), _('Show registered users'), 1);
+ if ($is_admin) show_link('add_cash', _('Add cash'), _('Deposit using bank statement'), 1);
+ if ($is_admin) show_link('commission', _('Commission'), _('Show commission statement'), 1);
+ if ($is_admin) show_link('bank', _('Bank'), _('Show bank statement &amp; pending withdrawals'), 1);
+ if ($is_admin) show_link('freeze', _('Freeze'), _('Stop activity on the exchange'), 1);
+ if ($is_logged_in) show_link('logout', _('Logout'), _('End this session') );
}
function show_footer($is_logged_in, $is_admin)
View
19 freeze.php
@@ -11,35 +11,34 @@
}
echo "<div class='content_box'>\n";
-echo "<h3>Freeze!</h3>\n";
+echo "<h3>" . _("Freeze!") . "</h3>\n";
if (isset($_POST['set_freeze'])) {
$state = post('set_freeze');
if ($state == 'freeze') {
set_frozen(true);
- echo "<p>Exchange has been frozen. <a href=".">continue</a></p>\n";
+ echo "<p>" . _("Exchange has been frozen.") . ' <a href=".">' . _("continue") . "</a></p>\n";
} else if ($state == 'unfreeze') {
set_frozen(false);
- echo "<p>Exchange has been unfrozen. <a href=".">continue</a></p>\n";
+ echo "<p>" . _("Exchange has been unfrozen.") . ' <a href=".">' . _("continue") . "</a></p>\n";
} else
throw Error("Unknown state", "State $state should be 'freeze' or 'unfreeze'.");
} else {
$is_frozen = is_frozen();
if ($is_frozen) {
- echo "<p>The exchange is currently frozen.</p>\n";
- echo "<p>Click 'unfreeze' below to resume order matching and withdrawal processing.</p>\n";
+ echo "<p>" . _("The exchange is currently frozen.") . "</p>\n";
+ echo "<p>" . _("Click 'unfreeze' below to resume order matching and withdrawal processing.") . "</p>\n";
} else {
- echo "<p>The exchange isn't currently frozen.</p>\n";
- echo "<p>Click 'freeze' below to freeze order matching and withdrawal processing.</p>\n";
- echo "<p>Users will still be able to place and cancel orders,\n";
- echo "they just won't be matched until after you unfreeze the exchange.</p>\n";
+ echo "<p>" . _("The exchange isn't currently frozen.") . "</p>\n";
+ echo "<p>" . _("Click 'freeze' below to freeze order matching and withdrawal processing.") . "</p>\n";
+ echo "<p>" . _("Users will still be able to place and cancel orders, they just won't be matched until after you unfreeze the exchange.") . "</p>\n";
}
?>
<form action='' class='indent_form' method='post'>
<input type='hidden' name='csrf_token' value="<?php echo $_SESSION['csrf_token']; ?>" />
<input type='hidden' name='set_freeze'' value='<?php echo $is_frozen ? "unfreeze" : "freeze" ?>' />
- <input type='submit' value='<?php echo $is_frozen ? "Unfreeze" : "Freeze" ?>' />
+ <input type='submit' value='<?php echo $is_frozen ? _("Unfreeze") : _("Freeze") ?>' />
</form>
<?php
}
View
6 header.php
@@ -123,7 +123,7 @@ function show_content_header_ticker()
echo " <div class='content_header_box'>\n";
echo " ", SPACE;
echo "buy: $buy_link${spaces}sell: $sell_link";
- echo SPACE, "last: $last", SPACE, "high: $high", SPACE, "low: $low", SPACE, "avg: $vwap\n";
+ echo SPACE, _("last") . ": $last", SPACE, _("high") . ": $high", SPACE, _("low") . ": $low", SPACE, _("avg") . ": $vwap\n";
echo " </div>\n";
}
@@ -142,9 +142,9 @@ function show_content_header_frozen()
{
if (is_frozen()) {
echo " <div class='content_header_box'>\n";
- echo " <span style='color: #fff;'>trading on the exchange is currently frozen; no orders will be matched</span>\n";
+ echo " <span style='color: #fff;'>" . _("trading on the exchange is currently frozen; no orders will be matched") . "</span>\n";
global $is_admin;
- if ($is_admin) echo "&nbsp;&nbsp;&nbsp;&nbsp;<a style='color: red;' href=\"?page=freeze\">unfreeze</a>\n";
+ if ($is_admin) echo "&nbsp;&nbsp;&nbsp;&nbsp;<a style='color: red;' href=\"?page=freeze\">" . _("unfreeze") . "</a>\n";
echo " </div>\n";
}
}
View
25 htdocs/config.php
@@ -27,6 +27,31 @@
define('CURRENCY_FULL', 'Australian Dollar');
define('CURRENCY_FULL_PLURAL', 'Australian Dollars');
+define('CONTACT_EMAIL_ADDRESS', 'support@intersango.com.au');
+define('CONTACT_SKYPE_ADDRESS', 'worldbitcoinexchange');
+define('CONTACT_FACEBOOK_URL', 'http://www.facebook.com/pages/World-Bitcoin-Exchange/227118550652605');
+define('CONTACT_FACEBOOK_NAME', 'worldbitcoinexchange');
+define('CONTACT_TWITTER_NAME', 'worldbitcoinx');
+define('CONTACT_PHONE_NUMBER', '+617 3102-9666');
+define('CONTACT_OFFICE_HOURS', 'Mon-Fri 9am to 5pm');
+define('CONTACT_TIME_ZONE', 'UTC/GMT +10 hours');
+define('CONTACT_ADDRESS_ETC', "<b>High Net Worth Property Pty Ltd</b><br/>
+ Trading As: World Bitcoin Exchange<br/>
+ ACN: 61 131 700 779<br/>
+ Gold Coast<br/>
+ Queensland<br/>
+ Australia<br/>
+ 4208");
+
+// .------------------------------------------------------------------------
+// | bank account details for deposits
+// `------------------------------------------------------------------------
+
+define('DEPOSIT_BANK_ACCOUNT_TITLE', 'High Net Worth Property PTY LTD');
+define('DEPOSIT_BANK_NAME', 'ANZ');
+define('DEPOSIT_BANK_ACCOUNT_NUMBER', '2034-65422');
+define('DEPOSIT_BANK_BRANCH_ID', '014-506');
+
// .------------------------------------------------------------------------
// | local time
// `------------------------------------------------------------------------
View
42 login.php
@@ -46,8 +46,8 @@
show_header('login', $uid);
echo " <div class='content_box'>\n";
- echo " <h3>Successful login!</h3>\n";
- echo " <p>Welcome back commander. Welcome back.</p>\n";
+ echo " <h3>" . _("Successful login!") . "</h3>\n";
+ echo " <p>" . _("Welcome back commander. Welcome back.") . "</p>\n";
}
else {
show_header('login', 0);
@@ -65,8 +65,8 @@
show_header('login', 0);
?>
<div class='content_box'>
-<h3>Login</h3>
-<p>Enter your OpenID login below:</p>
+<h3><?php echo _("Login"); ?></h3>
+<p><?php echo _("Enter your OpenID login below:"); ?></p>
<p>
<form action='' class='indent_form' method='get'>
<input type='hidden' name='csrf_token' value="<?php echo $_SESSION['csrf_token']; ?>" />
@@ -75,13 +75,15 @@
<input type='submit' value='Submit' />
</form>
</p>
-<p>If you do not have an OpenID login then we recommend <a href="https://www.myopenid.com/">MyOpenID</a>.</p>
-<p>Alternatively you may sign in using <a href="?page=login&openid_identifier=https://www.google.com/accounts/o8/id&csrf_token=<?php echo $_SESSION['csrf_token']; ?>">Google</a> or <a href="?page=login&openid_identifier=me.yahoo.com&csrf_token=<?php echo $_SESSION['csrf_token']; ?>">Yahoo</a>.</p>
+<p><?php printf(_("If you do not have an OpenID login then we recommend %s."), "<a href=\"https://www.myopenid.com/\">MyOpenID</a>"); ?></p>
+<p><?php printf(_("Alternatively you may sign in using %s or %s."),
+ "<a href=\"?page=login&openid_identifier=https://www.google.com/accounts/o8/id&csrf_token=" . $_SESSION['csrf_token'] . "\">Google</a>"
+ "<a href=\"?page=login&openid_identifier=me.yahoo.com&csrf_token=" . $_SESSION['csrf_token'] . "\">Yahoo</a>"); ?></p>
<?php
}
else if ($openid->mode == 'cancel') {
show_header('login', 0);
- throw new Problem(":(", "Login was cancelled.");
+ throw new Problem(":(", _("Login was cancelled."));
}
else if ($openid->validate()) {
# protect against session hijacking now we've escalated privilege level
@@ -120,8 +122,8 @@
if (has_results($result)) {
show_header('login', $uid);
echo " <div class='content_box'>\n";
- echo " <h3>Successful login!</h3>\n";
- echo " <p>Welcome back commander. Welcome back.</p>\n";
+ echo " <h3>" . _("Successful login!") . "</h3>\n";
+ echo " <p>" . _("Welcome back commander. Welcome back.") . "</p>\n";
} else {
// generate random str for deposit reference
$query = "
@@ -157,13 +159,19 @@
show_header('login', $uid);
echo " <div class='content_box'>\n";
- echo " <h3>Successful login!</h3>\n";
- echo " <p>Nice to finally see you here, <i>new</i> user.</p>\n";
+ echo " <h3>" . _("Successful login!") . "</h3>\n";
+ echo " <p>" . _("Nice to finally see you here, <i>new</i> user.") . "</p>\n";
if (gmp_cmp($free_fiat, 0) > 0 or gmp_cmp($free_btc, 0))
- echo " <p>We've given you ",
- internal_to_numstr($free_btc), " BTC and ",
- internal_to_numstr($free_fiat), " " . CURRENCY . " to test the exchange with.</p>\n";
- echo " <p>Now you may wish <a href='?page=deposit'>deposit</a> funds before continuing.</p>\n";
+ echo " <p>" .
+ sprintf("We've given you %s and %s to test the exchange with.",
+ internal_to_numstr($free_btc) . " BTC",
+ internal_to_numstr($free_fiat) . " " . CURRENCY) .
+ "</p>\n";
+ echo " <p>" .
+ sprintf("Now you may wish to %sdeposit%s funds before continuing.",
+ '<a href="?page=deposit">'
+ '</a>') .
+ "</p>\n";
}
// store for later
@@ -172,7 +180,9 @@
}
} else {
show_header('login', 0);
- throw new Problem(":(", "Unable to login. Please <a href='?page=login'>try again</a>.");
+ throw new Problem(":(", sprintf(_("Unable to login. Please %stry again%s."),
+ '<a href="?page=login">'
+ '</a>'));
}
}
}
View
116 util.php
@@ -9,25 +9,33 @@ class BASE_CURRENCY
}
function show_contact_info()
-{ ?>
-<h3>Contact info</h3>
-<p>Email: <a href="mailto:support@intersango.com.au">support@Intersango.com.au</a></p>
-<p>Skype: <a href="skype:worldbitcoinexchange?call">worldbitcoinexchange</a></p>
-<p>Facebook: <a target="_blank" href="http://www.facebook.com/pages/World-Bitcoin-Exchange/227118550652605">worldbitcoinexchange</a></p>
-<p>Twitter: <a target="_blank" href="http://twitter.com/worldbitcoinx">@worldbitcoinx</a></p>
-<p>Call +617 3102-9666</p>
-<p>Office Hours Mon-Fri 9am to 5pm</p>
-<p>(Standard time zone: UTC/GMT +10 hours - it is currently <?php require_once "util.php"; echo get_time_text(); ?>)</p>
-<p>
-<b>High Net Worth Property Pty Ltd <br /></b>
-Trading As: World Bitcoin Exchange <br />
-ACN: 61 131 700 779 <br />
-Gold Coast <br />
-Queensland <br />
-Australia <br />
-4208
-</p>
-<?php }
+{
+ echo "<h3>" . _("Contact info") . "</h3>\n";
+ printf("<p>%s: <a href=\"mailto:%s\">%s</a></p>\n",
+ _("Email"),
+ CONTACT_EMAIL_ADDRESS, CONTACT_EMAIL_ADDRESS);
+ printf("<p>%s: <a href=\"skype:%s?call\">%s</a></p>\n",
+ _("Skype"),
+ CONTACT_SKYPE_ADDRESS, CONTACT_SKYPE_ADDRESS);
+ printf("<p>%s: <a target=\"_blank\" href=\"%s\">%s</a></p>\n",
+ _("Facebook"),
+ CONTACT_FACEBOOK_URL, CONTACT_FACEBOOK_NAME);
+ printf("<p>%s: <a target=\"_blank\" href=\"http://twitter.com/%s\">@%s</a></p>\n",
+ _("Twitter"),
+ CONTACT_TWITTER_NAME, CONTACT_TWITTER_NAME);
+ printf("<p>%s: %s</p>\n",
+ _("Call"),
+ CONTACT_PHONE_NUMBER);
+ printf("<p>%s: %s</p> \n",
+ _("Office Hours"),
+ CONTACT_OFFICE_HOURS);
+ printf("<p>(%s: %s - %s %s)</p>\n",
+ _("Standard time zone"),
+ CONTACT_TIME_ZONE,
+ _("it is currently"), get_time_text());
+ printf("<p>%s</p>\n",
+ CONTACT_ADDRESS_ETC);
+}
function freeze_file()
{
@@ -56,7 +64,7 @@ function is_frozen()
function check_frozen()
{
if (is_frozen())
- throw new Error("Frozen", "Trading on the exchange is temporarily frozen");
+ throw new Error(_("Frozen"), _("Trading on the exchange is temporarily frozen"));
}
function sql_format_date($date)
@@ -241,7 +249,7 @@ function get_wait_lock($uid)
$umask = umask(0);
if (!($fp = fopen($lock, "w"))) {
umask($umask);
- throw new Error('Lock Error', "Can't create wait lockfile for $uid");
+ throw new Error(_('Lock Error'), "Can't create wait lockfile for $uid");
}
if (!flock($fp, LOCK_EX|LOCK_NB)) {
@@ -279,7 +287,7 @@ function get_lock($uid, $block)
$umask = umask(0);
if (!($fp = fopen($lock, "w"))) {
umask($umask);
- throw new Error('Lock Error', "Can't create lockfile for $uid");
+ throw new Error(_('Lock Error'), "Can't create lockfile for $uid");
}
$block_flags = LOCK_EX;
@@ -288,7 +296,7 @@ function get_lock($uid, $block)
if ($block == 0) {
if (!flock($fp, $no_block_flags)) {
umask($umask);
- throw new Error('Lock Error', "User $uid is already doing stuff.<br/>");
+ throw new Error(_('Lock Error'), sprintf(_("User %s is already doing stuff."), $uid) . "<br/>");
}
} else if ($block == 2) {
// try to get wait_lock. don't care whether we get it or not, only doing it to tell others who care that we're waiting
@@ -297,7 +305,7 @@ function get_lock($uid, $block)
if ($wait_lock)
release_wait_lock($wait_lock);
umask($umask);
- throw new Error('Lock Error', "Can't get lock for user $uid, even after waiting.<br/>");
+ throw new Error(_('Lock Error'), sprintf(_("Can't get lock for user %s, even after waiting."), $uid) . "<br/>");
}
if ($wait_lock)
release_wait_lock($wait_lock);
@@ -311,12 +319,12 @@ function get_lock($uid, $block)
if (!flock($fp, $block_flags)) {
release_wait_lock($wait_lock);
umask($umask);
- throw new Error('Lock Error', "Can't get lock for user $uid, even after waiting.<br/>");
+ throw new Error(_('Lock Error'), sprintf(_("Can't get lock for user %s, even after waiting."), $uid) . "<br/>");
}
release_wait_lock($wait_lock);
} else {
umask($umask);
- throw new Error('Lock Error', "User $uid is already doing stuff, and also already waiting for lock.<br/>");
+ throw new Error(_('Lock Error'), sprintf(_("User %s is already doing stuff, and also already waiting for lock."), $uid) . "<br/>");
}
}
}
@@ -390,7 +398,7 @@ function sync_to_bitcoin($uid)
$balance = @$bitcoin->getbalance($uid, CONFIRMATIONS_FOR_DEPOSIT);
if (is_float($balance))
- throw new Error("bitcoind version error", "bitcoind getbalance should return an integer not a float");
+ throw new Error(_("bitcoind version error"), _("bitcoind getbalance should return an integer not a float"));
if (gmp_cmp($balance, '0') > 0) {
$bitcoin->move($uid, '', $balance);
@@ -655,15 +663,15 @@ function curr_supported_check($curr_type)
function order_worthwhile_check($amount, $amount_disp, $min_str='0.5')
{
if (!is_numeric($amount_disp))
- throw new Problem('Numbers. Numbers.', 'The value you entered was not a number.');
+ throw new Problem(_('Numbers. Numbers.'), _('The value you entered was not a number.'));
$min = numstr_to_internal($min_str);
if ($amount < $min)
- throw new Problem("Try again...", "Your order size is too small. The minimum is $min_str.");
+ throw new Problem(_("Try again..."), sprintf(_("Your order size is too small. The minimum is %s."), $min_str));
}
function enough_money_check($amount, $curr_type)
{
if (!has_enough($amount, $curr_type))
- throw new Problem("Where's the gold?", "You don't have enough $curr_type.");
+ throw new Problem(sprintf(_("Where's the gold?", "You don't have enough %s."), $curr_type));
}
function translate_order_code($code)
@@ -678,7 +686,7 @@ function translate_order_code($code)
case 'CLOSED':
return 'Completed';
default:
- throw new Error('No such order', 'This order is wrong...');
+ throw new Error(_('No such order'), _('This order is wrong...'));
}
}
@@ -691,7 +699,7 @@ function translate_request_type($type)
case 'DEPOS':
return 'Deposit';
default:
- throw new Error('No such request type', 'This request is wrong...');
+ throw new Error(_('No such request type'), _('This request is wrong...'));
}
}
function translate_request_code($code)
@@ -704,19 +712,19 @@ function translate_request_code($code)
switch ($code)
{
case 'VERIFY':
- return 'Verifying';
+ return _('Verifying');
case 'PROCES':
- return 'Processing';
+ return _('Processing');
case 'FINAL':
- return 'Finished';
+ return _('Finished');
case 'IGNORE':
- return 'Ignored';
+ return _('Ignored');
case 'REJECT':
- return 'Rejected';
+ return _('Rejected');
case 'CANCEL':
- return 'Cancelled';
+ return _('Cancelled');
default:
- throw new Error('No such request', 'This request is wrong...');
+ throw new Error(_('No such request'), _('This request is wrong...'));
}
}
@@ -738,27 +746,27 @@ function show_commission_rates()
$cap = COMMISSION_CAP_IN_BTC;
$rate = COMMISSION_PERCENTAGE_FOR_BTC;
if ($rate == 0)
- echo "<p>buying BTC is free of commission</p>\n";
+ printf("<p>" . _("buying %s is free of commission") . "</p>\n", "BTC");;
else {
echo "<p>$rate%";
if ($cap)
- echo " (capped at $cap BTC)";
+ echo " (" . _("capped at") . " $cap BTC)";
else
- echo " (uncapped)";
- echo " when buying BTC</p>\n";
+ echo " (" . _("uncapped") . ")";
+ echo " " . _("when buying BTC") . "</p>\n";
}
$cap = COMMISSION_CAP_IN_FIAT;
$rate = COMMISSION_PERCENTAGE_FOR_FIAT;
if ($rate == 0)
- echo "<p>buying " . CURRENCY . " is free of commission</p>\n";
+ printf("<p>" . _("buying %s is free of commission") . "</p>\n", CURRENCY);
else {
echo "<p>$rate%";
if ($cap)
- echo " (capped at $cap " . CURRENCY . ")";
+ echo " (" . _("capped at") . " $cap " . CURRENCY . ")";
else
- echo " (uncapped)";
- echo " when selling BTC</p>\n";
+ echo " (" . _("uncapped") . ")";
+ echo " " . _("when selling BTC") . "</p>\n";
}
echo "</blockquote>\n";
@@ -851,10 +859,10 @@ function day_time_range_string()
function minutes_past_midnight_as_time_string($minutes)
{
if ($minutes == 0)
- return "midnight";
+ return _("midnight");
if ($minutes == 12*60)
- return "noon";
+ return _("noon");
return str_replace(' ', '', strftime("%l:%M%P", mktime(0,0,0) + $minutes*60));
}
@@ -916,7 +924,9 @@ function check_fiat_balance_limit($uid, $amount)
{
$balance = total_fiat_balance($uid);
$limit = numstr_to_internal(MAXIMUM_FIAT_BALANCE);
- echo "<p>Maximum balance is ", internal_to_numstr($limit), " " . CURRENCY . " and you have ", internal_to_numstr($balance), " " . CURRENCY . ".</p>\n";
+ printf("<p>" . _("Maximum balance is %s and you have %s") . "</p>\n",
+ internal_to_numstr($limit) . " " . CURRENCY,
+ internal_to_numstr($balance) . " " . CURRENCY);
}
function check_fiat_transfer_limit($uid, $amount)
@@ -926,7 +936,8 @@ function check_fiat_transfer_limit($uid, $amount)
$available = gmp_sub($limit, $withdrawn);
if (gmp_cmp($amount, $available) > 0)
- throw new Problem('Daily limit exceeded', 'You can only transfer '.internal_to_numstr($limit).' ' . CURRENCY . ' per day.');
+ throw new Problem(_('Daily limit exceeded'), sprintf(_('You can only transfer %s per day.'),
+ internal_to_numstr($limit) . ' ' . CURRENCY));
}
function check_btc_withdraw_limit($uid, $amount)
@@ -936,7 +947,8 @@ function check_btc_withdraw_limit($uid, $amount)
$available = gmp_sub($limit, $withdrawn);
if (gmp_cmp($amount, $available) > 0)
- throw new Problem('Daily limit exceeded', 'You can only withdraw '.internal_to_numstr($limit).' BTC per day.');
+ throw new Problem(_('Daily limit exceeded'), sprintf(_('You can only withdraw %s per day.'),
+ internal_to_numstr($limit) . ' BTC'));
}
function check_withdraw_limit($uid, $amount, $curr_type)

0 comments on commit 075131d

Please sign in to comment.