]> git.mxchange.org Git - friendica.git/commitdiff
provide permalink for posts, include permalinks in feeds and imported from feeds
authorFriendika <info@friendika.com>
Wed, 16 Feb 2011 10:07:11 +0000 (02:07 -0800)
committerFriendika <info@friendika.com>
Wed, 16 Feb 2011 10:07:11 +0000 (02:07 -0800)
13 files changed:
boot.php
include/items.php
mod/display.php
mod/item.php
mod/network.php
mod/profile.php
view/de/wallwall_item.tpl
view/en/wallwall_item.tpl
view/fr/wallwall_item.tpl
view/it/wallwall_item.tpl
view/theme/duepuntozero/style.css
view/theme/loozah/style.css
view/wall_item.tpl

index 3dff39a338b42427885b8acefb7181f3bc40967b..dcf5b1c1aac8f0299507d11107adcdade6047eca 100644 (file)
--- a/boot.php
+++ b/boot.php
@@ -2449,3 +2449,11 @@ function feed_salmonlinks($nick) {
        return $salmon;
 }}
 
+if(! function_exists('get_plink')) {
+function get_plink($item) {
+       $a = get_app(); 
+       $plink = (((x($item,'plink')) && (! $item['private'])) ? '<div class="wall-item-links-wrapper"><a href="' 
+                       . $item['plink'] . '" title="' . t('link to source') . '"><img src="' . $a->get_baseurl() . '/images/link-icon.gif" alt="' . t('link to source') . '" /></a></div>' : '');
+       return $plink;
+}}
+
index b5bdd783354f8ee7c8982900f4eb52792f29ee49..153debd7d321f803f2fa11a5fc934f0647092ae4 100644 (file)
@@ -246,7 +246,7 @@ function get_atom_elements($feed,$item) {
        $res['uri'] = unxmlify($item->get_id());
        $res['title'] = unxmlify($item->get_title());
        $res['body'] = unxmlify($item->get_content());
-
+       $res['plink'] = unxmlify($item->get_link(0));
 
        // look for a photo. We should check media size and find the best one,
        // but for now let's just find any author photo
@@ -591,6 +591,7 @@ function item_store($arr,$force_parent = false) {
        $arr['object']        = ((x($arr,'object'))        ? trim($arr['object'])                : '');
        $arr['target-type']   = ((x($arr,'target-type'))   ? notags(trim($arr['target-type']))   : '');
        $arr['target']        = ((x($arr,'target'))        ? trim($arr['target'])                : '');
+       $arr['plink']         = ((x($arr,'plink'))         ? notags(trim($arr['plink']))         : '');
        $arr['allow_cid']     = ((x($arr,'allow_cid'))     ? trim($arr['allow_cid'])             : '');
        $arr['allow_gid']     = ((x($arr,'allow_gid'))     ? trim($arr['allow_gid'])             : '');
        $arr['deny_cid']      = ((x($arr,'deny_cid'))      ? trim($arr['deny_cid'])              : '');
@@ -1418,7 +1419,7 @@ function atom_entry($item,$type,$author,$owner,$comment = false) {
        $o .= '<updated>' . xmlify(datetime_convert('UTC','UTC',$item['edited'] . '+00:00',ATOM_TIME)) . '</updated>' . "\r\n";
        $o .= '<dfrn:env>' . base64url_encode($item['body'], true) . '</dfrn:env>' . "\r\n";
        $o .= '<content type="' . $type . '" >' . xmlify(($type === 'html') ? bbcode($item['body']) : $item['body']) . '</content>' . "\r\n";
-       $o .= '<link rel="alternate" href="' . xmlify($a->get_baseurl() . '/display/' . $owner['nickname'] . '/' . $item['id']) . '" />' . "\r\n";
+       $o .= '<link rel="alternate" type="text/html" href="' . xmlify($a->get_baseurl() . '/display/' . $owner['nickname'] . '/' . $item['id']) . '" />' . "\r\n";
        if($comment)
                $o .= '<dfrn:comment-allow>' . intval($item['last-child']) . '</dfrn:comment-allow>' . "\r\n";
 
index b07e1aee57949e2e567c2c0aacae27cc0808dc70..03003f3c0ca44c4fdd3008e21c2970c663b8ec94 100644 (file)
@@ -272,6 +272,7 @@ function display_content(&$a) {
                                '$owner_url' => $owner_url,
                                '$owner_photo' => $owner_photo,
                                '$owner_name' => $owner_name,
+                               '$plink' => get_plink($item),
                                '$drop' => $drop,
                                '$vote' => $likebuttons,
                                '$like' => $like,
index 2cc2b9eb2cd9a1564cc8cedbb7e0224283a550c3..5bb4b1b73c8ce7a877381bbf33a8383f86df8a52 100644 (file)
@@ -429,10 +429,11 @@ function item_post(&$a) {
                        }
                }
 
-               $r = q("UPDATE `item` SET `parent` = %d, `parent-uri` = '%s', `changed` = '%s', `last-child` = 1, `visible` = 1
+               $r = q("UPDATE `item` SET `parent` = %d, `parent-uri` = '%s', `plink` = '%s', `changed` = '%s', `last-child` = 1, `visible` = 1
                        WHERE `id` = %d LIMIT 1",
                        intval($parent),
                        dbesc(($parent == $post_id) ? $uri : $parent_item['uri']),
+                       dbesc($a->get_baseurl() . '/display/' . $user['nickname'] . '/' . $post_id),
                        dbesc(datetime_convert()),
                        intval($post_id)
                );
index f09b302e9bbdece1fbc10807856a38aafdcfed0d..3658c601e32f6f712d5eb6e8088ed407d524a5dc 100644 (file)
@@ -425,6 +425,7 @@ function network_content(&$a, $update = 0) {
                                '$owner_url' => $owner_url,
                                '$owner_photo' => $owner_photo,
                                '$owner_name' => $owner_name,
+                               '$plink' => get_plink($item),
                                '$drop' => $drop,
                                '$vote' => $likebuttons,
                                '$like' => $like,
index 57abc479d72fd344fd1e1692473a952dea67bf5b..0723d64fb85c09ce90a3031fcf52542315ccaf73 100644 (file)
@@ -371,6 +371,7 @@ function profile_content(&$a, $update = 0) {
                                '$lock' => $lock,
                                '$location' => $location, 
                                '$indent' => $indent, 
+                               '$plink' => get_plink($item),
                                '$drop' => $drop,
                                '$like' => $like,
                                '$vote' => $likebuttons,
index fd05a74ace75b9f4cf841f947837500b4f969ab7..67b6006cf0ce3aae752cf18126746a2778a3a28a 100644 (file)
@@ -21,6 +21,7 @@
                        <div class="wall-item-title" id="wall-item-title-$id">$title</div>
                        <div class="wall-item-body" id="wall-item-body-$id" >$body</div>
                </div>
+               $plink
                $drop
        </div>  
        <div class="wall-item-wrapper-end"></div>
index f8affd1c56741e2f31d8aa5eb7535da45dc6518b..9c6ad60708bef026491bbf1a6ba10bcae5792de9 100644 (file)
@@ -21,6 +21,7 @@
                        <div class="wall-item-title" id="wall-item-title-$id">$title</div>
                        <div class="wall-item-body" id="wall-item-body-$id" >$body</div>
                </div>
+               $plink
                $drop
        </div>  
        <div class="wall-item-wrapper-end"></div>
index f8affd1c56741e2f31d8aa5eb7535da45dc6518b..9c6ad60708bef026491bbf1a6ba10bcae5792de9 100644 (file)
@@ -21,6 +21,7 @@
                        <div class="wall-item-title" id="wall-item-title-$id">$title</div>
                        <div class="wall-item-body" id="wall-item-body-$id" >$body</div>
                </div>
+               $plink
                $drop
        </div>  
        <div class="wall-item-wrapper-end"></div>
index bc2d3f2ecbd54d52a8391068bb18914e3357e316..3c7883fc81b00ed55fa7702d4a5ec4e141756932 100644 (file)
@@ -21,6 +21,7 @@
                        <div class="wall-item-title" id="wall-item-title-$id">$title</div>
                        <div class="wall-item-body" id="wall-item-body-$id" >$body</div>
                </div>
+               $plink
                $drop
        </div>  
        <div class="wall-item-wrapper-end"></div>
index ac3562d1c06762a8613236dc7619f92c48abfae0..e3a5fd3e72431a02dca7ad966421d95aab4cf325 100644 (file)
@@ -833,6 +833,13 @@ input#dfrn-url {
 .wall-item-like-buttons img {
        cursor: pointer;
 }
+
+.wall-item-links-wrapper {
+       float: left;
+       margin-bottom: 5px;
+       margin-left: 5px;
+}
+
 .wall-item-delete-wrapper {
        float: right;
        margin-top: 5px;
index a87252016f4601b3a060c13c7ec016dba84b0e41..d34c81a45d94168f7fec517ef43565b748541f23 100644 (file)
@@ -962,6 +962,13 @@ input#dfrn-url {
 .wall-item-like-buttons img {
        cursor: pointer;
 }
+
+.wall-item-links-wrapper {
+       float: left;
+       margin-top: 100px;
+       margin-left: 10px;
+}
+
 .wall-item-delete-wrapper {
        float: right;
        margin-top: 20px;
index 67fce415262c060bfde3f4d9ee64dcaaee7dbaec..b9f27ed4ad9aa15d47af4949e1d81ca6c35da123 100644 (file)
@@ -16,6 +16,7 @@
                        <div class="wall-item-title" id="wall-item-title-$id">$title</div>
                        <div class="wall-item-body" id="wall-item-body-$id" >$body</div>
                </div>
+               $plink
                $drop
        </div>
        <div class="wall-item-wrapper-end"></div>