@@ -38,8 +38,8 @@ discard block |
||
38 | 38 | 'roots' => [ |
39 | 39 | [ |
40 | 40 | 'driver' => 'LocalFileSystem', |
41 | - 'path' => root . '/upload/', |
|
42 | - 'URL' => App::$Alias->scriptUrl . '/upload/' |
|
41 | + 'path' => root.'/upload/', |
|
42 | + 'URL' => App::$Alias->scriptUrl.'/upload/' |
|
43 | 43 | ] |
44 | 44 | ] |
45 | 45 | ])); |
@@ -104,9 +104,9 @@ discard block |
||
104 | 104 | { |
105 | 105 | $this->setJsonHeader(); |
106 | 106 | // get ffcms news if cache is not available |
107 | - $cache = App::$Cache->getItem('download.ffcms.api.news.' . $this->lang); |
|
107 | + $cache = App::$Cache->getItem('download.ffcms.api.news.'.$this->lang); |
|
108 | 108 | if ($cache->isHit()) { |
109 | - $cache->set(File::getFromUrl('https://ffcms.org/api/api/news?lang=' . $this->lang)) |
|
109 | + $cache->set(File::getFromUrl('https://ffcms.org/api/api/news?lang='.$this->lang)) |
|
110 | 110 | ->expiresAfter(1440); |
111 | 111 | } |
112 | 112 | $news = $cache->get(); |
@@ -34,12 +34,12 @@ discard block |
||
34 | 34 | parent::before(); |
35 | 35 | $configs = AppRecord::getConfigs('app', 'Content'); |
36 | 36 | // prevent null-type config data |
37 | - if ((int)$configs['gallerySize'] > 0) { |
|
38 | - $this->maxSize = (int)$configs['gallerySize'] * 1024; |
|
37 | + if ((int) $configs['gallerySize'] > 0) { |
|
38 | + $this->maxSize = (int) $configs['gallerySize'] * 1024; |
|
39 | 39 | } |
40 | 40 | |
41 | - if ((int)$configs['galleryResize'] > 0) { |
|
42 | - $this->maxResize = (int)$configs['galleryResize']; |
|
41 | + if ((int) $configs['galleryResize'] > 0) { |
|
42 | + $this->maxResize = (int) $configs['galleryResize']; |
|
43 | 43 | } |
44 | 44 | } |
45 | 45 | |
@@ -119,8 +119,8 @@ discard block |
||
119 | 119 | } |
120 | 120 | |
121 | 121 | // check if directory exist |
122 | - if (!Directory::exist('/upload/gallery/' . $id)) { |
|
123 | - Directory::create('/upload/gallery/' . $id); |
|
122 | + if (!Directory::exist('/upload/gallery/'.$id)) { |
|
123 | + Directory::create('/upload/gallery/'.$id); |
|
124 | 124 | } |
125 | 125 | |
126 | 126 | // get file object |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | |
133 | 133 | // check file size |
134 | 134 | if ($file->getSize() < 1 || $file->getSize() > $this->maxSize) { |
135 | - throw new ForbiddenException(__('File size is too big. Max size: %size%kb', ['size' => (int)($this->maxSize/1024)])); |
|
135 | + throw new ForbiddenException(__('File size is too big. Max size: %size%kb', ['size' => (int) ($this->maxSize / 1024)])); |
|
136 | 136 | } |
137 | 137 | |
138 | 138 | // check file extension |
@@ -141,41 +141,41 @@ discard block |
||
141 | 141 | } |
142 | 142 | |
143 | 143 | // create origin directory |
144 | - $originPath = '/upload/gallery/' . $id . '/orig/'; |
|
144 | + $originPath = '/upload/gallery/'.$id.'/orig/'; |
|
145 | 145 | if (!Directory::exist($originPath)) { |
146 | 146 | Directory::create($originPath); |
147 | 147 | } |
148 | 148 | |
149 | 149 | // lets make a new file name |
150 | - $fileName = App::$Security->simpleHash($file->getClientOriginalName() . $file->getSize()); |
|
151 | - $fileNewName = $fileName . '.' . $file->guessExtension(); |
|
150 | + $fileName = App::$Security->simpleHash($file->getClientOriginalName().$file->getSize()); |
|
151 | + $fileNewName = $fileName.'.'.$file->guessExtension(); |
|
152 | 152 | // check if image is already loaded |
153 | - if (File::exist($originPath . $fileNewName)) { |
|
153 | + if (File::exist($originPath.$fileNewName)) { |
|
154 | 154 | throw new ForbiddenException(__('File is always exists!')); |
155 | 155 | } |
156 | 156 | // save file from tmp to gallery origin directory |
157 | 157 | $file->move(Normalize::diskFullPath($originPath), $fileNewName); |
158 | 158 | |
159 | 159 | // lets resize preview image for it |
160 | - $thumbPath = '/upload/gallery/' . $id . '/thumb/'; |
|
160 | + $thumbPath = '/upload/gallery/'.$id.'/thumb/'; |
|
161 | 161 | if (!Directory::exist($thumbPath)) { |
162 | 162 | Directory::create($thumbPath); |
163 | 163 | } |
164 | 164 | |
165 | 165 | $thumb = new Image(); |
166 | - $thumb->setCacheDir(root . '/Private/Cache/images'); |
|
166 | + $thumb->setCacheDir(root.'/Private/Cache/images'); |
|
167 | 167 | |
168 | 168 | // open original file, resize it and save |
169 | - $thumbSaveName = Normalize::diskFullPath($thumbPath) . '/' . $fileName . '.jpg'; |
|
170 | - $thumb->open(Normalize::diskFullPath($originPath) . DIRECTORY_SEPARATOR . $fileNewName) |
|
169 | + $thumbSaveName = Normalize::diskFullPath($thumbPath).'/'.$fileName.'.jpg'; |
|
170 | + $thumb->open(Normalize::diskFullPath($originPath).DIRECTORY_SEPARATOR.$fileNewName) |
|
171 | 171 | ->cropResize($this->maxResize) |
172 | 172 | ->save($thumbSaveName, 'jpg', 90); |
173 | 173 | $thumb = null; |
174 | 174 | |
175 | 175 | $this->setJsonHeader(); |
176 | 176 | return json_encode(['status' => 1, 'file' => [ |
177 | - 'thumbnailUrl' => '/upload/gallery/' . $id . '/thumb/' . $fileName . '.jpg', |
|
178 | - 'url' => '/upload/gallery/' . $id . '/orig/' . $fileNewName, |
|
177 | + 'thumbnailUrl' => '/upload/gallery/'.$id.'/thumb/'.$fileName.'.jpg', |
|
178 | + 'url' => '/upload/gallery/'.$id.'/orig/'.$fileNewName, |
|
179 | 179 | 'name' => $fileNewName |
180 | 180 | ]]); |
181 | 181 | } |
@@ -199,7 +199,7 @@ discard block |
||
199 | 199 | throw new NativeException('Permission denied'); |
200 | 200 | } |
201 | 201 | |
202 | - $thumbDir = Normalize::diskFullPath('/upload/gallery/' . $id . '/orig/'); |
|
202 | + $thumbDir = Normalize::diskFullPath('/upload/gallery/'.$id.'/orig/'); |
|
203 | 203 | if (!Directory::exist($thumbDir)) { |
204 | 204 | throw new NotFoundException('Nothing found'); |
205 | 205 | } |
@@ -214,10 +214,10 @@ discard block |
||
214 | 214 | $fileExt = Str::lastIn($file, '.'); |
215 | 215 | $fileName = Str::sub($file, 0, -Str::length($fileExt)); |
216 | 216 | $output[] = [ |
217 | - 'thumbnailUrl' => '/upload/gallery/' . $id . '/thumb/' . $fileName . '.jpg', |
|
218 | - 'url' => '/upload/gallery/' . $id . '/orig/' . $file, |
|
217 | + 'thumbnailUrl' => '/upload/gallery/'.$id.'/thumb/'.$fileName.'.jpg', |
|
218 | + 'url' => '/upload/gallery/'.$id.'/orig/'.$file, |
|
219 | 219 | 'name' => $file, |
220 | - 'size' => File::size('/upload/gallery/' . $id . '/orig/' . $file) |
|
220 | + 'size' => File::size('/upload/gallery/'.$id.'/orig/'.$file) |
|
221 | 221 | ]; |
222 | 222 | } |
223 | 223 | |
@@ -236,7 +236,7 @@ discard block |
||
236 | 236 | public function actionGallerydelete($id, $file = null) |
237 | 237 | { |
238 | 238 | if (!$file || Str::likeEmpty($file)) { |
239 | - $file = (string)$this->request->query->get('file', null); |
|
239 | + $file = (string) $this->request->query->get('file', null); |
|
240 | 240 | } |
241 | 241 | |
242 | 242 | // check passed data |
@@ -252,8 +252,8 @@ discard block |
||
252 | 252 | } |
253 | 253 | |
254 | 254 | // generate path |
255 | - $thumb = '/upload/gallery/' . $id . '/thumb/' . $fileName . '.jpg'; |
|
256 | - $full = '/upload/gallery/' . $id . '/orig/' . $file; |
|
255 | + $thumb = '/upload/gallery/'.$id.'/thumb/'.$fileName.'.jpg'; |
|
256 | + $full = '/upload/gallery/'.$id.'/orig/'.$file; |
|
257 | 257 | |
258 | 258 | // check if file exists and remove |
259 | 259 | if (File::exist($thumb) || File::exist($full)) { |
@@ -174,7 +174,7 @@ discard block |
||
174 | 174 | $answerTime = Date::convertToTimestamp($lastAnswer->created_at); |
175 | 175 | $cfgs = \Apps\ActiveRecord\App::getConfigs('app', 'Profile'); |
176 | 176 | // hmm, maybe past less then delay required? |
177 | - if ($now - (int)$cfgs['delayBetweenPost'] < $answerTime) { |
|
177 | + if ($now - (int) $cfgs['delayBetweenPost'] < $answerTime) { |
|
178 | 178 | throw new ForbiddenException('Delay between answers not pass'); |
179 | 179 | } |
180 | 180 | } |
@@ -189,7 +189,7 @@ discard block |
||
189 | 189 | // add notification for target user |
190 | 190 | if ($viewer->id !== $target_id) { |
191 | 191 | $notify = new EntityAddNotification($target_id); |
192 | - $notify->add('/profile/show/' . $target_id . '#wall-post-' . $wallRow->id, EntityAddNotification::MSG_ADD_WALLANSWER, [ |
|
192 | + $notify->add('/profile/show/'.$target_id.'#wall-post-'.$wallRow->id, EntityAddNotification::MSG_ADD_WALLANSWER, [ |
|
193 | 193 | 'snippet' => Text::snippet($message, 50), |
194 | 194 | 'post' => $wallRow->message |
195 | 195 | ]); |
@@ -298,7 +298,7 @@ discard block |
||
298 | 298 | // sender is not myself? then i'm - target (remote user is sender user->to_me) |
299 | 299 | if ($row->sender_id !== $user->id) { |
300 | 300 | $userList[] = $row->sender_id; |
301 | - if ((bool)$row->readed !== true) { |
|
301 | + if ((bool) $row->readed !== true) { |
|
302 | 302 | $unreadList[] = $row->sender_id; |
303 | 303 | } |
304 | 304 | } |
@@ -379,7 +379,7 @@ discard block |
||
379 | 379 | |
380 | 380 | // get special types for this action |
381 | 381 | $queryType = $this->request->get('type'); |
382 | - $queryId = (int)$this->request->get('id'); |
|
382 | + $queryId = (int) $this->request->get('id'); |
|
383 | 383 | // get current user object |
384 | 384 | $user = App::$User->identity(); |
385 | 385 | |
@@ -395,11 +395,11 @@ discard block |
||
395 | 395 | switch ($queryType) { |
396 | 396 | case 'after': |
397 | 397 | $messages = Message::where('id', '>', $queryId) |
398 | - ->where(function ($query) use ($cor_id, $user) { |
|
399 | - $query->where(function ($q) use ($cor_id, $user) { |
|
398 | + ->where(function($query) use ($cor_id, $user) { |
|
399 | + $query->where(function($q) use ($cor_id, $user) { |
|
400 | 400 | $q->where('target_id', '=', $user->getId()) |
401 | 401 | ->where('sender_id', '=', $cor_id); |
402 | - })->orWhere(function ($q) use ($cor_id, $user) { |
|
402 | + })->orWhere(function($q) use ($cor_id, $user) { |
|
403 | 403 | $q->where('target_id', '=', $cor_id) |
404 | 404 | ->where('sender_id', '=', $user->getId()); |
405 | 405 | }); |
@@ -407,21 +407,21 @@ discard block |
||
407 | 407 | break; |
408 | 408 | case 'before': |
409 | 409 | $messages = Message::where('id', '<', $queryId) |
410 | - ->where(function ($query) use ($cor_id, $user) { |
|
411 | - $query->where(function ($q) use ($cor_id, $user) { |
|
410 | + ->where(function($query) use ($cor_id, $user) { |
|
411 | + $query->where(function($q) use ($cor_id, $user) { |
|
412 | 412 | $q->where('target_id', '=', $user->getId()) |
413 | 413 | ->where('sender_id', '=', $cor_id); |
414 | - })->orWhere(function ($q) use ($cor_id, $user) { |
|
414 | + })->orWhere(function($q) use ($cor_id, $user) { |
|
415 | 415 | $q->where('target_id', '=', $cor_id) |
416 | 416 | ->where('sender_id', '=', $user->getId()); |
417 | 417 | }); |
418 | 418 | }); |
419 | 419 | break; |
420 | 420 | default: |
421 | - $messages = Message::where(function ($query) use ($cor_id, $user) { |
|
421 | + $messages = Message::where(function($query) use ($cor_id, $user) { |
|
422 | 422 | $query->where('target_id', '=', $user->getId()) |
423 | 423 | ->where('sender_id', '=', $cor_id); |
424 | - })->orWhere(function ($query) use ($cor_id, $user) { |
|
424 | + })->orWhere(function($query) use ($cor_id, $user) { |
|
425 | 425 | $query->where('target_id', '=', $cor_id) |
426 | 426 | ->where('sender_id', '=', $user->getId()); |
427 | 427 | }); |
@@ -452,7 +452,7 @@ discard block |
||
452 | 452 | ]; |
453 | 453 | |
454 | 454 | // update status to readed |
455 | - if ((bool)$msg->readed !== true && $msg->sender_id !== $user->id) { |
|
455 | + if ((bool) $msg->readed !== true && $msg->sender_id !== $user->id) { |
|
456 | 456 | $msg->readed = true; |
457 | 457 | $msg->save(); |
458 | 458 | } |
@@ -520,7 +520,7 @@ discard block |
||
520 | 520 | $this->setJsonHeader(); |
521 | 521 | |
522 | 522 | // get operation type and target user id |
523 | - $targetId = (int)$this->request->get('target'); |
|
523 | + $targetId = (int) $this->request->get('target'); |
|
524 | 524 | $type = $this->request->get('type'); |
525 | 525 | |
526 | 526 | // check type of query |
@@ -535,7 +535,7 @@ discard block |
||
535 | 535 | |
536 | 536 | $cfg = \Apps\ActiveRecord\App::getConfigs('app', 'Profile'); |
537 | 537 | // check if rating is enabled for website |
538 | - if (!(bool)$cfg['rating']) { |
|
538 | + if (!(bool) $cfg['rating']) { |
|
539 | 539 | throw new NativeException('Rating is disabled'); |
540 | 540 | } |
541 | 541 |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | $this->setJsonHeader(); |
34 | 34 | $configs = AppRecord::getConfigs('widget', 'Comments'); |
35 | 35 | |
36 | - $replayTo = (int)$this->request->request->get('replay-to'); |
|
36 | + $replayTo = (int) $this->request->request->get('replay-to'); |
|
37 | 37 | $model = null; |
38 | 38 | // check if its a answer (comment answer type) |
39 | 39 | if ($replayTo > 0) { |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | } |
46 | 46 | |
47 | 47 | // pass general comment params to model |
48 | - $model->message = App::$Security->secureHtml((string)$this->request->request->get('message')); |
|
48 | + $model->message = App::$Security->secureHtml((string) $this->request->request->get('message')); |
|
49 | 49 | $model->guestName = App::$Security->strip_tags($this->request->request->get('guest-name')); |
50 | 50 | |
51 | 51 | // check model conditions before add new row |
@@ -77,12 +77,12 @@ discard block |
||
77 | 77 | // get configs |
78 | 78 | $configs = AppRecord::getConfigs('widget', 'Comments'); |
79 | 79 | // items per page |
80 | - $perPage = (int)$configs['perPage']; |
|
80 | + $perPage = (int) $configs['perPage']; |
|
81 | 81 | // offset can be only integer |
82 | - $index = (int)$index; |
|
82 | + $index = (int) $index; |
|
83 | 83 | $offset = $perPage * $index; |
84 | 84 | // get comment target path and check |
85 | - $path = (string)$this->request->query->get('path'); |
|
85 | + $path = (string) $this->request->query->get('path'); |
|
86 | 86 | if (Str::likeEmpty($path)) { |
87 | 87 | throw new NotFoundException('Wrong path'); |
88 | 88 | } |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | ->where('moderate', '=', 0); |
93 | 93 | |
94 | 94 | // check if comments is depend of language locale |
95 | - if ((bool)$configs['onlyLocale'] === true) { |
|
95 | + if ((bool) $configs['onlyLocale'] === true) { |
|
96 | 96 | $query = $query->where('lang', '=', $this->request->getLanguage()); |
97 | 97 | } |
98 | 98 | |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | // calculate comments left count |
122 | 122 | $countQuery = CommentPost::where('pathway', '=', $path)->where('moderate', '=', 0); |
123 | 123 | // check if comments is depend of language locale |
124 | - if ((bool)$configs['onlyLocale'] === true) { |
|
124 | + if ((bool) $configs['onlyLocale'] === true) { |
|
125 | 125 | $countQuery = $countQuery->where('lang', '=', $this->request->getLanguage()); |
126 | 126 | } |
127 | 127 | $count = $countQuery->count(); |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | $records = CommentAnswer::with(['user', 'user.profile', 'user.role']) |
161 | 161 | ->where('comment_id', '=', $commentId) |
162 | 162 | ->where('moderate', '=', 0); |
163 | - if ((int)$configs['onlyLocale'] === 1) { |
|
163 | + if ((int) $configs['onlyLocale'] === 1) { |
|
164 | 164 | $records = $records->where('lang', '=', $this->request->getLanguage()); |
165 | 165 | } |
166 | 166 | |
@@ -205,11 +205,11 @@ discard block |
||
205 | 205 | foreach ($path as $id => $uri) { |
206 | 206 | $query = CommentPost::where('pathway', '=', $uri)->where('moderate', '=', 0); |
207 | 207 | // check if comments is depend of language locale |
208 | - if ((int)$configs['onlyLocale'] === 1) { |
|
208 | + if ((int) $configs['onlyLocale'] === 1) { |
|
209 | 209 | $query = $query->where('lang', '=', $this->request->getLanguage()); |
210 | 210 | } |
211 | 211 | // set itemId => count |
212 | - $count[(int)$id] = $query->count(); |
|
212 | + $count[(int) $id] = $query->count(); |
|
213 | 213 | } |
214 | 214 | // render json response |
215 | 215 | return json_encode(['status' => 1, 'count' => $count]); |
@@ -20,6 +20,6 @@ |
||
20 | 20 | |
21 | 21 | public function actionRead($id) |
22 | 22 | { |
23 | - echo "Action read called" . $id; |
|
23 | + echo "Action read called".$id; |
|
24 | 24 | } |
25 | 25 | } |
@@ -57,9 +57,9 @@ discard block |
||
57 | 57 | { |
58 | 58 | $path = $this->request->getPathWithoutControllerAction(); |
59 | 59 | $configs = $this->getConfigs(); |
60 | - $page = (int)$this->request->query->get('page', 0); |
|
61 | - $sort = (string)$this->request->query->get('sort', 'newest'); |
|
62 | - $itemCount = (int)$configs['itemPerCategory']; |
|
60 | + $page = (int) $this->request->query->get('page', 0); |
|
61 | + $sort = (string) $this->request->query->get('sort', 'newest'); |
|
62 | + $itemCount = (int) $configs['itemPerCategory']; |
|
63 | 63 | |
64 | 64 | // build special model with content list and category list information |
65 | 65 | $model = new EntityCategoryList($path, $configs, $page, $sort); |
@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | $model = new EntityContentRead($categoryRecord, $contentRecord->first()); |
140 | 140 | $search = null; |
141 | 141 | // check if similar search is enabled for item category |
142 | - if ((int)$model->getCategory()->getProperty('showSimilar') === 1 && $trash === false) { |
|
142 | + if ((int) $model->getCategory()->getProperty('showSimilar') === 1 && $trash === false) { |
|
143 | 143 | $search = new EntityContentSearch($model->title, $model->id, $model->getCategory()->id); |
144 | 144 | } |
145 | 145 | |
@@ -175,7 +175,7 @@ discard block |
||
175 | 175 | } |
176 | 176 | |
177 | 177 | // get equal rows order by creation date |
178 | - $records = ContentEntity::where('meta_keywords', 'like', '%' . $tagName . '%') |
|
178 | + $records = ContentEntity::where('meta_keywords', 'like', '%'.$tagName.'%') |
|
179 | 179 | ->orderBy('created_at', 'DESC') |
180 | 180 | ->take(self::TAG_PER_PAGE); |
181 | 181 | // check if result is not empty |
@@ -211,7 +211,7 @@ discard block |
||
211 | 211 | $this->layout = null; |
212 | 212 | |
213 | 213 | // check if rss display allowed for this category |
214 | - if ((int)$model->category['configs']['showRss'] !== 1) { |
|
214 | + if ((int) $model->category['configs']['showRss'] !== 1) { |
|
215 | 215 | throw new ForbiddenException(__('Rss feed is disabled for this category')); |
216 | 216 | } |
217 | 217 | |
@@ -225,7 +225,7 @@ discard block |
||
225 | 225 | // set channel data |
226 | 226 | $channel->title($model->category['title']) |
227 | 227 | ->description($model->category['description']) |
228 | - ->url(App::$Alias->baseUrl . '/content/list/' . $model->category['path']) |
|
228 | + ->url(App::$Alias->baseUrl.'/content/list/'.$model->category['path']) |
|
229 | 229 | ->appendTo($feed); |
230 | 230 | |
231 | 231 | // add content data |
@@ -235,10 +235,10 @@ discard block |
||
235 | 235 | // add title, short text, url |
236 | 236 | $item->title($row['title']) |
237 | 237 | ->description($row['text']) |
238 | - ->url(App::$Alias->baseUrl . $row['uri']); |
|
238 | + ->url(App::$Alias->baseUrl.$row['uri']); |
|
239 | 239 | // add poster |
240 | 240 | if ($row['thumb'] !== null) { |
241 | - $item->enclosure(App::$Alias->scriptUrl . $row['thumb'], $row['thumbSize'], 'image/jpeg'); |
|
241 | + $item->enclosure(App::$Alias->scriptUrl.$row['thumb'], $row['thumbSize'], 'image/jpeg'); |
|
242 | 242 | } |
243 | 243 | |
244 | 244 | // append response to channel |
@@ -272,12 +272,12 @@ discard block |
||
272 | 272 | |
273 | 273 | // check if user add enabled |
274 | 274 | $configs = $this->getConfigs(); |
275 | - if (!(bool)$configs['userAdd']) { |
|
275 | + if (!(bool) $configs['userAdd']) { |
|
276 | 276 | throw new NotFoundException(__('User add is disabled')); |
277 | 277 | } |
278 | 278 | |
279 | 279 | // prepare query |
280 | - $page = (int)$this->request->query->get('page', 0); |
|
280 | + $page = (int) $this->request->query->get('page', 0); |
|
281 | 281 | $offset = $page * 10; |
282 | 282 | $query = ContentRecord::where('author_id', '=', App::$User->identity()->getId()); |
283 | 283 | |
@@ -316,7 +316,7 @@ discard block |
||
316 | 316 | |
317 | 317 | // check if user add enabled |
318 | 318 | $configs = $this->getConfigs(); |
319 | - if (!(bool)$configs['userAdd']) { |
|
319 | + if (!(bool) $configs['userAdd']) { |
|
320 | 320 | throw new NotFoundException(__('User add is disabled')); |
321 | 321 | } |
322 | 322 | |
@@ -325,7 +325,7 @@ discard block |
||
325 | 325 | $new = $record->id === null; |
326 | 326 | |
327 | 327 | // reject edit published items and items from other authors |
328 | - if (($new === false && (int)$record->author_id !== App::$User->identity()->getId()) || (int)$record->display === 1) { |
|
328 | + if (($new === false && (int) $record->author_id !== App::$User->identity()->getId()) || (int) $record->display === 1) { |
|
329 | 329 | throw new ForbiddenException(__('You have no permissions to edit this content')); |
330 | 330 | } |
331 | 331 | |
@@ -370,10 +370,10 @@ discard block |
||
370 | 370 | } |
371 | 371 | |
372 | 372 | // build sitemap items using iteration - 5000 rows per each one |
373 | - $iterations = (int)($contentCount / static::SITEMAP_CONTENT_COUNT_ITERATION); |
|
373 | + $iterations = (int) ($contentCount / static::SITEMAP_CONTENT_COUNT_ITERATION); |
|
374 | 374 | for ($i = 0; $i <= $iterations; $i++) { |
375 | 375 | // check if lifetime is expired for current sitemap index |
376 | - $xmlTime = File::mTime('/upload/sitemap/content.' . $i . '.' . $langs[0] . '.xml'); |
|
376 | + $xmlTime = File::mTime('/upload/sitemap/content.'.$i.'.'.$langs[0].'.xml'); |
|
377 | 377 | $updateDelay = static::SITEMAP_UPDATE_DELAY * 60; |
378 | 378 | $updateDelay += mt_rand(0, 1800); // +- 0-30 rand min for caching update |
379 | 379 | // do not process if cache time is not expired |
@@ -391,7 +391,7 @@ discard block |
||
391 | 391 | $category = $content->getCategory(); |
392 | 392 | $uri = '/content/read/'; |
393 | 393 | if (!Str::likeEmpty($category->path)) { |
394 | - $uri .= $category->path . '/'; |
|
394 | + $uri .= $category->path.'/'; |
|
395 | 395 | } |
396 | 396 | $uri .= $content->path; |
397 | 397 | $sitemap->add($uri, $content->created_at, 'weekly', 0.7); |
@@ -399,13 +399,13 @@ discard block |
||
399 | 399 | // add categories |
400 | 400 | $categories = ContentCategory::all(); |
401 | 401 | foreach ($categories as $item) { |
402 | - if ((bool)$item->getProperty('showCategory')) { |
|
403 | - $uri = '/content/list/' . $item->path; |
|
402 | + if ((bool) $item->getProperty('showCategory')) { |
|
403 | + $uri = '/content/list/'.$item->path; |
|
404 | 404 | $sitemap->add($uri, date('c'), 'daily', 0.9); |
405 | 405 | } |
406 | 406 | } |
407 | 407 | // save data to xml file |
408 | - $sitemap->save('content.' . $i); |
|
408 | + $sitemap->save('content.'.$i); |
|
409 | 409 | } |
410 | 410 | } |
411 | 411 | } |
@@ -52,9 +52,9 @@ discard block |
||
52 | 52 | $records = null; |
53 | 53 | |
54 | 54 | // set current page and offset |
55 | - $page = (int)$this->request->query->get('page', 0); |
|
55 | + $page = (int) $this->request->query->get('page', 0); |
|
56 | 56 | $cfgs = $this->application->configs; |
57 | - $userPerPage = (int)$cfgs['usersOnPage']; |
|
57 | + $userPerPage = (int) $cfgs['usersOnPage']; |
|
58 | 58 | if ($userPerPage < 1) { |
59 | 59 | $userPerPage = 1; |
60 | 60 | } |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | switch ($name) { |
64 | 64 | case 'rating': // rating list, order by rating DESC |
65 | 65 | // check if rating is enabled |
66 | - if ((int)$cfgs['rating'] !== 1) { |
|
66 | + if ((int) $cfgs['rating'] !== 1) { |
|
67 | 67 | throw new NotFoundException(); |
68 | 68 | } |
69 | 69 | $records = (new ProfileRecords())->orderBy('rating', 'DESC'); |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | if (Str::likeEmpty($value)) { |
73 | 73 | throw new NotFoundException(); |
74 | 74 | } |
75 | - $records = (new ProfileRecords())->where('hobby', 'like', '%' . $value . '%'); |
|
75 | + $records = (new ProfileRecords())->where('hobby', 'like', '%'.$value.'%'); |
|
76 | 76 | break; |
77 | 77 | case 'city': |
78 | 78 | if (Str::likeEmpty($value)) { |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | if ($value === null || !Any::isInt($value)) { |
85 | 85 | throw new NotFoundException(); |
86 | 86 | } |
87 | - $records = (new ProfileRecords())->where('birthday', 'like', $value . '-%'); |
|
87 | + $records = (new ProfileRecords())->where('birthday', 'like', $value.'-%'); |
|
88 | 88 | break; |
89 | 89 | case 'all': |
90 | 90 | $records = (new ProfileRecords())->orderBy('id', 'DESC'); |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | 'pagination' => $pagination, |
115 | 115 | 'id' => $name, |
116 | 116 | 'add' => $value, |
117 | - 'ratingOn' => (int)$cfgs['rating'] |
|
117 | + 'ratingOn' => (int) $cfgs['rating'] |
|
118 | 118 | ]); |
119 | 119 | } |
120 | 120 | |
@@ -129,7 +129,7 @@ discard block |
||
129 | 129 | public function actionShow($userId) |
130 | 130 | { |
131 | 131 | $cfg = $this->application->configs; |
132 | - if (!(bool)$cfg['guestView'] && !App::$User->isAuth()) { |
|
132 | + if (!(bool) $cfg['guestView'] && !App::$User->isAuth()) { |
|
133 | 133 | throw new ForbiddenException(__('You must login to view other profile')); |
134 | 134 | } |
135 | 135 | |
@@ -152,7 +152,7 @@ discard block |
||
152 | 152 | App::$Session->getFlashBag()->add('error', __('This user are in your black list or you are in blacklist!')); |
153 | 153 | } else { |
154 | 154 | // check if message added |
155 | - if ($wallModel->makePost($targetPersone, $viewerPersone, (int)$cfg['delayBetweenPost'])) { |
|
155 | + if ($wallModel->makePost($targetPersone, $viewerPersone, (int) $cfg['delayBetweenPost'])) { |
|
156 | 156 | App::$Session->getFlashBag()->add('success', __('The message was successful posted!')); |
157 | 157 | } else { |
158 | 158 | App::$Session->getFlashBag()->add('warning', __('Posting message was failed! Please, wait few seconds')); |
@@ -162,8 +162,8 @@ discard block |
||
162 | 162 | } |
163 | 163 | |
164 | 164 | // pagination and query params |
165 | - $wallPage = (int)$this->request->query->get('page'); |
|
166 | - $wallItems = (int)$cfg['wallPostOnPage']; |
|
165 | + $wallPage = (int) $this->request->query->get('page'); |
|
166 | + $wallItems = (int) $cfg['wallPostOnPage']; |
|
167 | 167 | $wallOffset = $wallPage * $wallItems; |
168 | 168 | |
169 | 169 | // get wall posts by target user_id |
@@ -193,7 +193,7 @@ discard block |
||
193 | 193 | 'notify' => App::$Session->getFlashBag()->all(), |
194 | 194 | 'wallRecords' => $wallRecords, |
195 | 195 | 'pagination' => $wallPagination, |
196 | - 'ratingOn' => (int)$cfg['rating'] === 1 |
|
196 | + 'ratingOn' => (int) $cfg['rating'] === 1 |
|
197 | 197 | ]); |
198 | 198 | } |
199 | 199 | |
@@ -206,10 +206,10 @@ discard block |
||
206 | 206 | { |
207 | 207 | $cfg = $this->application->configs; |
208 | 208 | // get pagination page id and calc offset |
209 | - $page = (int)$this->request->query->get('page'); |
|
209 | + $page = (int) $this->request->query->get('page'); |
|
210 | 210 | $items = 10; |
211 | - if ((int)$cfg['wallPostOnFeed'] >= 1) { |
|
212 | - $items = (int)$cfg['wallPostOnFeed']; |
|
211 | + if ((int) $cfg['wallPostOnFeed'] >= 1) { |
|
212 | + $items = (int) $cfg['wallPostOnFeed']; |
|
213 | 213 | } |
214 | 214 | |
215 | 215 | $offset = $page * $items; |
@@ -307,7 +307,7 @@ discard block |
||
307 | 307 | $wallModel = new FormWallPostDelete($wallPost); |
308 | 308 | if ($wallModel->send() && $wallModel->validate()) { |
309 | 309 | $wallModel->make(); |
310 | - $this->response->redirect('profile/show/' . $wallPost->target_id); |
|
310 | + $this->response->redirect('profile/show/'.$wallPost->target_id); |
|
311 | 311 | } |
312 | 312 | |
313 | 313 | return $this->view->render('wall_delete', [ |
@@ -346,7 +346,7 @@ discard block |
||
346 | 346 | } |
347 | 347 | |
348 | 348 | // get page index and current user object |
349 | - $page = (int)$this->request->query->get('page', 0); |
|
349 | + $page = (int) $this->request->query->get('page', 0); |
|
350 | 350 | $offset = $page * static::NOTIFY_PER_PAGE; |
351 | 351 | $user = App::$User->identity(); |
352 | 352 | |
@@ -462,7 +462,7 @@ discard block |
||
462 | 462 | |
463 | 463 | // set user id from ?id= get param if form not sended |
464 | 464 | if (!$model->send()) { |
465 | - $uid = (int)$this->request->query->get('id'); |
|
465 | + $uid = (int) $this->request->query->get('id'); |
|
466 | 466 | if ($uid > 0) { |
467 | 467 | $model->id = $uid; |
468 | 468 | } |
@@ -480,7 +480,7 @@ discard block |
||
480 | 480 | // get blocked users |
481 | 481 | $query = Blacklist::where('user_id', '=', $user->getId()); |
482 | 482 | |
483 | - $page = (int)$this->request->query->get('page'); |
|
483 | + $page = (int) $this->request->query->get('page'); |
|
484 | 484 | $offset = $page * self::BLOCK_PER_PAGE; |
485 | 485 | |
486 | 486 | // build pagination |
@@ -590,9 +590,9 @@ discard block |
||
590 | 590 | // check if request is sended |
591 | 591 | if ($model->send() && $model->validate()) { |
592 | 592 | // get records from db |
593 | - $records = ProfileRecords::where('nick', 'like', '%' . $model->query . '%'); |
|
594 | - $page = (int)$this->request->query->get('page'); |
|
595 | - $userPerPage = (int)$cfgs['usersOnPage']; |
|
593 | + $records = ProfileRecords::where('nick', 'like', '%'.$model->query.'%'); |
|
594 | + $page = (int) $this->request->query->get('page'); |
|
595 | + $userPerPage = (int) $cfgs['usersOnPage']; |
|
596 | 596 | if ($userPerPage < 1) { |
597 | 597 | $userPerPage = 1; |
598 | 598 | } |
@@ -616,7 +616,7 @@ discard block |
||
616 | 616 | 'model' => $model, |
617 | 617 | 'records' => $records, |
618 | 618 | 'pagination' => $pagination, |
619 | - 'ratingOn' => (int)$cfgs['rating'] |
|
619 | + 'ratingOn' => (int) $cfgs['rating'] |
|
620 | 620 | ]); |
621 | 621 | } |
622 | 622 | |
@@ -640,7 +640,7 @@ discard block |
||
640 | 640 | // build sitemap from content items via business model |
641 | 641 | $sitemap = new EntityBuildMap($langs); |
642 | 642 | foreach ($profiles->get() as $user) { |
643 | - $sitemap->add('profile/show/' . $user->user_id, $user->updated_at, 'weekly', 0.2); |
|
643 | + $sitemap->add('profile/show/'.$user->user_id, $user->updated_at, 'weekly', 0.2); |
|
644 | 644 | } |
645 | 645 | |
646 | 646 | $sitemap->save('profile'); |
@@ -28,14 +28,14 @@ |
||
28 | 28 | public function actionIndex() |
29 | 29 | { |
30 | 30 | // get search query value from GET headers |
31 | - $query = (string)$this->request->query->get('query', null); |
|
31 | + $query = (string) $this->request->query->get('query', null); |
|
32 | 32 | // strip html tags |
33 | 33 | $query = App::$Security->strip_tags(trim($query)); |
34 | 34 | // get configs |
35 | 35 | $configs = $this->getConfigs(); |
36 | 36 | |
37 | 37 | // check search query length |
38 | - if (Str::likeEmpty($query) || Str::length($query) < (int)$configs['minLength']) { |
|
38 | + if (Str::likeEmpty($query) || Str::length($query) < (int) $configs['minLength']) { |
|
39 | 39 | throw new NotFoundException(__('Search query is too short!')); |
40 | 40 | } |
41 | 41 |
@@ -42,18 +42,18 @@ discard block |
||
42 | 42 | { |
43 | 43 | // get configs |
44 | 44 | $configs = $this->getConfigs(); |
45 | - if (!App::$User->isAuth() && !(bool)$configs['guestAdd']) { |
|
45 | + if (!App::$User->isAuth() && !(bool) $configs['guestAdd']) { |
|
46 | 46 | throw new ForbiddenException(__('Feedback available only for authorized users')); |
47 | 47 | } |
48 | 48 | |
49 | 49 | // initialize model |
50 | - $model = new FormFeedbackAdd((int)$configs['useCaptcha'] === 1); |
|
50 | + $model = new FormFeedbackAdd((int) $configs['useCaptcha'] === 1); |
|
51 | 51 | if ($model->send()) { |
52 | 52 | if ($model->validate()) { |
53 | 53 | // if validation is passed save data to db and get row |
54 | 54 | $record = $model->make(); |
55 | 55 | App::$Session->getFlashBag()->add('success', __('Your message was added successful')); |
56 | - $this->response->redirect('feedback/read/' . $record->id . '/' . $record->hash); |
|
56 | + $this->response->redirect('feedback/read/'.$record->id.'/'.$record->hash); |
|
57 | 57 | } else { |
58 | 58 | App::$Session->getFlashBag()->add('error', __('Message is not sended! Please, fix issues in form below')); |
59 | 59 | } |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | // render output view |
63 | 63 | return $this->view->render('create', [ |
64 | 64 | 'model' => $model, |
65 | - 'useCaptcha' => (int)$configs['useCaptcha'] === 1 |
|
65 | + 'useCaptcha' => (int) $configs['useCaptcha'] === 1 |
|
66 | 66 | ]); |
67 | 67 | } |
68 | 68 | |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | $userId = App::$User->isAuth() ? App::$User->identity()->getId() : 0; |
95 | 95 | $model = null; |
96 | 96 | // check if feedback post is not closed for answers |
97 | - if (!(bool)$recordPost->closed) { |
|
97 | + if (!(bool) $recordPost->closed) { |
|
98 | 98 | // init new answer add model |
99 | 99 | $model = new FormAnswerAdd($recordPost, $userId); |
100 | 100 | // if answer is sender lets try to make it model |
@@ -138,10 +138,10 @@ discard block |
||
138 | 138 | // check if action is submited |
139 | 139 | if ($this->request->request->get('closeRequest', false)) { |
140 | 140 | // if created by authorized user |
141 | - if ((int)$record->user_id !== 0) { |
|
141 | + if ((int) $record->user_id !== 0) { |
|
142 | 142 | $user = App::$User->identity(); |
143 | 143 | // button is pressed not by request creator |
144 | - if ($user === null || $user->getId() !== (int)$record->user_id) { |
|
144 | + if ($user === null || $user->getId() !== (int) $record->user_id) { |
|
145 | 145 | throw new ForbiddenException(__('This feedback request was created by another user')); |
146 | 146 | } |
147 | 147 | } |
@@ -152,7 +152,7 @@ discard block |
||
152 | 152 | |
153 | 153 | // add notification and redirect |
154 | 154 | App::$Session->getFlashBag()->add('warning', __('Feedback request now is closed!')); |
155 | - $this->response->redirect('feedback/read/' . $id . '/' . $hash); |
|
155 | + $this->response->redirect('feedback/read/'.$id.'/'.$hash); |
|
156 | 156 | } |
157 | 157 | |
158 | 158 | return $this->view->render('close'); |
@@ -168,7 +168,7 @@ discard block |
||
168 | 168 | public function actionList() |
169 | 169 | { |
170 | 170 | // set current page and offset |
171 | - $page = (int)$this->request->query->get('page'); |
|
171 | + $page = (int) $this->request->query->get('page'); |
|
172 | 172 | $offset = $page * self::ITEM_PER_PAGE; |
173 | 173 | |
174 | 174 | // check if user is authorized or throw exception |