X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=mod%2Fcontent.php;h=2377032a7939c7fd4a21911f9a1ad48da3fdd751;hb=a7ce601580b07e9b3e7653cbdb0a9b6bbb5c474e;hp=1f373b80eb4c9e00e1f940798ddd008213c700ef;hpb=c9342ccf1dd32e6e2ad9714099bd1121e4287ba3;p=friendica.git diff --git a/mod/content.php b/mod/content.php index 1f373b80eb..2377032a79 100644 --- a/mod/content.php +++ b/mod/content.php @@ -23,7 +23,7 @@ function content_content(&$a, $update = 0) { // Currently security is based on the logged in user - if(! local_user()) { + if (! local_user()) { return; } @@ -93,7 +93,7 @@ function content_content(&$a, $update = 0) { ); $str = ''; - if(count($r)) + if (dbm::is_result($r)) foreach($r as $rr) $str .= '<' . $rr['id'] . '>'; if(strlen($str)) @@ -113,11 +113,11 @@ function content_content(&$a, $update = 0) { intval($group), intval($_SESSION['uid']) ); - if(! count($r)) { + if (! dbm::is_result($r)) { if($update) killme(); notice( t('No such group') . EOL ); - goaway($a->get_baseurl(true) . '/network'); + goaway(App::get_baseurl(true) . '/network'); // NOTREACHED } @@ -141,7 +141,7 @@ function content_content(&$a, $update = 0) { AND `blocked` = 0 AND `pending` = 0 LIMIT 1", intval($cid) ); - if(count($r)) { + if (dbm::is_result($r)) { $sql_extra = " AND `item`.`parent` IN ( SELECT DISTINCT(`parent`) FROM `item` WHERE 1 $sql_options AND `contact-id` = " . intval($cid) . " and deleted = 0 ) "; } @@ -197,7 +197,7 @@ function content_content(&$a, $update = 0) { } if($conv) { - $myurl = $a->get_baseurl() . '/profile/'. $a->user['nickname']; + $myurl = App::get_baseurl() . '/profile/'. $a->user['nickname']; $myurl = substr($myurl,strpos($myurl,'://')+3); $myurl = str_replace('www.','',$myurl); $diasp_url = str_replace('/profile/','/u/',$myurl); @@ -217,14 +217,14 @@ function content_content(&$a, $update = 0) { $items = q("SELECT `item`.*, `item`.`id` AS `item_id`, `contact`.`name`, `contact`.`photo`, `contact`.`url`, `contact`.`rel`, `contact`.`writable`, `contact`.`network`, `contact`.`thumb`, `contact`.`dfrn-id`, `contact`.`self`, - `contact`.`id` AS `cid`, `contact`.`uid` AS `contact-uid` + `contact`.`id` AS `cid` FROM $sql_table INNER JOIN `contact` ON `contact`.`id` = `item`.`contact-id` WHERE `item`.`uid` = %d AND `item`.`visible` = 1 AND `item`.`deleted` = 0 and `item`.`moderated` = 0 $simple_update AND `contact`.`blocked` = 0 AND `contact`.`pending` = 0 $sql_extra $sql_nets - ORDER BY `item`.`received` DESC $pager_sql ", + ORDER BY `item`.`id` DESC $pager_sql ", intval($_SESSION['uid']) ); @@ -259,7 +259,7 @@ function content_content(&$a, $update = 0) { $parents_arr = array(); $parents_str = ''; - if(count($r)) { + if (dbm::is_result($r)) { foreach($r as $rr) if(! in_array($rr['item_id'],$parents_arr)) $parents_arr[] = $rr['item_id']; @@ -268,7 +268,7 @@ function content_content(&$a, $update = 0) { $items = q("SELECT `item`.*, `item`.`id` AS `item_id`, `contact`.`name`, `contact`.`photo`, `contact`.`url`, `contact`.`alias`, `contact`.`rel`, `contact`.`writable`, `contact`.`network`, `contact`.`thumb`, `contact`.`dfrn-id`, `contact`.`self`, - `contact`.`id` AS `cid`, `contact`.`uid` AS `contact-uid` + `contact`.`id` AS `cid` FROM $sql_table INNER JOIN `contact` ON `contact`.`id` = `item`.`contact-id` WHERE `item`.`uid` = %d AND `item`.`visible` = 1 AND `item`.`deleted` = 0 AND `item`.`moderated` = 0 @@ -509,8 +509,8 @@ function render_content(&$a, $items, $mode, $update, $preview = false) { 'like' => '', 'dislike' => '', 'comment' => '', - //'conv' => (($preview) ? '' : array('href'=> $a->get_baseurl($ssl_state) . '/display/' . $nickname . '/' . $item['id'], 'title'=> t('View in context'))), - 'conv' => (($preview) ? '' : array('href'=> $a->get_baseurl($ssl_state).'/display/'.$item['guid'], 'title'=> t('View in context'))), + //'conv' => (($preview) ? '' : array('href'=> App::get_baseurl($ssl_state) . '/display/' . $nickname . '/' . $item['id'], 'title'=> t('View in context'))), + 'conv' => (($preview) ? '' : array('href'=> App::get_baseurl($ssl_state).'/display/'.$item['guid'], 'title'=> t('View in context'))), 'previewing' => $previewing, 'wait' => t('Please wait'), ); @@ -742,10 +742,11 @@ function render_content(&$a, $items, $mode, $update, $preview = false) { } } - if(local_user() && link_compare($a->contact['url'],$item['author-link'])) - $edpost = array($a->get_baseurl($ssl_state)."/editpost/".$item['id'], t("Edit")); - else + if (local_user() && link_compare($a->contact['url'],$item['author-link'])) { + $edpost = array(App::get_baseurl($ssl_state)."/editpost/".$item['id'], t("Edit")); + } else { $edpost = false; + } $drop = ''; $dropping = false; @@ -764,7 +765,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,7 +783,8 @@ function render_content(&$a, $items, $mode, $update, $preview = false) { intval($item['uid']), intval($item['id']) ); - if (count($r)) { + + if (dbm::is_result($r)) { $ignore = array( 'do' => t("ignore thread"), 'undo' => t("unignore thread"), @@ -793,7 +795,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 +820,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']) : '');