<?php
+use Friendica\App;
+
require_once "include/bbcode.php";
require_once "include/acl_selectors.php";
-
/*
* Note: the code in 'item_extract_images' and 'item_redir_and_replace_images'
* is identical to the code in mod/message.php for 'item_extract_images' and
if ($total > 0) {
foreach ($item['children'] as $child) {
- if (! visible_activity($child))
+ if (! visible_activity($child)) {
$total --;
+ }
$total += count_descendants($child);
}
}
* 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_ATTEND, ACTIVITY_ATTENDNO, ACTIVITY_ATTENDMAYBE);
foreach ($hidden_activities as $act) {
- if (activity_match($item['verb'],$act)) {
+ if (activity_match($item['verb'], $act)) {
return false;
}
}
* @brief SQL query for items
*/
function item_query() {
- return "SELECT ".item_fieldlists()." FROM `item` ".
- item_joins()." WHERE ".item_condition();
+ return "SELECT " . item_fieldlists() . " FROM `item` " .
+ item_joins() . " WHERE " . item_condition();
}
/**
$arr_blocked = null;
if (local_user()) {
- $str_blocked = get_pconfig(local_user(),'system','blocked');
+ $str_blocked = get_pconfig(local_user(), 'system', 'blocked');
if ($str_blocked) {
- $arr_blocked = explode(',',$str_blocked);
+ $arr_blocked = explode(',', $str_blocked);
for ($x = 0; $x < count($arr_blocked); $x ++) {
$arr_blocked[$x] = trim($arr_blocked[$x]);
}
if ($arr_blocked) {
$blocked = false;
foreach ($arr_blocked as $b) {
- if ($b && link_compare($item['author-link'],$b)) {
+ if ($b && link_compare($item['author-link'], $b)) {
$blocked = true;
break;
}
$profile_link = zrl($profile_link);
}
- if (!x($item, 'author-thumb') OR ($item['author-thumb'] == "")) {
+ if (!x($item, 'author-thumb') || ($item['author-thumb'] == "")) {
$author_contact = get_contact_details_by_url($item['author-link'], $profile_owner);
if ($author_contact["thumb"]) {
$item['author-thumb'] = $author_contact["thumb"];
}
}
- if (!isset($item['owner-thumb']) OR ($item['owner-thumb'] == "")) {
+ if (!isset($item['owner-thumb']) || ($item['owner-thumb'] == "")) {
$owner_contact = get_contact_details_by_url($item['owner-link'], $profile_owner);
if ($owner_contact["thumb"]) {
$item['owner-thumb'] = $owner_contact["thumb"];
if ($arr_blocked) {
$blocked = false;
foreach ($arr_blocked as $b) {
- if ($b && link_compare($item['author-link'],$b)) {
+ if ($b && link_compare($item['author-link'], $b)) {
$blocked = true;
break;
}
'$mode' => $mode,
'$user' => $a->user,
'$threads' => $threads,
- '$dropping' => ($page_dropping && feature_enabled(local_user(),'multi_delete') ? t('Delete Selected Items') : False),
+ '$dropping' => ($page_dropping && feature_enabled(local_user(), 'multi_delete') ? t('Delete Selected Items') : False),
));
return $o;
$menu[t("Poke")] = $poke_link;
}
- if ((($cid == 0) OR ($rel == CONTACT_IS_FOLLOWER)) AND
+ if ((($cid == 0) || ($rel == CONTACT_IS_FOLLOWER)) &&
in_array($item['network'], array(NETWORK_DFRN, NETWORK_OSTATUS, NETWORK_DIASPORA))) {
$menu[t('Connect/Follow')] = 'follow?url=' . urlencode($item['author-link']);
}
if ((activity_match($item['verb'], $verb)) && ($item['id'] != $item['parent'])) {
$url = $item['author-link'];
- if ((local_user()) && (local_user() == $item['uid']) && ($item['network'] === NETWORK_DFRN) && (! $item['self']) && (link_compare($item['author-link'],$item['url']))) {
+ if ((local_user()) && (local_user() == $item['uid']) && ($item['network'] === NETWORK_DFRN) && (! $item['self']) && (link_compare($item['author-link'], $item['url']))) {
$url = 'redir/' . $item['contact-id'];
$sparkle = ' class="sparkle" ';
} else {
if ($cnt > 1) {
$total = count($arr);
- if ($total >= MAX_LIKERS)
+ if ($total >= MAX_LIKERS) {
$arr = array_slice($arr, 0, MAX_LIKERS - 1);
+ }
if ($total < MAX_LIKERS) {
$last = t('and') . ' ' . $arr[count($arr)-1];
$arr2 = array_slice($arr, 0, -1);
return $o;
}}
-function status_editor($a,$x, $notes_cid = 0, $popup = false) {
+function status_editor(App $a, $x, $notes_cid = 0, $popup = false) {
$o = '';
$geotag = (x($x, 'allow_location') ? replace_macros(get_markup_template('jot_geotag.tpl'), array()) : '');
// Private/public post links for the non-JS ACL form
$private_post = 1;
- if ($_REQUEST['public']) {
+ if (x($_REQUEST, 'public')) {
$private_post = 0;
}
'$title' => $x['title'],
'$placeholdertitle' => t('Set title'),
'$category' => $x['category'],
- '$placeholdercategory' => (feature_enabled(local_user(),'categories') ? t('Categories (comma-separated list)') : ''),
+ '$placeholdercategory' => (feature_enabled(local_user(), 'categories') ? t('Categories (comma-separated list)') : ''),
'$wait' => t('Please wait'),
'$permset' => t('Permission settings'),
'$shortpermset' => t('permissions'),
}
}
- if (stristr($order,'created')) {
- usort($parents,'sort_thr_created');
- } elseif (stristr($order,'commented')) {
- usort($parents,'sort_thr_commented');
+ if (stristr($order, 'created')) {
+ usort($parents, 'sort_thr_created');
+ } elseif (stristr($order, 'commented')) {
+ usort($parents, 'sort_thr_commented');
}
if (count($parents)) {
- foreach ($parents as $i=>$_x) {
+ foreach ($parents as $i => $_x) {
$parents[$i]['children'] = get_item_children($arr, $_x);
}
}
function get_response_button_text($v, $count) {
switch ($v) {
case 'like':
- return tt('Like','Likes', $count,'noun');
+ return tt('Like', 'Likes', $count, 'noun');
break;
case 'dislike':
- return tt('Dislike','Dislikes', $count,'noun');
+ return tt('Dislike', 'Dislikes', $count, 'noun');
break;
case 'attendyes':
- return tt('Attending','Attending', $count,'noun');
+ return tt('Attending', 'Attending', $count, 'noun');
break;
case 'attendno':
- return tt('Not Attending','Not Attending', $count,'noun');
+ return tt('Not Attending', 'Not Attending', $count, 'noun');
break;
case 'attendmaybe':
- return tt('Undecided','Undecided', $count,'noun');
+ return tt('Undecided', 'Undecided', $count, 'noun');
break;
}
}