Пример #1
0
  $res = $fpost->sendToUrl($fpost->ownerEntity->ds['server']);
  // see if the message was accepted on the "other" end
  tlog($res['result'] == 'OK', 'foreign_post sentToUrl('.$fpost->ownerEntity->ds['url'].')', 'OK ('.$fpost->data['msgid'].')', 'fail ('.$fpost->responseData['reason'].')');
  // this tests whether the message was instantly published (a post record was returned)
  tlog(sizeof($fpost->responseData['post']) > 0, 'foreign_post auto_publish on receive', 'OK ('.$fpost->responseData['post']['msgid'].')', 'fail');
  // is the message text uncorrupted?
  tlog($fpost->responseData['post']['text'] == $fpost->data['text'], 'foreign_post text unicode', 'OK', 'fail');
  tlog($fpost->responseData['post']['msgid'] != $fpost->data['msgid'], 'foreign_post-to-post ID change', 'OK', 'fail');
  // now, this activity should appear on $ne2's profile stream
	$wallPosts1 = $this->msg->getPostList($ne2->key());
	foreach($wallPosts1['list'] as $pds)
	  if($pds['m_id'] == $fpost->responseData['post']['msgid']) $postFound4 = true; 
	tlog($postFound4, 'post found on '.$u2name.'\'s profile', 'OK', 'fail '.dumpArray($wallPosts1));

  tsection('Realtime Updates');

  // if I am the owner of the message, I send it out to my closest friends as a realtime notification!
  $post = new HubbubMessage('post');
	$post->localUserEntity = $ne1->key();
  $post->author($ne2->ds);
  $post->owner($ne1->ds);
  $post->data['text'] = 'This is a realtime message. Umlauts like üöä should be preserved.';
  // if we're the owner, we can send a realtime update to ne2
  $fpost->save();

  // now, we'll update an existing message that has already been committed to DB
  $post->data['text'] = 'This message text has changed now';
  $post->markChanged(time()+$ctr++);
  $post->sendToUrl($ne1->ds['server']);
  tlog($post->responseData['result'] == 'OK', 'updated post sentToUrl('.$post->authorEntity->ds['url'].')', 'OK', 'fail ('.$post->responseData['reason'].')');
Пример #2
0
$notDeclared = array();
ksort($parse['call']);
foreach($parse['call'] as $function => $decl)
{
  if(!$builtIn[$function])
  {
    if(!$parse['func'][$function])    
      tlog(false, $function.' in '.$parse2['files'][$decl], 'OK', 'fail');
    else
      $okCount1++;
  }
}
tlog(true, 'Other declarations: '.$okCount1, 'OK', 'fail');

tsection('Unused Code');
ksort($parse['func']);
foreach($parse['func'] as $function => $decl) if(!strStartsWith($parse2['files'][$decl], './plugins/') && !strStartsWith($parse2['files'][$decl], './log/') && !strStartsWith($parse2['files'][$decl], './static/'))
{
  if(!inStr($parse2['files'][$decl], 'controller') && substr($function, 0, 1) != '_' && 
    substr($function, 0, 1) != '(' && !strStartsWith($parse2['files'][$decl], './msg') && !$ignoreCallCheck[$function] && !strEndsWith($function, 'callback()') &&
    !strStartsWith($function, 'js_') && !strStartsWith($function, 'dyn_') && $function != 'h2_exceptionhandler()')
  {
    if(!$parse['call'][$function])
      tlog(false, $function.' in '.$parse2['files'][$decl], 'OK', 'fail');
    else
      $okCount2++;
  }
}
tlog(true, 'Other calls: '.$okCount2, 'OK', 'fail');
Пример #3
0
    foreach(DB_GetList('SELECT * FROM '.getTableName('connections').' WHERE c_from = ?', array($eid)) as $cds)
    {
      $result[] = $cds['c_to'];
    }
    return($result);
  }
  
  function hasMessageInStream($ctx, $eid, $mkey)
  {
  	$streamPosts1 = $ctx->msg->getStream($eid);
    foreach($streamPosts1['list'] as $pds)
      if($pds['m_key'] == $mkey) return(true);     
    return(false);
  }

  tsection('Entities');
  $this->friends->contactServer($_SERVER['HTTP_HOST']);

  for($i = 0; $i < 5; $i++)
  {
    $usr = array('name' => 'HTT_'.substr(md5(time().rand(1, 100000)), 0, 5));
    $erec = array('server' => $_SERVER['HTTP_HOST'], 'user' => $usr['name'], 'url' => $_SERVER['HTTP_HOST'].'/'.$usr['name']);
    $usr['erec'] = $erec;
    $usr['entity'] = new HubbubEntity();
    $usr['entity']->create($usr['erec'], true); 
    $usr['id'] = $usr['entity']->ds['_key']; 
    $u[] = $usr;
    $eidx[$usr['id']] = $usr['name'];
  }

  quickConnect($u[0]['id'], $u[1]['id']);