@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | */ |
57 | 57 | public function labels() |
58 | 58 | { |
59 | - $labels = [ |
|
59 | + $labels = [ |
|
60 | 60 | 'nick' => __('Nickname'), |
61 | 61 | 'sex' => __('Sex'), |
62 | 62 | 'birthday' => __('Birthday'), |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | |
69 | 69 | // labels for custom fields |
70 | 70 | foreach (ProfileField::getAll() as $custom) { |
71 | - $labels['custom_data.' . $custom->id] = Serialize::getDecodeLocale($custom->name); |
|
71 | + $labels['custom_data.'.$custom->id] = Serialize::getDecodeLocale($custom->name); |
|
72 | 72 | } |
73 | 73 | |
74 | 74 | return $labels; |
@@ -93,12 +93,12 @@ discard block |
||
93 | 93 | // custom profile fields |
94 | 94 | foreach (ProfileField::getAll() as $custom) { |
95 | 95 | $rules[] = [ |
96 | - 'custom_data.' . $custom->id, |
|
96 | + 'custom_data.'.$custom->id, |
|
97 | 97 | 'used' |
98 | 98 | ]; |
99 | 99 | $rules[] = [ |
100 | - 'custom_data.' . $custom->id, |
|
101 | - (int)$custom->reg_cond === 1 ? 'direct_match' : 'reverse_match', |
|
100 | + 'custom_data.'.$custom->id, |
|
101 | + (int) $custom->reg_cond === 1 ? 'direct_match' : 'reverse_match', |
|
102 | 102 | $custom->reg_exp |
103 | 103 | ]; |
104 | 104 | } |
@@ -38,8 +38,8 @@ discard block |
||
38 | 38 | } |
39 | 39 | |
40 | 40 | /** |
41 | - * Set default data |
|
42 | - */ |
|
41 | + * Set default data |
|
42 | + */ |
|
43 | 43 | public function before() |
44 | 44 | { |
45 | 45 | $profile = $this->_user->getProfile()->toArray(); // object to array (property's is protected of access) |
@@ -60,8 +60,8 @@ discard block |
||
60 | 60 | } |
61 | 61 | |
62 | 62 | /** |
63 | - * Form display labels |
|
64 | - */ |
|
63 | + * Form display labels |
|
64 | + */ |
|
65 | 65 | public function labels() |
66 | 66 | { |
67 | 67 | $labels = [ |
@@ -83,8 +83,8 @@ discard block |
||
83 | 83 | } |
84 | 84 | |
85 | 85 | /** |
86 | - * Rules for validation |
|
87 | - */ |
|
86 | + * Rules for validation |
|
87 | + */ |
|
88 | 88 | public function rules() |
89 | 89 | { |
90 | 90 | $rules = [ |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | public function copyFile(iUser $user) |
48 | 48 | { |
49 | 49 | // move file to original folder |
50 | - $upload = $this->file->move(root . '/upload/user/avatar/original/', $user->id . '.' . $this->file->guessExtension()); |
|
50 | + $upload = $this->file->move(root.'/upload/user/avatar/original/', $user->id.'.'.$this->file->guessExtension()); |
|
51 | 51 | |
52 | 52 | try { |
53 | 53 | // big image |
@@ -82,11 +82,11 @@ discard block |
||
82 | 82 | } |
83 | 83 | |
84 | 84 | $image = new Image(); |
85 | - $image->setCacheDir(root . '/Private/Cache/images'); |
|
85 | + $image->setCacheDir(root.'/Private/Cache/images'); |
|
86 | 86 | |
87 | 87 | $image->open($original->getPathname()) |
88 | 88 | ->cropResize($sizeConvert[$size][0], $sizeConvert[$size][1]) |
89 | - ->save(root . '/upload/user/avatar/' . $size . '/' . $user_id . '.jpg', 'jpg', static::COMPRESS_QUALITY); |
|
89 | + ->save(root.'/upload/user/avatar/'.$size.'/'.$user_id.'.jpg', 'jpg', static::COMPRESS_QUALITY); |
|
90 | 90 | |
91 | 91 | return null; |
92 | 92 | } |
@@ -20,8 +20,8 @@ discard block |
||
20 | 20 | const COMPRESS_QUALITY = 90; |
21 | 21 | |
22 | 22 | /** |
23 | - * Form text helper data with translation |
|
24 | - */ |
|
23 | + * Form text helper data with translation |
|
24 | + */ |
|
25 | 25 | public function labels() |
26 | 26 | { |
27 | 27 | return [ |
@@ -30,8 +30,8 @@ discard block |
||
30 | 30 | } |
31 | 31 | |
32 | 32 | /** |
33 | - * Validation rules for avatar uploading |
|
34 | - */ |
|
33 | + * Validation rules for avatar uploading |
|
34 | + */ |
|
35 | 35 | public function rules() |
36 | 36 | { |
37 | 37 | return [ |
@@ -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 |
@@ -10,6 +10,10 @@ |
||
10 | 10 | { |
11 | 11 | public $message; |
12 | 12 | |
13 | + /** |
|
14 | + * @param string $name |
|
15 | + * @param string $type |
|
16 | + */ |
|
13 | 17 | public function createObject($name, $type) |
14 | 18 | { |
15 | 19 | $singleName = false; |
@@ -33,7 +33,7 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
@@ -32,7 +32,7 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
@@ -32,7 +32,7 @@ discard block |
||
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 |
||
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 | /** |
@@ -40,19 +40,19 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
@@ -32,7 +32,7 @@ |
||
32 | 32 | $connector = new \elFinderConnector(new \elFinder([ |
33 | 33 | 'locale' => '', |
34 | 34 | 'roots' => [ |
35 | - ['driver' => 'LocalFileSystem', 'path' => root . '/upload/', 'URL' => App::$Alias->scriptUrl . '/upload/'] |
|
35 | + ['driver' => 'LocalFileSystem', 'path' => root.'/upload/', 'URL' => App::$Alias->scriptUrl.'/upload/'] |
|
36 | 36 | ] |
37 | 37 | ])); |
38 | 38 |
@@ -46,8 +46,8 @@ discard block |
||
46 | 46 | } |
47 | 47 | |
48 | 48 | // check in cache |
49 | - if (MainApp::$Memory->get('profile.object.cache.' . $user_id) !== null) { |
|
50 | - return MainApp::$Memory->get('profile.object.cache.' . $user_id); |
|
49 | + if (MainApp::$Memory->get('profile.object.cache.'.$user_id) !== null) { |
|
50 | + return MainApp::$Memory->get('profile.object.cache.'.$user_id); |
|
51 | 51 | } |
52 | 52 | |
53 | 53 | // find row |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | |
61 | 61 | $object = $profile->first(); |
62 | 62 | |
63 | - MainApp::$Memory->set('profile.object.cache.' . $user_id, $object); |
|
63 | + MainApp::$Memory->set('profile.object.cache.'.$user_id, $object); |
|
64 | 64 | return $object; |
65 | 65 | } |
66 | 66 | |
@@ -71,17 +71,17 @@ discard block |
||
71 | 71 | */ |
72 | 72 | public function getAvatarUrl($type = 'small') |
73 | 73 | { |
74 | - $default = '/upload/user/avatar/' . $type . '/default.jpg'; |
|
74 | + $default = '/upload/user/avatar/'.$type.'/default.jpg'; |
|
75 | 75 | if (!Arr::in($type, ['small', 'big', 'medium'])) { |
76 | - return MainApp::$Alias->scriptUrl . $default; |
|
76 | + return MainApp::$Alias->scriptUrl.$default; |
|
77 | 77 | } |
78 | 78 | |
79 | - $route = '/upload/user/avatar/' . $type . '/' . $this->user_id . '.jpg'; |
|
79 | + $route = '/upload/user/avatar/'.$type.'/'.$this->user_id.'.jpg'; |
|
80 | 80 | if (File::exist($route)) { |
81 | - return MainApp::$Alias->scriptUrl . $route . '?mtime=' . File::mTime($route); |
|
81 | + return MainApp::$Alias->scriptUrl.$route.'?mtime='.File::mTime($route); |
|
82 | 82 | } |
83 | 83 | |
84 | - return MainApp::$Alias->scriptUrl . $default; |
|
84 | + return MainApp::$Alias->scriptUrl.$default; |
|
85 | 85 | } |
86 | 86 | |
87 | 87 | /** |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | { |
93 | 93 | $userNick = $this->nick; |
94 | 94 | if ($userNick === null || Str::likeEmpty($userNick)) { |
95 | - $userNick = 'id' . $this->id; |
|
95 | + $userNick = 'id'.$this->id; |
|
96 | 96 | } |
97 | 97 | |
98 | 98 | return $userNick; |