Diaspora: Fix class name case + add self
This commit is contained in:
		
					parent
					
						
							
								81d003cad1
							
						
					
				
			
			
				commit
				
					
						4a7c3b9eef
					
				
			
		
					 16 changed files with 28 additions and 28 deletions
				
			
		| 
						 | 
				
			
			@ -115,7 +115,7 @@ function terminate_friendship($user,$self,$contact) {
 | 
			
		|||
	}
 | 
			
		||||
	elseif($contact['network'] === NETWORK_DIASPORA) {
 | 
			
		||||
		require_once('include/diaspora.php');
 | 
			
		||||
		diaspora::send_unshare($user,$contact);
 | 
			
		||||
		Diaspora::send_unshare($user,$contact);
 | 
			
		||||
	}
 | 
			
		||||
	elseif($contact['network'] === NETWORK_DFRN) {
 | 
			
		||||
		require_once('include/dfrn.php');
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -3218,7 +3218,7 @@
 | 
			
		|||
	function api_share_as_retweet(&$item) {
 | 
			
		||||
		$body = trim($item["body"]);
 | 
			
		||||
 | 
			
		||||
		if (diaspora::is_reshare($body, false)===false) {
 | 
			
		||||
		if (Diaspora::is_reshare($body, false)===false) {
 | 
			
		||||
			return false;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -99,7 +99,7 @@ function network_to_name($s, $profile = "") {
 | 
			
		|||
 | 
			
		||||
	$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");
 | 
			
		||||
 | 
			
		||||
		$r = q("SELECT `gserver`.`platform` FROM `gcontact`
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -508,7 +508,7 @@ function delivery_run(&$argv, &$argc){
 | 
			
		|||
					break;
 | 
			
		||||
 | 
			
		||||
				if ($mail) {
 | 
			
		||||
					diaspora::send_mail($item,$owner,$contact);
 | 
			
		||||
					Diaspora::send_mail($item,$owner,$contact);
 | 
			
		||||
					break;
 | 
			
		||||
				}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -530,22 +530,22 @@ function delivery_run(&$argv, &$argc){
 | 
			
		|||
				if (($target_item['deleted']) && (($target_item['uri'] === $target_item['parent-uri']) || $followup)) {
 | 
			
		||||
					// top-level retraction
 | 
			
		||||
					logger('diaspora retract: '.$loc);
 | 
			
		||||
					diaspora::send_retraction($target_item,$owner,$contact,$public_message);
 | 
			
		||||
					Diaspora::send_retraction($target_item,$owner,$contact,$public_message);
 | 
			
		||||
					break;
 | 
			
		||||
				} elseif ($followup) {
 | 
			
		||||
					// send comments and likes to owner to relay
 | 
			
		||||
					logger('diaspora followup: '.$loc);
 | 
			
		||||
					diaspora::send_followup($target_item,$owner,$contact,$public_message);
 | 
			
		||||
					Diaspora::send_followup($target_item,$owner,$contact,$public_message);
 | 
			
		||||
					break;
 | 
			
		||||
				} elseif ($target_item['uri'] !== $target_item['parent-uri']) {
 | 
			
		||||
					// we are the relay - send comments, likes and relayable_retractions to our conversants
 | 
			
		||||
					logger('diaspora relay: '.$loc);
 | 
			
		||||
					diaspora::send_relay($target_item,$owner,$contact,$public_message);
 | 
			
		||||
					Diaspora::send_relay($target_item,$owner,$contact,$public_message);
 | 
			
		||||
					break;
 | 
			
		||||
				} elseif ($top_level && !$walltowall) {
 | 
			
		||||
					// currently no workable solution for sending walltowall
 | 
			
		||||
					logger('diaspora status: '.$loc);
 | 
			
		||||
					diaspora::send_status($target_item,$owner,$contact,$public_message);
 | 
			
		||||
					Diaspora::send_status($target_item,$owner,$contact,$public_message);
 | 
			
		||||
					break;
 | 
			
		||||
				}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -23,7 +23,7 @@ require_once("include/queue_fn.php");
 | 
			
		|||
 * @brief This class contain functions to create and send Diaspora XML files
 | 
			
		||||
 *
 | 
			
		||||
 */
 | 
			
		||||
class diaspora {
 | 
			
		||||
class Diaspora {
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * @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")
 | 
			
		||||
		$sender = $msg["author"];
 | 
			
		||||
 | 
			
		||||
		if (!diaspora::valid_posting($msg, $fields)) {
 | 
			
		||||
		if (!self::valid_posting($msg, $fields)) {
 | 
			
		||||
			logger("Invalid posting");
 | 
			
		||||
			return false;
 | 
			
		||||
		}
 | 
			
		||||
| 
						 | 
				
			
			@ -2444,7 +2444,7 @@ class diaspora {
 | 
			
		|||
		$b64url_data = base64url_encode($msg);
 | 
			
		||||
		$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";
 | 
			
		||||
		$encoding = "base64url";
 | 
			
		||||
		$alg = "RSA-SHA256";
 | 
			
		||||
| 
						 | 
				
			
			@ -2970,7 +2970,7 @@ class diaspora {
 | 
			
		|||
	 */
 | 
			
		||||
	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"]);
 | 
			
		||||
	}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -302,7 +302,7 @@ function new_contact($uid,$url,$interactive = false) {
 | 
			
		|||
		}
 | 
			
		||||
		if($contact['network'] == NETWORK_DIASPORA) {
 | 
			
		||||
			require_once('include/diaspora.php');
 | 
			
		||||
			$ret = diaspora::send_share($a->user,$contact);
 | 
			
		||||
			$ret = Diaspora::send_share($a->user,$contact);
 | 
			
		||||
			logger('share returns: '.$ret);
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -239,7 +239,7 @@ EOT;
 | 
			
		|||
 | 
			
		||||
 | 
			
		||||
	// 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;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -570,7 +570,7 @@ function notifier_run(&$argv, &$argc){
 | 
			
		|||
	if($public_message) {
 | 
			
		||||
 | 
			
		||||
		if (!$followup)
 | 
			
		||||
			$r0 = diaspora::relay_list();
 | 
			
		||||
			$r0 = Diaspora::relay_list();
 | 
			
		||||
		else
 | 
			
		||||
			$r0 = array();
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -2,5 +2,5 @@
 | 
			
		|||
require_once('include/diaspora.php');
 | 
			
		||||
 | 
			
		||||
function profile_change() {
 | 
			
		||||
	diaspora::send_profile(local_user());
 | 
			
		||||
	Diaspora::send_profile(local_user());
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -195,7 +195,7 @@ function queue_run(&$argv, &$argc){
 | 
			
		|||
			case NETWORK_DIASPORA:
 | 
			
		||||
				if($contact['notify']) {
 | 
			
		||||
					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)) {
 | 
			
		||||
						update_queue_time($q_item['id']);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -433,7 +433,7 @@ function dfrn_confirm_post(&$a,$handsfree = null) {
 | 
			
		|||
 | 
			
		||||
			if(($contact) && ($contact['network'] === NETWORK_DIASPORA)) {
 | 
			
		||||
				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);
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -50,12 +50,12 @@ function fetch_init($a){
 | 
			
		|||
	}
 | 
			
		||||
	$user = $r[0];
 | 
			
		||||
 | 
			
		||||
	$status = diaspora::build_status($item[0], $user);
 | 
			
		||||
	$xml = diaspora::build_post_xml($status["type"], $status["message"]);
 | 
			
		||||
	$status = Diaspora::build_status($item[0], $user);
 | 
			
		||||
	$xml = Diaspora::build_post_xml($status["type"], $status["message"]);
 | 
			
		||||
 | 
			
		||||
	// Send the envelope
 | 
			
		||||
	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();
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -952,7 +952,7 @@ function item_post(&$a) {
 | 
			
		|||
 | 
			
		||||
 | 
			
		||||
		// 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 {
 | 
			
		||||
		$parent = $post_id;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -54,8 +54,8 @@ function p_init($a){
 | 
			
		|||
	}
 | 
			
		||||
	$user = $r[0];
 | 
			
		||||
 | 
			
		||||
	$status = diaspora::build_status($item[0], $user);
 | 
			
		||||
	$xml = diaspora::build_post_xml($status["type"], $status["message"]);
 | 
			
		||||
	$status = Diaspora::build_status($item[0], $user);
 | 
			
		||||
	$xml = Diaspora::build_post_xml($status["type"], $status["message"]);
 | 
			
		||||
 | 
			
		||||
	header("Content-Type: application/xml; charset=utf-8");
 | 
			
		||||
	echo $xml;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -53,7 +53,7 @@ function receive_post(&$a) {
 | 
			
		|||
 | 
			
		||||
	logger('mod-diaspora: message is okay', LOGGER_DEBUG);
 | 
			
		||||
 | 
			
		||||
	$msg = diaspora::decode($importer,$xml);
 | 
			
		||||
	$msg = Diaspora::decode($importer,$xml);
 | 
			
		||||
 | 
			
		||||
	logger('mod-diaspora: decoded', LOGGER_DEBUG);
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -66,9 +66,9 @@ function receive_post(&$a) {
 | 
			
		|||
 | 
			
		||||
	$ret = 0;
 | 
			
		||||
	if($public) {
 | 
			
		||||
		diaspora::dispatch_public($msg);
 | 
			
		||||
		Diaspora::dispatch_public($msg);
 | 
			
		||||
	} else {
 | 
			
		||||
		$ret = diaspora::dispatch($importer,$msg);
 | 
			
		||||
		$ret = Diaspora::dispatch($importer,$msg);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	http_status_exit(($ret) ? $ret : 200);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -334,7 +334,7 @@ class Item extends BaseObject {
 | 
			
		|||
 | 
			
		||||
		// Diaspora isn't able to do likes on comments - but red does
 | 
			
		||||
		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"]);
 | 
			
		||||
 | 
			
		||||
		// Diaspora doesn't has multithreaded comments
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue