@@ -5,7 +5,6 @@ |
||
5 | 5 | use Ffcms\Core\App as MainApp; |
6 | 6 | use Ffcms\Core\Arch\ActiveModel; |
7 | 7 | use Ffcms\Core\Helper\Type\Arr; |
8 | -use Ffcms\Core\Helper\Type\Str; |
|
9 | 8 | |
10 | 9 | class Role extends ActiveModel |
11 | 10 | { |
@@ -26,12 +26,12 @@ |
||
26 | 26 | */ |
27 | 27 | public static function get($role_id) |
28 | 28 | { |
29 | - $role = MainApp::$Memory->get('user.role.cache.' . $role_id); |
|
29 | + $role = MainApp::$Memory->get('user.role.cache.'.$role_id); |
|
30 | 30 | |
31 | 31 | // not founded in cache |
32 | 32 | if ($role === null) { |
33 | 33 | $role = self::find($role_id); |
34 | - MainApp::$Memory->set('user.role.cache.' . $role_id, $role); |
|
34 | + MainApp::$Memory->set('user.role.cache.'.$role_id, $role); |
|
35 | 35 | } |
36 | 36 | return $role; |
37 | 37 | } |
@@ -9,7 +9,6 @@ |
||
9 | 9 | use Ffcms\Core\App; |
10 | 10 | use Ffcms\Core\Exception\SyntaxException; |
11 | 11 | use Ffcms\Core\Helper\FileSystem\File; |
12 | -use Ffcms\Core\Helper\Type\Arr; |
|
13 | 12 | use Ffcms\Core\Helper\Type\Integer; |
14 | 13 | use Ffcms\Core\Helper\Type\Str; |
15 | 14 |
@@ -32,20 +32,20 @@ discard block |
||
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 |
||
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 |
||
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()) { |
@@ -4,7 +4,6 @@ |
||
4 | 4 | |
5 | 5 | use Extend\Core\Arch\FrontAppController; |
6 | 6 | use Ffcms\Core\Arch\View; |
7 | -use Apps\Model\Front\User; |
|
8 | 7 | |
9 | 8 | |
10 | 9 | class Main extends FrontAppController |
@@ -25,6 +25,6 @@ |
||
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 |
@@ -9,7 +9,6 @@ |
||
9 | 9 | use Ffcms\Core\Helper\Date; |
10 | 10 | use Ffcms\Core\Helper\FileSystem\Directory; |
11 | 11 | use Ffcms\Core\Helper\FileSystem\File; |
12 | -use Ffcms\Core\Helper\Type\Integer; |
|
13 | 12 | use Ffcms\Core\Helper\Type\Obj; |
14 | 13 | use Ffcms\Core\Helper\Serialize; |
15 | 14 | use Ffcms\Core\Helper\Type\Str; |
@@ -43,8 +43,8 @@ discard block |
||
43 | 43 | } |
44 | 44 | |
45 | 45 | /** |
46 | - * Set model properties from active record data |
|
47 | - */ |
|
46 | + * Set model properties from active record data |
|
47 | + */ |
|
48 | 48 | public function before() |
49 | 49 | { |
50 | 50 | // is new item? |
@@ -105,8 +105,8 @@ discard block |
||
105 | 105 | } |
106 | 106 | |
107 | 107 | /** |
108 | - * Labels |
|
109 | - */ |
|
108 | + * Labels |
|
109 | + */ |
|
110 | 110 | public function labels() |
111 | 111 | { |
112 | 112 | return [ |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | if ($this->_content->id === null) { |
52 | 52 | $this->_new = true; |
53 | 53 | if (null === $this->galleryFreeId) { |
54 | - $this->galleryFreeId = '_tmp_' . Str::randomLatin(mt_rand(16, 32)); |
|
54 | + $this->galleryFreeId = '_tmp_'.Str::randomLatin(mt_rand(16, 32)); |
|
55 | 55 | } |
56 | 56 | if (null === $this->authorId) { |
57 | 57 | $this->authorId = App::$User->identity()->getId(); |
@@ -81,9 +81,9 @@ discard block |
||
81 | 81 | */ |
82 | 82 | public function rules() |
83 | 83 | { |
84 | - $res = [ |
|
85 | - ['title.' . App::$Request->getLanguage(), 'required'], |
|
86 | - ['text.' . App::$Request->getLanguage(), 'required', null, true, true], |
|
84 | + $res = [ |
|
85 | + ['title.'.App::$Request->getLanguage(), 'required'], |
|
86 | + ['text.'.App::$Request->getLanguage(), 'required', null, true, true], |
|
87 | 87 | ['text', 'used', null, true, true], |
88 | 88 | ['path', 'reverse_match', '/[\/\'~`\!@#\$%\^&\*\(\)+=\{\}\[\]\|;:"\<\>,\?\\\]/'], |
89 | 89 | [['path', 'categoryId', 'authorId', 'display', 'galleryFreeId', 'title'], 'required'], |
@@ -96,9 +96,9 @@ discard block |
||
96 | 96 | ]; |
97 | 97 | |
98 | 98 | foreach (App::$Properties->get('languages') as $lang) { |
99 | - $res[] = ['title.' . $lang, 'length_max', 120, null, true, true]; |
|
100 | - $res[] = ['keywords.' . $lang, 'length_max', 150]; |
|
101 | - $res[] = ['description.' . $lang, 'length_max', 250]; |
|
99 | + $res[] = ['title.'.$lang, 'length_max', 120, null, true, true]; |
|
100 | + $res[] = ['keywords.'.$lang, 'length_max', 150]; |
|
101 | + $res[] = ['description.'.$lang, 'length_max', 250]; |
|
102 | 102 | } |
103 | 103 | |
104 | 104 | return $res; |
@@ -142,8 +142,8 @@ discard block |
||
142 | 142 | $this->_content->meta_description = Serialize::encode(App::$Security->strip_tags($this->metaDescription)); |
143 | 143 | $this->_content->source = App::$Security->strip_tags($this->source); |
144 | 144 | // check if rating is changed |
145 | - if ((int)$this->addRating !== 0) { |
|
146 | - $this->_content->rating += (int)$this->addRating; |
|
145 | + if ((int) $this->addRating !== 0) { |
|
146 | + $this->_content->rating += (int) $this->addRating; |
|
147 | 147 | } |
148 | 148 | // check if special comment hash is exist |
149 | 149 | if ($this->_new || Str::length($this->_content->comment_hash) < 32) { |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | } |
156 | 156 | |
157 | 157 | // save poster data |
158 | - $posterPath = '/upload/gallery/' . $this->galleryFreeId . '/orig/' . $this->poster; |
|
158 | + $posterPath = '/upload/gallery/'.$this->galleryFreeId.'/orig/'.$this->poster; |
|
159 | 159 | if (File::exist($posterPath)) { |
160 | 160 | $this->_content->poster = $this->poster; |
161 | 161 | } |
@@ -168,7 +168,7 @@ discard block |
||
168 | 168 | |
169 | 169 | // move files |
170 | 170 | if ($tmpGalleryId !== $this->_content->id) { |
171 | - Directory::rename('/upload/gallery/' . $tmpGalleryId, $this->_content->id); |
|
171 | + Directory::rename('/upload/gallery/'.$tmpGalleryId, $this->_content->id); |
|
172 | 172 | } |
173 | 173 | } |
174 | 174 | |
@@ -181,7 +181,7 @@ discard block |
||
181 | 181 | $data = ContentCategory::getSortedCategories(); |
182 | 182 | $response = []; |
183 | 183 | foreach ($data as $key=>$val) { |
184 | - $response[] = (string)$key; |
|
184 | + $response[] = (string) $key; |
|
185 | 185 | } |
186 | 186 | return $response; |
187 | 187 | } |
@@ -10,6 +10,9 @@ |
||
10 | 10 | { |
11 | 11 | public $message; |
12 | 12 | |
13 | + /** |
|
14 | + * @param string $type |
|
15 | + */ |
|
13 | 16 | public function createObject($name, $type) |
14 | 17 | { |
15 | 18 | $singleName = false; |
@@ -29,8 +29,8 @@ discard block |
||
29 | 29 | $objectTemplate = null; |
30 | 30 | |
31 | 31 | if ($singleName) { |
32 | - $objectDirPath = root . '/Apps/' . $type . '/'; |
|
33 | - $objectNamespace = 'Apps\\' . $type; |
|
32 | + $objectDirPath = root.'/Apps/'.$type.'/'; |
|
33 | + $objectNamespace = 'Apps\\'.$type; |
|
34 | 34 | $objectName = ucfirst($name); |
35 | 35 | } else { |
36 | 36 | $split = explode('/', $name); |
@@ -47,46 +47,46 @@ discard block |
||
47 | 47 | } |
48 | 48 | |
49 | 49 | if ($type === 'Widget') { |
50 | - $objectDirPath = root . '/Widgets/' . $workground; |
|
51 | - $objectNamespace = 'Widgets\\' . $workground; |
|
50 | + $objectDirPath = root.'/Widgets/'.$workground; |
|
51 | + $objectNamespace = 'Widgets\\'.$workground; |
|
52 | 52 | } else { |
53 | - $objectDirPath = root . '/Apps/' . $type . '/' . $workground; |
|
54 | - $objectNamespace = 'Apps\\' . $type . '\\' . $workground; |
|
53 | + $objectDirPath = root.'/Apps/'.$type.'/'.$workground; |
|
54 | + $objectNamespace = 'Apps\\'.$type.'\\'.$workground; |
|
55 | 55 | } |
56 | 56 | |
57 | 57 | if (false !== $subName) { |
58 | - $objectDirPath .= '/' . implode('/', $subName); |
|
59 | - $objectNamespace .= '\\' . implode('\\', $subName); |
|
58 | + $objectDirPath .= '/'.implode('/', $subName); |
|
59 | + $objectNamespace .= '\\'.implode('\\', $subName); |
|
60 | 60 | } |
61 | 61 | |
62 | 62 | |
63 | 63 | // try to find workground-based controller |
64 | - if (File::exist('/Private/Carcase/' . $workground . '/' . $type . '.tphp')) { |
|
65 | - $objectTemplate = File::read('/Private/Carcase/' . $workground . '/' . $type . '.tphp'); |
|
64 | + if (File::exist('/Private/Carcase/'.$workground.'/'.$type.'.tphp')) { |
|
65 | + $objectTemplate = File::read('/Private/Carcase/'.$workground.'/'.$type.'.tphp'); |
|
66 | 66 | } |
67 | 67 | } |
68 | 68 | |
69 | 69 | if (!Directory::exist($objectDirPath) && !Directory::create($objectDirPath)) { |
70 | - $this->message = 'Directory could not be created: ' . $objectDirPath; |
|
70 | + $this->message = 'Directory could not be created: '.$objectDirPath; |
|
71 | 71 | return false; |
72 | 72 | } |
73 | 73 | |
74 | 74 | if ($objectTemplate === null) { |
75 | - $objectTemplate = File::read('/Private/Carcase/' . $type . '.tphp'); |
|
75 | + $objectTemplate = File::read('/Private/Carcase/'.$type.'.tphp'); |
|
76 | 76 | if (false === $objectTemplate) { |
77 | - $this->message = 'Php template file is not founded: /Private/Carcase/' . $type . '.tphp'; |
|
77 | + $this->message = 'Php template file is not founded: /Private/Carcase/'.$type.'.tphp'; |
|
78 | 78 | return false; |
79 | 79 | } |
80 | 80 | } |
81 | 81 | |
82 | 82 | $objectContent = Str::replace(['%namespace%', '%name%'], [$objectNamespace, $objectName], $objectTemplate); |
83 | - $objectFullPath = $objectDirPath . '/' . $objectName . '.php'; |
|
83 | + $objectFullPath = $objectDirPath.'/'.$objectName.'.php'; |
|
84 | 84 | if (File::exist($objectFullPath)) { |
85 | - $this->message = $type . ' is always exist: ' . $objectFullPath; |
|
85 | + $this->message = $type.' is always exist: '.$objectFullPath; |
|
86 | 86 | return false; |
87 | 87 | } |
88 | 88 | File::write($objectFullPath, $objectContent); |
89 | - $this->message = $type . ' template was created: [' . $objectName . '] in path: ' . Str::replace(root, '', $objectDirPath); |
|
89 | + $this->message = $type.' template was created: ['.$objectName.'] in path: '.Str::replace(root, '', $objectDirPath); |
|
90 | 90 | return true; |
91 | 91 | } |
92 | 92 | } |
93 | 93 | \ No newline at end of file |
@@ -2,7 +2,6 @@ |
||
2 | 2 | |
3 | 3 | namespace Apps\Model\Front\Profile; |
4 | 4 | |
5 | -use Apps\ActiveRecord\Blacklist; |
|
6 | 5 | use Apps\ActiveRecord\WallPost as WallRecords; |
7 | 6 | use Ffcms\Core\App; |
8 | 7 | use Ffcms\Core\Interfaces\iUser; |
@@ -4,7 +4,6 @@ |
||
4 | 4 | |
5 | 5 | use Ffcms\Core\App; |
6 | 6 | use Ffcms\Core\Arch\Model; |
7 | -use Ffcms\Core\Helper\Type\Obj; |
|
8 | 7 | use Ffcms\Core\Helper\Type\Str; |
9 | 8 | use Ffcms\Core\Interfaces\iUser; |
10 | 9 |
@@ -26,7 +26,7 @@ |
||
26 | 26 | $query = new UserRecords(); |
27 | 27 | |
28 | 28 | // set current page and offset |
29 | - $page = (int)App::$Request->query->get('page'); |
|
29 | + $page = (int) App::$Request->query->get('page'); |
|
30 | 30 | $offset = $page * self::ITEM_PER_PAGE; |
31 | 31 | |
32 | 32 | // build pagination |
@@ -202,7 +202,7 @@ |
||
202 | 202 | $findAnswer->delete(); |
203 | 203 | |
204 | 204 | $this->response = json_encode([ |
205 | - 'status' => 1, |
|
205 | + 'status' => 1, |
|
206 | 206 | 'message' => 'ok' |
207 | 207 | ]); |
208 | 208 | } |
@@ -149,7 +149,7 @@ discard block |
||
149 | 149 | $answerTime = Date::convertToTimestamp($lastAnswer->created_at); |
150 | 150 | $cfgs = \Apps\ActiveRecord\App::getConfigs('app', 'Profile'); |
151 | 151 | // hmm, maybe past less then delay required? |
152 | - if ($now - (int)$cfgs['delayBetweenPost'] < $answerTime) { |
|
152 | + if ($now - (int) $cfgs['delayBetweenPost'] < $answerTime) { |
|
153 | 153 | throw new JsonException('Delay between answers not pass'); |
154 | 154 | } |
155 | 155 | } |
@@ -196,7 +196,7 @@ discard block |
||
196 | 196 | $postInfo = $findAnswer->getWallPost(); |
197 | 197 | |
198 | 198 | // if not a target user of answer and not answer owner - lets throw exception |
199 | - if($postInfo->target_id !== $viewer->id && $findAnswer->user_id !== $viewer->id) { |
|
199 | + if ($postInfo->target_id !== $viewer->id && $findAnswer->user_id !== $viewer->id) { |
|
200 | 200 | throw new JsonException('Access declined!'); |
201 | 201 | } |
202 | 202 | |
@@ -256,7 +256,7 @@ discard block |
||
256 | 256 | // sender is not myself? then i'm - target (remote user is sender user->to_me) |
257 | 257 | if ($row->sender_id !== $user->id) { |
258 | 258 | $userList[] = $row->sender_id; |
259 | - if ((int)$row->tread === 0) { |
|
259 | + if ((int) $row->tread === 0) { |
|
260 | 260 | $unreadList[] = $row->sender_id; |
261 | 261 | } |
262 | 262 | } |
@@ -324,7 +324,7 @@ discard block |
||
324 | 324 | |
325 | 325 | // get special types for this action |
326 | 326 | $queryType = App::$Request->get('type'); |
327 | - $queryId = (int)App::$Request->get('id'); |
|
327 | + $queryId = (int) App::$Request->get('id'); |
|
328 | 328 | // get current user object |
329 | 329 | $user = App::$User->identity(); |
330 | 330 | |
@@ -340,11 +340,11 @@ discard block |
||
340 | 340 | switch ($queryType) { |
341 | 341 | case 'after': |
342 | 342 | $messages = Message::where('id', '>', $queryId) |
343 | - ->where(function ($query) use ($cor_id, $user) { |
|
344 | - $query->where(function ($q) use ($cor_id, $user){ |
|
343 | + ->where(function($query) use ($cor_id, $user) { |
|
344 | + $query->where(function($q) use ($cor_id, $user){ |
|
345 | 345 | $q->where('target_id', '=', $user->getId()) |
346 | 346 | ->where('sender_id', '=', $cor_id); |
347 | - })->orWhere(function ($q) use ($cor_id, $user){ |
|
347 | + })->orWhere(function($q) use ($cor_id, $user){ |
|
348 | 348 | $q->where('target_id', '=', $cor_id) |
349 | 349 | ->where('sender_id', '=', $user->getId()); |
350 | 350 | }); |
@@ -352,11 +352,11 @@ discard block |
||
352 | 352 | break; |
353 | 353 | case 'before': |
354 | 354 | $messages = Message::where('id', '<', $queryId) |
355 | - ->where(function ($query) use ($cor_id, $user) { |
|
356 | - $query->where(function ($q) use ($cor_id, $user){ |
|
355 | + ->where(function($query) use ($cor_id, $user) { |
|
356 | + $query->where(function($q) use ($cor_id, $user){ |
|
357 | 357 | $q->where('target_id', '=', $user->getId()) |
358 | 358 | ->where('sender_id', '=', $cor_id); |
359 | - })->orWhere(function ($q) use ($cor_id, $user){ |
|
359 | + })->orWhere(function($q) use ($cor_id, $user){ |
|
360 | 360 | $q->where('target_id', '=', $cor_id) |
361 | 361 | ->where('sender_id', '=', $user->getId()); |
362 | 362 | }); |
@@ -455,7 +455,7 @@ discard block |
||
455 | 455 | $this->setJsonHeader(); |
456 | 456 | |
457 | 457 | // get operation type and target user id |
458 | - $target_id = (int)App::$Request->get('target'); |
|
458 | + $target_id = (int) App::$Request->get('target'); |
|
459 | 459 | $type = App::$Request->get('type'); |
460 | 460 | |
461 | 461 | // check type of query |
@@ -470,7 +470,7 @@ discard block |
||
470 | 470 | |
471 | 471 | $cfg = \Apps\ActiveRecord\App::getConfigs('app', 'Profile'); |
472 | 472 | // check if rating is enabled for website |
473 | - if ((int)$cfg['rating'] !== 1) { |
|
473 | + if ((int) $cfg['rating'] !== 1) { |
|
474 | 474 | throw new JsonException('Rating is disabled'); |
475 | 475 | } |
476 | 476 |