module.v100.php

来自「php 开发的内容管理系统」· PHP 代码 · 共 324 行 · 第 1/2 页

PHP
324
字号
<?php
// $Id: module.php,v 1.1.1.2 2005/10/19 16:23:50 phppp Exp $
//  ------------------------------------------------------------------------ //
//                XOOPS - PHP Content Management System                      //
//                    Copyright (c) 2000 XOOPS.org                           //
//                       <http://www.xoops.org/>                             //
//  ------------------------------------------------------------------------ //
//  This program is free software; you can redistribute it and/or modify     //
//  it under the terms of the GNU General Public License as published by     //
//  the Free Software Foundation; either version 2 of the License, or        //
//  (at your option) any later version.                                      //
//                                                                           //
//  You may not change or alter any portion of this comment or credits       //
//  of supporting developers from this source code or any supporting         //
//  source code which is considered copyrighted (c) material of the          //
//  original comment or credit authors.                                      //
//                                                                           //
//  This program is distributed in the hope that it will be useful,          //
//  but WITHOUT ANY WARRANTY; without even the implied warranty of           //
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the            //
//  GNU General Public License for more details.                             //
//                                                                           //
//  You should have received a copy of the GNU General Public License        //
//  along with this program; if not, write to the Free Software              //
//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA //
//  ------------------------------------------------------------------------ //
//  Author: phppp (D.J., infomax@gmail.com)                                  //
//  URL: http://xoopsforge.com, http://xoops.org.cn                          //
//  Project: Article Project                                                 //
//  ------------------------------------------------------------------------ //

