Passed
Push — master ( 14d58a...6221c1 )
by Mihail
04:39
created
Apps/Model/Basic/Antivirus.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
         $this->beginTime = time();
34 34
 
35 35
         $this->signatures = new \DOMDocument();
36
-        $this->signatures->load(root . '/Private/Antivirus/Signatures.xml');
36
+        $this->signatures->load(root.'/Private/Antivirus/Signatures.xml');
37 37
 
38 38
         // list of files is not prepared, 1st iteration
39 39
         if (!File::exist('/Private/Antivirus/ScanFiles.json')) {
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
 
47 47
         $this->scanFiles = json_decode(File::read('/Private/Antivirus/ScanFiles.json'));
48 48
         if (File::exist('/Private/Antivirus/Infected.json')) {
49
-            $this->infected = (array)json_decode(File::read('/Private/Antivirus/Infected.json'));
49
+            $this->infected = (array) json_decode(File::read('/Private/Antivirus/Infected.json'));
50 50
         }
51 51
     }
52 52
 
@@ -108,13 +108,13 @@  discard block
 block discarded – undo
108 108
 
109 109
             switch ($attrFormat) {
110 110
                 case 're':
111
-                    if ((preg_match('#(' . $sigContent . ')#smi', $content, $found, PREG_OFFSET_CAPTURE)) ||
112
-                        (preg_match('#(' . $sigContent . ')#smi', $normalized, $found, PREG_OFFSET_CAPTURE))
111
+                    if ((preg_match('#('.$sigContent.')#smi', $content, $found, PREG_OFFSET_CAPTURE)) ||
112
+                        (preg_match('#('.$sigContent.')#smi', $normalized, $found, PREG_OFFSET_CAPTURE))
113 113
                     ) {
114 114
                         $detected = true;
115 115
                         $pos = $found[0][1];
116 116
                         $this->infected[$path][] = [
117
-                            'pos' => (int)$pos,
117
+                            'pos' => (int) $pos,
118 118
                             'sigId' => $attrId,
119 119
                             'sigRule' => $sigContent,
120 120
                             'sever' => $attrSever,
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
                         (($pos = strpos($normalized, $sigContent)) !== false)
129 129
                     ) {
130 130
                         $this->infected[$path][] = [
131
-                            'pos' => (int)$pos,
131
+                            'pos' => (int) $pos,
132 132
                             'sigId' => $attrId,
133 133
                             'sigRule' => $sigContent,
134 134
                             'sever' => $attrSever,
@@ -148,7 +148,7 @@  discard block
 block discarded – undo
148 148
      */
149 149
     private function prepareScanlist()
150 150
     {
151
-        $files = (object)File::listFiles(root, $this->affectedExt);
151
+        $files = (object) File::listFiles(root, $this->affectedExt);
152 152
         File::write('/Private/Antivirus/ScanFiles.json', json_encode($files));
153 153
     }
154 154
 
Please login to merge, or discard this patch.
Apps/Model/Install/Main/FormInstall.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -71,14 +71,14 @@
 block discarded – undo
71 71
         $cfg['database'] = $this->db;
72 72
         $cfg['adminEmail'] = $this->email;
73 73
         $cfg['singleLanguage'] = $this->singleLanguage;
74
-        $cfg['multiLanguage'] = (bool)$this->multiLanguage;
75
-        $cfg['passwordSalt'] = '$2a$07$' . Str::randomLatinNumeric(mt_rand(21, 30)) . '$';
76
-        $cfg['debug']['cookie']['key'] = 'fdebug_' . Str::randomLatinNumeric(mt_rand(4, 16));
74
+        $cfg['multiLanguage'] = (bool) $this->multiLanguage;
75
+        $cfg['passwordSalt'] = '$2a$07$'.Str::randomLatinNumeric(mt_rand(21, 30)).'$';
76
+        $cfg['debug']['cookie']['key'] = 'fdebug_'.Str::randomLatinNumeric(mt_rand(4, 16));
77 77
         $cfg['debug']['cookie']['value'] = Str::randomLatinNumeric(mt_rand(32, 128));
78 78
 
79 79
         // import database tables
80 80
         $connectName = 'install';
81
-        include(root . '/Private/Database/install.php');
81
+        include(root.'/Private/Database/install.php');
82 82
 
83 83
         // insert admin user
84 84
         $user = new User();
Please login to merge, or discard this patch.
Apps/Controller/Admin/Main.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -32,20 +32,20 @@  discard block
 block discarded – undo
32 32
         // cache some data
33 33
         $rootSize = App::$Cache->get('root.size');
34 34
         if ($rootSize === null) {
35
-            $rootSize = round(Directory::getSize('/') / (1024*1000), 2) . ' mb';
35
+            $rootSize = round(Directory::getSize('/') / (1024 * 1000), 2).' mb';
36 36
             App::$Cache->set('root.size', $rootSize, 60 * 60 * 24); // 24 hours caching
37 37
         }
38 38
         $loadAvg = App::$Cache->get('load.average');
39 39
         if ($loadAvg === null) {
40 40
             $loadAvg = Environment::loadAverage();
41
-            App::$Cache->set('load.average', $loadAvg, 60*5); // 5 min cache
41
+            App::$Cache->set('load.average', $loadAvg, 60 * 5); // 5 min cache
42 42
         }
43 43
 
44 44
         $stats = [
45
-            'ff_version' => App::$Properties->version['num'] . ' (' . App::$Properties->version['date'] . ')',
46
-            'php_version' => Environment::phpVersion() . ' (' . Environment::phpSAPI() . ')',
45
+            'ff_version' => App::$Properties->version['num'].' ('.App::$Properties->version['date'].')',
46
+            'php_version' => Environment::phpVersion().' ('.Environment::phpSAPI().')',
47 47
             'os_name' => Environment::osName(),
48
-            'database_name' => App::$Database->connection()->getDatabaseName() . ' (' . App::$Database->connection()->getDriverName() . ')',
48
+            'database_name' => App::$Database->connection()->getDatabaseName().' ('.App::$Database->connection()->getDriverName().')',
49 49
             'file_size' => $rootSize,
50 50
             'load_avg' => $loadAvg
51 51
         ];
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
     public function actionFiles()
87 87
     {
88 88
         return App::$View->render('files', [
89
-            'connector' => App::$Alias->scriptUrl . '/api/main/files?lang=' . App::$Request->getLanguage()
89
+            'connector' => App::$Alias->scriptUrl.'/api/main/files?lang='.App::$Request->getLanguage()
90 90
         ]);
91 91
     }
92 92
 
@@ -145,9 +145,9 @@  discard block
 block discarded – undo
145 145
      */
146 146
     public function actionDeleteroute()
147 147
     {
148
-        $type = (string)App::$Request->query->get('type');
149
-        $loader = (string)App::$Request->query->get('loader');
150
-        $source = Str::lowerCase((string)App::$Request->query->get('path'));
148
+        $type = (string) App::$Request->query->get('type');
149
+        $loader = (string) App::$Request->query->get('loader');
150
+        $source = Str::lowerCase((string) App::$Request->query->get('path'));
151 151
 
152 152
         $model = new EntityDeleteRoute($type, $loader, $source);
153 153
         if ($model->send()) {
Please login to merge, or discard this patch.
Apps/Controller/Admin/Feedback.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
     public function actionIndex()
33 33
     {
34 34
         // set current page and offset
35
-        $page = (int)App::$Request->query->get('page');
35
+        $page = (int) App::$Request->query->get('page');
36 36
         $offset = $page * self::ITEM_PER_PAGE;
37 37
 
38 38
         // get feedback posts AR table
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
 
74 74
         // initialize model with answer add if thread is not closed
75 75
         $model = null;
76
-        if ((int)$record->closed !== 1) {
76
+        if ((int) $record->closed !== 1) {
77 77
             $model = new FormAnswerAdd($record, App::$User->identity()->getId());
78 78
             if ($model->send()) {
79 79
                 if ($model->validate()) {
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
             case 'answer':
105 105
                 $record = FeedbackAnswer::find($id);
106 106
                 if ($record !== null && $record !== false) {
107
-                    $postId = (int)$record->getFeedbackPost()->id;
107
+                    $postId = (int) $record->getFeedbackPost()->id;
108 108
                 }
109 109
                 break;
110 110
         }
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
             if ($model->validate()) {
121 121
                 $model->make();
122 122
                 App::$Session->getFlashBag()->add('success', __('Feedback item are successful changed'));
123
-                App::$Response->redirect('feedback/read/' . $postId);
123
+                App::$Response->redirect('feedback/read/'.$postId);
124 124
             } else {
125 125
                 App::$Session->getFlashBag()->add('danger', __('Updating is failed'));
126 126
             }
@@ -170,7 +170,7 @@  discard block
 block discarded – undo
170 170
         App::$Session->getFlashBag()->add('success', __('Feedback request is changed!'));
171 171
 
172 172
         // redirect to feedback post read
173
-        App::$Response->redirect('feedback/read/' . $id);
173
+        App::$Response->redirect('feedback/read/'.$id);
174 174
         return null;
175 175
     }
176 176
 
@@ -214,7 +214,7 @@  discard block
 block discarded – undo
214 214
                 // its a answer, lets remove it and redirect back in post
215 215
                 $postId = $record->feedback_id;
216 216
                 $record->delete();
217
-                App::$Response->redirect('feedback/read/' . $postId);
217
+                App::$Response->redirect('feedback/read/'.$postId);
218 218
             }
219 219
         }
220 220
 
Please login to merge, or discard this patch.
Apps/Controller/Admin/Profile.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
         $query = new ProfileRecords();
33 33
 
34 34
         // set current page and offset
35
-        $page = (int)App::$Request->query->get('page');
35
+        $page = (int) App::$Request->query->get('page');
36 36
         $offset = $page * self::ITEM_PER_PAGE;
37 37
 
38 38
         // build pagination
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
      */
60 60
     public function actionDelete($id)
61 61
     {
62
-        App::$Response->redirect('user/delete/' . $id);
62
+        App::$Response->redirect('user/delete/'.$id);
63 63
     }
64 64
 
65 65
     /**
Please login to merge, or discard this patch.
Apps/Controller/Admin/Content.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
     public function actionIndex()
39 39
     {
40 40
         // set current page and offset
41
-        $page = (int)App::$Request->query->get('page');
41
+        $page = (int) App::$Request->query->get('page');
42 42
         $offset = $page * self::ITEM_PER_PAGE;
43 43
 
44 44
         $query = null;
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
         if ($type === 'trash') {
48 48
             $query = ContentEntity::onlyTrashed();
49 49
         } elseif (Obj::isLikeInt($type)) { // sounds like category id ;)
50
-            $query = ContentEntity::where('category_id', '=', (int)$type);
50
+            $query = ContentEntity::where('category_id', '=', (int) $type);
51 51
         } else {
52 52
             $query = new ContentEntity();
53 53
             $type = 'all';
@@ -193,7 +193,7 @@  discard block
 block discarded – undo
193 193
         if ($model->send() && $model->validate()) {
194 194
             // remove all trashed items
195 195
             foreach ($records->get() as $item) {
196
-                $galleryPath = '/upload/gallery/' . (int)$item->id;
196
+                $galleryPath = '/upload/gallery/'.(int) $item->id;
197 197
                 if (Directory::exist($galleryPath)) {
198 198
                     Directory::remove($galleryPath);
199 199
                 }
@@ -265,7 +265,7 @@  discard block
 block discarded – undo
265 265
     public function actionCategoryupdate($id = null)
266 266
     {
267 267
         // get owner id for new rows
268
-        $parentId = (int)App::$Request->query->get('parent');
268
+        $parentId = (int) App::$Request->query->get('parent');
269 269
 
270 270
         // get relation and pass to model
271 271
         $record = ContentCategory::findOrNew($id);
Please login to merge, or discard this patch.
Apps/Controller/Front/Main.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -25,6 +25,6 @@
 block discarded – undo
25 25
 
26 26
     public function actionRead($id)
27 27
     {
28
-        echo "Action read called" . $id;
28
+        echo "Action read called".$id;
29 29
     }
30 30
 }
31 31
\ No newline at end of file
Please login to merge, or discard this patch.
Apps/Controller/Front/Feedback.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -40,19 +40,19 @@  discard block
 block discarded – undo
40 40
     {
41 41
         // get configs
42 42
         $configs = $this->getConfigs();
43
-        if (!App::$User->isAuth() && (int)$configs['guestAdd'] !== 1) {
43
+        if (!App::$User->isAuth() && (int) $configs['guestAdd'] !== 1) {
44 44
             throw new ForbiddenException(__('Feedback available only for authorized users'));
45 45
         }
46 46
 
47 47
         // initialize model
48
-        $model = new FormFeedbackAdd((int)$configs['useCaptcha'] === 1);
48
+        $model = new FormFeedbackAdd((int) $configs['useCaptcha'] === 1);
49 49
         if ($model->send()) {
50 50
             if ($model->validate()) {
51 51
                 // if validation is passed save data to db and get row
52 52
                 $record = $model->make();
53 53
                 App::$Session->getFlashBag()->add('success', __('Your message was added successful'));
54 54
                 // todo: add email notification
55
-                App::$Response->redirect('feedback/read/' . $record->id . '/' . $record->hash);
55
+                App::$Response->redirect('feedback/read/'.$record->id.'/'.$record->hash);
56 56
             } else {
57 57
                 App::$Session->getFlashBag()->add('error', __('Message is not sended! Please, fix issues in form below'));
58 58
             }
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
         // render output view
62 62
         return App::$View->render('create', [
63 63
             'model' => $model->export(),
64
-            'useCaptcha' => (int)$configs['useCaptcha'] === 1
64
+            'useCaptcha' => (int) $configs['useCaptcha'] === 1
65 65
         ]);
66 66
     }
67 67
 
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
         $userId = App::$User->isAuth() ? App::$User->identity()->getId() : 0;
93 93
         $model = null;
94 94
         // check if feedback post is not closed for answers
95
-        if ((int)$recordPost->closed === 0) {
95
+        if ((int) $recordPost->closed === 0) {
96 96
             // init new answer add model
97 97
             $model = new FormAnswerAdd($recordPost, $userId);
98 98
             // if answer is sender lets try to make it model
@@ -127,10 +127,10 @@  discard block
 block discarded – undo
127 127
         // check if action is submited
128 128
         if (App::$Request->request->get('closeRequest', false)) {
129 129
             // if created by authorized user
130
-            if ((int)$record->user_id !== 0) {
130
+            if ((int) $record->user_id !== 0) {
131 131
                 $user = App::$User->identity();
132 132
                 // button is pressed not by request creator
133
-                if ($user === null || $user->getId() !== (int)$record->user_id) {
133
+                if ($user === null || $user->getId() !== (int) $record->user_id) {
134 134
                     throw new ForbiddenException(__('This feedback request was created by another user'));
135 135
                 }
136 136
             }
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
 
142 142
             // add notification and redirect
143 143
             App::$Session->getFlashBag()->add('warning', __('Feedback request now is closed!'));
144
-            App::$Response->redirect('feedback/read/' . $id . '/' . $hash);
144
+            App::$Response->redirect('feedback/read/'.$id.'/'.$hash);
145 145
         }
146 146
 
147 147
         return App::$View->render('close');
@@ -156,7 +156,7 @@  discard block
 block discarded – undo
156 156
     public function actionList()
157 157
     {
158 158
         // set current page and offset
159
-        $page = (int)App::$Request->query->get('page');
159
+        $page = (int) App::$Request->query->get('page');
160 160
         $offset = $page * self::ITEM_PER_PAGE;
161 161
 
162 162
         // check if user is authorized or throw exception
Please login to merge, or discard this patch.
Apps/Controller/Front/Profile.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -36,9 +36,9 @@  discard block
 block discarded – undo
36 36
         $records = null;
37 37
 
38 38
         // set current page and offset
39
-        $page = (int)App::$Request->query->get('page');
39
+        $page = (int) App::$Request->query->get('page');
40 40
         $cfgs = Serialize::decode($this->application->configs);
41
-        $userPerPage = (int)$cfgs['usersOnPage'];
41
+        $userPerPage = (int) $cfgs['usersOnPage'];
42 42
         if ($userPerPage < 1) {
43 43
             $userPerPage = 1;
44 44
         }
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
         switch ($filter_name) {
48 48
             case 'rating': // rating list, order by rating DESC
49 49
                 // check if rating is enabled
50
-                if ((int)$cfgs['rating'] !== 1) {
50
+                if ((int) $cfgs['rating'] !== 1) {
51 51
                     throw new NotFoundException();
52 52
                 }
53 53
                 $records = (new ProfileRecords())->orderBy('rating', 'DESC');
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
                 if (Str::likeEmpty($filter_value)) {
57 57
                     throw new NotFoundException();
58 58
                 }
59
-                $records = (new ProfileRecords())->where('hobby', 'like', '%' . $filter_value . '%');
59
+                $records = (new ProfileRecords())->where('hobby', 'like', '%'.$filter_value.'%');
60 60
                 break;
61 61
             case 'city':
62 62
                 if (Str::likeEmpty($filter_value)) {
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
                 if ($filter_value === null || !Obj::isLikeInt($filter_value)) {
69 69
                     throw new NotFoundException();
70 70
                 }
71
-                $records = (new ProfileRecords())->where('birthday', 'like', $filter_value . '-%');
71
+                $records = (new ProfileRecords())->where('birthday', 'like', $filter_value.'-%');
72 72
                 break;
73 73
             case 'all':
74 74
                 $records = (new ProfileRecords())->orderBy('id', 'DESC');
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
             'pagination' => $pagination,
92 92
             'id' => $filter_name,
93 93
             'add' => $filter_value,
94
-            'ratingOn' => (int)$cfgs['rating']
94
+            'ratingOn' => (int) $cfgs['rating']
95 95
         ]);
96 96
     }
97 97
 
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
     public function actionShow($userId)
105 105
     {
106 106
         $cfg = Serialize::decode($this->application->configs);
107
-        if ((int)$cfg['guestView'] !== 1 && !App::$User->isAuth()) {
107
+        if ((int) $cfg['guestView'] !== 1 && !App::$User->isAuth()) {
108 108
             throw new ForbiddenException('You must be registered user to view other profile');
109 109
         }
110 110
         // check if target exists
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
                     App::$Session->getFlashBag()->add('error', __('This user are in your black list or you are in blacklist!'));
127 127
                 } else {
128 128
                     // check if message added
129
-                    if ($wallModel->makePost($targetPersone, $viewerPersone, (int)$cfg['delayBetweenPost'])) {
129
+                    if ($wallModel->makePost($targetPersone, $viewerPersone, (int) $cfg['delayBetweenPost'])) {
130 130
                         App::$Session->getFlashBag()->add('success', __('The message was successful posted!'));
131 131
                     } else {
132 132
                         App::$Session->getFlashBag()->add('warning', __('Posting message was failed! You need to wait some time...'));
@@ -137,8 +137,8 @@  discard block
 block discarded – undo
137 137
 
138 138
         $query = $targetPersone->getWall(); // relation hasMany from users to walls
139 139
         // pagination and query params
140
-        $wallPage = (int)App::$Request->query->get('page');
141
-        $wallItems = (int)$cfg['wallPostOnPage'];
140
+        $wallPage = (int) App::$Request->query->get('page');
141
+        $wallItems = (int) $cfg['wallPostOnPage'];
142 142
         $wallOffset = $wallPage * $wallItems;
143 143
 
144 144
         // build pagination
@@ -160,7 +160,7 @@  discard block
 block discarded – undo
160 160
             'notify' => App::$Session->getFlashBag()->all(),
161 161
             'wallRecords' => $wallRecords,
162 162
             'pagination' => $wallPagination,
163
-            'ratingOn' => (int)$cfg['rating'] === 1
163
+            'ratingOn' => (int) $cfg['rating'] === 1
164 164
         ]);
165 165
     }
166 166
 
@@ -227,7 +227,7 @@  discard block
 block discarded – undo
227 227
         $wallModel = new FormWallPostDelete($wallPost);
228 228
         if ($wallModel->send() && $wallModel->validate()) {
229 229
             $wallModel->make();
230
-            App::$Response->redirect('profile/show/' . $wallPost->target_id);
230
+            App::$Response->redirect('profile/show/'.$wallPost->target_id);
231 231
         }
232 232
 
233 233
         return App::$View->render('wall_delete', [
@@ -320,7 +320,7 @@  discard block
 block discarded – undo
320 320
 
321 321
         // set user id from ?id= get param if form not sended
322 322
         if (!$model->send()) {
323
-            $uid = (int)App::$Request->query->get('id');
323
+            $uid = (int) App::$Request->query->get('id');
324 324
             if ($uid > 0) {
325 325
                 $model->id = $uid;
326 326
             }
@@ -338,7 +338,7 @@  discard block
 block discarded – undo
338 338
         // get blocked users
339 339
         $records = Blacklist::where('user_id', '=', $user->getId());
340 340
 
341
-        $page = (int)App::$Request->query->get('page');
341
+        $page = (int) App::$Request->query->get('page');
342 342
         $offset = $page * self::BLOCK_PER_PAGE;
343 343
 
344 344
         // build pagination
@@ -410,9 +410,9 @@  discard block
 block discarded – undo
410 410
         // check if request is sended
411 411
         if ($model->send() && $model->validate()) {
412 412
             // get records from db
413
-            $records = ProfileRecords::where('nick', 'like', '%' . $model->query . '%');
414
-            $page = (int)App::$Request->query->get('page');
415
-            $userPerPage = (int)$cfgs['usersOnPage'];
413
+            $records = ProfileRecords::where('nick', 'like', '%'.$model->query.'%');
414
+            $page = (int) App::$Request->query->get('page');
415
+            $userPerPage = (int) $cfgs['usersOnPage'];
416 416
             if ($userPerPage < 1) {
417 417
                 $userPerPage = 1;
418 418
             }
@@ -434,7 +434,7 @@  discard block
 block discarded – undo
434 434
             'model' => $model->export(),
435 435
             'records' => $records,
436 436
             'pagination' => $pagination,
437
-            'ratingOn' => (int)$cfgs['rating']
437
+            'ratingOn' => (int) $cfgs['rating']
438 438
         ]);
439 439
     }
440 440
 }
441 441
\ No newline at end of file
Please login to merge, or discard this patch.