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.

2078 lines
81 KiB

<?php
11 years ago
/**
* @file mod/admin.php
*
* @brief Friendica admin
*/
use \Friendica\Core\Config;
require_once("include/enotify.php");
require_once("include/text.php");
/**
* @brief Process send data from the admin panels subpages
*
* This function acts as relais for processing the data send from the subpages
* of the admin panel. Depending on the 1st parameter of the url (argv[1])
* specialized functions are called to process the data from the subpages.
*
* The function itself does not return anything, but the subsequencely function
* return the HTML for the pages of the admin panel.
*
* @param App $a
*
*/
function admin_post(App $a) {
if (!is_site_admin()) {
return;
11 years ago
}
// do not allow a page manager to access the admin panel at all.
if (x($_SESSION,'submanage') && intval($_SESSION['submanage'])) {
return;
}
11 years ago
// urls
if ($a->argc > 1) {
switch ($a->argv[1]) {
case 'site':
11 years ago
admin_page_site_post($a);
break;
case 'users':
admin_page_users_post($a);
break;
case 'plugins':
if ($a->argc > 2 &&
is_file("addon/".$a->argv[2]."/".$a->argv[2].".php")) {
@include_once("addon/".$a->argv[2]."/".$a->argv[2].".php");
if (function_exists($a->argv[2].'_plugin_admin_post')) {
$func = $a->argv[2].'_plugin_admin_post';
$func($a);
}
}
goaway('admin/plugins/'.$a->argv[2]);
return; // NOTREACHED
break;
case 'themes':
if ($a->argc < 2) {
if (is_ajax()) {
return;
}
goaway('admin/');
return;
}
$theme = $a->argv[2];
if (is_file("view/theme/$theme/config.php")) {
function __call_theme_admin_post(App $a, $theme) {
$orig_theme = $a->theme;
$orig_page = $a->page;
$orig_session_theme = $_SESSION['theme'];
require_once("view/theme/$theme/theme.php");
require_once("view/theme/$theme/config.php");
$_SESSION['theme'] = $theme;
$init = $theme."_init";
if (function_exists($init)) {
$init($a);
}
if (function_exists("theme_admin_post")) {
$admin_form = theme_admin_post($a);
}
$_SESSION['theme'] = $orig_session_theme;
$a->theme = $orig_theme;
$a->page = $orig_page;
return $admin_form;
}
__call_theme_admin_post($a, $theme);
}
info(t('Theme settings updated.'));
if (is_ajax()) {
return;
}
goaway('admin/themes/'.$theme);
return;
break;
case 'features':
admin_page_features_post($a);
break;
case 'logs':
admin_page_logs_post($a);
break;
case 'dbsync':
admin_page_dbsync_post($a);
break;
11 years ago
}
}
goaway('admin');
return; // NOTREACHED
11 years ago
}
/**
* @brief Generates content of the admin panel pages
*
* This function generates the content for the admin panel. It consists of the
* aside menu (same for the entire admin panel) and the code for the soecified
* subpage of the panel.
*
* The structure of the adress is: /admin/subpage/details though "details" is
* only necessary for some subpages, like themes or addons where it is the name
* of one theme resp. addon from which the details should be shown. Content for
* the subpages is generated in separate functions for each of the subpages.
*
* The returned string hold the generated HTML code of the page.
*
* @param App $a
* @return string
*/
function admin_content(App $a) {
if (!is_site_admin()) {
return login(false);
}
if (x($_SESSION,'submanage') && intval($_SESSION['submanage'])) {
return "";
}
// APC deactivated, since there are problems with PHP 5.5
//if (function_exists("apc_delete")) {
// $toDelete = new APCIterator('user', APC_ITER_VALUE);
// apc_delete($toDelete);
//}
// Header stuff
$a->page['htmlhead'] .= replace_macros(get_markup_template('admin_settings_head.tpl'), array());
/*
* Side bar links
*/
$aside_tools = array();
// array(url, name, extra css classes)
// not part of $aside to make the template more adjustable
$aside_sub = array(
'site' => array("admin/site/", t("Site") , "site"),
'users' => array("admin/users/", t("Users") , "users"),
'plugins'=> array("admin/plugins/", t("Plugins") , "plugins"),
'themes' => array("admin/themes/", t("Themes") , "themes"),
'features' => array("admin/features/", t("Additional features") , "features"),
'dbsync' => array("admin/dbsync/", t('DB updates'), "dbsync"),
'queue' => array("admin/queue/", t('Inspect Queue'), "queue"),
'federation' => array("admin/federation/", t('Federation Statistics'), "federation"),
);
/* get plugins admin page */
$r = q("SELECT `name` FROM `addon` WHERE `plugin_admin` = 1 ORDER BY `name`");
$aside_tools['plugins_admin']=array();
foreach ($r as $h) {
$plugin =$h['name'];
$aside_tools['plugins_admin'][] = array("admin/plugins/".$plugin, $plugin, "plugin");
// temp plugins with admin
$a->plugins_admin[] = $plugin;
}
$aside_tools['logs'] = array("admin/logs/", t("Logs"), "logs");
$aside_tools['viewlogs'] = array("admin/viewlogs/", t("View Logs"), 'viewlogs');
$aside_tools['diagnostics_probe'] = array('probe/', t('probe address'), 'probe');
$aside_tools['diagnostics_webfinger'] = array('webfinger/', t('check webfinger'), 'webfinger');
$t = get_markup_template("admin_aside.tpl");
$a->page['aside'] .= replace_macros($t, array(
'$admin' => $aside_tools,
'$subpages' => $aside_sub,
'$admtxt' => t('Admin'),
'$plugadmtxt' => t('Plugin Features'),
'$logtxt' => t('Logs'),
'$diagnosticstxt' => t('diagnostics'),
'$h_pending' => t('User registrations waiting for confirmation'),
'$admurl'=> "admin/"
11 years ago
));
/*
* Page content
*/
$o = '';
// urls
if ($a->argc > 1) {
switch ($a->argv[1]) {
case 'site':
$o = admin_page_site($a);
break;
case 'users':
$o = admin_page_users($a);
break;
case 'plugins':
$o = admin_page_plugins($a);
break;
case 'themes':
$o = admin_page_themes($a);
break;
case 'features':
$o = admin_page_features($a);
break;
case 'logs':
$o = admin_page_logs($a);
break;
case 'viewlogs':
$o = admin_page_viewlogs($a);
break;
case 'dbsync':
$o = admin_page_dbsync($a);
break;
case 'queue':
$o = admin_page_queue($a);
break;
case 'federation':
$o = admin_page_federation($a);
break;
default:
notice(t("Item not found."));
}
} else {
$o = admin_page_summary($a);
}
if (is_ajax()) {
echo $o;
killme();
return '';
} else {
return $o;
}
}
/**
* @brief Subpage with some stats about "the federation" network
*
* This function generates the "Federation Statistics" subpage for the admin
* panel. The page lists some numbers to the part of "The Federation" known to
* the node. This data includes the different connected networks (e.g.
* Diaspora, Hubzilla, GNU Social) and the used versions in the different
* networks.
*
* The returned string contains the HTML code of the subpage for display.
*
* @param App $a
* @return string
*/
function admin_page_federation(App $a) {
// get counts on active friendica, diaspora, redmatrix, hubzilla, gnu
// social and statusnet nodes this node is knowing
//
// We are looking for the following platforms in the DB, "Red" should find
// all variants of that platform ID string as the q() function is stripping
// off one % two of them are needed in the query
// Add more platforms if you like, when one returns 0 known nodes it is not
// displayed on the stats page.
$platforms = array('Friendi%%a', 'Diaspora', '%%red%%', 'Hubzilla', 'BlaBlaNet', 'GNU Social', 'StatusNet', 'Mastodon');
$colors = array('Friendi%%a' => '#ffc018', // orange from the logo
'Diaspora' => '#a1a1a1', // logo is black and white, makes a gray
'%%red%%' => '#c50001', // fire red from the logo
'Hubzilla' => '#43488a', // blue from the logo
'BlaBlaNet' => '#3B5998', // blue from the navbar at blablanet-dot-com
'GNU Social'=> '#a22430', // dark red from the logo
'StatusNet' => '#789240', // the green from the logo (red and blue have already others
'Mastodon' => '#1a9df9'); // blue from the Mastodon logo
$counts = array();
$total = 0;
foreach ($platforms as $p) {
// get a total count for the platform, the name and version of the
// highest version and the protocol tpe
$c = qu('SELECT COUNT(*) AS `total`, ANY_VALUE(`platform`) AS `platform`,
ANY_VALUE(`network`) AS `network`, MAX(`version`) AS `version` FROM `gserver`
WHERE `platform` LIKE "%s" AND `last_contact` >= `last_failure`
ORDER BY `version` ASC;', $p);
$total = $total + $c[0]['total'];
// what versions for that platform do we know at all?
// again only the active nodes
$v = qu('SELECT COUNT(*) AS `total`, `version` FROM `gserver`
WHERE `last_contact` >= `last_failure` AND `platform` LIKE "%s"
GROUP BY `version`
ORDER BY `version`;', $p);
//
// clean up version numbers
//
// some platforms do not provide version information, add a unkown there
// to the version string for the displayed list.
foreach ($v as $key => $value) {
if ($v[$key]['version'] == '') {
$v[$key] = array('total'=>$v[$key]['total'], 'version'=>t('unknown'));
}
}
// in the DB the Diaspora versions have the format x.x.x.x-xx the last
// part (-xx) should be removed to clean up the versions from the "head
// commit" information and combined into a single entry for x.x.x.x
if ($p == 'Diaspora') {
$newV = array();
$newVv = array();
foreach ($v as $vv) {
$newVC = $vv['total'];
$newVV = $vv['version'];
$posDash = strpos($newVV, '-');
if ($posDash) {
$newVV = substr($newVV, 0, $posDash);
}
if (isset($newV[$newVV])) {
$newV[$newVV] += $newVC;
} else {
$newV[$newVV] = $newVC;
}
}
foreach ($newV as $key => $value) {
array_push($newVv, array('total'=>$value, 'version'=>$key));
}
$v = $newVv;
}
// early friendica versions have the format x.x.xxxx where xxxx is the
// DB version stamp; those should be operated out and versions be
// conbined
if ($p == 'Friendi%%a') {
$newV = array();
$newVv = array();
foreach ($v as $vv) {
$newVC = $vv['total'];
$newVV = $vv['version'];
$lastDot = strrpos($newVV,'.');
$len = strlen($newVV)-1;
if (($lastDot == $len-4) && (!strrpos($newVV,'-rc') == $len-3)) {
$newVV = substr($newVV, 0, $lastDot);
}
if (isset($newV[$newVV])) {
$newV[$newVV] += $newVC;
} else {
$newV[$newVV] = $newVC;
}
}
foreach ($newV as $key => $value) {
array_push($newVv, array('total'=>$value, 'version'=>$key));
}
$v = $newVv;
}
foreach ($v as $key => $vv)
$v[$key]["version"] = trim(strip_tags($vv["version"]));
// the 3rd array item is needed for the JavaScript graphs as JS does
// not like some characters in the names of variables...
$counts[$p]=array($c[0], $v, str_replace(array(' ','%'),'',$p), $colors[$p]);
}
// some helpful text
$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.');
$hint = t('The <em>Auto Discovered Contact Directory</em> feature is not enabled, it will improve the data displayed here.');
// load the template, replace the macros and return the page content
$t = get_markup_template("admin_federation.tpl");
return replace_macros($t, array(
'$title' => t('Administration'),
'$page' => t('Federation Statistics'),
'$intro' => $intro,
'$hint' => $hint,
'$autoactive' => get_config('system', 'poco_completion'),
'$counts' => $counts,
'$version' => FRIENDICA_VERSION,
'$legendtext' => sprintf(t('Currently this node is aware of %d nodes from the following platforms:'), $total),
'$baseurl' => App::get_baseurl(),
));
}
/**
* @brief Admin Inspect Queue Page
6 years ago
*
* Generates a page for the admin to have a look into the current queue of
* postings that are not deliverabke. Shown are the name and url of the
* recipient, the delivery network and the dates when the posting was generated
* and the last time tried to deliver the posting.
*
* The returned string holds the content of the page.
*
* @param App $a
* @return string
*/
function admin_page_queue(App $a) {
// get content from the queue table
$r = q("SELECT `c`.`name`, `c`.`nurl`, `q`.`id`, `q`.`network`, `q`.`created`, `q`.`last`
FROM `queue` AS `q`, `contact` AS `c`
WHERE `c`.`id` = `q`.`cid`
ORDER BY `q`.`cid`, `q`.`created`;");
$t = get_markup_template("admin_queue.tpl");
return replace_macros($t, array(
'$title' => t('Administration'),
'$page' => t('Inspect Queue'),
'$count' => sizeof($r),
'id_header' => t('ID'),
'$to_header' => t('Recipient Name'),
'$url_header' => t('Recipient Profile'),
'$network_header' => t('Network'),
'$created_header' => t('Created'),
'$last_header' => t('Last Tried'),
'$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.'),
'$entries' => $r,
));
}
/**
* @brief Admin Summary Page
6 years ago
*
* The summary page is the "start page" of the admin panel. It gives the admin
* a first overview of the open adminastrative tasks.
*
* The returned string contains the HTML content of the generated page.
*
* @param App $a
* @return string
*/
function admin_page_summary(App $a) {
global $db;
// are there MyISAM tables in the DB? If so, trigger a warning message
$r = q("SELECT `engine` FROM `information_schema`.`tables` WHERE `engine` = 'myisam' AND `table_schema` = '%s' LIMIT 1",
dbesc($db->database_name()));
$showwarning = false;
$warningtext = array();
if (dbm::is_result($r)) {
$showwarning = true;
$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');
}
// MySQL >= 5.7.4 doesn't support the IGNORE keyword in ALTER TABLE statements
if ((version_compare($db->server_info(), '5.7.4') >= 0) AND
!(strpos($db->server_info(), 'MariaDB') !== false)) {
$warningtext[] = t('You are using a MySQL version which does not support all features that Friendica uses. You should consider switching to MariaDB.');
}
$r = q("SELECT `page-flags`, COUNT(`uid`) AS `count` FROM `user` GROUP BY `page-flags`");
$accounts = array(
array(t('Normal Account'), 0),
array(t('Soapbox Account'), 0),
array(t('Community/Celebrity Account'), 0),
array(t('Automatic Friend Account'), 0),
array(t('Blog Account'), 0),
array(t('Private Forum'), 0)
);
$users=0;
foreach ($r as $u) {
$accounts[$u['page-flags']][1] = $u['count'];
$users+= $u['count'];
}
logger('accounts: '.print_r($accounts,true),LOGGER_DATA);
$r = qu("SELECT COUNT(`id`) AS `count` FROM `register`");
$pending = $r[0]['count'];
$r = qu("SELECT COUNT(*) AS `total` FROM `queue` WHERE 1");
$queue = (($r) ? $r[0]['total'] : 0);
$r = qu("SELECT COUNT(*) AS `total` FROM `workerqueue` WHERE 1");
$workerqueue = (($r) ? $r[0]['total'] : 0);
// We can do better, but this is a quick queue status
$queues = array('label' => t('Message queues'), 'queue' => $queue, 'workerq' => $workerqueue);
$t = get_markup_template("admin_summary.tpl");
return replace_macros($t, array(
'$title' => t('Administration'),
'$page' => t('Summary'),
'$queues' => $queues,
'$users' => array(t('Registered users'), $users),
'$accounts' => $accounts,
'$pending' => array(t('Pending registrations'), $pending),
'$version' => array(t('Version'), FRIENDICA_VERSION),
'$baseurl' => App::get_baseurl(),
'$platform' => FRIENDICA_PLATFORM,
'$codename' => FRIENDICA_CODENAME,
'$build' => get_config('system','build'),
'$plugins' => array(t('Active plugins'), $a->plugins),
'$showwarning' => $showwarning,
'$warningtext' => $warningtext
));
}
11 years ago
/**
* @brief Process send data from Admin Site Page
*
* @param App $a
11 years ago
*/
function admin_page_site_post(App $a) {
if (!x($_POST,"page_site")) {
11 years ago
return;
}
check_form_security_token_redirectOnErr('/admin/site', 'admin_site');
// relocate
if (x($_POST,'relocate') && x($_POST,'relocate_url') && $_POST['relocate_url'] != "") {
$new_url = $_POST['relocate_url'];
$new_url = rtrim($new_url,"/");
$parsed = @parse_url($new_url);
if (!$parsed || (!x($parsed,'host') || !x($parsed,'scheme'))) {
notice(t("Can not parse base url. Must have at least <scheme>://<domain>"));
goaway('admin/site');
}
/* steps:
* replace all "baseurl" to "new_url" in config, profile, term, items and contacts
* send relocate for every local user
* */
$old_url = App::get_baseurl(true);
// Generate host names for relocation the addresses in the format user@address.tld
$new_host = str_replace("http://", "@", normalise_link($new_url));
$old_host = str_replace("http://", "@", normalise_link($old_url));
function update_table($table_name, $fields, $old_url, $new_url) {
global $db, $a;
$dbold = dbesc($old_url);
$dbnew = dbesc($new_url);
$upd = array();
foreach ($fields as $f) {
$upd[] = "`$f` = REPLACE(`$f`, '$dbold', '$dbnew')";
}
$upds = implode(", ", $upd);
$q = sprintf("UPDATE %s SET %s;", $table_name, $upds);
$r = q($q);
if (!$r) {
notice("Failed updating '$table_name': ".$db->error);
goaway('admin/site');
}
}
// update tables
// update profile links in the format "http://server.tld"
update_table("profile", array('photo', 'thumb'), $old_url, $new_url);
update_table("term", array('url'), $old_url, $new_url);
update_table("contact", array('photo','thumb','micro','url','nurl','alias','request','notify','poll','confirm','poco', 'avatar'), $old_url, $new_url);
update_table("gcontact", array('url','nurl','photo','server_url','notify','alias'), $old_url, $new_url);
update_table("item", array('owner-link','owner-avatar','author-link','author-avatar','body','plink','tag'), $old_url, $new_url);
// update profile addresses in the format "user@server.tld"
update_table("contact", array('addr'), $old_host, $new_host);
update_table("gcontact", array('connect','addr'), $old_host, $new_host);
// update config
$a->set_baseurl($new_url);
set_config('system','url',$new_url);
// send relocate
$users = q("SELECT `uid` FROM `user` WHERE `account_removed` = 0 AND `account_expired` = 0");
foreach ($users as $user) {
proc_run(PRIORITY_HIGH, 'include/notifier.php', 'relocate', $user['uid']);
}
info("Relocation started. Could take a while to complete.");
goaway('admin/site');
}
// end relocate
$sitename = ((x($_POST,'sitename')) ? notags(trim($_POST['sitename'])) : '');
$hostname = ((x($_POST,'hostname')) ? notags(trim($_POST['hostname'])) : '');
$sender_email = ((x($_POST,'sender_email')) ? notags(trim($_POST['sender_email'])) : '');
$banner = ((x($_POST,'banner')) ? trim($_POST['banner']) : false);
$shortcut_icon = ((x($_POST,'shortcut_icon')) ? notags(trim($_POST['shortcut_icon'])) : '');
$touch_icon = ((x($_POST,'touch_icon')) ? notags(trim($_POST['touch_icon'])) : '');
$info = ((x($_POST,'info')) ? trim($_POST['info']) : false);
$language = ((x($_POST,'language')) ? notags(trim($_POST['language'])) : '');
$theme = ((x($_POST,'theme')) ? notags(trim($_POST['theme'])) : '');
$theme_mobile = ((x($_POST,'theme_mobile')) ? notags(trim($_POST['theme_mobile'])) : '');
11 years ago
$maximagesize = ((x($_POST,'maximagesize')) ? intval(trim($_POST['maximagesize'])) : 0);
$maximagelength = ((x($_POST,'maximagelength')) ? intval(trim($_POST['maximagelength'])) : MAX_IMAGE_LENGTH);
$jpegimagequality = ((x($_POST,'jpegimagequality')) ? intval(trim($_POST['jpegimagequality'])) : JPEG_QUALITY);
$register_policy = ((x($_POST,'register_policy')) ? intval(trim($_POST['register_policy'])) : 0);
$daily_registrations = ((x($_POST,'max_daily_registrations')) ? intval(trim($_POST['max_daily_registrations'])) :0);
$abandon_days = ((x($_POST,'abandon_days')) ? intval(trim($_POST['abandon_days'])) : 0);
$register_text = ((x($_POST,'register_text')) ? notags(trim($_POST['register_text'])) : '');
$allowed_sites = ((x($_POST,'allowed_sites')) ? notags(trim($_POST['allowed_sites'])) : '');
$allowed_email = ((x($_POST,'allowed_email')) ? notags(trim($_POST['allowed_email'])) : '');
$block_public = ((x($_POST,'block_public')) ? True : False);
$force_publish = ((x($_POST,'publish_all')) ? True : False);
$global_directory = ((x($_POST,'directory')) ? notags(trim($_POST['directory'])) : '');
$thread_allow = ((x($_POST,'thread_allow')) ? True : False);
$newuser_private = ((x($_POST,'newuser_private')) ? True : False);
$enotify_no_content = ((x($_POST,'enotify_no_content')) ? True : False);
$private_addons = ((x($_POST,'private_addons')) ? True : False);
$disable_embedded = ((x($_POST,'disable_embedded')) ? True : False);
$allow_users_remote_self = ((x($_POST,'allow_users_remote_self')) ? True : False);
$no_multi_reg = ((x($_POST,'no_multi_reg')) ? True : False);
$no_openid = !((x($_POST,'no_openid')) ? True : False);
$no_regfullname = !((x($_POST,'no_regfullname')) ? True : False);
$community_page_style = ((x($_POST,'community_page_style')) ? intval(trim($_POST['community_page_style'])) : 0);
$max_author_posts_community_page = ((x($_POST,'max_author_posts_community_page')) ? intval(trim($_POST['max_author_posts_community_page'])) : 0);
$verifyssl = ((x($_POST,'verifyssl')) ? True : False);
$proxyuser = ((x($_POST,'proxyuser')) ? notags(trim($_POST['proxyuser'])) : '');
$proxy = ((x($_POST,'proxy')) ? notags(trim($_POST['proxy'])) : '');
$timeout = ((x($_POST,'timeout')) ? intval(trim($_POST['timeout'])) : 60);
$maxloadavg = ((x($_POST,'maxloadavg')) ? intval(trim($_POST['maxloadavg'])) : 50);
$maxloadavg_frontend = ((x($_POST,'maxloadavg_frontend')) ? intval(trim($_POST['maxloadavg_frontend'])) : 50);
$optimize_max_tablesize = ((x($_POST,'optimize_max_tablesize')) ? intval(trim($_POST['optimize_max_tablesize'])): 100);
$optimize_fragmentation = ((x($_POST,'optimize_fragmentation')) ? intval(trim($_POST['optimize_fragmentation'])): 30);
$poco_completion = ((x($_POST,'poco_completion')) ? intval(trim($_POST['poco_completion'])) : false);
$poco_requery_days = ((x($_POST,'poco_requery_days')) ? intval(trim($_POST['poco_requery_days'])) : 7);
$poco_discovery = ((x($_POST,'poco_discovery')) ? intval(trim($_POST['poco_discovery'])) : 0);
$poco_discovery_since = ((x($_POST,'poco_discovery_since')) ? intval(trim($_POST['poco_discovery_since'])) : 30);
$poco_local_search = ((x($_POST,'poco_local_search')) ? intval(trim($_POST['poco_local_search'])) : false);
$nodeinfo = ((x($_POST,'nodeinfo')) ? intval(trim($_POST['nodeinfo'])) : false);
$dfrn_only = ((x($_POST,'dfrn_only')) ? True : False);
$ostatus_disabled = !((x($_POST,'ostatus_disabled')) ? True : False);
$ostatus_poll_interval = ((x($_POST,'ostatus_poll_interval')) ? intval(trim($_POST['ostatus_poll_interval'])) : 0);
$ostatus_full_threads = ((x($_POST,'ostatus_full_threads')) ? True : False);
$diaspora_enabled = ((x($_POST,'diaspora_enabled')) ? True : False);
$ssl_policy = ((x($_POST,'ssl_policy')) ? intval($_POST['ssl_policy']) : 0);
$force_ssl = ((x($_POST,'force_ssl')) ? True : False);
$hide_help = ((x($_POST,'hide_help')) ? True : False);
$suppress_tags = ((x($_POST,'suppress_tags')) ? True : False);
$itemcache = ((x($_POST,'itemcache')) ? notags(trim($_POST['itemcache'])) : '');
$itemcache_duration = ((x($_POST,'itemcache_duration')) ? intval($_POST['itemcache_duration']) : 0);
$max_comments = ((x($_POST,'max_comments')) ? intval($_POST['max_comments']) : 0);
$temppath = ((x($_POST,'temppath')) ? notags(trim($_POST['temppath'])) : '');
$basepath = ((x($_POST,'basepath')) ? notags(trim($_POST['basepath'])) : '');
$singleuser = ((x($_POST,'singleuser')) ? notags(trim($_POST['singleuser'])) : '');
$proxy_disabled = ((x($_POST,'proxy_disabled')) ? True : False);
$only_tag_search = ((x($_POST,'only_tag_search')) ? True : False);
$rino = ((x($_POST,'rino')) ? intval($_POST['rino']) : 0);
$worker_queues = ((x($_POST,'worker_queues')) ? intval($_POST['worker_queues']) : 4);
$worker_dont_fork = ((x($_POST,'worker_dont_fork')) ? True : False);
$worker_fastlane = ((x($_POST,'worker_fastlane')) ? True : False);
$worker_frontend = ((x($_POST,'worker_frontend')) ? True : False);
// Has the directory url changed? If yes, then resubmit the existing profiles there
if ($global_directory != Config::get('system', 'directory') AND ($global_directory != '')) {
Config::set('system', 'directory', $global_directory);
proc_run(PRIORITY_LOW, 'include/directory.php');
}
if ($a->get_path() != "") {
$diaspora_enabled = false;
}
if (!$thread_allow) {