true ])); $item['mimetype'] = 'text/plain'; $item['plink'] = z_root() . '/' . str_replace('doc','help',$s); $item['owner_xchan'] = $item['author_xchan'] = $sys['channel_hash']; $item['item_type'] = ITEM_TYPE_DOC; $r = q("select item.* from item left join iconfig on item.id = iconfig.iid where iconfig.cat = 'system' and iconfig.k = 'docfile' and iconfig.v = '%s' and item_type = %d limit 1", dbesc($s), intval(ITEM_TYPE_DOC) ); \Zotlabs\Lib\IConfig::Set($item,'system','docfile',$s); if($r) { $item['id'] = $r[0]['id']; $item['mid'] = $item['parent_mid'] = $r[0]['mid']; $x = item_store_update($item); } else { $item['uuid'] = item_message_id(); $item['mid'] = $item['parent_mid'] = z_root() . '/item/' . $item['uuid']; $x = item_store($item); } return $x; }