Rel = "stylesheet" href = "../ main.css">
Post original address: a class that handles WDB program posts [PHP] [original]
Surfchen
I wrote this class mainly to re-create YB forums, but this class can be used to operate any WDB post data. . Just make several simple variable settings. . Note the comments above the constructor. .
CODE:
======= begin =======
php / * get and process the message information * / class ybpost {/ * constructor, get the message of the specified post * / / * $ post_url - post relative to the URI of the forum data folder, such as Forum11 / F_252, $ post_row Specifies a post in each topic, 0 is the first post * / function ybpost ($ post_url, $ post_row = 0) {/ * $ old_post_dir - Forum root directory relative to the URI in this file, for example "$ post_dir - post data root directory, such as PostData * / Global $ old_bbs_dir, $ post_dir, $ post_info, $ file_info, $ post_n; $ post_n = $ post_row; $ this-> mpostURL = $ OLD_BBS_DIR." / " . $ post_dir. "/". $ post_url; // Post complete url $ file_info = file ($ this-> mpostURL); $ post_info = expedition ("│", $ file_info [$ post_row]); list ($ pos_title $ Post_user, $ post_content, $ pos_date, $ pos_address) = $ pos_info; $ this-> mtitle = $ this-> muser = $ post_user; // Posted $ this-> mcontent = $ Post_content; // Post content $ this-> mdate = $ pos_date; // Published Date, format is UNIX timestamp $ this-> maddress = $ post_address; // President Address $ file_info = file ("{$ OLD_BBS_DIR} / {$ pos_dir} / forum {$ _ get ['fid']} / list.php "); Foreach ($ file_info as $ key => $ value) {$ TOPIC_INFO = EXPLODE ("│", $ value); if ($ TOPIC_INFO [5] == BaseName ($ post_url)) {// ????? 犞魈 犞魈? ???? ?? Building pig ???????? 牱 ⑻? ?????????? Hits ?????? Reply number List ($ this-> Mtopictitle, $ this-> Mtopicuser, $ this-> MtopicfirstTime ,, $ this-> Mtopichits, $ this-> MtopicPosts, $ last_post_info) = $ TOPIC_INFO; / / ?????? last reply theme ???????? 犠詈 蠡靥 ????????? Last reply time list ($ this-> MtopiclastPostTitle, $ this-> MtopiclastPostuser, $ this-> mtopiclastPostTime) =
Explode (",", $ last_post_info; Break;}}} / * Edit Posts Title * / Function EditPostTitle ($ TITLE) {Global $ POST_INFO, $ POST_N, $ FILE_INFO; $ Post_info [0] = $ Title; $ now_INFO = IMPLODE ("│", $ post_info); $ file_info [$ pos "= $ now_INFO; $ file_t_info = Implode (" ", $ file_info); savaEDITED ($ file_t_info);} / * Edit Posts * / Function EditPostContent $ content) {global $ post_info, $ post_n, $ file_info; $ post_info [2] = $ content; $ now_info = implode ( "│", $ post_info); $ file_info [$ post_n] = $ now_info; $ file_t_info = implode ("", $ file_info); savaedited ($ file_t_info);} / * Save Edit Information * / Function SaveEdited ($ INFO) {$ Handle = FOPEN ($ this-> MpostURL, "W"); flock ($ handle, Lock_ex; FWRITE ($ Handle, $ INFO); FLOCK ($ Handle, Lock_un); Fclose ($ Handle);}?> ======== End =======
This post was moved by Surfchen on September 10, 2004, 23:48.
IT talk