1
0
mirror of https://github.com/torrentpier/torrentpier.git synced 2025-03-12 04:35:42 -07:00

Added ability to set country name manually ()

* Minor improvements

* Updated

* Revert "Updated"

This reverts commit 927e085cc0b6ae3522bfde712b87279f2e1f05a2.

* Update CHANGELOG.md

* Update usercp_register.tpl

* Updated

* Updated

* Updated

* Update usercp_register.tpl

* Update usercp_register.tpl

* Update usercp_register.tpl

* Updated

* Update CHANGELOG.md

* Update usercp_register.tpl
This commit is contained in:
Roman Kelesidis 2024-10-05 14:02:35 +07:00 committed by GitHub
parent ca81d99a71
commit 408635cd52
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 42 additions and 7 deletions
CHANGELOG.mdinstall.php
library
includes/ucp
language/source
src/Legacy/Common
styles/templates/default

@ -12,6 +12,7 @@
- Added [TorrServer](https://github.com/YouROK/TorrServer) instance support! 🎞 [\#1603](https://github.com/torrentpier/torrentpier/pull/1603), [\#1623](https://github.com/torrentpier/torrentpier/pull/1623), [\#1624](https://github.com/torrentpier/torrentpier/pull/1624), [\#1628](https://github.com/torrentpier/torrentpier/pull/1628) ([belomaxorka](https://github.com/belomaxorka))
- Newtopic: Added configuring robots indexing [\#1599](https://github.com/torrentpier/torrentpier/pull/1599) ([belomaxorka](https://github.com/belomaxorka))
- Added showing releaser stats in profile [\#1568](https://github.com/torrentpier/torrentpier/pull/1568) ([belomaxorka](https://github.com/belomaxorka))
- Added ability to set country name manually [\#1652](https://github.com/torrentpier/torrentpier/pull/1652) ([belomaxorka](https://github.com/belomaxorka))
- Improved `filelist.php` [\#1586](https://github.com/torrentpier/torrentpier/pull/1586) ([belomaxorka](https://github.com/belomaxorka))
- Demo mode: Save user language in cookies [\#1584](https://github.com/torrentpier/torrentpier/pull/1584) ([belomaxorka](https://github.com/belomaxorka))
- BBCode: Fixed relative links working [\#1613](https://github.com/torrentpier/torrentpier/pull/1613) ([belomaxorka](https://github.com/belomaxorka))

@ -178,7 +178,7 @@ out("- All extensions are installed!\n", 'success');
if (is_file(BB_ROOT . '.env')) {
out('- TorrentPier already installed', 'warning');
echo 'Are you sure want to re-install TorrentPier? [y/N]: ';
if (in_array(mb_strtolower(readline()), ['y', 'ye', 'yes', 'yep', 'yeah'])) {
if (str_starts_with(mb_strtolower(readline()), 'y')) {
out("\n- Re-install process started...", 'info');
// environment
if (is_file(BB_ROOT . '.env')) {

@ -465,8 +465,10 @@ foreach ($profile_fields as $field => $can_edit) {
$pr_data['user_from'] = $from;
$db_data['user_from'] = (string)$from;
}
$tp_data['USER_FROM'] = $pr_data['user_from'];
$tp_data['COUNTRY_SELECTED'] = render_flag($pr_data['user_from']);
$tp_data['COUNTRY_SELECT'] = build_select('user_from', array_flip($lang['COUNTRIES']), $pr_data['user_from']);
$tp_data['CHECKED_MANUAL_COUNTRY'] = ($tp_data['COUNTRY_SELECTED'] === $pr_data['user_from']) ? 'checked' : '';
break;
/**

@ -987,6 +987,7 @@ $lang['DATETIME']['DEC'] = 'Dec';
// Country selector
$lang['COUNTRY'] = 'Country';
$lang['SET_OWN_COUNTRY'] = 'Set own country (Manually)';
$lang['COUNTRIES'] = [
0 => 'No select',
'AD' => 'Andorra',

@ -52,6 +52,7 @@ class Html
$this->_build_select_rec($params);
$select_params = $js ? " $js" : '';
$select_params .= ' autocomplete="off"';
$select_params .= $multiple_size ? ' multiple size="' . $multiple_size . '"' : '';
$select_params .= ' name="' . htmlCHR($name) . '"';
$select_params .= ' id="' . htmlCHR($name) . '"';

@ -155,13 +155,43 @@
</tr>
<tr>
<td class="prof-title">{L_LOCATION}:</td>
<td>{COUNTRY_SELECT}&nbsp;<span id="check_country">{COUNTRY_SELECTED}</td>
<td>
<label>{L_SET_OWN_COUNTRY}
<input {CHECKED_MANUAL_COUNTRY} name="user_from_set_manual" type="checkbox">
</label>
<hr>
<div id="country_select_hide">{COUNTRY_SELECT}&nbsp;<span id="check_country">{COUNTRY_SELECTED}</span></div>
<div style="display: none;" id="country_manual_select"><input type="text" name="user_from" size="50" maxlength="150" value="{USER_FROM}"/></div>
</td>
<script type="text/javascript">
$('#user_from').bind('change', function () {
ajax.exec({
action: 'user_register',
mode: 'check_country',
country: $(this).val()
$(document).ready(function () {
// Handle manual country select
const $manualCheckbox = $('input[name="user_from_set_manual"]');
const $countrySelectHide = $('div#country_select_hide');
const $countryManualSelect = $('div#country_manual_select');
function toggleCountrySelectors() {
if ($manualCheckbox.is(':checked')) {
$countrySelectHide.find('select').prop('disabled', true);
$countrySelectHide.hide();
$countryManualSelect.find('input').prop('disabled', false);
$countryManualSelect.show();
} else {
$countryManualSelect.find('input').prop('disabled', true);
$countryManualSelect.hide();
$countrySelectHide.find('select').prop('disabled', false);
$countrySelectHide.show();
}
}
toggleCountrySelectors();
$manualCheckbox.change(toggleCountrySelectors);
// Handle flag icon changing
$('#user_from').bind('change', function () {
ajax.exec({
action: 'user_register',
mode: 'check_country',
country: $(this).val()
});
});
});
</script>