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" => ["item", "uid"],
46 "parent" => ["item", "parent"],
47 "uri" => ["item", "uri"],
48 "uri-id" => ["item", "uri-id"],
49 "parent-uri" => ["item", "parent-uri"],
50 "parent-uri-id" => ["item", "parent-uri-id"],
51 "thr-parent" => ["item", "thr-parent"],
52 "thr-parent-id" => ["item", "thr-parent-id"],
53 "guid" => ["item", "guid"],
54 "type" => ["item", "type"],
55 "wall" => ["item", "wall"],
56 "gravity" => ["item", "gravity"],
57 "extid" => ["item", "extid"],
58 "created" => ["item", "created"],
59 "edited" => ["item", "edited"],
60 "commented" => ["item", "commented"],
61 "received" => ["item", "received"],
62 "changed" => ["item", "changed"],
63 "post-type" => ["item", "post-type"],
64 "private" => ["item", "private"],
65 "pubmail" => ["item", "pubmail"],
66 "moderated" => ["item", "moderated"],
67 "visible" => ["item", "visible"],
68 "starred" => ["item", "starred"],
69 "bookmark" => ["item", "bookmark"],
70 "unseen" => ["item", "unseen"],
71 "deleted" => ["item", "deleted"],
72 "origin" => ["item", "origin"],
73 "forum_mode" => ["item", "forum_mode"],
74 "mention" => ["item", "mention"],
75 "global" => ["item", "global"],
76 "network" => ["item", "network"],
77 "vid" => ["item", "vid"],
78 "psid" => ["item", "psid"],
79 "verb" => "IF (`item`.`vid` IS NULL, '', `verb`.`name`)",
80 "title" => ["post-content", "title"],
81 "content-warning" => ["post-content", "content-warning"],
82 "raw-body" => ["post-content", "raw-body"],
83 "body" => ["post-content", "body"],
84 "rendered-hash" => ["post-content", "rendered-hash"],
85 "rendered-html" => ["post-content", "rendered-html"],
86 "language" => ["post-content", "language"],
87 "plink" => ["post-content", "plink"],
88 "location" => ["post-content", "location"],
89 "coord" => ["post-content", "coord"],
90 "app" => ["post-content", "app"],
91 "object-type" => ["post-content", "object-type"],
92 "object" => ["post-content", "object"],
93 "target-type" => ["post-content", "target-type"],
94 "target" => ["post-content", "target"],
95 "resource-id" => ["post-content", "resource-id"],
96 "contact-id" => ["item", "contact-id"],
97 "contact-link" => ["contact", "url"],
98 "contact-addr" => ["contact", "addr"],
99 "contact-name" => ["contact", "name"],
100 "contact-nick" => ["contact", "nick"],
101 "contact-avatar" => ["contact", "thumb"],
102 "contact-network" => ["contact", "network"],
103 "contact-blocked" => ["contact", "blocked"],
104 "contact-hidden" => ["contact", "hidden"],
105 "contact-readonly" => ["contact", "readonly"],
106 "contact-archive" => ["contact", "archive"],
107 "contact-pending" => ["contact", "pending"],
108 "contact-rel" => ["contact", "rel"],
109 "contact-uid" => ["contact", "uid"],
110 "contact-contact-type" => ["contact", "contact-type"],
111 "writable" => "IF (`item`.`network` IN ('apub', 'dfrn', 'dspr', 'stat'), true, `contact`.`writable`)",
112 "self" => ["contact", "self"],
113 "cid" => ["contact", "id"],
114 "alias" => ["contact", "alias"],
115 "photo" => ["contact", "photo"],
116 "name-date" => ["contact", "name-date"],
117 "uri-date" => ["contact", "uri-date"],
118 "avatar-date" => ["contact", "avatar-date"],
119 "thumb" => ["contact", "thumb"],
120 "dfrn-id" => ["contact", "dfrn-id"],
121 "author-id" => ["item", "author-id"],
122 "author-link" => ["author", "url"],
123 "author-addr" => ["author", "addr"],
124 "author-name" => "IF (`contact`.`url` = `author`.`url` AND `contact`.`name` != '', `contact`.`name`, `author`.`name`)",
125 "author-nick" => ["author", "nick"],
126 "author-avatar" => "IF (`contact`.`url` = `author`.`url` AND `contact`.`thumb` != '', `contact`.`thumb`, `author`.`thumb`)",
127 "author-network" => ["author", "network"],
128 "author-blocked" => ["author", "blocked"],
129 "author-hidden" => ["author", "hidden"],
130 "owner-id" => ["item", "owner-id"],
131 "owner-link" => ["owner", "url"],
132 "owner-addr" => ["owner", "addr"],
133 "owner-name" => "IF (`contact`.`url` = `owner`.`url` AND `contact`.`name` != '', `contact`.`name`, `owner`.`name`)",
134 "owner-nick" => ["owner", "nick"],
135 "owner-avatar" => "IF (`contact`.`url` = `owner`.`url` AND `contact`.`thumb` != '', `contact`.`thumb`, `owner`.`thumb`)",
136 "owner-network" => ["owner", "network"],
137 "owner-blocked" => ["owner", "blocked"],
138 "owner-hidden" => ["owner", "hidden"],
139 "causer-id" => ["item", "causer-id"],
140 "causer-link" => ["causer", "url"],
141 "causer-addr" => ["causer", "addr"],
142 "causer-name" => ["causer", "name"],
143 "causer-nick" => ["causer", "nick"],
144 "causer-avatar" => ["causer", "thumb"],
145 "causer-network" => ["causer", "network"],
146 "causer-blocked" => ["causer", "blocked"],
147 "causer-hidden" => ["causer", "hidden"],
148 "causer-contact-type" => ["causer", "contact-type"],
149 "postopts" => ["post-delivery-data", "postopts"],
150 "inform" => ["post-delivery-data", "inform"],
151 "delivery_queue_count" => ["post-delivery-data", "queue_count"],
152 "delivery_queue_done" => ["post-delivery-data", "queue_done"],
153 "delivery_queue_failed" => ["post-delivery-data", "queue_failed"],
154 "allow_cid" => "IF (`item`.`psid` IS NULL, '', `permissionset`.`allow_cid`)",
155 "allow_gid" => "IF (`item`.`psid` IS NULL, '', `permissionset`.`allow_gid`)",
156 "deny_cid" => "IF (`item`.`psid` IS NULL, '', `permissionset`.`deny_cid`)",
157 "deny_gid" => "IF (`item`.`psid` IS NULL, '', `permissionset`.`deny_gid`)",
158 "event-id" => ["item", "event-id"],
159 "event-created" => ["event", "created"],
160 "event-edited" => ["event", "edited"],
161 "event-start" => ["event", "start"],
162 "event-finish" => ["event", "finish"],
163 "event-summary" => ["event", "summary"],
164 "event-desc" => ["event", "desc"],
165 "event-location" => ["event", "location"],
166 "event-type" => ["event", "type"],
167 "event-nofinish" => ["event", "nofinish"],
168 "event-adjust" => ["event", "adjust"],
169 "event-ignore" => ["event", "ignore"],
170 "signed_text" => ["diaspora-interaction", "interaction"],
171 "parent-guid" => ["parent-item", "guid"],
172 "parent-network" => ["parent-item", "network"],
173 "parent-author-id" => ["parent-item", "author-id"],
174 "parent-author-link" => ["parent-item-author", "url"],
175 "parent-author-name" => ["parent-item-author", "name"],
176 "parent-author-network" => ["parent-item-author", "network"],
178 "query" => "FROM `item`
179 LEFT JOIN `post-user` ON `post-user`.`uri-id` = `item`.`uri-id` AND `post-user`.`uid` = `item`.`uid`
180 STRAIGHT_JOIN `contact` ON `contact`.`id` = `item`.`contact-id`
181 STRAIGHT_JOIN `contact` AS `author` ON `author`.`id` = `item`.`author-id`
182 STRAIGHT_JOIN `contact` AS `owner` ON `owner`.`id` = `item`.`owner-id`
183 STRAIGHT_JOIN `contact` AS `causer` ON `causer`.`id` = `item`.`causer-id`
184 LEFT JOIN `verb` ON `verb`.`id` = `item`.`vid`
185 LEFT JOIN `event` ON `event`.`id` = `item`.`event-id`
186 LEFT JOIN `diaspora-interaction` ON `diaspora-interaction`.`uri-id` = `item`.`uri-id`
187 LEFT JOIN `post-content` ON `post-content`.`uri-id` = `item`.`uri-id`
188 LEFT JOIN `post-delivery-data` ON `post-delivery-data`.`uri-id` = `item`.`uri-id` AND `item`.`origin`
189 LEFT JOIN `permissionset` ON `permissionset`.`id` = `item`.`psid`
190 STRAIGHT_JOIN `item` AS `parent-item` ON `parent-item`.`uri-id` = `item`.`parent-uri-id` AND `parent-item`.`uid` = `item`.`uid`
191 STRAIGHT_JOIN `contact` AS `parent-item-author` ON `parent-item-author`.`id` = `parent-item`.`author-id`"
193 "post-thread-view" => [
195 "id" => ["item", "id"],
196 "iid" => ["item", "id"],
197 "item_id" => ["item", "id"],
198 "uid" => ["post-thread-user", "uid"],
199 "parent" => ["item", "parent"],
200 "uri" => ["item", "uri"],
201 "uri-id" => ["post-thread", "uri-id"],
202 "parent-uri" => ["item", "parent-uri"],
203 "parent-uri-id" => ["item", "parent-uri-id"],
204 "thr-parent" => ["item", "thr-parent"],
205 "thr-parent-id" => ["item", "thr-parent-id"],
206 "guid" => ["item", "guid"],
207 "type" => ["item", "type"],
208 "wall" => ["post-thread-user", "wall"],
209 "gravity" => ["item", "gravity"],
210 "extid" => ["item", "extid"],
211 "created" => ["post-thread", "created"],
212 "edited" => ["item", "edited"],
213 "commented" => ["post-thread", "commented"],
214 "received" => ["post-thread", "received"],
215 "changed" => ["post-thread", "changed"],
216 "post-type" => ["item", "post-type"],
217 "private" => ["item", "private"],
218 "pubmail" => ["post-thread-user", "pubmail"],
219 "moderated" => ["item", "moderated"],
220 "ignored" => ["post-thread-user", "ignored"],
221 "visible" => ["item", "visible"],
222 "starred" => ["post-thread-user", "starred"],
223 "bookmark" => ["item", "bookmark"],
224 "unseen" => ["post-user", "unseen"],
225 "deleted" => ["item", "deleted"],
226 "origin" => ["post-user", "origin"],
227 "forum_mode" => ["post-thread-user", "forum_mode"],
228 "mention" => ["item", "mention"],
229 "global" => ["item", "global"],
230 "network" => ["post-thread", "network"],
231 "vid" => ["item", "vid"],
232 "psid" => ["post-user", "psid"],
233 "verb" => "IF (`item`.`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-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 (`item`.`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", "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", "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 "causer-id" => ["item", "causer-id"],
294 "causer-link" => ["causer", "url"],
295 "causer-addr" => ["causer", "addr"],
296 "causer-name" => ["causer", "name"],
297 "causer-nick" => ["causer", "nick"],
298 "causer-avatar" => ["causer", "thumb"],
299 "causer-network" => ["causer", "network"],
300 "causer-blocked" => ["causer", "blocked"],
301 "causer-hidden" => ["causer", "hidden"],
302 "causer-contact-type" => ["causer", "contact-type"],
303 "postopts" => ["post-delivery-data", "postopts"],
304 "inform" => ["post-delivery-data", "inform"],
305 "delivery_queue_count" => ["post-delivery-data", "queue_count"],
306 "delivery_queue_done" => ["post-delivery-data", "queue_done"],
307 "delivery_queue_failed" => ["post-delivery-data", "queue_failed"],
308 "allow_cid" => "IF (`post-user`.`psid` IS NULL, '', `permissionset`.`allow_cid`)",
309 "allow_gid" => "IF (`post-user`.`psid` IS NULL, '', `permissionset`.`allow_gid`)",
310 "deny_cid" => "IF (`post-user`.`psid` IS NULL, '', `permissionset`.`deny_cid`)",
311 "deny_gid" => "IF (`post-user`.`psid` IS NULL, '', `permissionset`.`deny_gid`)",
312 "event-id" => ["item", "event-id"],
313 "event-created" => ["event", "created"],
314 "event-edited" => ["event", "edited"],
315 "event-start" => ["event", "start"],
316 "event-finish" => ["event", "finish"],
317 "event-summary" => ["event", "summary"],
318 "event-desc" => ["event", "desc"],
319 "event-location" => ["event", "location"],
320 "event-type" => ["event", "type"],
321 "event-nofinish" => ["event", "nofinish"],
322 "event-adjust" => ["event", "adjust"],
323 "event-ignore" => ["event", "ignore"],
324 "signed_text" => ["diaspora-interaction", "interaction"],
325 "parent-guid" => ["parent-item", "guid"],
326 "parent-network" => ["parent-item", "network"],
327 "parent-author-id" => ["parent-item", "author-id"],
328 "parent-author-link" => ["parent-item-author", "url"],
329 "parent-author-name" => ["parent-item-author", "name"],
330 "parent-author-network" => ["parent-item-author", "network"],
332 "query" => "FROM `post-thread`
333 STRAIGHT_JOIN `post-thread-user` ON `post-thread-user`.`uri-id` = `post-thread`.`uri-id`
334 STRAIGHT_JOIN `post-user` ON `post-user`.`uri-id` = `post-thread`.`uri-id`
335 STRAIGHT_JOIN `item` ON `item`.`uri-id` = `post-thread`.`uri-id` AND `item`.`uid` = `post-thread-user`.`uid`
336 STRAIGHT_JOIN `contact` ON `contact`.`id` = `post-user`.`contact-id`
337 STRAIGHT_JOIN `contact` AS `author` ON `author`.`id` = `post-thread`.`author-id`
338 STRAIGHT_JOIN `contact` AS `owner` ON `owner`.`id` = `post-thread`.`owner-id`
339 STRAIGHT_JOIN `contact` AS `causer` ON `causer`.`id` = `post-thread`.`causer-id`
340 LEFT JOIN `verb` ON `verb`.`id` = `item`.`vid`
341 LEFT JOIN `event` ON `event`.`id` = `item`.`event-id`
342 LEFT JOIN `diaspora-interaction` ON `diaspora-interaction`.`uri-id` = `post-thread`.`uri-id`
343 LEFT JOIN `post-content` ON `post-content`.`uri-id` = `post-thread`.`uri-id`
344 LEFT JOIN `post-delivery-data` ON `post-delivery-data`.`uri-id` = `post-thread`.`uri-id` AND `post-user`.`origin`
345 LEFT JOIN `permissionset` ON `permissionset`.`id` = `post-user`.`psid`
346 STRAIGHT_JOIN `item` AS `parent-item` ON `parent-item`.`id` = `item`.`parent`
347 STRAIGHT_JOIN `contact` AS `parent-item-author` ON `parent-item-author`.`id` = `parent-item`.`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` AND NOT `parent-item`.`moderated`
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-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 `post-user` ON `post-user`.`uri-id` = `post-thread`.`uri-id` AND `post-user`.`uid` = `post-thread-user`.`uid`
429 STRAIGHT_JOIN `item` ON `item`.`uri-id` = `post-thread`.`uri-id` AND `item`.`uid` = `post-thread-user`.`uid`
430 STRAIGHT_JOIN `contact` ON `contact`.`id` = `post-user`.`contact-id`
431 LEFT JOIN `user-contact` AS `author` ON `author`.`uid` = `post-user`.`uid` AND `author`.`cid` = `post-thread`.`author-id`
432 LEFT JOIN `user-contact` AS `owner` ON `owner`.`uid` = `post-user`.`uid` AND `owner`.`cid` = `post-thread`.`owner-id`
433 LEFT JOIN `contact` AS `ownercontact` ON `ownercontact`.`id` = `post-thread`.`owner-id`
434 WHERE `item`.`visible` AND NOT `item`.`deleted` AND NOT `item`.`moderated`
435 AND (NOT `contact`.`readonly` AND NOT `contact`.`blocked` AND NOT `contact`.`pending`)
436 AND (`post-user`.`hidden` IS NULL OR NOT `post-user`.`hidden`)
437 AND (`author`.`blocked` IS NULL OR NOT `author`.`blocked`)
438 AND (`owner`.`blocked` IS NULL OR NOT `owner`.`blocked`)"
442 "id" => ["contact", "id"],
443 "uid" => ["contact", "uid"],
444 "created" => ["contact", "created"],
445 "updated" => ["contact", "updated"],
446 "self" => ["contact", "self"],
447 "remote_self" => ["contact", "remote_self"],
448 "rel" => ["contact", "rel"],
449 "duplex" => ["contact", "duplex"],
450 "network" => ["contact", "network"],
451 "protocol" => ["contact", "protocol"],
452 "name" => ["contact", "name"],
453 "nick" => ["contact", "nick"],
454 "location" => ["contact", "location"],
455 "about" => ["contact", "about"],
456 "keywords" => ["contact", "keywords"],
457 "gender" => ["contact", "gender"],
458 "xmpp" => ["contact", "xmpp"],
459 "attag" => ["contact", "attag"],
460 "avatar" => ["contact", "avatar"],
461 "photo" => ["contact", "photo"],
462 "thumb" => ["contact", "thumb"],
463 "micro" => ["contact", "micro"],
464 "site-pubkey" => ["contact", "site-pubkey"],
465 "issued-id" => ["contact", "issued-id"],
466 "dfrn-id" => ["contact", "dfrn-id"],
467 "url" => ["contact", "url"],
468 "nurl" => ["contact", "nurl"],
469 "addr" => ["contact", "addr"],
470 "alias" => ["contact", "alias"],
471 "pubkey" => ["contact", "pubkey"],
472 "prvkey" => ["contact", "prvkey"],
473 "batch" => ["contact", "batch"],
474 "request" => ["contact", "request"],
475 "notify" => ["contact", "notify"],
476 "poll" => ["contact", "poll"],
477 "confirm" => ["contact", "confirm"],
478 "poco" => ["contact", "poco"],
479 "aes_allow" => ["contact", "aes_allow"],
480 "ret-aes" => ["contact", "ret-aes"],
481 "usehub" => ["contact", "usehub"],
482 "subhub" => ["contact", "subhub"],
483 "hub-verify" => ["contact", "hub-verify"],
484 "last-update" => ["contact", "last-update"],
485 "success_update" => ["contact", "success_update"],
486 "failure_update" => ["contact", "failure_update"],
487 "name-date" => ["contact", "name-date"],
488 "uri-date" => ["contact", "uri-date"],
489 "avatar-date" => ["contact", "avatar-date"],
490 "picdate" => ["contact", "avatar-date"], /// @todo Replaces all uses of "picdate" with "avatar-date"
491 "term-date" => ["contact", "term-date"],
492 "last-item" => ["contact", "last-item"],
493 "priority" => ["contact", "priority"],
494 "blocked" => ["user", "blocked"],
495 "block_reason" => ["contact", "block_reason"],
496 "readonly" => ["contact", "readonly"],
497 "writable" => ["contact", "writable"],
498 "forum" => ["contact", "forum"],
499 "prv" => ["contact", "prv"],
500 "contact-type" => ["contact", "contact-type"],
501 "manually-approve" => ["contact", "manually-approve"],
502 "hidden" => ["contact", "hidden"],
503 "archive" => ["contact", "archive"],
504 "pending" => ["contact", "pending"],
505 "deleted" => ["contact", "deleted"],
506 "unsearchable" => ["contact", "unsearchable"],
507 "sensitive" => ["contact", "sensitive"],
508 "baseurl" => ["contact", "baseurl"],
509 "reason" => ["contact", "reason"],
510 "closeness" => ["contact", "closeness"],
511 "info" => ["contact", "info"],
512 "profile-id" => ["contact", "profile-id"],
513 "bdyear" => ["contact", "bdyear"],
514 "bd" => ["contact", "bd"],
515 "notify_new_posts" => ["contact", "notify_new_posts"],
516 "fetch_further_information" => ["contact", "fetch_further_information"],
517 "ffi_keyword_denylist" => ["contact", "ffi_keyword_denylist"],
518 "parent-uid" => ["user", "parent-uid"],
519 "guid" => ["user", "guid"],
520 "nickname" => ["user", "nickname"], /// @todo Replaces all uses of "nickname" with "nick"
521 "email" => ["user", "email"],
522 "openid" => ["user", "openid"],
523 "timezone" => ["user", "timezone"],
524 "language" => ["user", "language"],
525 "register_date" => ["user", "register_date"],
526 "login_date" => ["user", "login_date"],
527 "default-location" => ["user", "default-location"],
528 "allow_location" => ["user", "allow_location"],
529 "theme" => ["user", "theme"],
530 "upubkey" => ["user", "pubkey"],
531 "uprvkey" => ["user", "prvkey"],
532 "sprvkey" => ["user", "sprvkey"],
533 "spubkey" => ["user", "spubkey"],
534 "verified" => ["user", "verified"],
535 "blockwall" => ["user", "blockwall"],
536 "hidewall" => ["user", "hidewall"],
537 "blocktags" => ["user", "blocktags"],
538 "unkmail" => ["user", "unkmail"],
539 "cntunkmail" => ["user", "cntunkmail"],
540 "notify-flags" => ["user", "notify-flags"],
541 "page-flags" => ["user", "page-flags"],
542 "account-type" => ["user", "account-type"],
543 "prvnets" => ["user", "prvnets"],
544 "maxreq" => ["user", "maxreq"],
545 "expire" => ["user", "expire"],
546 "account_removed" => ["user", "account_removed"],
547 "account_expired" => ["user", "account_expired"],
548 "account_expires_on" => ["user", "account_expires_on"],
549 "expire_notification_sent" => ["user", "expire_notification_sent"],
550 "def_gid" => ["user", "def_gid"],
551 "allow_cid" => ["user", "allow_cid"],
552 "allow_gid" => ["user", "allow_gid"],
553 "deny_cid" => ["user", "deny_cid"],
554 "deny_gid" => ["user", "deny_gid"],
555 "openidserver" => ["user", "openidserver"],
556 "publish" => ["profile", "publish"],
557 "net-publish" => ["profile", "net-publish"],
558 "hide-friends" => ["profile", "hide-friends"],
559 "prv_keywords" => ["profile", "prv_keywords"],
560 "pub_keywords" => ["profile", "pub_keywords"],
561 "address" => ["profile", "address"],
562 "locality" => ["profile", "locality"],
563 "region" => ["profile", "region"],
564 "postal-code" => ["profile", "postal-code"],
565 "country-name" => ["profile", "country-name"],
566 "homepage" => ["profile", "homepage"],
567 "dob" => ["profile", "dob"],
569 "query" => "FROM `user`
570 INNER JOIN `contact` ON `contact`.`uid` = `user`.`uid` AND `contact`.`self`
571 INNER JOIN `profile` ON `profile`.`uid` = `user`.`uid`"
575 "id" => ["register", "id"],
576 "hash" => ["register", "hash"],
577 "created" => ["register", "created"],
578 "uid" => ["register", "uid"],
579 "password" => ["register", "password"],
580 "language" => ["register", "language"],
581 "note" => ["register", "note"],
582 "self" => ["contact", "self"],
583 "name" => ["contact", "name"],
584 "url" => ["contact", "url"],
585 "micro" => ["contact", "micro"],
586 "email" => ["user", "email"],
587 "nick" => ["contact", "nick"],
589 "query" => "FROM `register`
590 INNER JOIN `contact` ON `register`.`uid` = `contact`.`uid`
591 INNER JOIN `user` ON `register`.`uid` = `user`.`uid`"
593 "tag-search-view" => [
595 "uri-id" => ["post-tag", "uri-id"],
596 "iid" => ["item", "id"],
597 "uri" => ["item", "uri"],
598 "guid" => ["item", "guid"],
599 "uid" => ["item", "uid"],
600 "private" => ["item", "private"],
601 "wall" => ["item", "wall"],
602 "origin" => ["item", "origin"],
603 "gravity" => ["item", "gravity"],
604 "received" => ["item", "received"],
605 "name" => ["tag", "name"],
607 "query" => "FROM `post-tag`
608 INNER JOIN `tag` ON `tag`.`id` = `post-tag`.`tid`
609 INNER JOIN `item` ON `item`.`uri-id` = `post-tag`.`uri-id`
610 WHERE `post-tag`.`type` = 1"
612 "workerqueue-view" => [
614 "pid" => ["process", "pid"],
615 "priority" => ["workerqueue", "priority"],
617 "query" => "FROM `process`
618 INNER JOIN `workerqueue` ON `workerqueue`.`pid` = `process`.`pid`
619 WHERE NOT `workerqueue`.`done`"