Пример #1
0
 public function Execute($db, $params)
 {
     // TODO: Sanity check the expiration date
     // TODO: Also run a regex on Resource to make sure it's a valid (relative or absolute) URL
     if (!isset($params["OwnerID"], $params["Resource"], $params["Expiration"]) || !UUID::TryParse($params["OwnerID"], $this->OwnerID)) {
         header("Content-Type: application/json", true);
         echo '{ "Message": "Invalid parameters" }';
         exit;
     }
     if (!isset($params["CapabilityID"]) || !UUID::TryParse($params["CapabilityID"], $this->CapabilityID)) {
         $this->CapabilityID = UUID::Random();
     }
     $resource = $params["Resource"];
     $expiration = $params["Expiration"];
     $sql = "INSERT INTO Capabilities (ID, OwnerID, Resource, ExpirationDate) VALUES (:ID, :OwnerID, :Resource, :ExpirationDate)\n                ON DUPLICATE KEY UPDATE OwnerID=VALUES(OwnerID), Resource=VALUES(Resource), ExpirationDate=VALUES(ExpirationDate)";
     $sth = $db->prepare($sql);
     if ($sth->execute(array(':ID' => $this->CapabilityID, ':OwnerID' => $this->OwnerID, ':Resource' => $resource, ':ExpirationDate' => $expiration))) {
         header("Content-Type: application/json", true);
         echo sprintf('{"Success": true, "CapabilityID": "%s"}', $this->CapabilityID);
         exit;
     } else {
         log_message('error', sprintf("Error occurred during query: %d %s", $sth->errorCode(), print_r($sth->errorInfo(), true)));
         log_message('debug', sprintf("Query: %s", $sql));
         header("Content-Type: application/json", true);
         echo '{ "Message": "Database query error" }';
         exit;
     }
 }
 public function Execute($db, $params)
 {
     $this->inventory = new ALT($db);
     $folderid = '';
     if (!isset($params["FolderID"]) || !UUID::TryParse($params["FolderID"], $folderid)) {
         $folderid = UUID::Random();
     }
     $this->Folder = new InventoryFolder($folderid);
     if (!isset($params, $params["Name"], $params["ParentID"], $params["OwnerID"]) || !UUID::TryParse($params["ParentID"], $this->Folder->ParentID) || !UUID::TryParse($params["OwnerID"], $this->Folder->OwnerID)) {
         header("Content-Type: application/json", true);
         echo '{ "Message": "Invalid parameters" }';
         exit;
     }
     $this->Folder->Name = trim($params["Name"]);
     $this->Folder->ContentType = isset($params["ContentType"]) && trim($params["ContentType"]) != '' ? trim($params["ContentType"]) : 'application/octet-stream';
     $this->Folder->ExtraData = isset($params["ExtraData"]) ? trim($params["ExtraData"]) : '';
     try {
         $result = $this->inventory->InsertNode($this->Folder);
         if ($result != FALSE) {
             header("Content-Type: application/json", true);
             echo sprintf('{ "Success": true, "FolderID": "%s" }', $result);
             exit;
         } else {
             header("Content-Type: application/json", true);
             echo '{ "Message": "Folder creation failed" }';
             exit;
         }
     } catch (Exception $ex) {
         log_message('error', sprintf("Error occurred during query: %s", $ex));
         header("Content-Type: application/json", true);
         echo '{ "Message": "Database query error" }';
         exit;
     }
 }
 public function Execute($db, $params)
 {
     if (!isset($params["OwnerID"], $params["Resource"], $params["Expiration"]) || !UUID::TryParse($params["OwnerID"], $this->OwnerID)) {
         header("Content-Type: application/json", true);
         echo '{ "Message": "Invalid parameters" }';
         exit;
     }
     if (!isset($params["CapabilityID"]) || !UUID::TryParse($params["CapabilityID"], $this->CapabilityID)) {
         $this->CapabilityID = UUID::Random();
     }
     $resource = $params["Resource"];
     $expiration = intval($params["Expiration"]);
     // Sanity check the expiration date
     if ($expiration <= time()) {
         header("Content-Type: application/json", true);
         echo '{ "Message": "Invalid expiration date ' . $expiration . '" }';
         exit;
     }
     log_message('debug', "Creating capability " . $this->CapabilityID . " owned by " . $this->OwnerID . " mapping to {$resource} until {$expiration}");
     $sql = "INSERT INTO Capabilities (ID, OwnerID, Resource, ExpirationDate) VALUES (:ID, :OwnerID, :Resource, FROM_UNIXTIME(:ExpirationDate))\n                ON DUPLICATE KEY UPDATE ID=VALUES(ID), Resource=VALUES(Resource), ExpirationDate=VALUES(ExpirationDate)";
     $sth = $db->prepare($sql);
     if ($sth->execute(array(':ID' => $this->CapabilityID, ':OwnerID' => $this->OwnerID, ':Resource' => $resource, ':ExpirationDate' => $expiration))) {
         header("Content-Type: application/json", true);
         echo sprintf('{"Success": true, "CapabilityID": "%s"}', $this->CapabilityID);
         exit;
     } else {
         log_message('error', sprintf("Error occurred during query: %d %s", $sth->errorCode(), print_r($sth->errorInfo(), true)));
         log_message('debug', sprintf("Query: %s", $sql));
         header("Content-Type: application/json", true);
         echo '{ "Message": "Database query error" }';
         exit;
     }
 }
 public function testStoreAsset()
 {
     $headers = array('X-Asset-Creator-Id' => (string) UUID::Random(), 'X-Asset-Id' => UUID::Zero);
     $r = new HttpRequest($this->server_url, HttpRequest::METH_POST);
     $r->addHeaders($headers);
     $r->AddPostFile(UUID::Random(), "eyewhite.tga", "image/tga");
     $r->send();
     $this->AssetSHA = sha1(file_get_contents('eyewhite.tga'));
     $this->assertEquals(201, $r->getResponseCode());
     if (file_exists('test.assetid')) {
         unlink('test.assetid');
     }
     file_put_contents('test.assetid', (string) UUID::Parse($r->getResponseHeader("X-Asset-Id")));
 }
 public function Execute($db, $params)
 {
     $this->inventory = new ALT($db);
     $itemid = null;
     if (!isset($params["ItemID"]) || !UUID::TryParse($params["ItemID"], $itemid)) {
         $itemid = UUID::Random();
     }
     $this->Item = new InventoryItem($itemid);
     if (!isset($params, $params["AssetID"], $params["Name"], $params["ParentID"], $params["OwnerID"]) || !UUID::TryParse($params["ParentID"], $this->Item->ParentID) || !UUID::TryParse($params["AssetID"], $this->Item->AssetID) || !UUID::TryParse($params["OwnerID"], $this->Item->OwnerID)) {
         header("Content-Type: application/json", true);
         echo '{ "Message": "Invalid parameters" }';
         exit;
     }
     $this->Item->Name = trim($params["Name"]);
     $this->Item->Description = isset($params["Description"]) ? $params["Description"] : '';
     $this->Item->ExtraData = isset($params["ExtraData"]) ? $params["ExtraData"] : '';
     // If the CreatorID is not set, invalid, or zero, we set CreatorID to NULL so the database
     // layer will fetch CreatorID information based on AssetID
     if (!isset($params["CreatorID"]) || !UUID::TryParse($params["CreatorID"], $this->Item->CreatorID) || $this->Item->CreatorID == '00000000-0000-0000-0000-000000000000') {
         $this->Item->CreatorID = null;
     }
     // If ContentType is not given the database layer will fetch ContentType information based
     // on AssetID
     if (isset($params["ContentType"])) {
         $this->Item->ContentType = $params["ContentType"];
     }
     try {
         $result = $this->inventory->InsertNode($this->Item);
         if ($result != false) {
             header("Content-Type: application/json", true);
             echo sprintf('{ "Success": true, "ItemID": "%s" }', $result);
             exit;
         } else {
             header("Content-Type: application/json", true);
             echo '{ "Message": "Item creation failed" }';
             exit;
         }
     } catch (Exception $ex) {
         log_message('error', sprintf("Error occurred during query: %s", $ex));
         header("Content-Type: application/json", true);
         echo '{ "Message": "Database query error" }';
         exit;
     }
 }
 public function Execute($db, $params)
 {
     $asset = null;
     $assetID = null;
     $response = array();
     if (isset($params["EncodedData"]) && isset($params["ContentType"])) {
         log_message('debug', "xAddAsset asset");
         // Build the asset structure from the parameters
         $asset = new Asset();
         if (!isset($params["AssetID"]) || !UUID::TryParse($params["AssetID"], $asset->ID)) {
             $asset->ID = UUID::Random();
         }
         if (!isset($params["CreatorID"]) || !UUID::TryParse($params["CreatorID"], $asset->CreatorID)) {
             $asset->CreatorID = UUID::Zero;
         }
         $asset->Data = base64_decode($params["EncodedData"]);
         $asset->SHA256 = hash("sha256", $asset->Data);
         $asset->ContentLength = strlen($asset->Data);
         $asset->ContentType = $params["ContentType"];
         $asset->Temporary = !empty($params["Temporary"]);
         $asset->Public = !empty($params["Public"]);
         $assets = new SQLAssets($db);
         $created = false;
         if ($assets->AddAsset($asset, $created)) {
             $response['Success'] = TRUE;
             $response['AssetID'] = $asset->ID;
             $response['Status'] = $created ? "created" : "updated";
         } else {
             log_message('warn', 'failed to create asset');
             $response['Success'] = FALSE;
             $response['Message'] = 'failed to create the asset';
         }
     } else {
         $response['Success'] = FALSE;
         $response['Message'] = 'missing required parameters';
     }
     log_message('debug', sprintf("[AddAsset] result %s", json_encode($response)));
     header("Content-Type: application/json", true);
     echo json_encode($response);
     exit;
 }
 public function __construct($name, $userid)
 {
     /* folder information */
     $Name = $name;
     $RootID = $userid;
     $parent_0 = UUID::Random();
     $parent_1 = UUID::Random();
     $parent_2 = UUID::Random();
     $parent_3 = UUID::Random();
     $parent_4 = UUID::Random();
     $parent_5 = UUID::Random();
     $parent_6 = UUID::Random();
     $parent_7 = UUID::Random();
     $parent_8 = UUID::Random();
     $parent_9 = UUID::Random();
     $parent_10 = UUID::Random();
     $parent_11 = UUID::Random();
     $parent_12 = UUID::Random();
     $parent_13 = UUID::Random();
     $parent_14 = UUID::Random();
     $this->gFolders = array($this->MakeFolder($RootID, UUID::Parse(UUID::Zero), $Name, 'application/vnd.ll.folder'), $this->MakeFolder($parent_0, $RootID, 'Objects', 'application/vnd.ll.primitive'), $this->MakeFolder($parent_1, $RootID, 'Gestures', 'application/vnd.ll.gesture'), $this->MakeFolder($parent_2, $RootID, 'Sounds', 'application/ogg'), $this->MakeFolder($parent_3, $RootID, 'Landmarks', 'application/vnd.ll.landmark'), $this->MakeFolder($parent_4, $RootID, 'Clothing', 'application/vnd.ll.clothing'), $this->MakeFolder($parent_5, $RootID, 'Calling Cards', 'application/vnd.ll.callingcard'), $this->MakeFolder($parent_6, $RootID, 'Photo Album', 'application/vnd.ll.snapshotfolder'), $this->MakeFolder($parent_7, $RootID, 'Scripts', 'application/vnd.ll.lsltext'), $this->MakeFolder($parent_8, $RootID, 'Notecards', 'application/vnd.ll.notecard'), $this->MakeFolder($parent_9, $RootID, 'Textures', 'image/x-j2c'), $this->MakeFolder($parent_10, $RootID, 'Trash', 'application/vnd.ll.trashfolder'), $this->MakeFolder($parent_11, $RootID, 'Lost and Found', 'application/vnd.ll.lostandfoundfolder'), $this->MakeFolder($parent_12, $RootID, 'Body Parts', 'application/vnd.ll.bodypart'), $this->MakeFolder($parent_13, $RootID, 'Animations', 'application/vnd.ll.animation'), $this->MakeFolder($parent_14, $parent_4, 'Default Outfit', 'application/octet-stream'));
     $this->gItems = array($this->MakeItem($parent_14, 'Default Eyes', '78d20332-9b07-44a2-bf74-3b368605f4b5', 'fd6e9c85-2fc3-478d-ad1b-e9bd382b78a9', '{}'), $this->MakeItem($parent_14, 'Default Shape', '530a2614-052e-49a2-af0e-534bb3c05af0', 'fd6e9c85-2fc3-478d-ad1b-e9bd382b78a9', '{}'), $this->MakeItem($parent_14, 'Default Shirt', '6a714f37-fe53-4230-b46f-8db384465981', 'fd6e9c85-2fc3-478d-ad1b-e9bd382b78a9', '{}'), $this->MakeItem($parent_14, 'Default Skin', '5f787f25-f761-4a35-9764-6418ee4774c4', 'fd6e9c85-2fc3-478d-ad1b-e9bd382b78a9', '{}'), $this->MakeItem($parent_14, 'Default Hair', 'dc675529-7ba5-4976-b91d-dcb9e5e36188', 'fd6e9c85-2fc3-478d-ad1b-e9bd382b78a9', '{}'), $this->MakeItem($parent_14, 'Default Pants', '3e8ee2d6-4f21-4a55-832d-77daa505edff', 'fd6e9c85-2fc3-478d-ad1b-e9bd382b78a9', '{}'));
     $this->gAppearance = array('serial' => 1, 'height' => 1.8, 'hipoffset' => 0, 'wearables' => array(array($this->MakeWearable($parent_14, 'Default Shape', '530a2614-052e-49a2-af0e-534bb3c05af0')), array($this->MakeWearable($parent_14, 'Default Skin', '5f787f25-f761-4a35-9764-6418ee4774c4')), array($this->MakeWearable($parent_14, 'Default Hair', 'dc675529-7ba5-4976-b91d-dcb9e5e36188')), array($this->MakeWearable($parent_14, 'Default Eyes', '78d20332-9b07-44a2-bf74-3b368605f4b5')), array($this->MakeWearable($parent_14, 'Default Shirt', '6a714f37-fe53-4230-b46f-8db384465981')), array($this->MakeWearable($parent_14, 'Default Pants', '3e8ee2d6-4f21-4a55-832d-77daa505edff')), array(), array(), array(), array(), array(), array(), array(), array(), array()));
 }
