punbb/install.php
author Dan
Thu, 12 Jul 2007 01:04:01 -0400
changeset 2 a8a21e1c7afa
parent 0 f9ffdbd96607
permissions -rw-r--r--
Let's just say that the API loads. While a decent part of PunBB works, we've still got a LONG way to go, mainly with form validation and security. At this point, Punano is NOT secure as far as privileges and user levels go.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
0
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
     1
<?php
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
     2
/***********************************************************************
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
     3
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
     4
  Copyright (C) 2002-2005  Rickard Andersson (rickard@punbb.org)
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
     5
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
     6
  This file is part of PunBB.
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
     7
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
     8
  PunBB is free software; you can redistribute it and/or modify it
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
     9
  under the terms of the GNU General Public License as published
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    10
  by the Free Software Foundation; either version 2 of the License,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    11
  or (at your option) any later version.
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    12
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    13
  PunBB is distributed in the hope that it will be useful, but
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    14
  WITHOUT ANY WARRANTY; without even the implied warranty of
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    15
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    16
  GNU General Public License for more details.
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    17
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    18
  You should have received a copy of the GNU General Public License
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    19
  along with this program; if not, write to the Free Software
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    20
  Foundation, Inc., 59 Temple Place, Suite 330, Boston,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    21
  MA  02111-1307  USA
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    22
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    23
************************************************************************/
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    24
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    25
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    26
// The PunBB version this script installs
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    27
$punbb_version = '1.2.15';
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    28
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    29
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    30
define('PUN_ROOT', './');
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    31
if (file_exists(PUN_ROOT.'config.php'))
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    32
	exit('The file \'config.php\' already exists which would mean that PunBB is already installed. You should go <a href="index.php">here</a> instead.');
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    33
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    34
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    35
// Make sure we are running at least PHP 4.1.0
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    36
if (intval(str_replace('.', '', phpversion())) < 410)
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    37
	exit('You are running PHP version '.PHP_VERSION.'. PunBB requires at least PHP 4.1.0 to run properly. You must upgrade your PHP installation before you can continue.');
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    38
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    39
// Disable error reporting for uninitialized variables
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    40
error_reporting(E_ALL);
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    41
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    42
// Turn off PHP time limit
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    43
@set_time_limit(0);
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    44
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    45
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    46
if (!isset($_POST['form_sent']))
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    47
{
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    48
	// Determine available database extensions
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    49
	$dual_mysql = false;
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    50
	$db_extensions = array();
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    51
	if (function_exists('mysqli_connect'))
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    52
		$db_extensions[] = array('mysqli', 'MySQL Improved');
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    53
	if (function_exists('mysql_connect'))
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    54
	{
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    55
		$db_extensions[] = array('mysql', 'MySQL Standard');
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    56
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    57
		if (count($db_extensions) > 1)
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    58
			$dual_mysql = true;
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    59
	}
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    60
	if (function_exists('sqlite_open'))
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    61
		$db_extensions[] = array('sqlite', 'SQLite');
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    62
	if (function_exists('pg_connect'))
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    63
		$db_extensions[] = array('pgsql', 'PostgreSQL');
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    64
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    65
	if (empty($db_extensions))
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    66
		exit('This PHP environment does not have support for any of the databases that PunBB supports. PHP needs to have support for either MySQL, PostgreSQL or SQLite in order for PunBB to be installed.');
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    67
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    68
?>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    69
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    70
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    71
<html>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    72
<head>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    73
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    74
<title>PunBB Installation</title>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    75
<link rel="stylesheet" type="text/css" href="style/Oxygen.css" />
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    76
<script type="text/javascript">
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    77
<!--
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    78
function process_form(the_form)
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    79
{
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    80
	var element_names = new Object()
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    81
	element_names["req_db_type"] = "Database type"
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    82
	element_names["req_db_host"] = "Database server hostname"
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    83
	element_names["req_db_name"] = "Database name"
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    84
	element_names["db_prefix"] = "Table prefix"
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    85
	element_names["req_username"] = "Administrator username"
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    86
	element_names["req_password1"] = "Administrator password 1"
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    87
	element_names["req_password2"] = "Administrator password 2"
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    88
	element_names["req_email"] = "Administrator's e-mail"
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    89
	element_names["req_base_url"] = "Base URL"
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    90
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    91
	if (document.all || document.getElementById)
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    92
	{
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    93
		for (i = 0; i < the_form.length; ++i)
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    94
		{
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    95
			var elem = the_form.elements[i]
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    96
			if (elem.name && elem.name.substring(0, 4) == "req_")
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    97
			{
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    98
				if (elem.type && (elem.type=="text" || elem.type=="textarea" || elem.type=="password" || elem.type=="file") && elem.value=='')
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    99
				{
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   100
					alert("\"" + element_names[elem.name] + "\" is a required field in this form.")
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   101
					elem.focus()
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   102
					return false
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   103
				}
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   104
			}
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   105
		}
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   106
	}
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   107
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   108
	return true
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   109
}
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   110
// -->
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   111
</script>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   112
</head>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   113
<body onload="document.getElementById('install').req_db_type.focus()">
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   114
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   115
<div id="puninstall" style="margin: auto 10% auto 10%">
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   116
<div class="pun">
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   117
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   118
<div class="block">
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   119
	<h2><span>PunBB Installation</span></h2>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   120
	<div class="box">
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   121
		<div class="inbox">
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   122
			<p>Welcome to PunBB installation! You are about to install PunBB. In order to install PunBB you must complete the form set out below. If you encounter any difficulties with the installation, please refer to the documentation.</p>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   123
		</div>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   124
	</div>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   125
</div>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   126
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   127
<div class="blockform">
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   128
	<h2><span>Install PunBB 1.2</span></h2>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   129
	<div class="box">
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   130
		<form id="install" method="post" action="install.php" onsubmit="this.start.disabled=true;if(process_form(this)){return true;}else{this.start.disabled=false;return false;}">
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   131
		<div><input type="hidden" name="form_sent" value="1" /></div>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   132
			<div class="inform">
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   133
				<div class="forminfo">
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   134
					<h3>Database setup</h3>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   135
					<p>Please enter the requested information in order to setup your database for PunBB. You must know all the information asked for before proceeding with the installation.</p>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   136
				</div>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   137
				<fieldset>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   138
				<legend>Select your database type</legend>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   139
					<div class="infldset">
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   140
						<p>PunBB currently supports MySQL, PostgreSQL and SQLite. If your database of choice is missing from the drop-down menu below, it means this PHP environment does not have support for that particular database. More information regarding support for particular versions of each database can be found in the FAQ.</p>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   141
<?php if ($dual_mysql): ?>						<p>PunBB has detected that your PHP environment supports two different ways of communicating with MySQL. The two options are called standard and improved. If you are uncertain which one to use, start by trying improved and if that fails, try standard.</p>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   142
<?php endif; ?>						<label><strong>Database type</strong>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   143
						<br /><select name="req_db_type">
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   144
<?php
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   145
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   146
	foreach ($db_extensions as $db_type)
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   147
		echo "\t\t\t\t\t\t\t".'<option value="'.$db_type[0].'">'.$db_type[1].'</option>'."\n";
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   148
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   149
?>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   150
						</select>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   151
						<br /></label>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   152
					</div>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   153
				</fieldset>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   154
			</div>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   155
			<div class="inform">
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   156
				<fieldset>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   157
					<legend>Enter your database server hostname</legend>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   158
					<div class="infldset">
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   159
						<p>The address of the database server (example: localhost, db.myhost.com or 192.168.0.15). You can specify a custom port number if your database doesn't run on the default port (example: localhost:3580). For SQLite support, just enter anything or leave it at 'localhost'.</p>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   160
						<label><strong>Database server hostname</strong><br /><input type="text" name="req_db_host" value="localhost" size="50" maxlength="100" /><br /></label>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   161
					</div>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   162
				</fieldset>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   163
			</div>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   164
			<div class="inform">
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   165
				<fieldset>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   166
					<legend>Enter then name of your database</legend>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   167
					<div class="infldset">
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   168
						<p>The name of the database that PunBB will be installed into. The database must exist. For SQLite, this is the relative path to the database file. If the SQLite database file does not exist, PunBB will attempt to create it.</p>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   169
						<label for="req_db_name"><strong>Database name</strong><br /><input id="req_db_name" type="text" name="req_db_name" size="30" maxlength="50" /><br /></label>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   170
					</div>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   171
				</fieldset>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   172
			</div>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   173
			<div class="inform">
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   174
				<fieldset>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   175
					<legend>Enter your database username and password</legend>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   176
					<div class="infldset">
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   177
						<p>Enter the username and password with which you connect to the database. Ignore for SQLite.</p>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   178
						<label class="conl">Database username<br /><input type="text" name="db_username" size="30" maxlength="50" /><br /></label>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   179
						<label class="conl">Database password<br /><input type="text" name="db_password" size="30" maxlength="50" /><br /></label>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   180
						<div class="clearer"></div>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   181
					</div>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   182
				</fieldset>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   183
			</div>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   184
			<div class="inform">
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   185
				<fieldset>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   186
					<legend>Enter database table prefix</legend>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   187
					<div class="infldset">
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   188
						<p>If you like you can specify a table prefix. This way you can run multiple copies of PunBB in the same database (example: foo_).</p>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   189
						<label>Table prefix<br /><input id="db_prefix" type="text" name="db_prefix" size="20" maxlength="30" /><br /></label>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   190
					</div>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   191
				</fieldset>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   192
			</div>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   193
			<div class="inform">
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   194
				<div class="forminfo">
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   195
					<h3>Administration setup</h3>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   196
					<p>Please enter the requested information in order to setup an administrator for your PunBB installation</p>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   197
				</div>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   198
				<fieldset>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   199
					<legend>Enter Administrators username</legend>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   200
					<div class="infldset">
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   201
						<p>The username of the forum administrator. You can later create more administrators and moderators. Usernames can be between 2 and 25 characters long.</p>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   202
						<label><strong>Administrator username</strong><br /><input type="text" name="req_username" size="25" maxlength="25" /><br /></label>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   203
					</div>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   204
				</fieldset>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   205
			</div>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   206
			<div class="inform">
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   207
				<fieldset>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   208
					<legend>Enter and confirm Administrator password</legend>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   209
					<div class="infldset">
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   210
					<p>Passwords can be between 4 and 16 characters long. Passwords are case sensitive.</p>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   211
						<label class="conl"><strong>Password</strong><br /><input id="req_password1" type="text" name="req_password1" size="16" maxlength="16" /><br /></label>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   212
						<label class="conl"><strong>Confirm password</strong><br /><input type="text" name="req_password2" size="16" maxlength="16" /><br /></label>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   213
						<div class="clearer"></div>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   214
					</div>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   215
				</fieldset>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   216
			</div>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   217
			<div class="inform">
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   218
				<fieldset>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   219
					<legend>Enter Administrator's e-mail</legend>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   220
					<div class="infldset">
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   221
						<p>The e-mail address of the forum administrator.</p>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   222
						<label for="req_email"><strong>Administrator's e-mail</strong><br /><input id="req_email" type="text" name="req_email" size="50" maxlength="50" /><br /></label>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   223
					</div>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   224
				</fieldset>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   225
			</div>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   226
			<div class="inform">
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   227
				<fieldset>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   228
					<legend>Enter the Base URL of your PunBB installation</legend>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   229
					<div class="infldset">
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   230
						<p>The URL (without trailing slash) of your PunBB forum (example: http://forum.myhost.com or http://myhost.com/~myuser). This <strong>must</strong> be correct or administrators and moderators will not be able to submit any forms. Please note that the preset value below is just an educated guess by PunBB.</p>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   231
						<label><strong>Base URL</strong><br /><input type="text" name="req_base_url" value="http://<?php echo $_SERVER['SERVER_NAME'].str_replace('\\', '/', dirname($_SERVER['SCRIPT_NAME'])) ?>" size="60" maxlength="100" /><br /></label>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   232
					</div>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   233
				</fieldset>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   234
			</div>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   235
			<p><input type="submit" name="start" value="Start install" /></p>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   236
		</form>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   237
	</div>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   238
</div>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   239
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   240
</div>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   241
</div>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   242
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   243
</body>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   244
</html>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   245
<?php
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   246
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   247
}
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   248
else
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   249
{
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   250
	//
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   251
	// Strip slashes only if magic_quotes_gpc is on.
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   252
	//
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   253
	function unescape($str)
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   254
	{
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   255
		return (get_magic_quotes_gpc() == 1) ? stripslashes($str) : $str;
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   256
	}
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   257
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   258
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   259
	//
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   260
	// Compute a hash of $str.
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   261
	// Uses sha1() if available. If not, SHA1 through mhash() if available. If not, fall back on md5().
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   262
	//
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   263
	function pun_hash($str)
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   264
	{
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   265
		if (function_exists('sha1'))	// Only in PHP 4.3.0+
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   266
			return sha1($str);
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   267
		else if (function_exists('mhash'))	// Only if Mhash library is loaded
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   268
			return bin2hex(mhash(MHASH_SHA1, $str));
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   269
		else
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   270
			return md5($str);
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   271
	}
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   272
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   273
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   274
	//
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   275
	// A temporary replacement for the full error handler found in functions.php.
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   276
	// It's here because a function called error() must be callable in the database abstraction layer.
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   277
	//
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   278
	function error($message, $file = false, $line = false, $db_error = false)
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   279
	{
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   280
		if ($file !== false && $line !== false)
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   281
			echo '<strong style="color: A00000">An error occured on line '.$line.' in file '.$file.'.</strong><br /><br />';
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   282
		else
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   283
			echo '<strong style="color: A00000">An error occured.</strong><br /><br />';
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   284
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   285
		echo '<strong>PunBB reported:</strong> '.htmlspecialchars($message).'<br /><br />';
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   286
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   287
		if ($db_error !== false)
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   288
			echo '<strong>Database reported:</strong> '.htmlspecialchars($db_error['error_msg']).(($db_error['error_no']) ? ' (Errno: '.$db_error['error_no'].')' : '');
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   289
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   290
		exit;
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   291
	}
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   292
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   293
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   294
	$db_type = $_POST['req_db_type'];
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   295
	$db_host = trim($_POST['req_db_host']);
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   296
	$db_name = trim($_POST['req_db_name']);
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   297
	$db_username = unescape(trim($_POST['db_username']));
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   298
	$db_password = unescape(trim($_POST['db_password']));
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   299
	$db_prefix = trim($_POST['db_prefix']);
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   300
	$username = unescape(trim($_POST['req_username']));
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   301
	$email = strtolower(trim($_POST['req_email']));
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   302
	$password1 = unescape(trim($_POST['req_password1']));
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   303
	$password2 = unescape(trim($_POST['req_password2']));
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   304
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   305
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   306
	// Make sure base_url doesn't end with a slash
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   307
	if (substr($_POST['req_base_url'], -1) == '/')
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   308
		$base_url = substr($_POST['req_base_url'], 0, -1);
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   309
	else
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   310
		$base_url = $_POST['req_base_url'];
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   311
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   312
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   313
	// Validate username and passwords
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   314
	if (strlen($username) < 2)
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   315
		error('Usernames must be at least 2 characters long. Please go back and correct.');
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   316
	if (strlen($password1) < 4)
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   317
		error('Passwords must be at least 4 characters long. Please go back and correct.');
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   318
	if ($password1 != $password2)
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   319
		error('Passwords do not match. Please go back and correct.');
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   320
	if (!strcasecmp($username, 'Guest'))
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   321
		error('The username guest is reserved. Please go back and correct.');
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   322
	if (preg_match('/[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}/', $username))
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   323
		error('Usernames may not be in the form of an IP address. Please go back and correct.');
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   324
	if (preg_match('#\[b\]|\[/b\]|\[u\]|\[/u\]|\[i\]|\[/i\]|\[color|\[/color\]|\[quote\]|\[/quote\]|\[code\]|\[/code\]|\[img\]|\[/img\]|\[url|\[/url\]|\[email|\[/email\]#i', $username))
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   325
		error('Usernames may not contain any of the text formatting tags (BBCode) that the forum uses. Please go back and correct.');
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   326
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   327
	if (strlen($email) > 50 || !preg_match('/^(([^<>()[\]\\.,;:\s@"\']+(\.[^<>()[\]\\.,;:\s@"\']+)*)|("[^"\']+"))@((\[\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\])|(([a-zA-Z\d\-]+\.)+[a-zA-Z]{2,}))$/', $email))
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   328
		error('The administrator e-mail address you entered is invalid. Please go back and correct.');
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   329
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   330
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   331
	// Load the appropriate DB layer class
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   332
	switch ($db_type)
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   333
	{
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   334
		case 'mysql':
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   335
			require PUN_ROOT.'include/dblayer/mysql.php';
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   336
			break;
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   337
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   338
		case 'mysqli':
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   339
			require PUN_ROOT.'include/dblayer/mysqli.php';
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   340
			break;
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   341
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   342
		case 'pgsql':
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   343
			require PUN_ROOT.'include/dblayer/pgsql.php';
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   344
			break;
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   345
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   346
		case 'sqlite':
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   347
			require PUN_ROOT.'include/dblayer/sqlite.php';
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   348
			break;
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   349
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   350
		default:
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   351
			error('\''.$db_type.'\' is not a valid database type.');
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   352
	}
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   353
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   354
	// Create the database object (and connect/select db)
2
a8a21e1c7afa Let's just say that the API loads. While a decent part of PunBB works, we've still got a LONG way to go, mainly with form validation and security. At this point, Punano is NOT secure as far as privileges and user levels go.
Dan
parents: 0
diff changeset
   355
	$pun_db = new DBLayer($db_host, $db_username, $db_password, $db_name, $db_prefix, false);
0
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   356
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   357
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   358
	// Do some DB type specific checks
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   359
	switch ($db_type)
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   360
	{
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   361
		case 'mysql':
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   362
		case 'mysqli':
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   363
			break;
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   364
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   365
		case 'pgsql':
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   366
			// Make sure we are running at least PHP 4.3.0 (needed only for PostgreSQL)
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   367
			if (version_compare(PHP_VERSION, '4.3.0', '<'))
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   368
				error('You are running PHP version '.PHP_VERSION.'. PunBB requires at least PHP 4.3.0 to run properly when using PostgreSQL. You must upgrade your PHP installation or use a different database before you can continue.');
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   369
			break;
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   370
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   371
		case 'sqlite':
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   372
			if (strtolower($db_prefix) == 'sqlite_')
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   373
				error('The table prefix \'sqlite_\' is reserved for use by the SQLite engine. Please choose a different prefix.');
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   374
			break;
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   375
	}
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   376
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   377
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   378
	// Make sure PunBB isn't already installed
2
a8a21e1c7afa Let's just say that the API loads. While a decent part of PunBB works, we've still got a LONG way to go, mainly with form validation and security. At this point, Punano is NOT secure as far as privileges and user levels go.
Dan
parents: 0
diff changeset
   379
	$result = $pun_db->query('SELECT 1 FROM '.$db_prefix.'users WHERE id=1');
a8a21e1c7afa Let's just say that the API loads. While a decent part of PunBB works, we've still got a LONG way to go, mainly with form validation and security. At this point, Punano is NOT secure as far as privileges and user levels go.
Dan
parents: 0
diff changeset
   380
	if ($pun_db->num_rows($result))
0
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   381
		error('A table called "'.$db_prefix.'users" is already present in the database "'.$db_name.'". This could mean that PunBB is already installed or that another piece of software is installed and is occupying one or more of the table names PunBB requires. If you want to install multiple copies of PunBB in the same database, you must choose a different table prefix.');
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   382
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   383
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   384
	// Create all tables
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   385
	switch ($db_type)
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   386
	{
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   387
		case 'mysql':
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   388
		case 'mysqli':
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   389
			$sql = 'CREATE TABLE '.$db_prefix."bans (
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   390
					id INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   391
					username VARCHAR(200),
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   392
					ip VARCHAR(255),
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   393
					email VARCHAR(50),
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   394
					message VARCHAR(255),
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   395
					expire INT(10) UNSIGNED,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   396
					PRIMARY KEY (id)
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   397
					) TYPE=MyISAM;";
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   398
			break;
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   399
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   400
		case 'pgsql':
2
a8a21e1c7afa Let's just say that the API loads. While a decent part of PunBB works, we've still got a LONG way to go, mainly with form validation and security. At this point, Punano is NOT secure as far as privileges and user levels go.
Dan
parents: 0
diff changeset
   401
			$pun_db->start_transaction();
0
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   402
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   403
			$sql = 'CREATE TABLE '.$db_prefix."bans (
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   404
					id SERIAL,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   405
					username VARCHAR(200),
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   406
					ip VARCHAR(255),
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   407
					email VARCHAR(50),
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   408
					message VARCHAR(255),
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   409
					expire INT,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   410
					PRIMARY KEY (id)
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   411
					)";
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   412
			break;
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   413
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   414
		case 'sqlite':
2
a8a21e1c7afa Let's just say that the API loads. While a decent part of PunBB works, we've still got a LONG way to go, mainly with form validation and security. At this point, Punano is NOT secure as far as privileges and user levels go.
Dan
parents: 0
diff changeset
   415
			$pun_db->start_transaction();
0
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   416
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   417
			$sql = 'CREATE TABLE '.$db_prefix."bans (
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   418
					id INTEGER NOT NULL,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   419
					username VARCHAR(200),
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   420
					ip  VARCHAR(255),
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   421
					email VARCHAR(50),
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   422
					message VARCHAR(255),
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   423
					expire INTEGER,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   424
					PRIMARY KEY (id)
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   425
					)";
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   426
			break;
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   427
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   428
	}
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   429
2
a8a21e1c7afa Let's just say that the API loads. While a decent part of PunBB works, we've still got a LONG way to go, mainly with form validation and security. At this point, Punano is NOT secure as far as privileges and user levels go.
Dan
parents: 0
diff changeset
   430
	$pun_db->query($sql) or error('Unable to create table '.$db_prefix.'bans. Please check your settings and try again.',  __FILE__, __LINE__, $pun_db->error());
