转帖建立自己的在线新闻组服务器—PHPNews2.63的使用介绍

 日期:2006-03-04 08时


以前在DRL跟大家讨论过互联网中古老而又活力的新闻组,感觉反应还挺热烈的,大家还都比较感爱好,所以,想着趁这几天稍闲一点儿,顺便给大家介绍一下有关新闻组的一些东西,有鉴于大家都习惯于在线方式的讨论,所以今天给大家伙儿说说PHPNews.

PHPNews是一种可以利用Web方式来访问新闻组的小程序,使用简单,功能齐全,非凡适合一些不方便或不喜欢使用新闻组客户端的朋友.
有时候在网吧里边玩,网吧限制使用OE或限制下载,或者在公司,被公司封了119端口之类的,假如你有了一个在线的新闻组服务器(严格来说,PHPNews只能算是个类似新闻组转接接口的东东)的话,就方便很多了,无论在哪儿,就都可以很方便的访问到你喜 欢的新闻组了,而无需到一台电脑就要再设置一次新闻组客户端了.
说实话,在OE里边设置好一个新闻组对于习惯于混迹BBS论坛的网友们来说并不是一件很轻易的事,相比使用IE要复杂一些.更别提其它的更专业的新闻组客户端和一些需要身份验证的新闻组服务器的设置了.

现在有了PHPNews就方便多了,PHPNews是中国台湾的一位朋友的作品,好象应该是台湾国立交通大学的,叫沉成达,也不知道是音译还是真的姓”沉”(好希奇的姓啊).

PHPNews程序可以在网上下载得到,好在它也不是很大,所以我把它作为附件放一个上来.有爱好的朋友可以试试.

OK,大致的说了一下PHPNews,咱们开始把它弄到咱们的服务器上边去吧.相比装一个普通的PHP程序,PHPNews很简单.俺来大致的介绍一下吧.

顾名思义,PHPNews需要PHP空间支持,把压缩包里边的所有文件和文件夹解压到服务器的某一个文件夹如pnews263里边,然后把其下子文件夹examples里边的config.inc.php文件和newsgroups.lst复制一份放到p news263文件夹里边.然后要做的就是修改config.inc.php这个文件里边的内容了.
文件本身不大,不到500行,很多注释,很轻易看懂.
从这个配置文件可以看得出,这个PHPNews的功能确实比较丰富实用.
由于PHP俺也只是个初哥,只是简单的介绍一下里边参数的配置.

PHP代码:复制内容到剪贴板代码:<?

# Do not put anything (including blanks and line breaks) before '<' and '?'

#
# PHP News Reader Configuration File
#
# Copyright (C) 2001-2005 - All rights reserved
# Shen Cheng-Da (cdsheen at users.sourceforge.net)

# This is a sample configuration.
# You should make a copy of this file at the directory of pnews.

# After making a copy, you can begin editing this file,

# In this configuration, you can use on as true, and off as false
# Also note that no quote is needed, for example: $foobar = on;

define( 'on', true, true );
define( 'off', false, true );

# The configuration contains 3 sections:
#
# Section 1 - Authentication
# Section 2 - Contents
# Section 3 - Languages

# The setting with 'REQUIRED' mark and do not come with a default value
# and should be explicitly configured

############################################################################
# Section 1 - Authentication - Configure how users login your system
############################################################################
# 第一部分,有关认证的设置

# [auth_type] Specify the authentication type (REQUIRED)
# "required" - authentication is required to access the while system
# "optional" - authentication is only required for posting and forwarding
# "open" - authentication is not needed

$CFG["auth_type"] = "optional";
# 你的这个认证类型,第一个是访问需认证,第二个是仅只是发帖子要认证,第三个是无需认证.假如这个只是你一个人用的话,可以用"required"或"optional",否则用”open”就可以了.


# [auth_prompt] Specify the style of login prompt (default: "form")
# (used when auth_type != 'open')
# "http" - authentication via HTTP login window (default)
# "form" - authentication with login form
# "other" - authentication with third party system (>=2.5.6)

$CFG["auth_prompt"] = "form";
# 这儿说的是认证方法,有三种,http,表单和第三方系统(这个要2.5.6以上支持)

# [global_readonly] Prohibits the posting and forwarding of articles,
# even if user performs login. (default: false)

// $CFG["global_readonly"] = true;
# 全局设定,即使用户登录了,也不答应发帖子和转发帖子.

# [auth_http_realm] Specify the realm used in http authentication prompt
# (REQUIRED if auth_prompt == 'http')

$CFG["auth_http_realm"] = "XXX";
# 指定http验证方式下的提示符

# [auth_method] Specify the authentication method
# REQUIRED if auth_type != "open"
# "ldap" - authenticated via LDAP server,
# "pop3" - authenticated via POP3 server,
# "pop3s" - authenticated via POP3 over SSL server, (>=v2.4.1)
# "ftp" - authenticated via FTP server,
# "ftps" - authenticated via FTP over SSL server, (>=v2.4.1)
# "mail" - authenticated via multiple POP3 server,
# "mysql" - authenticated via MySQL database,
# "pgsql" - authenticated via PostgreSQL database,
# "nntp" - authenticated via NNTP server,
# "nntps" - authenticated via NNTP over SSL server, (>=v2.4.0)
# "cas" - authenticated via CAS (>=v2.3.0)
# "phpbb" - authenticated via phpBB (>=v2.5.6)
# "user" - authenticated via your self-defined method,

$CFG["auth_method"] = "ftp";
# 验证方法.从这儿可以看出,PHPNews提供了相当丰富的验证方式.假如上边的验证方式是”open”的,这儿就无需理会了,否则,可以在这儿选择一种验证方法.囿于条件限制和时间,我们在这儿只用ftp这种方式吧,其它的俺们有空再讨论,估计用得比较 多的一般是pop3,ftp,mail,mysql,nntp之类的.其它的应该用得少吧,有些俺也没接触过.

# [auth_organization] Specify the organization of authentication source
# REQUIRED if auth_type != 'open'

$CFG["auth_organization"] = "大鲨鱼俱乐部";
# 认证的时候取个好听名字,如:大鲨鱼俱乐部之类…

# [auth_registration_info] Tell users how to get an account (default: "")
# This message will be displayed on login (FORM) or logout (HTTP) windows

// $CFG["auth_registration_info"] = "You can register an account at <a hreg=http://foobar.com/>Nopy's Club</a>";
# 认证注册信息

# [auth_user_module] Specify user-defined authentication module location
# REQUIRED if auth_method == 'user'

// $CFG["auth_user_module"] = "auth/my_auth.inc.php";
# 假如是自定义认证模式的话,这儿你可以指定认证的程序.

# You should implement a function with this prototype in your module:
#
# function check_user_password( $username, $password )

# 下边就是程序本身支持一些认证方法的设定了.有很多,俺们在这儿先只说说FTP方式吧.

# LDAP authentication parameters (REQUIRED if auth_method == 'ldap')
# [ldap_server] LDAP server address ( address:port )
# [ldap_dn] LDAP distinguish name
# [ldap_bind_rdn] LDAP bind RDN, %u replaced by username (default: "%u")
# [ldap_bind_pwd] LDAP bind password, %p replaced by password (default: "%p")
# [ldap_filter] LDAP search filter (default: "(cn=%u)")
# [ldap_variable] The attributes extract from this LDAP search for later use
# (default: null) ( %u can not be used here )

// $CFG["ldap_server"] = "ldap.domain.org";
// $CFG["ldap_dn"] = "ou=members, o=root";
// $CFG["ldap_bind_rdn"] = "cn=%u,ou=members,o=root";
// $CFG["ldap_bind_pwd"] = "%p";
// $CFG["ldap_variable"] = array( "%e" => "Email", "%f" => "Fullname" );
// $CFG["ldap_variable"] = array( "%e" => "Email" );
// $CFG["ldap_filter"] = "(&(cn=%u)(accountStatus=1)(MailStatus=1))";
// $CFG["ldap_filter"] = "(cn=%u)";


# FTP authentication parameters (REQUIRED if auth_method == 'ftp')
# [$ftp_server] FTP server address ( address:port )
# [$ftp_deny] The user list which is denied for FTP authentication
# (default: array( 'anonymous', 'guest', 'ftp' ) )

$CFG["ftp_server"] = "192.168.4.16";
$CFG["ftp_deny"] = array( 'anonymous', 'guest', 'ftp', 'root' );
# 上边的是地址,假如有端口就加在后边.
# 下边是拒绝认证的一些用户名的列表.

# FTPS authentication parameters (REQUIRED if auth_method == 'ftp')
# [$ftps_server] FTP over SSL server address ( address:port )
# [$ftps_deny] The user list which is denied for FTPS authentication
# (default: array( 'anonymous', 'guest', 'ftp' ) )

// $CFG["ftps_server"] = "ftps.domain.org";
// $CFG["ftps_deny"] = array( 'anonymous', 'guest', 'ftp', 'root' );


# POP3 authentication parameters (REQUIRED if auth_method == 'pop3')
# [pop3_server] POP3 server address ( address:port )

// $CFG["pop3_server"] = "pop3.domain.org";


# POP3S authentication parameters (REQUIRED if auth_method == 'pop3s')
# [pop3_server] POP3S server address ( address:port )

// $CFG["pop3s_server"] = "pop3s.domain.org";


# Mail authentication parameters (REQUIRED if auth_method == 'mail')
# [pop3_mapping] the mapping from E-Mail to POP3 server address
# [domain_select] Show domain-list selector in login dialog (default: true)

// $CFG["pop3_mapping"] = array( "@foobar.com" => "pop3.foobar.com",
// ".bbs@bbs.haha.com" => "bbs.haha.com",
// "@mail.domain.org" => "pop3.domain.org" );

// $CFG["domain_select"] = false;

# MySQL/PostgreSQL Database authentication parameters
# (REQUIRED if auth_method == 'mysql' || auth_method == 'pgsql' )

# [db_server] The database server address (address:port)
# [db_name] The database name
# [db_username] The username used to connect database
# [db_password] The password used to connect database
# [db_table] The table name for user information
# [db_field_username] The field name for username
# [db_field_password] The field name for password
# [db_password_crypt] The password encrypt method (default: "" - cleartext)
# current supported are: "md5", "crypt"

$CFG["db_server"] = "database.domain.org";
$CFG["db_name"] = "phpbb";
$CFG["db_username"] = "db_user";
$CFG["db_password"] = "db_pass";
$CFG["db_table"] = "phpbb_users";
$CFG["db_field_username"] = "username";
$CFG["db_field_password"] = "user_password";
$CFG["db_password_crypt"] = "md5";

$CFG["db_variable"] = array( "%e" => "user_email" );

# NNTP authentication parameters (REQUIRED if auth_method == 'nntp')
# [$auth_nntp_server] NNTP server address ( address:port )

// $CFG["auth_nntp_server"] = "news.domain.org";


# NNTPS authentication parameters (REQUIRED if auth_method == 'nntps')
# [$auth_nntps_server] NNTPS server address ( address:port )

// $CFG["auth_nntps_server"] = "nntps.domain.org";


# CAS authetication parameters (REQUIRED if auth_method == 'cas')
# [$auth_cas_server] CAS server FQDN and port ( address:port )
# [$auth_cas_base_uri] CAS server base URI
# [$auth_cas_debug] a file to debug phpCAS or FALSE to turn debugging off
# (default: false)

$CFG["auth_cas_server"] = 'cas.domain.name:8443';
$CFG["auth_cas_base_uri"] = 'cas';

// $CFG["auth_cas_debug"] = '/var/log/phpcas.log';

# phpBB authetication parameters (REQUIRED if auth_method == 'phpbb')
# [$auth_phpbb_url_base] The base URL of your phpBB installation
# [$auth_phpbb_path] The relative of absolute path of
# your phpBB installation

// $CFG['auth_phpbb_url_base'] = 'http://phpbb.foobar.com/';
// $CFG['auth_phpbb_path'] = '../phpbb/';


# [auth_expire_time] After this time in seconds, authentication is expired
# And login again is required. Zero means never expire
# (default: 3600 seconds)

$CFG["auth_expire_time"] = 1800;
# 认证超时设置

# [auth_user_fullname] The full name of authenticated user (default: "%u")

// $CFG["auth_user_fullname"] = "%f";
# 认证用户的全名,可以详见前边的一些认证方式的设定.

# [auth_user_email] The E-Mail of authenticated user (REQUIRED)
# The %u will be replaced by the username enter by authentication session
# Other variables are defined in the [db_variable] or [ldap_variable]
# (If you use 'mail' auth-method, %e will be the user's E-Mail,
# and %u will be the user name of the E-Mail - i.e: the string before '@')

$CFG["auth_user_email"] = "noadsp@mail.com";
# $CFG["auth_user_email"] = "%e";
# 用户Email地址.

# [log] Enable access log (default: "" - no log)
# You need to create this file w/ write permission to the user running httpd

// $CFG["log"] = "/var/log/webnews.log";
# 是否弄个Log,不过要有写入权限哦.

# [log_level] Log verbose level (default: 3)
# 0 - no log
# 1 - log only post/reply/xpost/forward/delete actions.
# 2 - log all actions for authenticated users.
# 3 - log all actions for all users.

// $CFG["log_level"] = 1;
# 定义Log文件的具体级别

# [debug_level] Debug verbose level (default: 0)
# 0 - Turn off NNTP debug information
# 1 - NNTP debug information will be embeded in HTML comments
# 2 - NNTP debug information will be shown inline with HTML

// $CFG["debug_level"] = 1;
# 定义调试级别

############################################################################
# Section 2 - Contents - Configure the contents
############################################################################
# 这一节则是针对PHPNew内容的设定了 .

# [url_base] The base url of your PHP News Reader installation (REQUIRED)

$CFG['url_base'] = 'http://192.168.4.16/pnews263/';
# 安装的URL,必需的.

# [url_rewrite] Turn on URL rewrite (Need Apache's mod_rewrite support)
# (default: false)

# $CFG['url_rewrite'] = true;


# [https_login] Whether to use SSL(HTTPS) after authentication (default: false)

# $CFG['https_login'] = true;
# 是否支持SSL方式.呵呵…DRL可以试试.

# [style_sheet] Configure the style sheet (default: "standard.css")
# this style sheet must be reside in the css/ subdirectory.

# $CFG['style_sheet'] = "fancy.css";
# 指定style sheet

# [title] The title for this webnews (default: "Webnews")

$CFG["title"] = "后羿在线新闻组服务";
# 标题,改个威风点儿的吧.

# [banner] The banner text or images, ex: "<img src=banner.jpg>" (default: false)

// $CFG["banner"] = "<img src=banner.jpg>";
# 可以加个Banner.

# [html_header] The file to be included as page header (default: false)

// $CFG["html_header"] = "header.htm";
# 也可以加个header

# [html_footer] The file to be included as page footer (default: false)

// $CFG["html_footer"] = "footer.htm";
# 可以加个footer,可定制度很高.

# [group_list] The group definition that show on this Web News
# You should get a copy from examples/newsgroups.lst
# (default: "newsgroups.lst")

// $CFG["group_list"] = "/somewhere/newsgroups.lst";
# 指定新闻组列表文件的位置,假如没有指定,默认在当前目录.

# [confirm_post] The message prompted to confirm the posting
# (post/reply/crosspost) (default: false)

// $CFG["confirm_post"] = "Really post the message ?";
# 发帖子前的提示.缺省状态下是不提示的.

# [confirm_forward] The message prompted to confirm the forwarding
# (default: false)

// $CFG["confirm_forward"] = "Really forward the message ?";
# 转发前的提示. 缺省状态下是不提示的.

# [magic_tag] Use magic tag to indicate the unread state of newsgroup
# (default: flase)
#

// $CFG["magic_tag"] = true;
# 加一个标签可以看到哪些是没有读过的, 缺省状态下是不加的.

# [cache_dir] Enable caching of indexing data (default: false)
# To enable caching, set this to the directory of cache data.
# You should grant write permission on this directory to the
# user running PHP.

// $CFG["cache_dir"] = "/tmp/pnews-cache";
# 缓存数据,可加快访问新闻组速度. 缺省状态是没有缓存的.

# [thread_enable] Enable threading (default: false)
# Articles in the same thread will be listed when you view one
# of the message in the thread).

// $CFG["thread_enable"] = true;
# 打开线索(嗯,这个我试了好象没感觉到效果. :S)

# [thread_db_format] Setting the dba handler used for storing threading data
# may be one of: dbm, ndbm, gdbm, db2, db3 or db4
# default: 'db3' prior to PHP 4.3.2, and 'db4' after PHP 4.3.2

// $CFG["thread_db_format"] = 'db4';
# 线索数据的存储格式,这个要注重PHP的版本.

# [group_sorting] sort newsgroups in each category (default: false)

$CFG["group_sorting"] = true;
# 新闻组列表是否排序, 缺省状态是不排序的.

# [image_inline] The uuencoded image attachment will be shown
# inline along with article (default: true)

// $CFG['image_inline'] = false;
# 设定发帖子的图片编码,这个其实俺不是太懂.

