@@ -81,7 +81,7 @@ |
||
| 81 | 81 | |
| 82 | 82 | return $this->rememberStatic( |
| 83 | 83 | $key, |
| 84 | - function () use ($key) { |
|
| 84 | + function() use ($key) { |
|
| 85 | 85 | return $this->find('all') |
| 86 | 86 | ->cache($key) |
| 87 | 87 | ->order(['category_order' => 'ASC']) |
@@ -63,7 +63,7 @@ |
||
| 63 | 63 | $entities = $this->newEntities($data); |
| 64 | 64 | // @performance is one transaction but multiple inserts |
| 65 | 65 | $this->getConnection()->transactional( |
| 66 | - function () use ($entities) { |
|
| 66 | + function() use ($entities) { |
|
| 67 | 67 | foreach ($entities as $entity) { |
| 68 | 68 | $this->save($entity, ['atomic' => false]); |
| 69 | 69 | } |
@@ -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 | |
@@ -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 | ); |
@@ -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; |
@@ -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 | ); |
@@ -61,7 +61,7 @@ discard block |
||
| 61 | 61 | |
| 62 | 62 | // ask if the permissions should be changed |
| 63 | 63 | if ($io->isInteractive()) { |
| 64 | - $validator = function ($arg) { |
|
| 64 | + $validator = function($arg) { |
|
| 65 | 65 | if (in_array($arg, ['Y', 'y', 'N', 'n'])) { |
| 66 | 66 | return $arg; |
| 67 | 67 | } |
@@ -97,8 +97,8 @@ discard block |
||
| 97 | 97 | */ |
| 98 | 98 | public static function createAppConfig($dir, $io) |
| 99 | 99 | { |
| 100 | - $appConfig = $dir . '/config/app.php'; |
|
| 101 | - $defaultConfig = $dir . '/config/app.default.php'; |
|
| 100 | + $appConfig = $dir.'/config/app.php'; |
|
| 101 | + $defaultConfig = $dir.'/config/app.default.php'; |
|
| 102 | 102 | if (!file_exists($appConfig)) { |
| 103 | 103 | copy($defaultConfig, $appConfig); |
| 104 | 104 | $io->write('Created `config/app.php` file'); |
@@ -115,10 +115,10 @@ discard block |
||
| 115 | 115 | public static function createWritableDirectories($dir, $io) |
| 116 | 116 | { |
| 117 | 117 | foreach (static::WRITABLE_DIRS as $path) { |
| 118 | - $path = $dir . '/' . $path; |
|
| 118 | + $path = $dir.'/'.$path; |
|
| 119 | 119 | if (!file_exists($path)) { |
| 120 | 120 | mkdir($path); |
| 121 | - $io->write('Created `' . $path . '` directory'); |
|
| 121 | + $io->write('Created `'.$path.'` directory'); |
|
| 122 | 122 | } |
| 123 | 123 | } |
| 124 | 124 | } |
@@ -135,7 +135,7 @@ discard block |
||
| 135 | 135 | public static function setFolderPermissions($dir, $io) |
| 136 | 136 | { |
| 137 | 137 | // Change the permissions on a path and output the results. |
| 138 | - $changePerms = function ($path) use ($io) { |
|
| 138 | + $changePerms = function($path) use ($io) { |
|
| 139 | 139 | $currentPerms = fileperms($path) & 0777; |
| 140 | 140 | $worldWritable = $currentPerms | 0007; |
| 141 | 141 | if ($worldWritable == $currentPerms) { |
@@ -144,16 +144,16 @@ discard block |
||
| 144 | 144 | |
| 145 | 145 | $res = chmod($path, $worldWritable); |
| 146 | 146 | if ($res) { |
| 147 | - $io->write('Permissions set on ' . $path); |
|
| 147 | + $io->write('Permissions set on '.$path); |
|
| 148 | 148 | } else { |
| 149 | - $io->write('Failed to set permissions on ' . $path); |
|
| 149 | + $io->write('Failed to set permissions on '.$path); |
|
| 150 | 150 | } |
| 151 | 151 | }; |
| 152 | 152 | |
| 153 | - $walker = function ($dir) use (&$walker, $changePerms) { |
|
| 153 | + $walker = function($dir) use (&$walker, $changePerms) { |
|
| 154 | 154 | $files = array_diff(scandir($dir), ['.', '..']); |
| 155 | 155 | foreach ($files as $file) { |
| 156 | - $path = $dir . '/' . $file; |
|
| 156 | + $path = $dir.'/'.$file; |
|
| 157 | 157 | |
| 158 | 158 | if (!is_dir($path)) { |
| 159 | 159 | continue; |
@@ -164,9 +164,9 @@ discard block |
||
| 164 | 164 | } |
| 165 | 165 | }; |
| 166 | 166 | |
| 167 | - $walker($dir . '/tmp'); |
|
| 168 | - $changePerms($dir . '/tmp'); |
|
| 169 | - $changePerms($dir . '/logs'); |
|
| 167 | + $walker($dir.'/tmp'); |
|
| 168 | + $changePerms($dir.'/tmp'); |
|
| 169 | + $changePerms($dir.'/logs'); |
|
| 170 | 170 | } |
| 171 | 171 | |
| 172 | 172 | /** |
@@ -193,7 +193,7 @@ discard block |
||
| 193 | 193 | */ |
| 194 | 194 | public static function setSecuritySaltInFile($dir, $io, $newKey, $file) |
| 195 | 195 | { |
| 196 | - $config = $dir . '/config/' . $file; |
|
| 196 | + $config = $dir.'/config/'.$file; |
|
| 197 | 197 | $content = file_get_contents($config); |
| 198 | 198 | |
| 199 | 199 | $content = str_replace('__SALT__', $newKey, $content, $count); |
@@ -206,7 +206,7 @@ discard block |
||
| 206 | 206 | |
| 207 | 207 | $result = file_put_contents($config, $content); |
| 208 | 208 | if ($result) { |
| 209 | - $io->write('Updated Security.salt value in config/' . $file); |
|
| 209 | + $io->write('Updated Security.salt value in config/'.$file); |
|
| 210 | 210 | |
| 211 | 211 | return; |
| 212 | 212 | } |
@@ -224,7 +224,7 @@ discard block |
||
| 224 | 224 | */ |
| 225 | 225 | public static function setAppNameInFile($dir, $io, $appName, $file) |
| 226 | 226 | { |
| 227 | - $config = $dir . '/config/' . $file; |
|
| 227 | + $config = $dir.'/config/'.$file; |
|
| 228 | 228 | $content = file_get_contents($config); |
| 229 | 229 | $content = str_replace('__APP_NAME__', $appName, $content, $count); |
| 230 | 230 | |
@@ -236,7 +236,7 @@ discard block |
||
| 236 | 236 | |
| 237 | 237 | $result = file_put_contents($config, $content); |
| 238 | 238 | if ($result) { |
| 239 | - $io->write('Updated __APP_NAME__ value in config/' . $file); |
|
| 239 | + $io->write('Updated __APP_NAME__ value in config/'.$file); |
|
| 240 | 240 | |
| 241 | 241 | return; |
| 242 | 242 | } |
@@ -1,6 +1,6 @@ |
||
| 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 |
@@ -1,6 +1,6 @@ |
||
| 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 |