0
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   431
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   432
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   433
	switch ($db_type)
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   434
	{
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   435
		case 'mysql':
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   436
		case 'mysqli':
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   437
			$sql = 'CREATE TABLE '.$db_prefix."categories (
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   438
					id INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   439
					cat_name VARCHAR(80) NOT NULL DEFAULT 'New Category',
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   440
					disp_position INT(10) NOT NULL DEFAULT 0,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   441
					PRIMARY KEY (id)
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   442
					) TYPE=MyISAM;";
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   443
			break;
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   444
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   445
		case 'pgsql':
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   446
			$sql = 'CREATE TABLE '.$db_prefix."categories (
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   447
					id SERIAL,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   448
					cat_name VARCHAR(80) NOT NULL DEFAULT 'New Category',
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   449
					disp_position INT NOT NULL DEFAULT 0,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   450
					PRIMARY KEY (id)
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   451
					)";
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   452
			break;
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   453
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   454
		case 'sqlite':
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   455
			$sql = 'CREATE TABLE '.$db_prefix."categories (
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   456
					id INTEGER NOT NULL,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   457
					cat_name VARCHAR(80) NOT NULL DEFAULT 'New Category',
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   458
					disp_position INTEGER NOT NULL DEFAULT 0,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   459
					PRIMARY KEY (id)
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   460
					)";
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   461
			break;
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   462
	}
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   463
2
a8a21e1c7afa Let's just say that the API loads. While a decent part of PunBB works, we've still got a LONG way to go, mainly with form validation and security. At this point, Punano is NOT secure as far as privileges and user levels go.
Dan
parents: 0
diff changeset
   464
	$pun_db->query($sql) or error('Unable to create table '.$db_prefix.'categories. Please check your settings and try again.',  __FILE__, __LINE__, $pun_db->error());
