From 9f020573748af28cc09cbde18e96cfc68641ce7b Mon Sep 17 00:00:00 2001 From: Friendika Date: Wed, 16 Feb 2011 02:07:11 -0800 Subject: [PATCH] provide permalink for posts, include permalinks in feeds and imported from feeds --- boot.php | 8 ++++++++ include/items.php | 5 +++-- mod/display.php | 1 + mod/item.php | 3 ++- mod/network.php | 1 + mod/profile.php | 1 + view/de/wallwall_item.tpl | 1 + view/en/wallwall_item.tpl | 1 + view/fr/wallwall_item.tpl | 1 + view/it/wallwall_item.tpl | 1 + view/theme/duepuntozero/style.css | 7 +++++++ view/theme/loozah/style.css | 7 +++++++ view/wall_item.tpl | 1 + 13 files changed, 35 insertions(+), 3 deletions(-) diff --git a/boot.php b/boot.php index 3dff39a338..dcf5b1c1aa 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'])) ? '' : ''); + return $plink; +}} + diff --git a/include/items.php b/include/items.php index b5bdd78335..153debd7d3 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 .= '' . xmlify(datetime_convert('UTC','UTC',$item['edited'] . '+00:00',ATOM_TIME)) . '' . "\r\n"; $o .= '' . base64url_encode($item['body'], true) . '' . "\r\n"; $o .= '' . xmlify(($type === 'html') ? bbcode($item['body']) : $item['body']) . '' . "\r\n"; - $o .= '' . "\r\n"; + $o .= '' . "\r\n"; if($comment) $o .= '' . intval($item['last-child']) . '' . "\r\n"; diff --git a/mod/display.php b/mod/display.php index b07e1aee57..03003f3c0c 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 2cc2b9eb2c..5bb4b1b73c 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 f09b302e9b..3658c601e3 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 57abc479d7..0723d64fb8 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 fd05a74ace..67b6006cf0 100644 --- a/view/de/wallwall_item.tpl +++ b/view/de/wallwall_item.tpl @@ -21,6 +21,7 @@
$title
$body
+ $plink $drop
diff --git a/view/en/wallwall_item.tpl b/view/en/wallwall_item.tpl index f8affd1c56..9c6ad60708 100644 --- a/view/en/wallwall_item.tpl +++ b/view/en/wallwall_item.tpl @@ -21,6 +21,7 @@
$title
$body
+ $plink $drop
diff --git a/view/fr/wallwall_item.tpl b/view/fr/wallwall_item.tpl index f8affd1c56..9c6ad60708 100644 --- a/view/fr/wallwall_item.tpl +++ b/view/fr/wallwall_item.tpl @@ -21,6 +21,7 @@
$title
$body
+ $plink $drop
diff --git a/view/it/wallwall_item.tpl b/view/it/wallwall_item.tpl index bc2d3f2ecb..3c7883fc81 100644 --- a/view/it/wallwall_item.tpl +++ b/view/it/wallwall_item.tpl @@ -21,6 +21,7 @@
$title
$body
+ $plink $drop
diff --git a/view/theme/duepuntozero/style.css b/view/theme/duepuntozero/style.css index ac3562d1c0..e3a5fd3e72 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 a87252016f..d34c81a45d 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 67fce41526..b9f27ed4ad 100644 --- a/view/wall_item.tpl +++ b/view/wall_item.tpl @@ -16,6 +16,7 @@
$title
$body
+ $plink $drop