Esempio n. 1
0
            $output = "";
        } else {
            if (strpos($query, '?POST?') > 0) {
                list($query, $data) = explode('?POST?', $query, 2);
                $context = stream_context_create(array('http' => array('method' => 'POST', 'header' => 'Content-Type: application/x-www-form-urlencoded', 'content' => $data)));
                $output = file_get_contents($query, false, $context);
            } else {
                $output = file_get_contents($query);
            }
        }
    } else {
        if ($call == "saveFile") {
            $imagedata = $_REQUEST["data"];
            //getValueSimple($values, "data", ""); don't want to convert " to _ here
            $filename = getValueSimple($values, "filename", "");
            $contentType = getValueSimple($values, "mimetype", "application/octet-stream");
            if ($encoding == "base64") {
                $imagedata = base64_decode($imagedata);
                $encoding = "";
            }
        } else {
            $myerror = "jsmol.php unrecognized call: {$call}";
        }
    }
}
ob_start();
if ($myerror != "") {
    $output = $myerror;
} else {
    if ($imagedata != "") {
        $output = $imagedata;
Esempio n. 2
0
    list($junk, $info) = explode('"' . $key . '"', $json, 2);
    list($junk, $val) = explode('"', $info, 3);
    if ($val == "") {
        $val = str_replace('"', '_', $_REQUEST[$key]);
    }
    if ($val == "") {
        $val = $default;
    }
    return $val;
}
$values = file_get_contents("php://input");
$encoding = getValueSimple($values, "encoding", "");
$call = getValueSimple($values, "call", "getRawDataFromDatabase");
$query = getValueSimple($values, "query", "morphine");
$database = getValueSimple($values, "database", "\$");
$postLoad = getValueSimple($values, "script", "");
if ($database == '$') {
    $database = '\\$';
    // NCI query
}
if (substr($query, 0, 1) == '$') {
    $query = '\\' . $query;
    // 2D query
}
$imagedata = "";
$output = "";
$isBinary = false;
if ($call == "getInfoFromDatabase") {
    if ($database == '=') {
        $restQueryUrl = "http://www.pdb.org/pdb/rest/search";
        $restReportUrl = "http://www.pdb.org/pdb/rest/customReport";