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 "uri" => ["item-uri", "uri"],
48 "uri-id" => ["post-user", "uri-id"],
49 "parent-uri" => ["parent-item-uri", "uri"],
50 "parent-uri-id" => ["post-user", "parent-uri-id"],
51 "thr-parent" => ["thr-parent-item-uri", "uri"],
52 "thr-parent-id" => ["post-user", "thr-parent-id"],
53 "guid" => ["item-uri", "guid"],
54 "wall" => ["post-user", "wall"],
55 "gravity" => ["post-user", "gravity"],
56 "extid" => ["item", "extid"],
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 "forum_mode" => ["post-thread-user", "forum_mode"],
71 "mention" => ["post-thread-user", "mention"],
72 "global" => ["post-user", "global"],
73 "network" => ["post-user", "network"],
74 "vid" => ["post-user", "vid"],
75 "psid" => ["post-user", "psid"],
76 "verb" => "IF (`post-user`.`vid` IS NULL, '', `verb`.`name`)",
77 "title" => ["post-content", "title"],
78 "content-warning" => ["post-content", "content-warning"],
79 "raw-body" => ["post-content", "raw-body"],
80 "body" => ["post-content", "body"],
81 "rendered-hash" => ["post-content", "rendered-hash"],
82 "rendered-html" => ["post-content", "rendered-html"],
83 "language" => ["post-content", "language"],
84 "plink" => ["post-content", "plink"],
85 "location" => ["post-content", "location"],
86 "coord" => ["post-content", "coord"],
87 "app" => ["post-content", "app"],
88 "object-type" => ["post-content", "object-type"],
89 "object" => ["post-content", "object"],
90 "target-type" => ["post-content", "target-type"],
91 "target" => ["post-content", "target"],
92 "resource-id" => ["post-content", "resource-id"],
93 "contact-id" => ["post-user", "contact-id"],
94 "contact-link" => ["contact", "url"],
95 "contact-addr" => ["contact", "addr"],
96 "contact-name" => ["contact", "name"],
97 "contact-nick" => ["contact", "nick"],
98 "contact-avatar" => ["contact", "thumb"],
99 "contact-network" => ["contact", "network"],
100 "contact-blocked" => ["contact", "blocked"],
101 "contact-hidden" => ["contact", "hidden"],
102 "contact-readonly" => ["contact", "readonly"],
103 "contact-archive" => ["contact", "archive"],
104 "contact-pending" => ["contact", "pending"],
105 "contact-rel" => ["contact", "rel"],
106 "contact-uid" => ["contact", "uid"],
107 "contact-contact-type" => ["contact", "contact-type"],
108 "writable" => "IF (`post-user`.`network` IN ('apub', 'dfrn', 'dspr', 'stat'), true, `contact`.`writable`)",
109 "self" => ["contact", "self"],
110 "cid" => ["contact", "id"],
111 "alias" => ["contact", "alias"],
112 "photo" => ["contact", "photo"],
113 "name-date" => ["contact", "name-date"],
114 "uri-date" => ["contact", "uri-date"],
115 "avatar-date" => ["contact", "avatar-date"],
116 "thumb" => ["contact", "thumb"],
117 "dfrn-id" => ["contact", "dfrn-id"],
118 "author-id" => ["post-user", "author-id"],
119 "author-link" => ["author", "url"],
120 "author-addr" => ["author", "addr"],
121 "author-name" => "IF (`contact`.`url` = `author`.`url` AND `contact`.`name` != '', `contact`.`name`, `author`.`name`)",
122 "author-nick" => ["author", "nick"],
123 "author-avatar" => "IF (`contact`.`url` = `author`.`url` AND `contact`.`thumb` != '', `contact`.`thumb`, `author`.`thumb`)",
124 "author-network" => ["author", "network"],
125 "author-blocked" => ["author", "blocked"],
126 "author-hidden" => ["author", "hidden"],
127 "owner-id" => ["post-user", "owner-id"],
128 "owner-link" => ["owner", "url"],
129 "owner-addr" => ["owner", "addr"],
130 "owner-name" => "IF (`contact`.`url` = `owner`.`url` AND `contact`.`name` != '', `contact`.`name`, `owner`.`name`)",
131 "owner-nick" => ["owner", "nick"],
132 "owner-avatar" => "IF (`contact`.`url` = `owner`.`url` AND `contact`.`thumb` != '', `contact`.`thumb`, `owner`.`thumb`)",
133 "owner-network" => ["owner", "network"],
134 "owner-blocked" => ["owner", "blocked"],
135 "owner-hidden" => ["owner", "hidden"],
136 "causer-id" => ["post-user", "causer-id"],
137 "causer-link" => ["causer", "url"],
138 "causer-addr" => ["causer", "addr"],
139 "causer-name" => ["causer", "name"],
140 "causer-nick" => ["causer", "nick"],
141 "causer-avatar" => ["causer", "thumb"],
142 "causer-network" => ["causer", "network"],
143 "causer-blocked" => ["causer", "blocked"],
144 "causer-hidden" => ["causer", "hidden"],
145 "causer-contact-type" => ["causer", "contact-type"],
146 "postopts" => ["post-delivery-data", "postopts"],
147 "inform" => ["post-delivery-data", "inform"],
148 "delivery_queue_count" => ["post-delivery-data", "queue_count"],
149 "delivery_queue_done" => ["post-delivery-data", "queue_done"],
150 "delivery_queue_failed" => ["post-delivery-data", "queue_failed"],
151 "allow_cid" => "IF (`post-user`.`psid` IS NULL, '', `permissionset`.`allow_cid`)",
152 "allow_gid" => "IF (`post-user`.`psid` IS NULL, '', `permissionset`.`allow_gid`)",
153 "deny_cid" => "IF (`post-user`.`psid` IS NULL, '', `permissionset`.`deny_cid`)",
154 "deny_gid" => "IF (`post-user`.`psid` IS NULL, '', `permissionset`.`deny_gid`)",
155 "event-id" => ["post-user", "event-id"],
156 "event-created" => ["event", "created"],
157 "event-edited" => ["event", "edited"],
158 "event-start" => ["event", "start"],
159 "event-finish" => ["event", "finish"],
160 "event-summary" => ["event", "summary"],
161 "event-desc" => ["event", "desc"],
162 "event-location" => ["event", "location"],
163 "event-type" => ["event", "type"],
164 "event-nofinish" => ["event", "nofinish"],
165 "event-adjust" => ["event", "adjust"],
166 "event-ignore" => ["event", "ignore"],
167 "signed_text" => ["diaspora-interaction", "interaction"],
168 "parent-guid" => ["parent-item-uri", "guid"],
169 "parent-network" => ["parent-post", "network"],
170 "parent-author-id" => ["parent-post", "author-id"],
171 "parent-author-link" => ["parent-post-author", "url"],
172 "parent-author-name" => ["parent-post-author", "name"],
173 "parent-author-network" => ["parent-post-author", "network"],
175 "query" => "FROM `post-user`
176 STRAIGHT_JOIN `post-thread-user` ON `post-thread-user`.`uri-id` = `post-user`.`parent-uri-id` AND `post-thread-user`.`uid` = `post-user`.`uid`
177 LEFT JOIN `item` ON `item`.`uri-id` = `post-user`.`uri-id` AND `item`.`uid` = `post-user`.`uid`
178 INNER JOIN `contact` ON `contact`.`id` = `post-user`.`contact-id`
179 INNER JOIN `contact` AS `author` ON `author`.`id` = `post-user`.`author-id`
180 INNER JOIN `contact` AS `owner` ON `owner`.`id` = `post-user`.`owner-id`
181 INNER JOIN `contact` AS `causer` ON `causer`.`id` = `post-user`.`causer-id`
182 INNER JOIN `item-uri` ON `item-uri`.`id` = `post-user`.`uri-id`
183 INNER JOIN `item-uri` AS `thr-parent-item-uri` ON `thr-parent-item-uri`.`id` = `post-user`.`thr-parent-id`
184 INNER JOIN `item-uri` AS `parent-item-uri` ON `parent-item-uri`.`id` = `post-user`.`parent-uri-id`
185 INNER JOIN `verb` ON `verb`.`id` = `post-user`.`vid`
186 LEFT JOIN `event` ON `event`.`id` = `post-user`.`event-id`
187 LEFT JOIN `diaspora-interaction` ON `diaspora-interaction`.`uri-id` = `post-user`.`uri-id`
188 LEFT JOIN `post-content` ON `post-content`.`uri-id` = `post-user`.`uri-id`
189 LEFT JOIN `post-delivery-data` ON `post-delivery-data`.`uri-id` = `post-user`.`uri-id`
190 LEFT JOIN `permissionset` ON `permissionset`.`id` = `post-user`.`psid`
191 LEFT JOIN `post-user` AS `parent-post` ON `parent-post`.`uri-id` = `post-user`.`parent-uri-id` AND `parent-post`.`uid` = `post-user`.`uid`
192 INNER JOIN `contact` AS `parent-post-author` ON `parent-post-author`.`id` = `parent-post`.`author-id`"
194 "post-thread-view" => [
196 "id" => ["item", "id"],
197 "iid" => ["item", "id"],
198 "item_id" => ["item", "id"],
199 "uid" => ["post-thread-user", "uid"],
200 "parent" => ["item", "parent"],
201 "uri" => ["item-uri", "uri"],
202 "uri-id" => ["post-thread-user", "uri-id"],
203 "parent-uri" => ["parent-item-uri", "uri"],
204 "parent-uri-id" => ["post-user", "parent-uri-id"],
205 "thr-parent" => ["thr-parent-item-uri", "uri"],
206 "thr-parent-id" => ["post-user", "thr-parent-id"],
207 "guid" => ["item-uri", "guid"],
208 "wall" => ["post-thread-user", "wall"],
209 "gravity" => ["post-user", "gravity"],
210 "extid" => ["item", "extid"],
211 "created" => ["post-thread-user", "created"],
212 "edited" => ["post-user", "edited"],
213 "commented" => ["post-thread-user", "commented"],
214 "received" => ["post-thread-user", "received"],
215 "changed" => ["post-thread-user", "changed"],
216 "post-type" => ["post-user", "post-type"],
217 "private" => ["post-user", "private"],
218 "pubmail" => ["post-thread-user", "pubmail"],
219 "ignored" => ["post-thread-user", "ignored"],
220 "visible" => ["post-user", "visible"],
221 "starred" => ["post-thread-user", "starred"],
222 "unseen" => ["post-thread-user", "unseen"],
223 "deleted" => ["post-user", "deleted"],
224 "origin" => ["post-thread-user", "origin"],
225 "forum_mode" => ["post-thread-user", "forum_mode"],
226 "mention" => ["post-thread-user", "mention"],
227 "global" => ["post-user", "global"],
228 "network" => ["post-thread-user", "network"],
229 "vid" => ["post-user", "vid"],
230 "psid" => ["post-thread-user", "psid"],
231 "verb" => "IF (`post-user`.`vid` IS NULL, '', `verb`.`name`)",
232 "title" => ["post-content", "title"],
233 "content-warning" => ["post-content", "content-warning"],
234 "raw-body" => ["post-content", "raw-body"],
235 "body" => ["post-content", "body"],
236 "rendered-hash" => ["post-content", "rendered-hash"],
237 "rendered-html" => ["post-content", "rendered-html"],
238 "language" => ["post-content", "language"],
239 "plink" => ["post-content", "plink"],
240 "location" => ["post-content", "location"],
241 "coord" => ["post-content", "coord"],
242 "app" => ["post-content", "app"],
243 "object-type" => ["post-content", "object-type"],
244 "object" => ["post-content", "object"],
245 "target-type" => ["post-content", "target-type"],
246 "target" => ["post-content", "target"],
247 "resource-id" => ["post-content", "resource-id"],
248 "contact-id" => ["post-thread-user", "contact-id"],
249 "contact-link" => ["contact", "url"],
250 "contact-addr" => ["contact", "addr"],
251 "contact-name" => ["contact", "name"],
252 "contact-nick" => ["contact", "nick"],
253 "contact-avatar" => ["contact", "thumb"],
254 "contact-network" => ["contact", "network"],
255 "contact-blocked" => ["contact", "blocked"],
256 "contact-hidden" => ["contact", "hidden"],
257 "contact-readonly" => ["contact", "readonly"],
258 "contact-archive" => ["contact", "archive"],
259 "contact-pending" => ["contact", "pending"],
260 "contact-rel" => ["contact", "rel"],
261 "contact-uid" => ["contact", "uid"],
262 "contact-contact-type" => ["contact", "contact-type"],
263 "writable" => "IF (`post-user`.`network` IN ('apub', 'dfrn', 'dspr', 'stat'), true, `contact`.`writable`)",
264 "self" => ["contact", "self"],
265 "cid" => ["contact", "id"],
266 "alias" => ["contact", "alias"],
267 "photo" => ["contact", "photo"],
268 "name-date" => ["contact", "name-date"],
269 "uri-date" => ["contact", "uri-date"],
270 "avatar-date" => ["contact", "avatar-date"],
271 "thumb" => ["contact", "thumb"],
272 "dfrn-id" => ["contact", "dfrn-id"],
273 "author-id" => ["post-thread-user", "author-id"],
274 "author-link" => ["author", "url"],
275 "author-addr" => ["author", "addr"],
276 "author-name" => "IF (`contact`.`url` = `author`.`url` AND `contact`.`name` != '', `contact`.`name`, `author`.`name`)",
277 "author-nick" => ["author", "nick"],
278 "author-avatar" => "IF (`contact`.`url` = `author`.`url` AND `contact`.`thumb` != '', `contact`.`thumb`, `author`.`thumb`)",
279 "author-network" => ["author", "network"],
280 "author-blocked" => ["author", "blocked"],
281 "author-hidden" => ["author", "hidden"],
282 "owner-id" => ["post-thread-user", "owner-id"],
283 "owner-link" => ["owner", "url"],
284 "owner-addr" => ["owner", "addr"],
285 "owner-name" => "IF (`contact`.`url` = `owner`.`url` AND `contact`.`name` != '', `contact`.`name`, `owner`.`name`)",
286 "owner-nick" => ["owner", "nick"],
287 "owner-avatar" => "IF (`contact`.`url` = `owner`.`url` AND `contact`.`thumb` != '', `contact`.`thumb`, `owner`.`thumb`)",
288 "owner-network" => ["owner", "network"],
289 "owner-blocked" => ["owner", "blocked"],
290 "owner-hidden" => ["owner", "hidden"],
291 "causer-id" => ["post-thread-user", "causer-id"],
292 "causer-link" => ["causer", "url"],
293 "causer-addr" => ["causer", "addr"],
294 "causer-name" => ["causer", "name"],
295 "causer-nick" => ["causer", "nick"],
296 "causer-avatar" => ["causer", "thumb"],
297 "causer-network" => ["causer", "network"],
298 "causer-blocked" => ["causer", "blocked"],
299 "causer-hidden" => ["causer", "hidden"],
300 "causer-contact-type" => ["causer", "contact-type"],
301 "postopts" => ["post-delivery-data", "postopts"],
302 "inform" => ["post-delivery-data", "inform"],
303 "delivery_queue_count" => ["post-delivery-data", "queue_count"],
304 "delivery_queue_done" => ["post-delivery-data", "queue_done"],
305 "delivery_queue_failed" => ["post-delivery-data", "queue_failed"],
306 "allow_cid" => "IF (`post-thread-user`.`psid` IS NULL, '', `permissionset`.`allow_cid`)",
307 "allow_gid" => "IF (`post-thread-user`.`psid` IS NULL, '', `permissionset`.`allow_gid`)",
308 "deny_cid" => "IF (`post-thread-user`.`psid` IS NULL, '', `permissionset`.`deny_cid`)",
309 "deny_gid" => "IF (`post-thread-user`.`psid` IS NULL, '', `permissionset`.`deny_gid`)",
310 "event-id" => ["post-user", "event-id"],
311 "event-created" => ["event", "created"],
312 "event-edited" => ["event", "edited"],
313 "event-start" => ["event", "start"],
314 "event-finish" => ["event", "finish"],
315 "event-summary" => ["event", "summary"],
316 "event-desc" => ["event", "desc"],
317 "event-location" => ["event", "location"],
318 "event-type" => ["event", "type"],
319 "event-nofinish" => ["event", "nofinish"],
320 "event-adjust" => ["event", "adjust"],
321 "event-ignore" => ["event", "ignore"],
322 "signed_text" => ["diaspora-interaction", "interaction"],
323 "parent-guid" => ["parent-item-uri", "guid"],
324 "parent-network" => ["parent-post", "network"],
325 "parent-author-id" => ["parent-post", "author-id"],
326 "parent-author-link" => ["parent-post-author", "url"],
327 "parent-author-name" => ["parent-post-author", "name"],
328 "parent-author-network" => ["parent-post-author", "network"],
330 "query" => "FROM `post-thread-user`
331 INNER JOIN `post-user` ON `post-user`.`id` = `post-thread-user`.`post-user-id`
332 INNER JOIN `item` ON `item`.`uri-id` = `post-thread-user`.`uri-id` AND `item`.`uid` = `post-thread-user`.`uid`
333 INNER JOIN `contact` ON `contact`.`id` = `post-thread-user`.`contact-id`
334 INNER JOIN `contact` AS `author` ON `author`.`id` = `post-thread-user`.`author-id`
335 INNER JOIN `contact` AS `owner` ON `owner`.`id` = `post-thread-user`.`owner-id`
336 INNER JOIN `contact` AS `causer` ON `causer`.`id` = `post-thread-user`.`causer-id`
337 LEFT JOIN `item-uri` ON `item-uri`.`id` = `post-user`.`uri-id`
338 LEFT JOIN `item-uri` AS `thr-parent-item-uri` ON `thr-parent-item-uri`.`id` = `post-user`.`thr-parent-id`
339 LEFT JOIN `item-uri` AS `parent-item-uri` ON `parent-item-uri`.`id` = `post-user`.`parent-uri-id`
340 LEFT JOIN `verb` ON `verb`.`id` = `post-user`.`vid`
341 LEFT JOIN `event` ON `event`.`id` = `post-user`.`event-id`
342 LEFT JOIN `diaspora-interaction` ON `diaspora-interaction`.`uri-id` = `post-thread-user`.`uri-id`
343 LEFT JOIN `post-content` ON `post-content`.`uri-id` = `post-thread-user`.`uri-id`
344 LEFT JOIN `post-delivery-data` ON `post-delivery-data`.`uri-id` = `post-thread-user`.`uri-id` AND `post-thread-user`.`origin`
345 LEFT JOIN `permissionset` ON `permissionset`.`id` = `post-thread-user`.`psid`
346 LEFT JOIN `post-user` AS `parent-post` ON `parent-post`.`uri-id` = `post-user`.`parent-uri-id` AND `parent-post`.`uid` = `post-user`.`uid`
347 INNER JOIN `contact` AS `parent-post-author` ON `parent-post-author`.`id` = `parent-post`.`author-id`"
351 "uri-id" => ["post-category", "uri-id"],
352 "uid" => ["post-category", "uid"],
353 "uri" => ["item-uri", "uri"],
354 "guid" => ["item-uri", "guid"],
355 "type" => ["post-category", "type"],
356 "tid" => ["post-category", "tid"],
357 "name" => ["tag", "name"],
358 "url" => ["tag", "url"],
360 "query" => "FROM `post-category`
361 INNER JOIN `item-uri` ON `item-uri`.id = `post-category`.`uri-id`
362 LEFT JOIN `tag` ON `post-category`.`tid` = `tag`.`id`"
366 "uri-id" => ["post-tag", "uri-id"],
367 "uri" => ["item-uri", "uri"],
368 "guid" => ["item-uri", "guid"],
369 "type" => ["post-tag", "type"],
370 "tid" => ["post-tag", "tid"],
371 "cid" => ["post-tag", "cid"],
372 "name" => "CASE `cid` WHEN 0 THEN `tag`.`name` ELSE `contact`.`name` END",
373 "url" => "CASE `cid` WHEN 0 THEN `tag`.`url` ELSE `contact`.`url` END",
375 "query" => "FROM `post-tag`
376 INNER JOIN `item-uri` ON `item-uri`.id = `post-tag`.`uri-id`
377 LEFT JOIN `tag` ON `post-tag`.`tid` = `tag`.`id`
378 LEFT JOIN `contact` ON `post-tag`.`cid` = `contact`.`id`"
380 "network-item-view" => [
382 "uri-id" => ["item", "parent-uri-id"],
383 "uri" => ["item", "parent-uri"],
384 "parent" => ["item", "parent"],
385 "received" => ["item", "received"],
386 "commented" => ["item", "commented"],
387 "created" => ["item", "created"],
388 "uid" => ["item", "uid"],
389 "starred" => ["item", "starred"],
390 "mention" => ["item", "mention"],
391 "network" => ["item", "network"],
392 "unseen" => ["item", "unseen"],
393 "gravity" => ["item", "gravity"],
394 "contact-id" => ["item", "contact-id"],
395 "contact-type" => ["ownercontact", "contact-type"],
397 "query" => "FROM `item`
398 INNER JOIN `item` AS `parent-item` ON `parent-item`.`id` = `item`.`parent`
399 STRAIGHT_JOIN `contact` ON `contact`.`id` = `parent-item`.`contact-id`
400 LEFT JOIN `post-user` ON `post-user`.`uri-id` = `item`.`uri-id` AND `post-user`.`uid` = `parent-item`.`uid`
401 LEFT JOIN `user-contact` AS `author` ON `author`.`uid` = `parent-item`.`uid` AND `author`.`cid` = `parent-item`.`author-id`
402 LEFT JOIN `user-contact` AS `owner` ON `owner`.`uid` = `parent-item`.`uid` AND `owner`.`cid` = `parent-item`.`owner-id`
403 LEFT JOIN `contact` AS `ownercontact` ON `ownercontact`.`id` = `parent-item`.`owner-id`
404 WHERE `parent-item`.`visible` AND NOT `parent-item`.`deleted`
405 AND (NOT `contact`.`readonly` AND NOT `contact`.`blocked` AND NOT `contact`.`pending`)
406 AND (`post-user`.`hidden` IS NULL OR NOT `post-user`.`hidden`)
407 AND (`author`.`blocked` IS NULL OR NOT `author`.`blocked`)
408 AND (`owner`.`blocked` IS NULL OR NOT `owner`.`blocked`)"
410 "network-thread-view" => [
412 "uri-id" => ["post-thread", "uri-id"],
413 "uri" => ["item", "uri"],
414 "parent-uri-id" => ["item", "parent-uri-id"],
415 "parent" => ["item", "id"],
416 "received" => ["post-thread", "received"],
417 "commented" => ["post-thread", "commented"],
418 "created" => ["post-thread", "created"],
419 "uid" => ["post-thread-user", "uid"],
420 "starred" => ["post-thread-user", "starred"],
421 "mention" => ["post-thread-user", "mention"],
422 "network" => ["post-thread", "network"],
423 "contact-id" => ["post-thread-user", "contact-id"],
424 "contact-type" => ["ownercontact", "contact-type"],
426 "query" => "FROM `post-thread`
427 STRAIGHT_JOIN `post-thread-user` ON `post-thread-user`.`uri-id` = `post-thread`.`uri-id`
428 STRAIGHT_JOIN `item` ON `item`.`uri-id` = `post-thread`.`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`.`author-id`
431 LEFT JOIN `user-contact` AS `owner` ON `owner`.`uid` = `post-thread-user`.`uid` AND `owner`.`cid` = `post-thread`.`owner-id`
432 LEFT JOIN `contact` AS `ownercontact` ON `ownercontact`.`id` = `post-thread`.`owner-id`
433 WHERE `item`.`visible` AND NOT `item`.`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 "iid" => ["item", "id"],
596 "uri" => ["item", "uri"],
597 "guid" => ["item", "guid"],
598 "uid" => ["item", "uid"],
599 "private" => ["item", "private"],
600 "wall" => ["item", "wall"],
601 "origin" => ["item", "origin"],
602 "gravity" => ["item", "gravity"],
603 "received" => ["item", "received"],
604 "name" => ["tag", "name"],
606 "query" => "FROM `post-tag`
607 INNER JOIN `tag` ON `tag`.`id` = `post-tag`.`tid`
608 INNER JOIN `item` ON `item`.`uri-id` = `post-tag`.`uri-id`
609 WHERE `post-tag`.`type` = 1"
611 "workerqueue-view" => [
613 "pid" => ["process", "pid"],
614 "priority" => ["workerqueue", "priority"],
616 "query" => "FROM `process`
617 INNER JOIN `workerqueue` ON `workerqueue`.`pid` = `process`.`pid`
618 WHERE NOT `workerqueue`.`done`"