Exemplo n.º 1
0
	function ajax_pingserver()
	{
	  $server = new HubbubServer($_REQUEST['server'], true);
	  $reload = '<script>
	      setTimeout("reload_'.md5($_REQUEST['server']).'()", 2000);
	    </script>';
	  if($server->isTrusted())
	  {
	    ?><span class="green">
        <?= htmlspecialchars($_REQUEST['url']) ?>
      </span><? 
    } 
    else if($server->isWaitingForKey())
    {
      ?><?= htmlspecialchars($_REQUEST['url']) ?><div class="gray">
        waiting for response...
      </div><?= $reload ?><?
    }
    else
    {
      $res = $server->msg_trust_sendkey1();
      if($res['result'] == 'OK')
      {
        ?><?= htmlspecialchars($_REQUEST['url']) ?><div class="gray">
          exchanging credentials...
        </div><?= $reload ?><?
      }
      else
      {
        ?><div class="red">
          ✘ <a class="red" title="<?= htmlspecialchars(getDefault($res['reason'], 'no connection')) ?>"><?= htmlspecialchars($_REQUEST['url']) ?></a>
        </div><?
      }
    }
  }
Exemplo n.º 2
0
  $results = array();

  $url = HubbubEndpoint::urlUnify($_REQUEST['q']);
  $url_res = $this->model->loadUrl($url);

  $GLOBALS['group.options'] = array('<option value="0">Select...</option>');
  foreach($this->model->getMyGroups() as $grp)
  $GLOBALS['group.options'][] = '<option value="'.$grp['lg_key'].'">'.$grp['lg_name'].'</option>';
  
  if($url_res['result'] == 'OK')
  {
    if($url_res['url'] == '') $url_res['url'] = $url; else $url_res['url'] = HubbubEndpoint::urlUnify($url_res['url']);
    if(trim($url_res['server']) != '' && trim($url_res['user']) != '') 
    {
      $server = new HubbubServer($url_res['server']);
      if(!$server->isTrusted()) $server->msg_trust_sendkey1();
      $url_res['server_trusted'] = $server->isTrusted();
      $results[] = $url_res;
    }
  }
  
  if(sizeof($results) == 0)
  {
    ?><div class="fail">
      <?php 
echo l10n('friend.notfound');
?>
    </div><? 
  }
  else
  {