function create_opensim_presence($scene, $userID, $circuitCode, $fullName, $appearance, $sessionID, $secureSessionID, $startPosition, &$seedCapability)
{
    $config =& get_config();
    $serviceurls = array('GatekeeperURI' => $config['hypergrid_uri'], 'HomeURI' => $config['hypergrid_uri'], 'InventoryServerURI' => $config['hg_inventory_service'], 'AssetServerURI' => $config['hg_asset_service'], 'ProfileServerURI' => $config['hg_user_service'], 'FriendsServerURI' => $config['hypergrid_uri'], 'IMServerURI' => $config['hypergrid_uri']);
    $capsPath = UUID::Random();
    return create_opensim_presence_full($scene->Address, $scene->Name, $scene->SceneID, $scene->MinPosition->X, $scene->MinPosition->Y, $userID, $circuitCode, $fullName, $appearance, $sessionID, $secureSessionID, $startPosition, $capsPath, null, $serviceurls, 128, null, $seedCapability);
}
function homeagent_handler($path_tail, $data)
{
    log_message('info', "[hypergrid] homeagent_handler called");
    $data = decodedata($data);
    $userid = $path_tail[0];
    log_message('info', "homeagent_handler called for {$userid} with {$data}");
    $osd = decode_recursive_json($data);
    if ($osd == null) {
        log_message('error', sprintf('[hypergrid] failed to decode foreignagent json string %s', $data));
        sendresponse(false, 'failed to decode foreignagent string');
    }
    $gatekeeper_uri = $osd['gatekeeper_serveruri'];
    if (!isset($osd['destination_x'])) {
        $osd['destination_x'] = 128;
    }
    if (!isset($osd['destination_y'])) {
        $osd['destination_y'] = 128;
    }
    if (!isset($osd['client_ip'])) {
        $session = get_session($userid);
        if (!isset($session['ExtraData']['ClientIP'])) {
            log_message('warn', "[hypergrid] no client ip found in session, this is going to fail");
            sendresponse(false, 'no client ip found in the session');
        }
        $osd['client_ip'] = $session['ExtraData']['ClientIP'];
    }
    if (!isset($osd['service_session_id'])) {
        log_message('debug', 'missing service_session_id, generating a new one');
        $osd['service_session_id'] = $gatekeeper_uri . ';' . UUID::Random();
    }
    /* $dest_uuid = $osd['destination_uuid']; */
    /* $caps_path = $osd['caps_path']; */
    /* $username = $osd['first_name'] . ' ' . $osd['last_name']; */
    /* $circuit_code = $osd['circuit_code']; */
    /* $session_id = $osd['session_id']; */
    /* $secure_session_id = $osd['secure_session_id']; */
    /* $start_pos = $osd['start_pos']; */
    /* $appearance = $osd['packed_appearance']; */
    /* $server_uri = $osd['destination_serveruri']; */
    $data = json_encode($osd);
    log_message('info', "[hypergrid] login to region with {$data}");
    $result = array();
    if (hg_login($gatekeeper_uri, $userid, $data, $yourip)) {
        $result['success'] = true;
        $result['reason'] = "success";
        $result['your_ip'] = $yourip;
        //echo '{"success": true, "reason": "success"}';
    } else {
        $result['success'] = false;
        $result['reason'] = "hypergrid login failed";
        $result['your_ip'] = $yourip;
        // echo '{"success": false, "reason": "hypergrid login failed"}';
    }
    $jresult = json_encode($result);
    log_message('info', "[hypergrid] homeagent returns {$jresult}");
    echo $jresult;
    exit;
}
 public function Execute($db, $params)
 {
     if (isset($params["UserID"]) && UUID::TryParse($params["UserID"], $this->UserID)) {
         if (isset($params["ExtraData"])) {
             $this->ExtraData = $params["ExtraData"];
         } else {
             $this->ExtraData = NULL;
         }
         if (isset($params["SessionID"], $params["SecureSessionID"]) && UUID::TryParse($params['SessionID'], $this->SessionID) && UUID::TryParse($params['SecureSessionID'], $this->SecureSessionID)) {
             // Creating or updating a user session
             $sql = "INSERT INTO Sessions (UserID, SessionID, SecureSessionID, ExtraData, SceneID, ScenePosition, SceneLookAt)\n                        VALUES (:UserID, :SessionID, :SecureSessionID, :ExtraData, '00000000-0000-0000-0000-000000000000', '<0, 0, 0>', '<0, 0, 0>')\n                        ON DUPLICATE KEY UPDATE SessionID=VALUES(SessionID), SecureSessionID=VALUES(SecureSessionID)";
             $sth = $db->prepare($sql);
             if ($sth->execute(array(':UserID' => $this->UserID, ':SessionID' => $this->SessionID, ':SecureSessionID' => $this->SecureSessionID, ':ExtraData' => $this->ExtraData))) {
                 if ($sth->rowCount() > 0) {
                     header("Content-Type: application/json", true);
                     echo sprintf('{ "Success": true, "SessionID": "%s", "SecureSessionID": "%s" }', $this->SessionID, $this->SecureSessionID);
                     exit;
                 } else {
                     log_message('error', "Failed updating the database");
                     header("Content-Type: application/json", true);
                     echo '{ "Message": "Database update failed" }';
                     exit;
                 }
             } else {
                 log_message('error', sprintf("Error occurred during query: %d %s", $sth->errorCode(), print_r($sth->errorInfo(), true)));
                 log_message('debug', sprintf("Query: %s", $sql));
                 header("Content-Type: application/json", true);
                 echo '{ "Message": "Database query error" }';
                 exit;
             }
         } else {
             // Creating or fetching a user session
             $this->SessionID = UUID::Random();
             $this->SecureSessionID = UUID::Random();
             $sql = "INSERT INTO Sessions (UserID, SessionID, SecureSessionID, ExtraData, SceneID, ScenePosition, SceneLookAt)\n                        VALUES (:UserID, :SessionID, :SecureSessionID, :ExtraData, '00000000-0000-0000-0000-000000000000', '<0, 0, 0>', '<0, 0, 0>')";
             $sth = $db->prepare($sql);
             if ($sth->execute(array(':UserID' => $this->UserID, ':SessionID' => $this->SessionID, ':SecureSessionID' => $this->SecureSessionID, ':ExtraData' => $this->ExtraData))) {
                 if ($sth->rowCount() > 0) {
                     header("Content-Type: application/json", true);
                     echo sprintf('{ "Success": true, "SessionID": "%s", "SecureSessionID": "%s" }', $this->SessionID, $this->SecureSessionID);
                     exit;
                 } else {
                     log_message('error', "Failed updating the database");
                     header("Content-Type: application/json", true);
                     echo '{ "Message": "Database update failed" }';
                     exit;
                 }
             } else {
                 $sql = "SELECT SessionID, SecureSessionID FROM Sessions WHERE UserID=:UserID";
                 $sth = $db->prepare($sql);
                 if ($sth->execute(array(':UserID' => $this->UserID))) {
                     if ($sth->rowCount() > 0) {
                         $obj = $sth->fetchObject();
                         header("Content-Type: application/json", true);
                         echo sprintf('{ "Success": true, "SessionID": "%s", "SecureSessionID": "%s" }', $obj->SessionID, $obj->SecureSessionID);
                         exit;
                     } else {
                         log_message('error', "Failed retrieving user session from the database");
                         header("Content-Type: application/json", true);
                         echo '{ "Message": "No user session found" }';
                         exit;
                     }
                 } else {
                     log_message('error', sprintf("Error occurred during query: %d %s", $sth->errorCode(), print_r($sth->errorInfo(), true)));
                     log_message('debug', sprintf("Query: %s", $sql));
                     header("Content-Type: application/json", true);
                     echo '{ "Message": "Database query error" }';
                     exit;
                 }
             }
         }
     } else {
         header("Content-Type: application/json", true);
         echo '{ "Message": "Invalid parameters" }';
         exit;
     }
 }
 public function testUpdatePresence()
 {
     $User = unserialize(file_get_contents('user1.dat'));
     $a = array('RequestMethod' => 'UpdatePresence', 'UserID' => (string) $User->ID, 'Location' => (string) UUID::Random(), 'Position' => '<192, 192, 192>', 'LookAt' => '<-1, -1, -1>');
     $r = new HttpRequest($this->server_url, HttpRequest::METH_POST);
     $r->addPostFields($a);
     $r->send();
     $this->assertEquals(200, $r->getResponseCode());
 }
