@@ -24,11 +24,11 @@ |
||
| 24 | 24 | |
| 25 | 25 | $query = ("SELECT " . implode(', ', $selection) .", rel.ancestor as parent_id ") . |
| 26 | 26 | |
| 27 | - ("FROM " . static::$table . " ent ") . |
|
| 27 | + ("FROM " . static::$table . " ent ") . |
|
| 28 | 28 | |
| 29 | - ("LEFT JOIN " . static::$table_relations . " rel ON rel.descendant = ent.id AND rel.depth = 1 ") . |
|
| 29 | + ("LEFT JOIN " . static::$table_relations . " rel ON rel.descendant = ent.id AND rel.depth = 1 ") . |
|
| 30 | 30 | |
| 31 | - ("WHERE ent." . $name . " = '" . addslashes($value) . "' LIMIT 1"); |
|
| 31 | + ("WHERE ent." . $name . " = '" . addslashes($value) . "' LIMIT 1"); |
|
| 32 | 32 | |
| 33 | 33 | # ------------------------ |
| 34 | 34 | |
@@ -18,17 +18,17 @@ discard block |
||
| 18 | 18 | |
| 19 | 19 | $selection = array_keys($this->definition->params()); |
| 20 | 20 | |
| 21 | - foreach ($selection as $key => $field) $selection[$key] = ('ent.' . $field); |
|
| 21 | + foreach ($selection as $key => $field) $selection[$key] = ('ent.'.$field); |
|
| 22 | 22 | |
| 23 | 23 | # Process query |
| 24 | 24 | |
| 25 | - $query = ("SELECT " . implode(', ', $selection) .", rel.ancestor as parent_id ") . |
|
| 25 | + $query = ("SELECT ".implode(', ', $selection).", rel.ancestor as parent_id "). |
|
| 26 | 26 | |
| 27 | - ("FROM " . static::$table . " ent ") . |
|
| 27 | + ("FROM ".static::$table." ent "). |
|
| 28 | 28 | |
| 29 | - ("LEFT JOIN " . static::$table_relations . " rel ON rel.descendant = ent.id AND rel.depth = 1 ") . |
|
| 29 | + ("LEFT JOIN ".static::$table_relations." rel ON rel.descendant = ent.id AND rel.depth = 1 "). |
|
| 30 | 30 | |
| 31 | - ("WHERE ent." . $name . " = '" . addslashes($value) . "' LIMIT 1"); |
|
| 31 | + ("WHERE ent.".$name." = '".addslashes($value)."' LIMIT 1"); |
|
| 32 | 32 | |
| 33 | 33 | # ------------------------ |
| 34 | 34 | |
@@ -133,7 +133,7 @@ discard block |
||
| 133 | 133 | |
| 134 | 134 | # Select entity from DB |
| 135 | 135 | |
| 136 | - $condition = ($name . " = '" . addslashes($value) . "' AND id != " . $this->id); |
|
| 136 | + $condition = ($name." = '".addslashes($value)."' AND id != ".$this->id); |
|
| 137 | 137 | |
| 138 | 138 | DB::select(static::$table, 'id', $condition, null, 1); |
| 139 | 139 | |
@@ -27,7 +27,9 @@ discard block |
||
| 27 | 27 | |
| 28 | 28 | $selection = array_keys($this->definition->params()); |
| 29 | 29 | |
| 30 | - foreach ($selection as $key => $field) $selection[$key] = ('ent.' . $field); |
|
| 30 | + foreach ($selection as $key => $field) { |
|
| 31 | + $selection[$key] = ('ent.' . $field); |
|
| 32 | + } |
|
| 31 | 33 | |
| 32 | 34 | # Process query |
| 33 | 35 | |
@@ -87,13 +89,19 @@ discard block |
||
| 87 | 89 | |
| 88 | 90 | public function init($value, string $name = 'id') { |
| 89 | 91 | |
| 90 | - if (0 !== $this->id) return false; |
|
| 92 | + if (0 !== $this->id) { |
|
| 93 | + return false; |
|
| 94 | + } |
|
| 91 | 95 | |
| 92 | 96 | # Get initiation index |
| 93 | 97 | |
| 94 | - if (false === ($index = $this->definition->index($name))) return false; |
|
| 98 | + if (false === ($index = $this->definition->index($name))) { |
|
| 99 | + return false; |
|
| 100 | + } |
|
| 95 | 101 | |
| 96 | - if (($index->type !== 'PRIMARY') && ($index->type !== 'UNIQUE')) return false; |
|
| 102 | + if (($index->type !== 'PRIMARY') && ($index->type !== 'UNIQUE')) { |
|
| 103 | + return false; |
|
| 104 | + } |
|
| 97 | 105 | |
| 98 | 106 | # Process name & value |
| 99 | 107 | |
@@ -101,7 +109,11 @@ discard block |
||
| 101 | 109 | |
| 102 | 110 | # Select entity from DB |
| 103 | 111 | |
| 104 | - if (!static::$nesting) $this->selectDefault($name, $value); else $this->selectNesting($name, $value); |
|
| 112 | + if (!static::$nesting) { |
|
| 113 | + $this->selectDefault($name, $value); |
|
| 114 | + } else { |
|
| 115 | + $this->selectNesting($name, $value); |
|
| 116 | + } |
|
| 105 | 117 | |
| 106 | 118 | # ------------------------ |
| 107 | 119 | |
@@ -114,9 +126,13 @@ discard block |
||
| 114 | 126 | |
| 115 | 127 | # Get initiation index |
| 116 | 128 | |
| 117 | - if (false === ($index = $this->definition->index($name))) return false; |
|
| 129 | + if (false === ($index = $this->definition->index($name))) { |
|
| 130 | + return false; |
|
| 131 | + } |
|
| 118 | 132 | |
| 119 | - if ($index->type !== 'UNIQUE') return false; |
|
| 133 | + if ($index->type !== 'UNIQUE') { |
|
| 134 | + return false; |
|
| 135 | + } |
|
| 120 | 136 | |
| 121 | 137 | # Process name & value |
| 122 | 138 | |
@@ -12,13 +12,13 @@ discard block |
||
| 12 | 12 | |
| 13 | 13 | return ("SELECT SQL_CALC_FOUND_ROWS " . $this->getSelection() . " ") . |
| 14 | 14 | |
| 15 | - ("FROM " . static::$table . " ent ") . |
|
| 15 | + ("FROM " . static::$table . " ent ") . |
|
| 16 | 16 | |
| 17 | 17 | (('' !== ($condition = $this->getCondition($config))) ? ("WHERE " . $condition . " ") : "") . |
| 18 | 18 | |
| 19 | 19 | ("ORDER BY " . $this->getOrderBy($order_by) . " ") . |
| 20 | 20 | |
| 21 | - (($index > 0) ? ("LIMIT " . ((($index - 1) * $display) . ", " . $display)) : ""); |
|
| 21 | + (($index > 0) ? ("LIMIT " . ((($index - 1) * $display) . ", " . $display)) : ""); |
|
| 22 | 22 | } |
| 23 | 23 | |
| 24 | 24 | # Get nesting select query |
@@ -27,9 +27,9 @@ discard block |
||
| 27 | 27 | |
| 28 | 28 | return ("SELECT SQL_CALC_FOUND_ROWS " . $this->getSelection() . ", COUNT(chd.descendant) as children ") . |
| 29 | 29 | |
| 30 | - ("FROM " . static::$table . " ent ") . |
|
| 30 | + ("FROM " . static::$table . " ent ") . |
|
| 31 | 31 | |
| 32 | - ("LEFT JOIN " . static::$table_relations . " chd ON chd.ancestor = ent.id AND chd.depth = 1 ") . |
|
| 32 | + ("LEFT JOIN " . static::$table_relations . " chd ON chd.ancestor = ent.id AND chd.depth = 1 ") . |
|
| 33 | 33 | |
| 34 | 34 | ("LEFT JOIN " . static::$table_relations . " rel ON rel.descendant = ent.id AND rel.depth = 1 ") . |
| 35 | 35 | |
@@ -39,7 +39,7 @@ discard block |
||
| 39 | 39 | |
| 40 | 40 | ("GROUP BY ent.id ORDER BY " . $this->getOrderBy($order_by) . " ") . |
| 41 | 41 | |
| 42 | - (($index > 0) ? ("LIMIT " . ((($index - 1) * $display) . ", " . $display)) : ""); |
|
| 42 | + (($index > 0) ? ("LIMIT " . ((($index - 1) * $display) . ", " . $display)) : ""); |
|
| 43 | 43 | } |
| 44 | 44 | |
| 45 | 45 | # Get default count query |
@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | |
| 49 | 49 | return ("SELECT COUNT(ent.id) as count FROM " . static::$table . " ent ") . |
| 50 | 50 | |
| 51 | - (('' !== ($condition = $this->getCondition($config))) ? ("WHERE " . $condition) : ""); |
|
| 51 | + (('' !== ($condition = $this->getCondition($config))) ? ("WHERE " . $condition) : ""); |
|
| 52 | 52 | } |
| 53 | 53 | |
| 54 | 54 | # Get nesting count query |
@@ -57,11 +57,11 @@ discard block |
||
| 57 | 57 | |
| 58 | 58 | return ("SELECT COUNT(ent.id) as count FROM " . static::$table . " ent ") . |
| 59 | 59 | |
| 60 | - ("LEFT JOIN " . static::$table_relations . " rel ON rel.descendant = ent.id AND rel.depth = 1 ") . |
|
| 60 | + ("LEFT JOIN " . static::$table_relations . " rel ON rel.descendant = ent.id AND rel.depth = 1 ") . |
|
| 61 | 61 | |
| 62 | - ("WHERE COALESCE(rel.ancestor, 0) = " . $parent_id . " ") . |
|
| 62 | + ("WHERE COALESCE(rel.ancestor, 0) = " . $parent_id . " ") . |
|
| 63 | 63 | |
| 64 | - (('' !== ($condition = $this->getCondition($config))) ? ("AND " . $condition) : ""); |
|
| 64 | + (('' !== ($condition = $this->getCondition($config))) ? ("AND " . $condition) : ""); |
|
| 65 | 65 | } |
| 66 | 66 | |
| 67 | 67 | # Select entries from DB |
@@ -10,58 +10,58 @@ discard block |
||
| 10 | 10 | |
| 11 | 11 | private function getDefaultSelectQuery(array $config, array $order_by, int $index, int $display) { |
| 12 | 12 | |
| 13 | - return ("SELECT SQL_CALC_FOUND_ROWS " . $this->getSelection() . " ") . |
|
| 13 | + return ("SELECT SQL_CALC_FOUND_ROWS ".$this->getSelection()." "). |
|
| 14 | 14 | |
| 15 | - ("FROM " . static::$table . " ent ") . |
|
| 15 | + ("FROM ".static::$table." ent "). |
|
| 16 | 16 | |
| 17 | - (('' !== ($condition = $this->getCondition($config))) ? ("WHERE " . $condition . " ") : "") . |
|
| 17 | + (('' !== ($condition = $this->getCondition($config))) ? ("WHERE ".$condition." ") : ""). |
|
| 18 | 18 | |
| 19 | - ("ORDER BY " . $this->getOrderBy($order_by) . " ") . |
|
| 19 | + ("ORDER BY ".$this->getOrderBy($order_by)." "). |
|
| 20 | 20 | |
| 21 | - (($index > 0) ? ("LIMIT " . ((($index - 1) * $display) . ", " . $display)) : ""); |
|
| 21 | + (($index > 0) ? ("LIMIT ".((($index - 1) * $display).", ".$display)) : ""); |
|
| 22 | 22 | } |
| 23 | 23 | |
| 24 | 24 | # Get nesting select query |
| 25 | 25 | |
| 26 | 26 | private function getNestingSelectQuery(int $parent_id, array $config, array $order_by, int $index, int $display) { |
| 27 | 27 | |
| 28 | - return ("SELECT SQL_CALC_FOUND_ROWS " . $this->getSelection() . ", COUNT(chd.descendant) as children ") . |
|
| 28 | + return ("SELECT SQL_CALC_FOUND_ROWS ".$this->getSelection().", COUNT(chd.descendant) as children "). |
|
| 29 | 29 | |
| 30 | - ("FROM " . static::$table . " ent ") . |
|
| 30 | + ("FROM ".static::$table." ent "). |
|
| 31 | 31 | |
| 32 | - ("LEFT JOIN " . static::$table_relations . " chd ON chd.ancestor = ent.id AND chd.depth = 1 ") . |
|
| 32 | + ("LEFT JOIN ".static::$table_relations." chd ON chd.ancestor = ent.id AND chd.depth = 1 "). |
|
| 33 | 33 | |
| 34 | - ("LEFT JOIN " . static::$table_relations . " rel ON rel.descendant = ent.id AND rel.depth = 1 ") . |
|
| 34 | + ("LEFT JOIN ".static::$table_relations." rel ON rel.descendant = ent.id AND rel.depth = 1 "). |
|
| 35 | 35 | |
| 36 | - ("WHERE COALESCE(rel.ancestor, 0) = " . $parent_id . " ") . |
|
| 36 | + ("WHERE COALESCE(rel.ancestor, 0) = ".$parent_id." "). |
|
| 37 | 37 | |
| 38 | - (('' !== ($condition = $this->getCondition($config))) ? ("AND " . $condition . " ") : "") . |
|
| 38 | + (('' !== ($condition = $this->getCondition($config))) ? ("AND ".$condition." ") : ""). |
|
| 39 | 39 | |
| 40 | - ("GROUP BY ent.id ORDER BY " . $this->getOrderBy($order_by) . " ") . |
|
| 40 | + ("GROUP BY ent.id ORDER BY ".$this->getOrderBy($order_by)." "). |
|
| 41 | 41 | |
| 42 | - (($index > 0) ? ("LIMIT " . ((($index - 1) * $display) . ", " . $display)) : ""); |
|
| 42 | + (($index > 0) ? ("LIMIT ".((($index - 1) * $display).", ".$display)) : ""); |
|
| 43 | 43 | } |
| 44 | 44 | |
| 45 | 45 | # Get default count query |
| 46 | 46 | |
| 47 | 47 | private function getDefaultCountQuery(array $config) { |
| 48 | 48 | |
| 49 | - return ("SELECT COUNT(ent.id) as count FROM " . static::$table . " ent ") . |
|
| 49 | + return ("SELECT COUNT(ent.id) as count FROM ".static::$table." ent "). |
|
| 50 | 50 | |
| 51 | - (('' !== ($condition = $this->getCondition($config))) ? ("WHERE " . $condition) : ""); |
|
| 51 | + (('' !== ($condition = $this->getCondition($config))) ? ("WHERE ".$condition) : ""); |
|
| 52 | 52 | } |
| 53 | 53 | |
| 54 | 54 | # Get nesting count query |
| 55 | 55 | |
| 56 | 56 | private function getNestingCountQuery(int $parent_id, array $config) { |
| 57 | 57 | |
| 58 | - return ("SELECT COUNT(ent.id) as count FROM " . static::$table . " ent ") . |
|
| 58 | + return ("SELECT COUNT(ent.id) as count FROM ".static::$table." ent "). |
|
| 59 | 59 | |
| 60 | - ("LEFT JOIN " . static::$table_relations . " rel ON rel.descendant = ent.id AND rel.depth = 1 ") . |
|
| 60 | + ("LEFT JOIN ".static::$table_relations." rel ON rel.descendant = ent.id AND rel.depth = 1 "). |
|
| 61 | 61 | |
| 62 | - ("WHERE COALESCE(rel.ancestor, 0) = " . $parent_id . " ") . |
|
| 62 | + ("WHERE COALESCE(rel.ancestor, 0) = ".$parent_id." "). |
|
| 63 | 63 | |
| 64 | - (('' !== ($condition = $this->getCondition($config))) ? ("AND " . $condition) : ""); |
|
| 64 | + (('' !== ($condition = $this->getCondition($config))) ? ("AND ".$condition) : ""); |
|
| 65 | 65 | } |
| 66 | 66 | |
| 67 | 67 | # Select entries from DB |
@@ -74,9 +74,7 @@ discard block |
||
| 74 | 74 | |
| 75 | 75 | # Select entities |
| 76 | 76 | |
| 77 | - $query = ((null === $parent_id) ? $this->getDefaultSelectQuery($config, $order_by, $index, $display) : |
|
| 78 | - |
|
| 79 | - $this->getNestingSelectQuery($parent_id, $config, $order_by, $index, $display)); |
|
| 77 | + $query = ((null === $parent_id) ? $this->getDefaultSelectQuery($config, $order_by, $index, $display) : $this->getNestingSelectQuery($parent_id, $config, $order_by, $index, $display)); |
|
| 80 | 78 | |
| 81 | 79 | if (!(DB::send($query) && DB::last()->status)) return false; |
| 82 | 80 | |
@@ -113,9 +111,7 @@ discard block |
||
| 113 | 111 | |
| 114 | 112 | # Count entities |
| 115 | 113 | |
| 116 | - $query = ((null === $parent_id) ? $this->getDefaultCountQuery($config) : |
|
| 117 | - |
|
| 118 | - $this->getNestingCountQuery($parent_id, $config)); |
|
| 114 | + $query = ((null === $parent_id) ? $this->getDefaultCountQuery($config) : $this->getNestingCountQuery($parent_id, $config)); |
|
| 119 | 115 | |
| 120 | 116 | if (!(DB::send($query) && DB::last()->status)) return false; |
| 121 | 117 | |
@@ -68,9 +68,13 @@ discard block |
||
| 68 | 68 | |
| 69 | 69 | private function select(int $parent_id = null, array $config = [], array $order_by = [], int $index = 0, int $display = 0) { |
| 70 | 70 | |
| 71 | - if (!((null === $parent_id) || ($parent_id >= 0))) return false; |
|
| 71 | + if (!((null === $parent_id) || ($parent_id >= 0))) { |
|
| 72 | + return false; |
|
| 73 | + } |
|
| 72 | 74 | |
| 73 | - if (!(($index >= 0) && ($display >= 0))) return false; |
|
| 75 | + if (!(($index >= 0) && ($display >= 0))) { |
|
| 76 | + return false; |
|
| 77 | + } |
|
| 74 | 78 | |
| 75 | 79 | # Select entities |
| 76 | 80 | |
@@ -78,7 +82,9 @@ discard block |
||
| 78 | 82 | |
| 79 | 83 | $this->getNestingSelectQuery($parent_id, $config, $order_by, $index, $display)); |
| 80 | 84 | |
| 81 | - if (!(DB::send($query) && DB::last()->status)) return false; |
|
| 85 | + if (!(DB::send($query) && DB::last()->status)) { |
|
| 86 | + return false; |
|
| 87 | + } |
|
| 82 | 88 | |
| 83 | 89 | # Process results |
| 84 | 90 | |
@@ -90,7 +96,9 @@ discard block |
||
| 90 | 96 | |
| 91 | 97 | $items['list'][$dataset->id]['dataset'] = $dataset; |
| 92 | 98 | |
| 93 | - if (null !== $parent_id) $items['list'][$dataset->id]['children'] = intval($data['children']); |
|
| 99 | + if (null !== $parent_id) { |
|
| 100 | + $items['list'][$dataset->id]['children'] = intval($data['children']); |
|
| 101 | + } |
|
| 94 | 102 | } |
| 95 | 103 | |
| 96 | 104 | # Count total |
@@ -109,7 +117,9 @@ discard block |
||
| 109 | 117 | |
| 110 | 118 | private function count(int $parent_id = null, array $config = []) { |
| 111 | 119 | |
| 112 | - if (!((null === $parent_id) || ($parent_id >= 0))) return false; |
|
| 120 | + if (!((null === $parent_id) || ($parent_id >= 0))) { |
|
| 121 | + return false; |
|
| 122 | + } |
|
| 113 | 123 | |
| 114 | 124 | # Count entities |
| 115 | 125 | |
@@ -117,7 +127,9 @@ discard block |
||
| 117 | 127 | |
| 118 | 128 | $this->getNestingCountQuery($parent_id, $config)); |
| 119 | 129 | |
| 120 | - if (!(DB::send($query) && DB::last()->status)) return false; |
|
| 130 | + if (!(DB::send($query) && DB::last()->status)) { |
|
| 131 | + return false; |
|
| 132 | + } |
|
| 121 | 133 | |
| 122 | 134 | # ------------------------ |
| 123 | 135 | |
@@ -142,7 +154,9 @@ discard block |
||
| 142 | 154 | |
| 143 | 155 | public function children(int $parent_id = 0, array $config = [], array $order_by = [], int $index = 0, int $display = 0) { |
| 144 | 156 | |
| 145 | - if (!static::$nesting) return false; |
|
| 157 | + if (!static::$nesting) { |
|
| 158 | + return false; |
|
| 159 | + } |
|
| 146 | 160 | |
| 147 | 161 | return $this->select($parent_id, $config, $order_by, $index, $display); |
| 148 | 162 | } |
@@ -151,7 +165,9 @@ discard block |
||
| 151 | 165 | |
| 152 | 166 | public function childrenCount(int $parent_id = 0, array $config = []) { |
| 153 | 167 | |
| 154 | - if (!static::$nesting) return false; |
|
| 168 | + if (!static::$nesting) { |
|
| 169 | + return false; |
|
| 170 | + } |
|
| 155 | 171 | |
| 156 | 172 | return $this->count($parent_id, $config); |
| 157 | 173 | } |
@@ -14,19 +14,19 @@ |
||
| 14 | 14 | |
| 15 | 15 | # Add params |
| 16 | 16 | |
| 17 | - $this->params->textual ('code', true, 40, true, ''); |
|
| 18 | - $this->params->textual ('ip', true, 255, false, ''); |
|
| 19 | - $this->params->integer ('time', false, 10, true, 0); |
|
| 17 | + $this->params->textual('code', true, 40, true, ''); |
|
| 18 | + $this->params->textual('ip', true, 255, false, ''); |
|
| 19 | + $this->params->integer('time', false, 10, true, 0); |
|
| 20 | 20 | |
| 21 | 21 | # Add indexes |
| 22 | 22 | |
| 23 | - $this->indexes->add ('code', 'UNIQUE'); |
|
| 24 | - $this->indexes->add ('ip'); |
|
| 25 | - $this->indexes->add ('time'); |
|
| 23 | + $this->indexes->add('code', 'UNIQUE'); |
|
| 24 | + $this->indexes->add('ip'); |
|
| 25 | + $this->indexes->add('time'); |
|
| 26 | 26 | |
| 27 | 27 | # Add foreign keys |
| 28 | 28 | |
| 29 | - $this->foreigns->add ('id', TABLE_USERS, 'id', 'CASCADE', 'RESTRICT'); |
|
| 29 | + $this->foreigns->add('id', TABLE_USERS, 'id', 'CASCADE', 'RESTRICT'); |
|
| 30 | 30 | } |
| 31 | 31 | } |
| 32 | 32 | } |
@@ -14,29 +14,29 @@ |
||
| 14 | 14 | |
| 15 | 15 | # Add params |
| 16 | 16 | |
| 17 | - $this->params->integer ('visibility', true, 1, true, VISIBILITY_DRAFT); |
|
| 18 | - $this->params->integer ('access', true, 1, true, ACCESS_PUBLIC); |
|
| 19 | - $this->params->boolean ('locked', true); |
|
| 20 | - $this->params->textual ('slug', true, 255, false, ''); |
|
| 21 | - $this->params->textual ('name', true, 255, false, ''); |
|
| 22 | - $this->params->textual ('title', true, 255, false, ''); |
|
| 23 | - $this->params->textual ('contents', false, 0, false, ''); |
|
| 24 | - $this->params->textual ('description', false, 0, false, ''); |
|
| 25 | - $this->params->textual ('keywords', false, 0, false, ''); |
|
| 26 | - $this->params->boolean ('robots_index', false); |
|
| 27 | - $this->params->boolean ('robots_follow', false); |
|
| 28 | - $this->params->integer ('time_created', false, 10, true, 0); |
|
| 29 | - $this->params->integer ('time_modified', false, 10, true, 0); |
|
| 17 | + $this->params->integer('visibility', true, 1, true, VISIBILITY_DRAFT); |
|
| 18 | + $this->params->integer('access', true, 1, true, ACCESS_PUBLIC); |
|
| 19 | + $this->params->boolean('locked', true); |
|
| 20 | + $this->params->textual('slug', true, 255, false, ''); |
|
| 21 | + $this->params->textual('name', true, 255, false, ''); |
|
| 22 | + $this->params->textual('title', true, 255, false, ''); |
|
| 23 | + $this->params->textual('contents', false, 0, false, ''); |
|
| 24 | + $this->params->textual('description', false, 0, false, ''); |
|
| 25 | + $this->params->textual('keywords', false, 0, false, ''); |
|
| 26 | + $this->params->boolean('robots_index', false); |
|
| 27 | + $this->params->boolean('robots_follow', false); |
|
| 28 | + $this->params->integer('time_created', false, 10, true, 0); |
|
| 29 | + $this->params->integer('time_modified', false, 10, true, 0); |
|
| 30 | 30 | |
| 31 | 31 | # Add indexes |
| 32 | 32 | |
| 33 | - $this->indexes->add ('visibility'); |
|
| 34 | - $this->indexes->add ('access'); |
|
| 35 | - $this->indexes->add ('slug'); |
|
| 36 | - $this->indexes->add ('name'); |
|
| 37 | - $this->indexes->add ('title'); |
|
| 38 | - $this->indexes->add ('time_created'); |
|
| 39 | - $this->indexes->add ('time_modified'); |
|
| 33 | + $this->indexes->add('visibility'); |
|
| 34 | + $this->indexes->add('access'); |
|
| 35 | + $this->indexes->add('slug'); |
|
| 36 | + $this->indexes->add('name'); |
|
| 37 | + $this->indexes->add('title'); |
|
| 38 | + $this->indexes->add('time_created'); |
|
| 39 | + $this->indexes->add('time_modified'); |
|
| 40 | 40 | } |
| 41 | 41 | } |
| 42 | 42 | } |
@@ -14,16 +14,16 @@ |
||
| 14 | 14 | |
| 15 | 15 | # Add params |
| 16 | 16 | |
| 17 | - $this->params->boolean ('active', false); |
|
| 18 | - $this->params->textual ('name', true, 255, false, ''); |
|
| 19 | - $this->params->textual ('title', true, 255, false, ''); |
|
| 20 | - $this->params->textual ('contents', false, 0, false, ''); |
|
| 17 | + $this->params->boolean('active', false); |
|
| 18 | + $this->params->textual('name', true, 255, false, ''); |
|
| 19 | + $this->params->textual('title', true, 255, false, ''); |
|
| 20 | + $this->params->textual('contents', false, 0, false, ''); |
|
| 21 | 21 | |
| 22 | 22 | # Add indexes |
| 23 | 23 | |
| 24 | - $this->indexes->add ('active'); |
|
| 25 | - $this->indexes->add ('name', 'UNIQUE'); |
|
| 26 | - $this->indexes->add ('title'); |
|
| 24 | + $this->indexes->add('active'); |
|
| 25 | + $this->indexes->add('name', 'UNIQUE'); |
|
| 26 | + $this->indexes->add('title'); |
|
| 27 | 27 | } |
| 28 | 28 | } |
| 29 | 29 | } |
@@ -14,16 +14,16 @@ |
||
| 14 | 14 | |
| 15 | 15 | # Add params |
| 16 | 16 | |
| 17 | - $this->params->boolean ('active', false); |
|
| 18 | - $this->params->integer ('position', true, 2, true, 0); |
|
| 19 | - $this->params->textual ('slug', true, 255, false, ''); |
|
| 20 | - $this->params->textual ('text', true, 255, false, ''); |
|
| 21 | - $this->params->integer ('target', true, 1, true, TARGET_SELF); |
|
| 17 | + $this->params->boolean('active', false); |
|
| 18 | + $this->params->integer('position', true, 2, true, 0); |
|
| 19 | + $this->params->textual('slug', true, 255, false, ''); |
|
| 20 | + $this->params->textual('text', true, 255, false, ''); |
|
| 21 | + $this->params->integer('target', true, 1, true, TARGET_SELF); |
|
| 22 | 22 | |
| 23 | 23 | # Add indexes |
| 24 | 24 | |
| 25 | - $this->indexes->add ('active'); |
|
| 26 | - $this->indexes->add ('position'); |
|
| 25 | + $this->indexes->add('active'); |
|
| 26 | + $this->indexes->add('position'); |
|
| 27 | 27 | } |
| 28 | 28 | } |
| 29 | 29 | } |
@@ -14,14 +14,14 @@ |
||
| 14 | 14 | |
| 15 | 15 | # Add params |
| 16 | 16 | |
| 17 | - $this->params->textual ('name', true, 255, false, ''); |
|
| 18 | - $this->params->textual ('title', true, 255, false, ''); |
|
| 19 | - $this->params->textual ('value', true, 255, false, ''); |
|
| 17 | + $this->params->textual('name', true, 255, false, ''); |
|
| 18 | + $this->params->textual('title', true, 255, false, ''); |
|
| 19 | + $this->params->textual('value', true, 255, false, ''); |
|
| 20 | 20 | |
| 21 | 21 | # Add indexes |
| 22 | 22 | |
| 23 | - $this->indexes->add ('name', 'UNIQUE'); |
|
| 24 | - $this->indexes->add ('title'); |
|
| 23 | + $this->indexes->add('name', 'UNIQUE'); |
|
| 24 | + $this->indexes->add('title'); |
|
| 25 | 25 | } |
| 26 | 26 | } |
| 27 | 27 | } |
@@ -14,27 +14,27 @@ |
||
| 14 | 14 | |
| 15 | 15 | # Add params |
| 16 | 16 | |
| 17 | - $this->params->integer ('rank', true, 1, true, RANK_GUEST); |
|
| 18 | - $this->params->textual ('name', true, 16, false, ''); |
|
| 19 | - $this->params->textual ('email', true, 128, false, ''); |
|
| 20 | - $this->params->textual ('auth_key', true, 40, true, ''); |
|
| 21 | - $this->params->textual ('password', true, 40, true, ''); |
|
| 22 | - $this->params->textual ('first_name', true, 255, false, ''); |
|
| 23 | - $this->params->textual ('last_name', true, 255, false, ''); |
|
| 24 | - $this->params->integer ('sex', true, 1, true, SEX_NOT_SELECTED); |
|
| 25 | - $this->params->textual ('city', true, 255, false, ''); |
|
| 26 | - $this->params->textual ('country', true, 2, false, ''); |
|
| 27 | - $this->params->textual ('timezone', true, 40, false, ''); |
|
| 28 | - $this->params->integer ('time_registered', false, 10, true, 0); |
|
| 29 | - $this->params->integer ('time_logged', false, 10, true, 0); |
|
| 17 | + $this->params->integer('rank', true, 1, true, RANK_GUEST); |
|
| 18 | + $this->params->textual('name', true, 16, false, ''); |
|
| 19 | + $this->params->textual('email', true, 128, false, ''); |
|
| 20 | + $this->params->textual('auth_key', true, 40, true, ''); |
|
| 21 | + $this->params->textual('password', true, 40, true, ''); |
|
| 22 | + $this->params->textual('first_name', true, 255, false, ''); |
|
| 23 | + $this->params->textual('last_name', true, 255, false, ''); |
|
| 24 | + $this->params->integer('sex', true, 1, true, SEX_NOT_SELECTED); |
|
| 25 | + $this->params->textual('city', true, 255, false, ''); |
|
| 26 | + $this->params->textual('country', true, 2, false, ''); |
|
| 27 | + $this->params->textual('timezone', true, 40, false, ''); |
|
| 28 | + $this->params->integer('time_registered', false, 10, true, 0); |
|
| 29 | + $this->params->integer('time_logged', false, 10, true, 0); |
|
| 30 | 30 | |
| 31 | 31 | # Add indexes |
| 32 | 32 | |
| 33 | - $this->indexes->add ('rank'); |
|
| 34 | - $this->indexes->add ('name', 'UNIQUE'); |
|
| 35 | - $this->indexes->add ('email', 'UNIQUE'); |
|
| 36 | - $this->indexes->add ('time_registered'); |
|
| 37 | - $this->indexes->add ('time_logged'); |
|
| 33 | + $this->indexes->add('rank'); |
|
| 34 | + $this->indexes->add('name', 'UNIQUE'); |
|
| 35 | + $this->indexes->add('email', 'UNIQUE'); |
|
| 36 | + $this->indexes->add('time_registered'); |
|
| 37 | + $this->indexes->add('time_logged'); |
|
| 38 | 38 | } |
| 39 | 39 | } |
| 40 | 40 | } |
@@ -44,11 +44,15 @@ |
||
| 44 | 44 | $data['contents'] = $contents; |
| 45 | 45 | $data['time_modified'] = REQUEST_TIME; |
| 46 | 46 | |
| 47 | - if (0 === $this->page->id) $data['time_created'] = REQUEST_TIME; |
|
| 47 | + if (0 === $this->page->id) { |
|
| 48 | + $data['time_created'] = REQUEST_TIME; |
|
| 49 | + } |
|
| 48 | 50 | |
| 49 | 51 | $modifier = ((0 === $this->page->id) ? 'create' : 'edit'); |
| 50 | 52 | |
| 51 | - if (!$this->page->$modifier($data)) return 'PAGE_ERROR_MODIFY'; |
|
| 53 | + if (!$this->page->$modifier($data)) { |
|
| 54 | + return 'PAGE_ERROR_MODIFY'; |
|
| 55 | + } |
|
| 52 | 56 | |
| 53 | 57 | # ------------------------ |
| 54 | 58 | |