`network` char(4) NOT NULL DEFAULT '' COMMENT 'Network from where the item comes from',
`rendered-hash` varchar(32) NOT NULL DEFAULT '' COMMENT '',
`rendered-html` mediumtext COMMENT 'item.body converted to html',
+ `global` boolean NOT NULL DEFAULT '0' COMMENT '',
PRIMARY KEY(`id`),
INDEX `guid` (`guid`(191)),
INDEX `uri` (`uri`(191)),
$r = dba::p(
"SELECT ".item_fieldlists()."
FROM `item` ".item_joins(api_user())."
- WHERE ".item_condition()." AND (`item`.`uid` = 0 OR (`item`.`uid` = ? AND NOT `item`.`public`))
+ WHERE ".item_condition()." AND (`item`.`uid` = 0 OR (`item`.`uid` = ? AND NOT `item`.`global`))
AND `item`.`body` LIKE CONCAT('%',?,'%')
$sql_extra
AND `item`.`id`>?
$sql_extra = ' AND `item`.`id` <= ' . intval($max_id);
}
- $r = q("SELECT `item`.`*` FROM `item`
+ $r = q("SELECT `item`.* FROM `item`
STRAIGHT_JOIN `contact` ON `contact`.`id` = `item`.`contact-id`
AND (NOT `contact`.`blocked` OR `contact`.`pending`)
WHERE `item`.`parent` = %d AND `item`.`visible`
"network" => ["type" => "char(4)", "not null" => "1", "default" => "", "comment" => "Network from where the item comes from"],
"rendered-hash" => ["type" => "varchar(32)", "not null" => "1", "default" => "", "comment" => ""],
"rendered-html" => ["type" => "mediumtext", "comment" => "item.body converted to html"],
+ "global" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
],
"indexes" => [
"PRIMARY" => ["id"],
}
}
+ // Is this item available in the global items (with uid=0)?
+ if ($item["uid"] == 0) {
+ $item["global"] = true;
+
+ // Set the global flag on all items if this was a global item entry
+ dba::update('item', ['global' => true], ['uri' => $item["uri"]]);
+ } else {
+ $item["global"] = dba::exists('item', ['uid' => 0, 'uri' => $item["uri"]]);
+ }
+
// ACL settings
if (strlen($allow_cid) || strlen($allow_gid) || strlen($deny_cid) || strlen($deny_gid)) {
$private = 1;