0
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   465
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   466
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   467
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   468
	switch ($db_type)
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   469
	{
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   470
		case 'mysql':
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   471
		case 'mysqli':
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   472
			$sql = 'CREATE TABLE '.$db_prefix."censoring (
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   473
					id INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   474
					search_for VARCHAR(60) NOT NULL DEFAULT '',
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   475
					replace_with VARCHAR(60) NOT NULL DEFAULT '',
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   476
					PRIMARY KEY (id)
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   477
					) TYPE=MyISAM;";
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   478
			break;
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   479
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   480
		case 'pgsql':
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   481
			$sql = 'CREATE TABLE '.$db_prefix."censoring (
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   482
					id SERIAL,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   483
					search_for VARCHAR(60) NOT NULL DEFAULT '',
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   484
					replace_with VARCHAR(60) NOT NULL DEFAULT '',
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   485
					PRIMARY KEY (id)
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   486
					)";
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   487
			break;
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   488
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   489
		case 'sqlite':
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   490
			$sql = 'CREATE TABLE '.$db_prefix."censoring (
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   491
					id INTEGER NOT NULL,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   492
					search_for VARCHAR(60) NOT NULL DEFAULT '',
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   493
					replace_with VARCHAR(60) NOT NULL DEFAULT '',
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   494
					PRIMARY KEY (id)
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   495
					)";
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   496
			break;
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   497
	}
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   498
2
a8a21e1c7afa Let's just say that the API loads. While a decent part of PunBB works, we've still got a LONG way to go, mainly with form validation and security. At this point, Punano is NOT secure as far as privileges and user levels go.
Dan
parents: 0
diff changeset
   499
	$pun_db->query($sql) or error('Unable to create table '.$db_prefix.'censoring. Please check your settings and try again.',  __FILE__, __LINE__, $pun_db->error());
0
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   500
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   501
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   502
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   503
	switch ($db_type)
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   504
	{
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   505
		case 'mysql':
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   506
		case 'mysqli':
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   507
			$sql = 'CREATE TABLE '.$db_prefix."config (
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   508
					conf_name VARCHAR(255) NOT NULL DEFAULT '',
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   509
					conf_value TEXT,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   510
					PRIMARY KEY (conf_name)
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   511
					) TYPE=MyISAM;";
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   512
			break;
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   513
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   514
		case 'pgsql':
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   515
			$sql = 'CREATE TABLE '.$db_prefix."config (
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   516
					conf_name VARCHAR(255) NOT NULL DEFAULT '',
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   517
					conf_value TEXT,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   518
					PRIMARY KEY (conf_name)
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   519
					)";
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   520
			break;
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   521
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   522
		case 'sqlite':
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   523
			$sql = 'CREATE TABLE '.$db_prefix."config (
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   524
					conf_name VARCHAR(255) NOT NULL DEFAULT '',
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   525
					conf_value TEXT,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   526
					PRIMARY KEY (conf_name)
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   527
					)";
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   528
			break;
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   529
	}
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   530
2
a8a21e1c7afa Let's just say that the API loads. While a decent part of PunBB works, we've still got a LONG way to go, mainly with form validation and security. At this point, Punano is NOT secure as far as privileges and user levels go.
Dan
parents: 0
diff changeset
   531
	$pun_db->query($sql) or error('Unable to create table '.$db_prefix.'config. Please check your settings and try again.',  __FILE__, __LINE__, $pun_db->error());
0
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   532
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   533
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   534
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   535
	switch ($db_type)
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   536
	{
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   537
		case 'mysql':
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   538
		case 'mysqli':
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   539
			$sql = 'CREATE TABLE '.$db_prefix."forum_perms (
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   540
					group_id INT(10) NOT NULL DEFAULT 0,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   541
					forum_id INT(10) NOT NULL DEFAULT 0,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   542
					read_forum TINYINT(1) NOT NULL DEFAULT 1,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   543
					post_replies TINYINT(1) NOT NULL DEFAULT 1,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   544
					post_topics TINYINT(1) NOT NULL DEFAULT 1,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   545
					PRIMARY KEY (group_id, forum_id)
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   546
					) TYPE=MyISAM;";
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   547
			break;
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   548
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   549
		case 'pgsql':
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   550
			$sql = 'CREATE TABLE '.$db_prefix."forum_perms (
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   551
					group_id INT NOT NULL DEFAULT 0,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   552
					forum_id INT NOT NULL DEFAULT 0,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   553
					read_forum SMALLINT NOT NULL DEFAULT 1,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   554
					post_replies SMALLINT NOT NULL DEFAULT 1,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   555
					post_topics SMALLINT NOT NULL DEFAULT 1,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   556
					PRIMARY KEY (group_id, forum_id)
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   557
					)";
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   558
			break;
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   559
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   560
		case 'sqlite':
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   561
			$sql = 'CREATE TABLE '.$db_prefix."forum_perms (
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   562
					group_id INTEGER NOT NULL DEFAULT 0,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   563
					forum_id INTEGER NOT NULL DEFAULT 0,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   564
					read_forum INTEGER NOT NULL DEFAULT 1,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   565
					post_replies INTEGER NOT NULL DEFAULT 1,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   566
					post_topics INTEGER NOT NULL DEFAULT 1,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   567
					PRIMARY KEY (group_id, forum_id)
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   568
					)";
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   569
			break;
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   570
	}
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   571
2
a8a21e1c7afa Let's just say that the API loads. While a decent part of PunBB works, we've still got a LONG way to go, mainly with form validation and security. At this point, Punano is NOT secure as far as privileges and user levels go.
Dan
parents: 0
diff changeset
   572
	$pun_db->query($sql) or error('Unable to create table '.$db_prefix.'forum_perms. Please check your settings and try again.',  __FILE__, __LINE__, $pun_db->error());
0
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   573
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   574
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   575
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   576
	switch ($db_type)
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   577
	{
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   578
		case 'mysql':
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   579
		case 'mysqli':
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   580
			$sql = 'CREATE TABLE '.$db_prefix."forums (
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   581
					id INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   582
					forum_name VARCHAR(80) NOT NULL DEFAULT 'New forum',
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   583
					forum_desc TEXT,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   584
					redirect_url VARCHAR(100),
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   585
					moderators TEXT,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   586
					num_topics MEDIUMINT(8) UNSIGNED NOT NULL DEFAULT 0,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   587
					num_posts MEDIUMINT(8) UNSIGNED NOT NULL DEFAULT 0,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   588
					last_post INT(10) UNSIGNED,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   589
					last_post_id INT(10) UNSIGNED,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   590
					last_poster VARCHAR(200),
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   591
					sort_by TINYINT(1) NOT NULL DEFAULT 0,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   592
					disp_position INT(10) NOT NULL DEFAULT 0,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   593
					cat_id INT(10) UNSIGNED NOT NULL DEFAULT 0,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   594
					PRIMARY KEY (id)
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   595
					) TYPE=MyISAM;";
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   596
			break;
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   597
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   598
		case 'pgsql':
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   599
			$sql = 'CREATE TABLE '.$db_prefix."forums (
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   600
					id SERIAL,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   601
					forum_name VARCHAR(80) NOT NULL DEFAULT 'New forum',
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   602
					forum_desc TEXT,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   603
					redirect_url VARCHAR(100),
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   604
					moderators TEXT,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   605
					num_topics INT NOT NULL DEFAULT 0,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   606
					num_posts INT NOT NULL DEFAULT 0,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   607
					last_post INT,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   608
					last_post_id INT,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   609
					last_poster VARCHAR(200),
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   610
					sort_by SMALLINT NOT NULL DEFAULT 0,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   611
					disp_position INT NOT NULL DEFAULT 0,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   612
					cat_id INT NOT NULL DEFAULT 0,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   613
					PRIMARY KEY (id)
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   614
					)";
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   615
			break;
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   616
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   617
		case 'sqlite':
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   618
			$sql = 'CREATE TABLE '.$db_prefix."forums (
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   619
					id INTEGER NOT NULL,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   620
					forum_name VARCHAR(80) NOT NULL DEFAULT 'New forum',
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   621
					forum_desc TEXT,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   622
					redirect_url VARCHAR(100),
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   623
					moderators TEXT,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   624
					num_topics INTEGER NOT NULL DEFAULT 0,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   625
					num_posts INTEGER NOT NULL DEFAULT 0,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   626
					last_post INTEGER,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   627
					last_post_id INTEGER,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   628
					last_poster VARCHAR(200),
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   629
					sort_by INTEGER NOT NULL DEFAULT 0,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   630
					disp_position INTEGER NOT NULL DEFAULT 0,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   631
					cat_id INTEGER NOT NULL DEFAULT 0,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   632
					PRIMARY KEY (id)
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   633
					)";
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   634
			break;
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   635
	}
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   636
2
a8a21e1c7afa Let's just say that the API loads. While a decent part of PunBB works, we've still got a LONG way to go, mainly with form validation and security. At this point, Punano is NOT secure as far as privileges and user levels go.
Dan
parents: 0
diff changeset
   637
	$pun_db->query($sql) or error('Unable to create table '.$db_prefix.'forums. Please check your settings and try again.',  __FILE__, __LINE__, $pun_db->error());
