@@ -32,7 +32,7 @@ |
||
32 | 32 | |
33 | 33 | return ((null !== $this->type) ? ($this->type . " ") : "") . |
34 | 34 | |
35 | - ("KEY `" . $this->name . "` (`" . $this->name . "`)"); |
|
35 | + ("KEY `" . $this->name . "` (`" . $this->name . "`)"); |
|
36 | 36 | } |
37 | 37 | } |
38 | 38 | } |
@@ -23,7 +23,7 @@ |
||
23 | 23 | |
24 | 24 | return ("`" . $this->name . "` " . ($this->short ? "tiny" : "") . "int(" . $this->length . ")") . |
25 | 25 | |
26 | - (($this->unsigned ? " UNSIGNED" : "") . " NOT NULL DEFAULT '" . $this->default . "'"); |
|
26 | + (($this->unsigned ? " UNSIGNED" : "") . " NOT NULL DEFAULT '" . $this->default . "'"); |
|
27 | 27 | } |
28 | 28 | |
29 | 29 | # Cast value |
@@ -23,7 +23,7 @@ |
||
23 | 23 | |
24 | 24 | return ("`" . $this->name . "` " . ($this->short ? ("varchar(" . $this->length . ")") : "text")) . |
25 | 25 | |
26 | - (($this->binary ? " BINARY" : "") . " NOT NULL DEFAULT '" . $this->default . "'"); |
|
26 | + (($this->binary ? " BINARY" : "") . " NOT NULL DEFAULT '" . $this->default . "'"); |
|
27 | 27 | } |
28 | 28 | |
29 | 29 | # Cast value |
@@ -30,9 +30,9 @@ |
||
30 | 30 | |
31 | 31 | $query = ("CREATE TABLE IF NOT EXISTS `" . static::$table . "` (") . |
32 | 32 | |
33 | - implode(", ", $this->getStatements()) . |
|
33 | + implode(", ", $this->getStatements()) . |
|
34 | 34 | |
35 | - (") ENGINE=InnoDB DEFAULT CHARSET=utf8"); |
|
35 | + (") ENGINE=InnoDB DEFAULT CHARSET=utf8"); |
|
36 | 36 | |
37 | 37 | # ------------------------ |
38 | 38 |
@@ -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 |
@@ -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 |
@@ -64,13 +64,13 @@ discard block |
||
64 | 64 | |
65 | 65 | $query = ("SELECT " . implode(', ', $selection) .", rel.ancestor as parent_id ") . |
66 | 66 | |
67 | - ("FROM " . static::$table . " ent ") . |
|
67 | + ("FROM " . static::$table . " ent ") . |
|
68 | 68 | |
69 | - ("LEFT JOIN " . static::$table_relations . " rel ON rel.descendant = ent.id AND rel.depth = 1 ") . |
|
69 | + ("LEFT JOIN " . static::$table_relations . " rel ON rel.descendant = ent.id AND rel.depth = 1 ") . |
|
70 | 70 | |
71 | - ("WHERE ent.visibility = " . VISIBILITY_PUBLISHED . " AND ent.access <= " . Auth::user()->rank . " AND ") . |
|
71 | + ("WHERE ent.visibility = " . VISIBILITY_PUBLISHED . " AND ent.access <= " . Auth::user()->rank . " AND ") . |
|
72 | 72 | |
73 | - ("ent.locked = 0 AND ent.slug = '" . addslashes($slug) . "' LIMIT 1"); |
|
73 | + ("ent.locked = 0 AND ent.slug = '" . addslashes($slug) . "' LIMIT 1"); |
|
74 | 74 | |
75 | 75 | # Select entity from DB |
76 | 76 | |
@@ -91,17 +91,17 @@ discard block |
||
91 | 91 | |
92 | 92 | $query = ("UPDATE " . static::$table . " ent JOIN (") . |
93 | 93 | |
94 | - ("SELECT rel.descendant as id, GROUP_CONCAT(ens.name ORDER BY rls.depth DESC SEPARATOR '/') slug ") . |
|
94 | + ("SELECT rel.descendant as id, GROUP_CONCAT(ens.name ORDER BY rls.depth DESC SEPARATOR '/') slug ") . |
|
95 | 95 | |
96 | - ("FROM " . static::$table_relations . " rel ") . |
|
96 | + ("FROM " . static::$table_relations . " rel ") . |
|
97 | 97 | |
98 | - ("JOIN " . static::$table_relations . " rls ON rls.descendant = rel.descendant ") . |
|
98 | + ("JOIN " . static::$table_relations . " rls ON rls.descendant = rel.descendant ") . |
|
99 | 99 | |
100 | - ("JOIN " . static::$table . " ens ON ens.id = rls.ancestor ") . |
|
100 | + ("JOIN " . static::$table . " ens ON ens.id = rls.ancestor ") . |
|
101 | 101 | |
102 | - ("WHERE rel.ancestor = " . $this->id . " GROUP BY rel.descendant") . |
|
102 | + ("WHERE rel.ancestor = " . $this->id . " GROUP BY rel.descendant") . |
|
103 | 103 | |
104 | - (") slg ON slg.id = ent.id SET ent.locked = 1, ent.slug = slg.slug"); |
|
104 | + (") slg ON slg.id = ent.id SET ent.locked = 1, ent.slug = slg.slug"); |
|
105 | 105 | |
106 | 106 | if (!(DB::send($query) && DB::last()->status)) return false; |
107 | 107 | |
@@ -109,15 +109,15 @@ discard block |
||
109 | 109 | |
110 | 110 | $query = ("UPDATE " . static::$table . " ent JOIN (") . |
111 | 111 | |
112 | - ("SELECT rel.descendant as id FROM " . static::$table_relations . " rel ") . |
|
112 | + ("SELECT rel.descendant as id FROM " . static::$table_relations . " rel ") . |
|
113 | 113 | |
114 | - ("JOIN " . static::$table . " enc ON enc.id = rel.descendant AND enc.locked = 1 ") . |
|
114 | + ("JOIN " . static::$table . " enc ON enc.id = rel.descendant AND enc.locked = 1 ") . |
|
115 | 115 | |
116 | - ("LEFT JOIN " . static::$table . " end ON end.id != enc.id AND end.slug = enc.slug ") . |
|
116 | + ("LEFT JOIN " . static::$table . " end ON end.id != enc.id AND end.slug = enc.slug ") . |
|
117 | 117 | |
118 | - ("WHERE end.id IS NULL GROUP BY rel.descendant") . |
|
118 | + ("WHERE end.id IS NULL GROUP BY rel.descendant") . |
|
119 | 119 | |
120 | - (") chk ON chk.id = ent.id SET ent.locked = 0"); |
|
120 | + (") chk ON chk.id = ent.id SET ent.locked = 0"); |
|
121 | 121 | |
122 | 122 | if (!(DB::send($query) && DB::last()->status)) return false; |
123 | 123 |
@@ -27,13 +27,13 @@ discard block |
||
27 | 27 | |
28 | 28 | $query = ("DELETE rla FROM " . static::$table_relations . " rla ") . |
29 | 29 | |
30 | - ("JOIN " . static::$table_relations . " rlb ON rlb.descendant = rla.descendant ") . |
|
30 | + ("JOIN " . static::$table_relations . " rlb ON rlb.descendant = rla.descendant ") . |
|
31 | 31 | |
32 | - ("LEFT JOIN " . static::$table_relations . " rlx ") . |
|
32 | + ("LEFT JOIN " . static::$table_relations . " rlx ") . |
|
33 | 33 | |
34 | - ("ON rlx.ancestor = rlb.ancestor AND rlx.descendant = rla.ancestor ") . |
|
34 | + ("ON rlx.ancestor = rlb.ancestor AND rlx.descendant = rla.ancestor ") . |
|
35 | 35 | |
36 | - ("WHERE rlb.ancestor = " . $this->id . " AND rlx.ancestor IS NULL"); |
|
36 | + ("WHERE rlb.ancestor = " . $this->id . " AND rlx.ancestor IS NULL"); |
|
37 | 37 | |
38 | 38 | if (!(DB::send($query) && DB::last()->status)) return false; |
39 | 39 | |
@@ -52,13 +52,13 @@ discard block |
||
52 | 52 | |
53 | 53 | $query = ("INSERT INTO " . static::$table_relations . " (ancestor, descendant, depth) ") . |
54 | 54 | |
55 | - ("SELECT sup.ancestor, sub.descendant, sup.depth + sub.depth + 1 ") . |
|
55 | + ("SELECT sup.ancestor, sub.descendant, sup.depth + sub.depth + 1 ") . |
|
56 | 56 | |
57 | - ("FROM " . static::$table_relations . " sup ") . |
|
57 | + ("FROM " . static::$table_relations . " sup ") . |
|
58 | 58 | |
59 | - ("JOIN " . static::$table_relations . " sub ") . |
|
59 | + ("JOIN " . static::$table_relations . " sub ") . |
|
60 | 60 | |
61 | - ("WHERE sub.ancestor = " . $this->id . " AND sup.descendant = " . $parent_id); |
|
61 | + ("WHERE sub.ancestor = " . $this->id . " AND sup.descendant = " . $parent_id); |
|
62 | 62 | |
63 | 63 | if (!(DB::send($query) && DB::last()->status)) return false; |
64 | 64 |
@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | |
13 | 13 | return (0 !== $parent_id) ? (("JOIN " . static::$table_relations . " rel ") . |
14 | 14 | |
15 | - ("ON rel.ancestor = " . $parent_id . " AND rel.descendant = ent.id AND rel.depth >= 1")) : |
|
15 | + ("ON rel.ancestor = " . $parent_id . " AND rel.descendant = ent.id AND rel.depth >= 1")) : |
|
16 | 16 | |
17 | 17 | ("JOIN " . static::$table_relations . " rel ON rel.descendant = ent.id"); |
18 | 18 | } |
@@ -23,13 +23,13 @@ discard block |
||
23 | 23 | |
24 | 24 | return ("SELECT " . $this->getSelection() . ", COALESCE(par.ancestor, 0) as parent_id ") . |
25 | 25 | |
26 | - ("FROM " . static::$table . " ent " . $this->getQueryJoin($parent_id) . " ") . |
|
26 | + ("FROM " . static::$table . " ent " . $this->getQueryJoin($parent_id) . " ") . |
|
27 | 27 | |
28 | - ("LEFT JOIN " . static::$table_relations . " par ON par.descendant = ent.id AND par.depth = 1 ") . |
|
28 | + ("LEFT JOIN " . static::$table_relations . " par ON par.descendant = ent.id AND par.depth = 1 ") . |
|
29 | 29 | |
30 | - (('' !== ($condition = $this->getCondition($config))) ? ("WHERE " . $condition . " ") : "") . |
|
30 | + (('' !== ($condition = $this->getCondition($config))) ? ("WHERE " . $condition . " ") : "") . |
|
31 | 31 | |
32 | - ("GROUP BY ent.id ORDER BY MAX(rel.depth) ASC, " . $this->getOrderBy($order_by)); |
|
32 | + ("GROUP BY ent.id ORDER BY MAX(rel.depth) ASC, " . $this->getOrderBy($order_by)); |
|
33 | 33 | } |
34 | 34 | |
35 | 35 | # Get count query |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | |
39 | 39 | return ("SELECT COUNT(DISTINCT ent.id) as count FROM " . static::$table . " ent ") . |
40 | 40 | |
41 | - $this->getQueryJoin($parent_id); |
|
41 | + $this->getQueryJoin($parent_id); |
|
42 | 42 | } |
43 | 43 | |
44 | 44 | # Get depth query |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | |
48 | 48 | $query = ("SELECT COUNT(DISTINCT rel.depth) as depth FROM " . static::$table . " ent ") . |
49 | 49 | |
50 | - $this->getQueryJoin($parent_id); |
|
50 | + $this->getQueryJoin($parent_id); |
|
51 | 51 | |
52 | 52 | # ------------------------ |
53 | 53 | |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | |
129 | 129 | $query = ("SELECT " . $this->getSelection() . " FROM " . static::$table . " ent ") . |
130 | 130 | |
131 | - ("JOIN " . static::$table_relations . " rel ON rel.ancestor = ent.id ") . |
|
131 | + ("JOIN " . static::$table_relations . " rel ON rel.ancestor = ent.id ") . |
|
132 | 132 | |
133 | 133 | ("WHERE rel.descendant = " . $parent_id . " ORDER BY rel.depth DESC"); |
134 | 134 |