Friendica Communications Platform (please note that this is a clone of the repository at github, issues are handled there) https://friendi.ca
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

2031 lines
81 KiB

9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
5 years ago
5 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
6 years ago
6 years ago
9 years ago
6 years ago
6 years ago
9 years ago
9 years ago
9 years ago
9 years ago
8 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
6 years ago
6 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
8 years ago
9 years ago
6 years ago
9 years ago
9 years ago
5 years ago
9 years ago
9 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
5 years ago
6 years ago
5 years ago
6 years ago
6 years ago
6 years ago
  1. <?php
  2. /**
  3. * @file mod/admin.php
  4. *
  5. * @brief Friendica admin
  6. */
  7. require_once("include/enotify.php");
  8. require_once("include/text.php");
  9. /**
  10. * @brief Process send data from the admin panels subpages
  11. *
  12. * This function acts as relais for processing the data send from the subpages
  13. * of the admin panel. Depending on the 1st parameter of the url (argv[1])
  14. * specialized functions are called to process the data from the subpages.
  15. *
  16. * The function itself does not return anything, but the subsequencely function
  17. * return the HTML for the pages of the admin panel.
  18. *
  19. * @param App $a
  20. *
  21. */
  22. function admin_post(&$a){
  23. if(!is_site_admin()) {
  24. return;
  25. }
  26. // do not allow a page manager to access the admin panel at all.
  27. if(x($_SESSION,'submanage') && intval($_SESSION['submanage']))
  28. return;
  29. // urls
  30. if($a->argc > 1) {
  31. switch ($a->argv[1]){
  32. case 'site':
  33. admin_page_site_post($a);
  34. break;
  35. case 'users':
  36. admin_page_users_post($a);
  37. break;
  38. case 'plugins':
  39. if($a->argc > 2 &&
  40. is_file("addon/".$a->argv[2]."/".$a->argv[2].".php")) {
  41. @include_once("addon/".$a->argv[2]."/".$a->argv[2].".php");
  42. if(function_exists($a->argv[2].'_plugin_admin_post')) {
  43. $func = $a->argv[2].'_plugin_admin_post';
  44. $func($a);
  45. }
  46. }
  47. goaway('admin/plugins/'.$a->argv[2]);
  48. return; // NOTREACHED
  49. break;
  50. case 'themes':
  51. if($a->argc < 2) {
  52. if(is_ajax()) return;
  53. goaway('admin/');
  54. return;
  55. }
  56. $theme = $a->argv[2];
  57. if(is_file("view/theme/$theme/config.php")){
  58. function __call_theme_admin_post(&$a, $theme) {
  59. $orig_theme = $a->theme;
  60. $orig_page = $a->page;
  61. $orig_session_theme = $_SESSION['theme'];
  62. require_once("view/theme/$theme/theme.php");
  63. require_once("view/theme/$theme/config.php");
  64. $_SESSION['theme'] = $theme;
  65. $init = $theme."_init";
  66. if(function_exists($init)) $init($a);
  67. if(function_exists("theme_admin_post")) {
  68. $admin_form = theme_admin_post($a);
  69. }
  70. $_SESSION['theme'] = $orig_session_theme;
  71. $a->theme = $orig_theme;
  72. $a->page = $orig_page;
  73. return $admin_form;
  74. }
  75. __call_theme_admin_post($a, $theme);
  76. }
  77. info(t('Theme settings updated.'));
  78. if(is_ajax()) return;
  79. goaway('admin/themes/'.$theme);
  80. return;
  81. break;
  82. case 'features':
  83. admin_page_features_post($a);
  84. break;
  85. case 'logs':
  86. admin_page_logs_post($a);
  87. break;
  88. case 'dbsync':
  89. admin_page_dbsync_post($a);
  90. break;
  91. }
  92. }
  93. goaway('admin');
  94. return; // NOTREACHED
  95. }
  96. /**
  97. * @brief Generates content of the admin panel pages
  98. *
  99. * This function generates the content for the admin panel. It consists of the
  100. * aside menu (same for the entire admin panel) and the code for the soecified
  101. * subpage of the panel.
  102. *
  103. * The structure of the adress is: /admin/subpage/details though "details" is
  104. * only necessary for some subpages, like themes or addons where it is the name
  105. * of one theme resp. addon from which the details should be shown. Content for
  106. * the subpages is generated in separate functions for each of the subpages.
  107. *
  108. * The returned string hold the generated HTML code of the page.
  109. *
  110. * @param App $a
  111. * @return string
  112. */
  113. function admin_content(&$a) {
  114. if(!is_site_admin()) {
  115. return login(false);
  116. }
  117. if(x($_SESSION,'submanage') && intval($_SESSION['submanage']))
  118. return "";
  119. // APC deactivated, since there are problems with PHP 5.5
  120. //if (function_exists("apc_delete")) {
  121. // $toDelete = new APCIterator('user', APC_ITER_VALUE);
  122. // apc_delete($toDelete);
  123. //}
  124. // Header stuff
  125. $a->page['htmlhead'] .= replace_macros(get_markup_template('admin_settings_head.tpl'), array());
  126. /*
  127. * Side bar links
  128. */
  129. $aside_tools = array();
  130. // array(url, name, extra css classes)
  131. // not part of $aside to make the template more adjustable
  132. $aside_sub = array(
  133. 'site' => array("admin/site/", t("Site") , "site"),
  134. 'users' => array("admin/users/", t("Users") , "users"),
  135. 'plugins'=> array("admin/plugins/", t("Plugins") , "plugins"),
  136. 'themes' => array("admin/themes/", t("Themes") , "themes"),
  137. 'features' => array("admin/features/", t("Additional features") , "features"),
  138. 'dbsync' => array("admin/dbsync/", t('DB updates'), "dbsync"),
  139. 'queue' => array("admin/queue/", t('Inspect Queue'), "queue"),
  140. 'federation' => array("admin/federation/", t('Federation Statistics'), "federation"),
  141. );
  142. /* get plugins admin page */
  143. $r = q("SELECT `name` FROM `addon` WHERE `plugin_admin` = 1 ORDER BY `name`");
  144. $aside_tools['plugins_admin']=array();
  145. foreach ($r as $h){
  146. $plugin =$h['name'];
  147. $aside_tools['plugins_admin'][] = array("admin/plugins/".$plugin, $plugin, "plugin");
  148. // temp plugins with admin
  149. $a->plugins_admin[] = $plugin;
  150. }
  151. $aside_tools['logs'] = array("admin/logs/", t("Logs"), "logs");
  152. $aside_tools['viewlogs'] = array("admin/viewlogs/", t("View Logs"), 'viewlogs');
  153. $aside_tools['diagnostics_probe'] = array('probe/', t('probe address'), 'probe');
  154. $aside_tools['diagnostics_webfinger'] = array('webfinger/', t('check webfinger'), 'webfinger');
  155. $t = get_markup_template("admin_aside.tpl");
  156. $a->page['aside'] .= replace_macros($t, array(
  157. '$admin' => $aside_tools,
  158. '$subpages' => $aside_sub,
  159. '$admtxt' => t('Admin'),
  160. '$plugadmtxt' => t('Plugin Features'),
  161. '$logtxt' => t('Logs'),
  162. '$diagnosticstxt' => t('diagnostics'),
  163. '$h_pending' => t('User registrations waiting for confirmation'),
  164. '$admurl'=> "admin/"
  165. ));
  166. /*
  167. * Page content
  168. */
  169. $o = '';
  170. // urls
  171. if($a->argc > 1) {
  172. switch ($a->argv[1]){
  173. case 'site':
  174. $o = admin_page_site($a);
  175. break;
  176. case 'users':
  177. $o = admin_page_users($a);
  178. break;
  179. case 'plugins':
  180. $o = admin_page_plugins($a);
  181. break;
  182. case 'themes':
  183. $o = admin_page_themes($a);
  184. break;
  185. case 'features':
  186. $o = admin_page_features($a);
  187. break;
  188. case 'logs':
  189. $o = admin_page_logs($a);
  190. break;
  191. case 'viewlogs':
  192. $o = admin_page_viewlogs($a);
  193. break;
  194. case 'dbsync':
  195. $o = admin_page_dbsync($a);
  196. break;
  197. case 'queue':
  198. $o = admin_page_queue($a);
  199. break;
  200. case 'federation':
  201. $o = admin_page_federation($a);
  202. break;
  203. default:
  204. notice(t("Item not found."));
  205. }
  206. } else {
  207. $o = admin_page_summary($a);
  208. }
  209. if(is_ajax()) {
  210. echo $o;
  211. killme();
  212. return '';
  213. } else {
  214. return $o;
  215. }
  216. }
  217. /**
  218. * @brief Subpage with some stats about "the federation" network
  219. *
  220. * This function generates the "Federation Statistics" subpage for the admin
  221. * panel. The page lists some numbers to the part of "The Federation" known to
  222. * the node. This data includes the different connected networks (e.g.
  223. * Diaspora, Hubzilla, GNU Social) and the used versions in the different
  224. * networks.
  225. *
  226. * The returned string contains the HTML code of the subpage for display.
  227. *
  228. * @param App $a
  229. * @return string
  230. */
  231. function admin_page_federation(&$a) {
  232. // get counts on active friendica, diaspora, redmatrix, hubzilla, gnu
  233. // social and statusnet nodes this node is knowing
  234. //
  235. // We are looking for the following platforms in the DB, "Red" should find
  236. // all variants of that platform ID string as the q() function is stripping
  237. // off one % two of them are needed in the query
  238. // Add more platforms if you like, when one returns 0 known nodes it is not
  239. // displayed on the stats page.
  240. $platforms = array('Friendica', 'Diaspora', '%%red%%', 'Hubzilla', 'GNU Social', 'StatusNet');
  241. $colors = array('Friendica' => '#ffc018', // orange from the logo
  242. 'Diaspora' => '#a1a1a1', // logo is black and white, makes a gray
  243. '%%red%%' => '#c50001', // fire red from the logo
  244. 'Hubzilla' => '#43488a', // blue from the logo
  245. 'GNU Social'=> '#a22430', // dark red from the logo
  246. 'StatusNet' => '#789240'); // the green from the logo (red and blue have already others
  247. $counts = array();
  248. $total = 0;
  249. foreach ($platforms as $p) {
  250. // get a total count for the platform, the name and version of the
  251. // highest version and the protocol tpe
  252. $c = q('SELECT COUNT(*) AS `total`, `platform`, `network`, `version` FROM `gserver`
  253. WHERE `platform` LIKE "%s" AND `last_contact` > `last_failure` AND `version` != ""
  254. ORDER BY `version` ASC;', $p);
  255. $total = $total + $c[0]['total'];
  256. // what versions for that platform do we know at all?
  257. // again only the active nodes
  258. $v = q('SELECT COUNT(*) AS `total`, `version` FROM `gserver`
  259. WHERE `last_contact` > `last_failure` AND `platform` LIKE "%s" AND `version` != ""
  260. GROUP BY `version`
  261. ORDER BY `version`;', $p);
  262. //
  263. // clean up version numbers
  264. //
  265. // in the DB the Diaspora versions have the format x.x.x.x-xx the last
  266. // part (-xx) should be removed to clean up the versions from the "head
  267. // commit" information and combined into a single entry for x.x.x.x
  268. if($p=='Diaspora') {
  269. $newV = array();
  270. $newVv = array();
  271. foreach($v as $vv) {
  272. $newVC = $vv['total'];
  273. $newVV = $vv['version'];
  274. $posDash = strpos($newVV, '-');
  275. if($posDash)
  276. $newVV = substr($newVV, 0, $posDash);
  277. if(isset($newV[$newVV]))
  278. $newV[$newVV] += $newVC;
  279. else
  280. $newV[$newVV] = $newVC;
  281. }
  282. foreach ($newV as $key => $value) {
  283. array_push($newVv, array('total'=>$value, 'version'=>$key));
  284. }
  285. $v = $newVv;
  286. }
  287. // early friendica versions have the format x.x.xxxx where xxxx is the
  288. // DB version stamp; those should be operated out and versions be
  289. // conbined
  290. if($p=='Friendica') {
  291. $newV = array();
  292. $newVv = array();
  293. foreach ($v as $vv) {
  294. $newVC = $vv['total'];
  295. $newVV = $vv['version'];
  296. $lastDot = strrpos($newVV,'.');
  297. $len = strlen($newVV)-1;
  298. if(($lastDot == $len-4) && (!strrpos($newVV,'-rc')==$len-3))
  299. $newVV = substr($newVV, 0, $lastDot);
  300. if(isset($newV[$newVV]))
  301. $newV[$newVV] += $newVC;
  302. else
  303. $newV[$newVV] = $newVC;
  304. }
  305. foreach ($newV as $key => $value) {
  306. array_push($newVv, array('total'=>$value, 'version'=>$key));
  307. }
  308. $v = $newVv;
  309. }
  310. foreach ($v as $key => $vv)
  311. $v[$key]["version"] = trim(strip_tags($vv["version"]));
  312. // the 3rd array item is needed for the JavaScript graphs as JS does
  313. // not like some characters in the names of variables...
  314. $counts[$p]=array($c[0], $v, str_replace(array(' ','%'),'',$p), $colors[$p]);
  315. }
  316. // some helpful text
  317. $intro = t('This page offers you some numbers to the known part of the federated social network your Friendica node is part of. These numbers are not complete but only reflect the part of the network your node is aware of.');
  318. $hint = t('The <em>Auto Discovered Contact Directory</em> feature is not enabled, it will improve the data displayed here.');
  319. // load the template, replace the macros and return the page content
  320. $t = get_markup_template("admin_federation.tpl");
  321. return replace_macros($t, array(
  322. '$title' => t('Administration'),
  323. '$page' => t('Federation Statistics'),
  324. '$intro' => $intro,
  325. '$hint' => $hint,
  326. '$autoactive' => get_config('system', 'poco_completion'),
  327. '$counts' => $counts,
  328. '$version' => FRIENDICA_VERSION,
  329. '$legendtext' => sprintf(t('Currently this node is aware of %d nodes from the following platforms:'), $total),
  330. '$baseurl' => $a->get_baseurl(),
  331. ));
  332. }
  333. /**
  334. * @brief Admin Inspect Queue Page
  335. *
  336. * Generates a page for the admin to have a look into the current queue of
  337. * postings that are not deliverabke. Shown are the name and url of the
  338. * recipient, the delivery network and the dates when the posting was generated
  339. * and the last time tried to deliver the posting.
  340. *
  341. * The returned string holds the content of the page.
  342. *
  343. * @param App $a
  344. * @return string
  345. */
  346. function admin_page_queue(&$a) {
  347. // get content from the queue table
  348. $r = q("SELECT `c`.`name`, `c`.`nurl`, `q`.`id`, `q`.`network`, `q`.`created`, `q`.`last`
  349. FROM `queue` AS `q`, `contact` AS `c`
  350. WHERE `c`.`id` = `q`.`cid`
  351. ORDER BY `q`.`cid`, `q`.`created`;");
  352. $t = get_markup_template("admin_queue.tpl");
  353. return replace_macros($t, array(
  354. '$title' => t('Administration'),
  355. '$page' => t('Inspect Queue'),
  356. '$count' => sizeof($r),
  357. 'id_header' => t('ID'),
  358. '$to_header' => t('Recipient Name'),
  359. '$url_header' => t('Recipient Profile'),
  360. '$network_header' => t('Network'),
  361. '$created_header' => t('Created'),
  362. '$last_header' => t('Last Tried'),
  363. '$info' => t('This page lists the content of the queue for outgoing postings. These are postings the initial delivery failed for. They will be resend later and eventually deleted if the delivery fails permanently.'),
  364. '$entries' => $r,
  365. ));
  366. }
  367. /**
  368. * @brief Admin Summary Page
  369. *
  370. * The summary page is the "start page" of the admin panel. It gives the admin
  371. * a first overview of the open adminastrative tasks.
  372. *
  373. * The returned string contains the HTML content of the generated page.
  374. *
  375. * @param App $a
  376. * @return string
  377. */
  378. function admin_page_summary(&$a) {
  379. $r = q("SELECT `page-flags`, COUNT(`uid`) AS `count` FROM `user` GROUP BY `page-flags`");
  380. $accounts = array(
  381. array(t('Normal Account'), 0),
  382. array(t('Soapbox Account'), 0),
  383. array(t('Community/Celebrity Account'), 0),
  384. array(t('Automatic Friend Account'), 0),
  385. array(t('Blog Account'), 0),
  386. array(t('Private Forum'), 0)
  387. );
  388. $users=0;
  389. foreach ($r as $u){ $accounts[$u['page-flags']][1] = $u['count']; $users+= $u['count']; }
  390. logger('accounts: '.print_r($accounts,true),LOGGER_DATA);
  391. $r = q("SELECT COUNT(`id`) AS `count` FROM `register`");
  392. $pending = $r[0]['count'];
  393. $r = q("SELECT COUNT(*) AS `total` FROM `deliverq` WHERE 1");
  394. $deliverq = (($r) ? $r[0]['total'] : 0);
  395. $r = q("SELECT COUNT(*) AS `total` FROM `queue` WHERE 1");
  396. $queue = (($r) ? $r[0]['total'] : 0);
  397. if (get_config('system','worker')) {
  398. $r = q("SELECT COUNT(*) AS `total` FROM `workerqueue` WHERE 1");
  399. $workerqueue = (($r) ? $r[0]['total'] : 0);
  400. } else {
  401. $workerqueue = 0;
  402. }
  403. // We can do better, but this is a quick queue status
  404. $queues = array('label' => t('Message queues'), 'deliverq' => $deliverq, 'queue' => $queue, 'workerq' => $workerqueue);
  405. $t = get_markup_template("admin_summary.tpl");
  406. return replace_macros($t, array(
  407. '$title' => t('Administration'),
  408. '$page' => t('Summary'),
  409. '$queues' => $queues,
  410. '$workeractive' => get_config('system','worker'),
  411. '$users' => array(t('Registered users'), $users),
  412. '$accounts' => $accounts,
  413. '$pending' => array(t('Pending registrations'), $pending),
  414. '$version' => array(t('Version'), FRIENDICA_VERSION),
  415. '$baseurl' => $a->get_baseurl(),
  416. '$platform' => FRIENDICA_PLATFORM,
  417. '$codename' => FRIENDICA_CODENAME,
  418. '$build' => get_config('system','build'),
  419. '$plugins' => array(t('Active plugins'), $a->plugins)
  420. ));
  421. }
  422. /**
  423. * @brief Process send data from Admin Site Page
  424. *
  425. * @param App $a
  426. */
  427. function admin_page_site_post(&$a) {
  428. if(!x($_POST,"page_site")) {
  429. return;
  430. }
  431. check_form_security_token_redirectOnErr('/admin/site', 'admin_site');
  432. // relocate
  433. if(x($_POST,'relocate') && x($_POST,'relocate_url') && $_POST['relocate_url']!="") {
  434. $new_url = $_POST['relocate_url'];
  435. $new_url = rtrim($new_url,"/");
  436. $parsed = @parse_url($new_url);
  437. if(!$parsed || (!x($parsed,'host') || !x($parsed,'scheme'))) {
  438. notice(t("Can not parse base url. Must have at least <scheme>://<domain>"));
  439. goaway('admin/site');
  440. }
  441. /* steps:
  442. * replace all "baseurl" to "new_url" in config, profile, term, items and contacts
  443. * send relocate for every local user
  444. * */
  445. $old_url = $a->get_baseurl(true);
  446. // Generate host names for relocation the addresses in the format user@address.tld
  447. $new_host = str_replace("http://", "@", normalise_link($new_url));
  448. $old_host = str_replace("http://", "@", normalise_link($old_url));
  449. function update_table($table_name, $fields, $old_url, $new_url) {
  450. global $db, $a;
  451. $dbold = dbesc($old_url);
  452. $dbnew = dbesc($new_url);
  453. $upd = array();
  454. foreach ($fields as $f) {
  455. $upd[] = "`$f` = REPLACE(`$f`, '$dbold', '$dbnew')";
  456. }
  457. $upds = implode(", ", $upd);
  458. $q = sprintf("UPDATE %s SET %s;", $table_name, $upds);
  459. $r = q($q);
  460. if(!$r) {
  461. notice("Failed updating '$table_name': ".$db->error);
  462. goaway('admin/site');
  463. }
  464. }
  465. // update tables
  466. // update profile links in the format "http://server.tld"
  467. update_table("profile", array('photo', 'thumb'), $old_url, $new_url);
  468. update_table("term", array('url'), $old_url, $new_url);
  469. update_table("contact", array('photo','thumb','micro','url','nurl','alias','request','notify','poll','confirm','poco', 'avatar'), $old_url, $new_url);
  470. update_table("gcontact", array('url','nurl','photo','server_url','notify','alias'), $old_url, $new_url);
  471. update_table("item", array('owner-link','owner-avatar','author-link','author-avatar','body','plink','tag'), $old_url, $new_url);
  472. // update profile addresses in the format "user@server.tld"
  473. update_table("contact", array('addr'), $old_host, $new_host);
  474. update_table("gcontact", array('connect','addr'), $old_host, $new_host);
  475. // update config
  476. $a->set_baseurl($new_url);
  477. set_config('system','url',$new_url);
  478. // send relocate
  479. $users = q("SELECT `uid` FROM `user` WHERE `account_removed` = 0 AND `account_expired` = 0");
  480. foreach ($users as $user) {
  481. proc_run(PRIORITY_HIGH, 'include/notifier.php', 'relocate', $user['uid']);
  482. }
  483. info("Relocation started. Could take a while to complete.");
  484. goaway('admin/site');
  485. }
  486. // end relocate
  487. $sitename = ((x($_POST,'sitename')) ? notags(trim($_POST['sitename'])) : '');
  488. $hostname = ((x($_POST,'hostname')) ? notags(trim($_POST['hostname'])) : '');
  489. $sender_email = ((x($_POST,'sender_email')) ? notags(trim($_POST['sender_email'])) : '');
  490. $banner = ((x($_POST,'banner')) ? trim($_POST['banner']) : false);
  491. $shortcut_icon = ((x($_POST,'shortcut_icon')) ? notags(trim($_POST['shortcut_icon'])) : '');
  492. $touch_icon = ((x($_POST,'touch_icon')) ? notags(trim($_POST['touch_icon'])) : '');
  493. $info = ((x($_POST,'info')) ? trim($_POST['info']) : false);
  494. $language = ((x($_POST,'language')) ? notags(trim($_POST['language'])) : '');
  495. $theme = ((x($_POST,'theme')) ? notags(trim($_POST['theme'])) : '');
  496. $theme_mobile = ((x($_POST,'theme_mobile')) ? notags(trim($_POST['theme_mobile'])) : '');
  497. $maximagesize = ((x($_POST,'maximagesize')) ? intval(trim($_POST['maximagesize'])) : 0);
  498. $maximagelength = ((x($_POST,'maximagelength')) ? intval(trim($_POST['maximagelength'])) : MAX_IMAGE_LENGTH);
  499. $jpegimagequality = ((x($_POST,'jpegimagequality')) ? intval(trim($_POST['jpegimagequality'])) : JPEG_QUALITY);
  500. $register_policy = ((x($_POST,'register_policy')) ? intval(trim($_POST['register_policy'])) : 0);
  501. $daily_registrations = ((x($_POST,'max_daily_registrations')) ? intval(trim($_POST['max_daily_registrations'])) :0);
  502. $abandon_days = ((x($_POST,'abandon_days')) ? intval(trim($_POST['abandon_days'])) : 0);
  503. $register_text = ((x($_POST,'register_text')) ? notags(trim($_POST['register_text'])) : '');
  504. $allowed_sites = ((x($_POST,'allowed_sites')) ? notags(trim($_POST['allowed_sites'])) : '');
  505. $allowed_email = ((x($_POST,'allowed_email')) ? notags(trim($_POST['allowed_email'])) : '');
  506. $block_public = ((x($_POST,'block_public')) ? True : False);
  507. $force_publish = ((x($_POST,'publish_all')) ? True : False);
  508. $global_directory = ((x($_POST,'directory')) ? notags(trim($_POST['directory'])) : '');
  509. $thread_allow = ((x($_POST,'thread_allow')) ? True : False);
  510. $newuser_private = ((x($_POST,'newuser_private')) ? True : False);
  511. $enotify_no_content = ((x($_POST,'enotify_no_content')) ? True : False);
  512. $private_addons = ((x($_POST,'private_addons')) ? True : False);
  513. $disable_embedded = ((x($_POST,'disable_embedded')) ? True : False);
  514. $allow_users_remote_self = ((x($_POST,'allow_users_remote_self')) ? True : False);
  515. $no_multi_reg = ((x($_POST,'no_multi_reg')) ? True : False);
  516. $no_openid = !((x($_POST,'no_openid')) ? True : False);
  517. $no_regfullname = !((x($_POST,'no_regfullname')) ? True : False);
  518. $no_utf = !((x($_POST,'no_utf')) ? True : False);
  519. $community_page_style = ((x($_POST,'community_page_style')) ? intval(trim($_POST['community_page_style'])) : 0);
  520. $max_author_posts_community_page = ((x($_POST,'max_author_posts_community_page')) ? intval(trim($_POST['max_author_posts_community_page'])) : 0);
  521. $verifyssl = ((x($_POST,'verifyssl')) ? True : False);
  522. $proxyuser = ((x($_POST,'proxyuser')) ? notags(trim($_POST['proxyuser'])) : '');
  523. $proxy = ((x($_POST,'proxy')) ? notags(trim($_POST['proxy'])) : '');
  524. $timeout = ((x($_POST,'timeout')) ? intval(trim($_POST['timeout'])) : 60);
  525. $delivery_interval = ((x($_POST,'delivery_interval')) ? intval(trim($_POST['delivery_interval'])) : 0);
  526. $poll_interval = ((x($_POST,'poll_interval')) ? intval(trim($_POST['poll_interval'])) : 0);
  527. $maxloadavg = ((x($_POST,'maxloadavg')) ? intval(trim($_POST['maxloadavg'])) : 50);
  528. $maxloadavg_frontend = ((x($_POST,'maxloadavg_frontend')) ? intval(trim($_POST['maxloadavg_frontend'])) : 50);
  529. $optimize_max_tablesize = ((x($_POST,'optimize_max_tablesize')) ? intval(trim($_POST['optimize_max_tablesize'])): 100);
  530. $optimize_fragmentation = ((x($_POST,'optimize_fragmentation')) ? intval(trim($_POST['optimize_fragmentation'])): 30);
  531. $poco_completion = ((x($_POST,'poco_completion')) ? intval(trim($_POST['poco_completion'])) : false);
  532. $poco_requery_days = ((x($_POST,'poco_requery_days')) ? intval(trim($_POST['poco_requery_days'])) : 7);
  533. $poco_discovery = ((x($_POST,'poco_discovery')) ? intval(trim($_POST['poco_discovery'])) : 0);
  534. $poco_discovery_since = ((x($_POST,'poco_discovery_since')) ? intval(trim($_POST['poco_discovery_since'])) : 30);
  535. $poco_local_search = ((x($_POST,'poco_local_search')) ? intval(trim($_POST['poco_local_search'])) : false);
  536. $nodeinfo = ((x($_POST,'nodeinfo')) ? intval(trim($_POST['nodeinfo'])) : false);
  537. $dfrn_only = ((x($_POST,'dfrn_only')) ? True : False);
  538. $ostatus_disabled = !((x($_POST,'ostatus_disabled')) ? True : False);
  539. $ostatus_poll_interval = ((x($_POST,'ostatus_poll_interval')) ? intval(trim($_POST['ostatus_poll_interval'])) : 0);
  540. $ostatus_full_threads = ((x($_POST,'ostatus_full_threads')) ? True : False);
  541. $diaspora_enabled = ((x($_POST,'diaspora_enabled')) ? True : False);
  542. $ssl_policy = ((x($_POST,'ssl_policy')) ? intval($_POST['ssl_policy']) : 0);
  543. $force_ssl = ((x($_POST,'force_ssl')) ? True : False);
  544. $old_share = ((x($_POST,'old_share')) ? True : False);
  545. $hide_help = ((x($_POST,'hide_help')) ? True : False);
  546. $suppress_language = ((x($_POST,'suppress_language')) ? True : False);
  547. $suppress_tags = ((x($_POST,'suppress_tags')) ? True : False);
  548. $use_fulltext_engine = ((x($_POST,'use_fulltext_engine')) ? True : False);
  549. $itemcache = ((x($_POST,'itemcache')) ? notags(trim($_POST['itemcache'])) : '');
  550. $itemcache_duration = ((x($_POST,'itemcache_duration')) ? intval($_POST['itemcache_duration']) : 0);
  551. $max_comments = ((x($_POST,'max_comments')) ? intval($_POST['max_comments']) : 0);
  552. $lockpath = ((x($_POST,'lockpath')) ? notags(trim($_POST['lockpath'])) : '');
  553. $temppath = ((x($_POST,'temppath')) ? notags(trim($_POST['temppath'])) : '');
  554. $basepath = ((x($_POST,'basepath')) ? notags(trim($_POST['basepath'])) : '');
  555. $singleuser = ((x($_POST,'singleuser')) ? notags(trim($_POST['singleuser'])) : '');
  556. $proxy_disabled = ((x($_POST,'proxy_disabled')) ? True : False);
  557. $old_pager = ((x($_POST,'old_pager')) ? True : False);
  558. $only_tag_search = ((x($_POST,'only_tag_search')) ? True : False);
  559. $rino = ((x($_POST,'rino')) ? intval($_POST['rino']) : 0);
  560. $embedly = ((x($_POST,'embedly')) ? notags(trim($_POST['embedly'])) : '');
  561. $worker = ((x($_POST,'worker')) ? True : False);
  562. $worker_queues = ((x($_POST,'worker_queues')) ? intval($_POST['worker_queues']) : 4);
  563. $worker_dont_fork = ((x($_POST,'worker_dont_fork')) ? True : False);
  564. $worker_fastlane = ((x($_POST,'worker_fastlane')) ? True : False);
  565. if($a->get_path() != "")
  566. $diaspora_enabled = false;
  567. if(!$thread_allow)
  568. $ostatus_disabled = true;
  569. if($ssl_policy != intval(get_config('system','ssl_policy'))) {
  570. if($ssl_policy == SSL_POLICY_FULL) {
  571. q("UPDATE `contact` SET
  572. `url` = REPLACE(`url` , 'http:' , 'https:'),
  573. `photo` = REPLACE(`photo` , 'http:' , 'https:'),
  574. `thumb` = REPLACE(`thumb` , 'http:' , 'https:'),
  575. `micro` = REPLACE(`micro` , 'http:' , 'https:'),
  576. `request` = REPLACE(`request`, 'http:' , 'https:'),
  577. `notify` = REPLACE(`notify` , 'http:' , 'https:'),
  578. `poll` = REPLACE(`poll` , 'http:' , 'https:'),
  579. `confirm` = REPLACE(`confirm`, 'http:' , 'https:'),
  580. `poco` = REPLACE(`poco` , 'http:' , 'https:')
  581. WHERE `self` = 1"
  582. );
  583. q("UPDATE `profile` SET
  584. `photo` = REPLACE(`photo` , 'http:' , 'https:'),
  585. `thumb` = REPLACE(`thumb` , 'http:' , 'https:')
  586. WHERE 1 "
  587. );
  588. }
  589. elseif($ssl_policy == SSL_POLICY_SELFSIGN) {
  590. q("UPDATE `contact` SET
  591. `url` = REPLACE(`url` , 'https:' , 'http:'),
  592. `photo` = REPLACE(`photo` , 'https:' , 'http:'),
  593. `thumb` = REPLACE(`thumb` , 'https:' , 'http:'),
  594. `micro` = REPLACE(`micro` , 'https:' , 'http:'),
  595. `request` = REPLACE(`request`, 'https:' , 'http:'),
  596. `notify` = REPLACE(`notify` , 'https:' , 'http:'),
  597. `poll` = REPLACE(`poll` , 'https:' , 'http:'),
  598. `confirm` = REPLACE(`confirm`, 'https:' , 'http:'),
  599. `poco` = REPLACE(`poco` , 'https:' , 'http:')
  600. WHERE `self` = 1"
  601. );
  602. q("UPDATE `profile` SET
  603. `photo` = REPLACE(`photo` , 'https:' , 'http:'),
  604. `thumb` = REPLACE(`thumb` , 'https:' , 'http:')
  605. WHERE 1 "
  606. );
  607. }
  608. }
  609. set_config('system','ssl_policy',$ssl_policy);
  610. set_config('system','delivery_interval',$delivery_interval);
  611. set_config('system','poll_interval',$poll_interval);
  612. set_config('system','maxloadavg',$maxloadavg);
  613. set_config('system','maxloadavg_frontend',$maxloadavg_frontend);
  614. set_config('system','optimize_max_tablesize',$optimize_max_tablesize);
  615. set_config('system','optimize_fragmentation',$optimize_fragmentation);
  616. set_config('system','poco_completion',$poco_completion);
  617. set_config('system','poco_requery_days',$poco_requery_days);
  618. set_config('system','poco_discovery',$poco_discovery);
  619. set_config('system','poco_discovery_since',$poco_discovery_since);
  620. set_config('system','poco_local_search',$poco_local_search);
  621. set_config('system','nodeinfo',$nodeinfo);
  622. set_config('config','sitename',$sitename);
  623. set_config('config','hostname',$hostname);
  624. set_config('config','sender_email', $sender_email);
  625. set_config('system','suppress_language',$suppress_language);
  626. set_config('system','suppress_tags',$suppress_tags);
  627. set_config('system','shortcut_icon',$shortcut_icon);
  628. set_config('system','touch_icon',$touch_icon);
  629. if($banner=="") {
  630. // don't know why, but del_config doesn't work...
  631. q("DELETE FROM `config` WHERE `cat` = '%s' AND `k` = '%s' LIMIT 1",
  632. dbesc("system"),
  633. dbesc("banner")
  634. );
  635. } else {
  636. set_config('system','banner', $banner);
  637. }
  638. if($info=="") {
  639. del_config('config','info');
  640. } else {
  641. set_config('config','info',$info);
  642. }
  643. set_config('system','language', $language);
  644. set_config('system','theme', $theme);
  645. if($theme_mobile === '---') {
  646. del_config('system','mobile-theme');
  647. } else {
  648. set_config('system','mobile-theme', $theme_mobile);
  649. }
  650. if($singleuser === '---') {
  651. del_config('system','singleuser');
  652. } else {
  653. set_config('system','singleuser', $singleuser);
  654. }
  655. set_config('system','maximagesize', $maximagesize);
  656. set_config('system','max_image_length', $maximagelength);
  657. set_config('system','jpeg_quality', $jpegimagequality);
  658. set_config('config','register_policy', $register_policy);
  659. set_config('system','max_daily_registrations', $daily_registrations);
  660. set_config('system','account_abandon_days', $abandon_days);
  661. set_config('config','register_text', $register_text);
  662. set_config('system','allowed_sites', $allowed_sites);
  663. set_config('system','allowed_email', $allowed_email);
  664. set_config('system','block_public', $block_public);
  665. set_config('system','publish_all', $force_publish);
  666. set_config('system','directory', $global_directory);
  667. set_config('system','thread_allow', $thread_allow);
  668. set_config('system','newuser_private', $newuser_private);
  669. set_config('system','enotify_no_content', $enotify_no_content);
  670. set_config('system','disable_embedded', $disable_embedded);
  671. set_config('system','allow_users_remote_self', $allow_users_remote_self);
  672. set_config('system','block_extended_register', $no_multi_reg);
  673. set_config('system','no_openid', $no_openid);
  674. set_config('system','no_regfullname', $no_regfullname);
  675. set_config('system','community_page_style', $community_page_style);
  676. set_config('system','max_author_posts_community_page', $max_author_posts_community_page);
  677. set_config('system','no_utf', $no_utf);
  678. set_config('system','verifyssl', $verifyssl);
  679. set_config('system','proxyuser', $proxyuser);
  680. set_config('system','proxy', $proxy);
  681. set_config('system','curl_timeout', $timeout);
  682. set_config('system','dfrn_only', $dfrn_only);
  683. set_config('system','ostatus_disabled', $ostatus_disabled);
  684. set_config('system','ostatus_poll_interval', $ostatus_poll_interval);
  685. set_config('system','ostatus_full_threads', $ostatus_full_threads);
  686. set_config('system','diaspora_enabled', $diaspora_enabled);
  687. set_config('config','private_addons', $private_addons);
  688. set_config('system','force_ssl', $force_ssl);
  689. set_config('system','old_share', $old_share);
  690. set_config('system','hide_help', $hide_help);
  691. set_config('system','use_fulltext_engine', $use_fulltext_engine);
  692. set_config('system','itemcache', $itemcache);
  693. set_config('system','itemcache_duration', $itemcache_duration);
  694. set_config('system','max_comments', $max_comments);
  695. set_config('system','lockpath', $lockpath);
  696. set_config('system','temppath', $temppath);
  697. set_config('system','basepath', $basepath);
  698. set_config('system','proxy_disabled', $proxy_disabled);
  699. set_config('system','old_pager', $old_pager);
  700. set_config('system','only_tag_search', $only_tag_search);
  701. set_config('system','worker', $worker);
  702. set_config('system','worker_queues', $worker_queues);
  703. set_config('system','worker_dont_fork', $worker_dont_fork);
  704. set_config('system','worker_fastlane', $worker_fastlane);
  705. if($rino==2 and !function_exists('mcrypt_create_iv')) {
  706. notice(t("RINO2 needs mcrypt php extension to work."));
  707. } else {
  708. set_config('system','rino_encrypt', $rino);
  709. }
  710. set_config('system','embedly', $embedly);
  711. info(t('Site settings updated.').EOL);
  712. goaway('admin/site');
  713. return; // NOTREACHED
  714. }
  715. /**
  716. * @brief Generate Admin Site subpage
  717. *
  718. * This function generates the main configuration page of the admin panel.
  719. *
  720. * @param App $a
  721. * @return string
  722. */
  723. function admin_page_site(&$a) {
  724. /* Installed langs */
  725. $lang_choices = get_available_languages();
  726. if(strlen(get_config('system','directory_submit_url')) AND
  727. !strlen(get_config('system','directory'))) {
  728. set_config('system','directory', dirname(get_config('system','directory_submit_url')));
  729. del_config('system','directory_submit_url');
  730. }
  731. /* Installed themes */
  732. $theme_choices = array();
  733. $theme_choices_mobile = array();
  734. $theme_choices_mobile["---"] = t("No special theme for mobile devices");
  735. $files = glob('view/theme/*');
  736. if($files) {
  737. foreach($files as $file) {
  738. if(intval(file_exists($file.'/unsupported')))
  739. continue;
  740. $f = basename($file);
  741. $theme_name = ((file_exists($file.'/experimental')) ? sprintf("%s - \x28Experimental\x29", $f) : $f);
  742. if(file_exists($file.'/mobile')) {
  743. $theme_choices_mobile[$f] = $theme_name;
  744. } else {
  745. $theme_choices[$f] = $theme_name;
  746. }
  747. }
  748. }
  749. /* Community page style */
  750. $community_page_style_choices = array(
  751. CP_NO_COMMUNITY_PAGE => t("No community page"),
  752. CP_USERS_ON_SERVER => t("Public postings from users of this site"),
  753. CP_GLOBAL_COMMUNITY => t("Global community page")
  754. );
  755. /* OStatus conversation poll choices */
  756. $ostatus_poll_choices = array(
  757. "-2" => t("Never"),
  758. "-1" => t("At post arrival"),
  759. "0" => t("Frequently"),
  760. "60" => t("Hourly"),
  761. "720" => t("Twice daily"),
  762. "1440" => t("Daily")
  763. );
  764. $poco_discovery_choices = array(
  765. "0" => t("Disabled"),
  766. "1" => t("Users"),
  767. "2" => t("Users, Global Contacts"),
  768. "3" => t("Users, Global Contacts/fallback"),
  769. );
  770. $poco_discovery_since_choices = array(
  771. "30" => t("One month"),
  772. "91" => t("Three months"),
  773. "182" => t("Half a year"),
  774. "365" => t("One year"),
  775. );
  776. /* get user names to make the install a personal install of X */
  777. $user_names = array();
  778. $user_names['---'] = t('Multi user instance');
  779. $users = q("SELECT `username`, `nickname` FROM `user`");
  780. foreach ($users as $user) {
  781. $user_names[$user['nickname']] = $user['username'];
  782. }
  783. /* Banner */
  784. $banner = get_config('system','banner');
  785. if($banner == false)
  786. $banner = '<a href="http://friendica.com"><img id="logo-img" src="images/friendica-32.png" alt="logo" /></a><span id="logo-text"><a href="http://friendica.com">Friendica</a></span>';
  787. $banner = htmlspecialchars($banner);
  788. $info = get_config('config','info');
  789. $info = htmlspecialchars($info);
  790. // Automatically create temporary paths
  791. get_temppath();
  792. get_lockpath();
  793. get_itemcachepath();
  794. //echo "<pre>"; var_dump($lang_choices); die("</pre>");
  795. /* Register policy */
  796. $register_choices = array(
  797. REGISTER_CLOSED => t("Closed"),
  798. REGISTER_APPROVE => t("Requires approval"),
  799. REGISTER_OPEN => t("Open")
  800. );
  801. $ssl_choices = array(
  802. SSL_POLICY_NONE => t("No SSL policy, links will track page SSL state"),
  803. SSL_POLICY_FULL => t("Force all links to use SSL"),
  804. SSL_POLICY_SELFSIGN => t("Self-signed certificate, use SSL for local links only (discouraged)")
  805. );
  806. if($a->config['hostname'] == "")
  807. $a->config['hostname'] = $a->get_hostname();
  808. $diaspora_able = ($a->get_path() == "");
  809. $t = get_markup_template("admin_site.tpl");
  810. return replace_macros($t, array(
  811. '$title' => t('Administration'),
  812. '$page' => t('Site'),
  813. '$submit' => t('Save Settings'),
  814. '$registration' => t('Registration'),
  815. '$upload' => t('File upload'),
  816. '$corporate' => t('Policies'),
  817. '$advanced' => t('Advanced'),
  818. '$portable_contacts' => t('Auto Discovered Contact Directory'),
  819. '$performance' => t('Performance'),
  820. '$worker_title' => t('Worker'),
  821. '$relocate'=> t('Relocate - WARNING: advanced function. Could make this server unreachable.'),
  822. '$baseurl' => $a->get_baseurl(true),
  823. // name, label, value, help string, extra data...
  824. '$sitename' => array('sitename', t("Site name"), $a->config['sitename'],''),
  825. '$hostname' => array('hostname', t("Host name"), $a->config['hostname'], ""),
  826. '$sender_email' => array('sender_email', t("Sender Email"), $a->config['sender_email'], t("The email address your server shall use to send notification emails from."), "", "", "email"),
  827. '$banner' => array('banner', t("Banner/Logo"), $banner, ""),
  828. '$shortcut_icon' => array('shortcut_icon', t("Shortcut icon"), get_config('system','shortcut_icon'), t("Link to an icon that will be used for browsers.")),
  829. '$touch_icon' => array('touch_icon', t("Touch icon"), get_config('system','touch_icon'), t("Link to an icon that will be used for tablets and mobiles.")),
  830. '$info' => array('info',t('Additional Info'), $info, sprintf(t('For public servers: you can add additional information here that will be listed at %s/siteinfo.'), get_server())),
  831. '$language' => array('language', t("System language"), get_config('system','language'), "", $lang_choices),
  832. '$theme' => array('theme', t("System theme"), get_config('system','theme'), t("Default system theme - may be over-ridden by user profiles - <a href='#' id='cnftheme'>change theme settings</a>"), $theme_choices),
  833. '$theme_mobile' => array('theme_mobile', t("Mobile system theme"), get_config('system','mobile-theme'), t("Theme for mobile devices"), $theme_choices_mobile),
  834. '$ssl_policy' => array('ssl_policy', t("SSL link policy"), (string) intval(get_config('system','ssl_policy')), t("Determines whether generated links should be forced to use SSL"), $ssl_choices),
  835. '$force_ssl' => array('force_ssl', t("Force SSL"), get_config('system','force_ssl'), t("Force all Non-SSL requests to SSL - Attention: on some systems it could lead to endless loops.")),
  836. '$old_share' => array('old_share', t("Old style 'Share'"), get_config('system','old_share'), t("Deactivates the bbcode element 'share' for repeating items.")),
  837. '$hide_help' => array('hide_help', t("Hide help entry from navigation menu"), get_config('system','hide_help'), t("Hides the menu entry for the Help pages from the navigation menu. You can still access it calling /help directly.")),
  838. '$singleuser' => array('singleuser', t("Single user instance"), get_config('system','singleuser'), t("Make this instance multi-user or single-user for the named user"), $user_names),
  839. '$maximagesize' => array('maximagesize', t("Maximum image size"), get_config('system','maximagesize'), t("Maximum size in bytes of uploaded images. Default is 0, which means no limits.")),
  840. '$maximagelength' => array('maximagelength', t("Maximum image length"), get_config('system','max_image_length'), t("Maximum length in pixels of the longest side of uploaded images. Default is -1, which means no limits.")),
  841. '$jpegimagequality' => array('jpegimagequality', t("JPEG image quality"), get_config('system','jpeg_quality'), t("Uploaded JPEGS will be saved at this quality setting [0-100]. Default is 100, which is full quality.")),
  842. '$register_policy' => array('register_policy', t("Register policy"), $a->config['register_policy'], "", $register_choices),
  843. '$daily_registrations' => array('max_daily_registrations', t("Maximum Daily Registrations"), get_config('system', 'max_daily_registrations'), 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.")),
  844. '$register_text' => array('register_text', t("Register text"), $a->config['register_text'], t("Will be displayed prominently on the registration page.")),
  845. '$abandon_days' => array('abandon_days', t('Accounts abandoned after x days'), get_config('system','account_abandon_days'), t('Will not waste system resources polling external sites for abandonded accounts. Enter 0 for no time limit.')),
  846. '$allowed_sites' => array('allowed_sites', t("Allowed friend domains"), get_config('system','allowed_sites'), t("Comma separated list of domains which are allowed to establish friendships with this site. Wildcards are accepted. Empty to allow any domains")),
  847. '$allowed_email' => array('allowed_email', t("Allowed email domains"), get_config('system','allowed_email'), 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")),
  848. '$block_public' => array('block_public', t("Block public"), get_config('system','block_public'), t("Check to block public access to all otherwise public personal pages on this site unless you are currently logged in.")),
  849. '$force_publish' => array('publish_all', t("Force publish"), get_config('system','publish_all'), t("Check to force all profiles on this site to be listed in the site directory.")),
  850. '$global_directory' => array('directory', t("Global directory URL"), get_config('system','directory'), t("URL to the global directory. If this is not set, the global directory is completely unavailable to the application.")),
  851. '$thread_allow' => array('thread_allow', t("Allow threaded items"), get_config('system','thread_allow'), t("Allow infinite level threading for items on this site.")),
  852. '$newuser_private' => array('newuser_private', t("Private posts by default for new users"), get_config('system','newuser_private'), t("Set default post permissions for all new members to the default privacy group rather than public.")),
  853. '$enotify_no_content' => array('enotify_no_content', t("Don't include post content in email notifications"), get_config('system','enotify_no_content'), 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.")),
  854. '$private_addons' => array('private_addons', t("Disallow public access to addons listed in the apps menu."), get_config('config','private_addons'), t("Checking this box will restrict addons listed in the apps menu to members only.")),
  855. '$disable_embedded' => array('disable_embedded', t("Don't embed private images in posts"), get_config('system','disable_embedded'), 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.")),
  856. '$allow_users_remote_self' => array('allow_users_remote_self', t('Allow Users to set remote_self'), get_config('system','allow_users_remote_self'), 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.')),
  857. '$no_multi_reg' => array('no_multi_reg', t("Block multiple registrations"), get_config('system','block_extended_register'), t("Disallow users to register additional accounts for use as pages.")),
  858. '$no_openid' => array('no_openid', t("OpenID support"), !get_config('system','no_openid'), t("OpenID support for registration and logins.")),
  859. '$no_regfullname' => array('no_regfullname', t("Fullname check"), !get_config('system','no_regfullname'), t("Force users to register with a space between firstname and lastname in Full name, as an antispam measure")),
  860. '$no_utf' => array('no_utf', t("UTF-8 Regular expressions"), !get_config('system','no_utf'), t("Use PHP UTF8 regular expressions")),
  861. '$community_page_style' => array('community_page_style', t("Community Page Style"), get_config('system','community_page_style'), t("Type of community page to show. 'Global community' shows every public posting from an open distributed network that arrived on this server."), $community_page_style_choices),
  862. '$max_author_posts_community_page' => array('max_author_posts_community_page', t("Posts per user on community page"), get_config('system','max_author_posts_community_page'), t("The maximum number of posts per user on the community page. (Not valid for 'Global Community')")),
  863. '$ostatus_disabled' => array('ostatus_disabled', t("Enable OStatus support"), !get_config('system','ostatus_disabled'), t("Provide built-in OStatus \x28StatusNet, GNU Social etc.\x29 compatibility. All communications in OStatus are public, so privacy warnings will be occasionally displayed.")),
  864. '$ostatus_poll_interval' => array('ostatus_poll_interval', t("OStatus conversation completion interval"), (string) intval(get_config('system','ostatus_poll_interval')), t("How often shall the poller check for new entries in OStatus conversations? This can be a very ressource task."), $ostatus_poll_choices),
  865. '$ostatus_full_threads' => array('ostatus_full_threads', t("Only import OStatus threads from our contacts"), get_config('system','ostatus_full_threads'), t("Normally we import every content from our OStatus contacts. With this option we only store threads that are started by a contact that is known on our system.")),
  866. '$ostatus_not_able' => t("OStatus support can only be enabled if threading is enabled."),
  867. '$diaspora_able' => $diaspora_able,
  868. '$diaspora_not_able' => t("Diaspora support can't be enabled because Friendica was installed into a sub directory."),
  869. '$diaspora_enabled' => array('diaspora_enabled', t("Enable Diaspora support"), get_config('system','diaspora_enabled'), t("Provide built-in Diaspora network compatibility.")),
  870. '$dfrn_only' => array('dfrn_only', t('Only allow Friendica contacts'), get_config('system','dfrn_only'), t("All contacts must use Friendica protocols. All other built-in communication protocols disabled.")),
  871. '$verifyssl' => array('verifyssl', t("Verify SSL"), get_config('system','verifyssl'), t("If you wish, you can turn on strict certificate checking. This will mean you cannot connect (at all) to self-signed SSL sites.")),
  872. '$proxyuser' => array('proxyuser', t("Proxy user"), get_config('system','proxyuser'), ""),
  873. '$proxy' => array('proxy', t("Proxy URL"), get_config('system','proxy'), ""),
  874. '$timeout' => array('timeout', t("Network timeout"), (x(get_config('system','curl_timeout'))?get_config('system','curl_timeout'):60), t("Value is in seconds. Set to 0 for unlimited (not recommended).")),
  875. '$delivery_interval' => array('delivery_interval', t("Delivery interval"), (x(get_config('system','delivery_interval'))?get_config('system','delivery_interval'):2), t("Delay background delivery processes by this many seconds to reduce system load. Recommend: 4-5 for shared hosts, 2-3 for virtual private servers. 0-1 for large dedicated servers.")),
  876. '$poll_interval' => array('poll_interval', t("Poll interval"), (x(get_config('system','poll_interval'))?get_config('system','poll_interval'):2), t("Delay background polling processes by this many seconds to reduce system load. If 0, use delivery interval.")),
  877. '$maxloadavg' => array('maxloadavg', t("Maximum Load Average"), ((intval(get_config('system','maxloadavg')) > 0)?get_config('system','maxloadavg'):50), t("Maximum system load before delivery and poll processes are deferred - default 50.")),
  878. '$maxloadavg_frontend' => array('maxloadavg_frontend', t("Maximum Load Average (Frontend)"), ((intval(get_config('system','maxloadavg_frontend')) > 0)?get_config('system','maxloadavg_frontend'):50), t("Maximum system load before the frontend quits service - default 50.")),
  879. '$optimize_max_tablesize'=> array('optimize_max_tablesize', t("Maximum table size for optimization"), ((intval(get_config('system','optimize_max_tablesize')) > 0)?get_config('system','optimize_max_tablesize'):100), t("Maximum table size (in MB) for the automatic optimization - default 100 MB. Enter -1 to disable it.")),
  880. '$optimize_fragmentation'=> array('optimize_fragmentation', t("Minimum level of fragmentation"), ((intval(get_config('system','optimize_fragmentation')) > 0)?get_config('system','optimize_fragmentation'):30), t("Minimum fragmenation level to start the automatic optimization - default value is 30%.")),
  881. '$poco_completion' => array('poco_completion', t("Periodical check of global contacts"), get_config('system','poco_completion'), t("If enabled, the global contacts are checked periodically for missing or outdated data and the vitality of the contacts and servers.")),
  882. '$poco_requery_days' => array('poco_requery_days', t("Days between requery"), get_config('system','poco_requery_days'), t("Number of days after which a server is requeried for his contacts.")),
  883. '$poco_discovery' => array('poco_discovery', t("Discover contacts from other servers"), (string) intval(get_config('system','poco_discovery')), 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 recommened setting is 'Users, Global Contacts'."), $poco_discovery_choices),
  884. '$poco_discovery_since' => array('poco_discovery_since', t("Timeframe for fetching global contacts"), (string) intval(get_config('system','poco_discovery_since')), 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),
  885. '$poco_local_search' => array('poco_local_search', t("Search the local directory"), get_config('system','poco_local_search'), 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.")),
  886. '$nodeinfo' => array('nodeinfo', t("Publish server information"), get_config('system','nodeinfo'), 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.")),
  887. '$use_fulltext_engine' => array('use_fulltext_engine', t("Use MySQL full text engine"), get_config('system','use_fulltext_engine'), t("Activates the full text engine. Speeds up search - but can only search for four and more characters.")),
  888. '$suppress_language' => array('suppress_language', t("Suppress Language"), get_config('system','suppress_language'), t("Suppress language information in meta information about a posting.")),
  889. '$suppress_tags' => array('suppress_tags', t("Suppress Tags"), get_config('system','suppress_tags'), t("Suppress showing a list of hashtags at the end of the posting.")),
  890. '$itemcache' => array('itemcache', t("Path to item cache"), get_config('system','itemcache'), t("The item caches buffers generated bbcode and external images.")),
  891. '$itemcache_duration' => array('itemcache_duration', t("Cache duration in seconds"), get_config('system','itemcache_duration'), 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.")),
  892. '$max_comments' => array('max_comments', t("Maximum numbers of comments per post"), get_config('system','max_comments'), t("How much comments should be shown for each post? Default value is 100.")),
  893. '$lockpath' => array('lockpath', t("Path for lock file"), get_config('system','lockpath'), t("The lock file is used to avoid multiple pollers at one time. Only define a folder here.")),
  894. '$temppath' => array('temppath', t("Temp path"), get_config('system','temppath'), t("If you have a restricted system where the webserver can't access the system temp path, enter another path here.")),
  895. '$basepath' => array('basepath', t