Exemplo n.º 1
0
function S3DBcall($s3ql)
{
    #S3DBcall takes in an array formatted in S3QL terms (for exmaple, $s3ql = array('url','http://ibl.mdanderson.org/s3db','key','xxxxxx','select','*','from','projects');)
    #and return the output from s3db parsed in an array
    if ($s3ql['format'] != 'php') {
        $s3ql['format'] = 'php';
    }
    $url = S3QLquery($s3ql);
    #echo $url;
    $h = fopen($url, 'r');
    while (!$h) {
        $h = fopen($url, 'r');
    }
    $data = stream_get_contents($h);
    return array($url, unserialize($data));
}
Exemplo n.º 2
0
function discover_url($dep_id, $db = '', $user_id = '', $key = '')
{
    $dep_idQ = ereg_replace('^D', '', $dep_id);
    $sql = "select * from s3db_deployment where deployment_id = '" . $dep_idQ . "'";
    $db->query($sql);
    if ($db->next_record()) {
        $url = $db->f('url');
    } else {
        #retrieve url from mothership
        $ms = $GLOBALS['s3db_info']['deployment']['mothership'];
        $s3ql['url'] = $ms;
        $s3ql['key'] = $key;
        $s3ql['from'] = 'deployment';
        $s3ql['where']['deployment_id'] = $dep_idQ;
        $s3ql['format'] = 'php';
        $Q = S3QLquery($s3ql);
        while (!$a && $try < 5) {
            $a = fopen($Q, "r");
            $try++;
        }
        if (!$a) {
            $msg = 'Mothership Not available';
        } else {
            $b = stream_get_contents($a);
            $urlInfo = unserialize($b);
            if (is_array($urlInfo) && $urlInfo[0]['url'] != '') {
                $url = $urlInfo[0]['url'];
            }
        }
    }
    if (!$url) {
        return array(False, $msg);
    } else {
        return array(true, $url);
    }
}
Exemplo n.º 3
0
        } else {
            $message = "Upload unsuccessfull, please try again.";
        }
    }
    #create the values that will go into the statements table
    #}
    #else
} elseif ($_REQUEST['remoteproject_id'] != '') {
    $key = get_entry('access_keys', 'key_id', 'account_id', $user_id, $db);
    $s3ql['key'] = $key;
    $s3ql['select'] = '*';
    $s3ql['from'] = 'projects';
    $s3ql['where']['project_id'] = $_REQUEST['remoteproject_id'];
    $s3ql['url'] = 'http://s3db.virtual.vps-host.net/central/';
    $s3ql['format'] = 'php';
    $S3QL_string = S3QLquery($s3ql);
    $handle = fopen($S3QL_string, 'r');
    $contents = stream_get_contents($handle);
    #echo $contents;
    parse_str($contents, $projects);
    #Check if project_id is repeated
    for ($i = 0; $i < count($projects); $i++) {
        if ($projects[$i]['project_id'] == $_POST['remote_project_id'] && $projects[$i]['URI'] == $_POST['URI']) {
            $found_project .= True;
        }
    }
    if ($found_project) {
        echo 'This project is being accessed.';
    } else {
        #When the creator is not revealed, use the local user as the owner of the project
        #	if ($creator=='' || $creator = 'anonymous') $creator = $_SESSION['user']['account_id'];
Exemplo n.º 4
0
function Query($s3ql)
{
    if (!ereg('^' . S3DB_URI_BASE, $s3ql['url'])) {
        $s3ql = array_filter(array_diff_key($s3ql, array('db' => '', 'user_id' => '')));
        $rule_query = S3QLquery($s3ql);
        $result = html2cell(stream_get_contents(fopen($rule_query, 'r')));
        return $result;
    } else {
        $s3ql = array_filter(array_diff_key($s3ql, array('url' => '', 'key' => '')));
        $result = S3QLaction($s3ql);
        return $result;
    }
}