第一步:按照模块克隆指南的说明复制"news"模块
第二步:(如果是全新安装news,可以跳过此步)运行 XOOPS/modules/news/import/news.php
第三步:升级(或全新安装)news模块
第四步:设置/调整模块权限和区块设置
第五步:修改XOOPS/backend.php(代码附后)
第六步:如果使用wfdownloads模块,用后边的代码替换 /wfdownloads/admin/newstory.php 的内容
附一:将下列代码添加到XOOPS/backend.php头部
附二:用下列代码替换/wfdownloads/admin/newstory.php
第二步:(如果是全新安装news,可以跳过此步)运行 XOOPS/modules/news/import/news.php
第三步:升级(或全新安装)news模块
第四步:设置/调整模块权限和区块设置
第五步:修改XOOPS/backend.php(代码附后)
第六步:如果使用wfdownloads模块,用后边的代码替换 /wfdownloads/admin/newstory.php 的内容
附一:将下列代码添加到XOOPS/backend.php头部
chdir("./modules/news/");
$_SERVER[ 'PHP_SELF' ] = dirname($_SERVER[ 'PHP_SELF' ])."/modules/news/xml.php";
$_SERVER[ 'REQUEST_URI' ] = $_SERVER[ 'PHP_SELF' ]."?rss";
include "xml.php";
exit();
附二:用下列代码替换/wfdownloads/admin/newstory.php
<?php
$category_handler =& xoops_getmodulehandler("category", "news");
$cat_id = isset($_POST["cat_id"]) ? intval($_POST["cat_id"]) : 0 ;
$category_obj =& $category_handler->get($cat_id);
$isModerator = $category_handler->getPermission($category_obj, "submit");
if( !$category_handler->getPermission($category_obj,"submit") ) {
return;
}
$article_handler =& xoops_getmodulehandler("article", "news");
$article_obj =& $article_handler->create();
$article_obj->setVar("art_title", $title);
$art_summary = $_POST["description"]. "rnrn".$title."";
$article_obj->setVar("art_summary", $art_summary);
$article_obj->setVar("cat_id", $cat_id);
$article_obj->setVar("uid", $xoopsUser->getVar("uid"));
$article_obj->setVar("art_time_create", time());
$article_obj->setVar("art_time_submit", time());
$article_obj->setVar("art_time_publish", time());
$art_id_new = $article_handler->insert($article_obj);
$cats[$cat_id] = array( "status" => 1, "uid" => $article_obj->getVar("uid") );
$article_handler->registerCategory($article_obj, $cats);
$article_handler->updateCategories($article_obj);
$text_handler =& xoops_getmodulehandler("text", "news");
$text_obj =& $text_handler->create();
$text_obj->setVar("art_id", $article_obj->getVar("art_id"));
$text_obj->setVar("dobr", 1);
$text_obj->setVar("text_body", $art_summary);
$text_id = $text_handler->insert($text_obj);
$article_obj->setVar("art_pages", array($text_id), true); // NOT GPC, important!
$article_handler->insert($article_obj);
?>