Example #1
0
  $p->author($ne1->ds);
  $p->owner($ne2->ds);
  $p->sanitizeDataset();
	// to se if sanitizeDataset() corrupts entries
  $p->sanitizeDataset();
  tlog($p->authorEntity->ds['_key'] > 0, 'HubbubMessage->authorEntity key', 'OK ('.$p->authorEntity->ds['_key'].')', 'no key assigned');
  tlog($p->authorEntity->ds['user'] == $p->data['author']['user'], 'HubbubMessage->authorEntity username', 'OK', 'not assigned');
  tlog($p->ownerEntity->ds['_key'] > 0, 'HubbubMessage->ownerEntity', 'OK ('.$p->ownerEntity->ds['_key'].')', 'no key assigned');
  tlog($p->ownerEntity->ds['user'] == $p->data['owner']['user'], 'HubbubMessage->ownerEntity username', 'OK', 'not assigned');
  tlog($p->data['owner']['server'] != '', 'HubbubMessage->ownerEntity server', 'OK', 'not assigned');
  
	$toServer = new HubbubServer($p->ownerEntity->ds['server']);
  tlog($toServer->ds['s_key'] > 0, 'HubbubServer::new('.$p->ownerEntity->ds['server'].')', 'OK ('.$toServer->ds['s_key'].')', 'not loaded');
  tlog($toServer->outboundKey() != '', 'HubbubServer->outboundKey()', 'OK ('.$toServer->outboundKey().')', 'not found');
  tlog($toServer->inboundKey() != '', 'HubbubServer->inboundKey()', 'OK ('.$toServer->inboundKey().')', 'not found');
  $p->signForServer($toServer);
  tlog($p->signature == md5($toServer->outboundKey().$p->payload), 'HubbubMessage::signForServer('.$p->ownerEntity->ds['server'].')', 'OK ('.$p->signature.')', 'invalid signature');
  tlog($p->validateSignature(), 'HubbubMessage->validateSignature(valid)', 'OK', 'failure');
	$p->signature = md5($p->signature);
	$GLOBALS['nolog'] = true; // disable logging, because we'll trigger an error here
	tlog(!$p->validateSignature(), 'HubbubMessage->validateSignature(invalid)', 'OK', 'failure');
  $GLOBALS['nolog'] = false;
  $p->signForServer($toServer);
  $r = new HubbubMessage();
	$r->receive($p->payload, $p->signature);
  tlog($r->validateSignature(), 'HubbubMessage->receive() signature', 'OK', 'failure ('.$p->expectedSignature.')');

  tsection('Friends');
  
	$url = $ne2->ds['url'];
  require_once('lib/hubbub2_loadurl.php');