0
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   638
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   639
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   640
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   641
	switch ($db_type)
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   642
	{
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   643
		case 'mysql':
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   644
		case 'mysqli':
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   645
			$sql = 'CREATE TABLE '.$db_prefix."groups (
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   646
					g_id INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   647
					g_title VARCHAR(50) NOT NULL DEFAULT '',
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   648
					g_user_title VARCHAR(50),
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   649
					g_read_board TINYINT(1) NOT NULL DEFAULT 1,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   650
					g_post_replies TINYINT(1) NOT NULL DEFAULT 1,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   651
					g_post_topics TINYINT(1) NOT NULL DEFAULT 1,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   652
					g_post_polls TINYINT(1) NOT NULL DEFAULT 1,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   653
					g_edit_posts TINYINT(1) NOT NULL DEFAULT 1,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   654
					g_delete_posts TINYINT(1) NOT NULL DEFAULT 1,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   655
					g_delete_topics TINYINT(1) NOT NULL DEFAULT 1,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   656
					g_set_title TINYINT(1) NOT NULL DEFAULT 1,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   657
					g_search TINYINT(1) NOT NULL DEFAULT 1,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   658
					g_search_users TINYINT(1) NOT NULL DEFAULT 1,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   659
					g_edit_subjects_interval SMALLINT(6) NOT NULL DEFAULT 300,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   660
					g_post_flood SMALLINT(6) NOT NULL DEFAULT 30,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   661
					g_search_flood SMALLINT(6) NOT NULL DEFAULT 30,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   662
					PRIMARY KEY (g_id)
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   663
					) TYPE=MyISAM;";
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   664
			break;
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   665
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   666
		case 'pgsql':
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   667
			$sql = 'CREATE TABLE '.$db_prefix."groups (
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   668
					g_id SERIAL,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   669
					g_title VARCHAR(50) NOT NULL DEFAULT '',
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   670
					g_user_title VARCHAR(50),
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   671
					g_read_board SMALLINT NOT NULL DEFAULT 1,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   672
					g_post_replies SMALLINT NOT NULL DEFAULT 1,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   673
					g_post_topics SMALLINT NOT NULL DEFAULT 1,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   674
					g_post_polls SMALLINT NOT NULL DEFAULT 1,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   675
					g_edit_posts SMALLINT NOT NULL DEFAULT 1,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   676
					g_delete_posts SMALLINT NOT NULL DEFAULT 1,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   677
					g_delete_topics SMALLINT NOT NULL DEFAULT 1,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   678
					g_set_title SMALLINT NOT NULL DEFAULT 1,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   679
					g_search SMALLINT NOT NULL DEFAULT 1,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   680
					g_search_users SMALLINT NOT NULL DEFAULT 1,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   681
					g_edit_subjects_interval SMALLINT NOT NULL DEFAULT 300,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   682
					g_post_flood SMALLINT NOT NULL DEFAULT 30,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   683
					g_search_flood SMALLINT NOT NULL DEFAULT 30,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   684
					PRIMARY KEY (g_id)
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   685
					)";
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   686
			break;
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   687
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   688
		case 'sqlite':
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   689
			$sql = 'CREATE TABLE '.$db_prefix."groups (
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   690
					g_id INTEGER NOT NULL,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   691
					g_title VARCHAR(50) NOT NULL DEFAULT '',
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   692
					g_user_title VARCHAR(50),
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   693
					g_read_board INTEGER NOT NULL DEFAULT 1,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   694
					g_post_replies INTEGER NOT NULL DEFAULT 1,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   695
					g_post_topics INTEGER NOT NULL DEFAULT 1,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   696
					g_post_polls INTEGER NOT NULL DEFAULT 1,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   697
					g_edit_posts INTEGER NOT NULL DEFAULT 1,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   698
					g_delete_posts INTEGER NOT NULL DEFAULT 1,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   699
					g_delete_topics INTEGER NOT NULL DEFAULT 1,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   700
					g_set_title INTEGER NOT NULL DEFAULT 1,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   701
					g_search INTEGER NOT NULL DEFAULT 1,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   702
					g_search_users INTEGER NOT NULL DEFAULT 1,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   703
					g_edit_subjects_interval INTEGER NOT NULL DEFAULT 300,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   704
					g_post_flood INTEGER NOT NULL DEFAULT 30,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   705
					g_search_flood INTEGER NOT NULL DEFAULT 30,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   706
					PRIMARY KEY (g_id)
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   707
					)";
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   708
			break;
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   709
	}
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   710
2
a8a21e1c7afa Let's just say that the API loads. While a decent part of PunBB works, we've still got a LONG way to go, mainly with form validation and security. At this point, Punano is NOT secure as far as privileges and user levels go.
Dan
parents: 0
diff changeset
   711
	$pun_db->query($sql) or error('Unable to create table '.$db_prefix.'groups. Please check your settings and try again.',  __FILE__, __LINE__, $pun_db->error());
0
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   712
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   713
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   714
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   715
	switch ($db_type)
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   716
	{
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   717
		case 'mysql':
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   718
		case 'mysqli':
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   719
			$sql = 'CREATE TABLE '.$db_prefix."online (
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   720
					user_id INT(10) UNSIGNED NOT NULL DEFAULT 1,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   721
					ident VARCHAR(200) NOT NULL DEFAULT '',
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   722
					logged INT(10) UNSIGNED NOT NULL DEFAULT 0,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   723
					idle TINYINT(1) NOT NULL DEFAULT 0
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   724
					) TYPE=HEAP;";
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   725
			break;
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   726
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   727
		case 'pgsql':
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   728
			$sql = 'CREATE TABLE '.$db_prefix."online (
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   729
					user_id INT NOT NULL DEFAULT 1,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   730
					ident VARCHAR(200) NOT NULL DEFAULT '',
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   731
					logged INT NOT NULL DEFAULT 0,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   732
					idle SMALLINT NOT NULL DEFAULT 0
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   733
					)";
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   734
			break;
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   735
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   736
		case 'sqlite':
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   737
			$sql = 'CREATE TABLE '.$db_prefix."online (
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   738
					user_id INTEGER NOT NULL DEFAULT 1,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   739
					ident VARCHAR(200) NOT NULL DEFAULT '',
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   740
					logged INTEGER NOT NULL DEFAULT 0,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   741
					idle INTEGER NOT NULL DEFAULT 0
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   742
					)";
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   743
			break;
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   744
	}
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   745
2
a8a21e1c7afa Let's just say that the API loads. While a decent part of PunBB works, we've still got a LONG way to go, mainly with form validation and security. At this point, Punano is NOT secure as far as privileges and user levels go.
Dan
parents: 0
diff changeset
   746
	$pun_db->query($sql) or error('Unable to create table '.$db_prefix.'online. Please check your settings and try again.',  __FILE__, __LINE__, $pun_db->error());
0
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   747
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   748
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   749
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   750
	switch ($db_type)
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   751
	{
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   752
		case 'mysql':
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   753
		case 'mysqli':
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   754
			$sql = 'CREATE TABLE '.$db_prefix."posts (
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   755
					id INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   756
					poster VARCHAR(200) NOT NULL DEFAULT '',
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   757
					poster_id INT(10) UNSIGNED NOT NULL DEFAULT 1,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   758
					poster_ip VARCHAR(15),
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   759
					poster_email VARCHAR(50),
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   760
					message TEXT,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   761
					hide_smilies TINYINT(1) NOT NULL DEFAULT 0,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   762
					posted INT(10) UNSIGNED NOT NULL DEFAULT 0,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   763
					edited INT(10) UNSIGNED,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   764
					edited_by VARCHAR(200),
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   765
					topic_id INT(10) UNSIGNED NOT NULL DEFAULT 0,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   766
					PRIMARY KEY (id)
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   767
					) TYPE=MyISAM;";
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   768
			break;
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   769
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   770
		case 'pgsql':
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   771
			$sql = 'CREATE TABLE '.$db_prefix."posts (
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   772
					id SERIAL,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   773
					poster VARCHAR(200) NOT NULL DEFAULT '',
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   774
					poster_id INT NOT NULL DEFAULT 1,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   775
					poster_ip VARCHAR(15),
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   776
					poster_email VARCHAR(50),
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   777
					message TEXT,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   778
					hide_smilies SMALLINT NOT NULL DEFAULT 0,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   779
					posted INT NOT NULL DEFAULT 0,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   780
					edited INT,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   781
					edited_by VARCHAR(200),
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   782
					topic_id INT NOT NULL DEFAULT 0,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   783
					PRIMARY KEY (id)
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   784
					)";
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   785
			break;
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   786
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   787
		case 'sqlite':
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   788
			$sql = 'CREATE TABLE '.$db_prefix."posts (
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   789
					id INTEGER NOT NULL,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   790
					poster VARCHAR(200) NOT NULL DEFAULT '',
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   791
					poster_id INTEGER NOT NULL DEFAULT 1,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   792
					poster_ip VARCHAR(15),
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   793
					poster_email VARCHAR(50),
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   794
					message TEXT,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   795
					hide_smilies INTEGER NOT NULL DEFAULT 0,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   796
					posted INTEGER NOT NULL DEFAULT 0,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   797
					edited INTEGER,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   798
					edited_by VARCHAR(200),
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   799
					topic_id INTEGER NOT NULL DEFAULT 0,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   800
					PRIMARY KEY (id)
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   801
					)";
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   802
			break;
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   803
	}
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   804
2
a8a21e1c7afa Let's just say that the API loads. While a decent part of PunBB works, we've still got a LONG way to go, mainly with form validation and security. At this point, Punano is NOT secure as far as privileges and user levels go.
Dan
parents: 0
diff changeset
   805
	$pun_db->query($sql) or error('Unable to create table '.$db_prefix.'posts. Please check your settings and try again.',  __FILE__, __LINE__, $pun_db->error());
