diff options
author | redmatrix <redmatrix@redmatrix.me> | 2015-09-08 22:46:34 -0700 |
---|---|---|
committer | redmatrix <redmatrix@redmatrix.me> | 2015-09-08 22:46:34 -0700 |
commit | 0a051ff2cd13eb33ecffc3c4e34a1a56a3fcf29a (patch) | |
tree | a698e3b4ce0721b5824d141868316ce81d6572a9 /include/items.php | |
parent | d702133ded36f23a79f7aed22c7d20ad263cff7b (diff) | |
download | volse-hubzilla-0a051ff2cd13eb33ecffc3c4e34a1a56a3fcf29a.tar.gz volse-hubzilla-0a051ff2cd13eb33ecffc3c4e34a1a56a3fcf29a.tar.bz2 volse-hubzilla-0a051ff2cd13eb33ecffc3c4e34a1a56a3fcf29a.zip |
preserve code blocks on item import if channel has code rights. When importing the channel itself,
turn code access off unless this is the admin.
Diffstat (limited to 'include/items.php')
-rwxr-xr-x | include/items.php | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/include/items.php b/include/items.php index 4c21d55a1..28fd8502b 100755 --- a/include/items.php +++ b/include/items.php @@ -833,10 +833,13 @@ function title_is_body($title, $body) { } -function get_item_elements($x) { +function get_item_elements($x,$allow_code = false) { $arr = array(); - $arr['body'] = (($x['body']) ? htmlspecialchars($x['body'],ENT_COMPAT,'UTF-8',false) : ''); + if($allow_code) + $arr['body'] = $x['body']; + else + $arr['body'] = (($x['body']) ? htmlspecialchars($x['body'],ENT_COMPAT,'UTF-8',false) : ''); $key = get_config('system','pubkey'); @@ -4731,6 +4734,12 @@ function items_fetch($arr,$channel = null,$observer_hash = null,$client_mode = C if($arr['wall']) $sql_options .= " and item_wall = 1 "; + + if($arr['item_id']) + $sql_options .= " and parent = " . intval($arr['item_id']) . " "; + + if($arr['mid']) + $sql_options .= " and parent_mid = '" . dbesc($arr['mid']) . "' "; $sql_extra = " AND item.parent IN ( SELECT parent FROM item WHERE item_thread_top = 1 $sql_options ) "; @@ -4857,11 +4866,15 @@ function items_fetch($arr,$channel = null,$observer_hash = null,$client_mode = C require_once('include/security.php'); $sql_extra .= item_permissions_sql($channel['channel_id'],$observer_hash); + if($arr['pages']) $item_restrict = " AND item_type = " . ITEM_TYPE_WEBPAGE . " "; else $item_restrict = " AND item_type = 0 "; + if($arr['item_type'] === '*') + $item_restrict = ''; + if ($arr['nouveau'] && ($client_mode & CLIENT_MODE_LOAD) && $channel) { // "New Item View" - show all items unthreaded in reverse created date order |