Make scripts translatable

This commit is contained in:
2023-01-22 20:00:49 +01:00
parent 21eb38c393
commit 78ba449fa3
22 changed files with 1652 additions and 418 deletions

View File

@ -10,16 +10,16 @@ use chillerlan\QRCode\QROptions;
header('Content-Type: text/html; charset=UTF-8');
print_header('Upgrade account', 'td{padding:5px;}');
?>
<h1>Hosting - Upgrade account</h1>
<h1><?php echo _('Hosting - Upgrade account'); ?></h1>
<?php
$rates = coinpayments_get_rates();
if($rates === false){
echo '<p>An error occurred talking to coinpayments</p>';
echo '<p>'._('An error occurred talking to coinpayments').'</p>';
}else{
?>
<form action="upgrade.php" method="post">
<table border="1">
<tr><td>Desired upgrade</td><td>
<tr><td><?php echo _('Desired upgrade'); ?></td><td>
<select name="upgrade">
<?php
foreach(ACCOUNT_UPGRADES as $name => $upgrade){
@ -31,7 +31,7 @@ if($rates === false){
}
?>
</td></tr>
<tr><td>Desired payment currency</td><td>
<tr><td><?php echo _('Desired payment currency'); ?></td><td>
<select name="currency">
<?php
$i=0;
@ -42,29 +42,29 @@ if($rates === false){
}
?>
</select></td></tr>
<tr><td colspan="2" style="text-align:center;"><button type="submit">Pay now</button></td></tr>
<tr><td colspan="2" style="text-align:center"><button type="submit"><?php echo _('Pay now'); ?></button></td></tr>
</table>
</form>
<?php
}
if(isset($_POST['currency']) && isset($_POST['upgrade'])){
if(!isset(ACCOUNT_UPGRADES[$_POST['upgrade']])){
echo "<p>Sorry, looks like you didn't select a valid upgrade.</p>";
echo '<p>'._("Sorry, looks like you didn't select a valid upgrade.").'</p>';
}elseif(!isset($rates[$_POST['currency']]) || $rates[$_POST['currency']]['accepted'] !== 1 || !in_array('payments', $rates[$_POST['currency']]['capabilities'])){
echo "<p>Sorry, looks like you didn't select a valid payment currency.</p>";
echo '<p>'._("Sorry, looks like you didn't select a valid payment currency.").'</p>';
}else{
$db = get_db_instance();
$transaction = coinpayments_create_transaction($_POST['currency'], ACCOUNT_UPGRADES[$_POST['upgrade']]['usd_price'], $_POST['upgrade'], $user['id']);
if($transaction === false){
echo "<p>An error occurred creating the transaction, please try again</p>";
echo '<p>'._('An error occurred creating the transaction, please try again').'</p>';
}else{
echo "<p>Please pay $transaction[amount] $_POST[currency] to $transaction[address]</p>";
echo '<img src="'.(new QRCode(new QROptions(['outputType' => QRCode::OUTPUT_IMAGE_PNG, 'eccLevel' => QRCode::ECC_H])))->render($transaction['address']).'" alt="QR Code">';
echo '<p>Once paid, it can take a while until the upgrade is applied to your account. Usually within an hour.</p>';
echo '<p>'.sprintf(_('Please pay %1$s to %2$s'), "$transaction[amount] $_POST[currency]", $transaction['address']).'</p>';
echo '<img src="'.(new QRCode(new QROptions(['outputType' => QRCode::OUTPUT_IMAGE_PNG, 'eccLevel' => QRCode::ECC_H])))->render($transaction['address']).'" alt="'._('QR Code').'">';
echo '<p>'._('Once paid, it can take a while until the upgrade is applied to your account. Usually within an hour.').'</p>';
}
}
}
?>
<p><a href="home.php">Go back to dashboard.</a></p>
<p><a href="home.php"><?php echo _('Go back to dashboard'); ?></a></p>
</body>
</html>