mirror of
https://github.com/getnamingo/registry.git
synced 2025-05-13 08:07:00 +02:00
Fixed #64
This commit is contained in:
parent
66ae0e2d04
commit
fd0909f3ec
8 changed files with 72 additions and 20 deletions
|
@ -6,6 +6,7 @@ use Psr\Http\Message\ResponseInterface as Response;
|
|||
use Psr\Http\Message\ServerRequestInterface as Request;
|
||||
use Psr\Container\ContainerInterface;
|
||||
use Respect\Validation\Validator as v;
|
||||
use League\ISO3166\ISO3166;
|
||||
|
||||
class SystemController extends Controller
|
||||
{
|
||||
|
@ -142,8 +143,19 @@ class SystemController extends Controller
|
|||
'name' => "rdap_server"
|
||||
]
|
||||
);
|
||||
|
||||
$db->update(
|
||||
'settings',
|
||||
[
|
||||
'value' => $data['currency']
|
||||
],
|
||||
[
|
||||
'name' => "currency"
|
||||
]
|
||||
);
|
||||
|
||||
$db->commit();
|
||||
$_SESSION['_currency'] = $data['currency'];
|
||||
} catch (Exception $e) {
|
||||
$db->rollBack();
|
||||
$this->container->get('flash')->addMessage('error', 'Database failure: ' . $e->getMessage());
|
||||
|
@ -154,7 +166,9 @@ class SystemController extends Controller
|
|||
return $response->withHeader('Location', '/registry')->withStatus(302);
|
||||
|
||||
}
|
||||
|
||||
|
||||
$iso3166 = new ISO3166();
|
||||
$countries = $iso3166->all();
|
||||
$db = $this->container->get('db');
|
||||
$company_name = $db->selectValue("SELECT value FROM settings WHERE name = 'company_name'");
|
||||
$vat_number = $db->selectValue("SELECT value FROM settings WHERE name = 'vat_number'");
|
||||
|
@ -166,6 +180,17 @@ class SystemController extends Controller
|
|||
$launch_phases = $db->selectValue("SELECT value FROM settings WHERE name = 'launch_phases'");
|
||||
$whois_server = $db->selectValue("SELECT value FROM settings WHERE name = 'whois_server'");
|
||||
$rdap_server = $db->selectValue("SELECT value FROM settings WHERE name = 'rdap_server'");
|
||||
$currency = $db->selectValue("SELECT value FROM settings WHERE name = 'currency'");
|
||||
|
||||
$uniqueCurrencies = [];
|
||||
foreach ($countries as $country) {
|
||||
// Assuming each country has a 'currency' field with an array of currencies
|
||||
foreach ($country['currency'] as $currencyCode) {
|
||||
if (!array_key_exists($currencyCode, $uniqueCurrencies)) {
|
||||
$uniqueCurrencies[$currencyCode] = $currencyCode; // Or any other currency detail you have
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return view($response,'admin/system/registry.twig', [
|
||||
'company_name' => $company_name,
|
||||
|
@ -177,7 +202,9 @@ class SystemController extends Controller
|
|||
'handle' => $handle,
|
||||
'launch_phases' => $launch_phases,
|
||||
'whois_server' => $whois_server,
|
||||
'rdap_server' => $rdap_server
|
||||
'rdap_server' => $rdap_server,
|
||||
'uniqueCurrencies' => $uniqueCurrencies,
|
||||
'currency' => $currency
|
||||
]);
|
||||
}
|
||||
|
||||
|
|
|
@ -131,22 +131,20 @@ $container->set('view', function ($container) {
|
|||
}
|
||||
|
||||
$db = $container->get('db');
|
||||
$query = 'SELECT r.currency, ru.registrar_id
|
||||
$user_data = 'SELECT ru.registrar_id
|
||||
FROM registrar_users ru
|
||||
JOIN registrar r ON ru.registrar_id = r.id
|
||||
WHERE ru.user_id = ?';
|
||||
$currency_data = "SELECT value FROM settings WHERE name = 'currency'";
|
||||
|
||||
if (isset($_SESSION['auth_user_id'])) {
|
||||
$result = $db->select($query, [$_SESSION['auth_user_id']]);
|
||||
$result = $db->select($user_data, [$_SESSION['auth_user_id']]);
|
||||
$db_currency = $db->select($currency_data);
|
||||
|
||||
// Default values
|
||||
$_SESSION['_currency'] = 'USD';
|
||||
$_SESSION['_currency'] = $db_currency[0]['value'];
|
||||
$_SESSION['auth_registrar_id'] = null; // Default registrar_id
|
||||
|
||||
if ($result !== null && count($result) > 0) {
|
||||
if (isset($result[0]['currency'])) {
|
||||
$_SESSION['_currency'] = $result[0]['currency'];
|
||||
}
|
||||
if (isset($result[0]['registrar_id'])) {
|
||||
$_SESSION['auth_registrar_id'] = $result[0]['registrar_id'];
|
||||
}
|
||||
|
|
|
@ -1339,3 +1339,8 @@ msgstr "TLDs"
|
|||
msgid "Support"
|
||||
msgstr "Support"
|
||||
|
||||
msgid "Registry Currency"
|
||||
msgstr "Registry Currency"
|
||||
|
||||
msgid "Choose the currency for all transactions. This impacts billing and financial reports. Inform stakeholders of changes."
|
||||
msgstr "Choose the currency for all transactions. This impacts billing and financial reports. Inform stakeholders of changes."
|
||||
|
|
|
@ -1339,3 +1339,8 @@ msgstr ""
|
|||
msgid "Support"
|
||||
msgstr ""
|
||||
|
||||
msgid "Registry Currency"
|
||||
msgstr ""
|
||||
|
||||
msgid "Choose the currency for all transactions. This impacts billing and financial reports. Inform stakeholders of changes."
|
||||
msgstr ""
|
||||
|
|
|
@ -1339,3 +1339,8 @@ msgstr "TLDs"
|
|||
msgid "Support"
|
||||
msgstr "Підтримка"
|
||||
|
||||
msgid "Registry Currency"
|
||||
msgstr "Валюта реєстру"
|
||||
|
||||
msgid "Choose the currency for all transactions. This impacts billing and financial reports. Inform stakeholders of changes."
|
||||
msgstr "Виберіть валюту для всіх операцій. Це впливає на рахунки та фінансові звіти. Інформувати зацікавлених сторін про зміни."
|
||||
|
|
|
@ -38,7 +38,19 @@
|
|||
<input type="text" class="form-control" id="registryOperator" name="registryOperator" placeholder="{{ __('Enter registry operator\'s name') }}" value="{{ company_name }}" required>
|
||||
<small class="form-hint">{{ __('The official name of the organization operating the registry.') }}</small>
|
||||
</div>
|
||||
|
||||
<div class="mb-3">
|
||||
<label for="rdapServer" class="form-label required">{{ __('RDAP Server') }}</label>
|
||||
<input type="text" class="form-control" id="rdapServer" name="rdapServer" placeholder="{{ __('Enter registry RDAP server') }}" value="{{ rdap_server }}" required>
|
||||
<small class="form-hint">{{ __('Enter the URL of the registry\'s RDAP server. Example:') }} https://rdap.example.com</small>
|
||||
</div>
|
||||
|
||||
<div class="mb-3">
|
||||
<label for="whoisServer" class="form-label required">{{ __('WHOIS Server') }}</label>
|
||||
<input type="text" class="form-control" id="whoisServer" name="whoisServer" placeholder="{{ __('Enter registry whois server') }}" value="{{ whois_server }}" required>
|
||||
<small class="form-hint">{{ __('Enter the URL of the registry\'s WHOIS server. Example:') }} whois.example.com</small>
|
||||
</div>
|
||||
|
||||
<div class="mb-3">
|
||||
<label for="registryHandle" class="form-label required">{{ __('Registry Handle') }}</label>
|
||||
<input type="text" class="form-control" id="registryHandle" name="registryHandle" placeholder="{{ __('Enter registry handle') }}" value="{{ handle }}" required>
|
||||
|
@ -46,15 +58,13 @@
|
|||
</div>
|
||||
|
||||
<div class="mb-3">
|
||||
<label for="whoisServer" class="form-label required">{{ __('WHOIS Server') }}</label>
|
||||
<input type="text" class="form-control" id="whoisServer" name="whoisServer" placeholder="{{ __('Enter registry whois server') }}" value="{{ whois_server }}" required>
|
||||
<small class="form-hint">{{ __('Enter the URL of the registry\'s WHOIS server. Example:') }} whois.example.com</small>
|
||||
</div>
|
||||
|
||||
<div class="mb-3">
|
||||
<label for="rdapServer" class="form-label required">{{ __('RDAP Server') }}</label>
|
||||
<input type="text" class="form-control" id="rdapServer" name="rdapServer" placeholder="{{ __('Enter registry RDAP server') }}" value="{{ rdap_server }}" required>
|
||||
<small class="form-hint">{{ __('Enter the URL of the registry\'s RDAP server. Example:') }} https://rdap.example.com</small>
|
||||
<label for="registryCurrency" class="form-label required">{{ __('Registry Currency') }}</label>
|
||||
<select class="form-select" id="registryCurrency" name="currency" required="required">
|
||||
{% for currencyCode, currencyName in uniqueCurrencies %}
|
||||
<option value="{{ currencyCode }}" {% if currency == currencyCode %}selected{% endif %}>{{ currencyName }}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
<small class="form-hint">{{ __('Choose the currency for all transactions. This impacts billing and financial reports. Inform stakeholders of changes.') }}</small>
|
||||
</div>
|
||||
|
||||
<div class="mb-3">
|
||||
|
|
|
@ -880,7 +880,8 @@ INSERT INTO `registry`.`settings` (`name`, `value`) VALUES
|
|||
('email', 'contact@example.com'),
|
||||
('launch_phases', 'on'),
|
||||
('whois_server', 'whois.example.com'),
|
||||
('rdap_server', 'https://rdap.example.com');
|
||||
('rdap_server', 'https://rdap.example.com'),
|
||||
('currency', 'USD');
|
||||
|
||||
CREATE DATABASE IF NOT EXISTS `registryTransaction`;
|
||||
|
||||
|
|
|
@ -802,7 +802,8 @@ INSERT INTO settings (name, value) VALUES
|
|||
('email', 'contact@example.com'),
|
||||
('launch_phases', 'on'),
|
||||
('whois_server', 'whois.example.com'),
|
||||
('rdap_server', 'https://rdap.example.com');
|
||||
('rdap_server', 'https://rdap.example.com'),
|
||||
('currency', 'USD');
|
||||
|
||||
ALTER TABLE domain_tld ADD FOREIGN KEY (launch_phase_id) REFERENCES launch_phases(id);
|
||||
ALTER TABLE launch_phases ADD FOREIGN KEY (tld_id) REFERENCES domain_tld(id);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue