X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=mod%2Fcontent.php;h=a8c3130333aa6770d7e63f42227702e65c0f50d6;hb=0dc1c932f8e403fc64c390b5887598758719fd3f;hp=332a35f006c472fd5ab4b26f40ce8cad2354e725;hpb=fb676335dbfb90d282622a68cb9a7113be19bc31;p=friendica.git diff --git a/mod/content.php b/mod/content.php index 332a35f006..a8c3130333 100644 --- a/mod/content.php +++ b/mod/content.php @@ -15,15 +15,16 @@ // fast - e.g. one or two milliseconds to fetch parent items for the current content, // and 10-20 milliseconds to fetch all the child items. +use Friendica\App; -function content_content(&$a, $update = 0) { +function content_content(App $a, $update = 0) { require_once('include/conversation.php'); // Currently security is based on the logged in user - if(! local_user()) { + if (! local_user()) { return; } @@ -61,7 +62,7 @@ function content_content(&$a, $update = 0) { $o = ''; - + $contact_id = $a->cid; @@ -100,7 +101,7 @@ function content_content(&$a, $update = 0) { $def_acl = array('allow_cid' => $str); } - + $sql_options = (($star) ? " and starred = 1 " : ''); $sql_options .= (($bmark) ? " and bookmark = 1 " : ''); @@ -137,7 +138,7 @@ function content_content(&$a, $update = 0) { } elseif($cid) { - $r = q("SELECT `id`,`name`,`network`,`writable`,`nurl` FROM `contact` WHERE `id` = %d + $r = q("SELECT `id`,`name`,`network`,`writable`,`nurl` FROM `contact` WHERE `id` = %d AND `blocked` = 0 AND `pending` = 0 LIMIT 1", intval($cid) ); @@ -307,7 +308,7 @@ function content_content(&$a, $update = 0) { -function render_content(&$a, $items, $mode, $update, $preview = false) { +function render_content(App $a, $items, $mode, $update, $preview = false) { require_once('include/bbcode.php'); require_once('mod/proxy.php'); @@ -382,7 +383,7 @@ function render_content(&$a, $items, $mode, $update, $preview = false) { if($mode === 'network-new' || $mode === 'search' || $mode === 'community') { - // "New Item View" on network page or search page results + // "New Item View" on network page or search page results // - just loop through the items and format them minimally for display //$tpl = get_markup_template('search_item.tpl'); @@ -402,7 +403,7 @@ function render_content(&$a, $items, $mode, $update, $preview = false) { || (activity_match($item['verb'],ACTIVITY_DISLIKE)) || activity_match($item['verb'],ACTIVITY_ATTEND) || activity_match($item['verb'],ACTIVITY_ATTENDNO) - || activity_match($item['verb'],ACTIVITY_ATTENDMAYBE)) + || activity_match($item['verb'],ACTIVITY_ATTENDMAYBE)) && ($item['id'] != $item['parent'])) continue; $nickname = $item['nickname']; @@ -450,7 +451,7 @@ function render_content(&$a, $items, $mode, $update, $preview = false) { $drop = array( 'dropping' => $dropping, - 'select' => t('Select'), + 'select' => t('Select'), 'delete' => t('Delete'), ); @@ -540,11 +541,11 @@ function render_content(&$a, $items, $mode, $update, $preview = false) { $comments[$item['parent']] = 1; else $comments[$item['parent']] += 1; - } elseif(! x($comments,$item['parent'])) + } elseif(! x($comments,$item['parent'])) $comments[$item['parent']] = 0; // avoid notices later on } - // map all the like/dislike/attendance activities for each parent item + // map all the like/dislike/attendance activities for each parent item // Store these in the $alike and $dlike arrays foreach($items as $item) { @@ -633,14 +634,14 @@ function render_content(&$a, $items, $mode, $update, $preview = false) { $redirect_url = 'redir/' . $item['cid'] ; - $lock = ((($item['private'] == 1) || (($item['uid'] == local_user()) && (strlen($item['allow_cid']) || strlen($item['allow_gid']) + $lock = ((($item['private'] == 1) || (($item['uid'] == local_user()) && (strlen($item['allow_cid']) || strlen($item['allow_gid']) || strlen($item['deny_cid']) || strlen($item['deny_gid'])))) ? t('Private Message') : false); // Top-level wall post not written by the wall owner (wall-to-wall) - // First figure out who owns it. + // First figure out who owns it. $osparkle = ''; @@ -667,13 +668,13 @@ function render_content(&$a, $items, $mode, $update, $preview = false) { if((! $owner_linkmatch) && (! $alias_linkmatch) && (! $owner_namematch)) { // The author url doesn't match the owner (typically the contact) - // and also doesn't match the contact alias. - // The name match is a hack to catch several weird cases where URLs are + // and also doesn't match the contact alias. + // The name match is a hack to catch several weird cases where URLs are // all over the park. It can be tricked, but this prevents you from // seeing "Bob Smith to Bob Smith via Wall-to-wall" and you know darn - // well that it's the same Bob Smith. + // well that it's the same Bob Smith. - // But it could be somebody else with the same name. It just isn't highly likely. + // But it could be somebody else with the same name. It just isn't highly likely. $owner_url = $item['owner-link']; @@ -682,7 +683,7 @@ function render_content(&$a, $items, $mode, $update, $preview = false) { $template = $wallwall; $commentww = 'ww'; // If it is our contact, use a friendly redirect link - if((link_compare($item['owner-link'],$item['url'])) + if((link_compare($item['owner-link'],$item['url'])) && ($item['network'] === NETWORK_DFRN)) { $owner_url = $redirect_url; $osparkle = ' sparkle'; @@ -694,7 +695,7 @@ function render_content(&$a, $items, $mode, $update, $preview = false) { } $likebuttons = ''; - $shareable = ((($profile_owner == local_user()) && ($item['private'] != 1)) ? true : false); + $shareable = ((($profile_owner == local_user()) && ($item['private'] != 1)) ? true : false); if($page_writeable) { /* if($toplevelpost) { */ @@ -714,7 +715,7 @@ function render_content(&$a, $items, $mode, $update, $preview = false) { if(($show_comment_box) || (($show_comment_box == false) && ($override_comment_box == false) && ($item['last-child']))) { $comment = replace_macros($cmnt_tpl,array( - '$return_path' => '', + '$return_path' => '', '$jsreload' => (($mode === 'display') ? $_SESSION['return_url'] : ''), '$type' => (($mode === 'profile') ? 'wall-comment' : 'net-comment'), '$id' => $item['item_id'], @@ -742,10 +743,11 @@ function render_content(&$a, $items, $mode, $update, $preview = false) { } } - if(local_user() && link_compare($a->contact['url'],$item['author-link'])) + if (local_user() && link_compare($a->contact['url'],$item['author-link'])) { $edpost = array(App::get_baseurl($ssl_state)."/editpost/".$item['id'], t("Edit")); - else + } else { $edpost = false; + } $drop = ''; $dropping = false; @@ -755,7 +757,7 @@ function render_content(&$a, $items, $mode, $update, $preview = false) { $drop = array( 'dropping' => $dropping, - 'select' => t('Select'), + 'select' => t('Select'), 'delete' => t('Delete'), ); @@ -764,7 +766,7 @@ function render_content(&$a, $items, $mode, $update, $preview = false) { $isstarred = "unstarred"; if ($profile_owner == local_user()) { - if($toplevelpost) { + if ($toplevelpost) { $isstarred = (($item['starred']) ? "starred" : "unstarred"); $star = array( @@ -782,6 +784,7 @@ function render_content(&$a, $items, $mode, $update, $preview = false) { intval($item['uid']), intval($item['id']) ); + if (dbm::is_result($r)) { $ignore = array( 'do' => t("ignore thread"), @@ -793,7 +796,7 @@ function render_content(&$a, $items, $mode, $update, $preview = false) { ); } $tagger = ''; - if(feature_enabled($profile_owner,'commtag')) { + if (feature_enabled($profile_owner,'commtag')) { $tagger = array( 'add' => t("add tag"), 'class' => "", @@ -818,19 +821,22 @@ function render_content(&$a, $items, $mode, $update, $preview = false) { $sp = false; $profile_link = best_link_url($item,$sp); - if($profile_link === 'mailbox') + if ($profile_link === 'mailbox') { $profile_link = ''; - if($sp) + } + if ($sp) { $sparkle = ' sparkle'; - else + } else { $profile_link = zrl($profile_link); + } // Don't rely on the author-avatar. It is better to use the data from the contact table $author_contact = get_contact_details_by_url($item['author-link'], $profile_owner); - if ($author_contact["thumb"]) + if ($author_contact["thumb"]) { $profile_avatar = $author_contact["thumb"]; - else + } else { $profile_avatar = $item['author-avatar']; + } $like = ((x($conv_responses['like'],$item['uri'])) ? format_like($conv_responses['like'][$item['uri']],$conv_responses['like'][$item['uri'] . '-l'],'like',$item['uri']) : ''); $dislike = ((x($conv_responses['dislike'],$item['uri'])) ? format_like($conv_responses['dislike'][$item['uri']],$conv_responses['dislike'][$item['uri'] . '-l'],'dislike',$item['uri']) : '');