Beispiel #1
0
function main()
{
    global $global, $smarty;
    set_global();
    include_all('admin/class/parent');
    include_all('admin/class');
    set_more_global();
    $path = 'admin/admin.php';
    if ($global['url'] != '') {
        $path2 = 'admin/' . $global['channel'] . '.php';
        if (file_exists($path2)) {
            $path = $path2;
        }
    }
    include $path;
}
Beispiel #2
0
function main()
{
    global $global, $smarty;
    set_global();
    if (S_HALF_STATIC) {
        if ($global['url'] == '') {
            if (S_FLASH != 1) {
                $path = '/' . S_URL_SUFFIX;
            } else {
                $path = '/flash.html';
            }
        } else {
            $path = $global['url'];
        }
        $path = 'html' . $path;
        if (substr($path, -1) == '/') {
            $path .= S_URL_SUFFIX;
        }
        if (file_exists($path)) {
            include $path;
            exit;
        } else {
            ob_start();
        }
    }
    if (S_FLASH && $_SERVER['REQUEST_URI'] == S_ROOT) {
        $path = 'index/flash.php';
    } else {
        include_all('index/class/parent');
        include_all('index/class');
        set_more_global();
        $path = 'index/' . $global['channel'] . '.php';
        if ($global['url'] != '') {
            if (!file_exists($path)) {
                $path = 'index/' . $global['original'] . '.php';
            }
        }
    }
    include $path;
}
Beispiel #3
0
function URIinfo($uid, $user_id, $key, $db, $timer = array())
{
    $uid_info = uid($uid);
    $element = $GLOBALS['s3codes'][substr($uid, 0, 1)];
    $local_info = s3info($element, ereg_replace('^' . letter($uid), '', $uid), $db);
    #echo $uid.'<pre>';print_r($local_info);exit;
    if (is_array($local_info) && !empty($local_info)) {
        $uid_info['Did'] = $GLOBALS['Did'];
        $uid_info['uid'] = $uid;
        $element_info = $local_info;
        $letter = strtoupper(substr($element, 0, 1));
        $info = include_all(compact('elements', 'letter', 'element_info', 'user_id', 'db', 'key', 'timer'));
        $info['remote_uri'] = 0;
        #echo '<pre>';print_r($info);exit;
    }
    if ($uid_info['Did'] == $GLOBALS['Did'] || $uid_info['Did'] == S3DB_URI_BASE) {
        if (is_array($local_info) && !empty($local_info)) {
            $uid = str_replace(S3DB_URI_BASE . '/', '', $uid_info['uid']);
            $uid_info['Did'] = $GLOBALS['Did'];
            $uid_info['uid'] = $uid;
            $element_info = s3info($element, ereg_replace('^' . letter($uid), '', $uid), $db);
            $letter = strtoupper(substr($element, 0, 1));
            $info = include_all(compact('elements', 'letter', 'element_info', 'user_id', 'db', 'key'));
            $info['remote_uri'] = 0;
        } else {
            $info = false;
        }
        #echo 'loca'.$uid;exit;
        #$info = URI($uid_info['uid'], $user_id, $db);
        #$info['remote_uri']=0;
    } else {
        #echo 'ola'.$uid;exit;
        $key = $key != '' ? $key : get_user_key($user_id, $db);
        #echo $user_id;exit;
        $info = remoteURI($letter . $uid_info['uid'], $key, $user_id, $db);
        #echo '<pre>';print_r($info);exit;
        $info['remote_uri'] = 1;
        if (!is_array($info) || empty($info)) {
            $info = URI($uid, $user_id, $db);
        }
        if (!is_array($info)) {
            $info = false;
        }
    }
    #echo '<pre>';print_r($info);exit;
    return $info;
}
Beispiel #4
0
if (PHP_SAPI === 'cli') {
    include_once 'path.php';
    include_once 'utility.php';
    include_once 'unique.php';
    include_once 'engines.php';
    include_once 'root.php';
    include_once 'Database.php';
    include_once 'ui.php';
    // Basic (minimal) bootstrapping.
    include_once SITE_ROOT . '/settings/config.php';
    include_once SITE_ROOT . '/settings/config.crypt.php';
    include_once SITE_ROOT . '/settings/config.flags.php';
    include_once SITE_ROOT . '/settings/config.enums.php';
    include_once SITE_ROOT . '/settings/config.global.php';
    include_once SITE_ROOT . '/settings/config.databases.php';
    include_all(SITE_ROOT . '/model/');
    global $auth_database;
    try {
        $auth_database = new Database(AUTH_DB_DSN, AUTH_DB_USER, AUTH_DB_PASS);
    } catch (Exception $e) {
        plog($e);
    }
    plog('$auth_database: ' . vars($auth_database));
    global $auth_model;
    $auth_model = new Auth($auth_database);
    global $session_model;
    $session_model = new Session($auth_database);
    global $profile_model;
    $profile_model = new Profile($auth_database);
    global $auth;
    $auth = NULL;
Beispiel #5
0
include_once 'core.header.php';
#core header will take care of exiting the system in case key is invalid
$format = $_REQUEST['format'];
$complete = $_REQUEST['display'] == 'complete' ? true : false;
if ($format == '') {
    $format = 'html';
}
#If no query is provided, expect a UID.
#Reading the UID should return a letter, C, I, R, S, U or P and a number.
#queries will be only on exact ID
if ($uid == '') {
    $letter = 'U';
    $t = $GLOBALS['s3codes'][$letter];
    $ID = $user_id;
    $element_info = $user_info;
    $data[0] = include_all(compact('letter', 'info', 'element_info', 'user_id', 'db', 'key'));
    $data[0]['uid'] = $GLOBALS['Did'] . ($letter != 'U' ? '|U' . $user_id : '') . '|' . $letter . $ID;
} else {
    $letter = letter($uid);
    $t = $GLOBALS['s3codes'][$letter];
    $uid_info = uid($uid);
    $ID = substr($uid_info['uid'], 1, strlen($uid_info['uid']));
    if ($ID != '' && $letter != '') {
        $element_info = URIinfo($uid, $user_id, $key, $db);
        #Find the appropriate table information from each table where to look for the UID
        #User_id does not need to check if there is permissions to perform the query, all others need permission
        if (!is_array($element_info)) {
            echo formatReturn($GLOBALS['error_codes']['something_does_not_exist'], 'UID ' . $uid . ' does not exist', $format, '');
            exit;
        }
        if (!$element_info['view']) {
Beispiel #6
0
function s3list($s3ql)
{
    $regexp = $GLOBALS['regexp'];
    $dbstruct = $GLOBALS['dbstruct'];
    extract($s3ql);
    if (is_array($where)) {
        extract($where);
    }
    if (!$user_id) {
        return 'User authentication is required';
        exit;
    }
    if ($order_by) {
        $order_by = ' order by ' . $order_by;
    }
    if (!$select) {
        $select = '*';
    }
    if (!$from) {
        $from = 'projects';
    }
    $equality = '=';
    #by default, equality on query end be this, unless specified that equality should be a regular expression
    $cols = $dbstruct[$from];
    #Error messages
    $syntax_message = "Please provide all the necessary fields. For syntax instructions refer to <a href='http://www.s3db.org/documentation.html'>S3DB Documentation</a>";
    $success = '<error>0</error><message>' . $from . ' ' . $action . 'ed ' . $element_id . '</message>';
    $not_a_query = '<error>1</error><message>' . $from . ' is not a valid S3element. Valid elements: groups, users, keys, projects, rules, statements, classes, instances, rulelog";</message>';
    $something_went_wrong = '<error>2</error><message>Failed to ' . $action . ' ' . $from . '</message>';
    $something_missing = '<error>3</error><message>' . $syntax_message . '</message>';
    $repeating_action = '<error>4</error>';
    $no_permission_message = '<error>5</error>';
    $something_does_not_exist = '<error>5</error>';
    $wrong_query_for_purpose = '<error>6</error>';
    $wrong_input = '<error>7</error>';
    $no_output = '<error>8</error>';
    #alternative IDs that can be used for the query
    $alt = array('keys' => array('key_id'), 'rulelog' => array('rule_id'), 'users' => array('group_id', 'project_id'), 'groups' => array('user_id'), 'projects' => array('user_id'), 'classes' => array('project_id', 'rule_id'), 'rules' => array('project_id', 'class_id'), 'instances' => array('class_id', 'project_id'), 'statements' => array('rule_id', 'instance_id', 'project_id'), 'files' => array('statement_id', 'rule_id', 'instance_id', 'project_id'));
    #if from is not one of these elements, sent the user back, query is invalid!
    if (!in_array($from, array_keys($alt))) {
        #check if user is inputing a sigular of one of the alt plurals
        $plurals = array_keys($alt);
        $singulars = array('key', 'rulelog', 'user', 'group', 'project', 'class', 'rule', 'instance', 'statement', 'file');
        $from = str_replace($singulars, $plurals, $from);
        #if still not in array, definitelly exit;
        if (!in_array($from, array_keys($alt))) {
            return $not_a_query;
        }
    }
    #now replace on "where" the correct s3db names
    $s3map = array('users' => array('user_id' => 'account_id', 'login' => 'account_lid', 'password' => 'account_pwd', 'username' => 'account_uname', 'email' => 'account_email', 'phone' => 'account_phone', 'address' => 'addr1', 'address2' => 'addr2', 'city' => 'city', 'state' => 'state', 'postal_code' => 'postal_code', 'country' => 'country'), 'groups' => array('group_id' => 'account_id', 'groupname' => 'account_lid'), 'keys' => array(), 'accesslog' => array('account_lid' => 'login_id', 'time' => 'login_timestamp'), 'projects' => array(), 'project' => array(), 'instances' => array('class_id' => 'resource_class_id', 'instance_id' => 'resource_id'), 'instance' => array('class_id' => 'resource_class_id', 'instance_id' => 'resource_id'), 'classes' => array('class_id' => 'resource_id'), 'class' => array('class_id' => 'resource_id'), 'rules' => array(), 'rule' => array(), 'statements' => array('instance_id' => 'resource_id'), 'statement' => array('instance_id' => 'resource_id'), 'files' => array());
    foreach ($alt[$from] as $s3id) {
        $s3dbId = $s3map[$from][$s3id];
        if ($s3dbId == '') {
            $s3dbId = $s3id;
        }
        if ($where[$s3id] != '') {
            #does it exist? What sort of resource is this? Type of id should be identified in the first letter (Class_id is C, rule_id is R...)
            $CRISP = strtoupper(substr($s3id, 0, 1));
            $id = $CRISP . $where[$s3id];
            $info[$where[$s3id]] = s3info(str_replace('_id', '', $s3id), $where[$s3id], $db);
            if (!is_array($info)) {
                return $something_does_not_exist . '<message>' . $s3id . ' ' . $where[$s3id] . ' does not exist</message>';
            }
            if (!permissionOnResource(compact('user_id', 'db', 'id'))) {
                return $no_permission_message . '<message>user does not have permission on ' . $id . '</message>';
            }
            #does user have permission on this/these resources?
            $query_end .= " and " . $s3dbId . " " . $equality . " '" . $where[$s3id] . "'";
        }
    }
    $toreplace = array_keys($s3map[$from]);
    $replacements = array_values($s3map[$from]);
    $s3ql['select'] = str_replace($toreplace, $replacements, $query_end);
    #restrict the query to the rules where user is allowed
    $user_projects = findUserProjects($user_id, $db);
    #alternative to re-using s3list to query projects - still not sure which is faster...
    $s3ql = compact('user_id', 'db');
    $s3ql['select'] = 'project_id';
    $s3ql['from'] = 'projects';
    #$user_projects = s3list($s3ql);
    if (is_array($user_projects)) {
        $user_permission_list = create_permission_list($user_projects);
        $user_project_list = create_project_id_list($user_projects);
    }
    if (!is_array($user_projects)) {
        return $no_output . '<message>User does not have permission in any project</message>';
    }
    if ($user_id != '1' && ereg('(projects|classes|rules|instances|statements|rulelog)', $from) && $where['project_id'] == '') {
        #If query end is empty, it means no id was supplied. So list all 'resources' where user is allowed, which implies making a query in project.
        $query_end .= " and project_id " . $regexp . " '" . $user_project_list . "'";
    }
    #When rule_id (or class_id) is supplied check if user has permission on a project that has permission on that rule (or class). If rule_id is not supplied
    #When instance_id is supplied, check if user has permission on the rule (or class) of that instance
    #array_keys contains the things to replace and array_values the replacements
    switch ($from) {
        case 'keys':
            $table = 'access_keys';
            $required = "expires > '" . date('Y-m-d') . "'";
            if ($user_id != '1') {
                $required .= " and (account_id = '" . $user_id . "')";
            }
            break;
        case 'rulelog':
            $table = 'rule_change_log';
            $required = "rule_id !=''";
            break;
        case 'users':
            #expecting group_id or project_id
            #remove password from query fields
            $table = 'account';
            $required = "account_type = 'u' and account_status = 'A'";
            break;
        case 'groups':
            $table = 'account';
            $required = "account_type = 'g' and account_status = 'A'";
            break;
        case 'projects':
            $table = 'project';
            $required = "project_status = 'A'";
            #if user is not admin, retrict this query to the projects user can view by extending queryend
            if ($user_id != '1') {
                $required .= " and (project_owner = '" . $user_id . "' or project_id in (select acl_project_id from s3db_project_acl where acl_account = '" . $user_id . "' and acl_rights!='0'))";
            }
            break;
        case 'classes':
            #$table = 'resource';
            $table = 'resource, s3db_rule';
            $required = "iid = '0'";
            $select = str_replace('project_id', 's3db_rule.project_id', $select);
            $select = str_replace('notes', 's3db_resource.notes', $select);
            if ($where['project_id'] != '') {
                $query_end = str_replace("and project_id = '" . $project_id . "'", "and (entity = subject and verb = 'has UID' and object = 'UID' and s3db_resource.project_id = s3db_rule.project_id and (s3db_rule.project_id = '" . $project_id . "' or s3db_rule.permission " . $regexp . " '(_|^)" . $project_id . "_'))", $query_end);
            }
            #restrict the query to the rules where user is allowed
            $query_end = str_replace("and project_id " . $regexp . " '" . $user_project_list . "'", "and subject = entity and object = 'UID' and s3db_rule.project_id = s3db_resource.project_id and (s3db_rule.project_id " . $regexp . " '" . $user_project_list . "' or s3db_rule.permission " . $regexp . " '" . $user_permission_list . "')", $query_end);
            break;
        case 'instances':
            $table = 'resource';
            $required = "iid = '1'";
            #to avoid having to call s3list again, created this function that simulates finding user classes
            $classes = findUserClasses($user_id, $db);
            if (!is_array($classes)) {
                return $no_output . '<message>User does not have permission in any classes</message>';
            }
            $classes_list = create_class_id_list($classes);
            $query_end = str_replace("and project_id " . $regexp . " '" . $user_project_list . "'", "and resource_class_id " . $regexp . " '" . $classes_list . "'", $query_end);
            break;
        case 'rules':
            $table = 'rule';
            $required = "rule_id !='0'";
            if ($where['project_id'] != '') {
                $query_end = str_replace("and project_id = '" . $project_id . "'", "and (project_id " . $regexp . " '^" . $project_id . "\$' or permission " . $regexp . " '(_|^)" . $project_id . "_')", $query_end);
                if ($where['class_id'] != '') {
                    $class_info = s3info('class', $where['class_id'], $db);
                    $query_end = str_replace("and class_id = '" . $where['class_id'] . "'", "and subject = '" . $class_info['entity'] . "'", $query_end);
                }
            } elseif ($where['class_id'] != '') {
                #no project_id but w/ class_id. If no project_id is indicated, it will have to find the correct subjects (which can be repeated if queried on several projects)
                $class_info = s3info('class', $where['class_id'], $db);
                $query_end = str_replace("and class_id = '" . $where['class_id'] . "'", "and (subject_id = '" . $where['class_id'] . "' or (subject = '" . $class_info['entity'] . "' and project_id = '" . $class_info['project_id'] . "'))", $query_end);
                #all that don't belong to this project will have to be queried by class_id.
            } else {
                $query_end = str_replace("and project_id " . $regexp . " '" . $user_project_list . "'", " and (project_id " . $regexp . " '" . $user_project_list . "' or permission " . $regexp . " '" . $user_permission_list . "')", $query_end);
            }
            break;
        case 'statements':
            $table = 'statement';
            $required = "status ='A'";
            #user only has permission to a number of statement, those where he has permission on rule. Permission on rule propagates to permission on statement
            #alternative to calling s3list again:
            $rules = findUserRules($user_id, $db);
            #echo '<pre>';print_r($rules);
            #exit;
            if (!is_array($rules)) {
                return $no_output . '<message>User does not have permission in any rules</message>';
            } else {
                $user_rule_list = create_rule_id_list($rules);
                $query_end = str_replace("and project_id " . $regexp . " '" . $user_project_list . "'", "and rule_id " . $regexp . " '" . $user_rule_list . "'", $query_end);
            }
            break;
    }
    #POSSIBLY MOVE THIS PART TO A SEPARATE FUNCTION!!
    $sql = "select " . $select . " from s3db_" . $table . " where " . $required . " " . $query_end . $order_by;
    #echo $sql.'<br>';
    #exit;
    $db->query($sql, __LINE__, __FILE__);
    while ($db->next_record()) {
        $resultStr .= "\$data[] = Array(";
        if ($extracol != '') {
            $resultStr .= "'" . $extracol . "'=>'" . $db->f($SQLfun) . "',";
        }
        foreach ($cols as $col) {
            $resultStr .= "'" . $col . "'=>'" . addslashes($db->f($col)) . "'";
            if ($col != end($cols)) {
                $resultStr .= ",";
            }
        }
        $resultStr .= ");";
    }
    #evaluate the long string
    eval($resultStr);
    #echo '<pre>';print_r($data);
    if (is_array($data)) {
        if (!$nomap) {
            #include stuff relevant for each element
            foreach ($data as $element_info) {
                #$element_info['dataAcl'] = instanceAcl(array('instance_info'=>$element_info, 'user_id'=>$user_id, 'db'=>$db));
                $data1[] = include_all(array('elements' => $from, 'element_info' => $element_info, 'user_id' => $user_id, 'db' => $db));
            }
            $data = $data1;
        }
    } else {
        $data = $no_output . '<message>Your query returned no results</message>';
    }
    #echo '<pre>';print_r($data);
    return $data;
}
Beispiel #7
0
function includeAllData($pack)
{
    extract($pack);
    $letter = letter($s3ql['from']);
    $element = $GLOBALS['s3codes'][$letter];
    #echo 'ola';exit;
    if (count($data) >= 50) {
        if (!ereg('^U|^G', $letter)) {
            $ids = permissionPropagation($letter, 'U' . $user_id, $user_id, $db, $uidQuery);
        }
    }
    #echo 'ola';exit;
    #echo '<pre>';print_r($ids);exit;
    ##Remove from data the uids that do not exist in ids
    $str = $GLOBALS['s3ids'][$GLOBALS['s3codes'][$letter]];
    $re_issued = array();
    if (is_array($data)) {
        foreach ($data as $ind => $array) {
            $uid = $letter . $array[$str];
            if ($uid != '') {
                if ($user_id != '1') {
                    if (is_array($ids)) {
                        if (!ereg('^U|^G', $letter)) {
                            if ($ids[$uid] != '' && (substr($ids[$uid], 0, 1) == '2' || substr($ids[$uid], 0, 1) == '1' && createdBy($uid, $db) == $user_id)) {
                                $array['acl'] = $ids[$uid];
                            } else {
                                $array = array();
                            }
                        }
                    } else {
                        $strictuid = 1;
                        $strictsharedwith = 1;
                        $shared_with = 'U' . $user_id;
                        $P = compact('uid', 'shared_with', 'user_id', 'db', 'strictuid', 'strictsharedwith', 'stream');
                        if (!ereg('^U|^G', $letter)) {
                            $array['acl'] = permissionOnResource($P);
                        } else {
                            $array['acl'] = userAcl(array('key' => $key, 'element_info' => $array, 'user_id_who_asks' => $user_id, 'db' => $db));
                        }
                        #$array['acl'] = permission4Resource($P);
                    }
                } else {
                    $array['acl'] = '222';
                }
            }
            #echo '<pre>';print_r($array);
            if (!empty($array)) {
                $re_issued[$uid] = $array;
                $element_info = $re_issued[$uid];
                #echo '<pre>';print_r($element_info);exit;
                $element_info = include_all(compact('letter', 'info', 'elements', 'element_info', 'user_id', 'db', 'key'));
                #$element_info['permissionOnResource']=permissionOnResource($D);
                #echo '<pre>';print_r($element_info);
                $element_info['uri'] = S3DB_URI_BASE . '/' . $letter . $array[$str];
                $pack['uid'] = $uid;
                $pack['info'] = $element_info;
                $element_info = filterDataForQuery($pack);
                #echo '<pre>';print_r($element_info);exit;
                $re_issued[$uid] = $element_info;
            }
        }
    }
    #echo '<pre>';print_r($re_issued);exit;
    $data = array_filter($re_issued);
    #echo '<pre>';print_r($data);exit;
    return $data;
}
Beispiel #8
0
function includeAllData($pack)
{
    extract($pack);
    $element2query = $element2query == '' ? $s3ql['from'] : $element2query;
    #echo '<pre>';print_r($data);exit;
    $letter = letter($element2query);
    $element = $GLOBALS['s3codes'][$letter];
    if ($user_id != '1') {
        if (count($data) >= 4) {
            if (!ereg('^U|^G', $letter)) {
                $Z = compact('user_id', 'db', 'uidQuery', 'timer', 'WhereInfo', 'shared_with_query');
                $Z['toFind'] = $letter;
                $Z['shared_with_user'] = '******' . $user_id;
                $ids = permissionPropagation($Z);
            }
        }
    }
    if (ereg('^U|^G', $letter) && $WhereInfo) {
        $whereId = array_keys($WhereInfo);
        if (count($whereId) > 1) {
            $array = array();
            return $array;
        } else {
            $whereId = $whereId[0];
            #Tlist provides the list of resources that are shared with the uid of interest, including users & groups
            $Hlist = bottom_up_propagation_list($whereId, $db);
            $Tlist = user_included_bottom_up_propagation_list('U', $whereId, $user_id, $db);
            $resourceUsers = s3dbPercolate($Hlist, $Tlist, $letter);
            if ($_REQUEST['su3d']) {
            }
        }
    }
    ##Remove from data the uids that do not exist in ids
    $str = $GLOBALS['s3ids'][$GLOBALS['s3codes'][$letter]];
    $re_issued = array();
    if (is_array($data)) {
        foreach ($data as $ind => $array) {
            $uid = $letter . $array[$str];
            if ($uid != '') {
                if ($user_id != '1') {
                    if (is_array($ids)) {
                        if (!ereg('^U|^G', $letter)) {
                            if ($ids[$uid] != '') {
                                $array['acl'] = $ids[$uid];
                            } else {
                                $array = array();
                            }
                        } else {
                            if ($resourceUsers) {
                                if (in_array($uid, array_keys($resourceUsers))) {
                                    $array['permissionOnResource'] = $resourceUsers[$uid];
                                } else {
                                    $array = array();
                                }
                            }
                            #else {
                            #	 $array=array();
                            #}
                        }
                    } else {
                        $strictuid = 1;
                        $strictsharedwith = 1;
                        $shared_with = 'U' . $user_id;
                        $P = compact('uid', 'shared_with', 'user_id', 'db', 'strictuid', 'strictsharedwith', 'stream', 'timer');
                        if (!ereg('^U|^G', $letter)) {
                            $array['acl'] = permission4Resource($P);
                            $array['permission_level'] = $array['acl'];
                            $permission2user = permissionModelComp($array['permission_level']);
                            $isOwner = $array['created_by'] == $user_id;
                            $array['view'] = allowed($permission2user, 0, $isOwner);
                            $array['change'] = allowed($permission2user, 1, $isOwner);
                            $array['propagate'] = allowed($permission2user, 2, $isOwner);
                            #create the element "delete", in case it is eventually created...For now it is the same as change
                            $array['delete'] = $array['change'];
                            $array['add_data'] = $array['propagate'];
                            $array['delete_data'] = $array['add_data'];
                        } else {
                            if ($resourceUsers) {
                                if (in_array($uid, array_keys($resourceUsers))) {
                                    $array['permissionOnResource'] = $resourceUsers[$uid];
                                } else {
                                    $array = array();
                                }
                            }
                            #else {
                            #	 $array=array();
                            #}
                        }
                    }
                } else {
                    $array['acl'] = 'yyy';
                    if (ereg('^U|^G', $letter) && $resourceUsers) {
                        if ($resourceUsers) {
                            if (in_array($uid, array_keys($resourceUsers))) {
                                $array['permissionOnResource'] = $resourceUsers[$uid];
                            } else {
                                $array = array();
                            }
                        }
                        #else {
                        #	 $array=array();
                        #}
                    }
                }
            }
            if (!empty($array)) {
                $re_issued[$uid] = $array;
                $element_info = $re_issued[$uid];
                $info = $WhereInfo;
                $C = compact('letter', 'info', 'elements', 'element_info', 'user_id', 'db', 'key', 'timer', 'model');
                $element_info = include_all($C);
                $element_info['uri'] = S3DB_URI_BASE . '/' . $letter . $array[$str];
                #$element_info['uri'] = str_replace('central', 'TCGA', S3DB_URI_BASE.'/'.$letter.$array[$str]);
                $pack['uid'] = $uid;
                $pack['info'] = $element_info;
                $element_info = filterDataForQuery($pack);
                if ($timer) {
                    $timer->setMarker('Filter Data For The Query');
                }
                $re_issued[$uid] = $element_info;
            }
        }
    }
    $data = array_values(array_filter($re_issued));
    return $data;
}
Beispiel #9
0
include_once 'unique.php';
include_once 'engines.php';
include_once 'root.php';
include_once 'Database.php';
include_once 'ui.php';
// Basic (minimal) bootstrapping.
include_once SITE_ROOT . '/settings/config.php';
include_once SITE_ROOT . '/settings/config.crypt.php';
include_once SITE_ROOT . '/settings/config.flags.php';
include_once SITE_ROOT . '/settings/config.enums.php';
include_once SITE_ROOT . '/settings/config.global.php';
include_once SITE_ROOT . '/settings/config.databases.php';
include_all(SITE_ROOT . '/model/');
include_all(SITE_ROOT . '/global/');
include_all(SITE_ROOT . '/shreds/');
include_all(SITE_ROOT . '/ui/');
include_once 'Auth.php';
// We're done!
global $_bound;
$_bound = 0;
class Header extends Root
{
    var $string, $replace, $http_response_code;
    public function construct($string, $replace = true, $http_response_code = 200)
    {
        $this->string = $string;
        $this->replace = $replace;
        $this->http_response_code = $http_response_code;
    }
    public function Execute()
    {
Beispiel #10
0
    echo formatReturn($GLOBALS['messages']['no_permission_message'], "User does not have access in this " . $specified_id_type, $input['format']);
    exit;
}
$triples = array();
$rootUID = letter($specified_id_type) . $specifiedInput['rootID'];
$rootTriples = rdf_encode(array(0 => $specified_id_info), letter($specified_id_type), 'array', $db);
$triples = array_merge($triples, $rootTriples);
#Export user permissions on object
#retrieve permission info on this URI
if (in_array('permissions', array_keys($inputs))) {
    $s3ql = compact('user_id', 'db');
    $s3ql['from'] = 'users';
    $s3ql['where'][$specified_id] = $specified_id_info[$specified_id];
    $users = S3QLaction($s3ql);
    $me = $user_info;
    $me = include_all(array('elements' => 'users', 'element_info' => $me, 'user_id' => $user_id, 'db' => $db));
    $me['permissionOnResource'] = $me['permission_level'];
    array_push($users, $me);
    $permissions = array_map('grab_permission', $users);
    $users = grab_id('user', $users);
    $specified_id_info['permissions'] = array_combine($users, $permissions);
    #echo '<pre>';print_r($specified_id_info['permissions']);
    if (is_array($specified_id_info['permissions'])) {
        $n3permissions .= chr(10);
    }
    sprintf($pre . $uid_info['uid'] . $suf) . chr(10);
    foreach ($specified_id_info['permissions'] as $user_code => $pcode) {
        $n3permissions .= sprintf(n3UID('U' . $user_code) . ' s3dbpc:VCU' . $pcode . ' ' . n3UID($ruid_info['uid']) . ' .') . chr(10);
        ##triples fo the rdfapi
        $tr = array(0 => array('s' => $ns[''] . 'U' . $user_code, 'p' => $ns['s3dbpc'] . $pcode, 'o' => $ns[''] . $rootUID, 'p_type' => 'uri', 'o_type' => 'uri'));
        $triples = array_merge($triples, $tr);
Beispiel #11
0
 /**
  * extentions() includes all extentions if they exist
  *
  * @since 0.2.3
  */
 function extentions()
 {
     include_all(THEMEMORE);
 }