@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | use Entitizer\Common\Page; |
17 | 17 | |
18 | 18 | /** |
19 | - * Initialize the page by a slug |
|
19 | + * Initialize the page by a slug |
|
20 | 20 | * |
21 | 21 | * @return bool : true on success or false on failure |
22 | 22 | */ |
@@ -39,13 +39,13 @@ discard block |
||
39 | 39 | |
40 | 40 | $query = ("SELECT " . implode(', ', $selection) .", rel.ancestor as parent_id ") . |
41 | 41 | |
42 | - ("FROM " . static::$table . " ent ") . |
|
42 | + ("FROM " . static::$table . " ent ") . |
|
43 | 43 | |
44 | - ("LEFT JOIN " . static::$table_relations . " rel ON rel.descendant = ent.id AND rel.depth = 1 ") . |
|
44 | + ("LEFT JOIN " . static::$table_relations . " rel ON rel.descendant = ent.id AND rel.depth = 1 ") . |
|
45 | 45 | |
46 | - ("WHERE ent.visibility = " . VISIBILITY_PUBLISHED . " AND ent.access <= " . Auth::get('rank') . " AND ") . |
|
46 | + ("WHERE ent.visibility = " . VISIBILITY_PUBLISHED . " AND ent.access <= " . Auth::get('rank') . " AND ") . |
|
47 | 47 | |
48 | - ("ent.locked = 0 AND ent.slug = '" . addslashes($slug) . "' LIMIT 1"); |
|
48 | + ("ent.locked = 0 AND ent.slug = '" . addslashes($slug) . "' LIMIT 1"); |
|
49 | 49 | |
50 | 50 | # Select entity from DB |
51 | 51 | |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | } |
58 | 58 | |
59 | 59 | /** |
60 | - * Update slugs of the page descendants |
|
60 | + * Update slugs of the page descendants |
|
61 | 61 | * |
62 | 62 | * @return bool : true on success or false on failure |
63 | 63 | */ |
@@ -70,17 +70,17 @@ discard block |
||
70 | 70 | |
71 | 71 | $query = ("UPDATE " . static::$table . " ent JOIN (") . |
72 | 72 | |
73 | - ("SELECT rel.descendant as id, GROUP_CONCAT(ens.name ORDER BY rls.depth DESC SEPARATOR '/') slug ") . |
|
73 | + ("SELECT rel.descendant as id, GROUP_CONCAT(ens.name ORDER BY rls.depth DESC SEPARATOR '/') slug ") . |
|
74 | 74 | |
75 | - ("FROM " . static::$table_relations . " rel ") . |
|
75 | + ("FROM " . static::$table_relations . " rel ") . |
|
76 | 76 | |
77 | - ("JOIN " . static::$table_relations . " rls ON rls.descendant = rel.descendant ") . |
|
77 | + ("JOIN " . static::$table_relations . " rls ON rls.descendant = rel.descendant ") . |
|
78 | 78 | |
79 | - ("JOIN " . static::$table . " ens ON ens.id = rls.ancestor ") . |
|
79 | + ("JOIN " . static::$table . " ens ON ens.id = rls.ancestor ") . |
|
80 | 80 | |
81 | - ("WHERE rel.ancestor = " . $this->id . " GROUP BY rel.descendant") . |
|
81 | + ("WHERE rel.ancestor = " . $this->id . " GROUP BY rel.descendant") . |
|
82 | 82 | |
83 | - (") slg ON slg.id = ent.id SET ent.locked = 1, ent.slug = slg.slug"); |
|
83 | + (") slg ON slg.id = ent.id SET ent.locked = 1, ent.slug = slg.slug"); |
|
84 | 84 | |
85 | 85 | if (!(DB::send($query) && DB::getLast()->status)) return false; |
86 | 86 | |
@@ -88,15 +88,15 @@ discard block |
||
88 | 88 | |
89 | 89 | $query = ("UPDATE " . static::$table . " ent JOIN (") . |
90 | 90 | |
91 | - ("SELECT rel.descendant as id FROM " . static::$table_relations . " rel ") . |
|
91 | + ("SELECT rel.descendant as id FROM " . static::$table_relations . " rel ") . |
|
92 | 92 | |
93 | - ("JOIN " . static::$table . " enc ON enc.id = rel.descendant AND enc.locked = 1 ") . |
|
93 | + ("JOIN " . static::$table . " enc ON enc.id = rel.descendant AND enc.locked = 1 ") . |
|
94 | 94 | |
95 | - ("LEFT JOIN " . static::$table . " end ON end.id != enc.id AND end.slug = enc.slug ") . |
|
95 | + ("LEFT JOIN " . static::$table . " end ON end.id != enc.id AND end.slug = enc.slug ") . |
|
96 | 96 | |
97 | - ("WHERE end.id IS NULL GROUP BY rel.descendant") . |
|
97 | + ("WHERE end.id IS NULL GROUP BY rel.descendant") . |
|
98 | 98 | |
99 | - (") chk ON chk.id = ent.id SET ent.locked = 0"); |
|
99 | + (") chk ON chk.id = ent.id SET ent.locked = 0"); |
|
100 | 100 | |
101 | 101 | if (!(DB::send($query) && DB::getLast()->status)) return false; |
102 | 102 |
@@ -32,7 +32,7 @@ |
||
32 | 32 | |
33 | 33 | return ("`" . $this->name . "` " . ($this->short ? "tiny" : "") . "int(" . $this->length . ")") . |
34 | 34 | |
35 | - (($this->unsigned ? " UNSIGNED" : "") . " NOT NULL DEFAULT '" . $this->default . "'"); |
|
35 | + (($this->unsigned ? " UNSIGNED" : "") . " NOT NULL DEFAULT '" . $this->default . "'"); |
|
36 | 36 | } |
37 | 37 | |
38 | 38 | /** |
@@ -32,7 +32,7 @@ |
||
32 | 32 | |
33 | 33 | return ("`" . $this->name . "` " . ($this->short ? ("varchar(" . $this->length . ")") : "text")) . |
34 | 34 | |
35 | - (($this->binary ? " BINARY" : "") . " NOT NULL DEFAULT '" . $this->default . "'"); |
|
35 | + (($this->binary ? " BINARY" : "") . " NOT NULL DEFAULT '" . $this->default . "'"); |
|
36 | 36 | } |
37 | 37 | |
38 | 38 | /** |
@@ -48,11 +48,11 @@ |
||
48 | 48 | |
49 | 49 | $query = ("SELECT " . implode(', ', $selection) . ", rel.ancestor as parent_id ") . |
50 | 50 | |
51 | - ("FROM " . static::$table . " ent ") . |
|
51 | + ("FROM " . static::$table . " ent ") . |
|
52 | 52 | |
53 | - ("LEFT JOIN " . static::$table_relations . " rel ON rel.descendant = ent.id AND rel.depth = 1 ") . |
|
53 | + ("LEFT JOIN " . static::$table_relations . " rel ON rel.descendant = ent.id AND rel.depth = 1 ") . |
|
54 | 54 | |
55 | - ("WHERE ent." . $name . " = '" . addslashes($value) . "' LIMIT 1"); |
|
55 | + ("WHERE ent." . $name . " = '" . addslashes($value) . "' LIMIT 1"); |
|
56 | 56 | |
57 | 57 | # ------------------------ |
58 | 58 |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | |
22 | 22 | return (0 !== $parent_id) ? (("JOIN " . static::$table_relations . " rel ") . |
23 | 23 | |
24 | - ("ON rel.ancestor = " . $parent_id . " AND rel.descendant = ent.id AND rel.depth >= 1")) : |
|
24 | + ("ON rel.ancestor = " . $parent_id . " AND rel.descendant = ent.id AND rel.depth >= 1")) : |
|
25 | 25 | |
26 | 26 | ("JOIN " . static::$table_relations . " rel ON rel.descendant = ent.id"); |
27 | 27 | } |
@@ -34,13 +34,13 @@ discard block |
||
34 | 34 | |
35 | 35 | return ("SELECT " . $this->getSelection() . ", COALESCE(par.ancestor, 0) as parent_id ") . |
36 | 36 | |
37 | - ("FROM " . static::$table . " ent " . $this->getQueryJoin($parent_id) . " ") . |
|
37 | + ("FROM " . static::$table . " ent " . $this->getQueryJoin($parent_id) . " ") . |
|
38 | 38 | |
39 | - ("LEFT JOIN " . static::$table_relations . " par ON par.descendant = ent.id AND par.depth = 1 ") . |
|
39 | + ("LEFT JOIN " . static::$table_relations . " par ON par.descendant = ent.id AND par.depth = 1 ") . |
|
40 | 40 | |
41 | - (('' !== ($condition = $this->getCondition($config))) ? ("WHERE " . $condition . " ") : "") . |
|
41 | + (('' !== ($condition = $this->getCondition($config))) ? ("WHERE " . $condition . " ") : "") . |
|
42 | 42 | |
43 | - ("GROUP BY ent.id ORDER BY MAX(rel.depth) ASC, " . $this->getOrderBy($order_by)); |
|
43 | + ("GROUP BY ent.id ORDER BY MAX(rel.depth) ASC, " . $this->getOrderBy($order_by)); |
|
44 | 44 | } |
45 | 45 | |
46 | 46 | /** |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | |
52 | 52 | return ("SELECT COUNT(DISTINCT ent.id) as count FROM " . static::$table . " ent ") . |
53 | 53 | |
54 | - $this->getQueryJoin($parent_id); |
|
54 | + $this->getQueryJoin($parent_id); |
|
55 | 55 | } |
56 | 56 | |
57 | 57 | /** |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | |
63 | 63 | $query = ("SELECT COUNT(DISTINCT rel.depth) as depth FROM " . static::$table . " ent ") . |
64 | 64 | |
65 | - $this->getQueryJoin($parent_id); |
|
65 | + $this->getQueryJoin($parent_id); |
|
66 | 66 | |
67 | 67 | # ------------------------ |
68 | 68 | |
@@ -169,7 +169,7 @@ discard block |
||
169 | 169 | |
170 | 170 | $query = ("SELECT " . $this->getSelection() . " FROM " . static::$table . " ent ") . |
171 | 171 | |
172 | - ("JOIN " . static::$table_relations . " rel ON rel.ancestor = ent.id ") . |
|
172 | + ("JOIN " . static::$table_relations . " rel ON rel.ancestor = ent.id ") . |
|
173 | 173 | |
174 | 174 | ("WHERE rel.descendant = " . $parent_id . " ORDER BY rel.depth DESC"); |
175 | 175 |
@@ -21,13 +21,13 @@ discard block |
||
21 | 21 | |
22 | 22 | return ("SELECT SQL_CALC_FOUND_ROWS " . $this->getSelection() . " ") . |
23 | 23 | |
24 | - ("FROM " . static::$table . " ent ") . |
|
24 | + ("FROM " . static::$table . " ent ") . |
|
25 | 25 | |
26 | 26 | (('' !== ($condition = $this->getCondition($config))) ? ("WHERE " . $condition . " ") : "") . |
27 | 27 | |
28 | 28 | ("ORDER BY " . $this->getOrderBy($order_by) . " ") . |
29 | 29 | |
30 | - (($index > 0) ? ("LIMIT " . ((($index - 1) * $display) . ", " . $display)) : ""); |
|
30 | + (($index > 0) ? ("LIMIT " . ((($index - 1) * $display) . ", " . $display)) : ""); |
|
31 | 31 | } |
32 | 32 | |
33 | 33 | /** |
@@ -38,9 +38,9 @@ discard block |
||
38 | 38 | |
39 | 39 | return ("SELECT SQL_CALC_FOUND_ROWS " . $this->getSelection() . ", COUNT(chd.descendant) as children ") . |
40 | 40 | |
41 | - ("FROM " . static::$table . " ent ") . |
|
41 | + ("FROM " . static::$table . " ent ") . |
|
42 | 42 | |
43 | - ("LEFT JOIN " . static::$table_relations . " chd ON chd.ancestor = ent.id AND chd.depth = 1 ") . |
|
43 | + ("LEFT JOIN " . static::$table_relations . " chd ON chd.ancestor = ent.id AND chd.depth = 1 ") . |
|
44 | 44 | |
45 | 45 | ("LEFT JOIN " . static::$table_relations . " rel ON rel.descendant = ent.id AND rel.depth = 1 ") . |
46 | 46 | |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | |
51 | 51 | ("GROUP BY ent.id ORDER BY " . $this->getOrderBy($order_by) . " ") . |
52 | 52 | |
53 | - (($index > 0) ? ("LIMIT " . ((($index - 1) * $display) . ", " . $display)) : ""); |
|
53 | + (($index > 0) ? ("LIMIT " . ((($index - 1) * $display) . ", " . $display)) : ""); |
|
54 | 54 | } |
55 | 55 | |
56 | 56 | /** |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | |
62 | 62 | return ("SELECT COUNT(ent.id) as count FROM " . static::$table . " ent ") . |
63 | 63 | |
64 | - (('' !== ($condition = $this->getCondition($config))) ? ("WHERE " . $condition) : ""); |
|
64 | + (('' !== ($condition = $this->getCondition($config))) ? ("WHERE " . $condition) : ""); |
|
65 | 65 | } |
66 | 66 | |
67 | 67 | /** |
@@ -72,11 +72,11 @@ discard block |
||
72 | 72 | |
73 | 73 | return ("SELECT COUNT(ent.id) as count FROM " . static::$table . " ent ") . |
74 | 74 | |
75 | - ("LEFT JOIN " . static::$table_relations . " rel ON rel.descendant = ent.id AND rel.depth = 1 ") . |
|
75 | + ("LEFT JOIN " . static::$table_relations . " rel ON rel.descendant = ent.id AND rel.depth = 1 ") . |
|
76 | 76 | |
77 | - ("WHERE COALESCE(rel.ancestor, 0) = " . $parent_id . " ") . |
|
77 | + ("WHERE COALESCE(rel.ancestor, 0) = " . $parent_id . " ") . |
|
78 | 78 | |
79 | - (('' !== ($condition = $this->getCondition($config))) ? ("AND " . $condition) : ""); |
|
79 | + (('' !== ($condition = $this->getCondition($config))) ? ("AND " . $condition) : ""); |
|
80 | 80 | } |
81 | 81 | |
82 | 82 | /** |