From 9f020573748af28cc09cbde18e96cfc68641ce7b Mon Sep 17 00:00:00 2001 From: Friendika Date: Wed, 16 Feb 2011 02:07:11 -0800 Subject: provide permalink for posts, include permalinks in feeds and imported from feeds --- mod/item.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'mod/item.php') 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) ); -- cgit v1.2.3 From d6998ffef2277eefc6a48c2371cc3c6077102bf5 Mon Sep 17 00:00:00 2001 From: Friendika Date: Wed, 16 Feb 2011 13:19:54 -0800 Subject: small fixes --- mod/item.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'mod/item.php') diff --git a/mod/item.php b/mod/item.php index 5bb4b1b73..21dfb4560 100644 --- a/mod/item.php +++ b/mod/item.php @@ -545,7 +545,7 @@ function item_content(&$a) { // generate a resource-id and therefore aren't intimately linked to the item. if(strlen($item['resource-id'])) { - $q("DELETE FROM `photo` WHERE `resource-id` = '%s' AND `uid` = %d ", + q("DELETE FROM `photo` WHERE `resource-id` = '%s' AND `uid` = %d ", dbesc($item['resource-id']), intval($item['uid']) ); -- cgit v1.2.3 From c397a2f89bf3c2c609852f5bfc618c1d0cb0b709 Mon Sep 17 00:00:00 2001 From: Friendika Date: Wed, 16 Feb 2011 20:25:10 -0800 Subject: properly handle error returns in post w/ajax --- mod/item.php | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'mod/item.php') diff --git a/mod/item.php b/mod/item.php index 21dfb4560..cbdd11eb9 100644 --- a/mod/item.php +++ b/mod/item.php @@ -35,7 +35,9 @@ function item_post(&$a) { ); if(! count($r)) { notice( t('Unable to locate original post.') . EOL); - goaway($a->get_baseurl() . "/" . $_POST['return'] ); + if(x($_POST,'return')) + goaway($a->get_baseurl() . "/" . $_POST['return'] ); + killme(); } $parent_item = $r[0]; if($parent_item['contact-id'] && $uid) { @@ -53,7 +55,9 @@ function item_post(&$a) { if(! can_write_wall($a,$profile_uid)) { notice( t('Permission denied.') . EOL) ; - return; + if(x($_POST,'return')) + goaway($a->get_baseurl() . "/" . $_POST['return'] ); + killme(); } $user = null; @@ -92,8 +96,9 @@ function item_post(&$a) { if(! strlen($body)) { notice( t('Empty post discarded.') . EOL ); - goaway($a->get_baseurl() . "/" . $_POST['return'] ); - + if(x($_POST,'return')) + goaway($a->get_baseurl() . "/" . $_POST['return'] ); + killme(); } // get contact info for poster -- cgit v1.2.3