]> git.mxchange.org Git - friendica.git/blobdiff - object/Item.php
Moved "privacy_image_cache" into the core. Enabled by default, can be disabled in...
[friendica.git] / object / Item.php
index ae4d26cc1073a56c7524dea931d3a3920a8f411c..246fecc189a15a260375105c8e992281cb9878cc 100644 (file)
@@ -32,7 +32,7 @@ class Item extends BaseObject {
 
        public function __construct($data) {
                $a = $this->get_app();
-               
+
                $this->data = $data;
                $this->set_template('wall');
                $this->toplevel = ($this->get_id() == $this->get_data_value('parent'));
@@ -45,7 +45,7 @@ class Item extends BaseObject {
                                }
                        }
                }
-               
+
                $this->writable = ($this->get_data_value('writable') || $this->get_data_value('self'));
 
                $ssl_state = ((local_user()) ? true : false);
@@ -81,6 +81,8 @@ class Item extends BaseObject {
         *      _ false on failure
         */
        public function get_template_data($alike, $dlike, $thread_level=1) {
+               require_once("mod/proxy.php");
+
                $result = array();
 
                $a = $this->get_app();
@@ -158,25 +160,6 @@ class Item extends BaseObject {
                $hashtags = array();
                $mentions = array();
 
-               if (!get_config('system','suppress_tags')) {
-                       $taglist = q("SELECT `type`, `term`, `url` FROM `term` WHERE `otype` = %d AND `oid` = %d AND `type` IN (%d, %d) ORDER BY `tid`",
-                                       intval(TERM_OBJ_POST), intval($item['id']), intval(TERM_HASHTAG), intval(TERM_MENTION));
-
-                       foreach($taglist as $tag) {
-
-                               if ($tag["url"] == "")
-                                       $tag["url"] = $searchpath.strtolower($tag["term"]);
-
-                               if ($tag["type"] == TERM_HASHTAG) {
-                                       $hashtags[] = "#<a href=\"".$tag["url"]."\" target=\"external-link\">".$tag["term"]."</a>";
-                                       $prefix = "#";
-                               } elseif ($tag["type"] == TERM_MENTION) {
-                                       $mentions[] = "@<a href=\"".$tag["url"]."\" target=\"external-link\">".$tag["term"]."</a>";
-                                       $prefix = "@";
-                               }
-                               $tags[] = $prefix."<a href=\"".$tag["url"]."\" target=\"external-link\">".$tag["term"]."</a>";
-                       }
-               }
 
                /*foreach(explode(',',$item['tag']) as $tag){
                        $tag = trim($tag);
@@ -287,13 +270,33 @@ class Item extends BaseObject {
                        $owner_name_e = $this->get_owner_name();
                }
 
+               // Disable features that aren't available in several networks
+               if (($item["item_network"] != "dfrn") AND isset($buttons["dislike"])) {
+                       unset($buttons["dislike"]);
+                       $tagger = '';
+               }
+
+               if (($item["item_network"] == "feed") AND isset($buttons["like"]))
+                       unset($buttons["like"]);
+
+               if (($item["item_network"] == "mail") AND isset($buttons["like"]))
+                       unset($buttons["like"]);
+
+               if (($item["item_network"] == "dspr") AND ($indent == 'comment') AND isset($buttons["like"]))
+                       unset($buttons["like"]);
+
+               // Facebook can like comments - but it isn't programmed in the connector yet.
+               if (($item["item_network"] == "face") AND ($indent == 'comment') AND isset($buttons["like"]))
+                       unset($buttons["like"]);
+
+
                $tmp_item = array(
                        'template' => $this->get_template(),
 
                        'type' => implode("",array_slice(explode("/",$item['verb']),-1)),
-                       'tags' => $tags,
-                       'hashtags' => $hashtags,
-                       'mentions' => $mentions,
+                       'tags' => $item['tags'],
+                       'hashtags' => $item['hashtags'],
+                       'mentions' => $item['mentions'],
                        'txt_cats' => t('Categories:'),
                        'txt_folders' => t('Filed under:'),
                        'has_cats' => ((count($categories)) ? 'true' : ''),
@@ -303,6 +306,7 @@ class Item extends BaseObject {
                        'body' => $body_e,
                        'text' => $text_e,
                        'id' => $this->get_id(),
+                       'guid' => $item['guid'],
                        'linktitle' => sprintf( t('View %s\'s profile @ %s'), $profile_name, ((strlen($item['author-link'])) ? $item['author-link'] : $item['url'])),
                        'olinktitle' => sprintf( t('View %s\'s profile @ %s'), $this->get_owner_name(), ((strlen($item['owner-link'])) ? $item['owner-link'] : $item['url'])),
                        'to' => t('to'),
@@ -312,18 +316,20 @@ class Item extends BaseObject {
                        'profile_url' => $profile_link,
                        'item_photo_menu' => item_photo_menu($item),
                        'name' => $name_e,
-                       'thumb' => $profile_avatar,
+                       'thumb' => proxy_url($profile_avatar),
                        'osparkle' => $osparkle,
                        'sparkle' => $sparkle,
                        'title' => $title_e,
                        'localtime' => datetime_convert('UTC', date_default_timezone_get(), $item['created'], 'r'),
                        'ago' => (($item['app']) ? sprintf( t('%s from %s'),relative_date($item['created']),$item['app']) : relative_date($item['created'])),
+                       'app' => $item['app'],
+                       'created' => relative_date($item['created']),
                        'lock' => $lock,
                        'location' => $location_e,
                        'indent' => $indent,
                        'shiny' => $shiny,
                        'owner_url' => $this->get_owner_url(),
-                       'owner_photo' => $this->get_owner_photo(),
+                       'owner_photo' => proxy_url($this->get_owner_photo()),
                        'owner_name' => $owner_name_e,
                        'plink' => get_plink($item),
                        'edpost'    => ((feature_enabled($conv->get_profile_owner(),'edit_posts')) ? $edpost : ''),
@@ -341,7 +347,9 @@ class Item extends BaseObject {
                        'wait' => t('Please wait'),
                        'thread_level' => $thread_level,
                         'postopts' => $langstr,
-                        'edited' => $edited
+                        'edited' => $edited,
+                       'network' => $item["item_network"],
+                       'network_name' => network_to_name($item['item_network']),
                );
 
                $arr = array('item' => $item, 'output' => $tmp_item);
@@ -391,7 +399,7 @@ class Item extends BaseObject {
 
                return $result;
        }
-       
+
        public function get_id() {
                return $this->get_data_value('id');
        }
@@ -422,7 +430,7 @@ class Item extends BaseObject {
                if(activity_match($item->get_data_value('verb'),ACTIVITY_LIKE) || activity_match($item->get_data_value('verb'),ACTIVITY_DISLIKE)) {
                        return false;
                }
-               
+
                $item->set_parent($this);
                $this->children[] = $item;
                return end($this->children);
@@ -681,7 +689,7 @@ class Item extends BaseObject {
                $a = $this->get_app();
                $conv = $this->get_conversation();
                $this->wall_to_wall = false;
-               
+
                if($this->is_toplevel()) {
                        if( (! $this->get_data_value('self')) && ($conv->get_mode() !== 'profile')) {
                                if($this->get_data_value('wall')) {