|
8 | 8 | * License: GNU/GPLv2
|
9 | 9 | * @see LICENSE.txt
|
10 | 10 | *
|
11 |
| - * This file: Front-end handler (last modified: 2022.12.10). |
| 11 | + * This file: Front-end handler (last modified: 2023.01.12). |
12 | 12 | */
|
13 | 13 |
|
14 | 14 | namespace phpMussel\FrontEnd;
|
@@ -1092,6 +1092,16 @@ public function view(string $Page = ''): void
|
1092 | 1092 | ' autocomplete="%s"',
|
1093 | 1093 | $DirValue['autocomplete']
|
1094 | 1094 | );
|
| 1095 | + |
| 1096 | + /** Fix for PHP automatically changing certain kinds of $_POST keys. */ |
| 1097 | + if (!isset($_POST[$ThisDir['DirLangKey']])) { |
| 1098 | + $Try = str_replace('.', '_', $ThisDir['DirLangKey']); |
| 1099 | + if (isset($_POST[$Try])) { |
| 1100 | + $_POST[$ThisDir['DirLangKey']] = $_POST[$Try]; |
| 1101 | + unset($_POST[$Try]); |
| 1102 | + } |
| 1103 | + } |
| 1104 | + |
1095 | 1105 | if (isset($_POST[$ThisDir['DirLangKey']])) {
|
1096 | 1106 | if (in_array($DirValue['type'], ['bool', 'float', 'int', 'kb', 'string', 'timezone', 'email', 'url'], true)) {
|
1097 | 1107 | $this->Loader->autoType($_POST[$ThisDir['DirLangKey']], $DirValue['type']);
|
@@ -1119,10 +1129,24 @@ public function view(string $Page = ''): void
|
1119 | 1129 | foreach ($DirValue['labels'] as $DirValue['ThisLabelKey'] => $DirValue['ThisLabel']) {
|
1120 | 1130 | if (!empty($_POST[$ThisDir['DirLangKey'] . '_' . $DirValue['ThisChoiceKey'] . '_' . $DirValue['ThisLabelKey']])) {
|
1121 | 1131 | $DirValue['Posts'][] = $DirValue['ThisChoiceKey'] . ':' . $DirValue['ThisLabelKey'];
|
| 1132 | + } else { |
| 1133 | + $Try = str_replace('.', '_', $ThisDir['DirLangKey'] . '_' . $DirValue['ThisChoiceKey'] . '_' . $DirValue['ThisLabelKey']); |
| 1134 | + if (!empty($_POST[$Try])) { |
| 1135 | + $_POST[$ThisDir['DirLangKey'] . '_' . $DirValue['ThisChoiceKey'] . '_' . $DirValue['ThisLabelKey']] = $_POST[$Try]; |
| 1136 | + unset($_POST[$Try]); |
| 1137 | + $DirValue['Posts'][] = $DirValue['ThisChoiceKey'] . ':' . $DirValue['ThisLabelKey']; |
| 1138 | + } |
1122 | 1139 | }
|
1123 | 1140 | }
|
1124 | 1141 | } elseif (!empty($_POST[$ThisDir['DirLangKey'] . '_' . $DirValue['ThisChoiceKey']])) {
|
1125 | 1142 | $DirValue['Posts'][] = $DirValue['ThisChoiceKey'];
|
| 1143 | + } else { |
| 1144 | + $Try = str_replace('.', '_', $ThisDir['DirLangKey'] . '_' . $DirValue['ThisChoiceKey']); |
| 1145 | + if (!empty($_POST[$Try])) { |
| 1146 | + $_POST[$ThisDir['DirLangKey'] . '_' . $DirValue['ThisChoiceKey']] = $_POST[$Try]; |
| 1147 | + unset($_POST[$Try]); |
| 1148 | + $DirValue['Posts'][] = $DirValue['ThisChoiceKey']; |
| 1149 | + } |
1126 | 1150 | }
|
1127 | 1151 | }
|
1128 | 1152 | $DirValue['Posts'] = implode(',', $DirValue['Posts']) ?: '';
|
|
0 commit comments