@@ -1,16 +1,16 @@ |
||
| 1 | 1 | <form id="<?php echo $this->formId ?>"> |
| 2 | -<?php foreach($this->fields as $name => $field): ?> |
|
| 2 | +<?php foreach ($this->fields as $name => $field): ?> |
|
| 3 | 3 | <div class="form-group row"> |
| 4 | 4 | <div class="col-md-3"> |
| 5 | 5 | <label title="<?php echo $field['type'] ?>"><?php echo $field['name'] ?></label> |
| 6 | 6 | </div> |
| 7 | 7 | <div class="col-md-2"> |
| 8 | -<?php if($field['functions']['type'] === 'name'): ?> |
|
| 8 | +<?php if ($field['functions']['type'] === 'name'): ?> |
|
| 9 | 9 | <label class=""><?php echo $field['functions']['name'] ?></label> |
| 10 | -<?php elseif($field['functions']['type'] === 'select'): ?> |
|
| 10 | +<?php elseif ($field['functions']['type'] === 'select'): ?> |
|
| 11 | 11 | <select name="<?php echo $field['functions']['name'] ?>" class="form-control"> |
| 12 | -<?php foreach($field['functions']['options'] as $function): ?> |
|
| 13 | - <option <?php if($function === $field['functions']['selected']): ?>selected<?php |
|
| 12 | +<?php foreach ($field['functions']['options'] as $function): ?> |
|
| 13 | + <option <?php if ($function === $field['functions']['selected']): ?>selected<?php |
|
| 14 | 14 | endif ?>><?php echo $function ?></option> |
| 15 | 15 | <?php endforeach ?> |
| 16 | 16 | </select> |
@@ -1,16 +1,16 @@ |
||
| 1 | 1 | <form class="form-horizontal" role="form" id="<?php echo $this->formId ?>"> |
| 2 | -<?php foreach($this->fields as $name => $field): ?> |
|
| 2 | +<?php foreach ($this->fields as $name => $field): ?> |
|
| 3 | 3 | <div class="form-group"> |
| 4 | 4 | <div class="col-md-3"> |
| 5 | 5 | <label title="<?php echo $field['type'] ?>"><?php echo $field['name'] ?></label> |
| 6 | 6 | </div> |
| 7 | 7 | <div class="col-md-2"> |
| 8 | -<?php if($field['functions']['type'] === 'name'): ?> |
|
| 8 | +<?php if ($field['functions']['type'] === 'name'): ?> |
|
| 9 | 9 | <label class=""><?php echo $field['functions']['name'] ?></label> |
| 10 | -<?php elseif($field['functions']['type'] === 'select'): ?> |
|
| 10 | +<?php elseif ($field['functions']['type'] === 'select'): ?> |
|
| 11 | 11 | <select name="<?php echo $field['functions']['name'] ?>" class="form-control"> |
| 12 | -<?php foreach($field['functions']['options'] as $function): ?> |
|
| 13 | - <option <?php if($function === $field['functions']['selected']): ?>selected<?php |
|
| 12 | +<?php foreach ($field['functions']['options'] as $function): ?> |
|
| 13 | + <option <?php if ($function === $field['functions']['selected']): ?>selected<?php |
|
| 14 | 14 | endif ?>><?php echo $function ?></option> |
| 15 | 15 | <?php endforeach ?> |
| 16 | 16 | </select> |
@@ -121,7 +121,7 @@ discard block |
||
| 121 | 121 | if ($row === null) { |
| 122 | 122 | return !$update && $field->autoIncrement ? "" : (isset($queryOptions["select"]) ? false : $default); |
| 123 | 123 | } |
| 124 | - if ($row[$name] != "" && $this->driver->jush() == "sql" && preg_match("~enum|set~", $field->type) ) { |
|
| 124 | + if ($row[$name] != "" && $this->driver->jush() == "sql" && preg_match("~enum|set~", $field->type)) { |
|
| 125 | 125 | return is_array($row[$name]) ? array_sum($row[$name]) : +$row[$name]; |
| 126 | 126 | } |
| 127 | 127 | return is_bool($row[$name]) ? +$row[$name] : $row[$name]; |
@@ -141,7 +141,7 @@ discard block |
||
| 141 | 141 | return "SQL"; |
| 142 | 142 | } |
| 143 | 143 | if ($queryOptions["save"]) { |
| 144 | - return (string)$queryOptions["function"][$name]; |
|
| 144 | + return (string) $queryOptions["function"][$name]; |
|
| 145 | 145 | } |
| 146 | 146 | if ($update && preg_match('~^CURRENT_TIMESTAMP~i', $field->onUpdate)) { |
| 147 | 147 | return 'now'; |
@@ -158,7 +158,7 @@ discard block |
||
| 158 | 158 | */ |
| 159 | 159 | public function insertItem(string $table, array $queryOptions): array |
| 160 | 160 | { |
| 161 | - list($fields, ,) = $this->getFields($table, $queryOptions); |
|
| 161 | + list($fields,,) = $this->getFields($table, $queryOptions); |
|
| 162 | 162 | |
| 163 | 163 | // From edit.inc.php |
| 164 | 164 | $values = []; |
@@ -188,7 +188,7 @@ discard block |
||
| 188 | 188 | */ |
| 189 | 189 | public function updateItem(string $table, array $queryOptions): array |
| 190 | 190 | { |
| 191 | - list($fields, $where, ) = $this->getFields($table, $queryOptions); |
|
| 191 | + list($fields, $where,) = $this->getFields($table, $queryOptions); |
|
| 192 | 192 | |
| 193 | 193 | // From edit.inc.php |
| 194 | 194 | $indexes = $this->driver->indexes($table); |
@@ -53,8 +53,7 @@ discard block |
||
| 53 | 53 | $row[$key] = '"' . str_replace('"', '""', $val) . '"'; |
| 54 | 54 | } |
| 55 | 55 | } |
| 56 | - $separator = $this->options['format'] === 'csv' ? ',' : |
|
| 57 | - ($this->options['format'] === 'tsv' ? "\t" : ';'); |
|
| 56 | + $separator = $this->options['format'] === 'csv' ? ',' : ($this->options['format'] === 'tsv' ? "\t" : ';'); |
|
| 58 | 57 | $this->queries[] = implode($separator, $row); |
| 59 | 58 | } |
| 60 | 59 | |
@@ -203,7 +202,7 @@ discard block |
||
| 203 | 202 | } |
| 204 | 203 | if (!$this->insert) { |
| 205 | 204 | $this->insert = 'INSERT INTO ' . $this->driver->table($table) . ' (' . |
| 206 | - implode(', ', array_map(function ($key) { |
|
| 205 | + implode(', ', array_map(function($key) { |
|
| 207 | 206 | return $this->driver->escapeId($key); |
| 208 | 207 | }, $keys)) . ') VALUES'; |
| 209 | 208 | } |
@@ -281,7 +281,7 @@ discard block |
||
| 281 | 281 | $col = $value['col']; |
| 282 | 282 | $prefix = ''; |
| 283 | 283 | if ($op === 'FIND_IN_SET') { |
| 284 | - $prefix = $op .'(' . $this->driver->quote($value['val']) . ', '; |
|
| 284 | + $prefix = $op . '(' . $this->driver->quote($value['val']) . ', '; |
|
| 285 | 285 | } |
| 286 | 286 | $condition = $this->getWhereCondition($value, $fields); |
| 287 | 287 | if ($col !== '') { |
@@ -310,7 +310,7 @@ discard block |
||
| 310 | 310 | */ |
| 311 | 311 | private function getMatchExpression(IndexEntity $index, int $i): string |
| 312 | 312 | { |
| 313 | - $columns = array_map(function ($column) { |
|
| 313 | + $columns = array_map(function($column) { |
|
| 314 | 314 | return $this->driver->escapeId($column); |
| 315 | 315 | }, $index->columns); |
| 316 | 316 | $match = $this->driver->quote($this->input->values['fulltext'][$i]); |
@@ -337,7 +337,7 @@ discard block |
||
| 337 | 337 | } |
| 338 | 338 | } |
| 339 | 339 | foreach ((array) $this->input->values['where'] as $value) { |
| 340 | - if (($value['col'] !== '' || $value['val'] !== '') && |
|
| 340 | + if (($value['col'] !== '' || $value['val'] !== '') && |
|
| 341 | 341 | in_array($value['op'], $this->driver->operators())) { |
| 342 | 342 | $expressions[] = $this->getSelectExpression($value, $fields); |
| 343 | 343 | } |
@@ -61,8 +61,7 @@ discard block |
||
| 61 | 61 | private function getEnumItemValue(string $val, int $i, $value): array |
| 62 | 62 | { |
| 63 | 63 | $val = stripcslashes(str_replace("''", "'", $val)); |
| 64 | - $checked = (is_int($value) ? $value == $i + 1 : |
|
| 65 | - (is_array($value) ? in_array($i+1, $value) : $value === $val)); |
|
| 64 | + $checked = (is_int($value) ? $value == $i + 1 : (is_array($value) ? in_array($i + 1, $value) : $value === $val)); |
|
| 66 | 65 | return ['value' => $i + 1, 'checked' => $checked, 'text' => $this->util->html($val)]; |
| 67 | 66 | } |
| 68 | 67 | |
@@ -81,7 +80,7 @@ discard block |
||
| 81 | 80 | 'text' => '<i>' . $this->trans->lang('original') . '</i>']; |
| 82 | 81 | } |
| 83 | 82 | if ($field->null) { |
| 84 | - $values[] = ['value' => '', 'checked' => $value === null && !$select, 'text' => '<i>NULL</i>']; |
|
| 83 | + $values[] = ['value' => '', 'checked' => $value === null && !$select, 'text' => '<i>NULL</i>']; |
|
| 85 | 84 | } |
| 86 | 85 | |
| 87 | 86 | // From functions.inc.php (function enum_input()) |