@@ -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 |
@@ -37,21 +37,21 @@ discard block |
||
37 | 37 | // cache some data |
38 | 38 | $rootSize = App::$Cache->get('root.size'); |
39 | 39 | if ($rootSize === null) { |
40 | - $rootSize = round(Directory::getSize('/') / (1024*1000), 2) . ' mb'; |
|
40 | + $rootSize = round(Directory::getSize('/') / (1024 * 1000), 2).' mb'; |
|
41 | 41 | App::$Cache->set('root.size', $rootSize, 86400); // 24 hours caching = 60 * 60 * 24 |
42 | 42 | } |
43 | 43 | $loadAvg = App::$Cache->get('load.average'); |
44 | 44 | if ($loadAvg === null) { |
45 | 45 | $loadAvg = Environment::loadAverage(); |
46 | - App::$Cache->set('load.average', $loadAvg, 60*5); // 5 min cache |
|
46 | + App::$Cache->set('load.average', $loadAvg, 60 * 5); // 5 min cache |
|
47 | 47 | } |
48 | 48 | |
49 | 49 | // prepare system statistic |
50 | 50 | $stats = [ |
51 | - 'ff_version' => App::$Properties->version['num'] . ' (' . App::$Properties->version['date'] . ')', |
|
52 | - 'php_version' => Environment::phpVersion() . ' (' . Environment::phpSAPI() . ')', |
|
51 | + 'ff_version' => App::$Properties->version['num'].' ('.App::$Properties->version['date'].')', |
|
52 | + 'php_version' => Environment::phpVersion().' ('.Environment::phpSAPI().')', |
|
53 | 53 | 'os_name' => Environment::osName(), |
54 | - 'database_name' => App::$Database->connection()->getDatabaseName() . ' (' . App::$Database->connection()->getDriverName() . ')', |
|
54 | + 'database_name' => App::$Database->connection()->getDatabaseName().' ('.App::$Database->connection()->getDriverName().')', |
|
55 | 55 | 'file_size' => $rootSize, |
56 | 56 | 'load_avg' => $loadAvg |
57 | 57 | ]; |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | public function actionFiles() |
104 | 104 | { |
105 | 105 | return $this->view->render('files', [ |
106 | - 'connector' => App::$Alias->scriptUrl . '/api/main/files?lang=' . $this->request->getLanguage() |
|
106 | + 'connector' => App::$Alias->scriptUrl.'/api/main/files?lang='.$this->request->getLanguage() |
|
107 | 107 | ]); |
108 | 108 | } |
109 | 109 | |
@@ -174,9 +174,9 @@ discard block |
||
174 | 174 | */ |
175 | 175 | public function actionDeleteroute() |
176 | 176 | { |
177 | - $type = (string)$this->request->query->get('type'); |
|
178 | - $loader = (string)$this->request->query->get('loader'); |
|
179 | - $source = Str::lowerCase((string)$this->request->query->get('path')); |
|
177 | + $type = (string) $this->request->query->get('type'); |
|
178 | + $loader = (string) $this->request->query->get('loader'); |
|
179 | + $source = Str::lowerCase((string) $this->request->query->get('path')); |
|
180 | 180 | |
181 | 181 | $model = new EntityDeleteRoute($type, $loader, $source); |
182 | 182 | if ($model->send() && $model->validate()) { |
@@ -199,7 +199,7 @@ discard block |
||
199 | 199 | { |
200 | 200 | $stats = App::$Cache->stats(); |
201 | 201 | // get size in mb from cache stats |
202 | - $size = round((int)$stats['size'] / (1024*1024), 2); |
|
202 | + $size = round((int) $stats['size'] / (1024 * 1024), 2); |
|
203 | 203 | |
204 | 204 | // check if submited |
205 | 205 | if ($this->request->request->get('clearcache', false)) { |
@@ -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; |
@@ -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 | } |
@@ -98,7 +98,7 @@ |
||
98 | 98 | if ($this->newpassword !== null && Str::length($this->newpassword) >= 3) { |
99 | 99 | $this->_user->password = App::$Security->password_hash($this->newpassword); |
100 | 100 | } |
101 | - } elseif($property === 'approve_token') { |
|
101 | + } elseif ($property === 'approve_token') { |
|
102 | 102 | if ($value == "1") { |
103 | 103 | $this->_user->approve_token = '0'; |
104 | 104 | } else { |
@@ -52,7 +52,7 @@ |
||
52 | 52 | public function save() |
53 | 53 | { |
54 | 54 | // check if target is myself or always exist in block list |
55 | - if ($this->_user->getId() === (int)$this->id || Blacklist::have($this->_user->getId(), $this->id)) { |
|
55 | + if ($this->_user->getId() === (int) $this->id || Blacklist::have($this->_user->getId(), $this->id)) { |
|
56 | 56 | return false; |
57 | 57 | } |
58 | 58 |
@@ -31,7 +31,7 @@ |
||
31 | 31 | [['text' => __('Name')], ['text' => $app->getLocaleName()]], |
32 | 32 | [['text' => __('System name')], ['text' => $app->sys_name]], |
33 | 33 | [['text' => __('Last update')], ['text' => Date::convertToDatetime($app->updated_at, DATE::FORMAT_TO_SECONDS)]], |
34 | - [['text' => __('Status')], ['text' => ((int)$app->disabled === 0) ? 'On' : 'Off'], 'property' => ['class' => ((int)$app->disabled === 0) ? 'alert-success' : 'alert-danger']] |
|
34 | + [['text' => __('Status')], ['text' => ((int) $app->disabled === 0) ? 'On' : 'Off'], 'property' => ['class' => ((int) $app->disabled === 0) ? 'alert-success' : 'alert-danger']] |
|
35 | 35 | ] |
36 | 36 | ] |
37 | 37 | ]); ?> |
@@ -9,4 +9,4 @@ |
||
9 | 9 | ['type' => 'link', 'text' => __('Group management'), 'link' => ['user/grouplist']], |
10 | 10 | ['type' => 'link', 'text' => __('Settings'), 'link' => ['user/settings']] |
11 | 11 | ] |
12 | -]);?> |
|
13 | 12 | \ No newline at end of file |
13 | +]); ?> |
|
14 | 14 | \ No newline at end of file |
@@ -1,6 +1,6 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | -return array ( |
|
3 | +return array( |
|
4 | 4 | 0 => 'global/write', |
5 | 5 | 1 => 'global/modify', |
6 | 6 | 2 => 'global/file', |
@@ -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 |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | ]; |
108 | 108 | |
109 | 109 | // general category |
110 | - if ($this->_new === false && (int)$this->_record->id === 1) { |
|
110 | + if ($this->_new === false && (int) $this->_record->id === 1) { |
|
111 | 111 | $rules[] = ['path', 'used']; |
112 | 112 | } else { |
113 | 113 | $rules[] = ['path', 'required']; |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | $rules[] = ['path', 'reverse_match', '/[\/\'~`\!@#\$%\^&\*\(\)+=\{\}\[\]\|;:"\<\>,\?\\\]/']; |
117 | 117 | } |
118 | 118 | |
119 | - $rules[] = ['title.' . App::$Request->getLanguage(), 'required']; |
|
119 | + $rules[] = ['title.'.App::$Request->getLanguage(), 'required']; |
|
120 | 120 | |
121 | 121 | |
122 | 122 | return $rules; |
@@ -129,7 +129,7 @@ discard block |
||
129 | 129 | { |
130 | 130 | $this->_record->title = Serialize::encode(App::$Security->strip_tags($this->title)); |
131 | 131 | $this->_record->description = Serialize::encode(App::$Security->strip_tags($this->description)); |
132 | - $savePath = trim($this->_pathNested . '/' . $this->path, '/'); |
|
132 | + $savePath = trim($this->_pathNested.'/'.$this->path, '/'); |
|
133 | 133 | $this->_record->path = $savePath; |
134 | 134 | $this->_record->configs = Serialize::encode($this->configs); |
135 | 135 | $this->_record->save(); |
@@ -164,7 +164,7 @@ discard block |
||
164 | 164 | // build path with owner category |
165 | 165 | $this->_pathNested = $owner->path; |
166 | 166 | if (Str::length($this->_pathNested) > 0) { |
167 | - $path = $this->_pathNested . '/' . $path; |
|
167 | + $path = $this->_pathNested.'/'.$path; |
|
168 | 168 | } |
169 | 169 | |
170 | 170 | // make select for check |