function get_node_and_contents($nodeID, $userID)
{
    $config =& get_config();
    $response = webservice_post($config['inventory_service'], array('RequestMethod' => 'GetInventoryNode', 'ItemID' => $nodeID, 'OwnerID' => $userID, 'IncludeFolders' => '1', 'IncludeItems' => '1', 'ChildrenOnly' => '1'));
    if (!empty($response['Success']) && is_array($response['Items'])) {
        return $response['Items'];
    }
    log_message('error', "Error fetching node {$nodeID} for user {$userID}: " . $response['Message']);
    return NULL;
}
Ejemplo n.º 2
0
function get_a1_hash($userName, &$userID)
{
    $config =& get_config();
    $userID = null;
    $response = webservice_post($config['user_service'], array('RequestMethod' => 'GetIdentities', 'Identifier' => $userName));
    if (!empty($response['Success']) && is_array($response['Identities'])) {
        $identities = $response['Identities'];
        foreach ($identities as $identity) {
            if ($identity['Type'] === 'a1hash' && $identity['Enabled']) {
                $userID = $identity['UserID'];
                return $identity['Credential'];
            }
        }
        // User or WebDAV identity not found
        return null;
    }
    log_message('error', "Error fetching identities for user '{$userName}': " . $response['Message']);
    return null;
}
Ejemplo n.º 3
0
function bump_user($user_id, $username, $email)
{
    $config =& get_config();
    $userService = $config['user_service'];
    $response = webservice_post($userService, array('RequestMethod' => 'AddUser', 'UserID' => $user_id, 'Name' => $username, 'Email' => $email, 'AccessLevel' => 0));
    if (!empty($response['success'])) {
        return true;
    } else {
        return false;
    }
}
function create_opensim_presence_full($server_uri, $scene_name, $scene_uuid, $scene_x, $scene_y, $userID, $circuitCode, $fullName, $appearance, $sessionID, $secureSessionID, $startPosition, $capsPath, $client_ip, $service_urls, $tp_flags, $service_session_id, &$seedCapability)
{
    log_message('info', "Create OpenSim presence in {$server_uri}");
    if (!ends_with($server_uri, '/')) {
        $server_uri .= '/';
    }
    $regionUrl = $server_uri . 'agent/' . $userID . '/';
    list($firstName, $lastName) = explode(' ', $fullName);
    $request = array('agent_id' => $userID, 'caps_path' => $capsPath, 'child' => false, 'circuit_code' => $circuitCode, 'first_name' => $firstName, 'last_name' => $lastName, 'session_id' => $sessionID, 'secure_session_id' => $secureSessionID, 'start_pos' => (string) $startPosition, 'destination_x' => $scene_x, 'destination_y' => $scene_y, 'destination_name' => $scene_name, 'destination_uuid' => $scene_uuid, 'packed_appearance' => $appearance, 'appearance_serial' => 1, 'teleport_flags' => $tp_flags, 'child' => true);
    if ($client_ip != null) {
        $request['client_ip'] = $client_ip;
    }
    if ($service_urls != null) {
        $request['serviceurls'] = $service_urls;
    }
    if ($service_session_id != null) {
        $request['service_session_id'] = $service_session_id;
    }
    $response = webservice_post($regionUrl, $request, true);
    if (!empty($response['success'])) {
        // This is the hardcoded format OpenSim uses for seed capability URLs
        $seedCapability = $server_uri . 'CAPS/' . $capsPath . '0000/';
        return $response['success'];
    }
    log_message('warn', "failed to create presence for {$userID}");
    $seedCapability = null;
    return false;
}
function hg_link_region($sceneID, $region_name, $external_name, $x, $y, $regionImage, $hgurl)
{
    log_message('info', "[hypergrid] hg_link_region called");
    $config =& get_config();
    $gridService = $config['grid_service'];
    $minpos = '<' . $x * 256 . "," . $y * 256 . ",0>";
    $maxpos = '<' . ($x * 256 + 256) . "," . ($y * 256 + 256) . ",0>";
    $xd = json_encode(array('HyperGrid' => true, 'RegionImage' => $regionImage, 'ExternalName' => $external_name));
    $data = array('RequestMethod' => 'AddScene', 'SceneID' => $sceneID, 'Name' => $region_name, 'MinPosition' => $minpos, 'MaxPosition' => $maxpos, 'ExtraData' => $xd, 'Address' => $hgurl, 'Enabled' => true);
    $response = webservice_post($gridService, $data);
    if ($response['Success']) {
        refresh_map_tile($x, $y, $regionImage);
    }
    return $response['Success'];
}
Ejemplo n.º 6
0
function create_opensim_presence($scene, $userID, $circuitCode, $fullName, $appearance, $attachments, $sessionID, $secureSessionID, $startPosition, &$seedCapability)
{
    $regionBaseUrl = $scene->Address;
    if (!ends_with($regionBaseUrl, '/')) {
        $regionBaseUrl .= '/';
    }
    $regionUrl = $regionBaseUrl . 'agent/' . $userID . '/';
    list($firstName, $lastName) = explode(' ', $fullName);
    $capsPath = UUID::Random();
    $wearables = array();
    $attached = array();
    if (isset($appearance)) {
        add_wearable($wearables, $appearance, 'Shape');
        add_wearable($wearables, $appearance, 'Skin');
        add_wearable($wearables, $appearance, 'Hair');
        add_wearable($wearables, $appearance, 'Eyes');
        add_wearable($wearables, $appearance, 'Shirt');
        add_wearable($wearables, $appearance, 'Pants');
        add_wearable($wearables, $appearance, 'Shoes');
        add_wearable($wearables, $appearance, 'Socks');
        add_wearable($wearables, $appearance, 'Jacket');
        add_wearable($wearables, $appearance, 'Gloves');
        add_wearable($wearables, $appearance, 'Undershirt');
        add_wearable($wearables, $appearance, 'Underpants');
        add_wearable($wearables, $appearance, 'Skirt');
    }
    if (isset($attachments)) {
        $i = 0;
        foreach ($attachments as $key => $item) {
            if (substr($key, 0, 4) === '_ap_') {
                $point = (int) substr($key, 4);
                $attached[$i++] = array('point' => $point, 'item' => $item);
            }
        }
    }
    $response = webservice_post($regionUrl, array('agent_id' => $userID, 'caps_path' => $capsPath, 'child' => false, 'circuit_code' => $circuitCode, 'first_name' => $firstName, 'last_name' => $lastName, 'session_id' => $sessionID, 'secure_session_id' => $secureSessionID, 'start_pos' => (string) $startPosition, 'appearance_serial' => 1, 'destination_x' => $scene->MinPosition->X, 'destination_y' => $scene->MinPosition->Y, 'destination_name' => $scene->Name, 'destination_uuid' => $scene->SceneID, 'wearables' => $wearables, 'attachments' => $attached, 'teleport_flags' => 128), true);
    if (!empty($response['success'])) {
        // This is the hardcoded format OpenSim uses for seed capability URLs
        $seedCapability = $regionBaseUrl . 'CAPS/' . $capsPath . '0000/';
        return true;
    }
    $seedCapability = null;
    return false;
}