Пример #12
0
        $asset->ID = $uuid;
        execute_command('GetAsset', $capability, $db, $asset);
        exit;
    } else {
        // Regular GET request
        $gMethodName = '(Webpage)';
        echo 'SimianGrid';
        exit;
    }
} else {
    if (isset($_SERVER['CONTENT_TYPE']) && stripos($_SERVER['CONTENT_TYPE'], 'multipart/form-data') !== FALSE) {
        if (isset($_FILES['Asset']) && count($_FILES) == 1) {
            // Asset upload
            $asset = new Asset();
            if (!isset($_POST['AssetID']) || !UUID::TryParse($_POST['AssetID'], $asset->ID)) {
                $asset->ID = UUID::Random();
            }
            if (!isset($_POST['CreatorID']) || !UUID::TryParse($_POST['CreatorID'], $asset->CreatorID)) {
                $asset->CreatorID = UUID::Zero;
            }
            if (!empty($_FILES['Asset']['tmp_name'])) {
                $tmpName = $_FILES['Asset']['tmp_name'];
                $fp = fopen($tmpName, 'r');
                $asset->Data = fread($fp, filesize($tmpName));
                fclose($fp);
                $asset->SHA256 = hash_file('sha256', $tmpName);
                $asset->ContentLength = filesize($tmpName);
                $asset->ContentType = $_FILES['Asset']['type'];
                $asset->Temporary = !empty($_POST['Temporary']);
                if (isset($_POST['Public'])) {
                    $asset->Public = $_POST['Public'] ? TRUE : FALSE;
Пример #13
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;
}
Пример #14
0
 public function Folders()
 {
     $skeleton = array(array('ID' => $this->RootID, 'ParentID' => UUID::Parse(UUID::Zero), 'Name' => $this->Name, 'PreferredContentType' => 'application/vnd.ll.folder'), array('ID' => UUID::Random(), 'ParentID' => $this->RootID, 'Name' => 'Animations', 'PreferredContentType' => 'application/vnd.ll.animation'), array('ID' => UUID::Random(), 'ParentID' => $this->RootID, 'Name' => 'Body Parts', 'PreferredContentType' => 'application/vnd.ll.bodypart'), array('ID' => UUID::Random(), 'ParentID' => $this->RootID, 'Name' => 'Calling Cards', 'PreferredContentType' => 'application/vnd.ll.callingcard'), array('ID' => UUID::Random(), 'ParentID' => $this->RootID, 'Name' => 'Gestures', 'PreferredContentType' => 'application/vnd.ll.gesture'), array('ID' => UUID::Random(), 'ParentID' => $this->RootID, 'Name' => 'Landmarks', 'PreferredContentType' => 'application/vnd.ll.landmark'), array('ID' => UUID::Random(), 'ParentID' => $this->RootID, 'Name' => 'Lost and Found', 'PreferredContentType' => 'application/vnd.ll.lostandfoundfolder'), array('ID' => UUID::Random(), 'ParentID' => $this->RootID, 'Name' => 'Notecards', 'PreferredContentType' => 'application/vnd.ll.notecard'), array('ID' => UUID::Random(), 'ParentID' => $this->RootID, 'Name' => 'Objects', 'PreferredContentType' => 'application/vnd.ll.primitive'), array('ID' => UUID::Random(), 'ParentID' => $this->RootID, 'Name' => 'Photo Album', 'PreferredContentType' => 'application/vnd.ll.snapshotfolder'), array('ID' => UUID::Random(), 'ParentID' => $this->RootID, 'Name' => 'Scripts', 'PreferredContentType' => 'application/vnd.ll.lsltext'), array('ID' => UUID::Random(), 'ParentID' => $this->RootID, 'Name' => 'Sounds', 'PreferredContentType' => 'application/ogg'), array('ID' => UUID::Random(), 'ParentID' => $this->RootID, 'Name' => 'Textures', 'PreferredContentType' => 'image/x-j2c'), array('ID' => UUID::Random(), 'ParentID' => $this->RootID, 'Name' => 'Trash', 'PreferredContentType' => 'application/vnd.ll.trashfolder'), array('ID' => $this->ClothingID, 'ParentID' => $this->RootID, 'Name' => 'Clothing', 'PreferredContentType' => 'application/vnd.ll.clothing'), array('ID' => $this->OutfitID, 'ParentID' => $this->ClothingID, 'Name' => 'Default Outfit', 'PreferredContentType' => 'application/octet-stream'));
     return $skeleton;
 }