} $oex = new OExchangeDiscoverer(); $target = $oex->getTargetInfoFromXrd($xrdUrl); // Output outputTargetJson($callback, $target); } else { if ($cmd == "getCommonUserTargets") { header("Content-Type: application/json", true); $fromEmail = $_REQUEST["from"]; $toEmailList = $_REQUEST["to"]; if (isset($_REQUEST["jsonpcb"])) { $callback = $_REQUEST["jsonpcb"]; } $toEmails = explode(",", $toEmailList); $oex = new OExchangeDiscoverer(); $matches = $oex->getCommonUserTargets($fromEmail, $toEmails); // Output outputMatchesJson($callback, $matches); } else { if (isset($cmd)) { header("HTTP/1.0 404 Not Found", true, true); } else { $page_title = "OExchange Demo Utility API"; include "../../pagetop-main.inc.php"; ?> <div id="contentpage"> <h2 class="pagetitle">Demo Utility API</h2> <div class="bannertext"> A simple GET/JSON-based API for various OExchange operations </div>
if ($me == "clear") { // We thought we had a user, but really we're forgetting them setcookie('wf_email', "", time() + 86400 * 14); unset($me); } else { // We have a user, cookie them to remember them setcookie('wf_email', $me, time() + 86400 * 14); } } // Do we know of any TO users? if (isset($to)) { $toEmails = explode(",", $to); } // If we have just a FROM user, look up their preferred targets. If we have both to and from, look up all of them if (isset($me) && isset($toEmails) && sizeof($toEmails) > 0) { $matchTargets = $oex->getCommonUserTargets($me, $toEmails); $userTargets = $matchTargets->fromTargets; } else { if (isset($me)) { $userTargets = $oex->getTargetsForUser($me); } } // Ok, we have what we need to render the UI require_once "pagestart.inc.php"; ?> <div id="offerpage"> <?php // If there was a specificaly-entered URL/host, and we found a Target there, prioritize this if (isset($explicitTargets) && sizeof($explicitTargets) > 0) { // Yes, great echo "<h3>Hurrah!</h3>";