function xoops_module_update_newbb_v100(&$module) 
{
	$result = $GLOBALS['xoopsDB']->queryF("CREATE TABLE ".$GLOBALS['xoopsDB']->prefix("bb_archive")."(
		`topic_id` tinyint(8) NOT NULL default '0',
		`post_id` tinyint(8) NOT NULL default '0',
	  	`post_text` text NOT NULL
		) TYPE=MyISAM");
	if (!$result) {
		$module->setErrors("Could not create bb_archive");
	}
	
	$result = $GLOBALS['xoopsDB']->queryF("CREATE TABLE ".$GLOBALS['xoopsDB']->prefix("bb_attachments")."(
		`attach_id` int(8) unsigned NOT NULL auto_increment,
		`post_id` int(10) default NULL,
		`name_saved` varchar(255) default NULL,
		`name_disp` varchar(255) default NULL,
		`mimetype` varchar(255) default NULL,
		`online` int(1) NOT NULL default '1',
		`attach_time` int(10) NOT NULL default '0',
		`download` int(10) NOT NULL default '0',
		PRIMARY KEY  (`attach_id`),
		KEY `post_id` (`post_id`)
		) TYPE=MyISAM");
	if (!$result) {
		$module->setErrors("Could not create bb_attachments");
	}
	
	$result = $GLOBALS['xoopsDB']->queryF("CREATE TABLE ".$GLOBALS['xoopsDB']->prefix("bb_digest")."(
		`digest_id` int(8) unsigned NOT NULL auto_increment,
		`digest_time` int(10) NOT NULL default '0',
		`digest_content` text,
		PRIMARY KEY  (`digest_id`),
		KEY `digest_time` (`digest_time`)
		) TYPE=MyISAM");
	if (!$result) {
		$module->setErrors("Could not create bb_digest");
	}
	
	$result = $GLOBALS['xoopsDB']->queryF("CREATE TABLE ".$GLOBALS['xoopsDB']->prefix("bb_online")."(
		`online_forum` int(10) NOT NULL default '0',
		`online_topic` int(10) NOT NULL default '0',
		`online_uid` int(10) default NULL,
		`online_uname` varchar(255) default NULL,
		`online_ip` varchar(32) default NULL,
		`online_updated` int(14) default NULL
		) TYPE=MyISAM");
	if (!$result) {
		$module->setErrors("Could not create bb_online");
	}
	
	$result = $GLOBALS['xoopsDB']->queryF("CREATE TABLE ".$GLOBALS['xoopsDB']->prefix("bb_report")."(
		`report_id` int(8) unsigned NOT NULL auto_increment,
		`post_id` int(10) default NULL,
		`reporter_uid` int(10) default NULL,
		`reporter_ip` int(11) NOT NULL default '0',
		`report_time` int(10) NOT NULL default '0',
		`report_text` varchar(255) default NULL,
		`report_result` tinyint(1) NOT NULL default '0',
		`report_memo` varchar(255) default NULL,
		PRIMARY KEY  (`report_id`),
		KEY `post_id` (`post_id`)
		) TYPE=MyISAM");
	if (!$result) {
		$module->setErrors("Could not create bb_report");
	}
	
	$result = $GLOBALS['xoopsDB']->queryF("CREATE TABLE ".$GLOBALS['xoopsDB']->prefix("bb_votedata")."(
		`ratingid` int(11) unsigned NOT NULL auto_increment,
		`topic_id` int(11) unsigned NOT NULL default '0',
		`ratinguser` int(11) NOT NULL default '0',
		`rating` tinyint(3) unsigned NOT NULL default '0',
		`ratinghostname` varchar(60) NOT NULL default '',
		`ratingtimestamp` int(10) NOT NULL default '0',
		PRIMARY KEY  (ratingid),
		KEY ratinguser (ratinguser),
		KEY ratinghostname (ratinghostname),
		KEY topic_id (topic_id)
		) TYPE=MyISAM");
	if (!$result) {
		$module->setErrors("Could not create bb_votedata");
	}
	
	$result = $GLOBALS['xoopsDB']->queryF("ALTER TABLE ".$GLOBALS['xoopsDB']->prefix("bb_categories")." ADD `cat_image` VARCHAR(50) DEFAULT NULL AFTER `cat_id`");
	if (!$result) {
		$module->setErrors("Could not add field in bb_categories");
	}
	
	$result = $GLOBALS['xoopsDB']->queryF("ALTER TABLE ".$GLOBALS['xoopsDB']->prefix("bb_categories")." ADD `cat_description` TEXT NOT NULL AFTER `cat_title`");
	if (!$result) {
		$module->setErrors("Could not add field in bb_categories");
	}
	
	$result = $GLOBALS['xoopsDB']->queryF("ALTER TABLE ".$GLOBALS['xoopsDB']->prefix("bb_categories")." CHANGE `cat_order` `cat_order` SMALLINT(3) UNSIGNED NOT NULL DEFAULT '0'");
	if (!$result) {
		$module->setErrors("Could not change field in bb_categories");
	}
	
	$result = $GLOBALS['xoopsDB']->queryF("ALTER TABLE ".$GLOBALS['xoopsDB']->prefix("bb_categories")." ADD `cat_url` VARCHAR(50) DEFAULT NULL AFTER `cat_state`");
	if (!$result) {
		$module->setErrors("Could not add field in bb_categories");
	}
	
	$result = $GLOBALS['xoopsDB']->queryF("ALTER TABLE ".$GLOBALS['xoopsDB']->prefix("bb_forums")." DROP `forum_access`");
	if (!$result) {
		$module->setErrors("Could not drop field in bb_forums");
	}
	
	$result = $GLOBALS['xoopsDB']->queryF("ALTER TABLE ".$GLOBALS['xoopsDB']->prefix("bb_forums")." DROP `posts_per_page`");
	if (!$result) {
		$module->setErrors("Could not drop field in bb_forums");
	}
	
	$result = $GLOBALS['xoopsDB']->queryF("ALTER TABLE ".$GLOBALS['xoopsDB']->prefix("bb_forums")." DROP `topics_per_page`");
	if (!$result) {
		$module->setErrors("Could not drop field in bb_forums");
	}
	
	$result = $GLOBALS['xoopsDB']->queryF("ALTER TABLE ".$GLOBALS['xoopsDB']->prefix("bb_forums")." ADD `parent_forum` INT(10) NOT NULL DEFAULT '0' AFTER `forum_desc`");
	if (!$result) {
		$module->setErrors("Could not add field in bb_forums");
	}
	
	$result = $GLOBALS['xoopsDB']->queryF("ALTER TABLE ".$GLOBALS['xoopsDB']->prefix("bb_forums")." CHANGE `forum_moderator` `forum_moderator` TEXT NOT NULL");
	if (!$result) {
		$module->setErrors("Could not change field in bb_forums");
	}
	
	$result = $GLOBALS['xoopsDB']->queryF("ALTER TABLE ".$GLOBALS['xoopsDB']->prefix("bb_forums")." CHANGE `forum_type` `forum_type` INT(1) NOT NULL DEFAULT '0'");
	if (!$result) {
		$module->setErrors("Could not change field in bb_forums");
	}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?