日期:2013-11-27  浏览次数:20398 次

<?php
//
// +----------------------------------------------------------------------+
// | 文章类                                                               |
// +----------------------------------------------------------------------+
// | Copyright (c) 2001 NetFish Software                                  |
// |                                                                      |
// | Author: whxbb(whxbb@21cn.com)                                        |
// +----------------------------------------------------------------------+
//
// $Id: whxbb_article.class.php,v 0.1 2001/8/11 22:18:13 yf Exp $
//

// 禁止直接访问该页面
if (basename($HTTP_SERVER_VARS['PHP_SELF']) == "whxbb_article.class.php") {
    header("HTTP/1.0 404 Not Found");
}


/**
* 文章类
* Purpose
*  封装对文章的各类操作
*
*
* @author  : whxbb(whxbb@21cn.com)
* @version : 0.1
* @date    :  2001/8/1
*/

class WHXBB_Article extends WHXBB
{
    /** 分页对象 */
    var $pager;

    function Article()
    {
        $this->WHXBB();
    }
    /**
     * 文章写入数据库
     * @param $title 文章标题
     * @param $author 文章作者
     * @param $content 文章内容
     * @return 操作出错:一个WHXBB_Error对象 成功:true
     * @access public
     */
    function Insert($title, $author, $content)
    {
        new WHXBB_Debug("Insert() Start");

        // 处理传入的参数
        WHXBB::OperateString(&$title, 'in');
        WHXBB::OperateString(&$author, 'in');
        WHXBB::OperateString(&$content, 'in');

        $sql = "insert into article(title,author,content) values('$title','$author','$content')";
        if( !@mysql_query($sql, $this->_conn) )
        {
            return new WHXBB_Error("Insert() Failed.($sql)", 1021);
        }
        new WHXBB_Debug("Insert() Completed");
  &nbs