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.

2063 lines
83 KiB

10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
6 years ago
6 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
7 years ago
7 years ago
10 years ago
7 years ago
7 years ago
10 years ago
10 years ago
10 years ago
10 years ago
9 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
7 years ago
7 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
9 years ago
10 years ago
7 years ago
10 years ago
10 years ago
6 years ago
10 years ago
10 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
6 years ago
10 years ago
7 years ago
6 years ago
10 years ago
10 years ago
10 years ago
10 years ago
7 years ago
7 years ago
7 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. }
  30. // urls
  31. if ($a->argc > 1) {
  32. switch ($a->argv[1]){
  33. case 'site':
  34. admin_page_site_post($a);
  35. break;
  36. case 'users':
  37. admin_page_users_post($a);
  38. break;
  39. case 'plugins':
  40. if($a->argc > 2 &&
  41. is_file("addon/".$a->argv[2]."/".$a->argv[2].".php")) {
  42. @include_once("addon/".$a->argv[2]."/".$a->argv[2].".php");
  43. if(function_exists($a->argv[2].'_plugin_admin_post')) {
  44. $func = $a->argv[2].'_plugin_admin_post';
  45. $func($a);
  46. }
  47. }
  48. goaway('admin/plugins/'.$a->argv[2]);
  49. return; // NOTREACHED
  50. break;
  51. case 'themes':
  52. if($a->argc < 2) {
  53. if(is_ajax()) return;
  54. goaway('admin/');
  55. return;
  56. }
  57. $theme = $a->argv[2];
  58. if(is_file("view/theme/$theme/config.php")){
  59. function __call_theme_admin_post(&$a, $theme) {
  60. $orig_theme = $a->theme;
  61. $orig_page = $a->page;
  62. $orig_session_theme = $_SESSION['theme'];
  63. require_once("view/theme/$theme/theme.php");
  64. require_once("view/theme/$theme/config.php");
  65. $_SESSION['theme'] = $theme;
  66. $init = $theme."_init";
  67. if(function_exists($init)) $init($a);
  68. if(function_exists("theme_admin_post")) {
  69. $admin_form = theme_admin_post($a);
  70. }
  71. $_SESSION['theme'] = $orig_session_theme;
  72. $a->theme = $orig_theme;
  73. $a->page = $orig_page;
  74. return $admin_form;
  75. }
  76. __call_theme_admin_post($a, $theme);
  77. }
  78. info(t('Theme settings updated.'));
  79. if(is_ajax()) return;
  80. goaway('admin/themes/'.$theme);
  81. return;
  82. break;
  83. case 'features':
  84. admin_page_features_post($a);
  85. break;
  86. case 'logs':
  87. admin_page_logs_post($a);
  88. break;
  89. case 'dbsync':
  90. admin_page_dbsync_post($a);
  91. break;
  92. }
  93. }
  94. goaway('admin');
  95. return; // NOTREACHED
  96. }
  97. /**
  98. * @brief Generates content of the admin panel pages
  99. *
  100. * This function generates the content for the admin panel. It consists of the
  101. * aside menu (same for the entire admin panel) and the code for the soecified
  102. * subpage of the panel.
  103. *
  104. * The structure of the adress is: /admin/subpage/details though "details" is
  105. * only necessary for some subpages, like themes or addons where it is the name
  106. * of one theme resp. addon from which the details should be shown. Content for
  107. * the subpages is generated in separate functions for each of the subpages.
  108. *
  109. * The returned string hold the generated HTML code of the page.
  110. *
  111. * @param App $a
  112. * @return string
  113. */
  114. function admin_content(&$a) {
  115. if(!is_site_admin()) {
  116. return login(false);
  117. }
  118. if (x($_SESSION,'submanage') && intval($_SESSION['submanage'])) {
  119. return "";
  120. }
  121. // APC deactivated, since there are problems with PHP 5.5
  122. //if (function_exists("apc_delete")) {
  123. // $toDelete = new APCIterator('user', APC_ITER_VALUE);
  124. // apc_delete($toDelete);
  125. //}
  126. // Header stuff
  127. $a->page['htmlhead'] .= replace_macros(get_markup_template('admin_settings_head.tpl'), array());
  128. /*
  129. * Side bar links
  130. */
  131. $aside_tools = array();
  132. // array(url, name, extra css classes)
  133. // not part of $aside to make the template more adjustable
  134. $aside_sub = array(
  135. 'site' => array("admin/site/", t("Site") , "site"),
  136. 'users' => array("admin/users/", t("Users") , "users"),
  137. 'plugins'=> array("admin/plugins/", t("Plugins") , "plugins"),
  138. 'themes' => array("admin/themes/", t("Themes") , "themes"),
  139. 'features' => array("admin/features/", t("Additional features") , "features"),
  140. 'dbsync' => array("admin/dbsync/", t('DB updates'), "dbsync"),
  141. 'queue' => array("admin/queue/", t('Inspect Queue'), "queue"),
  142. 'federation' => array("admin/federation/", t('Federation Statistics'), "federation"),
  143. );
  144. /* get plugins admin page */
  145. $r = q("SELECT `name` FROM `addon` WHERE `plugin_admin` = 1 ORDER BY `name`");
  146. $aside_tools['plugins_admin']=array();
  147. foreach ($r as $h){
  148. $plugin =$h['name'];
  149. $aside_tools['plugins_admin'][] = array("admin/plugins/".$plugin, $plugin, "plugin");
  150. // temp plugins with admin
  151. $a->plugins_admin[] = $plugin;
  152. }
  153. $aside_tools['logs'] = array("admin/logs/", t("Logs"), "logs");
  154. $aside_tools['viewlogs'] = array("admin/viewlogs/", t("View Logs"), 'viewlogs');
  155. $aside_tools['diagnostics_probe'] = array('probe/', t('probe address'), 'probe');
  156. $aside_tools['diagnostics_webfinger'] = array('webfinger/', t('check webfinger'), 'webfinger');
  157. $t = get_markup_template("admin_aside.tpl");
  158. $a->page['aside'] .= replace_macros($t, array(
  159. '$admin' => $aside_tools,
  160. '$subpages' => $aside_sub,
  161. '$admtxt' => t('Admin'),
  162. '$plugadmtxt' => t('Plugin Features'),
  163. '$logtxt' => t('Logs'),
  164. '$diagnosticstxt' => t('diagnostics'),
  165. '$h_pending' => t('User registrations waiting for confirmation'),
  166. '$admurl'=> "admin/"
  167. ));
  168. /*
  169. * Page content
  170. */
  171. $o = '';
  172. // urls
  173. if($a->argc > 1) {
  174. switch ($a->argv[1]){
  175. case 'site':
  176. $o = admin_page_site($a);
  177. break;
  178. case 'users':
  179. $o = admin_page_users($a);
  180. break;
  181. case 'plugins':
  182. $o = admin_page_plugins($a);
  183. break;
  184. case 'themes':
  185. $o = admin_page_themes($a);
  186. break;
  187. case 'features':
  188. $o = admin_page_features($a);
  189. break;
  190. case 'logs':
  191. $o = admin_page_logs($a);
  192. break;
  193. case 'viewlogs':
  194. $o = admin_page_viewlogs($a);
  195. break;
  196. case 'dbsync':
  197. $o = admin_page_dbsync($a);
  198. break;
  199. case 'queue':
  200. $o = admin_page_queue($a);
  201. break;
  202. case 'federation':
  203. $o = admin_page_federation($a);
  204. break;
  205. default:
  206. notice(t("Item not found."));
  207. }
  208. } else {
  209. $o = admin_page_summary($a);
  210. }
  211. if(is_ajax()) {
  212. echo $o;
  213. killme();
  214. return '';
  215. } else {
  216. return $o;
  217. }
  218. }
  219. /**
  220. * @brief Subpage with some stats about "the federation" network
  221. *
  222. * This function generates the "Federation Statistics" subpage for the admin
  223. * panel. The page lists some numbers to the part of "The Federation" known to
  224. * the node. This data includes the different connected networks (e.g.
  225. * Diaspora, Hubzilla, GNU Social) and the used versions in the different
  226. * networks.
  227. *
  228. * The returned string contains the HTML code of the subpage for display.
  229. *
  230. * @param App $a
  231. * @return string
  232. */
  233. function admin_page_federation(&$a) {
  234. // get counts on active friendica, diaspora, redmatrix, hubzilla, gnu
  235. // social and statusnet nodes this node is knowing
  236. //
  237. // We are looking for the following platforms in the DB, "Red" should find
  238. // all variants of that platform ID string as the q() function is stripping
  239. // off one % two of them are needed in the query
  240. // Add more platforms if you like, when one returns 0 known nodes it is not
  241. // displayed on the stats page.
  242. $platforms = array('Friendica', 'Diaspora', '%%red%%', 'Hubzilla', 'BlaBlaNet', 'GNU Social', 'StatusNet', 'Mastodon');
  243. $colors = array('Friendica' => '#ffc018', // orange from the logo
  244. 'Diaspora' => '#a1a1a1', // logo is black and white, makes a gray
  245. '%%red%%' => '#c50001', // fire red from the logo
  246. 'Hubzilla' => '#43488a', // blue from the logo
  247. 'BlaBlaNet' => '#3B5998', // blue from the navbar at blablanet-dot-com
  248. 'GNU Social'=> '#a22430', // dark red from the logo
  249. 'StatusNet' => '#789240', // the green from the logo (red and blue have already others
  250. 'Mastodon' => '#1a9df9'); // blue from the Mastodon logo
  251. $counts = array();
  252. $total = 0;
  253. foreach ($platforms as $p) {
  254. // get a total count for the platform, the name and version of the
  255. // highest version and the protocol tpe
  256. $c = qu('SELECT COUNT(*) AS `total`, `platform`, `network`, `version` FROM `gserver`
  257. WHERE `platform` LIKE "%s" AND `last_contact` >= `last_failure`
  258. ORDER BY `version` ASC;', $p);
  259. $total = $total + $c[0]['total'];
  260. // what versions for that platform do we know at all?
  261. // again only the active nodes
  262. $v = qu('SELECT COUNT(*) AS `total`, `version` FROM `gserver`
  263. WHERE `last_contact` >= `last_failure` AND `platform` LIKE "%s"
  264. GROUP BY `version`
  265. ORDER BY `version`;', $p);
  266. //
  267. // clean up version numbers
  268. //
  269. // some platforms do not provide version information, add a unkown there
  270. // to the version string for the displayed list.
  271. foreach ($v as $key => $value) {
  272. if ($v[$key]['version'] == '') {
  273. $v[$key] = array('total'=>$v[$key]['total'], 'version'=>t('unknown'));
  274. }
  275. }
  276. // in the DB the Diaspora versions have the format x.x.x.x-xx the last
  277. // part (-xx) should be removed to clean up the versions from the "head
  278. // commit" information and combined into a single entry for x.x.x.x
  279. if($p=='Diaspora') {
  280. $newV = array();
  281. $newVv = array();
  282. foreach($v as $vv) {
  283. $newVC = $vv['total'];
  284. $newVV = $vv['version'];
  285. $posDash = strpos($newVV, '-');
  286. if($posDash)
  287. $newVV = substr($newVV, 0, $posDash);
  288. if(isset($newV[$newVV]))
  289. $newV[$newVV] += $newVC;
  290. else
  291. $newV[$newVV] = $newVC;
  292. }
  293. foreach ($newV as $key => $value) {
  294. array_push($newVv, array('total'=>$value, 'version'=>$key));
  295. }
  296. $v = $newVv;
  297. }
  298. // early friendica versions have the format x.x.xxxx where xxxx is the
  299. // DB version stamp; those should be operated out and versions be
  300. // conbined
  301. if($p=='Friendica') {
  302. $newV = array();
  303. $newVv = array();
  304. foreach ($v as $vv) {
  305. $newVC = $vv['total'];
  306. $newVV = $vv['version'];
  307. $lastDot = strrpos($newVV,'.');
  308. $len = strlen($newVV)-1;
  309. if(($lastDot == $len-4) && (!strrpos($newVV,'-rc')==$len-3))
  310. $newVV = substr($newVV, 0, $lastDot);
  311. if(isset($newV[$newVV]))
  312. $newV[$newVV] += $newVC;
  313. else
  314. $newV[$newVV] = $newVC;
  315. }
  316. foreach ($newV as $key => $value) {
  317. array_push($newVv, array('total'=>$value, 'version'=>$key));
  318. }
  319. $v = $newVv;
  320. }
  321. foreach ($v as $key => $vv)
  322. $v[$key]["version"] = trim(strip_tags($vv["version"]));
  323. // the 3rd array item is needed for the JavaScript graphs as JS does
  324. // not like some characters in the names of variables...
  325. $counts[$p]=array($c[0], $v, str_replace(array(' ','%'),'',$p), $colors[$p]);
  326. }
  327. // some helpful text
  328. $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.');
  329. $hint = t('The <em>Auto Discovered Contact Directory</em> feature is not enabled, it will improve the data displayed here.');
  330. // load the template, replace the macros and return the page content
  331. $t = get_markup_template("admin_federation.tpl");
  332. return replace_macros($t, array(
  333. '$title' => t('Administration'),
  334. '$page' => t('Federation Statistics'),
  335. '$intro' => $intro,
  336. '$hint' => $hint,
  337. '$autoactive' => get_config('system', 'poco_completion'),
  338. '$counts' => $counts,
  339. '$version' => FRIENDICA_VERSION,
  340. '$legendtext' => sprintf(t('Currently this node is aware of %d nodes from the following platforms:'), $total),
  341. '$baseurl' => App::get_baseurl(),
  342. ));
  343. }
  344. /**
  345. * @brief Admin Inspect Queue Page
  346. *
  347. * Generates a page for the admin to have a look into the current queue of
  348. * postings that are not deliverabke. Shown are the name and url of the
  349. * recipient, the delivery network and the dates when the posting was generated
  350. * and the last time tried to deliver the posting.
  351. *
  352. * The returned string holds the content of the page.
  353. *
  354. * @param App $a
  355. * @return string
  356. */
  357. function admin_page_queue(&$a) {
  358. // get content from the queue table
  359. $r = q("SELECT `c`.`name`, `c`.`nurl`, `q`.`id`, `q`.`network`, `q`.`created`, `q`.`last`
  360. FROM `queue` AS `q`, `contact` AS `c`
  361. WHERE `c`.`id` = `q`.`cid`
  362. ORDER BY `q`.`cid`, `q`.`created`;");
  363. $t = get_markup_template("admin_queue.tpl");
  364. return replace_macros($t, array(
  365. '$title' => t('Administration'),
  366. '$page' => t('Inspect Queue'),
  367. '$count' => sizeof($r),
  368. 'id_header' => t('ID'),
  369. '$to_header' => t('Recipient Name'),
  370. '$url_header' => t('Recipient Profile'),
  371. '$network_header' => t('Network'),
  372. '$created_header' => t('Created'),
  373. '$last_header' => t('Last Tried'),
  374. '$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.'),
  375. '$entries' => $r,
  376. ));
  377. }
  378. /**
  379. * @brief Admin Summary Page
  380. *
  381. * The summary page is the "start page" of the admin panel. It gives the admin
  382. * a first overview of the open adminastrative tasks.
  383. *
  384. * The returned string contains the HTML content of the generated page.
  385. *
  386. * @param App $a
  387. * @return string
  388. */
  389. function admin_page_summary(&$a) {
  390. global $db;
  391. // are there MyISAM tables in the DB? If so, trigger a warning message
  392. $r = q("SELECT `engine` FROM `information_schema`.`tables` WHERE `engine` = 'myisam' AND `table_schema` = '%s' LIMIT 1",
  393. dbesc($db->database_name()));
  394. $showwarning = false;
  395. $warningtext = array();
  396. if (dbm::is_result($r)) {
  397. $showwarning = true;
  398. $warningtext[] = sprintf(t('Your DB still runs with MyISAM tables. You should change the engine type to InnoDB. As Friendica will use InnoDB only features in the future, you should change this! See <a href="%s">here</a> for a guide that may be helpful converting the table engines. You may also use the <tt>convert_innodb.sql</tt> in the <tt>/util</tt> directory of your Friendica installation.<br />'), 'https://dev.mysql.com/doc/refman/5.7/en/converting-tables-to-innodb.html');
  399. }
  400. // MySQL >= 5.7.4 doesn't support the IGNORE keyword in ALTER TABLE statements
  401. if ((version_compare($db->server_info(), '5.7.4') >= 0) AND
  402. !(strpos($db->server_info(), 'MariaDB') !== false)) {
  403. $warningtext[] = t('You are using a MySQL version which does not support all features that Friendica uses. You should consider switching to MariaDB.');
  404. }
  405. $r = q("SELECT `page-flags`, COUNT(`uid`) AS `count` FROM `user` GROUP BY `page-flags`");
  406. $accounts = array(
  407. array(t('Normal Account'), 0),
  408. array(t('Soapbox Account'), 0),
  409. array(t('Community/Celebrity Account'), 0),
  410. array(t('Automatic Friend Account'), 0),
  411. array(t('Blog Account'), 0),
  412. array(t('Private Forum'), 0)
  413. );
  414. $users=0;
  415. foreach ($r as $u){ $accounts[$u['page-flags']][1] = $u['count']; $users+= $u['count']; }
  416. logger('accounts: '.print_r($accounts,true),LOGGER_DATA);
  417. $r = qu("SELECT COUNT(`id`) AS `count` FROM `register`");
  418. $pending = $r[0]['count'];
  419. $r = qu("SELECT COUNT(*) AS `total` FROM `deliverq` WHERE 1");
  420. $deliverq = (($r) ? $r[0]['total'] : 0);
  421. $r = qu("SELECT COUNT(*) AS `total` FROM `queue` WHERE 1");
  422. $queue = (($r) ? $r[0]['total'] : 0);
  423. if (get_config('system','worker')) {
  424. $r = qu("SELECT COUNT(*) AS `total` FROM `workerqueue` WHERE 1");
  425. $workerqueue = (($r) ? $r[0]['total'] : 0);
  426. } else {
  427. $workerqueue = 0;
  428. }
  429. // We can do better, but this is a quick queue status
  430. $queues = array('label' => t('Message queues'), 'deliverq' => $deliverq, 'queue' => $queue, 'workerq' => $workerqueue);
  431. $t = get_markup_template("admin_summary.tpl");
  432. return replace_macros($t, array(
  433. '$title' => t('Administration'),
  434. '$page' => t('Summary'),
  435. '$queues' => $queues,
  436. '$workeractive' => get_config('system','worker'),
  437. '$users' => array(t('Registered users'), $users),
  438. '$accounts' => $accounts,
  439. '$pending' => array(t('Pending registrations'), $pending),
  440. '$version' => array(t('Version'), FRIENDICA_VERSION),
  441. '$baseurl' => App::get_baseurl(),
  442. '$platform' => FRIENDICA_PLATFORM,
  443. '$codename' => FRIENDICA_CODENAME,
  444. '$build' => get_config('system','build'),
  445. '$plugins' => array(t('Active plugins'), $a->plugins),
  446. '$showwarning' => $showwarning,
  447. '$warningtext' => $warningtext
  448. ));
  449. }
  450. /**
  451. * @brief Process send data from Admin Site Page
  452. *
  453. * @param App $a
  454. */
  455. function admin_page_site_post(&$a) {
  456. if(!x($_POST,"page_site")) {
  457. return;
  458. }
  459. check_form_security_token_redirectOnErr('/admin/site', 'admin_site');
  460. // relocate
  461. if(x($_POST,'relocate') && x($_POST,'relocate_url') && $_POST['relocate_url']!="") {
  462. $new_url = $_POST['relocate_url'];
  463. $new_url = rtrim($new_url,"/");
  464. $parsed = @parse_url($new_url);
  465. if(!$parsed || (!x($parsed,'host') || !x($parsed,'scheme'))) {
  466. notice(t("Can not parse base url. Must have at least <scheme>://<domain>"));
  467. goaway('admin/site');
  468. }
  469. /* steps:
  470. * replace all "baseurl" to "new_url" in config, profile, term, items and contacts
  471. * send relocate for every local user
  472. * */
  473. $old_url = App::get_baseurl(true);
  474. // Generate host names for relocation the addresses in the format user@address.tld
  475. $new_host = str_replace("http://", "@", normalise_link($new_url));
  476. $old_host = str_replace("http://", "@", normalise_link($old_url));
  477. function update_table($table_name, $fields, $old_url, $new_url) {
  478. global $db, $a;
  479. $dbold = dbesc($old_url);
  480. $dbnew = dbesc($new_url);
  481. $upd = array();
  482. foreach ($fields as $f) {
  483. $upd[] = "`$f` = REPLACE(`$f`, '$dbold', '$dbnew')";
  484. }
  485. $upds = implode(", ", $upd);
  486. $q = sprintf("UPDATE %s SET %s;", $table_name, $upds);
  487. $r = q($q);
  488. if(!$r) {
  489. notice("Failed updating '$table_name': ".$db->error);
  490. goaway('admin/site');
  491. }
  492. }
  493. // update tables
  494. // update profile links in the format "http://server.tld"
  495. update_table("profile", array('photo', 'thumb'), $old_url, $new_url);
  496. update_table("term", array('url'), $old_url, $new_url);
  497. update_table("contact", array('photo','thumb','micro','url','nurl','alias','request','notify','poll','confirm','poco', 'avatar'), $old_url, $new_url);
  498. update_table("gcontact", array('url','nurl','photo','server_url','notify','alias'), $old_url, $new_url);
  499. update_table("item", array('owner-link','owner-avatar','author-link','author-avatar','body','plink','tag'), $old_url, $new_url);
  500. // update profile addresses in the format "user@server.tld"
  501. update_table("contact", array('addr'), $old_host, $new_host);
  502. update_table("gcontact", array('connect','addr'), $old_host, $new_host);
  503. // update config
  504. $a->set_baseurl($new_url);
  505. set_config('system','url',$new_url);
  506. // send relocate
  507. $users = q("SELECT `uid` FROM `user` WHERE `account_removed` = 0 AND `account_expired` = 0");
  508. foreach ($users as $user) {
  509. proc_run(PRIORITY_HIGH, 'include/notifier.php', 'relocate', $user['uid']);
  510. }
  511. info("Relocation started. Could take a while to complete.");
  512. goaway('admin/site');
  513. }
  514. // end relocate
  515. $sitename = ((x($_POST,'sitename')) ? notags(trim($_POST['sitename'])) : '');
  516. $hostname = ((x($_POST,'hostname')) ? notags(trim($_POST['hostname'])) : '');
  517. $sender_email = ((x($_POST,'sender_email')) ? notags(trim($_POST['sender_email'])) : '');
  518. $banner = ((x($_POST,'banner')) ? trim($_POST['banner']) : false);
  519. $shortcut_icon = ((x($_POST,'shortcut_icon')) ? notags(trim($_POST['shortcut_icon'])) : '');
  520. $touch_icon = ((x($_POST,'touch_icon')) ? notags(trim($_POST['touch_icon'])) : '');
  521. $info = ((x($_POST,'info')) ? trim($_POST['info']) : false);
  522. $language = ((x($_POST,'language')) ? notags(trim($_POST['language'])) : '');
  523. $theme = ((x($_POST,'theme')) ? notags(trim($_POST['theme'])) : '');
  524. $theme_mobile = ((x($_POST,'theme_mobile')) ? notags(trim($_POST['theme_mobile'])) : '');
  525. $maximagesize = ((x($_POST,'maximagesize')) ? intval(trim($_POST['maximagesize'])) : 0);
  526. $maximagelength = ((x($_POST,'maximagelength')) ? intval(trim($_POST['maximagelength'])) : MAX_IMAGE_LENGTH);
  527. $jpegimagequality = ((x($_POST,'jpegimagequality')) ? intval(trim($_POST['jpegimagequality'])) : JPEG_QUALITY);
  528. $register_policy = ((x($_POST,'register_policy')) ? intval(trim($_POST['register_policy'])) : 0);
  529. $daily_registrations = ((x($_POST,'max_daily_registrations')) ? intval(trim($_POST['max_daily_registrations'])) :0);
  530. $abandon_days = ((x($_POST,'abandon_days')) ? intval(trim($_POST['abandon_days'])) : 0);
  531. $register_text = ((x($_POST,'register_text')) ? notags(trim($_POST['register_text'])) : '');
  532. $allowed_sites = ((x($_POST,'allowed_sites')) ? notags(trim($_POST['allowed_sites'])) : '');
  533. $allowed_email = ((x($_POST,'allowed_email')) ? notags(trim($_POST['allowed_email'])) : '');
  534. $block_public = ((x($_POST,'block_public')) ? True : False);
  535. $force_publish = ((x($_POST,'publish_all')) ? True : False);
  536. $global_directory = ((x($_POST,'directory')) ? notags(trim($_POST['directory'])) : '');
  537. $thread_allow = ((x($_POST,'thread_allow')) ? True : False);
  538. $newuser_private = ((x($_POST,'newuser_private')) ? True : False);
  539. $enotify_no_content = ((x($_POST,'enotify_no_content')) ? True : False);
  540. $private_addons = ((x($_POST,'private_addons')) ? True : False);
  541. $disable_embedded = ((x($_POST,'disable_embedded')) ? True : False);
  542. $allow_users_remote_self = ((x($_POST,'allow_users_remote_self')) ? True : False);
  543. $no_multi_reg = ((x($_POST,'no_multi_reg')) ? True : False);
  544. $no_openid = !((x($_POST,'no_openid')) ? True : False);
  545. $no_regfullname = !((x($_POST,'no_regfullname')) ? True : False);
  546. $no_utf = !((x($_POST,'no_utf')) ? True : False);
  547. $community_page_style = ((x($_POST,'community_page_style')) ? intval(trim($_POST['community_page_style'])) : 0);
  548. $max_author_posts_community_page = ((x($_POST,'max_author_posts_community_page')) ? intval(trim($_POST['max_author_posts_community_page'])) : 0);
  549. $verifyssl = ((x($_POST,'verifyssl')) ? True : False);
  550. $proxyuser = ((x($_POST,'proxyuser')) ? notags(trim($_POST['proxyuser'])) : '');
  551. $proxy = ((x($_POST,'proxy')) ? notags(trim($_POST['proxy'])) : '');
  552. $timeout = ((x($_POST,'timeout')) ? intval(trim($_POST['timeout'])) : 60);
  553. $delivery_interval = ((x($_POST,'delivery_interval')) ? intval(trim($_POST['delivery_interval'])) : 0);
  554. $poll_interval = ((x($_POST,'poll_interval')) ? intval(trim($_POST['poll_interval'])) : 0);
  555. $maxloadavg = ((x($_POST,'maxloadavg')) ? intval(trim($_POST['maxloadavg'])) : 50);
  556. $maxloadavg_frontend = ((x($_POST,'maxloadavg_frontend')) ? intval(trim($_POST['maxloadavg_frontend'])) : 50);
  557. $optimize_max_tablesize = ((x($_POST,'optimize_max_tablesize')) ? intval(trim($_POST['optimize_max_tablesize'])): 100);
  558. $optimize_fragmentation = ((x($_POST,'optimize_fragmentation')) ? intval(trim($_POST['optimize_fragmentation'])): 30);
  559. $poco_completion = ((x($_POST,'poco_completion')) ? intval(trim($_POST['poco_completion'])) : false);
  560. $poco_requery_days = ((x($_POST,'poco_requery_days')) ? intval(trim($_POST['poco_requery_days'])) : 7);
  561. $poco_discovery = ((x($_POST,'poco_discovery')) ? intval(trim($_POST['poco_discovery'])) : 0);
  562. $poco_discovery_since = ((x($_POST,'poco_discovery_since')) ? intval(trim($_POST['poco_discovery_since'])) : 30);
  563. $poco_local_search = ((x($_POST,'poco_local_search')) ? intval(trim($_POST['poco_local_search'])) : false);
  564. $nodeinfo = ((x($_POST,'nodeinfo')) ? intval(trim($_POST['nodeinfo'])) : false);
  565. $dfrn_only = ((x($_POST,'dfrn_only')) ? True : False);
  566. $ostatus_disabled = !((x($_POST,'ostatus_disabled')) ? True : False);
  567. $ostatus_poll_interval = ((x($_POST,'ostatus_poll_interval')) ? intval(trim($_POST['ostatus_poll_interval'])) : 0);
  568. $ostatus_full_threads = ((x($_POST,'ostatus_full_threads')) ? True : False);
  569. $diaspora_enabled = ((x($_POST,'diaspora_enabled')) ? True : False);
  570. $ssl_policy = ((x($_POST,'ssl_policy')) ? intval($_POST['ssl_policy']) : 0);
  571. $force_ssl = ((x($_POST,'force_ssl')) ? True : False);
  572. $old_share = ((x($_POST,'old_share')) ? True : False);
  573. $hide_help = ((x($_POST,'hide_help')) ? True : False);
  574. $suppress_language = ((x($_POST,'suppress_language')) ? True : False);
  575. $suppress_tags = ((x($_POST,'suppress_tags'