mirror of
https://github.com/friendica/friendica
synced 2025-04-22 08:30:10 +00:00
Issue 11487: IDN support added
This commit is contained in:
parent
e374c2e3da
commit
47808ab0e9
4 changed files with 32 additions and 45 deletions
|
@ -30,6 +30,7 @@ use Friendica\Model;
|
|||
use Friendica\Network\HTTPException;
|
||||
use Friendica\Object\Search\ContactResult;
|
||||
use Friendica\Object\Search\ResultList;
|
||||
use Friendica\Util\Network;
|
||||
|
||||
/**
|
||||
* Base class for search modules
|
||||
|
@ -68,7 +69,7 @@ class BaseSearch extends BaseModule
|
|||
$header = DI::l10n()->t('People Search - %s', $search);
|
||||
|
||||
if (strrpos($search, '@') > 0) {
|
||||
$results = Search::getContactsFromProbe($search);
|
||||
$results = Search::getContactsFromProbe(Network::convertToIdn($search));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -78,6 +79,8 @@ class BaseSearch extends BaseModule
|
|||
$header = DI::l10n()->t('Forum Search - %s', $search);
|
||||
}
|
||||
|
||||
$search = Network::convertToIdn($search);
|
||||
|
||||
if (DI::mode()->isMobile()) {
|
||||
$itemsPerPage = DI::pConfig()->get(local_user(), 'system', 'itemspage_mobile_network',
|
||||
DI::config()->get('system', 'itemspage_network_mobile'));
|
||||
|
|
|
@ -38,6 +38,7 @@ use Friendica\Model\Post;
|
|||
use Friendica\Model\Tag;
|
||||
use Friendica\Module\BaseSearch;
|
||||
use Friendica\Network\HTTPException;
|
||||
use Friendica\Util\Network;
|
||||
|
||||
class Index extends BaseSearch
|
||||
{
|
||||
|
@ -226,7 +227,8 @@ class Index extends BaseSearch
|
|||
*/
|
||||
private static function tryRedirectToProfile(string $search)
|
||||
{
|
||||
$isUrl = !empty(parse_url($search, PHP_URL_SCHEME));
|
||||
$search = Network::convertToIdn($search);
|
||||
$isUrl = !empty(parse_url($search, PHP_URL_SCHEME));
|
||||
$isAddr = (bool)preg_match('/^@?([a-z0-9.-_]+@[a-z0-9.-_:]+)$/i', trim($search), $matches);
|
||||
|
||||
if (!$isUrl && !$isAddr) {
|
||||
|
@ -274,6 +276,8 @@ class Index extends BaseSearch
|
|||
return;
|
||||
}
|
||||
|
||||
$search = Network::convertToIdn($search);
|
||||
|
||||
if (local_user()) {
|
||||
// Post URL search
|
||||
$item_id = Item::fetchByLink($search, local_user());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue