]> git.mxchange.org Git - friendica.git/commitdiff
repeated items from ostatus and diaspora are now using the share-element.
authorMichael Vogel <icarus@dabo.de>
Wed, 19 Dec 2012 11:18:52 +0000 (12:18 +0100)
committerMichael Vogel <icarus@dabo.de>
Wed, 19 Dec 2012 11:18:52 +0000 (12:18 +0100)
Some design changes to repeated items in "vier".

include/bbcode.php
include/delivery.php
include/diaspora.php
include/items.php
include/notifier.php
include/onepoll.php
include/text.php
view/de/strings.php
view/theme/vier/style.css

index b3f6aa826b6938390b4b94c62ecf0cd773ed1cfe..e09b1ed34259ffb02471dda4a9990899c46886ec 100644 (file)
@@ -251,11 +251,11 @@ function bb_ShareAttributes($match) {
        if ($avatar != "")
                $headline .= '<img src="'.$avatar.'" height="32" width="32" >';
 
-       $headline .= sprintf(t('<span><a href="%s">%s</a> wrote the following <a href="%s">post</a>:</span>'), $profile, $author, $link);
+       $headline .= sprintf(t('<span><a href="%s" target="external-link">%s</a> wrote the following <a href="%s" target="external-link">post</a>:</span>'), $profile, $author, $link);
 
         $headline .= "</div>";
 
-        $text = "<br />".$headline.'<blockquote class="shared_content">'.trim($match[2])."</blockquote>";
+        $text = $headline.'<blockquote class="shared_content">'.trim($match[2])."</blockquote>";
 
         return($text);
 }
@@ -314,6 +314,7 @@ function bbcode($Text,$preserve_nl = false, $tryoembed = true) {
 
        // We'll emulate it.
 
+       $Text = trim($Text);
        $Text = str_replace("\r\n","\n", $Text);
        $Text = str_replace(array("\r","\n"), array('<br />','<br />'), $Text);
 
index c56d7d2884526dd399ca14eec91a029a1cf03185..e8bf338a8f9a488be97e01d77a70e090bd734472 100644 (file)
@@ -439,14 +439,14 @@ function delivery_run(&$argv, &$argc){
                                        }
                                        if(! $it)
                                                break;
-                                       
+
 
                                        $local_user = q("SELECT * FROM `user` WHERE `uid` = %d LIMIT 1",
                                                intval($uid)
                                        );
                                        if(! count($local_user))
                                                break;
-                                       
+
                                        $reply_to = '';
                                        $r1 = q("SELECT * FROM `mailacct` WHERE `uid` = %d LIMIT 1",
                                                intval($uid)
@@ -482,12 +482,21 @@ function delivery_run(&$argv, &$argc){
 
                                        if($it['uri'] !== $it['parent-uri']) {
                                                $headers .= 'References: <' . iri2msgid($it['parent-uri']) . '>' . "\n";
-                                               if(!strlen($it['title'])) {
-                                                       $r = q("SELECT `title` FROM `item` WHERE `parent-uri` = '%s' LIMIT 1",
-                                                               dbesc($it['parent-uri']));
+                                               if(!$it['title']) {
+                                                       $r = q("SELECT `title` FROM `item` WHERE `uri` = '%s' AND `uid` = %d LIMIT 1",
+                                                               dbesc($it['parent-uri']),
+                                                               intval($uid));
 
                                                        if(count($r) AND ($r[0]['title'] != ''))
                                                                $subject = $r[0]['title'];
+                                                       else {
+                                                               $r = q("SELECT `title` FROM `item` WHERE `parent-uri` = '%s' AND `uid` = %d LIMIT 1",
+                                                                       dbesc($it['parent-uri']),
+                                                                       intval($uid));
+
+                                                               if(count($r) AND ($r[0]['title'] != ''))
+                                                                       $subject = $r[0]['title'];
+                                                       }
                                                }
                                                if(strncasecmp($subject,'RE:',3))
                                                        $subject = 'Re: '.$subject;
index c2b2fbcf4e1a71753b1a140ca1d48e5ba4e9678e..b14402b5a24cffade05e6fd14886ca1bdd88d053 100755 (executable)
@@ -923,6 +923,7 @@ function diaspora_reshare($importer,$xml,$msg) {
        $orig_guid = notags(unxmlify($xml->root_guid));
 
        $source_url = 'https://' . substr($orig_author,strpos($orig_author,'@')+1) . '/p/' . $orig_guid . '.xml';
+       $orig_url = 'https://'.substr($orig_author,strpos($orig_author,'@')+1).'/posts/'.$orig_guid;
        $x = fetch_url($source_url);
        if(! $x)
                $x = fetch_url(str_replace('https://','http://',$source_url));
@@ -1032,10 +1033,14 @@ function diaspora_reshare($importer,$xml,$msg) {
                $datarray['author-avatar'] = ((x($person,'thumb')) ? $person['thumb'] : $person['photo']);
                $datarray['body'] = $body;
        } else {
+               $prefix = "[share author='".$person['name'].
+                               "' profile='".$person['url'].
+                               "' avatar='".((x($person,'thumb')) ? $person['thumb'] : $person['photo']).
+                               "' link='".$orig_url."']";
                $datarray['author-name'] = $contact['name'];
                $datarray['author-link'] = $contact['url'];
                $datarray['author-avatar'] = $contact['thumb'];
-               $datarray['body'] = $prefix . $body;
+               $datarray['body'] = $prefix.$body."[/share]";
        }
 
        $datarray['tag'] = $str_tags;
index fb7a7e25d153d8bd5a93a626a388fac9d23257a3..5bd4423cfadc8a318552af0b0e3f84ef9ad6f2a4 100755 (executable)
@@ -798,6 +798,7 @@ function get_atom_elements($feed,$item) {
                logger('get_atom_elements: Looking for status.net repeated message');
 
                $message = $child["http://activitystrea.ms/spec/1.0/"]["object"][0]["child"][SIMPLEPIE_NAMESPACE_ATOM_10]["content"][0]["data"];
+               $orig_uri = $child["http://activitystrea.ms/spec/1.0/"]["object"][0]["child"][SIMPLEPIE_NAMESPACE_ATOM_10]["id"][0]["data"];
                $author = $child[SIMPLEPIE_NAMESPACE_ATOM_10]["author"][0]["child"][SIMPLEPIE_NAMESPACE_ATOM_10];
                $uri = $author["uri"][0]["data"];
                $name = $author["name"][0]["data"];
@@ -805,17 +806,22 @@ function get_atom_elements($feed,$item) {
                $avatar = $avatar["href"];
 
                if (($name != "") and ($uri != "") and ($avatar != "") and ($message != "")) {
-                       logger('get_atom_elements: fixing sender of repeated message');
+                       logger('get_atom_elements: fixing sender of repeated message. '.print_r($child, true));
 
-                       $res["owner-name"] = $res["author-name"];
+                       /*$res["owner-name"] = $res["author-name"];
                        $res["owner-link"] = $res["author-link"];
                        $res["owner-avatar"] = $res["author-avatar"];
 
                        $res["author-name"] = $name;
                        $res["author-link"] = $uri;
-                       $res["author-avatar"] = $avatar;
+                       $res["author-avatar"] = $avatar;*/
 
-                       $res["body"] = html2bbcode($message);
+                       $prefix = "[share author='".$name.
+                                       "' profile='".$uri.
+                                       "' avatar='".$avatar.
+                                       "' link='".$orig_uri."']";
+
+                       $res["body"] = $prefix.html2bbcode($message)."[/share]";
                }
        }
 
index b685e1b99872a32518558d4ad6fd0e603a5efef6..c522bcb6bc1ec00c457b51a0e5aadd26525c3e02 100644 (file)
@@ -791,12 +791,21 @@ function notifier_run(&$argv, &$argc){
 
                                                if($it['uri'] !== $it['parent-uri']) {
                                                        $headers .= 'References: <' . iri2msgid($it['parent-uri']) . '>' . "\n";
-                                                       if(!strlen($it['title'])) {
-                                                               $r = q("SELECT `title` FROM `item` WHERE `parent-uri` = '%s' LIMIT 1",
-                                                                       dbesc($it['parent-uri']));
+                                                       if(!$it['title']) {
+                                                               $r = q("SELECT `title` FROM `item` WHERE `uri` = '%s' AND `uid` = %d LIMIT 1",
+                                                                       dbesc($it['parent-uri']),
+                                                                       intval($uid));
 
-                                                               if(count($r) AND ($r[0]['title'] != ''))  
+                                                               if(count($r) AND ($r[0]['title'] != ''))
                                                                        $subject = $r[0]['title'];
+                                                               else {
+                                                                       $r = q("SELECT `title` FROM `item` WHERE `parent-uri` = '%s' AND `uid` = %d LIMIT 1",
+                                                                               dbesc($it['parent-uri']),
+                                                                               intval($uid));
+
+                                                                       if(count($r) AND ($r[0]['title'] != ''))
+                                                                               $subject = $r[0]['title'];
+                                                               }
                                                        }
                                                        if(strncasecmp($subject,'RE:',3))
                                                                $subject = 'Re: '.$subject;
index 1e11f2ca1e8ffc8e63753aedc5060f81f3c2470c..7b2eba70d1c9322be5b06cacef0e388b49dadba9 100644 (file)
@@ -405,8 +405,9 @@ function onepoll_run(&$argv, &$argc){
 
                                                // If it seems to be a reply but a header couldn't be found take the last message with matching subject
                                                if(!x($datarray,'parent-uri') and $reply) {
-                                                       $r = q("SELECT `uri` , `parent-uri` FROM `item` WHERE MATCH (`title`) AGAINST ('".'"%s"'."' IN BOOLEAN MODE) ORDER BY `created` DESC LIMIT 1",
-                                                               dbesc(protect_sprintf($datarray['title'])));
+                                                       $r = q("SELECT `uri` , `parent-uri` FROM `item` WHERE MATCH (`title`) AGAINST ('".'"%s"'."' IN BOOLEAN MODE) AND `uid` = %d ORDER BY `created` DESC LIMIT 1",
+                                                               dbesc(protect_sprintf($datarray['title'])),
+                                                               intval($importer_uid));
                                                        if(count($r))
                                                                $datarray['parent-uri'] = $r[0]['parent-uri'];
                                                }
index 7d26d355089952bec2a0dc12eb2ba69b362603f2..4212e23ca4dc8684817a6409dd2db5be9bef8662 100644 (file)
@@ -982,6 +982,9 @@ function prepare_body($item,$attach = false) {
        $s = $prep_arr['html'];
 
        if(! $attach) {
+               // Replace the blockquotes with quotes that are used in mails
+               $mailquote = '<blockquote type="cite" class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">';
+               $s = str_replace(array('<blockquote>', '<blockquote class="spoiler">', '<blockquote class="author">'), array($mailquote, $mailquote, $mailquote), $s);
                return $s;
        }
 
index 7bded94a41f278d8cbf045fcdac434441f6ce3b0..30e2d740f6e6c49cb4f77d6aa7a9bad3243403fd 100644 (file)
@@ -2081,3 +2081,5 @@ $a->strings["Post to Drupal by default"] = "Veröffentliche öffentliche Beiträ
 $a->strings["OEmbed settings updated"] = "OEmbed Einstellungen aktualisiert.";
 $a->strings["Use OEmbed for YouTube videos"] = "OEmbed für Youtube Videos verwenden";
 $a->strings["URL to embed:"] = "URL zum Einbetten:";
+$a->strings['<span><a href="%s" target="external-link">%s</a> wrote the following <a href="%s" target="external-link">post</a>:</span>'] = 
+            '<span><a href="%s" target="external-link">%s</a> hat diesen <a href="%s" target="external-link">Beitrag</a> ursprünglich gepostet:</span>';
index d6acade6925b879e296d1f0383f25883130fb70e..91680f41cb8661071a915364e92048af805f726c 100644 (file)
@@ -356,8 +356,8 @@ div.pager, .birthday-notice {
   height: 32px;
   color: #999;
   border-top: 1px solid #D2D2D2;
-  padding-top: 16px;
-  margin-top: 16px;
+  padding-top: 5px;
+  margin-top: 5px;
 }
 
 .shared_header img {