aboutsummaryrefslogtreecommitdiffstats
path: root/mod/item.php
diff options
context:
space:
mode:
authorFriendika <info@friendika.com>2011-03-18 00:30:34 -0700
committerFriendika <info@friendika.com>2011-03-18 00:30:34 -0700
commit9f5201dcaa4737427da7ec37969556c574e4711f (patch)
treea47c58b36c8399921e261bfaa0387f2b14edaa67 /mod/item.php
parentea03d9fa86827cbc7e86885bbe2493d8a9739546 (diff)
downloadvolse-hubzilla-9f5201dcaa4737427da7ec37969556c574e4711f.tar.gz
volse-hubzilla-9f5201dcaa4737427da7ec37969556c574e4711f.tar.bz2
volse-hubzilla-9f5201dcaa4737427da7ec37969556c574e4711f.zip
edit posting after submission
Diffstat (limited to 'mod/item.php')
-rw-r--r--mod/item.php48
1 files changed, 47 insertions, 1 deletions
diff --git a/mod/item.php b/mod/item.php
index 6e6e822d0..511e26809 100644
--- a/mod/item.php
+++ b/mod/item.php
@@ -51,7 +51,7 @@ function item_post(&$a) {
}
$profile_uid = ((x($_POST,'profile_uid')) ? intval($_POST['profile_uid']) : 0);
-
+ $post_id = ((x($_POST['post_id'])) ? intval($_POST['post_id']) : 0);
if(! can_write_wall($a,$profile_uid)) {
notice( t('Permission denied.') . EOL) ;
@@ -151,6 +151,35 @@ function item_post(&$a) {
}
}
+ // is this an edited post?
+
+ $orig_post = null;
+
+ if($post_id) {
+ $i = q("SELECT * FROM `item` WHERE `uid` = %d AND `id` = %d LIMIT 1",
+ intval($profile_uid),
+ intval($post_id)
+ );
+ if(! count($i))
+ killme();
+ $orig_post = $i[0];
+ }
+
+ if($orig_post) {
+ $str_group_allow = $orig_post['allow_gid'];
+ $str_contact_allow = $orig_post['allow_cid'];
+ $str_group_deny = $orig_post['deny_gid'];
+ $str_contact_deny = $orig_post['deny_cid'];
+ $private = $orig_post['private'];
+ $title = $orig_post['title'];
+ $location = $orig_post['location'];
+ $coord = $orig_post['coord'];
+ $verb = $orig_post['verb'];
+ $emailcc = $orig_post['emailcc'];
+
+ $body = escape_tags(trim($_POST['body']));
+ }
+
/**
*
@@ -294,8 +323,25 @@ function item_post(&$a) {
}
+ if($orig_post) {
+ $r = q("UPDATE `item` SET `body` = '%s', `edited` = '%s' WHERE `id` = %d AND `uid` = %d LIMIT 1",
+ dbesc($body),
+ dbesc(datetime_convert()),
+ intval($post_id),
+ intval($profile_uid)
+ );
+ proc_run('php', "include/notifier.php", 'edit_post', "$post_id");
+ if((x($_POST,'return')) && strlen($_POST['return'])) {
+ logger('return: ' . $_POST['return']);
+ goaway($a->get_baseurl() . "/" . $_POST['return'] );
+ }
+ killme();
+ }
+
+ $post_id = 0;
$wall = 0;
+
if($post_type === 'wall' || $post_type === 'wall-comment')
$wall = 1;