# [allow_attach_file] Max. number of allowed attachment in posting (default: 2)

// $CFG["allow_attach_file"] = 0;
# 发一个帖子的时候答应带的附件个数.

# [articles_per_page] Number of articles shown in one single page (default: 20)

// $CFG['articles_per_page'] = 30;
# 设置一页显示的帖子数, 缺省是20个.

# [email_editing] Allow E-Mail editing when posting article (default: true)

// $CFG["email_editing"] = false;
# 写帖子的时候能否改email地址.

# [hide_email] Hide E-Mail - makes it difficult for SpamBots
# to automatically obtain email addresses
# when they scan webnews pages (default: true)

// $CFG["hide_email"] = false;
# 因为新闻组经常会被一些邮件地址搜索机器人利用来搜索email地址,所以,为了防止垃圾邮件,这儿提供了一个隐藏email地址的选项.

# [filter_ansi_color] Show article in pupup window (default: true)

// $CFG["filter_ansi_color"] = false;
# 是否在弹出窗口中显示帖子.

# [time_format] The format used to displaying time (default: "%Y/%m/%d %H:%M:%S")

// $CFG["time_format"] = "%Y/%m/%d %H:%M:%S";
# 设置时间格式.

# [style_sheet] Alternative CSS (default: "style.css")

// $CFG["style_sheet"] = 'my_style.css';
# 可选的一个CSS

# [language_switch] Show language switch or not (default: true)

// $CFG["language_switch"] = false;
# 是否显示语言切换的Combo box

# [organization] The organization name of this site (default: "News Server")

$CFG["organization"] = "HouYi's News Server";
# 站点的名字,随便写一个

# [post_signature] The signature which been appended at each posted article
# (default: "")

// $CFG["post_signature"] = "\n-- \nPOST BY: PHP News Reader\n";
# 设置你的帖子的签名,”\n”表示回车换行

# [meta_description] The META description embeded in HTML header
# (default: "PHP News Reader")

// $CFG["meta_description"] = "Web-based News Reader";
# 设定Html的Hearder

# [meta_keywords] The META keywords embeded in HTML header
# (default: "news,pnews,webnews,nntp")

// $CFG["meta_keywords"] = "news,computer,network";
# 设定META要害字

# [show_sourceforge_logo] Show SourceForge logo (default: false)

$CFG["show_sourceforge_logo"] = true;
# 这个软件是一个开源项目,故有一个设定是否显示sourceforge的Logo的选项.

# [links] The links referring to other pages, (default: null)

// $CFG["links"] = array( "Back Home" => "../index.php",
// "Tech News" => "http://foo.bar/technews/" );


############################################################################
# Section 3 - Languages - Configure the setting about languages
############################################################################
#
# Natively supported languages and the codings are:
# "en" - English US-ASCII
# "zh-tw" - Traditional Chinese BIG5
# "zh-cn" - Simplified Chinese GB2312
# "unicode" - Unicode UTF-8 (default)
# "fr" - French ISO-8859-1
# "fi" - Finnish ISO-8859-1
# "de" - German ISO-8859-1
# "it" - Italiano ISO-8859-1
# "sk" - Slovak ISO-8859-2
# 以下是语言设定,因为有了这个,所以,这个程序对于中文新闻组的支持也相当好.

# [interface_language] The language setting of interface (default: "en")

$CFG["interface_language"] = "zh-cn";
# 设定界面语言

# [charset] The charset setting for various resource (default: "utf-8")
# [config] The language setting used in this config.inc.php
# [grouplst] The language setting used in newsgroups.lst
# [database] The language setting used in database or LDAP

$CFG["charset"]["config"] = "gb2312";
$CFG["charset"]["grouplst"] = "gb2312";
$CFG["charset"]["database"] = "gb2312";
# 第一个是配置文件里边的语言设定,第二是组列表的语言设定,第三个是数据库语言设定.
# 注重,后边的"gb2312"不能用大写,一定要小写.
############################################################################
# PHP News Reader
# Copyright (C) 2001-2005 - All rights reserved
# Shen Cheng-Da (cdsheen at users.sourceforge.net)
############################################################################

# Do not put anything (including blanks and line breaks) after '?' and '>'

?>

做好后的效果:
帖子来源:
https://www.d4e.org/showthread.php?t=90357

上一篇:10月23日游戏下载合集15部已测

下一篇:08-31河源精品免费绿色软件更新下载阿光整理