Diaspora: Fix class name case + add self

This commit is contained in:
Hypolite Petovan 2016-12-20 12:44:15 -05:00
parent 81d003cad1
commit 4a7c3b9eef
16 changed files with 28 additions and 28 deletions

View File

@ -115,7 +115,7 @@ function terminate_friendship($user,$self,$contact) {
} }
elseif($contact['network'] === NETWORK_DIASPORA) { elseif($contact['network'] === NETWORK_DIASPORA) {
require_once('include/diaspora.php'); require_once('include/diaspora.php');
diaspora::send_unshare($user,$contact); Diaspora::send_unshare($user,$contact);
} }
elseif($contact['network'] === NETWORK_DFRN) { elseif($contact['network'] === NETWORK_DFRN) {
require_once('include/dfrn.php'); require_once('include/dfrn.php');

View File

@ -3218,7 +3218,7 @@
function api_share_as_retweet(&$item) { function api_share_as_retweet(&$item) {
$body = trim($item["body"]); $body = trim($item["body"]);
if (diaspora::is_reshare($body, false)===false) { if (Diaspora::is_reshare($body, false)===false) {
return false; return false;
} }

View File

@ -99,7 +99,7 @@ function network_to_name($s, $profile = "") {
$networkname = str_replace($search,$replace,$s); $networkname = str_replace($search,$replace,$s);
if (($s == NETWORK_DIASPORA) AND ($profile != "") AND diaspora::is_redmatrix($profile)) { if (($s == NETWORK_DIASPORA) AND ($profile != "") AND Diaspora::is_redmatrix($profile)) {
$networkname = t("Hubzilla/Redmatrix"); $networkname = t("Hubzilla/Redmatrix");
$r = q("SELECT `gserver`.`platform` FROM `gcontact` $r = q("SELECT `gserver`.`platform` FROM `gcontact`

View File

@ -508,7 +508,7 @@ function delivery_run(&$argv, &$argc){
break; break;
if ($mail) { if ($mail) {
diaspora::send_mail($item,$owner,$contact); Diaspora::send_mail($item,$owner,$contact);
break; break;
} }
@ -530,22 +530,22 @@ function delivery_run(&$argv, &$argc){
if (($target_item['deleted']) && (($target_item['uri'] === $target_item['parent-uri']) || $followup)) { if (($target_item['deleted']) && (($target_item['uri'] === $target_item['parent-uri']) || $followup)) {
// top-level retraction // top-level retraction
logger('diaspora retract: '.$loc); logger('diaspora retract: '.$loc);
diaspora::send_retraction($target_item,$owner,$contact,$public_message); Diaspora::send_retraction($target_item,$owner,$contact,$public_message);
break; break;
} elseif ($followup) { } elseif ($followup) {
// send comments and likes to owner to relay // send comments and likes to owner to relay
logger('diaspora followup: '.$loc); logger('diaspora followup: '.$loc);
diaspora::send_followup($target_item,$owner,$contact,$public_message); Diaspora::send_followup($target_item,$owner,$contact,$public_message);
break; break;
} elseif ($target_item['uri'] !== $target_item['parent-uri']) { } elseif ($target_item['uri'] !== $target_item['parent-uri']) {
// we are the relay - send comments, likes and relayable_retractions to our conversants // we are the relay - send comments, likes and relayable_retractions to our conversants
logger('diaspora relay: '.$loc); logger('diaspora relay: '.$loc);
diaspora::send_relay($target_item,$owner,$contact,$public_message); Diaspora::send_relay($target_item,$owner,$contact,$public_message);
break; break;
} elseif ($top_level && !$walltowall) { } elseif ($top_level && !$walltowall) {
// currently no workable solution for sending walltowall // currently no workable solution for sending walltowall
logger('diaspora status: '.$loc); logger('diaspora status: '.$loc);
diaspora::send_status($target_item,$owner,$contact,$public_message); Diaspora::send_status($target_item,$owner,$contact,$public_message);
break; break;
} }

View File

@ -23,7 +23,7 @@ require_once("include/queue_fn.php");
* @brief This class contain functions to create and send Diaspora XML files * @brief This class contain functions to create and send Diaspora XML files
* *
*/ */
class diaspora { class Diaspora {
/** /**
* @brief Return a list of relay servers * @brief Return a list of relay servers
@ -344,7 +344,7 @@ class diaspora {
// This will often be different with relayed messages (for example "like" and "comment") // This will often be different with relayed messages (for example "like" and "comment")
$sender = $msg["author"]; $sender = $msg["author"];
if (!diaspora::valid_posting($msg, $fields)) { if (!self::valid_posting($msg, $fields)) {
logger("Invalid posting"); logger("Invalid posting");
return false; return false;
} }
@ -2444,7 +2444,7 @@ class diaspora {
$b64url_data = base64url_encode($msg); $b64url_data = base64url_encode($msg);
$data = str_replace(array("\n", "\r", " ", "\t"), array("", "", "", ""), $b64url_data); $data = str_replace(array("\n", "\r", " ", "\t"), array("", "", "", ""), $b64url_data);
$key_id = base64url_encode(diaspora::my_handle($user)); $key_id = base64url_encode(self::my_handle($user));
$type = "application/xml"; $type = "application/xml";
$encoding = "base64url"; $encoding = "base64url";
$alg = "RSA-SHA256"; $alg = "RSA-SHA256";
@ -2970,7 +2970,7 @@ class diaspora {
*/ */
public static function send_status($item, $owner, $contact, $public_batch = false) { public static function send_status($item, $owner, $contact, $public_batch = false) {
$status = diaspora::build_status($item, $owner); $status = self::build_status($item, $owner);
return self::build_and_transmit($owner, $contact, $status["type"], $status["message"], $public_batch, $item["guid"]); return self::build_and_transmit($owner, $contact, $status["type"], $status["message"], $public_batch, $item["guid"]);
} }

View File

@ -302,7 +302,7 @@ function new_contact($uid,$url,$interactive = false) {
} }
if($contact['network'] == NETWORK_DIASPORA) { if($contact['network'] == NETWORK_DIASPORA) {
require_once('include/diaspora.php'); require_once('include/diaspora.php');
$ret = diaspora::send_share($a->user,$contact); $ret = Diaspora::send_share($a->user,$contact);
logger('share returns: '.$ret); logger('share returns: '.$ret);
} }
} }

View File

@ -239,7 +239,7 @@ EOT;
// Save the author information for the like in case we need to relay to Diaspora // Save the author information for the like in case we need to relay to Diaspora
diaspora::store_like_signature($contact, $post_id); Diaspora::store_like_signature($contact, $post_id);
$arr['id'] = $post_id; $arr['id'] = $post_id;

View File

@ -570,7 +570,7 @@ function notifier_run(&$argv, &$argc){
if($public_message) { if($public_message) {
if (!$followup) if (!$followup)
$r0 = diaspora::relay_list(); $r0 = Diaspora::relay_list();
else else
$r0 = array(); $r0 = array();

View File

@ -2,5 +2,5 @@
require_once('include/diaspora.php'); require_once('include/diaspora.php');
function profile_change() { function profile_change() {
diaspora::send_profile(local_user()); Diaspora::send_profile(local_user());
} }

View File

@ -195,7 +195,7 @@ function queue_run(&$argv, &$argc){
case NETWORK_DIASPORA: case NETWORK_DIASPORA:
if($contact['notify']) { if($contact['notify']) {
logger('queue: diaspora_delivery: item '.$q_item['id'].' for '.$contact['name'].' <'.$contact['url'].'>'); logger('queue: diaspora_delivery: item '.$q_item['id'].' for '.$contact['name'].' <'.$contact['url'].'>');
$deliver_status = diaspora::transmit($owner,$contact,$data,$public,true); $deliver_status = Diaspora::transmit($owner,$contact,$data,$public,true);
if($deliver_status == (-1)) { if($deliver_status == (-1)) {
update_queue_time($q_item['id']); update_queue_time($q_item['id']);

View File

@ -433,7 +433,7 @@ function dfrn_confirm_post(&$a,$handsfree = null) {
if(($contact) && ($contact['network'] === NETWORK_DIASPORA)) { if(($contact) && ($contact['network'] === NETWORK_DIASPORA)) {
require_once('include/diaspora.php'); require_once('include/diaspora.php');
$ret = diaspora::send_share($user[0],$r[0]); $ret = Diaspora::send_share($user[0],$r[0]);
logger('share returns: ' . $ret); logger('share returns: ' . $ret);
} }

View File

@ -50,12 +50,12 @@ function fetch_init($a){
} }
$user = $r[0]; $user = $r[0];
$status = diaspora::build_status($item[0], $user); $status = Diaspora::build_status($item[0], $user);
$xml = diaspora::build_post_xml($status["type"], $status["message"]); $xml = Diaspora::build_post_xml($status["type"], $status["message"]);
// Send the envelope // Send the envelope
header("Content-Type: application/magic-envelope+xml; charset=utf-8"); header("Content-Type: application/magic-envelope+xml; charset=utf-8");
echo diaspora::build_magic_envelope($xml, $user); echo Diaspora::build_magic_envelope($xml, $user);
killme(); killme();
} }

View File

@ -952,7 +952,7 @@ function item_post(&$a) {
// Store the comment signature information in case we need to relay to Diaspora // Store the comment signature information in case we need to relay to Diaspora
diaspora::store_comment_signature($datarray, $author, ($self ? $user['prvkey'] : false), $post_id); Diaspora::store_comment_signature($datarray, $author, ($self ? $user['prvkey'] : false), $post_id);
} else { } else {
$parent = $post_id; $parent = $post_id;

View File

@ -54,8 +54,8 @@ function p_init($a){
} }
$user = $r[0]; $user = $r[0];
$status = diaspora::build_status($item[0], $user); $status = Diaspora::build_status($item[0], $user);
$xml = diaspora::build_post_xml($status["type"], $status["message"]); $xml = Diaspora::build_post_xml($status["type"], $status["message"]);
header("Content-Type: application/xml; charset=utf-8"); header("Content-Type: application/xml; charset=utf-8");
echo $xml; echo $xml;

View File

@ -53,7 +53,7 @@ function receive_post(&$a) {
logger('mod-diaspora: message is okay', LOGGER_DEBUG); logger('mod-diaspora: message is okay', LOGGER_DEBUG);
$msg = diaspora::decode($importer,$xml); $msg = Diaspora::decode($importer,$xml);
logger('mod-diaspora: decoded', LOGGER_DEBUG); logger('mod-diaspora: decoded', LOGGER_DEBUG);
@ -66,9 +66,9 @@ function receive_post(&$a) {
$ret = 0; $ret = 0;
if($public) { if($public) {
diaspora::dispatch_public($msg); Diaspora::dispatch_public($msg);
} else { } else {
$ret = diaspora::dispatch($importer,$msg); $ret = Diaspora::dispatch($importer,$msg);
} }
http_status_exit(($ret) ? $ret : 200); http_status_exit(($ret) ? $ret : 200);

View File

@ -334,7 +334,7 @@ class Item extends BaseObject {
// Diaspora isn't able to do likes on comments - but red does // Diaspora isn't able to do likes on comments - but red does
if (($item["item_network"] == NETWORK_DIASPORA) AND ($indent == 'comment') AND if (($item["item_network"] == NETWORK_DIASPORA) AND ($indent == 'comment') AND
!diaspora::is_redmatrix($item["owner-link"]) AND isset($buttons["like"])) !Diaspora::is_redmatrix($item["owner-link"]) AND isset($buttons["like"]))
unset($buttons["like"]); unset($buttons["like"]);
// Diaspora doesn't has multithreaded comments // Diaspora doesn't has multithreaded comments