]> git.mxchange.org Git - friendica.git/blobdiff - include/conversation.php
[frio] Fix code block display
[friendica.git] / include / conversation.php
index 411ffe38847fb4319b9e25e3332423eb7593db6d..3415a927c923883e3bb6f1c70b61028a6aff2fc1 100644 (file)
@@ -383,72 +383,13 @@ function item_query() {
 }
 
 /**
- * @brief All fieldlists that are needed for the item query
+ * @brief List of all data fields that are needed for displaying items
  */
 function item_fieldlists() {
 
-       return item_fieldlist().", ".zcontact_fieldlist().", ".contact_fieldlist();
-}
-
-/**
- * @brief SQL join for contacts
- */
-function item_joins() {
-
-       return contact_join()." ".zcontact_join();
-}
-
-/**
- * @brief Fieldlist for author and owner
- */
-function zcontact_fieldlist() {
-
-       return "`author`.`thumb` AS `author-thumb`, `owner`.`thumb` AS `owner-thumb`";
-}
-
-/**
- * @brief Join for author and owner
- */
-function zcontact_join() {
-
-       return "LEFT JOIN `contact` AS `author` ON `author`.`id`=`item`.`author-id`
-               LEFT JOIN `contact` AS `owner` ON `owner`.`id`=`item`.`author-id`";
-}
-
-/**
- * @brief List of all contact fields that are needed for the conversation function
- */
-function contact_fieldlist() {
-
-       return "`contact`.`network`, `contact`.`url`, `contact`.`name`, `contact`.`writable`,
-               `contact`.`self`, `contact`.`id` AS `cid`, `contact`.`alias`";
-}
-
-/**
- * @brief SQL condition for contacts
- */
-function contact_condition() {
-
-       return "NOT `contact`.`blocked` AND NOT `contact`.`pending`";
-}
-
-/**
- * @brief SQL join for contacts
- */
-function contact_join() {
-
-       return "INNER JOIN `contact` ON `contact`.`id` = `item`.`contact-id` AND ".contact_condition();
-}
-
-/**
- * @brief List of all item fields that are needed for the conversation function
- */
-function item_fieldlist() {
-
 /*
 These Fields are not added below (yet). They are here to for bug search.
 `item`.`type`,
-`item`.`object`,
 `item`.`extid`,
 `item`.`received`,
 `item`.`changed`,
@@ -457,7 +398,6 @@ These Fields are not added below (yet). They are here to for bug search.
 `item`.`target`,
 `item`.`resource-id`,
 `item`.`tag`,
-`item`.`attach`,
 `item`.`inform`,
 `item`.`pubmail`,
 `item`.`visible`,
@@ -475,21 +415,37 @@ These Fields are not added below (yet). They are here to for bug search.
 */
 
        return "`item`.`author-link`, `item`.`author-name`, `item`.`author-avatar`,
-                       `item`.`owner-link`, `item`.`owner-name`, `item`.`owner-avatar`,
-                       `item`.`contact-id`, `item`.`uid`, `item`.`id`, `item`.`parent`,
-                       `item`.`uri`, `item`.`thr-parent`, `item`.`parent-uri`,
-                       `item`.`commented`, `item`.`created`, `item`.`edited`,
-                       `item`.`verb`, `item`.`object-type`, `item`.`postopts`, `item`.`plink`,
-                       `item`.`guid`, `item`.`wall`, `item`.`private`, `item`.`starred`,
-                       `item`.`title`, `item`.`body`, `item`.`file`, `item`.`event-id`,
-                       `item`.`location`, `item`.`coord`, `item`.`app`,
-                       `item`.`rendered-hash`, `item`.`rendered-html`,
-                       `item`.`allow_cid`, `item`.`allow_gid`, `item`.`deny_cid`, `item`.`deny_gid`,
-                       `item`.`id` AS `item_id`, `item`.`network` AS `item_network`";
+               `item`.`owner-link`, `item`.`owner-name`, `item`.`owner-avatar`,
+               `item`.`contact-id`, `item`.`uid`, `item`.`id`, `item`.`parent`,
+               `item`.`uri`, `item`.`thr-parent`, `item`.`parent-uri`,
+               `item`.`commented`, `item`.`created`, `item`.`edited`,
+               `item`.`verb`, `item`.`object-type`, `item`.`postopts`, `item`.`plink`,
+               `item`.`guid`, `item`.`wall`, `item`.`private`, `item`.`starred`,
+               `item`.`title`, `item`.`body`, `item`.`file`, `item`.`event-id`,
+               `item`.`location`, `item`.`coord`, `item`.`app`, `item`.`attach`,
+               `item`.`rendered-hash`, `item`.`rendered-html`, `item`.`object`,
+               `item`.`allow_cid`, `item`.`allow_gid`, `item`.`deny_cid`, `item`.`deny_gid`,
+               `item`.`id` AS `item_id`, `item`.`network` AS `item_network`,
+
+               `author`.`thumb` AS `author-thumb`, `owner`.`thumb` AS `owner-thumb`,
+
+               `contact`.`network`, `contact`.`url`, `contact`.`name`, `contact`.`writable`,
+               `contact`.`self`, `contact`.`id` AS `cid`, `contact`.`alias`";
+}
+
+/**
+ * @brief SQL join for contacts that are needed for displaying items
+ */
+function item_joins() {
+
+       return "STRAIGHT_JOIN `contact` ON `contact`.`id` = `item`.`contact-id` AND
+               NOT `contact`.`blocked` AND NOT `contact`.`pending`
+               LEFT JOIN `contact` AS `author` ON `author`.`id`=`item`.`author-id`
+               LEFT JOIN `contact` AS `owner` ON `owner`.`id`=`item`.`owner-id`";
 }
 
 /**
- * @brief SQL condition for items
+ * @brief SQL condition for items that are needed for displaying items
  */
 function item_condition() {
 
@@ -718,7 +674,7 @@ function conversation(&$a, $items, $mode, $update, $preview = false) {
                                else
                                        $profile_link = zrl($profile_link);
 
-                               if (!isset($item['author-thumb'])) {
+                               if (!isset($item['author-thumb']) OR ($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"];
@@ -726,7 +682,7 @@ function conversation(&$a, $items, $mode, $update, $preview = false) {
                                                $item['author-thumb'] = $item['author-avatar'];
                                }
 
-                               if (!isset($item['owner-thumb'])) {
+                               if (!isset($item['owner-thumb']) OR ($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"];
@@ -923,15 +879,13 @@ function conversation(&$a, $items, $mode, $update, $preview = false) {
 
 function best_link_url($item,&$sparkle,$ssl_state = false) {
 
-       $a = get_app();
-
        $best_url = '';
        $sparkle  = false;
 
        $clean_url = normalise_link($item['author-link']);
 
        if (local_user()) {
-               $r = q("SELECT `id` FROM `contact` WHERE `network` = '%s' AND `uid` = %d AND `nurl` = '%s' LIMIT 1",
+               $r = q("SELECT `id` FROM `contact` WHERE `network` = '%s' AND `uid` = %d AND `nurl` = '%s' AND NOT `pending` LIMIT 1",
                        dbesc(NETWORK_DFRN), intval(local_user()), dbesc(normalise_link($clean_url)));
                if ($r) {
                        $best_url = 'redir/'.$r[0]['id'];
@@ -951,7 +905,6 @@ function best_link_url($item,&$sparkle,$ssl_state = false) {
 
 if(! function_exists('item_photo_menu')){
 function item_photo_menu($item){
-       $a = get_app();
 
        $ssl_state = false;
 
@@ -1183,7 +1136,7 @@ function format_like($cnt,$arr,$type,$id) {
                                $explikers = sprintf( t('%s don\'t attend.'), $likers);
                                break;
                        case 'attendmaybe':
-                               $phrase = sprintf( t('<span  %1$s>%2$d people</span> anttend maybe'), $spanatts, $cnt);
+                               $phrase = sprintf( t('<span  %1$s>%2$d people</span> attend maybe'), $spanatts, $cnt);
                                $explikers = sprintf( t('%s anttend maybe.'), $likers);
                                break;
                }
@@ -1327,6 +1280,10 @@ function status_editor($a,$x, $notes_cid = 0, $popup=false) {
                '$private' => t('Private post'),
                '$is_private' => $private_post,
                '$public_link' => $public_post_link,
+
+               //jot nav tab (used in some themes)
+               '$message' => t('Message'),
+               '$browser' => t('Browser'),
        ));