webroot/profile.php:

- Added $zeroUUID to avoid repeating the string in several places
- Fixed creation of response packet in many functions
- Insert empty profile record on properties request of non-existant record
- Return interest data along with properties data as expected by viewer
- Fixed updating of the interest data in user profile
- Fixed support for notes tab in profile

There are still problems with Picks and Classifieds profile operations.
(Forward port from r62 of opensim-069 branch)


git-svn-id: http://forge.opensimulator.org/svn/osprofile/trunk@68 19860011-0018-435d-96ae-4a7b0aaa3128
This commit is contained in:
kcozens
2010-10-06 02:30:01 +00:00
parent 7ed3b96267
commit 7109ae4d57
+28 -46
View File
@@ -188,11 +188,11 @@ function avatarpicksrequest($method_name, $params, $app_data)
$uuid = $req['uuid'];
$result = mysql_query("SELECT * FROM userpicks WHERE ".
"creatoruuid = '". mysql_escape_string($uuid) ."'");
$data = array();
$result = mysql_query("SELECT `pickuuid`,`name` FROM userpicks WHERE ".
"creatoruuid = '". mysql_escape_string($uuid) ."'");
while (($row = mysql_fetch_assoc($result)))
{
$data[] = array(
@@ -220,16 +220,16 @@ function pickinforequest($method_name, $params, $app_data)
$uuid = $req['avatar_id'];
$pick = $req['pick_id'];
$data = array();
$result = mysql_query("SELECT * FROM userpicks WHERE ".
"creatoruuid = '". mysql_escape_string($uuid) ."' AND ".
"pickuuid = '". mysql_escape_string($pick) ."'");
$data = array();
$row = mysql_fetch_assoc($result);
if ($row != FALSE)
{
if ($row["description"] == "")
if ($row["description"] == null || $row["description"] == "")
$row["description"] = "No description given";
$data[] = array(
@@ -275,12 +275,20 @@ function picks_update($method_name, $params, $app_data)
$parceluuid = $req['parcel_uuid'];
$snapshotuuid = $req['snapshot_id'];
$user = $req['user'];
$original = $req['original'];
$simname = $req['sim_name'];
$posglobal = $req['pos_global'];
$sortorder = $req['sort_order'];
$enabled = $req['enabled'];
if($parceluuid == "")
$parceluuid = $zeroUUID;
if($description == "")
$description = "No Description";
$sql = "SELECT COUNT(*) FROM userpicks WHERE ".
"pickuuid = '". mysql_escape_string($pickuuid) ."'";
// Check if we already have this one in the database
$check = mysql_query("SELECT COUNT(*) FROM userpicks WHERE ".
"pickuuid = '". mysql_escape_string($pickuuid) ."'");
@@ -289,23 +297,14 @@ function picks_update($method_name, $params, $app_data)
if ($row[0] == 0)
{
// Doing some late checking
// Should be done by the module but let's see what happens when
// I do it here
if($parceluuid == "")
$parceluuid = $zeroUUID;
if($description == "")
$description = "No Description";
if($user == "")
if($user == null || $user == "")
$user = "Unknown";
if($original == "")
$original = "Unknown";
//The original parcel name is the same as the name of the
//profile pick when a new profile pick is being created.
$original = $name;
$insertquery = "INSERT INTO userpicks VALUES ".
$query = "INSERT INTO userpicks VALUES ".
"('". mysql_escape_string($pickuuid) ."',".
"'". mysql_escape_string($creator) ."',".
"'". mysql_escape_string($toppick) ."',".
@@ -319,41 +318,21 @@ function picks_update($method_name, $params, $app_data)
"'". mysql_escape_string($posglobal) ."',".
"'". mysql_escape_string($sortorder) ."',".
"'". mysql_escape_string($enabled) ."')";
//print $insertquery;
// Create a new record for this avatar note
$result = mysql_query($insertquery);
}
else
{
// Doing some late checking
// Should be done by the module but let's see what happens when
// I do it here
if($parceluuid == "")
$parceluuid = $zeroUUID;
if($description == "")
$description = "Test";
if($user == "")
$user = "Unknown";
if($original == "")
$original = "Unknown";
$updatequery1 = "UPDATE userpicks SET " .
$query = "UPDATE userpicks SET " .
"parceluuid = '". mysql_escape_string($parceluuid) . "', " .
"name = '". mysql_escape_string($name) . "', " .
"description = '". mysql_escape_string($description) . "', " .
"snapshotuuid = '". mysql_escape_string($snapshotuuid) . "' WHERE ".
"pickuuid = '". mysql_escape_string($pickuuid) ."'";
// Update the existing record
$result = mysql_query($updatequery);
}
$result = mysql_query($query);
if ($result != FALSE)
$result = True;
$response_xml = xmlrpc_encode(array(
'success' => $result,
'errorMessage' => mysql_error()
@@ -376,6 +355,9 @@ function picks_delete($method_name, $params, $app_data)
$result = mysql_query("DELETE FROM userpicks WHERE ".
"pickuuid = '".mysql_escape_string($pickuuid) ."'");
if ($result != FALSE)
$result = True;
$response_xml = xmlrpc_encode(array(
'success' => $result,
'errorMessage' => mysql_error()