aboutsummaryrefslogtreecommitdiffstats
path: root/mod
diff options
context:
space:
mode:
Diffstat (limited to 'mod')
-rw-r--r--mod/admin.php3
-rw-r--r--mod/contacts.php32
-rw-r--r--mod/openid.php3
-rw-r--r--mod/pubsub.php6
-rw-r--r--mod/receive.php26
5 files changed, 32 insertions, 38 deletions
diff --git a/mod/admin.php b/mod/admin.php
index 1a926443f..7799e64ab 100644
--- a/mod/admin.php
+++ b/mod/admin.php
@@ -197,6 +197,7 @@ function admin_page_site_post(&$a){
$timeout = ((x($_POST,'timeout')) ? intval(trim($_POST['timeout'])) : 60);
$dfrn_only = ((x($_POST,'dfrn_only')) ? True : False);
$ostatus_disabled = !((x($_POST,'ostatus_disabled')) ? True : False);
+ $diaspora_enabled = ((x($_POST,'diaspora_enabled')) ? True : False);
set_config('config','sitename',$sitename);
@@ -241,6 +242,7 @@ function admin_page_site_post(&$a){
set_config('system','curl_timeout', $timeout);
set_config('system','dfrn_only', $dfrn_only);
set_config('system','ostatus_disabled', $ostatus_disabled);
+ set_config('system','diaspora_enabled', $diaspora_enabled);
info( t('Site settings updated.') . EOL);
goaway($a->get_baseurl() . '/admin/site' );
@@ -325,6 +327,7 @@ function admin_page_site(&$a) {
'$no_utf' => array('no_utf', t("UTF-8 Regular expressions"), !get_config('system','no_utf'), "Use PHP UTF8 regular expressions"),
'$no_community_page' => array('no_community_page', t("Show Community Page"), !get_config('system','no_community_page'), "Display a Community page showing all recent public postings on this site."),
'$ostatus_disabled' => array('ostatus_disabled', t("Enable OStatus support"), !get_config('system','ostatus_disable'), "Provide built-in OStatus \x28identi.ca, status.net, etc.\x29 compatibility. All communications in OStatus are public, so privacy warnings will be occasionally displayed."),
+ '$diaspora_enabled' => array('diaspora_enabled', t("Enable Diaspora support"), get_config('system','diaspora_enabled'), "Provide built-in Diaspora network compatibility."),
'$dfrn_only' => array('dfrn_only', t('Only allow Friendika contacts'), get_config('system','dfrn_only'), "All contacts must use Friendika protocols. All other built-in communication protocols disabled."),
'$verifyssl' => array('verifyssl', t("Verify SSL"), get_config('system','verifyssl'), "If you wish, you can turn on strict certificate checking. This will mean you cannot connect (at all) to self-signed SSL sites."),
'$proxyuser' => array('proxyuser', t("Proxy user"), get_config('system','proxyuser'), ""),
diff --git a/mod/contacts.php b/mod/contacts.php
index e4be93cd5..3b2b16acf 100644
--- a/mod/contacts.php
+++ b/mod/contacts.php
@@ -163,9 +163,9 @@ function contacts_content(&$a) {
if($cmd === 'block') {
$blocked = (($orig_record[0]['blocked']) ? 0 : 1);
$r = q("UPDATE `contact` SET `blocked` = %d WHERE `id` = %d AND `uid` = %d LIMIT 1",
- intval($blocked),
- intval($contact_id),
- intval(local_user())
+ intval($blocked),
+ intval($contact_id),
+ intval(local_user())
);
if($r) {
//notice( t('Contact has been ') . (($blocked) ? t('blocked') : t('unblocked')) . EOL );
@@ -178,9 +178,9 @@ function contacts_content(&$a) {
if($cmd === 'ignore') {
$readonly = (($orig_record[0]['readonly']) ? 0 : 1);
$r = q("UPDATE `contact` SET `readonly` = %d WHERE `id` = %d AND `uid` = %d LIMIT 1",
- intval($readonly),
- intval($contact_id),
- intval(local_user())
+ intval($readonly),
+ intval($contact_id),
+ intval(local_user())
);
if($r) {
info( (($readonly) ? t('Contact has been ignored') : t('Contact has been unignored')) . EOL );
@@ -193,7 +193,7 @@ function contacts_content(&$a) {
// create an unfollow slap
- if($orig_record[0]['network'] === 'stat') {
+ if($orig_record[0]['network'] === NETWORK_OSTATUS) {
$tpl = get_markup_template('follow_slap.tpl');
$slap = replace_macros($tpl, array(
'$name' => $a->user['username'],
@@ -215,13 +215,15 @@ function contacts_content(&$a) {
slapper($a->user,$orig_record[0]['notify'],$slap);
}
}
-
- if($orig_record[0]['network'] === 'dfrn') {
+ elseif($orig_record[0]['network'] === NETWORK_DIASPORA) {
+ require_once('include/diaspora.php');
+ diaspora_unshare($a->user,$orig_record[0]);
+ }
+ elseif($orig_record[0]['network'] === NETWORK_DFRN) {
require_once('include/items.php');
dfrn_deliver($a->user,$orig_record[0],'placeholder', 1);
}
-
contact_remove($orig_record[0]['id']);
info( t('Contact has been removed.') . EOL );
goaway($a->get_baseurl() . '/contacts');
@@ -290,6 +292,9 @@ function contacts_content(&$a) {
$lblsuggest = (($r[0]['network'] === NETWORK_DFRN)
? '<div id="contact-suggest-wrapper"><a href="fsuggest/' . $r[0]['id'] . '" id="contact-suggest">' . t('Suggest friends') . '</a></div>' : '');
+ $poll_enabled = (($r[0]['network'] !== NETWORK_DIASPORA) ? true : false);
+
+ $nettype = '<div id="contact-edit-nettype">' . sprintf( t('Network type: %s'),network_to_name($r[0]['network'])) . '</div>';
$o .= replace_macros($tpl,array(
'$header' => t('Contact Editor'),
@@ -310,7 +315,9 @@ function contacts_content(&$a) {
'$lblsuggest' => $lblsuggest,
'$grps' => $grps,
'$delete' => t('Delete contact'),
- '$poll_interval' => contact_poll_interval($r[0]['priority']),
+ '$nettype' => $nettype,
+ '$poll_interval' => contact_poll_interval($r[0]['priority'],(! $poll_enabled)),
+ '$poll_enabled' => $poll_enabled,
'$lastupdtext' => t('Last updated: '),
'$updpub' => t('Update public posts: '),
'$last_update' => $last_update,
@@ -420,11 +427,12 @@ function contacts_content(&$a) {
$o .= replace_macros($tpl, array(
'$img_hover' => sprintf( t('Visit %s\'s profile [%s]'),$rr['name'],$rr['url']),
'$edit_hover' => t('Edit contact'),
+ '$contact_photo_menu' => contact_photo_menu($rr),
'$id' => $rr['id'],
'$alt_text' => $alt_text,
'$dir_icon' => $dir_icon,
'$thumb' => $rr['thumb'],
- '$name' => substr($rr['name'],0,20),
+ '$name' => $rr['name'],
'$username' => $rr['name'],
'$sparkle' => $sparkle,
'$url' => $url
diff --git a/mod/openid.php b/mod/openid.php
index 6fbd013b8..3c3293147 100644
--- a/mod/openid.php
+++ b/mod/openid.php
@@ -55,7 +55,8 @@ function openid_content(&$a) {
}
- $r = q("SELECT * FROM `user` WHERE `openid` = '%s' AND `blocked` = 0 AND `verified` = 1 LIMIT 1",
+ $r = q("SELECT `user`.*, `user`.`pubkey` as `upubkey`, `user`.`prvkey` as `uprvkey`
+ FROM `user` WHERE `openid` = '%s' AND `blocked` = 0 AND `verified` = 1 LIMIT 1",
dbesc($_SESSION['openid'])
);
if(! count($r)) {
diff --git a/mod/pubsub.php b/mod/pubsub.php
index d6e3d378f..4dff5d531 100644
--- a/mod/pubsub.php
+++ b/mod/pubsub.php
@@ -122,6 +122,12 @@ function pubsub_post(&$a) {
$contact = $r[0];
+ // we have no way to match Diaspora guid's with atom post id's and could get duplicates.
+ // we'll assume that direct delivery is robust (and this is a bad assumption, but the duplicates are messy).
+
+ if($r[0]['network'] === NETWORK_DIASPORA)
+ hub_post_return();
+
$feedhub = '';
require_once('include/items.php');
diff --git a/mod/receive.php b/mod/receive.php
index c3738c143..34128518b 100644
--- a/mod/receive.php
+++ b/mod/receive.php
@@ -15,8 +15,6 @@ function receive_post(&$a) {
if($a->argc != 3 || $a->argv[1] !== 'users')
http_status_exit(500);
- logger('receive: raw input: ' . file_get_contents('php://input'), LOGGER_DATA);
-
$guid = $a->argv[2];
$r = q("SELECT * FROM `user` WHERE `guid` = '%s' LIMIT 1",
@@ -43,29 +41,7 @@ function receive_post(&$a) {
if(! is_array($msg))
http_status_exit(500);
-
- $parsed_xml = parse_xml_string($msg['message'],false);
-
- $xmlbase = $parsed_xml->post;
-
- if($xmlbase->request) {
- diaspora_request($importer,$xmlbase->request);
- }
- elseif($xmlbase->status_message) {
- diaspora_post($importer,$xmlbase->status_message);
- }
- elseif($xmlbase->comment) {
- diaspora_comment($importer,$xmlbase->comment,$msg);
- }
- elseif($xmlbase->like) {
- diaspora_like($importer,$xmlbase->like,$msg);
- }
- elseif($xmlbase->retraction) {
- diaspora_retraction($importer,$xmlbase->retraction,$msg);
- }
- else {
- logger('mod-diaspora: unknown message type: ' . print_r($xmlbase,true));
- }
+ diaspora_dispatch($importer,$msg);
http_status_exit(200);
// NOTREACHED