| 1 |
<?php |
|---|
| 2 |
|
|---|
| 3 |
|
|---|
| 4 |
|
|---|
| 5 |
$user_id = (int) $parameter; |
|---|
| 6 |
|
|---|
| 7 |
$foaf_elements = ""; |
|---|
| 8 |
$where = run("users:access_level_sql_where",$_SESSION['userid']); |
|---|
| 9 |
|
|---|
| 10 |
if (isset($data['vcard:profile:adr']) && sizeof($data['vcard:profile:adr']) > 0) { |
|---|
| 11 |
|
|---|
| 12 |
foreach($data['vcard:profile:adr'] as $foaf_element) { |
|---|
| 13 |
|
|---|
| 14 |
|
|---|
| 15 |
$value = ""; |
|---|
| 16 |
$value_type = ""; |
|---|
| 17 |
|
|---|
| 18 |
$profile_value = addslashes($foaf_element[0]); |
|---|
| 19 |
$foaf_name = $foaf_element[1]; |
|---|
| 20 |
$individual = $foaf_element[2]; |
|---|
| 21 |
$resource = $foaf_element[3]; |
|---|
| 22 |
foreach($data['profile:details'] as $profile_element) { |
|---|
| 23 |
if ($profile_element[1] == $profile_value) { |
|---|
| 24 |
$value_type = $profile_element[2]; |
|---|
| 25 |
} |
|---|
| 26 |
} |
|---|
| 27 |
|
|---|
| 28 |
if ($value_type != "keywords") { |
|---|
| 29 |
$result = db_query("select value from profile_data where name = '$profile_value' and ($where) and owner = $user_id"); |
|---|
| 30 |
} else { |
|---|
| 31 |
$result = db_query("select tag from tags where tagtype = '$profile_value' and ($where) and owner = $user_id"); |
|---|
| 32 |
} |
|---|
| 33 |
if (sizeof($result > 0)) { |
|---|
| 34 |
if ($individual == "individual") { |
|---|
| 35 |
foreach($result as $element) { |
|---|
| 36 |
if ($value_type == "keywords") { |
|---|
| 37 |
$element->value = $element->tag; |
|---|
| 38 |
} |
|---|
| 39 |
if (trim($element->value) != "") { |
|---|
| 40 |
$value = stripslashes($element->value); |
|---|
| 41 |
if ($resource == "resource") { |
|---|
| 42 |
$enclosure = "\t\t\t<" . $foaf_name . " "; |
|---|
| 43 |
if ($value_type == "keywords") { |
|---|
| 44 |
$enclosure .= "dc:title=\"" . htmlentities($value) . "\" "; |
|---|
| 45 |
$enclosure .= "rdf:resource=\"" . url . "tag/".urlencode($value)."\" />\n"; |
|---|
| 46 |
} else { |
|---|
| 47 |
$enclosure .= "rdf:resource=\"" . htmlentities($value) . "\" />\n"; |
|---|
| 48 |
} |
|---|
| 49 |
$foaf_elements .= $enclosure; |
|---|
| 50 |
} else { |
|---|
| 51 |
$enclosure = "\t\t\t<" . $foaf_name . "><![CDATA[" . htmlentities($value) . "]]></" . $foaf_name . ">\n"; |
|---|
| 52 |
$foaf_elements .= $enclosure; |
|---|
| 53 |
} |
|---|
| 54 |
} |
|---|
| 55 |
} |
|---|
| 56 |
} else { |
|---|
| 57 |
foreach($result as $element) { |
|---|
| 58 |
if ($value_type == "keywords") { |
|---|
| 59 |
$element->value = $element->tag; |
|---|
| 60 |
} |
|---|
| 61 |
if (trim($element->value) != "") { |
|---|
| 62 |
if ($value != "") { |
|---|
| 63 |
$value .= ", "; |
|---|
| 64 |
} |
|---|
| 65 |
$value .= stripslashes($element->value); |
|---|
| 66 |
} |
|---|
| 67 |
if ($resource == "resource") { |
|---|
| 68 |
$enclosure = "\t\t\t<" . $foaf_name . " "; |
|---|
| 69 |
if ($value_type == "keywords") { |
|---|
| 70 |
$enclosure .= "dc:title=\"" . htmlentities($value) . "\" "; |
|---|
| 71 |
$enclosure .= "rdf:resource=\"" . url . "tag/".urlencode($value)."\" />\n"; |
|---|
| 72 |
} else { |
|---|
| 73 |
$enclosure .= "rdf:resource=\"" . htmlentities($value) . "\" />\n"; |
|---|
| 74 |
} |
|---|
| 75 |
} else { |
|---|
| 76 |
$enclosure = "\t\t\t<" . $foaf_name . "><![CDATA[" . htmlentities($value) . "]]></" . $foaf_name . ">\n"; |
|---|
| 77 |
} |
|---|
| 78 |
} |
|---|
| 79 |
$foaf_elements .= $enclosure; |
|---|
| 80 |
} |
|---|
| 81 |
} |
|---|
| 82 |
|
|---|
| 83 |
} |
|---|
| 84 |
|
|---|
| 85 |
} |
|---|
| 86 |
|
|---|
| 87 |
$run_result .= $foaf_elements; |
|---|
| 88 |
|
|---|
| 89 |
?> |
|---|