phpbb3论坛的半自动新闻采集
查找[code]// Grab icons[/code]
将上面的
[code]));[/code]
替换为
[code] //采集新闻地址入口
'U_GET_XINHUANET_LIST' => ($auth->acl_get('f_post', $forum_id) || $user->data['user_id'] == ANONYMOUS) ? append_sid("{$phpbb_root_path}v_get_xinhuanet.$phpEx", 'mode=post&f=' . $forum_id) : '',
'U_GET_SDINFO_LIST' => ($auth->acl_get('f_post', $forum_id) || $user->data['user_id'] == ANONYMOUS) ? append_sid("{$phpbb_root_path}v_get_sdinfo.$phpEx", 'mode=post&f=' . $forum_id) : '',
'U_GET_JNNC_LIST' => ($auth->acl_get('f_post', $forum_id) || $user->data['user_id'] == ANONYMOUS) ? append_sid("{$phpbb_root_path}v_get_jnnc.$phpEx", 'mode=post&f=' . $forum_id) : '',
'U_GET_SDNEWS_LIST' => ($auth->acl_get('f_post', $forum_id) || $user->data['user_id'] == ANONYMOUS) ? append_sid("{$phpbb_root_path}v_get_sdnews.$phpEx", 'mode=post&f=' . $forum_id) : '',
'U_GET_READMEOK_LIST' => ($auth->acl_get('f_post', $forum_id) || $user->data['user_id'] == ANONYMOUS) ? append_sid("{$phpbb_root_path}v_get_readmeok.$phpEx", 'mode=post&f=' . $forum_id) : '',
'U_GET_E23_LIST' => ($auth->acl_get('f_post', $forum_id) || $user->data['user_id'] == ANONYMOUS) ? append_sid("{$phpbb_root_path}v_get_e23.$phpEx", 'mode=post&f=' . $forum_id) : '',
//采集新闻地址入口结束
));[/code]
2,打开论坛程序\styles\风格目录下的viewforum_body.html
查找
[code]<!-- INCLUDE pagination.html -->[/code]
下面添加
[code]<!-- IF U_ACP --><span class="gensmall">
[<a href="{U_GET_XINHUANET_LIST}">xinhuanet</a>]
[<a href="{U_GET_SDINFO_LIST}">sdinfo</a>]
[<a href="{U_GET_JNNC_LIST}">jnnc</a>]
[<a href="{U_GET_SDNEWS_LIST}">sdnews</a>]
[<a href="{U_GET_READMEOK_LIST}">readmeok</a>]
[<a href="{U_GET_E23_LIST}">e23</a>]
[<a href="http://news.google.com/news/section?pz=1&cf=all&q=%E6%B5%8E%E5%8D%97&ict=ln".html>google_jn</a>]
</span><!-- ENDIF -->
[/code]
3查找
[code]$make_global = false;[/code]
上面添加
[code]//按时间的年月日格式获取文件名
$file_name =date('Y_m_d', time());//当前时间年月日显示 ;
//判断是否新发布文章
if ($mode == 'post')
{
//主题写入_topic.txt
if ($fd = @fopen($phpbb_root_path."/store/".$file_name."new_topic.txt", "a")) {
flock($fd, LOCK_EX);
fseek($fd, 0, SEEK_END);
//INSERT INTO `phpbb_topics` (`topic_id`, `forum_id`, `icon_id`, `topic_attachment`, `topic_approved`, `topic_reported`, `topic_title`, `topic_poster`, `topic_time`, `topic_time_limit`, `topic_views`, `topic_replies`, `topic_replies_real`, `topic_status`, `topic_type`, `topic_first_post_id`, `topic_first_poster_name`, `topic_first_poster_colour`, `topic_last_post_id`, `topic_last_poster_id`, `topic_last_poster_name`, `topic_last_poster_colour`, `topic_last_post_subject`, `topic_last_post_time`, `topic_last_view_time`, `topic_moved_id`, `topic_bumped`, `topic_bumper`, `poll_title`, `poll_start`, `poll_length`, `poll_max_options`, `poll_last_vote`, `poll_vote_change`) VALUES
//(5196, 46, 0, 0, 1, 0, '2020', 2, 1334493139, 0, 2, 0, 0, 0, 0, 5999, 'yyn', 'AA0000', 5999, 2, 'yyn', 'AA0000', '2020', 1334493139, 1334493163, 0, 0, 0, '', 0, 0, 1, 0, 0);
// fwrite($fd, "delete from 'phpbb'.'phpbb_topic' where 'phpbb_topics'.'topic_id'=".$data['topic_id'].";\n");
fwrite($fd, "INSERT INTO `phpbb_topics` VALUES(".$data['topic_id'].",".$data['forum_id'].",0,0,1,0,'$subject',$poster_id,$current_time, 0, 1, 0, 0, 0, 0, ".$data['post_id'].",'".$user->data['username']."','".$user->data['user_colour']."',".$data['post_id'].",".$user->data['user_id'].",'".$user->data['username']."','".$user->data['user_colour']."','$subject',$current_time,$current_time, 0, 0, 0, '".$poll['poll_title']."', '$poll_start', '$poll_length', '".$poll['poll_max_options']."', 0, 0);\r\n");
//主题写入_topic.txt结束
//帖子写入_post.txt
fwrite($fd, "INSERT INTO `phpbb_posts` VALUES(".$data['post_id'].", ".$data['topic_id'].", ".$data['forum_id'].", $poster_id, 0, '$user->ip', $current_time, $post_approved, 0, 1, 1, 1, 1, '', '$subject', '".addslashes($data['message'])."','".$data['message_md5']."', 0, '".$data['bbcode_bitfield']."', '".$data['bbcode_uid']."', 1, 0, '', 0, 0, 0);\r\n");
flock($fd, LOCK_UN);
fclose($fd);
}
//帖子写入_post.txt结束
} //判断新文章发布状态结束
//判断文章回复状态
if ($mode == 'reply')
{
//帖子写入_post.txt
if ($fd = @fopen($phpbb_root_path."/store/".$file_name."reply_post.txt", "a")) {
flock($fd, LOCK_EX);
fseek($fd, 0, SEEK_END);
//INSERT INTO `phpbb_posts` (`post_id`, `topic_id`, `forum_id`, `poster_id`, `icon_id`, `poster_ip`, `post_time`, `post_approved`, `post_reported`, `enable_bbcode`, `enable_smilies`, `enable_magic_url`, `enable_sig`, `post_username`, `post_subject`, `post_text`, `post_checksum`, `post_attachment`, `bbcode_bitfield`, `bbcode_uid`, `post_postcount`, `post_edit_time`, `post_edit_reason`, `post_edit_user`, `post_edit_count`, `post_edit_locked`) VALUES
//(5986, 5183, 2, 2, 0, '127.0.0.1', 1331872792, 1, 0, 1, 1, 1, 1, '', '66', '666', 'fae0b27c451c728867a567e8c1bb4e53', 0, '', '2pg8tfks', 1, 0, '', 0, 0, 0);
// fwrite($fd, "delete from 'phpbb'.'phpbb_posts' where 'phpbb_posts'.'post_id'=".$data['post_id'].";\n");
fwrite($fd, "INSERT INTO `phpbb_posts` VALUES(".$data['post_id'].", ".$data['topic_id'].", ".$data['forum_id'].", $poster_id, 0, '$user->ip', $current_time, $post_approved, 0, 1, 1, 1, 1, '', '$subject', '".addslashes($data['message'])."','".$data['message_md5']."', 0, '".$data['bbcode_bitfield']."', '".$data['bbcode_uid']."', 1, 0, '', 0, 0, 0);\r\n");
flock($fd, LOCK_UN);
fclose($fd);
}
//帖子写入_post.txt结束
} //判断文章回复状态结束
//判断文章编辑状态
if ($mode == 'edit')
{
if ($fd = @fopen($phpbb_root_path."/store/".$file_name."edit_post.txt", "a")) {
flock($fd, LOCK_EX);
fseek($fd, 0, SEEK_END);
//更新标题
fwrite($fd, "UPDATE `phpbb`.`phpbb_topics` SET `topic_title` = '$subject' WHERE `phpbb_topics`.`topic_id` = ".$data['topic_id'].";\n");
//更新文章内容
fwrite($fd, "UPDATE `phpbb`.`phpbb_posts` SET `post_text` = '".$data['message']."' WHERE `phpbb_posts`.`post_id` = ".$data['post_id'].";\n");
flock($fd, LOCK_UN);
fclose($fd);
}
//帖子写入_edit_post.txt结束
} //判断文章编辑状态结束
[/code]