aboutsummaryrefslogtreecommitdiffstats
path: root/mod/item.php
diff options
context:
space:
mode:
Diffstat (limited to 'mod/item.php')
-rw-r--r--mod/item.php60
1 files changed, 48 insertions, 12 deletions
diff --git a/mod/item.php b/mod/item.php
index c504c77e1..dc8ee5015 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,14 +130,15 @@ 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) {
@@ -203,6 +204,10 @@ 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) {
@@ -333,8 +338,6 @@ 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
@@ -580,6 +583,22 @@ 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']),
@@ -602,6 +621,23 @@ 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);
@@ -648,7 +684,7 @@ function item_post(&$a) {
dbesc($parent_item['allow_gid']),
dbesc($parent_item['deny_cid']),
dbesc($parent_item['deny_gid']),
- intval($parent_item['private']),
+ intval($parent_item['item_private']),
intval($post_id)
);