3 * @copyright Copyright (C) 2020, Friendica
5 * @license GNU AGPL version 3 or any later version
7 * This program is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU Affero General Public License as
9 * published by the Free Software Foundation, either version 3 of the
10 * License, or (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU Affero General Public License for more details.
17 * You should have received a copy of the GNU Affero General Public License
18 * along with this program. If not, see <https://www.gnu.org/licenses/>.
20 * Main view structure configuration file.
22 * Here are described all the view Friendica needs to work.
24 * Syntax (braces indicate optionale values):
27 * "<field name>" => ["table", "field"],
28 * "<field name>" => "SQL expression",
31 * "query" => "FROM `table` INNER JOIN `other-table` ..."
35 * If you need to make any change, make sure to increment the DB_UPDATE_VERSION constant value in dbstructure.config.php.
42 "id" => ["item", "id"],
43 "item-id" => ["item", "id"],
44 "post-user-id" => ["post-user", "id"],
45 "uid" => ["post-user", "uid"],
46 "parent" => ["item", "parent"],
47 "parent-user-id" => ["parent-post", "id"],
48 "uri" => ["item-uri", "uri"],
49 "uri-id" => ["post-user", "uri-id"],
50 "parent-uri" => ["parent-item-uri", "uri"],
51 "parent-uri-id" => ["post-user", "parent-uri-id"],
52 "thr-parent" => ["thr-parent-item-uri", "uri"],
53 "thr-parent-id" => ["post-user", "thr-parent-id"],
54 "guid" => ["item-uri", "guid"],
55 "wall" => ["post-user", "wall"],
56 "gravity" => ["post-user", "gravity"],
57 "extid" => ["external-item-uri", "uri"],
58 "external-id" => ["post-user", "external-id"],
59 "created" => ["post-user", "created"],
60 "edited" => ["post-user", "edited"],
61 "commented" => ["post-thread-user", "commented"],
62 "received" => ["post-user", "received"],
63 "changed" => ["post-thread-user", "changed"],
64 "post-type" => ["post-user", "post-type"],
65 "private" => ["post-user", "private"],
66 "pubmail" => ["post-thread-user", "pubmail"],
67 "visible" => ["post-user", "visible"],
68 "starred" => ["post-thread-user", "starred"],
69 "unseen" => ["post-user", "unseen"],
70 "deleted" => ["post-user", "deleted"],
71 "origin" => ["post-user", "origin"],
72 "forum_mode" => ["post-thread-user", "forum_mode"],
73 "mention" => ["post-thread-user", "mention"],
74 "global" => ["post-user", "global"],
75 "network" => ["post-user", "network"],
76 "vid" => ["post-user", "vid"],
77 "psid" => ["post-user", "psid"],
78 "verb" => "IF (`post-user`.`vid` IS NULL, '', `verb`.`name`)",
79 "title" => ["post-content", "title"],
80 "content-warning" => ["post-content", "content-warning"],
81 "raw-body" => ["post-content", "raw-body"],
82 "body" => ["post-content", "body"],
83 "rendered-hash" => ["post-content", "rendered-hash"],
84 "rendered-html" => ["post-content", "rendered-html"],
85 "language" => ["post-content", "language"],
86 "plink" => ["post-content", "plink"],
87 "location" => ["post-content", "location"],
88 "coord" => ["post-content", "coord"],
89 "app" => ["post-content", "app"],
90 "object-type" => ["post-content", "object-type"],
91 "object" => ["post-content", "object"],
92 "target-type" => ["post-content", "target-type"],
93 "target" => ["post-content", "target"],
94 "resource-id" => ["post-content", "resource-id"],
95 "contact-id" => ["post-user", "contact-id"],
96 "contact-link" => ["contact", "url"],
97 "contact-addr" => ["contact", "addr"],
98 "contact-name" => ["contact", "name"],
99 "contact-nick" => ["contact", "nick"],
100 "contact-avatar" => ["contact", "thumb"],
101 "contact-network" => ["contact", "network"],
102 "contact-blocked" => ["contact", "blocked"],
103 "contact-hidden" => ["contact", "hidden"],
104 "contact-readonly" => ["contact", "readonly"],
105 "contact-archive" => ["contact", "archive"],
106 "contact-pending" => ["contact", "pending"],
107 "contact-rel" => ["contact", "rel"],
108 "contact-uid" => ["contact", "uid"],
109 "contact-contact-type" => ["contact", "contact-type"],
110 "writable" => "IF (`post-user`.`network` IN ('apub', 'dfrn', 'dspr', 'stat'), true, `contact`.`writable`)",
111 "self" => ["contact", "self"],
112 "cid" => ["contact", "id"],
113 "alias" => ["contact", "alias"],
114 "photo" => ["contact", "photo"],
115 "name-date" => ["contact", "name-date"],
116 "uri-date" => ["contact", "uri-date"],
117 "avatar-date" => ["contact", "avatar-date"],
118 "thumb" => ["contact", "thumb"],
119 "dfrn-id" => ["contact", "dfrn-id"],
120 "author-id" => ["post-user", "author-id"],
121 "author-link" => ["author", "url"],
122 "author-addr" => ["author", "addr"],
123 "author-name" => "IF (`contact`.`url` = `author`.`url` AND `contact`.`name` != '', `contact`.`name`, `author`.`name`)",
124 "author-nick" => ["author", "nick"],
125 "author-avatar" => "IF (`contact`.`url` = `author`.`url` AND `contact`.`thumb` != '', `contact`.`thumb`, `author`.`thumb`)",
126 "author-network" => ["author", "network"],
127 "author-blocked" => ["author", "blocked"],
128 "author-hidden" => ["author", "hidden"],
129 "owner-id" => ["post-user", "owner-id"],
130 "owner-link" => ["owner", "url"],
131 "owner-addr" => ["owner", "addr"],
132 "owner-name" => "IF (`contact`.`url` = `owner`.`url` AND `contact`.`name` != '', `contact`.`name`, `owner`.`name`)",
133 "owner-nick" => ["owner", "nick"],
134 "owner-avatar" => "IF (`contact`.`url` = `owner`.`url` AND `contact`.`thumb` != '', `contact`.`thumb`, `owner`.`thumb`)",
135 "owner-network" => ["owner", "network"],
136 "owner-blocked" => ["owner", "blocked"],
137 "owner-hidden" => ["owner", "hidden"],
138 "causer-id" => ["post-user", "causer-id"],
139 "causer-link" => ["causer", "url"],
140 "causer-addr" => ["causer", "addr"],
141 "causer-name" => ["causer", "name"],
142 "causer-nick" => ["causer", "nick"],
143 "causer-avatar" => ["causer", "thumb"],
144 "causer-network" => ["causer", "network"],
145 "causer-blocked" => ["causer", "blocked"],
146 "causer-hidden" => ["causer", "hidden"],
147 "causer-contact-type" => ["causer", "contact-type"],
148 "postopts" => ["post-delivery-data", "postopts"],
149 "inform" => ["post-delivery-data", "inform"],
150 "delivery_queue_count" => ["post-delivery-data", "queue_count"],
151 "delivery_queue_done" => ["post-delivery-data", "queue_done"],
152 "delivery_queue_failed" => ["post-delivery-data", "queue_failed"],
153 "allow_cid" => "IF (`post-user`.`psid` IS NULL, '', `permissionset`.`allow_cid`)",
154 "allow_gid" => "IF (`post-user`.`psid` IS NULL, '', `permissionset`.`allow_gid`)",
155 "deny_cid" => "IF (`post-user`.`psid` IS NULL, '', `permissionset`.`deny_cid`)",
156 "deny_gid" => "IF (`post-user`.`psid` IS NULL, '', `permissionset`.`deny_gid`)",
157 "event-id" => ["post-user", "event-id"],
158 "event-created" => ["event", "created"],
159 "event-edited" => ["event", "edited"],
160 "event-start" => ["event", "start"],
161 "event-finish" => ["event", "finish"],
162 "event-summary" => ["event", "summary"],
163 "event-desc" => ["event", "desc"],
164 "event-location" => ["event", "location"],
165 "event-type" => ["event", "type"],
166 "event-nofinish" => ["event", "nofinish"],
167 "event-adjust" => ["event", "adjust"],
168 "event-ignore" => ["event", "ignore"],
169 "signed_text" => ["diaspora-interaction", "interaction"],
170 "parent-guid" => ["parent-item-uri", "guid"],
171 "parent-network" => ["parent-post", "network"],
172 "parent-author-id" => ["parent-post", "author-id"],
173 "parent-author-link" => ["parent-post-author", "url"],
174 "parent-author-name" => ["parent-post-author", "name"],
175 "parent-author-network" => ["parent-post-author", "network"],
177 "query" => "FROM `post-user`
178 STRAIGHT_JOIN `post-thread-user` ON `post-thread-user`.`uri-id` = `post-user`.`parent-uri-id` AND `post-thread-user`.`uid` = `post-user`.`uid`
179 LEFT JOIN `item` ON `item`.`uri-id` = `post-user`.`uri-id` AND `item`.`uid` = `post-user`.`uid`
180 INNER JOIN `contact` ON `contact`.`id` = `post-user`.`contact-id`
181 INNER JOIN `contact` AS `author` ON `author`.`id` = `post-user`.`author-id`
182 INNER JOIN `contact` AS `owner` ON `owner`.`id` = `post-user`.`owner-id`
183 INNER JOIN `contact` AS `causer` ON `causer`.`id` = `post-user`.`causer-id`
184 INNER JOIN `item-uri` ON `item-uri`.`id` = `post-user`.`uri-id`
185 INNER JOIN `item-uri` AS `thr-parent-item-uri` ON `thr-parent-item-uri`.`id` = `post-user`.`thr-parent-id`
186 INNER JOIN `item-uri` AS `parent-item-uri` ON `parent-item-uri`.`id` = `post-user`.`parent-uri-id`
187 LEFT JOIN `item-uri` AS `external-item-uri` ON `external-item-uri`.`id` = `post-user`.`external-id`
188 INNER JOIN `verb` ON `verb`.`id` = `post-user`.`vid`
189 LEFT JOIN `event` ON `event`.`id` = `post-user`.`event-id`
190 LEFT JOIN `diaspora-interaction` ON `diaspora-interaction`.`uri-id` = `post-user`.`uri-id`
191 LEFT JOIN `post-content` ON `post-content`.`uri-id` = `post-user`.`uri-id`
192 LEFT JOIN `post-delivery-data` ON `post-delivery-data`.`uri-id` = `post-user`.`uri-id` AND `post-user`.`origin`
193 LEFT JOIN `permissionset` ON `permissionset`.`id` = `post-user`.`psid`
194 LEFT JOIN `post-user` AS `parent-post` ON `parent-post`.`uri-id` = `post-user`.`parent-uri-id` AND `parent-post`.`uid` = `post-user`.`uid`
195 INNER JOIN `contact` AS `parent-post-author` ON `parent-post-author`.`id` = `parent-post`.`author-id`"
197 "post-thread-view" => [
199 "id" => ["item", "id"],
200 "item-id" => ["item", "id"],
201 "iid" => ["item", "id"],
202 "post-user-id" => ["post-user", "id"],
203 "uid" => ["post-thread-user", "uid"],
204 "parent" => ["item", "parent"],
205 "parent-user-id" => ["parent-post", "id"],
206 "uri" => ["item-uri", "uri"],
207 "uri-id" => ["post-thread-user", "uri-id"],
208 "parent-uri" => ["parent-item-uri", "uri"],
209 "parent-uri-id" => ["post-user", "parent-uri-id"],
210 "thr-parent" => ["thr-parent-item-uri", "uri"],
211 "thr-parent-id" => ["post-user", "thr-parent-id"],
212 "guid" => ["item-uri", "guid"],
213 "wall" => ["post-thread-user", "wall"],
214 "gravity" => ["post-user", "gravity"],
215 "extid" => ["external-item-uri", "uri"],
216 "external-id" => ["post-user", "external-id"],
217 "created" => ["post-thread-user", "created"],
218 "edited" => ["post-user", "edited"],
219 "commented" => ["post-thread-user", "commented"],
220 "received" => ["post-thread-user", "received"],
221 "changed" => ["post-thread-user", "changed"],
222 "post-type" => ["post-user", "post-type"],
223 "private" => ["post-user", "private"],
224 "pubmail" => ["post-thread-user", "pubmail"],
225 "ignored" => ["post-thread-user", "ignored"],
226 "visible" => ["post-user", "visible"],
227 "starred" => ["post-thread-user", "starred"],
228 "unseen" => ["post-thread-user", "unseen"],
229 "deleted" => ["post-user", "deleted"],
230 "origin" => ["post-thread-user", "origin"],
231 "forum_mode" => ["post-thread-user", "forum_mode"],
232 "mention" => ["post-thread-user", "mention"],
233 "global" => ["post-user", "global"],
234 "network" => ["post-thread-user", "network"],
235 "vid" => ["post-user", "vid"],
236 "psid" => ["post-thread-user", "psid"],
237 "verb" => "IF (`post-user`.`vid` IS NULL, '', `verb`.`name`)",
238 "title" => ["post-content", "title"],
239 "content-warning" => ["post-content", "content-warning"],
240 "raw-body" => ["post-content", "raw-body"],
241 "body" => ["post-content", "body"],
242 "rendered-hash" => ["post-content", "rendered-hash"],
243 "rendered-html" => ["post-content", "rendered-html"],
244 "language" => ["post-content", "language"],
245 "plink" => ["post-content", "plink"],
246 "location" => ["post-content", "location"],
247 "coord" => ["post-content", "coord"],
248 "app" => ["post-content", "app"],
249 "object-type" => ["post-content", "object-type"],
250 "object" => ["post-content", "object"],
251 "target-type" => ["post-content", "target-type"],
252 "target" => ["post-content", "target"],
253 "resource-id" => ["post-content", "resource-id"],
254 "contact-id" => ["post-thread-user", "contact-id"],
255 "contact-link" => ["contact", "url"],
256 "contact-addr" => ["contact", "addr"],
257 "contact-name" => ["contact", "name"],
258 "contact-nick" => ["contact", "nick"],
259 "contact-avatar" => ["contact", "thumb"],
260 "contact-network" => ["contact", "network"],
261 "contact-blocked" => ["contact", "blocked"],
262 "contact-hidden" => ["contact", "hidden"],
263 "contact-readonly" => ["contact", "readonly"],
264 "contact-archive" => ["contact", "archive"],
265 "contact-pending" => ["contact", "pending"],
266 "contact-rel" => ["contact", "rel"],
267 "contact-uid" => ["contact", "uid"],
268 "contact-contact-type" => ["contact", "contact-type"],
269 "writable" => "IF (`post-user`.`network` IN ('apub', 'dfrn', 'dspr', 'stat'), true, `contact`.`writable`)",
270 "self" => ["contact", "self"],
271 "cid" => ["contact", "id"],
272 "alias" => ["contact", "alias"],
273 "photo" => ["contact", "photo"],
274 "name-date" => ["contact", "name-date"],
275 "uri-date" => ["contact", "uri-date"],
276 "avatar-date" => ["contact", "avatar-date"],
277 "thumb" => ["contact", "thumb"],
278 "dfrn-id" => ["contact", "dfrn-id"],
279 "author-id" => ["post-thread-user", "author-id"],
280 "author-link" => ["author", "url"],
281 "author-addr" => ["author", "addr"],
282 "author-name" => "IF (`contact`.`url` = `author`.`url` AND `contact`.`name` != '', `contact`.`name`, `author`.`name`)",
283 "author-nick" => ["author", "nick"],
284 "author-avatar" => "IF (`contact`.`url` = `author`.`url` AND `contact`.`thumb` != '', `contact`.`thumb`, `author`.`thumb`)",
285 "author-network" => ["author", "network"],
286 "author-blocked" => ["author", "blocked"],
287 "author-hidden" => ["author", "hidden"],
288 "owner-id" => ["post-thread-user", "owner-id"],
289 "owner-link" => ["owner", "url"],
290 "owner-addr" => ["owner", "addr"],
291 "owner-name" => "IF (`contact`.`url` = `owner`.`url` AND `contact`.`name` != '', `contact`.`name`, `owner`.`name`)",
292 "owner-nick" => ["owner", "nick"],
293 "owner-avatar" => "IF (`contact`.`url` = `owner`.`url` AND `contact`.`thumb` != '', `contact`.`thumb`, `owner`.`thumb`)",
294 "owner-network" => ["owner", "network"],
295 "owner-blocked" => ["owner", "blocked"],
296 "owner-hidden" => ["owner", "hidden"],
297 "causer-id" => ["post-thread-user", "causer-id"],
298 "causer-link" => ["causer", "url"],
299 "causer-addr" => ["causer", "addr"],
300 "causer-name" => ["causer", "name"],
301 "causer-nick" => ["causer", "nick"],
302 "causer-avatar" => ["causer", "thumb"],
303 "causer-network" => ["causer", "network"],
304 "causer-blocked" => ["causer", "blocked"],
305 "causer-hidden" => ["causer", "hidden"],
306 "causer-contact-type" => ["causer", "contact-type"],
307 "postopts" => ["post-delivery-data", "postopts"],
308 "inform" => ["post-delivery-data", "inform"],
309 "delivery_queue_count" => ["post-delivery-data", "queue_count"],
310 "delivery_queue_done" => ["post-delivery-data", "queue_done"],
311 "delivery_queue_failed" => ["post-delivery-data", "queue_failed"],
312 "allow_cid" => "IF (`post-thread-user`.`psid` IS NULL, '', `permissionset`.`allow_cid`)",
313 "allow_gid" => "IF (`post-thread-user`.`psid` IS NULL, '', `permissionset`.`allow_gid`)",
314 "deny_cid" => "IF (`post-thread-user`.`psid` IS NULL, '', `permissionset`.`deny_cid`)",
315 "deny_gid" => "IF (`post-thread-user`.`psid` IS NULL, '', `permissionset`.`deny_gid`)",
316 "event-id" => ["post-user", "event-id"],
317 "event-created" => ["event", "created"],
318 "event-edited" => ["event", "edited"],
319 "event-start" => ["event", "start"],
320 "event-finish" => ["event", "finish"],
321 "event-summary" => ["event", "summary"],
322 "event-desc" => ["event", "desc"],
323 "event-location" => ["event", "location"],
324 "event-type" => ["event", "type"],
325 "event-nofinish" => ["event", "nofinish"],
326 "event-adjust" => ["event", "adjust"],
327 "event-ignore" => ["event", "ignore"],
328 "signed_text" => ["diaspora-interaction", "interaction"],
329 "parent-guid" => ["parent-item-uri", "guid"],
330 "parent-network" => ["parent-post", "network"],
331 "parent-author-id" => ["parent-post", "author-id"],
332 "parent-author-link" => ["parent-post-author", "url"],
333 "parent-author-name" => ["parent-post-author", "name"],
334 "parent-author-network" => ["parent-post-author", "network"],
336 "query" => "FROM `post-thread-user`
337 INNER JOIN `post-user` ON `post-user`.`id` = `post-thread-user`.`post-user-id`
338 LEFT JOIN `item` ON `item`.`uri-id` = `post-thread-user`.`uri-id` AND `item`.`uid` = `post-thread-user`.`uid`
339 INNER JOIN `contact` ON `contact`.`id` = `post-thread-user`.`contact-id`
340 INNER JOIN `contact` AS `author` ON `author`.`id` = `post-thread-user`.`author-id`
341 INNER JOIN `contact` AS `owner` ON `owner`.`id` = `post-thread-user`.`owner-id`
342 INNER JOIN `contact` AS `causer` ON `causer`.`id` = `post-thread-user`.`causer-id`
343 INNER JOIN `item-uri` ON `item-uri`.`id` = `post-user`.`uri-id`
344 INNER JOIN `item-uri` AS `thr-parent-item-uri` ON `thr-parent-item-uri`.`id` = `post-user`.`thr-parent-id`
345 INNER JOIN `item-uri` AS `parent-item-uri` ON `parent-item-uri`.`id` = `post-user`.`parent-uri-id`
346 LEFT JOIN `item-uri` AS `external-item-uri` ON `external-item-uri`.`id` = `post-user`.`external-id`
347 INNER JOIN `verb` ON `verb`.`id` = `post-user`.`vid`
348 LEFT JOIN `event` ON `event`.`id` = `post-user`.`event-id`
349 LEFT JOIN `diaspora-interaction` ON `diaspora-interaction`.`uri-id` = `post-thread-user`.`uri-id`
350 LEFT JOIN `post-content` ON `post-content`.`uri-id` = `post-thread-user`.`uri-id`
351 LEFT JOIN `post-delivery-data` ON `post-delivery-data`.`uri-id` = `post-thread-user`.`uri-id` AND `post-thread-user`.`origin`
352 LEFT JOIN `permissionset` ON `permissionset`.`id` = `post-thread-user`.`psid`
353 LEFT JOIN `post-user` AS `parent-post` ON `parent-post`.`uri-id` = `post-user`.`parent-uri-id` AND `parent-post`.`uid` = `post-user`.`uid`
354 INNER JOIN `contact` AS `parent-post-author` ON `parent-post-author`.`id` = `parent-post`.`author-id`"
358 "uri-id" => ["post-category", "uri-id"],
359 "uid" => ["post-category", "uid"],
360 "type" => ["post-category", "type"],
361 "tid" => ["post-category", "tid"],
362 "name" => ["tag", "name"],
363 "url" => ["tag", "url"],
365 "query" => "FROM `post-category`
366 LEFT JOIN `tag` ON `post-category`.`tid` = `tag`.`id`"
370 "uri-id" => ["post-tag", "uri-id"],
371 "type" => ["post-tag", "type"],
372 "tid" => ["post-tag", "tid"],
373 "cid" => ["post-tag", "cid"],
374 "name" => "CASE `cid` WHEN 0 THEN `tag`.`name` ELSE `contact`.`name` END",
375 "url" => "CASE `cid` WHEN 0 THEN `tag`.`url` ELSE `contact`.`url` END",
377 "query" => "FROM `post-tag`
378 LEFT JOIN `tag` ON `post-tag`.`tid` = `tag`.`id`
379 LEFT JOIN `contact` ON `post-tag`.`cid` = `contact`.`id`"
381 "network-item-view" => [
383 "uri-id" => ["post-user", "uri-id"],
384 "parent" => ["item", "parent"],
385 "parent-uri-id" => ["post-user", "parent-uri-id"],
386 "received" => ["post-user", "received"],
387 "commented" => ["post-thread-user", "commented"],
388 "created" => ["post-user", "created"],
389 "uid" => ["post-user", "uid"],
390 "starred" => ["post-thread-user", "starred"],
391 "mention" => ["post-thread-user", "mention"],
392 "network" => ["post-user", "network"],
393 "unseen" => ["post-user", "unseen"],
394 "gravity" => ["post-user", "gravity"],
395 "contact-id" => ["post-user", "contact-id"],
396 "contact-type" => ["ownercontact", "contact-type"],
398 "query" => "FROM `post-user`
399 STRAIGHT_JOIN `post-thread-user` ON `post-thread-user`.`uri-id` = `post-user`.`parent-uri-id` AND `post-thread-user`.`uid` = `post-user`.`uid`
400 LEFT JOIN `item` ON `item`.`uri-id` = `post-user`.`uri-id` AND `item`.`uid` = `post-user`.`uid`
401 INNER JOIN `contact` ON `contact`.`id` = `post-thread-user`.`contact-id`
402 LEFT JOIN `user-contact` AS `author` ON `author`.`uid` = `post-thread-user`.`uid` AND `author`.`cid` = `post-thread-user`.`author-id`
403 LEFT JOIN `user-contact` AS `owner` ON `owner`.`uid` = `post-thread-user`.`uid` AND `owner`.`cid` = `post-thread-user`.`owner-id`
404 INNER JOIN `contact` AS `ownercontact` ON `ownercontact`.`id` = `post-thread-user`.`owner-id`
405 WHERE `post-user`.`visible` AND NOT `post-user`.`deleted`
406 AND (NOT `contact`.`readonly` AND NOT `contact`.`blocked` AND NOT `contact`.`pending`)
407 AND (`post-user`.`hidden` IS NULL OR NOT `post-user`.`hidden`)
408 AND (`author`.`blocked` IS NULL OR NOT `author`.`blocked`)
409 AND (`owner`.`blocked` IS NULL OR NOT `owner`.`blocked`)"
411 "network-thread-view" => [
413 "uri-id" => ["post-thread-user", "uri-id"],
414 "parent-uri-id" => ["post-user", "parent-uri-id"],
415 "parent" => ["item", "id"],
416 "received" => ["post-thread-user", "received"],
417 "commented" => ["post-thread-user", "commented"],
418 "created" => ["post-thread-user", "created"],
419 "uid" => ["post-thread-user", "uid"],
420 "starred" => ["post-thread-user", "starred"],
421 "mention" => ["post-thread-user", "mention"],
422 "network" => ["post-thread-user", "network"],
423 "contact-id" => ["post-thread-user", "contact-id"],
424 "contact-type" => ["ownercontact", "contact-type"],
426 "query" => "FROM `post-thread-user`
427 INNER JOIN `post-user` ON `post-user`.`id` = `post-thread-user`.`post-user-id`
428 LEFT JOIN `item` ON `item`.`uri-id` = `post-thread-user`.`uri-id` AND `item`.`uid` = `post-thread-user`.`uid`
429 STRAIGHT_JOIN `contact` ON `contact`.`id` = `post-thread-user`.`contact-id`
430 LEFT JOIN `user-contact` AS `author` ON `author`.`uid` = `post-thread-user`.`uid` AND `author`.`cid` = `post-thread-user`.`author-id`
431 LEFT JOIN `user-contact` AS `owner` ON `owner`.`uid` = `post-thread-user`.`uid` AND `owner`.`cid` = `post-thread-user`.`owner-id`
432 LEFT JOIN `contact` AS `ownercontact` ON `ownercontact`.`id` = `post-thread-user`.`owner-id`
433 WHERE `post-user`.`visible` AND NOT `post-user`.`deleted`
434 AND (NOT `contact`.`readonly` AND NOT `contact`.`blocked` AND NOT `contact`.`pending`)
435 AND (`post-thread-user`.`hidden` IS NULL OR NOT `post-thread-user`.`hidden`)
436 AND (`author`.`blocked` IS NULL OR NOT `author`.`blocked`)
437 AND (`owner`.`blocked` IS NULL OR NOT `owner`.`blocked`)"
441 "id" => ["contact", "id"],
442 "uid" => ["contact", "uid"],
443 "created" => ["contact", "created"],
444 "updated" => ["contact", "updated"],
445 "self" => ["contact", "self"],
446 "remote_self" => ["contact", "remote_self"],
447 "rel" => ["contact", "rel"],
448 "duplex" => ["contact", "duplex"],
449 "network" => ["contact", "network"],
450 "protocol" => ["contact", "protocol"],
451 "name" => ["contact", "name"],
452 "nick" => ["contact", "nick"],
453 "location" => ["contact", "location"],
454 "about" => ["contact", "about"],
455 "keywords" => ["contact", "keywords"],
456 "gender" => ["contact", "gender"],
457 "xmpp" => ["contact", "xmpp"],
458 "attag" => ["contact", "attag"],
459 "avatar" => ["contact", "avatar"],
460 "photo" => ["contact", "photo"],
461 "thumb" => ["contact", "thumb"],
462 "micro" => ["contact", "micro"],
463 "site-pubkey" => ["contact", "site-pubkey"],
464 "issued-id" => ["contact", "issued-id"],
465 "dfrn-id" => ["contact", "dfrn-id"],
466 "url" => ["contact", "url"],
467 "nurl" => ["contact", "nurl"],
468 "addr" => ["contact", "addr"],
469 "alias" => ["contact", "alias"],
470 "pubkey" => ["contact", "pubkey"],
471 "prvkey" => ["contact", "prvkey"],
472 "batch" => ["contact", "batch"],
473 "request" => ["contact", "request"],
474 "notify" => ["contact", "notify"],
475 "poll" => ["contact", "poll"],
476 "confirm" => ["contact", "confirm"],
477 "poco" => ["contact", "poco"],
478 "aes_allow" => ["contact", "aes_allow"],
479 "ret-aes" => ["contact", "ret-aes"],
480 "usehub" => ["contact", "usehub"],
481 "subhub" => ["contact", "subhub"],
482 "hub-verify" => ["contact", "hub-verify"],
483 "last-update" => ["contact", "last-update"],
484 "success_update" => ["contact", "success_update"],
485 "failure_update" => ["contact", "failure_update"],
486 "name-date" => ["contact", "name-date"],
487 "uri-date" => ["contact", "uri-date"],
488 "avatar-date" => ["contact", "avatar-date"],
489 "picdate" => ["contact", "avatar-date"], /// @todo Replaces all uses of "picdate" with "avatar-date"
490 "term-date" => ["contact", "term-date"],
491 "last-item" => ["contact", "last-item"],
492 "priority" => ["contact", "priority"],
493 "blocked" => ["user", "blocked"],
494 "block_reason" => ["contact", "block_reason"],
495 "readonly" => ["contact", "readonly"],
496 "writable" => ["contact", "writable"],
497 "forum" => ["contact", "forum"],
498 "prv" => ["contact", "prv"],
499 "contact-type" => ["contact", "contact-type"],
500 "manually-approve" => ["contact", "manually-approve"],
501 "hidden" => ["contact", "hidden"],
502 "archive" => ["contact", "archive"],
503 "pending" => ["contact", "pending"],
504 "deleted" => ["contact", "deleted"],
505 "unsearchable" => ["contact", "unsearchable"],
506 "sensitive" => ["contact", "sensitive"],
507 "baseurl" => ["contact", "baseurl"],
508 "reason" => ["contact", "reason"],
509 "closeness" => ["contact", "closeness"],
510 "info" => ["contact", "info"],
511 "profile-id" => ["contact", "profile-id"],
512 "bdyear" => ["contact", "bdyear"],
513 "bd" => ["contact", "bd"],
514 "notify_new_posts" => ["contact", "notify_new_posts"],
515 "fetch_further_information" => ["contact", "fetch_further_information"],
516 "ffi_keyword_denylist" => ["contact", "ffi_keyword_denylist"],
517 "parent-uid" => ["user", "parent-uid"],
518 "guid" => ["user", "guid"],
519 "nickname" => ["user", "nickname"], /// @todo Replaces all uses of "nickname" with "nick"
520 "email" => ["user", "email"],
521 "openid" => ["user", "openid"],
522 "timezone" => ["user", "timezone"],
523 "language" => ["user", "language"],
524 "register_date" => ["user", "register_date"],
525 "login_date" => ["user", "login_date"],
526 "default-location" => ["user", "default-location"],
527 "allow_location" => ["user", "allow_location"],
528 "theme" => ["user", "theme"],
529 "upubkey" => ["user", "pubkey"],
530 "uprvkey" => ["user", "prvkey"],
531 "sprvkey" => ["user", "sprvkey"],
532 "spubkey" => ["user", "spubkey"],
533 "verified" => ["user", "verified"],
534 "blockwall" => ["user", "blockwall"],
535 "hidewall" => ["user", "hidewall"],
536 "blocktags" => ["user", "blocktags"],
537 "unkmail" => ["user", "unkmail"],
538 "cntunkmail" => ["user", "cntunkmail"],
539 "notify-flags" => ["user", "notify-flags"],
540 "page-flags" => ["user", "page-flags"],
541 "account-type" => ["user", "account-type"],
542 "prvnets" => ["user", "prvnets"],
543 "maxreq" => ["user", "maxreq"],
544 "expire" => ["user", "expire"],
545 "account_removed" => ["user", "account_removed"],
546 "account_expired" => ["user", "account_expired"],
547 "account_expires_on" => ["user", "account_expires_on"],
548 "expire_notification_sent" => ["user", "expire_notification_sent"],
549 "def_gid" => ["user", "def_gid"],
550 "allow_cid" => ["user", "allow_cid"],
551 "allow_gid" => ["user", "allow_gid"],
552 "deny_cid" => ["user", "deny_cid"],
553 "deny_gid" => ["user", "deny_gid"],
554 "openidserver" => ["user", "openidserver"],
555 "publish" => ["profile", "publish"],
556 "net-publish" => ["profile", "net-publish"],
557 "hide-friends" => ["profile", "hide-friends"],
558 "prv_keywords" => ["profile", "prv_keywords"],
559 "pub_keywords" => ["profile", "pub_keywords"],
560 "address" => ["profile", "address"],
561 "locality" => ["profile", "locality"],
562 "region" => ["profile", "region"],
563 "postal-code" => ["profile", "postal-code"],
564 "country-name" => ["profile", "country-name"],
565 "homepage" => ["profile", "homepage"],
566 "dob" => ["profile", "dob"],
568 "query" => "FROM `user`
569 INNER JOIN `contact` ON `contact`.`uid` = `user`.`uid` AND `contact`.`self`
570 INNER JOIN `profile` ON `profile`.`uid` = `user`.`uid`"
574 "id" => ["register", "id"],
575 "hash" => ["register", "hash"],
576 "created" => ["register", "created"],
577 "uid" => ["register", "uid"],
578 "password" => ["register", "password"],
579 "language" => ["register", "language"],
580 "note" => ["register", "note"],
581 "self" => ["contact", "self"],
582 "name" => ["contact", "name"],
583 "url" => ["contact", "url"],
584 "micro" => ["contact", "micro"],
585 "email" => ["user", "email"],
586 "nick" => ["contact", "nick"],
588 "query" => "FROM `register`
589 INNER JOIN `contact` ON `register`.`uid` = `contact`.`uid`
590 INNER JOIN `user` ON `register`.`uid` = `user`.`uid`"
592 "tag-search-view" => [
594 "uri-id" => ["post-tag", "uri-id"],
595 "uid" => ["post-user", "uid"],
596 "private" => ["post-user", "private"],
597 "wall" => ["post-user", "wall"],
598 "origin" => ["post-user", "origin"],
599 "gravity" => ["post-user", "gravity"],
600 "received" => ["post-user", "received"],
601 "name" => ["tag", "name"],
603 "query" => "FROM `post-tag`
604 INNER JOIN `tag` ON `tag`.`id` = `post-tag`.`tid`
605 STRAIGHT_JOIN `post-user` ON `post-user`.`uri-id` = `post-tag`.`uri-id`
606 WHERE `post-tag`.`type` = 1"
608 "workerqueue-view" => [
610 "pid" => ["process", "pid"],
611 "priority" => ["workerqueue", "priority"],
613 "query" => "FROM `process`
614 INNER JOIN `workerqueue` ON `workerqueue`.`pid` = `process`.`pid`
615 WHERE NOT `workerqueue`.`done`"