provide permalink for posts, include permalinks in feeds and imported from feeds

This commit is contained in:
Friendika 2011-02-16 02:07:11 -08:00
parent c5f5102396
commit 9f02057374
13 changed files with 35 additions and 3 deletions

View File

@ -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;
}}

View 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";

View 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,

View 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)
);

View 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,

View 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,

View 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>

View 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>

View 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>

View 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>

View 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;

View 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;

View 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>