diff options
author | ArthurHoaro <arthur@hoa.ro> | 2020-09-22 20:25:47 +0200 |
---|---|---|
committer | ArthurHoaro <arthur@hoa.ro> | 2020-11-09 10:56:24 +0100 |
commit | 53054b2bf6a919fd4ff9b44b6ad1986f21f488b6 (patch) | |
tree | 39cad52645ce00fbf863ff8e482d10dfcbe7f26c /application/front/controller/visitor/InstallController.php | |
parent | e09bb93e18a333eff8e6a4156f5b58ba9c7d25cd (diff) | |
download | Shaarli-53054b2bf6a919fd4ff9b44b6ad1986f21f488b6.tar.gz Shaarli-53054b2bf6a919fd4ff9b44b6ad1986f21f488b6.tar.zst Shaarli-53054b2bf6a919fd4ff9b44b6ad1986f21f488b6.zip |
Apply PHP Code Beautifier on source code for linter automatic fixes
Diffstat (limited to 'application/front/controller/visitor/InstallController.php')
-rw-r--r-- | application/front/controller/visitor/InstallController.php | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/application/front/controller/visitor/InstallController.php b/application/front/controller/visitor/InstallController.php index 22329294..bf965929 100644 --- a/application/front/controller/visitor/InstallController.php +++ b/application/front/controller/visitor/InstallController.php | |||
@@ -39,7 +39,8 @@ class InstallController extends ShaarliVisitorController | |||
39 | // Before installation, we'll make sure that permissions are set properly, and sessions are working. | 39 | // Before installation, we'll make sure that permissions are set properly, and sessions are working. |
40 | $this->checkPermissions(); | 40 | $this->checkPermissions(); |
41 | 41 | ||
42 | if (static::SESSION_TEST_VALUE | 42 | if ( |
43 | static::SESSION_TEST_VALUE | ||
43 | !== $this->container->sessionManager->getSessionParameter(static::SESSION_TEST_KEY) | 44 | !== $this->container->sessionManager->getSessionParameter(static::SESSION_TEST_KEY) |
44 | ) { | 45 | ) { |
45 | $this->container->sessionManager->setSessionParameter(static::SESSION_TEST_KEY, static::SESSION_TEST_VALUE); | 46 | $this->container->sessionManager->setSessionParameter(static::SESSION_TEST_KEY, static::SESSION_TEST_VALUE); |
@@ -75,17 +76,18 @@ class InstallController extends ShaarliVisitorController | |||
75 | // This part makes sure sessions works correctly. | 76 | // This part makes sure sessions works correctly. |
76 | // (Because on some hosts, session.save_path may not be set correctly, | 77 | // (Because on some hosts, session.save_path may not be set correctly, |
77 | // or we may not have write access to it.) | 78 | // or we may not have write access to it.) |
78 | if (static::SESSION_TEST_VALUE | 79 | if ( |
80 | static::SESSION_TEST_VALUE | ||
79 | !== $this->container->sessionManager->getSessionParameter(static::SESSION_TEST_KEY) | 81 | !== $this->container->sessionManager->getSessionParameter(static::SESSION_TEST_KEY) |
80 | ) { | 82 | ) { |
81 | // Step 2: Check if data in session is correct. | 83 | // Step 2: Check if data in session is correct. |
82 | $msg = t( | 84 | $msg = t( |
83 | '<pre>Sessions do not seem to work correctly on your server.<br>'. | 85 | '<pre>Sessions do not seem to work correctly on your server.<br>' . |
84 | 'Make sure the variable "session.save_path" is set correctly in your PHP config, '. | 86 | 'Make sure the variable "session.save_path" is set correctly in your PHP config, ' . |
85 | 'and that you have write access to it.<br>'. | 87 | 'and that you have write access to it.<br>' . |
86 | 'It currently points to %s.<br>'. | 88 | 'It currently points to %s.<br>' . |
87 | 'On some browsers, accessing your server via a hostname like \'localhost\' '. | 89 | 'On some browsers, accessing your server via a hostname like \'localhost\' ' . |
88 | 'or any custom hostname without a dot causes cookie storage to fail. '. | 90 | 'or any custom hostname without a dot causes cookie storage to fail. ' . |
89 | 'We recommend accessing your server via it\'s IP address or Fully Qualified Domain Name.<br>' | 91 | 'We recommend accessing your server via it\'s IP address or Fully Qualified Domain Name.<br>' |
90 | ); | 92 | ); |
91 | $msg = sprintf($msg, $this->container->sessionManager->getSavePath()); | 93 | $msg = sprintf($msg, $this->container->sessionManager->getSavePath()); |
@@ -104,7 +106,8 @@ class InstallController extends ShaarliVisitorController | |||
104 | public function save(Request $request, Response $response): Response | 106 | public function save(Request $request, Response $response): Response |
105 | { | 107 | { |
106 | $timezone = 'UTC'; | 108 | $timezone = 'UTC'; |
107 | if (!empty($request->getParam('continent')) | 109 | if ( |
110 | !empty($request->getParam('continent')) | ||
108 | && !empty($request->getParam('city')) | 111 | && !empty($request->getParam('city')) |
109 | && isTimeZoneValid($request->getParam('continent'), $request->getParam('city')) | 112 | && isTimeZoneValid($request->getParam('continent'), $request->getParam('city')) |
110 | ) { | 113 | ) { |
@@ -114,7 +117,7 @@ class InstallController extends ShaarliVisitorController | |||
114 | 117 | ||
115 | $login = $request->getParam('setlogin'); | 118 | $login = $request->getParam('setlogin'); |
116 | $this->container->conf->set('credentials.login', $login); | 119 | $this->container->conf->set('credentials.login', $login); |
117 | $salt = sha1(uniqid('', true) .'_'. mt_rand()); | 120 | $salt = sha1(uniqid('', true) . '_' . mt_rand()); |
118 | $this->container->conf->set('credentials.salt', $salt); | 121 | $this->container->conf->set('credentials.salt', $salt); |
119 | $this->container->conf->set('credentials.hash', sha1($request->getParam('setpassword') . $login . $salt)); | 122 | $this->container->conf->set('credentials.hash', sha1($request->getParam('setpassword') . $login . $salt)); |
120 | 123 | ||
@@ -123,7 +126,7 @@ class InstallController extends ShaarliVisitorController | |||
123 | } else { | 126 | } else { |
124 | $this->container->conf->set( | 127 | $this->container->conf->set( |
125 | 'general.title', | 128 | 'general.title', |
126 | 'Shared bookmarks on '.escape(index_url($this->container->environment)) | 129 | 'Shared bookmarks on ' . escape(index_url($this->container->environment)) |
127 | ); | 130 | ); |
128 | } | 131 | } |
129 | 132 | ||