diff options
Diffstat (limited to 'mod/item.php')
-rw-r--r-- | mod/item.php | 53 |
1 files changed, 40 insertions, 13 deletions
diff --git a/mod/item.php b/mod/item.php index 164b345f0..5ddafb709 100644 --- a/mod/item.php +++ b/mod/item.php @@ -262,28 +262,48 @@ function item_post(&$a) { if($orig_post) { - $str_group_allow = ((array_key_exists('group_allow',$_REQUEST)) - ? perms2str($_REQUEST['group_allow']) : $orig_post['allow_gid']); - $str_contact_allow = ((array_key_exists('contact_allow',$_REQUEST)) - ? perms2str($_REQUEST['contact_allow']) : $orig_post['allow_cid']); - $str_group_deny = ((array_key_exists('group_deny',$_REQUEST)) - ? perms2str($_REQUEST['group_deny']) : $orig_post['deny_gid']); - $str_contact_deny = ((array_key_exists('contact_deny',$_REQUEST)) - ? perms2str($_REQUEST['contact_deny']) : $orig_post['deny_cid']); + $private = 0; + // webpages are allowed to change ACLs after the fact. Normal conversation items aren't. + if($webpage) { + $str_group_allow = perms2str($_REQUEST['group_allow']); + $str_contact_allow = perms2str($_REQUEST['contact_allow']); + $str_group_deny = perms2str($_REQUEST['group_deny']); + $str_contact_deny = perms2str($_REQUEST['contact_deny']); + } + else { + $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']; + } + + if((strlen($str_group_allow)) + || strlen($str_contact_allow) + || strlen($str_group_deny) + || strlen($str_contact_deny)) { + $private = 1; + } + $location = $orig_post['location']; $coord = $orig_post['coord']; $verb = $orig_post['verb']; $app = $orig_post['app']; $title = $_REQUEST['title']; $body = $_REQUEST['body']; - $private = $orig_post['item_private']; $item_flags = $orig_post['item_flags']; + + // force us to recalculate if we need to obscure this post + + if($item_flags & ITEM_OBSCURED) + $item_flags = ($item_flags ^ ITEM_OBSCURED); + $item_restrict = $orig_post['item_restrict']; $postopts = $orig_post['postopts']; $created = $orig_post['created']; $mid = $orig_post['mid']; $parent_mid = $orig_post['parent_mid']; $plink = $orig_post['plink']; + } else { @@ -356,6 +376,7 @@ function item_post(&$a) { } } + $expires = '0000-00-00 00:00:00'; if(feature_enabled($profile_uid,'content_expire')) { @@ -376,6 +397,7 @@ function item_post(&$a) { $body = z_input_filter($profile_uid,$body,$mimetype); } + // Verify ability to use html or php!!! $execflag = false; @@ -397,6 +419,7 @@ function item_post(&$a) { } } + if($mimetype === 'text/bbcode') { // BBCODE alert: the following functions assume bbcode input @@ -440,6 +463,10 @@ function item_post(&$a) { $body = preg_replace_callback('/\[\$b64url(.*?)\[\/(url)\]/ism','red_unescape_codeblock',$body); $body = preg_replace_callback('/\[\$b64code(.*?)\[\/(code)\]/ism','red_unescape_codeblock',$body); + // fix any img tags that should be zmg + + $body = preg_replace_callback('/\[img(.*?)\](.*?)\[\/img\]/ism','red_zrlify_img_callback',$body); + /** * @@ -488,6 +515,7 @@ function item_post(&$a) { $body = scale_external_images($body,false); + /** * Look for any tags and linkify them */ @@ -578,7 +606,6 @@ function item_post(&$a) { // BBCODE end alert - if(strlen($categories)) { $cats = explode(',',$categories); foreach($cats as $cat) { @@ -847,10 +874,10 @@ function item_content(&$a) { require_once('include/security.php'); if((argc() == 3) && (argv(1) === 'drop') && intval(argv(2))) { + require_once('include/items.php'); - $i = q("select id, uid, author_xchan, owner_xchan, source_xchan, item_restrict from item where id = %d and uid = %d limit 1", - intval(argv(2)), - intval(local_user()) + $i = q("select id, uid, author_xchan, owner_xchan, source_xchan, item_restrict from item where id = %d limit 1", + intval(argv(2)) ); if($i) { |