Fixed an exit of a loop in builtin_activity_puller().
There was a "$return", but I think it should be "return".
This commit is contained in:
parent
daed7fbead
commit
9d143e3f2d
@ -205,20 +205,20 @@ function localize_item(&$item){
|
|||||||
$item['body'] .= "\n\n\n" . $Bphoto;
|
$item['body'] .= "\n\n\n" . $Bphoto;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stristr($item['verb'],ACTIVITY_POKE)) {
|
if (stristr($item['verb'], ACTIVITY_POKE)) {
|
||||||
|
|
||||||
// FIXME for obscured private posts, until then leave untranslated
|
/** @FIXME for obscured private posts, until then leave untranslated */
|
||||||
return;
|
return;
|
||||||
|
|
||||||
$verb = urldecode(substr($item['verb'],strpos($item['verb'],'#')+1));
|
$verb = urldecode(substr($item['verb'],strpos($item['verb'],'#')+1));
|
||||||
if(! $verb)
|
if(! $verb)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if ($item['obj_type']=="" || $item['obj_type']!== ACTIVITY_OBJ_PERSON) return;
|
if ($item['obj_type']=="" || $item['obj_type']!== ACTIVITY_OBJ_PERSON) return;
|
||||||
|
|
||||||
$Aname = $item['author']['xchan_name'];
|
$Aname = $item['author']['xchan_name'];
|
||||||
$Alink = $item['author']['xchan_url'];
|
$Alink = $item['author']['xchan_url'];
|
||||||
|
|
||||||
|
|
||||||
$obj= json_decode_plus($item['object']);
|
$obj= json_decode_plus($item['object']);
|
||||||
|
|
||||||
$Blink = $Bphoto = '';
|
$Blink = $Bphoto = '';
|
||||||
@ -246,7 +246,6 @@ function localize_item(&$item){
|
|||||||
|
|
||||||
$item['body'] = $item['localize'] = sprintf($txt, $A, $B);
|
$item['body'] = $item['localize'] = sprintf($txt, $A, $B);
|
||||||
$item['body'] .= "\n\n\n" . $Bphoto;
|
$item['body'] .= "\n\n\n" . $Bphoto;
|
||||||
|
|
||||||
}
|
}
|
||||||
if (stristr($item['verb'],ACTIVITY_MOOD)) {
|
if (stristr($item['verb'],ACTIVITY_MOOD)) {
|
||||||
$verb = urldecode(substr($item['verb'],strpos($item['verb'],'#')+1));
|
$verb = urldecode(substr($item['verb'],strpos($item['verb'],'#')+1));
|
||||||
@ -376,53 +375,71 @@ function localize_item(&$item){
|
|||||||
$item['body'] = json_encode(crypto_encapsulate($item['body'],get_config('system','pubkey')));
|
$item['body'] = json_encode(crypto_encapsulate($item['body'],get_config('system','pubkey')));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Count the total of comments on this item and its desendants
|
* @brief Count the total of comments on this item and its desendants.
|
||||||
|
*
|
||||||
|
* @param array $item an assoziative item-array which provides:
|
||||||
|
* * \e array \b children
|
||||||
|
* @return number
|
||||||
*/
|
*/
|
||||||
function count_descendants($item) {
|
function count_descendants($item) {
|
||||||
|
|
||||||
$total = count($item['children']);
|
$total = count($item['children']);
|
||||||
|
|
||||||
if($total > 0) {
|
if ($total > 0) {
|
||||||
foreach($item['children'] as $child) {
|
foreach ($item['children'] as $child) {
|
||||||
if(! visible_activity($child))
|
if (! visible_activity($child))
|
||||||
$total --;
|
$total --;
|
||||||
$total += count_descendants($child);
|
|
||||||
}
|
$total += count_descendants($child);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return $total;
|
return $total;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Check if the activity of the item is visible.
|
||||||
|
*
|
||||||
|
* likes (etc.) can apply to other things besides posts. Check if they are post
|
||||||
|
* children, in which case we handle them specially.
|
||||||
|
*
|
||||||
|
* @param array $item
|
||||||
|
* @return boolean
|
||||||
|
*/
|
||||||
function visible_activity($item) {
|
function visible_activity($item) {
|
||||||
|
|
||||||
// likes (etc.) can apply to other things besides posts. Check if they are post children,
|
|
||||||
// in which case we handle them specially
|
|
||||||
|
|
||||||
$hidden_activities = array(ACTIVITY_LIKE, ACTIVITY_DISLIKE, ACTIVITY_AGREE, ACTIVITY_DISAGREE, ACTIVITY_ABSTAIN, ACTIVITY_ATTEND, ACTIVITY_ATTENDNO, ACTIVITY_ATTENDMAYBE);
|
$hidden_activities = array(ACTIVITY_LIKE, ACTIVITY_DISLIKE, ACTIVITY_AGREE, ACTIVITY_DISAGREE, ACTIVITY_ABSTAIN, ACTIVITY_ATTEND, ACTIVITY_ATTENDNO, ACTIVITY_ATTENDMAYBE);
|
||||||
foreach($hidden_activities as $act) {
|
|
||||||
if((activity_match($item['verb'],$act)) && ($item['mid'] != $item['parent_mid'])) {
|
foreach ($hidden_activities as $act) {
|
||||||
|
if ((activity_match($item['verb'], $act)) && ($item['mid'] != $item['parent_mid'])) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* "Render" a conversation or list of items for HTML display.
|
* @brief "Render" a conversation or list of items for HTML display.
|
||||||
|
*
|
||||||
* There are two major forms of display:
|
* There are two major forms of display:
|
||||||
* - Sequential or unthreaded ("New Item View" or search results)
|
* - Sequential or unthreaded ("New Item View" or search results)
|
||||||
* - conversation view
|
* - conversation view
|
||||||
|
*
|
||||||
* The $mode parameter decides between the various renderings and also
|
* The $mode parameter decides between the various renderings and also
|
||||||
* figures out how to determine page owner and other contextual items
|
* figures out how to determine page owner and other contextual items
|
||||||
* that are based on unique features of the calling module.
|
* that are based on unique features of the calling module.
|
||||||
*
|
*
|
||||||
|
* @param App &$a
|
||||||
|
* @param array $items
|
||||||
|
* @param string $mode
|
||||||
|
* @param boolean $update
|
||||||
|
* @param string $page_mode default traditional
|
||||||
|
* @param string $prepared_item
|
||||||
|
* @return string
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
function conversation(&$a, $items, $mode, $update, $page_mode = 'traditional', $prepared_item = '') {
|
function conversation(&$a, $items, $mode, $update, $page_mode = 'traditional', $prepared_item = '') {
|
||||||
|
|
||||||
$content_html = '';
|
$content_html = '';
|
||||||
@ -432,39 +449,38 @@ function conversation(&$a, $items, $mode, $update, $page_mode = 'traditional', $
|
|||||||
|
|
||||||
$ssl_state = ((local_channel()) ? true : false);
|
$ssl_state = ((local_channel()) ? true : false);
|
||||||
|
|
||||||
if(local_channel())
|
if (local_channel())
|
||||||
load_pconfig(local_channel(),'');
|
load_pconfig(local_channel(),'');
|
||||||
|
|
||||||
$arr_blocked = null;
|
$arr_blocked = null;
|
||||||
|
|
||||||
if(local_channel())
|
if (local_channel())
|
||||||
$str_blocked = get_pconfig(local_channel(),'system','blocked');
|
$str_blocked = get_pconfig(local_channel(),'system','blocked');
|
||||||
if(! local_channel() && ($mode == 'network')) {
|
if (! local_channel() && ($mode == 'network')) {
|
||||||
$sys = get_sys_channel();
|
$sys = get_sys_channel();
|
||||||
$id = $sys['channel_id'];
|
$id = $sys['channel_id'];
|
||||||
$str_blocked = get_pconfig($id,'system','blocked');
|
$str_blocked = get_pconfig($id,'system','blocked');
|
||||||
}
|
}
|
||||||
|
|
||||||
if($str_blocked) {
|
if ($str_blocked) {
|
||||||
$arr_blocked = explode(',',$str_blocked);
|
$arr_blocked = explode(',',$str_blocked);
|
||||||
for($x = 0; $x < count($arr_blocked); $x ++)
|
for ($x = 0; $x < count($arr_blocked); $x ++)
|
||||||
$arr_blocked[$x] = trim($arr_blocked[$x]);
|
$arr_blocked[$x] = trim($arr_blocked[$x]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$profile_owner = 0;
|
||||||
$profile_owner = 0;
|
$page_writeable = false;
|
||||||
$page_writeable = false;
|
|
||||||
$live_update_div = '';
|
$live_update_div = '';
|
||||||
|
|
||||||
$preview = (($page_mode === 'preview') ? true : false);
|
$preview = (($page_mode === 'preview') ? true : false);
|
||||||
$previewing = (($preview) ? ' preview ' : '');
|
$previewing = (($preview) ? ' preview ' : '');
|
||||||
|
|
||||||
if($mode === 'network') {
|
if ($mode === 'network') {
|
||||||
|
|
||||||
$profile_owner = local_channel();
|
$profile_owner = local_channel();
|
||||||
$page_writeable = true;
|
$page_writeable = true;
|
||||||
|
|
||||||
if(!$update) {
|
if (!$update) {
|
||||||
// The special div is needed for liveUpdate to kick in for this page.
|
// The special div is needed for liveUpdate to kick in for this page.
|
||||||
// We only launch liveUpdate if you aren't filtering in some incompatible
|
// We only launch liveUpdate if you aren't filtering in some incompatible
|
||||||
// way and also you aren't writing a comment (discovered in javascript).
|
// way and also you aren't writing a comment (discovered in javascript).
|
||||||
@ -490,13 +506,13 @@ function conversation(&$a, $items, $mode, $update, $page_mode = 'traditional', $
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
elseif($mode === 'channel') {
|
elseif ($mode === 'channel') {
|
||||||
$profile_owner = $a->profile['profile_uid'];
|
$profile_owner = $a->profile['profile_uid'];
|
||||||
$page_writeable = ($profile_owner == local_channel());
|
$page_writeable = ($profile_owner == local_channel());
|
||||||
|
|
||||||
if(!$update) {
|
if (!$update) {
|
||||||
$tab = notags(trim($_GET['tab']));
|
$tab = notags(trim($_GET['tab']));
|
||||||
if($tab === 'posts') {
|
if ($tab === 'posts') {
|
||||||
// This is ugly, but we can't pass the profile_uid through the session to the ajax updater,
|
// This is ugly, but we can't pass the profile_uid through the session to the ajax updater,
|
||||||
// because browser prefetching might change it on us. We have to deliver it with the page.
|
// because browser prefetching might change it on us. We have to deliver it with the page.
|
||||||
|
|
||||||
@ -507,23 +523,23 @@ function conversation(&$a, $items, $mode, $update, $page_mode = 'traditional', $
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
elseif($mode === 'display') {
|
elseif ($mode === 'display') {
|
||||||
$profile_owner = local_channel();
|
$profile_owner = local_channel();
|
||||||
$page_writeable = false;
|
$page_writeable = false;
|
||||||
$live_update_div = '<div id="live-display"></div>' . "\r\n";
|
$live_update_div = '<div id="live-display"></div>' . "\r\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
elseif($mode === 'page') {
|
elseif ($mode === 'page') {
|
||||||
$profile_owner = $a->profile['uid'];
|
$profile_owner = $a->profile['uid'];
|
||||||
$page_writeable = ($profile_owner == local_channel());
|
$page_writeable = ($profile_owner == local_channel());
|
||||||
$live_update_div = '<div id="live-page"></div>' . "\r\n";
|
$live_update_div = '<div id="live-page"></div>' . "\r\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
elseif($mode === 'search') {
|
elseif ($mode === 'search') {
|
||||||
$live_update_div = '<div id="live-search"></div>' . "\r\n";
|
$live_update_div = '<div id="live-search"></div>' . "\r\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
elseif($mode === 'photos') {
|
elseif ($mode === 'photos') {
|
||||||
$profile_onwer = $a->profile['profile_uid'];
|
$profile_onwer = $a->profile['profile_uid'];
|
||||||
$page_writeable = ($profile_owner == local_channel());
|
$page_writeable = ($profile_owner == local_channel());
|
||||||
$live_update_div = '<div id="live-photos"></div>' . "\r\n";
|
$live_update_div = '<div id="live-photos"></div>' . "\r\n";
|
||||||
@ -533,7 +549,7 @@ function conversation(&$a, $items, $mode, $update, $page_mode = 'traditional', $
|
|||||||
|
|
||||||
$page_dropping = ((local_channel() && local_channel() == $profile_owner) ? true : false);
|
$page_dropping = ((local_channel() && local_channel() == $profile_owner) ? true : false);
|
||||||
|
|
||||||
if(! feature_enabled($profile_owner,'multi_delete'))
|
if (! feature_enabled($profile_owner,'multi_delete'))
|
||||||
$page_dropping = false;
|
$page_dropping = false;
|
||||||
|
|
||||||
|
|
||||||
@ -637,7 +653,6 @@ function conversation(&$a, $items, $mode, $update, $page_mode = 'traditional', $
|
|||||||
else
|
else
|
||||||
$dropping = false;
|
$dropping = false;
|
||||||
|
|
||||||
|
|
||||||
$drop = array(
|
$drop = array(
|
||||||
'pagedropping' => $page_dropping,
|
'pagedropping' => $page_dropping,
|
||||||
'dropping' => $dropping,
|
'dropping' => $dropping,
|
||||||
@ -659,17 +674,14 @@ function conversation(&$a, $items, $mode, $update, $page_mode = 'traditional', $
|
|||||||
$verified = (($item['item_flags'] & ITEM_VERIFIED) ? t('Message signature validated') : '');
|
$verified = (($item['item_flags'] & ITEM_VERIFIED) ? t('Message signature validated') : '');
|
||||||
$forged = ((($item['sig']) && (! ($item['item_flags'] & ITEM_VERIFIED))) ? t('Message signature incorrect') : '');
|
$forged = ((($item['sig']) && (! ($item['item_flags'] & ITEM_VERIFIED))) ? t('Message signature incorrect') : '');
|
||||||
|
|
||||||
|
|
||||||
$unverified = '';
|
$unverified = '';
|
||||||
|
|
||||||
|
|
||||||
$tags=array();
|
$tags=array();
|
||||||
$terms = get_terms_oftype($item['term'],array(TERM_HASHTAG,TERM_MENTION,TERM_UNKNOWN));
|
$terms = get_terms_oftype($item['term'],array(TERM_HASHTAG,TERM_MENTION,TERM_UNKNOWN));
|
||||||
if(count($terms))
|
if(count($terms))
|
||||||
foreach($terms as $tag)
|
foreach($terms as $tag)
|
||||||
$tags[] = format_term_for_display($tag);
|
$tags[] = format_term_for_display($tag);
|
||||||
|
|
||||||
|
|
||||||
$body = prepare_body($item,true);
|
$body = prepare_body($item,true);
|
||||||
|
|
||||||
$tmp_item = array(
|
$tmp_item = array(
|
||||||
@ -731,12 +743,9 @@ function conversation(&$a, $items, $mode, $update, $page_mode = 'traditional', $
|
|||||||
|
|
||||||
// $threads[$threadsid]['id'] = $item['item_id'];
|
// $threads[$threadsid]['id'] = $item['item_id'];
|
||||||
$threads[] = $arr['output'];
|
$threads[] = $arr['output'];
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
|
|
||||||
// Normal View
|
// Normal View
|
||||||
// logger('conv: items: ' . print_r($items,true));
|
// logger('conv: items: ' . print_r($items,true));
|
||||||
@ -751,7 +760,6 @@ function conversation(&$a, $items, $mode, $update, $page_mode = 'traditional', $
|
|||||||
if($mode === 'display' && $items)
|
if($mode === 'display' && $items)
|
||||||
$conv->set_profile_owner($items[0]['uid']);
|
$conv->set_profile_owner($items[0]['uid']);
|
||||||
|
|
||||||
|
|
||||||
// get all the topmost parents
|
// get all the topmost parents
|
||||||
// this shouldn't be needed, as we should have only them in our array
|
// this shouldn't be needed, as we should have only them in our array
|
||||||
// But for now, this array respects the old style, just in case
|
// But for now, this array respects the old style, just in case
|
||||||
@ -831,20 +839,19 @@ function conversation(&$a, $items, $mode, $update, $page_mode = 'traditional', $
|
|||||||
// logger('nouveau: ' . print_r($threads,true));
|
// logger('nouveau: ' . print_r($threads,true));
|
||||||
|
|
||||||
|
|
||||||
$o .= replace_macros($page_template, array(
|
$o .= replace_macros($page_template, array(
|
||||||
'$baseurl' => $a->get_baseurl($ssl_state),
|
'$baseurl' => $a->get_baseurl($ssl_state),
|
||||||
'$photo_item' => $content_html,
|
'$photo_item' => $content_html,
|
||||||
'$live_update' => $live_update_div,
|
'$live_update' => $live_update_div,
|
||||||
'$remove' => t('remove'),
|
'$remove' => t('remove'),
|
||||||
'$mode' => $mode,
|
'$mode' => $mode,
|
||||||
'$user' => $a->user,
|
'$user' => $a->user,
|
||||||
'$threads' => $threads,
|
'$threads' => $threads,
|
||||||
'$wait' => t('Loading...'),
|
'$wait' => t('Loading...'),
|
||||||
'$dropping' => ($page_dropping?t('Delete Selected Items'):False),
|
'$dropping' => ($page_dropping?t('Delete Selected Items'):False),
|
||||||
));
|
));
|
||||||
|
|
||||||
return $o;
|
return $o;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -892,7 +899,6 @@ function item_photo_menu($item){
|
|||||||
$vsrc_link = "";
|
$vsrc_link = "";
|
||||||
$follow_url = "";
|
$follow_url = "";
|
||||||
|
|
||||||
|
|
||||||
$local_channel = local_channel();
|
$local_channel = local_channel();
|
||||||
|
|
||||||
if($local_channel) {
|
if($local_channel) {
|
||||||
@ -910,7 +916,7 @@ function item_photo_menu($item){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$profile_link = chanlink_hash($item['author_xchan']);
|
$profile_link = chanlink_hash($item['author_xchan']);
|
||||||
if($item['uid'] > 0)
|
if($item['uid'] > 0)
|
||||||
$pm_url = $a->get_baseurl($ssl_state) . '/mail/new/?f=&hash=' . $item['author_xchan'];
|
$pm_url = $a->get_baseurl($ssl_state) . '/mail/new/?f=&hash=' . $item['author_xchan'];
|
||||||
|
|
||||||
@ -927,7 +933,6 @@ function item_photo_menu($item){
|
|||||||
$posts_link = $a->get_baseurl($ssl_state) . '/network/?cid=' . $contact['abook_id'];
|
$posts_link = $a->get_baseurl($ssl_state) . '/network/?cid=' . $contact['abook_id'];
|
||||||
|
|
||||||
$clean_url = normalise_link($item['author-link']);
|
$clean_url = normalise_link($item['author-link']);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$menu = Array(
|
$menu = Array(
|
||||||
@ -943,7 +948,6 @@ function item_photo_menu($item){
|
|||||||
t("Poke") => $poke_link
|
t("Poke") => $poke_link
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
$args = array('item' => $item, 'menu' => $menu);
|
$args = array('item' => $item, 'menu' => $menu);
|
||||||
|
|
||||||
call_hooks('item_photo_menu', $args);
|
call_hooks('item_photo_menu', $args);
|
||||||
@ -958,17 +962,17 @@ function item_photo_menu($item){
|
|||||||
}
|
}
|
||||||
elseif ($v!="") $o .= "<li><a href=\"$v\">$k</a></li>\n";
|
elseif ($v!="") $o .= "<li><a href=\"$v\">$k</a></li>\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
return $o;
|
return $o;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Checks item to see if it is one of the builtin activities (like/dislike, event attendance, consensus items, etc.)
|
* @brief Checks item to see if it is one of the builtin activities (like/dislike, event attendance, consensus items, etc.)
|
||||||
|
*
|
||||||
* Increments the count of each matching activity and adds a link to the author as needed.
|
* Increments the count of each matching activity and adds a link to the author as needed.
|
||||||
*
|
*
|
||||||
* @param array $a (not used)
|
|
||||||
* @param array $item
|
* @param array $item
|
||||||
* @param array &$conv_responses (already created with builtin activity structure)
|
* @param array &$conv_responses (already created with builtin activity structure)
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
function builtin_activity_puller($item, &$conv_responses) {
|
function builtin_activity_puller($item, &$conv_responses) {
|
||||||
|
|
||||||
@ -1011,11 +1015,7 @@ function builtin_activity_puller($item, &$conv_responses) {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if((activity_match($item['verb'], $verb)) && ($item['id'] != $item['parent'])) {
|
if((activity_match($item['verb'], $verb)) && ($item['id'] != $item['parent'])) {
|
||||||
|
|
||||||
|
|
||||||
$name = (($item['author']['xchan_name']) ? $item['author']['xchan_name'] : t('Unknown'));
|
$name = (($item['author']['xchan_name']) ? $item['author']['xchan_name'] : t('Unknown'));
|
||||||
$url = (($item['author']['xchan_url'])
|
$url = (($item['author']['xchan_url'])
|
||||||
? '<a href="' . chanlink_url($item['author']['xchan_url']) . '">' . $name . '</a>'
|
? '<a href="' . chanlink_url($item['author']['xchan_url']) . '">' . $name . '</a>'
|
||||||
@ -1041,31 +1041,33 @@ function builtin_activity_puller($item, &$conv_responses) {
|
|||||||
$conv_responses[$mode][$item['thr_parent'] . '-l'][] = $url;
|
$conv_responses[$mode][$item['thr_parent'] . '-l'][] = $url;
|
||||||
|
|
||||||
// there can only be one activity verb per item so if we found anything, we can stop looking
|
// there can only be one activity verb per item so if we found anything, we can stop looking
|
||||||
$return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Format the like/dislike text for a profile item
|
|
||||||
// $cnt = number of people who like/dislike the item
|
|
||||||
// $arr = array of pre-linked names of likers/dislikers
|
|
||||||
// $type = one of 'like, 'dislike'
|
|
||||||
// $id = item id
|
|
||||||
// returns formatted text
|
|
||||||
|
|
||||||
|
/**
|
||||||
function format_like($cnt,$arr,$type,$id) {
|
* @brief Format the like/dislike text for a profile item.
|
||||||
|
*
|
||||||
|
* @param int $cnt number of people who like/dislike the item
|
||||||
|
* @param array $arr array of pre-linked names of likers/dislikers
|
||||||
|
* @param string $typ eone of 'like, 'dislike'
|
||||||
|
* @param int $id item id
|
||||||
|
* @return string formatted text
|
||||||
|
*/
|
||||||
|
function format_like($cnt, $arr, $type, $id) {
|
||||||
$o = '';
|
$o = '';
|
||||||
if($cnt == 1)
|
if ($cnt == 1) {
|
||||||
$o .= (($type === 'like') ? sprintf( t('%s likes this.'), $arr[0]) : sprintf( t('%s doesn\'t like this.'), $arr[0])) . EOL ;
|
$o .= (($type === 'like') ? sprintf( t('%s likes this.'), $arr[0]) : sprintf( t('%s doesn\'t like this.'), $arr[0])) . EOL ;
|
||||||
else {
|
} else {
|
||||||
$spanatts = 'class="fakelink" onclick="openClose(\'' . $type . 'list-' . $id . '\');"';
|
$spanatts = 'class="fakelink" onclick="openClose(\'' . $type . 'list-' . $id . '\');"';
|
||||||
$o .= (($type === 'like') ?
|
$o .= (($type === 'like') ?
|
||||||
sprintf( tt('<span %1$s>%2$d people</span> like this.','<span %1$s>%2$d people</span> like this.',$cnt), $spanatts, $cnt)
|
sprintf( tt('<span %1$s>%2$d people</span> like this.','<span %1$s>%2$d people</span> like this.',$cnt), $spanatts, $cnt)
|
||||||
:
|
:
|
||||||
sprintf( tt('<span %1$s>%2$d people</span> don\'t like this.','<span %1$s>%2$d people</span> don\'t like this.',$cnt), $spanatts, $cnt) );
|
sprintf( tt('<span %1$s>%2$d people</span> don\'t like this.','<span %1$s>%2$d people</span> don\'t like this.',$cnt), $spanatts, $cnt) );
|
||||||
$o .= EOL ;
|
$o .= EOL;
|
||||||
$total = count($arr);
|
$total = count($arr);
|
||||||
if($total >= MAX_LIKERS)
|
if($total >= MAX_LIKERS)
|
||||||
$arr = array_slice($arr, 0, MAX_LIKERS - 1);
|
$arr = array_slice($arr, 0, MAX_LIKERS - 1);
|
||||||
@ -1077,6 +1079,7 @@ function format_like($cnt,$arr,$type,$id) {
|
|||||||
$str = (($type === 'like') ? sprintf( t('%s like this.'), $str) : sprintf( t('%s don\'t like this.'), $str));
|
$str = (($type === 'like') ? sprintf( t('%s like this.'), $str) : sprintf( t('%s don\'t like this.'), $str));
|
||||||
$o .= "\t" . '<div id="' . $type . 'list-' . $id . '" style="display: none;" >' . $str . '</div>';
|
$o .= "\t" . '<div id="' . $type . 'list-' . $id . '" style="display: none;" >' . $str . '</div>';
|
||||||
}
|
}
|
||||||
|
|
||||||
return $o;
|
return $o;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1098,7 +1101,7 @@ function status_editor($a, $x, $popup = false) {
|
|||||||
if(array_key_exists('mimetype', $x) && $x['mimetype']) {
|
if(array_key_exists('mimetype', $x) && $x['mimetype']) {
|
||||||
if($x['mimetype'] != 'text/bbcode')
|
if($x['mimetype'] != 'text/bbcode')
|
||||||
$plaintext = true;
|
$plaintext = true;
|
||||||
if($x['mimetype'] === 'choose') {
|
if($x['mimetype'] === 'choose') {
|
||||||
$mimeselect = mimetype_select($x['profile_uid']);
|
$mimeselect = mimetype_select($x['profile_uid']);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -1376,7 +1379,6 @@ function render_location_default($item) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function prepare_page($item) {
|
function prepare_page($item) {
|
||||||
$a = get_app();
|
$a = get_app();
|
||||||
$naked = ((get_pconfig($item['uid'],'system','nakedpage')) ? 1 : 0);
|
$naked = ((get_pconfig($item['uid'],'system','nakedpage')) ? 1 : 0);
|
||||||
@ -1446,7 +1448,6 @@ function network_tabs() {
|
|||||||
$public_active = 'active';
|
$public_active = 'active';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (($new_active == '')
|
if (($new_active == '')
|
||||||
&& ($starred_active == '')
|
&& ($starred_active == '')
|
||||||
&& ($conv_active == '')
|
&& ($conv_active == '')
|
||||||
@ -1538,13 +1539,18 @@ function network_tabs() {
|
|||||||
return replace_macros($tpl, array('$tabs' => $arr['tabs']));
|
return replace_macros($tpl, array('$tabs' => $arr['tabs']));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief
|
||||||
function profile_tabs($a, $is_owner=False, $nickname=Null){
|
*
|
||||||
|
* @param App $a
|
||||||
|
* @param boolean $is_owner default false
|
||||||
|
* @param string $nickname default null
|
||||||
|
* @return void|string
|
||||||
|
*/
|
||||||
|
function profile_tabs($a, $is_owner = false, $nickname = null){
|
||||||
|
|
||||||
// Don't provide any profile tabs if we're running as the sys channel
|
// Don't provide any profile tabs if we're running as the sys channel
|
||||||
|
if ($a->is_sys)
|
||||||
if($a->is_sys)
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
$channel = $a->get_channel();
|
$channel = $a->get_channel();
|
||||||
@ -1554,10 +1560,10 @@ function profile_tabs($a, $is_owner=False, $nickname=Null){
|
|||||||
|
|
||||||
$uid = (($a->profile['profile_uid']) ? $a->profile['profile_uid'] : local_channel());
|
$uid = (($a->profile['profile_uid']) ? $a->profile['profile_uid'] : local_channel());
|
||||||
|
|
||||||
if (get_pconfig($uid,'system','noprofiletabs'))
|
if (get_pconfig($uid, 'system', 'noprofiletabs'))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if(x($_GET,'tab'))
|
if (x($_GET, 'tab'))
|
||||||
$tab = notags(trim($_GET['tab']));
|
$tab = notags(trim($_GET['tab']));
|
||||||
|
|
||||||
$url = $a->get_baseurl() . '/channel/' . $nickname;
|
$url = $a->get_baseurl() . '/channel/' . $nickname;
|
||||||
@ -1575,42 +1581,42 @@ function profile_tabs($a, $is_owner=False, $nickname=Null){
|
|||||||
|
|
||||||
$p = get_all_perms($uid,get_observer_hash());
|
$p = get_all_perms($uid,get_observer_hash());
|
||||||
|
|
||||||
if($p['view_profile']) {
|
if ($p['view_profile']) {
|
||||||
$tabs[] = array(
|
$tabs[] = array(
|
||||||
'label' => t('About'),
|
'label' => t('About'),
|
||||||
'url' => $pr,
|
'url' => $pr,
|
||||||
'sel' => ((argv(0) == 'profile') ? 'active' : ''),
|
'sel' => ((argv(0) == 'profile') ? 'active' : ''),
|
||||||
'title' => t('Profile Details'),
|
'title' => t('Profile Details'),
|
||||||
'id' => 'profile-tab',
|
'id' => 'profile-tab',
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
if($p['view_photos']) {
|
if ($p['view_photos']) {
|
||||||
$tabs[] = array(
|
$tabs[] = array(
|
||||||
'label' => t('Photos'),
|
'label' => t('Photos'),
|
||||||
'url' => $a->get_baseurl() . '/photos/' . $nickname,
|
'url' => $a->get_baseurl() . '/photos/' . $nickname,
|
||||||
'sel' => ((argv(0) == 'photos') ? 'active' : ''),
|
'sel' => ((argv(0) == 'photos') ? 'active' : ''),
|
||||||
'title' => t('Photo Albums'),
|
'title' => t('Photo Albums'),
|
||||||
'id' => 'photo-tab',
|
'id' => 'photo-tab',
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
if($p['view_storage']) {
|
if ($p['view_storage']) {
|
||||||
$tabs[] = array(
|
$tabs[] = array(
|
||||||
'label' => t('Files'),
|
'label' => t('Files'),
|
||||||
'url' => $a->get_baseurl() . '/cloud/' . $nickname . ((get_observer_hash()) ? '' : '?f=&davguest=1'),
|
'url' => $a->get_baseurl() . '/cloud/' . $nickname . ((get_observer_hash()) ? '' : '?f=&davguest=1'),
|
||||||
'sel' => ((argv(0) == 'cloud' || argv(0) == 'sharedwithme') ? 'active' : ''),
|
'sel' => ((argv(0) == 'cloud' || argv(0) == 'sharedwithme') ? 'active' : ''),
|
||||||
'title' => t('Files and Storage'),
|
'title' => t('Files and Storage'),
|
||||||
'id' => 'files-tab',
|
'id' => 'files-tab',
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if($p['chat']) {
|
if ($p['chat']) {
|
||||||
require_once('include/chat.php');
|
require_once('include/chat.php');
|
||||||
$has_chats = chatroom_list_count($uid);
|
$has_chats = chatroom_list_count($uid);
|
||||||
if ($has_chats) {
|
if ($has_chats) {
|
||||||
$tabs[] = array(
|
$tabs[] = array(
|
||||||
'label' => t('Chatrooms'),
|
'label' => t('Chatrooms'),
|
||||||
'url' => $a->get_baseurl() . '/chat/' . $nickname,
|
'url' => $a->get_baseurl() . '/chat/' . $nickname,
|
||||||
'sel' => ((argv(0) == 'chat') ? 'active' : '' ),
|
'sel' => ((argv(0) == 'chat') ? 'active' : '' ),
|
||||||
'title' => t('Chatrooms'),
|
'title' => t('Chatrooms'),
|
||||||
'id' => 'chat-tab',
|
'id' => 'chat-tab',
|
||||||
);
|
);
|
||||||
@ -1619,30 +1625,29 @@ function profile_tabs($a, $is_owner=False, $nickname=Null){
|
|||||||
|
|
||||||
require_once('include/menu.php');
|
require_once('include/menu.php');
|
||||||
$has_bookmarks = menu_list_count(local_channel(),'',MENU_BOOKMARK) + menu_list_count(local_channel(),'',MENU_SYSTEM|MENU_BOOKMARK);
|
$has_bookmarks = menu_list_count(local_channel(),'',MENU_BOOKMARK) + menu_list_count(local_channel(),'',MENU_SYSTEM|MENU_BOOKMARK);
|
||||||
if($is_owner && $has_bookmarks) {
|
if ($is_owner && $has_bookmarks) {
|
||||||
$tabs[] = array(
|
$tabs[] = array(
|
||||||
'label' => t('Bookmarks'),
|
'label' => t('Bookmarks'),
|
||||||
'url' => $a->get_baseurl() . '/bookmarks',
|
'url' => $a->get_baseurl() . '/bookmarks',
|
||||||
'sel' => ((argv(0) == 'bookmarks') ? 'active' : ''),
|
'sel' => ((argv(0) == 'bookmarks') ? 'active' : ''),
|
||||||
'title' => t('Saved Bookmarks'),
|
'title' => t('Saved Bookmarks'),
|
||||||
'id' => 'bookmarks-tab',
|
'id' => 'bookmarks-tab',
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($is_owner && feature_enabled($uid,'webpages')) {
|
||||||
if($is_owner && feature_enabled($uid,'webpages')) {
|
|
||||||
$tabs[] = array(
|
$tabs[] = array(
|
||||||
'label' => t('Webpages'),
|
'label' => t('Webpages'),
|
||||||
'url' => $a->get_baseurl() . '/webpages/' . $nickname,
|
'url' => $a->get_baseurl() . '/webpages/' . $nickname,
|
||||||
'sel' => ((argv(0) == 'webpages') ? 'active' : ''),
|
'sel' => ((argv(0) == 'webpages') ? 'active' : ''),
|
||||||
'title' => t('Manage Webpages'),
|
'title' => t('Manage Webpages'),
|
||||||
'id' => 'webpages-tab',
|
'id' => 'webpages-tab',
|
||||||
);
|
);
|
||||||
}
|
} else {
|
||||||
else {
|
/**
|
||||||
// FIXME
|
* @FIXME we probably need a listing of events that were created by
|
||||||
// we probably need a listing of events that were created by
|
* this channel and are visible to the observer
|
||||||
// this channel and are visible to the observer
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
$arr = array('is_owner' => $is_owner, 'nickname' => $nickname, 'tab' => (($tab) ? $tab : false), 'tabs' => $tabs);
|
$arr = array('is_owner' => $is_owner, 'nickname' => $nickname, 'tab' => (($tab) ? $tab : false), 'tabs' => $tabs);
|
||||||
@ -1665,8 +1670,7 @@ function get_responses($conv_responses,$response_verbs,$ob,$item) {
|
|||||||
$ret[$v]['list_part'] = array_slice($ret[$v]['list'], 0, MAX_LIKERS);
|
$ret[$v]['list_part'] = array_slice($ret[$v]['list'], 0, MAX_LIKERS);
|
||||||
array_push($ret[$v]['list_part'], '<a href="#" data-toggle="modal" data-target="#' . $v . 'Modal-'
|
array_push($ret[$v]['list_part'], '<a href="#" data-toggle="modal" data-target="#' . $v . 'Modal-'
|
||||||
. (($ob) ? $ob->get_id() : $item['id']) . '"><b>' . t('View all') . '</b></a>');
|
. (($ob) ? $ob->get_id() : $item['id']) . '"><b>' . t('View all') . '</b></a>');
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
$ret[$v]['list_part'] = '';
|
$ret[$v]['list_part'] = '';
|
||||||
}
|
}
|
||||||
$ret[$v]['button'] = get_response_button_text($v,$ret[$v]['count']);
|
$ret[$v]['button'] = get_response_button_text($v,$ret[$v]['count']);
|
||||||
@ -1674,9 +1678,9 @@ function get_responses($conv_responses,$response_verbs,$ob,$item) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$count = 0;
|
$count = 0;
|
||||||
foreach($ret as $key) {
|
foreach ($ret as $key) {
|
||||||
if ($key['count'] == true)
|
if ($key['count'] == true)
|
||||||
$count++;
|
$count++;
|
||||||
}
|
}
|
||||||
|
|
||||||
$ret['count'] = $count;
|
$ret['count'] = $count;
|
||||||
|
Reference in New Issue
Block a user