@@ -1,5 +1,7 @@ |
||
| 1 | 1 | <?php |
| 2 | -if (!defined('TYPO3_MODE')) die ('Access denied.'); |
|
| 2 | +if (!defined('TYPO3_MODE')) { |
|
| 3 | + die ('Access denied.'); |
|
| 4 | +} |
|
| 3 | 5 | |
| 4 | 6 | // We only want to have file relations if extension File advanced metadata is loaded. |
| 5 | 7 | if (\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded('filemetadata')) { |
@@ -1,5 +1,7 @@ |
||
| 1 | 1 | <?php |
| 2 | -if (!defined('TYPO3_MODE')) die ('Access denied.'); |
|
| 2 | +if (!defined('TYPO3_MODE')) { |
|
| 3 | + die ('Access denied.'); |
|
| 4 | +} |
|
| 3 | 5 | |
| 4 | 6 | $tca = [ |
| 5 | 7 | 'ctrl' => [ |
@@ -63,7 +63,9 @@ discard block |
||
| 63 | 63 | } |
| 64 | 64 | |
| 65 | 65 | // Read file head, check for JPEG SOI + JFIF/Exif APP1 |
| 66 | - for ($i = 0; $i < 4; $i++) $exif_data[$i] = self::read_1_byte($fh); |
|
| 66 | + for ($i = 0; $i < 4; $i++) { |
|
| 67 | + $exif_data[$i] = self::read_1_byte($fh); |
|
| 68 | + } |
|
| 67 | 69 | if ($exif_data[0] !== 0xFF || |
| 68 | 70 | $exif_data[1] !== 0xD8 |
| 69 | 71 | ) { |
@@ -81,7 +83,9 @@ discard block |
||
| 81 | 83 | } |
| 82 | 84 | $length -= 8; |
| 83 | 85 | // Read JFIF head, check for "JFIF" |
| 84 | - for ($i = 0; $i < 5; $i++) $exif_data[$i] = self::read_1_byte($fh); |
|
| 86 | + for ($i = 0; $i < 5; $i++) { |
|
| 87 | + $exif_data[$i] = self::read_1_byte($fh); |
|
| 88 | + } |
|
| 85 | 89 | if ($exif_data[0] !== 0x4A || |
| 86 | 90 | $exif_data[1] !== 0x46 || |
| 87 | 91 | $exif_data[2] !== 0x49 || |
@@ -91,7 +95,9 @@ discard block |
||
| 91 | 95 | return; |
| 92 | 96 | } |
| 93 | 97 | // Read JFIF body |
| 94 | - for ($i = 0; $i < $length; $i++) $exif_data[$i] = self::read_1_byte($fh); |
|
| 98 | + for ($i = 0; $i < $length; $i++) { |
|
| 99 | + $exif_data[$i] = self::read_1_byte($fh); |
|
| 100 | + } |
|
| 95 | 101 | |
| 96 | 102 | if (self::read_1_byte($fh) !== 0) { |
| 97 | 103 | // Seems there is a 0 byte to separate segments... |
@@ -117,7 +123,9 @@ discard block |
||
| 117 | 123 | } |
| 118 | 124 | $length -= 8; |
| 119 | 125 | // Read Exif head, check for "Exif" |
| 120 | - for ($i = 0; $i < 6; $i++) $exif_data[$i] = self::read_1_byte($fh); |
|
| 126 | + for ($i = 0; $i < 6; $i++) { |
|
| 127 | + $exif_data[$i] = self::read_1_byte($fh); |
|
| 128 | + } |
|
| 121 | 129 | if ($exif_data[0] !== 0x45 || |
| 122 | 130 | $exif_data[1] !== 0x78 || |
| 123 | 131 | $exif_data[2] !== 0x69 || |
@@ -128,7 +136,9 @@ discard block |
||
| 128 | 136 | return; |
| 129 | 137 | } |
| 130 | 138 | // Read Exif body |
| 131 | - for ($i = 0; $i < $length; $i++) $exif_data[$i] = self::read_1_byte($fh); |
|
| 139 | + for ($i = 0; $i < $length; $i++) { |
|
| 140 | + $exif_data[$i] = self::read_1_byte($fh); |
|
| 141 | + } |
|
| 132 | 142 | |
| 133 | 143 | if ($length < 12) { // Length of an IFD entry |
| 134 | 144 | return; |
@@ -145,29 +155,47 @@ discard block |
||
| 145 | 155 | |
| 146 | 156 | // Check Tag mark |
| 147 | 157 | if ($is_motorola) { |
| 148 | - if ($exif_data[2] !== 0) return; |
|
| 149 | - if ($exif_data[3] !== 0x2A) return; |
|
| 158 | + if ($exif_data[2] !== 0) { |
|
| 159 | + return; |
|
| 160 | + } |
|
| 161 | + if ($exif_data[3] !== 0x2A) { |
|
| 162 | + return; |
|
| 163 | + } |
|
| 150 | 164 | } else { |
| 151 | - if ($exif_data[3] !== 0) return; |
|
| 152 | - if ($exif_data[2] !== 0x2A) return; |
|
| 165 | + if ($exif_data[3] !== 0) { |
|
| 166 | + return; |
|
| 167 | + } |
|
| 168 | + if ($exif_data[2] !== 0x2A) { |
|
| 169 | + return; |
|
| 170 | + } |
|
| 153 | 171 | } |
| 154 | 172 | |
| 155 | 173 | // Get first IFD offset (offset to IFD0) |
| 156 | 174 | if ($is_motorola) { |
| 157 | - if ($exif_data[4] !== 0) return; |
|
| 158 | - if ($exif_data[5] !== 0) return; |
|
| 175 | + if ($exif_data[4] !== 0) { |
|
| 176 | + return; |
|
| 177 | + } |
|
| 178 | + if ($exif_data[5] !== 0) { |
|
| 179 | + return; |
|
| 180 | + } |
|
| 159 | 181 | $offset = $exif_data[6]; |
| 160 | 182 | $offset <<= 8; |
| 161 | 183 | $offset += $exif_data[7]; |
| 162 | 184 | } else { |
| 163 | - if ($exif_data[7] !== 0) return; |
|
| 164 | - if ($exif_data[6] !== 0) return; |
|
| 185 | + if ($exif_data[7] !== 0) { |
|
| 186 | + return; |
|
| 187 | + } |
|
| 188 | + if ($exif_data[6] !== 0) { |
|
| 189 | + return; |
|
| 190 | + } |
|
| 165 | 191 | $offset = $exif_data[5]; |
| 166 | 192 | $offset <<= 8; |
| 167 | 193 | $offset += $exif_data[4]; |
| 168 | 194 | } |
| 169 | 195 | // Check end of data segment |
| 170 | - if ($offset > $length - 2) return; |
|
| 196 | + if ($offset > $length - 2) { |
|
| 197 | + return; |
|
| 198 | + } |
|
| 171 | 199 | |
| 172 | 200 | // Get the number of directory entries contained in this IFD |
| 173 | 201 | if ($is_motorola) { |
@@ -179,13 +207,17 @@ discard block |
||
| 179 | 207 | $number_of_tags <<= 8; |
| 180 | 208 | $number_of_tags += $exif_data[$offset]; |
| 181 | 209 | } |
| 182 | - if ($number_of_tags === 0) return; |
|
| 210 | + if ($number_of_tags === 0) { |
|
| 211 | + return; |
|
| 212 | + } |
|
| 183 | 213 | $offset += 2; |
| 184 | 214 | |
| 185 | 215 | // Search for Orientation Tag in IFD0 |
| 186 | 216 | while (true) { |
| 187 | 217 | // Check end of data segment |
| 188 | - if ($offset > $length - 12) return; |
|
| 218 | + if ($offset > $length - 12) { |
|
| 219 | + return; |
|
| 220 | + } |
|
| 189 | 221 | // Get Tag number |
| 190 | 222 | if ($is_motorola) { |
| 191 | 223 | $tagnum = $exif_data[$offset]; |
@@ -197,8 +229,12 @@ discard block |
||
| 197 | 229 | $tagnum += $exif_data[$offset]; |
| 198 | 230 | } |
| 199 | 231 | // Found Orientation Tag |
| 200 | - if ($tagnum === 0x0112) break; |
|
| 201 | - if (--$number_of_tags === 0) return; |
|
| 232 | + if ($tagnum === 0x0112) { |
|
| 233 | + break; |
|
| 234 | + } |
|
| 235 | + if (--$number_of_tags === 0) { |
|
| 236 | + return; |
|
| 237 | + } |
|
| 202 | 238 | $offset += 12; |
| 203 | 239 | } |
| 204 | 240 | |
@@ -1,5 +1,7 @@ |
||
| 1 | 1 | <?php |
| 2 | -if (!defined('TYPO3_MODE')) die ('Access denied.'); |
|
| 2 | +if (!defined('TYPO3_MODE')) { |
|
| 3 | + die ('Access denied.'); |
|
| 4 | +} |
|
| 3 | 5 | |
| 4 | 6 | $tca = [ |
| 5 | 7 | 'ctrl' => [ |
@@ -1,5 +1,7 @@ |
||
| 1 | 1 | <?php |
| 2 | -if (!defined('TYPO3_MODE')) die ('Access denied.'); |
|
| 2 | +if (!defined('TYPO3_MODE')) { |
|
| 3 | + die ('Access denied.'); |
|
| 4 | +} |
|
| 3 | 5 | |
| 4 | 6 | $configuration = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance( |
| 5 | 7 | TYPO3\CMS\Core\Configuration\ExtensionConfiguration::class |