aboutsummaryrefslogtreecommitdiffstats
path: root/include/items.php
diff options
context:
space:
mode:
authorfriendica <info@friendica.com>2012-12-22 04:33:32 -0800
committerfriendica <info@friendica.com>2012-12-22 04:33:32 -0800
commitce0d38969614fbc1c7e3d9d54d974962a1014357 (patch)
tree7e97d9d5ea30d438c0f6ed4d2a929c0c4c811cc1 /include/items.php
parent91932ac5a8d13ba57070512389efaaffdafbd03b (diff)
downloadvolse-hubzilla-ce0d38969614fbc1c7e3d9d54d974962a1014357.tar.gz
volse-hubzilla-ce0d38969614fbc1c7e3d9d54d974962a1014357.tar.bz2
volse-hubzilla-ce0d38969614fbc1c7e3d9d54d974962a1014357.zip
profile messages for directory synchronisation
Diffstat (limited to 'include/items.php')
-rwxr-xr-xinclude/items.php43
1 files changed, 43 insertions, 0 deletions
diff --git a/include/items.php b/include/items.php
index c2688a9cd..4e656d059 100755
--- a/include/items.php
+++ b/include/items.php
@@ -644,6 +644,8 @@ function decode_tags($t) {
}
+// santise a potentially complex array
+
function activity_sanitise($arr) {
if($arr) {
$ret = array();
@@ -658,6 +660,19 @@ function activity_sanitise($arr) {
return '';
}
+// sanitise a simple linear array
+
+function array_sanitise($arr) {
+ if($arr) {
+ $ret = array();
+ foreach($arr as $x) {
+ $ret[] = htmlentities($x, ENT_COMPAT,'UTF-8');
+ }
+ return $ret;
+ }
+ return '';
+}
+
function encode_item_flags($item) {
// most of item_flags and item_restrict are local settings which don't apply when transmitted.
@@ -726,6 +741,34 @@ function get_mail_elements($x) {
}
+function get_profile_elements($x) {
+
+ $arr = array();
+
+ if(import_author_xchan($x['from']))
+ $arr['xprof_hash'] = base64url_encode(hash('whirlpool',$x['from']['guid'] . $x['from']['guid_sig'], true));
+ else
+ return array();
+
+ $arr['desc'] = (($x['title']) ? htmlentities($x['title'],ENT_COMPAT,'UTF-8') : '');
+
+ $arr['dob'] = datetime_convert('UTC','UTC',$x['birthday'],'Y-m-d');
+
+ $arr['gender'] = (($x['gender']) ? htmlentities($x['gender'], ENT_COMPAT,'UTF-8') : '');
+ $arr['marital'] = (($x['marital']) ? htmlentities($x['marital'], ENT_COMPAT,'UTF-8') : '');
+ $arr['sexual'] = (($x['sexual']) ? htmlentities($x['sexual'], ENT_COMPAT,'UTF-8') : '');
+ $arr['locale'] = (($x['locale']) ? htmlentities($x['locale'], ENT_COMPAT,'UTF-8') : '');
+ $arr['region'] = (($x['region']) ? htmlentities($x['region'], ENT_COMPAT,'UTF-8') : '');
+ $arr['postcode'] = (($x['postcode']) ? htmlentities($x['postcode'], ENT_COMPAT,'UTF-8') : '');
+ $arr['country'] = (($x['country']) ? htmlentities($x['country'], ENT_COMPAT,'UTF-8') : '');
+
+ $arr['keywords'] = (($x['keywords'] && is_array($x['keywords'])) ? array_sanitise($x['keywords']) : array());
+
+ return $arr;
+
+}
+
+
function get_atom_elements($feed,$item) {