]> git.mxchange.org Git - friendica.git/blobdiff - mod/content.php
More usage of dbm::is_result($r) instead of count($r):
[friendica.git] / mod / content.php
index 043b7b68588508b8c5eabe403cde6593df83a66b..8831f8ef78ea5f997549c87572e403b82ab266e8 100644 (file)
@@ -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,7 +113,7 @@ 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 );
@@ -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 ) ";
 
                }
@@ -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
@@ -358,8 +358,6 @@ function render_content(&$a, $items, $mode, $update, $preview = false) {
        else
                $return_url = $_SESSION['return_url'] = $a->query_string;
 
-       //load_contact_links(local_user());
-
        $cb = array('items' => $items, 'mode' => $mode, 'update' => $update, 'preview' => $preview);
        call_hooks('conversation_start',$cb);
 
@@ -784,7 +782,7 @@ 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"),