一个对WDB的帖子进行操作的类
2004-08-24 16:58
393 查看
一个处理WDB程序帖子的类[PHP][原创]
帖子原始地址:一个处理WDB程序帖子的类[PHP][原创]
surfchen我写这个类主要是为了重新制作YB的论坛,不过这个类可以用来对任何WDB的帖子数据进行操作。。只要进行几个简单的变量设置。。注意看构造函数上面的注释。。
Code:
=======begin=======
========end=======
[此贴被surfchen在2004年9月10日23:48动过手脚]
IT杂谈
帖子原始地址:一个处理WDB程序帖子的类[PHP][原创]
surfchen我写这个类主要是为了重新制作YB的论坛,不过这个类可以用来对任何WDB的帖子数据进行操作。。只要进行几个简单的变量设置。。注意看构造函数上面的注释。。
Code:
=======begin=======
<?php /*获得和处理帖子信息*/ class YbPost { /*构造函数,获得指定帖子的信息*/ /*$post_url--帖子相对于论坛数据文件夹的URI,例如forum11/f_252,$post_row指定每个主题的某个帖子,为0时为第一帖*/ function YbPost($post_url,$post_row=0) { /*$old_post_dir--论坛根目录相对于本文件所在目录的URI,例如"bbs".$post_dir--帖子数据根目录,例如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;//帖子完全的url $file_info=file($this->mPostUrl); $post_info=explode("│",$file_info[$post_row]); list($post_title,$post_user,$post_content,$post_date,$post_address)=$post_info; $this->mTitle=$post_title;//帖子标题 $this->mUser=$post_user;//发帖人 $this->mContent=$post_content;//帖子内容 $this->mDate=$post_date;//发表日期,格式为UNIX时间戳 $this->mAddress=$post_address;//发帖人地址 $file_info=file("{$old_bbs_dir}/{$post_dir}/forum{$_GET['fid']}/list.php"); foreach ($file_info as $key => $value) { $topic_info=explode("│",$value); if ($topic_info[5]==basename($post_url)) { // ?????犞魈獗晏??????楼猪 ????????牱⑻奔??????????点击数 ??????回复数 list($this->mTopicTitle,$this->mTopicUser,$this->mTopicFirstTime,,,,$this->mTopicHits,$this->mTopicPosts,$last_post_info) =$topic_info; // ??????最后回帖主题 ????????犠詈蠡靥?????????最后回帖时间 list($this->mTopicLastPostTitle,$this->mTopicLastPostUser,$this->mTopicLastPostTime)=explode(",",$last_post_info); break; } } } /*编辑帖子标题*/ function EditPostTitle($title) { global $post_info,$post_n,$file_info; $post_info[0]=$title; $now_info=implode("│",$post_info); $file_info[$post_n]=$now_info; $file_t_info=implode("",$file_info); SavaEdited($file_t_info); } /*编辑帖子内容*/ 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); } /*保存编辑信息*/ function SaveEdited($info) { $handle=fopen($this->mPostUrl,"w"); flock($handle,LOCK_EX); fwrite($handle,$info); flock($handle,LOCK_UN); fclose($handle); } ?>
========end=======
[此贴被surfchen在2004年9月10日23:48动过手脚]
IT杂谈
相关文章推荐
- 多个按键绑定同一个监听器,并实现按下,弹起进行不同操作
- 异或加密法 在对文本进行简单加密的时候,可以选择用一个n位的二进制数,对原文进行异或运算。 解密的方法就是再执行一次同样的操作。
- Chapter 3 | Stacks and Queues--实现数据结构模拟一个栈由几个子栈组成,并可以在指定子栈上进行出栈操作
- Linux下多个进程或线程同时对一个文件进行写操作
- 页面中checkbox返回的是一个数组,如何对数组进行操作
- 这是一个定时脚本,主要功能是遍历该文件夹下的所有文件并存储到数组,对数据中的文件进行操作,一个一个移动到指定的目录下,并删除原有文件
- samza中扒了一个YarnUtil来对yarn app进行相应的操作
- 一个项目配置多个数据源进行数据操作,简单方便。
- 一张图像表示成NxN的矩阵,图像中每个像素是4个字节,写一个函数把图像旋转90度。 你能原地进行操作吗?(即不开辟额外的存储空间)
- 昨天写的一个连接SQL库,并对其进行读操作的代码,请指点
- 要求写一个程序,返回最少的操作数,使得源串进行这些操作后等于目标串。源串和目标串长度都小于2000。
- 一个stmt多个rs进行操作引起的ResultSet已经关闭错误
- 堆的数据结构能够使得堆顶总是维持最大(对于大根堆)或最小(对于小根堆),给定一个数组,对这个数组进行建堆,则平均复杂度是多少?如果只是用堆的 push 操作,则一个大根堆依次输入 3,7,2,4,1,5,8 后,得到的堆的结构示意图是下述图表中的哪个?
- 一个封装好的C++比特数组BitArray,可以对位进行直接操作
- 使用java类SequenceInputStream 对一个文件进行分割和合并的操作
- 用c++封装一个Hash Table,并与STL map 进行操作性能上的比较
- Linux shell 循环读入一个列表 文件 进行操作
- 同一个程序在命令行下,编译为什么报错???难道命令行下不能进行导入包的操作???
- 整个页面的ajax都执行完以后再进行其他的操作,怎么判断一个图片是否正常显示?
- Linux下多个进程或线程同时对一个文件进行写操作