]> git.mxchange.org Git - friendica.git/blobdiff - src/Core/Installer.php
rewording the encouragement and regen of the messages.po
[friendica.git] / src / Core / Installer.php
index 58cd713435bce804e0498759afccbf3271cfcf4d..041771812526fe028b8e7cda42d7137f7e54ec33 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 /**
- * @copyright Copyright (C) 2020, Friendica
+ * @copyright Copyright (C) 2010-2021, the Friendica project
  *
  * @license GNU AGPL version 3 or any later version
  *
@@ -129,14 +129,18 @@ class Installer
                        $returnVal = false;
                }
 
-               if (!$this->checkKeys()) {
+               if (!$this->checkTLS()) {
                        $returnVal = false;
                }
 
-               if (!$this->checkHtAccess($baseurl)) {
+               if (!$this->checkKeys()) {
                        $returnVal = false;
                }
 
+               /// @TODO This check should not block installations because of containerization issues
+               /// @see https://github.com/friendica/docker/issues/134
+               $this->checkHtAccess($baseurl);
+
                return $returnVal;
        }
 
@@ -465,7 +469,7 @@ class Installer
 
                $status = $this->checkFunction('proc_open',
                        DI::l10n()->t('Program execution functions'),
-                       DI::l10n()->t('Error: Program execution functions required but not enabled.'),
+                       DI::l10n()->t('Error: Program execution functions (proc_open) required but not enabled.'),
                        true
                );
                $returnVal = $returnVal ? $status : false;
@@ -562,7 +566,7 @@ class Installer
 
                        if ($fetchResult->getReturnCode() != 204) {
                                $status = false;
-                               $help = DI::l10n()->t('Url rewrite in .htaccess seems not working. Make sure you copied .htaccess-dist to .htaccess.');
+                               $help = DI::l10n()->t('Url rewrite in .htaccess seems not working. Make sure you copied .htaccess-dist to .htaccess.') . EOL;
                                $help .= DI::l10n()->t('In some circumstances (like running inside containers), you can skip this error.');
                                $error_msg = [];
                                $error_msg['head'] = DI::l10n()->t('Error message from Curl when fetching');
@@ -580,6 +584,38 @@ class Installer
                return $status;
        }
 
+       /**
+        * TLS Check
+        *
+        * Tries to determine whether the connection to the server is secured
+        * by TLS or not. If not the user will be warned that it is higly
+        * encuraged to use TLS.
+        *
+        * @return bool (true) as TLS is not mandatory
+        */
+       public function checkTLS()
+       {
+               $tls = false;
+
+               if (isset($_SERVER['HTTPS'])) {
+                       if (($_SERVER['HTTPS'] == 1) || ($_SERVER['HTTPS'] == 'on')) {
+                               $tls = true;
+                       }
+               }
+               
+               if (!$tls) {
+                       $help = DI::l10n()->t('The detection of TLS to secure the communication between the browser and the new Friendica server failed.');
+                       $help .= ' ' . DI::l10n()->t('It is highly encouraged to use Friendica only over a secure connection as sensitive information like passwords will be transmitted.');
+                       $help .= ' ' . DI::l10n()->t('Please ensure that the connection to the server is secure.');
+                       $this->addCheck(DI::l10n()->t('No TLS detected'), $tls, false, $help);
+               } else {
+                       $this->addCheck(DI::l10n()->t('TLS detected'), $tls, false, '');
+               }
+
+               // TLS is not required
+               return true;
+       }
+
        /**
         * Imagick Check
         *