diff options
author | Michael Vogel <icarus@dabo.de> | 2012-06-04 08:09:15 +0200 |
---|---|---|
committer | Michael Vogel <icarus@dabo.de> | 2012-06-04 08:09:15 +0200 |
commit | 0353410cd4b8153fd2b6e9d3524c6e46ad4acd68 (patch) | |
tree | e93cc7977a7367eb6281c733d9a34730dae3bf95 /mod/item.php | |
parent | 5de91c2a7c924ac6067828a0e5bfbef5572c1f39 (diff) | |
parent | ca105f1c669950768a1f4cd6b93f471cabbc5114 (diff) | |
download | volse-hubzilla-0353410cd4b8153fd2b6e9d3524c6e46ad4acd68.tar.gz volse-hubzilla-0353410cd4b8153fd2b6e9d3524c6e46ad4acd68.tar.bz2 volse-hubzilla-0353410cd4b8153fd2b6e9d3524c6e46ad4acd68.zip |
Merge remote branch 'upstream/master'
Diffstat (limited to 'mod/item.php')
-rw-r--r-- | mod/item.php | 47 |
1 files changed, 30 insertions, 17 deletions
diff --git a/mod/item.php b/mod/item.php index df242d6f7..c1c0b14ec 100644 --- a/mod/item.php +++ b/mod/item.php @@ -262,17 +262,17 @@ function item_post(&$a) { } } - if(strlen($categories)) { - // get the "fileas" tags for this post - $filedas = file_tag_file_to_list($categories, 'file'); + 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'); + // 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 @@ -453,6 +453,7 @@ function item_post(&$a) { $tagged = array(); + $private_forum = false; if(count($tags)) { foreach($tags as $tag) { @@ -471,11 +472,22 @@ function item_post(&$a) { continue; $success = handle_tag($a, $body, $inform, $str_tags, (local_user()) ? local_user() : $profile_uid , $tag); - if($success) + if($success['replaced']) $tagged[] = $tag; + if(is_array($success['contact']) && intval($success['contact']['prv'])) { + $private_forum = true; + $private_id = $success['contact']['id']; + } } } + if(($private_forum) && (! $parent) && (! $private)) { + // we tagged a private forum in a top level post and the message was public. + // Restrict it. + $private = 1; + $str_contact_allow = '<' . $private_id . '>'; + } + $attachments = ''; $match = false; @@ -725,16 +737,16 @@ function item_post(&$a) { if($datarray['verb'] === ACTIVITY_LIKE) $signed_text = $datarray['guid'] . ';' . 'Post' . ';' . $parent_item['guid'] . ';' . 'true' . ';' . $myaddr; else - $signed_text = $datarray['guid'] . ';' . $parent_item['guid'] . ';' . $signed_body . ';' . $myaddr; + $signed_text = $datarray['guid'] . ';' . $parent_item['guid'] . ';' . $signed_body . ';' . $myaddr; $authorsig = base64_encode(rsa_sign($signed_text,$a->user['prvkey'],'sha256')); q("insert into sign (`iid`,`signed_text`,`signature`,`signer`) values (%d,'%s','%s','%s') ", intval($post_id), - dbesc($signed_text), - dbesc(base64_encode($authorsig)), - dbesc($myaddr) - ); + dbesc($signed_text), + dbesc(base64_encode($authorsig)), + dbesc($myaddr) + ); } } else { @@ -893,6 +905,7 @@ function item_content(&$a) { function handle_tag($a, &$body, &$inform, &$str_tags, $profile_uid, $tag) { $replaced = false; + $r = null; //is it a hash tag? if(strpos($tag,'#') === 0) { @@ -1023,5 +1036,5 @@ function handle_tag($a, &$body, &$inform, &$str_tags, $profile_uid, $tag) { } } - return $replaced; + return array('replaced' => $replaced, 'contact' => $r[0]); } |