Passed
Push — master ( 6042d7...377078 )
by Mihail
04:38
created
Apps/View/Admin/default/main/updates.php 1 patch
Braces   +5 added lines, -2 removed lines patch added patch discarded remove patch
@@ -56,7 +56,10 @@
 block discarded – undo
56 56
 
57 57
 <?php if($model->checkAll()): ?>
58 58
     <?= \Ffcms\Core\Helper\Url::link('main/install', __('Start install'), ['class' => 'btn btn-success btn-block']) ?>
59
-<?php else: ?>
59
+<?php else {
60
+    : ?>
60 61
     <?= \Ffcms\Core\Helper\Url::link('main/index', __('Check again'), ['class' => 'btn btn-warning btn-block']) ?>
61
-<?php endif; ?>
62
+<?php endif;
63
+}
64
+?>
62 65
 
Please login to merge, or discard this patch.
Apps/Model/Admin/Main/FormUpdateDatabase.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -40,9 +40,9 @@  discard block
 block discarded – undo
40 40
         foreach ($all as $file) {
41 41
             $file = Str::cleanExtension(basename($file));
42 42
             // $file="3.0.0-3.0.1" become to $start = 3.0.0,$end=3.0.1
43
-            list($start,$end) = explode('-', $file);
43
+            list($start, $end) = explode('-', $file);
44 44
             // true: start <= db & script >= $end
45
-            if (version_compare($this->dbVersion, $start) !== 1 &&  version_compare($this->scriptVersion, $end) !== -1) {
45
+            if (version_compare($this->dbVersion, $start) !== 1 && version_compare($this->scriptVersion, $end) !== -1) {
46 46
                 $this->updateQueries[] = $file;
47 47
             }
48 48
         }
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
     {
57 57
         // run update queries from included files
58 58
         foreach ($this->updateQueries as $file) {
59
-            @include root . '/Private/Database/Updates/' . $file . '.php';
59
+            @include root.'/Private/Database/Updates/'.$file.'.php';
60 60
         }
61 61
         // update version in db table
62 62
         $row = System::getVar('version');
Please login to merge, or discard this patch.
Apps/Model/Admin/Main/FormUpdateDownload.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -34,12 +34,12 @@
 block discarded – undo
34 34
      */
35 35
     public function make()
36 36
     {
37
-        $archive = $this->name . '.zip';
37
+        $archive = $this->name.'.zip';
38 38
         // download archive
39
-        File::saveFromUrl($this->url, '/' . $archive);
39
+        File::saveFromUrl($this->url, '/'.$archive);
40 40
         // extract archive
41 41
         $zip = new \ZipArchive();
42
-        if ($zip->open(root . '/' . $archive) === true) {
42
+        if ($zip->open(root.'/'.$archive) === true) {
43 43
             $zip->extractTo(root);
44 44
             $zip->close();
45 45
             // cleanup cache
Please login to merge, or discard this patch.
Apps/Controller/Console/Main.php 1 patch
Spacing   +37 added lines, -37 removed lines patch added patch discarded remove patch
@@ -27,20 +27,20 @@  discard block
 block discarded – undo
27 27
      */
28 28
     public function actionHelp()
29 29
     {
30
-        $text = "You are using FFCMS console application." . PHP_EOL;
31
-        $text .= "This application support next basic commands:" . PHP_EOL;
32
-        $text .= "\t main/info - show info about CMS" . PHP_EOL;
33
-        $text .= "\t main/install - install FFCMS from console line." . PHP_EOL;
34
-        $text .= "\t main/update - update package to current minor version if available." . PHP_EOL;
35
-        $text .= "\t main/chmod - update chmod for ffcms special folders. Can be used after project deployment." . PHP_EOL;
36
-        $text .= "\t main/buildperms - build and update permissions map for applications." . PHP_EOL;
37
-        $text .= "\t create/model workground/modelName - create model carcase default." . PHP_EOL;
38
-        $text .= "\t create/ar activeRecordName - create active record table and model." . PHP_EOL;
39
-        $text .= "\t create/controller workground/controllerName - create default controller carcase." . PHP_EOL;
40
-        $text .= "\t create/widget workground/widgetName/widgetName - create default widget carcase." . PHP_EOL;
41
-        $text .= "\t db/import activeRecordName - import to database single schema from ar model." . PHP_EOL;
42
-        $text .= "\t db/importAll - import all active record tables to database." . PHP_EOL;
43
-        $text .= "\t db/adduser - add new user into database." . PHP_EOL;
30
+        $text = "You are using FFCMS console application.".PHP_EOL;
31
+        $text .= "This application support next basic commands:".PHP_EOL;
32
+        $text .= "\t main/info - show info about CMS".PHP_EOL;
33
+        $text .= "\t main/install - install FFCMS from console line.".PHP_EOL;
34
+        $text .= "\t main/update - update package to current minor version if available.".PHP_EOL;
35
+        $text .= "\t main/chmod - update chmod for ffcms special folders. Can be used after project deployment.".PHP_EOL;
36
+        $text .= "\t main/buildperms - build and update permissions map for applications.".PHP_EOL;
37
+        $text .= "\t create/model workground/modelName - create model carcase default.".PHP_EOL;
38
+        $text .= "\t create/ar activeRecordName - create active record table and model.".PHP_EOL;
39
+        $text .= "\t create/controller workground/controllerName - create default controller carcase.".PHP_EOL;
40
+        $text .= "\t create/widget workground/widgetName/widgetName - create default widget carcase.".PHP_EOL;
41
+        $text .= "\t db/import activeRecordName - import to database single schema from ar model.".PHP_EOL;
42
+        $text .= "\t db/importAll - import all active record tables to database.".PHP_EOL;
43
+        $text .= "\t db/adduser - add new user into database.".PHP_EOL;
44 44
         return $text;
45 45
     }
46 46
 
@@ -50,17 +50,17 @@  discard block
 block discarded – undo
50 50
      */
51 51
     public function actionInfo()
52 52
     {
53
-        $text = "Information about FFCMS package and environment:" . PHP_EOL;
54
-        $text .= "\t PHP version: " . phpversion() . PHP_EOL;
55
-        $text .= "\t Dist path: " . root . PHP_EOL;
56
-        $text .= "\t Used version: " . Version::VERSION . ' [build: ' . Version::DATE . ']' . PHP_EOL;
57
-        $text .= "Information about FFCMS cmf packages:" . PHP_EOL;
53
+        $text = "Information about FFCMS package and environment:".PHP_EOL;
54
+        $text .= "\t PHP version: ".phpversion().PHP_EOL;
55
+        $text .= "\t Dist path: ".root.PHP_EOL;
56
+        $text .= "\t Used version: ".Version::VERSION.' [build: '.Version::DATE.']'.PHP_EOL;
57
+        $text .= "Information about FFCMS cmf packages:".PHP_EOL;
58 58
 
59 59
         $composerInfo = File::read('/composer.lock');
60 60
         if (false !== $composerInfo) {
61 61
             $jsonInfo = json_decode($composerInfo);
62 62
             foreach ($jsonInfo->packages as $item) {
63
-                $text .= "\t Package: " . $item->name . ' => ' . $item->version . PHP_EOL;
63
+                $text .= "\t Package: ".$item->name.' => '.$item->version.PHP_EOL;
64 64
             }
65 65
         } else {
66 66
             $text .= "\t Composer is never be used - no information available.";
@@ -96,16 +96,16 @@  discard block
 block discarded – undo
96 96
             preg_match_all('/public function action(\w*?)\(/', $byte, $matches); // matches[0] contains all methods ;)
97 97
             if (Obj::isArray($matches[1]) && count($matches[1]) > 0) {
98 98
                 foreach ($matches[1] as $perm) {
99
-                    $permissions[] = 'Admin/' . $className . '/' . $perm;
99
+                    $permissions[] = 'Admin/'.$className.'/'.$perm;
100 100
                 }
101 101
             }
102 102
         }
103 103
 
104 104
         // prepare save string
105
-        $stringSave = "<?php \n\nreturn " . var_export($permissions, true) . ';';
105
+        $stringSave = "<?php \n\nreturn ".var_export($permissions, true).';';
106 106
         File::write('/Private/Config/Permissions.php', $stringSave);
107 107
 
108
-        return 'Permissions configuration is successful updated! Founded permissions: ' . count($permissions);
108
+        return 'Permissions configuration is successful updated! Founded permissions: '.count($permissions);
109 109
     }
110 110
 
111 111
     /**
@@ -119,9 +119,9 @@  discard block
 block discarded – undo
119 119
             if (Directory::exist($obj)) {
120 120
                 Directory::recursiveChmod($obj, 0777);
121 121
             } elseif (File::exist($obj)) {
122
-                chmod(root . $obj, 0777);
122
+                chmod(root.$obj, 0777);
123 123
             } else {
124
-                $errors .= Console::$Output->write('Filesystem object is not founded: ' . $obj);
124
+                $errors .= Console::$Output->write('Filesystem object is not founded: '.$obj);
125 125
             }
126 126
         }
127 127
 
@@ -140,7 +140,7 @@  discard block
 block discarded – undo
140 140
         }
141 141
 
142 142
         echo Console::$Output->writeHeader('License start');
143
-        echo File::read('/LICENSE') . PHP_EOL;
143
+        echo File::read('/LICENSE').PHP_EOL;
144 144
         echo Console::$Output->writeHeader('License end');
145 145
 
146 146
         $config = Console::$Properties->get('database');
@@ -159,38 +159,38 @@  discard block
 block discarded – undo
159 159
 
160 160
         // database config from input
161 161
         echo Console::$Output->writeHeader('Database connection configuration');
162
-        echo 'Driver(default:' . $config['driver'] . '):';
162
+        echo 'Driver(default:'.$config['driver'].'):';
163 163
         $dbDriver = Console::$Input->read();
164 164
         if (Arr::in($dbDriver, ['mysql', 'pgsql', 'sqlite'])) {
165 165
             $newConfig['driver'] = $dbDriver;
166 166
         }
167 167
 
168 168
         // for sqlite its would be a path
169
-        echo 'Host(default:' . $config['host'] . '):';
169
+        echo 'Host(default:'.$config['host'].'):';
170 170
         $dbHost = Console::$Input->read();
171 171
         if (!Str::likeEmpty($dbHost)) {
172 172
             $newConfig['host'] = $dbHost;
173 173
         }
174 174
 
175
-        echo 'Database name(default:' . $config['database'] . '):';
175
+        echo 'Database name(default:'.$config['database'].'):';
176 176
         $dbName = Console::$Input->read();
177 177
         if (!Str::likeEmpty($dbName)) {
178 178
             $newConfig['database'] = $dbName;
179 179
         }
180 180
 
181
-        echo 'User(default:' . $config['username'] . '):';
181
+        echo 'User(default:'.$config['username'].'):';
182 182
         $dbUser = Console::$Input->read();
183 183
         if (!Str::likeEmpty($dbUser)) {
184 184
             $newConfig['username'] = $dbUser;
185 185
         }
186 186
 
187
-        echo 'Password(default:' . $config['password'] . '):';
187
+        echo 'Password(default:'.$config['password'].'):';
188 188
         $dbPwd = Console::$Input->read();
189 189
         if (!Str::likeEmpty($dbPwd)) {
190 190
             $newConfig['password'] = $dbPwd;
191 191
         }
192 192
 
193
-        echo 'Table prefix(default:' . $config['prefix'] . '):';
193
+        echo 'Table prefix(default:'.$config['prefix'].'):';
194 194
         $dbPrefix = Console::$Input->read();
195 195
         if (!Str::likeEmpty($dbPrefix)) {
196 196
             $newConfig['prefix'] = $dbPrefix;
@@ -203,11 +203,11 @@  discard block
 block discarded – undo
203 203
         try {
204 204
             Console::$Database->connection('install')->getDatabaseName();
205 205
         } catch (\Exception $e) {
206
-            return 'Testing database connection is failed! Run installer again and pass tested connection data! Log: ' . $e->getMessage();
206
+            return 'Testing database connection is failed! Run installer again and pass tested connection data! Log: '.$e->getMessage();
207 207
         }
208 208
 
209 209
         // autoload isn't work here
210
-        include(root . '/Apps/Controller/Console/Db.php');
210
+        include(root.'/Apps/Controller/Console/Db.php');
211 211
 
212 212
         // import db data
213 213
         $dbController = new DbController();
@@ -215,7 +215,7 @@  discard block
 block discarded – undo
215 215
 
216 216
         // set website send from email from input
217 217
         $emailConfig = Console::$Properties->get('adminEmail');
218
-        echo 'Website sendFrom email(default: ' . $emailConfig . '):';
218
+        echo 'Website sendFrom email(default: '.$emailConfig.'):';
219 219
         $email = Console::$Input->read();
220 220
         if (!Str::isEmail($email)) {
221 221
             $email = $emailConfig;
@@ -236,9 +236,9 @@  discard block
 block discarded – undo
236 236
         $allCfg['adminEmail'] = $email;
237 237
         $allCfg['baseDomain'] = $baseDomain;
238 238
         echo Console::$Output->write('Generate password salt for BLOWFISH crypt');
239
-        $allCfg['passwordSalt'] = '$2a$07$' . Str::randomLatinNumeric(mt_rand(21, 30)) . '$';
239
+        $allCfg['passwordSalt'] = '$2a$07$'.Str::randomLatinNumeric(mt_rand(21, 30)).'$';
240 240
         echo Console::$Output->write('Generate security cookies for debug panel');
241
-        $allCfg['debug']['cookie']['key'] = 'fdebug_' . Str::randomLatinNumeric(mt_rand(8, 32));
241
+        $allCfg['debug']['cookie']['key'] = 'fdebug_'.Str::randomLatinNumeric(mt_rand(8, 32));
242 242
         $allCfg['debug']['cookie']['value'] = Str::randomLatinNumeric(mt_rand(32, 128));
243 243
 
244 244
         // write config data
Please login to merge, or discard this patch.
Apps/Controller/Admin/Main.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -47,21 +47,21 @@  discard block
 block discarded – undo
47 47
         // cache some data
48 48
         $rootSize = App::$Cache->get('root.size');
49 49
         if ($rootSize === null) {
50
-            $rootSize = round(Directory::getSize('/') / (1024*1000), 2) . ' mb';
50
+            $rootSize = round(Directory::getSize('/') / (1024 * 1000), 2).' mb';
51 51
             App::$Cache->set('root.size', $rootSize, 86400); // 24 hours caching = 60 * 60 * 24
52 52
         }
53 53
         $loadAvg = App::$Cache->get('load.average');
54 54
         if ($loadAvg === null) {
55 55
             $loadAvg = Environment::loadAverage();
56
-            App::$Cache->set('load.average', $loadAvg, 60*5); // 5 min cache
56
+            App::$Cache->set('load.average', $loadAvg, 60 * 5); // 5 min cache
57 57
         }
58 58
 
59 59
         // prepare system statistic
60 60
         $stats = [
61
-            'ff_version' => Version::VERSION . ' (' . Version::DATE . ')',
62
-            'php_version' => Environment::phpVersion() . ' (' . Environment::phpSAPI() . ')',
61
+            'ff_version' => Version::VERSION.' ('.Version::DATE.')',
62
+            'php_version' => Environment::phpVersion().' ('.Environment::phpSAPI().')',
63 63
             'os_name' => Environment::osName(),
64
-            'database_name' => App::$Database->connection()->getDatabaseName() . ' (' . App::$Database->connection()->getDriverName() . ')',
64
+            'database_name' => App::$Database->connection()->getDatabaseName().' ('.App::$Database->connection()->getDriverName().')',
65 65
             'file_size' => $rootSize,
66 66
             'load_avg' => $loadAvg
67 67
         ];
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
     public function actionFiles()
114 114
     {
115 115
         return $this->view->render('files', [
116
-            'connector' => App::$Alias->scriptUrl . '/api/main/files?lang=' . $this->request->getLanguage()
116
+            'connector' => App::$Alias->scriptUrl.'/api/main/files?lang='.$this->request->getLanguage()
117 117
         ]);
118 118
     }
119 119
 
@@ -186,9 +186,9 @@  discard block
 block discarded – undo
186 186
      */
187 187
     public function actionDeleteroute()
188 188
     {
189
-        $type = (string)$this->request->query->get('type');
190
-        $loader = (string)$this->request->query->get('loader');
191
-        $source = Str::lowerCase((string)$this->request->query->get('path'));
189
+        $type = (string) $this->request->query->get('type');
190
+        $loader = (string) $this->request->query->get('loader');
191
+        $source = Str::lowerCase((string) $this->request->query->get('path'));
192 192
 
193 193
         $model = new EntityDeleteRoute($type, $loader, $source);
194 194
         if ($model->send() && $model->validate()) {
@@ -211,7 +211,7 @@  discard block
 block discarded – undo
211 211
     {
212 212
         $stats = App::$Cache->stats();
213 213
         // get size in mb from cache stats
214
-        $size = round((int)$stats['size'] / (1024*1024), 2);
214
+        $size = round((int) $stats['size'] / (1024 * 1024), 2);
215 215
 
216 216
         // check if submited
217 217
         if ($this->request->request->get('clearcache', false)) {
Please login to merge, or discard this patch.
Apps/Controller/Api/Api.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -38,7 +38,7 @@
 block discarded – undo
38 38
                 $data[] = [
39 39
                     'title' => App::$Translate->getLocaleText($item['title']),
40 40
                     'date' => Date::humanize($item['created_at']),
41
-                    'url' => 'https://ffcms.org/' . $this->request->getLanguage() . '/content/read/' . $item['cpath'] . '/' . $item['path'],
41
+                    'url' => 'https://ffcms.org/'.$this->request->getLanguage().'/content/read/'.$item['cpath'].'/'.$item['path'],
42 42
                     'snippet' => Text::snippet(App::$Translate->getLocaleText($item['text'], $this->request->getLanguage()))
43 43
                 ];
44 44
             }
Please login to merge, or discard this patch.
Private/Database/install.php 1 patch
Spacing   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -5,31 +5,31 @@
 block discarded – undo
5 5
 }
6 6
 
7 7
 // require all tables
8
-require_once(root . '/Private/Database/Tables/App.php');
9
-require_once(root . '/Private/Database/Tables/Blacklist.php');
10
-require_once(root . '/Private/Database/Tables/CommentAnswer.php');
11
-require_once(root . '/Private/Database/Tables/CommentPost.php');
12
-require_once(root . '/Private/Database/Tables/Content.php');
13
-require_once(root . '/Private/Database/Tables/ContentCategory.php');
14
-require_once(root . '/Private/Database/Tables/ContentRating.php');
15
-require_once(root . '/Private/Database/Tables/ContentTag.php');
16
-require_once(root . '/Private/Database/Tables/FeedbackAnswer.php');
17
-require_once(root . '/Private/Database/Tables/FeedbackPost.php');
18
-require_once(root . '/Private/Database/Tables/Invite.php');
19
-require_once(root . '/Private/Database/Tables/Message.php');
20
-require_once(root . '/Private/Database/Tables/Profile.php');
21
-require_once(root . '/Private/Database/Tables/ProfileField.php');
22
-require_once(root . '/Private/Database/Tables/ProfileRating.php');
23
-require_once(root . '/Private/Database/Tables/Role.php');
24
-require_once(root . '/Private/Database/Tables/Session.php');
25
-require_once(root . '/Private/Database/Tables/System.php');
26
-require_once(root . '/Private/Database/Tables/User.php');
27
-require_once(root . '/Private/Database/Tables/UserLog.php');
28
-require_once(root . '/Private/Database/Tables/UserNotification.php');
29
-require_once(root . '/Private/Database/Tables/UserProvider.php');
30
-require_once(root . '/Private/Database/Tables/UserRecovery.php');
31
-require_once(root . '/Private/Database/Tables/WallPost.php');
32
-require_once(root . '/Private/Database/Tables/WallAnswer.php');
8
+require_once(root.'/Private/Database/Tables/App.php');
9
+require_once(root.'/Private/Database/Tables/Blacklist.php');
10
+require_once(root.'/Private/Database/Tables/CommentAnswer.php');
11
+require_once(root.'/Private/Database/Tables/CommentPost.php');
12
+require_once(root.'/Private/Database/Tables/Content.php');
13
+require_once(root.'/Private/Database/Tables/ContentCategory.php');
14
+require_once(root.'/Private/Database/Tables/ContentRating.php');
15
+require_once(root.'/Private/Database/Tables/ContentTag.php');
16
+require_once(root.'/Private/Database/Tables/FeedbackAnswer.php');
17
+require_once(root.'/Private/Database/Tables/FeedbackPost.php');
18
+require_once(root.'/Private/Database/Tables/Invite.php');
19
+require_once(root.'/Private/Database/Tables/Message.php');
20
+require_once(root.'/Private/Database/Tables/Profile.php');
21
+require_once(root.'/Private/Database/Tables/ProfileField.php');
22
+require_once(root.'/Private/Database/Tables/ProfileRating.php');
23
+require_once(root.'/Private/Database/Tables/Role.php');
24
+require_once(root.'/Private/Database/Tables/Session.php');
25
+require_once(root.'/Private/Database/Tables/System.php');
26
+require_once(root.'/Private/Database/Tables/User.php');
27
+require_once(root.'/Private/Database/Tables/UserLog.php');
28
+require_once(root.'/Private/Database/Tables/UserNotification.php');
29
+require_once(root.'/Private/Database/Tables/UserProvider.php');
30
+require_once(root.'/Private/Database/Tables/UserRecovery.php');
31
+require_once(root.'/Private/Database/Tables/WallPost.php');
32
+require_once(root.'/Private/Database/Tables/WallAnswer.php');
33 33
 
34 34
 // use default preset (for none or other presets)
35
-require_once (root . '/Private/Database/Other/PresetDefault.php');
36 35
\ No newline at end of file
36
+require_once (root.'/Private/Database/Other/PresetDefault.php');
37 37
\ No newline at end of file
Please login to merge, or discard this patch.