@@ -3,7 +3,6 @@ |
||
3 | 3 | namespace Saito\User\ReadPostings; |
4 | 4 | |
5 | 5 | use App\Controller\Component\CurrentUserComponent; |
6 | -use Cake\Utility\Hash; |
|
7 | 6 | use Saito\Posting\Posting; |
8 | 7 | |
9 | 8 | /** |
@@ -127,6 +127,7 @@ discard block |
||
127 | 127 | |
128 | 128 | /** |
129 | 129 | * {@inheritDoc} |
130 | + * @return boolean|string |
|
130 | 131 | */ |
131 | 132 | public function isLoggedIn() |
132 | 133 | { |
@@ -152,7 +153,7 @@ discard block |
||
152 | 153 | /** |
153 | 154 | * Checks if user is forbidden. |
154 | 155 | * |
155 | - * @return bool|string |
|
156 | + * @return string|false |
|
156 | 157 | */ |
157 | 158 | public function isForbidden() |
158 | 159 | { |
@@ -3,8 +3,6 @@ |
||
3 | 3 | namespace Saito\User; |
4 | 4 | |
5 | 5 | use App\Model\Entity\User; |
6 | -use Cake\Core\Exception\Exception; |
|
7 | -use Cake\I18n\Time; |
|
8 | 6 | use Cake\Utility\Hash; |
9 | 7 | use Saito\App\Registry; |
10 | 8 |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | } |
57 | 57 | |
58 | 58 | if (!empty($settings['id'])) { |
59 | - $this->_id = (int)$settings['id']; |
|
59 | + $this->_id = (int) $settings['id']; |
|
60 | 60 | $this->_isLoggedIn = true; |
61 | 61 | } |
62 | 62 | |
@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | public function isUser($user) |
140 | 140 | { |
141 | 141 | if (is_numeric($user)) { |
142 | - $id = (int)$user; |
|
142 | + $id = (int) $user; |
|
143 | 143 | } elseif ($user instanceof ForumsUserInterface || $user instanceof User) { |
144 | 144 | $id = $user->get('id'); |
145 | 145 | } else { |
@@ -3,11 +3,9 @@ |
||
3 | 3 | namespace Saito\User\Upload; |
4 | 4 | |
5 | 5 | use App\Model\Entity\User; |
6 | -use Cake\Core\Configure; |
|
7 | 6 | use Cake\Event\Event; |
8 | 7 | use Cake\Event\EventListenerInterface; |
9 | 8 | use Cake\Filesystem\Folder; |
10 | -use Cake\ORM\Entity; |
|
11 | 9 | use Cake\Utility\Text; |
12 | 10 | use Proffer\Lib\ProfferPath; |
13 | 11 |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | |
74 | 74 | // `webroot/files/<table>/<field>/<seed>/<file>` |
75 | 75 | |
76 | - $newFilename = Text::uuid() . $ext; |
|
76 | + $newFilename = Text::uuid().$ext; |
|
77 | 77 | |
78 | 78 | // $path->setTable('avatars'); |
79 | 79 | |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | $dir = $user->get('id'); |
120 | 120 | if (!empty($dir)) { |
121 | 121 | $folder = new Folder( |
122 | - $this->rootDirectory . '/users/avatar/' . $dir |
|
122 | + $this->rootDirectory.'/users/avatar/'.$dir |
|
123 | 123 | ); |
124 | 124 | $folder->delete(); |
125 | 125 | } |
@@ -416,7 +416,7 @@ discard block |
||
416 | 416 | * get parent id |
417 | 417 | * |
418 | 418 | * @param int $id id |
419 | - * @return mixed |
|
419 | + * @return integer |
|
420 | 420 | * @throws \UnexpectedValueException |
421 | 421 | */ |
422 | 422 | public function getParentId($id) |
@@ -627,7 +627,7 @@ discard block |
||
627 | 627 | /** |
628 | 628 | * trees for multiple tids |
629 | 629 | * |
630 | - * @param array $ids ids |
|
630 | + * @param integer[] $ids ids |
|
631 | 631 | * @param array $order order |
632 | 632 | * @param array $fieldlist fieldlist |
633 | 633 | * @return array|bool false if no threads or array of Postings |
@@ -679,7 +679,7 @@ discard block |
||
679 | 679 | * @param array $params params |
680 | 680 | * - 'fields' array of thread-ids: [1, 2, 5] |
681 | 681 | * - 'order' sort order for threads ['time' => 'ASC'], |
682 | - * @return mixed unhydrated result set |
|
682 | + * @return Query unhydrated result set |
|
683 | 683 | */ |
684 | 684 | protected function _getThreadEntries(array $tid, array $params = []) |
685 | 685 | { |
@@ -747,6 +747,8 @@ discard block |
||
747 | 747 | |
748 | 748 | /** |
749 | 749 | * {@inheritDoc} |
750 | + * @param integer $id |
|
751 | + * @param string $key |
|
750 | 752 | */ |
751 | 753 | public function toggle($id, $key) |
752 | 754 | { |
@@ -826,7 +828,7 @@ discard block |
||
826 | 828 | * Anonymizes the entries for a user |
827 | 829 | * |
828 | 830 | * @param string $userId user-ID |
829 | - * @return bool success |
|
831 | + * @return integer success |
|
830 | 832 | */ |
831 | 833 | public function anonymizeEntriesFromUser($userId) |
832 | 834 | { |
@@ -933,7 +935,7 @@ discard block |
||
933 | 935 | * Check if posting is thread-root. |
934 | 936 | * |
935 | 937 | * @param array $id posting-ID or posting data |
936 | - * @return mixed |
|
938 | + * @return boolean |
|
937 | 939 | */ |
938 | 940 | protected function _isRoot(array $id) |
939 | 941 | { |
@@ -1128,7 +1130,7 @@ discard block |
||
1128 | 1130 | * |
1129 | 1131 | * @param null $tid thread-ID |
1130 | 1132 | * @param null $newCategoryId id for new category |
1131 | - * @return bool success |
|
1133 | + * @return integer success |
|
1132 | 1134 | * @throws \NotFoundException |
1133 | 1135 | * @throws \InvalidArgumentException |
1134 | 1136 | */ |
@@ -19,8 +19,6 @@ |
||
19 | 19 | use Cake\Http\Exception\NotFoundException; |
20 | 20 | use Cake\ORM\Entity; |
21 | 21 | use Cake\ORM\Query; |
22 | -use Cake\ORM\RulesChecker; |
|
23 | -use Cake\ORM\TableRegistry; |
|
24 | 22 | use Cake\Validation\Validator; |
25 | 23 | use Saito\App\Registry; |
26 | 24 | use Saito\Posting\Posting; |
@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | 'Users' => ['entry_count'], |
171 | 171 | // cache how many threads a category has |
172 | 172 | 'Categories' => [ |
173 | - 'thread_count' => function ($event, Entity $entity, $table, $original) { |
|
173 | + 'thread_count' => function($event, Entity $entity, $table, $original) { |
|
174 | 174 | if (!$entity->isRoot()) { |
175 | 175 | return false; |
176 | 176 | } |
@@ -317,7 +317,7 @@ discard block |
||
317 | 317 | |
318 | 318 | $options['category_id'] = $User->Categories->getAll('read'); |
319 | 319 | |
320 | - $read = function () use ($options) { |
|
320 | + $read = function() use ($options) { |
|
321 | 321 | $conditions = []; |
322 | 322 | if ($options['user_id'] !== null) { |
323 | 323 | $conditions[]['Entries.user_id'] = $options['user_id']; |
@@ -344,7 +344,7 @@ discard block |
||
344 | 344 | return $result; |
345 | 345 | }; |
346 | 346 | |
347 | - $key = 'Entry.recentEntries-' . md5(serialize($options)); |
|
347 | + $key = 'Entry.recentEntries-'.md5(serialize($options)); |
|
348 | 348 | $results = Cache::remember($key, $read, 'entries'); |
349 | 349 | |
350 | 350 | $threads = []; |
@@ -375,7 +375,7 @@ discard block |
||
375 | 375 | )->first(); |
376 | 376 | if (empty($entry)) { |
377 | 377 | throw new \UnexpectedValueException( |
378 | - 'Posting not found. Posting-Id: ' . $id |
|
378 | + 'Posting not found. Posting-Id: '.$id |
|
379 | 379 | ); |
380 | 380 | } |
381 | 381 | |
@@ -396,7 +396,7 @@ discard block |
||
396 | 396 | unset($options['return']); |
397 | 397 | |
398 | 398 | $result = $this->find('entry') |
399 | - ->where([$this->getAlias() . '.id' => $primaryKey]) |
|
399 | + ->where([$this->getAlias().'.id' => $primaryKey]) |
|
400 | 400 | ->first(); |
401 | 401 | |
402 | 402 | if (!$result) { |
@@ -424,7 +424,7 @@ discard block |
||
424 | 424 | $entry = $this->find()->select('pid')->where(['id' => $id])->first(); |
425 | 425 | if (!$entry) { |
426 | 426 | throw new \UnexpectedValueException( |
427 | - 'Posting not found. Posting-Id: ' . $id |
|
427 | + 'Posting not found. Posting-Id: '.$id |
|
428 | 428 | ); |
429 | 429 | } |
430 | 430 | |
@@ -617,7 +617,7 @@ discard block |
||
617 | 617 | $tree = reset($tree); |
618 | 618 | |
619 | 619 | //= extract subtree |
620 | - if ((int)$tid !== (int)$id) { |
|
620 | + if ((int) $tid !== (int) $id) { |
|
621 | 621 | $tree = $tree->getThread()->get($id); |
622 | 622 | } |
623 | 623 |
@@ -118,7 +118,7 @@ |
||
118 | 118 | * Fast version of Set::combine($results, '{n}.Setting.name', |
119 | 119 | * '{n}.Setting.value'); |
120 | 120 | * |
121 | - * @param array $results results |
|
121 | + * @param Query $results results |
|
122 | 122 | * @return array |
123 | 123 | */ |
124 | 124 | protected function _compactKeyValue($results) |
@@ -15,8 +15,6 @@ |
||
15 | 15 | use App\Lib\Model\Table\AppSettingTable; |
16 | 16 | use Cake\Cache\Cache; |
17 | 17 | use Cake\Core\Configure; |
18 | -use Cake\ORM\Query; |
|
19 | -use Saito\App\Registry; |
|
20 | 18 | use \Stopwatch\Lib\Stopwatch; |
21 | 19 | |
22 | 20 | class SettingsTable extends AppSettingTable |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -declare(strict_types = 1); |
|
3 | +declare(strict_types=1); |
|
4 | 4 | |
5 | 5 | /** |
6 | 6 | * Saito - The Threaded Web Forum |
@@ -84,11 +84,11 @@ discard block |
||
84 | 84 | { |
85 | 85 | Stopwatch::start('Settings->getSettings()'); |
86 | 86 | |
87 | - $cacheKey = 'Saito.appSettings.' . Configure::read('Saito.v'); |
|
87 | + $cacheKey = 'Saito.appSettings.'.Configure::read('Saito.v'); |
|
88 | 88 | |
89 | 89 | $settings = Cache::remember( |
90 | 90 | $cacheKey, |
91 | - function () { |
|
91 | + function() { |
|
92 | 92 | return $this->getSettings(); |
93 | 93 | } |
94 | 94 | ); |
@@ -131,7 +131,7 @@ discard block |
||
131 | 131 | * |
132 | 132 | * @param int $userId user-ID |
133 | 133 | * @param int $blockedId user-ID |
134 | - * @return mixed |
|
134 | + * @return \Cake\Datasource\EntityInterface |
|
135 | 135 | */ |
136 | 136 | protected function _get($userId, $blockedId) |
137 | 137 | { |
@@ -189,7 +189,7 @@ discard block |
||
189 | 189 | * counts how many users ignore the user with ID $id |
190 | 190 | * |
191 | 191 | * @param int $id user-ID |
192 | - * @return array |
|
192 | + * @return integer |
|
193 | 193 | */ |
194 | 194 | public function countIgnored($id) |
195 | 195 | { |
@@ -157,7 +157,7 @@ |
||
157 | 157 | $results = $this->find() |
158 | 158 | ->contain( |
159 | 159 | [ |
160 | - 'Users' => function (Query $query) { |
|
160 | + 'Users' => function(Query $query) { |
|
161 | 161 | $query->select(['Users.id', 'Users.username']); |
162 | 162 | |
163 | 163 | return $query; |
@@ -121,7 +121,7 @@ |
||
121 | 121 | * Removes user with uuid `$id` from UserOnline |
122 | 122 | * |
123 | 123 | * @param string $id id |
124 | - * @return bool |
|
124 | + * @return integer |
|
125 | 125 | */ |
126 | 126 | public function setOffline($id) |
127 | 127 | { |
@@ -9,9 +9,6 @@ |
||
9 | 9 | |
10 | 10 | namespace App\Model\Table; |
11 | 11 | |
12 | -use ArrayObject; |
|
13 | -use Cake\Event\Event; |
|
14 | -use Cake\ORM\Entity; |
|
15 | 12 | use Cake\ORM\Query; |
16 | 13 | use Cake\ORM\Table; |
17 | 14 | use Cake\Validation\Validator; |
@@ -368,7 +368,7 @@ |
||
368 | 368 | * set last refresh |
369 | 369 | * |
370 | 370 | * @param int $userId user-ID |
371 | - * @param null $lastRefresh last refresh |
|
371 | + * @param integer $lastRefresh last refresh |
|
372 | 372 | * @return void |
373 | 373 | */ |
374 | 374 | public function setLastRefresh($userId, $lastRefresh = null) |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | $this->addBehavior( |
78 | 78 | 'Proffer.Proffer', |
79 | 79 | [ |
80 | - 'avatar' => [ // The name of your upload field (filename) |
|
80 | + 'avatar' => [// The name of your upload field (filename) |
|
81 | 81 | 'root' => $avatarRootDir, |
82 | 82 | 'dir' => 'avatar_dir', // field for upload directory |
83 | 83 | 'thumbnailSizes' => [ |
@@ -787,8 +787,8 @@ discard block |
||
787 | 787 | $User->set('user_category_custom', $newCats); |
788 | 788 | } else { |
789 | 789 | //=if set a single category |
790 | - $category = (int)$category; |
|
791 | - if ($category > 0 && $this->Entries->Categories->exists((int)$category) |
|
790 | + $category = (int) $category; |
|
791 | + if ($category > 0 && $this->Entries->Categories->exists((int) $category) |
|
792 | 792 | ) { |
793 | 793 | $active = $category; |
794 | 794 | } else { |
@@ -845,7 +845,7 @@ discard block |
||
845 | 845 | // ->enableHydration(false) |
846 | 846 | ->contain( |
847 | 847 | [ |
848 | - 'UserIgnores' => function ($query) { |
|
848 | + 'UserIgnores' => function($query) { |
|
849 | 849 | return $query->enableHydration(false)->select( |
850 | 850 | ['blocked_user_id', 'user_id'] |
851 | 851 | ); |
@@ -9,7 +9,6 @@ |
||
9 | 9 | |
10 | 10 | namespace App\View\Helper; |
11 | 11 | |
12 | -use App\Controller\Component\CurrentUserComponent; |
|
13 | 12 | use Cake\Core\Configure; |
14 | 13 | use Cake\Event\Event; |
15 | 14 | use Cake\View\Helper; |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | 'version' => Configure::read('Saito.v'), |
64 | 64 | 'settings' => [ |
65 | 65 | 'autoPageReload' => (isset($View->viewVars['autoPageReload']) ? $View->viewVars['autoPageReload'] : 0), |
66 | - 'editPeriod' => (int)Configure::read( |
|
66 | + 'editPeriod' => (int) Configure::read( |
|
67 | 67 | 'Saito.Settings.edit_period' |
68 | 68 | ), |
69 | 69 | 'language' => Configure::read('Saito.language'), |
@@ -77,9 +77,9 @@ discard block |
||
77 | 77 | 'quote_symbol' => $settings['quote_symbol'], |
78 | 78 | 'subject_maxlength' => $settings['subject_maxlength'], |
79 | 79 | 'upload_max_img_size' => $settings['upload_max_img_size'] * 1024, |
80 | - 'upload_max_number_of_uploads' => (int)$settings['upload_max_number_of_uploads'], |
|
80 | + 'upload_max_number_of_uploads' => (int) $settings['upload_max_number_of_uploads'], |
|
81 | 81 | 'theme' => $View->getTheme(), |
82 | - 'apiroot' => $request->getAttribute('webroot') . 'api/v2/', |
|
82 | + 'apiroot' => $request->getAttribute('webroot').'api/v2/', |
|
83 | 83 | 'webroot' => $request->getAttribute('webroot') |
84 | 84 | ] |
85 | 85 | ], |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | 'csrf' => $this->_getCsrf($View) |
92 | 92 | ], |
93 | 93 | 'currentUser' => [ |
94 | - 'id' => (int)$CurrentUser->get('id'), |
|
94 | + 'id' => (int) $CurrentUser->get('id'), |
|
95 | 95 | 'username' => $CurrentUser->get('username'), |
96 | 96 | 'user_show_inline' => $CurrentUser->get('inline_view_on_click') || false, |
97 | 97 | 'user_show_thread_collapsed' => $CurrentUser->get('user_show_thread_collapsed') || false |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | 'afterViewInit' => [] |
103 | 103 | ] |
104 | 104 | ]; |
105 | - $out = 'var SaitoApp = ' . json_encode($js); |
|
105 | + $out = 'var SaitoApp = '.json_encode($js); |
|
106 | 106 | $out .= '; SaitoApp.timeAppStart = new Date().getTime();'; |
107 | 107 | |
108 | 108 | return $out; |