]> git.mxchange.org Git - friendica.git/blob - static/dbview.config.php
DE FAQ: moved info about support channels to the FAQ top
[friendica.git] / static / dbview.config.php
1 <?php
2 /**
3  * @copyright Copyright (C) 2020, Friendica
4  *
5  * @license GNU AGPL version 3 or any later version
6  *
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.
11  *
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.
16  *
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/>.
19  *
20  * Main view structure configuration file.
21  *
22  * Here are described all the view Friendica needs to work.
23  *
24  * Syntax (braces indicate optionale values):
25  * "<view name>" => [
26  *      "fields" => [
27  *              "<field name>" => ["table", "field"],
28  *              "<field name>" => "SQL expression",
29  *              ...
30  *      ],
31  *      "query" => "FROM `table` INNER JOIN `other-table` ..."
32  *      ],
33  * ],
34  *
35  * If you need to make any change, make sure to increment the DB_UPDATE_VERSION constant value in dbstructure.config.php.
36  *
37  */
38
39  return [
40         "post-view" => [
41                 "fields" => [
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                         "resource-id" => ["item", "resource-id"],
64                         "post-type" => ["item", "post-type"],
65                         "private" => ["item", "private"],
66                         "pubmail" => ["item", "pubmail"],
67                         "moderated" => ["item", "moderated"],
68                         "visible" => ["item", "visible"],
69                         "starred" => ["item", "starred"],
70                         "bookmark" => ["item", "bookmark"],
71                         "unseen" => ["item", "unseen"],
72                         "deleted" => ["item", "deleted"],
73                         "origin" => ["item", "origin"],
74                         "forum_mode" => ["item", "forum_mode"],
75                         "mention" => ["item", "mention"],
76                         "global" => ["item", "global"],
77                         "network" => ["item", "network"],
78                         "vid" => ["item", "vid"],
79                         "psid" => ["item", "psid"],
80                         "verb" => "IF (`item`.`vid` IS NULL, '', `verb`.`name`)",
81                         "title" => ["item-content", "title"],
82                         "content-warning" => ["item-content", "content-warning"],
83                         "raw-body" => ["item-content", "raw-body"],
84                         "body" => ["item-content", "body"],
85                         "rendered-hash" => ["item-content", "rendered-hash"],
86                         "rendered-html" => ["item-content", "rendered-html"],
87                         "language" => ["item-content", "language"],
88                         "plink" => ["item-content", "plink"],
89                         "location" => ["item-content", "location"],
90                         "coord" => ["item-content", "coord"],
91                         "app" => ["item-content", "app"],
92                         "object-type" => ["item-content", "object-type"],
93                         "object" => ["item-content", "object"],
94                         "target-type" => ["item-content", "target-type"],
95                         "target" => ["item-content", "target"],
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"], 
177                 ],
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 `item-content` ON `item-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`"
192         ],
193         "post-thread-view" => [
194                 "fields" => [
195                         "id" => ["item", "id"],
196                         "iid" => ["thread", "iid"],
197                         "item_id" => ["item", "id"],
198                         "uid" => ["thread", "uid"],
199                         "parent" => ["item", "parent"],
200                         "uri" => ["item", "uri"],
201                         "uri-id" => ["item", "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" => ["thread", "wall"],
209                         "gravity" => ["item", "gravity"],
210                         "extid" => ["item", "extid"],
211                         "created" => ["thread", "created"],
212                         "edited" => ["item", "edited"],
213                         "commented" => ["thread", "commented"],
214                         "received" => ["thread", "received"],
215                         "changed" => ["thread", "changed"],
216                         "resource-id" => ["item", "resource-id"],
217                         "post-type" => ["thread", "post-type"],
218                         "private" => ["thread", "private"],
219                         "pubmail" => ["thread", "pubmail"],
220                         "moderated" => ["thread", "moderated"],
221                         "ignored" => ["thread", "ignored"],
222                         "visible" => ["thread", "visible"],
223                         "starred" => ["thread", "starred"],
224                         "bookmark" => ["item", "bookmark"],
225                         "unseen" => ["item", "unseen"],
226                         "deleted" => ["thread", "deleted"],
227                         "origin" => ["thread", "origin"],
228                         "forum_mode" => ["thread", "forum_mode"],
229                         "mention" => ["thread", "mention"],
230                         "global" => ["item", "global"],
231                         "network" => ["thread", "network"],
232                         "vid" => ["item", "vid"],
233                         "psid" => ["item", "psid"],
234                         "verb" => "IF (`item`.`vid` IS NULL, '', `verb`.`name`)",
235                         "title" => ["item-content", "title"],
236                         "content-warning" => ["item-content", "content-warning"],
237                         "raw-body" => ["item-content", "raw-body"],
238                         "body" => ["item-content", "body"],
239                         "rendered-hash" => ["item-content", "rendered-hash"],
240                         "rendered-html" => ["item-content", "rendered-html"],
241                         "language" => ["item-content", "language"],
242                         "plink" => ["item-content", "plink"],
243                         "location" => ["item-content", "location"],
244                         "coord" => ["item-content", "coord"],
245                         "app" => ["item-content", "app"],
246                         "object-type" => ["item-content", "object-type"],
247                         "object" => ["item-content", "object"],
248                         "target-type" => ["item-content", "target-type"],
249                         "target" => ["item-content", "target"],
250                         "contact-id" => ["thread", "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" => ["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" => ["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 (`item`.`psid` IS NULL, '', `permissionset`.`allow_cid`)",
309                         "allow_gid" => "IF (`item`.`psid` IS NULL, '', `permissionset`.`allow_gid`)",
310                         "deny_cid" => "IF (`item`.`psid` IS NULL, '', `permissionset`.`deny_cid`)",
311                         "deny_gid" => "IF (`item`.`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"], 
331                 ],
332                 "query" => "FROM `thread`
333                         STRAIGHT_JOIN `item` ON `item`.`id` = `thread`.`iid`
334                         STRAIGHT_JOIN `contact` ON `contact`.`id` = `thread`.`contact-id`
335                         STRAIGHT_JOIN `contact` AS `author` ON `author`.`id` = `thread`.`author-id`
336                         STRAIGHT_JOIN `contact` AS `owner` ON `owner`.`id` = `thread`.`owner-id`
337                         STRAIGHT_JOIN `contact` AS `causer` ON `causer`.`id` = `item`.`causer-id`
338                         LEFT JOIN `verb` ON `verb`.`id` = `item`.`vid`
339                         LEFT JOIN `event` ON `event`.`id` = `item`.`event-id`
340                         LEFT JOIN `diaspora-interaction` ON `diaspora-interaction`.`uri-id` = `thread`.`uri-id`
341                         LEFT JOIN `item-content` ON `item-content`.`uri-id` = `thread`.`uri-id`
342                         LEFT JOIN `post-delivery-data` ON `post-delivery-data`.`uri-id` = `thread`.`uri-id` AND `thread`.`origin`
343                         LEFT JOIN `permissionset` ON `permissionset`.`id` = `item`.`psid`
344                         STRAIGHT_JOIN `item` AS `parent-item` ON `parent-item`.`id` = `item`.`parent`
345                         STRAIGHT_JOIN `contact` AS `parent-item-author` ON `parent-item-author`.`id` = `parent-item`.`author-id`"
346         ],
347         "category-view" => [
348                 "fields" => [
349                         "uri-id" => ["post-category", "uri-id"],
350                         "uid" => ["post-category", "uid"],
351                         "uri" => ["item-uri", "uri"],
352                         "guid" => ["item-uri", "guid"],
353                         "type" => ["post-category", "type"],
354                         "tid" => ["post-category", "tid"],
355                         "name" => ["tag", "name"],
356                         "url" => ["tag", "url"],
357                 ],
358                 "query" => "FROM `post-category`
359                         INNER JOIN `item-uri` ON `item-uri`.id = `post-category`.`uri-id`
360                         LEFT JOIN `tag` ON `post-category`.`tid` = `tag`.`id`"
361         ],
362         "tag-view" => [
363                 "fields" => [
364                         "uri-id" => ["post-tag", "uri-id"],
365                         "uri" => ["item-uri", "uri"],
366                         "guid" => ["item-uri", "guid"],
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",
372                 ],
373                 "query" => "FROM `post-tag`
374                         INNER JOIN `item-uri` ON `item-uri`.id = `post-tag`.`uri-id`
375                         LEFT JOIN `tag` ON `post-tag`.`tid` = `tag`.`id`
376                         LEFT JOIN `contact` ON `post-tag`.`cid` = `contact`.`id`"
377         ],
378         "network-item-view" => [
379                 "fields" => [
380                         "uri-id" => ["item", "parent-uri-id"],
381                         "uri" => ["item", "parent-uri"],
382                         "parent" => ["item", "parent"],
383                         "received" => ["item", "received"],
384                         "commented" => ["item", "commented"],
385                         "created" => ["item", "created"],
386                         "uid" => ["item", "uid"],
387                         "starred" => ["item", "starred"],
388                         "mention" => ["item", "mention"],
389                         "network" => ["item", "network"],
390                         "unseen" => ["item", "unseen"],
391                         "gravity" => ["item", "gravity"],
392                         "contact-id" => ["item", "contact-id"],
393                         "contact-type" => ["ownercontact", "contact-type"],
394                 ],
395                 "query" => "FROM `item`
396                         INNER JOIN `thread` ON `thread`.`iid` = `item`.`parent`
397                         STRAIGHT_JOIN `contact` ON `contact`.`id` = `thread`.`contact-id`
398                         LEFT JOIN `user-item` ON `user-item`.`iid` = `item`.`id` AND `user-item`.`uid` = `thread`.`uid`
399                         LEFT JOIN `user-contact` AS `author` ON `author`.`uid` = `thread`.`uid` AND `author`.`cid` = `thread`.`author-id`
400                         LEFT JOIN `user-contact` AS `owner` ON `owner`.`uid` = `thread`.`uid` AND `owner`.`cid` = `thread`.`owner-id`
401                         LEFT JOIN `contact` AS `ownercontact` ON `ownercontact`.`id` = `thread`.`owner-id`
402                         WHERE `thread`.`visible` AND NOT `thread`.`deleted` AND NOT `thread`.`moderated`
403                         AND (NOT `contact`.`readonly` AND NOT `contact`.`blocked` AND NOT `contact`.`pending`)
404                         AND (`user-item`.`hidden` IS NULL OR NOT `user-item`.`hidden`)
405                         AND (`author`.`blocked` IS NULL OR NOT `author`.`blocked`)
406                         AND (`owner`.`blocked` IS NULL OR NOT `owner`.`blocked`)"
407         ],
408         "network-thread-view" => [
409                 "fields" => [
410                         "uri-id" => ["item", "uri-id"],
411                         "uri" => ["item", "uri"],
412                         "parent-uri-id" => ["item", "parent-uri-id"],
413                         "parent" => ["thread", "iid"],
414                         "received" => ["thread", "received"],
415                         "commented" => ["thread", "commented"],
416                         "created" => ["thread", "created"],
417                         "uid" => ["thread", "uid"],
418                         "starred" => ["thread", "starred"],
419                         "mention" => ["thread", "mention"],
420                         "network" => ["thread", "network"],
421                         "contact-id" => ["thread", "contact-id"],
422                         "contact-type" => ["ownercontact", "contact-type"],
423                 ],
424                 "query" => "FROM `thread`
425                         STRAIGHT_JOIN `contact` ON `contact`.`id` = `thread`.`contact-id`
426                         STRAIGHT_JOIN `item` ON `item`.`id` = `thread`.`iid`
427                         LEFT JOIN `user-item` ON `user-item`.`iid` = `item`.`id` AND `user-item`.`uid` = `thread`.`uid`
428                         LEFT JOIN `user-contact` AS `author` ON `author`.`uid` = `thread`.`uid` AND `author`.`cid` = `thread`.`author-id`
429                         LEFT JOIN `user-contact` AS `owner` ON `owner`.`uid` = `thread`.`uid` AND `owner`.`cid` = `thread`.`owner-id`
430                         LEFT JOIN `contact` AS `ownercontact` ON `ownercontact`.`id` = `thread`.`owner-id`
431                         WHERE `thread`.`visible` AND NOT `thread`.`deleted` AND NOT `thread`.`moderated`
432                         AND (NOT `contact`.`readonly` AND NOT `contact`.`blocked` AND NOT `contact`.`pending`)
433                         AND (`user-item`.`hidden` IS NULL OR NOT `user-item`.`hidden`)
434                         AND (`author`.`blocked` IS NULL OR NOT `author`.`blocked`)
435                         AND (`owner`.`blocked` IS NULL OR NOT `owner`.`blocked`)"
436         ],
437         "owner-view" => [
438                 "fields" => [
439                         "id" => ["contact", "id"],
440                         "uid" => ["contact", "uid"],
441                         "created" => ["contact", "created"],
442                         "updated" => ["contact", "updated"],
443                         "self" => ["contact", "self"],
444                         "remote_self" => ["contact", "remote_self"],
445                         "rel" => ["contact", "rel"],
446                         "duplex" => ["contact", "duplex"],
447                         "network" => ["contact", "network"],
448                         "protocol" => ["contact", "protocol"],
449                         "name" => ["contact", "name"],
450                         "nick" => ["contact", "nick"],
451                         "location" => ["contact", "location"],
452                         "about" => ["contact", "about"],
453                         "keywords" => ["contact", "keywords"],
454                         "gender" => ["contact", "gender"],
455                         "xmpp" => ["contact", "xmpp"],
456                         "attag" => ["contact", "attag"],
457                         "avatar" => ["contact", "avatar"],
458                         "photo" => ["contact", "photo"],
459                         "thumb" => ["contact", "thumb"],
460                         "micro" => ["contact", "micro"],
461                         "site-pubkey" => ["contact", "site-pubkey"],
462                         "issued-id" => ["contact", "issued-id"],
463                         "dfrn-id" => ["contact", "dfrn-id"],
464                         "url" => ["contact", "url"],
465                         "nurl" => ["contact", "nurl"],
466                         "addr" => ["contact", "addr"],
467                         "alias" => ["contact", "alias"],
468                         "pubkey" => ["contact", "pubkey"],
469                         "prvkey" => ["contact", "prvkey"],
470                         "batch" => ["contact", "batch"],
471                         "request" => ["contact", "request"],
472                         "notify" => ["contact", "notify"],
473                         "poll" => ["contact", "poll"],
474                         "confirm" => ["contact", "confirm"],
475                         "poco" => ["contact", "poco"],
476                         "aes_allow" => ["contact", "aes_allow"],
477                         "ret-aes" => ["contact", "ret-aes"],
478                         "usehub" => ["contact", "usehub"],
479                         "subhub" => ["contact", "subhub"],
480                         "hub-verify" => ["contact", "hub-verify"],
481                         "last-update" => ["contact", "last-update"],
482                         "success_update" => ["contact", "success_update"],
483                         "failure_update" => ["contact", "failure_update"],
484                         "name-date" => ["contact", "name-date"],
485                         "uri-date" => ["contact", "uri-date"],
486                         "avatar-date" => ["contact", "avatar-date"],
487                         "picdate" => ["contact", "avatar-date"], /// @todo Replaces all uses of "picdate" with "avatar-date"
488                         "term-date" => ["contact", "term-date"],
489                         "last-item" => ["contact", "last-item"],
490                         "priority" => ["contact", "priority"],
491                         "blocked" => ["user", "blocked"],
492                         "block_reason" => ["contact", "block_reason"],
493                         "readonly" => ["contact", "readonly"],
494                         "writable" => ["contact", "writable"],
495                         "forum" => ["contact", "forum"],
496                         "prv" => ["contact", "prv"],
497                         "contact-type" => ["contact", "contact-type"],
498                         "manually-approve" => ["contact", "manually-approve"],
499                         "hidden" => ["contact", "hidden"],
500                         "archive" => ["contact", "archive"],
501                         "pending" => ["contact", "pending"],
502                         "deleted" => ["contact", "deleted"],
503                         "unsearchable" => ["contact", "unsearchable"],
504                         "sensitive" => ["contact", "sensitive"],
505                         "baseurl" => ["contact", "baseurl"],
506                         "reason" => ["contact", "reason"],
507                         "closeness" => ["contact", "closeness"],
508                         "info" => ["contact", "info"],
509                         "profile-id" => ["contact", "profile-id"],
510                         "bdyear" => ["contact", "bdyear"],
511                         "bd" => ["contact", "bd"],
512                         "notify_new_posts" => ["contact", "notify_new_posts"],
513                         "fetch_further_information" => ["contact", "fetch_further_information"],
514                         "ffi_keyword_denylist" => ["contact", "ffi_keyword_denylist"],
515                         "parent-uid" => ["user", "parent-uid"],
516                         "guid" => ["user", "guid"],
517                         "nickname" => ["user", "nickname"], /// @todo Replaces all uses of "nickname" with "nick"
518                         "email" => ["user", "email"],
519                         "openid" => ["user", "openid"],
520                         "timezone" => ["user", "timezone"],
521                         "language" => ["user", "language"],
522                         "register_date" => ["user", "register_date"],
523                         "login_date" => ["user", "login_date"],
524                         "default-location" => ["user", "default-location"],
525                         "allow_location" => ["user", "allow_location"],
526                         "theme" => ["user", "theme"],
527                         "upubkey" => ["user", "pubkey"],
528                         "uprvkey" => ["user", "prvkey"],
529                         "sprvkey" => ["user", "sprvkey"],
530                         "spubkey" => ["user", "spubkey"],
531                         "verified" => ["user", "verified"],
532                         "blockwall" => ["user", "blockwall"],
533                         "hidewall" => ["user", "hidewall"],
534                         "blocktags" => ["user", "blocktags"],
535                         "unkmail" => ["user", "unkmail"],
536                         "cntunkmail" => ["user", "cntunkmail"],
537                         "notify-flags" => ["user", "notify-flags"],
538                         "page-flags" => ["user", "page-flags"],
539                         "account-type" => ["user", "account-type"],
540                         "prvnets" => ["user", "prvnets"],
541                         "maxreq" => ["user", "maxreq"],
542                         "expire" => ["user", "expire"],
543                         "account_removed" => ["user", "account_removed"],
544                         "account_expired" => ["user", "account_expired"],
545                         "account_expires_on" => ["user", "account_expires_on"],
546                         "expire_notification_sent" => ["user", "expire_notification_sent"],
547                         "def_gid" => ["user", "def_gid"],
548                         "allow_cid" => ["user", "allow_cid"],
549                         "allow_gid" => ["user", "allow_gid"],
550                         "deny_cid" => ["user", "deny_cid"],
551                         "deny_gid" => ["user", "deny_gid"],
552                         "openidserver" => ["user", "openidserver"],
553                         "publish" => ["profile", "publish"],
554                         "net-publish" => ["profile", "net-publish"],
555                         "hide-friends" => ["profile", "hide-friends"],
556                         "prv_keywords" => ["profile", "prv_keywords"],
557                         "pub_keywords" => ["profile", "pub_keywords"],
558                         "address" => ["profile", "address"],
559                         "locality" => ["profile", "locality"],
560                         "region" => ["profile", "region"],
561                         "postal-code" => ["profile", "postal-code"],
562                         "country-name" => ["profile", "country-name"],
563                         "homepage" => ["profile", "homepage"],
564                         "dob" => ["profile", "dob"],
565                 ],
566                 "query" => "FROM `user`
567                         INNER JOIN `contact` ON `contact`.`uid` = `user`.`uid` AND `contact`.`self`
568                         INNER JOIN `profile` ON `profile`.`uid` = `user`.`uid`"
569         ],
570         "pending-view" => [
571                 "fields" => [
572                         "id" => ["register", "id"],
573                         "hash" => ["register", "hash"],
574                         "created" => ["register", "created"],
575                         "uid" => ["register", "uid"],
576                         "password" => ["register", "password"],
577                         "language" => ["register", "language"],
578                         "note" => ["register", "note"],
579                         "self" => ["contact", "self"],
580                         "name" => ["contact", "name"],
581                         "url" => ["contact", "url"],
582                         "micro" => ["contact", "micro"],
583                         "email" => ["user", "email"],
584                         "nick" => ["contact", "nick"],
585                 ],
586                 "query" => "FROM `register`
587                         INNER JOIN `contact` ON `register`.`uid` = `contact`.`uid`
588                         INNER JOIN `user` ON `register`.`uid` = `user`.`uid`"
589         ],
590         "tag-search-view" => [
591                 "fields" => [
592                         "uri-id" => ["post-tag", "uri-id"],
593                         "iid" => ["item", "id"],
594                         "uri" => ["item", "uri"],
595                         "guid" => ["item", "guid"],
596                         "uid" => ["item", "uid"],
597                         "private" => ["item", "private"],
598                         "wall" => ["item", "wall"],
599                         "origin" => ["item", "origin"],
600                         "gravity" => ["item", "gravity"],
601                         "received" => ["item", "received"],                     
602                         "name" => ["tag", "name"],
603                 ],
604                 "query" => "FROM `post-tag`
605                         INNER JOIN `tag` ON `tag`.`id` = `post-tag`.`tid`
606                         INNER JOIN `item` ON `item`.`uri-id` = `post-tag`.`uri-id`
607                         WHERE `post-tag`.`type` = 1"
608         ],
609         "workerqueue-view" => [
610                 "fields" => [
611                         "pid" => ["process", "pid"],
612                         "priority" => ["workerqueue", "priority"],
613                 ],
614                 "query" => "FROM `process`
615                         INNER JOIN `workerqueue` ON `workerqueue`.`pid` = `process`.`pid`
616                         WHERE NOT `workerqueue`.`done`"
617         ],
618 ];
619