⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mydownloads_update.php

📁 在综合英文版XOOPS 2.09, 2.091, 2.092 的基础上正式发布XOOPS 2.09中文版 XOOPS 2.09x 版主要是PHP5升级、bug修正和安全补正: 1 全面兼容PHP 5.
💻 PHP
📖 第 1 页 / 共 3 页
字号:
<?php
if (!defined('IS_UPDATE_FILE')) {
	echo "Cannot access this file directly!";
	exit();
}

/**
 * $Id: mydownloads_update.php v 1.00 03 july 2004 Catwolf Exp $
 * Module: WF-Downloads
 * Version: v2.0.5
 * Release Date: 25 july 2004
 * Author: WF-Sections
 * Licence: GNU
 */

    $error = array();
    $output = array();
    /**
     * Delete newly created tables in WF-Downloads
     */
    $table_array = array("wfdownloads_broken",
        "wfdownloads_cat",
        "wfdownloads_downloads",
        "wfdownloads_mimetypes",
        "wfdownloads_mod",
        "wfdownloads_reviews",
        "wfdownloads_votedata",
        "wfdownloads_indexpage"
        );
    foreach ($table_array as $table_arr)
    {
        $result = $xoopsDB -> queryF("DROP TABLE " . $xoopsDB -> prefix($table_arr) . " ");
        if (!$result)
        {
            $error[] = "<b>Error:</b> Could <span style='color:#ff0000;font-weight:bold'>not delete</span> table <b>$table_arr</b> as it does not exist!";
        } 
        else
        {
            $output[] = "<b>Success:</b> Table <b>$table_arr</b> was <span style='color:#FF0000;font-weight:bold'>delete</span> Successfully";
        } 
    } 
    /**
     * Copy over old download tables without delete;
     */
    $table_array = array("mydownloads_broken" => "wfdownloads_broken",
        "mydownloads_cat" => "wfdownloads_cat",
        "mydownloads_downloads" => "wfdownloads_downloads",
        "mydownloads_mod" => "wfdownloads_mod",
        "mydownloads_votedata" => "wfdownloads_votedata",
        ); 
    // $result = $xoopsDB->queryF("ALTER TABLE " . $xoopsDB->prefix("mydownloads_reviews") . " RENAME TO " . $xoopsDB->prefix("wfdownloads_reviews") . " ");
    foreach ($table_array as $table1 => $table2)
    {
        $result = $xoopsDB -> queryF("ALTER TABLE " . $xoopsDB -> prefix(trim($table1)) . " RENAME TO " . $xoopsDB -> prefix(trim($table2)) . " ");
        if (!$result)
        {
            $error[] = "<b>Error:</b> Could <span style='color:#ff0000;font-weight:bold'>not rename</span> table $table1 to table <b>$table2</b>!";
        } 
        else
        {
            $output[] = "<b>Success:</b> Table <b>$table1</b> was <span style='color:#FF0000;font-weight:bold'>renamed</span> to $table2 Successfully";
        } 
        unset($result);
    } 

    /**
     * Create Index Page tables
     */
    $result = $xoopsDB -> queryF("CREATE TABLE " . $xoopsDB -> prefix("wfdownloads_indexpage") . " (
  		indeximage varchar(255) NOT NULL default 'blank.png',
  		indexheading varchar(255) NOT NULL default 'WF-Sections',
  		indexheader text NOT NULL,
 		indexfooter text NOT NULL,
 		nohtml tinyint(8) NOT NULL default '1',
		nosmiley tinyint(8) NOT NULL default '1',
		noxcodes tinyint(8) NOT NULL default '1',
		noimages tinyint(8) NOT NULL default '1',
		nobreak tinyint(4) NOT NULL default '0',
		indexheaderalign varchar(25) NOT NULL default 'left',
		indexfooteralign varchar(25) NOT NULL default 'center',
		FULLTEXT KEY indexheading (indexheading),
  		FULLTEXT KEY indexheader (indexheader),
  		FULLTEXT KEY indexfooter (indexfooter)
		)
  	"); 
    # Dumping data for table `wfdownloads_indexpage`
    $xoopsDB -> query("INSERT INTO " . $xoopsDB -> prefix("wfdownloads_indexpage") . " VALUES ('logo.png', 'wfdownloads', 'wfdownloads heading', 'wfdownloads footer', 0, 0, 0, 0, 1, 'left', 'center')");
    /**
     * Reviews table
     */
    $result = $xoopsDB -> queryF("CREATE TABLE " . $xoopsDB -> prefix("wfdownloads_reviews") . " (
		review_id int(11) unsigned NOT NULL auto_increment,
	  	lid int(11) NOT NULL default '0',
	  	title varchar(255) default NULL,
	 	review text,
	  	submit int(11) NOT NULL default '0',
	  	date int(11) NOT NULL default '0',
	  	uid int(10) NOT NULL default '0',
	  	rated int(11) NOT NULL default '0',
	  	PRIMARY KEY  (review_id),
	  	KEY categoryid (lid)
	 )");

    /**
     * Create mimetype update
     */
    $table = "wfdownloads_mimetypes";
    $result = $xoopsDB -> queryF("CREATE TABLE `" . $xoopsDB -> prefix("wfdownloads_mimetypes") . "` (
	  	mime_id int(11) NOT NULL auto_increment,
	  	mime_ext varchar(60) NOT NULL default '',
	  	mime_types text NOT NULL,
	  	mime_name varchar(255) NOT NULL default '',
	 	mime_admin int(1) NOT NULL default '1',
	  	mime_user int(1) NOT NULL default '0',
	  	KEY mime_id (mime_id)
	)");
    if (!$result)
    {
        $error[] = "<b>Error:</b> Could <span style='color:#ff0000;font-weight:bold'>not create</span> new table <b>$table</b>!";
    } 
    else
    {
        $output[] = "<b>Success:</b> Table <b>$table</b> was <span style='color:#FF0000;font-weight:bold'>created</span> Successfully";
    } 
    $xoopsDB -> query("INSERT INTO " . $xoopsDB -> prefix("wfdownloads_mimetypes") . " VALUES (1, 'bin', 'application/octet-stream', 'Binary File/Linux Executable', 0, 0)");
    $xoopsDB -> query("INSERT INTO " . $xoopsDB -> prefix("wfdownloads_mimetypes") . " VALUES (2, 'dms', 'application/octet-stream', 'Amiga DISKMASHER Compressed Archive', 1, 0)");
    $xoopsDB -> query("INSERT INTO " . $xoopsDB -> prefix("wfdownloads_mimetypes") . " VALUES (3, 'class', 'application/octet-stream', 'Java Bytecode', 1, 0)");

⌨️ 快捷键说明

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