X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=include%2Fcontact_widgets.php;h=cfe27c5c9ba36997b4bb52e1583decd39360910b;hb=b3680c0d266f06d2474cb45750b0486d246a8315;hp=1f70e536f2461b6872634e2894b5da5d1a4bd462;hpb=f39e8126773e2a030cf84c8b9d428cc78546c1b9;p=friendica.git diff --git a/include/contact_widgets.php b/include/contact_widgets.php old mode 100755 new mode 100644 index 1f70e536f2..cfe27c5c9b --- a/include/contact_widgets.php +++ b/include/contact_widgets.php @@ -12,6 +12,7 @@ function follow_widget() { } function findpeople_widget() { + require_once('include/Contact.php'); $a = get_app(); @@ -32,6 +33,7 @@ function findpeople_widget() { '$findthem' => t('Find'), '$suggest' => t('Friend Suggestions'), '$similar' => t('Similar Interests'), + '$random' => t('Random Profile'), '$inv' => t('Invite Friends') )); @@ -87,7 +89,7 @@ function fileas_widget($baseurl,$selected = '') { $cnt = preg_match_all('/\[(.*?)\]/',$saved,$matches,PREG_SET_ORDER); if($cnt) { foreach($matches as $mtch) { - $unescaped = file_tag_decode($mtch[1]); + $unescaped = xmlify(file_tag_decode($mtch[1])); $terms[] = array('name' => $unescaped,'selected' => (($selected == $unescaped) ? 'selected' : '')); } } @@ -103,3 +105,75 @@ function fileas_widget($baseurl,$selected = '') { )); } +function categories_widget($baseurl,$selected = '') { + $a = get_app(); + + $saved = get_pconfig($a->profile['profile_uid'],'system','filetags'); + if(! strlen($saved)) + return; + + $matches = false; + $terms = array(); + $cnt = preg_match_all('/<(.*?)>/',$saved,$matches,PREG_SET_ORDER); + if($cnt) { + foreach($matches as $mtch) { + $unescaped = xmlify(file_tag_decode($mtch[1])); + $terms[] = array('name' => $unescaped,'selected' => (($selected == $unescaped) ? 'selected' : '')); + } + } + + return replace_macros(get_markup_template('categories_widget.tpl'),array( + '$title' => t('Categories'), + '$desc' => '', + '$sel_all' => (($selected == '') ? 'selected' : ''), + '$all' => t('Everything'), + '$terms' => $terms, + '$base' => $baseurl, + + )); +} + +function common_friends_visitor_widget($profile_uid) { + + $a = get_app(); + + if(local_user() == $profile_uid) + return; + + $cid = $zcid = 0; + + if(can_write_wall($a,$profile_uid)) + $cid = local_user(); + else { + if(get_my_url()) { + $r = q("select id from gcontact where nurl = '%s' limit 1", + dbesc(normalise_link(get_my_url())) + ); + if(count($r)) + $zcid = $r[0]['id']; + } + } + + if($cid == 0 && $zcid == 0) + return; + + require_once('include/socgraph.php'); + + if($cid) + $t = count_common_friends($profile_uid,$cid); + else + $t = count_common_friends($profile_uid,$cid); + if(! $t) + return; + + if($cid) + $r = common_friends($profile_uid,$cid,5); + else + $r = common_friends_zcid($profile_uid,$zcid); + + return replace_macros(get_markup_template('remote_friends_common.tpl'), array( + '$desc' => sprintf( tt("%d friend in common", "%d friends in common", $t), $t), + '$items' => $r + )); + +}; \ No newline at end of file