$res['app'] = 'OStatus';
}
-
// base64 encoded json structure representing Diaspora signature
- $dspr_enabled = intval(get_config('system','diaspora_enabled'));
-
- if( $dspr_enabled) {
- $dsig = $item->get_item_tags(NAMESPACE_DFRN,'diaspora_signature');
- if($dsig) {
- $res['dsprsig'] = unxmlify($dsig[0]['data']);
- }
- $dguid = $item->get_item_tags(NAMESPACE_DFRN,'diaspora_guid');
- if($dguid)
- $res['guid'] = unxmlify($dguid[0]['data']);
+ $dsig = $item->get_item_tags(NAMESPACE_DFRN,'diaspora_signature');
+ if($dsig) {
+ $res['dsprsig'] = unxmlify($dsig[0]['data']);
}
+ $dguid = $item->get_item_tags(NAMESPACE_DFRN,'diaspora_guid');
+ if($dguid)
+ $res['guid'] = unxmlify($dguid[0]['data']);
$bm = $item->get_item_tags(NAMESPACE_DFRN,'bookmark');
if($bm)
// If a Diaspora signature structure was passed in, pull it out of the
// item array and set it aside for later storage.
- $dspr_enabled = intval(get_config('system','diaspora_enabled'));
$dsprsig = null;
-
if(x($arr,'dsprsig')) {
- if($dspr_enabled)
- $dsprsig = json_decode(base64_decode($arr['dsprsig']));
+ $dsprsig = json_decode(base64_decode($arr['dsprsig']));
unset($arr['dsprsig']);
}
-
if(x($arr, 'gravity'))
$arr['gravity'] = intval($arr['gravity']);
elseif($arr['parent-uri'] === $arr['uri'])
intval($parent_id)
);
-
- // Store the Diaspora signature if there is one
- if($dspr_enabled && $dsprsig) {
+ if($dsprsig) {
q("insert into sign (`iid`,`signed_text`,`signature`,`signer`) values (%d,'%s','%s','%s') ",
intval($current_post),
dbesc($dsprsig->signed_text),
$dlink = normalise_link($a->get_baseurl() . '/u/' . $u[0]['nickname']);
-
$cnt = preg_match_all('/[\@\!]\[url\=(.*?)\](.*?)\[\/url\]/ism',$item['body'],$matches,PREG_SET_ORDER);
if($cnt) {
foreach($matches as $mtch) {
$is_a_remote_comment = false;
+ // POSSIBLE CLEANUP --> Why select so many fields when only forum_mode and wall are used?
$r = q("select `item`.`id`, `item`.`uri`, `item`.`tag`, `item`.`forum_mode`,`item`.`origin`,`item`.`wall`,
`contact`.`name`, `contact`.`url`, `contact`.`thumb` from `item`
LEFT JOIN `contact` ON `contact`.`id` = `item`.`contact-id`
if($item['app'])
$o .= '<statusnet:notice_info local_id="' . $item['id'] . '" source="' . xmlify($item['app']) . '" ></statusnet:notice_info>' . "\r\n";
- $dspr_enabled = intval(get_config('system','diaspora_enabled'));
- if( $dspr_enabled) {
- if($item['guid'])
- $o .= '<dfrn:diaspora_guid>' . $item['guid'] . '</dfrn:diaspora_guid>' . "\r\n";
+ if($item['guid'])
+ $o .= '<dfrn:diaspora_guid>' . $item['guid'] . '</dfrn:diaspora_guid>' . "\r\n";
- if($item['signed_text']) {
- $sign = base64_encode(json_encode(array('signed_text' => $item['signed_text'],'signature' => $item['signature'],'signer' => $item['signer'])));
- $o .= '<dfrn:diaspora_signature>' . xmlify($sign) . '</dfrn:diaspora_signature>' . "\r\n";
- }
+ if($item['signed_text']) {
+ $sign = base64_encode(json_encode(array('signed_text' => $item['signed_text'],'signature' => $item['signature'],'signer' => $item['signer'])));
+ $o .= '<dfrn:diaspora_signature>' . xmlify($sign) . '</dfrn:diaspora_signature>' . "\r\n";
}
$verb = construct_verb($item);
// ignore the result
}
- // clean up item_id and sign (Diaspora signature) meta-data tables
- // Clean up the sign table even if Diaspora support is disabled. We may still need to
- // clean it up if Diaspora support had been enabled in the past
+ // clean up item_id and sign meta-data tables
$r = q("DELETE FROM item_id where iid in (select id from item where parent = %d and uid = %d)",
intval($item['id']),
$uid = $r[0]['uid'];
$updated = $r[0]['edited'];
- // The following seems superfluous. We've already checked for "if (! intval($r[0]['parent']))" a few lines up
+ // POSSIBLE CLEANUP --> The following seems superfluous. We've already checked for "if (! intval($r[0]['parent']))" a few lines up
if(! $parent_id)
return;
}
break;
case NETWORK_DIASPORA:
+ require_once('include/diaspora.php');
+
if(get_config('system','dfrn_only') || (! get_config('system','diaspora_enabled')))
break;
- require_once('include/diaspora.php');
-
if($mail) {
diaspora_send_mail($item,$owner,$contact);
break;
}
-
- // If the item was deleted, clean up the `sign` table (for Diaspora signatures)
- // Do this even if Diaspora support is disabled, as it may have been enabled in
- // the past
+ // If the item was deleted, clean up the `sign` table
if($target_item['deleted']) {
$r = q("DELETE FROM sign where `retract_iid` = %d",
intval($target_item['id'])
);
}
-
logger('notifier: calling hooks', LOGGER_DEBUG);
if($normal_mode)