mirror of
https://github.com/friendica/friendica
synced 2024-11-09 16:22:56 +00:00
Fallback mechanism for missing IDN functions
This commit is contained in:
parent
e9dcf15d86
commit
78dc61b59e
6 changed files with 58 additions and 32 deletions
|
@ -30,7 +30,7 @@ Due to the large variety of operating systems and PHP platforms in existence we
|
||||||
* Apache with mod-rewrite enabled and "Options All" so you can use a local `.htaccess` file
|
* Apache with mod-rewrite enabled and "Options All" so you can use a local `.htaccess` file
|
||||||
* PHP 7.4+
|
* PHP 7.4+
|
||||||
* PHP *command line* access with register_argc_argv set to true in the php.ini file
|
* PHP *command line* access with register_argc_argv set to true in the php.ini file
|
||||||
* Curl, GD, GMP, PDO, mbstrings, MySQLi, hash, xml, zip, IntlChar and OpenSSL extensions
|
* Curl, GD, GMP, PDO, mbstrings, MySQLi, hash, xml, zip, IntlChar, IDN and OpenSSL extensions
|
||||||
* The POSIX module of PHP needs to be activated (e.g. [RHEL, CentOS](http://www.bigsoft.co.uk/blog/index.php/2014/12/08/posix-php-commands-not-working-under-centos-7) have disabled it)
|
* The POSIX module of PHP needs to be activated (e.g. [RHEL, CentOS](http://www.bigsoft.co.uk/blog/index.php/2014/12/08/posix-php-commands-not-working-under-centos-7) have disabled it)
|
||||||
* Some form of email server or email gateway such that PHP mail() works.
|
* Some form of email server or email gateway such that PHP mail() works.
|
||||||
If you cannot set up your own email server, you can use the [phpmailer](https://github.com/friendica/friendica-addons/tree/develop/phpmailer) addon and use a remote SMTP server.
|
If you cannot set up your own email server, you can use the [phpmailer](https://github.com/friendica/friendica-addons/tree/develop/phpmailer) addon and use a remote SMTP server.
|
||||||
|
|
|
@ -27,7 +27,7 @@ Requirements
|
||||||
* Apache mit einer aktiverten mod-rewrite-Funktion und dem Eintrag "Options All", so dass du die lokale .htaccess-Datei nutzen kannst
|
* Apache mit einer aktiverten mod-rewrite-Funktion und dem Eintrag "Options All", so dass du die lokale .htaccess-Datei nutzen kannst
|
||||||
* PHP 7.4+
|
* PHP 7.4+
|
||||||
* PHP *Kommandozeilen*-Zugang mit register_argc_argv auf "true" gesetzt in der php.ini-Datei
|
* PHP *Kommandozeilen*-Zugang mit register_argc_argv auf "true" gesetzt in der php.ini-Datei
|
||||||
* Curl, GD, GMP, PDO, mbstrings, MySQLi, hash, xml, zip, IntlChar and OpenSSL-Erweiterung
|
* Curl, GD, GMP, PDO, mbstrings, MySQLi, hash, xml, zip, IntlChar, IDN und OpenSSL-Erweiterung
|
||||||
* Das POSIX Modul muss aktiviert sein ([CentOS, RHEL](http://www.bigsoft.co.uk/blog/index.php/2014/12/08/posix-php-commands-not-working-under-centos-7http://www.bigsoft.co.uk/blog/index.php/2014/12/08/posix-php-commands-not-working-under-centos-7) haben dies z.B. deaktiviert)
|
* Das POSIX Modul muss aktiviert sein ([CentOS, RHEL](http://www.bigsoft.co.uk/blog/index.php/2014/12/08/posix-php-commands-not-working-under-centos-7http://www.bigsoft.co.uk/blog/index.php/2014/12/08/posix-php-commands-not-working-under-centos-7) haben dies z.B. deaktiviert)
|
||||||
* Einen E-Mail Server, so dass PHP `mail()` funktioniert.
|
* Einen E-Mail Server, so dass PHP `mail()` funktioniert.
|
||||||
Wenn kein eigener E-Mail Server zur Verfügung steht, kann alternativ das [phpmailer](https://github.com/friendica/friendica-addons/tree/develop/phpmailer) Addon mit einem externen SMTP Account verwendet werden.
|
Wenn kein eigener E-Mail Server zur Verfügung steht, kann alternativ das [phpmailer](https://github.com/friendica/friendica-addons/tree/develop/phpmailer) Addon mit einem externen SMTP Account verwendet werden.
|
||||||
|
|
|
@ -495,6 +495,13 @@ class Installer
|
||||||
);
|
);
|
||||||
$returnVal = $returnVal ? $status : false;
|
$returnVal = $returnVal ? $status : false;
|
||||||
|
|
||||||
|
$status = $this->checkFunction('idn_to_ascii',
|
||||||
|
DI::l10n()->t('IDN Functions PHP module'),
|
||||||
|
DI::l10n()->t('Error: IDN Functions PHP module required but not installed.'),
|
||||||
|
true
|
||||||
|
);
|
||||||
|
$returnVal = $returnVal ? $status : false;
|
||||||
|
|
||||||
return $returnVal;
|
return $returnVal;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -533,20 +533,29 @@ class Network
|
||||||
{
|
{
|
||||||
$parts = parse_url($uri);
|
$parts = parse_url($uri);
|
||||||
if (!empty($parts['scheme']) && !empty($parts['host'])) {
|
if (!empty($parts['scheme']) && !empty($parts['host'])) {
|
||||||
$parts['host'] = idn_to_ascii($parts['host']);
|
$parts['host'] = self::idnToAscii($parts['host']);
|
||||||
$uri = (string)Uri::fromParts($parts);
|
$uri = (string)Uri::fromParts($parts);
|
||||||
} else {
|
} else {
|
||||||
$parts = explode('@', $uri);
|
$parts = explode('@', $uri);
|
||||||
if (count($parts) == 2) {
|
if (count($parts) == 2) {
|
||||||
$uri = $parts[0] . '@' . idn_to_ascii($parts[1]);
|
$uri = $parts[0] . '@' . self::idnToAscii($parts[1]);
|
||||||
} else {
|
} else {
|
||||||
$uri = idn_to_ascii($uri);
|
$uri = self::idnToAscii($uri);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $uri;
|
return $uri;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static function idnToAscii(string $uri): string
|
||||||
|
{
|
||||||
|
if (!function_exists('idn_to_ascii')) {
|
||||||
|
Logger::error('IDN functions are missing.');
|
||||||
|
return $uri;
|
||||||
|
}
|
||||||
|
return idn_to_ascii($uri);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Switch the scheme of an url between http and https
|
* Switch the scheme of an url between http and https
|
||||||
*
|
*
|
||||||
|
|
|
@ -110,6 +110,8 @@ class InstallerTest extends MockedTest
|
||||||
$this->mockL10nT('Error: File Information PHP module required but not installed.', 1);
|
$this->mockL10nT('Error: File Information PHP module required but not installed.', 1);
|
||||||
$this->mockL10nT('GNU Multiple Precision PHP module', 1);
|
$this->mockL10nT('GNU Multiple Precision PHP module', 1);
|
||||||
$this->mockL10nT('Error: GNU Multiple Precision PHP module required but not installed.', 1);
|
$this->mockL10nT('Error: GNU Multiple Precision PHP module required but not installed.', 1);
|
||||||
|
$this->mockL10nT('IDN Functions PHP module', 1);
|
||||||
|
$this->mockL10nT('Error: IDN Functions PHP module required but not installed.', 1);
|
||||||
$this->mockL10nT('Program execution functions', 1);
|
$this->mockL10nT('Program execution functions', 1);
|
||||||
$this->mockL10nT('Error: Program execution functions (proc_open) required but not enabled.', 1);
|
$this->mockL10nT('Error: Program execution functions (proc_open) required but not enabled.', 1);
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,7 +8,7 @@ msgid ""
|
||||||
msgstr ""
|
msgstr ""
|
||||||
"Project-Id-Version: 2024.06-dev\n"
|
"Project-Id-Version: 2024.06-dev\n"
|
||||||
"Report-Msgid-Bugs-To: \n"
|
"Report-Msgid-Bugs-To: \n"
|
||||||
"POT-Creation-Date: 2024-04-05 07:28+0000\n"
|
"POT-Creation-Date: 2024-04-06 11:09+0000\n"
|
||||||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||||
|
@ -2793,120 +2793,128 @@ msgstr ""
|
||||||
msgid "Error: GNU Multiple Precision PHP module required but not installed."
|
msgid "Error: GNU Multiple Precision PHP module required but not installed."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: src/Core/Installer.php:516
|
#: src/Core/Installer.php:499
|
||||||
|
msgid "IDN Functions PHP module"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: src/Core/Installer.php:500
|
||||||
|
msgid "Error: IDN Functions PHP module required but not installed."
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: src/Core/Installer.php:523
|
||||||
msgid ""
|
msgid ""
|
||||||
"The web installer needs to be able to create a file called \"local.config.php"
|
"The web installer needs to be able to create a file called \"local.config.php"
|
||||||
"\" in the \"config\" folder of your web server and it is unable to do so."
|
"\" in the \"config\" folder of your web server and it is unable to do so."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: src/Core/Installer.php:517
|
#: src/Core/Installer.php:524
|
||||||
msgid ""
|
msgid ""
|
||||||
"This is most often a permission setting, as the web server may not be able "
|
"This is most often a permission setting, as the web server may not be able "
|
||||||
"to write files in your folder - even if you can."
|
"to write files in your folder - even if you can."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: src/Core/Installer.php:518
|
#: src/Core/Installer.php:525
|
||||||
msgid ""
|
msgid ""
|
||||||
"At the end of this procedure, we will give you a text to save in a file "
|
"At the end of this procedure, we will give you a text to save in a file "
|
||||||
"named local.config.php in your Friendica \"config\" folder."
|
"named local.config.php in your Friendica \"config\" folder."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: src/Core/Installer.php:519
|
#: src/Core/Installer.php:526
|
||||||
msgid ""
|
msgid ""
|
||||||
"You can alternatively skip this procedure and perform a manual installation. "
|
"You can alternatively skip this procedure and perform a manual installation. "
|
||||||
"Please see the file \"doc/INSTALL.md\" for instructions."
|
"Please see the file \"doc/INSTALL.md\" for instructions."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: src/Core/Installer.php:522
|
#: src/Core/Installer.php:529
|
||||||
msgid "config/local.config.php is writable"
|
msgid "config/local.config.php is writable"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: src/Core/Installer.php:542
|
#: src/Core/Installer.php:549
|
||||||
msgid ""
|
msgid ""
|
||||||
"Friendica uses the Smarty3 template engine to render its web views. Smarty3 "
|
"Friendica uses the Smarty3 template engine to render its web views. Smarty3 "
|
||||||
"compiles templates to PHP to speed up rendering."
|
"compiles templates to PHP to speed up rendering."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: src/Core/Installer.php:543
|
#: src/Core/Installer.php:550
|
||||||
msgid ""
|
msgid ""
|
||||||
"In order to store these compiled templates, the web server needs to have "
|
"In order to store these compiled templates, the web server needs to have "
|
||||||
"write access to the directory view/smarty3/ under the Friendica top level "
|
"write access to the directory view/smarty3/ under the Friendica top level "
|
||||||
"folder."
|
"folder."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: src/Core/Installer.php:544
|
#: src/Core/Installer.php:551
|
||||||
msgid ""
|
msgid ""
|
||||||
"Please ensure that the user that your web server runs as (e.g. www-data) has "
|
"Please ensure that the user that your web server runs as (e.g. www-data) has "
|
||||||
"write access to this folder."
|
"write access to this folder."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: src/Core/Installer.php:545
|
#: src/Core/Installer.php:552
|
||||||
msgid ""
|
msgid ""
|
||||||
"Note: as a security measure, you should give the web server write access to "
|
"Note: as a security measure, you should give the web server write access to "
|
||||||
"view/smarty3/ only--not the template files (.tpl) that it contains."
|
"view/smarty3/ only--not the template files (.tpl) that it contains."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: src/Core/Installer.php:548
|
#: src/Core/Installer.php:555
|
||||||
msgid "view/smarty3 is writable"
|
msgid "view/smarty3 is writable"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: src/Core/Installer.php:576
|
#: src/Core/Installer.php:583
|
||||||
msgid ""
|
msgid ""
|
||||||
"Url rewrite in .htaccess seems not working. Make sure you copied .htaccess-"
|
"Url rewrite in .htaccess seems not working. Make sure you copied .htaccess-"
|
||||||
"dist to .htaccess."
|
"dist to .htaccess."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: src/Core/Installer.php:577
|
#: src/Core/Installer.php:584
|
||||||
msgid ""
|
msgid ""
|
||||||
"In some circumstances (like running inside containers), you can skip this "
|
"In some circumstances (like running inside containers), you can skip this "
|
||||||
"error."
|
"error."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: src/Core/Installer.php:579
|
#: src/Core/Installer.php:586
|
||||||
msgid "Error message from Curl when fetching"
|
msgid "Error message from Curl when fetching"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: src/Core/Installer.php:585
|
#: src/Core/Installer.php:592
|
||||||
msgid "Url rewrite is working"
|
msgid "Url rewrite is working"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: src/Core/Installer.php:614
|
#: src/Core/Installer.php:621
|
||||||
msgid ""
|
msgid ""
|
||||||
"The detection of TLS to secure the communication between the browser and the "
|
"The detection of TLS to secure the communication between the browser and the "
|
||||||
"new Friendica server failed."
|
"new Friendica server failed."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: src/Core/Installer.php:615
|
#: src/Core/Installer.php:622
|
||||||
msgid ""
|
msgid ""
|
||||||
"It is highly encouraged to use Friendica only over a secure connection as "
|
"It is highly encouraged to use Friendica only over a secure connection as "
|
||||||
"sensitive information like passwords will be transmitted."
|
"sensitive information like passwords will be transmitted."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: src/Core/Installer.php:616
|
#: src/Core/Installer.php:623
|
||||||
msgid "Please ensure that the connection to the server is secure."
|
msgid "Please ensure that the connection to the server is secure."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: src/Core/Installer.php:617
|
#: src/Core/Installer.php:624
|
||||||
msgid "No TLS detected"
|
msgid "No TLS detected"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: src/Core/Installer.php:619
|
#: src/Core/Installer.php:626
|
||||||
msgid "TLS detected"
|
msgid "TLS detected"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: src/Core/Installer.php:636
|
#: src/Core/Installer.php:643
|
||||||
msgid "ImageMagick PHP extension is not installed"
|
msgid "ImageMagick PHP extension is not installed"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: src/Core/Installer.php:638
|
#: src/Core/Installer.php:645
|
||||||
msgid "ImageMagick PHP extension is installed"
|
msgid "ImageMagick PHP extension is installed"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: src/Core/Installer.php:659
|
#: src/Core/Installer.php:666
|
||||||
msgid "Database already in use."
|
msgid "Database already in use."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: src/Core/Installer.php:664
|
#: src/Core/Installer.php:671
|
||||||
msgid "Could not connect to database."
|
msgid "Could not connect to database."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
@ -6656,9 +6664,9 @@ msgstr[1] ""
|
||||||
#: src/Module/Debug/ItemBody.php:38 src/Module/Diaspora/Receive.php:57
|
#: src/Module/Debug/ItemBody.php:38 src/Module/Diaspora/Receive.php:57
|
||||||
#: src/Module/Item/Display.php:96 src/Module/Item/Feed.php:59
|
#: src/Module/Item/Display.php:96 src/Module/Item/Feed.php:59
|
||||||
#: src/Module/Item/Follow.php:41 src/Module/Item/Ignore.php:41
|
#: src/Module/Item/Follow.php:41 src/Module/Item/Ignore.php:41
|
||||||
#: src/Module/Item/Pin.php:41 src/Module/Item/Pin.php:56
|
#: src/Module/Item/Language.php:53 src/Module/Item/Pin.php:41
|
||||||
#: src/Module/Item/Searchtext.php:53 src/Module/Item/Star.php:42
|
#: src/Module/Item/Pin.php:56 src/Module/Item/Searchtext.php:53
|
||||||
#: src/Module/Update/Display.php:37
|
#: src/Module/Item/Star.php:42 src/Module/Update/Display.php:37
|
||||||
msgid "Access denied."
|
msgid "Access denied."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue