]> git.mxchange.org Git - friendica.git/blobdiff - src/Module/Install.php
Merge pull request #7292 from annando/notice
[friendica.git] / src / Module / Install.php
index 67677940f3ab7d12792cdc5bcbe756203c93d6c3..54c10534ddeafd27b976fa178d674b26a56edbbe 100644 (file)
@@ -28,7 +28,7 @@ class Install extends BaseModule
         */
        const DATABASE_CONFIG = 3;
        /**
-        * Step four - Adapat site settings
+        * Step four - Adapt site settings
         */
        const SITE_SETTINGS = 4;
        /**
@@ -50,11 +50,16 @@ class Install extends BaseModule
        {
                $a = self::getApp();
 
+               if (!$a->getMode()->isInstall()) {
+                       throw new \Friendica\Network\HTTPException\ForbiddenException();
+               }
+
                // route: install/testrwrite
                // $baseurl/install/testrwrite to test if rewrite in .htaccess is working
+               // @TODO: Replace with parameter from router
                if ($a->getArgumentValue(1, '') == 'testrewrite') {
                        // Status Code 204 means that it worked without content
-                       Core\System::httpExit(204);
+                       throw new \Friendica\Network\HTTPException\NoContentException();
                }
 
                self::$installer = new Core\Installer();
@@ -160,23 +165,22 @@ class Install extends BaseModule
 
                                $tpl = Renderer::getMarkupTemplate('install_checks.tpl');
                                $output .= Renderer::replaceMacros($tpl, [
-                                       '$title'        => $install_title,
-                                       '$pass'         => L10n::t('System check'),
-                                       '$checks'       => self::$installer->getChecks(),
-                                       '$passed'       => $status,
-                                       '$see_install'  => L10n::t('Please see the file "INSTALL.txt".'),
-                                       '$next'         => L10n::t('Next'),
-                                       '$reload'       => L10n::t('Check again'),
-                                       '$php_path'     => $php_path,
-                                       '$baseurl'      => $a->getBaseURL()
+                                       '$title'       => $install_title,
+                                       '$pass'        => L10n::t('System check'),
+                                       '$checks'      => self::$installer->getChecks(),
+                                       '$passed'      => $status,
+                                       '$see_install' => L10n::t('Please see the file "INSTALL.txt".'),
+                                       '$next'        => L10n::t('Next'),
+                                       '$reload'      => L10n::t('Check again'),
+                                       '$php_path'    => $php_path,
                                ]);
                                break;
 
                        case self::BASE_CONFIG:
                                $ssl_choices = [
-                                       BaseUrl::SSL_POLICY_NONE     => L10n::t("No SSL policy, links will track page SSL state"),
-                                       BaseUrl::SSL_POLICY_FULL     => L10n::t("Force all links to use SSL"),
-                                       BaseUrl::SSL_POLICY_SELFSIGN => L10n::t("Self-signed certificate, use SSL for local links only \x28discouraged\x29")
+                                       BaseURL::SSL_POLICY_NONE     => L10n::t("No SSL policy, links will track page SSL state"),
+                                       BaseURL::SSL_POLICY_FULL     => L10n::t("Force all links to use SSL"),
+                                       BaseURL::SSL_POLICY_SELFSIGN => L10n::t("Self-signed certificate, use SSL for local links only \x28discouraged\x29")
                                ];
 
                                $tpl = Renderer::getMarkupTemplate('install_base.tpl');
@@ -184,26 +188,25 @@ class Install extends BaseModule
                                        '$title'      => $install_title,
                                        '$pass'       => L10n::t('Base settings'),
                                        '$ssl_policy' => ['system-ssl_policy',
-                                                                               L10n::t("SSL link policy"),
-                                                                               $configCache->get('system', 'ssl_policy'),
-                                                                               L10n::t("Determines whether generated links should be forced to use SSL"),
-                                                                               $ssl_choices],
+                                               L10n::t("SSL link policy"),
+                                               $configCache->get('system', 'ssl_policy'),
+                                               L10n::t("Determines whether generated links should be forced to use SSL"),
+                                               $ssl_choices],
                                        '$hostname'   => ['config-hostname',
-                                                                               L10n::t('Host name'),
-                                                                               $configCache->get('config', 'hostname'),
-                                                                               L10n::t('Overwrite this field in case the determinated hostname isn\'t right, otherweise leave it as is.'),
-                                                                               'required'],
+                                               L10n::t('Host name'),
+                                               $configCache->get('config', 'hostname'),
+                                               L10n::t('Overwrite this field in case the determinated hostname isn\'t right, otherweise leave it as is.'),
+                                               'required'],
                                        '$basepath'   => ['system-basepath',
-                                                                               L10n::t("Base path to installation"),
-                                                                               $configCache->get('system', 'basepath'),
-                                                                               L10n::t("If the system cannot detect the correct path to your installation, enter the correct path here. This setting should only be set if you are using a restricted system and symbolic links to your webroot."),
-                                                                               'required'],
+                                               L10n::t("Base path to installation"),
+                                               $configCache->get('system', 'basepath'),
+                                               L10n::t("If the system cannot detect the correct path to your installation, enter the correct path here. This setting should only be set if you are using a restricted system and symbolic links to your webroot."),
+                                               'required'],
                                        '$urlpath'    => ['system-urlpath',
-                                                                               L10n::t('Sub path of the URL'),
-                                                                               $configCache->get('system', 'urlpath'),
-                                                                               L10n::t('Overwrite this field in case the sub path determination isn\'t right, otherwise leave it as is. Leaving this field blank means the installation is at the base URL without sub path.'),
-                                                                               ''],
-                                       '$baseurl'    => $a->getBaseURL(),
+                                               L10n::t('Sub path of the URL'),
+                                               $configCache->get('system', 'urlpath'),
+                                               L10n::t('Overwrite this field in case the sub path determination isn\'t right, otherwise leave it as is. Leaving this field blank means the installation is at the base URL without sub path.'),
+                                               ''],
                                        '$php_path'   => $configCache->get('config', 'php_path'),
                                        '$submit'     => L10n::t('Submit'),
                                ]);
@@ -212,41 +215,40 @@ class Install extends BaseModule
                        case self::DATABASE_CONFIG:
                                $tpl = Renderer::getMarkupTemplate('install_db.tpl');
                                $output .= Renderer::replaceMacros($tpl, [
-                                       '$title'    => $install_title,
-                                       '$pass'     => L10n::t('Database connection'),
-                                       '$info_01'  => L10n::t('In order to install Friendica we need to know how to connect to your database.'),
-                                       '$info_02'  => L10n::t('Please contact your hosting provider or site administrator if you have questions about these settings.'),
-                                       '$info_03'  => L10n::t('The database you specify below should already exist. If it does not, please create it before continuing.'),
-                                       'checks'    => self::$installer->getChecks(),
+                                       '$title'      => $install_title,
+                                       '$pass'       => L10n::t('Database connection'),
+                                       '$info_01'    => L10n::t('In order to install Friendica we need to know how to connect to your database.'),
+                                       '$info_02'    => L10n::t('Please contact your hosting provider or site administrator if you have questions about these settings.'),
+                                       '$info_03'    => L10n::t('The database you specify below should already exist. If it does not, please create it before continuing.'),
+                                       'checks'      => self::$installer->getChecks(),
                                        '$hostname'   => $configCache->get('config', 'hostname'),
                                        '$ssl_policy' => $configCache->get('system', 'ssl_policy'),
                                        '$basepath'   => $configCache->get('system', 'basepath'),
                                        '$urlpath'    => $configCache->get('system', 'urlpath'),
-                                       '$dbhost'   => ['database-hostname',
-                                                                       L10n::t('Database Server Name'),
-                                                                       $configCache->get('database', 'hostname'),
-                                                                       '',
-                                                                       'required'],
-                                       '$dbuser'   => ['database-username',
-                                                                       L10n::t('Database Login Name'),
-                                                                       $configCache->get('database', 'username'),
-                                                                       '',
-                                                                       'required',
-                                                                       'autofocus'],
-                                       '$dbpass'   => ['database-password',
-                                                                       L10n::t('Database Login Password'),
-                                                                       $configCache->get('database', 'password'),
-                                                                       L10n::t("For security reasons the password must not be empty"),
-                                                                       'required'],
-                                       '$dbdata'   => ['database-database',
-                                                                       L10n::t('Database Name'),
-                                                                       $configCache->get('database', 'database'),
-                                                                       '',
-                                                                       'required'],
-                                       '$lbl_10'   => L10n::t('Please select a default timezone for your website'),
-                                       '$baseurl'  => $a->getBaseURL(),
-                                       '$php_path' => $configCache->get('config', 'php_path'),
-                                       '$submit'   => L10n::t('Submit')
+                                       '$dbhost'     => ['database-hostname',
+                                               L10n::t('Database Server Name'),
+                                               $configCache->get('database', 'hostname'),
+                                               '',
+                                               'required'],
+                                       '$dbuser'     => ['database-username',
+                                               L10n::t('Database Login Name'),
+                                               $configCache->get('database', 'username'),
+                                               '',
+                                               'required',
+                                               'autofocus'],
+                                       '$dbpass'     => ['database-password',
+                                               L10n::t('Database Login Password'),
+                                               $configCache->get('database', 'password'),
+                                               L10n::t("For security reasons the password must not be empty"),
+                                               'required'],
+                                       '$dbdata'     => ['database-database',
+                                               L10n::t('Database Name'),
+                                               $configCache->get('database', 'database'),
+                                               '',
+                                               'required'],
+                                       '$lbl_10'     => L10n::t('Please select a default timezone for your website'),
+                                       '$php_path'   => $configCache->get('config', 'php_path'),
+                                       '$submit'     => L10n::t('Submit')
                                ]);
                                break;
 
@@ -256,34 +258,33 @@ class Install extends BaseModule
 
                                $tpl = Renderer::getMarkupTemplate('install_settings.tpl');
                                $output .= Renderer::replaceMacros($tpl, [
-                                       '$title'                => $install_title,
-                                       '$checks'               => self::$installer->getChecks(),
-                                       '$pass'                 => L10n::t('Site settings'),
-                                       '$hostname'     => $configCache->get('config', 'hostname'),
-                                       '$ssl_policy'   => $configCache->get('system', 'ssl_policy'),
-                                       '$basepath'     => $configCache->get('system', 'basepath'),
-                                       '$urlpath'      => $configCache->get('system', 'urlpath'),
-                                       '$dbhost'               => $configCache->get('database', 'hostname'),
-                                       '$dbuser'               => $configCache->get('database', 'username'),
-                                       '$dbpass'               => $configCache->get('database', 'password'),
-                                       '$dbdata'               => $configCache->get('database', 'database'),
-                                       '$adminmail'    => ['config-admin_email',
-                                                                               L10n::t('Site administrator email address'),
-                                                                               $configCache->get('config', 'admin_email'),
-                                                                               L10n::t('Your account email address must match this in order to use the web admin panel.'),
-                                                                               'required', 'autofocus', 'email'],
-                                       '$timezone'     => Temporal::getTimezoneField('system-default_timezone',
-                                                                               L10n::t('Please select a default timezone for your website'),
-                                                                               $configCache->get('system', 'default_timezone'),
-                                                                       ''),
-                                       '$language'     => ['system-language',
-                                                                               L10n::t('System Language:'),
-                                                                               $configCache->get('system', 'language'),
-                                                                               L10n::t('Set the default language for your Friendica installation interface and to send emails.'),
-                                                                               $lang_choices],
-                                       '$baseurl'              => $a->getBaseURL(),
-                                       '$php_path' => $configCache->get('config', 'php_path'),
-                                       '$submit'               => L10n::t('Submit')
+                                       '$title'      => $install_title,
+                                       '$checks'     => self::$installer->getChecks(),
+                                       '$pass'       => L10n::t('Site settings'),
+                                       '$hostname'   => $configCache->get('config', 'hostname'),
+                                       '$ssl_policy' => $configCache->get('system', 'ssl_policy'),
+                                       '$basepath'   => $configCache->get('system', 'basepath'),
+                                       '$urlpath'    => $configCache->get('system', 'urlpath'),
+                                       '$dbhost'     => $configCache->get('database', 'hostname'),
+                                       '$dbuser'     => $configCache->get('database', 'username'),
+                                       '$dbpass'     => $configCache->get('database', 'password'),
+                                       '$dbdata'     => $configCache->get('database', 'database'),
+                                       '$adminmail'  => ['config-admin_email',
+                                               L10n::t('Site administrator email address'),
+                                               $configCache->get('config', 'admin_email'),
+                                               L10n::t('Your account email address must match this in order to use the web admin panel.'),
+                                               'required', 'autofocus', 'email'],
+                                       '$timezone'   => Temporal::getTimezoneField('system-default_timezone',
+                                               L10n::t('Please select a default timezone for your website'),
+                                               $configCache->get('system', 'default_timezone'),
+                                               ''),
+                                       '$language'   => ['system-language',
+                                               L10n::t('System Language:'),
+                                               $configCache->get('system', 'language'),
+                                               L10n::t('Set the default language for your Friendica installation interface and to send emails.'),
+                                               $lang_choices],
+                                       '$php_path'   => $configCache->get('config', 'php_path'),
+                                       '$submit'     => L10n::t('Submit')
                                ]);
                                break;