3 require_once('include/datetime.php');
4 require_once('include/diaspora.php');
5 require_once('include/queue_fn.php');
6 require_once('include/Contact.php');
8 function profile_change() {
15 // $url = $a->get_baseurl() . '/profile/' . $a->user['nickname'];
16 // if($url && strlen(get_config('system','directory')))
17 // proc_run('php',"include/directory.php","$url");
19 $recips = q("SELECT `id`,`name`,`network`,`pubkey`,`notify` FROM `contact` WHERE `network` = '%s'
20 AND `uid` = %d AND `rel` != %d ",
21 dbesc(NETWORK_DIASPORA),
23 intval(CONTACT_IS_SHARING)
28 $r = q("SELECT `profile`.`uid` AS `profile_uid`, `profile`.* , `user`.* FROM `profile`
29 INNER JOIN `user` ON `profile`.`uid` = `user`.`uid`
30 WHERE `user`.`uid` = %d AND `profile`.`is-default` = 1 LIMIT 1",
38 $handle = xmlify($a->user['nickname'] . '@' . substr($a->get_baseurl(), strpos($a->get_baseurl(),'://') + 3));
39 $first = xmlify(((strpos($profile['name'],' '))
40 ? trim(substr($profile['name'],0,strpos($profile['name'],' '))) : $profile['name']));
41 $last = xmlify((($first === $profile['name']) ? '' : trim(substr($profile['name'],strlen($first)))));
42 $large = xmlify($a->get_baseurl() . '/photo/custom/300/' . $profile['uid'] . '.jpg');
43 $medium = xmlify($a->get_baseurl() . '/photo/custom/100/' . $profile['uid'] . '.jpg');
44 $small = xmlify($a->get_baseurl() . '/photo/custom/50/' . $profile['uid'] . '.jpg');
45 $searchable = xmlify((($profile['publish'] && $profile['net-publish']) ? 'true' : 'false' ));
46 // $searchable = 'true';
48 if($searchable === 'true') {
51 if(($profile['dob']) && ($profile['dob'] != '0000-00-00'))
52 $dob = ((intval($profile['dob'])) ? intval($profile['dob']) : '1000') . '-' . datetime_convert('UTC','UTC',$profile['dob'],'m-d');
53 $gender = xmlify($profile['gender']);
54 $about = xmlify($profile['about']);
55 require_once('include/bbcode.php');
56 $about = xmlify(strip_tags(bbcode($about)));
57 $location = formatted_location($profile);
58 $location = xmlify($location);
60 if($profile['pub_keywords']) {
61 $kw = str_replace(',',' ',$profile['pub_keywords']);
62 $kw = str_replace(' ',' ',$kw);
63 $arr = explode(' ',$profile['pub_keywords']);
65 for($x = 0; $x < 5; $x ++) {
67 $tags .= '#' . trim($arr[$x]) . ' ';
71 $tags = xmlify(trim($tags));
74 $tpl = get_markup_template('diaspora_profile.tpl');
76 $msg = replace_macros($tpl,array(
86 '$location' => $location,
87 '$searchable' => $searchable,
90 logger('profile_change: ' . $msg, LOGGER_ALL);
92 foreach($recips as $recip) {
93 $msgtosend = 'xml=' . urlencode(urlencode(diaspora_msg_build($msg,$a->user,$recip,$a->user['prvkey'],$recip['pubkey'],false)));
94 add_to_queue($recip['id'],NETWORK_DIASPORA,$msgtosend,false);