]> git.mxchange.org Git - friendica.git/blob - static/dbview.config.php
Updated main translation file after adding strings
[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                         "uid" => ["item", "uid"],
45                         "parent" => ["item", "parent"],
46                         "uri" => ["item", "uri"],
47                         "uri-id" => ["item", "uri-id"],
48                         "parent-uri" => ["item", "parent-uri"],
49                         "parent-uri-id" => ["item", "parent-uri-id"],
50                         "thr-parent" => ["item", "thr-parent"],
51                         "thr-parent-id" => ["item", "thr-parent-id"],
52                         "guid" => ["item", "guid"],
53                         "type" => ["item", "type"],
54                         "wall" => ["item", "wall"],
55                         "gravity" => ["item", "gravity"],
56                         "extid" => ["item", "extid"],
57                         "created" => ["item", "created"],
58                         "edited" => ["item", "edited"],
59                         "commented" => ["item", "commented"],
60                         "received" => ["item", "received"],
61                         "changed" => ["item", "changed"],
62                         "resource-id" => ["item", "resource-id"],
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" => ["item-content", "title"],
81                         "content-warning" => ["item-content", "content-warning"],
82                         "raw-body" => ["item-content", "raw-body"],
83                         "body" => ["item-content", "body"],
84                         "rendered-hash" => ["item-content", "rendered-hash"],
85                         "rendered-html" => ["item-content", "rendered-html"],
86                         "language" => ["item-content", "language"],
87                         "plink" => ["item-content", "plink"],
88                         "location" => ["item-content", "location"],
89                         "coord" => ["item-content", "coord"],
90                         "app" => ["item-content", "app"],
91                         "object-type" => ["item-content", "object-type"],
92                         "object" => ["item-content", "object"],
93                         "target-type" => ["item-content", "target-type"],
94                         "target" => ["item-content", "target"],
95                         "contact-id" => ["item", "contact-id"],
96                         "contact-link" => ["contact", "url"],
97                         "contact-addr" => ["contact", "addr"],
98                         "contact-name" => ["contact", "name"],
99                         "contact-nick" => ["contact", "nick"],
100                         "contact-avatar" => ["contact", "thumb"],
101                         "contact-network" => ["contact", "network"],
102                         "contact-blocked" => ["contact", "blocked"],
103                         "contact-hidden" => ["contact", "hidden"],
104                         "contact-readonly" => ["contact", "readonly"],
105                         "contact-archive" => ["contact", "archive"],
106                         "contact-pending" => ["contact", "pending"],
107                         "contact-rel" => ["contact", "rel"],
108                         "contact-uid" => ["contact", "uid"],
109                         "contact-contact-type" => ["contact", "contact-type"],
110                         "writable" => "IF (`item`.`network` IN ('apub', 'dfrn', 'dspr', 'stat'), true, `contact`.`writable`)",
111                         "self" => ["contact", "self"],
112                         "cid" => ["contact", "id"],
113                         "alias" => ["contact", "alias"],
114                         "photo" => ["contact", "photo"],
115                         "name-date" => ["contact", "name-date"],
116                         "uri-date" => ["contact", "uri-date"],
117                         "avatar-date" => ["contact", "avatar-date"],
118                         "thumb" => ["contact", "thumb"],
119                         "dfrn-id" => ["contact", "dfrn-id"],
120                         "author-id" => ["item", "author-id"],
121                         "author-link" => ["author", "url"],
122                         "author-addr" => ["author", "addr"],
123                         "author-name" => "IF (`contact`.`url` = `author`.`url` AND `contact`.`name` != '', `contact`.`name`, `author`.`name`)",
124                         "author-nick" => ["author", "nick"],
125                         "author-avatar" => "IF (`contact`.`url` = `author`.`url` AND `contact`.`thumb` != '', `contact`.`thumb`, `author`.`thumb`)",
126                         "author-network" => ["author", "network"],
127                         "author-blocked" => ["author", "blocked"],
128                         "author-hidden" => ["author", "hidden"],
129                         "owner-id" => ["item", "owner-id"],
130                         "owner-link" => ["owner", "url"],
131                         "owner-addr" => ["owner", "addr"],
132                         "owner-name" => "IF (`contact`.`url` = `owner`.`url` AND `contact`.`name` != '', `contact`.`name`, `owner`.`name`)",
133                         "owner-nick" => ["owner", "nick"],
134                         "owner-avatar" => "IF (`contact`.`url` = `owner`.`url` AND `contact`.`thumb` != '', `contact`.`thumb`, `owner`.`thumb`)",
135                         "owner-network" => ["owner", "network"],
136                         "owner-blocked" => ["owner", "blocked"],
137                         "owner-hidden" => ["owner", "hidden"],
138                         "causer-id" => ["item", "causer-id"],
139                         "causer-link" => ["causer", "url"],
140                         "causer-addr" => ["causer", "addr"],
141                         "causer-name" => ["causer", "name"],
142                         "causer-nick" => ["causer", "nick"], 
143                         "causer-avatar" => ["causer", "thumb"],
144                         "causer-network" => ["causer", "network"],
145                         "causer-blocked" => ["causer", "blocked"],
146                         "causer-hidden" => ["causer", "hidden"],
147                         "causer-contact-type" => ["causer", "contact-type"],
148                         "postopts" => ["post-delivery-data", "postopts"],
149                         "inform" => ["post-delivery-data", "inform"],
150                         "delivery_queue_count" => ["post-delivery-data", "queue_count"],
151                         "delivery_queue_done" => ["post-delivery-data", "queue_done"],
152                         "delivery_queue_failed" => ["post-delivery-data", "queue_failed"],
153                         "allow_cid" => "IF (`item`.`psid` IS NULL, '', `permissionset`.`allow_cid`)",
154                         "allow_gid" => "IF (`item`.`psid` IS NULL, '', `permissionset`.`allow_gid`)",
155                         "deny_cid" => "IF (`item`.`psid` IS NULL, '', `permissionset`.`deny_cid`)",
156                         "deny_gid" => "IF (`item`.`psid` IS NULL, '', `permissionset`.`deny_gid`)",
157                         "event-id" => ["item", "event-id"],
158                         "event-created" => ["event", "created"],
159                         "event-edited" => ["event", "edited"],
160                         "event-start" => ["event", "start"],
161                         "event-finish" => ["event", "finish"],
162                         "event-summary" => ["event", "summary"],
163                         "event-desc" => ["event", "desc"],
164                         "event-location" => ["event", "location"],
165                         "event-type" => ["event", "type"],
166                         "event-nofinish" => ["event", "nofinish"],
167                         "event-adjust" => ["event", "adjust"],
168                         "event-ignore" => ["event", "ignore"],
169                         "signed_text" => ["diaspora-interaction", "interaction"],
170                         "parent-guid" => ["parent-item", "guid"],
171                         "parent-network" => ["parent-item", "network"],
172                         "parent-author-id" => ["parent-item", "author-id"],
173                         "parent-author-link" => ["parent-item-author", "url"],  
174                         "parent-author-name" => ["parent-item-author", "name"],
175                         "parent-author-network" => ["parent-item-author", "network"], 
176                 ],
177                 "query" => "FROM `item`
178                         STRAIGHT_JOIN `contact` ON `contact`.`id` = `item`.`contact-id`
179                         STRAIGHT_JOIN `contact` AS `author` ON `author`.`id` = `item`.`author-id`
180                         STRAIGHT_JOIN `contact` AS `owner` ON `owner`.`id` = `item`.`owner-id`
181                         STRAIGHT_JOIN `contact` AS `causer` ON `causer`.`id` = `item`.`causer-id`
182                         LEFT JOIN `verb` ON `verb`.`id` = `item`.`vid`
183                         LEFT JOIN `event` ON `event`.`id` = `item`.`event-id`
184                         LEFT JOIN `diaspora-interaction` ON `diaspora-interaction`.`uri-id` = `item`.`uri-id`
185                         LEFT JOIN `item-content` ON `item-content`.`uri-id` = `item`.`uri-id`
186                         LEFT JOIN `post-delivery-data` ON `post-delivery-data`.`uri-id` = `item`.`uri-id` AND `item`.`origin`
187                         LEFT JOIN `permissionset` ON `permissionset`.`id` = `item`.`psid`
188                         STRAIGHT_JOIN `item` AS `parent-item` ON `parent-item`.`uri-id` = `item`.`parent-uri-id` AND `parent-item`.`uid` = `item`.`uid`
189                         STRAIGHT_JOIN `contact` AS `parent-item-author` ON `parent-item-author`.`id` = `parent-item`.`author-id`"
190         ],
191         "post-thread-view" => [
192                 "fields" => [
193                         "id" => ["item", "id"],
194                         "iid" => ["thread", "iid"],
195                         "item_id" => ["item", "id"],
196                         "uid" => ["thread", "uid"],
197                         "parent" => ["item", "parent"],
198                         "uri" => ["item", "uri"],
199                         "uri-id" => ["item", "uri-id"],
200                         "parent-uri" => ["item", "parent-uri"],
201                         "parent-uri-id" => ["item", "parent-uri-id"],
202                         "thr-parent" => ["item", "thr-parent"],
203                         "thr-parent-id" => ["item", "thr-parent-id"],
204                         "guid" => ["item", "guid"],
205                         "type" => ["item", "type"],
206                         "wall" => ["thread", "wall"],
207                         "gravity" => ["item", "gravity"],
208                         "extid" => ["item", "extid"],
209                         "created" => ["thread", "created"],
210                         "edited" => ["item", "edited"],
211                         "commented" => ["thread", "commented"],
212                         "received" => ["thread", "received"],
213                         "changed" => ["thread", "changed"],
214                         "resource-id" => ["item", "resource-id"],
215                         "post-type" => ["thread", "post-type"],
216                         "private" => ["thread", "private"],
217                         "pubmail" => ["thread", "pubmail"],
218                         "moderated" => ["thread", "moderated"],
219                         "ignored" => ["thread", "ignored"],
220                         "visible" => ["thread", "visible"],
221                         "starred" => ["thread", "starred"],
222                         "bookmark" => ["item", "bookmark"],
223                         "unseen" => ["item", "unseen"],
224                         "deleted" => ["thread", "deleted"],
225                         "origin" => ["thread", "origin"],
226                         "forum_mode" => ["thread", "forum_mode"],
227                         "mention" => ["thread", "mention"],
228                         "global" => ["item", "global"],
229                         "network" => ["thread", "network"],
230                         "vid" => ["item", "vid"],
231                         "psid" => ["item", "psid"],
232                         "verb" => "IF (`item`.`vid` IS NULL, '', `verb`.`name`)",
233                         "title" => ["item-content", "title"],
234                         "content-warning" => ["item-content", "content-warning"],
235                         "raw-body" => ["item-content", "raw-body"],
236                         "body" => ["item-content", "body"],
237                         "rendered-hash" => ["item-content", "rendered-hash"],
238                         "rendered-html" => ["item-content", "rendered-html"],
239                         "language" => ["item-content", "language"],
240                         "plink" => ["item-content", "plink"],
241                         "location" => ["item-content", "location"],
242                         "coord" => ["item-content", "coord"],
243                         "app" => ["item-content", "app"],
244                         "object-type" => ["item-content", "object-type"],
245                         "object" => ["item-content", "object"],
246                         "target-type" => ["item-content", "target-type"],
247                         "target" => ["item-content", "target"],
248                         "contact-id" => ["thread", "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 (`item`.`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" => ["thread", "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" => ["thread", "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" => ["item", "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 (`item`.`psid` IS NULL, '', `permissionset`.`allow_cid`)",
307                         "allow_gid" => "IF (`item`.`psid` IS NULL, '', `permissionset`.`allow_gid`)",
308                         "deny_cid" => "IF (`item`.`psid` IS NULL, '', `permissionset`.`deny_cid`)",
309                         "deny_gid" => "IF (`item`.`psid` IS NULL, '', `permissionset`.`deny_gid`)",
310                         "event-id" => ["item", "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", "guid"],
324                         "parent-network" => ["parent-item", "network"],
325                         "parent-author-id" => ["parent-item", "author-id"],
326                         "parent-author-link" => ["parent-item-author", "url"],  
327                         "parent-author-name" => ["parent-item-author", "name"],
328                         "parent-author-network" => ["parent-item-author", "network"], 
329                 ],
330                 "query" => "FROM `thread`
331                         STRAIGHT_JOIN `item` ON `item`.`id` = `thread`.`iid`
332                         STRAIGHT_JOIN `contact` ON `contact`.`id` = `thread`.`contact-id`
333                         STRAIGHT_JOIN `contact` AS `author` ON `author`.`id` = `thread`.`author-id`
334                         STRAIGHT_JOIN `contact` AS `owner` ON `owner`.`id` = `thread`.`owner-id`
335                         STRAIGHT_JOIN `contact` AS `causer` ON `causer`.`id` = `item`.`causer-id`
336                         LEFT JOIN `verb` ON `verb`.`id` = `item`.`vid`
337                         LEFT JOIN `event` ON `event`.`id` = `item`.`event-id`
338                         LEFT JOIN `diaspora-interaction` ON `diaspora-interaction`.`uri-id` = `thread`.`uri-id`
339                         LEFT JOIN `item-content` ON `item-content`.`uri-id` = `thread`.`uri-id`
340                         LEFT JOIN `post-delivery-data` ON `post-delivery-data`.`uri-id` = `thread`.`uri-id` AND `thread`.`origin`
341                         LEFT JOIN `permissionset` ON `permissionset`.`id` = `item`.`psid`
342                         STRAIGHT_JOIN `item` AS `parent-item` ON `parent-item`.`id` = `item`.`parent`
343                         STRAIGHT_JOIN `contact` AS `parent-item-author` ON `parent-item-author`.`id` = `parent-item`.`author-id`"
344         ],
345         "category-view" => [
346                 "fields" => [
347                         "uri-id" => ["post-category", "uri-id"],
348                         "uid" => ["post-category", "uid"],
349                         "uri" => ["item-uri", "uri"],
350                         "guid" => ["item-uri", "guid"],
351                         "type" => ["post-category", "type"],
352                         "tid" => ["post-category", "tid"],
353                         "name" => ["tag", "name"],
354                         "url" => ["tag", "url"],
355                 ],
356                 "query" => "FROM `post-category`
357                         INNER JOIN `item-uri` ON `item-uri`.id = `post-category`.`uri-id`
358                         LEFT JOIN `tag` ON `post-category`.`tid` = `tag`.`id`"
359         ],
360         "tag-view" => [
361                 "fields" => [
362                         "uri-id" => ["post-tag", "uri-id"],
363                         "uri" => ["item-uri", "uri"],
364                         "guid" => ["item-uri", "guid"],
365                         "type" => ["post-tag", "type"],
366                         "tid" => ["post-tag", "tid"],
367                         "cid" => ["post-tag", "cid"],
368                         "name" => "CASE `cid` WHEN 0 THEN `tag`.`name` ELSE `contact`.`name` END",
369                         "url" => "CASE `cid` WHEN 0 THEN `tag`.`url` ELSE `contact`.`url` END",
370                 ],
371                 "query" => "FROM `post-tag`
372                         INNER JOIN `item-uri` ON `item-uri`.id = `post-tag`.`uri-id`
373                         LEFT JOIN `tag` ON `post-tag`.`tid` = `tag`.`id`
374                         LEFT JOIN `contact` ON `post-tag`.`cid` = `contact`.`id`"
375         ],
376         "network-item-view" => [
377                 "fields" => [
378                         "uri-id" => ["item", "parent-uri-id"],
379                         "uri" => ["item", "parent-uri"],
380                         "parent" => ["item", "parent"],
381                         "received" => ["item", "received"],
382                         "commented" => ["item", "commented"],
383                         "created" => ["item", "created"],
384                         "uid" => ["item", "uid"],
385                         "starred" => ["item", "starred"],
386                         "mention" => ["item", "mention"],
387                         "network" => ["item", "network"],
388                         "unseen" => ["item", "unseen"],
389                         "gravity" => ["item", "gravity"],
390                         "contact-id" => ["item", "contact-id"],
391                         "contact-type" => ["ownercontact", "contact-type"],
392                 ],
393                 "query" => "FROM `item`
394                         INNER JOIN `thread` ON `thread`.`iid` = `item`.`parent`
395                         STRAIGHT_JOIN `contact` ON `contact`.`id` = `thread`.`contact-id`
396                         LEFT JOIN `user-item` ON `user-item`.`iid` = `item`.`id` AND `user-item`.`uid` = `thread`.`uid`
397                         LEFT JOIN `user-contact` AS `author` ON `author`.`uid` = `thread`.`uid` AND `author`.`cid` = `thread`.`author-id`
398                         LEFT JOIN `user-contact` AS `owner` ON `owner`.`uid` = `thread`.`uid` AND `owner`.`cid` = `thread`.`owner-id`
399                         LEFT JOIN `contact` AS `ownercontact` ON `ownercontact`.`id` = `thread`.`owner-id`
400                         WHERE `thread`.`visible` AND NOT `thread`.`deleted` AND NOT `thread`.`moderated`
401                         AND (NOT `contact`.`readonly` AND NOT `contact`.`blocked` AND NOT `contact`.`pending`)
402                         AND (`user-item`.`hidden` IS NULL OR NOT `user-item`.`hidden`)
403                         AND (`author`.`blocked` IS NULL OR NOT `author`.`blocked`)
404                         AND (`owner`.`blocked` IS NULL OR NOT `owner`.`blocked`)"
405         ],
406         "network-thread-view" => [
407                 "fields" => [
408                         "uri-id" => ["item", "uri-id"],
409                         "uri" => ["item", "uri"],
410                         "parent-uri-id" => ["item", "parent-uri-id"],
411                         "parent" => ["thread", "iid"],
412                         "received" => ["thread", "received"],
413                         "commented" => ["thread", "commented"],
414                         "created" => ["thread", "created"],
415                         "uid" => ["thread", "uid"],
416                         "starred" => ["thread", "starred"],
417                         "mention" => ["thread", "mention"],
418                         "network" => ["thread", "network"],
419                         "contact-id" => ["thread", "contact-id"],
420                         "contact-type" => ["ownercontact", "contact-type"],
421                 ],
422                 "query" => "FROM `thread`
423                         STRAIGHT_JOIN `contact` ON `contact`.`id` = `thread`.`contact-id`
424                         STRAIGHT_JOIN `item` ON `item`.`id` = `thread`.`iid`
425                         LEFT JOIN `user-item` ON `user-item`.`iid` = `item`.`id` AND `user-item`.`uid` = `thread`.`uid`
426                         LEFT JOIN `user-contact` AS `author` ON `author`.`uid` = `thread`.`uid` AND `author`.`cid` = `thread`.`author-id`
427                         LEFT JOIN `user-contact` AS `owner` ON `owner`.`uid` = `thread`.`uid` AND `owner`.`cid` = `thread`.`owner-id`
428                         LEFT JOIN `contact` AS `ownercontact` ON `ownercontact`.`id` = `thread`.`owner-id`
429                         WHERE `thread`.`visible` AND NOT `thread`.`deleted` AND NOT `thread`.`moderated`
430                         AND (NOT `contact`.`readonly` AND NOT `contact`.`blocked` AND NOT `contact`.`pending`)
431                         AND (`user-item`.`hidden` IS NULL OR NOT `user-item`.`hidden`)
432                         AND (`author`.`blocked` IS NULL OR NOT `author`.`blocked`)
433                         AND (`owner`.`blocked` IS NULL OR NOT `owner`.`blocked`)"
434         ],
435         "owner-view" => [
436                 "fields" => [
437                         "id" => ["contact", "id"],
438                         "uid" => ["contact", "uid"],
439                         "created" => ["contact", "created"],
440                         "updated" => ["contact", "updated"],
441                         "self" => ["contact", "self"],
442                         "remote_self" => ["contact", "remote_self"],
443                         "rel" => ["contact", "rel"],
444                         "duplex" => ["contact", "duplex"],
445                         "network" => ["contact", "network"],
446                         "protocol" => ["contact", "protocol"],
447                         "name" => ["contact", "name"],
448                         "nick" => ["contact", "nick"],
449                         "location" => ["contact", "location"],
450                         "about" => ["contact", "about"],
451                         "keywords" => ["contact", "keywords"],
452                         "gender" => ["contact", "gender"],
453                         "xmpp" => ["contact", "xmpp"],
454                         "attag" => ["contact", "attag"],
455                         "avatar" => ["contact", "avatar"],
456                         "photo" => ["contact", "photo"],
457                         "thumb" => ["contact", "thumb"],
458                         "micro" => ["contact", "micro"],
459                         "site-pubkey" => ["contact", "site-pubkey"],
460                         "issued-id" => ["contact", "issued-id"],
461                         "dfrn-id" => ["contact", "dfrn-id"],
462                         "url" => ["contact", "url"],
463                         "nurl" => ["contact", "nurl"],
464                         "addr" => ["contact", "addr"],
465                         "alias" => ["contact", "alias"],
466                         "pubkey" => ["contact", "pubkey"],
467                         "prvkey" => ["contact", "prvkey"],
468                         "batch" => ["contact", "batch"],
469                         "request" => ["contact", "request"],
470                         "notify" => ["contact", "notify"],
471                         "poll" => ["contact", "poll"],
472                         "confirm" => ["contact", "confirm"],
473                         "poco" => ["contact", "poco"],
474                         "aes_allow" => ["contact", "aes_allow"],
475                         "ret-aes" => ["contact", "ret-aes"],
476                         "usehub" => ["contact", "usehub"],
477                         "subhub" => ["contact", "subhub"],
478                         "hub-verify" => ["contact", "hub-verify"],
479                         "last-update" => ["contact", "last-update"],
480                         "success_update" => ["contact", "success_update"],
481                         "failure_update" => ["contact", "failure_update"],
482                         "name-date" => ["contact", "name-date"],
483                         "uri-date" => ["contact", "uri-date"],
484                         "avatar-date" => ["contact", "avatar-date"],
485                         "picdate" => ["contact", "avatar-date"], /// @todo Replaces all uses of "picdate" with "avatar-date"
486                         "term-date" => ["contact", "term-date"],
487                         "last-item" => ["contact", "last-item"],
488                         "priority" => ["contact", "priority"],
489                         "blocked" => ["user", "blocked"],
490                         "block_reason" => ["contact", "block_reason"],
491                         "readonly" => ["contact", "readonly"],
492                         "writable" => ["contact", "writable"],
493                         "forum" => ["contact", "forum"],
494                         "prv" => ["contact", "prv"],
495                         "contact-type" => ["contact", "contact-type"],
496                         "manually-approve" => ["contact", "manually-approve"],
497                         "hidden" => ["contact", "hidden"],
498                         "archive" => ["contact", "archive"],
499                         "pending" => ["contact", "pending"],
500                         "deleted" => ["contact", "deleted"],
501                         "unsearchable" => ["contact", "unsearchable"],
502                         "sensitive" => ["contact", "sensitive"],
503                         "baseurl" => ["contact", "baseurl"],
504                         "reason" => ["contact", "reason"],
505                         "closeness" => ["contact", "closeness"],
506                         "info" => ["contact", "info"],
507                         "profile-id" => ["contact", "profile-id"],
508                         "bdyear" => ["contact", "bdyear"],
509                         "bd" => ["contact", "bd"],
510                         "notify_new_posts" => ["contact", "notify_new_posts"],
511                         "fetch_further_information" => ["contact", "fetch_further_information"],
512                         "ffi_keyword_denylist" => ["contact", "ffi_keyword_denylist"],
513                         "parent-uid" => ["user", "parent-uid"],
514                         "guid" => ["user", "guid"],
515                         "nickname" => ["user", "nickname"], /// @todo Replaces all uses of "nickname" with "nick"
516                         "email" => ["user", "email"],
517                         "openid" => ["user", "openid"],
518                         "timezone" => ["user", "timezone"],
519                         "language" => ["user", "language"],
520                         "register_date" => ["user", "register_date"],
521                         "login_date" => ["user", "login_date"],
522                         "default-location" => ["user", "default-location"],
523                         "allow_location" => ["user", "allow_location"],
524                         "theme" => ["user", "theme"],
525                         "upubkey" => ["user", "pubkey"],
526                         "uprvkey" => ["user", "prvkey"],
527                         "sprvkey" => ["user", "sprvkey"],
528                         "spubkey" => ["user", "spubkey"],
529                         "verified" => ["user", "verified"],
530                         "blockwall" => ["user", "blockwall"],
531                         "hidewall" => ["user", "hidewall"],
532                         "blocktags" => ["user", "blocktags"],
533                         "unkmail" => ["user", "unkmail"],
534                         "cntunkmail" => ["user", "cntunkmail"],
535                         "notify-flags" => ["user", "notify-flags"],
536                         "page-flags" => ["user", "page-flags"],
537                         "account-type" => ["user", "account-type"],
538                         "prvnets" => ["user", "prvnets"],
539                         "maxreq" => ["user", "maxreq"],
540                         "expire" => ["user", "expire"],
541                         "account_removed" => ["user", "account_removed"],
542                         "account_expired" => ["user", "account_expired"],
543                         "account_expires_on" => ["user", "account_expires_on"],
544                         "expire_notification_sent" => ["user", "expire_notification_sent"],
545                         "def_gid" => ["user", "def_gid"],
546                         "allow_cid" => ["user", "allow_cid"],
547                         "allow_gid" => ["user", "allow_gid"],
548                         "deny_cid" => ["user", "deny_cid"],
549                         "deny_gid" => ["user", "deny_gid"],
550                         "openidserver" => ["user", "openidserver"],
551                         "publish" => ["profile", "publish"],
552                         "net-publish" => ["profile", "net-publish"],
553                         "hide-friends" => ["profile", "hide-friends"],
554                         "prv_keywords" => ["profile", "prv_keywords"],
555                         "pub_keywords" => ["profile", "pub_keywords"],
556                         "address" => ["profile", "address"],
557                         "locality" => ["profile", "locality"],
558                         "region" => ["profile", "region"],
559                         "postal-code" => ["profile", "postal-code"],
560                         "country-name" => ["profile", "country-name"],
561                         "homepage" => ["profile", "homepage"],
562                         "dob" => ["profile", "dob"],
563                 ],
564                 "query" => "FROM `user`
565                         INNER JOIN `contact` ON `contact`.`uid` = `user`.`uid` AND `contact`.`self`
566                         INNER JOIN `profile` ON `profile`.`uid` = `user`.`uid`"
567         ],
568         "pending-view" => [
569                 "fields" => [
570                         "id" => ["register", "id"],
571                         "hash" => ["register", "hash"],
572                         "created" => ["register", "created"],
573                         "uid" => ["register", "uid"],
574                         "password" => ["register", "password"],
575                         "language" => ["register", "language"],
576                         "note" => ["register", "note"],
577                         "self" => ["contact", "self"],
578                         "name" => ["contact", "name"],
579                         "url" => ["contact", "url"],
580                         "micro" => ["contact", "micro"],
581                         "email" => ["user", "email"],
582                         "nick" => ["contact", "nick"],
583                 ],
584                 "query" => "FROM `register`
585                         INNER JOIN `contact` ON `register`.`uid` = `contact`.`uid`
586                         INNER JOIN `user` ON `register`.`uid` = `user`.`uid`"
587         ],
588         "tag-search-view" => [
589                 "fields" => [
590                         "uri-id" => ["post-tag", "uri-id"],
591                         "iid" => ["item", "id"],
592                         "uri" => ["item", "uri"],
593                         "guid" => ["item", "guid"],
594                         "uid" => ["item", "uid"],
595                         "private" => ["item", "private"],
596                         "wall" => ["item", "wall"],
597                         "origin" => ["item", "origin"],
598                         "gravity" => ["item", "gravity"],
599                         "received" => ["item", "received"],                     
600                         "name" => ["tag", "name"],
601                 ],
602                 "query" => "FROM `post-tag`
603                         INNER JOIN `tag` ON `tag`.`id` = `post-tag`.`tid`
604                         INNER JOIN `item` ON `item`.`uri-id` = `post-tag`.`uri-id`
605                         WHERE `post-tag`.`type` = 1"
606         ],
607         "workerqueue-view" => [
608                 "fields" => [
609                         "pid" => ["process", "pid"],
610                         "priority" => ["workerqueue", "priority"],
611                 ],
612                 "query" => "FROM `process`
613                         INNER JOIN `workerqueue` ON `workerqueue`.`pid` = `process`.`pid`
614                         WHERE NOT `workerqueue`.`done`"
615         ],
616 ];
617