Fix formatting and PHP notices in include/conversation
- Remove unused $nickname variable - Remove unused $comment variable - Use defaults() in get_responses() to check for array key existence
This commit is contained in:
parent
66dbef93e3
commit
3069f3b59d
1 changed files with 76 additions and 85 deletions
|
@ -545,8 +545,10 @@ function conversation(App $a, $items, $mode, $update, $preview = false) {
|
||||||
$profile_owner = $a->profile['profile_uid'];
|
$profile_owner = $a->profile['profile_uid'];
|
||||||
|
|
||||||
if (!$update) {
|
if (!$update) {
|
||||||
$tab = notags(trim($_GET['tab']));
|
$tab = 'posts';
|
||||||
$tab = ( $tab ? $tab : 'posts' );
|
if (x($_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,
|
||||||
|
@ -647,20 +649,10 @@ function conversation(App $a, $items, $mode, $update, $preview = false) {
|
||||||
|
|
||||||
$threadsid++;
|
$threadsid++;
|
||||||
|
|
||||||
$comment = '';
|
|
||||||
$owner_url = '';
|
$owner_url = '';
|
||||||
$owner_name = '';
|
$owner_name = '';
|
||||||
$sparkle = '';
|
$sparkle = '';
|
||||||
|
|
||||||
if ($mode === 'search' || $mode === 'community') {
|
|
||||||
if (((activity_match($item['verb'], ACTIVITY_LIKE)) || (activity_match($item['verb'], ACTIVITY_DISLIKE)))
|
|
||||||
&& ($item['id'] != $item['parent']))
|
|
||||||
continue;
|
|
||||||
$nickname = $item['nickname'];
|
|
||||||
} else {
|
|
||||||
$nickname = $a->user['nickname'];
|
|
||||||
}
|
|
||||||
|
|
||||||
// prevent private email from leaking.
|
// prevent private email from leaking.
|
||||||
if ($item['network'] === NETWORK_MAIL && local_user() != $item['uid']) {
|
if ($item['network'] === NETWORK_MAIL && local_user() != $item['uid']) {
|
||||||
continue;
|
continue;
|
||||||
|
@ -813,7 +805,6 @@ function conversation(App $a, $items, $mode, $update, $preview = false) {
|
||||||
'like' => '',
|
'like' => '',
|
||||||
'dislike' => '',
|
'dislike' => '',
|
||||||
'comment' => '',
|
'comment' => '',
|
||||||
//'conv' => (($preview) ? '' : array('href'=> 'display/' . $nickname . '/' . $item['id'], 'title'=> t('View in context'))),
|
|
||||||
'conv' => (($preview) ? '' : array('href'=> 'display/'.$item['guid'], 'title'=> t('View in context'))),
|
'conv' => (($preview) ? '' : array('href'=> 'display/'.$item['guid'], 'title'=> t('View in context'))),
|
||||||
'previewing' => $previewing,
|
'previewing' => $previewing,
|
||||||
'wait' => t('Please wait'),
|
'wait' => t('Please wait'),
|
||||||
|
@ -1197,39 +1188,40 @@ function format_like($cnt, array $arr, $type, $id) {
|
||||||
return $o;
|
return $o;
|
||||||
}
|
}
|
||||||
|
|
||||||
function status_editor(App $a, $x, $notes_cid = 0, $popup = false) {
|
function status_editor(App $a, $x, $notes_cid = 0, $popup = false)
|
||||||
|
{
|
||||||
$o = '';
|
$o = '';
|
||||||
|
|
||||||
$geotag = (x($x, 'allow_location') ? replace_macros(get_markup_template('jot_geotag.tpl'), array()) : '');
|
$geotag = x($x, 'allow_location') ? replace_macros(get_markup_template('jot_geotag.tpl'), array()) : '';
|
||||||
|
|
||||||
$tpl = get_markup_template('jot-header.tpl');
|
$tpl = get_markup_template('jot-header.tpl');
|
||||||
$a->page['htmlhead'] .= replace_macros($tpl, array(
|
$a->page['htmlhead'] .= replace_macros($tpl, array(
|
||||||
'$newpost' => 'true',
|
'$newpost' => 'true',
|
||||||
'$baseurl' => System::baseUrl(true),
|
'$baseurl' => System::baseUrl(true),
|
||||||
'$geotag' => $geotag,
|
'$geotag' => $geotag,
|
||||||
'$nickname' => $x['nickname'],
|
'$nickname' => $x['nickname'],
|
||||||
'$ispublic' => t('Visible to <strong>everybody</strong>'),
|
'$ispublic' => t('Visible to <strong>everybody</strong>'),
|
||||||
'$linkurl' => t('Please enter a link URL:'),
|
'$linkurl' => t('Please enter a link URL:'),
|
||||||
'$vidurl' => t("Please enter a video link/URL:"),
|
'$vidurl' => t("Please enter a video link/URL:"),
|
||||||
'$audurl' => t("Please enter an audio link/URL:"),
|
'$audurl' => t("Please enter an audio link/URL:"),
|
||||||
'$term' => t('Tag term:'),
|
'$term' => t('Tag term:'),
|
||||||
'$fileas' => t('Save to Folder:'),
|
'$fileas' => t('Save to Folder:'),
|
||||||
'$whereareu' => t('Where are you right now?'),
|
'$whereareu' => t('Where are you right now?'),
|
||||||
'$delitems' => t('Delete item(s)?')
|
'$delitems' => t('Delete item(s)?')
|
||||||
));
|
));
|
||||||
|
|
||||||
$tpl = get_markup_template('jot-end.tpl');
|
$tpl = get_markup_template('jot-end.tpl');
|
||||||
$a->page['end'] .= replace_macros($tpl, array(
|
$a->page['end'] .= replace_macros($tpl, array(
|
||||||
'$newpost' => 'true',
|
'$newpost' => 'true',
|
||||||
'$baseurl' => System::baseUrl(true),
|
'$baseurl' => System::baseUrl(true),
|
||||||
'$geotag' => $geotag,
|
'$geotag' => $geotag,
|
||||||
'$nickname' => $x['nickname'],
|
'$nickname' => $x['nickname'],
|
||||||
'$ispublic' => t('Visible to <strong>everybody</strong>'),
|
'$ispublic' => t('Visible to <strong>everybody</strong>'),
|
||||||
'$linkurl' => t('Please enter a link URL:'),
|
'$linkurl' => t('Please enter a link URL:'),
|
||||||
'$vidurl' => t("Please enter a video link/URL:"),
|
'$vidurl' => t("Please enter a video link/URL:"),
|
||||||
'$audurl' => t("Please enter an audio link/URL:"),
|
'$audurl' => t("Please enter an audio link/URL:"),
|
||||||
'$term' => t('Tag term:'),
|
'$term' => t('Tag term:'),
|
||||||
'$fileas' => t('Save to Folder:'),
|
'$fileas' => t('Save to Folder:'),
|
||||||
'$whereareu' => t('Where are you right now?')
|
'$whereareu' => t('Where are you right now?')
|
||||||
));
|
));
|
||||||
|
|
||||||
|
@ -1262,57 +1254,56 @@ function status_editor(App $a, $x, $notes_cid = 0, $popup = false) {
|
||||||
$tpl = get_markup_template("jot.tpl");
|
$tpl = get_markup_template("jot.tpl");
|
||||||
|
|
||||||
$o .= replace_macros($tpl,array(
|
$o .= replace_macros($tpl,array(
|
||||||
'$return_path' => $query_str,
|
'$return_path' => $query_str,
|
||||||
'$action' => 'item',
|
'$action' => 'item',
|
||||||
'$share' => (x($x,'button') ? $x['button'] : t('Share')),
|
'$share' => defaults($x, 'button', t('Share')),
|
||||||
'$upload' => t('Upload photo'),
|
'$upload' => t('Upload photo'),
|
||||||
'$shortupload' => t('upload photo'),
|
'$shortupload' => t('upload photo'),
|
||||||
'$attach' => t('Attach file'),
|
'$attach' => t('Attach file'),
|
||||||
'$shortattach' => t('attach file'),
|
'$shortattach' => t('attach file'),
|
||||||
'$weblink' => t('Insert web link'),
|
'$weblink' => t('Insert web link'),
|
||||||
'$shortweblink' => t('web link'),
|
'$shortweblink' => t('web link'),
|
||||||
'$video' => t('Insert video link'),
|
'$video' => t('Insert video link'),
|
||||||
'$shortvideo' => t('video link'),
|
'$shortvideo' => t('video link'),
|
||||||
'$audio' => t('Insert audio link'),
|
'$audio' => t('Insert audio link'),
|
||||||
'$shortaudio' => t('audio link'),
|
'$shortaudio' => t('audio link'),
|
||||||
'$setloc' => t('Set your location'),
|
'$setloc' => t('Set your location'),
|
||||||
'$shortsetloc' => t('set location'),
|
'$shortsetloc' => t('set location'),
|
||||||
'$noloc' => t('Clear browser location'),
|
'$noloc' => t('Clear browser location'),
|
||||||
'$shortnoloc' => t('clear location'),
|
'$shortnoloc' => t('clear location'),
|
||||||
'$title' => $x['title'],
|
'$title' => defaults($x, 'title', ''),
|
||||||
'$placeholdertitle' => t('Set title'),
|
'$placeholdertitle' => t('Set title'),
|
||||||
'$category' => $x['category'],
|
'$category' => defaults($x, 'category', ''),
|
||||||
'$placeholdercategory' => (Feature::isEnabled(local_user(), 'categories') ? t('Categories (comma-separated list)') : ''),
|
'$placeholdercategory' => Feature::isEnabled(local_user(), 'categories') ? t('Categories (comma-separated list)') : '',
|
||||||
'$wait' => t('Please wait'),
|
'$wait' => t('Please wait'),
|
||||||
'$permset' => t('Permission settings'),
|
'$permset' => t('Permission settings'),
|
||||||
'$shortpermset' => t('permissions'),
|
'$shortpermset' => t('permissions'),
|
||||||
'$ptyp' => (($notes_cid) ? 'note' : 'wall'),
|
'$ptyp' => $notes_cid ? 'note' : 'wall',
|
||||||
'$content' => $x['content'],
|
'$content' => defaults($x, 'content', ''),
|
||||||
'$post_id' => $x['post_id'],
|
'$post_id' => defaults($x, 'post_id', ''),
|
||||||
'$baseurl' => System::baseUrl(true),
|
'$baseurl' => System::baseUrl(true),
|
||||||
'$defloc' => $x['default_location'],
|
'$defloc' => $x['default_location'],
|
||||||
'$visitor' => $x['visitor'],
|
'$visitor' => $x['visitor'],
|
||||||
'$pvisit' => (($notes_cid) ? 'none' : $x['visitor']),
|
'$pvisit' => $notes_cid ? 'none' : $x['visitor'],
|
||||||
'$public' => t('Public post'),
|
'$public' => t('Public post'),
|
||||||
'$jotnets' => $jotnets,
|
'$lockstate' => $x['lockstate'],
|
||||||
'$lockstate' => $x['lockstate'],
|
'$bang' => $x['bang'],
|
||||||
'$bang' => $x['bang'],
|
'$profile_uid' => $x['profile_uid'],
|
||||||
'$profile_uid' => $x['profile_uid'],
|
'$preview' => Feature::isEnabled($x['profile_uid'], 'preview') ? t('Preview') : '',
|
||||||
'$preview' => ((Feature::isEnabled($x['profile_uid'],'preview')) ? t('Preview') : ''),
|
'$jotplugins' => $jotplugins,
|
||||||
'$jotplugins' => $jotplugins,
|
'$notes_cid' => $notes_cid,
|
||||||
'$notes_cid' => $notes_cid,
|
'$sourceapp' => t($a->sourcename),
|
||||||
'$sourceapp' => t($a->sourcename),
|
'$cancel' => t('Cancel'),
|
||||||
'$cancel' => t('Cancel'),
|
'$rand_num' => random_digits(12),
|
||||||
'$rand_num' => random_digits(12),
|
|
||||||
|
|
||||||
// ACL permissions box
|
// ACL permissions box
|
||||||
'$acl' => $x['acl'],
|
'$acl' => $x['acl'],
|
||||||
'$acl_data' => $x['acl_data'],
|
'$acl_data' => $x['acl_data'],
|
||||||
'$group_perms' => t('Post to Groups'),
|
'$group_perms' => t('Post to Groups'),
|
||||||
'$contact_perms' => t('Post to Contacts'),
|
'$contact_perms' => t('Post to Contacts'),
|
||||||
'$private' => t('Private post'),
|
'$private' => t('Private post'),
|
||||||
'$is_private' => $private_post,
|
'$is_private' => $private_post,
|
||||||
'$public_link' => $public_post_link,
|
'$public_link' => $public_post_link,
|
||||||
|
|
||||||
//jot nav tab (used in some themes)
|
//jot nav tab (used in some themes)
|
||||||
'$message' => t('Message'),
|
'$message' => t('Message'),
|
||||||
|
@ -1321,7 +1312,7 @@ function status_editor(App $a, $x, $notes_cid = 0, $popup = false) {
|
||||||
|
|
||||||
|
|
||||||
if ($popup == true) {
|
if ($popup == true) {
|
||||||
$o = '<div id="jot-popup" style="display: none;">'.$o.'</div>';
|
$o = '<div id="jot-popup" style="display: none;">' . $o . '</div>';
|
||||||
}
|
}
|
||||||
|
|
||||||
return $o;
|
return $o;
|
||||||
|
@ -1577,9 +1568,9 @@ function get_responses($conv_responses, $response_verbs, $ob, $item) {
|
||||||
$ret = array();
|
$ret = array();
|
||||||
foreach ($response_verbs as $v) {
|
foreach ($response_verbs as $v) {
|
||||||
$ret[$v] = array();
|
$ret[$v] = array();
|
||||||
$ret[$v]['count'] = ((x($conv_responses[$v], $item['uri'])) ? $conv_responses[$v][$item['uri']] : '');
|
$ret[$v]['count'] = defaults($conv_responses[$v], $item['uri'], '');
|
||||||
$ret[$v]['list'] = ((x($conv_responses[$v], $item['uri'])) ? $conv_responses[$v][$item['uri'] . '-l'] : '');
|
$ret[$v]['list'] = defaults($conv_responses[$v], $item['uri'] . '-l', '');
|
||||||
$ret[$v]['self'] = ((x($conv_responses[$v], $item['uri'])) ? $conv_responses[$v][$item['uri'] . '-self'] : '0');
|
$ret[$v]['self'] = defaults($conv_responses[$v], $item['uri'] . '-self', '0');
|
||||||
if (count($ret[$v]['list']) > MAX_LIKERS) {
|
if (count($ret[$v]['list']) > MAX_LIKERS) {
|
||||||
$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-'
|
||||||
|
|
Loading…
Reference in a new issue