0
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   806
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   807
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   808
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   809
	switch ($db_type)
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   810
	{
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   811
		case 'mysql':
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   812
		case 'mysqli':
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   813
			$sql = 'CREATE TABLE '.$db_prefix."ranks (
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   814
					id INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   815
					rank VARCHAR(50) NOT NULL DEFAULT '',
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   816
					min_posts MEDIUMINT(8) UNSIGNED NOT NULL DEFAULT 0,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   817
					PRIMARY KEY (id)
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   818
					) TYPE=MyISAM;";
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   819
			break;
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   820
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   821
		case 'pgsql':
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   822
			$sql = 'CREATE TABLE '.$db_prefix."ranks (
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   823
					id SERIAL,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   824
					rank VARCHAR(50) NOT NULL DEFAULT '',
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   825
					min_posts INT NOT NULL DEFAULT 0,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   826
					PRIMARY KEY (id)
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   827
					)";
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   828
			break;
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   829
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   830
		case 'sqlite':
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   831
			$sql = 'CREATE TABLE '.$db_prefix."ranks (
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   832
					id INTEGER NOT NULL,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   833
					rank VARCHAR(50) NOT NULL DEFAULT '',
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   834
					min_posts INTEGER NOT NULL DEFAULT 0,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   835
					PRIMARY KEY (id)
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   836
					)";
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   837
			break;
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   838
	}
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   839
2
a8a21e1c7afa Let's just say that the API loads. While a decent part of PunBB works, we've still got a LONG way to go, mainly with form validation and security. At this point, Punano is NOT secure as far as privileges and user levels go.
Dan
parents: 0
diff changeset
   840
	$pun_db->query($sql) or error('Unable to create table '.$db_prefix.'titles. Please check your settings and try again.',  __FILE__, __LINE__, $pun_db->error());
0
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   841
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   842
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   843
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   844
	switch ($db_type)
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   845
	{
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   846
		case 'mysql':
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   847
		case 'mysqli':
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   848
			$sql = 'CREATE TABLE '.$db_prefix."reports (
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   849
					id INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   850
					post_id INT(10) UNSIGNED NOT NULL DEFAULT 0,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   851
					topic_id INT(10) UNSIGNED NOT NULL DEFAULT 0,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   852
					forum_id INT(10) UNSIGNED NOT NULL DEFAULT 0,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   853
					reported_by INT(10) UNSIGNED NOT NULL DEFAULT 0,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   854
					created INT(10) UNSIGNED NOT NULL DEFAULT 0,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   855
					message TEXT,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   856
					zapped INT(10) UNSIGNED,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   857
					zapped_by INT(10) UNSIGNED,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   858
					PRIMARY KEY (id)
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   859
					) TYPE=MyISAM;";
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   860
			break;
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   861
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   862
		case 'pgsql':
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   863
			$sql = 'CREATE TABLE '.$db_prefix."reports (
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   864
					id SERIAL,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   865
					post_id INT NOT NULL DEFAULT 0,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   866
					topic_id INT NOT NULL DEFAULT 0,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   867
					forum_id INT NOT NULL DEFAULT 0,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   868
					reported_by INT NOT NULL DEFAULT 0,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   869
					created INT NOT NULL DEFAULT 0,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   870
					message TEXT,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   871
					zapped INT,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   872
					zapped_by INT,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   873
					PRIMARY KEY (id)
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   874
					)";
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   875
			break;
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   876
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   877
		case 'sqlite':
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   878
			$sql = 'CREATE TABLE '.$db_prefix."reports (
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   879
					id INTEGER NOT NULL,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   880
					post_id INTEGER NOT NULL DEFAULT 0,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   881
					topic_id INTEGER NOT NULL DEFAULT 0,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   882
					forum_id INTEGER NOT NULL DEFAULT 0,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   883
					reported_by INTEGER NOT NULL DEFAULT 0,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   884
					created INTEGER NOT NULL DEFAULT 0,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   885
					message TEXT,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   886
					zapped INTEGER,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   887
					zapped_by INTEGER,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   888
					PRIMARY KEY (id)
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   889
					)";
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   890
			break;
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   891
	}
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   892
2
a8a21e1c7afa Let's just say that the API loads. While a decent part of PunBB works, we've still got a LONG way to go, mainly with form validation and security. At this point, Punano is NOT secure as far as privileges and user levels go.
Dan
parents: 0
diff changeset
   893
	$pun_db->query($sql) or error('Unable to create table '.$db_prefix.'reports. Please check your settings and try again.',  __FILE__, __LINE__, $pun_db->error());
0
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   894
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   895
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   896
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   897
	switch ($db_type)
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   898
	{
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   899
		case 'mysql':
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   900
		case 'mysqli':
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   901
			$sql = 'CREATE TABLE '.$db_prefix."search_cache (
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   902
					id INT(10) UNSIGNED NOT NULL DEFAULT 0,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   903
					ident VARCHAR(200) NOT NULL DEFAULT '',
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   904
					search_data TEXT,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   905
					PRIMARY KEY (id)
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   906
					) TYPE=MyISAM;";
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   907
			break;
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   908
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   909
		case 'pgsql':
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   910
			$sql = 'CREATE TABLE '.$db_prefix."search_cache (
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   911
					id INT NOT NULL DEFAULT 0,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   912
					ident VARCHAR(200) NOT NULL DEFAULT '',
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   913
					search_data TEXT,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   914
					PRIMARY KEY (id)
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   915
					)";
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   916
			break;
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   917
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   918
		case 'sqlite':
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   919
			$sql = 'CREATE TABLE '.$db_prefix."search_cache (
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   920
					id INTEGER NOT NULL DEFAULT 0,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   921
					ident VARCHAR(200) NOT NULL DEFAULT '',
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   922
					search_data TEXT,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   923
					PRIMARY KEY (id)
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   924
					)";
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   925
			break;
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   926
	}
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   927
2
a8a21e1c7afa Let's just say that the API loads. While a decent part of PunBB works, we've still got a LONG way to go, mainly with form validation and security. At this point, Punano is NOT secure as far as privileges and user levels go.
Dan
parents: 0
diff changeset
   928
	$pun_db->query($sql) or error('Unable to create table '.$db_prefix.'search_cache. Please check your settings and try again.',  __FILE__, __LINE__, $pun_db->error());
0
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   929
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   930
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   931
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   932
	switch ($db_type)
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   933
	{
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   934
		case 'mysql':
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   935
		case 'mysqli':
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   936
			$sql = 'CREATE TABLE '.$db_prefix."search_matches (
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   937
					post_id INT(10) UNSIGNED NOT NULL DEFAULT 0,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   938
					word_id MEDIUMINT(8) UNSIGNED NOT NULL DEFAULT 0,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   939
					subject_match TINYINT(1) NOT NULL DEFAULT 0
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   940
					) TYPE=MyISAM;";
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   941
			break;
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   942
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   943
		case 'pgsql':
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   944
			$sql = 'CREATE TABLE '.$db_prefix."search_matches (
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   945
					post_id INT NOT NULL DEFAULT 0,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   946
					word_id INT NOT NULL DEFAULT 0,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   947
					subject_match SMALLINT NOT NULL DEFAULT 0
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   948
					)";
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   949
			break;
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   950
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   951
		case 'sqlite':
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   952
			$sql = 'CREATE TABLE '.$db_prefix."search_matches (
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   953
					post_id INTEGER NOT NULL DEFAULT 0,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   954
					word_id INTEGER NOT NULL DEFAULT 0,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   955
					subject_match INTEGER NOT NULL DEFAULT 0
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   956
					)";
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   957
			break;
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   958
	}
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   959
2
a8a21e1c7afa Let's just say that the API loads. While a decent part of PunBB works, we've still got a LONG way to go, mainly with form validation and security. At this point, Punano is NOT secure as far as privileges and user levels go.
Dan
parents: 0
diff changeset
   960
	$pun_db->query($sql) or error('Unable to create table '.$db_prefix.'search_matches. Please check your settings and try again.',  __FILE__, __LINE__, $pun_db->error());
0
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   961
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   962
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   963
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   964
	switch ($db_type)
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   965
	{
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   966
		case 'mysql':
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   967
		case 'mysqli':
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   968
			$sql = 'CREATE TABLE '.$db_prefix."search_words (
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   969
					id MEDIUMINT(8) UNSIGNED NOT NULL AUTO_INCREMENT,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   970
					word VARCHAR(20) BINARY NOT NULL DEFAULT '',
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   971
					PRIMARY KEY (word),
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   972
					KEY ".$db_prefix."search_words_id_idx (id)
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   973
					) TYPE=MyISAM;";
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   974
			break;
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   975
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   976
		case 'pgsql':
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   977
			$sql = 'CREATE TABLE '.$db_prefix."search_words (
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   978
					id SERIAL,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   979
					word VARCHAR(20) NOT NULL DEFAULT '',
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   980
					PRIMARY KEY (word)
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   981
					)";
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   982
			break;
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   983
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   984
		case 'sqlite':
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   985
			$sql = 'CREATE TABLE '.$db_prefix."search_words (
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   986
					id INTEGER NOT NULL,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   987
					word VARCHAR(20) NOT NULL DEFAULT '',
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   988
					PRIMARY KEY (id),
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   989
					UNIQUE (word)
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   990
					)";
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   991
			break;
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   992
	}
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   993
2
a8a21e1c7afa Let's just say that the API loads. While a decent part of PunBB works, we've still got a LONG way to go, mainly with form validation and security. At this point, Punano is NOT secure as far as privileges and user levels go.
Dan
parents: 0
diff changeset
   994
	$pun_db->query($sql) or error('Unable to create table '.$db_prefix.'search_words. Please check your settings and try again.',  __FILE__, __LINE__, $pun_db->error());
0
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   995
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   996
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   997
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   998
	switch ($db_type)
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   999
	{
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1000
		case 'mysql':
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1001
		case 'mysqli':
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1002
			$sql = 'CREATE TABLE '.$db_prefix."subscriptions (
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1003
					user_id INT(10) UNSIGNED NOT NULL DEFAULT 0,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1004
					topic_id INT(10) UNSIGNED NOT NULL DEFAULT 0,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1005
					PRIMARY KEY (user_id, topic_id)
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1006
					) TYPE=MyISAM;";
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1007
			break;
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1008
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1009
		case 'pgsql':
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1010
			$sql = 'CREATE TABLE '.$db_prefix."subscriptions (
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1011
					user_id INT NOT NULL DEFAULT 0,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1012
					topic_id INT NOT NULL DEFAULT 0,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1013
					PRIMARY KEY (user_id, topic_id)
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1014
					)";
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1015
			break;
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1016
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1017
		case 'sqlite':
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1018
			$sql = 'CREATE TABLE '.$db_prefix."subscriptions (
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1019
					user_id INTEGER NOT NULL DEFAULT 0,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1020
					topic_id INTEGER NOT NULL DEFAULT 0,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1021
					PRIMARY KEY (user_id, topic_id)
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1022
					)";
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1023
			break;
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1024
	}
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1025
2
a8a21e1c7afa Let's just say that the API loads. While a decent part of PunBB works, we've still got a LONG way to go, mainly with form validation and security. At this point, Punano is NOT secure as far as privileges and user levels go.
Dan
parents: 0
diff changeset
  1026
	$pun_db->query($sql) or error('Unable to create table '.$db_prefix.'subscriptions. Please check your settings and try again.',  __FILE__, __LINE__, $pun_db->error());
