aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFriendika <info@friendika.com>2011-02-16 02:07:11 -0800
committerFriendika <info@friendika.com>2011-02-16 02:07:11 -0800
commit9f020573748af28cc09cbde18e96cfc68641ce7b (patch)
tree7f70d8374ca24ee81e192e6da5973ed3b9c0023b
parentc5f5102396cee8ec691fd22d486070ec3d5f243d (diff)
downloadvolse-hubzilla-9f020573748af28cc09cbde18e96cfc68641ce7b.tar.gz
volse-hubzilla-9f020573748af28cc09cbde18e96cfc68641ce7b.tar.bz2
volse-hubzilla-9f020573748af28cc09cbde18e96cfc68641ce7b.zip
provide permalink for posts, include permalinks in feeds and imported from feeds
-rw-r--r--boot.php8
-rw-r--r--include/items.php5
-rw-r--r--mod/display.php1
-rw-r--r--mod/item.php3
-rw-r--r--mod/network.php1
-rw-r--r--mod/profile.php1
-rw-r--r--view/de/wallwall_item.tpl1
-rw-r--r--view/en/wallwall_item.tpl1
-rw-r--r--view/fr/wallwall_item.tpl1
-rw-r--r--view/it/wallwall_item.tpl1
-rw-r--r--view/theme/duepuntozero/style.css7
-rw-r--r--view/theme/loozah/style.css7
-rw-r--r--view/wall_item.tpl1
13 files changed, 35 insertions, 3 deletions
diff --git a/boot.php b/boot.php
index 3dff39a33..dcf5b1c1a 100644
--- 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;
+}}
+
diff --git a/include/items.php b/include/items.php
index b5bdd7833..153debd7d 100644
--- a/include/items.php
+++ b/include/items.php
@@ -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";
diff --git a/mod/display.php b/mod/display.php
index b07e1aee5..03003f3c0 100644
--- a/mod/display.php
+++ b/mod/display.php
@@ -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,
diff --git a/mod/item.php b/mod/item.php
index 2cc2b9eb2..5bb4b1b73 100644
--- a/mod/item.php
+++ b/mod/item.php
@@ -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)
);
diff --git a/mod/network.php b/mod/network.php
index f09b302e9..3658c601e 100644
--- a/mod/network.php
+++ b/mod/network.php
@@ -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,
diff --git a/mod/profile.php b/mod/profile.php
index 57abc479d..0723d64fb 100644
--- a/mod/profile.php
+++ b/mod/profile.php
@@ -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,
diff --git a/view/de/wallwall_item.tpl b/view/de/wallwall_item.tpl
index fd05a74ac..67b6006cf 100644
--- a/view/de/wallwall_item.tpl
+++ b/view/de/wallwall_item.tpl
@@ -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>
diff --git a/view/en/wallwall_item.tpl b/view/en/wallwall_item.tpl
index f8affd1c5..9c6ad6070 100644
--- a/view/en/wallwall_item.tpl
+++ b/view/en/wallwall_item.tpl
@@ -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>
diff --git a/view/fr/wallwall_item.tpl b/view/fr/wallwall_item.tpl
index f8affd1c5..9c6ad6070 100644
--- a/view/fr/wallwall_item.tpl
+++ b/view/fr/wallwall_item.tpl
@@ -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>
diff --git a/view/it/wallwall_item.tpl b/view/it/wallwall_item.tpl
index bc2d3f2ec..3c7883fc8 100644
--- a/view/it/wallwall_item.tpl
+++ b/view/it/wallwall_item.tpl
@@ -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>
diff --git a/view/theme/duepuntozero/style.css b/view/theme/duepuntozero/style.css
index ac3562d1c..e3a5fd3e7 100644
--- a/view/theme/duepuntozero/style.css
+++ b/view/theme/duepuntozero/style.css
@@ -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;
diff --git a/view/theme/loozah/style.css b/view/theme/loozah/style.css
index a87252016..d34c81a45 100644
--- a/view/theme/loozah/style.css
+++ b/view/theme/loozah/style.css
@@ -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;
diff --git a/view/wall_item.tpl b/view/wall_item.tpl
index 67fce4152..b9f27ed4a 100644
--- a/view/wall_item.tpl
+++ b/view/wall_item.tpl
@@ -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>