diff options
Diffstat (limited to 'mod/item.php')
-rw-r--r-- | mod/item.php | 60 |
1 files changed, 12 insertions, 48 deletions
diff --git a/mod/item.php b/mod/item.php index dc8ee5015..c504c77e1 100644 --- a/mod/item.php +++ b/mod/item.php @@ -44,7 +44,7 @@ function item_post(&$a) { call_hooks('post_local_start', $_REQUEST); -// logger('postvars ' . print_r($_REQUEST,true), LOGGER_DATA); + logger('postvars ' . print_r($_REQUEST,true), LOGGER_DATA); $api_source = ((x($_REQUEST,'api_source') && $_REQUEST['api_source']) ? true : false); @@ -130,15 +130,14 @@ function item_post(&$a) { //if(($parid) && ($parid != $parent)) $thr_parent = $parent_mid; -// if($parent_item['contact-id'] && $uid) { -// $r = q("SELECT * FROM `contact` WHERE `id` = %d AND `uid` = %d LIMIT 1", -// intval($parent_item['contact-id']), -// intval($uid) -// ); -// if(count($r)) -// $parent_contact = $r[0]; -// } - + if($parent_item['contact-id'] && $uid) { + $r = q("SELECT * FROM `contact` WHERE `id` = %d AND `uid` = %d LIMIT 1", + intval($parent_item['contact-id']), + intval($uid) + ); + if(count($r)) + $parent_contact = $r[0]; + } } if($parent) { @@ -204,10 +203,6 @@ function item_post(&$a) { goaway($a->get_baseurl() . "/" . $return_path ); killme(); } - - if($observer) { - logger('mod_item: post accepted from ' . $observer['xchan_name'] . ' for ' . $owner_xchan['xchan_name'], LOGGER_DEBUG); - } if($orig_post) { @@ -338,6 +333,8 @@ function item_post(&$a) { $body .= "\n\n@group+" . $x[0]['abook_id'] . "\n"; } + + /** * fix naked links by passing through a callback to see if this is a red site * (already known to us) which will get a zrl, otherwise link with url @@ -583,22 +580,6 @@ function item_post(&$a) { } - if(mb_strlen($datarray['title']) > 255) - $datarray['title'] = mb_substr($datarray['title'],0,255); - - if(array_key_exists('item_private',$datarray) && $datarray['item_private']) { - logger('Encrypting local storage'); - $key = get_config('system','pubkey'); - $datarray['item_flags'] = $datarray['item_flags'] | ITEM_OBSCURED; - if($datarray['title']) - $datarray['title'] = json_encode(aes_encapsulate($datarray['title'],$key)); - if($datarray['body']) - $datarray['body'] = json_encode(aes_encapsulate($datarray['body'],$key)); - } - - - - if($orig_post) { $r = q("UPDATE `item` SET `title` = '%s', `body` = '%s', `attach` = '%s', `edited` = '%s' WHERE `id` = %d AND `uid` = %d LIMIT 1", dbesc($datarray['title']), @@ -621,23 +602,6 @@ function item_post(&$a) { ); - if(count($post_tags)) { - foreach($post_tags as $tag) { - if(strlen(trim($tag['term']))) { - q("insert into term (uid,oid,otype,type,term,url) values (%d,%d,%d,%d,'%s','%s')", - intval($tag['uid']), - intval($post_id), - intval($tag['otype']), - intval($tag['type']), - dbesc(trim($tag['term'])), - dbesc(trim($tag['url'])) - ); - } - } - } - - - proc_run('php', "include/notifier.php", 'edit_post', $post_id); if((x($_REQUEST,'return')) && strlen($return_path)) { logger('return: ' . $return_path); @@ -684,7 +648,7 @@ function item_post(&$a) { dbesc($parent_item['allow_gid']), dbesc($parent_item['deny_cid']), dbesc($parent_item['deny_gid']), - intval($parent_item['item_private']), + intval($parent_item['private']), intval($post_id) ); |