streams/include/contact_widgets.php

134 lines
3.6 KiB
PHP
Raw Normal View History

2013-02-26 01:09:40 +00:00
<?php /** @file */
2013-12-07 05:40:01 +00:00
function findpeople_widget() {
if(get_config('system','invitation_only')) {
2015-01-29 04:56:04 +00:00
$x = get_pconfig(local_channel(),'system','invites_remaining');
if($x || is_site_admin()) {
2016-03-31 23:06:03 +00:00
App::$page['aside'] .= '<div class="side-link" id="side-invite-remain">'
. sprintf( tt('%d invitation available','%d invitations available',$x), $x)
. '</div>' . $inv;
}
}
2014-03-09 01:39:20 +00:00
$advanced_search = ((local_channel() && feature_enabled(local_channel(),'advanced_dirsearch')) ? t('Advanced') : false);
return replace_macros(get_markup_template('peoplefind.tpl'),array(
2012-11-03 09:34:12 +00:00
'$findpeople' => t('Find Channels'),
'$desc' => t('Enter name or interest'),
'$label' => t('Connect/Follow'),
'$hint' => t('Examples: Robert Morgenstein, Fishing'),
'$findthem' => t('Find'),
2012-11-03 09:34:12 +00:00
'$suggest' => t('Channel Suggestions'),
'$similar' => '', // FIXME and uncomment when mod/match working // t('Similar Interests'),
2012-04-11 03:50:31 +00:00
'$random' => t('Random Profile'),
'$inv' => t('Invite Friends'),
2014-03-09 01:39:20 +00:00
'$advanced_search' => $advanced_search,
'$advanced_hint' => "\r\n" . t('Advanced example: name=fred and country=iceland'),
2015-01-29 04:56:04 +00:00
'$loggedin' => local_channel()
));
}
2011-11-02 04:27:11 +00:00
function fileas_widget($baseurl,$selected = '') {
2012-07-10 05:08:25 +00:00
2015-01-29 04:56:04 +00:00
if(! local_channel())
return '';
$terms = array();
2016-06-01 04:45:33 +00:00
$r = q("select distinct(term) from term where uid = %d and ttype = %d order by term asc",
2015-01-29 04:56:04 +00:00
intval(local_channel()),
2012-07-10 05:08:25 +00:00
intval(TERM_FILE)
);
2012-11-03 13:32:27 +00:00
if(! $r)
return;
foreach($r as $rr)
2012-07-10 05:08:25 +00:00
$terms[] = array('name' => $rr['term'], 'selected' => (($selected == $rr['term']) ? 'selected' : ''));
return replace_macros(get_markup_template('fileas_widget.tpl'),array(
2012-03-30 09:42:36 +00:00
'$title' => t('Saved Folders'),
'$desc' => '',
'$sel_all' => (($selected == '') ? 'selected' : ''),
'$all' => t('Everything'),
'$terms' => $terms,
'$base' => $baseurl,
));
}
2012-01-06 04:40:48 +00:00
function categories_widget($baseurl,$selected = '') {
2016-03-31 23:06:03 +00:00
if(! feature_enabled(App::$profile['profile_uid'],'categories'))
2012-11-03 23:51:29 +00:00
return '';
$item_normal = item_normal();
$terms = array();
$r = q("select distinct(term.term)
from term join item on term.oid = item.id
where item.uid = %d
and term.uid = item.uid
2016-06-01 04:45:33 +00:00
and term.ttype = %d
and term.otype = %d
and item.owner_xchan = '%s'
and item.item_wall = 1
$item_normal
order by term.term asc",
2016-03-31 23:06:03 +00:00
intval(App::$profile['profile_uid']),
intval(TERM_CATEGORY),
intval(TERM_OBJ_POST),
2016-03-31 23:06:03 +00:00
dbesc(App::$profile['channel_hash'])
2012-07-10 05:08:25 +00:00
);
if($r && count($r)) {
2012-07-10 05:08:25 +00:00
foreach($r as $rr)
$terms[] = array('name' => $rr['term'], 'selected' => (($selected == $rr['term']) ? '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,
));
}
return '';
}
2012-05-02 02:16:18 +00:00
function common_friends_visitor_widget($profile_uid) {
2015-01-29 04:56:04 +00:00
if(local_channel() == $profile_uid)
2012-05-02 02:16:18 +00:00
return;
$observer_hash = get_observer_hash();
2012-09-10 04:17:06 +00:00
if((! $observer_hash) || (! perm_is_allowed($profile_uid,$observer_hash,'view_contacts')))
return;
2012-05-02 02:16:18 +00:00
require_once('include/socgraph.php');
$t = count_common_friends($profile_uid,$observer_hash);
2012-05-02 02:16:18 +00:00
if(! $t)
return;
$r = common_friends($profile_uid,$observer_hash,0,5,true);
2012-05-02 02:16:18 +00:00
return replace_macros(get_markup_template('remote_friends_common.tpl'), array(
'$desc' => sprintf( tt("%d connection in common", "%d connections in common", $t), $t),
2016-03-31 05:13:24 +00:00
'$base' => z_root(),
2012-05-04 08:46:36 +00:00
'$uid' => $profile_uid,
'$cid' => $observer,
'$linkmore' => (($t > 5) ? 'true' : ''),
2012-05-04 08:46:36 +00:00
'$more' => t('show more'),
2012-05-02 02:20:41 +00:00
'$items' => $r
2012-05-02 02:16:18 +00:00
));
2013-12-07 05:40:01 +00:00
};