]> git.mxchange.org Git - friendica.git/blobdiff - mod/notes.php
Merge pull request #3797 from rabuzarus/20171015_-_duplicate_event
[friendica.git] / mod / notes.php
index a25d090ed701faad32ab49fb2dbc7012b13d8e2f..d1810604ca514bd8ddbcf292e061701017dbf2e5 100644 (file)
@@ -1,9 +1,12 @@
 <?php
 
-function notes_init(&$a) {
+use Friendica\App;
 
-       if(! local_user())
+function notes_init(App $a) {
+
+       if (! local_user()) {
                return;
+       }
 
        $profile = 0;
 
@@ -16,9 +19,9 @@ function notes_init(&$a) {
 }
 
 
-function notes_content(&$a,$update = false) {
+function notes_content(App $a, $update = false) {
 
-       if(! local_user()) {
+       if (! local_user()) {
                notice( t('Permission denied.') . EOL);
                return;
        }
@@ -70,7 +73,7 @@ function notes_content(&$a,$update = false) {
 
        // default permissions - anonymous user
 
-       $sql_extra = " AND `allow_cid` = '<" . $a->contact['id'] . ">' ";
+       $sql_extra = " AND `item`.`allow_cid` = '<" . $a->contact['id'] . ">' ";
 
        $r = q("SELECT COUNT(*) AS `total`
                FROM `item` %s
@@ -82,7 +85,7 @@ function notes_content(&$a,$update = false) {
 
        );
 
-       if(count($r)) {
+       if (dbm::is_result($r)) {
                $a->set_pager_total($r[0]['total']);
                $a->set_pager_itemspage(40);
        }
@@ -102,7 +105,7 @@ function notes_content(&$a,$update = false) {
        $parents_arr = array();
        $parents_str = '';
 
-       if(count($r)) {
+       if (dbm::is_result($r)) {
                foreach($r as $rr)
                        $parents_arr[] = $rr['item_id'];
                $parents_str = implode(', ', $parents_arr);
@@ -116,7 +119,7 @@ function notes_content(&$a,$update = false) {
                        dbesc($parents_str)
                );
 
-               if(count($r)) {
+               if (dbm::is_result($r)) {
                        $items = conv_sort($r,"`commented`");
 
                        $o .= conversation($a,$items,'notes',$update);