From 408635cd52c3bd579a9aa79b035d82298faa4b17 Mon Sep 17 00:00:00 2001 From: Roman Kelesidis Date: Sat, 5 Oct 2024 14:02:35 +0700 Subject: [PATCH] Added ability to set country name manually (#1652) * 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 --- CHANGELOG.md | 1 + install.php | 2 +- library/includes/ucp/register.php | 2 + library/language/source/main.php | 1 + src/Legacy/Common/Html.php | 1 + styles/templates/default/usercp_register.tpl | 42 +++++++++++++++++--- 6 files changed, 42 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ac4853481..9193ed1e7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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)) diff --git a/install.php b/install.php index 36c1e5107..b6eec09e1 100644 --- a/install.php +++ b/install.php @@ -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')) { diff --git a/library/includes/ucp/register.php b/library/includes/ucp/register.php index 79294f627..74d8a58c0 100644 --- a/library/includes/ucp/register.php +++ b/library/includes/ucp/register.php @@ -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; /** diff --git a/library/language/source/main.php b/library/language/source/main.php index af4938fc6..1bc4b74e0 100644 --- a/library/language/source/main.php +++ b/library/language/source/main.php @@ -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', diff --git a/src/Legacy/Common/Html.php b/src/Legacy/Common/Html.php index 530834b6e..536da9377 100644 --- a/src/Legacy/Common/Html.php +++ b/src/Legacy/Common/Html.php @@ -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) . '"'; diff --git a/styles/templates/default/usercp_register.tpl b/styles/templates/default/usercp_register.tpl index aeddeb247..7739b6fbc 100644 --- a/styles/templates/default/usercp_register.tpl +++ b/styles/templates/default/usercp_register.tpl @@ -155,13 +155,43 @@ {L_LOCATION}: - {COUNTRY_SELECT} {COUNTRY_SELECTED} + + +
+
{COUNTRY_SELECT} {COUNTRY_SELECTED}
+ +