]> git.mxchange.org Git - friendica.git/blob - static/dbview.config.php
Merge pull request #11409 from annando/server-detect
[friendica.git] / static / dbview.config.php
1 <?php
2 /**
3  * @copyright Copyright (C) 2010-2022, the Friendica project
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         "application-view" => [
41                 "fields" => [
42                         "id" => ["application", "id"],
43                         "uid" => ["application-token", "uid"],
44                         "name" => ["application", "name"],
45                         "redirect_uri" => ["application", "redirect_uri"],
46                         "website" => ["application", "website"],
47                         "client_id" => ["application", "client_id"],
48                         "client_secret" => ["application", "client_secret"],
49                         "code" => ["application-token", "code"],
50                         "access_token" => ["application-token", "access_token"],
51                         "created_at" => ["application-token", "created_at"],
52                         "scopes" => ["application-token", "scopes"],
53                         "read" => ["application-token", "read"],
54                         "write" => ["application-token", "write"],
55                         "follow" => ["application-token", "follow"],
56                         "push" => ["application-token", "push"],
57                 ],
58                 "query" => "FROM `application-token`
59                         INNER JOIN `application` ON `application-token`.`application-id` = `application`.`id`"
60         ],
61         "post-user-view" => [
62                 "fields" => [
63                         "id" => ["post-user", "id"],
64                         "post-user-id" => ["post-user", "id"],
65                         "uid" => ["post-user", "uid"],
66                         "parent" => ["parent-post", "id"],
67                         "uri" => ["item-uri", "uri"],
68                         "uri-id" => ["post-user", "uri-id"],
69                         "parent-uri" => ["parent-item-uri", "uri"],
70                         "parent-uri-id" => ["post-user", "parent-uri-id"],
71                         "thr-parent" => ["thr-parent-item-uri", "uri"],
72                         "thr-parent-id" => ["post-user", "thr-parent-id"],
73                         "guid" => ["item-uri", "guid"],
74                         "wall" => ["post-user", "wall"],
75                         "gravity" => ["post-user", "gravity"],
76                         "extid" => ["external-item-uri", "uri"],
77                         "external-id" => ["post-user", "external-id"],
78                         "created" => ["post-user", "created"],
79                         "edited" => ["post-user", "edited"],
80                         "commented" => ["post-thread-user", "commented"],
81                         "received" => ["post-user", "received"],
82                         "changed" => ["post-thread-user", "changed"],
83                         "post-type" => ["post-user", "post-type"],
84                         "post-reason" => ["post-user", "post-reason"],
85                         "private" => ["post-user", "private"],
86                         "pubmail" => ["post-thread-user", "pubmail"],
87                         "visible" => ["post-user", "visible"],
88                         "starred" => ["post-thread-user", "starred"],
89                         "unseen" => ["post-user", "unseen"],
90                         "deleted" => ["post-user", "deleted"],
91                         "origin" => ["post-user", "origin"],
92                         "parent-origin" => ["post-thread-user", "origin"],
93                         "mention" => ["post-thread-user", "mention"],
94                         "global" => ["post-user", "global"],
95                         "featured" => "EXISTS(SELECT `type` FROM `post-collection` WHERE `type` = 0 AND `uri-id` = `post-user`.`uri-id`)",
96                         "network" => ["post-user", "network"],
97                         "vid" => ["post-user", "vid"],
98                         "psid" => ["post-user", "psid"],
99                         "verb" => "IF (`post-user`.`vid` IS NULL, '', `verb`.`name`)",
100                         "title" => ["post-content", "title"],
101                         "content-warning" => ["post-content", "content-warning"],
102                         "raw-body" => ["post-content", "raw-body"],
103                         "body" => "IFNULL (`post-content`.`body`, '')",
104                         "rendered-hash" => ["post-content", "rendered-hash"],
105                         "rendered-html" => ["post-content", "rendered-html"],
106                         "language" => ["post-content", "language"],
107                         "plink" => ["post-content", "plink"],
108                         "location" => ["post-content", "location"],
109                         "coord" => ["post-content", "coord"],
110                         "app" => ["post-content", "app"],
111                         "object-type" => ["post-content", "object-type"],
112                         "object" => ["post-content", "object"],
113                         "target-type" => ["post-content", "target-type"],
114                         "target" => ["post-content", "target"],
115                         "resource-id" => ["post-content", "resource-id"],
116                         "contact-id" => ["post-user", "contact-id"],
117                         "contact-link" => ["contact", "url"],
118                         "contact-addr" => ["contact", "addr"],
119                         "contact-name" => ["contact", "name"],
120                         "contact-nick" => ["contact", "nick"],
121                         "contact-avatar" => ["contact", "thumb"],
122                         "contact-network" => ["contact", "network"],
123                         "contact-blocked" => ["contact", "blocked"],
124                         "contact-hidden" => ["contact", "hidden"],
125                         "contact-readonly" => ["contact", "readonly"],
126                         "contact-archive" => ["contact", "archive"],
127                         "contact-pending" => ["contact", "pending"],
128                         "contact-rel" => ["contact", "rel"],
129                         "contact-uid" => ["contact", "uid"],
130                         "contact-contact-type" => ["contact", "contact-type"],
131                         "writable" => "IF (`post-user`.`network` IN ('apub', 'dfrn', 'dspr', 'stat'), true, `contact`.`writable`)",
132                         "self" => ["contact", "self"],
133                         "cid" => ["contact", "id"],
134                         "alias" => ["contact", "alias"],
135                         "photo" => ["contact", "photo"],
136                         "name-date" => ["contact", "name-date"],
137                         "uri-date" => ["contact", "uri-date"],
138                         "avatar-date" => ["contact", "avatar-date"],
139                         "thumb" => ["contact", "thumb"],
140                         "author-id" => ["post-user", "author-id"],
141                         "author-link" => ["author", "url"],
142                         "author-addr" => ["author", "addr"],
143                         "author-name" => "IF (`contact`.`url` = `author`.`url` AND `contact`.`name` != '', `contact`.`name`, `author`.`name`)",
144                         "author-nick" => ["author", "nick"],
145                         "author-avatar" => "IF (`contact`.`url` = `author`.`url` AND `contact`.`thumb` != '', `contact`.`thumb`, `author`.`thumb`)",
146                         "author-network" => ["author", "network"],
147                         "author-blocked" => ["author", "blocked"],
148                         "author-hidden" => ["author", "hidden"],
149                         "owner-id" => ["post-user", "owner-id"],
150                         "owner-link" => ["owner", "url"],
151                         "owner-addr" => ["owner", "addr"],
152                         "owner-name" => "IF (`contact`.`url` = `owner`.`url` AND `contact`.`name` != '', `contact`.`name`, `owner`.`name`)",
153                         "owner-nick" => ["owner", "nick"],
154                         "owner-avatar" => "IF (`contact`.`url` = `owner`.`url` AND `contact`.`thumb` != '', `contact`.`thumb`, `owner`.`thumb`)",
155                         "owner-network" => ["owner", "network"],
156                         "owner-blocked" => ["owner", "blocked"],
157                         "owner-hidden" => ["owner", "hidden"],
158                         "owner-contact-type" => ["owner", "contact-type"],
159                         "causer-id" => ["post-user", "causer-id"],
160                         "causer-link" => ["causer", "url"],
161                         "causer-addr" => ["causer", "addr"],
162                         "causer-name" => ["causer", "name"],
163                         "causer-nick" => ["causer", "nick"],
164                         "causer-avatar" => ["causer", "thumb"],
165                         "causer-network" => ["causer", "network"],
166                         "causer-blocked" => ["causer", "blocked"],
167                         "causer-hidden" => ["causer", "hidden"],
168                         "causer-contact-type" => ["causer", "contact-type"],
169                         "postopts" => ["post-delivery-data", "postopts"],
170                         "inform" => ["post-delivery-data", "inform"],
171                         "delivery_queue_count" => ["post-delivery-data", "queue_count"],
172                         "delivery_queue_done" => ["post-delivery-data", "queue_done"],
173                         "delivery_queue_failed" => ["post-delivery-data", "queue_failed"],
174                         "allow_cid" => "IF (`post-user`.`psid` IS NULL, '', `permissionset`.`allow_cid`)",
175                         "allow_gid" => "IF (`post-user`.`psid` IS NULL, '', `permissionset`.`allow_gid`)",
176                         "deny_cid" => "IF (`post-user`.`psid` IS NULL, '', `permissionset`.`deny_cid`)",
177                         "deny_gid" => "IF (`post-user`.`psid` IS NULL, '', `permissionset`.`deny_gid`)",
178                         "event-id" => ["post-user", "event-id"],
179                         "event-created" => ["event", "created"],
180                         "event-edited" => ["event", "edited"],
181                         "event-start" => ["event", "start"],
182                         "event-finish" => ["event", "finish"],
183                         "event-summary" => ["event", "summary"],
184                         "event-desc" => ["event", "desc"],
185                         "event-location" => ["event", "location"],
186                         "event-type" => ["event", "type"],
187                         "event-nofinish" => ["event", "nofinish"],
188                         "event-ignore" => ["event", "ignore"],
189                         "signed_text" => ["diaspora-interaction", "interaction"],
190                         "parent-guid" => ["parent-item-uri", "guid"],
191                         "parent-network" => ["parent-post", "network"],
192                         "parent-author-id" => ["parent-post", "author-id"],
193                         "parent-author-link" => ["parent-post-author", "url"],
194                         "parent-author-name" => ["parent-post-author", "name"],
195                         "parent-author-nick" => ["parent-post-author", "nick"],
196                         "parent-author-network" => ["parent-post-author", "network"],
197                         "parent-author-blocked" => ["parent-post-author", "blocked"],
198                         "parent-author-hidden" => ["parent-post-author", "hidden"],
199                 ],
200                 "query" => "FROM `post-user`
201                         STRAIGHT_JOIN `post-thread-user` ON `post-thread-user`.`uri-id` = `post-user`.`parent-uri-id` AND `post-thread-user`.`uid` = `post-user`.`uid`
202                         STRAIGHT_JOIN `contact` ON `contact`.`id` = `post-user`.`contact-id`
203                         STRAIGHT_JOIN `contact` AS `author` ON `author`.`id` = `post-user`.`author-id`
204                         STRAIGHT_JOIN `contact` AS `owner` ON `owner`.`id` = `post-user`.`owner-id`
205                         LEFT JOIN `contact` AS `causer` ON `causer`.`id` = `post-user`.`causer-id`
206                         LEFT JOIN `item-uri` ON `item-uri`.`id` = `post-user`.`uri-id`
207                         LEFT JOIN `item-uri` AS `thr-parent-item-uri` ON `thr-parent-item-uri`.`id` = `post-user`.`thr-parent-id`
208                         LEFT JOIN `item-uri` AS `parent-item-uri` ON `parent-item-uri`.`id` = `post-user`.`parent-uri-id`
209                         LEFT JOIN `item-uri` AS `external-item-uri` ON `external-item-uri`.`id` = `post-user`.`external-id`
210                         LEFT JOIN `verb` ON `verb`.`id` = `post-user`.`vid`
211                         LEFT JOIN `event` ON `event`.`id` = `post-user`.`event-id`
212                         LEFT JOIN `diaspora-interaction` ON `diaspora-interaction`.`uri-id` = `post-user`.`uri-id`
213                         LEFT JOIN `post-content` ON `post-content`.`uri-id` = `post-user`.`uri-id`
214                         LEFT JOIN `post-delivery-data` ON `post-delivery-data`.`uri-id` = `post-user`.`uri-id` AND `post-user`.`origin`
215                         LEFT JOIN `permissionset` ON `permissionset`.`id` = `post-user`.`psid`
216                         LEFT JOIN `post-user` AS `parent-post` ON `parent-post`.`uri-id` = `post-user`.`parent-uri-id` AND `parent-post`.`uid` = `post-user`.`uid`
217                         LEFT JOIN `contact` AS `parent-post-author` ON `parent-post-author`.`id` = `parent-post`.`author-id`"
218         ],
219         "post-thread-user-view" => [
220                 "fields" => [
221                         "id" => ["post-user", "id"],
222                         "post-user-id" => ["post-user", "id"],
223                         "uid" => ["post-thread-user", "uid"],
224                         "parent" => ["parent-post", "id"],
225                         "uri" => ["item-uri", "uri"],
226                         "uri-id" => ["post-thread-user", "uri-id"],
227                         "parent-uri" => ["parent-item-uri", "uri"],
228                         "parent-uri-id" => ["post-user", "parent-uri-id"],
229                         "thr-parent" => ["thr-parent-item-uri", "uri"],
230                         "thr-parent-id" => ["post-user", "thr-parent-id"],
231                         "guid" => ["item-uri", "guid"],
232                         "wall" => ["post-thread-user", "wall"],
233                         "gravity" => ["post-user", "gravity"],
234                         "extid" => ["external-item-uri", "uri"],
235                         "external-id" => ["post-user", "external-id"],
236                         "created" => ["post-thread-user", "created"],
237                         "edited" => ["post-user", "edited"],
238                         "commented" => ["post-thread-user", "commented"],
239                         "received" => ["post-thread-user", "received"],
240                         "changed" => ["post-thread-user", "changed"],
241                         "post-type" => ["post-user", "post-type"],
242                         "post-reason" => ["post-user", "post-reason"],
243                         "private" => ["post-user", "private"],
244                         "pubmail" => ["post-thread-user", "pubmail"],
245                         "ignored" => ["post-thread-user", "ignored"],
246                         "visible" => ["post-user", "visible"],
247                         "starred" => ["post-thread-user", "starred"],
248                         "unseen" => ["post-thread-user", "unseen"],
249                         "deleted" => ["post-user", "deleted"],
250                         "origin" => ["post-thread-user", "origin"],
251                         "mention" => ["post-thread-user", "mention"],
252                         "global" => ["post-user", "global"],
253                         "featured" => "EXISTS(SELECT `type` FROM `post-collection` WHERE `type` = 0 AND `uri-id` = `post-thread-user`.`uri-id`)",
254                         "network" => ["post-thread-user", "network"],
255                         "vid" => ["post-user", "vid"],
256                         "psid" => ["post-thread-user", "psid"],
257                         "verb" => "IF (`post-user`.`vid` IS NULL, '', `verb`.`name`)",
258                         "title" => ["post-content", "title"],
259                         "content-warning" => ["post-content", "content-warning"],
260                         "raw-body" => ["post-content", "raw-body"],
261                         "body" => ["post-content", "body"],
262                         "rendered-hash" => ["post-content", "rendered-hash"],
263                         "rendered-html" => ["post-content", "rendered-html"],
264                         "language" => ["post-content", "language"],
265                         "plink" => ["post-content", "plink"],
266                         "location" => ["post-content", "location"],
267                         "coord" => ["post-content", "coord"],
268                         "app" => ["post-content", "app"],
269                         "object-type" => ["post-content", "object-type"],
270                         "object" => ["post-content", "object"],
271                         "target-type" => ["post-content", "target-type"],
272                         "target" => ["post-content", "target"],
273                         "resource-id" => ["post-content", "resource-id"],
274                         "contact-id" => ["post-thread-user", "contact-id"],
275                         "contact-link" => ["contact", "url"],
276                         "contact-addr" => ["contact", "addr"],
277                         "contact-name" => ["contact", "name"],
278                         "contact-nick" => ["contact", "nick"],
279                         "contact-avatar" => ["contact", "thumb"],
280                         "contact-network" => ["contact", "network"],
281                         "contact-blocked" => ["contact", "blocked"],
282                         "contact-hidden" => ["contact", "hidden"],
283                         "contact-readonly" => ["contact", "readonly"],
284                         "contact-archive" => ["contact", "archive"],
285                         "contact-pending" => ["contact", "pending"],
286                         "contact-rel" => ["contact", "rel"],
287                         "contact-uid" => ["contact", "uid"],
288                         "contact-contact-type" => ["contact", "contact-type"],
289                         "writable" => "IF (`post-user`.`network` IN ('apub', 'dfrn', 'dspr', 'stat'), true, `contact`.`writable`)",
290                         "self" => ["contact", "self"],
291                         "cid" => ["contact", "id"],
292                         "alias" => ["contact", "alias"],
293                         "photo" => ["contact", "photo"],
294                         "name-date" => ["contact", "name-date"],
295                         "uri-date" => ["contact", "uri-date"],
296                         "avatar-date" => ["contact", "avatar-date"],
297                         "thumb" => ["contact", "thumb"],
298                         "author-id" => ["post-thread-user", "author-id"],
299                         "author-link" => ["author", "url"],
300                         "author-addr" => ["author", "addr"],
301                         "author-name" => "IF (`contact`.`url` = `author`.`url` AND `contact`.`name` != '', `contact`.`name`, `author`.`name`)",
302                         "author-nick" => ["author", "nick"],
303                         "author-avatar" => "IF (`contact`.`url` = `author`.`url` AND `contact`.`thumb` != '', `contact`.`thumb`, `author`.`thumb`)",
304                         "author-network" => ["author", "network"],
305                         "author-blocked" => ["author", "blocked"],
306                         "author-hidden" => ["author", "hidden"],
307                         "owner-id" => ["post-thread-user", "owner-id"],
308                         "owner-link" => ["owner", "url"],
309                         "owner-addr" => ["owner", "addr"],
310                         "owner-name" => "IF (`contact`.`url` = `owner`.`url` AND `contact`.`name` != '', `contact`.`name`, `owner`.`name`)",
311                         "owner-nick" => ["owner", "nick"],
312                         "owner-avatar" => "IF (`contact`.`url` = `owner`.`url` AND `contact`.`thumb` != '', `contact`.`thumb`, `owner`.`thumb`)",
313                         "owner-network" => ["owner", "network"],
314                         "owner-blocked" => ["owner", "blocked"],
315                         "owner-hidden" => ["owner", "hidden"],
316                         "owner-contact-type" => ["owner", "contact-type"],
317                         "causer-id" => ["post-thread-user", "causer-id"],
318                         "causer-link" => ["causer", "url"],
319                         "causer-addr" => ["causer", "addr"],
320                         "causer-name" => ["causer", "name"],
321                         "causer-nick" => ["causer", "nick"],
322                         "causer-avatar" => ["causer", "thumb"],
323                         "causer-network" => ["causer", "network"],
324                         "causer-blocked" => ["causer", "blocked"],
325                         "causer-hidden" => ["causer", "hidden"],
326                         "causer-contact-type" => ["causer", "contact-type"],
327                         "postopts" => ["post-delivery-data", "postopts"],
328                         "inform" => ["post-delivery-data", "inform"],
329                         "delivery_queue_count" => ["post-delivery-data", "queue_count"],
330                         "delivery_queue_done" => ["post-delivery-data", "queue_done"],
331                         "delivery_queue_failed" => ["post-delivery-data", "queue_failed"],
332                         "allow_cid" => "IF (`post-thread-user`.`psid` IS NULL, '', `permissionset`.`allow_cid`)",
333                         "allow_gid" => "IF (`post-thread-user`.`psid` IS NULL, '', `permissionset`.`allow_gid`)",
334                         "deny_cid" => "IF (`post-thread-user`.`psid` IS NULL, '', `permissionset`.`deny_cid`)",
335                         "deny_gid" => "IF (`post-thread-user`.`psid` IS NULL, '', `permissionset`.`deny_gid`)",
336                         "event-id" => ["post-user", "event-id"],
337                         "event-created" => ["event", "created"],
338                         "event-edited" => ["event", "edited"],
339                         "event-start" => ["event", "start"],
340                         "event-finish" => ["event", "finish"],
341                         "event-summary" => ["event", "summary"],
342                         "event-desc" => ["event", "desc"],
343                         "event-location" => ["event", "location"],
344                         "event-type" => ["event", "type"],
345                         "event-nofinish" => ["event", "nofinish"],
346                         "event-ignore" => ["event", "ignore"],
347                         "signed_text" => ["diaspora-interaction", "interaction"],
348                         "parent-guid" => ["parent-item-uri", "guid"],
349                         "parent-network" => ["parent-post", "network"],
350                         "parent-author-id" => ["parent-post", "author-id"],
351                         "parent-author-link" => ["parent-post-author", "url"],
352                         "parent-author-name" => ["parent-post-author", "name"],
353                         "parent-author-network" => ["parent-post-author", "network"],
354                         "parent-author-blocked" => ["parent-post-author", "blocked"],
355                         "parent-author-hidden" => ["parent-post-author", "hidden"],
356                 ],
357                 "query" => "FROM `post-thread-user`
358                         INNER JOIN `post-user` ON `post-user`.`id` = `post-thread-user`.`post-user-id`
359                         STRAIGHT_JOIN `contact` ON `contact`.`id` = `post-thread-user`.`contact-id`
360                         STRAIGHT_JOIN `contact` AS `author` ON `author`.`id` = `post-thread-user`.`author-id`
361                         STRAIGHT_JOIN `contact` AS `owner` ON `owner`.`id` = `post-thread-user`.`owner-id`
362                         LEFT JOIN `contact` AS `causer` ON `causer`.`id` = `post-thread-user`.`causer-id`
363                         LEFT JOIN `item-uri` ON `item-uri`.`id` = `post-thread-user`.`uri-id`
364                         LEFT JOIN `item-uri` AS `thr-parent-item-uri` ON `thr-parent-item-uri`.`id` = `post-user`.`thr-parent-id`
365                         LEFT JOIN `item-uri` AS `parent-item-uri` ON `parent-item-uri`.`id` = `post-user`.`parent-uri-id`
366                         LEFT JOIN `item-uri` AS `external-item-uri` ON `external-item-uri`.`id` = `post-user`.`external-id`
367                         LEFT JOIN `verb` ON `verb`.`id` = `post-user`.`vid`
368                         LEFT JOIN `event` ON `event`.`id` = `post-user`.`event-id`
369                         LEFT JOIN `diaspora-interaction` ON `diaspora-interaction`.`uri-id` = `post-thread-user`.`uri-id`
370                         LEFT JOIN `post-content` ON `post-content`.`uri-id` = `post-thread-user`.`uri-id`
371                         LEFT JOIN `post-delivery-data` ON `post-delivery-data`.`uri-id` = `post-thread-user`.`uri-id` AND `post-thread-user`.`origin`
372                         LEFT JOIN `permissionset` ON `permissionset`.`id` = `post-thread-user`.`psid`
373                         LEFT JOIN `post-user` AS `parent-post` ON `parent-post`.`uri-id` = `post-user`.`parent-uri-id` AND `parent-post`.`uid` = `post-thread-user`.`uid`
374                         LEFT JOIN `contact` AS `parent-post-author` ON `parent-post-author`.`id` = `parent-post`.`author-id`"
375         ],
376         "post-view" => [
377                 "fields" => [
378                         "uri" => ["item-uri", "uri"],
379                         "uri-id" => ["post", "uri-id"],
380                         "parent-uri" => ["parent-item-uri", "uri"],
381                         "parent-uri-id" => ["post", "parent-uri-id"],
382                         "thr-parent" => ["thr-parent-item-uri", "uri"],
383                         "thr-parent-id" => ["post", "thr-parent-id"],
384                         "guid" => ["item-uri", "guid"],
385                         "gravity" => ["post", "gravity"],
386                         "extid" => ["external-item-uri", "uri"],
387                         "external-id" => ["post", "external-id"],
388                         "created" => ["post", "created"],
389                         "edited" => ["post", "edited"],
390                         "commented" => ["post-thread", "commented"],
391                         "received" => ["post", "received"],
392                         "changed" => ["post-thread", "changed"],
393                         "post-type" => ["post", "post-type"],
394                         "private" => ["post", "private"],
395                         "visible" => ["post", "visible"],
396                         "deleted" => ["post", "deleted"],
397                         "global" => ["post", "global"],
398                         "featured" => "EXISTS(SELECT `type` FROM `post-collection` WHERE `type` = 0 AND `uri-id` = `post`.`uri-id`)",
399                         "network" => ["post", "network"],
400                         "vid" => ["post", "vid"],
401                         "verb" => "IF (`post`.`vid` IS NULL, '', `verb`.`name`)",
402                         "title" => ["post-content", "title"],
403                         "content-warning" => ["post-content", "content-warning"],
404                         "raw-body" => ["post-content", "raw-body"],
405                         "body" => ["post-content", "body"],
406                         "rendered-hash" => ["post-content", "rendered-hash"],
407                         "rendered-html" => ["post-content", "rendered-html"],
408                         "language" => ["post-content", "language"],
409                         "plink" => ["post-content", "plink"],
410                         "location" => ["post-content", "location"],
411                         "coord" => ["post-content", "coord"],
412                         "app" => ["post-content", "app"],
413                         "object-type" => ["post-content", "object-type"],
414                         "object" => ["post-content", "object"],
415                         "target-type" => ["post-content", "target-type"],
416                         "target" => ["post-content", "target"],
417                         "resource-id" => ["post-content", "resource-id"],
418                         "contact-id" => ["post", "author-id"],
419                         "contact-link" => ["author", "url"],
420                         "contact-addr" => ["author", "addr"],
421                         "contact-name" => ["author", "name"],
422                         "contact-nick" => ["author", "nick"],
423                         "contact-avatar" => ["author", "thumb"],
424                         "contact-network" => ["author", "network"],
425                         "contact-blocked" => ["author", "blocked"],
426                         "contact-hidden" => ["author", "hidden"],
427                         "contact-readonly" => ["author", "readonly"],
428                         "contact-archive" => ["author", "archive"],
429                         "contact-pending" => ["author", "pending"],
430                         "contact-rel" => ["author", "rel"],
431                         "contact-uid" => ["author", "uid"],
432                         "contact-contact-type" => ["author", "contact-type"],
433                         "writable" => "IF (`post`.`network` IN ('apub', 'dfrn', 'dspr', 'stat'), true, `author`.`writable`)",
434                         "self" => "false",
435                         "cid" => ["author", "id"],
436                         "alias" => ["author", "alias"],
437                         "photo" => ["author", "photo"],
438                         "name-date" => ["author", "name-date"],
439                         "uri-date" => ["author", "uri-date"],
440                         "avatar-date" => ["author", "avatar-date"],
441                         "thumb" => ["author", "thumb"],
442                         "author-id" => ["post", "author-id"],
443                         "author-link" => ["author", "url"],
444                         "author-addr" => ["author", "addr"],
445                         "author-name" => ["author", "name"],
446                         "author-nick" => ["author", "nick"],
447                         "author-avatar" => ["author", "thumb"],
448                         "author-network" => ["author", "network"],
449                         "author-blocked" => ["author", "blocked"],
450                         "author-hidden" => ["author", "hidden"],
451                         "owner-id" => ["post", "owner-id"],
452                         "owner-link" => ["owner", "url"],
453                         "owner-addr" => ["owner", "addr"],
454                         "owner-name" => ["owner", "name"],
455                         "owner-nick" => ["owner", "nick"],
456                         "owner-avatar" => ["owner", "thumb"],
457                         "owner-network" => ["owner", "network"],
458                         "owner-blocked" => ["owner", "blocked"],
459                         "owner-hidden" => ["owner", "hidden"],
460                         "owner-contact-type" => ["owner", "contact-type"],
461                         "causer-id" => ["post", "causer-id"],
462                         "causer-link" => ["causer", "url"],
463                         "causer-addr" => ["causer", "addr"],
464                         "causer-name" => ["causer", "name"],
465                         "causer-nick" => ["causer", "nick"],
466                         "causer-avatar" => ["causer", "thumb"],
467                         "causer-network" => ["causer", "network"],
468                         "causer-blocked" => ["causer", "blocked"],
469                         "causer-hidden" => ["causer", "hidden"],
470                         "causer-contact-type" => ["causer", "contact-type"],
471                         "signed_text" => ["diaspora-interaction", "interaction"],
472                         "parent-guid" => ["parent-item-uri", "guid"],
473                         "parent-network" => ["parent-post", "network"],
474                         "parent-author-id" => ["parent-post", "author-id"],
475                         "parent-author-link" => ["parent-post-author", "url"],
476                         "parent-author-name" => ["parent-post-author", "name"],
477                         "parent-author-network" => ["parent-post-author", "network"],
478                         "parent-author-blocked" => ["parent-post-author", "blocked"],
479                         "parent-author-hidden" => ["parent-post-author", "hidden"],
480                 ],
481                 "query" => "FROM `post`
482                         STRAIGHT_JOIN `post-thread` ON `post-thread`.`uri-id` = `post`.`parent-uri-id`
483                         STRAIGHT_JOIN `contact` AS `author` ON `author`.`id` = `post`.`author-id`
484                         STRAIGHT_JOIN `contact` AS `owner` ON `owner`.`id` = `post`.`owner-id`
485                         LEFT JOIN `contact` AS `causer` ON `causer`.`id` = `post`.`causer-id`
486                         LEFT JOIN `item-uri` ON `item-uri`.`id` = `post`.`uri-id`
487                         LEFT JOIN `item-uri` AS `thr-parent-item-uri` ON `thr-parent-item-uri`.`id` = `post`.`thr-parent-id`
488                         LEFT JOIN `item-uri` AS `parent-item-uri` ON `parent-item-uri`.`id` = `post`.`parent-uri-id`
489                         LEFT JOIN `item-uri` AS `external-item-uri` ON `external-item-uri`.`id` = `post`.`external-id`
490                         LEFT JOIN `verb` ON `verb`.`id` = `post`.`vid`
491                         LEFT JOIN `diaspora-interaction` ON `diaspora-interaction`.`uri-id` = `post`.`uri-id`
492                         LEFT JOIN `post-content` ON `post-content`.`uri-id` = `post`.`uri-id`
493                         LEFT JOIN `post` AS `parent-post` ON `parent-post`.`uri-id` = `post`.`parent-uri-id`
494                         LEFT JOIN `contact` AS `parent-post-author` ON `parent-post-author`.`id` = `parent-post`.`author-id`"
495         ],
496         "post-thread-view" => [
497                 "fields" => [
498                         "uri" => ["item-uri", "uri"],
499                         "uri-id" => ["post-thread", "uri-id"],
500                         "parent-uri" => ["parent-item-uri", "uri"],
501                         "parent-uri-id" => ["post", "parent-uri-id"],
502                         "thr-parent" => ["thr-parent-item-uri", "uri"],
503                         "thr-parent-id" => ["post", "thr-parent-id"],
504                         "guid" => ["item-uri", "guid"],
505                         "gravity" => ["post", "gravity"],
506                         "extid" => ["external-item-uri", "uri"],
507                         "external-id" => ["post", "external-id"],
508                         "created" => ["post-thread", "created"],
509                         "edited" => ["post", "edited"],
510                         "commented" => ["post-thread", "commented"],
511                         "received" => ["post-thread", "received"],
512                         "changed" => ["post-thread", "changed"],
513                         "post-type" => ["post", "post-type"],
514                         "private" => ["post", "private"],
515                         "visible" => ["post", "visible"],
516                         "deleted" => ["post", "deleted"],
517                         "global" => ["post", "global"],
518                         "featured" => "EXISTS(SELECT `type` FROM `post-collection` WHERE `type` = 0 AND `uri-id` = `post-thread`.`uri-id`)",
519                         "network" => ["post-thread", "network"],
520                         "vid" => ["post", "vid"],
521                         "verb" => "IF (`post`.`vid` IS NULL, '', `verb`.`name`)",
522                         "title" => ["post-content", "title"],
523                         "content-warning" => ["post-content", "content-warning"],
524                         "raw-body" => ["post-content", "raw-body"],
525                         "body" => ["post-content", "body"],
526                         "rendered-hash" => ["post-content", "rendered-hash"],
527                         "rendered-html" => ["post-content", "rendered-html"],
528                         "language" => ["post-content", "language"],
529                         "plink" => ["post-content", "plink"],
530                         "location" => ["post-content", "location"],
531                         "coord" => ["post-content", "coord"],
532                         "app" => ["post-content", "app"],
533                         "object-type" => ["post-content", "object-type"],
534                         "object" => ["post-content", "object"],
535                         "target-type" => ["post-content", "target-type"],
536                         "target" => ["post-content", "target"],
537                         "resource-id" => ["post-content", "resource-id"],
538                         "contact-id" => ["post-thread", "author-id"],
539                         "contact-link" => ["author", "url"],
540                         "contact-addr" => ["author", "addr"],
541                         "contact-name" => ["author", "name"],
542                         "contact-nick" => ["author", "nick"],
543                         "contact-avatar" => ["author", "thumb"],
544                         "contact-network" => ["author", "network"],
545                         "contact-blocked" => ["author", "blocked"],
546                         "contact-hidden" => ["author", "hidden"],
547                         "contact-readonly" => ["author", "readonly"],
548                         "contact-archive" => ["author", "archive"],
549                         "contact-pending" => ["author", "pending"],
550                         "contact-rel" => ["author", "rel"],
551                         "contact-uid" => ["author", "uid"],
552                         "contact-contact-type" => ["author", "contact-type"],
553                         "writable" => "IF (`post`.`network` IN ('apub', 'dfrn', 'dspr', 'stat'), true, `author`.`writable`)",
554                         "self" => "false",
555                         "cid" => ["author", "id"],
556                         "alias" => ["author", "alias"],
557                         "photo" => ["author", "photo"],
558                         "name-date" => ["author", "name-date"],
559                         "uri-date" => ["author", "uri-date"],
560                         "avatar-date" => ["author", "avatar-date"],
561                         "thumb" => ["author", "thumb"],
562                         "author-id" => ["post-thread", "author-id"],
563                         "author-link" => ["author", "url"],
564                         "author-addr" => ["author", "addr"],
565                         "author-name" => ["author", "name"],
566                         "author-nick" => ["author", "nick"],
567                         "author-avatar" => ["author", "thumb"],
568                         "author-network" => ["author", "network"],
569                         "author-blocked" => ["author", "blocked"],
570                         "author-hidden" => ["author", "hidden"],
571                         "owner-id" => ["post-thread", "owner-id"],
572                         "owner-link" => ["owner", "url"],
573                         "owner-addr" => ["owner", "addr"],
574                         "owner-name" => ["owner", "name"],
575                         "owner-nick" => ["owner", "nick"],
576                         "owner-avatar" => ["owner", "thumb"],
577                         "owner-network" => ["owner", "network"],
578                         "owner-blocked" => ["owner", "blocked"],
579                         "owner-hidden" => ["owner", "hidden"],
580                         "owner-contact-type" => ["owner", "contact-type"],
581                         "causer-id" => ["post-thread", "causer-id"],
582                         "causer-link" => ["causer", "url"],
583                         "causer-addr" => ["causer", "addr"],
584                         "causer-name" => ["causer", "name"],
585                         "causer-nick" => ["causer", "nick"],
586                         "causer-avatar" => ["causer", "thumb"],
587                         "causer-network" => ["causer", "network"],
588                         "causer-blocked" => ["causer", "blocked"],
589                         "causer-hidden" => ["causer", "hidden"],
590                         "causer-contact-type" => ["causer", "contact-type"],
591                         "signed_text" => ["diaspora-interaction", "interaction"],
592                         "parent-guid" => ["parent-item-uri", "guid"],
593                         "parent-network" => ["parent-post", "network"],
594                         "parent-author-id" => ["parent-post", "author-id"],
595                         "parent-author-link" => ["parent-post-author", "url"],
596                         "parent-author-name" => ["parent-post-author", "name"],
597                         "parent-author-network" => ["parent-post-author", "network"],
598                         "parent-author-blocked" => ["parent-post-author", "blocked"],
599                         "parent-author-hidden" => ["parent-post-author", "hidden"],
600                 ],
601                 "query" => "FROM `post-thread`
602                         INNER JOIN `post` ON `post`.`uri-id` = `post-thread`.`uri-id`
603                         STRAIGHT_JOIN `contact` AS `author` ON `author`.`id` = `post-thread`.`author-id`
604                         STRAIGHT_JOIN `contact` AS `owner` ON `owner`.`id` = `post-thread`.`owner-id`
605                         LEFT JOIN `contact` AS `causer` ON `causer`.`id` = `post-thread`.`causer-id`
606                         LEFT JOIN `item-uri` ON `item-uri`.`id` = `post-thread`.`uri-id`
607                         LEFT JOIN `item-uri` AS `thr-parent-item-uri` ON `thr-parent-item-uri`.`id` = `post`.`thr-parent-id`
608                         LEFT JOIN `item-uri` AS `parent-item-uri` ON `parent-item-uri`.`id` = `post`.`parent-uri-id`
609                         LEFT JOIN `item-uri` AS `external-item-uri` ON `external-item-uri`.`id` = `post`.`external-id`
610                         LEFT JOIN `verb` ON `verb`.`id` = `post`.`vid`
611                         LEFT JOIN `diaspora-interaction` ON `diaspora-interaction`.`uri-id` = `post-thread`.`uri-id`
612                         LEFT JOIN `post-content` ON `post-content`.`uri-id` = `post-thread`.`uri-id`
613                         LEFT JOIN `post` AS `parent-post` ON `parent-post`.`uri-id` = `post`.`parent-uri-id`
614                         LEFT JOIN `contact` AS `parent-post-author` ON `parent-post-author`.`id` = `parent-post`.`author-id`"
615         ],
616         "category-view" => [
617                 "fields" => [
618                         "uri-id" => ["post-category", "uri-id"],
619                         "uid" => ["post-category", "uid"],
620                         "type" => ["post-category", "type"],
621                         "tid" => ["post-category", "tid"],
622                         "name" => ["tag", "name"],
623                         "url" => ["tag", "url"],
624                 ],
625                 "query" => "FROM `post-category`
626                         LEFT JOIN `tag` ON `post-category`.`tid` = `tag`.`id`"
627         ],
628         "collection-view" => [
629                 "fields" => [
630                         "uri-id" => ["post-collection", "uri-id"],
631                         "type" => ["post-collection", "type"],
632                         "cid" => ["post", "author-id"],
633                         "received" => ["post", "received"],
634                         "created" => ["post", "created"],
635                 ],
636                 "query" => "FROM `post-collection`
637                         INNER JOIN `post` ON `post-collection`.`uri-id` = `post`.`uri-id`"
638         ],
639         "tag-view" => [
640                 "fields" => [
641                         "uri-id" => ["post-tag", "uri-id"],
642                         "type" => ["post-tag", "type"],
643                         "tid" => ["post-tag", "tid"],
644                         "cid" => ["post-tag", "cid"],
645                         "name" => "CASE `cid` WHEN 0 THEN `tag`.`name` ELSE `contact`.`name` END",
646                         "url" => "CASE `cid` WHEN 0 THEN `tag`.`url` ELSE `contact`.`url` END",
647                 ],
648                 "query" => "FROM `post-tag`
649                         LEFT JOIN `tag` ON `post-tag`.`tid` = `tag`.`id`
650                         LEFT JOIN `contact` ON `post-tag`.`cid` = `contact`.`id`"
651         ],
652         "network-item-view" => [
653                 "fields" => [
654                         "uri-id" => ["post-user", "uri-id"],
655                         "parent" => ["parent-post", "id"],
656                         "received" => ["post-user", "received"],
657                         "commented" => ["post-thread-user", "commented"],
658                         "created" => ["post-user", "created"],
659                         "uid" => ["post-user", "uid"],
660                         "starred" => ["post-thread-user", "starred"],
661                         "mention" => ["post-thread-user", "mention"],
662                         "network" => ["post-user", "network"],
663                         "unseen" => ["post-user", "unseen"],
664                         "gravity" => ["post-user", "gravity"],
665                         "contact-id" => ["post-user", "contact-id"],
666                         "contact-type" => ["ownercontact", "contact-type"],
667                 ],
668                 "query" => "FROM `post-user`
669                         STRAIGHT_JOIN `post-thread-user` ON `post-thread-user`.`uri-id` = `post-user`.`parent-uri-id` AND `post-thread-user`.`uid` = `post-user`.`uid`                  
670                         INNER JOIN `contact` ON `contact`.`id` = `post-thread-user`.`contact-id`
671                         LEFT JOIN `user-contact` AS `author` ON `author`.`uid` = `post-thread-user`.`uid` AND `author`.`cid` = `post-thread-user`.`author-id`
672                         LEFT JOIN `user-contact` AS `owner` ON `owner`.`uid` = `post-thread-user`.`uid` AND `owner`.`cid` = `post-thread-user`.`owner-id`
673                         INNER JOIN `contact` AS `ownercontact` ON `ownercontact`.`id` = `post-thread-user`.`owner-id`
674                         LEFT JOIN `post-user` AS `parent-post` ON `parent-post`.`uri-id` = `post-user`.`parent-uri-id` AND `parent-post`.`uid` = `post-user`.`uid`
675                         WHERE `post-user`.`visible` AND NOT `post-user`.`deleted`
676                         AND (NOT `contact`.`readonly` AND NOT `contact`.`blocked` AND NOT `contact`.`pending`)
677                         AND (`post-user`.`hidden` IS NULL OR NOT `post-user`.`hidden`)
678                         AND (`author`.`blocked` IS NULL OR NOT `author`.`blocked`)
679                         AND (`owner`.`blocked` IS NULL OR NOT `owner`.`blocked`)"
680         ],
681         "network-thread-view" => [
682                 "fields" => [
683                         "uri-id" => ["post-thread-user", "uri-id"],
684                         "parent" => ["parent-post", "id"],
685                         "received" => ["post-thread-user", "received"],
686                         "commented" => ["post-thread-user", "commented"],
687                         "created" => ["post-thread-user", "created"],
688                         "uid" => ["post-thread-user", "uid"],
689                         "starred" => ["post-thread-user", "starred"],
690                         "mention" => ["post-thread-user", "mention"],
691                         "network" => ["post-thread-user", "network"],
692                         "contact-id" => ["post-thread-user", "contact-id"],
693                         "contact-type" => ["ownercontact", "contact-type"],
694                 ],
695                 "query" => "FROM `post-thread-user`
696                         INNER JOIN `post-user` ON `post-user`.`id` = `post-thread-user`.`post-user-id`
697                         STRAIGHT_JOIN `contact` ON `contact`.`id` = `post-thread-user`.`contact-id`
698                         LEFT JOIN `user-contact` AS `author` ON `author`.`uid` = `post-thread-user`.`uid` AND `author`.`cid` = `post-thread-user`.`author-id`
699                         LEFT JOIN `user-contact` AS `owner` ON `owner`.`uid` = `post-thread-user`.`uid` AND `owner`.`cid` = `post-thread-user`.`owner-id`
700                         LEFT JOIN `contact` AS `ownercontact` ON `ownercontact`.`id` = `post-thread-user`.`owner-id`
701                         LEFT JOIN `post-user` AS `parent-post` ON `parent-post`.`uri-id` = `post-user`.`parent-uri-id` AND `parent-post`.`uid` = `post-user`.`uid`
702                         WHERE `post-user`.`visible` AND NOT `post-user`.`deleted`
703                         AND (NOT `contact`.`readonly` AND NOT `contact`.`blocked` AND NOT `contact`.`pending`)
704                         AND (`post-thread-user`.`hidden` IS NULL OR NOT `post-thread-user`.`hidden`)
705                         AND (`author`.`blocked` IS NULL OR NOT `author`.`blocked`)
706                         AND (`owner`.`blocked` IS NULL OR NOT `owner`.`blocked`)"
707         ],
708         "owner-view" => [
709                 "fields" => [
710                         "id" => ["contact", "id"],
711                         "uid" => ["contact", "uid"],
712                         "created" => ["contact", "created"],
713                         "updated" => ["contact", "updated"],
714                         "self" => ["contact", "self"],
715                         "remote_self" => ["contact", "remote_self"],
716                         "rel" => ["contact", "rel"],
717                         "network" => ["contact", "network"],
718                         "protocol" => ["contact", "protocol"],
719                         "name" => ["contact", "name"],
720                         "nick" => ["contact", "nick"],
721                         "location" => ["contact", "location"],
722                         "about" => ["contact", "about"],
723                         "keywords" => ["contact", "keywords"],
724                         "xmpp" => ["contact", "xmpp"],
725                         "matrix" => ["contact", "matrix"],
726                         "attag" => ["contact", "attag"],
727                         "avatar" => ["contact", "avatar"],
728                         "photo" => ["contact", "photo"],
729                         "thumb" => ["contact", "thumb"],
730                         "micro" => ["contact", "micro"],
731                         "header" => ["contact", "header"],
732                         "url" => ["contact", "url"],
733                         "nurl" => ["contact", "nurl"],
734                         "uri-id" => ["contact", "uri-id"],
735                         "addr" => ["contact", "addr"],
736                         "alias" => ["contact", "alias"],
737                         "pubkey" => ["contact", "pubkey"],
738                         "prvkey" => ["contact", "prvkey"],
739                         "batch" => ["contact", "batch"],
740                         "request" => ["contact", "request"],
741                         "notify" => ["contact", "notify"],
742                         "poll" => ["contact", "poll"],
743                         "confirm" => ["contact", "confirm"],
744                         "poco" => ["contact", "poco"],
745                         "subhub" => ["contact", "subhub"],
746                         "hub-verify" => ["contact", "hub-verify"],
747                         "last-update" => ["contact", "last-update"],
748                         "success_update" => ["contact", "success_update"],
749                         "failure_update" => ["contact", "failure_update"],
750                         "name-date" => ["contact", "name-date"],
751                         "uri-date" => ["contact", "uri-date"],
752                         "avatar-date" => ["contact", "avatar-date"],
753                         "picdate" => ["contact", "avatar-date"], /// @todo Replaces all uses of "picdate" with "avatar-date"
754                         "term-date" => ["contact", "term-date"],
755                         "last-item" => ["contact", "last-item"],
756                         "priority" => ["contact", "priority"],
757                         "blocked" => ["user", "blocked"],
758                         "block_reason" => ["contact", "block_reason"],
759                         "readonly" => ["contact", "readonly"],
760                         "writable" => ["contact", "writable"],
761                         "forum" => ["contact", "forum"],
762                         "prv" => ["contact", "prv"],
763                         "contact-type" => ["contact", "contact-type"],
764                         "manually-approve" => ["contact", "manually-approve"],
765                         "hidden" => ["contact", "hidden"],
766                         "archive" => ["contact", "archive"],
767                         "pending" => ["contact", "pending"],
768                         "deleted" => ["contact", "deleted"],
769                         "unsearchable" => ["contact", "unsearchable"],
770                         "sensitive" => ["contact", "sensitive"],
771                         "baseurl" => ["contact", "baseurl"],
772                         "reason" => ["contact", "reason"],
773                         "info" => ["contact", "info"],
774                         "bdyear" => ["contact", "bdyear"],
775                         "bd" => ["contact", "bd"],
776                         "notify_new_posts" => ["contact", "notify_new_posts"],
777                         "fetch_further_information" => ["contact", "fetch_further_information"],
778                         "ffi_keyword_denylist" => ["contact", "ffi_keyword_denylist"],
779                         "parent-uid" => ["user", "parent-uid"],
780                         "guid" => ["user", "guid"],
781                         "nickname" => ["user", "nickname"], /// @todo Replaces all uses of "nickname" with "nick"
782                         "email" => ["user", "email"],
783                         "openid" => ["user", "openid"],
784                         "timezone" => ["user", "timezone"],
785                         "language" => ["user", "language"],
786                         "register_date" => ["user", "register_date"],
787                         "login_date" => ["user", "login_date"],
788                         "default-location" => ["user", "default-location"],
789                         "allow_location" => ["user", "allow_location"],
790                         "theme" => ["user", "theme"],
791                         "upubkey" => ["user", "pubkey"],
792                         "uprvkey" => ["user", "prvkey"],
793                         "sprvkey" => ["user", "sprvkey"],
794                         "spubkey" => ["user", "spubkey"],
795                         "verified" => ["user", "verified"],
796                         "blockwall" => ["user", "blockwall"],
797                         "hidewall" => ["user", "hidewall"],
798                         "blocktags" => ["user", "blocktags"],
799                         "unkmail" => ["user", "unkmail"],
800                         "cntunkmail" => ["user", "cntunkmail"],
801                         "notify-flags" => ["user", "notify-flags"],
802                         "page-flags" => ["user", "page-flags"],
803                         "account-type" => ["user", "account-type"],
804                         "prvnets" => ["user", "prvnets"],
805                         "maxreq" => ["user", "maxreq"],
806                         "expire" => ["user", "expire"],
807                         "account_removed" => ["user", "account_removed"],
808                         "account_expired" => ["user", "account_expired"],
809                         "account_expires_on" => ["user", "account_expires_on"],
810                         "expire_notification_sent" => ["user", "expire_notification_sent"],
811                         "def_gid" => ["user", "def_gid"],
812                         "allow_cid" => ["user", "allow_cid"],
813                         "allow_gid" => ["user", "allow_gid"],
814                         "deny_cid" => ["user", "deny_cid"],
815                         "deny_gid" => ["user", "deny_gid"],
816                         "openidserver" => ["user", "openidserver"],
817                         "publish" => ["profile", "publish"],
818                         "net-publish" => ["profile", "net-publish"],
819                         "hide-friends" => ["profile", "hide-friends"],
820                         "prv_keywords" => ["profile", "prv_keywords"],
821                         "pub_keywords" => ["profile", "pub_keywords"],
822                         "address" => ["profile", "address"],
823                         "locality" => ["profile", "locality"],
824                         "region" => ["profile", "region"],
825                         "postal-code" => ["profile", "postal-code"],
826                         "country-name" => ["profile", "country-name"],
827                         "homepage" => ["profile", "homepage"],
828                         "dob" => ["profile", "dob"],
829                 ],
830                 "query" => "FROM `user`
831                         INNER JOIN `contact` ON `contact`.`uid` = `user`.`uid` AND `contact`.`self`
832                         INNER JOIN `profile` ON `profile`.`uid` = `user`.`uid`"
833         ],
834         "account-view" => [
835                 "fields" => [
836                         "id" => ["contact", "id"],
837                         "url" => ["contact", "url"],
838                         "nurl" => ["contact", "nurl"],
839                         "uri-id" => ["contact", "uri-id"],
840                         "guid" => ["item-uri", "guid"],
841                         "addr" => ["contact", "addr"],
842                         "alias" => ["contact", "alias"],
843                         "name" => ["contact", "name"],
844                         "nick" => ["contact", "nick"],
845                         "about" => ["contact", "about"],
846                         "keywords" => ["contact", "keywords"],
847                         "xmpp" => ["contact", "xmpp"],
848                         "matrix" => ["contact", "matrix"],
849                         "avatar" => ["contact", "avatar"],
850                         "photo" => ["contact", "photo"],
851                         "thumb" => ["contact", "thumb"],
852                         "micro" => ["contact", "micro"],
853                         "header" => ["contact", "header"],
854                         "created" => ["contact", "created"],
855                         "updated" => ["contact", "updated"],
856                         "network" => ["contact", "network"],
857                         "protocol" => ["contact", "protocol"],
858                         "location" => ["contact", "location"],
859                         "attag" => ["contact", "attag"],
860                         "pubkey" => ["contact", "pubkey"],
861                         "prvkey" => ["contact", "prvkey"],
862                         "subscribe" => ["contact", "subscribe"],
863                         "last-update" => ["contact", "last-update"],
864                         "success_update" => ["contact", "success_update"],
865                         "failure_update" => ["contact", "failure_update"],
866                         "failed" => ["contact", "failed"],
867                         "last-item" => ["contact", "last-item"],
868                         "last-discovery" => ["contact", "last-discovery"],
869                         "contact-type" => ["contact", "contact-type"],
870                         "manually-approve" => ["contact", "manually-approve"],
871                         "unsearchable" => ["contact", "unsearchable"],
872                         "sensitive" => ["contact", "sensitive"],
873                         "baseurl" => ["contact", "baseurl"],
874                         "gsid" => ["contact", "gsid"],
875                         "info" => ["contact", "info"],
876                         "bdyear" => ["contact", "bdyear"],
877                         "bd" => ["contact", "bd"],
878                         "poco" => ["contact", "poco"],
879                         "name-date" => ["contact", "name-date"],
880                         "uri-date" => ["contact", "uri-date"],
881                         "avatar-date" => ["contact", "avatar-date"],
882                         "term-date" => ["contact", "term-date"],
883                         "global-ignored" => ["contact", "hidden"],
884                         "global-blocked" => ["contact", "blocked"],
885                         "hidden" => ["contact", "hidden"],
886                         "archive" => ["contact", "archive"],
887                         "deleted" => ["contact", "deleted"],
888                         "blocked" => ["contact", "blocked"],
889                         "dfrn-notify" => ["contact", "notify"],
890                         "dfrn-poll" => ["contact", "poll"],
891                         "diaspora-guid" => ["fcontact", "guid"],
892                         "diaspora-batch" => ["fcontact", "batch"],
893                         "diaspora-notify" => ["fcontact", "notify"],
894                         "diaspora-poll" => ["fcontact", "poll"],
895                         "diaspora-alias" => ["fcontact", "alias"],
896                         "ap-uuid" => ["apcontact", "uuid"],
897                         "ap-type" => ["apcontact", "type"],
898                         "ap-following" => ["apcontact", "following"],
899                         "ap-followers" => ["apcontact", "followers"],
900                         "ap-inbox" => ["apcontact", "inbox"],
901                         "ap-outbox" => ["apcontact", "outbox"],
902                         "ap-sharedinbox" => ["apcontact", "sharedinbox"],
903                         "ap-generator" => ["apcontact", "generator"],
904                         "ap-following_count" => ["apcontact", "following_count"],
905                         "ap-followers_count" => ["apcontact", "followers_count"],
906                         "ap-statuses_count" => ["apcontact", "statuses_count"],
907                         "site_name" => ["gserver", "site_name"],
908                         "platform" => ["gserver", "platform"],
909                         "version" => ["gserver", "version"],
910                 ],
911                 "query" => "FROM `contact`
912                         LEFT JOIN `item-uri` ON `item-uri`.`id` = `contact`.`uri-id`
913                         LEFT JOIN `apcontact` ON `apcontact`.`uri-id` = `contact`.`uri-id`
914                         LEFT JOIN `fcontact` ON `fcontact`.`uri-id` = contact.`uri-id`
915                         LEFT JOIN `gserver` ON `gserver`.`id` = contact.`gsid`
916                         WHERE `contact`.`uid` = 0"                      
917         ],
918         "account-user-view" => [
919                 "fields" => [
920                         "id" => ["ucontact", "id"],
921                         "pid" => ["contact", "id"],
922                         "uid" => ["ucontact", "uid"],
923                         "url" => ["contact", "url"],
924                         "nurl" => ["contact", "nurl"],
925                         "uri-id" => ["contact", "uri-id"],
926                         "guid" => ["item-uri", "guid"],
927                         "addr" => ["contact", "addr"],
928                         "alias" => ["contact", "alias"],
929                         "name" => ["contact", "name"],
930                         "nick" => ["contact", "nick"],
931                         "about" => ["contact", "about"],
932                         "keywords" => ["contact", "keywords"],
933                         "xmpp" => ["contact", "xmpp"],
934                         "matrix" => ["contact", "matrix"],
935                         "avatar" => ["contact", "avatar"],
936                         "photo" => ["contact", "photo"],
937                         "thumb" => ["contact", "thumb"],
938                         "micro" => ["contact", "micro"],
939                         "header" => ["contact", "header"],
940                         "created" => ["contact", "created"],
941                         "updated" => ["contact", "updated"],
942                         "self" => ["ucontact", "self"],
943                         "remote_self" => ["ucontact", "remote_self"],
944                         "rel" =>  ["ucontact", "rel"],
945                         "network" => ["contact", "network"],
946                         "protocol" => ["ucontact", "protocol"],
947                         "location" => ["contact", "location"],
948                         "attag" => ["ucontact", "attag"],
949                         "pubkey" => ["contact", "pubkey"],
950                         "prvkey" => ["contact", "prvkey"],
951                         "subscribe" => ["contact", "subscribe"],
952                         "last-update" => ["contact", "last-update"],
953                         "success_update" => ["contact", "success_update"],
954                         "failure_update" => ["contact", "failure_update"],
955                         "failed" => ["contact", "failed"],
956                         "last-item" => ["contact", "last-item"],
957                         "last-discovery" => ["contact", "last-discovery"],
958                         "contact-type" => ["contact", "contact-type"],
959                         "manually-approve" => ["contact", "manually-approve"],
960                         "unsearchable" => ["contact", "unsearchable"],
961                         "sensitive" => ["contact", "sensitive"],
962                         "baseurl" => ["contact", "baseurl"],
963                         "gsid" => ["contact", "gsid"],
964                         "info" => ["ucontact", "info"],
965                         "bdyear" => ["contact", "bdyear"],
966                         "bd" => ["contact", "bd"],
967                         "poco" => ["contact", "poco"],
968                         "name-date" => ["contact", "name-date"],
969                         "uri-date" => ["contact", "uri-date"],
970                         "avatar-date" => ["contact", "avatar-date"],
971                         "term-date" => ["contact", "term-date"],
972                         "global-ignored" => ["contact", "hidden"],
973                         "global-blocked" => ["contact", "blocked"],
974                         "hidden" => ["ucontact", "hidden"],
975                         "archive" => ["ucontact", "archive"],
976                         "pending" => ["ucontact", "pending"],
977                         "deleted" => ["ucontact", "deleted"],
978                         "notify_new_posts" => ["ucontact", "notify_new_posts"],
979                         "fetch_further_information" => ["ucontact", "fetch_further_information"],
980                         "ffi_keyword_denylist" => ["ucontact", "ffi_keyword_denylist"],
981                         "rating" => ["ucontact", "rating"],
982                         "readonly" => ["ucontact", "readonly"],
983                         "blocked" => ["ucontact", "blocked"],
984                         "block_reason" => ["ucontact", "block_reason"],
985                         "subhub" => ["ucontact", "subhub"],
986                         "hub-verify" => ["ucontact", "hub-verify"],
987                         "reason" => ["ucontact", "reason"],
988                         "dfrn-notify" => ["contact", "notify"],
989                         "dfrn-poll" => ["contact", "poll"],
990                         "diaspora-guid" => ["fcontact", "guid"],
991                         "diaspora-batch" => ["fcontact", "batch"],
992                         "diaspora-notify" => ["fcontact", "notify"],
993                         "diaspora-poll" => ["fcontact", "poll"],
994                         "diaspora-alias" => ["fcontact", "alias"],
995                         "ap-uuid" => ["apcontact", "uuid"],
996                         "ap-type" => ["apcontact", "type"],
997                         "ap-following" => ["apcontact", "following"],
998                         "ap-followers" => ["apcontact", "followers"],
999                         "ap-inbox" => ["apcontact", "inbox"],
1000                         "ap-outbox" => ["apcontact", "outbox"],
1001                         "ap-sharedinbox" => ["apcontact", "sharedinbox"],
1002                         "ap-generator" => ["apcontact", "generator"],
1003                         "ap-following_count" => ["apcontact", "following_count"],
1004                         "ap-followers_count" => ["apcontact", "followers_count"],
1005                         "ap-statuses_count" => ["apcontact", "statuses_count"],
1006                         "site_name" => ["gserver", "site_name"],
1007                         "platform" => ["gserver", "platform"],
1008                         "version" => ["gserver", "version"],
1009                 ],
1010                 "query" => "FROM `contact` AS `ucontact`
1011                         INNER JOIN `contact` ON `contact`.`uri-id` = `ucontact`.`uri-id` AND `contact`.`uid` = 0
1012                         LEFT JOIN `item-uri` ON `item-uri`.`id` = `ucontact`.`uri-id`
1013                         LEFT JOIN `apcontact` ON `apcontact`.`uri-id` = `ucontact`.`uri-id`
1014                         LEFT JOIN `fcontact` ON `fcontact`.`uri-id` = `ucontact`.`uri-id` AND `fcontact`.`network` = 'dspr'
1015                         LEFT JOIN `gserver` ON `gserver`.`id` = contact.`gsid`"
1016         ],
1017         "pending-view" => [
1018                 "fields" => [
1019                         "id" => ["register", "id"],
1020                         "hash" => ["register", "hash"],
1021                         "created" => ["register", "created"],
1022                         "uid" => ["register", "uid"],
1023                         "password" => ["register", "password"],
1024                         "language" => ["register", "language"],
1025                         "note" => ["register", "note"],
1026                         "self" => ["contact", "self"],
1027                         "name" => ["contact", "name"],
1028                         "url" => ["contact", "url"],
1029                         "micro" => ["contact", "micro"],
1030                         "email" => ["user", "email"],
1031                         "nick" => ["contact", "nick"],
1032                 ],
1033                 "query" => "FROM `register`
1034                         INNER JOIN `contact` ON `register`.`uid` = `contact`.`uid`
1035                         INNER JOIN `user` ON `register`.`uid` = `user`.`uid`"
1036         ],
1037         "tag-search-view" => [
1038                 "fields" => [
1039                         "uri-id" => ["post-tag", "uri-id"],
1040                         "uid" => ["post-user", "uid"],
1041                         "iid" => ["post-user", "id"],
1042                         "private" => ["post-user", "private"],
1043                         "wall" => ["post-user", "wall"],
1044                         "origin" => ["post-user", "origin"],
1045                         "global" => ["post-user", "global"],
1046                         "gravity" => ["post-user", "gravity"],
1047                         "received" => ["post-user", "received"],
1048                         "network" => ["post-user", "network"],
1049                         "author-id" => ["post-user", "author-id"],
1050                         "name" => ["tag", "name"],
1051                 ],
1052                 "query" => "FROM `post-tag`
1053                         INNER JOIN `tag` ON `tag`.`id` = `post-tag`.`tid`
1054                         STRAIGHT_JOIN `post-user` ON `post-user`.`uri-id` = `post-tag`.`uri-id`
1055                         WHERE `post-tag`.`type` = 1"
1056         ],
1057         "workerqueue-view" => [
1058                 "fields" => [
1059                         "pid" => ["process", "pid"],
1060                         "priority" => ["workerqueue", "priority"],
1061                 ],
1062                 "query" => "FROM `process`
1063                         INNER JOIN `workerqueue` ON `workerqueue`.`pid` = `process`.`pid`
1064                         WHERE NOT `workerqueue`.`done`"
1065         ],
1066         "profile_field-view" => [
1067                 "fields" => [
1068                         "id" => ["profile_field", "id"],
1069                         "uid" => ["profile_field", "uid"],
1070                         "label" => ["profile_field", "label"],
1071                         "value" => ["profile_field", "value"],
1072                         "order" => ["profile_field", "order"],
1073                         "psid"=> ["profile_field", "psid"],
1074                         "allow_cid" => ["permissionset", "allow_cid"],
1075                         "allow_gid" => ["permissionset", "allow_gid"],
1076                         "deny_cid" => ["permissionset", "deny_cid"],
1077                         "deny_gid" => ["permissionset", "deny_gid"],
1078                         "created" => ["profile_field", "created"],
1079                         "edited" => ["profile_field", "edited"],
1080                 ],
1081                 "query" => "FROM `profile_field`
1082                         INNER JOIN `permissionset` ON `permissionset`.`id` = `profile_field`.`psid`"
1083         ],
1084 ];
1085