@@ -7,11 +7,7 @@ |
||
7 | 7 | use Symfony\Component\HttpFoundation\BinaryFileResponse; |
8 | 8 | use Symfony\Component\HttpFoundation\Request; |
9 | 9 | use Symfony\Component\HttpFoundation\Response; |
10 | -use Symfony\Component\HttpFoundation\RedirectResponse; |
|
11 | 10 | use Symfony\Component\HttpFoundation\ResponseHeaderBag; |
12 | -use Symfony\Component\HttpFoundation\StreamedResponse; |
|
13 | -use Intervention\Image\Facades\Image; |
|
14 | -use Intervention\Image\ImageManager; |
|
15 | 11 | |
16 | 12 | class FileController extends Base |
17 | 13 | { |
@@ -15,6 +15,9 @@ |
||
15 | 15 | const WARNING = 'warning'; |
16 | 16 | const ERROR = 'error'; |
17 | 17 | |
18 | + /** |
|
19 | + * @param string $template |
|
20 | + */ |
|
18 | 21 | public function __construct($template) |
19 | 22 | { |
20 | 23 | $this->template = $template; |
@@ -60,7 +60,7 @@ |
||
60 | 60 | $twig->addExtension(new \Twig_Extension_Debug()); |
61 | 61 | |
62 | 62 | // Mardown support. |
63 | - $twig->addFilter(new \Twig_SimpleFilter('markdown', function ($text) { |
|
63 | + $twig->addFilter(new \Twig_SimpleFilter('markdown', function($text) { |
|
64 | 64 | $parsedown = new \Parsedown(); |
65 | 65 | return $parsedown->text($text); |
66 | 66 | })); |
@@ -119,11 +119,11 @@ |
||
119 | 119 | . " php_format VARCHAR(50) NOT NULL UNIQUE" |
120 | 120 | . ")"); |
121 | 121 | $granularities = [ |
122 | - [1, 'Exact', 'Y-m-d H:i:s'], |
|
123 | - [2, 'Day', 'j F Y'], |
|
124 | - [3, 'Month', 'F Y'], |
|
125 | - [4, 'Year', 'Y'], |
|
126 | - [5, 'Circa', '\\c. Y'], |
|
122 | + [1, 'Exact', 'Y-m-d H:i:s'], |
|
123 | + [2, 'Day', 'j F Y'], |
|
124 | + [3, 'Month', 'F Y'], |
|
125 | + [4, 'Year', 'Y'], |
|
126 | + [5, 'Circa', '\\c. Y'], |
|
127 | 127 | ]; |
128 | 128 | foreach ($granularities as $gran) { |
129 | 129 | $this->query( |
@@ -161,7 +161,7 @@ |
||
161 | 161 | . " `password` VARCHAR(255) NULL DEFAULT NULL," |
162 | 162 | . " `reminder_token` VARCHAR(255) NULL DEFAULT NULL," |
163 | 163 | . " `reminder_time` DATETIME NULL DEFAULT NULL," |
164 | - . " `default_group` INT(5) UNSIGNED NOT NULL DEFAULT ".User::GROUP_PUBLIC."," |
|
164 | + . " `default_group` INT(5) UNSIGNED NOT NULL DEFAULT " . User::GROUP_PUBLIC . "," |
|
165 | 165 | . " FOREIGN KEY (`default_group`) REFERENCES `groups` (`id`)" |
166 | 166 | . ")"); |
167 | 167 | $this->query("CREATE TABLE IF NOT EXISTS `user_groups` (" |
@@ -76,7 +76,6 @@ |
||
76 | 76 | return false; |
77 | 77 | } |
78 | 78 | return is_file($path) ? |
79 | - @unlink($path) : |
|
80 | - array_map([__CLASS__, __FUNCTION__], glob($path . '/*')) == @rmdir($path); |
|
79 | + @unlink($path) : array_map([__CLASS__, __FUNCTION__], glob($path . '/*')) == @rmdir($path); |
|
81 | 80 | } |
82 | 81 | } |
@@ -248,7 +248,7 @@ discard block |
||
248 | 248 | $version = $this->getVersionCount(); |
249 | 249 | } |
250 | 250 | if ($version > $this->getVersionCount()) { |
251 | - throw new Exception("Version $version does not exist for Item ".$this->getId()); |
|
251 | + throw new Exception("Version $version does not exist for Item " . $this->getId()); |
|
252 | 252 | } |
253 | 253 | $filesystem = App::getFilesystem(); |
254 | 254 | $path = $this->getFilePath($version); |
@@ -279,7 +279,7 @@ discard block |
||
279 | 279 | $height = $image->getHeight(); |
280 | 280 | $newWidth = ($width > $height) ? 700 : null; |
281 | 281 | $newHeight = ($width > $height) ? null : 700; |
282 | - $image->resize($newWidth, $newHeight, function (Constraint $constraint) { |
|
282 | + $image->resize($newWidth, $newHeight, function(Constraint $constraint) { |
|
283 | 283 | $constraint->aspectRatio(); |
284 | 284 | $constraint->upsize(); |
285 | 285 | }); |
@@ -11,7 +11,7 @@ |
||
11 | 11 | public function run() |
12 | 12 | { |
13 | 13 | $config = new Config(); |
14 | - $this->write("Upgrading ".$config->siteTitle()." . . . "); |
|
14 | + $this->write("Upgrading " . $config->siteTitle() . " . . . "); |
|
15 | 15 | $db = new Db(); |
16 | 16 | $db->install(); |
17 | 17 | $this->write("Upgrade complete"); |
@@ -39,7 +39,7 @@ |
||
39 | 39 | . " FROM item_tags selected_tags" |
40 | 40 | . " JOIN item_tags related_tags ON selected_tags.item = related_tags.item" |
41 | 41 | . " JOIN tags ON related_tags.tag = tags.id" |
42 | - . (!$tags->isEmpty() ? " WHERE selected_tags.tag IN (".$tags->toString().") " : '') |
|
42 | + . (!$tags->isEmpty() ? " WHERE selected_tags.tag IN (" . $tags->toString() . ") " : '') |
|
43 | 43 | . " GROUP BY tags.id ORDER BY tags.title ASC"; |
44 | 44 | $params = []; |
45 | 45 | $template->tags = $this->db->query($tagsSql, $params); |
@@ -12,17 +12,17 @@ |
||
12 | 12 | /** |
13 | 13 | * Exception handling. |
14 | 14 | */ |
15 | -set_exception_handler([ \App\App::class, 'exceptionHandler' ]); |
|
15 | +set_exception_handler([\App\App::class, 'exceptionHandler']); |
|
16 | 16 | |
17 | 17 | /** |
18 | 18 | * Configuration file. When testing, the tests/config.php file is used. |
19 | 19 | */ |
20 | -if (substr(basename($_SERVER['PHP_SELF']), 0, 7)==='phpunit') { |
|
20 | +if (substr(basename($_SERVER['PHP_SELF']), 0, 7) === 'phpunit') { |
|
21 | 21 | define('CONFIG_FILE', __DIR__ . '/tests/config.php'); |
22 | 22 | } else { |
23 | 23 | define('CONFIG_FILE', __DIR__ . '/config.php'); |
24 | 24 | } |
25 | 25 | if (!file_exists(CONFIG_FILE)) { |
26 | - echo "Please copy <code>config.example.php</code> to <code>".CONFIG_FILE."</code> and edit the values therein"; |
|
26 | + echo "Please copy <code>config.example.php</code> to <code>" . CONFIG_FILE . "</code> and edit the values therein"; |
|
27 | 27 | exit(1); |
28 | 28 | } |
@@ -65,7 +65,7 @@ |
||
65 | 65 | } |
66 | 66 | |
67 | 67 | /** |
68 | - * @param $str |
|
68 | + * @param string $str |
|
69 | 69 | * @return $this |
70 | 70 | */ |
71 | 71 | public function removeFromString($str) |