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" => ["post-user", "id"],
43 "post-user-id" => ["post-user", "id"],
44 "uid" => ["post-user", "uid"],
45 "parent" => ["parent-post", "id"],
46 "uri" => ["item-uri", "uri"],
47 "uri-id" => ["post-user", "uri-id"],
48 "parent-uri" => ["parent-item-uri", "uri"],
49 "parent-uri-id" => ["post-user", "parent-uri-id"],
50 "thr-parent" => ["thr-parent-item-uri", "uri"],
51 "thr-parent-id" => ["post-user", "thr-parent-id"],
52 "guid" => ["item-uri", "guid"],
53 "wall" => ["post-user", "wall"],
54 "gravity" => ["post-user", "gravity"],
55 "extid" => ["external-item-uri", "uri"],
56 "external-id" => ["post-user", "external-id"],
57 "created" => ["post-user", "created"],
58 "edited" => ["post-user", "edited"],
59 "commented" => ["post-thread-user", "commented"],
60 "received" => ["post-user", "received"],
61 "changed" => ["post-thread-user", "changed"],
62 "post-type" => ["post-user", "post-type"],
63 "private" => ["post-user", "private"],
64 "pubmail" => ["post-thread-user", "pubmail"],
65 "visible" => ["post-user", "visible"],
66 "starred" => ["post-thread-user", "starred"],
67 "unseen" => ["post-user", "unseen"],
68 "deleted" => ["post-user", "deleted"],
69 "origin" => ["post-user", "origin"],
70 "parent-origin" => ["post-thread-user", "origin"],
71 "forum_mode" => ["post-thread-user", "forum_mode"],
72 "mention" => ["post-thread-user", "mention"],
73 "global" => ["post-user", "global"],
74 "network" => ["post-user", "network"],
75 "vid" => ["post-user", "vid"],
76 "psid" => ["post-user", "psid"],
77 "verb" => "IF (`post-user`.`vid` IS NULL, '', `verb`.`name`)",
78 "title" => ["post-content", "title"],
79 "content-warning" => ["post-content", "content-warning"],
80 "raw-body" => ["post-content", "raw-body"],
81 "body" => ["post-content", "body"],
82 "rendered-hash" => ["post-content", "rendered-hash"],
83 "rendered-html" => ["post-content", "rendered-html"],
84 "language" => ["post-content", "language"],
85 "plink" => ["post-content", "plink"],
86 "location" => ["post-content", "location"],
87 "coord" => ["post-content", "coord"],
88 "app" => ["post-content", "app"],
89 "object-type" => ["post-content", "object-type"],
90 "object" => ["post-content", "object"],
91 "target-type" => ["post-content", "target-type"],
92 "target" => ["post-content", "target"],
93 "resource-id" => ["post-content", "resource-id"],
94 "contact-id" => ["post-user", "contact-id"],
95 "contact-link" => ["contact", "url"],
96 "contact-addr" => ["contact", "addr"],
97 "contact-name" => ["contact", "name"],
98 "contact-nick" => ["contact", "nick"],
99 "contact-avatar" => ["contact", "thumb"],
100 "contact-network" => ["contact", "network"],
101 "contact-blocked" => ["contact", "blocked"],
102 "contact-hidden" => ["contact", "hidden"],
103 "contact-readonly" => ["contact", "readonly"],
104 "contact-archive" => ["contact", "archive"],
105 "contact-pending" => ["contact", "pending"],
106 "contact-rel" => ["contact", "rel"],
107 "contact-uid" => ["contact", "uid"],
108 "contact-contact-type" => ["contact", "contact-type"],
109 "writable" => "IF (`post-user`.`network` IN ('apub', 'dfrn', 'dspr', 'stat'), true, `contact`.`writable`)",
110 "self" => ["contact", "self"],
111 "cid" => ["contact", "id"],
112 "alias" => ["contact", "alias"],
113 "photo" => ["contact", "photo"],
114 "name-date" => ["contact", "name-date"],
115 "uri-date" => ["contact", "uri-date"],
116 "avatar-date" => ["contact", "avatar-date"],
117 "thumb" => ["contact", "thumb"],
118 "dfrn-id" => ["contact", "dfrn-id"],
119 "author-id" => ["post-user", "author-id"],
120 "author-link" => ["author", "url"],
121 "author-addr" => ["author", "addr"],
122 "author-name" => "IF (`contact`.`url` = `author`.`url` AND `contact`.`name` != '', `contact`.`name`, `author`.`name`)",
123 "author-nick" => ["author", "nick"],
124 "author-avatar" => "IF (`contact`.`url` = `author`.`url` AND `contact`.`thumb` != '', `contact`.`thumb`, `author`.`thumb`)",
125 "author-network" => ["author", "network"],
126 "author-blocked" => ["author", "blocked"],
127 "author-hidden" => ["author", "hidden"],
128 "owner-id" => ["post-user", "owner-id"],
129 "owner-link" => ["owner", "url"],
130 "owner-addr" => ["owner", "addr"],
131 "owner-name" => "IF (`contact`.`url` = `owner`.`url` AND `contact`.`name` != '', `contact`.`name`, `owner`.`name`)",
132 "owner-nick" => ["owner", "nick"],
133 "owner-avatar" => "IF (`contact`.`url` = `owner`.`url` AND `contact`.`thumb` != '', `contact`.`thumb`, `owner`.`thumb`)",
134 "owner-network" => ["owner", "network"],
135 "owner-blocked" => ["owner", "blocked"],
136 "owner-hidden" => ["owner", "hidden"],
137 "owner-contact-type" => ["owner", "contact-type"],
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 `contact` ON `contact`.`id` = `post-user`.`contact-id`
180 LEFT JOIN `contact` AS `author` ON `author`.`id` = `post-user`.`author-id`
181 LEFT JOIN `contact` AS `owner` ON `owner`.`id` = `post-user`.`owner-id`
182 LEFT JOIN `contact` AS `causer` ON `causer`.`id` = `post-user`.`causer-id`
183 LEFT JOIN `item-uri` ON `item-uri`.`id` = `post-user`.`uri-id`
184 LEFT JOIN `item-uri` AS `thr-parent-item-uri` ON `thr-parent-item-uri`.`id` = `post-user`.`thr-parent-id`
185 LEFT JOIN `item-uri` AS `parent-item-uri` ON `parent-item-uri`.`id` = `post-user`.`parent-uri-id`
186 LEFT JOIN `item-uri` AS `external-item-uri` ON `external-item-uri`.`id` = `post-user`.`external-id`
187 LEFT JOIN `verb` ON `verb`.`id` = `post-user`.`vid`
188 LEFT JOIN `event` ON `event`.`id` = `post-user`.`event-id`
189 LEFT JOIN `diaspora-interaction` ON `diaspora-interaction`.`uri-id` = `post-user`.`uri-id`
190 LEFT JOIN `post-content` ON `post-content`.`uri-id` = `post-user`.`uri-id`
191 LEFT JOIN `post-delivery-data` ON `post-delivery-data`.`uri-id` = `post-user`.`uri-id` AND `post-user`.`origin`
192 LEFT JOIN `permissionset` ON `permissionset`.`id` = `post-user`.`psid`
193 LEFT JOIN `post-user` AS `parent-post` ON `parent-post`.`uri-id` = `post-user`.`parent-uri-id` AND `parent-post`.`uid` = `post-user`.`uid`
194 LEFT JOIN `contact` AS `parent-post-author` ON `parent-post-author`.`id` = `parent-post`.`author-id`"
196 "post-thread-view" => [
198 "id" => ["post-user", "id"],
199 "post-user-id" => ["post-user", "id"],
200 "uid" => ["post-thread-user", "uid"],
201 "parent" => ["parent-post", "id"],
202 "uri" => ["item-uri", "uri"],
203 "uri-id" => ["post-thread-user", "uri-id"],
204 "parent-uri" => ["parent-item-uri", "uri"],
205 "parent-uri-id" => ["post-user", "parent-uri-id"],
206 "thr-parent" => ["thr-parent-item-uri", "uri"],
207 "thr-parent-id" => ["post-user", "thr-parent-id"],
208 "guid" => ["item-uri", "guid"],
209 "wall" => ["post-thread-user", "wall"],
210 "gravity" => ["post-user", "gravity"],
211 "extid" => ["external-item-uri", "uri"],
212 "external-id" => ["post-user", "external-id"],
213 "created" => ["post-thread-user", "created"],
214 "edited" => ["post-user", "edited"],
215 "commented" => ["post-thread-user", "commented"],
216 "received" => ["post-thread-user", "received"],
217 "changed" => ["post-thread-user", "changed"],
218 "post-type" => ["post-user", "post-type"],
219 "private" => ["post-user", "private"],
220 "pubmail" => ["post-thread-user", "pubmail"],
221 "ignored" => ["post-thread-user", "ignored"],
222 "visible" => ["post-user", "visible"],
223 "starred" => ["post-thread-user", "starred"],
224 "unseen" => ["post-thread-user", "unseen"],
225 "deleted" => ["post-user", "deleted"],
226 "origin" => ["post-thread-user", "origin"],
227 "forum_mode" => ["post-thread-user", "forum_mode"],
228 "mention" => ["post-thread-user", "mention"],
229 "global" => ["post-user", "global"],
230 "network" => ["post-thread-user", "network"],
231 "vid" => ["post-user", "vid"],
232 "psid" => ["post-thread-user", "psid"],
233 "verb" => "IF (`post-user`.`vid` IS NULL, '', `verb`.`name`)",
234 "title" => ["post-content", "title"],
235 "content-warning" => ["post-content", "content-warning"],
236 "raw-body" => ["post-content", "raw-body"],
237 "body" => ["post-content", "body"],
238 "rendered-hash" => ["post-content", "rendered-hash"],
239 "rendered-html" => ["post-content", "rendered-html"],
240 "language" => ["post-content", "language"],
241 "plink" => ["post-content", "plink"],
242 "location" => ["post-content", "location"],
243 "coord" => ["post-content", "coord"],
244 "app" => ["post-content", "app"],
245 "object-type" => ["post-content", "object-type"],
246 "object" => ["post-content", "object"],
247 "target-type" => ["post-content", "target-type"],
248 "target" => ["post-content", "target"],
249 "resource-id" => ["post-content", "resource-id"],
250 "contact-id" => ["post-thread-user", "contact-id"],
251 "contact-link" => ["contact", "url"],
252 "contact-addr" => ["contact", "addr"],
253 "contact-name" => ["contact", "name"],
254 "contact-nick" => ["contact", "nick"],
255 "contact-avatar" => ["contact", "thumb"],
256 "contact-network" => ["contact", "network"],
257 "contact-blocked" => ["contact", "blocked"],
258 "contact-hidden" => ["contact", "hidden"],
259 "contact-readonly" => ["contact", "readonly"],
260 "contact-archive" => ["contact", "archive"],
261 "contact-pending" => ["contact", "pending"],
262 "contact-rel" => ["contact", "rel"],
263 "contact-uid" => ["contact", "uid"],
264 "contact-contact-type" => ["contact", "contact-type"],
265 "writable" => "IF (`post-user`.`network` IN ('apub', 'dfrn', 'dspr', 'stat'), true, `contact`.`writable`)",
266 "self" => ["contact", "self"],
267 "cid" => ["contact", "id"],
268 "alias" => ["contact", "alias"],
269 "photo" => ["contact", "photo"],
270 "name-date" => ["contact", "name-date"],
271 "uri-date" => ["contact", "uri-date"],
272 "avatar-date" => ["contact", "avatar-date"],
273 "thumb" => ["contact", "thumb"],
274 "dfrn-id" => ["contact", "dfrn-id"],
275 "author-id" => ["post-thread-user", "author-id"],
276 "author-link" => ["author", "url"],
277 "author-addr" => ["author", "addr"],
278 "author-name" => "IF (`contact`.`url` = `author`.`url` AND `contact`.`name` != '', `contact`.`name`, `author`.`name`)",
279 "author-nick" => ["author", "nick"],
280 "author-avatar" => "IF (`contact`.`url` = `author`.`url` AND `contact`.`thumb` != '', `contact`.`thumb`, `author`.`thumb`)",
281 "author-network" => ["author", "network"],
282 "author-blocked" => ["author", "blocked"],
283 "author-hidden" => ["author", "hidden"],
284 "owner-id" => ["post-thread-user", "owner-id"],
285 "owner-link" => ["owner", "url"],
286 "owner-addr" => ["owner", "addr"],
287 "owner-name" => "IF (`contact`.`url` = `owner`.`url` AND `contact`.`name` != '', `contact`.`name`, `owner`.`name`)",
288 "owner-nick" => ["owner", "nick"],
289 "owner-avatar" => "IF (`contact`.`url` = `owner`.`url` AND `contact`.`thumb` != '', `contact`.`thumb`, `owner`.`thumb`)",
290 "owner-network" => ["owner", "network"],
291 "owner-blocked" => ["owner", "blocked"],
292 "owner-hidden" => ["owner", "hidden"],
293 "owner-contact-type" => ["owner", "contact-type"],
294 "causer-id" => ["post-thread-user", "causer-id"],
295 "causer-link" => ["causer", "url"],
296 "causer-addr" => ["causer", "addr"],
297 "causer-name" => ["causer", "name"],
298 "causer-nick" => ["causer", "nick"],
299 "causer-avatar" => ["causer", "thumb"],
300 "causer-network" => ["causer", "network"],
301 "causer-blocked" => ["causer", "blocked"],
302 "causer-hidden" => ["causer", "hidden"],
303 "causer-contact-type" => ["causer", "contact-type"],
304 "postopts" => ["post-delivery-data", "postopts"],
305 "inform" => ["post-delivery-data", "inform"],
306 "delivery_queue_count" => ["post-delivery-data", "queue_count"],
307 "delivery_queue_done" => ["post-delivery-data", "queue_done"],
308 "delivery_queue_failed" => ["post-delivery-data", "queue_failed"],
309 "allow_cid" => "IF (`post-thread-user`.`psid` IS NULL, '', `permissionset`.`allow_cid`)",
310 "allow_gid" => "IF (`post-thread-user`.`psid` IS NULL, '', `permissionset`.`allow_gid`)",
311 "deny_cid" => "IF (`post-thread-user`.`psid` IS NULL, '', `permissionset`.`deny_cid`)",
312 "deny_gid" => "IF (`post-thread-user`.`psid` IS NULL, '', `permissionset`.`deny_gid`)",
313 "event-id" => ["post-user", "event-id"],
314 "event-created" => ["event", "created"],
315 "event-edited" => ["event", "edited"],
316 "event-start" => ["event", "start"],
317 "event-finish" => ["event", "finish"],
318 "event-summary" => ["event", "summary"],
319 "event-desc" => ["event", "desc"],
320 "event-location" => ["event", "location"],
321 "event-type" => ["event", "type"],
322 "event-nofinish" => ["event", "nofinish"],
323 "event-adjust" => ["event", "adjust"],
324 "event-ignore" => ["event", "ignore"],
325 "signed_text" => ["diaspora-interaction", "interaction"],
326 "parent-guid" => ["parent-item-uri", "guid"],
327 "parent-network" => ["parent-post", "network"],
328 "parent-author-id" => ["parent-post", "author-id"],
329 "parent-author-link" => ["parent-post-author", "url"],
330 "parent-author-name" => ["parent-post-author", "name"],
331 "parent-author-network" => ["parent-post-author", "network"],
333 "query" => "FROM `post-thread-user`
334 INNER JOIN `post-user` ON `post-user`.`id` = `post-thread-user`.`post-user-id`
335 LEFT JOIN `contact` ON `contact`.`id` = `post-thread-user`.`contact-id`
336 LEFT JOIN `contact` AS `author` ON `author`.`id` = `post-thread-user`.`author-id`
337 LEFT JOIN `contact` AS `owner` ON `owner`.`id` = `post-thread-user`.`owner-id`
338 LEFT JOIN `contact` AS `causer` ON `causer`.`id` = `post-thread-user`.`causer-id`
339 LEFT JOIN `item-uri` ON `item-uri`.`id` = `post-thread-user`.`uri-id`
340 LEFT JOIN `item-uri` AS `thr-parent-item-uri` ON `thr-parent-item-uri`.`id` = `post-user`.`thr-parent-id`
341 LEFT JOIN `item-uri` AS `parent-item-uri` ON `parent-item-uri`.`id` = `post-user`.`parent-uri-id`
342 LEFT JOIN `item-uri` AS `external-item-uri` ON `external-item-uri`.`id` = `post-user`.`external-id`
343 LEFT JOIN `verb` ON `verb`.`id` = `post-user`.`vid`
344 LEFT JOIN `event` ON `event`.`id` = `post-user`.`event-id`
345 LEFT JOIN `diaspora-interaction` ON `diaspora-interaction`.`uri-id` = `post-thread-user`.`uri-id`
346 LEFT JOIN `post-content` ON `post-content`.`uri-id` = `post-thread-user`.`uri-id`
347 LEFT JOIN `post-delivery-data` ON `post-delivery-data`.`uri-id` = `post-thread-user`.`uri-id` AND `post-thread-user`.`origin`
348 LEFT JOIN `permissionset` ON `permissionset`.`id` = `post-thread-user`.`psid`
349 LEFT JOIN `post-user` AS `parent-post` ON `parent-post`.`uri-id` = `post-user`.`parent-uri-id` AND `parent-post`.`uid` = `post-thread-user`.`uid`
350 LEFT JOIN `contact` AS `parent-post-author` ON `parent-post-author`.`id` = `parent-post`.`author-id`"
354 "uri-id" => ["post-category", "uri-id"],
355 "uid" => ["post-category", "uid"],
356 "type" => ["post-category", "type"],
357 "tid" => ["post-category", "tid"],
358 "name" => ["tag", "name"],
359 "url" => ["tag", "url"],
361 "query" => "FROM `post-category`
362 LEFT JOIN `tag` ON `post-category`.`tid` = `tag`.`id`"
366 "uri-id" => ["post-tag", "uri-id"],
367 "type" => ["post-tag", "type"],
368 "tid" => ["post-tag", "tid"],
369 "cid" => ["post-tag", "cid"],
370 "name" => "CASE `cid` WHEN 0 THEN `tag`.`name` ELSE `contact`.`name` END",
371 "url" => "CASE `cid` WHEN 0 THEN `tag`.`url` ELSE `contact`.`url` END",
373 "query" => "FROM `post-tag`
374 LEFT JOIN `tag` ON `post-tag`.`tid` = `tag`.`id`
375 LEFT JOIN `contact` ON `post-tag`.`cid` = `contact`.`id`"
377 "network-item-view" => [
379 "uri-id" => ["post-user", "uri-id"],
380 "parent" => ["parent-post", "id"],
381 "received" => ["post-user", "received"],
382 "commented" => ["post-thread-user", "commented"],
383 "created" => ["post-user", "created"],
384 "uid" => ["post-user", "uid"],
385 "starred" => ["post-thread-user", "starred"],
386 "mention" => ["post-thread-user", "mention"],
387 "network" => ["post-user", "network"],
388 "unseen" => ["post-user", "unseen"],
389 "gravity" => ["post-user", "gravity"],
390 "contact-id" => ["post-user", "contact-id"],
391 "contact-type" => ["ownercontact", "contact-type"],
393 "query" => "FROM `post-user`
394 STRAIGHT_JOIN `post-thread-user` ON `post-thread-user`.`uri-id` = `post-user`.`parent-uri-id` AND `post-thread-user`.`uid` = `post-user`.`uid`
395 INNER JOIN `contact` ON `contact`.`id` = `post-thread-user`.`contact-id`
396 LEFT JOIN `user-contact` AS `author` ON `author`.`uid` = `post-thread-user`.`uid` AND `author`.`cid` = `post-thread-user`.`author-id`
397 LEFT JOIN `user-contact` AS `owner` ON `owner`.`uid` = `post-thread-user`.`uid` AND `owner`.`cid` = `post-thread-user`.`owner-id`
398 INNER JOIN `contact` AS `ownercontact` ON `ownercontact`.`id` = `post-thread-user`.`owner-id`
399 LEFT JOIN `post-user` AS `parent-post` ON `parent-post`.`uri-id` = `post-user`.`parent-uri-id` AND `parent-post`.`uid` = `post-user`.`uid`
400 WHERE `post-user`.`visible` AND NOT `post-user`.`deleted`
401 AND (NOT `contact`.`readonly` AND NOT `contact`.`blocked` AND NOT `contact`.`pending`)
402 AND (`post-user`.`hidden` IS NULL OR NOT `post-user`.`hidden`)
403 AND (`author`.`blocked` IS NULL OR NOT `author`.`blocked`)
404 AND (`owner`.`blocked` IS NULL OR NOT `owner`.`blocked`)"
406 "network-thread-view" => [
408 "uri-id" => ["post-thread-user", "uri-id"],
409 "parent" => ["parent-post", "id"],
410 "received" => ["post-thread-user", "received"],
411 "commented" => ["post-thread-user", "commented"],
412 "created" => ["post-thread-user", "created"],
413 "uid" => ["post-thread-user", "uid"],
414 "starred" => ["post-thread-user", "starred"],
415 "mention" => ["post-thread-user", "mention"],
416 "network" => ["post-thread-user", "network"],
417 "contact-id" => ["post-thread-user", "contact-id"],
418 "contact-type" => ["ownercontact", "contact-type"],
420 "query" => "FROM `post-thread-user`
421 INNER JOIN `post-user` ON `post-user`.`id` = `post-thread-user`.`post-user-id`
422 STRAIGHT_JOIN `contact` ON `contact`.`id` = `post-thread-user`.`contact-id`
423 LEFT JOIN `user-contact` AS `author` ON `author`.`uid` = `post-thread-user`.`uid` AND `author`.`cid` = `post-thread-user`.`author-id`
424 LEFT JOIN `user-contact` AS `owner` ON `owner`.`uid` = `post-thread-user`.`uid` AND `owner`.`cid` = `post-thread-user`.`owner-id`
425 LEFT JOIN `contact` AS `ownercontact` ON `ownercontact`.`id` = `post-thread-user`.`owner-id`
426 LEFT JOIN `post-user` AS `parent-post` ON `parent-post`.`uri-id` = `post-user`.`parent-uri-id` AND `parent-post`.`uid` = `post-user`.`uid`
427 WHERE `post-user`.`visible` AND NOT `post-user`.`deleted`
428 AND (NOT `contact`.`readonly` AND NOT `contact`.`blocked` AND NOT `contact`.`pending`)
429 AND (`post-thread-user`.`hidden` IS NULL OR NOT `post-thread-user`.`hidden`)
430 AND (`author`.`blocked` IS NULL OR NOT `author`.`blocked`)
431 AND (`owner`.`blocked` IS NULL OR NOT `owner`.`blocked`)"
435 "id" => ["contact", "id"],
436 "uid" => ["contact", "uid"],
437 "created" => ["contact", "created"],
438 "updated" => ["contact", "updated"],
439 "self" => ["contact", "self"],
440 "remote_self" => ["contact", "remote_self"],
441 "rel" => ["contact", "rel"],
442 "duplex" => ["contact", "duplex"],
443 "network" => ["contact", "network"],
444 "protocol" => ["contact", "protocol"],
445 "name" => ["contact", "name"],
446 "nick" => ["contact", "nick"],
447 "location" => ["contact", "location"],
448 "about" => ["contact", "about"],
449 "keywords" => ["contact", "keywords"],
450 "gender" => ["contact", "gender"],
451 "xmpp" => ["contact", "xmpp"],
452 "attag" => ["contact", "attag"],
453 "avatar" => ["contact", "avatar"],
454 "photo" => ["contact", "photo"],
455 "thumb" => ["contact", "thumb"],
456 "micro" => ["contact", "micro"],
457 "site-pubkey" => ["contact", "site-pubkey"],
458 "issued-id" => ["contact", "issued-id"],
459 "dfrn-id" => ["contact", "dfrn-id"],
460 "url" => ["contact", "url"],
461 "nurl" => ["contact", "nurl"],
462 "addr" => ["contact", "addr"],
463 "alias" => ["contact", "alias"],
464 "pubkey" => ["contact", "pubkey"],
465 "prvkey" => ["contact", "prvkey"],
466 "batch" => ["contact", "batch"],
467 "request" => ["contact", "request"],
468 "notify" => ["contact", "notify"],
469 "poll" => ["contact", "poll"],
470 "confirm" => ["contact", "confirm"],
471 "poco" => ["contact", "poco"],
472 "aes_allow" => ["contact", "aes_allow"],
473 "ret-aes" => ["contact", "ret-aes"],
474 "usehub" => ["contact", "usehub"],
475 "subhub" => ["contact", "subhub"],
476 "hub-verify" => ["contact", "hub-verify"],
477 "last-update" => ["contact", "last-update"],
478 "success_update" => ["contact", "success_update"],
479 "failure_update" => ["contact", "failure_update"],
480 "name-date" => ["contact", "name-date"],
481 "uri-date" => ["contact", "uri-date"],
482 "avatar-date" => ["contact", "avatar-date"],
483 "picdate" => ["contact", "avatar-date"], /// @todo Replaces all uses of "picdate" with "avatar-date"
484 "term-date" => ["contact", "term-date"],
485 "last-item" => ["contact", "last-item"],
486 "priority" => ["contact", "priority"],
487 "blocked" => ["user", "blocked"],
488 "block_reason" => ["contact", "block_reason"],
489 "readonly" => ["contact", "readonly"],
490 "writable" => ["contact", "writable"],
491 "forum" => ["contact", "forum"],
492 "prv" => ["contact", "prv"],
493 "contact-type" => ["contact", "contact-type"],
494 "manually-approve" => ["contact", "manually-approve"],
495 "hidden" => ["contact", "hidden"],
496 "archive" => ["contact", "archive"],
497 "pending" => ["contact", "pending"],
498 "deleted" => ["contact", "deleted"],
499 "unsearchable" => ["contact", "unsearchable"],
500 "sensitive" => ["contact", "sensitive"],
501 "baseurl" => ["contact", "baseurl"],
502 "reason" => ["contact", "reason"],
503 "closeness" => ["contact", "closeness"],
504 "info" => ["contact", "info"],
505 "profile-id" => ["contact", "profile-id"],
506 "bdyear" => ["contact", "bdyear"],
507 "bd" => ["contact", "bd"],
508 "notify_new_posts" => ["contact", "notify_new_posts"],
509 "fetch_further_information" => ["contact", "fetch_further_information"],
510 "ffi_keyword_denylist" => ["contact", "ffi_keyword_denylist"],
511 "parent-uid" => ["user", "parent-uid"],
512 "guid" => ["user", "guid"],
513 "nickname" => ["user", "nickname"], /// @todo Replaces all uses of "nickname" with "nick"
514 "email" => ["user", "email"],
515 "openid" => ["user", "openid"],
516 "timezone" => ["user", "timezone"],
517 "language" => ["user", "language"],
518 "register_date" => ["user", "register_date"],
519 "login_date" => ["user", "login_date"],
520 "default-location" => ["user", "default-location"],
521 "allow_location" => ["user", "allow_location"],
522 "theme" => ["user", "theme"],
523 "upubkey" => ["user", "pubkey"],
524 "uprvkey" => ["user", "prvkey"],
525 "sprvkey" => ["user", "sprvkey"],
526 "spubkey" => ["user", "spubkey"],
527 "verified" => ["user", "verified"],
528 "blockwall" => ["user", "blockwall"],
529 "hidewall" => ["user", "hidewall"],
530 "blocktags" => ["user", "blocktags"],
531 "unkmail" => ["user", "unkmail"],
532 "cntunkmail" => ["user", "cntunkmail"],
533 "notify-flags" => ["user", "notify-flags"],
534 "page-flags" => ["user", "page-flags"],
535 "account-type" => ["user", "account-type"],
536 "prvnets" => ["user", "prvnets"],
537 "maxreq" => ["user", "maxreq"],
538 "expire" => ["user", "expire"],
539 "account_removed" => ["user", "account_removed"],
540 "account_expired" => ["user", "account_expired"],
541 "account_expires_on" => ["user", "account_expires_on"],
542 "expire_notification_sent" => ["user", "expire_notification_sent"],
543 "def_gid" => ["user", "def_gid"],
544 "allow_cid" => ["user", "allow_cid"],
545 "allow_gid" => ["user", "allow_gid"],
546 "deny_cid" => ["user", "deny_cid"],
547 "deny_gid" => ["user", "deny_gid"],
548 "openidserver" => ["user", "openidserver"],
549 "publish" => ["profile", "publish"],
550 "net-publish" => ["profile", "net-publish"],
551 "hide-friends" => ["profile", "hide-friends"],
552 "prv_keywords" => ["profile", "prv_keywords"],
553 "pub_keywords" => ["profile", "pub_keywords"],
554 "address" => ["profile", "address"],
555 "locality" => ["profile", "locality"],
556 "region" => ["profile", "region"],
557 "postal-code" => ["profile", "postal-code"],
558 "country-name" => ["profile", "country-name"],
559 "homepage" => ["profile", "homepage"],
560 "dob" => ["profile", "dob"],
562 "query" => "FROM `user`
563 INNER JOIN `contact` ON `contact`.`uid` = `user`.`uid` AND `contact`.`self`
564 INNER JOIN `profile` ON `profile`.`uid` = `user`.`uid`"
568 "id" => ["register", "id"],
569 "hash" => ["register", "hash"],
570 "created" => ["register", "created"],
571 "uid" => ["register", "uid"],
572 "password" => ["register", "password"],
573 "language" => ["register", "language"],
574 "note" => ["register", "note"],
575 "self" => ["contact", "self"],
576 "name" => ["contact", "name"],
577 "url" => ["contact", "url"],
578 "micro" => ["contact", "micro"],
579 "email" => ["user", "email"],
580 "nick" => ["contact", "nick"],
582 "query" => "FROM `register`
583 INNER JOIN `contact` ON `register`.`uid` = `contact`.`uid`
584 INNER JOIN `user` ON `register`.`uid` = `user`.`uid`"
586 "tag-search-view" => [
588 "uri-id" => ["post-tag", "uri-id"],
589 "uid" => ["post-user", "uid"],
590 "iid" => ["post-user", "id"],
591 "private" => ["post-user", "private"],
592 "wall" => ["post-user", "wall"],
593 "origin" => ["post-user", "origin"],
594 "gravity" => ["post-user", "gravity"],
595 "received" => ["post-user", "received"],
596 "name" => ["tag", "name"],
598 "query" => "FROM `post-tag`
599 INNER JOIN `tag` ON `tag`.`id` = `post-tag`.`tid`
600 STRAIGHT_JOIN `post-user` ON `post-user`.`uri-id` = `post-tag`.`uri-id`
601 WHERE `post-tag`.`type` = 1"
603 "workerqueue-view" => [
605 "pid" => ["process", "pid"],
606 "priority" => ["workerqueue", "priority"],
608 "query" => "FROM `process`
609 INNER JOIN `workerqueue` ON `workerqueue`.`pid` = `process`.`pid`
610 WHERE NOT `workerqueue`.`done`"