The Red Matrix
|
some database related functions and abstract driver class. More...
Classes | |
class | dba_driver |
abstract database driver class. More... | |
Functions | |
dba_factory ($server, $port, $user, $pass, $db, $dbtype, $install=false) | |
Returns the database driver object. More... | |
printable ($s) | |
dbg ($state) | |
set database driver debugging state. More... | |
dbesc ($str) | |
Escape strings being passed to DB queries. More... | |
dbescbin ($str) | |
dbunescbin ($str) | |
dbescdate ($date) | |
db_quoteinterval ($txt) | |
dbesc_identifier ($str) | |
db_utcnow () | |
db_optimizetable ($table) | |
db_concat ($fld, $sep) | |
q ($sql) | |
Execute a SQL query with printf style args. More... | |
dbq ($sql) | |
Raw DB query, no arguments. More... | |
dbesc_array_cb (&$item, $key) | |
dbesc_array (&$arr) | |
db_getfunc ($f) | |
some database related functions and abstract driver class.
This file contains the abstract database driver class dba_driver and some functions for working with databases.
db_concat | ( | $fld, | |
$sep | |||
) |
Referenced by acl_init(), and admin_page_users().
db_getfunc | ( | $f | ) |
db_optimizetable | ( | $table | ) |
Referenced by ref_session_gc().
db_quoteinterval | ( | $txt | ) |
Referenced by chatroom_enter(), expire_run(), item_expire(), mark_orphan_hubsxchans(), notifier_run(), onepoll_run(), photo_upload(), ping_init(), poco_load(), poller_run(), post_post(), queue_run(), random_profile(), register_content(), register_post(), update_birthdays(), update_channels_active_halfyear_stat(), update_channels_active_monthly_stat(), and update_suggestions().
db_utcnow | ( | ) |
Referenced by chatroom_enter(), expire_run(), item_expire(), mark_orphan_hubsxchans(), notifier_run(), onepoll_run(), photo_upload(), ping_init(), poco_load(), poller_run(), post_post(), queue_run(), random_profile(), register_content(), register_post(), update_birthdays(), update_channels_active_halfyear_stat(), update_channels_active_monthly_stat(), and update_suggestions().
dba_factory | ( | $server, | |
$port, | |||
$user, | |||
$pass, | |||
$db, | |||
$dbtype, | |||
$install = false |
|||
) |
Returns the database driver object.
If available it will use PHP's mysqli otherwise mysql driver.
string | $server | DB server name |
string | $port | DB port |
string | $user | DB username |
string | $pass | DB password |
string | $db | database name |
string | $dbtype | 0 for mysql, 1 for postgres |
bool | $install | Defaults to false |
Referenced by cli_startup(), and setup_post().
dbesc | ( | $str | ) |
Escape strings being passed to DB queries.
Always escape strings being used in DB queries. This function returns the escaped string. Integer DB parameters should all be proven integers by wrapping with intval().
string | $str | A string to pass to a DB query |
Referenced by abook_toggle_flag(), account_verify_password(), achievements_content(), acl_init(), add_source_route(), admin_page_profs_post(), admin_page_users(), advanced_profile(), allowed_public_recips(), api_direct_messages_new(), api_get_user(), api_login(), api_status_show(), api_statuses_destroy(), api_statuses_mentions(), api_user(), api_users_show(), app_destroy(), app_installed(), app_store(), app_update(), appman_content(), attach_by_hash(), attach_by_hash_nodata(), attach_change_permissions(), attach_count_files(), attach_delete(), attach_list_files(), attach_mkdir(), attach_store(), authenticate_success(), bb2diaspora_itemwallwall(), bb2dmention_callback(), block_content(), blocks_content(), bookmark_add(), bookmarks_init(), build_sync_packet(), call_hooks(), categories_widget(), change_channel(), channel_content(), channel_remove(), channelx_by_hash(), channelx_by_n(), channelx_by_nick(), chanview_content(), chat_message(), chat_post(), chatroom_create(), chatroom_destroy(), chatroom_enter(), chatroom_leave(), chatsvc_content(), chatsvc_post(), check_account_email(), check_account_invite(), check_item_source(), check_upstream_directory(), check_webbie(), Cache\clear(), comanche_block(), common_friends(), connect_init(), connect_post(), connections_content(), connections_post(), connedit_post(), consume_feed(), contact_remove(), contactgroup_content(), count_common_friends(), create_account(), create_identity(), RedMatrix\RedDAV\RedDirectory\createFile(), del_config(), del_pconfig(), del_xconfig(), delegate_content(), delete_imported_item(), delete_item_lowlevel(), deliver_run(), diaspora_asphoto(), diaspora_comment(), diaspora_conversation(), diaspora_dispatch_public(), diaspora_get_contact_by_handle(), diaspora_handle_from_contact(), diaspora_like(), diaspora_mention_callback(), diaspora_message(), diaspora_photo(), diaspora_post(), diaspora_process_outbound(), diaspora_request(), diaspora_reshare(), diaspora_retraction(), diaspora_send_followup(), diaspora_send_images(), diaspora_send_relay(), diaspora_share(), diaspora_signed_retraction(), diaspora_transmit(), dir_flag_build(), dir_query_build(), directory_init(), directory_run(), dirsearch_content(), discover_by_url(), discover_by_webbie(), display_content(), downgrade_accounts(), editblock_content(), editlayout_content(), editpost_content(), editwebpage_content(), event_addtocal(), event_store_event(), event_store_item(), events_content(), events_post(), externals_run(), fbrowser_content(), feed_init(), fetch_post_tags(), file_tag_file_query(), filerm_content(), filestorage_content(), filter_insecure(), find_diaspora_person_by_handle(), find_filename_by_hash(), find_folder_hash_by_attach_hash(), RedMatrix\RedDAV\RedBrowser\findAttachHash(), RedMatrix\RedDAV\RedBrowser\findAttachIdByHash(), fix_attached_photo_permissions(), fix_private_photos(), fix_system_urls(), fsuggest_post(), Cache\get(), RedMatrix\RedDAV\RedFile\get(), get_all_perms(), get_birthdays(), get_channel_by_nick(), get_cloudpath(), get_config_from_storage(), get_events(), get_item_elements(), get_online_status(), get_things(), RedMatrix\RedDAV\RedDirectory\getDir(), RedMatrix\RedDAV\RedDirectory\getLastModified(), gprobe_run(), group_add(), group_add_member(), group_byname(), group_content(), group_post(), group_rec_byhash(), group_rmv(), group_rmv_member(), groups_containing(), handle_feed(), handle_tag(), hcard_init(), home_content(), hubloc_change_primary(), impel_init(), import_author_diaspora(), import_author_rss(), import_author_unknown(), import_author_zot(), import_directory_keywords(), import_directory_profile(), import_post(), import_profile_photo(), import_site(), import_xchan(), install_plugin(), invite_post(), is_matrix_url(), item_add_cid(), item_message_id(), item_permissions_sql(), item_post(), item_remove_cid(), item_store(), item_store_update(), items_fetch(), layouts_content(), like_content(), list_public_sites(), load_config(), load_plugin(), load_xconfig(), local_dir_update(), lockview_content(), locs_content(), locs_post(), FKOAuthDataStore\lookup_consumer(), FKOAuthDataStore\lookup_nonce(), FKOAuthDataStore\lookup_token(), lostpass_content(), lostpass_post(), magic_init(), mail_content(), mail_store(), manage_content(), mark_orphan_hubsxchans(), match_openid(), member_of(), menu_add_item(), menu_create(), menu_delete(), menu_edit(), menu_edit_item(), menu_fetch(), menu_list(), menu_list_count(), msearch_post(), netgrowth_content(), network_content(), FKOAuthDataStore\new_access_token(), new_contact(), new_cookie(), FKOAuthDataStore\new_request_token(), notification(), notifier_run(), notify_init(), oauth_get_client(), onedirsync_run(), onepoll_run(), openid_content(), p_init(), page_init(), perm_is_allowed(), permissions_sql(), photo_init(), photo_new_resource(), photo_upload(), photos_album_exists(), photos_album_get_db_idstr(), photos_album_rename(), photos_content(), photos_list_photos(), photos_post(), ping_init(), plugin_is_installed(), poco_init(), poco_load(), poll_post(), poller_run(), post_init(), post_post(), private_messages_drop(), private_messages_fetch_conversation(), private_messages_fetch_message(), private_messages_list(), process_channel_sync_delivery(), process_delivery(), process_location_delivery(), process_mail_delivery(), process_profile_delivery(), profile_init(), profile_load(), profile_photo_post(), profile_photo_set_profile_perms(), profiles_content(), profiles_init(), profiles_post(), profperm_content(), prune_hub_reinstalls(), public_permissions_sql(), public_recips(), RedMatrix\RedDAV\RedFile\put(), queue_run(), rconnect_url(), receive_post(), RedCollectionData(), RedFileData(), ref_session_destroy(), ref_session_gc(), ref_session_read(), ref_session_write(), refimport_content(), reflect_comment_store(), reflect_get_channel(), register_hook(), register_post(), remote_online_status(), remove_all_xchan_resources(), remove_community_tag(), remove_obsolete_hublocs(), remove_queue_item(), rmagic_init(), rmagic_post(), rpost_content(), photo_driver\save(), search_ac_init(), search_content(), send_message(), send_reg_approval_email(), send_status_notifications(), Cache\set(), set_config(), set_pconfig(), set_xconfig(), RedMatrix\RedDAV\RedFile\setName(), RedMatrix\RedDAV\RedDirectory\setName(), settings_post(), sitelist_init(), sources_content(), sources_post(), start_delivery_chain(), photo_driver\store(), store_diaspora_comment_sig(), store_item_tag(), stream_perms_xchans(), stringify_array_elms(), subthread_content(), suggest_init(), sync_directories(), sync_locations(), tag_deliver(), tagger_content(), term_query(), tgroup_check(), thing_content(), thing_init(), uninstall_plugin(), unregister_hook(), update_birthdays(), update_directory_entry(), update_modtime(), update_queue_time(), update_remote_id(), user_allow(), user_approve(), user_deny(), RedMatrix\RedDAV\RedBasicAuth\validateUserPass(), vcard_from_xchan(), verify_email_address(), vote_post(), webpages_content(), wfinger_init(), widget_bookmarkedchats(), widget_item(), widget_random_block(), widget_savedsearch(), xchan_content(), xchan_mail_query(), xchan_query(), xchan_store(), xrd_init(), z_readdir(), zfinger_init(), zid_init(), zot_feed(), zot_finger(), zot_get_hublocs(), zot_gethub(), zot_process_message_request(), zot_process_response(), zot_refresh(), and zotfeed_init().
dbesc_array | ( | & | $arr | ) |
Referenced by import_post(), item_store(), item_store_update(), mail_store(), and profiles_init().
dbesc_array_cb | ( | & | $item, |
$key | |||
) |
dbesc_identifier | ( | $str | ) |
dbescbin | ( | $str | ) |
Referenced by attach_store(), photos_post(), photo_driver\save(), and photo_driver\store().
dbescdate | ( | $date | ) |
Referenced by discover_by_webbie(), and import_xchan().
dbg | ( | $state | ) |
set database driver debugging state.
int | $state | 0 to disable debugging |
Referenced by connedit_post().
dbq | ( | $sql | ) |
Raw DB query, no arguments.
This function executes a raw DB query without any arguments.
string | $sql | The SQL query to execute |
Referenced by import_post(), item_store(), item_store_update(), mail_store(), process_channel_sync_delivery(), and profiles_init().
dbunescbin | ( | $str | ) |
Referenced by photo_init(), and photos_post().
printable | ( | $s | ) |
Referenced by dba_mysql\q(), dba_mysqli\q(), and dba_postgres\q().
q | ( | $sql | ) |
Execute a SQL query with printf style args.
printf style arguments s and d are replaced with variable arguments, which should each be appropriately dbesc() or intval(). SELECT queries return an array of results or false if SQL or DB error. Other queries return true if the command was successful or false if it wasn't.
Example: $r = q("SELECT * FROM <tt>%s</tt> WHERE <tt>uid</tt> = %d", 'user', 1);
string | $sql | The SQL query to execute |
Referenced by abook_connections(), abook_self(), abook_toggle_flag(), account_remove(), account_service_class_fetch(), account_total(), account_verify_password(), achievements_content(), acl_init(), add_source_route(), admin_content(), admin_page_channels(), admin_page_channels_post(), admin_page_dbsync(), admin_page_hubloc(), admin_page_hubloc_post(), admin_page_profs(), admin_page_profs_post(), admin_page_summary(), admin_page_users(), admin_page_users_post(), advanced_profile(), all_friends(), allowed_public_recips(), api_direct_messages_box(), api_direct_messages_new(), api_favorites(), api_ff_ids(), api_format_items(), api_get_user(), api_group(), api_group_members(), api_login(), api_status_show(), api_statuses_destroy(), api_statuses_f(), api_statuses_home_timeline(), api_statuses_mentions(), api_statuses_public_timeline(), api_statuses_repeat(), api_statuses_show(), api_user(), api_users_show(), app_destroy(), app_installed(), app_list(), app_store(), app_update(), appman_content(), attach_by_hash(), attach_by_hash_nodata(), attach_change_permissions(), attach_count_files(), attach_delete(), attach_init(), attach_list_files(), attach_mkdir(), attach_store(), authenticate_success(), bb2diaspora_itemwallwall(), bb2dmention_callback(), block_content(), blocks_content(), bookmark_add(), bookmarks_init(), build_sync_packet(), call_hooks(), catblock(), categories_widget(), change_channel(), channel_content(), channel_remove(), channel_total(), channelx_by_hash(), channelx_by_n(), channelx_by_nick(), chanview_content(), chat_content(), chat_message(), chat_post(), chatroom_create(), chatroom_destroy(), chatroom_enter(), chatroom_leave(), chatroom_list(), chatroom_list_count(), chatsvc_content(), chatsvc_init(), chatsvc_post(), check_account_email(), check_account_invite(), check_config(), check_item_source(), check_upstream_directory(), check_webbie(), Cache\clear(), collect_recipients(), comanche_block(), common_friends(), common_friends_zcid(), common_init(), connect_init(), connect_post(), connections_content(), connections_post(), connedit_content(), connedit_init(), connedit_post(), consume_feed(), contact_block(), contact_profile_assign(), contact_remove(), contact_select(), contactgroup_content(), count_all_friends(), count_common_friends(), count_common_friends_zcid(), create_account(), create_identity(), RedMatrix\RedDAV\RedDirectory\createDirectory(), RedMatrix\RedDAV\RedDirectory\createFile(), current_theme(), del_config(), del_pconfig(), del_xconfig(), delegate_content(), delete_imported_item(), delete_item_lowlevel(), deliver_run(), diaspora_asphoto(), diaspora_comment(), diaspora_conversation(), diaspora_dispatch_public(), diaspora_get_contact_by_handle(), diaspora_handle_from_contact(), diaspora_like(), diaspora_mention_callback(), diaspora_message(), diaspora_photo(), diaspora_post(), diaspora_process_outbound(), diaspora_request(), diaspora_reshare(), diaspora_retraction(), diaspora_send_followup(), diaspora_send_images(), diaspora_send_mail(), diaspora_send_relay(), diaspora_share(), diaspora_signed_retraction(), diaspora_transmit(), dir_parse_query(), dir_tagadelic(), directory_content(), directory_init(), directory_run(), dirsearch_content(), discover_by_url(), discover_by_webbie(), display_content(), downgrade_accounts(), drop_item(), editblock_content(), editlayout_content(), editpost_content(), editwebpage_content(), encode_item(), event_addtocal(), event_store_event(), event_store_item(), events_content(), events_post(), expand_groups(), expire_run(), externals_run(), fbrowser_content(), feed_init(), fetch_post_tags(), fileas_widget(), filer_content(), filerm_content(), filestorage_content(), filter_insecure(), find_diaspora_person_by_handle(), find_filename_by_hash(), find_folder_hash_by_attach_hash(), RedMatrix\RedDAV\RedBrowser\findAttachHash(), RedMatrix\RedDAV\RedBrowser\findAttachIdByHash(), first_post_date(), fix_attached_photo_permissions(), fix_private_photos(), fix_system_urls(), fsuggest_content(), fsuggest_post(), RedMatrix\RedDAV\RedBrowser\generateDirectoryIndex(), Cache\get(), RedMatrix\RedDAV\RedFile\get(), get_all_perms(), get_birthdays(), get_channel_by_nick(), get_channel_default_perms(), get_cloudpath(), get_config_from_storage(), get_events(), get_item_elements(), get_online_status(), get_sys_channel(), get_things(), get_words(), RedMatrix\RedDAV\RedDirectory\getDir(), RedMatrix\RedDAV\RedDirectory\getLastModified(), RedMatrix\RedDAV\RedDirectory\getQuotaInfo(), gprobe_run(), group_add(), group_add_member(), group_byname(), group_content(), group_get_members(), group_post(), group_rec_byhash(), group_rmv(), group_rmv_member(), group_select(), group_side(), groups_containing(), handle_feed(), handle_tag(), hcard_init(), home_content(), hubloc_change_primary(), identity_basic_export(), identity_check_service_class(), identity_selector(), impel_init(), import_author_diaspora(), import_author_rss(), import_author_unknown(), import_author_zot(), import_directory_keywords(), import_directory_profile(), import_post(), import_profile_photo(), import_site(), import_xchan(), install_plugin(), invite_post(), is_matrix_url(), is_sys_channel(), item_add_cid(), item_check_service_class(), item_content(), item_expire(), item_message_id(), item_post(), item_remove_cid(), item_store(), item_store_update(), items_fetch(), layout_select(), layouts_content(), like_content(), list_public_sites(), load_config(), load_contact_links(), load_hooks(), load_pconfig(), load_plugin(), load_translation_table(), load_xconfig(), local_dir_update(), lockview_content(), locs_content(), locs_post(), FKOAuth1\loginUser(), FKOAuthDataStore\lookup_consumer(), FKOAuthDataStore\lookup_nonce(), FKOAuthDataStore\lookup_token(), lostpass_content(), lostpass_post(), magic_init(), mail_content(), mail_store(), manage_content(), mark_orphan_hubsxchans(), match_content(), match_openid(), member_of(), menu_add_item(), menu_create(), menu_del_item(), menu_delete(), menu_delete_id(), menu_edit(), menu_edit_item(), menu_fetch(), menu_fetch_id(), menu_list(), menu_list_count(), mimetype_select(), mini_group_select(), mitem_content(), mood_init(), msearch_post(), nav(), netgrowth_content(), network_content(), FKOAuthDataStore\new_access_token(), new_contact(), new_cookie(), FKOAuthDataStore\new_request_token(), notification(), notifications_content(), notifications_off(), notifications_on(), notifications_post(), notifier_run(), notify_content(), notify_init(), oauth_get_client(), onedirsync_run(), onepoll_run(), openid_content(), p_init(), page_init(), pagelist_widget(), pdl_selector(), perm_is_allowed(), photo_init(), photo_new_resource(), photo_upload(), photos_album_exists(), photos_album_get_db_idstr(), photos_album_rename(), photos_albums_list(), photos_content(), photos_list_photos(), photos_post(), ping_init(), plugin_is_installed(), poco_init(), poco_load(), poke_content(), poke_init(), poll_content(), poll_post(), poller_run(), post_activity_item(), post_init(), post_post(), private_messages_drop(), private_messages_fetch_conversation(), private_messages_fetch_message(), private_messages_list(), process_channel_sync_delivery(), process_delivery(), process_location_delivery(), process_mail_delivery(), process_profile_delivery(), profile_init(), profile_load(), profile_photo_post(), profile_photo_set_profile_perms(), profile_sidebar(), profiles_content(), profiles_init(), profiles_post(), profperm_content(), prune_hub_reinstalls(), public_recips(), RedMatrix\RedDAV\RedFile\put(), queue_run(), random_profile(), rconnect_url(), receive_post(), RedChannelList(), RedCollectionData(), RedFileData(), ref_session_destroy(), ref_session_gc(), ref_session_read(), ref_session_write(), refimport_content(), reflect_comment_store(), reflect_get_channel(), register_content(), register_hook(), register_post(), reload_plugins(), remote_online_status(), remove_all_xchan_resources(), remove_community_tag(), remove_obsolete_hublocs(), remove_queue_item(), retain_item(), rmagic_init(), rmagic_post(), rpost_content(), photo_driver\save(), search_ac_init(), search_content(), send_message(), send_reg_approval_email(), send_status_notifications(), service_class_allows(), service_class_fetch(), Cache\set(), set_config(), set_default_login_identity(), set_pconfig(), set_xconfig(), RedMatrix\RedDAV\RedFile\setName(), RedMatrix\RedDAV\RedDirectory\setName(), settings_post(), setup_content(), share_init(), siteinfo_content(), siteinfo_init(), sitelist_init(), sources_content(), sources_post(), starred_init(), start_delivery_chain(), photo_driver\store(), store_diaspora_comment_sig(), store_item_tag(), stream_perms_api_uids(), stream_perms_xchans(), subthread_content(), suggest_init(), suggestion_query(), sync_directories(), sync_locations(), tag_deliver(), tagadelic(), tagger_content(), tagrm_content(), tagrm_post(), tgroup_check(), thing_content(), thing_init(), uninstall_plugin(), unregister_hook(), update_birthdays(), update_channels_active_halfyear_stat(), update_channels_active_monthly_stat(), update_channels_total_stat(), update_directory_entry(), update_local_posts_stat(), update_modtime(), update_queue_time(), update_remote_id(), update_suggestions(), user_allow(), user_approve(), user_deny(), RedMatrix\RedDAV\RedBasicAuth\validateUserPass(), vcard_from_xchan(), verify_email_address(), viewconnections_content(), viewsrc_content(), vote_content(), vote_init(), vote_post(), webpages_content(), wfinger_init(), widget_bookmarkedchats(), widget_filer(), widget_follow(), widget_item(), widget_random_block(), widget_savedsearch(), widget_settings_menu(), widget_suggestedchats(), wtagblock(), xchan_content(), xchan_fetch(), xchan_mail_query(), xchan_query(), xchan_store(), xrd_init(), z_input_filter(), z_readdir(), zfinger_init(), zid_init(), zot_feed(), zot_finger(), zot_get_hublocs(), zot_gethub(), zot_import(), zot_process_message_request(), zot_process_response(), zot_refresh(), and zotfeed_init().