代碼: 選擇全部
###############################################
## Hack Title: db_update generator
## Hack Version: 0.0.9
## Author: Freakin' Booty ;-P & Antony Bailey
## Description: Creates a form into which you enter your SQL and a db_update.php file is then created. You can
## either copy/paste the file, or download it onto your computer.
## Compatibility: 2.0.0 - 2.0.5
##
## Installation Level: Easy
## Installation Time: 2 minutes
## Files To Edit: 1
## language/lang_english/lang_main.php
##
## Included Files: 3
## db_generator.php
## language/lang_english/db_generator.tpl
## templates/subSilver/db_generator_body.tpl
## admin_db_generator.php
## admin_db_generator.tpl
##
## History:
## 0.0.1: Initial code.
## 0.0.2: Template fixed up and a few new bits added.
## 0.0.3: Language variables added to language files, make it easier for translation.
## 0.0.4: Added the possibility to download the db_update.php file - mainly to add ease-of-use and to prevent
## people getting "headers already sent" errors. You can now specify your own table prefix - needed if
## the generator is not on your own server.
## 0.0.5: Fixed one language variable in the template.
## 0.0.6: The default table prefix is now added in the field by default.
## 0.0.7: The default table prefix, is now pulled from your phpBB config.php file, making the utility easier for a user.
## 0.0.8: Cleaned up the db_update.php template.
## 0.0.8: Added the admin panel option.
##
## Author Notes:
## None
##
## Support: http://www.phpbbhacks.com/forums
## Copyright: ?003 db_update.php Generator 0.0.9 - Freakin' Booty ;-P & Antony Bailey
##
###############################################
## You downloaded this hack from phpBBHacks.com, the #1 source for phpBB related downloads.
## Please visit http://www.phpbbhacks.com/forums for support.
###############################################
##
###############################################
## This hack is released under the GPL License.
## This hack can be freely used, but not distributed, without permission.
## Intellectual Property is retained by the hack author(s) listed above.
###############################################
我自行中文化的部份
![圖檔](http://phpbb-tw.net/phpbb/images/smiles/icon_redface.gif)
代碼: 選擇全部
//
// db_update generator
//
$lang['Db_update_generator'] = 'db_update 生成器';
$lang['Instructions'] = '簡介';
$lang['SQL_instructions'] = '這是一個建立PHP 檔案來更新你資料庫,並讓你可以透過瀏覽器來執行他。這裡有一些東西在你輸入SQL前必須要詳細查閱。<br />第一,確定每項SQL 查詢是以分號 (;)來完結的。如果不是,將會建立db_update失敗。下一步,確定資料表的表格字首是"phpbb_"。程式會自動覆寫你自己的資料庫的表格字首。';
$lang['Table_prefix'] = '資料庫的表格字首 (Prefix)';
$lang['Table_prefix_explain'] = 'phpBB 是使用一個標準的資料庫的表格字首。這通常是 \'phpbb_\' 。如果你在安裝時曾經自訂過其他的資料庫的表格字首,你的就會不同。如果是的話,請更改相應的。 <br /><br />如果你不清楚如何尋找資料庫的表格字首,請在你的主目錄下開啟 \'config.php\' ,尋找 \'$table_prefix\' 的設定。';
$lang['Enter_SQL'] = '輸入SQL 指令';
$lang['Enter_SQL_explain'] = 'MySQL 是世界上最受歡迎的資料庫,它的速度和可靠性為人認同';
$lang['Output_SQL'] = 'SQL 輸出';
$lang['Output_SQL_explain'] = '複製和貼上以下這些文字去一個新的空白檔案。將此檔案儲存為<u>db_update</u>,再上載去你的伺服器上。使用瀏覽器執行他(你必須以系統管理員身份登入)。<br /><br />你亦可以按"下載"將此檔案下載到你的電腦(建議)';
$lang['Output_SQL_explain'] = '複製和貼上以下這些文字去一個新的空白檔案。將此檔案儲存為<u>db_update</u>,再上載去你的伺服器上。使用瀏覽器執行他(你必須以系統管理員身份登入)。';
$lang['Download'] = '下載';
代碼: 選擇全部
<?php
/***************************************************************************
* db_update.php
* -------------------
* copyright : ?003 Freakin' Booty ;-P & Antony Bailey
*
***************************************************************************/
/***************************************************************************
*
\n * 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.
*
***************************************************************************/
define('IN_PHPBB', true);
$phpbb_root_path = './';
include($phpbb_root_path . 'extension.inc');
include($phpbb_root_path . 'common.'.$phpEx);
//
// Start session management
//
$userdata = session_pagestart($user_ip, PAGE_INDEX);
init_userprefs($userdata);
//
// End session management
//
if( !$userdata['session_logged_in'] )
{
$header_location = ( @preg_match('/Microsoft|WebSTAR|Xitami/', getenv('SERVER_SOFTWARE')) ) ? 'Refresh: 0; URL=' : 'Location: ';
header($header_location . append_sid('login.'.$phpEx.'?redirect=db_update.'.$phpEx));
exit;
}
if( $userdata['user_level'] != ADMIN )
{
message_die(GENERAL_MESSAGE, 'You are not authorised to access this page');
}
$page_title = '更新資料庫';
include($phpbb_root_path . 'includes/page_header.'.$phpEx);
echo '<table width="100%" cellspacing="1" cellpadding="2" border="0" class="forumline">';
echo '<tr><th>更新資料庫</th></tr><tr><td><span class="genmed"><ul type="circle">';
$sql = array();
{SQL_OUTPUT}
for( $i = 0; $i < count($sql); $i++ )
{
if( !$result = $db->sql_query ($sql[$i]) )
{
$error = $db->sql_error();
echo '<li>' . $sql[$i] . '<br /> +++ <font color="#FF0000"><b>錯誤:</b></font> ' . $error['message'] . '</li><br />';
}
else
{
echo '<li>' . $sql[$i] . '<br /> +++ <font color="#00AA00"><b>完成</b></font></li><br />';
}
}
echo '</ul></span></td></tr><tr><td class="catBottom" height="28"> </td></tr>';
echo '<tr><th>End</th></tr><tr><td><span class="genmed">安裝已完成,請立即刪除此檔案。<br />如果你運行有任何錯誤,請瀏覽 <a href="http://www.phpbbhacks.com/forums" target="_phpbbhacks">phpBBHacks.com 技術支援論壇</a>請教某人去幫助你.</span></td></tr>';
echo '<tr><td class="catBottom" height="28" align="center"><span class="genmed"><a href="' . append_sid("index.$phpEx") . '">回到首頁</a></span></td></table>';
include($phpbb_root_path . 'includes/page_tail.'.$phpEx);
?>