The Hubzilla
|
Items related functions. More...
Functions | |
collect_recipients ($item, &$private_envelope) | |
Collects recipients. More... | |
comments_are_now_closed ($item) | |
item_normal () | |
item_normal_search () | |
item_normal_update () | |
is_item_normal ($item) | |
This is a compatibility function primarily for plugins, because in earlier DB schemas this was a much simpler single integer compare. More... | |
can_comment_on_post ($observer_xchan, $item) | |
Decide if current observer has sufficient privileges to comment on item. More... | |
add_source_route ($iid, $hash) | |
Adds $hash to the item source route specified by $iid. More... | |
post_activity_item ($arr, $allow_code=false, $deliver=true) | |
Post an activity. More... | |
validate_item_elements ($message, $arr) | |
limit_body_size ($body) | |
Limit length on imported system messages. More... | |
title_is_body ($title, $body) | |
get_item_elements ($x, $allow_code=false) | |
import_author_xchan ($x) | |
import_author_rss ($x) | |
Imports an author from a RSS feed. More... | |
import_author_unknown ($x) | |
encode_item ($item, $mirror=false) | |
map_scope ($scope, $strip=false) | |
translate_scope ($scope) | |
Returns a descriptive text for a given $scope. More... | |
encode_item_xchan ($xchan) | |
encode_item_terms ($terms, $mirror=false) | |
encode_item_meta ($meta, $mirror=false) | |
decode_item_meta ($meta) | |
termtype ($t) | |
decode_tags ($t) | |
activity_sanitise ($arr) | |
Santise a potentially complex array. More... | |
array_sanitise ($arr) | |
Sanitise a simple linear array. More... | |
encode_item_flags ($item) | |
encode_mail ($item, $extended=false) | |
get_mail_elements ($x) | |
get_profile_elements ($x) | |
item_sign (&$item) | |
Signs an item body. More... | |
item_store ($arr, $allow_exec=false, $deliver=true) | |
Stores an item type record. More... | |
item_store_update ($arr, $allow_exec=false, $deliver=true) | |
Update a stored item. More... | |
send_status_notifications ($post_id, $item) | |
get_item_contact ($item, $contacts) | |
tag_deliver ($uid, $item_id) | |
Called when we deliver things that might be tagged in ways that require delivery processing. More... | |
tgroup_check ($uid, $item) | |
This function is called pre-deliver to see if a post matches the criteria to be tag delivered. More... | |
start_delivery_chain ($channel, $item, $item_id, $parent) | |
check_item_source ($uid, $item) | |
Checks to see if this item owner is referenced as a source for this channel and if the post matches the rules for inclusion in this channel. Returns true if we should create a second delivery chain and false if none of the rules apply, or if the item is private. More... | |
post_is_importable ($item, $abook) | |
mail_store ($arr) | |
fix_private_photos ($s, $uid, $item=null, $cid=0) | |
has_permissions ($obj) | |
compare_permissions ($obj1, $obj2) | |
enumerate_permissions ($obj) | |
Returns an array of contact-ids that are allowed to see this object. More... | |
item_getfeedtags ($item) | |
item_getfeedattach ($item) | |
item_expire ($uid, $days) | |
retain_item ($id) | |
drop_items ($items, $interactive=false, $stage=DROPITEM_NORMAL, $force=false) | |
drop_item ($id, $interactive=true, $stage=DROPITEM_NORMAL, $force=false) | |
delete_item_lowlevel ($item, $stage=DROPITEM_NORMAL, $force=false) | |
first_post_date ($uid, $wall=false) | |
Return the first post date. More... | |
list_post_dates ($uid, $wall, $mindate) | |
posted_dates ($uid, $wall) | |
fetch_post_tags ($items, $link=false) | |
Extend an item array with the associated tags of the posts. More... | |
zot_feed ($uid, $observer_hash, $arr) | |
items_fetch ($arr, $channel=null, $observer_hash=null, $client_mode=CLIENT_MODE_NORMAL, $module= 'network') | |
webpage_to_namespace ($webpage) | |
update_remote_id ($channel, $post_id, $webpage, $pagetitle, $namespace, $remote_id, $mid) | |
item_add_cid ($xchan_hash, $mid, $uid) | |
Change access control for item with message_id $mid and channel_id $uid. More... | |
item_remove_cid ($xchan_hash, $mid, $uid) | |
set_linkified_perms ($linkified, &$str_contact_allow, &$str_group_allow, $profile_uid, $parent_item=false, &$private) | |
comment_local_origin ($item) | |
send_profile_photo_activity ($channel, $photo, $profile) | |
sync_an_item ($channel_id, $item_id) | |
fix_attached_photo_permissions ($uid, $xchan_hash, $body, $str_contact_allow, $str_group_allow, $str_contact_deny, $str_group_deny) | |
fix_attached_file_permissions ($channel, $observer_hash, $body, $str_contact_allow, $str_group_allow, $str_contact_deny, $str_group_deny) | |
item_create_edit_activity ($post) | |
copy_of_pubitem ($channel, $mid) | |
copies an entire conversation from the pubstream to this channel's stream which will allow you to interact with it. More... | |
Items related functions.
activity_sanitise | ( | $arr | ) |
Santise a potentially complex array.
array | $arr |
Referenced by get_item_elements(), get_mail_elements(), item_store(), and item_store_update().
add_source_route | ( | $iid, | |
$hash | |||
) |
Adds $hash to the item source route specified by $iid.
$item['route'] contains a comma-separated list of xchans that sent the current message, somewhat analogous to the * Received: header line in email. We can use this to perform loop detection and to avoid sending a particular item to any "upstream" sender (they already have a copy because they sent it to us).
Modifies item in the database pointed to by $iid.
integer | $iid | item['id'] of target item |
string | $hash | xchan_hash of the channel that sent the item |
Referenced by process_delivery().
array_sanitise | ( | $arr | ) |
Sanitise a simple linear array.
array | $arr |
Referenced by get_profile_elements().
can_comment_on_post | ( | $observer_xchan, | |
$item | |||
) |
Decide if current observer has sufficient privileges to comment on item.
This function examines the comment_policy attached to an item and decides if the current observer has sufficient privileges to comment. This will normally be called on a remote site where perm_is_allowed() will not be suitable because the post owner does not have a local channel_id. Generally we should look at the item - in particular the author['abook_flags'] and see if ABOOK_FLAG_SELF is set. If it is, you should be able to use perm_is_allowed( ... 'post_comments'), and if it isn't you need to call can_comment_on_post() We also check the comments_closed date/time on the item if this is set.
string | $observer_xchan | |
array | $item |
Referenced by Zotlabs\Lib\ThreadStream\add_thread(), Zotlabs\Module\Like\get(), and Zotlabs\Module\Item\post().
check_item_source | ( | $uid, | |
$item | |||
) |
Checks to see if this item owner is referenced as a source for this channel and if the post matches the rules for inclusion in this channel. Returns true if we should create a second delivery chain and false if none of the rules apply, or if the item is private.
int | $uid | |
array | $item |
Referenced by process_delivery(), start_delivery_chain(), and tag_deliver().
collect_recipients | ( | $item, | |
& | $private_envelope | ||
) |
Collects recipients.
array | $item | ||
[out] | boolean | $private_envelope |
Referenced by Zotlabs\Daemon\Notifier\run().
comment_local_origin | ( | $item | ) |
We can't trust ITEM_ORIGIN to tell us if this is a local comment which needs to be relayed, because it was misconfigured at one point for several months and set for some remote items (in alternate delivery chains). This could cause looping, so use this hackish but accurate method.
array | $item |
Referenced by Zotlabs\Daemon\Notifier\run().
comments_are_now_closed | ( | $item | ) |
Referenced by Zotlabs\Lib\ThreadStream\add_thread(), can_comment_on_post(), and item_store().
compare_permissions | ( | $obj1, | |
$obj2 | |||
) |
Referenced by fix_private_photos().
copy_of_pubitem | ( | $channel, | |
$mid | |||
) |
copies an entire conversation from the pubstream to this channel's stream which will allow you to interact with it.
Referenced by Zotlabs\Module\React\get(), Zotlabs\Module\Tagger\get(), Zotlabs\Module\Subthread\get(), Zotlabs\Module\Like\get(), and Zotlabs\Module\Item\post().
decode_item_meta | ( | $meta | ) |
Referenced by get_item_elements().
decode_tags | ( | $t | ) |
array | $t |
Referenced by get_item_elements().
delete_item_lowlevel | ( | $item, | |
$stage = DROPITEM_NORMAL , |
|||
$force = false |
|||
) |
array | $item | |
int | $stage | |
boolean | $force |
Referenced by drop_item().
drop_item | ( | $id, | |
$interactive = true , |
|||
$stage = DROPITEM_NORMAL , |
|||
$force = false |
|||
) |
Referenced by attach_drop_photo(), channel_remove(), consume_feed(), contact_remove(), delete_imported_item(), Zotlabs\Lib\NativeWiki\delete_wiki(), drop_items(), Zotlabs\Module\Moderate\get(), Zotlabs\Module\Like\get(), Zotlabs\Module\Item\get(), item_expire(), process_feed_tombstones(), remove_all_xchan_resources(), Zotlabs\Daemon\Cron\run(), and Zotlabs\Daemon\Expire\run().
drop_items | ( | $items, | |
$interactive = false , |
|||
$stage = DROPITEM_NORMAL , |
|||
$force = false |
|||
) |
Referenced by Zotlabs\Lib\NativeWikiPage\delete_page(), and Zotlabs\Module\Item\post().
encode_item | ( | $item, | |
$mirror = false |
|||
) |
Referenced by api_network_stream(), api_photo_detail(), attach_export_data(), channel_export_items(), event_addtocal(), Zotlabs\Module\Moderate\get(), Zotlabs\Module\Tagger\get(), Zotlabs\Module\Search\get(), Zotlabs\Module\Item\get(), identity_basic_export(), identity_export_year(), Zotlabs\Module\Starred\init(), item_create_edit_activity(), Zotlabs\Module\Events\post(), Zotlabs\Module\Item\post(), red_item(), Zotlabs\Daemon\Cron\run(), Zotlabs\Daemon\Notifier\run(), Zotlabs\Lib\NativeWiki\sync_a_wiki_item(), sync_an_item(), and zot_feed().
encode_item_flags | ( | $item | ) |
Referenced by encode_item().
encode_item_meta | ( | $meta, | |
$mirror = false |
|||
) |
Referenced by encode_item().
encode_item_terms | ( | $terms, | |
$mirror = false |
|||
) |
Referenced by encode_item().
encode_item_xchan | ( | $xchan | ) |
array | $xchan |
Referenced by encode_item(), encode_mail(), and process_channel_sync_delivery().
encode_mail | ( | $item, | |
$extended = false |
|||
) |
enumerate_permissions | ( | $obj | ) |
Returns an array of contact-ids that are allowed to see this object.
object | $obj |
Referenced by compare_permissions(), and fix_private_photos().
fetch_post_tags | ( | $items, | |
$link = false |
|||
) |
Extend an item array with the associated tags of the posts.
array | $items | |
boolean | $link | (optional) default false |
Referenced by api_photo_detail(), attach_export_data(), channel_export_items(), copy_of_pubitem(), event_addtocal(), event_store_item(), Zotlabs\Module\Pubstream\get(), Zotlabs\Module\Moderate\get(), Zotlabs\Module\Article_edit\get(), Zotlabs\Module\Card_edit\get(), Zotlabs\Module\Editpost\get(), Zotlabs\Module\Search\get(), Zotlabs\Module\Display\get(), Zotlabs\Module\Block\get(), Zotlabs\Module\Articles\get(), Zotlabs\Module\Cards\get(), Zotlabs\Module\Network\get(), Zotlabs\Module\Hq\get(), Zotlabs\Module\Cal\get(), Zotlabs\Module\Tagrm\get(), Zotlabs\Module\Channel\get(), Zotlabs\Module\Page\get(), Zotlabs\Module\Events\get(), Zotlabs\Module\Item\get(), identity_basic_export(), identity_export_year(), Zotlabs\Module\Bookmarks\init(), Zotlabs\Module\Starred\init(), item_create_edit_activity(), item_expire(), items_fetch(), Zotlabs\Lib\NativeWikiPage\load_page(), Zotlabs\Lib\NativeWikiPage\load_page_history(), Zotlabs\Module\Oep\oep_articles_reply(), Zotlabs\Module\Oep\oep_cards_reply(), Zotlabs\Module\Oep\oep_display_reply(), Zotlabs\Module\Oep\oep_mid_reply(), Zotlabs\Lib\NativeWikiPage\page_list(), Zotlabs\Module\Tagrm\post(), Zotlabs\Module\Events\post(), Zotlabs\Module\Item\post(), Zotlabs\Module\Photos\post(), Zotlabs\Daemon\Cron\run(), Zotlabs\Daemon\Notifier\run(), search_doc_files(), Zotlabs\Lib\NativeWiki\sync_a_wiki_item(), sync_an_item(), tag_deliver(), Zotlabs\Widget\Item\widget(), and zot_feed().
first_post_date | ( | $uid, | |
$wall = false |
|||
) |
Return the first post date.
int | $uid | |
boolean | $wall | (optional) default false |
Referenced by list_post_dates(), and posted_dates().
fix_attached_file_permissions | ( | $channel, | |
$observer_hash, | |||
$body, | |||
$str_contact_allow, | |||
$str_group_allow, | |||
$str_contact_deny, | |||
$str_group_deny | |||
) |
Referenced by import_items(), and Zotlabs\Module\Item\post().
fix_attached_photo_permissions | ( | $uid, | |
$xchan_hash, | |||
$body, | |||
$str_contact_allow, | |||
$str_group_allow, | |||
$str_contact_deny, | |||
$str_group_deny | |||
) |
Referenced by import_items(), and Zotlabs\Module\Item\post().
fix_private_photos | ( | $s, | |
$uid, | |||
$item = null , |
|||
$cid = 0 |
|||
) |
Referenced by atom_entry().
get_item_contact | ( | $item, | |
$contacts | |||
) |
get_item_elements | ( | $x, | |
$allow_code = false |
|||
) |
Referenced by import_items(), photo_upload(), Zotlabs\Daemon\Externals\run(), Zotlabs\Daemon\Onepoll\run(), and zot_import().
get_mail_elements | ( | $x | ) |
Referenced by import_mail(), and zot_import().
get_profile_elements | ( | $x | ) |
Referenced by zot_import().
has_permissions | ( | $obj | ) |
Referenced by fix_private_photos().
import_author_rss | ( | $x | ) |
Imports an author from a RSS feed.
array | $x | an associative array with
|
Referenced by import_author_xchan().
import_author_unknown | ( | $x | ) |
Referenced by consume_feed(), and import_author_xchan().
import_author_xchan | ( | $x | ) |
Referenced by get_item_elements(), get_mail_elements(), get_profile_elements(), and process_channel_sync_delivery().
is_item_normal | ( | $item | ) |
This is a compatibility function primarily for plugins, because in earlier DB schemas this was a much simpler single integer compare.
array | $item |
Referenced by Zotlabs\Module\Item\post().
item_add_cid | ( | $xchan_hash, | |
$mid, | |||
$uid | |||
) |
Change access control for item with message_id $mid and channel_id $uid.
string | $xchan_hash | |
string | $mid | |
int | $uid |
item_create_edit_activity | ( | $post | ) |
item_expire | ( | $uid, | |
$days | |||
) |
Referenced by Zotlabs\Daemon\Expire\run().
item_getfeedattach | ( | $item | ) |
item_getfeedtags | ( | $item | ) |
item_normal | ( | ) |
Referenced by article_tagadelic(), card_tagadelic(), categories_widget(), first_post_date(), Zotlabs\Module\Manage\get(), Zotlabs\Module\Viewsrc\get(), Zotlabs\Module\Pubstream\get(), Zotlabs\Module\Like\get(), Zotlabs\Module\Display\get(), Zotlabs\Module\Network\get(), Zotlabs\Module\Hq\get(), Zotlabs\Module\Channel\get(), Zotlabs\Module\Bookmarks\init(), Zotlabs\Module\Ping\init(), Zotlabs\Module\Item\item_check_service_class(), item_expire(), items_fetch(), Zotlabs\Module\Oep\oep_display_reply(), Zotlabs\Module\Photos\post(), tagadelic(), Zotlabs\Widget\Forums\widget(), Zotlabs\Widget\Activity\widget(), and zot_feed().
item_normal_search | ( | ) |
Referenced by Zotlabs\Module\Search\get().
item_normal_update | ( | ) |
item_remove_cid | ( | $xchan_hash, | |
$mid, | |||
$uid | |||
) |
item_sign | ( | & | $item | ) |
Signs an item body.
[in,out] | array | $item |
Referenced by item_store(), and item_store_update().
item_store | ( | $arr, | |
$allow_exec = false , |
|||
$deliver = true |
|||
) |
Stores an item type record.
array | $arr | |
boolean | $allow_exec | (optional) default false |
boolean | $deliver | (optional) default true |
Referenced by consume_feed(), copy_of_pubitem(), Zotlabs\Lib\NativeWiki\create_wiki(), delete_imported_item(), event_store_item(), Zotlabs\Module\React\get(), Zotlabs\Module\Like\get(), Zotlabs\Module\Subthread\get(), import_items(), import_webpage_element(), Zotlabs\Module\Impel\init(), Zotlabs\Module\Mood\init(), photo_upload(), photos_create_item(), Zotlabs\Module\Item\post(), post_activity_item(), process_delivery(), profile_activity(), refimport_content(), reflect_comment_store(), Zotlabs\Lib\NativeWikiPage\save_page(), and store_doc_file().
item_store_update | ( | $arr, | |
$allow_exec = false , |
|||
$deliver = true |
|||
) |
Update a stored item.
array | $arr | an item |
boolean | $allow_exec | (optional) default false |
boolean | $deliver | (optional) default true |
Referenced by Zotlabs\Module\Tagrm\get(), import_items(), import_webpage_element(), Zotlabs\Module\Impel\init(), photo_upload(), Zotlabs\Module\Tagrm\post(), Zotlabs\Module\Item\post(), Zotlabs\Module\Photos\post(), refimport_content(), reflect_comment_store(), store_doc_file(), update_feed_item(), update_imported_item(), and Zotlabs\Lib\NativeWiki\update_wiki().
items_fetch | ( | $arr, | |
$channel = null , |
|||
$observer_hash = null , |
|||
$client_mode = CLIENT_MODE_NORMAL , |
|||
$module = 'network' |
|||
) |
Referenced by api_network_stream(), get_feed_for(), and red_item().
limit_body_size | ( | $body | ) |
Limit length on imported system messages.
The purpose of this function is to apply system message length limits to imported messages without including any embedded photos in the length.
string | $body |
Referenced by get_atom_elements().
list_post_dates | ( | $uid, | |
$wall, | |||
$mindate | |||
) |
modified posted_dates() {below} to arrange the list in years, which we'll eventually use to make a menu of years with collapsible sub-menus for the months instead of the current flat list of all representative dates.
int | $uid | |
boolean | $wall | |
string | $mindate |
Referenced by Zotlabs\Widget\Archive\widget().
mail_store | ( | $arr | ) |
Referenced by import_mail(), and process_mail_delivery().
map_scope | ( | $scope, | |
$strip = false |
|||
) |
int | $scope | |
boolean | $strip | (optional) default false |
Referenced by Zotlabs\Lib\NativeWikiPage\create_page(), Zotlabs\Lib\NativeWiki\create_wiki(), encode_item(), Zotlabs\Module\Profiles\get(), photo_upload(), Zotlabs\Module\Item\post(), post_activity_item(), and start_delivery_chain().
post_activity_item | ( | $arr, | |
$allow_code = false , |
|||
$deliver = true |
|||
) |
Post an activity.
In its simplest form one needs only to set $arr['body'] to post a note to the logged in channel's wall. Much more complex activities can be created. Permissions are checked. No filtering, tag expansion or other processing is performed.
array | $arr | |
boolean | $allow_code | (optional) default false |
boolean | $deliver | (optional) default true |
Referenced by api_channel_stream(), Zotlabs\Lib\NativeWikiPage\create_page(), file_activity(), Zotlabs\Module\Tagger\get(), Zotlabs\Module\Thing\init(), Zotlabs\Module\Poke\init(), item_create_edit_activity(), Zotlabs\Module\Connedit\post(), Zotlabs\Module\Cover_photo\send_cover_photo_activity(), and send_profile_photo_activity().
post_is_importable | ( | $item, | |
$abook | |||
) |
Referenced by consume_feed(), and process_delivery().
posted_dates | ( | $uid, | |
$wall | |||
) |
retain_item | ( | $id | ) |
send_profile_photo_activity | ( | $channel, | |
$photo, | |||
$profile | |||
) |
Referenced by Zotlabs\Module\Profile_photo\post().
send_status_notifications | ( | $post_id, | |
$item | |||
) |
Referenced by item_store(), and item_store_update().
set_linkified_perms | ( | $linkified, | |
& | $str_contact_allow, | ||
& | $str_group_allow, | ||
$profile_uid, | |||
$parent_item = false , |
|||
& | $private | ||
) |
Referenced by Zotlabs\Module\Item\post().
start_delivery_chain | ( | $channel, | |
$item, | |||
$item_id, | |||
$parent | |||
) |
Sourced and tag-delivered posts are re-targetted for delivery to the connections of the channel receiving the post. This starts the second delivery chain, by resetting permissions and ensuring that ITEM_UPLINK is set on the parent post, and storing the current owner_xchan as the source_xchan. We'll become the new owner. If called without $parent, this is the parent post.
array | $channel | |
array | $item | |
int | $item_id | |
boolean | $parent |
Referenced by tag_deliver().
sync_an_item | ( | $channel_id, | |
$item_id | |||
) |
tag_deliver | ( | $uid, | |
$item_id | |||
) |
Called when we deliver things that might be tagged in ways that require delivery processing.
Handles community tagging of posts and also look for mention tags and sets up a second delivery chain if appropriate.
int | $uid | |
int | $item_id |
Referenced by delete_imported_item(), Zotlabs\Module\Item\get(), item_store(), and item_store_update().
termtype | ( | $t | ) |
tgroup_check | ( | $uid, | |
$item | |||
) |
This function is called pre-deliver to see if a post matches the criteria to be tag delivered.
We don't actually do anything except check that it matches the criteria. This is so that the channel with tag_delivery enabled can receive the post even if they turn off permissions for the sender to send their stream. tag_deliver() can't be called until the post is actually stored. By then it would be too late to reject it.
number | $uid | A chnnel_id |
array | $item |
Referenced by process_delivery().
title_is_body | ( | $title, | |
$body | |||
) |
Referenced by get_atom_elements().
translate_scope | ( | $scope | ) |
Returns a descriptive text for a given $scope.
string | $scope |
Referenced by Zotlabs\Module\Lockview\get(), and Zotlabs\Module\Profiles\get().
update_remote_id | ( | $channel, | |
$post_id, | |||
$webpage, | |||
$pagetitle, | |||
$namespace, | |||
$remote_id, | |||
$mid | |||
) |
validate_item_elements | ( | $message, | |
$arr | |||
) |
Referenced by zot_import().
webpage_to_namespace | ( | $webpage | ) |
Referenced by Zotlabs\Module\Item\post(), and update_remote_id().
zot_feed | ( | $uid, | |
$observer_hash, | |||
$arr | |||
) |
int | $uid | |
string | $observer_hash | |
array | $arr |
Referenced by api_channel_stream(), Zotlabs\Module\Zotfeed\init(), Zotlabs\Daemon\Onepoll\run(), and zot_reply_message_request().