aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorredmatrix <redmatrix@redmatrix.me>2015-08-03 16:52:51 -0700
committerredmatrix <redmatrix@redmatrix.me>2015-08-03 16:52:51 -0700
commitb737e224b149c1c27775bfc213125eea0ce540b8 (patch)
tree76625d521743a6af375700231a009321ab9d86e8
parentdb70c76494997dfda4f850b4ee63ddae2c608bde (diff)
downloadvolse-hubzilla-b737e224b149c1c27775bfc213125eea0ce540b8.tar.gz
volse-hubzilla-b737e224b149c1c27775bfc213125eea0ce540b8.tar.bz2
volse-hubzilla-b737e224b149c1c27775bfc213125eea0ce540b8.zip
more work separating Diaspora from core
-rw-r--r--include/follow.php27
-rw-r--r--include/network.php5
-rw-r--r--mod/admin.php3
-rw-r--r--mod/settings.php25
-rwxr-xr-xview/tpl/admin_site.tpl1
-rwxr-xr-xview/tpl/settings_addons.tpl23
6 files changed, 14 insertions, 70 deletions
diff --git a/include/follow.php b/include/follow.php
index 9430feac6..960138743 100644
--- a/include/follow.php
+++ b/include/follow.php
@@ -129,19 +129,6 @@ function new_contact($uid,$url,$channel,$interactive = false, $confirm = false)
}
}
else {
- if(! ($is_http)) {
- if(! intval(get_config('system','diaspora_enabled'))) {
- $result['message'] = t('Protocol disabled.');
- return $result;
- }
-
- $allowed = get_pconfig($uid,'system','diaspora_allowed');
-
- if(! intval($allowed)) {
- $result['message'] = t('Protocol blocked for this channel.');
- return $result;
- }
- }
$their_perms = 0;
$xchan_hash = '';
@@ -158,8 +145,15 @@ function new_contact($uid,$url,$channel,$interactive = false, $confirm = false)
}
elseif($is_http) {
$r = discover_by_url($url);
+ $r['allowed'] = intval(get_config('system','feed_contacts'));
}
if($r) {
+ $r['channel_id'] = $uid;
+ call_hooks('follow_allow',$r);
+ if(! $r['allowed']) {
+ $result['message'] = t('Protocol disabled.');
+ return $result;
+ }
$r = q("select * from xchan where xchan_hash = '%s' or xchan_url = '%s' limit 1",
dbesc($url),
dbesc($url)
@@ -199,10 +193,6 @@ function new_contact($uid,$url,$channel,$interactive = false, $confirm = false)
if($is_http) {
- if(! intval(get_config('system','feed_contacts'))) {
- $result['message'] = t('Protocol disabled.');
- return $result;
- }
$r = q("select count(*) as total from abook where abook_account = %d and abook_feed = 1 ",
intval($aid)
@@ -261,8 +251,7 @@ function new_contact($uid,$url,$channel,$interactive = false, $confirm = false)
);
if($r) {
$result['abook'] = $r[0];
- if($is_red)
- proc_run('php', 'include/notifier.php', 'permission_update', $result['abook']['abook_id']);
+ proc_run('php', 'include/notifier.php', 'permission_update', $result['abook']['abook_id']);
}
$arr = array('channel_id' => $uid, 'abook' => $result['abook']);
diff --git a/include/network.php b/include/network.php
index 5d01b7eba..ef92e0132 100644
--- a/include/network.php
+++ b/include/network.php
@@ -1068,6 +1068,11 @@ function discover_by_webbie($webbie) {
}
}
+ $arr = array('address' => $webbie, 'success' => false);
+ call_hooks('discover_by_webbie', $arr);
+ if($arr['success'])
+ return true;
+
$result = array();
$network = null;
$diaspora = false;
diff --git a/mod/admin.php b/mod/admin.php
index 3b8cd2a95..794bac69b 100644
--- a/mod/admin.php
+++ b/mod/admin.php
@@ -299,11 +299,9 @@ function admin_page_site_post(&$a){
$poll_interval = ((x($_POST,'poll_interval')) ? intval(trim($_POST['poll_interval'])) : 0);
$maxloadavg = ((x($_POST,'maxloadavg')) ? intval(trim($_POST['maxloadavg'])) : 50);
$feed_contacts = ((x($_POST,'feed_contacts')) ? intval($_POST['feed_contacts']) : 0);
- $diaspora_enabled = ((x($_POST,'diaspora_enabled')) ? intval($_POST['diaspora_enabled']) : 0);
$verify_email = ((x($_POST,'verify_email')) ? 1 : 0);
set_config('system', 'feed_contacts', $feed_contacts);
- set_config('system', 'diaspora_enabled', $diaspora_enabled);
set_config('system', 'delivery_interval', $delivery_interval);
set_config('system', 'poll_interval', $poll_interval);
set_config('system', 'maxloadavg', $maxloadavg);
@@ -465,7 +463,6 @@ function admin_page_site(&$a) {
'$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),
'$theme_mobile' => array('theme_mobile', t("Mobile system theme"), get_config('system','mobile_theme'), t("Theme for mobile devices"), $theme_choices_mobile),
// '$site_channel' => array('site_channel', t("Channel to use for this website's static pages"), get_config('system','site_channel'), t("Site Channel")),
- '$diaspora_enabled' => array('diaspora_enabled',t('Enable Diaspora Protocol'), get_config('system','diaspora_enabled'), t('Communicate with Diaspora and Friendica - experimental')),
'$feed_contacts' => array('feed_contacts', t('Allow Feeds as Connections'),get_config('system','feed_contacts'),t('(Heavy system resource usage)')),
'$maximagesize' => array('maximagesize', t("Maximum image size"), intval(get_config('system','maximagesize')), t("Maximum size in bytes of uploaded images. Default is 0, which means no limits.")),
'$register_policy' => array('register_policy', t("Does this site allow new member registration?"), get_config('system','register_policy'), "", $register_choices),
diff --git a/mod/settings.php b/mod/settings.php
index f26182dc6..cbd6abafc 100644
--- a/mod/settings.php
+++ b/mod/settings.php
@@ -123,13 +123,6 @@ function settings_post(&$a) {
call_hooks('feature_settings_post', $_POST);
- if($_POST['dspr-submit']) {
- set_pconfig(local_channel(),'system','diaspora_allowed',intval($_POST['dspr_allowed']));
- set_pconfig(local_channel(),'system','diaspora_public_comments',intval($_POST['dspr_pubcomment']));
- set_pconfig(local_channel(),'system','prevent_tag_hijacking',intval($_POST['dspr_hijack']));
- info( t('Diaspora Policy Settings updated.') . EOL);
- }
-
build_sync_packet();
return;
}
@@ -664,33 +657,17 @@ function settings_content(&$a) {
$settings_addons = "";
$o = '';
- $diaspora_enabled = get_config('system','diaspora_enabled');
$r = q("SELECT * FROM `hook` WHERE `hook` = 'feature_settings' ");
- if((! $r) && (! $diaspora_enabled))
+ if(! $r)
$settings_addons = t('No feature settings configured');
- if($diaspora_enabled) {
- $dspr_allowed = get_pconfig(local_channel(),'system','diaspora_allowed');
- $pubcomments = get_pconfig(local_channel(),'system','diaspora_public_comments');
- if($pubcomments === false)
- $pubcomments = 1;
- $hijacking = get_pconfig(local_channel(),'system','prevent_tag_hijacking');
- }
-
call_hooks('feature_settings', $settings_addons);
$tpl = get_markup_template("settings_addons.tpl");
$o .= replace_macros($tpl, array(
'$form_security_token' => get_form_security_token("settings_featured"),
'$title' => t('Feature/Addon Settings'),
- '$diaspora_enabled' => $diaspora_enabled,
- '$dsprdesc' => t('Settings for the built-in Diaspora emulator'),
- '$pubcomments' => array('dspr_pubcomment', t('Allow any Diaspora member to comment on your public posts'), $pubcomments, '', $yes_no),
- '$dspr_allowed' => array('dspr_allowed', t('Enable the Diaspora protocol for this channel'), $dspr_allowed, '', $yes_no),
- '$dsprtitle' => t('Diaspora Policy Settings'),
- '$hijacking' => array('dspr_hijack', t('Prevent your hashtags from being redirected to other sites'), $hijacking, '', $yes_no),
- '$dsprsubmit' => t('Submit'),
'$settings_addons' => $settings_addons
));
return $o;
diff --git a/view/tpl/admin_site.tpl b/view/tpl/admin_site.tpl
index 3884038c0..e2ce3c552 100755
--- a/view/tpl/admin_site.tpl
+++ b/view/tpl/admin_site.tpl
@@ -67,7 +67,6 @@
<h3>{{$corporate}}</h3>
{{include file="field_checkbox.tpl" field=$block_public}}
{{include file="field_checkbox.tpl" field=$verify_email}}
- {{include file="field_checkbox.tpl" field=$diaspora_enabled}}
{{include file="field_checkbox.tpl" field=$feed_contacts}}
{{include file="field_checkbox.tpl" field=$force_publish}}
{{include file="field_checkbox.tpl" field=$disable_discover_tab}}
diff --git a/view/tpl/settings_addons.tpl b/view/tpl/settings_addons.tpl
index ae8dac3f8..52f8d9d3f 100755
--- a/view/tpl/settings_addons.tpl
+++ b/view/tpl/settings_addons.tpl
@@ -5,29 +5,6 @@
<form action="settings/featured" method="post" autocomplete="off">
<input type='hidden' name='form_security_token' value='{{$form_security_token}}'>
<div class="panel-group" id="settings" role="tablist">
- {{if $diaspora_enabled}}
- <div class="panel">
- <div class="section-subtitle-wrapper" role="tab" id="dspr-settings">
- <h3>
- <a title="{{$dsprdesc}}" data-toggle="collapse" data-parent="#settings" href="#dspr-settings-content" aria-controls="dspr-settings-content">
- {{$dsprtitle}}
- </a>
- </h3>
- </div>
- <div id="dspr-settings-content" class="panel-collapse collapse" role="tabpanel" aria-labelledby="dspr-settings">
- <div class="section-content-tools-wrapper">
-
- {{include file="field_checkbox.tpl" field=$dspr_allowed}}
- {{include file="field_checkbox.tpl" field=$pubcomments}}
- {{include file="field_checkbox.tpl" field=$hijacking}}
-
- <div class="settings-submit-wrapper" >
- <button type="submit" name="dspr-submit" class="btn btn-primary" value="{{$dsprsubmit}}">{{$dsprsubmit}}</button>
- </div>
- </div>
- </div>
- </div>
- {{/if}}
{{$settings_addons}}
</div>
</form>