Add new directory structure. Tags will contain current and past releases, and stable will contain any bug fixes to the current stable release so users won't have to get the potentially broken trunk build to fix a screwup in stable.

Trunk updated to 0.9

git-svn-id: http://kusabax.cultnet.net/svn/repo/stable@176 73d99b7e-4f53-4972-b7b7-2ecd3c4d89ee
This commit is contained in:
Sazpaimon committed 2009-05-27 06:37:50 +00:00
commit 88bacfad9c
316 files changed
+79806

No files matched your search

+14
View File
@@ -0,0 +1,14 @@
===== Serissa to Kusaba X 0.8 Conversion Script =====
=== How to use ===
1. Copy s2xk.php and s2kx.sql to the folder containing config.php on your server.
2. Run s2kx.php.
3. Download the full version Kusaba X from http://kusabax.org
4. Make a backup of your current config.php
5. Extract the files that you downloaded where you want them installed. Overwrite everything.
6. If everything went right, congratulations! You are now running Kusaba X 0.8!
== When upgrading to Kusaba X 0.9 ==
7. Once converted, you will need to run the upgrade scripts to upgrade from Kusaba X 0.8 to Kusabax 0.9. These scripts are located in the OTHER directory.
+146
View File
@@ -0,0 +1,146 @@
<?php
/**
* @ignore
*/
################################################################################
# kusaba MySQL Importing Script v1.0 is © 2007 David Steven-Jennings (relixx@gmail.com)
#
# This work is licensed under the Creative Commons Attribution-ShareAlike 2.5 License.
# To view a copy of this license, visit http://creativecommons.org/licenses/by-sa/2.5/
# or send a letter to Creative Commons, 543 Howard Street, 5th Floor, San Francisco,
# California, 94105, USA.
#
# You can modify this script as you wish just as long as this box stays intact. If
# you do modify this script please state that you have done so and give me credit
# as the author of the original script (with my email address intact).
################################################################################
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="pl" lang="pl">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>MySQL Batch File Importing Script</title>
<style type="text/css">
body { font-family: sans-serif; font-size: 75%; background: #ffe }
a { text-decoration: none; color: #550 }
h1,h2 { margin: 0px; background: #fca }
h1 { font-size: 150% }
h2 { font-size: 100%; margin-top: 1em }
.hl { font-style: italic }
.plus { float: right; font-size: 8px; font-weight: normal; padding: 1px 4px 2px 4px; margin: 0px 0px; background: #eb9; color: #000; border: 1px solid #da8; cursor: hand; cursor: pointer }
.plus:hover { background: #da8; border: 1px solid #c97 }
ul { list-style: none; padding-left: 0px; margin: 0px }
li { margin: 0px }
li:hover { background: #fec; }
li a { display: block; width: 100%; }
</style>
<link rel="shortcut icon" href="/favicon.ico" />
</head>
<body>
<div style="text-align:center;"><h1>MySQL Batch File Importing Script</h1></div>
<?php
if (!isset($_POST["confirm"])) {
?>
<br /><br />
<font color="#FF0000"><strong>WARNING!</strong></font><br /><br />
The purpose of this script is to quickly and easily run the commands contained within the kusaba SQL file, and is
to be used if you are installing the script for the first time or want to recreate the tables, for whatever reason.<br />
Running this script will delete any related tables and their data (including the admin files). I offer this script as-is and cannot be held
responsible for any damages caused or accidental loss of data incurred as a result of running this script.<br />
Before running this script, make sure that:<br />
<ul>
<li>-&gt; You have set up the database connection and that it is working</li>
<li>-&gt; You have created the database</li>
<li>-&gt; You have created the database user and set up the config file appropriately</li>
</ul>
<form action="install-mysql.php" method="post">
<br />
<input type="checkbox" name="confirm"> By clicking this check box I agree that the author of this script cannot be held responsible for my own stupidity if something goes wrong.<br /><br /><br />
<input type="submit" value="Import the MySQL batch file">
</form>
<?php
} else {
require('config.php');
$reqiredtables = array("ads","announcements","banlist","bannedhashes","blotter","boards","board_filetypes","embeds","events","filetypes","front","loginattempts","modlog","module_settings","posts","reports","sections","staff","watchedthreads","wordfilter");
foreach ($reqiredtables as $tablename) {
if (mysql_table_exists(KU_DBDATABASE,KU_DBPREFIX.$tablename)) {
die("Table <strong>".KU_DBPREFIX.$tablename."</strong> already exists in the database! Drop it, and re run this script.");
}
}
// Lets open the file for reading! :)
echo '<h2>SQL Batch File Processing</h2>';
echo 'Locating \'kusaba_freshinstall.mysql.sql\'... ';
if (file_exists('kusaba_freshinstall.mysql.sql') && (filesize('kusaba_freshinstall.mysql.sql') > 0)) {
echo 'found.<br />';
$sqlfile = fopen('kusaba_freshinstall.mysql.sql', 'r');
echo 'File opened.<br />';
$readdata = fread($sqlfile, filesize('kusaba_freshinstall.mysql.sql'));
$readdata = str_replace('PREFIX_',KU_DBPREFIX,$readdata);
fclose($sqlfile);
echo 'Contents read.<br />';
}else{
echo '<font color=red>error.</font> ';
die('An error occured. kusaba_freshinstall.mysql.sql does not exist in this directory or it is 0 bytes big :( Barring that, do you have read permissions for the directory?');
}
$tc_db->Execute("ALTER DATABASE `" . KU_DBDATABASE . "` CHARACTER SET utf8 COLLATE utf8_general_ci");
// Explodes the array
$sqlarray = explode("\n", $readdata);
// Loops through the array and deletes the non-SQL bits in the file, which is basically the '--' lines and the lines with no content
foreach ($sqlarray as $key => $sqldata) {
if (strstr($sqldata, '--') || strlen($sqldata) == 0){
unset($sqlarray[$key]);
}
}
// Here we are imploding everything together again...
$readdata = implode('',$sqlarray);
// ...then exploding it again. At this point we will have an array where each key's value is a one of the CREATE statements
$sqlarray = explode(';',$readdata);
echo 'File contents have been formatted for use with mysql_query.<br />';
// Lets drop any existing tables in the database
$listoftables = $tc_db->GetAll("show tables from ".KU_DBDATABASE."");
echo '<h2>Table Creation</h2>';
// Lets now loop through the array and create each table
foreach ($sqlarray as $sqldata) {
if (strlen($sqldata) !== 0) { // As the array was exploded on ';', the last ';' caused a blank element to be created as there was no data after it :p
// The following three lines retrieve the table name of the table from the sql command. It's dynamic so it doesn't matter how many tables need to be created
// As long as each CREATE TABLE statement stays in the format CREATE TABLE `table` then this part will work.
$pos1 = strpos($sqldata, '`');
$pos2 = strpos($sqldata, '`', $pos1 + 1);
$tablename = substr($sqldata, $pos1+1, ($pos2-$pos1)-1);
echo "Attempting to create table '$tablename'... ";
if($tc_db->Execute($sqldata)) {
echo "success.<br />";
} else {
echo "<font color='red'>failed</font>. Enable debugging by setting KU_DEBUG to true to see this error.<br />";
die ("Table creation failed. Please rerun this script again or attempt to fix the problem if you know how to solve it.");
}
}
}
// All done :)
echo '<br />SQL commands have finished. If all is well, proceed to the <a href="install.php"><strong><u>installation file</u></strong></a> but don\'t forget to delete this file!';
}
function mysql_table_exists($database, $tableName)
{
global $tc_db;
$tables = array();
$tablesResults = $tc_db->GetAll("SHOW TABLES FROM `$database`;");
foreach ($tablesResults AS $row) $tables[] = $row[0];
return(in_array($tableName, $tables));
}
?>
</body>
</html>
+147
View File
@@ -0,0 +1,147 @@
<?php
/**
* @ignore
*/
################################################################################
# kusaba PostgreSQL Importing Script v1.0 is © 2007 David Steven-Jennings (relixx@gmail.com)
#
# This work is licensed under the Creative Commons Attribution-ShareAlike 2.5 License.
# To view a copy of this license, visit http://creativecommons.org/licenses/by-sa/2.5/
# or send a letter to Creative Commons, 543 Howard Street, 5th Floor, San Francisco,
# California, 94105, USA.
#
# You can modify this script as you wish just as long as this box stays intact. If
# you do modify this script please state that you have done so and give me credit
# as the author of the original script (with my email address intact).
################################################################################
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="pl" lang="pl">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>PostgreSQL Batch File Importing Script</title>
<style type="text/css">
body { font-family: sans-serif; font-size: 75%; background: #ffe }
a { text-decoration: none; color: #550 }
h1,h2 { margin: 0px; background: #fca }
h1 { font-size: 150% }
h2 { font-size: 100%; margin-top: 1em }
.hl { font-style: italic }
.plus { float: right; font-size: 8px; font-weight: normal; padding: 1px 4px 2px 4px; margin: 0px 0px; background: #eb9; color: #000; border: 1px solid #da8; cursor: hand; cursor: pointer }
.plus:hover { background: #da8; border: 1px solid #c97 }
ul { list-style: none; padding-left: 0px; margin: 0px }
li { margin: 0px }
li:hover { background: #fec; }
li a { display: block; width: 100%; }
</style>
<link rel="shortcut icon" href="/favicon.ico" />
</head>
<body>
<div style="text-align:center;"><h1>PostgreSQL Batch File Importing Script</h1></div>
<?php
if (!isset($_POST["confirm"])) {
?>
<br /><br />
<font color="#FF0000"><strong>WARNING!</strong></font><br /><br />
The purpose of this script is to quickly and easily run the commands contained within the kusaba SQL file, and is
to be used if you are installing the script for the first time or want to recreate the tables, for whatever reason.<br />
Running this script will delete any related tables and their data (including the admin files). I offer this script as-is and cannot be held
responsible for any damages caused or accidental loss of data incurred as a result of running this script.<br />
Before running this script, make sure that:<br />
<ul>
<li>-&gt; You have set up the database connection and that it is working</li>
<li>-&gt; You have created the database</li>
<li>-&gt; You have created the database user and set up the config file appropriately</li>
</ul>
<form action="install-pgsql.php" method="post">
<br />
<input type="checkbox" name="confirm"> By clicking this check box I agree that the author of this script cannot be held responsible for my own stupidity if something goes wrong.<br /><br /><br />
<input type="submit" value="Import the PostgreSQL batch file">
</form>
<?php
} else {
require('config.php');
$reqiredtables = array("ads","announcements","banlist","bannedhashes","blotter","boards","board_filetypes","embeds","events","filetypes","front","loginattempts","modlog","module_settings","posts","reports","sections","staff","watchedthreads","wordfilter");
foreach ($reqiredtables as $tablename) {
if (pgsql_table_exists(KU_DBDATABASE,KU_DBPREFIX.$tablename)) {
die("Table <strong>".KU_DBPREFIX.$tablename."</strong> already exists in the database! Drop it, and re run this script.");
}
}
// Lets open the file for reading! :)
echo '<h2>SQL Batch File Processing</h2>';
echo 'Locating \'kusaba_freshinstall.postgres.sql\'... ';
if (file_exists('kusaba_freshinstall.postgres.sql') && (filesize('kusaba_freshinstall.postgres.sql') > 0)) {
echo 'found.<br />';
$sqlfile = fopen('kusaba_freshinstall.postgres.sql', 'r');
echo 'File opened.<br />';
$readdata = fread($sqlfile, filesize('kusaba_freshinstall.postgres.sql'));
$readdata = str_replace('PREFIX_',KU_DBPREFIX,$readdata);
fclose($sqlfile);
echo 'Contents read.<br />';
}else{
echo '<font color=red>error.</font> ';
die('An error occured. kusaba_freshinstall.postgres.sql does not exist in this directory or it is 0 bytes big :( Barring that, do you have read permissions for the directory?');
}
// Explodes the array
$sqlarray = explode("\n", $readdata);
// Loops through the array and deletes the non-SQL bits in the file, which is basically the '--' lines and the lines with no content
foreach ($sqlarray as $key => $sqldata) {
if (strstr($sqldata, '--') || strlen($sqldata) == 0){
unset($sqlarray[$key]);
}
}
// Here we are imploding everything together again...
$readdata = implode('',$sqlarray);
// ...then exploding it again. At this point we will have an array where each key's value is a one of the CREATE statements
$sqlarray = explode(';',$readdata);
echo 'File contents have been formatted for use with pg_query.<br />';
// Lets drop any existing tables in the database
$listoftables = $tc_db->GetAll("SELECT table_name FROM information_schema.tables WHERE table_schema='public' AND table_type='BASE TABLE'");
echo '<h2>Table Creation</h2>';
// Lets now loop through the array and create each table
foreach ($sqlarray as $sqldata) {
if (strlen($sqldata) !== 0) { // As the array was exploded on ';', the last ';' caused a blank element to be created as there was no data after it :p
// The following three lines retrieve the table name of the table from the sql command. It's dynamic so it doesn't matter how many tables need to be created
// As long as each CREATE TABLE statement stays in the format CREATE TABLE `table` then this part will work.
$sqldata = str_replace(":semicolon:", ";", $sqldata);
if (strpos($sqldata, "CREATE TABLE") !== false) {
preg_match("/CREATE TABLE (.*?) \(/", $sqldata, $tablename);
echo "Attempting to create table '{$tablename[1]}'... ";
}
else {
echo "Attempting to run query '".$sqldata."'... ";
}
if($tc_db->Execute($sqldata)) {
echo "success.<br />";
} else {
echo "<font color='red'>failed</font>. Enable debugging by setting KU_DEBUG to true to see this error.<br />";
die ("Table creation failed. Please rerun this script again or attempt to fix the problem if you know how to solve it.");
}
}
}
// All done :)
echo '<br />SQL commands have finished. If all is well, proceed to the <a href="install.php"><strong><u>installation file</u></strong></a> but don\'t forget to delete this file!';
}
function pgsql_table_exists($database, $tableName) {
global $tc_db;
$tables = array();
$tablesResults = $tc_db->GetAll("SELECT table_name FROM information_schema.tables WHERE table_schema='public' AND table_type='BASE TABLE'");
foreach ($tablesResults AS $row) $tables[] = $row[0];
return(in_array($tableName, $tables));
}
?>
</body>
</html>
+150
View File
@@ -0,0 +1,150 @@
<?php
/**
* @ignore
*/
################################################################################
# kusaba SQLite Importing Script v1.0 is © 2007 David Steven-Jennings (relixx@gmail.com)
#
# This work is licensed under the Creative Commons Attribution-ShareAlike 2.5 License.
# To view a copy of this license, visit http://creativecommons.org/licenses/by-sa/2.5/
# or send a letter to Creative Commons, 543 Howard Street, 5th Floor, San Francisco,
# California, 94105, USA.
#
# You can modify this script as you wish just as long as this box stays intact. If
# you do modify this script please state that you have done so and give me credit
# as the author of the original script (with my email address intact).
################################################################################
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="pl" lang="pl">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>SQLite Batch File Importing Script</title>
<style type="text/css">
body { font-family: sans-serif; font-size: 75%; background: #ffe }
a { text-decoration: none; color: #550 }
h1,h2 { margin: 0px; background: #fca }
h1 { font-size: 150% }
h2 { font-size: 100%; margin-top: 1em }
.hl { font-style: italic }
.plus { float: right; font-size: 8px; font-weight: normal; padding: 1px 4px 2px 4px; margin: 0px 0px; background: #eb9; color: #000; border: 1px solid #da8; cursor: hand; cursor: pointer }
.plus:hover { background: #da8; border: 1px solid #c97 }
ul { list-style: none; padding-left: 0px; margin: 0px }
li { margin: 0px }
li:hover { background: #fec; }
li a { display: block; width: 100%; }
</style>
<link rel="shortcut icon" href="/favicon.ico" />
</head>
<body>
<div style="text-align:center;"><h1>SQLite Batch File Importing Script</h1></div>
<?php
if (!isset($_POST["confirm"])) {
?>
<br /><br />
<font color="#FF0000"><strong>WARNING!</strong></font><br /><br />
The purpose of this script is to quickly and easily run the commands contained within the kusaba SQL file, and is
to be used if you are installing the script for the first time or want to recreate the tables, for whatever reason.<br />
Running this script will delete any related tables and their data (including the admin files). I offer this script as-is and cannot be held
responsible for any damages caused or accidental loss of data incurred as a result of running this script.<br />
Before running this script, make sure that:<br />
<ul>
<li>-&gt; You have set up the database connection and that it is working</li>
<li>-&gt; You have created the database</li>
<li>-&gt; You have created the database user and set up the config file appropriately</li>
</ul>
<form action="install-sqlite.php" method="post">
<br />
<input type="checkbox" name="confirm"> By clicking this check box I agree that the author of this script cannot be held responsible for my own stupidity if something goes wrong.<br /><br /><br />
<input type="submit" value="Import the SQLite batch file">
</form>
<?php
} else {
require('config.php');
$reqiredtables = array("ads","announcements","banlist","bannedhashes","blotter","boards","board_filetypes","embeds","events","filetypes","front","loginattempts","modlog","module_settings","posts","reports","sections","staff","watchedthreads","wordfilter");
foreach ($reqiredtables as $tablename) {
if (sqlite_table_exists(KU_DBDATABASE,KU_DBPREFIX.$tablename)) {
die("Table <strong>".KU_DBPREFIX.$tablename."</strong> already exists in the database! Drop it, and re run this script.");
}
}
// Lets open the file for reading! :)
echo '<h2>SQL Batch File Processing</h2>';
echo 'Locating \'kusaba_freshinstall.sqlite.sql\'... ';
if (file_exists('kusaba_freshinstall.sqlite.sql') && (filesize('kusaba_freshinstall.sqlite.sql') > 0)) {
echo 'found.<br />';
$sqlfile = fopen('kusaba_freshinstall.sqlite.sql', 'r');
echo 'File opened.<br />';
$readdata = fread($sqlfile, filesize('kusaba_freshinstall.sqlite.sql'));
$readdata = str_replace('PREFIX_',KU_DBPREFIX,$readdata);
fclose($sqlfile);
echo 'Contents read.<br />';
}else{
echo '<font color=red>error.</font> ';
die('An error occured. kusaba_freshinstall.sqlite.sql does not exist in this directory or it is 0 bytes big :( Barring that, do you have read permissions for the directory?');
}
// Explodes the array
$sqlarray = explode("\n", $readdata);
// Loops through the array and deletes the non-SQL bits in the file, which is basically the '--' lines and the lines with no content
foreach ($sqlarray as $key => $sqldata) {
if (strstr($sqldata, '--') || strlen($sqldata) == 0){
unset($sqlarray[$key]);
}
}
// Here we are imploding everything together again...
$readdata = implode('',$sqlarray);
// ...then exploding it again. At this point we will have an array where each key's value is a one of the CREATE statements
$sqlarray = explode(';',$readdata);
echo 'File contents have been formatted for use with sqlite_query.<br />';
// Lets drop any existing tables in the database
$listoftables = $tc_db->GetAll("SELECT name FROM sqlite_master WHERE type = 'table'");
echo '<h2>Table Creation</h2>';
// Lets now loop through the array and create each table
foreach ($sqlarray as $sqldata) {
if (strlen($sqldata) !== 0) { // As the array was exploded on ';', the last ';' caused a blank element to be created as there was no data after it :p
// The following three lines retrieve the table name of the table from the sql command. It's dynamic so it doesn't matter how many tables need to be created
// As long as each CREATE TABLE statement stays in the format CREATE TABLE `table` then this part will work.
$sqldata = str_replace(":semicolon:", ";", $sqldata);
if (strpos($sqldata, "CREATE TABLE") !== false) {
preg_match("/CREATE TABLE (.*?) \(/", $sqldata, $tablename);
echo "Attempting to create table '{$tablename[1]}'... ";
}
else {
echo "Attempting to run query '".$sqldata."'... ";
}
if($tc_db->Execute($sqldata)) {
echo "success.<br />";
} else {
echo "<font color='red'>failed</font>. Enable debugging by setting KU_DEBUG to true to see this error.<br />";
die ("Table creation failed. Please rerun this script again or attempt to fix the problem if you know how to solve it.");
}
}
}
// All done :)
echo '<br />SQL commands have finished. If all is well, proceed to the <a href="install.php"><strong><u>installation file</u></strong></a> but don\'t forget to delete this file!';
}
function sqlite_table_exists($database, $tableName) {
global $tc_db;
$tables = array();
$tablesResults = $tc_db->GetAll("SELECT name FROM sqlite_master WHERE type = 'table'" );
foreach ($tablesResults AS $row) $tables[] = $row[0];
return(in_array($tableName, $tables));
}
?>
</body>
</html>
+120
View File
@@ -0,0 +1,120 @@
<?php
/**
* @ignore
*/
function mysql_table_exists($database, $tableName) {
global $tc_db;
$tables = array();
$tablesResults = $tc_db->GetAll("SHOW TABLES FROM `$database`;");
foreach ($tablesResults AS $row) $tables[] = $row[0];
return(in_array($tableName, $tables));
}
function pgsql_table_exists($database, $tableName) {
global $tc_db;
$tables = array();
$tablesResults = $tc_db->GetAll(" select table_name from information_schema.tables where table_schema='public' and table_type='BASE TABLE'");
foreach ($tablesResults AS $row) $tables[] = $row[0];
return(in_array($tableName, $tables));
}
function sqlite_table_exists($database, $tableName) {
global $tc_db;
$tables = array();
$tablesResults = $tc_db->GetAll("SELECT name FROM sqlite_master WHERE type = 'table'" );
foreach ($tablesResults AS $row) $tables[] = $row[0];
return(in_array($tableName, $tables));
}
function CreateSalt() {
$chars = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789';
$salt = '';
for ($i = 0; $i < 3; ++$i) {
$salt .= $chars[mt_rand(0, strlen($chars) - 1)];
}
return $salt;
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="pl" lang="pl">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Kusaba X Installation</title>
<style type="text/css">
body { font-family: sans-serif; font-size: 75%; background: #ffe }
a { text-decoration: none; color: #550 }
h1,h2 { margin: 0px; background: #fca }
h1 { font-size: 150% }
h2 { font-size: 100%; margin-top: 1em }
.hl { font-style: italic }
.plus { float: right; font-size: 8px; font-weight: normal; padding: 1px 4px 2px 4px; margin: 0px 0px; background: #eb9; color: #000; border: 1px solid #da8; cursor: hand; cursor: pointer }
.plus:hover { background: #da8; border: 1px solid #c97 }
ul { list-style: none; padding-left: 0px; margin: 0px }
li { margin: 0px }
li:hover { background: #fec; }
li a { display: block; width: 100%; }
</style>
<link rel="shortcut icon" href="/favicon.ico" />
</head>
<body>
<div style="text-align:center;"><h1>Kusaba X Installation</h1></div>
<?php
echo '<h2>Checking configuration file...</h2>';
if (file_exists('config.php')) {
require 'config.php';
require KU_ROOTDIR . 'inc/functions.php';
if (KU_RANDOMSEED!="ENTER RANDOM LETTERS/NUMBERS HERE"&&KU_RANDOMSEED!="") {
echo 'Configuration appears correct.';
echo '<h2>Checking database...</h2>';
$reqiredtables = array("ads","announcements","banlist","bannedhashes","blotter","boards","board_filetypes","embeds","events","filetypes","front","loginattempts","modlog","module_settings","posts","reports","sections","staff","watchedthreads","wordfilter");
foreach ($reqiredtables as $tablename) {
if (KU_DBTYPE == 'mysql' || KU_DBTYPE == 'mysqli') {
if (!mysql_table_exists(KU_DBDATABASE,KU_DBPREFIX.$tablename)) {
die("Couldn't find the table <strong>".KU_DBPREFIX.$tablename."</strong> in the database. Please <a href=\"install-mysql.php\"><strong><u>insert the mySQL dump</u></strong></a>.");
}
}
if (KU_DBTYPE == 'postgres7' || KU_DBTYPE == 'postgres8' || KU_DBTYPE == 'postgres') {
if (!pgsql_table_exists(KU_DBDATABASE,KU_DBPREFIX.$tablename)) {
die("Couldn't find the table <strong>".KU_DBPREFIX.$tablename."</strong> in the database. Please <a href=\"install-pgsql.php\"><strong><u>insert the PostgreSQL dump</u></strong></a>.");
}
}
if (KU_DBTYPE == 'sqlite') {
if (!sqlite_table_exists(KU_DBDATABASE,KU_DBPREFIX.$tablename)) {
die("Couldn't find the table <strong>".KU_DBPREFIX.$tablename."</strong> in the database. Please <a href=\"install-sqlite.php\"><strong><u>insert the SQLite dump</u></strong></a>.");
}
}
}
echo 'Database appears correct.';
echo '<h2>Inserting default administrator account...</h2>';
$result_exists = $tc_db->GetOne("SELECT COUNT(*) FROM `".KU_DBPREFIX."staff` WHERE `username` = 'admin'");
if ($result_exists==0) {
$salt = CreateSalt();
$result = $tc_db->Execute("INSERT INTO `".KU_DBPREFIX."staff` ( `username` , `salt`, `password` , `type` , `addedon` ) VALUES ( 'admin' , '".$salt."', '".md5("admin".$salt)."' , '1' , '".time()."' )");
echo 'Account inserted.';
$result = true;
} else {
echo 'There is already an administrator account inserted.';
$result = true;
}
if ($result) {
require_once KU_ROOTDIR . 'inc/classes/menu.class.php';
$menu_class = new Menu();
$menu_class->Generate();
echo '<h2>Done!</h2>Installation has finished! The default administrator account is <strong>admin</strong> with the password of <strong>admin</strong>.<br /><br />Delete this and the install-mysql.php file from the server, then <a href="manage.php">add some boards</a>!';
echo '<br /><br /><br /><h1><font color="red">DELETE THIS AND install-mysql.php RIGHT NOW!</font></h1>';
} else {
echo 'Error inserting SQL. Please add <strong>$tc_db->debug = true;</strong> just before ?&gt; in config.php to turn on debugging, and check the error message.';
}
} else {
echo 'Please enter a random string into the <strong>KU_RANDOMSEED</strong> value.';
}
} else {
echo 'Unable to locate config.php';
}
?>
</body>
</html>
+371
View File
@@ -0,0 +1,371 @@
-- --------------------------------------------------------
--
-- Table structure for table `ads`
--
CREATE TABLE `PREFIX_ads` (
`id` smallint(1) unsigned NOT NULL,
`position` varchar(3) NOT NULL,
`disp` tinyint(1) NOT NULL,
`boards` varchar(255) NOT NULL,
`code` text NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- Table structure for table `announcements`
--
CREATE TABLE `PREFIX_announcements` (
`id` int(10) unsigned NOT NULL auto_increment,
`parentid` int(10) unsigned NOT NULL default '0',
`subject` varchar(255) NOT NULL,
`postedat` int(20) NOT NULL,
`postedby` varchar(75) NOT NULL,
`message` text NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- Table structure for table `banlist`
--
CREATE TABLE `PREFIX_banlist` (
`id` mediumint(8) unsigned NOT NULL auto_increment,
`type` tinyint(1) NOT NULL default '0',
`expired` tinyint(1) NOT NULL default '0',
`allowread` tinyint(1) NOT NULL default '1',
`ip` varchar(50) NOT NULL,
`ipmd5` char(32) NOT NULL,
`globalban` tinyint(1) NOT NULL default '0',
`boards` varchar(255) NOT NULL,
`by` varchar(75) NOT NULL,
`at` int(20) NOT NULL,
`until` int(20) NOT NULL,
`reason` text NOT NULL,
`staffnote` text NOT NULL,
`appeal` text NOT NULL default '',
`appealat` int(20) NOT NULL default '0',
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- Table structure for table `bannedhashes`
--
CREATE TABLE `PREFIX_bannedhashes` (
`id` int(10) NOT NULL auto_increment,
`md5` varchar(255) NOT NULL,
`bantime` int(10) NOT NULL default '0',
`description` text NOT NULL,
UNIQUE KEY `id` (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- Table structure for table `blotter`
--
CREATE TABLE `PREFIX_blotter` (
`id` smallint(5) unsigned NOT NULL auto_increment,
`important` tinyint(1) NOT NULL,
`at` int(20) NOT NULL,
`message` text NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- Table structure for table `boards`
--
CREATE TABLE `PREFIX_boards` (
`id` smallint(5) unsigned NOT NULL auto_increment,
`order` tinyint(5) NOT NULL default '0',
`name` varchar(75) collate utf8_unicode_ci NOT NULL default '',
`type` tinyint(1) NOT NULL default '0',
`start` int(10) UNSIGNED NOT NULL ,
`uploadtype` tinyint(1) NOT NULL default '0',
`desc` varchar(75) collate utf8_unicode_ci NOT NULL default '',
`image` varchar(255) collate utf8_unicode_ci NOT NULL,
`section` tinyint(2) NOT NULL default '0',
`maximagesize` int(20) NOT NULL default '1024000',
`maxpages` int(20) NOT NULL default '11',
`maxage` int(20) NOT NULL default '0',
`markpage` tinyint(4) NOT NULL default '9',
`maxreplies` int(5) NOT NULL default '200',
`messagelength` int(10) NOT NULL default '8192',
`createdon` int(20) NOT NULL,
`locked` tinyint(1) NOT NULL default '0',
`includeheader` text collate utf8_unicode_ci NOT NULL default '',
`redirecttothread` tinyint(1) NOT NULL default '0',
`anonymous` varchar(255) collate utf8_unicode_ci NOT NULL default 'Anonymous',
`forcedanon` tinyint(1) NOT NULL default '0',
`embeds_allowed` varchar(255) NOT NULL default '',
`trial` tinyint(1) NOT NULL default '0',
`popular` tinyint(1) NOT NULL default '0',
`defaultstyle` varchar(50) character set latin1 NOT NULL default '',
`locale` varchar(30) character set latin1 NOT NULL default '',
`showid` tinyint(1) NOT NULL default '0',
`compactlist` tinyint(1) NOT NULL default '0',
`enablereporting` tinyint(1) NOT NULL default '1',
`enablecaptcha` tinyint(1) NOT NULL default '0',
`enablenofile` tinyint(1) NOT NULL default '0',
`enablearchiving` tinyint(1) NOT NULL default '0',
`enablecatalog` tinyint(1) NOT NULL default '1',
`loadbalanceurl` varchar(255) character set latin1 NOT NULL default '',
`loadbalancepassword` varchar(255) character set latin1 NOT NULL default '',
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
-- --------------------------------------------------------
--
-- Table structure for table `board_filetypes`
--
CREATE TABLE `PREFIX_board_filetypes` (
`boardid` tinyint(5) NOT NULL default '0',
`typeid` mediumint(5) NOT NULL default '0'
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- Table structure for table `embeds`
--
CREATE TABLE `PREFIX_embeds` (
`id` tinyint(5) unsigned NOT NULL auto_increment,
`filetype` varchar(3) NOT NULL,
`name` varchar(255) NOT NULL,
`videourl` varchar(510) NOT NULL,
`width` tinyint(3) unsigned NOT NULL,
`height` tinyint(3) unsigned NOT NULL,
`code` text NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- Table structure for table `events`
--
CREATE TABLE `PREFIX_events` (
`name` varchar(255) NOT NULL,
`at` int(20) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- Table structure for table `filetypes`
--
CREATE TABLE `PREFIX_filetypes` (
`id` smallint(5) unsigned NOT NULL auto_increment,
`filetype` varchar(255) NOT NULL,
`mime` varchar(255) NOT NULL default '',
`image` varchar(255) NOT NULL default '',
`image_w` int(7) NOT NULL default '0',
`image_h` int(7) NOT NULL default '0',
`force_thumb` int(1) NOT NULL default '1',
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- Table structure for table `front`
--
CREATE TABLE `PREFIX_front` (
`id` smallint(5) unsigned NOT NULL auto_increment,
`page` smallint(1) unsigned NOT NULL default '0',
`order` smallint(5) unsigned NOT NULL default '0',
`subject` varchar(255) NOT NULL,
`message` text NOT NULL,
`timestamp` int(20) NOT NULL default '0',
`poster` varchar(75) NOT NULL,
`email` varchar(255) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- Table structure for table `loginattempts`
--
CREATE TABLE `PREFIX_loginattempts` (
`username` varchar(255) NOT NULL,
`ip` varchar(20) NOT NULL,
`timestamp` int(20) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- Table structure for table `modlog`
--
CREATE TABLE `PREFIX_modlog` (
`entry` text NOT NULL,
`user` varchar(255) NOT NULL,
`category` tinyint(2) NOT NULL default '0',
`timestamp` int(20) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- Table structure for table `module_settings`
--
CREATE TABLE `PREFIX_module_settings` (
`module` varchar(255) NOT NULL,
`key` varchar(255) NOT NULL,
`value` text character set utf8 collate utf8_unicode_ci NOT NULL,
`type` varchar(255) NOT NULL default 'string'
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- Table structure for table `posts`
--
CREATE TABLE `PREFIX_posts` (
`id` int(10) unsigned NOT NULL auto_increment,
`boardid` smallint(5) unsigned NOT NULL,
`parentid` int(10) unsigned NOT NULL default '0',
`name` varchar(255) NOT NULL,
`tripcode` varchar(30) NOT NULL,
`email` varchar(255) NOT NULL,
`subject` varchar(255) NOT NULL,
`message` text NOT NULL,
`password` varchar(255) NOT NULL,
`file` varchar(50) NOT NULL,
`file_md5` char(32) NOT NULL,
`file_type` varchar(20) NOT NULL,
`file_original` varchar(255) NOT NULL,
`file_size` int(20) NOT NULL default '0',
`file_size_formatted` varchar(75) NOT NULL,
`image_w` smallint(5) NOT NULL default '0',
`image_h` smallint(5) NOT NULL default '0',
`thumb_w` smallint(5) unsigned NOT NULL default '0',
`thumb_h` smallint(5) unsigned NOT NULL default '0',
`ip` varchar(75) NOT NULL,
`ipmd5` char(32) NOT NULL,
`tag` varchar(5) NOT NULL,
`timestamp` int(20) unsigned NOT NULL,
`stickied` tinyint(1) NOT NULL default '0',
`locked` tinyint(1) NOT NULL default '0',
`posterauthority` tinyint(1) NOT NULL default '0',
`reviewed` tinyint(1) unsigned NOT NULL default '0',
`deleted_timestamp` int(20) NOT NULL default '0',
`IS_DELETED` tinyint(1) NOT NULL default '0',
`bumped` int(20) unsigned NOT NULL default '0',
PRIMARY KEY (`boardid`,`id`),
KEY `parentid` (`parentid`),
KEY `bumped` (`bumped`),
KEY `file_md5` (`file_md5`),
KEY `stickied` (`stickied`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
-- --------------------------------------------------------
--
-- Table structure for table `reports`
--
CREATE TABLE `PREFIX_reports` (
`id` smallint(5) unsigned NOT NULL auto_increment,
`cleared` tinyint(1) NOT NULL default '0',
`board` varchar(255) NOT NULL,
`postid` int(20) NOT NULL,
`when` int(20) NOT NULL,
`ip` varchar(75) NOT NULL,
`reason` varchar(255) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- Table structure for table `sections`
--
CREATE TABLE `PREFIX_sections` (
`id` smallint(5) unsigned NOT NULL auto_increment,
`order` tinyint(3) NOT NULL default '0',
`hidden` tinyint(1) NOT NULL default '0',
`name` varchar(255) NOT NULL default '0',
`abbreviation` varchar(10) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- Table structure for table `staff`
--
CREATE TABLE `PREFIX_staff` (
`id` smallint(5) unsigned NOT NULL auto_increment,
`username` varchar(255) NOT NULL,
`password` varchar(255) NOT NULL,
`salt` varchar(3) NOT NULL,
`type` tinyint(1) NOT NULL default '0',
`boards` text,
`addedon` int(20) NOT NULL,
`lastactive` int(20) NOT NULL default '0',
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- Table structure for table `watchedthreads`
--
CREATE TABLE `PREFIX_watchedthreads` (
`id` mediumint(8) unsigned NOT NULL auto_increment,
`threadid` int(20) NOT NULL,
`board` varchar(255) NOT NULL,
`ip` char(15) NOT NULL,
`lastsawreplyid` int(20) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- Table structure for table `wordfilter`
--
CREATE TABLE `PREFIX_wordfilter` (
`id` smallint(5) unsigned NOT NULL auto_increment,
`word` varchar(75) NOT NULL,
`replacedby` varchar(75) NOT NULL,
`boards` text NOT NULL,
`time` int(20) NOT NULL,
`regex` tinyint(1) NOT NULL default '0',
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
INSERT INTO `PREFIX_ads` (`id`, `position`, `disp`, `boards`, `code`) VALUES (1, 'top', 0, '', 'Right Frame Top'), (2, 'bot', 0, '', 'Right Frame Bottom');
INSERT INTO `PREFIX_filetypes` (`filetype`, `force_thumb`) VALUES ('jpg', 0), ('gif', 0), ('png', 0) ;
INSERT INTO `PREFIX_events` (`name`, `at`) VALUES ('pingback', 0), ('sitemap', 0);
INSERT INTO `PREFIX_embeds` (`filetype`, `name`, `videourl`, `width`, `height`, `code`) VALUES ('you', 'Youtube', 'http://www.youtube.com/watch?v=', 200, 164, '<object type="application/x-shockwave-flash" width="SET_WIDTH" height="SET_HEIGHT" data="http://www.youtube.com/v/EMBED_ID"> <param name="movie" value="http://www.youtube.com/v/EMBED_ID" /> </object>'), ('goo', 'Google', 'http://video.google.com/videoplay?docid=', 200, 164, '<embed width="SET_WIDTH" height="SET_HEIGHT" id="VideoPlayback" type="application/x-shockwave-flash" src="http://video.google.com/googleplayer.swf?docId=EMBED_ID"></embed>') ;
+386
View File
@@ -0,0 +1,386 @@
-- --------------------------------------------------------
--
-- Table structure for table ads
--
CREATE TABLE PREFIX_ads (
id smallint NOT NULL,
position varchar(3) NOT NULL,
disp smallint NOT NULL,
boards varchar(255) NOT NULL,
code text NOT NULL
);
-- --------------------------------------------------------
--
-- Table structure for table announcements
--
CREATE TABLE PREFIX_announcements (
id serial,
parentid int NOT NULL default '0',
subject varchar(255) NOT NULL,
postedat int NOT NULL,
postedby varchar(75) NOT NULL,
message text NOT NULL,
PRIMARY KEY (id)
);
-- --------------------------------------------------------
--
-- Table structure for table banlist
--
CREATE TABLE PREFIX_banlist (
id serial,
type smallint NOT NULL default '0',
expired smallint NOT NULL default '0',
allowread smallint NOT NULL default '1',
ip varchar(50) NOT NULL,
ipmd5 char(32) NOT NULL,
globalban smallint NOT NULL default '0',
boards varchar(255) NOT NULL,
by varchar(75) NOT NULL,
at int NOT NULL,
until int NOT NULL,
reason text NOT NULL,
staffnote text NOT NULL,
appeal text NOT NULL default '',
appealat int NOT NULL default'0',
PRIMARY KEY (id)
);
-- --------------------------------------------------------
--
-- Table structure for table bannedhashes
--
CREATE TABLE PREFIX_bannedhashes (
id serial,
md5 varchar(255) NOT NULL,
bantime int,
description text NOT NULL,
UNIQUE (id)
);
-- --------------------------------------------------------
--
-- Table structure for table blotter
--
CREATE TABLE PREFIX_blotter (
id serial,
important smallint NOT NULL,
at int NOT NULL,
message text NOT NULL,
PRIMARY KEY (id)
);
-- --------------------------------------------------------
--
-- Table structure for table boards
--
CREATE TABLE PREFIX_boards (
id serial,
`order` smallint,
name varchar(75) NOT NULL default '',
type smallint NOT NULL default '0',
start int NOT NULL,
uploadtype smallint,
`desc` varchar(75) NOT NULL default '',
image varchar(255) NOT NULL,
section smallint NOT NULL default '0',
maximagesize int NOT NULL default '1024000',
maxpages int NOT NULL default '11',
maxage int NOT NULL default '0',
markpage smallint NOT NULL default '9',
maxreplies int NOT NULL default '200',
messagelength int NOT NULL default '8192',
createdon int NOT NULL,
locked smallint NOT NULL default '0',
includeheader text NOT NULL default '',
redirecttothread smallint NOT NULL default '0',
anonymous varchar(255) NOT NULL default 'Anonymous',
forcedanon smallint NOT NULL default '0',
embeds_allowed varchar(255) NOT NULL default '',
trial smallint NOT NULL default '0',
popular smallint NOT NULL default '0',
defaultstyle varchar(50) NOT NULL default '',
locale varchar(30) NOT NULL default '',
showid smallint NOT NULL default '0',
compactlist smallint NOT NULL default '0',
enablereporting smallint NOT NULL default '1',
enablecaptcha smallint NOT NULL default '0',
enablenofile smallint NOT NULL default '0',
enablearchiving smallint NOT NULL default '0',
enablecatalog smallint NOT NULL default '1',
loadbalanceurl varchar(255) NOT NULL default '',
loadbalancepassword varchar(255) NOT NULL default '',
PRIMARY KEY (id)
);
--
-- Table structure for table board_filetypes
--
CREATE TABLE PREFIX_board_filetypes (
boardid smallint NOT NULL default '0',
typeid int NOT NULL default '0'
);
-- --------------------------------------------------------
--
-- Table structure for table embeds
--
CREATE TABLE PREFIX_embeds (
id serial,
filetype varchar(3) NOT NULL,
name varchar(255) NOT NULL,
videourl varchar(510) NOT NULL,
width smallint NOT NULL,
height smallint NOT NULL,
code text NOT NULL,
PRIMARY KEY (id)
);
-- --------------------------------------------------------
--
-- Table structure for table events
--
CREATE TABLE PREFIX_events (
name varchar(255) NOT NULL,
at int NOT NULL
);
-- --------------------------------------------------------
--
-- Table structure for table filetypes
--
CREATE TABLE PREFIX_filetypes (
id serial,
filetype varchar(255) NOT NULL,
mime varchar(255) NOT NULL default '',
image varchar(255) NOT NULL default '',
image_w int NOT NULL default '0',
image_h int NOT NULL default '0',
force_thumb int NOT NULL default '1',
PRIMARY KEY (id)
);
-- --------------------------------------------------------
--
-- Table structure for table front
--
CREATE TABLE PREFIX_front (
id serial,
page smallint NOT NULL default '0',
`order` smallint NOT NULL default '0',
subject varchar(255) NOT NULL,
message text NOT NULL,
timestamp int NOT NULL default '0',
poster varchar(75) NOT NULL,
email varchar(255) NOT NULL,
PRIMARY KEY (id)
);
-- --------------------------------------------------------
--
-- Table structure for table loginattempts
--
CREATE TABLE PREFIX_loginattempts (
username varchar(255) NOT NULL,
ip varchar(20) NOT NULL,
timestamp int NOT NULL
);
-- --------------------------------------------------------
--
-- Table structure for table modlog
--
CREATE TABLE PREFIX_modlog (
entry text NOT NULL,
`user` varchar(255) NOT NULL,
category smallint NOT NULL default '0',
timestamp int NOT NULL
);
-- --------------------------------------------------------
--
-- Table structure for table module_settings
--
CREATE TABLE PREFIX_module_settings (
module varchar(255) NOT NULL,
key varchar(255) NOT NULL,
value text NOT NULL,
type varchar(255) NOT NULL default 'string'
);
-- --------------------------------------------------------
--
-- Table structure for table posts
--
CREATE TABLE PREFIX_posts (
id int NOT NULL,
boardid smallint NOT NULL,
parentid int NOT NULL default '0',
name varchar(255) NOT NULL,
tripcode varchar(30) NOT NULL,
email varchar(255) NOT NULL,
subject varchar(255) NOT NULL,
message text NOT NULL,
password varchar(255) NOT NULL,
file varchar(50) NOT NULL,
file_md5 char(32) NOT NULL,
file_type varchar(20) NOT NULL,
file_original varchar(255) NOT NULL,
file_size int NOT NULL default '0',
file_size_formatted varchar(75) NOT NULL,
image_w smallint NOT NULL default '0',
image_h smallint NOT NULL default '0',
thumb_w smallint NOT NULL default '0',
thumb_h smallint NOT NULL default '0',
ip varchar(75) NOT NULL,
ipmd5 char(32) NOT NULL,
tag varchar(5) NOT NULL,
timestamp int NOT NULL,
stickied smallint NOT NULL default '0',
locked smallint NOT NULL default '0',
posterauthority smallint NOT NULL default '0',
reviewed smallint NOT NULL default '0',
deleted_timestamp int NOT NULL default '0',
IS_DELETED smallint NOT NULL default '0',
bumped int NOT NULL default '0',
PRIMARY KEY (boardid, id)
);
CREATE OR REPLACE FUNCTION posts_update()
RETURNS "trigger" AS
'
BEGIN
PERFORM id FROM PREFIX_boards WHERE id = NEW.boardid FOR UPDATE:semicolon:
SELECT COALESCE(MAX(id),0) + 1 INTO NEW.id FROM PREFIX_posts WHERE boardid = NEW.boardid:semicolon: RETURN NEW:semicolon:
END
'
LANGUAGE 'plpgsql';
CREATE TRIGGER posts_trigger BEFORE INSERT on PREFIX_posts FOR EACH ROW EXECUTE PROCEDURE posts_update();
CREATE INDEX parentid ON PREFIX_posts (parentid);
CREATE INDEX bumped ON PREFIX_posts (bumped);
CREATE INDEX file_md5 On PREFIX_posts (file_md5);
CREATE INDEX stickied ON PREFIX_posts (stickied);
-- --------------------------------------------------------
--
-- Table structure for table reports
--
CREATE TABLE PREFIX_reports (
id serial,
cleared smallint NOT NULL default '0',
board varchar(255) NOT NULL,
postid int NOT NULL,
`when` int NOT NULL,
ip varchar(75) NOT NULL,
reason varchar(255) NOT NULL,
PRIMARY KEY (id)
);
-- --------------------------------------------------------
--
-- Table structure for table sections
--
CREATE TABLE PREFIX_sections (
id serial,
`order` smallint,
hidden smallint NOT NULL default '0',
name varchar(255) NOT NULL NOT NULL default '0',
abbreviation varchar(10) NOT NULL,
PRIMARY KEY (id)
);
-- --------------------------------------------------------
--
-- Table structure for table staff
--
CREATE TABLE PREFIX_staff (
id serial,
username varchar(255) NOT NULL,
password varchar(255) NOT NULL,
salt varchar(3) NOT NULL,
type smallint NOT NULL default '0',
boards text,
addedon int NOT NULL,
lastactive int NOT NULL default '0',
PRIMARY KEY (id)
);
-- --------------------------------------------------------
--
-- Table structure for table watchedthreads
--
CREATE TABLE PREFIX_watchedthreads (
id serial,
threadid int NOT NULL,
board varchar(255) NOT NULL,
ip char(15) NOT NULL,
lastsawreplyid int NOT NULL,
PRIMARY KEY (id)
);
-- --------------------------------------------------------
--
-- Table structure for table wordfilter
--
CREATE TABLE PREFIX_wordfilter (
id serial,
word varchar(75) NOT NULL,
replacedby varchar(75) NOT NULL,
boards text NOT NULL,
time int NOT NULL,
regex smallint NOT NULL default '0',
PRIMARY KEY (id)
);
CREATE OR REPLACE FUNCTION "if"(boolean, integer, integer) RETURNS integer AS
'SELECT CASE WHEN $1 THEN $2 ELSE $3 END:semicolon:'
LANGUAGE 'sql';
INSERT INTO `PREFIX_ads` (`id`, `position`, `disp`, `boards`, `code`) VALUES (1, 'top', 0, '', 'Right Frame Top');
INSERT INTO `PREFIX_ads` (`id`, `position`, `disp`, `boards`, `code`) VALUES (2, 'bot', 0, '', 'Right Frame Bottom');
INSERT INTO `PREFIX_filetypes` (`filetype`, `force_thumb`) VALUES ('jpg', 0);
INSERT INTO `PREFIX_filetypes` (`filetype`, `force_thumb`) VALUES ('gif', 0);
INSERT INTO `PREFIX_filetypes` (`filetype`, `force_thumb`) VALUES ('png', 0) ;
INSERT INTO `PREFIX_events` (`name`, `at`) VALUES ('pingback', 0);
INSERT INTO `PREFIX_events` (`name`, `at`) VALUES ('sitemap', 0);
INSERT INTO `PREFIX_embeds` (`filetype`, `name`, `videourl`, `width`, `height`, `code`) VALUES ('you', 'Youtube', 'http://www.youtube.com/watch?v=', 200, 164, '<object type="application/x-shockwave-flash" width="SET_WIDTH" height="SET_HEIGHT" data="http://www.youtube.com/v/EMBED_ID"> <param name="movie" value="http://www.youtube.com/v/EMBED_ID" /> </object>');
INSERT INTO `PREFIX_embeds` (`filetype`, `name`, `videourl`, `width`, `height`, `code`) VALUES ('goo', 'Google', 'http://video.google.com/videoplay?docid=', 200, 164, '<embed width="SET_WIDTH" height="SET_HEIGHT" id="VideoPlayback" type="application/x-shockwave-flash" src="http://video.google.com/googleplayer.swf?docId=EMBED_ID"></embed>');
+376
View File
@@ -0,0 +1,376 @@
-- --------------------------------------------------------
--
-- Table structure for table ads
--
CREATE TABLE PREFIX_ads (
id smallint NOT NULL,
position varchar(3) NOT NULL,
disp smallint NOT NULL,
boards varchar(255) NOT NULL,
code text NOT NULL
);
-- --------------------------------------------------------
--
-- Table structure for table announcements
--
CREATE TABLE PREFIX_announcements (
id INTEGER PRIMARY KEY,
parentid int NOT NULL default '0',
subject varchar(255) NOT NULL,
postedat int NOT NULL,
postedby varchar(75) NOT NULL,
message text NOT NULL
);
-- --------------------------------------------------------
--
-- Table structure for table banlist
--
CREATE TABLE PREFIX_banlist (
id INTEGER PRIMARY KEY,
type smallint NOT NULL default '0',
expired smallint NOT NULL default '0',
allowread smallint NOT NULL default '1',
ip varchar(50) NOT NULL,
ipmd5 char(32) NOT NULL,
globalban smallint NOT NULL default '0',
boards varchar(255) NOT NULL,
`by` varchar(75) NOT NULL,
at int NOT NULL,
until int NOT NULL,
reason text NOT NULL,
staffnote text NOT NULL,
appeal text NOT NULL default '',
appealat int NOT NULL default '0'
);
-- --------------------------------------------------------
--
-- Table structure for table bannedhashes
--
CREATE TABLE PREFIX_bannedhashes (
id INTEGER PRIMARY KEY,
md5 varchar(255) NOT NULL,
bantime int,
description text NOT NULL,
UNIQUE (id)
);
-- --------------------------------------------------------
--
-- Table structure for table blotter
--
CREATE TABLE PREFIX_blotter (
id INTEGER PRIMARY KEY,
important smallint NOT NULL,
at int NOT NULL,
message text NOT NULL
);
-- --------------------------------------------------------
--
-- Table structure for table boards
--
CREATE TABLE PREFIX_boards (
id INTEGER PRIMARY KEY,
`order` smallint,
name varchar(75) NOT NULL default '',
type smallint NOT NULL default '0',
start int NOT NULL,
uploadtype smallint,
`desc` varchar(75) NOT NULL default '',
image varchar(255) NOT NULL,
section smallint NOT NULL default '0',
maximagesize int NOT NULL default '1024000',
maxpages int NOT NULL default '11',
maxage int NOT NULL default '0',
markpage smallint NOT NULL default '9',
maxreplies int NOT NULL default '200',
messagelength int NOT NULL default '8192',
createdon int NOT NULL,
locked smallint NOT NULL default '0',
includeheader text NOT NULL default '',
redirecttothread smallint NOT NULL default '0',
anonymous varchar(255) NOT NULL default 'Anonymous',
forcedanon smallint NOT NULL default '0',
embeds_allowed varchar(255) NOT NULL default '',
trial smallint NOT NULL default '0',
popular smallint NOT NULL default '0',
defaultstyle varchar(50) NOT NULL default '',
locale varchar(30) NOT NULL default '',
showid smallint NOT NULL default '0',
compactlist smallint NOT NULL default '0',
enablereporting smallint NOT NULL default '1',
enablecaptcha smallint NOT NULL default '0',
enablenofile smallint NOT NULL default '0',
enablearchiving smallint NOT NULL default '0',
enablecatalog smallint NOT NULL default '1',
loadbalanceurl varchar(255) NOT NULL default '',
loadbalancepassword varchar(255) NOT NULL default ''
);
--
-- Table structure for table board_filetypes
--
CREATE TABLE PREFIX_board_filetypes (
boardid smallint NOT NULL default '0',
typeid int NOT NULL default '0'
);
-- --------------------------------------------------------
--
-- Table structure for table embeds
--
CREATE TABLE PREFIX_embeds (
id INTEGER PRIMARY KEY,
filetype varchar(3) NOT NULL,
name varchar(255) NOT NULL,
videourl varchar(510) NOT NULL,
width smallint NOT NULL,
height smallint NOT NULL,
code text NOT NULL
);
-- --------------------------------------------------------
--
-- Table structure for table events
--
CREATE TABLE PREFIX_events (
name varchar(255) NOT NULL,
at int NOT NULL
);
-- --------------------------------------------------------
--
-- Table structure for table filetypes
--
CREATE TABLE PREFIX_filetypes (
id INTEGER PRIMARY KEY,
filetype varchar(255) NOT NULL,
mime varchar(255) NOT NULL default '',
image varchar(255) NOT NULL default '',
image_w int NOT NULL default '0',
image_h int NOT NULL default '0',
force_thumb int NOT NULL default '1'
);
-- --------------------------------------------------------
--
-- Table structure for table front
--
CREATE TABLE PREFIX_front (
id INTEGER PRIMARY KEY,
page smallint NOT NULL default '0',
`order` smallint NOT NULL default '0',
subject varchar(255) NOT NULL,
message text NOT NULL,
timestamp int NOT NULL DEFAULT '0',
poster varchar(75) NOT NULL DEFAULT '',
email varchar(255) NOT NULL DEFAULT ''
);
-- --------------------------------------------------------
--
-- Table structure for table loginattempts
--
CREATE TABLE PREFIX_loginattempts (
username varchar(255) NOT NULL,
ip varchar(20) NOT NULL,
timestamp int NOT NULL
);
-- --------------------------------------------------------
--
-- Table structure for table modlog
--
CREATE TABLE PREFIX_modlog (
entry text NOT NULL,
`user` varchar(255) NOT NULL,
category smallint NOT NULL default '0',
timestamp int NOT NULL
);
-- --------------------------------------------------------
--
-- Table structure for table module_settings
--
CREATE TABLE PREFIX_module_settings (
module varchar(255) NOT NULL,
key varchar(255) NOT NULL,
value text NOT NULL,
type varchar(255) NOT NULL default 'string'
);
-- --------------------------------------------------------
--
-- Table structure for table posts
--
CREATE TABLE PREFIX_posts (
id int default '0' ,
boardid smallint NOT NULL,
parentid int NOT NULL default '0',
name varchar(255) NOT NULL,
tripcode varchar(30) NOT NULL,
email varchar(255) NOT NULL,
subject varchar(255) NOT NULL,
message text NOT NULL,
password varchar(255) NOT NULL,
file varchar(50) NOT NULL,
file_md5 char(32) NOT NULL,
file_type varchar(20) NOT NULL,
file_original varchar(255) NOT NULL,
file_size int NOT NULL default '0',
file_size_formatted varchar(75) NOT NULL,
image_w smallint NOT NULL default '0',
image_h smallint NOT NULL default '0',
thumb_w smallint NOT NULL default '0',
thumb_h smallint NOT NULL default '0',
ip varchar(75) NOT NULL,
ipmd5 char(32) NOT NULL,
tag varchar(5) NOT NULL,
timestamp int NOT NULL,
stickied smallint NOT NULL default '0',
locked smallint NOT NULL default '0',
posterauthority smallint NOT NULL default '0',
reviewed smallint NOT NULL default '0',
deleted_timestamp int NOT NULL default '0',
IS_DELETED smallint NOT NULL default '0',
bumped int NOT NULL default '0',
PRIMARY KEY (boardid, id)
);
CREATE TRIGGER posts_trigger AFTER INSERT on PREFIX_posts
BEGIN
UPDATE PREFIX_posts SET id = (SELECT COALESCE(MAX(id),0) + 1 FROM PREFIX_posts WHERE boardid = NEW.boardid) WHERE rowid = last_insert_rowid():semicolon:
END;
CREATE INDEX parentid ON PREFIX_posts (parentid);
CREATE INDEX bumped ON PREFIX_posts (bumped);
CREATE INDEX file_md5 On PREFIX_posts (file_md5);
CREATE INDEX stickied ON PREFIX_posts (stickied);
-- --------------------------------------------------------
--
-- Table structure for table reports
--
CREATE TABLE PREFIX_reports (
id INTEGER PRIMARY KEY,
cleared smallint NOT NULL default '0',
board varchar(255) NOT NULL,
postid int NOT NULL,
`when` int NOT NULL,
ip varchar(75) NOT NULL,
reason varchar(255) NOT NULL
);
-- --------------------------------------------------------
--
-- Table structure for table sections
--
CREATE TABLE PREFIX_sections (
id INTEGER PRIMARY KEY,
`order` smallint,
hidden smallint NOT NULL default '0',
name varchar(255) NOT NULL NOT NULL default '0',
abbreviation varchar(10) NOT NULL
);
-- --------------------------------------------------------
--
-- Table structure for table staff
--
CREATE TABLE PREFIX_staff (
id INTEGER PRIMARY KEY,
username varchar(255) NOT NULL,
password varchar(255) NOT NULL,
salt varchar(3) NOT NULL,
type smallint NOT NULL default '0',
boards text,
addedon int NOT NULL,
lastactive int NOT NULL default '0'
);
-- --------------------------------------------------------
--
-- Table structure for table watchedthreads
--
CREATE TABLE PREFIX_watchedthreads (
id INTEGER PRIMARY KEY,
threadid int NOT NULL,
board varchar(255) NOT NULL,
ip char(15) NOT NULL,
lastsawreplyid int NOT NULL
);
-- --------------------------------------------------------
--
-- Table structure for table wordfilter
--
CREATE TABLE PREFIX_wordfilter (
id INTEGER PRIMARY KEY,
word varchar(75) NOT NULL,
replacedby varchar(75) NOT NULL,
boards text NOT NULL,
time int NOT NULL,
regex smallint NOT NULL default '0'
);
INSERT INTO `PREFIX_ads` (`id`, `position`, `disp`, `boards`, `code`) VALUES (1, 'top', 0, '', 'Right Frame Top');
INSERT INTO `PREFIX_ads` (`id`, `position`, `disp`, `boards`, `code`) VALUES (2, 'bot', 0, '', 'Right Frame Bottom');
INSERT INTO `PREFIX_filetypes` (`filetype`, `force_thumb`) VALUES ('jpg', 0);
INSERT INTO `PREFIX_filetypes` (`filetype`, `force_thumb`) VALUES ('gif', 0);
INSERT INTO `PREFIX_filetypes` (`filetype`, `force_thumb`) VALUES ('png', 0) ;
INSERT INTO `PREFIX_events` (`name`, `at`) VALUES ('pingback', 0);
INSERT INTO `PREFIX_events` (`name`, `at`) VALUES ('sitemap', 0);
INSERT INTO `PREFIX_embeds` (`filetype`, `name`, `videourl`, `width`, `height`, `code`) VALUES ('you', 'Youtube', 'http://www.youtube.com/watch?v=', 200, 164, '<object type="application/x-shockwave-flash" width="SET_WIDTH" height="SET_HEIGHT" data="http://www.youtube.com/v/EMBED_ID"> <param name="movie" value="http://www.youtube.com/v/EMBED_ID" /> </object>');
INSERT INTO `PREFIX_embeds` (`filetype`, `name`, `videourl`, `width`, `height`, `code`) VALUES ('goo', 'Google', 'http://video.google.com/videoplay?docid=', 200, 164, '<embed width="SET_WIDTH" height="SET_HEIGHT" id="VideoPlayback" type="application/x-shockwave-flash" src="http://video.google.com/googleplayer.swf?docId=EMBED_ID"></embed>');
+50
View File
@@ -0,0 +1,50 @@
CREATE TABLE IF NOT EXISTS `PREFIX_front` (
`id` smallint(5) unsigned NOT NULL auto_increment,
`page` smallint(1) unsigned NOT NULL default '0',
`order` smallint(5) unsigned NOT NULL default '0',
`subject` varchar(255) NOT NULL,
`message` text NOT NULL,
`timestamp` int(20) NOT NULL,
`poster` varchar(75) NOT NULL,
`email` varchar(255) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `PREFIX_posts` (
`id` int(10) unsigned NOT NULL auto_increment,
`boardid` smallint(5) unsigned NOT NULL,
`parentid` int(10) unsigned NOT NULL default '0',
`name` varchar(255) NOT NULL,
`tripcode` varchar(30) NOT NULL,
`email` varchar(255) NOT NULL,
`subject` varchar(255) NOT NULL,
`message` text NOT NULL,
`password` varchar(255) NOT NULL,
`file` varchar(50) NOT NULL,
`file_md5` char(32) NOT NULL,
`file_type` varchar(20) NOT NULL,
`file_original` varchar(255) NOT NULL,
`file_size` int(20) NOT NULL default '0',
`file_size_formatted` varchar(75) NOT NULL,
`image_w` smallint(5) NOT NULL default '0',
`image_h` smallint(5) NOT NULL default '0',
`thumb_w` smallint(5) unsigned NOT NULL default '0',
`thumb_h` smallint(5) unsigned NOT NULL default '0',
`ip` varchar(75) NOT NULL,
`ipmd5` char(32) NOT NULL,
`tag` varchar(5) NOT NULL,
`timestamp_formatted` varchar(50) NOT NULL,
`timestamp` int(20) unsigned NOT NULL,
`stickied` tinyint(1) NOT NULL default '0',
`locked` tinyint(1) NOT NULL default '0',
`posterauthority` tinyint(1) NOT NULL default '0',
`reviewed` tinyint(1) unsigned NOT NULL default '0',
`deleted_timestamp` int(20) NOT NULL default '0',
`IS_DELETED` tinyint(1) NOT NULL default '0',
`bumped` int(20) unsigned NOT NULL default '0',
PRIMARY KEY (`boardid`,`id`),
KEY `parentid` (`parentid`),
KEY `bumped` (`bumped`),
KEY `file_md5` (`file_md5`),
KEY `stickied` (`stickied`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
+192
View File
@@ -0,0 +1,192 @@
<?php
/* Config */
define('KU_FULLDIR', 'change this to the same value as your KU_ROOTDIR');
define('KU_PASSWORD', 'changeme');
define('KU_THUMBWIDTH', 200);
define('KU_THUMBHEIGHT', 200);
define('KU_REPLYTHUMBWIDTH', 125);
define('KU_REPLYTHUMBHEIGHT', 125);
define('KU_CATTHUMBWIDTH', 50);
define('KU_CATTHUMBHEIGHT', 50);
if (KU_FULLDIR == 'change this to the same value as your KU_ROOTDIR' || KU_FULLDIR == '') die('You must set KU_FULLDIR!');
if (KU_PASSWORD == 'changeme' || KU_FULLDIR == '') die('You must set KU_PASSWORD!');
if ($_POST['password'] != KU_PASSWORD) die('bad password');
if (!isset($_POST['type'])) die('failure');
if ($_POST['type'] == 'thumbnail' || $_POST['type'] == 'direct') {
if (isset($_POST['file']) && isset($_POST['targetname'])) {
$target_file = KU_FULLDIR . $_POST['targetname'];
if (is_file($target_file)) die('file already exists');
if (!$handle = fopen($target_file, 'w+')) {
die('unable to copy');
}
if (fwrite($handle, base64_decode($_POST['file'])) === false) {
die('unable to copy');
}
fclose($handle);
if ($_POST['type'] == 'thumbnail') {
if ($_POST['targetthumb'] == '' || $_POST['targetthumb_c'] == '') {
@unlink($_POST['targetname']);
die('failure');
}
$target_thumb = KU_FULLDIR . $_POST['targetthumb'];
$target_thumb_catalog = KU_FULLDIR . $_POST['targetthumb_c'];
$imageDim = getimagesize($target_file);
$imgw = $imageDim[0];
$imgh = $imageDim[1];
if (($_POST['isreply'] == '0' && ($imgw > KU_THUMBWIDTH || $imgh > KU_THUMBHEIGHT)) || ($_POST['isreply'] == '1' && ($imgw > KU_REPLYTHUMBWIDTH || $imgh > KU_REPLYTHUMBHEIGHT))) {
if ($_POST['isreply'] == '0') {
if (!@createThumbnail($target_file, $target_thumb, KU_THUMBWIDTH, KU_THUMBHEIGHT)) {
@unlink($target_file);
die('unable to thumbnail');
}
} else {
if (!@createThumbnail($target_file, $target_thumb, KU_REPLYTHUMBWIDTH, KU_REPLYTHUMBHEIGHT)) {
@unlink($target_file);
die('unable to thumbnail');
}
}
} else {
if (!@createThumbnail($target_file, $target_thumb, $imgw, $imgh)) {
@unlink($target_file);
die('unable to thumbnail');
}
}
if (!@createThumbnail($target_file, $target_thumb_catalog, KU_CATTHUMBWIDTH, KU_CATTHUMBHEIGHT)) {
@unlink($target_file);
die('unable to thumbnail');
}
$imageDim_thumb = getimagesize($target_thumb);
$imgw_thumb = $imageDim_thumb[0];
$imgh_thumb = $imageDim_thumb[1];
die(serialize(array('imgw_thumb' => $imgw_thumb, 'imgh_thumb' => $imgh_thumb)));
}
die('success');
}
} elseif ($_POST['type'] == 'delete') {
unlink('src/' . $_POST['filename'] . '.' . $_POST['filetype']);
unlink('thumb/' . $_POST['filename'] . 's.' . $_POST['filetype']);
unlink('thumb/' . $_POST['filename'] . 'c.' . $_POST['filetype']);
die("\n" . 'finished');
}
/**
* @ignore
*/
function createThumbnail($name, $filename, $new_w, $new_h) {
$system=explode(".", $filename);
$system = array_reverse($system);
if (preg_match("/jpg|jpeg/", $system[0])) {
$src_img=imagecreatefromjpeg($name);
} else if (preg_match("/png/", $system[0])) {
$src_img=imagecreatefrompng($name);
} else if (preg_match("/gif/", $system[0])) {
$src_img=imagecreatefromgif($name);
} else {
return false;
}
if (!$src_img) {
echo '<br />Unable to open the uploaded image for thumbnailing. Maybe its a different filetype, and has the wrong extension?';
return false;
}
$old_x=imageSX($src_img);
$old_y=imageSY($src_img);
if ($old_x > $old_y) {
$percent = $new_w / $old_x;
} else {
$percent = $new_h / $old_y;
}
$thumb_w = round($old_x * $percent);
$thumb_h = round($old_y * $percent);
$dst_img=ImageCreateTrueColor($thumb_w, $thumb_h);
fastimagecopyresampled($dst_img, $src_img, 0, 0, 0, 0, $thumb_w, $thumb_h, $old_x, $old_y);
if (preg_match("/png/", $system[0])) {
if (!imagepng($dst_img, $filename)) {
echo 'unable to imagepng.';
return false;
}
} else if (preg_match("/jpg|jpeg/", $system[0])) {
if (!imagejpeg($dst_img, $filename, 70)) {
echo 'unable to imagejpg.';
return false;
}
} else if (preg_match("/gif/", $system[0])) {
if (!imagegif($dst_img, $filename)) {
echo 'unable to imagegif.';
return false;
}
}
imagedestroy($dst_img);
imagedestroy($src_img);
return true;
}
/* Author: Tim Eckel - Date: 12/17/04 - Project: FreeRingers.net - Freely distributable. */
/**
* @ignore
*/
function fastimagecopyresampled(&$dst_image, &$src_image, $dst_x, $dst_y, $src_x, $src_y, $dst_w, $dst_h, $src_w, $src_h, $quality = 3) {
/*
Optional "quality" parameter (defaults is 3). Fractional values are allowed, for example 1.5.
1 = Up to 600 times faster. Poor results, just uses imagecopyresized but removes black edges.
2 = Up to 95 times faster. Images may appear too sharp, some people may prefer it.
3 = Up to 60 times faster. Will give high quality smooth results very close to imagecopyresampled.
4 = Up to 25 times faster. Almost identical to imagecopyresampled for most images.
5 = No speedup. Just uses imagecopyresampled, highest quality but no advantage over imagecopyresampled.
*/
if (empty($src_image) || empty($dst_image)) { return false; }
if ($quality <= 1) {
$temp = imagecreatetruecolor ($dst_w + 1, $dst_h + 1);
imagecopyresized ($temp, $src_image, $dst_x, $dst_y, $src_x, $src_y, $dst_w + 1, $dst_h + 1, $src_w, $src_h);
imagecopyresized ($dst_image, $temp, 0, 0, 0, 0, $dst_w, $dst_h, $dst_w, $dst_h);
imagedestroy ($temp);
} elseif ($quality < 5 && (($dst_w * $quality) < $src_w || ($dst_h * $quality) < $src_h)) {
$tmp_w = $dst_w * $quality;
$tmp_h = $dst_h * $quality;
$temp = imagecreatetruecolor ($tmp_w + 1, $tmp_h + 1);
imagecopyresized ($temp, $src_image, $dst_x * $quality, $dst_y * $quality, $src_x, $src_y, $tmp_w + 1, $tmp_h + 1, $src_w, $src_h);
imagecopyresampled ($dst_image, $temp, 0, 0, 0, 0, $dst_w, $dst_h, $tmp_w, $tmp_h);
imagedestroy ($temp);
} else {
imagecopyresampled ($dst_image, $src_image, $dst_x, $dst_y, $src_x, $src_y, $dst_w, $dst_h, $src_w, $src_h);
}
return true;
}
/**
* @ignore
*/
function mime_content_type_custom($f) {
return trim(exec('file -bi ' . escapeshellarg ($f )));
}
?>
+144
View File
@@ -0,0 +1,144 @@
<?php
/**
* @ignore
*/
################################################################################
# kusaba MySQL Importing Script v1.0 is © 2007 David Steven-Jennings (relixx@gmail.com)
#
# This work is licensed under the Creative Commons Attribution-ShareAlike 2.5 License.
# To view a copy of this license, visit http://creativecommons.org/licenses/by-sa/2.5/
# or send a letter to Creative Commons, 543 Howard Street, 5th Floor, San Francisco,
# California, 94105, USA.
#
# You can modify this script as you wish just as long as this box stays intact. If
# you do modify this script please state that you have done so and give me credit
# as the author of the original script (with my email address intact).
################################################################################
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="pl" lang="pl">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>MySQL Batch File Importing Script</title>
<style type="text/css">
body { font-family: sans-serif; font-size: 75%; background: #ffe }
a { text-decoration: none; color: #550 }
h1,h2 { margin: 0px; background: #fca }
h1 { font-size: 150% }
h2 { font-size: 100%; margin-top: 1em }
.hl { font-style: italic }
.plus { float: right; font-size: 8px; font-weight: normal; padding: 1px 4px 2px 4px; margin: 0px 0px; background: #eb9; color: #000; border: 1px solid #da8; cursor: hand; cursor: pointer }
.plus:hover { background: #da8; border: 1px solid #c97 }
ul { list-style: none; padding-left: 0px; margin: 0px }
li { margin: 0px }
li:hover { background: #fec; }
li a { display: block; width: 100%; }
</style>
<link rel="shortcut icon" href="/favicon.ico" />
</head>
<body>
<div style="text-align:center;"><h1>MySQL Batch File Importing Script</h1></div>
<?php
if (!isset($_POST["confirm"])) {
?>
<br /><br />
<font color="#FF0000"><strong>WARNING!</strong></font><br /><br />
The purpose of this script is to quickly and easily run the commands contained within the kusaba SQL file, and is
to be used if you are installing the script for the first time or want to recreate the tables, for whatever reason.<br />
Running this script will delete any related tables and their data (including the admin files). I offer this script as-is and cannot be held
responsible for any damages caused or accidental loss of data incurred as a result of running this script.<br />
Before running this script, make sure that:<br />
<ul>
<li>-&gt; You have set up the database connection and that it is working</li>
<li>-&gt; You have created the database</li>
<li>-&gt; You have created the database user and set up the config file appropriately</li>
</ul>
<form action="s2kx.php" method="post">
<br />
<input type="checkbox" name="confirm" /> By clicking this check box I agree that the author of this script cannot be held responsible for my own stupidity if something goes wrong.<br /><br /><br />
<input type="submit" value="Import the MySQL batch file" />
</form>
<?php
} else {
require('config.php');
//$reqiredtables = array("ads","announcements","embeds","faq","rules");
//foreach ($reqiredtables as $tablename) {
// if (mysql_table_exists(KU_DBDATABASE,KU_DBPREFIX.$tablename)) {
// die("Table <strong>".KU_DBPREFIX.$tablename."</strong> already exists in the database! Drop it, and re run this script.");
// }
//}
// Lets open the file for reading! :)
echo '<h2>SQL Batch File Processing</h2>';
echo 'Locating \'s2kx.sql\'... ';
if (file_exists('s2kx.sql') && (filesize('s2kx.sql') > 0)) {
echo 'found.<br />';
$sqlfile = fopen('s2kx.sql', 'r');
echo 'File opened.<br />';
$readdata = fread($sqlfile, filesize('s2kx.sql'));
$readdata = str_replace('PREFIX_',KU_DBPREFIX,$readdata);
fclose($sqlfile);
echo 'Contents read.<br />';
}else{
echo '<font color=red>Error.</font> ';
die('An error occured. s2kx.sql does not exist in this directory or it is 0 bytes big :( Barring that, do you have read permissions for the directory?');
}
$tc_db->Execute("ALTER DATABASE `" . KU_DBDATABASE . "` CHARACTER SET utf8 COLLATE utf8_general_ci");
// Explodes the array
$sqlarray = explode("\n", $readdata);
// Loops through the array and deletes the non-SQL bits in the file, which is basically the '--' lines and the lines with no content
foreach ($sqlarray as $key => $sqldata) {
if (strstr($sqldata, '--') || strlen($sqldata) == 0){
unset($sqlarray[$key]);
}
}
// Here we are imploding everything together again...
$readdata = implode('',$sqlarray);
// ...then exploding it again. At this point we will have an array where each key's value is a one of the CREATE statements
$sqlarray = explode(';',$readdata);
echo 'File contents have been formatted for use with mysql_query.<br />';
// Lets drop any existing tables in the database
$listoftables = $tc_db->GetAll("show tables from ".KU_DBDATABASE."");
echo '<h2>Table Creation</h2>';
// Lets now loop through the array and create each table
foreach ($sqlarray as $sqldata) {
if (strlen($sqldata) !== 0) { // As the array was exploded on ';', the last ';' caused a blank element to be created as there was no data after it :p
// The following three lines retrieve the table name of the table from the sql command. It's dynamic so it doesn't matter how many tables need to be created
// As long as each CREATE TABLE statement stays in the format CREATE TABLE `table` then this part will work.
$pos1 = strpos($sqldata, '`');
$pos2 = strpos($sqldata, '`', $pos1 + 1);
$tablename = substr($sqldata, $pos1+1, ($pos2-$pos1)-1);
echo "Attempting to create table '$tablename'... ";
if($tc_db->Execute($sqldata)) {
echo "success.<br />";
} else {
echo "<font color='red'>failed</font>. Enable debugging by setting KU_DEBUG to true to see this error.<br />";
die ("Table creation failed. Please rerun this script again or attempt to fix the problem if you know how to solve it.");
}
}
}
// All done :)
echo '<br />SQL commands have finished. If all is well, proceed to the <a href="install.php"><strong><u>installation file</u></strong></a> but don\'t forget to delete this file!';
}
function mysql_table_exists($database, $tableName)
{
global $tc_db;
$tables = array();
$tablesResults = $tc_db->GetAll("SHOW TABLES FROM `$database`;");
foreach ($tablesResults AS $row) $tables[] = $row[0];
return(in_array($tableName, $tables));
}
?>
</body>
</html>
+99
View File
@@ -0,0 +1,99 @@
-- --------------------------------------------------------
--
-- Drop tables not used in Kusaba X.
--
DROP TABLE `PREFIX_announcements`;
DROP TABLE `PREFIX_faptcha_attempts`;
DROP TABLE `PREFIX_spamfilter`;
DROP TABLE `PREFIX_menu`;
ALTER TABLE `PREFIX_boards` DROP enablefaptcha;
ALTER TABLE `PREFIX_boards` DROP enableporn;
ALTER TABLE `PREFIX_staff` DROP suspended;
ALTER TABLE `PREFIX_staff` DROP access;
ALTER TABLE `PREFIX_banlist` CHANGE `note` `staffnote` TEXT;
-- --------------------------------------------------------
--
-- Table structure for table `ads`
--
CREATE TABLE `PREFIX_ads` (
`id` smallint(1) unsigned NOT NULL,
`position` varchar(3) NOT NULL,
`disp` tinyint(1) NOT NULL,
`boards` varchar(255) NOT NULL,
`code` text NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- Table structure for table `announcements`
--
CREATE TABLE `PREFIX_announcements` (
`id` int(10) unsigned NOT NULL auto_increment,
`parentid` int(10) unsigned NOT NULL default '0',
`subject` varchar(255) NOT NULL,
`postedat` int(20) NOT NULL,
`postedby` varchar(75) NOT NULL,
`message` text NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- Table structure for table `embeds`
--
CREATE TABLE `PREFIX_embeds` (
`id` tinyint(5) unsigned NOT NULL auto_increment,
`filetype` varchar(3) NOT NULL,
`name` varchar(255) NOT NULL,
`videourl` varchar(510) NOT NULL,
`width` tinyint(3) unsigned NOT NULL,
`height` tinyint(3) unsigned NOT NULL,
`code` text NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- Table structure for table `faq`
--
CREATE TABLE `PREFIX_faq` (
`id` smallint(5) unsigned NOT NULL auto_increment,
`order` smallint(5) unsigned NOT NULL,
`heading` varchar(255) NOT NULL,
`message` text NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- Table structure for table `rules`
--
CREATE TABLE `PREFIX_rules` (
`id` smallint(5) unsigned NOT NULL auto_increment,
`order` smallint(5) unsigned NOT NULL,
`heading` varchar(255) NOT NULL,
`message` text NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
ALTER TABLE `PREFIX_boards` CHANGE `maxpages` `maxpages` INT( 20 ) NOT NULL DEFAULT '11';
ALTER TABLE `PREFIX_boards` CHANGE `maxpages` `maxpages` INT( 20 ) NOT NULL DEFAULT '11';
INSERT INTO `PREFIX_ads` (`id`, `position`, `disp`, `boards`, `code`) VALUES (1, 'top', 0, '', 'Right Frame Top'), (2, 'bot', 0, '', 'Right Frame Bottom');
INSERT INTO `PREFIX_embeds` (`filetype`, `name`, `videourl`, `width`, `height`, `code`) VALUES ('you', 'Youtube', 'http://www.youtube.com/watch?v=', 200, 164, '<object type="application/x-shockwave-flash" width="SET_WIDTH" height="SET_HEIGHT" data="http://www.youtube.com/v/EMBED_ID"> <param name="movie" value="http://www.youtube.com/v/EMBED_ID" /> </object>'), ('goo', 'Google', 'http://video.google.com/videoplay?docid=', 200, 164, '<embed width="SET_WIDTH" height="SET_HEIGHT" id="VideoPlayback" type="application/x-shockwave-flash" src="http://video.google.com/googleplayer.swf?docId=EMBED_ID"></embed>') ;
+251
View File
@@ -0,0 +1,251 @@
<?php
/**
* @ignore
*/
################################################################################
# kusaba MySQL Importing Script v1.0 is © 2007 David Steven-Jennings (relixx@gmail.com)
#
# This work is licensed under the Creative Commons Attribution-ShareAlike 2.5 License.
# To view a copy of this license, visit http://creativecommons.org/licenses/by-sa/2.5/
# or send a letter to Creative Commons, 543 Howard Street, 5th Floor, San Francisco,
# California, 94105, USA.
#
# You can modify this script as you wish just as long as this box stays intact. If
# you do modify this script please state that you have done so and give me credit
# as the author of the original script (with my email address intact).
################################################################################
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="pl" lang="pl">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>MySQL Batch File Importing Script</title>
<style type="text/css">
body { font-family: sans-serif; font-size: 75%; background: #ffe }
a { text-decoration: none; color: #550 }
h1,h2 { margin: 0px; background: #fca }
h1 { font-size: 150% }
h2 { font-size: 100%; margin-top: 1em }
.hl { font-style: italic }
.plus { float: right; font-size: 8px; font-weight: normal; padding: 1px 4px 2px 4px; margin: 0px 0px; background: #eb9; color: #000; border: 1px solid #da8; cursor: hand; cursor: pointer }
.plus:hover { background: #da8; border: 1px solid #c97 }
ul { list-style: none; padding-left: 0px; margin: 0px }
li { margin: 0px }
li:hover { background: #fec; }
li a { display: block; width: 100%; }
</style>
<link rel="shortcut icon" href="/favicon.ico" />
</head>
<body>
<div style="text-align:center;"><h1>MySQL Batch File Importing Script</h1></div>
<?php
if (!isset($_POST["confirm"])) {
?>
<br /><br />
<font color="#FF0000"><strong>WARNING!</strong></font><br /><br />
The purpose of this script is to quickly and easily run the commands contained within the kusaba SQL file, and is
to be used if you are installing the script for the first time or want to recreate the tables, for whatever reason.<br />
Running this script will delete any related tables and their data (including the admin files). I offer this script as-is and cannot be held
responsible for any damages caused or accidental loss of data incurred as a result of running this script.<br />
Before running this script, make sure that:<br />
<ul>
<li>-&gt; You have set up the database connection and that it is working</li>
<li>-&gt; You have created the database</li>
<li>-&gt; You have created the database user and set up the config file appropriately</li>
</ul>
<form action="update-mysql.php" method="post">
<br />
<input type="checkbox" checked="checked" name="removeposts" />Uncheck this box to convert posts to a single table without deleting the old tables. The old tables will not be deleted after being converted, but will remain completely unused.<br /><br /><br />
<input type="checkbox" checked="checked" name="removefront" />Uncheck this box to convert FAQ, Rules, and News to a single table without deleting the old tables. The old tables will not be deleted after being converted, but will remain completely unused.<br /><br /><br />
<br />
<input type="checkbox" name="confirm" /> By clicking this check box I agree that the author of this script cannot be held responsible for my own stupidity if something goes wrong.<br /><br /><br />
<input type="submit" value="Import the MySQL batch file" />
</form>
<?php
} else {
require('config.php');
/*$reqiredtables = array("ads","announcements","embeds","faq","rules");
foreach ($reqiredtables as $tablename) {
if (mysql_table_exists(KU_DBDATABASE,KU_DBPREFIX.$tablename)) {
die("Table <strong>".KU_DBPREFIX.$tablename."</strong> already exists in the database! Drop it, and re run this script.");
}
}*/
// Lets open the file for reading! :)
echo '<h2>SQL Batch File Processing</h2>';
echo 'Locating \'kusabax_updatemysql.sql\'... ';
if (file_exists('kusabax_updatemysql.sql') && (filesize('kusabax_updatemysql.sql') > 0)) {
echo 'found.<br />';
$sqlfile = fopen('kusabax_updatemysql.sql', 'r');
echo 'File opened.<br />';
$readdata = fread($sqlfile, filesize('kusabax_updatemysql.sql'));
$readdata = str_replace('PREFIX_',KU_DBPREFIX,$readdata);
fclose($sqlfile);
echo 'Contents read.<br />';
}else{
echo '<font color=red>Error.</font> ';
die('An error occured. kusabax_updatemysql.sql does not exist in this directory or it is 0 bytes big :( Barring that, do you have read permissions for the directory?');
}
$tc_db->Execute("ALTER DATABASE `" . KU_DBDATABASE . "` CHARACTER SET utf8 COLLATE utf8_general_ci");
// Explodes the array
$sqlarray = explode("\n", $readdata);
// Loops through the array and deletes the non-SQL bits in the file, which is basically the '--' lines and the lines with no content
foreach ($sqlarray as $key => $sqldata) {
if (strstr($sqldata, '--') || strlen($sqldata) == 0){
unset($sqlarray[$key]);
}
}
// Here we are imploding everything together again...
$readdata = implode('',$sqlarray);
// ...then exploding it again. At this point we will have an array where each key's value is a one of the CREATE statements
$sqlarray = explode(';',$readdata);
echo 'File contents have been formatted for use with mysql_query.<br />';
// Lets drop any existing tables in the database
$listoftables = $tc_db->GetAll("show tables from ".KU_DBDATABASE."");
echo '<h2>Table Creation</h2>';
// Lets now loop through the array and create each table
foreach ($sqlarray as $sqldata) {
if (strlen($sqldata) !== 0) { // As the array was exploded on ';', the last ';' caused a blank element to be created as there was no data after it :p
// The following three lines retrieve the table name of the table from the sql command. It's dynamic so it doesn't matter how many tables need to be created
// As long as each CREATE TABLE statement stays in the format CREATE TABLE `table` then this part will work.
$pos1 = strpos($sqldata, '`');
$pos2 = strpos($sqldata, '`', $pos1 + 1);
$tablename = substr($sqldata, $pos1+1, ($pos2-$pos1)-1);
echo "Attempting to create table '$tablename'... ";
if($tc_db->Execute($sqldata)) {
echo "success.<br />";
} else {
echo "<font color='red'>failed</font>. Enable debugging by setting KU_DEBUG to true to see this error.<br />";
die ("Table creation failed. Please rerun this script again or attempt to fix the problem if you know how to solve it.");
}
}
}
add_column_if_not_exist("boards", "start", "int(10) UNSIGNED AFTER `type`");
add_column_if_not_exist("reports", "reason", "VARCHAR(255)");
add_column_if_not_exist("staff", "salt", "VARCHAR(3) AFTER `password`");
add_column_if_not_exist("banlist", "appeal", "TEXT");
add_column_if_not_exist("banlist", "staffnote", "text NOT NULL");
add_column_if_not_exist("banlist", "expired", "tinyint(1) NOT NULL default '0'");
add_column_if_not_exist("boards", "embeds_allowed", "VARCHAR(255) NOT NULL DEFAULT '' AFTER `forcedanon`");
echo "Attempting to convert posts...";
db_conversion();
echo "done<br />";
front_db_conversion();
// All done :)
echo '<br />SQL commands have finished. If all is well, proceed to the <a href="install.php"><strong><u>installation file</u></strong></a> but don\'t forget to delete this file!';
}
function mysql_table_exists($database, $tableName)
{
global $tc_db;
$tables = array();
$tablesResults = $tc_db->GetAll("SHOW TABLES FROM `$database`;");
foreach ($tablesResults AS $row) $tables[] = $row[0];
return(in_array($tableName, $tables));
}
function add_column_if_not_exist($tableName, $columnName, $column_attr = "VARCHAR( 255 ) NULL" ){
global $tc_db;
$exists = false;
$columns = $tc_db->GetAll("SHOW COLUMNS FROM `".KU_DBPREFIX."$tableName");
foreach ($columns as $column) {
if($column['Field'] == $columnName){
$exists = true;
break;
}
}
if(!$exists){
$tc_db->Execute("ALTER TABLE `".KU_DBPREFIX."$tableName` ADD `$columnName` $column_attr");
}
}
function db_conversion()
{
global $tc_db;
$resultsboard = $tc_db->GetAll("SELECT HIGH_PRIORITY `id`, `name` FROM `" . KU_DBPREFIX . "boards` ORDER BY `name` ASC");
foreach ($resultsboard as $lineboard) {
echo "Converting board /".$lineboard['name']."/...";
$posts_table = KU_DBPREFIX.'posts_'.$lineboard['name'];
$posts = $tc_db->GetOne('SELECT COUNT(*) FROM `' . $posts_table.'`');
$i=0;
while ($i <= $posts+1500) {
$boardid = $lineboard['id'];
$results = $tc_db->GetAssoc('SELECT * FROM `' . $posts_table.'` LIMIT '.$i.',1500');
foreach($results AS $line) {
$query = 'INSERT INTO `'.KU_DBPREFIX.'posts` (`id`, `boardid`, `parentid`, `name`, `tripcode`, `email`, `subject`, `message`, `password`, `file`, `file_md5`, `file_type`, `file_original`, `file_size`, `file_size_formatted`, `image_w`, `image_h`, `thumb_w`, `thumb_h`, `ip`, `ipmd5`, `tag`, `timestamp_formatted`, `timestamp`, `stickied`, `locked`, `posterauthority`, `reviewed`, `deleted_timestamp`, `IS_DELETED`, `bumped`) VALUES
( ' . $tc_db->qstr($line['id']) . ', \'' . $boardid . '\' ,' . $tc_db->qstr($line['parentid']) . ', ' . $tc_db->qstr($line['name']) . ', ' . $tc_db->qstr($line['tripcode']) . ', ' . $tc_db->qstr($line['email']) . ', ' . $tc_db->qstr($line['subject']) . ', ' . $tc_db->qstr($line['message']) . ', ' . $tc_db->qstr($line['password']) . ', ' . $tc_db->qstr($line['filename']) . ', ' . $tc_db->qstr($line['filemd5']) . ', ' .$tc_db->qstr($line['filetype']) . ', ' . $tc_db->qstr($line['filename_original']) . ', ' . $tc_db->qstr($line['filesize']) . ', ' . $tc_db->qstr($line['filesize_formatted']) . ', ' . $tc_db->qstr($line['image_w']) . ', ' . $tc_db->qstr($line['image_h']) . ', ' . $tc_db->qstr($line['thumb_w']) . ', ' . $tc_db->qstr($line['thumb_h']) . ', ' . $tc_db->qstr($line['ip']) . ', ' . $tc_db->qstr($line['ipmd5']) . ', ' . $tc_db->qstr($line['tag']) . ', '. $tc_db->qstr(date('y/m/d(D)H:i', $line['postedat'])) . ', ' . $tc_db->qstr($line['postedat']) . ', ' . $tc_db->qstr($line['stickied']) . ', ' . $tc_db->qstr($line['locked']) . ', ' . $tc_db->qstr($line['posterauthority']) . ', ' . $tc_db->qstr($line['reviewed']) . ', ' . $tc_db->qstr($line['deletedat']) . ', ' . $tc_db->qstr($line['IS_DELETED']) . ', ' . $tc_db->qstr($line['lastbumped']) . ')';
$tc_db->Execute($query);
if (!mysql_error()) {
} else {
$error = mysql_error();
$tc_db->Execute('TRUNCATE TABLE `'.KU_DBPREFIX.'posts`');
die ("Conversion failed. Please rerun this script again or attempt to fix the problem if you know how to solve it.<br />
Debugging info:<br />
Query: ".$query."<br />
Error: ".$error."");
}
}
$i = $i+1500;
}
echo "done<br />";
}
if (isset($_POST["removeposts"])) {
echo "Removing old posts tables...";
foreach ($resultsboard as $lineboard) {
$posts_table = 'posts_'.$lineboard['name'];
$tc_db->Execute('DROP TABLE `' . $posts_table.'`');
}
echo "done<br />";
}
}
function front_db_conversion() {
global $tc_db;
echo 'Updating News, FAQ, and Rules tables...<br />';
$news = $tc_db->GetAll("SELECT * FROM `" . KU_DBPREFIX . "news`");
$faq = $tc_db->GetAll("SELECT * FROM `" . KU_DBPREFIX . "faq` ORDER BY `order`");
$rules = $tc_db->GetAll("SELECT * FROM `" . KU_DBPREFIX . "rules` ORDER BY `order`");
foreach ($news as $newspost) {
$tc_db->Execute("INSERT HIGH_PRIORITY INTO `" . KU_DBPREFIX . "front` ( `page`, `subject` , `message` , `timestamp` , `poster` , `email` ) VALUES ( '0', '" . $newspost['subject'] . "' , '" . $newspost['message'] . "' , '" . $newspost['postedat'] . "' , '" . $newspost['postedby'] . "' , '" . $newspost['postedemail'] . "' )");
}
echo 'Updated news table.<br />';
foreach ($faq as $faqpost) {
$tc_db->Execute("INSERT HIGH_PRIORITY INTO `" . KU_DBPREFIX . "front` ( `page`, `order`, `subject` , `message` ) VALUES ( '1', '" . $faqpost['order'] . "' , '" . $faqpost['heading'] . "' , '" . $faqpost['message'] . "' )");
}
echo 'Updated FAQ table.<br />';
foreach ($rules as $rulespost) {
$tc_db->Execute("INSERT HIGH_PRIORITY INTO `" . KU_DBPREFIX . "front` ( `page`, `order`, `subject` , `message` ) VALUES ( '2', '" . $rulespost['order'] . "' , '" . $rulespost['heading'] . "' , '" . $rulespost['message'] . "' )");
}
echo 'Updated rules table.<br />';
if (isset($_POST['removefront'])) {
echo 'Deleting unused front page tables...';
$tc_db->Execute("DROP TABLE `" . KU_DBPREFIX . "news`");
$tc_db->Execute("DROP TABLE `" . KU_DBPREFIX . "faq`");
$tc_db->Execute("DROP TABLE `" . KU_DBPREFIX . "rules`");
echo ' done<br />';
}
echo 'Finished updating front tables.<br />';
}
?>
</body>
</html>