0
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1027
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1028
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1029
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1030
	switch ($db_type)
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1031
	{
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1032
		case 'mysql':
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1033
		case 'mysqli':
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1034
			$sql = 'CREATE TABLE '.$db_prefix."topics (
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1035
					id INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1036
					poster VARCHAR(200) NOT NULL DEFAULT '',
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1037
					subject VARCHAR(255) NOT NULL DEFAULT '',
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1038
					posted INT(10) UNSIGNED NOT NULL DEFAULT 0,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1039
					last_post INT(10) UNSIGNED NOT NULL DEFAULT 0,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1040
					last_post_id INT(10) UNSIGNED NOT NULL DEFAULT 0,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1041
					last_poster VARCHAR(200),
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1042
					num_views MEDIUMINT(8) UNSIGNED NOT NULL DEFAULT 0,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1043
					num_replies MEDIUMINT(8) UNSIGNED NOT NULL DEFAULT 0,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1044
					closed TINYINT(1) NOT NULL DEFAULT 0,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1045
					sticky TINYINT(1) NOT NULL DEFAULT 0,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1046
					moved_to INT(10) UNSIGNED,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1047
					forum_id INT(10) UNSIGNED NOT NULL DEFAULT 0,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1048
					PRIMARY KEY (id)
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1049
					) TYPE=MyISAM;";
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1050
			break;
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1051
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1052
		case 'pgsql':
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1053
			$sql = 'CREATE TABLE '.$db_prefix."topics (
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1054
					id SERIAL,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1055
					poster VARCHAR(200) NOT NULL DEFAULT '',
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1056
					subject VARCHAR(255) NOT NULL DEFAULT '',
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1057
					posted INT NOT NULL DEFAULT 0,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1058
					last_post INT NOT NULL DEFAULT 0,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1059
					last_post_id INT NOT NULL DEFAULT 0,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1060
					last_poster VARCHAR(200),
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1061
					num_views INT NOT NULL DEFAULT 0,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1062
					num_replies INT NOT NULL DEFAULT 0,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1063
					closed SMALLINT NOT NULL DEFAULT 0,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1064
					sticky SMALLINT NOT NULL DEFAULT 0,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1065
					moved_to INT,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1066
					forum_id INT NOT NULL DEFAULT 0,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1067
					PRIMARY KEY (id)
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1068
					)";
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1069
			break;
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1070
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1071
		case 'sqlite':
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1072
			$sql = 'CREATE TABLE '.$db_prefix."topics (
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1073
					id INTEGER NOT NULL,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1074
					poster VARCHAR(200) NOT NULL DEFAULT '',
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1075
					subject VARCHAR(255) NOT NULL DEFAULT '',
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1076
					posted INTEGER NOT NULL DEFAULT 0,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1077
					last_post INTEGER NOT NULL DEFAULT 0,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1078
					last_post_id INTEGER NOT NULL DEFAULT 0,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1079
					last_poster VARCHAR(200),
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1080
					num_views INTEGER NOT NULL DEFAULT 0,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1081
					num_replies INTEGER NOT NULL DEFAULT 0,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1082
					closed INTEGER NOT NULL DEFAULT 0,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1083
					sticky INTEGER NOT NULL DEFAULT 0,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1084
					moved_to INTEGER,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1085
					forum_id INTEGER NOT NULL DEFAULT 0,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1086
					PRIMARY KEY (id)
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1087
					)";
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1088
			break;
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1089
	}
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1090
2
a8a21e1c7afa Let's just say that the API loads. While a decent part of PunBB works, we've still got a LONG way to go, mainly with form validation and security. At this point, Punano is NOT secure as far as privileges and user levels go.
Dan
parents: 0
diff changeset
  1091
	$pun_db->query($sql) or error('Unable to create table '.$db_prefix.'topics. Please check your settings and try again.',  __FILE__, __LINE__, $pun_db->error());
0
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1092
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1093
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1094
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1095
	switch ($db_type)
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1096
	{
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1097
		case 'mysql':
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1098
		case 'mysqli':
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1099
			$sql = 'CREATE TABLE '.$db_prefix."users (
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1100
					id INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1101
					group_id INT(10) UNSIGNED NOT NULL DEFAULT 4,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1102
					username VARCHAR(200) NOT NULL DEFAULT '',
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1103
					password VARCHAR(40) NOT NULL DEFAULT '',
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1104
					email VARCHAR(50) NOT NULL DEFAULT '',
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1105
					title VARCHAR(50),
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1106
					realname VARCHAR(40),
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1107
					url VARCHAR(100),
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1108
					jabber VARCHAR(75),
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1109
					icq VARCHAR(12),
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1110
					msn VARCHAR(50),
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1111
					aim VARCHAR(30),
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1112
					yahoo VARCHAR(30),
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1113
					location VARCHAR(30),
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1114
					use_avatar TINYINT(1) NOT NULL DEFAULT 0,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1115
					signature TEXT,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1116
					disp_topics TINYINT(3) UNSIGNED,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1117
					disp_posts TINYINT(3) UNSIGNED,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1118
					email_setting TINYINT(1) NOT NULL DEFAULT 1,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1119
					save_pass TINYINT(1) NOT NULL DEFAULT 1,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1120
					notify_with_post TINYINT(1) NOT NULL DEFAULT 0,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1121
					show_smilies TINYINT(1) NOT NULL DEFAULT 1,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1122
					show_img TINYINT(1) NOT NULL DEFAULT 1,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1123
					show_img_sig TINYINT(1) NOT NULL DEFAULT 1,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1124
					show_avatars TINYINT(1) NOT NULL DEFAULT 1,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1125
					show_sig TINYINT(1) NOT NULL DEFAULT 1,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1126
					timezone FLOAT NOT NULL DEFAULT 0,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1127
					language VARCHAR(25) NOT NULL DEFAULT 'English',
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1128
					style VARCHAR(25) NOT NULL DEFAULT 'Oxygen',
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1129
					num_posts INT(10) UNSIGNED NOT NULL DEFAULT 0,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1130
					last_post INT(10) UNSIGNED,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1131
					registered INT(10) UNSIGNED NOT NULL DEFAULT 0,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1132
					registration_ip VARCHAR(15) NOT NULL DEFAULT '0.0.0.0',
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1133
					last_visit INT(10) UNSIGNED NOT NULL DEFAULT 0,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1134
					admin_note VARCHAR(30),
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1135
					activate_string VARCHAR(50),
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1136
					activate_key VARCHAR(8),
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1137
					PRIMARY KEY (id)
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1138
					) TYPE=MyISAM;";
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1139
			break;
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1140
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1141
		case 'pgsql':
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1142
			$sql = 'CREATE TABLE '.$db_prefix."users (
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1143
					id SERIAL,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1144
					group_id INT NOT NULL DEFAULT 4,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1145
					username VARCHAR(200) NOT NULL DEFAULT '',
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1146
					password VARCHAR(40) NOT NULL DEFAULT '',
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1147
					email VARCHAR(50) NOT NULL DEFAULT '',
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1148
					title VARCHAR(50),
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1149
					realname VARCHAR(40),
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1150
					url VARCHAR(100),
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1151
					jabber VARCHAR(75),
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1152
					icq VARCHAR(12),
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1153
					msn VARCHAR(50),
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1154
					aim VARCHAR(30),
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1155
					yahoo VARCHAR(30),
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1156
					location VARCHAR(30),
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1157
					use_avatar SMALLINT NOT NULL DEFAULT 0,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1158
					signature TEXT,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1159
					disp_topics SMALLINT,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1160
					disp_posts SMALLINT,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1161
					email_setting SMALLINT NOT NULL DEFAULT 1,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1162
					save_pass SMALLINT NOT NULL DEFAULT 1,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1163
					notify_with_post SMALLINT NOT NULL DEFAULT 0,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1164
					show_smilies SMALLINT NOT NULL DEFAULT 1,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1165
					show_img SMALLINT NOT NULL DEFAULT 1,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1166
					show_img_sig SMALLINT NOT NULL DEFAULT 1,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1167
					show_avatars SMALLINT NOT NULL DEFAULT 1,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1168
					show_sig SMALLINT NOT NULL DEFAULT 1,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1169
					timezone REAL NOT NULL DEFAULT 0,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1170
					language VARCHAR(25) NOT NULL DEFAULT 'English',
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1171
					style VARCHAR(25) NOT NULL DEFAULT 'Oxygen',
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1172
					num_posts INT NOT NULL DEFAULT 0,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1173
					last_post INT,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1174
					registered INT NOT NULL DEFAULT 0,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1175
					registration_ip VARCHAR(15) NOT NULL DEFAULT '0.0.0.0',
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1176
					last_visit INT NOT NULL DEFAULT 0,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1177
					admin_note VARCHAR(30),
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1178
					activate_string VARCHAR(50),
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1179
					activate_key VARCHAR(8),
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1180
					PRIMARY KEY (id)
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1181
					)";
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1182
			break;
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1183
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1184
		case 'sqlite':
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1185
			$sql = 'CREATE TABLE '.$db_prefix."users (
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1186
					id INTEGER NOT NULL,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1187
					group_id INTEGER NOT NULL DEFAULT 4,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1188
					username VARCHAR(200) NOT NULL DEFAULT '',
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1189
					password VARCHAR(40) NOT NULL DEFAULT '',
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1190
					email VARCHAR(50) NOT NULL DEFAULT '',
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1191
					title VARCHAR(50),
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1192
					realname VARCHAR(40),
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1193
					url VARCHAR(100),
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1194
					jabber VARCHAR(75),
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1195
					icq VARCHAR(12),
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1196
					msn VARCHAR(50),
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1197
					aim VARCHAR(30),
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1198
					yahoo VARCHAR(30),
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1199
					location VARCHAR(30),
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1200
					use_avatar INTEGER NOT NULL DEFAULT 0,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1201
					signature TEXT,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1202
					disp_topics INTEGER,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1203
					disp_posts INTEGER,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1204
					email_setting INTEGER NOT NULL DEFAULT 1,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1205
					save_pass INTEGER NOT NULL DEFAULT 1,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1206
					notify_with_post INTEGER NOT NULL DEFAULT 0,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1207
					show_smilies INTEGER NOT NULL DEFAULT 1,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1208
					show_img INTEGER NOT NULL DEFAULT 1,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1209
					show_img_sig INTEGER NOT NULL DEFAULT 1,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1210
					show_avatars INTEGER NOT NULL DEFAULT 1,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1211
					show_sig INTEGER NOT NULL DEFAULT 1,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1212
					timezone FLOAT NOT NULL DEFAULT 0,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1213
					language VARCHAR(25) NOT NULL DEFAULT 'English',
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1214
					style VARCHAR(25) NOT NULL DEFAULT 'Oxygen',
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1215
					num_posts INTEGER NOT NULL DEFAULT 0,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1216
					last_post INTEGER,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1217
					registered INTEGER NOT NULL DEFAULT 0,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1218
					registration_ip VARCHAR(15) NOT NULL DEFAULT '0.0.0.0',
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1219
					last_visit INTEGER NOT NULL DEFAULT 0,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1220
					admin_note VARCHAR(30),
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1221
					activate_string VARCHAR(50),
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1222
					activate_key VARCHAR(8),
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1223
					PRIMARY KEY (id)
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1224
					)";
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1225
			break;
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1226
	}
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1227
2
a8a21e1c7afa Let's just say that the API loads. While a decent part of PunBB works, we've still got a LONG way to go, mainly with form validation and security. At this point, Punano is NOT secure as far as privileges and user levels go.
Dan
parents: 0
diff changeset
  1228
	$pun_db->query($sql) or error('Unable to create table '.$db_prefix.'users. Please check your settings and try again.',  __FILE__, __LINE__, $pun_db->error());
