mirror of
https://github.com/friendica/friendica
synced 2024-12-22 23:20:16 +00:00
Issue 10640: Use consistent settings to enable protocol support
This commit is contained in:
parent
0448070069
commit
e3c7cd25e1
9 changed files with 18 additions and 26 deletions
|
@ -92,11 +92,7 @@ function settings_post(App $a)
|
||||||
$mail_replyto = $_POST['mail_replyto'] ?? '';
|
$mail_replyto = $_POST['mail_replyto'] ?? '';
|
||||||
$mail_pubmail = $_POST['mail_pubmail'] ?? '';
|
$mail_pubmail = $_POST['mail_pubmail'] ?? '';
|
||||||
|
|
||||||
if (
|
if (function_exists('imap_open') && !DI::config()->get('system', 'imap_disabled')) {
|
||||||
!DI::config()->get('system', 'dfrn_only')
|
|
||||||
&& function_exists('imap_open')
|
|
||||||
&& !DI::config()->get('system', 'imap_disabled')
|
|
||||||
) {
|
|
||||||
$failed = false;
|
$failed = false;
|
||||||
$r = q("SELECT * FROM `mailacct` WHERE `uid` = %d LIMIT 1",
|
$r = q("SELECT * FROM `mailacct` WHERE `uid` = %d LIMIT 1",
|
||||||
intval(local_user())
|
intval(local_user())
|
||||||
|
@ -513,9 +509,6 @@ function settings_content(App $a)
|
||||||
}
|
}
|
||||||
|
|
||||||
$mail_disabled = ((function_exists('imap_open') && (!DI::config()->get('system', 'imap_disabled'))) ? 0 : 1);
|
$mail_disabled = ((function_exists('imap_open') && (!DI::config()->get('system', 'imap_disabled'))) ? 0 : 1);
|
||||||
if (DI::config()->get('system', 'dfrn_only')) {
|
|
||||||
$mail_disabled = 1;
|
|
||||||
}
|
|
||||||
if (!$mail_disabled) {
|
if (!$mail_disabled) {
|
||||||
$r = q("SELECT * FROM `mailacct` WHERE `uid` = %d LIMIT 1",
|
$r = q("SELECT * FROM `mailacct` WHERE `uid` = %d LIMIT 1",
|
||||||
local_user()
|
local_user()
|
||||||
|
|
|
@ -183,8 +183,8 @@ class Site extends BaseAdmin
|
||||||
$poco_discovery = (!empty($_POST['poco_discovery']) ? intval(trim($_POST['poco_discovery'])) : false);
|
$poco_discovery = (!empty($_POST['poco_discovery']) ? intval(trim($_POST['poco_discovery'])) : false);
|
||||||
$poco_local_search = !empty($_POST['poco_local_search']);
|
$poco_local_search = !empty($_POST['poco_local_search']);
|
||||||
$nodeinfo = !empty($_POST['nodeinfo']);
|
$nodeinfo = !empty($_POST['nodeinfo']);
|
||||||
$dfrn_only = !empty($_POST['dfrn_only']);
|
$mail_enabled = !empty($_POST['mail_enabled']);
|
||||||
$ostatus_disabled = !empty($_POST['ostatus_disabled']);
|
$ostatus_enabled = !empty($_POST['ostatus_enabled']);
|
||||||
$diaspora_enabled = !empty($_POST['diaspora_enabled']);
|
$diaspora_enabled = !empty($_POST['diaspora_enabled']);
|
||||||
$ssl_policy = (!empty($_POST['ssl_policy']) ? intval($_POST['ssl_policy']) : 0);
|
$ssl_policy = (!empty($_POST['ssl_policy']) ? intval($_POST['ssl_policy']) : 0);
|
||||||
$force_ssl = !empty($_POST['force_ssl']);
|
$force_ssl = !empty($_POST['force_ssl']);
|
||||||
|
@ -340,8 +340,8 @@ class Site extends BaseAdmin
|
||||||
DI::config()->set('system', 'proxyuser' , $proxyuser);
|
DI::config()->set('system', 'proxyuser' , $proxyuser);
|
||||||
DI::config()->set('system', 'proxy' , $proxy);
|
DI::config()->set('system', 'proxy' , $proxy);
|
||||||
DI::config()->set('system', 'curl_timeout' , $timeout);
|
DI::config()->set('system', 'curl_timeout' , $timeout);
|
||||||
DI::config()->set('system', 'dfrn_only' , $dfrn_only);
|
DI::config()->set('system', 'imap_disabled' , !$mail_enabled && function_exists('imap_open'));
|
||||||
DI::config()->set('system', 'ostatus_disabled' , $ostatus_disabled);
|
DI::config()->set('system', 'ostatus_disabled' , !$ostatus_enabled);
|
||||||
DI::config()->set('system', 'diaspora_enabled' , $diaspora_enabled);
|
DI::config()->set('system', 'diaspora_enabled' , $diaspora_enabled);
|
||||||
|
|
||||||
DI::config()->set('config', 'private_addons' , $private_addons);
|
DI::config()->set('config', 'private_addons' , $private_addons);
|
||||||
|
@ -560,12 +560,11 @@ class Site extends BaseAdmin
|
||||||
'$no_regfullname' => ['no_regfullname', DI::l10n()->t('No Fullname check'), DI::config()->get('system', 'no_regfullname'), DI::l10n()->t('Allow users to register without a space between the first name and the last name in their full name.')],
|
'$no_regfullname' => ['no_regfullname', DI::l10n()->t('No Fullname check'), DI::config()->get('system', 'no_regfullname'), DI::l10n()->t('Allow users to register without a space between the first name and the last name in their full name.')],
|
||||||
'$community_page_style' => ['community_page_style', DI::l10n()->t('Community pages for visitors'), DI::config()->get('system', 'community_page_style'), DI::l10n()->t('Which community pages should be available for visitors. Local users always see both pages.'), $community_page_style_choices],
|
'$community_page_style' => ['community_page_style', DI::l10n()->t('Community pages for visitors'), DI::config()->get('system', 'community_page_style'), DI::l10n()->t('Which community pages should be available for visitors. Local users always see both pages.'), $community_page_style_choices],
|
||||||
'$max_author_posts_community_page' => ['max_author_posts_community_page', DI::l10n()->t('Posts per user on community page'), DI::config()->get('system', 'max_author_posts_community_page'), DI::l10n()->t('The maximum number of posts per user on the community page. (Not valid for "Global Community")')],
|
'$max_author_posts_community_page' => ['max_author_posts_community_page', DI::l10n()->t('Posts per user on community page'), DI::config()->get('system', 'max_author_posts_community_page'), DI::l10n()->t('The maximum number of posts per user on the community page. (Not valid for "Global Community")')],
|
||||||
'$ostatus_disabled' => ['ostatus_disabled', DI::l10n()->t('Disable OStatus support'), DI::config()->get('system', 'ostatus_disabled'), DI::l10n()->t('Disable built-in OStatus (StatusNet, GNU Social etc.) compatibility. All communications in OStatus are public, so privacy warnings will be occasionally displayed.')],
|
'$mail_enabled' => ['mail_enabled', DI::l10n()->t('Enable Mail support'), !DI::config()->get('system', 'imap_disabled', !function_exists('imap_open')), DI::l10n()->t('Enable built-in mail support to poll IMAP folders and to reply via mail.')],
|
||||||
'$ostatus_not_able' => DI::l10n()->t('OStatus support can only be enabled if threading is enabled.'),
|
'$ostatus_enabled' => ['ostatus_enabled', DI::l10n()->t('Enable OStatus support'), !DI::config()->get('system', 'ostatus_disabled'), DI::l10n()->t('Enable built-in OStatus (StatusNet, GNU Social etc.) compatibility. All communications in OStatus are public.')],
|
||||||
'$diaspora_able' => $diaspora_able,
|
'$diaspora_able' => $diaspora_able,
|
||||||
'$diaspora_not_able' => DI::l10n()->t('Diaspora support can\'t be enabled because Friendica was installed into a sub directory.'),
|
'$diaspora_not_able' => DI::l10n()->t('Diaspora support can\'t be enabled because Friendica was installed into a sub directory.'),
|
||||||
'$diaspora_enabled' => ['diaspora_enabled', DI::l10n()->t('Enable Diaspora support'), DI::config()->get('system', 'diaspora_enabled', $diaspora_able), DI::l10n()->t('Provide built-in Diaspora network compatibility.')],
|
'$diaspora_enabled' => ['diaspora_enabled', DI::l10n()->t('Enable Diaspora support'), DI::config()->get('system', 'diaspora_enabled', $diaspora_able), DI::l10n()->t('Enable built-in Diaspora network compatibility for communicating with diaspora servers.')],
|
||||||
'$dfrn_only' => ['dfrn_only', DI::l10n()->t('Only allow Friendica contacts'), DI::config()->get('system', 'dfrn_only'), DI::l10n()->t('All contacts must use Friendica protocols. All other built-in communication protocols disabled.')],
|
|
||||||
'$verifyssl' => ['verifyssl', DI::l10n()->t('Verify SSL'), DI::config()->get('system', 'verifyssl'), DI::l10n()->t('If you wish, you can turn on strict certificate checking. This will mean you cannot connect (at all) to self-signed SSL sites.')],
|
'$verifyssl' => ['verifyssl', DI::l10n()->t('Verify SSL'), DI::config()->get('system', 'verifyssl'), DI::l10n()->t('If you wish, you can turn on strict certificate checking. This will mean you cannot connect (at all) to self-signed SSL sites.')],
|
||||||
'$proxyuser' => ['proxyuser', DI::l10n()->t('Proxy user'), DI::config()->get('system', 'proxyuser'), ''],
|
'$proxyuser' => ['proxyuser', DI::l10n()->t('Proxy user'), DI::config()->get('system', 'proxyuser'), ''],
|
||||||
'$proxy' => ['proxy', DI::l10n()->t('Proxy URL'), DI::config()->get('system', 'proxy'), ''],
|
'$proxy' => ['proxy', DI::l10n()->t('Proxy URL'), DI::config()->get('system', 'proxy'), ''],
|
||||||
|
|
|
@ -72,7 +72,7 @@ class NodeInfo120 extends BaseModule
|
||||||
$nodeinfo['services']['inbound'][] = 'rss2.0';
|
$nodeinfo['services']['inbound'][] = 'rss2.0';
|
||||||
$nodeinfo['services']['outbound'][] = 'atom1.0';
|
$nodeinfo['services']['outbound'][] = 'atom1.0';
|
||||||
|
|
||||||
if (function_exists('imap_open') && !$config->get('system', 'imap_disabled') && !$config->get('system', 'dfrn_only')) {
|
if (function_exists('imap_open') && !$config->get('system', 'imap_disabled')) {
|
||||||
$nodeinfo['services']['inbound'][] = 'imap';
|
$nodeinfo['services']['inbound'][] = 'imap';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -72,7 +72,7 @@ class NodeInfo210 extends BaseModule
|
||||||
$nodeinfo['services']['inbound'][] = 'rss2.0';
|
$nodeinfo['services']['inbound'][] = 'rss2.0';
|
||||||
$nodeinfo['services']['outbound'][] = 'atom1.0';
|
$nodeinfo['services']['outbound'][] = 'atom1.0';
|
||||||
|
|
||||||
if (function_exists('imap_open') && !$config->get('system', 'imap_disabled') && !$config->get('system', 'dfrn_only')) {
|
if (function_exists('imap_open') && !$config->get('system', 'imap_disabled')) {
|
||||||
$nodeinfo['services']['inbound'][] = 'imap';
|
$nodeinfo['services']['inbound'][] = 'imap';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -394,7 +394,7 @@ class Delivery
|
||||||
|
|
||||||
Logger::notice('Deliver via Diaspora', ['target' => $target_item['id'], 'guid' => $target_item['guid'], 'to' => $loc]);
|
Logger::notice('Deliver via Diaspora', ['target' => $target_item['id'], 'guid' => $target_item['guid'], 'to' => $loc]);
|
||||||
|
|
||||||
if (DI::config()->get('system', 'dfrn_only') || !DI::config()->get('system', 'diaspora_enabled')) {
|
if (!DI::config()->get('system', 'diaspora_enabled')) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -477,7 +477,7 @@ class Delivery
|
||||||
*/
|
*/
|
||||||
private static function deliverMail($cmd, $contact, $owner, $target_item, $thr_parent)
|
private static function deliverMail($cmd, $contact, $owner, $target_item, $thr_parent)
|
||||||
{
|
{
|
||||||
if (DI::config()->get('system','dfrn_only')) {
|
if (DI::config()->get('system','imap_disabled')) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -615,7 +615,7 @@ class Notifier
|
||||||
$url_recipients = array_filter($url_recipients);
|
$url_recipients = array_filter($url_recipients);
|
||||||
// send salmon slaps to mentioned remote tags (@foo@example.com) in OStatus posts
|
// send salmon slaps to mentioned remote tags (@foo@example.com) in OStatus posts
|
||||||
// They are especially used for notifications to OStatus users that don't follow us.
|
// They are especially used for notifications to OStatus users that don't follow us.
|
||||||
if (!DI::config()->get('system', 'dfrn_only') && count($url_recipients) && ($public_message || $push_notify) && !empty($target_item)) {
|
if (count($url_recipients) && ($public_message || $push_notify) && !empty($target_item)) {
|
||||||
$slap = OStatus::salmon($target_item, $owner);
|
$slap = OStatus::salmon($target_item, $owner);
|
||||||
foreach ($url_recipients as $url) {
|
foreach ($url_recipients as $url) {
|
||||||
Logger::info('Salmon delivery', ['item' => $target_id, 'to' => $url]);
|
Logger::info('Salmon delivery', ['item' => $target_id, 'to' => $url]);
|
||||||
|
|
|
@ -56,7 +56,8 @@
|
||||||
{{include file="field_select.tpl" field=$community_page_style}}
|
{{include file="field_select.tpl" field=$community_page_style}}
|
||||||
{{include file="field_input.tpl" field=$max_author_posts_community_page}}
|
{{include file="field_input.tpl" field=$max_author_posts_community_page}}
|
||||||
|
|
||||||
{{include file="field_checkbox.tpl" field=$ostatus_disabled}}
|
{{include file="field_checkbox.tpl" field=$mail_enabled}}
|
||||||
|
{{include file="field_checkbox.tpl" field=$ostatus_enabled}}
|
||||||
|
|
||||||
{{if $diaspora_able}}
|
{{if $diaspora_able}}
|
||||||
{{include file="field_checkbox.tpl" field=$diaspora_enabled}}
|
{{include file="field_checkbox.tpl" field=$diaspora_enabled}}
|
||||||
|
@ -66,7 +67,6 @@
|
||||||
<span id='id_{{$diaspora_enabled.0}}'>{{$diaspora_not_able}}</span>
|
<span id='id_{{$diaspora_enabled.0}}'>{{$diaspora_not_able}}</span>
|
||||||
</div>
|
</div>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{include file="field_checkbox.tpl" field=$dfrn_only}}
|
|
||||||
{{include file="field_input.tpl" field=$global_directory}}
|
{{include file="field_input.tpl" field=$global_directory}}
|
||||||
<div class="submit"><input type="submit" name="republish_directory" value="{{$republish}}"/></div>
|
<div class="submit"><input type="submit" name="republish_directory" value="{{$republish}}"/></div>
|
||||||
{{include file="field_checkbox.tpl" field=$newuser_private}}
|
{{include file="field_checkbox.tpl" field=$newuser_private}}
|
||||||
|
|
|
@ -135,7 +135,8 @@
|
||||||
{{include file="field_select.tpl" field=$community_page_style}}
|
{{include file="field_select.tpl" field=$community_page_style}}
|
||||||
{{include file="field_input.tpl" field=$max_author_posts_community_page}}
|
{{include file="field_input.tpl" field=$max_author_posts_community_page}}
|
||||||
|
|
||||||
{{include file="field_checkbox.tpl" field=$ostatus_disabled}}
|
{{include file="field_checkbox.tpl" field=$mail_enabled}}
|
||||||
|
{{include file="field_checkbox.tpl" field=$ostatus_enabled}}
|
||||||
|
|
||||||
{{if $diaspora_able}}
|
{{if $diaspora_able}}
|
||||||
{{include file="field_checkbox.tpl" field=$diaspora_enabled}}
|
{{include file="field_checkbox.tpl" field=$diaspora_enabled}}
|
||||||
|
@ -145,7 +146,6 @@
|
||||||
<span id="id_{{$diaspora_enabled.0}}">{{$diaspora_not_able}}</span>
|
<span id="id_{{$diaspora_enabled.0}}">{{$diaspora_not_able}}</span>
|
||||||
</div>
|
</div>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{include file="field_checkbox.tpl" field=$dfrn_only}}
|
|
||||||
{{include file="field_input.tpl" field=$global_directory}}
|
{{include file="field_input.tpl" field=$global_directory}}
|
||||||
<p>
|
<p>
|
||||||
<input type="submit" name="republish_directory" class="btn btn-primary" value="{{$republish}}"/>
|
<input type="submit" name="republish_directory" class="btn btn-primary" value="{{$republish}}"/>
|
||||||
|
|
|
@ -285,7 +285,7 @@ function vier_community_info()
|
||||||
$r[] = ["photo" => "images/wordpress.png", "name" => "Wordpress"];
|
$r[] = ["photo" => "images/wordpress.png", "name" => "Wordpress"];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (function_exists("imap_open") && !DI::config()->get("system", "imap_disabled") && !DI::config()->get("system", "dfrn_only")) {
|
if (function_exists("imap_open") && !DI::config()->get("system", "imap_disabled")) {
|
||||||
$r[] = ["photo" => "images/mail.png", "name" => "E-Mail"];
|
$r[] = ["photo" => "images/mail.png", "name" => "E-Mail"];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue