} else { $output .= keepGoing(); } /*********************************************************************/ /***** Is the file valid JSON? ***/ $output .= establishErrorCategory("Is the file valid JSON?"); $thisArray = json_decode(fread($keyFileHandle, filesize($keyFilePath)), TRUE); if (json_last_error() == JSON_ERROR_NONE) { $output .= keepGoing(); } else { exitWithOutput($output, "No"); } /*********************************************************************/ /***** How many capture servers are in the file? ***/ $output .= establishErrorCategory("How many instances found?"); $output .= keepGoing(sizeof($thisArray["clients"])); /********************************************************************/ /****** Ask the user to choose a server ******/ if (sizeof($thisArray["clients"]) == 1) { // only one set of values, so just use this set of values. $_SESSION['captureServer']['value'] = $thisArray["apid_uri"]; $_SESSION['client_id'] = $thisArray["client_id"]; $_SESSION['client_secret'] = $thisArray["client_secret"]; } else { $_SESSION['listOfServers'] = $thisArray["clients"]; foreach ($thisArray["clients"] as $key => $values) { $output .= "<div class='divRow'>"; $output .= "<div class= 'serverNameCell'>" . $key . "</div>"; $output .= "<div class = 'divCell'>"; $output .= "<button class = 'client' id = '{$key}'>Select</button>"; $output .= "</div>";
<?php // Janrain Random User Generator (J-RUG) // tsmith@janrain.com session_start(); include 'includes/functions/sendCurlRequest.php'; include 'includes/functions/errorChecking.php'; $captureServer = $_SESSION["captureServer"]; $params["client_id"] = $_SESSION['client_id']; $params["client_secret"] = $_SESSION['client_secret']; $params["type_name"] = "user"; $thisArray["name"] = "isAutogeneratedUser"; $thisArray["type"] = "boolean"; $params["attr_def"] = json_encode($thisArray); $jsonResponse = sendCurlRequest("entityType.addAttribute", $params, $captureServer); $jsonArray = json_decode($jsonResponse, true); $output = "<div class='divTable'>"; $output .= establishErrorCategory($captureServer . " schema OK?"); if ($jsonArray["stat"] == "ok") { $output .= keepGoing(); $thisArray["schemaStatus"] = "OK"; } else { exitWithOutput($output, $jsonResponse); } $output .= "</div>"; $thisArray["html"] = $output; echo json_encode($thisArray); exit;