0
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1229
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1230
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1231
	// Add some indexes
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1232
	switch ($db_type)
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1233
	{
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1234
		case 'mysql':
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1235
		case 'mysqli':
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1236
			// We use MySQL's ALTER TABLE ... ADD INDEX syntax instead of CREATE INDEX to avoid problems with users lacking the INDEX privilege
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1237
			$queries[] = 'ALTER TABLE '.$db_prefix.'online ADD UNIQUE INDEX '.$db_prefix.'online_user_id_ident_idx(user_id,ident)';
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1238
			$queries[] = 'ALTER TABLE '.$db_prefix.'online ADD INDEX '.$db_prefix.'online_user_id_idx(user_id)';
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1239
			$queries[] = 'ALTER TABLE '.$db_prefix.'posts ADD INDEX '.$db_prefix.'posts_topic_id_idx(topic_id)';
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1240
			$queries[] = 'ALTER TABLE '.$db_prefix.'posts ADD INDEX '.$db_prefix.'posts_multi_idx(poster_id, topic_id)';
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1241
			$queries[] = 'ALTER TABLE '.$db_prefix.'reports ADD INDEX '.$db_prefix.'reports_zapped_idx(zapped)';
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1242
			$queries[] = 'ALTER TABLE '.$db_prefix.'search_matches ADD INDEX '.$db_prefix.'search_matches_word_id_idx(word_id)';
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1243
			$queries[] = 'ALTER TABLE '.$db_prefix.'search_matches ADD INDEX '.$db_prefix.'search_matches_post_id_idx(post_id)';
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1244
			$queries[] = 'ALTER TABLE '.$db_prefix.'topics ADD INDEX '.$db_prefix.'topics_forum_id_idx(forum_id)';
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1245
			$queries[] = 'ALTER TABLE '.$db_prefix.'topics ADD INDEX '.$db_prefix.'topics_moved_to_idx(moved_to)';
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1246
			$queries[] = 'ALTER TABLE '.$db_prefix.'users ADD INDEX '.$db_prefix.'users_registered_idx(registered)';
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1247
			$queries[] = 'ALTER TABLE '.$db_prefix.'search_cache ADD INDEX '.$db_prefix.'search_cache_ident_idx(ident(8))';
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1248
			$queries[] = 'ALTER TABLE '.$db_prefix.'users ADD INDEX '.$db_prefix.'users_username_idx(username(8))';
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1249
			break;
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1250
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1251
		default:
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1252
			$queries[] = 'CREATE INDEX '.$db_prefix.'online_user_id_idx ON '.$db_prefix.'online(user_id)';
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1253
			$queries[] = 'CREATE INDEX '.$db_prefix.'posts_topic_id_idx ON '.$db_prefix.'posts(topic_id)';
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1254
			$queries[] = 'CREATE INDEX '.$db_prefix.'posts_multi_idx ON '.$db_prefix.'posts(poster_id, topic_id)';
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1255
			$queries[] = 'CREATE INDEX '.$db_prefix.'reports_zapped_idx ON '.$db_prefix.'reports(zapped)';
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1256
			$queries[] = 'CREATE INDEX '.$db_prefix.'search_matches_word_id_idx ON '.$db_prefix.'search_matches(word_id)';
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1257
			$queries[] = 'CREATE INDEX '.$db_prefix.'search_matches_post_id_idx ON '.$db_prefix.'search_matches(post_id)';
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1258
			$queries[] = 'CREATE INDEX '.$db_prefix.'topics_forum_id_idx ON '.$db_prefix.'topics(forum_id)';
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1259
			$queries[] = 'CREATE INDEX '.$db_prefix.'topics_moved_to_idx ON '.$db_prefix.'topics(moved_to)';
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1260
			$queries[] = 'CREATE INDEX '.$db_prefix.'users_registered_idx ON '.$db_prefix.'users(registered)';
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1261
			$queries[] = 'CREATE INDEX '.$db_prefix.'users_username_idx ON '.$db_prefix.'users(username)';
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1262
			$queries[] = 'CREATE INDEX '.$db_prefix.'search_cache_ident_idx ON '.$db_prefix.'search_cache(ident)';
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1263
			$queries[] = 'CREATE INDEX '.$db_prefix.'search_words_id_idx ON '.$db_prefix.'search_words(id)';
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1264
			break;
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1265
	}
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1266
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1267
	@reset($queries);
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1268
	while (list(, $sql) = @each($queries))
2
a8a21e1c7afa Let's just say that the API loads. While a decent part of PunBB works, we've still got a LONG way to go, mainly with form validation and security. At this point, Punano is NOT secure as far as privileges and user levels go.
Dan
parents: 0
diff changeset
  1269
		$pun_db->query($sql) or error('Unable to create indexes. Please check your configuration and try again.',  __FILE__, __LINE__, $pun_db->error());
0
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1270
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1271
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1272
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1273
	$now = time();
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1274
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1275
	// Insert the four preset groups
2
a8a21e1c7afa Let's just say that the API loads. While a decent part of PunBB works, we've still got a LONG way to go, mainly with form validation and security. At this point, Punano is NOT secure as far as privileges and user levels go.
Dan
parents: 0
diff changeset
  1276
	$pun_db->query('INSERT INTO '.$pun_db->prefix."groups (g_title, g_user_title, g_read_board, g_post_replies, g_post_topics, g_post_polls, g_edit_posts, g_delete_posts, g_delete_topics, g_set_title, g_search, g_search_users, g_edit_subjects_interval, g_post_flood, g_search_flood) VALUES('Administrators', 'Administrator', 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0)") or error('Unable to add group', __FILE__, __LINE__, $pun_db->error());
a8a21e1c7afa Let's just say that the API loads. While a decent part of PunBB works, we've still got a LONG way to go, mainly with form validation and security. At this point, Punano is NOT secure as far as privileges and user levels go.
Dan
parents: 0
diff changeset
  1277
	$pun_db->query('INSERT INTO '.$pun_db->prefix."groups (g_title, g_user_title, g_read_board, g_post_replies, g_post_topics, g_post_polls, g_edit_posts, g_delete_posts, g_delete_topics, g_set_title, g_search, g_search_users, g_edit_subjects_interval, g_post_flood, g_search_flood) VALUES('Moderators', 'Moderator', 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0)") or error('Unable to add group', __FILE__, __LINE__, $pun_db->error());
a8a21e1c7afa Let's just say that the API loads. While a decent part of PunBB works, we've still got a LONG way to go, mainly with form validation and security. At this point, Punano is NOT secure as far as privileges and user levels go.
Dan
parents: 0
diff changeset
  1278
	$pun_db->query('INSERT INTO '.$pun_db->prefix."groups (g_title, g_user_title, g_read_board, g_post_replies, g_post_topics, g_post_polls, g_edit_posts, g_delete_posts, g_delete_topics, g_set_title, g_search, g_search_users, g_edit_subjects_interval, g_post_flood, g_search_flood) VALUES('Guest', NULL, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0)") or error('Unable to add group', __FILE__, __LINE__, $pun_db->error());
a8a21e1c7afa Let's just say that the API loads. While a decent part of PunBB works, we've still got a LONG way to go, mainly with form validation and security. At this point, Punano is NOT secure as far as privileges and user levels go.
Dan
parents: 0
diff changeset
  1279
	$pun_db->query('INSERT INTO '.$pun_db->prefix."groups (g_title, g_user_title, g_read_board, g_post_replies, g_post_topics, g_post_polls, g_edit_posts, g_delete_posts, g_delete_topics, g_set_title, g_search, g_search_users, g_edit_subjects_interval, g_post_flood, g_search_flood) VALUES('Members', NULL, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 300, 60, 30)") or error('Unable to add group', __FILE__, __LINE__, $pun_db->error());
0
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1280
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1281
	// Insert guest and first admin user
2
a8a21e1c7afa Let's just say that the API loads. While a decent part of PunBB works, we've still got a LONG way to go, mainly with form validation and security. At this point, Punano is NOT secure as far as privileges and user levels go.
Dan
parents: 0
diff changeset
  1282
	$pun_db->query('INSERT INTO '.$db_prefix."users (group_id, username, password, email) VALUES(3, 'Guest', 'Guest', 'Guest')")
0
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1283
		or error('Unable to add guest user. Please check your configuration and try again.');
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1284
2
a8a21e1c7afa Let's just say that the API loads. While a decent part of PunBB works, we've still got a LONG way to go, mainly with form validation and security. At this point, Punano is NOT secure as far as privileges and user levels go.
Dan
parents: 0
diff changeset
  1285
	$pun_db->query('INSERT INTO '.$db_prefix."users (group_id, username, password, email, num_posts, last_post, registered, registration_ip, last_visit) VALUES(1, '".$pun_db->escape($username)."', '".pun_hash($password1)."', '$email', 1, ".$now.", ".$now.", '127.0.0.1', ".$now.')')
