return false; } foreach ($data as $query) { if (!in_array($query['entity'], $_SESSION['entities'])) { return false; } } return true; } } session_start(); if (!array_key_exists('user', $_SESSION)) { exit("Authentication required."); } session_commit(); $proxy = new ApiProxy(); $query = $proxy->getPost(); if (strlen($query) == 0) { return "query is not set."; } $type = array_key_exists('type', $_GET) ? $_GET['type'] : 'default'; switch ($type) { case 'series': $response = $proxy->seriesJsonQuery($query); break; case 'properties': $response = $proxy->propertiesJsonQuery($query); break; default: $response = ""; break;
/** * Set the API Proxy instance used to make the RPC call. Allows for mocking * in tests. * @param resource $apiProxy API Proxy instance to use */ public static function setApiProxy($apiProxy) { ApiProxy::$apiProxy = $apiProxy; }