]> git.mxchange.org Git - friendica.git/blob - src/Module/Admin/Site.php
parameters now are having a default value and are optional
[friendica.git] / src / Module / Admin / Site.php
1 <?php
2
3 namespace Friendica\Module\Admin;
4
5 use Friendica\App;
6 use Friendica\Core\Config;
7 use Friendica\Core\L10n;
8 use Friendica\Core\Renderer;
9 use Friendica\Core\StorageManager;
10 use Friendica\Core\Theme;
11 use Friendica\Core\Worker;
12 use Friendica\Database\DBA;
13 use Friendica\Module\BaseAdminModule;
14 use Friendica\Module\Register;
15 use Friendica\Protocol\PortableContact;
16 use Friendica\Util\BasePath;
17 use Friendica\Util\Strings;
18 use Friendica\Worker\Delivery;
19
20 require_once __DIR__ . '/../../../boot.php';
21
22 class Site extends BaseAdminModule
23 {
24         public static function post(array $parameters = [])
25         {
26                 parent::post($parameters);
27
28                 self::checkFormSecurityTokenRedirectOnError('/admin/site', 'admin_site');
29
30                 $a = self::getApp();
31
32                 if (!empty($_POST['republish_directory'])) {
33                         Worker::add(PRIORITY_LOW, 'Directory');
34                         return;
35                 }
36
37                 if (empty($_POST['page_site'])) {
38                         return;
39                 }
40
41                 // relocate
42                 // @TODO This file could benefit from moving this feature away in a Module\Admin\Relocate class for example
43                 if (!empty($_POST['relocate']) && !empty($_POST['relocate_url']) && $_POST['relocate_url'] != "") {
44                         $new_url = $_POST['relocate_url'];
45                         $new_url = rtrim($new_url, "/");
46
47                         $parsed = @parse_url($new_url);
48                         if (!is_array($parsed) || empty($parsed['host']) || empty($parsed['scheme'])) {
49                                 notice(L10n::t("Can not parse base url. Must have at least <scheme>://<domain>"));
50                                 $a->internalRedirect('admin/site');
51                         }
52
53                         /* steps:
54                          * replace all "baseurl" to "new_url" in config, profile, term, items and contacts
55                          * send relocate for every local user
56                          * */
57
58                         $old_url = $a->getBaseURL(true);
59
60                         // Generate host names for relocation the addresses in the format user@address.tld
61                         $new_host = str_replace("http://", "@", Strings::normaliseLink($new_url));
62                         $old_host = str_replace("http://", "@", Strings::normaliseLink($old_url));
63
64                         function update_table(App $a, $table_name, $fields, $old_url, $new_url)
65                         {
66                                 $dbold = DBA::escape($old_url);
67                                 $dbnew = DBA::escape($new_url);
68
69                                 $upd = [];
70                                 foreach ($fields as $f) {
71                                         $upd[] = "`$f` = REPLACE(`$f`, '$dbold', '$dbnew')";
72                                 }
73
74                                 $upds = implode(", ", $upd);
75
76                                 $r = DBA::e(sprintf("UPDATE %s SET %s;", $table_name, $upds));
77                                 if (!DBA::isResult($r)) {
78                                         notice("Failed updating '$table_name': " . DBA::errorMessage());
79                                         $a->internalRedirect('admin/site');
80                                 }
81                         }
82
83                         // update tables
84                         // update profile links in the format "http://server.tld"
85                         update_table($a, "profile", ['photo', 'thumb'], $old_url, $new_url);
86                         update_table($a, "term", ['url'], $old_url, $new_url);
87                         update_table($a, "contact", ['photo', 'thumb', 'micro', 'url', 'nurl', 'alias', 'request', 'notify', 'poll', 'confirm', 'poco', 'avatar'], $old_url, $new_url);
88                         update_table($a, "gcontact", ['url', 'nurl', 'photo', 'server_url', 'notify', 'alias'], $old_url, $new_url);
89                         update_table($a, "item", ['owner-link', 'author-link', 'body', 'plink', 'tag'], $old_url, $new_url);
90
91                         // update profile addresses in the format "user@server.tld"
92                         update_table($a, "contact", ['addr'], $old_host, $new_host);
93                         update_table($a, "gcontact", ['connect', 'addr'], $old_host, $new_host);
94
95                         // update config
96                         Config::set('system', 'url', $new_url);
97                         $a->setBaseURL($new_url);
98
99                         // send relocate
100                         $usersStmt = DBA::select('user', ['uid'], ['account_removed' => false, 'account_expired' => false]);
101                         while ($user = DBA::fetch($usersStmt)) {
102                                 Worker::add(PRIORITY_HIGH, 'Notifier', Delivery::RELOCATION, $user['uid']);
103                         }
104
105                         info("Relocation started. Could take a while to complete.");
106
107                         $a->internalRedirect('admin/site');
108                 }
109                 // end relocate
110
111                 $sitename         = (!empty($_POST['sitename'])         ? Strings::escapeTags(trim($_POST['sitename']))      : '');
112                 $sender_email     = (!empty($_POST['sender_email'])     ? Strings::escapeTags(trim($_POST['sender_email']))  : '');
113                 $banner           = (!empty($_POST['banner'])           ? trim($_POST['banner'])                             : false);
114                 $shortcut_icon    = (!empty($_POST['shortcut_icon'])    ? Strings::escapeTags(trim($_POST['shortcut_icon'])) : '');
115                 $touch_icon       = (!empty($_POST['touch_icon'])       ? Strings::escapeTags(trim($_POST['touch_icon']))    : '');
116                 $additional_info  = (!empty($_POST['additional_info'])  ? trim($_POST['additional_info'])                    : '');
117                 $language         = (!empty($_POST['language'])         ? Strings::escapeTags(trim($_POST['language']))      : '');
118                 $theme            = (!empty($_POST['theme'])            ? Strings::escapeTags(trim($_POST['theme']))         : '');
119                 $theme_mobile     = (!empty($_POST['theme_mobile'])     ? Strings::escapeTags(trim($_POST['theme_mobile']))  : '');
120                 $maximagesize     = (!empty($_POST['maximagesize'])     ? intval(trim($_POST['maximagesize']))               : 0);
121                 $maximagelength   = (!empty($_POST['maximagelength'])   ? intval(trim($_POST['maximagelength']))             : MAX_IMAGE_LENGTH);
122                 $jpegimagequality = (!empty($_POST['jpegimagequality']) ? intval(trim($_POST['jpegimagequality']))           : JPEG_QUALITY);
123
124                 $register_policy        = (!empty($_POST['register_policy'])         ? intval(trim($_POST['register_policy']))             : 0);
125                 $daily_registrations    = (!empty($_POST['max_daily_registrations']) ? intval(trim($_POST['max_daily_registrations']))     : 0);
126                 $abandon_days           = (!empty($_POST['abandon_days'])            ? intval(trim($_POST['abandon_days']))                : 0);
127
128                 $register_text          = (!empty($_POST['register_text'])           ? strip_tags(trim($_POST['register_text']))           : '');
129
130                 $allowed_sites          = (!empty($_POST['allowed_sites'])           ? Strings::escapeTags(trim($_POST['allowed_sites']))  : '');
131                 $allowed_email          = (!empty($_POST['allowed_email'])           ? Strings::escapeTags(trim($_POST['allowed_email']))  : '');
132                 $forbidden_nicknames    = (!empty($_POST['forbidden_nicknames'])     ? strtolower(Strings::escapeTags(trim($_POST['forbidden_nicknames']))) : '');
133                 $no_oembed_rich_content = !empty($_POST['no_oembed_rich_content']);
134                 $allowed_oembed         = (!empty($_POST['allowed_oembed'])          ? Strings::escapeTags(trim($_POST['allowed_oembed'])) : '');
135                 $block_public           = !empty($_POST['block_public']);
136                 $force_publish          = !empty($_POST['publish_all']);
137                 $global_directory       = (!empty($_POST['directory'])               ? Strings::escapeTags(trim($_POST['directory']))      : '');
138                 $newuser_private        = !empty($_POST['newuser_private']);
139                 $enotify_no_content     = !empty($_POST['enotify_no_content']);
140                 $private_addons         = !empty($_POST['private_addons']);
141                 $disable_embedded       = !empty($_POST['disable_embedded']);
142                 $allow_users_remote_self = !empty($_POST['allow_users_remote_self']);
143                 $explicit_content       = !empty($_POST['explicit_content']);
144
145                 $no_multi_reg           = !empty($_POST['no_multi_reg']);
146                 $no_openid              = !empty($_POST['no_openid']);
147                 $no_regfullname         = !empty($_POST['no_regfullname']);
148                 $community_page_style   = (!empty($_POST['community_page_style']) ? intval(trim($_POST['community_page_style'])) : 0);
149                 $max_author_posts_community_page = (!empty($_POST['max_author_posts_community_page']) ? intval(trim($_POST['max_author_posts_community_page'])) : 0);
150
151                 $verifyssl              = !empty($_POST['verifyssl']);
152                 $proxyuser              = (!empty($_POST['proxyuser'])              ? Strings::escapeTags(trim($_POST['proxyuser'])) : '');
153                 $proxy                  = (!empty($_POST['proxy'])                  ? Strings::escapeTags(trim($_POST['proxy']))     : '');
154                 $timeout                = (!empty($_POST['timeout'])                ? intval(trim($_POST['timeout']))                : 60);
155                 $maxloadavg             = (!empty($_POST['maxloadavg'])             ? intval(trim($_POST['maxloadavg']))             : 20);
156                 $maxloadavg_frontend    = (!empty($_POST['maxloadavg_frontend'])    ? intval(trim($_POST['maxloadavg_frontend']))    : 50);
157                 $min_memory             = (!empty($_POST['min_memory'])             ? intval(trim($_POST['min_memory']))             : 0);
158                 $optimize_max_tablesize = (!empty($_POST['optimize_max_tablesize']) ? intval(trim($_POST['optimize_max_tablesize'])) : 100);
159                 $optimize_fragmentation = (!empty($_POST['optimize_fragmentation']) ? intval(trim($_POST['optimize_fragmentation'])) : 30);
160                 $poco_completion        = (!empty($_POST['poco_completion'])        ? intval(trim($_POST['poco_completion']))        : false);
161                 $poco_requery_days      = (!empty($_POST['poco_requery_days'])      ? intval(trim($_POST['poco_requery_days']))      : 7);
162                 $poco_discovery         = (!empty($_POST['poco_discovery'])         ? intval(trim($_POST['poco_discovery']))         : PortableContact::DISABLED);
163                 $poco_discovery_since   = (!empty($_POST['poco_discovery_since'])   ? intval(trim($_POST['poco_discovery_since']))   : 30);
164                 $poco_local_search      = !empty($_POST['poco_local_search']);
165                 $nodeinfo               = !empty($_POST['nodeinfo']);
166                 $dfrn_only              = !empty($_POST['dfrn_only']);
167                 $ostatus_disabled       = !empty($_POST['ostatus_disabled']);
168                 $diaspora_enabled       = !empty($_POST['diaspora_enabled']);
169                 $ssl_policy             = (!empty($_POST['ssl_policy'])             ? intval($_POST['ssl_policy'])                    : 0);
170                 $force_ssl              = !empty($_POST['force_ssl']);
171                 $hide_help              = !empty($_POST['hide_help']);
172                 $dbclean                = !empty($_POST['dbclean']);
173                 $dbclean_expire_days    = (!empty($_POST['dbclean_expire_days'])    ? intval($_POST['dbclean_expire_days'])           : 0);
174                 $dbclean_unclaimed      = (!empty($_POST['dbclean_unclaimed'])      ? intval($_POST['dbclean_unclaimed'])             : 0);
175                 $dbclean_expire_conv    = (!empty($_POST['dbclean_expire_conv'])    ? intval($_POST['dbclean_expire_conv'])           : 0);
176                 $suppress_tags          = !empty($_POST['suppress_tags']);
177                 $itemcache              = (!empty($_POST['itemcache'])              ? Strings::escapeTags(trim($_POST['itemcache']))  : '');
178                 $itemcache_duration     = (!empty($_POST['itemcache_duration'])     ? intval($_POST['itemcache_duration'])            : 0);
179                 $max_comments           = (!empty($_POST['max_comments'])           ? intval($_POST['max_comments'])                  : 0);
180                 $temppath               = (!empty($_POST['temppath'])               ? Strings::escapeTags(trim($_POST['temppath']))   : '');
181                 $singleuser             = (!empty($_POST['singleuser'])             ? Strings::escapeTags(trim($_POST['singleuser'])) : '');
182                 $proxy_disabled         = !empty($_POST['proxy_disabled']);
183                 $only_tag_search        = !empty($_POST['only_tag_search']);
184                 $rino                   = (!empty($_POST['rino'])                   ? intval($_POST['rino'])                          : 0);
185                 $check_new_version_url  = (!empty($_POST['check_new_version_url'])  ? Strings::escapeTags(trim($_POST['check_new_version_url'])) : 'none');
186
187                 $worker_queues    = (!empty($_POST['worker_queues'])                ? intval($_POST['worker_queues'])                 : 10);
188                 $worker_dont_fork = !empty($_POST['worker_dont_fork']);
189                 $worker_fastlane  = !empty($_POST['worker_fastlane']);
190                 $worker_frontend  = !empty($_POST['worker_frontend']);
191
192                 $relay_directly    = !empty($_POST['relay_directly']);
193                 $relay_server      = (!empty($_POST['relay_server'])      ? Strings::escapeTags(trim($_POST['relay_server']))       : '');
194                 $relay_subscribe   = !empty($_POST['relay_subscribe']);
195                 $relay_scope       = (!empty($_POST['relay_scope'])       ? Strings::escapeTags(trim($_POST['relay_scope']))        : '');
196                 $relay_server_tags = (!empty($_POST['relay_server_tags']) ? Strings::escapeTags(trim($_POST['relay_server_tags']))  : '');
197                 $relay_user_tags   = !empty($_POST['relay_user_tags']);
198                 $active_panel      = (!empty($_POST['active_panel'])      ? "#" . Strings::escapeTags(trim($_POST['active_panel'])) : '');
199
200                 /**
201                  * @var $storagebackend \Friendica\Model\Storage\IStorage
202                  */
203                 $storagebackend    = Strings::escapeTags(trim($_POST['storagebackend'] ?? ''));
204
205                 // save storage backend form
206                 if (!is_null($storagebackend) && $storagebackend != "") {
207                         if (StorageManager::setBackend($storagebackend)) {
208                                 $storage_opts = $storagebackend::getOptions();
209                                 $storage_form_prefix = preg_replace('|[^a-zA-Z0-9]|', '', $storagebackend);
210                                 $storage_opts_data = [];
211                                 foreach ($storage_opts as $name => $info) {
212                                         $fieldname = $storage_form_prefix . '_' . $name;
213                                         switch ($info[0]) { // type
214                                                 case 'checkbox':
215                                                 case 'yesno':
216                                                         $value = !empty($_POST[$fieldname]);
217                                                         break;
218                                                 default:
219                                                         $value = $_POST[$fieldname] ?? '';
220                                         }
221                                         $storage_opts_data[$name] = $value;
222                                 }
223                                 unset($name);
224                                 unset($info);
225
226                                 $storage_form_errors = $storagebackend::saveOptions($storage_opts_data);
227                                 if (count($storage_form_errors)) {
228                                         foreach ($storage_form_errors as $name => $err) {
229                                                 notice('Storage backend, ' . $storage_opts[$name][1] . ': ' . $err);
230                                         }
231                                         $a->internalRedirect('admin/site' . $active_panel);
232                                 }
233                         } else {
234                                 info(L10n::t('Invalid storage backend setting value.'));
235                         }
236                 }
237
238                 // Has the directory url changed? If yes, then resubmit the existing profiles there
239                 if ($global_directory != Config::get('system', 'directory') && ($global_directory != '')) {
240                         Config::set('system', 'directory', $global_directory);
241                         Worker::add(PRIORITY_LOW, 'Directory');
242                 }
243
244                 if ($a->getURLPath() != "") {
245                         $diaspora_enabled = false;
246                 }
247                 if ($ssl_policy != intval(Config::get('system', 'ssl_policy'))) {
248                         if ($ssl_policy == App\BaseURL::SSL_POLICY_FULL) {
249                                 DBA::e("UPDATE `contact` SET
250                                 `url`     = REPLACE(`url`    , 'http:' , 'https:'),
251                                 `photo`   = REPLACE(`photo`  , 'http:' , 'https:'),
252                                 `thumb`   = REPLACE(`thumb`  , 'http:' , 'https:'),
253                                 `micro`   = REPLACE(`micro`  , 'http:' , 'https:'),
254                                 `request` = REPLACE(`request`, 'http:' , 'https:'),
255                                 `notify`  = REPLACE(`notify` , 'http:' , 'https:'),
256                                 `poll`    = REPLACE(`poll`   , 'http:' , 'https:'),
257                                 `confirm` = REPLACE(`confirm`, 'http:' , 'https:'),
258                                 `poco`    = REPLACE(`poco`   , 'http:' , 'https:')
259                                 WHERE `self` = 1"
260                                 );
261                                 DBA::e("UPDATE `profile` SET
262                                 `photo`   = REPLACE(`photo`  , 'http:' , 'https:'),
263                                 `thumb`   = REPLACE(`thumb`  , 'http:' , 'https:')
264                                 WHERE 1 "
265                                 );
266                         } elseif ($ssl_policy == App\BaseURL::SSL_POLICY_SELFSIGN) {
267                                 DBA::e("UPDATE `contact` SET
268                                 `url`     = REPLACE(`url`    , 'https:' , 'http:'),
269                                 `photo`   = REPLACE(`photo`  , 'https:' , 'http:'),
270                                 `thumb`   = REPLACE(`thumb`  , 'https:' , 'http:'),
271                                 `micro`   = REPLACE(`micro`  , 'https:' , 'http:'),
272                                 `request` = REPLACE(`request`, 'https:' , 'http:'),
273                                 `notify`  = REPLACE(`notify` , 'https:' , 'http:'),
274                                 `poll`    = REPLACE(`poll`   , 'https:' , 'http:'),
275                                 `confirm` = REPLACE(`confirm`, 'https:' , 'http:'),
276                                 `poco`    = REPLACE(`poco`   , 'https:' , 'http:')
277                                 WHERE `self` = 1"
278                                 );
279                                 DBA::e("UPDATE `profile` SET
280                                 `photo`   = REPLACE(`photo`  , 'https:' , 'http:'),
281                                 `thumb`   = REPLACE(`thumb`  , 'https:' , 'http:')
282                                 WHERE 1 "
283                                 );
284                         }
285                 }
286                 Config::set('system', 'ssl_policy'            , $ssl_policy);
287                 Config::set('system', 'maxloadavg'            , $maxloadavg);
288                 Config::set('system', 'maxloadavg_frontend'   , $maxloadavg_frontend);
289                 Config::set('system', 'min_memory'            , $min_memory);
290                 Config::set('system', 'optimize_max_tablesize', $optimize_max_tablesize);
291                 Config::set('system', 'optimize_fragmentation', $optimize_fragmentation);
292                 Config::set('system', 'poco_completion'       , $poco_completion);
293                 Config::set('system', 'poco_requery_days'     , $poco_requery_days);
294                 Config::set('system', 'poco_discovery'        , $poco_discovery);
295                 Config::set('system', 'poco_discovery_since'  , $poco_discovery_since);
296                 Config::set('system', 'poco_local_search'     , $poco_local_search);
297                 Config::set('system', 'nodeinfo'              , $nodeinfo);
298                 Config::set('config', 'sitename'              , $sitename);
299                 Config::set('config', 'sender_email'          , $sender_email);
300                 Config::set('system', 'suppress_tags'         , $suppress_tags);
301                 Config::set('system', 'shortcut_icon'         , $shortcut_icon);
302                 Config::set('system', 'touch_icon'            , $touch_icon);
303
304                 if ($banner == "") {
305                         Config::delete('system', 'banner');
306                 } else {
307                         Config::set('system', 'banner', $banner);
308                 }
309
310                 if (empty($additional_info)) {
311                         Config::delete('config', 'info');
312                 } else {
313                         Config::set('config', 'info', $additional_info);
314                 }
315                 Config::set('system', 'language', $language);
316                 Config::set('system', 'theme', $theme);
317                 Theme::install($theme);
318
319                 if ($theme_mobile == '---') {
320                         Config::delete('system', 'mobile-theme');
321                 } else {
322                         Config::set('system', 'mobile-theme', $theme_mobile);
323                 }
324                 if ($singleuser == '---') {
325                         Config::delete('system', 'singleuser');
326                 } else {
327                         Config::set('system', 'singleuser', $singleuser);
328                 }
329                 Config::set('system', 'maximagesize'           , $maximagesize);
330                 Config::set('system', 'max_image_length'       , $maximagelength);
331                 Config::set('system', 'jpeg_quality'           , $jpegimagequality);
332
333                 Config::set('config', 'register_policy'        , $register_policy);
334                 Config::set('system', 'max_daily_registrations', $daily_registrations);
335                 Config::set('system', 'account_abandon_days'   , $abandon_days);
336                 Config::set('config', 'register_text'          , $register_text);
337                 Config::set('system', 'allowed_sites'          , $allowed_sites);
338                 Config::set('system', 'allowed_email'          , $allowed_email);
339                 Config::set('system', 'forbidden_nicknames'    , $forbidden_nicknames);
340                 Config::set('system', 'no_oembed_rich_content' , $no_oembed_rich_content);
341                 Config::set('system', 'allowed_oembed'         , $allowed_oembed);
342                 Config::set('system', 'block_public'           , $block_public);
343                 Config::set('system', 'publish_all'            , $force_publish);
344                 Config::set('system', 'newuser_private'        , $newuser_private);
345                 Config::set('system', 'enotify_no_content'     , $enotify_no_content);
346                 Config::set('system', 'disable_embedded'       , $disable_embedded);
347                 Config::set('system', 'allow_users_remote_self', $allow_users_remote_self);
348                 Config::set('system', 'explicit_content'       , $explicit_content);
349                 Config::set('system', 'check_new_version_url'  , $check_new_version_url);
350
351                 Config::set('system', 'block_extended_register', $no_multi_reg);
352                 Config::set('system', 'no_openid'              , $no_openid);
353                 Config::set('system', 'no_regfullname'         , $no_regfullname);
354                 Config::set('system', 'community_page_style'   , $community_page_style);
355                 Config::set('system', 'max_author_posts_community_page', $max_author_posts_community_page);
356                 Config::set('system', 'verifyssl'              , $verifyssl);
357                 Config::set('system', 'proxyuser'              , $proxyuser);
358                 Config::set('system', 'proxy'                  , $proxy);
359                 Config::set('system', 'curl_timeout'           , $timeout);
360                 Config::set('system', 'dfrn_only'              , $dfrn_only);
361                 Config::set('system', 'ostatus_disabled'       , $ostatus_disabled);
362                 Config::set('system', 'diaspora_enabled'       , $diaspora_enabled);
363
364                 Config::set('config', 'private_addons'         , $private_addons);
365
366                 Config::set('system', 'force_ssl'              , $force_ssl);
367                 Config::set('system', 'hide_help'              , $hide_help);
368
369                 Config::set('system', 'dbclean'                , $dbclean);
370                 Config::set('system', 'dbclean-expire-days'    , $dbclean_expire_days);
371                 Config::set('system', 'dbclean_expire_conversation', $dbclean_expire_conv);
372
373                 if ($dbclean_unclaimed == 0) {
374                         $dbclean_unclaimed = $dbclean_expire_days;
375                 }
376
377                 Config::set('system', 'dbclean-expire-unclaimed', $dbclean_unclaimed);
378
379                 if ($itemcache != '') {
380                         $itemcache = BasePath::getRealPath($itemcache);
381                 }
382
383                 Config::set('system', 'itemcache', $itemcache);
384                 Config::set('system', 'itemcache_duration', $itemcache_duration);
385                 Config::set('system', 'max_comments', $max_comments);
386
387                 if ($temppath != '') {
388                         $temppath = BasePath::getRealPath($temppath);
389                 }
390
391                 Config::set('system', 'temppath', $temppath);
392
393                 Config::set('system', 'proxy_disabled'   , $proxy_disabled);
394                 Config::set('system', 'only_tag_search'  , $only_tag_search);
395
396                 Config::set('system', 'worker_queues'    , $worker_queues);
397                 Config::set('system', 'worker_dont_fork' , $worker_dont_fork);
398                 Config::set('system', 'worker_fastlane'  , $worker_fastlane);
399                 Config::set('system', 'frontend_worker'  , $worker_frontend);
400
401                 Config::set('system', 'relay_directly'   , $relay_directly);
402                 Config::set('system', 'relay_server'     , $relay_server);
403                 Config::set('system', 'relay_subscribe'  , $relay_subscribe);
404                 Config::set('system', 'relay_scope'      , $relay_scope);
405                 Config::set('system', 'relay_server_tags', $relay_server_tags);
406                 Config::set('system', 'relay_user_tags'  , $relay_user_tags);
407
408                 Config::set('system', 'rino_encrypt'     , $rino);
409
410                 info(L10n::t('Site settings updated.') . EOL);
411
412                 $a->internalRedirect('admin/site' . $active_panel);
413         }
414
415         public static function content(array $parameters = [])
416         {
417                 parent::content($parameters);
418
419                 $a = self::getApp();
420
421                 /* Installed langs */
422                 $lang_choices = L10n::getAvailableLanguages();
423
424                 if (strlen(Config::get('system', 'directory_submit_url')) &&
425                         !strlen(Config::get('system', 'directory'))) {
426                         Config::set('system', 'directory', dirname(Config::get('system', 'directory_submit_url')));
427                         Config::delete('system', 'directory_submit_url');
428                 }
429
430                 /* Installed themes */
431                 $theme_choices = [];
432                 $theme_choices_mobile = [];
433                 $theme_choices_mobile['---'] = L10n::t('No special theme for mobile devices');
434                 $files = glob('view/theme/*');
435                 if (is_array($files)) {
436                         $allowed_theme_list = Config::get('system', 'allowed_themes');
437
438                         foreach ($files as $file) {
439                                 if (intval(file_exists($file . '/unsupported'))) {
440                                         continue;
441                                 }
442
443                                 $f = basename($file);
444
445                                 // Only show allowed themes here
446                                 if (($allowed_theme_list != '') && !strstr($allowed_theme_list, $f)) {
447                                         continue;
448                                 }
449
450                                 $theme_name = ((file_exists($file . '/experimental')) ? L10n::t('%s - (Experimental)', $f) : $f);
451
452                                 if (file_exists($file . '/mobile')) {
453                                         $theme_choices_mobile[$f] = $theme_name;
454                                 } else {
455                                         $theme_choices[$f] = $theme_name;
456                                 }
457                         }
458                 }
459
460                 /* Community page style */
461                 $community_page_style_choices = [
462                         CP_NO_INTERNAL_COMMUNITY => L10n::t('No community page for local users'),
463                         CP_NO_COMMUNITY_PAGE => L10n::t('No community page'),
464                         CP_USERS_ON_SERVER => L10n::t('Public postings from users of this site'),
465                         CP_GLOBAL_COMMUNITY => L10n::t('Public postings from the federated network'),
466                         CP_USERS_AND_GLOBAL => L10n::t('Public postings from local users and the federated network')
467                 ];
468
469                 $poco_discovery_choices = [
470                         PortableContact::DISABLED => L10n::t('Disabled'),
471                         PortableContact::USERS => L10n::t('Users'),
472                         PortableContact::USERS_GCONTACTS => L10n::t('Users, Global Contacts'),
473                         PortableContact::USERS_GCONTACTS_FALLBACK => L10n::t('Users, Global Contacts/fallback'),
474                 ];
475
476                 $poco_discovery_since_choices = [
477                         '30' => L10n::t('One month'),
478                         '91' => L10n::t('Three months'),
479                         '182' => L10n::t('Half a year'),
480                         '365' => L10n::t('One year'),
481                 ];
482
483                 /* get user names to make the install a personal install of X */
484                 // @TODO Move to Model\User::getNames()
485                 $user_names = [];
486                 $user_names['---'] = L10n::t('Multi user instance');
487
488                 $usersStmt = DBA::select('user', ['username', 'nickname'], ['account_removed' => 0, 'account_expired' => 0]);
489                 foreach (DBA::toArray($usersStmt) as $user) {
490                         $user_names[$user['nickname']] = $user['username'];
491                 }
492
493                 /* Banner */
494                 $banner = Config::get('system', 'banner');
495
496                 if ($banner == false) {
497                         $banner = '<a href="https://friendi.ca"><img id="logo-img" src="images/friendica-32.png" alt="logo" /></a><span id="logo-text"><a href="https://friendi.ca">Friendica</a></span>';
498                 }
499
500                 $additional_info = Config::get('config', 'info');
501
502                 // Automatically create temporary paths
503                 get_temppath();
504                 get_itemcachepath();
505
506                 /* Register policy */
507                 $register_choices = [
508                         Register::CLOSED => L10n::t('Closed'),
509                         Register::APPROVE => L10n::t('Requires approval'),
510                         Register::OPEN => L10n::t('Open')
511                 ];
512
513                 $ssl_choices = [
514                         App\BaseURL::SSL_POLICY_NONE => L10n::t('No SSL policy, links will track page SSL state'),
515                         App\BaseURL::SSL_POLICY_FULL => L10n::t('Force all links to use SSL'),
516                         App\BaseURL::SSL_POLICY_SELFSIGN => L10n::t('Self-signed certificate, use SSL for local links only (discouraged)')
517                 ];
518
519                 $check_git_version_choices = [
520                         'none' => L10n::t('Don\'t check'),
521                         'master' => L10n::t('check the stable version'),
522                         'develop' => L10n::t('check the development version')
523                 ];
524
525                 $diaspora_able = ($a->getURLPath() == '');
526
527                 $optimize_max_tablesize = Config::get('system', 'optimize_max_tablesize', -1);
528
529                 if ($optimize_max_tablesize <= 0) {
530                         $optimize_max_tablesize = -1;
531                 }
532
533                 $storage_backends = StorageManager::listBackends();
534                 /** @var $current_storage_backend \Friendica\Model\Storage\IStorage */
535                 $current_storage_backend = StorageManager::getBackend();
536
537                 $available_storage_backends = [];
538
539                 // show legacy option only if it is the current backend:
540                 // once changed can't be selected anymore
541                 if ($current_storage_backend == '') {
542                         $available_storage_backends[''] = L10n::t('Database (legacy)');
543                 }
544
545                 foreach ($storage_backends as $name => $class) {
546                         $available_storage_backends[$class] = $name;
547                 }
548                 unset($storage_backends);
549
550                 // build storage config form,
551                 $storage_form_prefix = preg_replace('|[^a-zA-Z0-9]|' ,'', $current_storage_backend);
552
553                 $storage_form = [];
554                 if (!is_null($current_storage_backend) && $current_storage_backend != '') {
555                         foreach ($current_storage_backend::getOptions() as $name => $info) {
556                                 $type = $info[0];
557                                 $info[0] = $storage_form_prefix . '_' . $name;
558                                 $info['type'] = $type;
559                                 $info['field'] = 'field_' . $type . '.tpl';
560                                 $storage_form[$name] = $info;
561                         }
562                 }
563
564                 $t = Renderer::getMarkupTemplate('admin/site.tpl');
565                 return Renderer::replaceMacros($t, [
566                         '$title'             => L10n::t('Administration'),
567                         '$page'              => L10n::t('Site'),
568                         '$submit'            => L10n::t('Save Settings'),
569                         '$republish'         => L10n::t('Republish users to directory'),
570                         '$registration'      => L10n::t('Registration'),
571                         '$upload'            => L10n::t('File upload'),
572                         '$corporate'         => L10n::t('Policies'),
573                         '$advanced'          => L10n::t('Advanced'),
574                         '$portable_contacts' => L10n::t('Auto Discovered Contact Directory'),
575                         '$performance'       => L10n::t('Performance'),
576                         '$worker_title'      => L10n::t('Worker'),
577                         '$relay_title'       => L10n::t('Message Relay'),
578                         '$relocate'          => L10n::t('Relocate Instance'),
579                         '$relocate_warning'  => L10n::t('Warning! Advanced function. Could make this server unreachable.'),
580                         '$baseurl'           => $a->getBaseURL(true),
581
582                         // name, label, value, help string, extra data...
583                         '$sitename'         => ['sitename', L10n::t('Site name'), Config::get('config', 'sitename'), ''],
584                         '$sender_email'     => ['sender_email', L10n::t('Sender Email'), Config::get('config', 'sender_email'), L10n::t('The email address your server shall use to send notification emails from.'), '', '', 'email'],
585                         '$banner'           => ['banner', L10n::t('Banner/Logo'), $banner, ''],
586                         '$shortcut_icon'    => ['shortcut_icon', L10n::t('Shortcut icon'), Config::get('system', 'shortcut_icon'), L10n::t('Link to an icon that will be used for browsers.')],
587                         '$touch_icon'       => ['touch_icon', L10n::t('Touch icon'), Config::get('system', 'touch_icon'), L10n::t('Link to an icon that will be used for tablets and mobiles.')],
588                         '$additional_info'  => ['additional_info', L10n::t('Additional Info'), $additional_info, L10n::t('For public servers: you can add additional information here that will be listed at %s/servers.', get_server())],
589                         '$language'         => ['language', L10n::t('System language'), Config::get('system', 'language'), '', $lang_choices],
590                         '$theme'            => ['theme', L10n::t('System theme'), Config::get('system', 'theme'), L10n::t('Default system theme - may be over-ridden by user profiles - <a href="/admin/themes" id="cnftheme">Change default theme settings</a>'), $theme_choices],
591                         '$theme_mobile'     => ['theme_mobile', L10n::t('Mobile system theme'), Config::get('system', 'mobile-theme', '---'), L10n::t('Theme for mobile devices'), $theme_choices_mobile],
592                         '$ssl_policy'       => ['ssl_policy', L10n::t('SSL link policy'), (string)intval(Config::get('system', 'ssl_policy')), L10n::t('Determines whether generated links should be forced to use SSL'), $ssl_choices],
593                         '$force_ssl'        => ['force_ssl', L10n::t('Force SSL'), Config::get('system', 'force_ssl'), L10n::t('Force all Non-SSL requests to SSL - Attention: on some systems it could lead to endless loops.')],
594                         '$hide_help'        => ['hide_help', L10n::t('Hide help entry from navigation menu'), Config::get('system', 'hide_help'), L10n::t('Hides the menu entry for the Help pages from the navigation menu. You can still access it calling /help directly.')],
595                         '$singleuser'       => ['singleuser', L10n::t('Single user instance'), Config::get('system', 'singleuser', '---'), L10n::t('Make this instance multi-user or single-user for the named user'), $user_names],
596
597                         '$storagebackend'   => ['storagebackend', L10n::t('File storage backend'), $current_storage_backend, L10n::t('The backend used to store uploaded data. If you change the storage backend, you can manually move the existing files. If you do not do so, the files uploaded before the change will still be available at the old backend. Please see <a href="/help/Settings#1_2_3_1">the settings documentation</a> for more information about the choices and the moving procedure.'), $available_storage_backends],
598                         '$storageform'      => $storage_form,
599                         '$maximagesize'     => ['maximagesize', L10n::t('Maximum image size'), Config::get('system', 'maximagesize'), L10n::t('Maximum size in bytes of uploaded images. Default is 0, which means no limits.')],
600                         '$maximagelength'   => ['maximagelength', L10n::t('Maximum image length'), Config::get('system', 'max_image_length'), L10n::t('Maximum length in pixels of the longest side of uploaded images. Default is -1, which means no limits.')],
601                         '$jpegimagequality' => ['jpegimagequality', L10n::t('JPEG image quality'), Config::get('system', 'jpeg_quality'), L10n::t('Uploaded JPEGS will be saved at this quality setting [0-100]. Default is 100, which is full quality.')],
602
603                         '$register_policy'        => ['register_policy', L10n::t('Register policy'), Config::get('config', 'register_policy'), '', $register_choices],
604                         '$daily_registrations'    => ['max_daily_registrations', L10n::t('Maximum Daily Registrations'), Config::get('system', 'max_daily_registrations'), L10n::t('If registration is permitted above, this sets the maximum number of new user registrations to accept per day.  If register is set to closed, this setting has no effect.')],
605                         '$register_text'          => ['register_text', L10n::t('Register text'), Config::get('config', 'register_text'), L10n::t('Will be displayed prominently on the registration page. You can use BBCode here.')],
606                         '$forbidden_nicknames'    => ['forbidden_nicknames', L10n::t('Forbidden Nicknames'), Config::get('system', 'forbidden_nicknames'), L10n::t('Comma separated list of nicknames that are forbidden from registration. Preset is a list of role names according RFC 2142.')],
607                         '$abandon_days'           => ['abandon_days', L10n::t('Accounts abandoned after x days'), Config::get('system', 'account_abandon_days'), L10n::t('Will not waste system resources polling external sites for abandonded accounts. Enter 0 for no time limit.')],
608                         '$allowed_sites'          => ['allowed_sites', L10n::t('Allowed friend domains'), Config::get('system', 'allowed_sites'), L10n::t('Comma separated list of domains which are allowed to establish friendships with this site. Wildcards are accepted. Empty to allow any domains')],
609                         '$allowed_email'          => ['allowed_email', L10n::t('Allowed email domains'), Config::get('system', 'allowed_email'), L10n::t('Comma separated list of domains which are allowed in email addresses for registrations to this site. Wildcards are accepted. Empty to allow any domains')],
610                         '$no_oembed_rich_content' => ['no_oembed_rich_content', L10n::t('No OEmbed rich content'), Config::get('system', 'no_oembed_rich_content'), L10n::t('Don\'t show the rich content (e.g. embedded PDF), except from the domains listed below.')],
611                         '$allowed_oembed'         => ['allowed_oembed', L10n::t('Allowed OEmbed domains'), Config::get('system', 'allowed_oembed'), L10n::t('Comma separated list of domains which oembed content is allowed to be displayed. Wildcards are accepted.')],
612                         '$block_public'           => ['block_public', L10n::t('Block public'), Config::get('system', 'block_public'), L10n::t('Check to block public access to all otherwise public personal pages on this site unless you are currently logged in.')],
613                         '$force_publish'          => ['publish_all', L10n::t('Force publish'), Config::get('system', 'publish_all'), L10n::t('Check to force all profiles on this site to be listed in the site directory.') . '<strong>' . L10n::t('Enabling this may violate privacy laws like the GDPR') . '</strong>'],
614                         '$global_directory'       => ['directory', L10n::t('Global directory URL'), Config::get('system', 'directory', 'https://dir.friendica.social'), L10n::t('URL to the global directory. If this is not set, the global directory is completely unavailable to the application.')],
615                         '$newuser_private'        => ['newuser_private', L10n::t('Private posts by default for new users'), Config::get('system', 'newuser_private'), L10n::t('Set default post permissions for all new members to the default privacy group rather than public.')],
616                         '$enotify_no_content'     => ['enotify_no_content', L10n::t('Don\'t include post content in email notifications'), Config::get('system', 'enotify_no_content'), L10n::t('Don\'t include the content of a post/comment/private message/etc. in the email notifications that are sent out from this site, as a privacy measure.')],
617                         '$private_addons'         => ['private_addons', L10n::t('Disallow public access to addons listed in the apps menu.'), Config::get('config', 'private_addons'), L10n::t('Checking this box will restrict addons listed in the apps menu to members only.')],
618                         '$disable_embedded'       => ['disable_embedded', L10n::t('Don\'t embed private images in posts'), Config::get('system', 'disable_embedded'), L10n::t('Don\'t replace locally-hosted private photos in posts with an embedded copy of the image. This means that contacts who receive posts containing private photos will have to authenticate and load each image, which may take a while.')],
619                         '$explicit_content'       => ['explicit_content', L10n::t('Explicit Content'), Config::get('system', 'explicit_content', false), L10n::t('Set this to announce that your node is used mostly for explicit content that might not be suited for minors. This information will be published in the node information and might be used, e.g. by the global directory, to filter your node from listings of nodes to join. Additionally a note about this will be shown at the user registration page.')],
620                         '$allow_users_remote_self'=> ['allow_users_remote_self', L10n::t('Allow Users to set remote_self'), Config::get('system', 'allow_users_remote_self'), L10n::t('With checking this, every user is allowed to mark every contact as a remote_self in the repair contact dialog. Setting this flag on a contact causes mirroring every posting of that contact in the users stream.')],
621                         '$no_multi_reg'           => ['no_multi_reg', L10n::t('Block multiple registrations'), Config::get('system', 'block_extended_register'), L10n::t('Disallow users to register additional accounts for use as pages.')],
622                         '$no_openid'              => ['no_openid', L10n::t('Disable OpenID'), Config::get('system', 'no_openid'), L10n::t('Disable OpenID support for registration and logins.')],
623                         '$no_regfullname'         => ['no_regfullname', L10n::t('No Fullname check'), Config::get('system', 'no_regfullname'), L10n::t('Allow users to register without a space between the first name and the last name in their full name.')],
624                         '$community_page_style'   => ['community_page_style', L10n::t('Community pages for visitors'), Config::get('system', 'community_page_style'), L10n::t('Which community pages should be available for visitors. Local users always see both pages.'), $community_page_style_choices],
625                         '$max_author_posts_community_page' => ['max_author_posts_community_page', L10n::t('Posts per user on community page'), Config::get('system', 'max_author_posts_community_page'), L10n::t('The maximum number of posts per user on the community page. (Not valid for "Global Community")')],
626                         '$ostatus_disabled'       => ['ostatus_disabled', L10n::t('Disable OStatus support'), Config::get('system', 'ostatus_disabled'), L10n::t('Disable built-in OStatus (StatusNet, GNU Social etc.) compatibility. All communications in OStatus are public, so privacy warnings will be occasionally displayed.')],
627                         '$ostatus_not_able'       => L10n::t('OStatus support can only be enabled if threading is enabled.'),
628                         '$diaspora_able'          => $diaspora_able,
629                         '$diaspora_not_able'      => L10n::t('Diaspora support can\'t be enabled because Friendica was installed into a sub directory.'),
630                         '$diaspora_enabled'       => ['diaspora_enabled', L10n::t('Enable Diaspora support'), Config::get('system', 'diaspora_enabled', $diaspora_able), L10n::t('Provide built-in Diaspora network compatibility.')],
631                         '$dfrn_only'              => ['dfrn_only', L10n::t('Only allow Friendica contacts'), Config::get('system', 'dfrn_only'), L10n::t('All contacts must use Friendica protocols. All other built-in communication protocols disabled.')],
632                         '$verifyssl'              => ['verifyssl', L10n::t('Verify SSL'), Config::get('system', 'verifyssl'), L10n::t('If you wish, you can turn on strict certificate checking. This will mean you cannot connect (at all) to self-signed SSL sites.')],
633                         '$proxyuser'              => ['proxyuser', L10n::t('Proxy user'), Config::get('system', 'proxyuser'), ''],
634                         '$proxy'                  => ['proxy', L10n::t('Proxy URL'), Config::get('system', 'proxy'), ''],
635                         '$timeout'                => ['timeout', L10n::t('Network timeout'), Config::get('system', 'curl_timeout', 60), L10n::t('Value is in seconds. Set to 0 for unlimited (not recommended).')],
636                         '$maxloadavg'             => ['maxloadavg', L10n::t('Maximum Load Average'), Config::get('system', 'maxloadavg', 20), L10n::t('Maximum system load before delivery and poll processes are deferred - default %d.', 20)],
637                         '$maxloadavg_frontend'    => ['maxloadavg_frontend', L10n::t('Maximum Load Average (Frontend)'), Config::get('system', 'maxloadavg_frontend', 50), L10n::t('Maximum system load before the frontend quits service - default 50.')],
638                         '$min_memory'             => ['min_memory', L10n::t('Minimal Memory'), Config::get('system', 'min_memory', 0), L10n::t('Minimal free memory in MB for the worker. Needs access to /proc/meminfo - default 0 (deactivated).')],
639                         '$optimize_max_tablesize' => ['optimize_max_tablesize', L10n::t('Maximum table size for optimization'), $optimize_max_tablesize, L10n::t('Maximum table size (in MB) for the automatic optimization. Enter -1 to disable it.')],
640                         '$optimize_fragmentation' => ['optimize_fragmentation', L10n::t('Minimum level of fragmentation'), Config::get('system', 'optimize_fragmentation', 30), L10n::t('Minimum fragmenation level to start the automatic optimization - default value is 30%.')],
641
642                         '$poco_completion'        => ['poco_completion', L10n::t('Periodical check of global contacts'), Config::get('system', 'poco_completion'), L10n::t('If enabled, the global contacts are checked periodically for missing or outdated data and the vitality of the contacts and servers.')],
643                         '$poco_requery_days'      => ['poco_requery_days', L10n::t('Days between requery'), Config::get('system', 'poco_requery_days'), L10n::t('Number of days after which a server is requeried for his contacts.')],
644                         '$poco_discovery'         => ['poco_discovery', L10n::t('Discover contacts from other servers'), (string)intval(Config::get('system', 'poco_discovery')), L10n::t('Periodically query other servers for contacts. You can choose between "Users": the users on the remote system, "Global Contacts": active contacts that are known on the system. The fallback is meant for Redmatrix servers and older friendica servers, where global contacts weren\'t available. The fallback increases the server load, so the recommended setting is "Users, Global Contacts".'), $poco_discovery_choices],
645                         '$poco_discovery_since'   => ['poco_discovery_since', L10n::t('Timeframe for fetching global contacts'), (string)intval(Config::get('system', 'poco_discovery_since')), L10n::t('When the discovery is activated, this value defines the timeframe for the activity of the global contacts that are fetched from other servers.'), $poco_discovery_since_choices],
646                         '$poco_local_search'      => ['poco_local_search', L10n::t('Search the local directory'), Config::get('system', 'poco_local_search'), L10n::t('Search the local directory instead of the global directory. When searching locally, every search will be executed on the global directory in the background. This improves the search results when the search is repeated.')],
647
648                         '$nodeinfo'               => ['nodeinfo', L10n::t('Publish server information'), Config::get('system', 'nodeinfo'), L10n::t('If enabled, general server and usage data will be published. The data contains the name and version of the server, number of users with public profiles, number of posts and the activated protocols and connectors. See <a href="http://the-federation.info/">the-federation.info</a> for details.')],
649
650                         '$check_new_version_url'  => ['check_new_version_url', L10n::t('Check upstream version'), Config::get('system', 'check_new_version_url'), L10n::t('Enables checking for new Friendica versions at github. If there is a new version, you will be informed in the admin panel overview.'), $check_git_version_choices],
651                         '$suppress_tags'          => ['suppress_tags', L10n::t('Suppress Tags'), Config::get('system', 'suppress_tags'), L10n::t('Suppress showing a list of hashtags at the end of the posting.')],
652                         '$dbclean'                => ['dbclean', L10n::t('Clean database'), Config::get('system', 'dbclean', false), L10n::t('Remove old remote items, orphaned database records and old content from some other helper tables.')],
653                         '$dbclean_expire_days'    => ['dbclean_expire_days', L10n::t('Lifespan of remote items'), Config::get('system', 'dbclean-expire-days', 0), L10n::t('When the database cleanup is enabled, this defines the days after which remote items will be deleted. Own items, and marked or filed items are always kept. 0 disables this behaviour.')],
654                         '$dbclean_unclaimed'      => ['dbclean_unclaimed', L10n::t('Lifespan of unclaimed items'), Config::get('system', 'dbclean-expire-unclaimed', 90), L10n::t('When the database cleanup is enabled, this defines the days after which unclaimed remote items (mostly content from the relay) will be deleted. Default value is 90 days. Defaults to the general lifespan value of remote items if set to 0.')],
655                         '$dbclean_expire_conv'    => ['dbclean_expire_conv', L10n::t('Lifespan of raw conversation data'), Config::get('system', 'dbclean_expire_conversation', 90), L10n::t('The conversation data is used for ActivityPub and OStatus, as well as for debug purposes. It should be safe to remove it after 14 days, default is 90 days.')],
656                         '$itemcache'              => ['itemcache', L10n::t('Path to item cache'), Config::get('system', 'itemcache'), L10n::t('The item caches buffers generated bbcode and external images.')],
657                         '$itemcache_duration'     => ['itemcache_duration', L10n::t('Cache duration in seconds'), Config::get('system', 'itemcache_duration'), L10n::t('How long should the cache files be hold? Default value is 86400 seconds (One day). To disable the item cache, set the value to -1.')],
658                         '$max_comments'           => ['max_comments', L10n::t('Maximum numbers of comments per post'), Config::get('system', 'max_comments'), L10n::t('How much comments should be shown for each post? Default value is 100.')],
659                         '$temppath'               => ['temppath', L10n::t('Temp path'), Config::get('system', 'temppath'), L10n::t('If you have a restricted system where the webserver can\'t access the system temp path, enter another path here.')],
660                         '$proxy_disabled'         => ['proxy_disabled', L10n::t('Disable picture proxy'), Config::get('system', 'proxy_disabled'), L10n::t('The picture proxy increases performance and privacy. It shouldn\'t be used on systems with very low bandwidth.')],
661                         '$only_tag_search'        => ['only_tag_search', L10n::t('Only search in tags'), Config::get('system', 'only_tag_search'), L10n::t('On large systems the text search can slow down the system extremely.')],
662
663                         '$relocate_url'           => ['relocate_url', L10n::t('New base url'), $a->getBaseURL(), L10n::t('Change base url for this server. Sends relocate message to all Friendica and Diaspora* contacts of all users.')],
664
665                         '$rino'                   => ['rino', L10n::t('RINO Encryption'), intval(Config::get('system', 'rino_encrypt')), L10n::t('Encryption layer between nodes.'), [0 => L10n::t('Disabled'), 1 => L10n::t('Enabled')]],
666
667                         '$worker_queues'          => ['worker_queues', L10n::t('Maximum number of parallel workers'), Config::get('system', 'worker_queues'), L10n::t('On shared hosters set this to %d. On larger systems, values of %d are great. Default value is %d.', 5, 20, 10)],
668                         '$worker_dont_fork'       => ['worker_dont_fork', L10n::t('Don\'t use "proc_open" with the worker'), Config::get('system', 'worker_dont_fork'), L10n::t('Enable this if your system doesn\'t allow the use of "proc_open". This can happen on shared hosters. If this is enabled you should increase the frequency of worker calls in your crontab.')],
669                         '$worker_fastlane'        => ['worker_fastlane', L10n::t('Enable fastlane'), Config::get('system', 'worker_fastlane'), L10n::t('When enabed, the fastlane mechanism starts an additional worker if processes with higher priority are blocked by processes of lower priority.')],
670                         '$worker_frontend'        => ['worker_frontend', L10n::t('Enable frontend worker'), Config::get('system', 'frontend_worker'), L10n::t('When enabled the Worker process is triggered when backend access is performed (e.g. messages being delivered). On smaller sites you might want to call %s/worker on a regular basis via an external cron job. You should only enable this option if you cannot utilize cron/scheduled jobs on your server.', $a->getBaseURL())],
671
672                         '$relay_subscribe'        => ['relay_subscribe', L10n::t('Subscribe to relay'), Config::get('system', 'relay_subscribe'), L10n::t('Enables the receiving of public posts from the relay. They will be included in the search, subscribed tags and on the global community page.')],
673                         '$relay_server'           => ['relay_server', L10n::t('Relay server'), Config::get('system', 'relay_server', 'https://relay.diasp.org'), L10n::t('Address of the relay server where public posts should be send to. For example https://relay.diasp.org')],
674                         '$relay_directly'         => ['relay_directly', L10n::t('Direct relay transfer'), Config::get('system', 'relay_directly'), L10n::t('Enables the direct transfer to other servers without using the relay servers')],
675                         '$relay_scope'            => ['relay_scope', L10n::t('Relay scope'), Config::get('system', 'relay_scope'), L10n::t('Can be "all" or "tags". "all" means that every public post should be received. "tags" means that only posts with selected tags should be received.'), ['' => L10n::t('Disabled'), 'all' => L10n::t('all'), 'tags' => L10n::t('tags')]],
676                         '$relay_server_tags'      => ['relay_server_tags', L10n::t('Server tags'), Config::get('system', 'relay_server_tags'), L10n::t('Comma separated list of tags for the "tags" subscription.')],
677                         '$relay_user_tags'        => ['relay_user_tags', L10n::t('Allow user tags'), Config::get('system', 'relay_user_tags', true), L10n::t('If enabled, the tags from the saved searches will used for the "tags" subscription in addition to the "relay_server_tags".')],
678
679                         '$form_security_token'    => parent::getFormSecurityToken('admin_site'),
680                         '$relocate_button'        => L10n::t('Start Relocation'),
681                 ]);
682         }
683 }