| [ Index ] |
|
Code source de Phorum 5.1.25 |
[Code source] [Imprimer] [Statistiques]
The other Phorum code does not care how the messages are stored. The only requirement is that they are returned from these functions in the right way. This means each database can use as many or as few tables as it likes. It can store the fields anyway it wants. The only thing to worry about is the table_prefix for the tables. all tables for a Phorum install should be prefixed with the table_prefix that will be entered in include/db/config.php. This will allow multiple Phorum installations to use the same database.
| Poids: | 4876 lignes (166 kb) |
| Inclus ou requis: | 0 fois |
| Référencé: | 0 fois |
| Nécessite: | 2 fichiers include/email_functions.php include/thread_info.php |
| phorum_db_get_thread_list($offset) X-Ref |
| This function executes a query to select the visible messages from the database for a given page offset. The main Phorum code handles actually sorting the threads into a threaded list if needed. By default, the message body is not included in the fetch queries. If the body is needed in the thread list, $PHORUM['TMP']['bodies_in_list'] must be set to "1" (for example using setting.tpl). NOTE: ALL dates should be returned as Unix timestamps param: offset - the index of the page to return, starting with 0 param: messages - an array containing forum messages |
| phorum_db_get_recent_messages($count, $forum_id = 0, $thread = 0, $threads_only = 0) X-Ref |
| This function executes a query to get the recent messages for all forums the user can read, a particular forum, or a particular thread, and and returns an array of the messages order by message_id. You can optionally retrieve only new threads. The original version of this function came from Jim Winstead of mysql.com |
| phorum_db_get_unapproved_list($forum = NULL, $waiting_only=false,$moddays=0,$countonly=false) X-Ref |
| This function executes a query to select messages from the database and returns an array. The main Phorum code handles actually sorting the threads into a threaded list if needed. NOTE: ALL dates should be returned as Unix timestamps param: forum - the forum id to work with. Omit or NULL for all forums. param: waiting_only - only take into account messages which have to |
| phorum_db_post_message(&$message,$convert=false) X-Ref |
| This function posts a message to the tables. The message is passed by reference and message_id and thread are filled |
| phorum_db_delete_message($message_id, $mode = PHORUM_DELETE_MESSAGE) X-Ref |
| This function deletes messages from the messages table. param: message $ _id the id of the message which should be deleted |
| phorum_db_get_messagetree($parent_id, $forum_id) X-Ref |
| gets all attached messages to a message param: id $ id of the message |
| phorum_db_update_message($message_id, $message) X-Ref |
| This function updates the message given in the $message array for the row with the given message id. It returns non 0 on success. |
| phorum_db_get_message($value, $field="message_id", $ignore_forum_id=false) X-Ref |
| This function executes a query to get the row with the given value in the given field and returns the message in an array. |
| phorum_db_get_messages($thread,$page=0,$ignore_mod_perms = 0) X-Ref |
| This function executes a query to get the rows with the given thread id and returns an array of the message. |
| phorum_db_get_message_index($thread=0,$message_id=0) X-Ref |
| this function returns the index of a message in a thread |
| phorum_db_search($search, $offset, $length, $match_type, $match_date, $match_forum) X-Ref |
| This function searches the database for the supplied search criteria and returns an array with two elements. One is the count of total messages that matched, the second is an array of the messages from the results based on the $start (0 base) given and the $length given. |
| phorum_db_get_older_thread($key) X-Ref |
| Returns the closest older or newer neighbour thread. param: int $key return: mixed |
| phorum_db_get_newer_thread($key) X-Ref |
| Pas de description |
| phorum_db_get_neighbour_thread($key, $direction) X-Ref |
| Pas de description |
| phorum_db_load_settings() X-Ref |
| This function executes a query to get bad items of type $type and returns an array of the results. |
| phorum_db_update_settings($settings) X-Ref |
| This function executes a query to get bad items of type $type and returns an array of the results. |
| phorum_db_get_forums($forum_ids = 0, $parent_id = -1, $vroot = null, $inherit_id = null) X-Ref |
| This function executes a query to select all forum data from the database for a flat/collapsed display and returns the data in an array. |
| phorum_db_update_forum_stats($refresh=false, $msg_count_change=0, $timestamp=0, $thread_count_change=0, $sticky_count_change=0) X-Ref |
| This function updates the forums stats. If refresh is true, it pulls the numbers from the table. |
| phorum_db_move_thread($thread_id, $toforum) X-Ref |
| actually moves a thread to the given forum |
| phorum_db_close_thread($thread_id) X-Ref |
| closes the given thread |
| phorum_db_reopen_thread($thread_id) X-Ref |
| (re)opens the given thread |
| phorum_db_add_forum($forum) X-Ref |
| This function executes a query to insert a forum into the forums table and returns the forums id on success or 0 on failure. |
| phorum_db_drop_forum($forum_id) X-Ref |
| This function executes a query to remove a forum from the forums table and its messages. |
| phorum_db_drop_folder($forum_id) X-Ref |
| This function executes a query to remove a folder from the forums table and change the parent of its children. |
| phorum_db_update_forum($forum) X-Ref |
| This function executes a query to update a forum in the forums table and returns non zero on success or 0 on failure. |
| phorum_db_get_groups($group_id=0) X-Ref |
| Pas de description |
| phorum_db_get_group_members($group_id, $status = NULL) X-Ref |
| Get the members of a group. param: group_id - can be an integer (single group), or an array of groups param: status - a specific status to look for, defaults to all return: array - users (key is userid, value is group membership status) |
| phorum_db_save_group($group) X-Ref |
| Pas de description |
| phorum_db_delete_group($group_id) X-Ref |
| Pas de description |
| phorum_db_add_group($group_name,$group_id=0) X-Ref |
| phorum_db_add_group() param: $group_name $group_id return: |
| phorum_db_user_get_moderators($forum_id,$ignore_user_perms=false,$for_email=false) X-Ref |
| This function returns all moderators for a particular forum |
| phorum_db_user_get($user_id, $detailed) X-Ref |
| This function executes a query to select data about a user including his permission data and returns that in an array. |
| phorum_db_user_get_fields($user_id, $fields) X-Ref |
| Pas de description |
| phorum_db_user_get_list($type = 0) X-Ref |
| Get a list of all users of a certain type. param: $type - what type of list to retrieve. return: array - key: userid, value: array (username, displayname) |
| phorum_db_user_check_pass($username, $password, $temp_password=false) X-Ref |
| This function executes a query to select data about a user including his permission data and returns that in an array. |
| phorum_db_user_check_field($field, $value, $operator="=", $return_array=false) X-Ref |
| This function executes a query to check for the given field in the user tableusername and return the user_id of the user it matches or 0 if no match is found. The parameters can be arrays. If they are, all must be passed and all must have the same number of values. If $return_array is true, an array of all matching rows will be returned. Otherwise, only the first user_id from the results will be returned. |
| phorum_db_user_add($userdata) X-Ref |
| This function executes a query to add the given user data to the database and returns the userid or 0 |
| phorum_db_user_save($userdata) X-Ref |
| This function executes a query to update the given user data in the database and returns the true or false |
| phorum_db_user_save_groups($user_id, $groups) X-Ref |
| This function saves a users group permissions. |
| phorum_db_user_subscribe($user_id, $forum_id, $thread, $type) X-Ref |
| This function executes a query to subscribe a user to a forum/thread. |
| phorum_db_user_addpost() X-Ref |
| This function increases the post-counter for a user by one |
| phorum_db_user_unsubscribe($user_id, $thread, $forum_id=0) X-Ref |
| This function executes a query to unsubscribe a user to a forum/thread. |
| phorum_db_user_get_groups($user_id) X-Ref |
| This function will return a list of groups the user is a member of, as well as the users permissions. |
| phorum_db_search_users($search) X-Ref |
| This function executes a query to select data about a user including his permission data and returns that in an array. If $search is empty, all users should be returned. |
| phorum_db_user_get_unapproved() X-Ref |
| This function gets the users that await approval |
| phorum_db_user_delete($user_id) X-Ref |
| This function deletes a user completely - entry in the users-table - entries in the permissions-table - entries in the newflags-table - entries in the subscribers-table - entries in the group_xref-table - entries in the private-messages-table - entries in the files-table - sets entries in the messages-table to anonymous |
| phorum_db_get_user_file_list($user_id) X-Ref |
| This function gets the users file list |
| phorum_db_get_message_file_list($message_id) X-Ref |
| This function gets the message's file list |
| phorum_db_file_get($file_id) X-Ref |
| This function retrieves a file from the db |
| phorum_db_file_save($user_id, $filename, $filesize, $buffer, $message_id=0, $link=null) X-Ref |
| This function saves a file to the db |
| phorum_db_file_delete($file_id) X-Ref |
| This function saves a file to the db |
| phorum_db_file_link($file_id, $message_id, $link = null) X-Ref |
| This function links a file to a specific message |
| phorum_db_get_user_filesize_total($user_id) X-Ref |
| This function reads the current total size of all files for a user |
| phorum_db_file_purge_stale_files($live_run = false) X-Ref |
| This function is used for cleaning up stale files from the database. Stale files are files that are not linked to anything. These can for example be caused by users that are writing a message with attachments, but never post it. param: live_run - If set to false (default), the function |
| phorum_db_newflag_allread($forum_id=0) X-Ref |
| This function returns the newinfo-array for markallread |
| phorum_db_newflag_get_flags($forum_id=0) X-Ref |
| This function returns the read messages for the current user and forum optionally for a given forum (for the index) |
| phorum_db_newflag_get_unread_count($forum_id=0) X-Ref |
| This function returns the count of unread messages the current user and forum optionally for a given forum (for the index) |
| phorum_db_newflag_add_read($message_ids) X-Ref |
| This function marks a message as read |
| phorum_db_newflag_get_count($forum_id=0) X-Ref |
| This function returns the number of newflags for this user and forum |
| phorum_db_newflag_delete($numdelete=0,$forum_id=0) X-Ref |
| This function removes a number of newflags for this user and forum |
| phorum_db_newflag_update_forum($message_ids) X-Ref |
| This function executes a query to fix any newflags that are assigned to the wrong forum |
| phorum_db_get_subscribed_users($forum_id, $thread, $type) X-Ref |
| This function executes a query to get the user ids of the users subscribed to a forum/thread. |
| phorum_db_get_message_subscriptions($user_id,$days=2) X-Ref |
| This function executes a query to get the subscriptions of a user-id, together with the forum-id and subjects of the threads |
| phorum_db_get_if_subscribed($forum_id, $thread, $user_id, $type=PHORUM_SUBSCRIPTION_MESSAGE) X-Ref |
| This function executes a query to find out if a user is subscribed to a thread |
| phorum_db_get_banlists($ordered=false) X-Ref |
| This function retrieves the banlists for the current forum |
| phorum_db_get_banitem($banid) X-Ref |
| This function retrieves one item from the banlists |
| phorum_db_del_banitem($banid) X-Ref |
| This function deletes one item from the banlists |
| phorum_db_mod_banlists($type,$pcre,$string,$forum_id,$id=0) X-Ref |
| This function adds or modifies a banlist-entry |
| phorum_db_pm_list($folder, $user_id = NULL, $reverse = true) X-Ref |
| This function lists all private messages in a folder. param: folder - The folder to use. Either a special folder param: user_id - The user to retrieve messages for or NULL param: reverse - If set to a true value (default), sorting |
| phorum_db_pm_get($pm_id, $folder = NULL, $user_id = NULL) X-Ref |
| This function retrieves a private message from the database. param: pm_id - The id for the private message to retrieve. param: user_id - The user to retrieve messages for or NULL param: folder_id - The folder to retrieve the message from or |
| phorum_db_pm_create_folder($foldername, $user_id = NULL) X-Ref |
| This function creates a new folder for a user. param: foldername - The name of the folder to create. param: user_id - The user to create the folder for or |
| phorum_db_pm_rename_folder($folder_id, $newname, $user_id = NULL) X-Ref |
| This function renames a folder for a user. param: folder_id - The id of the folder to rename. param: newname - The new name for the folder. param: user_id - The user to rename the folder for or |
| phorum_db_pm_delete_folder($folder_id, $user_id = NULL) X-Ref |
| This function deletes a folder for a user. Along with the folder, all contained messages are deleted as well. param: folder_id - The id of the folder to delete. param: user_id - The user to delete the folder for or |
| phorum_db_pm_getfolders($user_id = NULL, $count_messages = false) X-Ref |
| This function retrieves the list of folders for a user. param: user_id - The user to retrieve folders for or NULL param: count_messages - Count the number of messages for the |
| phorum_db_pm_messagecount($folder, $user_id = NULL) X-Ref |
| This function computes the number of private messages a user has and returns both the total and the number unread. param: folder - The folder to use. Either a special folder param: user_id - The user to retrieve messages for or NULL |
| phorum_db_pm_checknew($user_id = NULL) X-Ref |
| This function does a quick check if the user has new private messages. This is useful in case you only want to know whether the user has new messages or not and when you are not interested in the exact amount of new messages. param: user_id - The user to retrieve messages for or NULL return: A true value, in case there are new messages available. |
| phorum_db_pm_send($subject, $message, $to, $from=NULL, $keepcopy=false) X-Ref |
| This function inserts a private message in the database. The return value is the pm_message_id of the created message. param: subject - The subject for the private message. param: message - The message text for the private message. param: to - A single user_id or an array of user_ids for the recipients. param: from - The user_id of the sender. The current user is used in case param: keepcopy - If set to a true value, a copy of the mail will be put in |
| phorum_db_pm_setflag($pm_id, $flag, $value, $user_id = NULL) X-Ref |
| This function updates a flag for a private message. param: pm_id - The id of the message to update. param: flag - The flag to update. Options are PHORUM_PM_READ_FLAG param: value - The value for the flag (true or false). param: user_id - The user to set a flag for or NULL |
| phorum_db_pm_delete($pm_id, $folder, $user_id = NULL) X-Ref |
| This function deletes a private message from a folder. param: folder - The folder from which to delete the message param: pm_id - The id of the private message to delete param: user_id - The user to delete the message for or NULL |
| phorum_db_pm_move($pm_id, $from, $to, $user_id = NULL) X-Ref |
| This function moves a private message to a different folder. param: pm_id - The id of the private message to move. param: from - The folder to move the message from. param: to - The folder to move the message to. param: user_id - The user to move the message for or NULL |
| phorum_db_pm_update_message_info($pm_id) X-Ref |
| This function updates the meta information for a message. If it detects that no xrefs are available for the message anymore, the message will be deleted from the database. So this function has to be called after setting the read_flag and after deleting a message. PMTODO maybe we need some locking here to prevent concurrent updates of the message info. |
| phorum_db_get_private_messages($arg1, $arg2) X-Ref |
| Pas de description |
| phorum_db_get_private_message($arg1) X-Ref |
| Pas de description |
| phorum_db_get_private_message_count($arg1) X-Ref |
| Pas de description |
| phorum_db_put_private_messages($arg1, $arg2, $arg3, $arg4, $arg5) X-Ref |
| Pas de description |
| phorum_db_update_private_message($arg1, $arg2, $arg3) X-Ref |
| Pas de description |
| phorum_db_pm_deprecated($func) X-Ref |
| Pas de description |
| phorum_db_pm_is_buddy($buddy_user_id, $user_id = NULL) X-Ref |
| This function checks if a certain user is buddy of another user. The function return the pm_buddy_id in case the user is a buddy or NULL in case the user isn't. param: buddy_user_id - The user_id to check for if it's a buddy. param: user_id - The user_id for which the buddy list must be |
| phorum_db_pm_buddy_add($buddy_user_id, $user_id = NULL) X-Ref |
| This function adds a buddy for a user. It will return the pm_buddy_id for the new buddy. If the buddy already exists, it will return the existing pm_buddy_id. If a non existant user_id is used for the buddy_user_id, the function will return NULL. param: buddy_user_id - The user_id that has to be added as a buddy. param: user_id - The user_id the buddy has to be added for or |
| phorum_db_pm_buddy_delete($buddy_user_id, $user_id = NULL) X-Ref |
| This function deletes a buddy for a user. param: buddy_user_id - The user_id that has to be deleted as a buddy. param: user_id - The user_id the buddy has to be delete for or |
| phorum_db_pm_buddy_list($user_id = NULL, $find_mutual = false) X-Ref |
| This function retrieves a list of buddies for a user. param: user_id - The user_id for which to retrieve the buddies param: find_mutual - Wheter to find mutual buddies or not (default not). |
| phorum_db_prune_oldThreads($time,$forum=0,$mode=1) X-Ref |
| This function returns messages or threads which are newer or older than the given timestamp $time - holds the timestamp the comparison is done against $forum - get Threads from this forum $mode - should we compare against datestamp (1) or modifystamp (2) |
| phorum_db_split_thread($message, $forum_id) X-Ref |
| split thread |
| phorum_db_get_max_messageid() X-Ref |
| This function returns the maximum message-id in the database |
| phorum_db_viewcount_inc($message_id) X-Ref |
| This function increments the viewcount for a post |
| phorum_db_get_custom_field_users($field_id,$field_content,$match) X-Ref |
| Pas de description |
| phorum_db_metaquery_compile($metaquery) X-Ref |
| Translates a message searching meta query into a real SQL WHERE statement for this database backend. The meta query can be used to define extended SQL queries, based on a meta description of the search that has to be performed on the database. The meta query is an array, containing: - query conditions - grouping using "(" and ")" - AND/OR specifications using "AND" and "OR". The query conditions are arrays, containing the following elements: - condition A description of a condition. The syntax for this is: <field name to query> <operator> <match specification> The <field name to query> is a field in the message query that we are running in this function. The <operator> can be one of "=", "!=", "<", "<=", ">", ">=". Note that there is nothing like "LIKE" or "NOT LIKE". If a "LIKE" query has to be done, then that is setup through the <match specification> (see below). The <match specification> tells us with what the field should be matched. The string "QUERY" inside the specification is preserved to specify at which spot in the query the "query" element from the condition array should be inserted. If "QUERY" is not available in the specification, then a match is made on the exact value in the specification. To perform "LIKE" searches (case insensitive wildcard searches), you can use the "*" wildcard character in the specification to do so. - query The data to use in the query, in case the condition element has a <match specification> that uses "QUERY" in it. Example: $metaquery = array( array( "condition" => "field1 = *QUERY*", "query" => "test data" ), "AND", "(", array("condition" => "field2 = whatever"), "OR", array("condition" => "field2 = something else"), ")" ); For MySQL, this would be turned into the MySQL WHERE statement: ... WHERE field1 LIKE '%test data%' AND (field2 = 'whatever' OR field2 = 'something else') param: $metaquery - A meta query description array. return: $return - An array containing two elements. The first element |
| phorum_db_metaquery_messagesearch($metaquery) X-Ref |
| Run a search on the messages, using a metaquery. See the documentation for the phorum_db_metaquery_compile() function for more info on the metaquery syntax. The query that is run here, does create a view on the messages, which includes some thread and user info. This is used so these can also be taken into account when selecting messages. For the condition elements in the meta query, you can use fully qualified field names for the <field name to query>. You can use message.*, user.* and thread.* for this. The primary goal for this function is to provide a backend for the message pruning interface. param: $metaquery - A metaquery array. return: $messages - An array of message records. |
| phorum_db_create_tables() X-Ref |
| This function creates the tables needed in the database. |
| phorum_db_escape_string($str) X-Ref |
| Pas de description |
| phorum_db_run_queries($queries) X-Ref |
| This function goes through an array of queries and executes them |
| phorum_db_check_connection() X-Ref |
| This function checks that a database connection can be made. |
| phorum_db_mysql_connect() X-Ref |
| handy little connection function. This allows us to not connect to the server until a query is actually run. NOTE: This is not a required part of abstraction |
| phorum_db_mysql_error($err) X-Ref |
| error handling function NOTE: This is not a required part of abstraction |
| phorum_db_sanitize_mixed(&$var, $type) X-Ref |
| This function will sanitize a mixed variable of data based on type param: $var The variable to be sanitized. Passed by reference. param: $type Either int or not int. return: null |
| phorum_db_validate_field($field_name) X-Ref |
| Checks that a value to be used as a field name contains only characters that would appear in a field name. param: $field_name string to be checked return: bool |
| phorum_db_maxpacketsize() X-Ref |
| This function is used by the sanity checking system in the admin interface to determine how much data can be transferred in one query. This is used to detect problems with uploads that are larger than the database server can handle. The function returns the size in bytes. For database implementations which do not have this kind of limit, NULL can be returned. |
| phorum_db_sanitychecks() X-Ref |
| This function is used by the sanity checking system to let the database layer do sanity checks of its own. This function can be used by every database layer to implement specific checks. The return value for this function should be exactly the same as the return value expected for regular sanity checking function (see include/admin/sanity_checks.php for information). There's no need to load the sanity_check.php file for the needed constants, because this function should only be called from the sanity checking system. |
| Généré le : Thu Nov 29 12:22:27 2007 | par Balluche grâce à PHPXref 0.7 |
|