]> git.mxchange.org Git - friendica.git/blobdiff - src/Model/Term.php
Improved definition style
[friendica.git] / src / Model / Term.php
index 713218e184e30bb392c655828e6734fb36b66bce..13639f770083cdf1a0522da26f6341270c964f57 100644 (file)
@@ -40,10 +40,7 @@ class Term
     const HASHTAG           = 1;
     const MENTION           = 2;
     const CATEGORY          = 3;
-    const PCATEGORY         = 4;
     const FILE              = 5;
-    const SAVEDSEARCH       = 6;
-    const CONVERSATION      = 7;
        /**
         * An implicit mention is a mention in a comment body that is redundant with the threading information.
         */
@@ -82,7 +79,7 @@ class Term
                                WHERE `thread`.`visible`
                                  AND NOT `thread`.`deleted`
                                  AND NOT `thread`.`moderated`
-                                 AND NOT `thread`.`private`
+                                 AND `thread`.`private` = ?
                                  AND t.`uid` = 0
                                  AND t.`otype` = ?
                                  AND t.`type` = ?
@@ -91,6 +88,7 @@ class Term
                                GROUP BY `term`
                                ORDER BY `score` DESC
                                LIMIT ?",
+                               Item::PUBLIC,
                                Term::OBJECT_TYPE_POST,
                                Term::HASHTAG,
                                $period,
@@ -122,11 +120,10 @@ class Term
                                FROM `term` t
                                JOIN `item` i ON i.`id` = t.`oid` AND i.`uid` = t.`uid`
                                JOIN `thread` ON `thread`.`iid` = i.`id`
-                               JOIN `user` ON `user`.`uid` = `thread`.`uid` AND NOT `user`.`hidewall`
                                WHERE `thread`.`visible`
                                  AND NOT `thread`.`deleted`
                                  AND NOT `thread`.`moderated`
-                                 AND NOT `thread`.`private`
+                                 AND `thread`.`private` = ?
                                  AND `thread`.`wall`
                                  AND `thread`.`origin`
                                  AND t.`otype` = ?
@@ -136,6 +133,7 @@ class Term
                                GROUP BY `term`
                                ORDER BY `score` DESC
                                LIMIT ?",
+                               Item::PUBLIC,
                                Term::OBJECT_TYPE_POST,
                                Term::HASHTAG,
                                $period,
@@ -332,6 +330,10 @@ class Term
                                continue;
                        }
 
+                       if (empty($term)) {
+                               continue;
+                       }
+
                        if ($item['uid'] == 0) {
                                $global = true;
                                DBA::update('term', ['global' => true], ['otype' => self::OBJECT_TYPE_POST, 'guid' => $item['guid']]);
@@ -344,7 +346,7 @@ class Term
                                'oid'      => $item_id,
                                'otype'    => self::OBJECT_TYPE_POST,
                                'type'     => $type,
-                               'term'     => $term,
+                               'term'     => substr($term, 0, 255),
                                'url'      => $link,
                                'guid'     => $item['guid'],
                                'created'  => $item['created'],