@@ -1,13 +1,13 @@ |
||
| 1 | 1 | <nav><ul class="pagination"><?php |
| 2 | - if(($this->prev)) |
|
| 2 | + if (($this->prev)) |
|
| 3 | 3 | { |
| 4 | 4 | echo $this->prev; |
| 5 | 5 | } |
| 6 | - foreach($this->links as $link) |
|
| 6 | + foreach ($this->links as $link) |
|
| 7 | 7 | { |
| 8 | 8 | echo $link; |
| 9 | 9 | } |
| 10 | - if(($this->next)) |
|
| 10 | + if (($this->next)) |
|
| 11 | 11 | { |
| 12 | 12 | echo $this->next; |
| 13 | 13 | } |
@@ -35,7 +35,7 @@ discard block |
||
| 35 | 35 | /** |
| 36 | 36 | * @var SelectEntity|null |
| 37 | 37 | */ |
| 38 | - private SelectEntity|null $selectEntity = null; |
|
| 38 | + private SelectEntity | null $selectEntity = null; |
|
| 39 | 39 | |
| 40 | 40 | /** |
| 41 | 41 | * @param AbstractFacade $dbFacade |
@@ -116,11 +116,9 @@ discard block |
||
| 116 | 116 | $value = $this->selectEntity->queryOptions["columns"][$valueKey] ?? []; |
| 117 | 117 | |
| 118 | 118 | $fun = $value["fun"] ?? ''; |
| 119 | - $fieldKey = !$this->selectEntity->select ? $key : |
|
| 120 | - ($value["col"] ?? current($this->selectEntity->select)); |
|
| 119 | + $fieldKey = !$this->selectEntity->select ? $key : ($value["col"] ?? current($this->selectEntity->select)); |
|
| 121 | 120 | $field = $this->selectEntity->fields[$fieldKey]; |
| 122 | - $name = !$field ? ($fun ? "*" : $key) : |
|
| 123 | - $this->admin->fieldName($field, $rank); |
|
| 121 | + $name = !$field ? ($fun ? "*" : $key) : $this->admin->fieldName($field, $rank); |
|
| 124 | 122 | |
| 125 | 123 | return [$fun, $name, $field]; |
| 126 | 124 | } |
@@ -246,8 +244,7 @@ discard block |
||
| 246 | 244 | private function getRowIdMd5Key(string $key, string $collation): string |
| 247 | 245 | { |
| 248 | 246 | return $this->driver->jush() != 'sql' || |
| 249 | - preg_match("~^utf8~", $collation) ? $key : |
|
| 250 | - "CONVERT($key USING " . $this->driver->charset() . ")"; |
|
| 247 | + preg_match("~^utf8~", $collation) ? $key : "CONVERT($key USING " . $this->driver->charset() . ")"; |
|
| 251 | 248 | } |
| 252 | 249 | |
| 253 | 250 | /** |
@@ -366,8 +363,8 @@ discard block |
||
| 366 | 363 | $query = $this->driver->getRowCountQuery($table, |
| 367 | 364 | $this->selectEntity->where, $this->hasGroupsInFields(), |
| 368 | 365 | $this->selectEntity->group); |
| 369 | - return (int)$this->driver->result($query); |
|
| 370 | - } catch(Exception $_) { |
|
| 366 | + return (int) $this->driver->result($query); |
|
| 367 | + } catch (Exception $_) { |
|
| 371 | 368 | return -1; |
| 372 | 369 | } |
| 373 | 370 | } |
@@ -105,7 +105,7 @@ |
||
| 105 | 105 | /** |
| 106 | 106 | * @var string|null |
| 107 | 107 | */ |
| 108 | - public string|null $error = null; |
|
| 108 | + public string | null $error = null; |
|
| 109 | 109 | |
| 110 | 110 | /** |
| 111 | 111 | * @var TableSelectEntity |
@@ -25,7 +25,7 @@ discard block |
||
| 25 | 25 | { |
| 26 | 26 | return [ |
| 27 | 27 | 'select' => $select, |
| 28 | - 'values' => (array)$options["columns"], |
|
| 28 | + 'values' => (array) $options["columns"], |
|
| 29 | 29 | 'columns' => $columns, |
| 30 | 30 | 'functions' => $this->driver->functions(), |
| 31 | 31 | 'grouping' => $this->driver->grouping(), |
@@ -49,7 +49,7 @@ discard block |
||
| 49 | 49 | } |
| 50 | 50 | return [ |
| 51 | 51 | // 'where' => $where, |
| 52 | - 'values' => (array)$options["where"], |
|
| 52 | + 'values' => (array) $options["where"], |
|
| 53 | 53 | 'columns' => $columns, |
| 54 | 54 | 'indexes' => $indexes, |
| 55 | 55 | 'operators' => $this->driver->operators(), |
@@ -68,8 +68,8 @@ discard block |
||
| 68 | 68 | private function getSortingOptions(array $columns, array $options): array |
| 69 | 69 | { |
| 70 | 70 | $values = []; |
| 71 | - $descs = (array)$options["desc"]; |
|
| 72 | - foreach ((array)$options["order"] as $key => $value) { |
|
| 71 | + $descs = (array) $options["desc"]; |
|
| 72 | + foreach ((array) $options["order"] as $key => $value) { |
|
| 73 | 73 | $values[] = [ |
| 74 | 74 | 'col' => $value, |
| 75 | 75 | 'desc' => $descs[$key] ?? 0, |
@@ -286,7 +286,7 @@ discard block |
||
| 286 | 286 | $col = $value['col']; |
| 287 | 287 | $prefix = ''; |
| 288 | 288 | if ($op === 'FIND_IN_SET') { |
| 289 | - $prefix = $op .'(' . $this->driver->quote($value['val']) . ', '; |
|
| 289 | + $prefix = $op . '(' . $this->driver->quote($value['val']) . ', '; |
|
| 290 | 290 | } |
| 291 | 291 | $condition = $this->getWhereCondition($value, $fields); |
| 292 | 292 | if ($col !== '') { |
@@ -315,7 +315,7 @@ discard block |
||
| 315 | 315 | */ |
| 316 | 316 | private function getMatchExpression(IndexEntity $index, int $i): string |
| 317 | 317 | { |
| 318 | - $columns = array_map(function ($column) { |
|
| 318 | + $columns = array_map(function($column) { |
|
| 319 | 319 | return $this->driver->escapeId($column); |
| 320 | 320 | }, $index->columns); |
| 321 | 321 | $fulltext = $this->utils->input->values['fulltext'][$i] ?? ''; |
@@ -341,7 +341,7 @@ discard block |
||
| 341 | 341 | } |
| 342 | 342 | } |
| 343 | 343 | foreach ((array) $this->utils->input->values['where'] as $value) { |
| 344 | - if (($value['col'] !== '' || $value['val'] !== '') && |
|
| 344 | + if (($value['col'] !== '' || $value['val'] !== '') && |
|
| 345 | 345 | in_array($value['op'], $this->driver->operators())) { |
| 346 | 346 | $selectEntity->where[] = $this |
| 347 | 347 | ->getSelectExpression($value, $selectEntity->fields); |
@@ -149,7 +149,7 @@ |
||
| 149 | 149 | */ |
| 150 | 150 | public function insertItem(string $table, array $queryOptions): array |
| 151 | 151 | { |
| 152 | - [$fields, ,] = $this->getFields($table, $queryOptions); |
|
| 152 | + [$fields,,] = $this->getFields($table, $queryOptions); |
|
| 153 | 153 | |
| 154 | 154 | // From edit.inc.php |
| 155 | 155 | $values = []; |
@@ -36,8 +36,8 @@ |
||
| 36 | 36 | public function __construct(private AuthInterface $auth, |
| 37 | 37 | private DriverInterface $driver, array $database, array $options) |
| 38 | 38 | { |
| 39 | - $this->enabled = (bool)($options['enduser']['enabled'] ?? false); |
|
| 40 | - $this->limit = (int)($options['enduser']['limit'] ?? 15); |
|
| 39 | + $this->enabled = (bool) ($options['enduser']['enabled'] ?? false); |
|
| 40 | + $this->limit = (int) ($options['enduser']['limit'] ?? 15); |
|
| 41 | 41 | if (!$this->enabled) { |
| 42 | 42 | return; |
| 43 | 43 | } |
@@ -53,8 +53,8 @@ |
||
| 53 | 53 | public function __construct(private AuthInterface $auth, |
| 54 | 54 | private DriverInterface $driver, array $database, array $options) |
| 55 | 55 | { |
| 56 | - $this->enduserEnabled = (bool)($options['enduser']['enabled'] ?? false); |
|
| 57 | - $this->historyEnabled = (bool)($options['history']['enabled'] ?? false); |
|
| 56 | + $this->enduserEnabled = (bool) ($options['enduser']['enabled'] ?? false); |
|
| 57 | + $this->historyEnabled = (bool) ($options['history']['enabled'] ?? false); |
|
| 58 | 58 | $this->category = Options::CAT_BUILDER; |
| 59 | 59 | $this->userDatabase = $options['database']; |
| 60 | 60 | if (!$this->enduserEnabled && !$this->historyEnabled) { |
@@ -17,7 +17,7 @@ discard block |
||
| 17 | 17 | /** |
| 18 | 18 | * @var int|null |
| 19 | 19 | */ |
| 20 | - private int|null $ownerId = null; |
|
| 20 | + private int | null $ownerId = null; |
|
| 21 | 21 | |
| 22 | 22 | /** |
| 23 | 23 | * @var ConnectionInterface |
@@ -56,7 +56,7 @@ discard block |
||
| 56 | 56 | * |
| 57 | 57 | * @return bool|StatementInterface |
| 58 | 58 | */ |
| 59 | - private function executeQuery(string $query, array $values): bool|StatementInterface |
|
| 59 | + private function executeQuery(string $query, array $values): bool | StatementInterface |
|
| 60 | 60 | { |
| 61 | 61 | $st = $this->connection->prepareStatement($query); |
| 62 | 62 | return $this->connection->executeStatement($st, $values) ?? false; |
@@ -76,7 +76,7 @@ discard block |
||
| 76 | 76 | { |
| 77 | 77 | $query = "select id from dbadmin_owners where username=:username limit 1"; |
| 78 | 78 | $statement = $this->executeQuery($query, ['username' => $username]); |
| 79 | - return !$statement || !($row = $statement->fetchAssoc()) ? 0 : (int)$row['id']; |
|
| 79 | + return !$statement || !($row = $statement->fetchAssoc()) ? 0 : (int) $row['id']; |
|
| 80 | 80 | } |
| 81 | 81 | |
| 82 | 82 | /** |
@@ -107,8 +107,7 @@ discard block |
||
| 107 | 107 | */ |
| 108 | 108 | private function getOwnerId(bool $canCreate = true): int |
| 109 | 109 | { |
| 110 | - return $this->ownerId !== null ? $this->ownerId : |
|
| 111 | - ($this->readOwnerId($this->user()) ?: ($canCreate ? |
|
| 110 | + return $this->ownerId !== null ? $this->ownerId : ($this->readOwnerId($this->user()) ?: ($canCreate ? |
|
| 112 | 111 | $this->newOwnerId($this->user()) : 0)); |
| 113 | 112 | } |
| 114 | 113 | } |