]> git.mxchange.org Git - friendica.git/blob - src/Module/Admin/Site.php
c899729f8e7a7b684d5978d3cbd757e965914dd5
[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\BaseURL;
18 use Friendica\Util\Strings;
19 use Friendica\Worker\Delivery;
20
21 require_once __DIR__ . '/../../../boot.php';
22
23 class Site extends BaseAdminModule
24 {
25         public static function post()
26         {
27                 parent::post();
28
29                 self::checkFormSecurityTokenRedirectOnError('/admin/site', 'admin_site');
30
31                 $a = self::getApp();
32
33                 if (!empty($_POST['republish_directory'])) {
34                         Worker::add(PRIORITY_LOW, 'Directory');
35                         return;
36                 }
37
38                 if (empty($_POST['page_site'])) {
39                         return;
40                 }
41
42                 // relocate
43                 // @TODO This file could benefit from moving this feature away in a Module\Admin\Relocate class for example
44                 if (!empty($_POST['relocate']) && !empty($_POST['relocate_url']) && $_POST['relocate_url'] != "") {
45                         $new_url = $_POST['relocate_url'];
46                         $new_url = rtrim($new_url, "/");
47
48                         $parsed = @parse_url($new_url);
49                         if (!is_array($parsed) || empty($parsed['host']) || empty($parsed['scheme'])) {
50                                 notice(L10n::t("Can not parse base url. Must have at least <scheme>://<domain>"));
51                                 $a->internalRedirect('admin/site');
52                         }
53
54                         /* steps:
55                          * replace all "baseurl" to "new_url" in config, profile, term, items and contacts
56                          * send relocate for every local user
57                          * */
58
59                         $old_url = $a->getBaseURL(true);
60
61                         // Generate host names for relocation the addresses in the format user@address.tld
62                         $new_host = str_replace("http://", "@", Strings::normaliseLink($new_url));
63                         $old_host = str_replace("http://", "@", Strings::normaliseLink($old_url));
64
65                         function update_table(App $a, $table_name, $fields, $old_url, $new_url)
66                         {
67                                 $dbold = DBA::escape($old_url);
68                                 $dbnew = DBA::escape($new_url);
69
70                                 $upd = [];
71                                 foreach ($fields as $f) {
72                                         $upd[] = "`$f` = REPLACE(`$f`, '$dbold', '$dbnew')";
73                                 }
74
75                                 $upds = implode(", ", $upd);
76
77                                 $r = DBA::e(sprintf("UPDATE %s SET %s;", $table_name, $upds));
78                                 if (!DBA::isResult($r)) {
79                                         notice("Failed updating '$table_name': " . DBA::errorMessage());
80                                         $a->internalRedirect('admin/site');
81                                 }
82                         }
83
84                         // update tables
85                         // update profile links in the format "http://server.tld"
86                         update_table($a, "profile", ['photo', 'thumb'], $old_url, $new_url);
87                         update_table($a, "term", ['url'], $old_url, $new_url);
88                         update_table($a, "contact", ['photo', 'thumb', 'micro', 'url', 'nurl', 'alias', 'request', 'notify', 'poll', 'confirm', 'poco', 'avatar'], $old_url, $new_url);
89                         update_table($a, "gcontact", ['url', 'nurl', 'photo', 'server_url', 'notify', 'alias'], $old_url, $new_url);
90                         update_table($a, "item", ['owner-link', 'author-link', 'body', 'plink', 'tag'], $old_url, $new_url);
91
92                         // update profile addresses in the format "user@server.tld"
93                         update_table($a, "contact", ['addr'], $old_host, $new_host);
94                         update_table($a, "gcontact", ['connect', 'addr'], $old_host, $new_host);
95
96                         // update config
97                         Config::set('system', 'url', $new_url);
98                         $a->setBaseURL($new_url);
99
100                         // send relocate
101                         $usersStmt = DBA::select('user', ['uid'], ['account_removed' => false, 'account_expired' => false]);
102                         while ($user = DBA::fetch($usersStmt)) {
103                                 Worker::add(PRIORITY_HIGH, 'Notifier', Delivery::RELOCATION, $user['uid']);
104                         }
105
106                         info("Relocation started. Could take a while to complete.");
107
108                         $a->internalRedirect('admin/site');
109                 }
110                 // end relocate
111
112                 $sitename         = (!empty($_POST['sitename'])         ? Strings::escapeTags(trim($_POST['sitename']))      : '');
113                 $sender_email     = (!empty($_POST['sender_email'])     ? Strings::escapeTags(trim($_POST['sender_email']))  : '');
114                 $banner           = (!empty($_POST['banner'])           ? trim($_POST['banner'])                             : false);
115                 $shortcut_icon    = (!empty($_POST['shortcut_icon'])    ? Strings::escapeTags(trim($_POST['shortcut_icon'])) : '');
116                 $touch_icon       = (!empty($_POST['touch_icon'])       ? Strings::escapeTags(trim($_POST['touch_icon']))    : '');
117                 $additional_info  = (!empty($_POST['additional_info'])  ? trim($_POST['additional_info'])                    : '');
118                 $language         = (!empty($_POST['language'])         ? Strings::escapeTags(trim($_POST['language']))      : '');
119                 $theme            = (!empty($_POST['theme'])            ? Strings::escapeTags(trim($_POST['theme']))         : '');
120                 $theme_mobile     = (!empty($_POST['theme_mobile'])     ? Strings::escapeTags(trim($_POST['theme_mobile']))  : '');
121                 $maximagesize     = (!empty($_POST['maximagesize'])     ? intval(trim($_POST['maximagesize']))               : 0);
122                 $maximagelength   = (!empty($_POST['maximagelength'])   ? intval(trim($_POST['maximagelength']))             : MAX_IMAGE_LENGTH);
123                 $jpegimagequality = (!empty($_POST['jpegimagequality']) ? intval(trim($_POST['jpegimagequality']))           : JPEG_QUALITY);
124
125                 $register_policy        = (!empty($_POST['register_policy'])         ? intval(trim($_POST['register_policy']))             : 0);
126                 $daily_registrations    = (!empty($_POST['max_daily_registrations']) ? intval(trim($_POST['max_daily_registrations']))     : 0);
127                 $abandon_days           = (!empty($_POST['abandon_days'])            ? intval(trim($_POST['abandon_days']))                : 0);
128
129                 $register_text          = (!empty($_POST['register_text'])           ? strip_tags(trim($_POST['register_text']))           : '');
130
131                 $allowed_sites          = (!empty($_POST['allowed_sites'])           ? Strings::escapeTags(trim($_POST['allowed_sites']))  : '');
132                 $allowed_email          = (!empty($_POST['allowed_email'])           ? Strings::escapeTags(trim($_POST['allowed_email']))  : '');
133                 $forbidden_nicknames    = (!empty($_POST['forbidden_nicknames'])     ? strtolower(Strings::escapeTags(trim($_POST['forbidden_nicknames']))) : '');
134                 $no_oembed_rich_content = !empty($_POST['no_oembed_rich_content']);
135                 $allowed_oembed         = (!empty($_POST['allowed_oembed'])          ? Strings::escapeTags(trim($_POST['allowed_oembed'])) : '');
136                 $block_public           = !empty($_POST['block_public']);
137                 $force_publish          = !empty($_POST['publish_all']);
138                 $global_directory       = (!empty($_POST['directory'])               ? Strings::escapeTags(trim($_POST['directory']))      : '');
139                 $newuser_private        = !empty($_POST['newuser_private']);
140                 $enotify_no_content     = !empty($_POST['enotify_no_content']);
141                 $private_addons         = !empty($_POST['private_addons']);
142                 $disable_embedded       = !empty($_POST['disable_embedded']);
143                 $allow_users_remote_self = !empty($_POST['allow_users_remote_self']);
144                 $explicit_content       = !empty($_POST['explicit_content']);
145
146                 $no_multi_reg           = !empty($_POST['no_multi_reg']);
147                 $no_openid              = !empty($_POST['no_openid']);
148                 $no_regfullname         = !empty($_POST['no_regfullname']);
149                 $community_page_style   = (!empty($_POST['community_page_style']) ? intval(trim($_POST['community_page_style'])) : 0);
150                 $max_author_posts_community_page = (!empty($_POST['max_author_posts_community_page']) ? intval(trim($_POST['max_author_posts_community_page'])) : 0);
151
152                 $verifyssl              = !empty($_POST['verifyssl']);
153                 $proxyuser              = (!empty($_POST['proxyuser'])              ? Strings::escapeTags(trim($_POST['proxyuser'])) : '');
154                 $proxy                  = (!empty($_POST['proxy'])                  ? Strings::escapeTags(trim($_POST['proxy']))     : '');
155                 $timeout                = (!empty($_POST['timeout'])                ? intval(trim($_POST['timeout']))                : 60);
156                 $maxloadavg             = (!empty($_POST['maxloadavg'])             ? intval(trim($_POST['maxloadavg']))             : 20);
157                 $maxloadavg_frontend    = (!empty($_POST['maxloadavg_frontend'])    ? intval(trim($_POST['maxloadavg_frontend']))    : 50);
158                 $min_memory             = (!empty($_POST['min_memory'])             ? intval(trim($_POST['min_memory']))             : 0);
159                 $optimize_max_tablesize = (!empty($_POST['optimize_max_tablesize']) ? intval(trim($_POST['optimize_max_tablesize'])) : 100);
160                 $optimize_fragmentation = (!empty($_POST['optimize_fragmentation']) ? intval(trim($_POST['optimize_fragmentation'])) : 30);
161                 $poco_completion        = (!empty($_POST['poco_completion'])        ? intval(trim($_POST['poco_completion']))        : false);
162                 $poco_requery_days      = (!empty($_POST['poco_requery_days'])      ? intval(trim($_POST['poco_requery_days']))      : 7);
163                 $poco_discovery         = (!empty($_POST['poco_discovery'])         ? intval(trim($_POST['poco_discovery']))         : PortableContact::DISABLED);
164                 $poco_discovery_since   = (!empty($_POST['poco_discovery_since'])   ? intval(trim($_POST['poco_discovery_since']))   : 30);
165                 $poco_local_search      = !empty($_POST['poco_local_search']);
166                 $nodeinfo               = !empty($_POST['nodeinfo']);
167                 $dfrn_only              = !empty($_POST['dfrn_only']);
168                 $ostatus_disabled       = !empty($_POST['ostatus_disabled']);
169                 $diaspora_enabled       = !empty($_POST['diaspora_enabled']);
170                 $ssl_policy             = (!empty($_POST['ssl_policy'])             ? intval($_POST['ssl_policy'])                    : 0);
171                 $force_ssl              = !empty($_POST['force_ssl']);
172                 $hide_help              = !empty($_POST['hide_help']);
173                 $dbclean                = !empty($_POST['dbclean']);
174                 $dbclean_expire_days    = (!empty($_POST['dbclean_expire_days'])    ? intval($_POST['dbclean_expire_days'])           : 0);
175                 $dbclean_unclaimed      = (!empty($_POST['dbclean_unclaimed'])      ? intval($_POST['dbclean_unclaimed'])             : 0);
176                 $dbclean_expire_conv    = (!empty($_POST['dbclean_expire_conv'])    ? intval($_POST['dbclean_expire_conv'])           : 0);
177                 $suppress_tags          = !empty($_POST['suppress_tags']);
178                 $itemcache              = (!empty($_POST['itemcache'])              ? Strings::escapeTags(trim($_POST['itemcache']))  : '');
179                 $itemcache_duration     = (!empty($_POST['itemcache_duration'])     ? intval($_POST['itemcache_duration'])            : 0);
180                 $max_comments           = (!empty($_POST['max_comments'])           ? intval($_POST['max_comments'])                  : 0);
181                 $temppath               = (!empty($_POST['temppath'])               ? Strings::escapeTags(trim($_POST['temppath']))   : '');
182                 $singleuser             = (!empty($_POST['singleuser'])             ? Strings::escapeTags(trim($_POST['singleuser'])) : '');
183                 $proxy_disabled         = !empty($_POST['proxy_disabled']);
184                 $only_tag_search        = !empty($_POST['only_tag_search']);
185                 $rino                   = (!empty($_POST['rino'])                   ? intval($_POST['rino'])                          : 0);
186                 $check_new_version_url  = (!empty($_POST['check_new_version_url'])  ? Strings::escapeTags(trim($_POST['check_new_version_url'])) : 'none');
187
188                 $worker_queues    = (!empty($_POST['worker_queues'])                ? intval($_POST['worker_queues'])                 : 10);
189                 $worker_dont_fork = !empty($_POST['worker_dont_fork']);
190                 $worker_fastlane  = !empty($_POST['worker_fastlane']);
191                 $worker_frontend  = !empty($_POST['worker_frontend']);
192
193                 $relay_directly    = !empty($_POST['relay_directly']);
194                 $relay_server      = (!empty($_POST['relay_server'])      ? Strings::escapeTags(trim($_POST['relay_server']))       : '');
195                 $relay_subscribe   = !empty($_POST['relay_subscribe']);
196                 $relay_scope       = (!empty($_POST['relay_scope'])       ? Strings::escapeTags(trim($_POST['relay_scope']))        : '');
197                 $relay_server_tags = (!empty($_POST['relay_server_tags']) ? Strings::escapeTags(trim($_POST['relay_server_tags']))  : '');
198                 $relay_user_tags   = !empty($_POST['relay_user_tags']);
199                 $active_panel      = (!empty($_POST['active_panel'])      ? "#" . Strings::escapeTags(trim($_POST['active_panel'])) : '');
200
201                 /**
202                  * @var $storagebackend \Friendica\Model\Storage\IStorage
203                  */
204                 $storagebackend    = Strings::escapeTags(trim(defaults($_POST, 'storagebackend', '')));
205
206                 // save storage backend form
207                 if (!is_null($storagebackend) && $storagebackend != "") {
208                         if (StorageManager::setBackend($storagebackend)) {
209                                 $storage_opts = $storagebackend::getOptions();
210                                 $storage_form_prefix = preg_replace('|[^a-zA-Z0-9]|', '', $storagebackend);
211                                 $storage_opts_data = [];
212                                 foreach ($storage_opts as $name => $info) {
213                                         $fieldname = $storage_form_prefix . '_' . $name;
214                                         switch ($info[0]) { // type
215                                                 case 'checkbox':
216                                                 case 'yesno':
217                                                         $value = !empty($_POST[$fieldname]);
218                                                         break;
219                                                 default:
220                                                         $value = defaults($_POST, $fieldname, '');
221                                         }
222                                         $storage_opts_data[$name] = $value;
223                                 }
224                                 unset($name);
225                                 unset($info);
226
227                                 $storage_form_errors = $storagebackend::saveOptions($storage_opts_data);
228                                 if (count($storage_form_errors)) {
229                                         foreach ($storage_form_errors as $name => $err) {
230                                                 notice('Storage backend, ' . $storage_opts[$name][1] . ': ' . $err);
231                                         }
232                                         $a->internalRedirect('admin/site' . $active_panel);
233                                 }
234                         } else {
235                                 info(L10n::t('Invalid storage backend setting value.'));
236                         }
237                 }
238
239                 // Has the directory url changed? If yes, then resubmit the existing profiles there
240                 if ($global_directory != Config::get('system', 'directory') && ($global_directory != '')) {
241                         Config::set('system', 'directory', $global_directory);
242                         Worker::add(PRIORITY_LOW, 'Directory');
243                 }
244
245                 if ($a->getURLPath() != "") {
246                         $diaspora_enabled = false;
247                 }
248                 if ($ssl_policy != intval(Config::get('system', 'ssl_policy'))) {
249                         if ($ssl_policy == BaseURL::SSL_POLICY_FULL) {
250                                 DBA::e("UPDATE `contact` SET
251                                 `url`     = REPLACE(`url`    , 'http:' , 'https:'),
252                                 `photo`   = REPLACE(`photo`  , 'http:' , 'https:'),
253                                 `thumb`   = REPLACE(`thumb`  , 'http:' , 'https:'),
254                                 `micro`   = REPLACE(`micro`  , 'http:' , 'https:'),
255                                 `request` = REPLACE(`request`, 'http:' , 'https:'),
256                                 `notify`  = REPLACE(`notify` , 'http:' , 'https:'),
257                                 `poll`    = REPLACE(`poll`   , 'http:' , 'https:'),
258                                 `confirm` = REPLACE(`confirm`, 'http:' , 'https:'),
259                                 `poco`    = REPLACE(`poco`   , 'http:' , 'https:')
260                                 WHERE `self` = 1"
261                                 );
262                                 DBA::e("UPDATE `profile` SET
263                                 `photo`   = REPLACE(`photo`  , 'http:' , 'https:'),
264                                 `thumb`   = REPLACE(`thumb`  , 'http:' , 'https:')
265                                 WHERE 1 "
266                                 );
267                         } elseif ($ssl_policy == BaseURL::SSL_POLICY_SELFSIGN) {
268                                 DBA::e("UPDATE `contact` SET
269                                 `url`     = REPLACE(`url`    , 'https:' , 'http:'),
270                                 `photo`   = REPLACE(`photo`  , 'https:' , 'http:'),
271                                 `thumb`   = REPLACE(`thumb`  , 'https:' , 'http:'),
272                                 `micro`   = REPLACE(`micro`  , 'https:' , 'http:'),
273                                 `request` = REPLACE(`request`, 'https:' , 'http:'),
274                                 `notify`  = REPLACE(`notify` , 'https:' , 'http:'),
275                                 `poll`    = REPLACE(`poll`   , 'https:' , 'http:'),
276                                 `confirm` = REPLACE(`confirm`, 'https:' , 'http:'),
277                                 `poco`    = REPLACE(`poco`   , 'https:' , 'http:')
278                                 WHERE `self` = 1"
279                                 );
280                                 DBA::e("UPDATE `profile` SET
281                                 `photo`   = REPLACE(`photo`  , 'https:' , 'http:'),
282                                 `thumb`   = REPLACE(`thumb`  , 'https:' , 'http:')
283                                 WHERE 1 "
284                                 );
285                         }
286                 }
287                 Config::set('system', 'ssl_policy'            , $ssl_policy);
288                 Config::set('system', 'maxloadavg'            , $maxloadavg);
289                 Config::set('system', 'maxloadavg_frontend'   , $maxloadavg_frontend);
290                 Config::set('system', 'min_memory'            , $min_memory);
291                 Config::set('system', 'optimize_max_tablesize', $optimize_max_tablesize);
292                 Config::set('system', 'optimize_fragmentation', $optimize_fragmentation);
293                 Config::set('system', 'poco_completion'       , $poco_completion);
294                 Config::set('system', 'poco_requery_days'     , $poco_requery_days);
295                 Config::set('system', 'poco_discovery'        , $poco_discovery);
296                 Config::set('system', 'poco_discovery_since'  , $poco_discovery_since);
297                 Config::set('system', 'poco_local_search'     , $poco_local_search);
298                 Config::set('system', 'nodeinfo'              , $nodeinfo);
299                 Config::set('config', 'sitename'              , $sitename);
300                 Config::set('config', 'sender_email'          , $sender_email);
301                 Config::set('system', 'suppress_tags'         , $suppress_tags);
302                 Config::set('system', 'shortcut_icon'         , $shortcut_icon);
303                 Config::set('system', 'touch_icon'            , $touch_icon);
304
305                 if ($banner == "") {
306                         Config::delete('system', 'banner');
307                 } else {
308                         Config::set('system', 'banner', $banner);
309                 }
310
311                 if (empty($additional_info)) {
312                         Config::delete('config', 'info');
313                 } else {
314                         Config::set('config', 'info', $additional_info);
315                 }
316                 Config::set('system', 'language', $language);
317                 Config::set('system', 'theme', $theme);
318                 Theme::install($theme);
319
320                 if ($theme_mobile == '---') {
321                         Config::delete('system', 'mobile-theme');
322                 } else {
323                         Config::set('system', 'mobile-theme', $theme_mobile);
324                 }
325                 if ($singleuser == '---') {
326                         Config::delete('system', 'singleuser');
327                 } else {
328                         Config::set('system', 'singleuser', $singleuser);
329                 }
330                 Config::set('system', 'maximagesize'           , $maximagesize);
331                 Config::set('system', 'max_image_length'       , $maximagelength);
332                 Config::set('system', 'jpeg_quality'           , $jpegimagequality);
333
334                 Config::set('config', 'register_policy'        , $register_policy);
335                 Config::set('system', 'max_daily_registrations', $daily_registrations);
336                 Config::set('system', 'account_abandon_days'   , $abandon_days);
337                 Config::set('config', 'register_text'          , $register_text);
338                 Config::set('system', 'allowed_sites'          , $allowed_sites);
339                 Config::set('system', 'allowed_email'          , $allowed_email);
340                 Config::set('system', 'forbidden_nicknames'    , $forbidden_nicknames);
341                 Config::set('system', 'no_oembed_rich_content' , $no_oembed_rich_content);
342                 Config::set('system', 'allowed_oembed'         , $allowed_oembed);
343                 Config::set('system', 'block_public'           , $block_public);
344                 Config::set('system', 'publish_all'            , $force_publish);
345                 Config::set('system', 'newuser_private'        , $newuser_private);
346                 Config::set('system', 'enotify_no_content'     , $enotify_no_content);
347                 Config::set('system', 'disable_embedded'       , $disable_embedded);
348                 Config::set('system', 'allow_users_remote_self', $allow_users_remote_self);
349                 Config::set('system', 'explicit_content'       , $explicit_content);
350                 Config::set('system', 'check_new_version_url'  , $check_new_version_url);
351
352                 Config::set('system', 'block_extended_register', $no_multi_reg);
353                 Config::set('system', 'no_openid'              , $no_openid);
354                 Config::set('system', 'no_regfullname'         , $no_regfullname);
355                 Config::set('system', 'community_page_style'   , $community_page_style);
356                 Config::set('system', 'max_author_posts_community_page', $max_author_posts_community_page);
357                 Config::set('system', 'verifyssl'              , $verifyssl);
358                 Config::set('system', 'proxyuser'              , $proxyuser);
359                 Config::set('system', 'proxy'                  , $proxy);
360                 Config::set('system', 'curl_timeout'           , $timeout);
361                 Config::set('system', 'dfrn_only'              , $dfrn_only);
362                 Config::set('system', 'ostatus_disabled'       , $ostatus_disabled);
363                 Config::set('system', 'diaspora_enabled'       , $diaspora_enabled);
364
365                 Config::set('config', 'private_addons'         , $private_addons);
366
367                 Config::set('system', 'force_ssl'              , $force_ssl);
368                 Config::set('system', 'hide_help'              , $hide_help);
369
370                 Config::set('system', 'dbclean'                , $dbclean);
371                 Config::set('system', 'dbclean-expire-days'    , $dbclean_expire_days);
372                 Config::set('system', 'dbclean_expire_conversation', $dbclean_expire_conv);
373
374                 if ($dbclean_unclaimed == 0) {
375                         $dbclean_unclaimed = $dbclean_expire_days;
376                 }
377
378                 Config::set('system', 'dbclean-expire-unclaimed', $dbclean_unclaimed);
379
380                 if ($itemcache != '') {
381                         $itemcache = BasePath::getRealPath($itemcache);
382                 }
383
384                 Config::set('system', 'itemcache', $itemcache);
385                 Config::set('system', 'itemcache_duration', $itemcache_duration);
386                 Config::set('system', 'max_comments', $max_comments);
387
388                 if ($temppath != '') {
389                         $temppath = BasePath::getRealPath($temppath);
390                 }
391
392                 Config::set('system', 'temppath', $temppath);
393
394                 Config::set('system', 'proxy_disabled'   , $proxy_disabled);
395                 Config::set('system', 'only_tag_search'  , $only_tag_search);
396
397                 Config::set('system', 'worker_queues'    , $worker_queues);
398                 Config::set('system', 'worker_dont_fork' , $worker_dont_fork);
399                 Config::set('system', 'worker_fastlane'  , $worker_fastlane);
400                 Config::set('system', 'frontend_worker'  , $worker_frontend);
401
402                 Config::set('system', 'relay_directly'   , $relay_directly);
403                 Config::set('system', 'relay_server'     , $relay_server);
404                 Config::set('system', 'relay_subscribe'  , $relay_subscribe);
405                 Config::set('system', 'relay_scope'      , $relay_scope);
406                 Config::set('system', 'relay_server_tags', $relay_server_tags);
407                 Config::set('system', 'relay_user_tags'  , $relay_user_tags);
408
409                 Config::set('system', 'rino_encrypt'     , $rino);
410
411                 info(L10n::t('Site settings updated.') . EOL);
412
413                 $a->internalRedirect('admin/site' . $active_panel);
414         }
415
416         public static function content()
417         {
418                 parent::content();
419
420                 $a = self::getApp();
421
422                 /* Installed langs */
423                 $lang_choices = L10n::getAvailableLanguages();
424
425                 if (strlen(Config::get('system', 'directory_submit_url')) &&
426                         !strlen(Config::get('system', 'directory'))) {
427                         Config::set('system', 'directory', dirname(Config::get('system', 'directory_submit_url')));
428                         Config::delete('system', 'directory_submit_url');
429                 }
430
431                 /* Installed themes */
432                 $theme_choices = [];
433                 $theme_choices_mobile = [];
434                 $theme_choices_mobile['---'] = L10n::t('No special theme for mobile devices');
435                 $files = glob('view/theme/*');
436                 if (is_array($files)) {
437                         $allowed_theme_list = Config::get('system', 'allowed_themes');
438
439                         foreach ($files as $file) {
440                                 if (intval(file_exists($file . '/unsupported'))) {
441                                         continue;
442                                 }
443
444                                 $f = basename($file);
445
446                                 // Only show allowed themes here
447                                 if (($allowed_theme_list != '') && !strstr($allowed_theme_list, $f)) {
448                                         continue;
449                                 }
450
451                                 $theme_name = ((file_exists($file . '/experimental')) ? L10n::t('%s - (Experimental)', $f) : $f);
452
453                                 if (file_exists($file . '/mobile')) {
454                                         $theme_choices_mobile[$f] = $theme_name;
455                                 } else {
456                                         $theme_choices[$f] = $theme_name;
457                                 }
458                         }
459                 }
460
461                 /* Community page style */
462                 $community_page_style_choices = [
463                         CP_NO_INTERNAL_COMMUNITY => L10n::t('No community page for local users'),
464                         CP_NO_COMMUNITY_PAGE => L10n::t('No community page'),
465                         CP_USERS_ON_SERVER => L10n::t('Public postings from users of this site'),
466                         CP_GLOBAL_COMMUNITY => L10n::t('Public postings from the federated network'),
467                         CP_USERS_AND_GLOBAL => L10n::t('Public postings from local users and the federated network')
468                 ];
469
470                 $poco_discovery_choices = [
471                         PortableContact::DISABLED => L10n::t('Disabled'),
472                         PortableContact::USERS => L10n::t('Users'),
473                         PortableContact::USERS_GCONTACTS => L10n::t('Users, Global Contacts'),
474                         PortableContact::USERS_GCONTACTS_FALLBACK => L10n::t('Users, Global Contacts/fallback'),
475                 ];
476
477                 $poco_discovery_since_choices = [
478                         '30' => L10n::t('One month'),
479                         '91' => L10n::t('Three months'),
480                         '182' => L10n::t('Half a year'),
481                         '365' => L10n::t('One year'),
482                 ];
483
484                 /* get user names to make the install a personal install of X */
485                 // @TODO Move to Model\User::getNames()
486                 $user_names = [];
487                 $user_names['---'] = L10n::t('Multi user instance');
488
489                 $usersStmt = DBA::select('user', ['username', 'nickname'], ['account_removed' => 0, 'account_expired' => 0]);
490                 foreach (DBA::toArray($usersStmt) as $user) {
491                         $user_names[$user['nickname']] = $user['username'];
492                 }
493
494                 /* Banner */
495                 $banner = Config::get('system', 'banner');
496
497                 if ($banner == false) {
498                         $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>';
499                 }
500
501                 $additional_info = Config::get('config', 'info');
502
503                 // Automatically create temporary paths
504                 get_temppath();
505                 get_itemcachepath();
506
507                 /* Register policy */
508                 $register_choices = [
509                         Register::CLOSED => L10n::t('Closed'),
510                         Register::APPROVE => L10n::t('Requires approval'),
511                         Register::OPEN => L10n::t('Open')
512                 ];
513
514                 $ssl_choices = [
515                         BaseURL::SSL_POLICY_NONE => L10n::t('No SSL policy, links will track page SSL state'),
516                         BaseURL::SSL_POLICY_FULL => L10n::t('Force all links to use SSL'),
517                         BaseURL::SSL_POLICY_SELFSIGN => L10n::t('Self-signed certificate, use SSL for local links only (discouraged)')
518                 ];
519
520                 $check_git_version_choices = [
521                         'none' => L10n::t('Don\'t check'),
522                         'master' => L10n::t('check the stable version'),
523                         'develop' => L10n::t('check the development version')
524                 ];
525
526                 $diaspora_able = ($a->getURLPath() == '');
527
528                 $optimize_max_tablesize = Config::get('system', 'optimize_max_tablesize', -1);
529
530                 if ($optimize_max_tablesize <= 0) {
531                         $optimize_max_tablesize = -1;
532                 }
533
534                 $storage_backends = StorageManager::listBackends();
535                 /** @var $current_storage_backend \Friendica\Model\Storage\IStorage */
536                 $current_storage_backend = StorageManager::getBackend();
537
538                 $available_storage_backends = [];
539
540                 // show legacy option only if it is the current backend:
541                 // once changed can't be selected anymore
542                 if ($current_storage_backend == '') {
543                         $available_storage_backends[''] = L10n::t('Database (legacy)');
544                 }
545
546                 foreach ($storage_backends as $name => $class) {
547                         $available_storage_backends[$class] = $name;
548                 }
549                 unset($storage_backends);
550
551                 // build storage config form,
552                 $storage_form_prefix = preg_replace('|[^a-zA-Z0-9]|' ,'', $current_storage_backend);
553
554                 $storage_form = [];
555                 if (!is_null($current_storage_backend) && $current_storage_backend != '') {
556                         foreach ($current_storage_backend::getOptions() as $name => $info) {
557                                 $type = $info[0];
558                                 $info[0] = $storage_form_prefix . '_' . $name;
559                                 $info['type'] = $type;
560                                 $info['field'] = 'field_' . $type . '.tpl';
561                                 $storage_form[$name] = $info;
562                         }
563                 }
564
565                 $t = Renderer::getMarkupTemplate('admin/site.tpl');
566                 return Renderer::replaceMacros($t, [
567                         '$title'             => L10n::t('Administration'),
568                         '$page'              => L10n::t('Site'),
569                         '$submit'            => L10n::t('Save Settings'),
570                         '$republish'         => L10n::t('Republish users to directory'),
571                         '$registration'      => L10n::t('Registration'),
572                         '$upload'            => L10n::t('File upload'),
573                         '$corporate'         => L10n::t('Policies'),
574                         '$advanced'          => L10n::t('Advanced'),
575                         '$portable_contacts' => L10n::t('Auto Discovered Contact Directory'),
576                         '$performance'       => L10n::t('Performance'),
577                         '$worker_title'      => L10n::t('Worker'),
578                         '$relay_title'       => L10n::t('Message Relay'),
579                         '$relocate'          => L10n::t('Relocate Instance'),
580                         '$relocate_warning'  => L10n::t('Warning! Advanced function. Could make this server unreachable.'),
581                         '$baseurl'           => $a->getBaseURL(true),
582
583                         // name, label, value, help string, extra data...
584                         '$sitename'         => ['sitename', L10n::t('Site name'), Config::get('config', 'sitename'), ''],
585                         '$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'],
586                         '$banner'           => ['banner', L10n::t('Banner/Logo'), $banner, ''],
587                         '$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.')],
588                         '$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.')],
589                         '$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())],
590                         '$language'         => ['language', L10n::t('System language'), Config::get('system', 'language'), '', $lang_choices],
591                         '$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],
592                         '$theme_mobile'     => ['theme_mobile', L10n::t('Mobile system theme'), Config::get('system', 'mobile-theme', '---'), L10n::t('Theme for mobile devices'), $theme_choices_mobile],
593                         '$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],
594                         '$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.')],
595                         '$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.')],
596                         '$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],
597
598                         '$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],
599                         '$storageform'      => $storage_form,
600                         '$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.')],
601                         '$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.')],
602                         '$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.')],
603
604                         '$register_policy'        => ['register_policy', L10n::t('Register policy'), Config::get('config', 'register_policy'), '', $register_choices],
605                         '$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.')],
606                         '$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.')],
607                         '$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.')],
608                         '$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.')],
609                         '$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')],
610                         '$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')],
611                         '$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.')],
612                         '$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.')],
613                         '$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.')],
614                         '$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>'],
615                         '$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.')],
616                         '$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.')],
617                         '$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.')],
618                         '$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.')],
619                         '$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.')],
620                         '$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.')],
621                         '$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.')],
622                         '$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.')],
623                         '$no_openid'              => ['no_openid', L10n::t('Disable OpenID'), Config::get('system', 'no_openid'), L10n::t('Disable OpenID support for registration and logins.')],
624                         '$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.')],
625                         '$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],
626                         '$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")')],
627                         '$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.')],
628                         '$ostatus_not_able'       => L10n::t('OStatus support can only be enabled if threading is enabled.'),
629                         '$diaspora_able'          => $diaspora_able,
630                         '$diaspora_not_able'      => L10n::t('Diaspora support can\'t be enabled because Friendica was installed into a sub directory.'),
631                         '$diaspora_enabled'       => ['diaspora_enabled', L10n::t('Enable Diaspora support'), Config::get('system', 'diaspora_enabled', $diaspora_able), L10n::t('Provide built-in Diaspora network compatibility.')],
632                         '$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.')],
633                         '$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.')],
634                         '$proxyuser'              => ['proxyuser', L10n::t('Proxy user'), Config::get('system', 'proxyuser'), ''],
635                         '$proxy'                  => ['proxy', L10n::t('Proxy URL'), Config::get('system', 'proxy'), ''],
636                         '$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).')],
637                         '$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)],
638                         '$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.')],
639                         '$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).')],
640                         '$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.')],
641                         '$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%.')],
642
643                         '$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.')],
644                         '$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.')],
645                         '$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],
646                         '$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],
647                         '$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.')],
648
649                         '$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.')],
650
651                         '$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],
652                         '$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.')],
653                         '$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.')],
654                         '$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.')],
655                         '$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.')],
656                         '$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.')],
657                         '$itemcache'              => ['itemcache', L10n::t('Path to item cache'), Config::get('system', 'itemcache'), L10n::t('The item caches buffers generated bbcode and external images.')],
658                         '$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.')],
659                         '$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.')],
660                         '$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.')],
661                         '$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.')],
662                         '$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.')],
663
664                         '$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.')],
665
666                         '$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')]],
667
668                         '$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)],
669                         '$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.')],
670                         '$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.')],
671                         '$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())],
672
673                         '$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.')],
674                         '$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')],
675                         '$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')],
676                         '$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')]],
677                         '$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.')],
678                         '$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".')],
679
680                         '$form_security_token'    => parent::getFormSecurityToken('admin_site'),
681                         '$relocate_button'        => L10n::t('Start Relocation'),
682                 ]);
683         }
684 }