|
8 | 8 | * License: GNU/GPLv2
|
9 | 9 | * @see LICENSE.txt
|
10 | 10 | *
|
11 |
| - * This file: Upload handler (last modified: 2023.04.02). |
| 11 | + * This file: Upload handler (last modified: 2023.04.03). |
12 | 12 | */
|
13 | 13 |
|
14 | 14 | namespace phpMussel\Web;
|
@@ -156,20 +156,20 @@ public function scan()
|
156 | 156 | }
|
157 | 157 |
|
158 | 158 | if (is_array($fileData['name'])) {
|
159 |
| - array_walk_recursive($fileData['name'], function ($item, $key) use (&$FilesData) { |
160 |
| - $FilesData['name'][] = $item; |
| 159 | + array_walk_recursive($fileData['name'], function ($Item, $Key) use (&$FilesData) { |
| 160 | + $FilesData['name'][] = $Item; |
161 | 161 | });
|
162 |
| - array_walk_recursive($fileData['type'], function ($item, $key) use (&$FilesData) { |
163 |
| - $FilesData['type'][] = $item; |
| 162 | + array_walk_recursive($fileData['type'], function ($Item, $Key) use (&$FilesData) { |
| 163 | + $FilesData['type'][] = $Item; |
164 | 164 | });
|
165 |
| - array_walk_recursive($fileData['tmp_name'], function ($item, $key) use (&$FilesData) { |
166 |
| - $FilesData['tmp_name'][] = $item; |
| 165 | + array_walk_recursive($fileData['tmp_name'], function ($Item, $Key) use (&$FilesData) { |
| 166 | + $FilesData['tmp_name'][] = $Item; |
167 | 167 | });
|
168 |
| - array_walk_recursive($fileData['error'], function ($item, $key) use (&$FilesData) { |
169 |
| - $FilesData['error'][] = $item; |
| 168 | + array_walk_recursive($fileData['error'], function ($Item, $Key) use (&$FilesData) { |
| 169 | + $FilesData['error'][] = $Item; |
170 | 170 | });
|
171 |
| - array_walk_recursive($fileData['size'], function ($item, $key) use (&$FilesData) { |
172 |
| - $FilesData['size'][] = $item; |
| 171 | + array_walk_recursive($fileData['size'], function ($Item, $Key) use (&$FilesData) { |
| 172 | + $FilesData['size'][] = $Item; |
173 | 173 | });
|
174 | 174 | } else {
|
175 | 175 | $FilesData['name'][] = $fileData['name'];
|
@@ -306,11 +306,11 @@ public function scan()
|
306 | 306 | /** Pull relevant client-specified L10N data. */
|
307 | 307 | if (!empty($this->Attache)) {
|
308 | 308 | foreach (['denied', 'denied_reason'] as $Pull) {
|
309 |
| - if (isset($this->ClientL10N->Data[$Pull])) { |
310 |
| - $TemplateData[$Pull] = $this->ClientL10N->Data[$Pull]; |
| 309 | + if (($Try = $this->ClientL10N->getString($Pull)) !== '') { |
| 310 | + $TemplateData[$Pull] = $Try; |
311 | 311 | }
|
312 | 312 | }
|
313 |
| - unset($Pull); |
| 313 | + unset($Try, $Pull); |
314 | 314 | }
|
315 | 315 |
|
316 | 316 | /** Determine which template file to use. */
|
@@ -385,10 +385,15 @@ public function scan()
|
385 | 385 | ) ? '' : '<br /><a href="' . $this->Loader->Configuration['legal']['privacy_policy'] . '">' . $this->ClientL10N->L10N->getString('PrivacyPolicy') . '</a>';
|
386 | 386 |
|
387 | 387 | /** Generate HTML output. */
|
388 |
| - $Output = $this->Loader->parse( |
389 |
| - $this->Loader->ClientL10N->Data, |
390 |
| - $this->Loader->parse($TemplateData, $this->Loader->readFile($TemplateFile)) |
391 |
| - ); |
| 388 | + $Output = $this->Loader->parse($TemplateData, $this->Loader->readFile($TemplateFile)); |
| 389 | + if (preg_match_all('~\{([A-Za-z\d_ -]+)\}~', $Output, $Matches)) { |
| 390 | + foreach ($Matches[1] as $Key) { |
| 391 | + if (($Value = $this->Loader->ClientL10N->getString($Key)) !== '') { |
| 392 | + $Output = str_replace('{' . $Key . '}', $Value, $Output); |
| 393 | + } |
| 394 | + } |
| 395 | + } |
| 396 | + unset($Value, $Key, $Matches); |
392 | 397 |
|
393 | 398 | /** Send email notifications about blocked uploads (if enabled). */
|
394 | 399 | if (strlen($this->Loader->InstanceCache['enable_notifications'])) {
|
|
0 commit comments