From 528d795fb68a8ae53cb7b9ad8479aeaa2b1f975f Mon Sep 17 00:00:00 2001 From: friendica Date: Thu, 22 Mar 2012 16:17:10 -0700 Subject: ability to change tags in edited posts --- mod/item.php | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) (limited to 'mod/item.php') diff --git a/mod/item.php b/mod/item.php index ee6c5c9a7..fc1c5fd0f 100755 --- a/mod/item.php +++ b/mod/item.php @@ -177,10 +177,11 @@ function item_post(&$a) { $verb = $orig_post['verb']; $emailcc = $orig_post['emailcc']; $app = $orig_post['app']; - + $categories = $orig_post['file']; $body = escape_tags(trim($_REQUEST['body'])); $private = $orig_post['private']; $pubmail_enable = $orig_post['pubmail']; + } else { @@ -213,8 +214,10 @@ function item_post(&$a) { $coord = notags(trim($_REQUEST['coord'])); $verb = notags(trim($_REQUEST['verb'])); $emailcc = notags(trim($_REQUEST['emailcc'])); - $body = escape_tags(trim($_REQUEST['body'])); + + // $categories = TODO + $private = ((strlen($str_group_allow) || strlen($str_contact_allow) || strlen($str_group_deny) || strlen($str_contact_deny)) ? 1 : 0); if(($parent_item) && @@ -242,8 +245,6 @@ function item_post(&$a) { } } - - if(! strlen($body)) { if($preview) killme(); @@ -500,6 +501,7 @@ function item_post(&$a) { $datarray['location'] = $location; $datarray['coord'] = $coord; $datarray['tag'] = $str_tags; + $datarray['file'] = $categories; $datarray['inform'] = $inform; $datarray['verb'] = $verb; $datarray['allow_cid'] = $str_contact_allow; @@ -559,9 +561,12 @@ function item_post(&$a) { if($orig_post) { - $r = q("UPDATE `item` SET `title` = '%s', `body` = '%s', `edited` = '%s' WHERE `id` = %d AND `uid` = %d LIMIT 1", - dbesc($title), - dbesc($body), + $r = q("UPDATE `item` SET `title` = '%s', `body` = '%s', `tag` = '%s', `attach` = '%s', `file` = '%s', `edited` = '%s' WHERE `id` = %d AND `uid` = %d LIMIT 1", + dbesc($datarray['title']), + dbesc($datarray['body']), + dbesc($datarray['tag']), + dbesc($datarray['attach']), + dbesc($datarray['file']), dbesc(datetime_convert()), intval($post_id), intval($profile_uid) -- cgit v1.2.3 From ca1e2254c9bbad75d4fa479a6ad7b5f38386a7ef Mon Sep 17 00:00:00 2001 From: Michael Johnston Date: Sun, 25 Mar 2012 16:00:11 -0400 Subject: typo datarry -> datarray --- 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 fc1c5fd0f..5baae2bde 100755 --- a/mod/item.php +++ b/mod/item.php @@ -624,7 +624,7 @@ function item_post(&$a) { dbesc($datarray['attach']), intval($datarray['bookmark']), intval($datarray['origin']), - intval($datarry['moderated']) + intval($datarray['moderated']) ); $r = q("SELECT `id` FROM `item` WHERE `uri` = '%s' LIMIT 1", -- cgit v1.2.3 From b18086097e6ffd6f8b456ac27af1de16ad2977a1 Mon Sep 17 00:00:00 2001 From: friendica Date: Wed, 28 Mar 2012 03:18:26 -0700 Subject: title not updated when editing post --- 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 5baae2bde..24730f53e 100755 --- a/mod/item.php +++ b/mod/item.php @@ -171,13 +171,13 @@ function item_post(&$a) { $str_contact_allow = $orig_post['allow_cid']; $str_group_deny = $orig_post['deny_gid']; $str_contact_deny = $orig_post['deny_cid']; - $title = $orig_post['title']; $location = $orig_post['location']; $coord = $orig_post['coord']; $verb = $orig_post['verb']; $emailcc = $orig_post['emailcc']; $app = $orig_post['app']; $categories = $orig_post['file']; + $title = notags(trim($_REQUEST['title'])); $body = escape_tags(trim($_REQUEST['body'])); $private = $orig_post['private']; $pubmail_enable = $orig_post['pubmail']; -- cgit v1.2.3 From 581b54c974a9b9a050a8a0b9a17a19bd41b1f2f5 Mon Sep 17 00:00:00 2001 From: Michael Johnston Date: Sun, 1 Apr 2012 21:28:31 -0400 Subject: allow users to set categories on their posts --- mod/item.php | 30 ++++++++++++++++++++++++------ 1 file changed, 24 insertions(+), 6 deletions(-) (limited to 'mod/item.php') diff --git a/mod/item.php b/mod/item.php index 24730f53e..72e63865b 100755 --- a/mod/item.php +++ b/mod/item.php @@ -216,8 +216,6 @@ function item_post(&$a) { $emailcc = notags(trim($_REQUEST['emailcc'])); $body = escape_tags(trim($_REQUEST['body'])); - // $categories = TODO - $private = ((strlen($str_group_allow) || strlen($str_contact_allow) || strlen($str_group_deny) || strlen($str_contact_deny)) ? 1 : 0); if(($parent_item) && @@ -255,6 +253,19 @@ function item_post(&$a) { } } + if(strlen($categories)) { + // get the "fileas" tags for this post + $filedas = file_tag_file_to_list($categories, 'file'); + } + // save old and new categories, so we can determine what needs to be deleted from pconfig + $categories_old = $categories; + $categories = file_tag_list_to_file(trim($_REQUEST['category']), 'category'); + $categories_new = $categories; + if(strlen($filedas)) { + // append the fileas stuff to the new categories list + $categories .= file_tag_list_to_file($filedas, 'file'); + } + // Work around doubled linefeeds in Tinymce 3.5b2 // First figure out if it's a status post that would've been // created using tinymce. Otherwise leave it alone. @@ -572,6 +583,9 @@ function item_post(&$a) { intval($profile_uid) ); + // update filetags in pconfig + file_tag_update_pconfig($uid,$categories_old,$categories_new,'category'); + proc_run('php', "include/notifier.php", 'edit_post', "$post_id"); if((x($_REQUEST,'return')) && strlen($return_path)) { logger('return: ' . $return_path); @@ -585,8 +599,8 @@ function item_post(&$a) { $r = q("INSERT INTO `item` (`guid`, `uid`,`type`,`wall`,`gravity`,`contact-id`,`owner-name`,`owner-link`,`owner-avatar`, `author-name`, `author-link`, `author-avatar`, `created`, `edited`, `commented`, `received`, `changed`, `uri`, `thr-parent`, `title`, `body`, `app`, `location`, `coord`, - `tag`, `inform`, `verb`, `postopts`, `allow_cid`, `allow_gid`, `deny_cid`, `deny_gid`, `private`, `pubmail`, `attach`, `bookmark`,`origin`, `moderated` ) - VALUES( '%s', %d, '%s', %d, %d, %d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d, %d, '%s', %d, %d, %d )", + `tag`, `inform`, `verb`, `postopts`, `allow_cid`, `allow_gid`, `deny_cid`, `deny_gid`, `private`, `pubmail`, `attach`, `bookmark`,`origin`, `moderated`, `file` ) + VALUES( '%s', %d, '%s', %d, %d, %d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d, %d, '%s', %d, %d, %d, '%s' )", dbesc($datarray['guid']), intval($datarray['uid']), dbesc($datarray['type']), @@ -624,8 +638,9 @@ function item_post(&$a) { dbesc($datarray['attach']), intval($datarray['bookmark']), intval($datarray['origin']), - intval($datarray['moderated']) - ); + intval($datarray['moderated']), + dbesc($datarray['file']) + ); $r = q("SELECT `id` FROM `item` WHERE `uri` = '%s' LIMIT 1", dbesc($datarray['uri'])); @@ -633,6 +648,9 @@ function item_post(&$a) { $post_id = $r[0]['id']; logger('mod_item: saved item ' . $post_id); + // update filetags in pconfig + file_tag_update_pconfig($uid,$categories_old,$categories_new,'category'); + if($parent) { // This item is the last leaf and gets the comment box, clear any ancestors -- cgit v1.2.3