A class that operates on WDB posts

xiaoxiao2021-03-06  92

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 =======

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

转载请注明原文地址:https://www.9cbs.com/read-123897.html

New Post(0)