0
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1286
		or error('Unable to add administrator user. Please check your configuration and try again.');
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1287
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1288
	// Insert config data
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1289
	$config = array(
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1290
		'o_cur_version'				=> "'$punbb_version'",
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1291
		'o_board_title'				=> "'My PunBB forum'",
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1292
		'o_board_desc'				=> "'Unfortunately no one can be told what PunBB is - you have to see it for yourself.'",
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1293
		'o_server_timezone'			=> "'0'",
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1294
		'o_time_format'				=> "'H:i:s'",
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1295
		'o_date_format'				=> "'Y-m-d'",
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1296
		'o_timeout_visit'			=> "'600'",
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1297
		'o_timeout_online'			=> "'300'",
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1298
		'o_redirect_delay'			=> "'1'",
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1299
		'o_show_version'			=> "'0'",
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1300
		'o_show_user_info'			=> "'1'",
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1301
		'o_show_post_count'			=> "'1'",
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1302
		'o_smilies'					=> "'1'",
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1303
		'o_smilies_sig'				=> "'1'",
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1304
		'o_make_links'				=> "'1'",
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1305
		'o_default_lang'			=> "'English'",
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1306
		'o_default_style'			=> "'Oxygen'",
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1307
		'o_default_user_group'		=> "'4'",
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1308
		'o_topic_review'			=> "'15'",
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1309
		'o_disp_topics_default'		=> "'30'",
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1310
		'o_disp_posts_default'		=> "'25'",
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1311
		'o_indent_num_spaces'		=> "'4'",
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1312
		'o_quickpost'				=> "'1'",
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1313
		'o_users_online'			=> "'1'",
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1314
		'o_censoring'				=> "'0'",
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1315
		'o_ranks'					=> "'1'",
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1316
		'o_show_dot'				=> "'0'",
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1317
		'o_quickjump'				=> "'1'",
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1318
		'o_gzip'					=> "'0'",
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1319
		'o_additional_navlinks'		=> "''",
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1320
		'o_report_method'			=> "'0'",
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1321
		'o_regs_report'				=> "'0'",
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1322
		'o_mailing_list'			=> "'$email'",
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1323
		'o_avatars'					=> "'1'",
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1324
		'o_avatars_dir'				=> "'img/avatars'",
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1325
		'o_avatars_width'			=> "'60'",
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1326
		'o_avatars_height'			=> "'60'",
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1327
		'o_avatars_size'			=> "'10240'",
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1328
		'o_search_all_forums'		=> "'1'",
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1329
		'o_base_url'				=> "'$base_url'",
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1330
		'o_admin_email'				=> "'$email'",
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1331
		'o_webmaster_email'			=> "'$email'",
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1332
		'o_subscriptions'			=> "'1'",
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1333
		'o_smtp_host'				=> "NULL",
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1334
		'o_smtp_user'				=> "NULL",
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1335
		'o_smtp_pass'				=> "NULL",
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1336
		'o_regs_allow'				=> "'1'",
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1337
		'o_regs_verify'				=> "'0'",
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1338
		'o_announcement'			=> "'0'",
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1339
		'o_announcement_message'	=> "'Enter your announcement here.'",
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1340
		'o_rules'					=> "'0'",
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1341
		'o_rules_message'			=> "'Enter your rules here.'",
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1342
		'o_maintenance'				=> "'0'",
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1343
		'o_maintenance_message'		=> "'The forums are temporarily down for maintenance. Please try again in a few minutes.<br />\\n<br />\\n/Administrator'",
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1344
		'p_mod_edit_users'			=> "'1'",
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1345
		'p_mod_rename_users'		=> "'0'",
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1346
		'p_mod_change_passwords'	=> "'0'",
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1347
		'p_mod_ban_users'			=> "'0'",
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1348
		'p_message_bbcode'			=> "'1'",
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1349
		'p_message_img_tag'			=> "'1'",
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1350
		'p_message_all_caps'		=> "'1'",
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1351
		'p_subject_all_caps'		=> "'1'",
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1352
		'p_sig_all_caps'			=> "'1'",
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1353
		'p_sig_bbcode'				=> "'1'",
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1354
		'p_sig_img_tag'				=> "'0'",
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1355
		'p_sig_length'				=> "'400'",
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1356
		'p_sig_lines'				=> "'4'",
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1357
		'p_allow_banned_email'		=> "'1'",
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1358
		'p_allow_dupe_email'		=> "'0'",
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1359
		'p_force_guest_email'		=> "'1'"
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1360
	);
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1361
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1362
	while (list($conf_name, $conf_value) = @each($config))
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1363
	{
2
a8a21e1c7afa Let's just say that the API loads. While a decent part of PunBB works, we've still got a LONG way to go, mainly with form validation and security. At this point, Punano is NOT secure as far as privileges and user levels go.
Dan
parents: 0
diff changeset
  1364
		$pun_db->query('INSERT INTO '.$db_prefix."config (conf_name, conf_value) VALUES('$conf_name', $conf_value)")
0
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1365
			or error('Unable to insert into table '.$db_prefix.'config. Please check your configuration and try again.');
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1366
	}
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1367
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1368
	// Insert some other default data
2
a8a21e1c7afa Let's just say that the API loads. While a decent part of PunBB works, we've still got a LONG way to go, mainly with form validation and security. At this point, Punano is NOT secure as far as privileges and user levels go.
Dan
parents: 0
diff changeset
  1369
	$pun_db->query('INSERT INTO '.$db_prefix."categories (cat_name, disp_position) VALUES('Test category', 1)")
0
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1370
		or error('Unable to insert into table '.$db_prefix.'categories. Please check your configuration and try again.');
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1371
2
a8a21e1c7afa Let's just say that the API loads. While a decent part of PunBB works, we've still got a LONG way to go, mainly with form validation and security. At this point, Punano is NOT secure as far as privileges and user levels go.
Dan
parents: 0
diff changeset
  1372
	$pun_db->query('INSERT INTO '.$db_prefix."forums (forum_name, forum_desc, num_topics, num_posts, last_post, last_post_id, last_poster, disp_position, cat_id) VALUES('Test forum', 'This is just a test forum', 1, 1, ".$now.", 1, '".$pun_db->escape($username)."', 1, 1)")
0
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1373
		or error('Unable to insert into table '.$db_prefix.'forums. Please check your configuration and try again.');
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1374
2
a8a21e1c7afa Let's just say that the API loads. While a decent part of PunBB works, we've still got a LONG way to go, mainly with form validation and security. At this point, Punano is NOT secure as far as privileges and user levels go.
Dan
parents: 0
diff changeset
  1375
	$pun_db->query('INSERT INTO '.$db_prefix."topics (poster, subject, posted, last_post, last_post_id, last_poster, forum_id) VALUES('".$pun_db->escape($username)."', 'Test post', ".$now.", ".$now.", 1, '".$pun_db->escape($username)."', 1)")
0
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1376
		or error('Unable to insert into table '.$db_prefix.'topics. Please check your configuration and try again.');
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1377
2
a8a21e1c7afa Let's just say that the API loads. While a decent part of PunBB works, we've still got a LONG way to go, mainly with form validation and security. At this point, Punano is NOT secure as far as privileges and user levels go.
Dan
parents: 0
diff changeset
  1378
	$pun_db->query('INSERT INTO '.$db_prefix."posts (poster, poster_id, poster_ip, message, posted, topic_id) VALUES('".$pun_db->escape($username)."', 2, '127.0.0.1', 'If you are looking at this (which I guess you are), the install of PunBB appears to have worked! Now log in and head over to the administration control panel to configure your forum.', ".$now.', 1)')
0
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1379
		or error('Unable to insert into table '.$db_prefix.'posts. Please check your configuration and try again.');
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1380
2
a8a21e1c7afa Let's just say that the API loads. While a decent part of PunBB works, we've still got a LONG way to go, mainly with form validation and security. At this point, Punano is NOT secure as far as privileges and user levels go.
Dan
parents: 0
diff changeset
  1381
	$pun_db->query('INSERT INTO '.$db_prefix."ranks (rank, min_posts) VALUES('New member', 0)")
0
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1382
		or error('Unable to insert into table '.$db_prefix.'ranks. Please check your configuration and try again.');
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1383
2
a8a21e1c7afa Let's just say that the API loads. While a decent part of PunBB works, we've still got a LONG way to go, mainly with form validation and security. At this point, Punano is NOT secure as far as privileges and user levels go.
Dan
parents: 0
diff changeset
  1384
	$pun_db->query('INSERT INTO '.$db_prefix."ranks (rank, min_posts) VALUES('Member', 10)")
0
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1385
		or error('Unable to insert into table '.$db_prefix.'ranks. Please check your configuration and try again.');
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1386
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1387
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1388
	if ($db_type == 'pgsql' || $db_type == 'sqlite')
2
a8a21e1c7afa Let's just say that the API loads. While a decent part of PunBB works, we've still got a LONG way to go, mainly with form validation and security. At this point, Punano is NOT secure as far as privileges and user levels go.
Dan
parents: 0
diff changeset
  1389
		$pun_db->end_transaction();
0
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1390
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1391
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1392
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1393
	$alerts = '';
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1394
	// Check if the cache directory is writable
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1395
	if (!@is_writable('./cache/'))
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1396
		$alerts .= '<p style="font-size: 1.1em"><span style="color: #C03000"><strong>The cache directory is currently not writable!</strong></span> In order for PunBB to function properly, the directory named <em>cache</em> must be writable by PHP. Use chmod to set the appropriate directory permissions. If in doubt, chmod to 0777.</p>';
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1397
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1398
	// Check if default avatar directory is writable
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1399
	if (!@is_writable('./img/avatars/'))
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1400
		$alerts .= '<p style="font-size: 1.1em"><span style="color: #C03000"><strong>The avatar directory is currently not writable!</strong></span> If you want users to be able to upload their own avatar images you must see to it that the directory named <em>img/avatars</em> is writable by PHP. You can later choose to save avatar images in a different directory (see Admin/Options). Use chmod to set the appropriate directory permissions. If in doubt, chmod to 0777.</p>';
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1401
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1402
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1403
	/// Display config.php and give further instructions
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1404
	$config = '<?php'."\n\n".'$db_type = \''.$db_type."';\n".'$db_host = \''.$db_host."';\n".'$db_name = \''.$db_name."';\n".'$db_username = \''.$db_username."';\n".'$db_password = \''.$db_password."';\n".'$db_prefix = \''.$db_prefix."';\n".'$p_connect = false;'."\n\n".'$cookie_name = '."'punbb_cookie';\n".'$cookie_domain = '."'';\n".'$cookie_path = '."'/';\n".'$cookie_secure = 0;'."\n".'$cookie_seed = \''.substr(md5(time()), -8)."';\n\ndefine('PUN', 1);";
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1405
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1406
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1407
?>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1408
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1409
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1410
<html>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1411
<head>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1412
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1413
<title>PunBB Installation</title>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1414
<link rel="stylesheet" type="text/css" href="style/Oxygen.css" />
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1415
</head>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1416
<body>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1417
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1418
<div id="puninstall" style="margin: auto 10% auto 10%">
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1419
<div class="pun">
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1420
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1421
<div class="blockform">
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1422
	<h2>Final instructions</h2>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1423
	<div class="box">
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1424
		<div class="fakeform">
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1425
			<div class="inform">
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1426
				<div class="forminfo">
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1427
					<p>To finalize the installation all you need to do is to <strong>copy and paste the text in the text box below into a file called config.php and then upload this file to the root directory of your PunBB installation</strong>. Make sure there are no linebreaks or spaces before &lt;?php. You can later edit config.php if you reconfigure your setup (e.g. change the database password or ).</p>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1428
<?php if ($alerts != ''): ?>					<?php echo $alerts."\n" ?>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1429
<?php endif; ?>				</div>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1430
				<fieldset>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1431
					<legend>Copy contents to config.php</legend>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1432
					<div class="infldset">
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1433
						<textarea cols="80" rows="20"><?php echo htmlspecialchars($config) ?></textarea>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1434
					</div>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1435
				</fieldset>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1436
			</div>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1437
			<div class="inform">
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1438
				<div class="forminfo">
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1439
					<p>Once you have created config.php with the contents above, PunBB is installed!</p>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1440
					<p><a href="index.php">Go to forum index</a></p>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1441
				</div>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1442
			</div>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1443
		</div>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1444
	</div>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1445
</div>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1446
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1447
</div>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1448
</div>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1449
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1450
</body>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1451
</html>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1452
<?php
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1453
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
  1454
}