1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-09-10 16:20:46 +02:00

Compare commits

..

1 Commits

Author SHA1 Message Date
(no author)
7944f41f6b This commit was manufactured by cvs2svn to create tag
'release_2_0_17'.

git-svn-id: file:///svn/phpbb/tags/release_2_0_17@5191 89ea8834-ac86-4346-8a33-228a782c2dd0
2005-08-08 14:55:26 +00:00
68 changed files with 1400 additions and 6764 deletions

View File

@@ -43,7 +43,7 @@ else
{
$config_name = $row['config_name'];
$config_value = $row['config_value'];
$default_config[$config_name] = str_replace("'", "\'", $config_value);
$default_config[$config_name] = isset($HTTP_POST_VARS['submit']) ? str_replace("'", "\'", $config_value) : $config_value;
$new[$config_name] = ( isset($HTTP_POST_VARS[$config_name]) ) ? $HTTP_POST_VARS[$config_name] : $default_config[$config_name];
@@ -97,6 +97,9 @@ $activation_none = ( $new['require_activation'] == USER_ACTIVATION_NONE ) ? "che
$activation_user = ( $new['require_activation'] == USER_ACTIVATION_SELF ) ? "checked=\"checked\"" : "";
$activation_admin = ( $new['require_activation'] == USER_ACTIVATION_ADMIN ) ? "checked=\"checked\"" : "";
$confirm_yes = ($new['enable_confirm']) ? 'checked="checked"' : '';
$confirm_no = (!$new['enable_confirm']) ? 'checked="checked"' : '';
$board_email_form_yes = ( $new['board_email_form'] ) ? "checked=\"checked\"" : "";
$board_email_form_no = ( !$new['board_email_form'] ) ? "checked=\"checked\"" : "";
@@ -160,6 +163,8 @@ $template->assign_vars(array(
"L_NONE" => $lang['Acc_None'],
"L_USER" => $lang['Acc_User'],
"L_ADMIN" => $lang['Acc_Admin'],
"L_VISUAL_CONFIRM" => $lang['Visual_confirm'],
"L_VISUAL_CONFIRM_EXPLAIN" => $lang['Visual_confirm_explain'],
"L_COOKIE_SETTINGS" => $lang['Cookie_settings'],
"L_COOKIE_SETTINGS_EXPLAIN" => $lang['Cookie_settings_explain'],
"L_COOKIE_DOMAIN" => $lang['Cookie_domain'],

View File

@@ -693,7 +693,7 @@ if( isset($HTTP_GET_VARS['perform']) || isset($HTTP_POST_VARS['perform']) )
include('./page_footer_admin.'.$phpEx);
}
$tables = array('auth_access', 'banlist', 'categories', 'config', 'disallow', 'forums', 'forum_prune', 'groups', 'posts', 'posts_text', 'privmsgs', 'privmsgs_text', 'ranks', 'search_results', 'search_wordlist', 'search_wordmatch', 'sessions', 'smilies', 'themes', 'themes_name', 'topics', 'topics_watch', 'user_group', 'users', 'vote_desc', 'vote_results', 'vote_voters', 'words');
$tables = array('auth_access', 'banlist', 'categories', 'config', 'disallow', 'forums', 'forum_prune', 'groups', 'posts', 'posts_text', 'privmsgs', 'privmsgs_text', 'ranks', 'search_results', 'search_wordlist', 'search_wordmatch', 'sessions', 'smilies', 'themes', 'themes_name', 'topics', 'topics_watch', 'user_group', 'users', 'vote_desc', 'vote_results', 'vote_voters', 'words', 'confirm');
$additional_tables = (isset($HTTP_POST_VARS['additional_tables'])) ? $HTTP_POST_VARS['additional_tables'] : ( (isset($HTTP_GET_VARS['additional_tables'])) ? $HTTP_GET_VARS['additional_tables'] : "" );

View File

@@ -233,6 +233,7 @@ if( isset($HTTP_POST_VARS['addforum']) || isset($HTTP_POST_VARS['addcategory'])
if( $mode == "addforum" )
{
list($cat_id) = each($HTTP_POST_VARS['addforum']);
$cat_id = intval($cat_id);
//
// stripslashes needs to be run on this because slashes are added when the forum name is posted
//
@@ -1024,4 +1025,4 @@ $template->pparse("body");
include('./page_footer_admin.'.$phpEx);
?>
?>

View File

@@ -447,6 +447,9 @@ else if ( $mode != "" )
$smile_code = ( isset($HTTP_POST_VARS['smile_code']) ) ? $HTTP_POST_VARS['smile_code'] : $HTTP_GET_VARS['smile_code'];
$smile_url = ( isset($HTTP_POST_VARS['smile_url']) ) ? $HTTP_POST_VARS['smile_url'] : $HTTP_GET_VARS['smile_url'];
$smile_emotion = ( isset($HTTP_POST_VARS['smile_emotion']) ) ? $HTTP_POST_VARS['smile_emotion'] : $HTTP_GET_VARS['smile_emotion'];
$smile_code = trim($smile_code);
$smile_url = trim($smile_url);
$smile_emotion = trim($smile_emotion);
// If no code was entered complain ...
if ($smile_code == '' || $smile_url == '')
@@ -553,4 +556,4 @@ else
//
include('./page_footer_admin.'.$phpEx);
?>
?>

View File

@@ -48,6 +48,9 @@ $no_page_header = (!empty($HTTP_POST_VARS['send_file']) || $cancel) ? TRUE : FAL
require('./pagestart.' . $phpEx);
$confirm = ( isset($HTTP_POST_VARS['confirm']) ) ? TRUE : FALSE;
$cancel = ( isset($HTTP_POST_VARS['cancel']) ) ? TRUE : FALSE;
if ($cancel)
{
redirect('admin/' . append_sid("admin_styles.$phpEx", true));
@@ -72,7 +75,7 @@ switch( $mode )
if( isset($install_to) )
{
include($phpbb_root_path. "templates/" . $install_to . "/theme_info.cfg");
include($phpbb_root_path. "templates/" . basename($install_to) . "/theme_info.cfg");
$template_name = $$install_to;
$found = FALSE;
@@ -736,7 +739,7 @@ switch( $mode )
@umask(0111);
$fp = @fopen($phpbb_root_path . 'templates/' . $template_name . '/theme_info.cfg', 'w');
$fp = @fopen($phpbb_root_path . 'templates/' . basename($template_name) . '/theme_info.cfg', 'w');
if( !$fp )
{

View File

@@ -414,6 +414,7 @@ if ( isset($HTTP_POST_VARS['submit']) && ( ( $mode == 'user' && $user_id ) || (
FROM " . AUTH_ACCESS_TABLE . " aa, " . USER_GROUP_TABLE . " ug, " . USERS_TABLE . " u
WHERE ug.group_id = aa.group_id
AND u.user_id = ug.user_id
AND ug.user_pending = 0
AND u.user_level NOT IN (" . MOD . ", " . ADMIN . ")
GROUP BY u.user_id
HAVING SUM(aa.auth_mod) > 0";
@@ -508,6 +509,48 @@ if ( isset($HTTP_POST_VARS['submit']) && ( ( $mode == 'user' && $user_id ) || (
}
}
$sql = 'SELECT user_id FROM ' . USER_GROUP_TABLE . "
WHERE group_id = $group_id";
$result = $db->sql_query($sql);
$group_user = array();
while ($row = $db->sql_fetchrow($result))
{
$group_user[$row['user_id']] = $row['user_id'];
}
$db->sql_freeresult($result);
$sql = "SELECT ug.user_id, COUNT(auth_mod) AS is_auth_mod
FROM " . AUTH_ACCESS_TABLE . " aa, " . USER_GROUP_TABLE . " ug
WHERE ug.user_id IN (" . implode(', ', $group_user) . ")
AND aa.group_id = ug.group_id
AND aa.auth_mod = 1
GROUP BY ug.user_id";
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Could not obtain moderator status', '', __LINE__, __FILE__, $sql);
}
while ($row = $db->sql_fetchrow($result))
{
if ($row['is_auth_mod'])
{
unset($group_user[$row['user_id']]);
}
}
$db->sql_freeresult($result);
if (sizeof($group_user))
{
$sql = "UPDATE " . USERS_TABLE . "
SET user_level = " . USER . "
WHERE user_id IN (" . implode(', ', $group_user) . ") AND user_level = " . MOD;
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Could not update user level', '', __LINE__, __FILE__, $sql);
}
}
message_die(GENERAL_MESSAGE, $message);
}
}
@@ -526,9 +569,10 @@ else if ( ( $mode == 'user' && ( isset($HTTP_POST_VARS['username']) || $user_id
//
// Front end
//
$sql = "SELECT *
FROM " . FORUMS_TABLE . " f
ORDER BY forum_order";
$sql = "SELECT f.*
FROM " . FORUMS_TABLE . " f, " . CATEGORIES_TABLE . " c
WHERE f.cat_id = c.cat_id
ORDER BY c.cat_order, f.forum_order ASC";
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, "Couldn't obtain forum information", "", __LINE__, __FILE__, $sql);
@@ -561,7 +605,7 @@ else if ( ( $mode == 'user' && ( isset($HTTP_POST_VARS['username']) || $user_id
}
}
$sql = "SELECT u.user_id, u.username, u.user_level, g.group_id, g.group_name, g.group_single_user FROM " . USERS_TABLE . " u, " . GROUPS_TABLE . " g, " . USER_GROUP_TABLE . " ug WHERE ";
$sql = "SELECT u.user_id, u.username, u.user_level, g.group_id, g.group_name, g.group_single_user, ug.user_pending FROM " . USERS_TABLE . " u, " . GROUPS_TABLE . " g, " . USER_GROUP_TABLE . " ug WHERE ";
$sql .= ( $mode == 'user' ) ? "u.user_id = $user_id AND ug.user_id = u.user_id AND g.group_id = ug.group_id" : "g.group_id = $group_id AND ug.group_id = g.group_id AND u.user_id = ug.user_id";
if ( !($result = $db->sql_query($sql)) )
{
@@ -764,7 +808,7 @@ else if ( ( $mode == 'user' && ( isset($HTTP_POST_VARS['username']) || $user_id
$i++;
}
@reset($auth_user);
// @reset($auth_user);
if ( $mode == 'user' )
{
@@ -789,12 +833,19 @@ else if ( ( $mode == 'user' && ( isset($HTTP_POST_VARS['username']) || $user_id
if( count($name) )
{
$t_usergroup_list = '';
$t_usergroup_list = $t_pending_list = '';
for($i = 0; $i < count($ug_info); $i++)
{
$ug = ( $mode == 'user' ) ? 'group&amp;' . POST_GROUPS_URL : 'user&amp;' . POST_USERS_URL;
$t_usergroup_list .= ( ( $t_usergroup_list != '' ) ? ', ' : '' ) . '<a href="' . append_sid("admin_ug_auth.$phpEx?mode=$ug=" . $id[$i]) . '">' . $name[$i] . '</a>';
if (!$ug_info[$i]['user_pending'])
{
$t_usergroup_list .= ( ( $t_usergroup_list != '' ) ? ', ' : '' ) . '<a href="' . append_sid("admin_ug_auth.$phpEx?mode=$ug=" . $id[$i]) . '">' . $name[$i] . '</a>';
}
else
{
$t_pending_list .= ( ( $t_pending_list != '' ) ? ', ' : '' ) . '<a href="' . append_sid("admin_ug_auth.$phpEx?mode=$ug=" . $id[$i]) . '">' . $name[$i] . '</a>';
}
}
}
else
@@ -857,7 +908,7 @@ else if ( ( $mode == 'user' && ( isset($HTTP_POST_VARS['username']) || $user_id
$template->assign_vars(array(
'USERNAME' => $t_groupname,
'GROUP_MEMBERSHIP' => $lang['Usergroup_members'] . ' : ' . $t_usergroup_list)
'GROUP_MEMBERSHIP' => $lang['Usergroup_members'] . ' : ' . $t_usergroup_list . '<br />' . $lang['Pending_members'] . ' : ' . $t_pending_list)
);
}

View File

@@ -86,7 +86,7 @@ if ( $mode == 'edit' || $mode == 'save' && ( isset($HTTP_POST_VARS['username'])
$row = $db->sql_fetchrow($result);
$sql = "UPDATE " . POSTS_TABLE . "
SET poster_id = " . DELETED . ", post_username = '$username'
SET poster_id = " . DELETED . ", post_username = '" . str_replace("\\'", "''", addslashes($this_userdata['username'])) . "'
WHERE poster_id = $user_id";
if( !$db->sql_query($sql) )
{

View File

@@ -560,6 +560,71 @@ elseif( isset($HTTP_GET_VARS['pane']) && $HTTP_GET_VARS['pane'] == 'right' )
);
}
// Check for new version
$current_version = explode('.', '2' . $board_config['version']);
$minor_revision = (int) $current_version[2];
$errno = 0;
$errstr = $version_info = '';
if ($fsock = @fsockopen('www.phpbb.com', 80, $errno, $errstr))
{
@fputs($fsock, "GET /updatecheck/20x.txt HTTP/1.1\r\n");
@fputs($fsock, "HOST: www.phpbb.com\r\n");
@fputs($fsock, "Connection: close\r\n\r\n");
$get_info = false;
while (!@feof($fsock))
{
if ($get_info)
{
$version_info .= @fread($fsock, 1024);
}
else
{
if (@fgets($fsock, 1024) == "\r\n")
{
$get_info = true;
}
}
}
@fclose($fsock);
$version_info = explode("\n", $version_info);
$latest_head_revision = (int) $version_info[0];
$latest_minor_revision = (int) $version_info[2];
$latest_version = (int) $version_info[0] . '.' . (int) $version_info[1] . '.' . (int) $version_info[2];
if ($latest_head_revision == 2 && $minor_revision == $latest_minor_revision)
{
$version_info = '<p style="color:green">' . $lang['Version_up_to_date'] . '</p>';
}
else
{
$version_info = '<p style="color:red">' . $lang['Version_not_up_to_date'];
$version_info .= '<br />' . sprintf($lang['Latest_version_info'], $latest_version) . sprintf($lang['Current_version_info'], '2' . $board_config['version']) . '</p>';
}
}
else
{
if ($errstr)
{
$version_info = '<p style="color:red">' . sprintf($lang['Connect_socket_error'], $errstr) . '</p>';
}
else
{
$version_info = '<p>' . $lang['Socket_functions_disabled'] . '</p>';
}
}
$version_info .= '<p>' . $lang['Mailing_list_subscribe_reminder'] . '</p>';
$template->assign_vars(array(
'VERSION_INFO' => $version_info,
'L_VERSION_INFORMATION' => $lang['Version_information'])
);
$template->pparse("body");
include('./page_footer_admin.'.$phpEx);

View File

@@ -33,7 +33,7 @@ $template->set_filenames(array(
);
$template->assign_vars(array(
'PHPBB_VERSION' => '2' . $board_config['version'],
'PHPBB_VERSION' => ($userdata['user_level'] == ADMIN && $userdata['user_id'] != ANONYMOUS) ? '2' . $board_config['version'] : '',
'TRANSLATION_INFO' => $lang['TRANSLATION_INFO'])
);

View File

@@ -35,7 +35,7 @@ if ( $board_config['gzip_compress'] )
{
$phpver = phpversion();
$useragent = (isset($_SERVER["HTTP_USER_AGENT"]) ) ? $_SERVER["HTTP_USER_AGENT"] : $HTTP_USER_AGENT;
$useragent = (isset($HTTP_SERVER_VARS['HTTP_USER_AGENT'])) ? $HTTP_SERVER_VARS['HTTP_USER_AGENT'] : getenv('HTTP_USER_AGENT');
if ( $phpver >= '4.0.4pl1' && ( strstr($useragent,'compatible') || strstr($useragent,'Gecko') ) )
{

View File

@@ -40,7 +40,7 @@ init_userprefs($userdata);
if (!$userdata['session_logged_in'])
{
redirect(append_sid("login.$phpEx?redirect=admin/", true));
redirect(append_sid("login.$phpEx?redirect=admin/index.$phpEx", true));
}
else if ($userdata['user_level'] != ADMIN)
{
@@ -59,6 +59,11 @@ if ($HTTP_GET_VARS['sid'] != $userdata['session_id'])
redirect("index.$phpEx?sid=" . $userdata['session_id']);
}
if (!$userdata['session_admin'])
{
redirect(append_sid("login.$phpEx?redirect=admin/index.$phpEx&admin=1", true));
}
if (empty($no_page_header))
{
// Not including the pageheader can be neccesarry if META tags are

View File

@@ -24,52 +24,80 @@ if ( !defined('IN_PHPBB') )
die("Hacking attempt");
}
//
function unset_vars(&$var)
{
while (list($var_name, $null) = @each($var))
{
unset($GLOBALS[$var_name]);
}
return;
}
//
error_reporting (E_ERROR | E_WARNING | E_PARSE); // This will NOT report uninitialized variables
set_magic_quotes_runtime(0); // Disable magic_quotes_runtime
$ini_val = (@phpversion() >= '4.0.0') ? 'ini_get' : 'get_cfg_var';
// The following code (unsetting globals) was contributed by Matt Kavanagh
// Unset globally registered vars - PHP5 ... hhmmm
if (@$ini_val('register_globals') == '1' || strtolower(@$ini_val('register_globals')) == 'on')
// PHP5 with register_long_arrays off?
if (!isset($HTTP_POST_VARS) && isset($_POST))
{
$var_prefix = 'HTTP';
$var_suffix = '_VARS';
$HTTP_POST_VARS = $_POST;
$HTTP_GET_VARS = $_GET;
$HTTP_SERVER_VARS = $_SERVER;
$HTTP_COOKIE_VARS = $_COOKIE;
$HTTP_ENV_VARS = $_ENV;
$HTTP_POST_FILES = $_FILES;
// _SESSION is the only superglobal which is conditionally set
if (isset($_SESSION))
{
$HTTP_SESSION_VARS = $_SESSION;
}
}
if (@phpversion() < '4.0.0')
{
// PHP3 path; in PHP3, globals are _always_ registered
$test = array('_GET', '_POST', '_SERVER', '_COOKIE', '_ENV');
// We 'flip' the array of variables to test like this so that
// we can validate later with isset($test[$var]) (no in_array())
$test = array('HTTP_GET_VARS' => NULL, 'HTTP_POST_VARS' => NULL, 'HTTP_COOKIE_VARS' => NULL, 'HTTP_SERVER_VARS' => NULL, 'HTTP_ENV_VARS' => NULL, 'HTTP_POST_FILES' => NULL, 'phpEx' => NULL, 'phpbb_root_path' => NULL);
foreach ($test as $var)
// Loop through each input array
@reset($test);
while (list($input,) = @each($test))
{
if (is_array(${$var_prefix . $var . $var_suffix}))
while (list($var,) = @each($$input))
{
unset_vars(${$var_prefix . $var . $var_suffix});
}
if (is_array(${$var}))
{
unset_vars(${$var});
// Validate the variable to be unset
if (!isset($test[$var]) && $var != 'test' && $var != 'input')
{
unset($$var);
}
}
}
}
else if (@ini_get('register_globals') == '1' || strtolower(@ini_get('register_globals')) == 'on')
{
// PHP4+ path
$not_unset = array('HTTP_GET_VARS', 'HTTP_POST_VARS', 'HTTP_COOKIE_VARS', 'HTTP_SERVER_VARS', 'HTTP_SESSION_VARS', 'HTTP_ENV_VARS', 'HTTP_POST_FILES', 'phpEx', 'phpbb_root_path');
if (is_array(${'_FILES'}))
// Not only will array_merge give a warning if a parameter
// is not an array, it will actually fail. So we check if
// HTTP_SESSION_VARS has been initialised.
if (!isset($HTTP_SESSION_VARS))
{
unset_vars(${'_FILES'});
$HTTP_SESSION_VARS = array();
}
if (is_array(${'HTTP_POST_FILES'}))
// Merge all into one extremely huge array; unset
// this later
$input = array_merge($HTTP_GET_VARS, $HTTP_POST_VARS, $HTTP_COOKIE_VARS, $HTTP_SERVER_VARS, $HTTP_SESSION_VARS, $HTTP_ENV_VARS, $HTTP_POST_FILES);
unset($input['input']);
unset($input['not_unset']);
while (list($var,) = @each($input))
{
unset_vars(${'HTTP_POST_FILES'});
if (!in_array($var, $not_unset))
{
unset($$var);
}
}
unset($input);
}
//
@@ -176,7 +204,7 @@ include($phpbb_root_path . 'includes/db.'.$phpEx);
// even bother complaining ... go scream and shout at the idiots out there who feel
// "clever" is doing harm rather than good ... karma is a great thing ... :)
//
$client_ip = ( !empty($HTTP_SERVER_VARS['REMOTE_ADDR']) ) ? $HTTP_SERVER_VARS['REMOTE_ADDR'] : ( ( !empty($HTTP_ENV_VARS['REMOTE_ADDR']) ) ? $HTTP_ENV_VARS['REMOTE_ADDR'] : $REMOTE_ADDR );
$client_ip = ( !empty($HTTP_SERVER_VARS['REMOTE_ADDR']) ) ? $HTTP_SERVER_VARS['REMOTE_ADDR'] : ( ( !empty($HTTP_ENV_VARS['REMOTE_ADDR']) ) ? $HTTP_ENV_VARS['REMOTE_ADDR'] : getenv('REMOTE_ADDR') );
$user_ip = encode_ip($client_ip);
//

View File

@@ -1,472 +0,0 @@
<?php
/***************************************************************************
* oracle.php
* -------------------
* begin : Thrusday Feb 15, 2001
* copyright : (C) 2001 The phpBB Group
* email : support@phpbb.com
*
* $Id$
*
***************************************************************************/
/***************************************************************************
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
***************************************************************************/
if(!defined("SQL_LAYER"))
{
define("SQL_LAYER","oracle");
class sql_db
{
var $db_connect_id;
var $query_result;
var $in_transaction = 0;
var $row = array();
var $rowset = array();
var $num_queries = 0;
var $last_query_text = "";
//
// Constructor
//
function sql_db($sqlserver, $sqluser, $sqlpassword, $database="", $persistency = true)
{
$this->persistency = $persistency;
$this->user = $sqluser;
$this->password = $sqlpassword;
$this->server = $sqlserver;
$this->dbname = $database;
if($this->persistency)
{
$this->db_connect_id = @OCIPLogon($this->user, $this->password, $this->server);
}
else
{
$this->db_connect_id = @OCINLogon($this->user, $this->password, $this->server);
}
if($this->db_connect_id)
{
return $this->db_connect_id;
}
else
{
return false;
}
}
//
// Other base methods
//
function sql_close()
{
if($this->db_connect_id)
{
// Commit outstanding transactions
if($this->in_transaction)
{
OCICommit($this->db_connect_id);
}
if($this->query_result)
{
@OCIFreeStatement($this->query_result);
}
$result = @OCILogoff($this->db_connect_id);
return $result;
}
else
{
return false;
}
}
//
// Base query method
//
function sql_query($query = "", $transaction = FALSE)
{
// Remove any pre-existing queries
unset($this->query_result);
// Put us in transaction mode because with Oracle as soon as you make a query you're in a transaction
$this->in_transaction = TRUE;
if($query != "")
{
$this->last_query = $query;
$this->num_queries++;
if(eregi("LIMIT", $query))
{
preg_match("/^(.*)LIMIT ([0-9]+)[, ]*([0-9]+)*/s", $query, $limits);
$query = $limits[1];
if($limits[3])
{
$row_offset = $limits[2];
$num_rows = $limits[3];
}
else
{
$row_offset = 0;
$num_rows = $limits[2];
}
}
if(eregi("^(INSERT|UPDATE) ", $query))
{
$query = preg_replace("/\\\'/s", "''", $query);
}
$this->query_result = @OCIParse($this->db_connect_id, $query);
$success = @OCIExecute($this->query_result, OCI_DEFAULT);
}
if($success)
{
if($transaction == END_TRANSACTION)
{
OCICommit($this->db_connect_id);
$this->in_transaction = FALSE;
}
unset($this->row[$this->query_result]);
unset($this->rowset[$this->query_result]);
$this->last_query_text[$this->query_result] = $query;
return $this->query_result;
}
else
{
if($this->in_transaction)
{
OCIRollback($this->db_connect_id);
}
return false;
}
}
//
// Other query methods
//
function sql_numrows($query_id = 0)
{
if(!$query_id)
{
$query_id = $this->query_result;
}
if($query_id)
{
$result = @OCIFetchStatement($query_id, $this->rowset);
// OCIFetchStatment kills our query result so we have to execute the statment again
// if we ever want to use the query_id again.
@OCIExecute($query_id, OCI_DEFAULT);
return $result;
}
else
{
return false;
}
}
function sql_affectedrows($query_id = 0)
{
if(!$query_id)
{
$query_id = $this->query_result;
}
if($query_id)
{
$result = @OCIRowCount($query_id);
return $result;
}
else
{
return false;
}
}
function sql_numfields($query_id = 0)
{
if(!$query_id)
{
$query_id = $this->query_result;
}
if($query_id)
{
$result = @OCINumCols($query_id);
return $result;
}
else
{
return false;
}
}
function sql_fieldname($offset, $query_id = 0)
{
// OCIColumnName uses a 1 based array so we have to up the offset by 1 in here to maintain
// full abstraction compatibitly
$offset += 1;
if(!$query_id)
{
$query_id = $this->query_result;
}
if($query_id)
{
$result = strtolower(@OCIColumnName($query_id, $offset));
return $result;
}
else
{
return false;
}
}
function sql_fieldtype($offset, $query_id = 0)
{
// This situation is the same as fieldname
$offset += 1;
if(!$query_id)
{
$query_id = $this->query_result;
}
if($query_id)
{
$result = @OCIColumnType($query_id, $offset);
return $result;
}
else
{
return false;
}
}
function sql_fetchrow($query_id = 0, $debug = FALSE)
{
if(!$query_id)
{
$query_id = $this->query_result;
}
if($query_id)
{
$result_row = "";
$result = @OCIFetchInto($query_id, $result_row, OCI_ASSOC+OCI_RETURN_NULLS);
if($debug)
{
echo "Query was: ".$this->last_query . "<br>";
echo "Result: $result<br>";
echo "Query ID: $query_id<br>";
echo "<pre>";
var_dump($result_row);
echo "</pre>";
}
if($result_row == "")
{
return false;
}
for($i = 0; $i < count($result_row); $i++)
{
list($key, $val) = each($result_row);
$return_arr[strtolower($key)] = $val;
}
$this->row[$query_id] = $return_arr;
return $this->row[$query_id];
}
else
{
return false;
}
}
// This function probably isn't as efficant is it could be but any other way I do it
// I end up losing 1 row...
function sql_fetchrowset($query_id = 0)
{
if(!$query_id)
{
$query_id = $this->query_result;
}
if($query_id)
{
$rows = @OCIFetchStatement($query_id, $results);
@OCIExecute($query_id, OCI_DEFAULT);
for($i = 0; $i < $rows; $i++)
{
@OCIFetchInto($query_id, $tmp_result, OCI_ASSOC+OCI_RETURN_NULLS);
for($j = 0; $j < count($tmp_result); $j++)
{
list($key, $val) = each($tmp_result);
$return_arr[strtolower($key)] = $val;
}
$result[] = $return_arr;
}
return $result;
}
else
{
return false;
}
}
function sql_fetchfield($field, $rownum = -1, $query_id = 0)
{
if(!$query_id)
{
$query_id = $this->query_result;
}
if($query_id)
{
if($rownum > -1)
{
// Reset the internal rownum pointer.
@OCIExecute($query_id, OCI_DEFAULT);
for($i = 0; $i < $rownum; $i++)
{
// Move the interal pointer to the row we want
@OCIFetch($query_id);
}
// Get the field data.
$result = @OCIResult($query_id, strtoupper($field));
}
else
{
// The internal pointer should be where we want it
// so we just grab the field out of the current row.
$result = @OCIResult($query_id, strtoupper($field));
}
return $result;
}
else
{
return false;
}
}
function sql_rowseek($rownum, $query_id = 0)
{
if(!$query_id)
{
$query_id = $this->query_result;
}
if($query_id)
{
@OCIExecute($query_id, OCI_DEFAULT);
for($i = 0; $i < $rownum; $i++)
{
@OCIFetch($query_id);
}
$result = @OCIFetch($query_id);
return $result;
}
else
{
return false;
}
}
function sql_nextid($query_id = 0)
{
if(!$query_id)
{
$query_id = $this->query_result;
}
if($query_id && $this->last_query_text[$query_id] != "")
{
if( eregi("^(INSERT{1}|^INSERT INTO{1})[[:space:]][\"]?([a-zA-Z0-9\_\-]+)[\"]?", $this->last_query_text[$query_id], $tablename))
{
$query = "SELECT ".$tablename[2]."_id_seq.currval FROM DUAL";
$stmt = @OCIParse($this->db_connect_id, $query);
@OCIExecute($stmt,OCI_DEFAULT );
$temp_result = @OCIFetchInto($stmt, $temp_result, OCI_ASSOC+OCI_RETURN_NULLS);
if($temp_result)
{
return $temp_result['CURRVAL'];
}
else
{
return false;
}
}
else
{
return false;
}
}
else
{
return false;
}
}
function sql_nextid($query_id = 0)
{
if(!$query_id)
{
$query_id = $this->query_result;
}
if($query_id && $this->last_query_text[$query_id] != "")
{
if( eregi("^(INSERT{1}|^INSERT INTO{1})[[:space:]][\"]?([a-zA-Z0-9\_\-]+)[\"]?", $this->last_query_text[$query_id], $tablename))
{
$query = "SELECT ".$tablename[2]."_id_seq.CURRVAL FROM DUAL";
$temp_q_id = @OCIParse($this->db_connect_id, $query);
@OCIExecute($temp_q_id, OCI_DEFAULT);
@OCIFetchInto($temp_q_id, $temp_result, OCI_ASSOC+OCI_RETURN_NULLS);
if($temp_result)
{
return $temp_result['CURRVAL'];
}
else
{
return false;
}
}
else
{
return false;
}
}
else
{
return false;
}
}
function sql_freeresult($query_id = 0)
{
if(!$query_id)
{
$query_id = $this->query_result;
}
if($query_id)
{
$result = @OCIFreeStatement($query_id);
return $result;
}
else
{
return false;
}
}
function sql_error($query_id = 0)
{
if(!$query_id)
{
$query_id = $this->query_result;
}
$result = @OCIError($query_id);
return $result;
}
} // class sql_db
} // if ... define
?>

View File

@@ -3,7 +3,7 @@
<head>
<meta http-equiv="Content-Type" content="text/html">
<meta http-equiv="Content-Style-Type" content="text/css">
<title>phpBB 2.0.9 :: Changelog</title>
<title>phpBB 2.0.x :: Changelog</title>
<link rel="stylesheet" href="../templates/subSilver/subSilver.css" type="text/css" />
<style type="text/css">
<!--
@@ -24,7 +24,7 @@ p,ul,td {font-size:10pt;}
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><img src="../templates/subSilver/images/logo_phpBB.gif" border="0" alt="phpBB 2 : Creating Communities" vspace="1" /></a></td>
<td align="center" width="100%" valign="middle"><span class="maintitle">phpBB 2.0.9 CHANGELOG</span></td>
<td align="center" width="100%" valign="middle"><span class="maintitle">phpBB 2.0.x CHANGELOG</span></td>
</tr>
</table>
@@ -32,6 +32,14 @@ p,ul,td {font-size:10pt;}
<ol>
<li><a href="#changelog">Changelog</a></li>
<ol type="i">
<li><a href="#2016">Changes since 2.0.16</a></li>
<li><a href="#2015">Changes since 2.0.15</a></li>
<li><a href="#2014">Changes since 2.0.14</a></li>
<li><a href="#2013">Changes since 2.0.13</a></li>
<li><a href="#2012">Changes since 2.0.12</a></li>
<li><a href="#2011">Changes since 2.0.11</a></li>
<li><a href="#2010">Changes since 2.0.10</a></li>
<li><a href="#209">Changes since 2.0.9</a></li>
<li><a href="#208">Changes since 2.0.8</a></li>
<li><a href="#207">Changes since 2.0.7</a></li>
<li><a href="#206">Changes since 2.0.6</a></li>
@@ -54,7 +62,121 @@ p,ul,td {font-size:10pt;}
<p>This is a non-exhaustive (but still near complete) changelog for phpBB 2.0.x including beta and release candidate versions. Our thanks to all those people who've contributed bug reports and code fixes.</p>
<a name="208"></a><h3 class="h3">l.i. Changes since 2.0.8</h3>
<a name="2016"></a><h3 class="h3">l.i. Changes since 2.0.16</h3>
<ul>
<li>Added extra checks to the deletion code in privmsg.php - reported by party_fan</li>
<li>Fixed XSS issue in IE using the url BBCode</li>
<li>Fixed admin activation so that you must have administrator rights to activate accounts in this mode - reported by ieure</li>
<li>Fixed get_username returning wrong row for usernames beginning with numerics - reported by Ptirhiik</li>
<li>Pass username through phpbb_clean_username within validate_username function - AnthraX101</li>
<li>Fixed PHP error in message_die function</li>
<li>Fixed incorrect generation of {postrow.SEARCH_IMG} tag in viewtopic.php - reported by Double_J</li>
<li>Also fixed above issue in usercp_viewprofile.php</li>
<li>Fixed incorrect setting of user_level on pending members if a group is granted moderator rights - reported by halochat</li>
<li>Fixed ordering of forums on admin_ug_auth.php to be consistant with other pages</li>
<li>Correctly set username on posts when deleting a user from the admin panel</li>
</ul>
<a name="2015"></a><h3 class="h3">l.ii. Changes since 2.0.15</h3>
<ul>
<li>Fixed critical issue with highlighting - <b>Discovered and fix provided by Ron van Daal</b></li>
<li>Url descriptions able to be wrapped over more than one line again</li>
<li>Fixed bug with eAccelerator in admin_ug_auth.php</li>
<li>Check new_forum_id for existence in modcp.php - <b>alessnet</b></li>
<li>Prevent uploading avatars with no dimensions - <b>Xpert</b></li>
<li>Fixed bug in usercp_register.php, forcing avatar file removal without updating avatar informations within the database - <b>HenkPoley</b></li>
<li>Fixed bug in admin re-authentication redirect for servers not having index.php as one of their default files set</li>
</ul>
<a name="2014"></a><h3 class="h3">l.iii. Changes since 2.0.14</h3>
<ul>
<li>Fixed moderator status removal in groupcp.php</li>
<li>Removed newlines after ?&gt; on some files - <b>Thoul</b></li>
<li>Added admin re-authentication (admin needs to login seperatly to access the ACP) - backported from Olympus</li>
<li>Fixed vulnerability in url/bbcode handling functions - <b>PapaDos and Paul/Zhen-Xjell from CastleCops</b></li>
<li>Fixed issue in admin/admin_forums.php</li>
<li>Suppressed warning message for fsockopen in /includes/smtp.php - <b>Thoul</b></li>
<li>Fixed bug in admin/admin_smilies.php (admin is able to add empty smilies) - <b>Exy</b></li>
<li>Adjusted documents to reflect the urgent need to update the files too (not only running the database update script)</li>
<li>Updated the readme file</li>
<li>Added one new language variable</li>
<li>Added general error if accessing profile for a non-existent user</li>
<li>Changed session id generation to be more unique - <b>Henno Joosep</b></li>
<li>Fixed bug in highlight code to escape characters correctly</li>
<li>Reversed the 2.0.14 fix for postgresql because it produced more problems than it solves.</li>
<li>Added reference to article written by R45 about case-sensitivity in postgreSQL to the readme file</li>
<li>Fixed bypassing of validate_username on registration - Yen</li>
<li>Empty url/img bbcodes no longer get parsed</li>
</ul>
<a name="2013"></a><h3 class="h3">l.iv. Changes since 2.0.13</h3>
<ul>
<li>Hardened author and keyword search a bit to not allow very server intensive searches</li>
<li>Fixed full path disclosure in bad word parsing</li>
<li>Resetting complete userdata array in session code if authentication fails</li>
<li>Fixed bug in moderator control panel where certain parameters could lead to an "error creating new session" sql error</li>
<li>Fixed bug in session code where empty page ids could lead to an "error creating new session" sql error</li>
<li>Fixed html handling in signatures if html is turned off globally</li>
<li>Fixed install.php problem with PHP5 register_long_arrays option turned off</li>
<li>Fixed potential issues with styling system</li>
<li>Added correct class to login_body template file</li>
<li>Removed file db/oracle.php from package</li>
<li>Removed version number from message body page in /admin (if user is not an admin) - <b>mikelbeck</b></li>
<li>Fixed case-sensitivity issues in postgres7.php - <b>R45</b></li>
</ul>
<a name="2012"></a><h3 class="h3">l.v. Changes since 2.0.12</h3>
<ul>
<li>Ommitted preg_replace warning in viewtopic due to improper working of preg_quote in PHP - originally reported by matrix_killer, fix submitted by another party</li>
<li>Fixed high severity issue in session handling allowing everyone gaining administrator rights. Please update as soon as possible.</li>
<li>Minimum requirements raised to PHP 4.0.3 or above due to fixing vulnerability issues breaking PHP3 compatibility.</li>
</ul>
<a name="2011"></a><h3 class="h3">l.vi. Changes since 2.0.11</h3>
<ul>
<li>Added confirm table to admin_db_utilities.php</li>
<li>Prevented full path display on critical messages</li>
<li>Fixed full path disclosure in username handling caused by a PHP 4.3.10 bug - <b>AnthraX101</b></li>
<li>Added exclude list to unsetting globals (if register_globals is on) - <b>SpoofedExistence</b></li>
<li>Fixed arbitrary file disclosure vulnerability in avatar handling functions - <b>AnthraX101</b></li>
<li>Fixed arbitrary file unlink vulnerability in avatar handling functions - <b>AnthraX101</b></li>
<li>Removed version number from powered by line</li>
<li>Merged database update files to update_to_latest.php file</li>
<li>Fixed path disclosure bug in search.php caused by a PHP 4.3.10 bug (related to AnthraX101's discovery)</li>
<li>Fixed path disclosure bug in viewtopic.php caused by a PHP 4.3.10 bug - <b>matrix_killer</b></li>
</ul>
<a name="2010"></a><h3 class="h3">l.vii. Changes since 2.0.10</h3>
<ul>
<li>Fixed vulnerability in highlighting code (<b>very high severity, please update your installation as soon as possible</b>)</li>
<li>Fixed unsetting global vars - <b>Matt Kavanagh</b></li>
<li>Fixed XSS vulnerability in username handling - <b>AnthraX101</b></li>
<li>Fixed not confirmed sql injection in username handling - <b>warmth</b></li>
<li>Added check for empty topic id in topic_review function</li>
<li>Added visual confirmation mod to code base</li>
</ul>
<a name="209"></a><h3 class="h3">l.viii. Changes since 2.0.9</h3>
<ul>
<li>Fixed deleting of styles in admin_styles.php</li>
<li>Fixed wrong unsetting of variables introduced in phpBB 2.0.9, making the board non-functional for users with specific php.ini settings</li>
<li>Added code to let phpBB work with PHP5 for those having register_long_arrays set to off (default settings) - running phpBB 2.0.x with PHP5 is not supported at http://www.phpbb.com.</li>
<li>Fixed bug in admin_board.php for board settings having single quotes in it</li>
<li>Fixed "search by author" in search.php. Now it is possible to search for users with special chars in their name too</li>
<li>Fixed forum jumpbox propagating session id in moderator control pages</li>
<li>Added check for newlines at redirecting pages, to prevent http response splitting attacks - <b>Ory Segal and Amit Klein</b></li>
<li>Fixed visual confirmation code. The image was not created due to a wrong regular expression.</li>
</ul>
<a name="208"></a><h3 class="h3">l.ix. Changes since 2.0.8</h3>
<ul>
<li>Fixed one vulnerability in admin_board.php - <b>Xore</b></li>
@@ -62,7 +184,7 @@ p,ul,td {font-size:10pt;}
<li>Fixed injection vulnerabilities possible with linked avatars</li>
<li>Implemented unsetting globalised variables</li>
<li>Limited confirm switch to POST variable in posting</li>
<li>Changed IP code in common.php to prevent IP spoofing</li>
<li>Changed IP code in common.php to prevent IP spoofing, which might introduce some problems with private IP Ranges showing up. - <b>Wang Products</b></li>
<li>Updated visual confirmation mod [pre-edited files]</li>
<li>Moved obtaining word censors in modcp out of topic generation loop [increased performance/lower query count] - spotted by <b>R45</b></li>
<li>Added the ability to link to https/ftps sites using the img bbcode tag</li>
@@ -73,7 +195,7 @@ p,ul,td {font-size:10pt;}
<li>Fixed problem with SID not delivered to next page in groupcp.php</li>
</ul>
<a name="207"></a><h3 class="h3">l.ii. Changes since 2.0.7</h3>
<a name="207"></a><h3 class="h3">l.x. Changes since 2.0.7</h3>
<ul>
<li>Fixed several vulnerabilities in admin pages</li>
@@ -85,7 +207,7 @@ p,ul,td {font-size:10pt;}
<li>Fixed sql injection vulnerability in privmsg - 2.0.8a</li>
</ul>
<a name="206"></a><h3 class="h3">1.iii. Changes since 2.0.6</h3>
<a name="206"></a><h3 class="h3">1.xi. Changes since 2.0.6</h3>
<ul>
<li>Fixed several vulnerabilities in modcp - <b>Robert Lavierck</b></li>
@@ -99,7 +221,7 @@ p,ul,td {font-size:10pt;}
<li>Fixed potential vulnerability in avatar gallery</li>
</ul>
<a name="205"></a><h3 class="h3">1.iv. Changes since 2.0.5</h3>
<a name="205"></a><h3 class="h3">1.xii. Changes since 2.0.5</h3>
<ul>
<li>Fixed various email issues</li>
@@ -115,7 +237,7 @@ p,ul,td {font-size:10pt;}
<li>Fixed sql injection with reset date format field in profile - <b>tendor</b></li>
</ul>
<a name="204"></a><h3 class="h3">1.v. Changes since 2.0.4</h3>
<a name="204"></a><h3 class="h3">1.xiii. Changes since 2.0.4</h3>
<ul>
<li>Removed user facing session_id checks</li>
@@ -187,7 +309,7 @@ p,ul,td {font-size:10pt;}
<li>Default English support for visual confirmation - translators are encouraged to support this</li>
</ul>
<a name="203"></a><h3 class="h3">1.vi. Changes since 2.0.3</h3>
<a name="203"></a><h3 class="h3">1.xiv. Changes since 2.0.3</h3>
<ul>
<li>Fixed cross-browser scripting issue with highlight param</li>
@@ -314,7 +436,7 @@ p,ul,td {font-size:10pt;}
<li>Fixed potential SQL vulnerability with marking of private messages - <b>Ulf Harnhammar</b></li>
</ul>
<a name="202"></a><h3 class="h3">1.vii. Changes since 2.0.2</h3>
<a name="202"></a><h3 class="h3">1.xv. Changes since 2.0.2</h3>
<ul>
<li>Fixed potential cross-site scripting vulnerability with avatars - <b>Showscout</b></li>
@@ -323,7 +445,7 @@ p,ul,td {font-size:10pt;}
<li>Fixed (hopefully) issue with MS Access and multiple pages</li>
</ul>
<a name="201"></a><h3 class="h3">1.viii. Changes since 2.0.1</h3>
<a name="201"></a><h3 class="h3">1.xvi. Changes since 2.0.1</h3>
<ul>
<li>Fixed missing "username" lang variable in user admin template</li>
@@ -358,7 +480,7 @@ p,ul,td {font-size:10pt;}
<li>Fix emailer to allow sending emails with language-specific character sets</li>
</ul>
<a name="200"></a><h3 class="h3">1.ix. Changes since 2.0.0</h3>
<a name="200"></a><h3 class="h3">1.xvii. Changes since 2.0.0</h3>
<ul>
<li>Fixed delete image bug for normal users</li>
@@ -415,7 +537,7 @@ p,ul,td {font-size:10pt;}
<li>Added database closure to admin frameset page</li>
</ul>
<a name="final"></a><h3 class="h3">1.x. Changes since RC-4</h3>
<a name="final"></a><h3 class="h3">1.xviii. Changes since RC-4</h3>
<ul>
<li>Fixed improper report of general error when posting messages containing errors</li>
@@ -445,7 +567,7 @@ p,ul,td {font-size:10pt;}
<li>Fixed various remaining usergroup display issues</li>
</ul>
<a name="rc4"></a><h3 class="h3">1.xi. Changes since RC-3</h3>
<a name="rc4"></a><h3 class="h3">1.xix. Changes since RC-3</h3>
<ul>
<li>Addressed serious security issue with included files</li>
@@ -476,7 +598,7 @@ p,ul,td {font-size:10pt;}
<li>Fix (hopefully) remaining ICQ overlay issue with view profile in subSilver</li>
</ul>
<a name="rc3"></a><h3 class="h3">1.xii. Changes since RC-2</h3>
<a name="rc3"></a><h3 class="h3">1.xx. Changes since RC-2</h3>
<ul>
<li>Fixed infamous install parse error</li>
@@ -509,7 +631,7 @@ p,ul,td {font-size:10pt;}
<li>Hidden usergroups are now completely hidden from view</li>
</ul>
<a name="rc2"></a><h3 class="h3">1.xiii. Changes since RC-1</h3>
<a name="rc2"></a><h3 class="h3">1.xxi. Changes since RC-1</h3>
<ul>
<li>Fixed numerous PostgreSQL related issues</li>
@@ -529,7 +651,7 @@ p,ul,td {font-size:10pt;}
<li>Various other fixes and updates</li>
</ul>
<a name="rc1"></a><h3 class="h3">1.xv. Changes since RC-1 (pre)</h3>
<a name="rc1"></a><h3 class="h3">1.xxii. Changes since RC-1 (pre)</h3>
<ul>
<li>Upgrade script completed for initial fully functional release</li>

View File

@@ -3,7 +3,7 @@
<head>
<meta http-equiv="Content-Type" content="text/html">
<meta http-equiv="Content-Style-Type" content="text/css">
<title>phpBB 2.0.9 :: Install</title>
<title>phpBB 2.0.x :: Install</title>
<link rel="stylesheet" href="../templates/subSilver/subSilver.css" type="text/css">
<style type="text/css">
<!--
@@ -24,7 +24,7 @@ p,ul,td {font-size:10pt;}
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><img src="../templates/subSilver/images/logo_phpBB.gif" border="0" alt="phpBB 2 : Creating Communities" vspace="1" /></a></td>
<td align="center" width="100%" valign="middle"><span class="maintitle">phpBB 2.0.9 INSTALL</span></td>
<td align="center" width="100%" valign="middle"><span class="maintitle">phpBB 2.0.x INSTALL</span></td>
</tr>
</table>
@@ -33,7 +33,7 @@ p,ul,td {font-size:10pt;}
<p>Please note these instructions are not fully comprehensive, a more thorough userguide will be available on the phpBB website in the near future. However, this document will walk you through the basics on installing the forum software.</p>
<p>A basic overview of running phpBB 2.0.9 can be found in the accompanying <a href="README.html">README</a> documentation. Please ensure you read that document in addition to this! For more detailed information on using phpBB 2 you should read <a href="http://www.phpbb.com/guide/phpBB_Users_Guide.html" target="_new">Userguide</a> now available online.</p>
<p>A basic overview of running phpBB 2.0.x can be found in the accompanying <a href="README.html">README</a> documentation. Please ensure you read that document in addition to this! For more detailed information on using phpBB 2 you should read <a href="http://www.phpbb.com/support/guide/" target="_new">Userguide</a> now available online.</p>
<ol>
<li><a href="#quickinstall">Quick Install</a></li>
@@ -88,7 +88,7 @@ p,ul,td {font-size:10pt;}
<a name="require"></a><h2 class="h2"><u>2. Requirements</u></h2>
<p>Installation of phpBB 2.0.9 requires the following:</p>
<p>Installation of phpBB2 requires the following:</p>
<ul>
<li>A webserver or web hosting account running on any major Operating System</li>
<li>A SQL database system, <b>one of</b>:
@@ -99,7 +99,7 @@ p,ul,td {font-size:10pt;}
<li>MS Access (2000 or XP) via ODBC</li>
</ul>
</li>
<li>PHP (3.0.9 and above or preferably a recent 4.x) with support for the database you intend to use above</li>
<li>PHP (4.0.3 and above) with support for the database you intend to use above</li>
</ul>
<p>If your server or hosting account does not meet the requirements above I am afraid phpBB 2.0 is not for you.</p>
@@ -170,11 +170,11 @@ p,ul,td {font-size:10pt;}
<p>Upgrading from these versions is generally quite easy. First you should make a copy of your existing <u>config.php</u>, keep it in a safe place! Next delete all the existing phpBB 2 files, do not leave any in place otherwise you may encounter errors later. You can leave alternative templates in-place but you should note they may not function correctly with the final release. It is therefore recommended you switch back to subSilver if you are currently using a different style. With this complete you can upload the new phpBB 2.0.0 files (see <a href="#install">New Installations</a> for details if necessary). Once complete copy back your saved <u>config.php</u>, replacing the new one.</p>
<p>You should now run <b>install/update_to_209.php</b> which, depending on your previous version, will make a number of database changes. You may receive <u>FAILURES</u> during this procedure, they should not be a cause for concern unless you see an actual <u>ERROR</u>, in which case the script will stop (in this case you should seek help via our forums or bug tracker).</p>
<p>You should now run <b>install/update_to_latest.php</b> which, depending on your previous version, will make a number of database changes. You may receive <u>FAILURES</u> during this procedure, they should not be a cause for concern unless you see an actual <u>ERROR</u>, in which case the script will stop (in this case you should seek help via our forums or bug tracker).</p>
<p><b>RC-2 and below MSSQL users</b>, please note that during the update procedure your existing forums table will be dropped and re-created. All data in standard fields will be retained. However if you have modified the forums table and added additional fields or altered existing ones these changes <b>WILL</b> be lost. If this is a significant issue for you we advise you comment out the "DROP FORUM TABLE" section in update_to_209.php and instead, manually alter the forum_id column to remove the IDENTITY setting (if it exists).</p>
<p><b>RC-2 and below MSSQL users</b>, please note that during the update procedure your existing forums table will be dropped and re-created. All data in standard fields will be retained. However if you have modified the forums table and added additional fields or altered existing ones these changes <b>WILL</b> be lost. If this is a significant issue for you we advise you comment out the "DROP FORUM TABLE" section in update_to_latest.php and instead, manually alter the forum_id column to remove the IDENTITY setting (if it exists).</p>
<p>Once the update_to_209.php has completed you <b>MUST</b> proceed to the Administration General Configuration panel and check all the values in General Configuration. This is essential if you were running any version before RC-3 since extra information needs to be entered to enable correct URLs to be output in emails.</p>
<p>Once the update_to_latest.php has completed you <b>MUST</b> proceed to the Administration General Configuration panel and check all the values in General Configuration. This is essential if you were running any version before RC-3 since extra information needs to be entered to enable correct URLs to be output in emails.</p>
<a name="langtempchanges"></a><h3 class="h3">6.i. Changes in language pack format and templates</h3>
@@ -186,27 +186,29 @@ p,ul,td {font-size:10pt;}
<p><b>MySQL Users Please Note</b>: Changes introduced in 2.0.4 may increase the size of your database, more specifically the search_wordmatch table. There are other changes in that release which are designed to reduce the database size. However these additional changes may not apply to all types of forum (particularly non-English boards). While any increases will be relatively small compared to the overall database size it may be an issue for some users. In particular users on hosting plans which limit database size and where the database is near that limit.</p>
<p><b>Please make sure you update your phpBB2 source files too, even if you run the update_to_latest.php file.</b></p>
<a name="#upgradeSTABLE_full"></a><h3 class="h3">7.i. Full package</h3>
<p>If you have downloaded the full package you should follow the same general upgrade path as for "<a href="#upgradeRC">Upgrade from previous Release Candidate versions of phpBB 2</a>". The exception to this being the need to switch or update styles. In addition there is generally little need to visit the admin panel (though it is adviseable).</p>
<a name="#upgradeSTABLE_files"></a><h3 class="h3">7.ii. Changed files only</h3>
<p>This package contains a number of archives, each contains the files changed from a given release to 2.0.9. You should select the appropriate archive for your current version, e.g. if you currently have 2.0.6 you should select the phpBB-2.0.6_to_2.0.9.zip/tar.gz file.</p>
<p>This package contains a number of archives, each contains the files changed from a given release to the latest version. You should select the appropriate archive for your current version, e.g. if you currently have 2.0.16 you should select the phpBB-2.0.16_to_2.0.17.zip/tar.gz file.</p>
<p>The directory structure has been preserved enabling you (if you wish) to simply upload the contents of the archive to the appropriate location on your server, i.e. simply overwrite the existing files with the new versions. Do not forget that if you have installed any Mods these files will overwrite the originals possibly destroying them in the process. You will need to re-add Mods to any affected file before uploading.</p>
<p>As for the other upgrade procedures you should run <b>install/update_to_209.php</b> after you have finished updating the files. This will update your database schema and data (if appropriate) and increment the version number.</p>
<p>As for the other upgrade procedures you should run <b>install/update_to_latest.php</b> after you have finished updating the files. This will update your database schema and increment the version number.</p>
<a name="#upgradeSTABLE_patch"></a><h3 class="h3">7.iii. Patch file</h3>
<p>The patch file is probably the best solution for those with many Mods or other changes who do not want to re-add them back to all the changed files. To use this you will need command line access to a standard UNIX type <b>patch</b> application.</p>
<p>A number of patch files are provided to allow you to upgrade from previous stable releases. Select the correct patch, e.g. if your current version is 2.0.6 you need the phpBB-2.0.6_to_2.0.9.patch. Place the correct patch in the parent directory containing the phpBB 2 core files (i.e. index.php, viewforum.php, etc.). With this done you should run the following command: <b>patch -cl -d [PHPBB DIRECTORY] -p1 &lt; [PATCH NAME]</b> (where PHPBB DIRECTORY is the directory name your phpBB Installation resides in, for example phpBB2, and where PATCH NAME is the relevant filename of the selected patch file). This should complete quickly, hopefully without any HUNK FAILED comments.</p>
<p>A number of patch files are provided to allow you to upgrade from previous stable releases. Select the correct patch, e.g. if your current version is 2.0.16 you need the phpBB-2.0.16_to_2.0.17.patch. Place the correct patch in the parent directory containing the phpBB 2 core files (i.e. index.php, viewforum.php, etc.). With this done you should run the following command: <b>patch -cl -d [PHPBB DIRECTORY] -p1 &lt; [PATCH NAME]</b> (where PHPBB DIRECTORY is the directory name your phpBB Installation resides in, for example phpBB2, and where PATCH NAME is the relevant filename of the selected patch file). This should complete quickly, hopefully without any HUNK FAILED comments.</p>
<p>If you do get failures you should look at using the <a href="#upgradeSTABLE_files">Changed files only</a> package to replace the files which failed to patch, please note that you will need to manually re-add any Mods to these particular files. Alternatively if you know how you can examine the .rej files to determine what failed where and make manual adjustments to the relevant source.</p>
<p>You should of course delete the patch file (or files) after use. As for the other upgrade procedures you should run <b>install/update_to_209.php</b> after you have finished updating the files. This will update your database schema and data (if appropriate) and increment the version number.</p>
<p>You should of course delete the patch file (or files) after use. As for the other upgrade procedures you should run <b>install/update_to_latest.php</b> after you have finished updating the files. This will update your database schema and data (if appropriate) and increment the version number.</p>
<a name="#upgradeSTABLE_all"></a><h3 class="h3">7.iv. All package types</h3>
@@ -214,7 +216,7 @@ p,ul,td {font-size:10pt;}
<a name="postinstall"></a><h2 class="h2"><u>8. Important (security related) post-Install tasks for all installation methods</u></h2>
<p>Once you have succssfully installed phpBB 2.0.9 you <b>MUST</b> ensure you remove the entire install/ and contrib/ directories. Leaving these in place is a <u>very serious potential security issue</u> which may lead to deletion or alteration of files, etc. Please note that until these directories are remove phpBB2 will not operate and a warning message will be displayed. Beyond these <b>essential</b> deletions you may also wish to delete the docs/ directories if you wish.</p>
<p>Once you have succssfully installed phpBB 2.0.x you <b>MUST</b> ensure you remove the entire install/ and contrib/ directories. Leaving these in place is a <u>very serious potential security issue</u> which may lead to deletion or alteration of files, etc. Please note that until these directories are remove phpBB2 will not operate and a warning message will be displayed. Beyond these <b>essential</b> deletions you may also wish to delete the docs/ directories if you wish.</p>
<p>With these directories deleted you should proceed to the administration panel. Depending on how the installation completed you may have been directed there automatically. If not, login as the administrator you specified during install/upgrade and click the "<b>Administration Panel</b>" link at the bottom of any page. Ensure that details specified in General -> Configuration are correct!</p>
@@ -232,7 +234,7 @@ p,ul,td {font-size:10pt;}
<a name="safemode"></a><h3 class="h3">8.ii. Safe Mode</h3>
<p>phpBB 2.0.9 includes support for using uploadable avatars on systems running PHP in safe mode. If this applies to your hosting service you will need to create a sub-directory called <u>tmp</u> in the directory you specified for storage of uploaded avatars (by default this is images/avatars as explained above). Give it the same access rights as for uploadable avatars above.</p>
<p>phpBB 2.0.x includes support for using uploadable avatars on systems running PHP in safe mode. If this applies to your hosting service you will need to create a sub-directory called <u>tmp</u> in the directory you specified for storage of uploaded avatars (by default this is images/avatars as explained above). Give it the same access rights as for uploadable avatars above.</p>
<p>This safe mode support includes compatibility with various directory restrictions your host may impose (assuming they are not too restrictive and that the PHP installed is version 4.0.3 or later). There is generally no need for any manual setup for safe mode support it is typically handled transparantly.</p>

View File

@@ -3,7 +3,7 @@
<head>
<meta http-equiv="Content-Type" content="text/html">
<meta http-equiv="Content-Style-Type" content="text/css">
<title>phpBB 2.0.9 :: Readme</title>
<title>phpBB 2.0.x :: Readme</title>
<link rel="stylesheet" href="../templates/subSilver/subSilver.css" type="text/css" />
<style type="text/css">
<!--
@@ -24,7 +24,7 @@ p,ul,td {font-size:10pt;}
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><img src="../templates/subSilver/images/logo_phpBB.gif" border="0" alt="phpBB 2 : Creating Communities" vspace="1" /></a></td>
<td align="center" width="100%" valign="middle"><span class="maintitle">phpBB 2.0.9 README</span></td>
<td align="center" width="100%" valign="middle"><span class="maintitle">phpBB 2.0.x README</span></td>
</tr>
</table>
@@ -62,7 +62,7 @@ p,ul,td {font-size:10pt;}
<p>Installation and upgrade instructions can be found in the <a href="INSTALL.html">INSTALL</a> document contained in this distribution. If you are intending to upgrade from a previous phpBB 1.4.x installation we highly recommend you backup any existing data before proceeding!</p>
<p><b>Please note</b> that users of Release Candidate (RC) versions of phpBB 2 should run the update_to_205.php script <b>BEFORE</b> attempting to access your board. Failing to do so may result in errors and unexpected behaviour! While these won't do any damage they will prevent you using your board.</p>
<p><b>Please note</b> that users of Release Candidate (RC) versions of phpBB 2 should run the update_to_latest.php script <b>BEFORE</b> attempting to access your board. Failing to do so may result in errors and unexpected behaviour! While these won't do any damage they will prevent you using your board.</p>
<p>If you are using RC-1 (pre) you may find some other DB changes have occured and should examine the schemas to see if your installation requires any modifications (note that most of these have already been discussed on the phpBB 2 forums and are handled by the update script). If you are uncomfortable doing any of this we recommend you re-install (you may backup your existing data if you wish, re-install phpBB 2 and then insert your backup).</p>
@@ -84,7 +84,7 @@ p,ul,td {font-size:10pt;}
<p>If your language is not available please visit our forums where you will find a topic listing translations currently available or in preparation. This topic also gives you information should you wish to volunteer to translate a language not currently listed</p>
<p><b>Please note</b> that users who have upgraded to 2.0.9 from versions prior to RC-3 should will <b>need</b> to download new versions of the language/subSilver image packs. Any package downloaded prior to the availability of RC-3 will <b>not</b> function correctly with this version of phpBB 2.</p>
<p><b>Please note</b> that users who have upgraded to the latest version from versions prior to RC-3 should will <b>need</b> to download new versions of the language/subSilver image packs. Any package downloaded prior to the availability of RC-3 will <b>not</b> function correctly with this version of phpBB 2.</p>
<p>If you have upgraded from 2.0.0 and make use of non-English language packs you will benefit from downloading updated versions which will become available shortly. These introduce a number of strings which went missing from the first version plus a few updates and additions.</p>
@@ -116,7 +116,7 @@ p,ul,td {font-size:10pt;}
<p>A comprehensive userguide is now available online and can be accessed from the following location:</p>
<p><a href="http://www.phpbb.com/guide/phpBB_Users_Guide.html" target="_new">http://www.phpbb.com/guide/phpBB_Users_Guide.html</a></p>
<p><a href="http://www.phpbb.com/support/guide/" target="_new">http://www.phpbb.com/support/guide/</a></p>
<p>This covers everything from installation through setting permissions and managing users.</p>
@@ -130,23 +130,19 @@ p,ul,td {font-size:10pt;}
<a name="irc"></a><h3 class="h3">3.iii Internet Relay Chat</h3>
<p>Another place you may find help is our IRC channel. This operates on the Openprojects IRC network, <b>irc.openprojects.net</b> and the channel is <b>#phpbb</b> and can be accessed by any good IRC client such as mIRC, XChat, etc. Again, please do not abuse this service and be respectful of other users.</p>
<p>Another place you may find help is our IRC channel. This operates on the Freenode IRC network, <b>irc.freenode.net</b> and the channel is <b>#phpbb</b> and can be accessed by any good IRC client such as mIRC, XChat, etc. Again, please do not abuse this service and be respectful of other users.</p>
<a name="status"></a><h2 class="h2"><u>4. Status of this version</u></h2>
<p>This is the second stable release of phpBB 2. The 2.0.x line is essentially feature frozen, point releases will see only bugs and such like fixed. Our next major release will be phpBB 2.2 and work is progressing on this (the unstable development version is 2.1). Please do not post questions asking when 2.2 will be available, no release date has been set. Feel free to suggest new features for phpBB 2.2, we already have a number of improvements in mind and these can be viewed using our task tracker:</p>
<p>This is the second stable release of phpBB 2. The 2.0.x line is essentially feature frozen, point releases will see only bugs and such like fixed. Our next major release will be phpBB 3.0 and work is progressing on this (the unstable development version is 2.1). Please do not post questions asking when 3.0 will be available, no release date has been set. phpBB 3.0 is now feature frozen, please feel free to suggest new features for phpBB 3.2 using our feature request tracker. We do not guarantee that all these will appear in 3.2 but we will do our best!:</p>
<p><a href="http://sourceforge.net/pm/task.php?group_project_id=13524&group_id=7885&func=browse" target="_new">http://sourceforge.net/pm/task.php?group_project_id=13524&group_id=7885</a></p>
<p>We do not guarantee that all these will appear in 2.2 but we will do our best! If your idea does not appear on this list please visit our feature request list:</p>
<p><a href="http://sourceforge.net/tracker/?atid=357885&group_id=7885&func=browse" target="_new">http://sourceforge.net/tracker/?atid=357885&group_id=7885</a></p>
<p><a href="http://sourceforge.net/tracker/?atid=580201&group_id=7885&func=browse" target="_new">http://sourceforge.net/tracker/?atid=580201&group_id=7885&func=browse</a></p>
<p>Before submitting your idea please <b>ensure</b> you have read through the entries in that list. If your idea is similar to an existing one please feel free to add a comment to it. Please <b>do not</b> submit duplicate suggestions!</p>
<p>For some suggestions we may ask for your feedback via our forums. For those interested in the development of phpBB 2.2 you should keep an eye on the community forums (particularly the Feature Discussion forum) where you may be able to influence the direction we take with certain new features. Finally you may like to visit our development forum to see how things are progressing:</p>
<p>For some suggestions we may ask for your feedback via our forums. For those interested in the development of phpBB 3.0 you should keep an eye on the community forums (particularly the Feature Discussion forum) where you may be able to influence the direction we take with certain new features. Finally you may like to visit our development forum to see how things are progressing:</p>
<p><a href="http://area51.phpbb.com/phpBB 2/" target="_new">http://area51.phpbb.com/phpBB 2/</a></p>
<p><a href="http://area51.phpbb.com/phpBB/" target="_new">http://area51.phpbb.com/phpBB/</a></p>
<p>Please note that this forum should <b>NOT</b> be used to obtain support for or ask questions about phpBB 2.0.x, the main community forums are the place for this. Any such posts will be locked and go unanswered.</p>
@@ -177,9 +173,9 @@ p,ul,td {font-size:10pt;}
<a name="securitybugs"></a><h3 class="h3">5.i. Security related bugs</h3>
<p>If you find a potential security related vulnerability in phpBB 2 please <b>DO NOT</b> post it to the bug tracker, public forums, mailing lists, etc.! Doing so may allow unscrupulous users to take advantage of it before we have time to put a fix in place. All security related bugs should be sent directly to one or more of the developers.</p>
<p>If you find a potential security related vulnerability in phpBB 2 please <b>DO NOT</b> post it to the bug tracker, public forums, mailing lists, etc.! Doing so may allow unscrupulous users to take advantage of it before we have time to put a fix in place. All security related bugs should be sent to our security tracker:</p>
<p>This can be done in one of three ways; email <a href="mailto:security&#64;phpbb.com">security&#64;phpbb.com</a> this is forwarded to all developers, PM one of the developers (see Developer usergroup list for usernames of all developers) or email them directly (either use their listed email address if available or username&#64;phpbb.com where username is their board username). If emailing or PM'ing developers individually please send the message to several and not just one. If you obtain no response in a reasonable timeframe (a day or two) try the other listed developers.</p>
<p><a href="http://www.phpbb.com/security/" target="_new">http://www.phpbb.com/security/</a></p>
<a name="curbugs"></a><h2 class="h2"><u>6. Overview of current bug list</u></h2>
@@ -191,14 +187,19 @@ p,ul,td {font-size:10pt;}
<li>By default cannot post very large messages with MSSQL (this can be configured within MSSQL)</li>
<li>Use of non-latin charsets with MSSQL may result in post data being cropped unexpectedly</li>
<li>Upgrade may fail to complete on large boards under some hosts</li>
<li>PHP 3 compatibility issues remain and we recommend you upgrade to PHP4 as soon as possible ( phpBB 2.0.x will be the last version to support PHP 3 )
<li>Case-sensitivity on usernames and emails with PostgreSQL 7.x. A fix is provided by a user <a href="http://www.phpbb.com/kb/article.php?article_id=201" target="_new">within our knowledge base</a></li>
</ul>
<a name="php"></a><h2 class="h2"><u>7. PHP compatibility issues</u></h2>
<p>phpBB is no longer supported on PHP3 due to several compatibility issues and we recommend that you upgrade to the latest stable release of PHP4 to run phpBB.</p>
<p>Please remember that running any application on a developmental version of PHP can lead to strange/unexpected results which may appear to be bugs in the application (which may not be true). Therefore we recommend you upgrade to the newest stable version of PHP before running phpBB 2. If you are running a developmental version of PHP please check any bugs you find on a system running a stable release before submitting.</p>
<p>This board has been developed and tested under Linux and Windows (amongst others) running IIS and Apache using MySQL 3.23 and 4.0.0, MSSQL Server 2000, MS Access 2000 and XP and PostgreSQL 7.x. Versions of PHP used range from 4.0.6 to 4.2.3 without problem. There may be unconfirmed issues with PHP 4.0.1 including patch level releases. If you experience problems with phpBB and have this PHP version installed it is recommended you upgrade it before posting bug reports.</p>
<p>This board has been developed and tested under Linux and Windows (amongst others) running IIS and Apache using MySQL 3.23 and 4.0.0, MSSQL Server 2000, MS Access 2000 and XP and PostgreSQL 7.x. Versions of PHP used range from 4.0.6 to 4.3.8 without problem. There may be unconfirmed issues with PHP 4.0.1 including patch level releases. If you experience problems with phpBB and have this PHP version installed it is recommended you upgrade it before posting bug reports.</p>
<p>With the recent release of the official version of PHP 5, people and hosts may be switching to the latest PHP version. At this moment, the phpBB Team does not officially support running phpBB on PHP 5, as phpBB2.0.x was not written with PHP 5 in mind. However, many users have reported using it sucessfully on PHP 5 having made a configuration change in PHP to enable support for the deprecated HTTP_*_VARS arrays which is turned off by default in new PHP 5 installations. The relevant configuration option is register_long_arrays and it is decribed in the PHP Manual. phpBB 2.0.x makes use of these arrays in order to maintain backwards compatibility with early versions of PHP 4.x which is part of the original specification.<br />
For this reason we do not support PHP 5 as platform for phpBB. It has been reported working, so you can try it. It's a risk you will be taking though.</p>
<a name="phpsec"></a><h3 class="h3">7.i. Notice on PHP security issues</h3>

View File

@@ -337,7 +337,7 @@ else if ( isset($HTTP_POST_VARS['unsub']) || isset($HTTP_POST_VARS['unsubpending
message_die(GENERAL_ERROR, 'Could not obtain moderator status', '', __LINE__, __FILE__, $sql);
}
if ( !($row = $db->sql_fetchrow($result)) )
if ( !($row = $db->sql_fetchrow($result)) || $row['is_auth_mod'] == 0 )
{
$sql = "UPDATE " . USERS_TABLE . "
SET user_level = " . USER . "
@@ -472,7 +472,7 @@ else if ( $group_id )
if ( isset($HTTP_POST_VARS['add']) )
{
$username = ( isset($HTTP_POST_VARS['username']) ) ? htmlspecialchars($HTTP_POST_VARS['username']) : '';
$username = ( isset($HTTP_POST_VARS['username']) ) ? phpbb_clean_username($HTTP_POST_VARS['username']) : '';
$sql = "SELECT user_id, user_email, user_lang, user_level
FROM " . USERS_TABLE . "

View File

@@ -124,6 +124,8 @@ function bbencode_second_pass($text, $uid)
{
global $lang, $bbcode_tpl;
$text = preg_replace('#(script|about|applet|activex|chrome):#is', "\\1&#058;", $text);
// pad it with a space so we can distinguish between FALSE and matching the 1st char (index 0).
// This is important; bbencode_quote(), bbencode_list(), and bbencode_code() all depend on it.
$text = " " . $text;
@@ -194,23 +196,23 @@ function bbencode_second_pass($text, $uid)
// [img]image_url_here[/img] code..
// This one gets first-passed..
$patterns[] = "#\[img:$uid\](.*?)\[/img:$uid\]#si";
$patterns[] = "#\[img:$uid\]([^?].*?)\[/img:$uid\]#i";
$replacements[] = $bbcode_tpl['img'];
// matches a [url]xxxx://www.phpbb.com[/url] code..
$patterns[] = "#\[url\]([\w]+?://[^ \"\n\r\t<]*?)\[/url\]#is";
$patterns[] = "#\[url\]([\w]+?://[\w\#$%&~/.\-;:=,?@\[\]+]*?)\[/url\]#is";
$replacements[] = $bbcode_tpl['url1'];
// [url]www.phpbb.com[/url] code.. (no xxxx:// prefix).
$patterns[] = "#\[url\]((www|ftp)\.[^ \"\n\r\t<]*?)\[/url\]#is";
$patterns[] = "#\[url\]((www|ftp)\.[\w\#$%&~/.\-;:=,?@\[\]+]*?)\[/url\]#is";
$replacements[] = $bbcode_tpl['url2'];
// [url=xxxx://www.phpbb.com]phpBB[/url] code..
$patterns[] = "#\[url=([\w]+?://[^ \"\n\r\t<]*?)\](.*?)\[/url\]#is";
$patterns[] = "#\[url=([\w]+?://[\w\#$%&~/.\-;:=,?@\[\]+]*?)\]([^?\n\r\t].*?)\[/url\]#is";
$replacements[] = $bbcode_tpl['url3'];
// [url=www.phpbb.com]phpBB[/url] code.. (no xxxx:// prefix).
$patterns[] = "#\[url=((www|ftp)\.[^ \"\n\r\t<]*?)\](.*?)\[/url\]#is";
$patterns[] = "#\[url=((www|ftp)\.[\w\#$%&~/.\-;:=,?@\[\]+]*?)\]([^?\n\r\t].*?)\[/url\]#is";
$replacements[] = $bbcode_tpl['url4'];
// [email]user@domain.tld[/email] code..
@@ -614,6 +616,7 @@ function bbencode_second_pass_code($text, $uid, $bbcode_tpl)
*/
function make_clickable($text)
{
$text = preg_replace('#(script|about|applet|activex|chrome):#is', "\\1&#058;", $text);
// pad it with a space so we can match things at the start of the 1st line.
$ret = ' ' . $text;
@@ -621,13 +624,13 @@ function make_clickable($text)
// matches an "xxxx://yyyy" URL at the start of a line, or after a space.
// xxxx can only be alpha characters.
// yyyy is anything up to the first space, newline, comma, double quote or <
$ret = preg_replace("#(^|[\n ])([\w]+?://[^ \"\n\r\t<]*)#is", "\\1<a href=\"\\2\" target=\"_blank\">\\2</a>", $ret);
$ret = preg_replace("#(^|[\n ])([\w]+?://[\w\#$%&~/.\-;:=,?@\[\]+]*)#is", "\\1<a href=\"\\2\" target=\"_blank\">\\2</a>", $ret);
// matches a "www|ftp.xxxx.yyyy[/zzzz]" kinda lazy URL thing
// Must contain at least 2 dots. xxxx contains either alphanum, or "-"
// zzzz is optional.. will contain everything up to the first space, newline,
// comma, double quote or <.
$ret = preg_replace("#(^|[\n ])((www|ftp)\.[^ \"\t\n\r<]*)#is", "\\1<a href=\"http://\\2\" target=\"_blank\">\\2</a>", $ret);
$ret = preg_replace("#(^|[\n ])((www|ftp)\.[\w\#$%&~/.\-;:=,?@\[\]+]*)#is", "\\1<a href=\"http://\\2\" target=\"_blank\">\\2</a>", $ret);
// matches an email@domain type address at the start of a line, or after a space.
// Note: Only the followed chars are valid; alphanums, "-", "_" and or ".".

View File

@@ -148,6 +148,7 @@ define('AUTH_ATTACH', 11);
// Table names
define('CONFIRM_TABLE', $table_prefix.'confirm');
define('AUTH_ACCESS_TABLE', $table_prefix.'auth_access');
define('BANLIST_TABLE', $table_prefix.'banlist');
define('CATEGORIES_TABLE', $table_prefix.'categories');

View File

@@ -74,6 +74,42 @@ function get_db_stat($mode)
return false;
}
// added at phpBB 2.0.11 to properly format the username
function phpbb_clean_username($username)
{
$username = substr(htmlspecialchars(str_replace("\'", "'", trim($username))), 0, 25);
$username = phpbb_rtrim($username, "\\");
$username = str_replace("'", "\'", $username);
return $username;
}
// added at phpBB 2.0.12 to fix a bug in PHP 4.3.10 (only supporting charlist in php >= 4.1.0)
function phpbb_rtrim($str, $charlist = false)
{
if ($charlist === false)
{
return rtrim($str);
}
$php_version = explode('.', PHP_VERSION);
// php version < 4.1.0
if ((int) $php_version[0] < 4 || ((int) $php_version[0] == 4 && (int) $php_version[1] < 1))
{
while ($str{strlen($str)-1} == $charlist)
{
$str = substr($str, 0, strlen($str)-1);
}
}
else
{
$str = rtrim($str, $charlist);
}
return $str;
}
//
// Get Userdata, $user can be username or user_id. If force_str is true, the username will be forced.
//
@@ -81,11 +117,9 @@ function get_userdata($user, $force_str = false)
{
global $db;
if (intval($user) == 0 || $force_str)
if (!is_numeric($user) || $force_str)
{
$user = trim(htmlspecialchars($user));
$user = substr(str_replace("\\'", "'", $user), 0, 25);
$user = str_replace("'", "\\'", $user);
$user = phpbb_clean_username($user);
}
else
{
@@ -188,10 +222,11 @@ function make_jumpbox($action, $match_forum_id = 0)
$boxstring .= '<select name="' . POST_FORUM_URL . '" onchange="if(this.options[this.selectedIndex].value != -1){ forms[\'jumpbox\'].submit() }"></select>';
}
if ( !empty($SID) )
{
// Let the jumpbox work again in sites having additional session id checks.
// if ( !empty($SID) )
// {
$boxstring .= '<input type="hidden" name="sid" value="' . $userdata['session_id'] . '" />';
}
// }
$template->set_filenames(array(
'jumpbox' => 'jumpbox.tpl')
@@ -543,7 +578,7 @@ function message_die($msg_code, $msg_text = '', $msg_title = '', $err_line = '',
die("message_die() was called multiple times. This isn't supposed to happen. Was message_die() used in page_tail.php?");
}
define(HAS_DIED, 1);
define('HAS_DIED', 1);
$sql_store = $sql;
@@ -570,7 +605,7 @@ function message_die($msg_code, $msg_text = '', $msg_title = '', $err_line = '',
if ( $err_line != '' && $err_file != '' )
{
$debug_text .= '</br /><br />Line : ' . $err_line . '<br />File : ' . $err_file;
$debug_text .= '</br /><br />Line : ' . $err_line . '<br />File : ' . basename($err_file);
}
}
@@ -744,6 +779,11 @@ function redirect($url)
$db->sql_close();
}
if (strstr(urldecode($url), "\n") || strstr(urldecode($url), "\r"))
{
message_die(GENERAL_ERROR, 'Tried to redirect to potentially insecure url.');
}
$server_protocol = ($board_config['cookie_secure']) ? 'https://' : 'http://';
$server_name = preg_replace('#^\/?(.*?)\/?$#', '\1', trim($board_config['server_name']));
$server_port = ($board_config['server_port'] <> 80) ? ':' . trim($board_config['server_port']) : '';

View File

@@ -128,7 +128,7 @@ function prepare_post(&$mode, &$post_data, &$bbcode_on, &$html_on, &$smilies_on,
// Check username
if (!empty($username))
{
$username = trim(strip_tags($username));
$username = phpbb_clean_username($username);
if (!$userdata['session_logged_in'] || ($userdata['session_logged_in'] && $username != $userdata['username']))
{

View File

@@ -435,7 +435,7 @@ function username_search($search_match)
$username_list = '';
if ( !empty($search_match) )
{
$username_search = preg_replace('/\*/', '%', trim(strip_tags($search_match)));
$username_search = preg_replace('/\*/', '%', phpbb_clean_username($search_match));
$sql = "SELECT username
FROM " . USERS_TABLE . "
@@ -469,7 +469,7 @@ function username_search($search_match)
);
$template->assign_vars(array(
'USERNAME' => ( !empty($search_match) ) ? strip_tags($search_match) : '',
'USERNAME' => (!empty($search_match)) ? phpbb_clean_username($search_match) : '',
'L_CLOSE_WINDOW' => $lang['Close_window'],
'L_SEARCH_USERNAME' => $lang['Find_username'],

View File

@@ -108,4 +108,4 @@ function tz_select($default, $select_name = 'timezone')
return $tz_select;
}
?>
?>

View File

@@ -30,11 +30,9 @@ function validate_username($username)
global $db, $lang, $userdata;
// Remove doubled up spaces
$username = preg_replace('#\s+#', ' ', $username);
// Limit username length
$username = substr(str_replace("\'", "'", $username), 0, 25);
$username = str_replace("'", "''", $username);
$username = preg_replace('#\s+#', ' ', trim($username));
$username = phpbb_clean_username($username);
$sql = "SELECT username
FROM " . USERS_TABLE . "
WHERE LOWER(username) = '" . strtolower($username) . "'";

View File

@@ -35,7 +35,7 @@ if ( $board_config['gzip_compress'] )
{
$phpver = phpversion();
$useragent = (isset($_SERVER["HTTP_USER_AGENT"]) ) ? $_SERVER["HTTP_USER_AGENT"] : $HTTP_USER_AGENT;
$useragent = (isset($HTTP_SERVER_VARS['HTTP_USER_AGENT'])) ? $HTTP_SERVER_VARS['HTTP_USER_AGENT'] : getenv('HTTP_USER_AGENT');
if ( $phpver >= '4.0.4pl1' && ( strstr($useragent,'compatible') || strstr($useragent,'Gecko') ) )
{
@@ -466,7 +466,7 @@ else
// Work around for "current" Apache 2 + PHP module which seems to not
// cope with private cache control setting
if (!empty($_SERVER['SERVER_SOFTWARE']) && strstr($_SERVER['SERVER_SOFTWARE'], 'Apache/2'))
if (!empty($HTTP_SERVER_VARS['SERVER_SOFTWARE']) && strstr($HTTP_SERVER_VARS['SERVER_SOFTWARE'], 'Apache/2'))
{
header ('Cache-Control: no-cache, pre-check=0, post-check=0');
}

View File

@@ -35,8 +35,7 @@ $template->set_filenames(array(
);
$template->assign_vars(array(
'PHPBB_VERSION' => '2' . $board_config['version'],
'TRANSLATION_INFO' => ( isset($lang['TRANSLATION_INFO']) ) ? $lang['TRANSLATION_INFO'] : '',
'TRANSLATION_INFO' => ( isset($lang['TRANSLATION_INFO']) ) ? $lang['TRANSLATION_INFO'] : '',
'ADMIN_LINK' => $admin_link)
);

View File

@@ -24,7 +24,7 @@
// Adds/updates a new session to the database for the given userid.
// Returns the new session ID on success.
//
function session_begin($user_id, $user_ip, $page_id, $auto_create = 0, $enable_autologin = 0)
function session_begin($user_id, $user_ip, $page_id, $auto_create = 0, $enable_autologin = 0, $admin = 0)
{
global $db, $board_config;
global $HTTP_COOKIE_VARS, $HTTP_GET_VARS, $SID;
@@ -53,6 +53,8 @@ function session_begin($user_id, $user_ip, $page_id, $auto_create = 0, $enable_a
$session_id = '';
}
$page_id = (int) $page_id;
$last_visit = 0;
$current_time = time();
$expiry_time = $current_time - $board_config['session_length'];
@@ -79,7 +81,7 @@ function session_begin($user_id, $user_ip, $page_id, $auto_create = 0, $enable_a
if ( isset($sessiondata['autologinid']) && $userdata['user_active'] )
{
// We have to login automagically
if( $sessiondata['autologinid'] == $auto_login_key )
if( $sessiondata['autologinid'] === $auto_login_key )
{
// autologinid matches password
$login = 1;
@@ -91,6 +93,11 @@ function session_begin($user_id, $user_ip, $page_id, $auto_create = 0, $enable_a
$login = 0;
$enable_autologin = 0;
$user_id = $userdata['user_id'] = ANONYMOUS;
$sql = 'SELECT * FROM ' . USERS_TABLE . ' WHERE user_id = ' . ANONYMOUS;
$result = $db->sql_query($sql);
$userdata = $db->sql_fetchrow($result);
$db->sql_freeresult($result);
}
}
else
@@ -99,6 +106,11 @@ function session_begin($user_id, $user_ip, $page_id, $auto_create = 0, $enable_a
$login = 0;
$enable_autologin = 0;
$user_id = $userdata['user_id'] = ANONYMOUS;
$sql = 'SELECT * FROM ' . USERS_TABLE . ' WHERE user_id = ' . ANONYMOUS;
$result = $db->sql_query($sql);
$userdata = $db->sql_fetchrow($result);
$db->sql_freeresult($result);
}
}
else
@@ -143,16 +155,18 @@ function session_begin($user_id, $user_ip, $page_id, $auto_create = 0, $enable_a
// Create or update the session
//
$sql = "UPDATE " . SESSIONS_TABLE . "
SET session_user_id = $user_id, session_start = $current_time, session_time = $current_time, session_page = $page_id, session_logged_in = $login
SET session_user_id = $user_id, session_start = $current_time, session_time = $current_time, session_page = $page_id, session_logged_in = $login, session_admin = $admin
WHERE session_id = '" . $session_id . "'
AND session_ip = '$user_ip'";
if ( !$db->sql_query($sql) || !$db->sql_affectedrows() )
{
$session_id = md5(uniqid($user_ip));
list($sec, $usec) = explode(' ', microtime());
mt_srand((float) $sec + ((float) $usec * 100000));
$session_id = md5(uniqid(mt_rand(), true));
$sql = "INSERT INTO " . SESSIONS_TABLE . "
(session_id, session_user_id, session_start, session_time, session_ip, session_page, session_logged_in)
VALUES ('$session_id', $user_id, $current_time, $current_time, '$user_ip', $page_id, $login)";
(session_id, session_user_id, session_start, session_time, session_ip, session_page, session_logged_in, session_admin)
VALUES ('$session_id', $user_id, $current_time, $current_time, '$user_ip', $page_id, $login, $admin)";
if ( !$db->sql_query($sql) )
{
message_die(CRITICAL_ERROR, 'Error creating new session', '', __LINE__, __FILE__, $sql);
@@ -163,17 +177,20 @@ function session_begin($user_id, $user_ip, $page_id, $auto_create = 0, $enable_a
{// ( $userdata['user_session_time'] > $expiry_time && $auto_create ) ? $userdata['user_lastvisit'] : (
$last_visit = ( $userdata['user_session_time'] > 0 ) ? $userdata['user_session_time'] : $current_time;
$sql = "UPDATE " . USERS_TABLE . "
SET user_session_time = $current_time, user_session_page = $page_id, user_lastvisit = $last_visit
WHERE user_id = $user_id";
if ( !$db->sql_query($sql) )
if (!$admin)
{
message_die(CRITICAL_ERROR, 'Error updating last visit time', '', __LINE__, __FILE__, $sql);
$sql = "UPDATE " . USERS_TABLE . "
SET user_session_time = $current_time, user_session_page = $page_id, user_lastvisit = $last_visit
WHERE user_id = $user_id";
if ( !$db->sql_query($sql) )
{
message_die(CRITICAL_ERROR, 'Error updating last visit time', '', __LINE__, __FILE__, $sql);
}
}
$userdata['user_lastvisit'] = $last_visit;
$sessiondata['autologinid'] = ( $enable_autologin && $sessionmethod == SESSION_METHOD_COOKIE ) ? $auto_login_key : '';
$sessiondata['autologinid'] = (!$admin) ? (( $enable_autologin && $sessionmethod == SESSION_METHOD_COOKIE ) ? $auto_login_key : '') : $sessiondata['autologinid'];
$sessiondata['userid'] = $user_id;
}
@@ -184,6 +201,7 @@ function session_begin($user_id, $user_ip, $page_id, $auto_create = 0, $enable_a
$userdata['session_page'] = $page_id;
$userdata['session_start'] = $current_time;
$userdata['session_time'] = $current_time;
$userdata['session_admin'] = $admin;
setcookie($cookiename . '_data', serialize($sessiondata), $current_time + 31536000, $cookiepath, $cookiedomain, $cookiesecure);
setcookie($cookiename . '_sid', $session_id, 0, $cookiepath, $cookiedomain, $cookiesecure);
@@ -229,6 +247,8 @@ function session_pagestart($user_ip, $thispage_id)
$session_id = '';
}
$thispage_id = (int) $thispage_id;
//
// Does a session exist?
//
@@ -271,8 +291,11 @@ function session_pagestart($user_ip, $thispage_id)
//
if ( $current_time - $userdata['session_time'] > 60 )
{
// A little trick to reset session_admin on session re-usage
$update_admin = (!defined('IN_ADMIN') && $current_time - $userdata['session_time'] > ($board_config['session_length']+60)) ? ', session_admin = 0' : '';
$sql = "UPDATE " . SESSIONS_TABLE . "
SET session_time = $current_time, session_page = $thispage_id
SET session_time = $current_time, session_page = $thispage_id$update_admin
WHERE session_id = '" . $userdata['session_id'] . "'";
if ( !$db->sql_query($sql) )
{
@@ -282,7 +305,7 @@ function session_pagestart($user_ip, $thispage_id)
if ( $userdata['user_id'] != ANONYMOUS )
{
$sql = "UPDATE " . USERS_TABLE . "
SET user_session_time = $current_time, user_session_page = $thispage_id
SET user_session_time = $current_time, user_session_page = $thispage_id
WHERE user_id = " . $userdata['user_id'];
if ( !$db->sql_query($sql) )
{
@@ -294,6 +317,7 @@ function session_pagestart($user_ip, $thispage_id)
// Delete expired sessions
//
$expiry_time = $current_time - $board_config['session_length'];
$sql = "DELETE FROM " . SESSIONS_TABLE . "
WHERE session_time < $expiry_time
AND session_id <> '$session_id'";

View File

@@ -106,7 +106,7 @@ function smtpmail($mail_to, $subject, $message, $headers = '')
// Ok we have error checked as much as we can to this point let's get on
// it already.
if( !$socket = fsockopen($board_config['smtp_host'], 25, $errno, $errstr, 20) )
if( !$socket = @fsockopen($board_config['smtp_host'], 25, $errno, $errstr, 20) )
{
message_die(GENERAL_ERROR, "Could not connect to smtp host : $errno : $errstr", "", __LINE__, __FILE__);
}

View File

@@ -230,7 +230,7 @@ class Template {
// Check if it's an absolute or relative path.
if (substr($filename, 0, 1) != '/')
{
$filename = phpbb_realpath($this->root . '/' . $filename);
$filename = ($rp_filename = phpbb_realpath($this->root . '/' . $filename)) ? $rp_filename : $filename;
}
if (!file_exists($filename))
@@ -475,4 +475,4 @@ class Template {
}
?>
?>

View File

@@ -30,9 +30,9 @@ function topic_review($topic_id, $is_inline_review)
if ( !$is_inline_review )
{
if ( !isset($topic_id) )
if ( !isset($topic_id) || !$topic_id)
{
message_die(GENERAL_MESSAGE, 'Topic_not_exist');
message_die(GENERAL_MESSAGE, 'Topic_post_not_exist');
}
//
@@ -225,4 +225,4 @@ function topic_review($topic_id, $is_inline_review)
}
}
?>
?>

View File

@@ -47,6 +47,11 @@ if ( $row = $db->sql_fetchrow($result) )
}
else if ((trim($row['user_actkey']) == trim($HTTP_GET_VARS['act_key'])) && (trim($row['user_actkey']) != ''))
{
if (intval($board_config['require_activation']) == USER_ACTIVATION_ADMIN && $userdata['user_level'] != ADMIN)
{
message_die(GENERAL_MESSAGE, $lang['Not_Authorised']);
}
$sql_update_pass = ( $row['user_newpasswd'] != '' ) ? ", user_password = '" . str_replace("\'", "''", $row['user_newpasswd']) . "', user_newpasswd = ''" : '';
$sql = "UPDATE " . USERS_TABLE . "

View File

@@ -51,6 +51,7 @@ function user_avatar_delete($avatar_type, $avatar_file)
{
global $board_config, $userdata;
$avatar_file = basename($avatar_file);
if ( $avatar_type == USER_AVATAR_UPLOAD && $avatar_file != '' )
{
if ( @file_exists(@phpbb_realpath('./' . $board_config['avatar_path'] . '/' . $avatar_file)) )
@@ -65,6 +66,13 @@ function user_avatar_delete($avatar_type, $avatar_file)
function user_avatar_gallery($mode, &$error, &$error_msg, $avatar_filename)
{
global $board_config;
$avatar_filename = str_replace(array('../', '..\\', './', '.\\'), '', $avatar_filename);
if ($avatar_filename{0} == '/' || $avatar_filename{0} == "\\")
{
return '';
}
if ( file_exists(@phpbb_realpath($board_config['avatar_gallery_path'] . '/' . $avatar_filename)) && ($mode == 'editprofile') )
{
$return = ", user_avatar = '" . str_replace("\'", "''", $avatar_filename) . "', user_avatar_type = " . USER_AVATAR_GALLERY;
@@ -78,6 +86,8 @@ function user_avatar_gallery($mode, &$error, &$error_msg, $avatar_filename)
function user_avatar_url($mode, &$error, &$error_msg, $avatar_filename)
{
global $lang;
if ( !preg_match('#^(http)|(ftp):\/\/#i', $avatar_filename) )
{
$avatar_filename = 'http://' . $avatar_filename;
@@ -191,7 +201,7 @@ function user_avatar_upload($mode, $avatar_mode, &$current_avatar, &$current_typ
return;
}
if ( $width <= $board_config['avatar_max_width'] && $height <= $board_config['avatar_max_height'] )
if ( $width > 0 && $height > 0 && $width <= $board_config['avatar_max_width'] && $height <= $board_config['avatar_max_height'] )
{
$new_filename = uniqid(rand()) . $imgtype;
@@ -224,6 +234,10 @@ function user_avatar_upload($mode, $avatar_mode, &$current_avatar, &$current_typ
$move_file = 'copy';
}
if (!is_uploaded_file($avatar_filename))
{
message_die(GENERAL_ERROR, 'Unable to upload file', '', __LINE__, __FILE__);
}
$move_file($avatar_filename, './' . $board_config['avatar_path'] . "/$new_filename");
}

View File

@@ -0,0 +1,435 @@
<?php
/***************************************************************************
* usercp_confirm.php
* -------------------
* begin : Saturday, Jan 15, 2003
* copyright : (C) 2001 The phpBB Group
* email : support@phpbb.com
*
* $Id$
*
***************************************************************************/
/***************************************************************************
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
***************************************************************************/
if ( !defined('IN_PHPBB') )
{
die('Hacking attempt');
exit;
}
// Note to potential users of this code ...
//
// Remember this is released under the _GPL_ and is subject
// to that licence. Do not incorporate this within software
// released or distributed in any way under a licence other
// than the GPL. We will be watching ... ;)
// Do we have an id? No, then just exit
if (empty($HTTP_GET_VARS['id']))
{
exit;
}
$confirm_id = htmlspecialchars($HTTP_GET_VARS['id']);
// Define available charset
$chars = array('A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '1', '2', '3', '4', '5', '6', '7', '8', '9');
if (!preg_match('/^[A-Za-z0-9]+$/', $confirm_id))
{
$confirm_id = '';
}
// Try and grab code for this id and session
$sql = 'SELECT code
FROM ' . CONFIRM_TABLE . "
WHERE session_id = '" . $userdata['session_id'] . "'
AND confirm_id = '$confirm_id'";
$result = $db->sql_query($sql);
// If we have a row then grab data else create a new id
if ($row = $db->sql_fetchrow($result))
{
$db->sql_freeresult($result);
$code = $row['code'];
}
else
{
exit;
}
// If we can we will generate a single filtered png else we will have to simply
// output six seperate original pngs ... first way is preferable!
if (@extension_loaded('zlib'))
{
$_png = define_filtered_pngs();
$total_width = 320;
$total_height = 50;
$img_height = 40;
$img_width = 0;
$l = 0;
list($usec, $sec) = explode(' ', microtime());
mt_srand($sec * $usec);
$char_widths = array();
for ($i = 0; $i < strlen($code); $i++)
{
$char = $code{$i};
$width = mt_rand(0, 4);
$char_widths[] = $width;
$img_width += $_png[$char]['width'] - $width;
}
$offset_x = mt_rand(0, $total_width - $img_width);
$offset_y = mt_rand(0, $total_height - $img_height);
$image = '';
$hold_chars = array();
for ($i = 0; $i < $total_height; $i++)
{
$image .= chr(0);
if ($i > $offset_y && $i < $offset_y + $img_height)
{
$j = 0;
for ($k = 0; $k < $offset_x; $k++)
{
$image .= chr(mt_rand(140, 255));
}
for ($k = 0; $k < strlen($code); $k++)
{
$char = $code{$k};
if (empty($hold_chars[$char]))
{
$hold_chars[$char] = explode("\n", chunk_split(base64_decode($_png[$char]['data']), $_png[$char]['width'] + 1, "\n"));
}
$image .= randomise(substr($hold_chars[$char][$l], 1), $char_widths[$j]);
$j++;
}
for ($k = $offset_x + $img_width; $k < $total_width; $k++)
{
$image .= chr(mt_rand(140, 255));
}
$l++;
}
else
{
for ($k = 0; $k < $total_width; $k++)
{
$image .= chr(mt_rand(140, 255));
}
}
}
unset($hold);
$image = create_png(gzcompress($image), $total_width, $total_height);
// Output image
header('Content-Type: image/png');
header('Cache-control: no-cache, no-store');
echo $image;
unset($image);
unset($_png);
exit;
}
else
{
if (!empty($HTTP_GET_VARS['c']))
{
$_png = define_raw_pngs();
$char = substr($code, intval($HTTP_GET_VARS['c']) - 1, 1);
header('Content-Type: image/png');
header('Cache-control: no-cache, no-store');
echo base64_decode($_png[$char]);
unset($_png);
exit;
}
}
exit;
// This is designed to randomise the pixels of the image data within
// certain limits so as to keep it readable. It also varies the image
// width a little
function randomise($scanline, $width)
{
$new_line = '';
$start = floor($width/2);
$end = strlen($scanline) - ceil($width/2);
for ($i = $start; $i < $end; $i++)
{
$pixel = ord($scanline{$i});
if ($pixel < 190)
{
$new_line .= chr(mt_rand(0, 205));
}
else if ($pixel > 190)
{
$new_line .= chr(mt_rand(145, 255));
}
else
{
$new_line .= $scanline{$i};
}
}
return $new_line;
}
// This creates a chunk of the given type, with the given data
// of the given length adding the relevant crc
function png_chunk($length, $type, $data)
{
$raw = $type;
$raw .= $data;
$crc = crc32($raw);
$raw .= pack('C4', $crc >> 24, $crc >> 16, $crc >> 8, $crc);
return pack('C4', $length >> 24, $length >> 16, $length >> 8, $length) . $raw;
}
// Creates greyscale 8bit png - The PNG spec can be found at
// http://www.libpng.org/pub/png/spec/PNG-Contents.html we use
// png because it's a fully recognised open standard and supported
// by practically all modern browsers and OSs
function create_png($gzimage, $width, $height)
{
// SIG
$image = pack('C8', 137, 80, 78, 71, 13, 10, 26, 10);
// IHDR
$raw = pack('C4', $width >> 24, $width >> 16, $width >> 8, $width);
$raw .= pack('C4', $height >> 24, $height >> 16, $height >> 8, $height);
$raw .= pack('C5', 8, 0, 0, 0, 0);
$image .= png_chunk(13, 'IHDR', $raw);
// IDAT
$image .= png_chunk(strlen($gzimage), 'IDAT', $gzimage);
// IEND
$image .= png_chunk(0, 'IEND', '');
return $image;
}
// Each 'data' element is base64_encoded uncompressed IDAT
// png image data
function define_filtered_pngs()
{
$_png = array(
'0' => array(
'data' => 'AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A///////////////////olFAkBAAAGDyA4P///M31/////////////wD////////////////0dAgAAAAAAAAAAAAEcPipFGHn////////////AP//////////////6DAAAAAAAAAAAAAAAAAALSEAN+T///////////8A//////////////xAAAAAAAAAAAAAAAAAAAAAACPA/////////////wD/////////////oAAAAAAAAAAAAAAAAAAAAAAAev//////////////AP////////////8oAAAAAAAAPNj/zDAAAAAAAABD//////////////8A////////////1AAAAAAAABjw////5BAAAAAAAADo/////////////wD///////////+QAAAAAAAAbP//////QgAAAAAAAKj/////////////AP///////////1wAAAAAAACs/////8AXAAAAAAAAcP////////////8A////////////OAAAAAAAAND////dNwAAAAAAAABI/////////////wD///////////8gAAAAAAAA4P//7koACwAAAAAAACT/////////////AP///////////wgAAAAAAAD///VqAwaPAAAAAAAAEP////////////8A////////////AAAAAAAAAP/8kQYDavUAAAAAAAAA/////////////wD///////////8AAAAAAAAA/6kNAEru/wAAAAAAAAD/////////////AP///////////wAAAAAAAADAIwA33f//AAAAAAAAAP////////////8A////////////FAAAAAAAADYAI8D///8AAAAAAAAQ/////////////wD///////////8kAAAAAAAAAA2p////5AAAAAAAACD/////////////AP///////////0gAAAAAAAAFkfz////UAAAAAAAAQP////////////8A////////////cAAAAAAAAET1/////7AAAAAAAABo/////////////wD///////////+oAAAAAAAAXfX/////sAAAAAAAAGj/////////////AAAAALgAAAAAAAAwAAAAAAAAAAAAAAD////////////oAAAAAAAACOT////oEAAAAAAAAOD/////////////AP////////////8+AAAAAAAAKMz/zDQAAAAAAAA0//////////////8A////////////7jgAAAAAAAAAAAAAAAAAAAAAAKT//////////////wD///////////VqAwIAAAAAAAAAAAAAAAAAAAA8////////////////AP//////////rQcDaVEAAAAAAAAAAAAAAAAAKOj///////////////8A///////////nblnu/IAIAAAAAAAAAAAAAFzw/////////////////wD////////////79////+iITCAAAAAgSITg////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////w==',
'width' => 40
),
'1' => array(
'data' => 'AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////8BAAAAAAAP//////////////////AP////////////////////////9sAAAAAAAA//////////////////8A////////////////////////pAAAAAAAAAD//////////////////wD//////////////////////6wEAAAAAAAAAP//////////////////AP////////////////////h4AAAAAAAAAAAA//////////////////8A//////////////////ygJAAAAAAAAAAAAAD//////////////////wD//////////////9x8HAAAAAAAAAAAAAAAAP//////////////////AP//////////////AAAAAAAAAAAAAAAAAAAA//////////////////8A//////////////8AAAAAAAAAAAAAAAAAAAD//////////////////wD//////////////wAAAAAAAAR4AAAAAAAAAP//////////////////AP//////////////AAAAAAA4zP8AAAAAAAAA//////////////////8A//////////////8AAAA4sP///wAAAAAAAAD//////////////////wD//////////////yR80P//////AAAAAAAAAP//////////////////AP////////////////////////8AAAAAAAAA//////////////////8A/////////////////////////wAAAAAAAAD//////////////////wD/////////////////////////AAAAAAAAAP//////////////////AP////////////////////////8AAAAAAAAA//////////////////8A/////////////////////////wAAAAAAAAD//////////////////wD/////////////////////////AAAAAAAAAP//////////////////AP////////////////////////8AAAAAAAAA//////////////////8A/////////////////////////wAAAAAAAAD//////////////////wD/////////////////////////AAAAAAAAAP//////////////////AP////////////////////////8AAAAAAAAA//////////////////8A/////////////////////////wAAAAAAAAD//////////////////wD/////////////////////////AAAAAAAAAP//////////////////AP////////////////////////8AAAAAAAAA//////////////////8A/////////////////////////wAAAAAAAAD//////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8=',
'width' => 40
),
'2' => array(
'data' => 'AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP/////////////////okFAkCAAABCBIfNT///////////////////8A///////////////8hAgAAAAAAAAAAAAAAFTo/////////////////wD//////////////1QAAAAAAAAAAAAAAAAAACjo////////////////AP////////////+MAAAAAAAAAAAAAAAAAAAAADj///////////////8A////////////9BAAAAAAAAAAAAAAAAAAAAAAALD//////////////wD///////////+gAAAAAAAAAHjs+KwMAAAAAAAAVP//////////////AP///////////1gAAAAAAABM/////6QAAAAAAAAU//////////////8A////////////KAAAAAAAALj/////+AAAAAAAAAD//////////////wD///////////+MfGBMOCAI8P/////wAAAAAAAACP//////////////AP///////////////////////////5wAAAAAAAAw//////////////8A///////////////////////////oFAAAAAAAAHz//////////////wD/////////////////////////6CgAAAAAAAAE3P//////////////AP///////////////////////9ggAAAAAAAAAHT///////////////8A//////////////////////+0DAAAAAAAAAA8+P///////////////wD/////////////////////gAAAAAAAAAAAKOj/////////////////AP//////////////////9FAAAAAAAAAAADzw//////////////////8A/////////////////+g4AAAAAAAAAABk/P///////////////////wD////////////////oKAAAAAAAAAAMqP//////////////////////AP//////////////6CgAAAAAAAAAMNz///////////////////////8A//////////////g4AAAAAAAAAFT0/////////////////////////wD/////////////bAAAAAAAAABU/P//////////////////////////AP///////////8wAAAAAAAAAAAAAAAAAAAAAAAAA//////////////8A////////////SAAAAAAAAAAAAAAAAAAAAAAAAAD//////////////wD//////////9wAAAAAAAAAAAAAAAAAAAAAAAAAAP//////////////AP//////////hAAAAAAAAAAAAAAAAAAAAAAAAAAA//////////////8A//////////9AAAAAAAAAAAAAAAAAAAAAAAAAAAD//////////////wD//////////xAAAAAAAAAAAAAAAAAAAAAAAAAAAP//////////////AP////////////////////////////////////////////////////8=',
'width' => 40
),
'3' => array(
'data' => 'AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD////////////////8sGg0FAAAACA4cLz8////////////////////AP//////////////rBgAAAAAAAAAAAAAACTA//////////////////8A/////////////3QAAAAAAAAAAAAAAAAAAASs/////////////////wD///////////+YAAAAAAAAAAAAAAAAAAAAAAjc////////////////AP//////////6AwAAAAAAAAAAAAAAAAAAAAAAGT///////////////8A//////////94AAAAAAAABJDw/8g4AAAAAAAAHP///////////////wD//////////yAAAAAAAACE/////9gAAAAAAAAA////////////////AP///////////NSwiGQ4FOT//////AAAAAAAABD///////////////8A//////////////////////////+YAAAAAAAAVP///////////////wD//////////////////////P/ggAQAAAAAAATM////////////////AP////////////////////9gAAAAAAAAAAAElP////////////////8A/////////////////////0AAAAAAAAAAHLj//////////////////wD/////////////////////OAAAAAAAAAAwkPj/////////////////AP////////////////////8gAAAAAAAAAAAAINj///////////////8A/////////////////////xAAAAAAAAAAAAAAIPD//////////////wD/////////////////////uOz/4HgEAAAAAAAAhP//////////////AP///////////////////////////3wAAAAAAAAw//////////////8A////////////////////////////6AAAAAAAAAj//////////////wD/////////////////////////////AAAAAAAAAP//////////////AP//////////tJh8YEQoDNz//////+AAAAAAAAAY//////////////8A//////////88AAAAAAAAaP//////dAAAAAAAAEz//////////////wD//////////6QAAAAAAAAAdOD/5HQAAAAAAAAApP//////////////AP///////////CgAAAAAAAAAAAAAAAAAAAAAACD4//////////////8A////////////yAQAAAAAAAAAAAAAAAAAAAAEuP///////////////wD/////////////rAQAAAAAAAAAAAAAAAAABJD/////////////////AP//////////////zDQAAAAAAAAAAAAAACTA//////////////////8A/////////////////8BwOCAAAAAUNGi0/P///////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8=',
'width' => 40
),
'4' => array(
'data' => 'AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP//////////////////////////nAAAAAAAAAD///////////////8A/////////////////////////8AEAAAAAAAAAP///////////////wD////////////////////////gGAAAAAAAAAAA////////////////AP//////////////////////9DAAAAAAAAAAAAD///////////////8A//////////////////////9UAAAAAAAAAAAAAP///////////////wD/////////////////////hAAAAAAAAAAAAAAA////////////////AP///////////////////7QAAAAAAAAAAAAAAAD///////////////8A///////////////////UDAAAAAAUAAAAAAAAAP///////////////wD/////////////////7CQAAAAABMAAAAAAAAAA////////////////AP////////////////xEAAAAAACU/wAAAAAAAAD///////////////8A////////////////cAAAAAAAZP//AAAAAAAAAP///////////////wD//////////////6AAAAAAADz8//8AAAAAAAAA////////////////AP/////////////IBAAAAAAc6P///wAAAAAAAAD///////////////8A////////////5BgAAAAADMz/////AAAAAAAAAP///////////////wD///////////g0AAAAAACk//////8AAAAAAAAA////////////////AP//////////XAAAAAAAfP///////wAAAAAAAAD///////////////8A//////////8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP///////////wD//////////wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA////////////AP//////////AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD///////////8A//////////8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP///////////wD//////////wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA////////////AP//////////AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD///////////8A////////////////////////////AAAAAAAAAP///////////////wD///////////////////////////8AAAAAAAAA////////////////AP///////////////////////////wAAAAAAAAD///////////////8A////////////////////////////AAAAAAAAAP///////////////wD///////////////////////////8AAAAAAAAA////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8=',
'width' => 40
),
'5' => array(
'data' => 'AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP//////////////8AAAAAAAAAAAAAAAAAAAAAAA//////////////8A///////////////MAAAAAAAAAAAAAAAAAAAAAAD//////////////wD//////////////6wAAAAAAAAAAAAAAAAAAAAAAP//////////////AP//////////////iAAAAAAAAAAAAAAAAAAAAAAA//////////////8A//////////////9kAAAAAAAAAAAAAAAAAAAAAAD//////////////wD//////////////0QAAAAAAAAAAAAAAAAAAAAAAP//////////////AP//////////////IAAAAAAAYP////////////////////////////8A//////////////wAAAAAAAB8/////////////////////////////wD/////////////3AAAAAAAAIj/////////////////////////////AP////////////+4AAAAAAAAoLRYHAAEKGTE//////////////////8A/////////////5QAAAAAAAAQAAAAAAAAAABY9P///////////////wD/////////////dAAAAAAAAAAAAAAAAAAAAAA89P//////////////AP////////////9QAAAAAAAAAAAAAAAAAAAAAABg//////////////8A/////////////zAAAAAAAAAAAAAAAAAAAAAAAADQ/////////////wD/////////////IAAAAAAAAGjY/+h4BAAAAAAAAGz/////////////AP//////////////9NS0lHSc//////90AAAAAAAALP////////////8A/////////////////////////////9QAAAAAAAAE/////////////wD//////////////////////////////wAAAAAAAAD/////////////AP/////////////////////////////8AAAAAAAAEP////////////8A////////////pIRwWEAgDOD//////8wAAAAAAAA8/////////////wD///////////9EAAAAAAAAaP//////ZAAAAAAAAHz/////////////AP///////////6QAAAAAAAAAaOD/4GQAAAAAAAAE4P////////////8A/////////////CQAAAAAAAAAAAAAAAAAAAAAAGD//////////////wD/////////////yAQAAAAAAAAAAAAAAAAAAAAc7P//////////////AP//////////////rAwAAAAAAAAAAAAAAAAAGNj///////////////8A////////////////0EAAAAAAAAAAAAAAAFTo/////////////////wD//////////////////8h4QCAAAAAcQHzU////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8=',
'width' => 40
),
'6' => array(
'data' => 'AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD///////////////////+0ZCwMAAAUNGjI////////////////////AP/////////////////EMAAAAAAAAAAAAABM6P////////////////8A////////////////lAQAAAAAAAAAAAAAAAAo6P///////////////wD//////////////6wAAAAAAAAAAAAAAAAAAABI////////////////AP/////////////oEAAAAAAAAAAAAAAAAAAAAACw//////////////8A/////////////3AAAAAAAAAoxP/YPAAAAAAAAEj//////////////wD////////////4EAAAAAAACOD////YDCBAVGiAoP//////////////AP///////////7gAAAAAAABY//////////////////////////////8A////////////eAAAAAAAAJT//////////////////////////////wD///////////9MAAAAAAAAvP/IXBgABCx03P//////////////////AP///////////ygAAAAAAADcdAAAAAAAAAAEiP////////////////8A////////////FAAAAAAAAFAAAAAAAAAAAAAAcP///////////////wD///////////8AAAAAAAAAAAAAAAAAAAAAAAAAlP//////////////AP///////////wAAAAAAAAAAAAAAAAAAAAAAAAAQ8P////////////8A////////////AAAAAAAAAABAyP/kZAAAAAAAAACQ/////////////wD///////////8MAAAAAAAALPj/////WAAAAAAAAET/////////////AP///////////yQAAAAAAACY///////MAAAAAAAAFP////////////8A////////////SAAAAAAAAMD///////wAAAAAAAAA/////////////wD///////////9wAAAAAAAAvP///////wAAAAAAAAD/////////////AP///////////7QAAAAAAACI///////UAAAAAAAAJP////////////8A////////////+AwAAAAAACDw/////2wAAAAAAABY/////////////wD/////////////cAAAAAAAADC8/Ox4AAAAAAAAAKj/////////////AP/////////////oEAAAAAAAAAAAAAAAAAAAAAAk/P////////////8A//////////////+oAAAAAAAAAAAAAAAAAAAABLj//////////////wD///////////////+QAAAAAAAAAAAAAAAAAACQ////////////////AP////////////////+0JAAAAAAAAAAAAAAkuP////////////////8A///////////////////8sGg0FAAADCxgqPz//////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8=',
'width' => 40
),
'7' => array(
'data' => 'AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD///////////8AAAAAAAAAAAAAAAAAAAAAAAAAAAD/////////////AP///////////wAAAAAAAAAAAAAAAAAAAAAAAAAAAP////////////8A////////////AAAAAAAAAAAAAAAAAAAAAAAAAAAA/////////////wD///////////8AAAAAAAAAAAAAAAAAAAAAAAAAAAD/////////////AP///////////wAAAAAAAAAAAAAAAAAAAAAAAAAABP////////////8A////////////AAAAAAAAAAAAAAAAAAAAAAAAAAy4/////////////wD//////////////////////////+QUAAAAAAAEuP//////////////AP/////////////////////////8QAAAAAAAAKT///////////////8A/////////////////////////4wAAAAAAAB0/////////////////wD////////////////////////cCAAAAAAANPz/////////////////AP///////////////////////0QAAAAAAATY//////////////////8A//////////////////////+0AAAAAAAAeP///////////////////wD//////////////////////CQAAAAAABTw////////////////////AP////////////////////+gAAAAAAAAkP////////////////////8A/////////////////////ywAAAAAABDw/////////////////////wD///////////////////+4AAAAAAAAbP//////////////////////AP///////////////////1wAAAAAAADQ//////////////////////8A///////////////////4DAAAAAAAMP///////////////////////wD//////////////////7QAAAAAAAB8////////////////////////AP//////////////////aAAAAAAAAMj///////////////////////8A//////////////////8oAAAAAAAM/P///////////////////////wD/////////////////8AAAAAAAAET/////////////////////////AP////////////////+0AAAAAAAAcP////////////////////////8A/////////////////4wAAAAAAACY/////////////////////////wD/////////////////WAAAAAAAAMD/////////////////////////AP////////////////80AAAAAAAA4P////////////////////////8A/////////////////xAAAAAAAAD4/////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8=',
'width' => 40
),
'8' => array(
'data' => 'AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD////////////////////IdDQUAAAEIEiA1P//////////////////AP/////////////////gRAAAAAAAAAAAAAAAROD///////////////8A////////////////0BgAAAAAAAAAAAAAAAAAEMj//////////////wD///////////////AcAAAAAAAAAAAAAAAAAAAAHPD/////////////AP//////////////hAAAAAAAAAAAAAAAAAAAAAAAhP////////////8A//////////////8sAAAAAAAAKMz/zCgAAAAAAAAs/////////////wD//////////////wAAAAAAAADM////zAAAAAAAAAD/////////////AP//////////////BAAAAAAAAP//////AAAAAAAABP////////////8A//////////////8sAAAAAAAAzP///9QAAAAAAAAw/////////////wD//////////////3wAAAAAAAAoyP/YNAAAAAAAAIT/////////////AP//////////////7BgAAAAAAAAAAAAAAAAAAAAc8P////////////8A////////////////xBgAAAAAAAAAAAAAAAAAGNj//////////////wD/////////////////tAQAAAAAAAAAAAAAAACo////////////////AP///////////////HAAAAAAAAAAAAAAAAAAAAB8//////////////8A//////////////9gAAAAAAAAAAAAAAAAAAAAAAB8/////////////wD/////////////wAAAAAAAAABk4P/UWAAAAAAAAATQ////////////AP////////////9UAAAAAAAAaP//////XAAAAAAAAGT///////////8A/////////////xgAAAAAAADg///////cAAAAAAAAJP///////////wD/////////////AAAAAAAAAP////////8AAAAAAAAA////////////AP////////////8AAAAAAAAA4P//////3AAAAAAAAAT///////////8A/////////////ygAAAAAAABg//////9cAAAAAAAALP///////////wD/////////////ZAAAAAAAAABY1P/cXAAAAAAAAABw////////////AP/////////////QAAAAAAAAAAAAAAAAAAAAAAAABNz///////////8A//////////////9gAAAAAAAAAAAAAAAAAAAAAAB0/////////////wD///////////////Q8AAAAAAAAAAAAAAAAAAAAUPz/////////////AP////////////////x4CAAAAAAAAAAAAAAAEIT8//////////////8A///////////////////smFQwGAAAABg0ZKT0/////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8=',
'width' => 40
),
'9' => array(
'data' => 'AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD///////////////////ysYCwMAAAUNGiw/P//////////////////AP////////////////+4JAAAAAAAAAAAAAAkuP////////////////8A////////////////lAQAAAAAAAAAAAAAAAAAkP///////////////wD//////////////8AEAAAAAAAAAAAAAAAAAAAAqP//////////////AP/////////////8JAAAAAAAAAAAAAAAAAAAAAAQ7P////////////8A/////////////6wAAAAAAAAAfOz8vCwAAAAAAABw/////////////wD/////////////WAAAAAAAAHD/////7BgAAAAAAAz4////////////AP////////////8kAAAAAAAA1P//////hAAAAAAAALT///////////8A/////////////wAAAAAAAAD///////+4AAAAAAAAcP///////////wD/////////////AAAAAAAAAPz//////8AAAAAAAABI////////////AP////////////8UAAAAAAAAzP//////lAAAAAAAACT///////////8A/////////////0QAAAAAAABY//////gsAAAAAAAADP///////////wD/////////////kAAAAAAAAABw5P/IPAAAAAAAAAAA////////////AP/////////////wEAAAAAAAAAAAAAAAAAAAAAAAAAD///////////8A//////////////+UAAAAAAAAAAAAAAAAAAAAAAAAAP///////////wD///////////////9wAAAAAAAAAAAAAFAAAAAAAAAU////////////AP////////////////+IBAAAAAAAAABw3AAAAAAAACj///////////8A///////////////////cdCwEABhcxP+8AAAAAAAATP///////////wD//////////////////////////////5AAAAAAAAB4////////////AP//////////////////////////////UAAAAAAAALj///////////8A//////////////+kgGxUQCAM2P///+AIAAAAAAAQ+P///////////wD//////////////0gAAAAAAAA42P/EKAAAAAAAAHD/////////////AP//////////////sAAAAAAAAAAAAAAAAAAAAAAQ6P////////////8A////////////////TAAAAAAAAAAAAAAAAAAAAKz//////////////wD////////////////oKAAAAAAAAAAAAAAAAASU////////////////AP/////////////////sUAAAAAAAAAAAAAAwxP////////////////8A////////////////////yHA0FAAADCxktP///////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8=',
'width' => 40
),
'A' => array(
'data' => 'AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD//////////////////+QAAAAAAAAAAAAAAOT/////////////////AP//////////////////kAAAAAAAAAAAAAAAkP////////////////8A//////////////////88AAAAAAAAAAAAAAA8/////////////////wD/////////////////5AAAAAAAAAAAAAAAAADk////////////////AP////////////////+QAAAAAAAAAAAAAAAAAJD///////////////8A/////////////////zwAAAAAAAAAAAAAAAAAPP///////////////wD////////////////kAAAAAAAAAAgAAAAAAAAA5P//////////////AP///////////////5AAAAAAAAAAgAAAAAAAAACQ//////////////8A////////////////PAAAAAAAAAz8HAAAAAAAADz//////////////wD//////////////+QAAAAAAAAAWP9kAAAAAAAAANz/////////////AP//////////////kAAAAAAAAACk/7wAAAAAAAAAhP////////////8A//////////////88AAAAAAAABOz//BQAAAAAAAAw/////////////wD/////////////4AAAAAAAAAA8////ZAAAAAAAAADc////////////AP////////////+EAAAAAAAAAIj///+8AAAAAAAAAIT///////////8A/////////////zAAAAAAAAAA2P////wQAAAAAAAAMP///////////wD////////////cAAAAAAAAACT//////1wAAAAAAAAA3P//////////AP///////////4QAAAAAAAAAAAAAAAAAAAAAAAAAAACE//////////8A////////////MAAAAAAAAAAAAAAAAAAAAAAAAAAAADD//////////wD//////////9wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAANz/////////AP//////////hAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAhP////////8A//////////8wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAw/////////wD/////////3AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADc////////AP////////+EAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIT///////8A/////////zAAAAAAAAAAhP///////////2QAAAAAAAAAMP///////wD////////cAAAAAAAAAADM////////////vAAAAAAAAAAA3P//////AP///////4QAAAAAAAAAHP/////////////4DAAAAAAAAACE//////8A////////MAAAAAAAAABk//////////////9cAAAAAAAAADD//////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8=',
'width' => 40
),
'B' => array(
'data' => 'AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A//////////8AAAAAAAAAAAAAAAAAAAAAEDh83P///////////////wD//////////wAAAAAAAAAAAAAAAAAAAAAAAAAEhP//////////////AP//////////AAAAAAAAAAAAAAAAAAAAAAAAAAAAeP////////////8A//////////8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAxP///////////wD//////////wAAAAAAAAAAAAAAAAAAAAAAAAAAAABY////////////AP//////////AAAAAAAAAAAAAAAAAAAAAAAAAAAAABT///////////8A//////////8AAAAAAAAAAP/////4zEwAAAAAAAAAAP///////////wD//////////wAAAAAAAAAA////////7AAAAAAAAAAQ////////////AP//////////AAAAAAAAAAD////////sAAAAAAAAAEj///////////8A//////////8AAAAAAAAAAP/////4zEQAAAAAAAAAtP///////////wD//////////wAAAAAAAAAAAAAAAAAAAAAAAAAAAFz/////////////AP//////////AAAAAAAAAAAAAAAAAAAAAAAAAAiA/P////////////8A//////////8AAAAAAAAAAAAAAAAAAAAAAAAIjPj//////////////wD//////////wAAAAAAAAAAAAAAAAAAAAAAAAAAGKz/////////////AP//////////AAAAAAAAAAAAAAAAAAAAAAAAAAAAAJT///////////8A//////////8AAAAAAAAAAAAAAAAAAAAAAAAAAAAABNz//////////wD//////////wAAAAAAAAAA///////sqCAAAAAAAAAAbP//////////AP//////////AAAAAAAAAAD/////////yAAAAAAAAAAs//////////8A//////////8AAAAAAAAAAP//////////AAAAAAAAAAT//////////wD//////////wAAAAAAAAAA/////////7wAAAAAAAAAAP//////////AP//////////AAAAAAAAAAD//////+ikGAAAAAAAAAAY//////////8A//////////8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFT//////////wD//////////wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAsP//////////AP//////////AAAAAAAAAAAAAAAAAAAAAAAAAAAAADj///////////8A//////////8AAAAAAAAAAAAAAAAAAAAAAAAAAAAc6P///////////wD//////////wAAAAAAAAAAAAAAAAAAAAAAAAAATOj/////////////AP//////////AAAAAAAAAAAAAAAAAAAEIEBkkNj///////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8=',
'width' => 40
),
'C' => array(
'data' => 'AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP//////////////////5JRULBAAAAgkTIDQ//////////////////8A////////////////1FAAAAAAAAAAAAAAAABAyP///////////////wD//////////////4gEAAAAAAAAAAAAAAAAAAAElP//////////////AP////////////9wAAAAAAAAAAAAAAAAAAAAAAAAlP////////////8A////////////kAAAAAAAAAAAAAAAAAAAAAAAAAAEyP///////////wD//////////9wIAAAAAAAAAAAAAAAAAAAAAAAAAAAw////////////AP//////////WAAAAAAAAAAAWMz/8JwQAAAAAAAAAACw//////////8A/////////+wEAAAAAAAAAID//////9QMAAAAAAAAAET//////////wD/////////nAAAAAAAAAAo/P///////3wAAAAABDBspP//////////AP////////9gAAAAAAAAAIz/////////3BxQjMT0//////////////8A/////////zQAAAAAAAAAzP///////////////////////////////wD/////////GAAAAAAAAADo////////////////////////////////AP////////8AAAAAAAAAAP////////////////////////////////8A/////////wAAAAAAAAAA/////////////////////////////////wD/////////AAAAAAAAAAD/////////////////////////////////AP////////8cAAAAAAAAAOj///////////////////////////////8A/////////zgAAAAAAAAA0P/////////kIGio7P///////////////wD/////////bAAAAAAAAACg/////////5wAAAAAMHS49P//////////AP////////+oAAAAAAAAAEz/////////PAAAAAAAAAAc//////////8A//////////QIAAAAAAAAALz//////6QAAAAAAAAAAGT//////////wD//////////3AAAAAAAAAADIzo/+SEBAAAAAAAAAAAyP//////////AP//////////7BAAAAAAAAAAAAAAAAAAAAAAAAAAAED///////////8A////////////rAAAAAAAAAAAAAAAAAAAAAAAAAAE0P///////////wD/////////////fAAAAAAAAAAAAAAAAAAAAAAAAJz/////////////AP//////////////iAQAAAAAAAAAAAAAAAAAAASY//////////////8A////////////////yEAAAAAAAAAAAAAAAAA8yP///////////////wD//////////////////9yIUCwQAAAAIEB4yP//////////////////AP////////////////////////////////////////////////////8=',
'width' => 40
),
'D' => array(
'data' => 'AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD///////////8AAAAAAAAAAAAAAAAADChQkOT/////////////////AP///////////wAAAAAAAAAAAAAAAAAAAAAABGjw//////////////8A////////////AAAAAAAAAAAAAAAAAAAAAAAAACDY/////////////wD///////////8AAAAAAAAAAAAAAAAAAAAAAAAAABjk////////////AP///////////wAAAAAAAAAAAAAAAAAAAAAAAAAAAED///////////8A////////////AAAAAAAAAAAAAAAAAAAAAAAAAAAAAKj//////////wD///////////8AAAAAAAAAAP///+isSAAAAAAAAAAANP//////////AP///////////wAAAAAAAAAA////////hAAAAAAAAAAA2P////////8A////////////AAAAAAAAAAD/////////MAAAAAAAAACQ/////////wD///////////8AAAAAAAAAAP////////+MAAAAAAAAAFj/////////AP///////////wAAAAAAAAAA/////////8gAAAAAAAAAMP////////8A////////////AAAAAAAAAAD/////////5AAAAAAAAAAY/////////wD///////////8AAAAAAAAAAP//////////AAAAAAAAAAD/////////AP///////////wAAAAAAAAAA//////////8AAAAAAAAAAP////////8A////////////AAAAAAAAAAD//////////wAAAAAAAAAA/////////wD///////////8AAAAAAAAAAP/////////wAAAAAAAAABD/////////AP///////////wAAAAAAAAAA/////////9QAAAAAAAAAJP////////8A////////////AAAAAAAAAAD/////////qAAAAAAAAABI/////////wD///////////8AAAAAAAAAAP////////9QAAAAAAAAAHj/////////AP///////////wAAAAAAAAAA////////uAAAAAAAAAAAvP////////8A////////////AAAAAAAAAAD////w0HwEAAAAAAAAACT8/////////wD///////////8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAoP//////////AP///////////wAAAAAAAAAAAAAAAAAAAAAAAAAAADz8//////////8A////////////AAAAAAAAAAAAAAAAAAAAAAAAAAAY6P///////////wD///////////8AAAAAAAAAAAAAAAAAAAAAAAAAKNz/////////////AP///////////wAAAAAAAAAAAAAAAAAAAAAACHT0//////////////8A////////////AAAAAAAAAAAAAAAAABg4bKj0/////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8=',
'width' => 40
),
'E' => array(
'data' => 'AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP//////////AAAAAAAAAAAAAAAAAAAAAAAAAAAAAP////////////8A//////////8AAAAAAAAAAAAAAAAAAAAAAAAAAAAA/////////////wD//////////wAAAAAAAAAAAAAAAAAAAAAAAAAAAAD/////////////AP//////////AAAAAAAAAAAAAAAAAAAAAAAAAAAAAP////////////8A//////////8AAAAAAAAAAAAAAAAAAAAAAAAAAAAA/////////////wD//////////wAAAAAAAAAAAAAAAAAAAAAAAAAAAAD/////////////AP//////////AAAAAAAAAAD///////////////////////////////8A//////////8AAAAAAAAAAP///////////////////////////////wD//////////wAAAAAAAAAA////////////////////////////////AP//////////AAAAAAAAAAD///////////////////////////////8A//////////8AAAAAAAAAAAAAAAAAAAAAAAAAAAD//////////////wD//////////wAAAAAAAAAAAAAAAAAAAAAAAAAAAP//////////////AP//////////AAAAAAAAAAAAAAAAAAAAAAAAAAAA//////////////8A//////////8AAAAAAAAAAAAAAAAAAAAAAAAAAAD//////////////wD//////////wAAAAAAAAAAAAAAAAAAAAAAAAAAAP//////////////AP//////////AAAAAAAAAAAAAAAAAAAAAAAAAAAA//////////////8A//////////8AAAAAAAAAAP///////////////////////////////wD//////////wAAAAAAAAAA////////////////////////////////AP//////////AAAAAAAAAAD///////////////////////////////8A//////////8AAAAAAAAAAP///////////////////////////////wD//////////wAAAAAAAAAA////////////////////////////////AP//////////AAAAAAAAAAAAAAAAAAAAAAAAAAAAAP////////////8A//////////8AAAAAAAAAAAAAAAAAAAAAAAAAAAAA/////////////wD//////////wAAAAAAAAAAAAAAAAAAAAAAAAAAAAD/////////////AP//////////AAAAAAAAAAAAAAAAAAAAAAAAAAAAAP////////////8A//////////8AAAAAAAAAAAAAAAAAAAAAAAAAAAAA/////////////wD//////////wAAAAAAAAAAAAAAAAAAAAAAAAAAAAD/////////////AP////////////////////////////////////////////////////8=',
'width' => 40
),
'F' => array(
'data' => 'AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////wAAAAAAAAAAAAAAAAAAAAAAAAAA/////////////wD/////////////AAAAAAAAAAAAAAAAAAAAAAAAAAD/////////////AP////////////8AAAAAAAAAAAAAAAAAAAAAAAAAAP////////////8A/////////////wAAAAAAAAAAAAAAAAAAAAAAAAAA/////////////wD/////////////AAAAAAAAAAAAAAAAAAAAAAAAAAD/////////////AP////////////8AAAAAAAAAAAAAAAAAAAAAAAAAAP////////////8A/////////////wAAAAAAAAAA/////////////////////////////wD/////////////AAAAAAAAAAD/////////////////////////////AP////////////8AAAAAAAAAAP////////////////////////////8A/////////////wAAAAAAAAAA/////////////////////////////wD/////////////AAAAAAAAAAAAAAAAAAAAAAAA////////////////AP////////////8AAAAAAAAAAAAAAAAAAAAAAAD///////////////8A/////////////wAAAAAAAAAAAAAAAAAAAAAAAP///////////////wD/////////////AAAAAAAAAAAAAAAAAAAAAAAA////////////////AP////////////8AAAAAAAAAAAAAAAAAAAAAAAD///////////////8A/////////////wAAAAAAAAAAAAAAAAAAAAAAAP///////////////wD/////////////AAAAAAAAAAD/////////////////////////////AP////////////8AAAAAAAAAAP////////////////////////////8A/////////////wAAAAAAAAAA/////////////////////////////wD/////////////AAAAAAAAAAD/////////////////////////////AP////////////8AAAAAAAAAAP////////////////////////////8A/////////////wAAAAAAAAAA/////////////////////////////wD/////////////AAAAAAAAAAD/////////////////////////////AP////////////8AAAAAAAAAAP////////////////////////////8A/////////////wAAAAAAAAAA/////////////////////////////wD/////////////AAAAAAAAAAD/////////////////////////////AP////////////8AAAAAAAAAAP////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8=',
'width' => 40
),
'G' => array(
'data' => 'AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD//////////////////MB8TCgQAAAACCA4YJzs////////////////AP///////////////JQcAAAAAAAAAAAAAAAAAAhw8P////////////8A/////////////9gwAAAAAAAAAAAAAAAAAAAAAAAk2P///////////wD////////////EDAAAAAAAAAAAAAAAAAAAAAAAAAAc7P//////////AP//////////2AwAAAAAAAAAAAAAAAAAAAAAAAAAAABY//////////8A//////////wwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADQ/////////wD/////////kAAAAAAAAAAAEHzQ/P/gmCAAAAAAAAAAAFz/////////AP////////wcAAAAAAAAACjg////////8CwAAAAAAAAgWP////////8A////////vAAAAAAAAAAI2P//////////yBRAcJjI8P///////////wD///////94AAAAAAAAAGD/////////////////////////////////AP///////0AAAAAAAAAAsP////////////////////////////////8A////////IAAAAAAAAADc/////////////////////////////////wD///////8AAAAAAAAAAP///////wAAAAAAAAAAAAAAAAD/////////AP///////wAAAAAAAAAA////////AAAAAAAAAAAAAAAAAP////////8A////////AAAAAAAAAAD///////8AAAAAAAAAAAAAAAAA/////////wD///////8gAAAAAAAAAOD//////wAAAAAAAAAAAAAAAAD/////////AP///////0AAAAAAAAAAtP//////AAAAAAAAAAAAAAAAAP////////8A////////cAAAAAAAAABw//////8AAAAAAAAAAAAAAAAA/////////wD///////+8AAAAAAAAABDs////////////AAAAAAAAAAD/////////AP////////wYAAAAAAAAADz0//////////AAAAAAAAAAAP////////8A/////////5AAAAAAAAAAACCY4P//3KhcCAAAAAAAAAAA/////////wD/////////+CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD/////////AP//////////xAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIP////////8A////////////rAQAAAAAAAAAAAAAAAAAAAAAAAAAAGTw/////////wD/////////////vBQAAAAAAAAAAAAAAAAAAAAAADjI////////////AP//////////////8HAQAAAAAAAAAAAAAAAAAEiw//////////////8A//////////////////iwcEAgBAAABCA4aKDk/////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8=',
'width' => 40
),
'H' => array(
'data' => 'AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////8AAAAAAAAAAP///////////wAAAAAAAAAA//////////8A/////////wAAAAAAAAAA////////////AAAAAAAAAAD//////////wD/////////AAAAAAAAAAD///////////8AAAAAAAAAAP//////////AP////////8AAAAAAAAAAP///////////wAAAAAAAAAA//////////8A/////////wAAAAAAAAAA////////////AAAAAAAAAAD//////////wD/////////AAAAAAAAAAD///////////8AAAAAAAAAAP//////////AP////////8AAAAAAAAAAP///////////wAAAAAAAAAA//////////8A/////////wAAAAAAAAAA////////////AAAAAAAAAAD//////////wD/////////AAAAAAAAAAD///////////8AAAAAAAAAAP//////////AP////////8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA//////////8A/////////wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD//////////wD/////////AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP//////////AP////////8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA//////////8A/////////wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD//////////wD/////////AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP//////////AP////////8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA//////////8A/////////wAAAAAAAAAA////////////AAAAAAAAAAD//////////wD/////////AAAAAAAAAAD///////////8AAAAAAAAAAP//////////AP////////8AAAAAAAAAAP///////////wAAAAAAAAAA//////////8A/////////wAAAAAAAAAA////////////AAAAAAAAAAD//////////wD/////////AAAAAAAAAAD///////////8AAAAAAAAAAP//////////AP////////8AAAAAAAAAAP///////////wAAAAAAAAAA//////////8A/////////wAAAAAAAAAA////////////AAAAAAAAAAD//////////wD/////////AAAAAAAAAAD///////////8AAAAAAAAAAP//////////AP////////8AAAAAAAAAAP///////////wAAAAAAAAAA//////////8A/////////wAAAAAAAAAA////////////AAAAAAAAAAD//////////wD/////////AAAAAAAAAAD///////////8AAAAAAAAAAP//////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8=',
'width' => 40
),
'I' => array(
'data' => 'AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////AAAAAAAAAAAAAAAAAAAAAAAA////////////////AP////////////8AAAAAAAAAAAAAAAAAAAAAAAD///////////////8A/////////////wAAAAAAAAAAAAAAAAAAAAAAAP///////////////wD/////////////AAAAAAAAAAAAAAAAAAAAAAAA////////////////AP////////////8AAAAAAAAAAAAAAAAAAAAAAAD///////////////8A/////////////wAAAAAAAAAAAAAAAAAAAAAAAP///////////////wD/////////////AAAAAAAAAAAAAAAAAAAAAAAA////////////////AP///////////////////wAAAAAAAAAA//////////////////////8A////////////////////AAAAAAAAAAD//////////////////////wD///////////////////8AAAAAAAAAAP//////////////////////AP///////////////////wAAAAAAAAAA//////////////////////8A////////////////////AAAAAAAAAAD//////////////////////wD///////////////////8AAAAAAAAAAP//////////////////////AP///////////////////wAAAAAAAAAA//////////////////////8A////////////////////AAAAAAAAAAD//////////////////////wD///////////////////8AAAAAAAAAAP//////////////////////AP///////////////////wAAAAAAAAAA//////////////////////8A////////////////////AAAAAAAAAAD//////////////////////wD///////////////////8AAAAAAAAAAP//////////////////////AP///////////////////wAAAAAAAAAA//////////////////////8A////////////////////AAAAAAAAAAD//////////////////////wD///////////////////8AAAAAAAAAAP//////////////////////AP////////////8AAAAAAAAAAAAAAAAAAAAAAAD///////////////8A/////////////wAAAAAAAAAAAAAAAAAAAAAAAP///////////////wD/////////////AAAAAAAAAAAAAAAAAAAAAAAA////////////////AP////////////8AAAAAAAAAAAAAAAAAAAAAAAD///////////////8A/////////////wAAAAAAAAAAAAAAAAAAAAAAAP///////////////wD/////////////AAAAAAAAAAAAAAAAAAAAAAAA////////////////AP////////////8AAAAAAAAAAAAAAAAAAAAAAAD///////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8=',
'width' => 40
),
'J' => array(
'data' => 'AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP///////////////////////////wAAAAAAAAAA//////////////8A////////////////////////////AAAAAAAAAAD//////////////wD///////////////////////////8AAAAAAAAAAP//////////////AP///////////////////////////wAAAAAAAAAA//////////////8A////////////////////////////AAAAAAAAAAD//////////////wD///////////////////////////8AAAAAAAAAAP//////////////AP///////////////////////////wAAAAAAAAAA//////////////8A////////////////////////////AAAAAAAAAAD//////////////wD///////////////////////////8AAAAAAAAAAP//////////////AP///////////////////////////wAAAAAAAAAA//////////////8A////////////////////////////AAAAAAAAAAD//////////////wD///////////////////////////8AAAAAAAAAAP//////////////AP///////////////////////////wAAAAAAAAAA//////////////8A////////////////////////////AAAAAAAAAAD//////////////wD///////////////////////////8AAAAAAAAAAP//////////////AP///////////////////////////wAAAAAAAAAA//////////////8A////////////////////////////AAAAAAAAAAj//////////////wD//////////+zMrIxwUDAQ//////wAAAAAAAAAIP//////////////AP//////////DAAAAAAAAADo////2AAAAAAAAAA0//////////////8A//////////8wAAAAAAAAAKj///+YAAAAAAAAAFj//////////////wD//////////2gAAAAAAAAAIND/yBgAAAAAAAAAkP//////////////AP//////////vAAAAAAAAAAAAAAAAAAAAAAAAADc//////////////8A////////////MAAAAAAAAAAAAAAAAAAAAAAAUP///////////////wD////////////EBAAAAAAAAAAAAAAAAAAAABjk////////////////AP////////////+sBAAAAAAAAAAAAAAAAAAY2P////////////////8A///////////////EMAAAAAAAAAAAAAAAVOj//////////////////wD/////////////////vHBAIAAAABg8fNT/////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8=',
'width' => 40
),
'K' => array(
'data' => 'AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD///////8AAAAAAAAAAP//////////wAQAAAAAAAAAAABw////////AP///////wAAAAAAAAAA/////////9AMAAAAAAAAAAAAcP////////8A////////AAAAAAAAAAD////////cGAAAAAAAAAAAAHD//////////wD///////8AAAAAAAAAAP//////6CgAAAAAAAAAAABs////////////AP///////wAAAAAAAAAA//////Q0AAAAAAAAAAAAVPz///////////8A////////AAAAAAAAAAD////8RAAAAAAAAAAAAFT8/////////////wD///////8AAAAAAAAAAP///1gAAAAAAAAAAABU/P//////////////AP///////wAAAAAAAAAA//9wAAAAAAAAAAAASPz///////////////8A////////AAAAAAAAAAD/jAAAAAAAAAAAADz0/////////////////wD///////8AAAAAAAAAAKQAAAAAAAAAAAA89P//////////////////AP///////wAAAAAAAAAABAAAAAAAAAAAFPT///////////////////8A////////AAAAAAAAAAAAAAAAAAAAAAAApP///////////////////wD///////8AAAAAAAAAAAAAAAAAAAAAAAAU8P//////////////////AP///////wAAAAAAAAAAAAAAAAAAAAAAAABk//////////////////8A////////AAAAAAAAAAAAAAAAAAAAAAAAAADE/////////////////wD///////8AAAAAAAAAAAAAAAAoEAAAAAAAACz8////////////////AP///////wAAAAAAAAAAAAAAGNiAAAAAAAAAAIj///////////////8A////////AAAAAAAAAAAAABjY//gYAAAAAAAACOD//////////////wD///////8AAAAAAAAAAAAY2P///5wAAAAAAAAASP//////////////AP///////wAAAAAAAAAAGNj//////CgAAAAAAAAAqP////////////8A////////AAAAAAAAAADI////////sAAAAAAAAAAc8P///////////wD///////8AAAAAAAAAAP//////////QAAAAAAAAABs////////////AP///////wAAAAAAAAAA///////////IAAAAAAAAAATI//////////8A////////AAAAAAAAAAD///////////9YAAAAAAAAADD8/////////wD///////8AAAAAAAAAAP///////////9wEAAAAAAAAAJD/////////AP///////wAAAAAAAAAA/////////////3AAAAAAAAAADOT///////8A////////AAAAAAAAAAD/////////////7BAAAAAAAAAAUP///////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8=',
'width' => 40
),
'L' => array(
'data' => 'AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////8AAAAAAAAAAP////////////////////////////8A/////////////wAAAAAAAAAA/////////////////////////////wD/////////////AAAAAAAAAAD/////////////////////////////AP////////////8AAAAAAAAAAP////////////////////////////8A/////////////wAAAAAAAAAA/////////////////////////////wD/////////////AAAAAAAAAAD/////////////////////////////AP////////////8AAAAAAAAAAP////////////////////////////8A/////////////wAAAAAAAAAA/////////////////////////////wD/////////////AAAAAAAAAAD/////////////////////////////AP////////////8AAAAAAAAAAP////////////////////////////8A/////////////wAAAAAAAAAA/////////////////////////////wD/////////////AAAAAAAAAAD/////////////////////////////AP////////////8AAAAAAAAAAP////////////////////////////8A/////////////wAAAAAAAAAA/////////////////////////////wD/////////////AAAAAAAAAAD/////////////////////////////AP////////////8AAAAAAAAAAP////////////////////////////8A/////////////wAAAAAAAAAA/////////////////////////////wD/////////////AAAAAAAAAAD/////////////////////////////AP////////////8AAAAAAAAAAP////////////////////////////8A/////////////wAAAAAAAAAA/////////////////////////////wD/////////////AAAAAAAAAAAAAAAAAAAAAAAAAAD/////////////AP////////////8AAAAAAAAAAAAAAAAAAAAAAAAAAP////////////8A/////////////wAAAAAAAAAAAAAAAAAAAAAAAAAA/////////////wD/////////////AAAAAAAAAAAAAAAAAAAAAAAAAAD/////////////AP////////////8AAAAAAAAAAAAAAAAAAAAAAAAAAP////////////8A/////////////wAAAAAAAAAAAAAAAAAAAAAAAAAA/////////////wD/////////////AAAAAAAAAAAAAAAAAAAAAAAAAAD/////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8=',
'width' => 40
),
'M' => array(
'data' => 'AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A//////8AAAAAAAAAAAAAAHz//////3wAAAAAAAAAAAAAAP///////wD//////wAAAAAAAAAAAAAATP//////UAAAAAAAAAAAAAAA////////AP//////AAAAAAAAAAAAAAAc//////8cAAAAAAAAAAAAAAD///////8A//////8AAAAAAAAAAAAAAADw////8AAAAAAAAAAAAAAAAP///////wD//////wAAAAAAAAAAAAAAALz////AAAAAAAAAAAAAAAAA////////AP//////AAAAAAAAAAAAAAAAkP///5AAAAAAAAAAAAAAAAD///////8A//////8AAAAAAAAAAAAAAABc////ZAAAAAAAAAAAAAAAAP///////wD//////wAAAAAAAAAoAAAAADD///8wAAAAACQAAAAAAAAA////////AP//////AAAAAAAAAFwAAAAABPz//AgAAAAAXAAAAAAAAAD///////8A//////8AAAAAAAAAkAAAAAAA0P/UAAAAAACQAAAAAAAAAP///////wD//////wAAAAAAAADMAAAAAACg/6gAAAAAAMQAAAAAAAAA////////AP//////AAAAAAAAAPgEAAAAAHD/dAAAAAAE+AAAAAAAAAD///////8A//////8AAAAAAAAA/zQAAAAAQP9IAAAAADD/AAAAAAAAAP///////wD//////wAAAAAAAAD/bAAAAAAQ/xQAAAAAaP8AAAAAAAAA////////AP//////AAAAAAAAAP+gAAAAAADQAAAAAACc/wAAAAAAAAD///////8A//////8AAAAAAAAA/9QAAAAAAGgAAAAAAND/AAAAAAAAAP///////wD//////wAAAAAAAAD//wwAAAAAFAAAAAAM/P8AAAAAAAAA////////AP//////AAAAAAAAAP//RAAAAAAAAAAAADz//wAAAAAAAAD///////8A//////8AAAAAAAAA//94AAAAAAAAAAAAcP//AAAAAAAAAP///////wD//////wAAAAAAAAD//7AAAAAAAAAAAACo//8AAAAAAAAA////////AP//////AAAAAAAAAP//5AAAAAAAAAAAANz//wAAAAAAAAD///////8A//////8AAAAAAAAA////HAAAAAAAAAAQ////AAAAAAAAAP///////wD//////wAAAAAAAAD///9QAAAAAAAAAEz///8AAAAAAAAA////////AP//////AAAAAAAAAP///4gAAAAAAAAAfP///wAAAAAAAAD///////8A//////8AAAAAAAAA////vAAAAAAAAACw////AAAAAAAAAP///////wD//////wAAAAAAAAD////wAAAAAAAAAOz///8AAAAAAAAA////////AP//////AAAAAAAAAP////8sAAAAAAAc/////wAAAAAAAAD///////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8=',
'width' => 40
),
'N' => array(
'data' => 'AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////AAAAAAAAALD/////////////AAAAAAAAAP//////////AP////////8AAAAAAAAAFOj///////////8AAAAAAAAA//////////8A/////////wAAAAAAAAAASP///////////wAAAAAAAAD//////////wD/////////AAAAAAAAAAAAkP//////////AAAAAAAAAP//////////AP////////8AAAAAAAAAAAAI1P////////8AAAAAAAAA//////////8A/////////wAAAAAAAAAAAAAw+P///////wAAAAAAAAD//////////wD/////////AAAAAAAAAAAAAABw////////AAAAAAAAAP//////////AP////////8AAAAAAAAAAAAAAAC8//////8AAAAAAAAA//////////8A/////////wAAAAAAAAAAAAAAABzs/////wAAAAAAAAD//////////wD/////////AAAAAAAAAAAAAAAAAFD/////AAAAAAAAAP//////////AP////////8AAAAAAAAAAAAAAAAAAJz///8AAAAAAAAA//////////8A/////////wAAAAAAAAAUAAAAAAAADNz//wAAAAAAAAD//////////wD/////////AAAAAAAAALQAAAAAAAAANPz/AAAAAAAAAP//////////AP////////8AAAAAAAAA/2wAAAAAAAAAfP8AAAAAAAAA//////////8A/////////wAAAAAAAAD/+CwAAAAAAAAExAAAAAAAAAD//////////wD/////////AAAAAAAAAP//0AQAAAAAAAAgAAAAAAAAAP//////////AP////////8AAAAAAAAA////jAAAAAAAAAAAAAAAAAAA//////////8A/////////wAAAAAAAAD/////RAAAAAAAAAAAAAAAAAD//////////wD/////////AAAAAAAAAP/////kFAAAAAAAAAAAAAAAAP//////////AP////////8AAAAAAAAA//////+sAAAAAAAAAAAAAAAA//////////8A/////////wAAAAAAAAD///////9kAAAAAAAAAAAAAAD//////////wD/////////AAAAAAAAAP////////QkAAAAAAAAAAAAAP//////////AP////////8AAAAAAAAA/////////8wEAAAAAAAAAAAA//////////8A/////////wAAAAAAAAD//////////4QAAAAAAAAAAAD//////////wD/////////AAAAAAAAAP///////////DwAAAAAAAAAAP//////////AP////////8AAAAAAAAA////////////4BAAAAAAAAAA//////////8A/////////wAAAAAAAAD/////////////qAAAAAAAAAD//////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8=',
'width' => 40
),
'O' => array(
'data' => 'AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A///////////////////0qGw4HAAAABw4aKT0/////////////////wD////////////////wcAwAAAAAAAAAAAAAAAho6P//////////////AP//////////////uBQAAAAAAAAAAAAAAAAAAAAMoP////////////8A/////////////6AEAAAAAAAAAAAAAAAAAAAAAAAAkP///////////wD///////////+4BAAAAAAAAAAAAAAAAAAAAAAAAAAAoP//////////AP//////////8BQAAAAAAAAAAAAAAAAAAAAAAAAAAAAM5P////////8A//////////9wAAAAAAAAAAAsrPD/7KQsAAAAAAAAAABg/////////wD/////////+BAAAAAAAAAAUPj///////hQAAAAAAAAAAjs////////AP////////+sAAAAAAAAABDw//////////AYAAAAAAAAAKD///////8A/////////2wAAAAAAAAAdP///////////3wAAAAAAAAAYP///////wD/////////OAAAAAAAAAC4////////////xAAAAAAAAAAw////////AP////////8cAAAAAAAAAOD////////////oAAAAAAAAABT///////8A/////////wAAAAAAAAAA//////////////8AAAAAAAAAAP///////wD/////////AAAAAAAAAAD//////////////wAAAAAAAAAA////////AP////////8AAAAAAAAAAP/////////////8AAAAAAAAAAD///////8A/////////xwAAAAAAAAA5P///////////+AAAAAAAAAAHP///////wD/////////NAAAAAAAAAC8////////////uAAAAAAAAAA4////////AP////////9oAAAAAAAAAHj///////////98AAAAAAAAAGT///////8A/////////6gAAAAAAAAAGPD/////////+BgAAAAAAAAApP///////wD/////////9AwAAAAAAAAAUPz///////xcAAAAAAAAAAjs////////AP//////////cAAAAAAAAAAALKjs//CwOAAAAAAAAAAAYP////////8A///////////wFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAzk/////////wD///////////+4BAAAAAAAAAAAAAAAAAAAAAAAAAAAoP//////////AP////////////+QAAAAAAAAAAAAAAAAAAAAAAAAAJD///////////8A//////////////+sEAAAAAAAAAAAAAAAAAAAAAyg/////////////wD////////////////oZAgAAAAAAAAAAAAAAARg4P//////////////AP//////////////////9KhsOCAAAAAUMFyc7P////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8=',
'width' => 40
),
'P' => array(
'data' => 'AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP///////////wAAAAAAAAAAAAAAAAAACCxguP////////////////8A////////////AAAAAAAAAAAAAAAAAAAAAAAAOOD//////////////wD///////////8AAAAAAAAAAAAAAAAAAAAAAAAAGOD/////////////AP///////////wAAAAAAAAAAAAAAAAAAAAAAAAAARP////////////8A////////////AAAAAAAAAAAAAAAAAAAAAAAAAAAAxP///////////wD///////////8AAAAAAAAAAAAAAAAAAAAAAAAAAABo////////////AP///////////wAAAAAAAAAA////6JwMAAAAAAAAADD///////////8A////////////AAAAAAAAAAD//////6AAAAAAAAAADP///////////wD///////////8AAAAAAAAAAP//////9AAAAAAAAAAA////////////AP///////////wAAAAAAAAAA///////0AAAAAAAAAAD///////////8A////////////AAAAAAAAAAD//////5gAAAAAAAAAHP///////////wD///////////8AAAAAAAAAAP///9iICAAAAAAAAABI////////////AP///////////wAAAAAAAAAAAAAAAAAAAAAAAAAAAJD///////////8A////////////AAAAAAAAAAAAAAAAAAAAAAAAAAAI6P///////////wD///////////8AAAAAAAAAAAAAAAAAAAAAAAAAAIT/////////////AP///////////wAAAAAAAAAAAAAAAAAAAAAAAABU/P////////////8A////////////AAAAAAAAAAAAAAAAAAAAAAAIhPz//////////////wD///////////8AAAAAAAAAAAAAAAAABCRMkOz/////////////////AP///////////wAAAAAAAAAA//////////////////////////////8A////////////AAAAAAAAAAD//////////////////////////////wD///////////8AAAAAAAAAAP//////////////////////////////AP///////////wAAAAAAAAAA//////////////////////////////8A////////////AAAAAAAAAAD//////////////////////////////wD///////////8AAAAAAAAAAP//////////////////////////////AP///////////wAAAAAAAAAA//////////////////////////////8A////////////AAAAAAAAAAD//////////////////////////////wD///////////8AAAAAAAAAAP//////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8=',
'width' => 40
),
'Q' => array(
'data' => 'AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////SoaDQcAAAAHDhoqPT///////////////////8A//////////////BwDAAAAAAAAAAAAAAACHDo/////////////////wD///////////+4FAAAAAAAAAAAAAAAAAAAABCo////////////////AP//////////nAQAAAAAAAAAAAAAAAAAAAAAAACQ//////////////8A/////////7gEAAAAAAAAAAAAAAAAAAAAAAAAAACg/////////////wD////////wFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAzo////////////AP///////3AAAAAAAAAAACyo8P/sqCwAAAAAAAAAAGT///////////8A///////4EAAAAAAAAABM+P///////FQAAAAAAAAACPT//////////wD//////7AAAAAAAAAAFPD/////////9BgAAAAAAAAApP//////////AP//////bAAAAAAAAAB4////////////fAAAAAAAAABk//////////8A//////84AAAAAAAAALz///////////+8AAAAAAAAADT//////////wD//////xwAAAAAAAAA6P///////////+QAAAAAAAAAHP//////////AP//////AAAAAAAAAAD//////////////wAAAAAAAAAA//////////8A//////8AAAAAAAAAAP//////////////AAAAAAAAAAD//////////wD//////wAAAAAAAAAA/P////////////8AAAAAAAAAAP//////////AP//////GAAAAAAAAADg////////////4AAAAAAAAAAc//////////8A//////84AAAAAAAAALT////MJHTo//+8AAAAAAAAADT//////////wD//////2wAAAAAAAAAdP///2AAABCg/3wAAAAAAAAAZP//////////AP//////rAAAAAAAAAAY9P/sCAAAAABMGAAAAAAAAACk//////////8A///////4EAAAAAAAAABU/P+0OAAAAAAAAAAAAAAACPT//////////wD///////94AAAAAAAAAAA4sPD/gAAAAAAAAAAAAABk////////////AP////////AcAAAAAAAAAAAAAAAAAAAAAAAAAAAADOT///////////8A/////////7wEAAAAAAAAAAAAAAAAAAAAAAAAAACQ/////////////wD//////////6wEAAAAAAAAAAAAAAAAAAAAAAAAABSs////////////AP///////////7gUAAAAAAAAAAAAAAAAAAAAAAAAAABAwP////////8A//////////////BwDAAAAAAAAAAAAAAABAgAAAAAAAA8/////////wD////////////////0qGg0GAAAABgwXJjkxBgAAAAAALD/////////AP//////////////////////////////////5DQAAAAk/P////////8A////////////////////////////////////+GwAAJD//////////wD//////////////////////////////////////8A49P//////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8=',
'width' => 40
),
'R' => array(
'data' => 'AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////wAAAAAAAAAAAAAAAAAAAAQgOGSk+P///////////////wD/////////AAAAAAAAAAAAAAAAAAAAAAAAAAAcuP//////////////AP////////8AAAAAAAAAAAAAAAAAAAAAAAAAAAAEsP////////////8A/////////wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQ6P///////////wD/////////AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAB8////////////AP////////8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAADD///////////8A/////////wAAAAAAAAAA///////svDgAAAAAAAAACP///////////wD/////////AAAAAAAAAAD/////////7AAAAAAAAAAA////////////AP////////8AAAAAAAAAAP/////////cAAAAAAAAABD///////////8A/////////wAAAAAAAAAA//////DQoCQAAAAAAAAAQP///////////wD/////////AAAAAAAAAAAAAAAAAAAAAAAAAAAAAACU////////////AP////////8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAIPj///////////8A/////////wAAAAAAAAAAAAAAAAAAAAAAAAAAAAzU/////////////wD/////////AAAAAAAAAAAAAAAAAAAAAAAAAAA02P//////////////AP////////8AAAAAAAAAAAAAAAAAAAAAAAxctPz///////////////8A/////////wAAAAAAAAAAAAAAAAAAAAAAAEDY/////////////////wD/////////AAAAAAAAAAD/9LAsAAAAAAAAAAzc////////////////AP////////8AAAAAAAAAAP///+wkAAAAAAAAADD8//////////////8A/////////wAAAAAAAAAA/////8QAAAAAAAAAAJD//////////////wD/////////AAAAAAAAAAD//////1QAAAAAAAAAFPD/////////////AP////////8AAAAAAAAAAP//////3AQAAAAAAAAAgP////////////8A/////////wAAAAAAAAAA////////aAAAAAAAAAAM6P///////////wD/////////AAAAAAAAAAD////////oCAAAAAAAAABs////////////AP////////8AAAAAAAAAAP////////+AAAAAAAAAAATc//////////8A/////////wAAAAAAAAAA//////////AUAAAAAAAAAFj//////////wD/////////AAAAAAAAAAD//////////5AAAAAAAAAAAND/////////AP////////8AAAAAAAAAAP//////////+CQAAAAAAAAAQP////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8=',
'width' => 40
),
'S' => array(
'data' => 'AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP/////////////////8vHBEIAgAAAQgQHC8/P////////////////8A////////////////pCQAAAAAAAAAAAAAAAAcoP///////////////wD//////////////FwAAAAAAAAAAAAAAAAAAAAAXP//////////////AP////////////9oAAAAAAAAAAAAAAAAAAAAAAAAhP////////////8A////////////zAAAAAAAAAAAAAAAAAAAAAAAAAAI6P///////////wD///////////9cAAAAAAAAAAAAAAAAAAAAAAAAAACA////////////AP///////////xgAAAAAAAAAUOD/8KwkAAAAAAAAADj///////////8A////////////AAAAAAAAAAD0/////8wABCAgICxASP///////////wD///////////8MAAAAAAAAAMz/////////////////////////////AP///////////0AAAAAAAAAACFiQxPT///////////////////////8A////////////oAAAAAAAAAAAAAAAADBwtPT//////////////////wD////////////8QAAAAAAAAAAAAAAAAAAACFTA////////////////AP/////////////oOAAAAAAAAAAAAAAAAAAAAABM6P////////////8A///////////////4fAgAAAAAAAAAAAAAAAAAAAAY2P///////////wD/////////////////7IwwAAAAAAAAAAAAAAAAAAAo+P//////////AP/////////////////////koGw0BAAAAAAAAAAAAACU//////////8A///////////////////////////4uFgAAAAAAAAAADz//////////wD//////////2BgSEA0IBwA6P///////5QAAAAAAAAADP//////////AP//////////JAAAAAAAAACc/////////AAAAAAAAAAA//////////8A//////////9YAAAAAAAAACDo///////AAAAAAAAAABT//////////wD//////////6QAAAAAAAAAACCk7P/snBQAAAAAAAAAUP//////////AP//////////+BAAAAAAAAAAAAAAAAAAAAAAAAAAAACs//////////8A////////////kAAAAAAAAAAAAAAAAAAAAAAAAAAAOP///////////wD////////////8RAAAAAAAAAAAAAAAAAAAAAAAABjc////////////AP/////////////0PAAAAAAAAAAAAAAAAAAAAAAg2P////////////8A///////////////8hBQAAAAAAAAAAAAAAAAMdPT//////////////wD/////////////////+LRwSCAMAAAAHDhoqPT/////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8=',
'width' => 40
),
'T' => array(
'data' => 'AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA////////////AP////////8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD///////////8A/////////wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP///////////wD/////////AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA////////////AP////////8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD///////////8A/////////wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP///////////wD///////////////////8AAAAAAAAAAP//////////////////////AP///////////////////wAAAAAAAAAA//////////////////////8A////////////////////AAAAAAAAAAD//////////////////////wD///////////////////8AAAAAAAAAAP//////////////////////AP///////////////////wAAAAAAAAAA//////////////////////8A////////////////////AAAAAAAAAAD//////////////////////wD///////////////////8AAAAAAAAAAP//////////////////////AP///////////////////wAAAAAAAAAA//////////////////////8A////////////////////AAAAAAAAAAD//////////////////////wD///////////////////8AAAAAAAAAAP//////////////////////AP///////////////////wAAAAAAAAAA//////////////////////8A////////////////////AAAAAAAAAAD//////////////////////wD///////////////////8AAAAAAAAAAP//////////////////////AP///////////////////wAAAAAAAAAA//////////////////////8A////////////////////AAAAAAAAAAD//////////////////////wD///////////////////8AAAAAAAAAAP//////////////////////AP///////////////////wAAAAAAAAAA//////////////////////8A////////////////////AAAAAAAAAAD//////////////////////wD///////////////////8AAAAAAAAAAP//////////////////////AP///////////////////wAAAAAAAAAA//////////////////////8A////////////////////AAAAAAAAAAD//////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8=',
'width' => 40
),
'U' => array(
'data' => 'AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////8AAAAAAAAAAP///////////wAAAAAAAAAA//////////8A/////////wAAAAAAAAAA////////////AAAAAAAAAAD//////////wD/////////AAAAAAAAAAD///////////8AAAAAAAAAAP//////////AP////////8AAAAAAAAAAP///////////wAAAAAAAAAA//////////8A/////////wAAAAAAAAAA////////////AAAAAAAAAAD//////////wD/////////AAAAAAAAAAD///////////8AAAAAAAAAAP//////////AP////////8AAAAAAAAAAP///////////wAAAAAAAAAA//////////8A/////////wAAAAAAAAAA////////////AAAAAAAAAAD//////////wD/////////AAAAAAAAAAD///////////8AAAAAAAAAAP//////////AP////////8AAAAAAAAAAP///////////wAAAAAAAAAA//////////8A/////////wAAAAAAAAAA////////////AAAAAAAAAAD//////////wD/////////AAAAAAAAAAD///////////8AAAAAAAAAAP//////////AP////////8AAAAAAAAAAP///////////wAAAAAAAAAA//////////8A/////////wAAAAAAAAAA////////////AAAAAAAAAAD//////////wD/////////AAAAAAAAAAD///////////8AAAAAAAAAAP//////////AP////////8AAAAAAAAAAP///////////wAAAAAAAAAA//////////8A/////////wAAAAAAAAAA////////////AAAAAAAAAAD//////////wD/////////JAAAAAAAAADk/////////+gAAAAAAAAAHP//////////AP////////9MAAAAAAAAAJz/////////nAAAAAAAAABE//////////8A/////////4gAAAAAAAAAHOj//////+ggAAAAAAAAAHz//////////wD/////////0AAAAAAAAAAAIJzs/+ykIAAAAAAAAAAA0P//////////AP//////////QAAAAAAAAAAAAAAAAAAAAAAAAAAAAED///////////8A///////////IBAAAAAAAAAAAAAAAAAAAAAAAAAAE0P///////////wD///////////+YAAAAAAAAAAAAAAAAAAAAAAAAAJj/////////////AP////////////+UBAAAAAAAAAAAAAAAAAAAAASU//////////////8A///////////////IPAAAAAAAAAAAAAAAAAAwyP///////////////wD/////////////////0IxYOCAIAAAEIEiAyP//////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8=',
'width' => 40
),
'V' => array(
'data' => 'AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD//////zAAAAAAAAAAYP//////////////ZAAAAAAAAAAw////////AP//////kAAAAAAAAAAU/P////////////8UAAAAAAAAAJD///////8A///////oBAAAAAAAAADE////////////xAAAAAAAAAAE7P///////wD///////9MAAAAAAAAAHD///////////94AAAAAAAAAEz/////////AP///////6gAAAAAAAAAJP///////////yQAAAAAAAAArP////////8A////////+BAAAAAAAAAA1P/////////YAAAAAAAAABT4/////////wD/////////aAAAAAAAAACE/////////4QAAAAAAAAAbP//////////AP/////////EAAAAAAAAADT/////////OAAAAAAAAADM//////////8A//////////8kAAAAAAAAAOT//////+QAAAAAAAAAKP///////////wD//////////4QAAAAAAAAAmP//////nAAAAAAAAACI////////////AP//////////5AAAAAAAAABE//////9EAAAAAAAABOT///////////8A////////////QAAAAAAAAAT0////9AgAAAAAAABI/////////////wD///////////+gAAAAAAAAAKT///+kAAAAAAAAAKj/////////////AP////////////QIAAAAAAAAXP///1wAAAAAAAAM+P////////////8A/////////////1wAAAAAAAAM+P/8DAAAAAAAAGT//////////////wD/////////////vAAAAAAAAAC8/7wAAAAAAAAAxP//////////////AP//////////////HAAAAAAAAGj/aAAAAAAAACT///////////////8A//////////////94AAAAAAAAHP8cAAAAAAAAhP///////////////wD//////////////9gAAAAAAAAAkAAAAAAAAADk////////////////AP///////////////zgAAAAAAAAQAAAAAAAAQP////////////////8A////////////////lAAAAAAAAAAAAAAAAACg/////////////////wD////////////////sCAAAAAAAAAAAAAAADPT/////////////////AP////////////////9QAAAAAAAAAAAAAABg//////////////////8A/////////////////7AAAAAAAAAAAAAAAMD//////////////////wD//////////////////BQAAAAAAAAAAAAc////////////////////AP//////////////////cAAAAAAAAAAAAHz///////////////////8A///////////////////MAAAAAAAAAAAA3P///////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8=',
'width' => 40
),
'W' => array(
'data' => 'AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A//8cAAAAAAAAALz/////4AAAAAAAAAAA6P////+8AAAAAAAAABz//wD//1QAAAAAAAAAjP////+gAAAAAAAAAACo/////4wAAAAAAAAAUP//AP//jAAAAAAAAABU/////2AAAAAAAAAAAGj/////VAAAAAAAAACM//8A///EAAAAAAAAACT/////IAAAAAAAAAAAKP////8kAAAAAAAAAMT//wD///gEAAAAAAAAAPD//+AAAAAAAAAAAAAA6P//8AAAAAAAAAAE9P//AP///zAAAAAAAAAAvP//oAAAAAAAAAAAAACo//+8AAAAAAAAADD///8A////bAAAAAAAAACM//9gAAAAAAAAAAAAAGT//4wAAAAAAAAAaP///wD///+kAAAAAAAAAFT//yAAAAAAAAAAAAAAIP//VAAAAAAAAACc////AP///9gAAAAAAAAAJP/gAAAAAAAAAAAAAAAA4P8kAAAAAAAAANT///8A/////xAAAAAAAAAA8KAAAAAAAAAAAAAAAACg8AAAAAAAAAAQ/////wD/////TAAAAAAAAAC8YAAAAAAAAAAAAAAAAGC8AAAAAAAAAET/////AP////+AAAAAAAAAAIwgAAAAAAAAAAAAAAAAIIwAAAAAAAAAfP////8A/////7gAAAAAAAAANAAAAAAAACwwAAAAAAAANAAAAAAAAACw/////wD/////8AAAAAAAAAAAAAAAAAAAdHgAAAAAAAAAAAAAAAAAAOz/////AP//////KAAAAAAAAAAAAAAAAAC4vAAAAAAAAAAAAAAAAAAg//////8A//////9gAAAAAAAAAAAAAAAACPj4CAAAAAAAAAAAAAAAAFj//////wD//////5QAAAAAAAAAAAAAAABE//9IAAAAAAAAAAAAAAAAkP//////AP//////0AAAAAAAAAAAAAAAAIj//4wAAAAAAAAAAAAAAADI//////8A///////8DAAAAAAAAAAAAAAAzP//1AAAAAAAAAAAAAAABPj//////wD///////88AAAAAAAAAAAAABT/////GAAAAAAAAAAAAAA0////////AP///////3QAAAAAAAAAAAAAWP////9gAAAAAAAAAAAAAHD///////8A////////sAAAAAAAAAAAAACg/////6QAAAAAAAAAAAAApP///////wD////////kAAAAAAAAAAAAAOT/////6AAAAAAAAAAAAADc////////AP////////8cAAAAAAAAAAAo////////MAAAAAAAAAAAEP////////8A/////////1QAAAAAAAAAAHD///////94AAAAAAAAAABM/////////wD/////////jAAAAAAAAAAAtP///////7wAAAAAAAAAAID/////////AP/////////EAAAAAAAAAAT0////////+AgAAAAAAAAAuP////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8=',
'width' => 40
),
'X' => array(
'data' => 'AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD///////9UAAAAAAAAAKz///////////+sAAAAAAAAAFD/////////AP///////+QQAAAAAAAAFOT/////////8BwAAAAAAAAM5P////////8A/////////5gAAAAAAAAATP////////9kAAAAAAAAAJD//////////wD//////////0AAAAAAAAAAoP//////wAAAAAAAAAA0/P//////////AP//////////2AgAAAAAAAAQ4P////gkAAAAAAAABMz///////////8A////////////iAAAAAAAAABA////dAAAAAAAAABw/////////////wD////////////8MAAAAAAAAACU/9AEAAAAAAAAHPD/////////////AP/////////////IBAAAAAAAAAzYMAAAAAAAAACs//////////////8A//////////////90AAAAAAAAABAAAAAAAAAATP///////////////wD///////////////QgAAAAAAAAAAAAAAAAAAzg////////////////AP///////////////7wAAAAAAAAAAAAAAAAAjP////////////////8A/////////////////2AAAAAAAAAAAAAAADD8/////////////////wD/////////////////7BQAAAAAAAAAAAAEyP//////////////////AP/////////////////gDAAAAAAAAAAAAAjY//////////////////8A/////////////////0AAAAAAAAAAAAAAADj8/////////////////wD///////////////+UAAAAAAAAAAAAAAAAAJD/////////////////AP//////////////4AwAAAAAAAAAAAAAAAAADOD///////////////8A//////////////9AAAAAAAAAAAAAAAAAAAAAQP///////////////wD/////////////nAAAAAAAAAAAWAAAAAAAAAAAlP//////////////AP///////////+QQAAAAAAAAAGD/YAAAAAAAAAAM4P////////////8A////////////TAAAAAAAAAAs9P/0LAAAAAAAAABM/////////////wD//////////6AAAAAAAAAADNT////UDAAAAAAAAACg////////////AP/////////kEAAAAAAAAACg//////+gAAAAAAAAABDk//////////8A/////////0wAAAAAAAAAYP////////9gAAAAAAAAAEz//////////wD///////+oAAAAAAAAACz0//////////QsAAAAAAAAAKT/////////AP//////7BQAAAAAAAAM1P///////////9QMAAAAAAAAFOz///////8A//////9UAAAAAAAAAKD//////////////6AAAAAAAAAAVP///////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8=',
'width' => 40
),
'Y' => array(
'data' => 'AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP///////1QAAAAAAAAAAGj//////////2gAAAAAAAAAAFT///////8A////////5BAAAAAAAAAAAMT////////EAAAAAAAAAAAQ5P///////wD/////////mAAAAAAAAAAAKPj/////+CgAAAAAAAAAAJj/////////AP//////////PAAAAAAAAAAAgP////+AAAAAAAAAAAA8//////////8A///////////YCAAAAAAAAAAE2P//2AQAAAAAAAAACNj//////////wD///////////+AAAAAAAAAAAA4//84AAAAAAAAAACA////////////AP////////////woAAAAAAAAAACUlAAAAAAAAAAAKPz///////////8A/////////////8gAAAAAAAAAABAQAAAAAAAAAADI/////////////wD//////////////2wAAAAAAAAAAAAAAAAAAAAAbP//////////////AP//////////////8BwAAAAAAAAAAAAAAAAAABzw//////////////8A////////////////tAAAAAAAAAAAAAAAAAAAtP///////////////wD/////////////////VAAAAAAAAAAAAAAAAFT/////////////////AP/////////////////oEAAAAAAAAAAAAAAQ6P////////////////8A//////////////////+cAAAAAAAAAAAAAJz//////////////////wD///////////////////9AAAAAAAAAAABA////////////////////AP///////////////////9gAAAAAAAAAANj///////////////////8A/////////////////////wAAAAAAAAAA/////////////////////wD/////////////////////AAAAAAAAAAD/////////////////////AP////////////////////8AAAAAAAAAAP////////////////////8A/////////////////////wAAAAAAAAAA/////////////////////wD/////////////////////AAAAAAAAAAD/////////////////////AP////////////////////8AAAAAAAAAAP////////////////////8A/////////////////////wAAAAAAAAAA/////////////////////wD/////////////////////AAAAAAAAAAD/////////////////////AP////////////////////8AAAAAAAAAAP////////////////////8A/////////////////////wAAAAAAAAAA/////////////////////wD/////////////////////AAAAAAAAAAD/////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8=',
'width' => 40
),
'Z' => array(
'data' => 'AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A//////////8AAAAAAAAAAAAAAAAAAAAAAAAAAAD//////////////wD//////////wAAAAAAAAAAAAAAAAAAAAAAAAAAAP//////////////AP//////////AAAAAAAAAAAAAAAAAAAAAAAAAAAA//////////////8A//////////8AAAAAAAAAAAAAAAAAAAAAAAAAAAD//////////////wD//////////wAAAAAAAAAAAAAAAAAAAAAAAAAAAP//////////////AP//////////AAAAAAAAAAAAAAAAAAAAAAAAAAAQ//////////////8A/////////////////////////1AAAAAAAAAABLz//////////////wD///////////////////////98AAAAAAAAAACY////////////////AP//////////////////////pAAAAAAAAAAAaP////////////////8A/////////////////////8QIAAAAAAAAAET8/////////////////wD////////////////////gGAAAAAAAAAAo9P//////////////////AP//////////////////9CwAAAAAAAAAFNz///////////////////8A//////////////////xMAAAAAAAAAATA/////////////////////wD/////////////////eAAAAAAAAAAAnP//////////////////////AP///////////////5wAAAAAAAAAAHT///////////////////////8A///////////////ABAAAAAAAAABM/P///////////////////////wD/////////////3BQAAAAAAAAALPT/////////////////////////AP////////////QoAAAAAAAAABjg//////////////////////////8A///////////8SAAAAAAAAAAExP///////////////////////////wD//////////2wAAAAAAAAAAKD/////////////////////////////AP////////+YAAAAAAAAAAB8//////////////////////////////8A/////////wQAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/////////////wD/////////AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD/////////////AP////////8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP////////////8A/////////wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/////////////wD/////////AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD/////////////AP////////8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8=',
'width' => 40
),
);
return $_png;
}
// These define base64_encoded raw png image data used
// when we cannot generate our own single png image
function define_raw_pngs()
{
$_png = array(
'0' => 'iVBORw0KGgoAAAANSUhEUgAAACgAAAAoCAAAAACpleexAAAAFXRFWHRDcmVhdGlvbiBUaW1lAAfTBQ4QKCNGXKO6AAAAB3RJTUUH0wUOEDQ6EUG1VwAAAAlwSFlzAAALEgAACxIB0t1+/AAAAXNJREFUeNpj/M9AHGAiUt2wVvhyaqAqKyOjpG3jQwaGv+e+IUn9RwJfSjjg4iwFP1aKJD6HyyErfGGAYrquIoP5E2wK/zigu0v5wH9sChdgeKDqP1aFGhBZmxv/z0Dd4IxV4RWIpMQHIPuJAITzAqEQETx7IFQIP5CQNoJwDmALxzMQCuyjg1chnBPYwtECwr8AZN41h0p6YHOjAkTuwf//77wYuCEcFWwKOWA2fM1iZuuHcASwKYQ55c9ENuasrxgRjKlwJS+D17v/hBUeUGYwv/sfn0IRiJQZJIbxuFEFagjvSlDUQNgK2GIGqpC1JRhIfoAqxBYz0DRhn8IMJO+giKEqhMaMJBeI3AHhIKdkRPqG8DlAifqFADyasKRHO6h1Z/6fMYEwTbCmx3cWGCl8CTaFwBhGz+M2/7EpXMvOnBmIok7jBVaFz/Mi3/1pQORrhpgPyOr+M8IL0j9/gKpeLjhy5QEwoDVsYuRR3cE4IktcAJNx8cJaZBeQAAAAAElFTkSuQmCC',
'1' => 'iVBORw0KGgoAAAANSUhEUgAAACgAAAAoCAAAAACpleexAAAAFXRFWHRDcmVhdGlvbiBUaW1lAAfTBQ4QMi//xxVKAAAAB3RJTUUH0wUOEDYLcqnX7wAAAAlwSFlzAAALEgAACxIB0t1+/AAAAHpJREFUeNpj/M9AHGAiUh1WhR8FGUGAsMKaD9iM/I8BlmCVwVS4hoUohT8qcNiFyv2zQIWBCIV3amRwu54RKcDRAgQ1KigIcJYK7CqR3QsCFmf+Y8qgeQakbANMAz6FKjUXECbj8zWa76nm61GFw1UhI10KqVGFNFQIADdK9Zj7PsV9AAAAAElFTkSuQmCC',
'2' => 'iVBORw0KGgoAAAANSUhEUgAAACgAAAAoCAAAAACpleexAAAAFXRFWHRDcmVhdGlvbiBUaW1lAAfTBQ4QMwPUBEjoAAAAB3RJTUUH0wUOEDUqFe2UcgAAAAlwSFlzAAALEgAACxIB0t1+/AAAAQxJREFUeNpj/M9AHGAiUt2owkGrkAWF93LFgStPfjCwyGiYRGijqfyPAH9aOJAkQl78RwbICkNQjdB4gUNhD7qzLLAr/CKA4YENSAoRvl7zAUJXvPmxhgfCXILVMxEQvg+IDVUhgtVqDYjkDhD7B2aQIMIx5cOTN29evLAAsaEKObBajQzmQOQMcIQjHLwQgSisIaDwBdS5LHfwK7yhAHVVyX+8CrdAA5HB5gdehQ3Yoxpd4ZcAmDqbD//xKISEIjhU//zHoxDmXQaeFRhOZ8CmzuDOf3wKf8DsDfnyH6/CHJi6P//xKjyDJethVehBpMI7DPgVwrPCCgb8AK5wDwGFcNMF8EkCASOx1QcAGUxu1untnFIAAAAASUVORK5CYII=',
'3' => 'iVBORw0KGgoAAAANSUhEUgAAACgAAAAoCAAAAACpleexAAAAFXRFWHRDcmVhdGlvbiBUaW1lAAfTBQ4QMxBQugk2AAAAB3RJTUUH0wUOEDU3duv4qwAAAAlwSFlzAAALEgAACxIB0t1+/AAAATdJREFUeNpj/M9AHGAiUt0IVciCzPm7ZceZB28YGBQkLHwcmNFU/keANRJI4ioH/qMAJIUlaHatwaFwBrqrOO5gVfiCB8P9KVgVVkAtnPDh/wkLCFsGq0IFiGQLiH0D06P/GWHJ7O+NOzfuXLlzQRrEhgSawHscwYPurxAcwQMBf/4/aIAYyHIGr8IEeDhO+Y9XoQNUncwOVHGMRPEDSovc+IkzrpGDCQgUbuC1WgBhhsIHfAp3vPn/oIIFKfRxKQSDGohCA4IKX0DTD7YoRAWMUJ9iyQpbn4DBBWUQ5yFEDDnFw622gXAzwBxoYvfB5sYlUI0lD/4/gWWKJdgU/tHAcKjCD6y+PsGCpo4FJbaRgmcNqkqWCThTzxkTJHXo+Ro1HA9uOPHiATDlKJj4eKCVFIzDqWgGAK7GW/haPS+zAAAAAElFTkSuQmCC',
'4' => 'iVBORw0KGgoAAAANSUhEUgAAACgAAAAoCAAAAACpleexAAAAFXRFWHRDcmVhdGlvbiBUaW1lAAfTBQ4QMyqWttCEAAAAB3RJTUUH0wUOEDUxn4hdngAAAAlwSFlzAAALEgAACxIB0t1+/AAAAKBJREFUeNpj/M9AHGAiUh2FCucyQgCK4H9McIAFixwWhQ8kGIhS+MWAgTiFIQzEKWxhIE7hFgbiFF7hASkQIajwjQpInuUAIYV/XMDyU/4TUlgAlk75T0jhArCszR9CCk+AY07mxX8CCp+AY47nzH8CCn+YgOWW/CekMAYsVfMfl0JGmCBq4kNEDp2zAn0UMmItABjRvDykPTO43DgyFQIANP6pTFLWAdoAAAAASUVORK5CYII=',
'5' => 'iVBORw0KGgoAAAANSUhEUgAAACgAAAAoCAAAAACpleexAAAAFXRFWHRDcmVhdGlvbiBUaW1lAAfTBQ4QMzPy3XhEAAAAB3RJTUUH0wUOEDUk8lW5dQAAAAlwSFlzAAALEgAACxIB0t1+/AAAAQpJREFUeNpj/M9AHGAiUt2oQuIVfmREBzgU3iHWxAfEKiTaRFpZnfAfAbAr/AsxUYagiVCbeQgqhPpFYmukLCOrZupRNJUIB02BCAjAZCK+/Ed2LoJZgm6bzRfsCgMw3JWAXaEBpg8uIGSRPPMBQmXc+P+iggXCnoOQZUQK1K8PgEAjGcQs7QGL6FzG5mtkcAUiyYIQYcRRUkDTLEIWR1b4ixamQMPhrKUP3rx48eDNFXmwdyFiOthixgXqaTAnBcKpwRaOS6A6Mx78fwBVx/IAm8I/KsTGzAkWNHUyb7Ar/L8GNSlK3MCRev7/v+CApC7kBUoUoAX4yQ0nHjwAWqpiE6GNFgNDoAwHAKC2Q2lMNcCmAAAAAElFTkSuQmCC',
'6' => 'iVBORw0KGgoAAAANSUhEUgAAACgAAAAoCAAAAACpleexAAAAFXRFWHRDcmVhdGlvbiBUaW1lAAfTBQ4QNAObRd4vAAAAB3RJTUUH0wUOEDUc2lcB6wAAAAlwSFlzAAALEgAACxIB0t1+/AAAATtJREFUeNpj/M9AHGAiUh2Gwq2puryMjKKmmSfRVf5HBkcMEBI+L1CkUBROYUE2QuMFLoVr0CzzwKHwhQC6szZgV1gAtfHI/xs2mEYywsPxp8QHEMVxQ56B4aaJiIKIiIRCPDZf74DwI/5jB4hwPAChbAgG+BWoExlOxkoysuqW3sUV4BoQ/p0SqARLB44AF4HIByDMKMCuEIu7phCrUOADNl/DgMOJ/09SIMwPC7B5hgfC1/kB4kRAOC7YrFaByM0Ac85AOCLYrFaBhSMIQNPlG2wBDg3HP2CSGU/MuEAoiKVXUWxB9cwPiG8UwEGSg5FCMNOjwZ4/byqgpqwgMoWr/MGeZ1agqWPZgSNz/Z+AqnDCf1wK/29B8qbKDhQpRtTE8HfLjjMP3jDwKJh4hKCGJSPNC6lRhTRWCABWpdoxd/bZ4QAAAABJRU5ErkJggg==',
'7' => 'iVBORw0KGgoAAAANSUhEUgAAACgAAAAoCAAAAACpleexAAAAFXRFWHRDcmVhdGlvbiBUaW1lAAfTBQ4QNA18/fMoAAAAB3RJTUUH0wUOEDUVo4u5TwAAAAlwSFlzAAALEgAACxIB0t1+/AAAAM9JREFUeNpj/M9AHGAiUt2oQnorZIGzGLFJIyJ40HqGhUiFPFuQ/YUFPBGBmLcDSQybwj8OEDOW/CegsAeiruQ/AYV3OMDqTP4QUugCceCN/wQUQn1a8Z+Awj8qYHUiHwgpXAAxcMJ/Qgp1wOoEPhBSuANiYM5/QgpjIAovEFL4gweszgAz0NASxZ4vYMqHYDKDBiIWhWhWa0CS1x9CVn+8AaYsmAlZfQRC6RDMChADGTQIKjxDrMI7EEoBi0JGlMJe8AOY+sFOSCEeQHQBAABCZ7xyT9fJhwAAAABJRU5ErkJggg==',
'8' => 'iVBORw0KGgoAAAANSUhEUgAAACgAAAAoCAAAAACpleexAAAAFXRFWHRDcmVhdGlvbiBUaW1lAAfTBQ4QNBeBnwpSAAAAB3RJTUUH0wUOEDUOKe5wowAAAAlwSFlzAAALEgAACxIB0t1+/AAAATVJREFUeNpj/M9AHGAiUt1AKmRB459cc+DBGwYWGQ2LEG1Umf/I4IELkozLA2QpFIUXJFDMEDiBQ+EHGTR3yHzArrAFwwct2BXqQGQ1zvw/owFh6mBXCDXmDJB5BsOrjEhxzfoHIgkiGCGB9xtrgEPtOwvEV6FWY4+ZAAgVc5LhZgKEGYI9wN+gBiPu4Pl/BFWlxA1cMfN/C0rUr8AVhX8K0KyuwaEwASNmarAqPACVTXnw/0oENBFewKYQGhYZYE4MVBM2hVAvQ1LhHQhHBVsUMjIgYhCdhy3PPASTd6GOxBYz0KhOQHajDjY3pkC1Rlz5fweqjqEAm8ILGK5gYLlDZICXYI+ZLzZo6gL+4EgUfyo4kJQJtCCpQ8kKQPB2zZ47L14AU5iMgUMAN7IM43AqHwdQIQAhMPz6Gz5V/wAAAABJRU5ErkJggg==',
'9' => 'iVBORw0KGgoAAAANSUhEUgAAACgAAAAoCAAAAACpleexAAAAFXRFWHRDcmVhdGlvbiBUaW1lAAfTBQ4QNCQ+T2tEAAAAB3RJTUUH0wUOEDUHUDLIBwAAAAlwSFlzAAALEgAACxIB0t1+/AAAAUZJREFUeNpj/M9AHGAiUh26wr9rE3V5GRlFTTM3/kVT+R8Z7FBBSKjsQJFCUTiFBcWMCbgUHmBBs20FdoV/VNDUMQi8wapwDVS65s2fPToQZgFWhRFIkm8kwGyeH9gUQm2+Aua0QDhb4LJI4XgHQmmDSRMIZw+emIEENAeEcwObQhEIdQHiABRbUGPGBSIQAWL/gHqbB5tnJkC1Fjz5f8IGwxwkhR8EsCQarFE4hViF/wsQCgKgHsSu8H8HLFkUQL2rgUPh/zslOiwMEjFH/kND2geXQvQgqMAWhSjgAIRygAswIuXCpXfevHjz4M0ZdQaGhxo/wAnyBTuWmPnvARGxuPH/iAa+9Ph/A7r9Ai+wK/zvg6ZwzX8cCl9oICtjmfIfl8L/bwIQ6gyO/Met8P//EwUmwHTJo5OyBU2CkdaF1KhCWisEAM/sJxmZkdWnAAAAAElFTkSuQmCC',
'A' => 'iVBORw0KGgoAAAANSUhEUgAAACgAAAAoCAAAAACpleexAAAAFXRFWHRDcmVhdGlvbiBUaW1lAAfTBQ4QFwy1U7TfAAAAB3RJTUUH0wUOEC0ZKCZtPQAAAAlwSFlzAAALEgAACxIB0t1+/AAAAO1JREFUeNrt1LERwiAUBuAHZ2GRwsIypQMwQEZwgBQpM4QDZBSLFI7gCA5gQWGRdA5gkTuMSh48eMTUnq96wH98B+QiDCwruTD3D76qF676ueAp0Y9lSBXeSkFWaLAje3T+kkzK4SgpBzZw8pqxJWcdOJuRsyGPbWDk0tS20zw9SXsobdfytJVXdzNsP61i6Zt3K7Ht0UeUgbPdjsrOXMd+2IS2C2qb271HVWi7YANcNXFQsUEVBTXwNdl46jYRxPl52dnwRUZbhkLSDmS8DnxFRWiULxg8UxvobefuRR8ZQYDKtffVVcQWv/RrfgJC4bd0upw4MQAAAABJRU5ErkJggg==',
'B' => 'iVBORw0KGgoAAAANSUhEUgAAACgAAAAoCAAAAACpleexAAAAFXRFWHRDcmVhdGlvbiBUaW1lAAfTBQ4QGAusrz2zAAAAB3RJTUUH0wUOEC01Gv4B3gAAAAlwSFlzAAALEgAACxIB0t1+/AAAANJJREFUeNpj/M9AHGAiUh0tFTKiAUHL2rsoKv9DARZDWFr+IwA+hQwMFcQqZDhCrMIIYhWK4FYIYv8444PuV+wK//9/A+UJwBUSCHAL3OEIsdoFyttCpGdiiAtHjoY/RCnk6PlBbBRKrCE6CqcQq5DlDs5whIT3CgUI788EvOEIBCegXB2YPCNMBSNMISqf5TeUjysK90LpP/itfrFEAhZCMHkWdKMYUbk2MAah7BqD02pUYEFkgMu8IE6hD0IdpmegwSejoKLjoY7syaFU7A0HhQA2e4cJytImvAAAAABJRU5ErkJggg==',
'C' => 'iVBORw0KGgoAAAANSUhEUgAAACgAAAAoCAAAAACpleexAAAAFXRFWHRDcmVhdGlvbiBUaW1lAAfTBQ4QGBbPqVFqAAAAB3RJTUUH0wUOEC4BEGemqAAAAAlwSFlzAAALEgAACxIB0t1+/AAAASlJREFUeNpj/M9AHGAiUt2owkGrkAWV+3TDgRtPPjBwyGiYBOijSv1HAlcCkGUcTiDLISvsQDOeZQp2hQWYDpuCTeEEbD44ganwDgc2vxpgKoyAyUWc+f9hjgCMtwFd4RuYRxog/ueBcl3QFc6BSmj8gfBrwE40yFmCrjABqrAH5mSZgJ4jX7AEjwlU4Zn/OAAsrp9AaRlccc0IzdeMsBilOPWQrBDmtpfEKnwBpZ8qZq58i6IS6vscKHcBcgQYlOz4gh6OK6AKfaB8G5hN6Aq/wBLPHjB3CczCFIzUA0u2PD0v/j9pgaf1ExgK3wgwYAEOWFL4GizqWC5gyzM1mArnEJkLZ2DPhf//n3BAVmeDkq8ZUZPL3TUn7gBLCgYFBYsAcxQZRmKrDwABNsv9SJSDwwAAAABJRU5ErkJggg==',
'D' => 'iVBORw0KGgoAAAANSUhEUgAAACgAAAAoCAAAAACpleexAAAAFXRFWHRDcmVhdGlvbiBUaW1lAAfTBQ4QGC1+orhOAAAAB3RJTUUH0wUOEC4yr7fHvgAAAAlwSFlzAAALEgAACxIB0t1+/AAAAM9JREFUeNpj/M9AHGAiUt1AKmSBsxiRhXlkNBxCpFFU/ocBTDMyPvxHADwKGRgUbhCpkEHiCZEKGRyIVciwArdCIPPFGg8YzwSvQiBogXFvEFD43wDKnQDl44yZGCh9glAU2sCsJqRQBkq/gMUw3G2wuP6PnU/H9PgRSgsQUvgESosQUngFSqsQUrgCSsNiCFcU7oBx9+CL6w8XamB5SeUPkelxAZEJ1+YPcQolXhCXFTTuEJULOUq+IOVrFgasQELBxMaHG1mEcTiVjwOoEADAIkCnGpmJKgAAAABJRU5ErkJggg==',
'E' => 'iVBORw0KGgoAAAANSUhEUgAAACgAAAAoCAAAAACpleexAAAAFXRFWHRDcmVhdGlvbiBUaW1lAAfTBQ4QGDeDwEE0AAAAB3RJTUUH0wUOEC8CkHXGUwAAAAlwSFlzAAALEgAACxIB0t1+/AAAAD5JREFUeNpj/M9AHGAiUt2owkGrkAXGYMQqjUgJQ8EzpPsa05+D140oMYTk4KEQ4MMqZqgUhcM1czESW30AABfqB1XDnLzcAAAAAElFTkSuQmCC',
'F' => 'iVBORw0KGgoAAAANSUhEUgAAACgAAAAoCAAAAACpleexAAAAFXRFWHRDcmVhdGlvbiBUaW1lAAfTBQ4QGQe8AkDZAAAAB3RJTUUH0wUOEC8JB6cf2wAAAAlwSFlzAAALEgAACxIB0t1+/AAAADlJREFUeNpj/M9AHGAiUt3wUsiCYDJikUYE3lDwDDm+xvTp4HUjIoaQXTsUAnxYxcyoQryAcUSWuAAW/gZTg/yEMAAAAABJRU5ErkJggg==',
'G' => 'iVBORw0KGgoAAAANSUhEUgAAACgAAAAoCAAAAACpleexAAAAFXRFWHRDcmVhdGlvbiBUaW1lAAfTBQ4QGRFI1vWIAAAAB3RJTUUH0wUOEC8QY8y3GwAAAAlwSFlzAAALEgAACxIB0t1+/AAAASZJREFUeNpj/M9AHGAiUt0IVciCwvt7ZM+FOy8+MDBwSEho2AQII8v9R4A/U2RQtHEUfEBIIim8YYBhn8oNLAqP8GBxmcwbDIU3sKljYIhAV/jHgAE7uICmcAJMQqDmwp//D2YowPgxqAr/wPyr8QAi8EEHwleIQFW4BxYicG+eEHEomHECET5QhRVQhQn/cQFoFJ6AKgwgFNcPoFwdnAoZIXmGERahKDwkIdqlR1j4PiRW4RVCCmExvQenQrSYEXiDiAoUBfC4loAK23yBSnzArhCRehRmAJPFnRUxHDgU/lDA7zZECj/Cgl2dAkaeWYNVZcoHDIX/94hgKLM4gS27/v9QIICizGMDkiQjSon7c8eBCw+e/GFgkZEwsHCRRpZiHE5FMwCa2YE+WcAOUwAAAABJRU5ErkJggg==',
'H' => 'iVBORw0KGgoAAAANSUhEUgAAACgAAAAoCAAAAACpleexAAAAFXRFWHRDcmVhdGlvbiBUaW1lAAfTBQ4QGRw2Z4k1AAAAB3RJTUUH0wUOEC8agxleBQAAAAlwSFlzAAALEgAACxIB0t1+/AAAAD1JREFUeNpj/M9AHGAiUt2oQvyABUozQml4+KMLDAXPDAWFLGh8RlwKh4JnaB88GOlxELhxVCFewDgEynAAN2sFVHAvevkAAAAASUVORK5CYII=',
'I' => 'iVBORw0KGgoAAAANSUhEUgAAACgAAAAoCAAAAACpleexAAAAFXRFWHRDcmVhdGlvbiBUaW1lAAfTBQ4QGSlg1E0WAAAAB3RJTUUH0wUOEC86uHd+zQAAAAlwSFlzAAALEgAACxIB0t1+/AAAAD5JREFUeNpj/M9AHGAiUt1AKmRBMBkxJJE9OhQ8Q32FjGhxDQsjjCQwFDwzqnCwKkRKZqO5EBMwDqcSl2iFAMMeB0s/kLo2AAAAAElFTkSuQmCC',
'J' => 'iVBORw0KGgoAAAANSUhEUgAAACgAAAAoCAAAAACpleexAAAAFXRFWHRDcmVhdGlvbiBUaW1lAAfTBQ4QGywiiNsbAAAAB3RJTUUH0wUOEDAFw0tdbgAAAAlwSFlzAAALEgAACxIB0t1+/AAAAKdJREFUeNpj/M9AHGAiUh3xClmwijJCaSR3Ud/qUYWjCklTyIHEhifctw8ePHgCxO+B7L9QMQlsChW+QOiX4gwMd6BiItisVoHSB6AYWQwM/kNBBszkC/9PwKyc8B8B4Ar3YPHMHWwK/xtgqAv4j1XhEfScK/EEu8L/a1BVStz4j0Ph/yPItoe8QFH3nxGlkNq75cKDB0DDVBwitNEcwjhwpdmoQrwAAN6ioiFapgUdAAAAAElFTkSuQmCC',
'K' => 'iVBORw0KGgoAAAANSUhEUgAAACgAAAAoCAAAAACpleexAAAAFXRFWHRDcmVhdGlvbiBUaW1lAAfTBQ4QHAEoFhGpAAAAB3RJTUUH0wUOEDANzZDVXAAAAAlwSFlzAAALEgAACxIB0t1+/AAAAPZJREFUeNpj/M9AHGAiUt2owgFSyAgFMOGDrDARxkKo0H8wYEDh/b/AAzepACqEVeEdCQx1WBW+0ICry/mPR+EXE7i6kD94FP5xwaYOi8IIrOowFRbA1Xkgq8NQ2ANXZ/PlPx6FS3CpQ1fIAmOIoKn7jxbXf2CMNxvQIxvVRAQQ+YDXaiSQQqxChiOEFGoIQGidP/gVStxogLI68CqUuPH/BzSVcTzAoxCo7v//ObBIxK0QrO7/H1iCXIFT4QkIFxbaMh9wKYQJO0D5OYQUnoDF/QkCCuHJ1+APAYV3YOloAgGF8JTO84SAwjfQiGQIgPAZqV4rAACnKSarzdlc4gAAAABJRU5ErkJggg==',
'L' => 'iVBORw0KGgoAAAANSUhEUgAAACgAAAAoCAAAAACpleexAAAAFXRFWHRDcmVhdGlvbiBUaW1lAAfTBQ4QHA64qQw4AAAAB3RJTUUH0wUOEDAXMPIsJgAAAAlwSFlzAAALEgAACxIB0t1+/AAAADlJREFUeNpj/M9AHGAiUt2QUMiCYDJCaezhMBQ8M6pwVCEdFLJgCjEisRH5Zyh4hvoKGUdkQUq0QgARaARRV9jUFQAAAABJRU5ErkJggg==',
'M' => 'iVBORw0KGgoAAAANSUhEUgAAACgAAAAoCAAAAACpleexAAAAFXRFWHRDcmVhdGlvbiBUaW1lAAfTBQ4QHBhMfblpAAAAB3RJTUUH0wUOEDAqaJpgNwAAAAlwSFlzAAALEgAACxIB0t1+/AAAAPNJREFUeNrdlK0OgzAUhS8bCQYxMYmcmEAgEAgejQfZQyG2pAIxOYlATkAu691o2tvSYia2iv7lyzn3NG0jhG1tt5H7Aggom7ZuaKPhBFqKV+pFWDGjjcxStEAYXuvBkrKtoVX+gdRiK9i6sxjgeVGUMJzWwZLACaZOTqoAOAronmrlBuvPkQsIgHn8BqnE2AMmhaaYJ57jqTRFMwsDyW249XaJLhAujizm7UFM5XCUXTqiTvBLQYWRc7H3WWt+3NmlyGbOGh9q/45mjQxUb+CA6A2jSqu5MweX0ooQWLJxLYx6fz0GwmBOsww5GP3At/dX4Ayb7qpFI9y5ygAAAABJRU5ErkJggg==',
'N' => 'iVBORw0KGgoAAAANSUhEUgAAACgAAAAoCAAAAACpleexAAAAFXRFWHRDcmVhdGlvbiBUaW1lAAfTBQ4QHC6DxyzwAAAAB3RJTUUH0wUOEDAye/b4YQAAAAlwSFlzAAALEgAACxIB0t1+/AAAALRJREFUeNpj/M9AHGAiUt0IV8gIARsRMlAROP8/BEB5Ii/+/0cVgXNRhRk8iFXIMIFYhRxXiFTIYPCDSIUMBcQqZNhDrEKZN0QqZAggViHDHIIKRSAUzx1CCrdAaZM/BBT+z4Eyaggp/KEDYbAcIaDw/wUWCEuBkML/PagBgFvhfxdiFT4RIVLh/zXEKvyfQqzCLypEKvx/hoVIhf9biFX4x4ZIhf8fCBCp8P8KNBHG4VQ0AwDEOyeZhO5p1AAAAABJRU5ErkJggg==',
'O' => 'iVBORw0KGgoAAAANSUhEUgAAACgAAAAoCAAAAACpleexAAAAFXRFWHRDcmVhdGlvbiBUaW1lAAfTBQ4QHQExDSDoAAAAB3RJTUUH0wUOEDA4myMRfwAAAAlwSFlzAAALEgAACxIB0t1+/AAAATtJREFUeNpj/M9AHGAiUt3wUsiCyv265ciZJ08YGGRkDGwCuFGk/iOBDwU8SDIcGS+Q5JAV7hBBs45nAVaFC1gwXTYBi8IdWNQxMCzAUPhBBJs6Bp4n6AoLYFI6az78f7NEB8ZNQFP4QwAqEfADwg+A+f0NqsI1UHGBDzCnSKC6EhYzB6B0Cj+UwZ+CKgNTeAZKu8C94QGlL6DGjAyU+wAeXC+gIiIQLiM0KzDC9CFCBlWICsnsL3aFMDc+hcs8QZWBKYSF2g24whvYFZpA6T1whUegNCwyoYGxAmYyLGZ+wOxYghqFX2BpO+APmP8nBspHj2uk1LPizf8PGyxgXPTUQ3x6JDqF//8/AYs6bHkGmCYF0O3FnguBCSaFA0kZS8IDJDlG1IIUVFK8eABMWzI6DgHCyDKMI7LEBQCD5YgI9wbKGgAAAABJRU5ErkJggg==',
'P' => 'iVBORw0KGgoAAAANSUhEUgAAACgAAAAoCAAAAACpleexAAAAFXRFWHRDcmVhdGlvbiBUaW1lAAfTBQ4QHQvR2Mn2AAAAB3RJTUUH0wUOEDEDMzPJGgAAAAlwSFlzAAALEgAACxIB0t1+/AAAAKVJREFUeNpj/M9AHGAiUh05ChlRAKdu4k5Ulf9hANMQiwf/EQCfQgaJB0QqZHAhViHDEbg0AV8vwRM8QN0v5vBAOSfw+BrMWQDl8MClGeEKGGEKQcRXHmQemTGD1RMy+N14o4MDyvGAS7NgGMaIzPHAYyIy4HhBZMy0EBmFIX+IUsjRgqQOi2fAgEVBwyVGGEUEQw2O3EbLzDWSFDIOhtJsVCEWAAC/Yt2X+2PYcgAAAABJRU5ErkJggg==',
'Q' => 'iVBORw0KGgoAAAANSUhEUgAAACgAAAAoCAAAAACpleexAAAAFXRFWHRDcmVhdGlvbiBUaW1lAAfTBQ4QHRxSC0wxAAAAB3RJTUUH0wUOEDEKSu9xvgAAAAlwSFlzAAALEgAACxIB0t1+/AAAAW1JREFUeNpj/M9AHGAiUt2QUMiCzPm65cCZF08YGGRkDBx8uNFU/oeDDwU8SOIcBS/+IwOEwh0iaEYIrMCqcA4LprsmYFG4A4s6BoYFGAo/iGBTx8DzAl1hAUxKZ8WH/29W6MC4KWgKfwhAJXx+gPl/QmB+/4KqcANUXOQDVPiLBFRkCUwhJGb2wGzihzK4U6CMA6hReAbKc4F7wwFKX0CNGRkoB+HJJ1ARGZgAIziFM8J0IUIGXYjMZPaXkEJYYDyBiz+EuRFVoQKUdwWIz6qWvmRguAMVkUBVaIIUalPu9GgshIefAWrwrIHp//L/DQc4KjFiBi2uQ/7832KB5AX0uP5fAZOx2PDhfwNCIXrq+f9BhgEb4HmCkcL3YE3hSHkBnmfWYFMpsoaYXAgGDgcwFKLlaxYOCG2DqRCYrldkmIACUMIgZsaTI5Cg3IBNISp4AoovlT+EFf7/kYPkb3wK//8/YAGPGcYhUIYDAHBC9Yak1w7iAAAAAElFTkSuQmCC',
'R' => 'iVBORw0KGgoAAAANSUhEUgAAACgAAAAoCAAAAACpleexAAAAFXRFWHRDcmVhdGlvbiBUaW1lAAfTBQ4QHSkEuIgSAAAAB3RJTUUH0wUOEDEUsOBM3QAAAAlwSFlzAAALEgAACxIB0t1+/AAAAOZJREFUeNpj/M9AHGAiUh0NFLJAaUY0YRkJHYcQdmSh/xCAzRCZHf8RAJ9CBpYNRCpkEHgBV4jfMx+mEOVGIDDAaTWY82aPBZTLgV8hUCkaH6cbP8B8gxHgyODjgwstMDfiVIgWQyFE+lrhB3EBznOFuJgxuUFMXPPEbPmDpA53FH55osKMIoAe4F826MDMvPMfj9WgWFGBBeIf/Ar/H4FxJhBQ+B8WzCIfCCi8A4uvBgIK/2fA/POCgMIXHFBuDqH02ABLM3cIKPwgAuVHEFD4fwJM4AIBhT9goe4AFWAcAsXesFIIAEvJyZHTCSiTAAAAAElFTkSuQmCC',
'S' => 'iVBORw0KGgoAAAANSUhEUgAAACgAAAAoCAAAAACpleexAAAAFXRFWHRDcmVhdGlvbiBUaW1lAAfTBQ4QHTRnvuTLAAAAB3RJTUUH0wUOEDEbIF9RTAAAAAlwSFlzAAALEgAACxIB0t1+/AAAAVZJREFUeNpj/M9AHGAiUt2oQvyABYX398CWK3de/GBgkVEw8HFgRpH7jwSWqCDLyCxAlkNS+CcG3boY7AozMB3Wgk3hGSw+4HgBl0b4egIWhT9mYPGMBFQg4MH/D2tgvrKASzPC0yMjlP7CDSTOmrDIMDDwiHBsxzSRBypw5j9WgFDoAPNAxIQjX/ApXIDsC4OCLV9wKfzjwIACOEIO4IiZFxbooePzAqvC/z9qONBUStzAqvD//zc9BqgqNX5gVwgETxbkmCClvSk4FYLdsCMCptAGI2YSGV78+PLmz5MX4mDu1ByIMM9n9JiBxe4caGChy8MZMMsUIEFyAMoVwVC4BGaEwpI3/9/MEYGlJQyFPwQYsIE1mL7GlnCR0iNSXLtgqpO4gy1mvtigq1NAxCBKgP9pEUFWxlOCnNIYUYrmn3v23Ljx5gsw88sYOPhwI0sxDoEyHAABtSc836a1EQAAAABJRU5ErkJggg==',
'T' => 'iVBORw0KGgoAAAANSUhEUgAAACgAAAAoCAAAAACpleexAAAAFXRFWHRDcmVhdGlvbiBUaW1lAAfTBQ4QHgUdTbcyAAAAB3RJTUUH0wUOEDEgkVS4aAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADdJREFUeNpj/M9AHGAiUt0IVcgCpRlxyMODeSh4hmiFjGipB+Z7jEQ1FDwzqnBU4WBSyDicimYAb/AFTaJpyH8AAAAASUVORK5CYII=',
'U' => 'iVBORw0KGgoAAAANSUhEUgAAACgAAAAoCAAAAACpleexAAAAFXRFWHRDcmVhdGlvbiBUaW1lAAfTBQ4QHhEHl2NPAAAAB3RJTUUH0wUOEDEon48wWgAAAAlwSFlzAAALEgAACxIB0t1+/AAAAKlJREFUeNpj/M9AHGAiUh3xClmgNCOUhrsEXYD6Vo8qHFVIuUIVKP0USr+E0jLoCjWg9A4ovQVNHJjUIaADZsILMPeFApRfA5X/D1N4AaZRYc6b/2+WwNQxXEBX+N8Bqxcc/mMoPMGCRR3LBUyF/2dgUTjjPxaF/6egm8ky5T9Whf9P2KCoMziBJPefEaWQurjnzIMXL34wsMhoWHiYo2hjHLjSbFQhXgAAKzejCLAOcVMAAAAASUVORK5CYII=',
'V' => 'iVBORw0KGgoAAAANSUhEUgAAACgAAAAoCAAAAACpleexAAAAFXRFWHRDcmVhdGlvbiBUaW1lAAfTBQ4QHh/gL05IAAAAB3RJTUUH0wUOEDEuduyVbwAAAAlwSFlzAAALEgAACxIB0t1+/AAAAVNJREFUeNpj/M9AHGAiUt2owoFRaMgIAYlIMqlQMUMo/z8ITIByRP78hwMRqNgECBei8AULVPQIXN0RqAjLGwgfYrW4B1R4DdzmLVDaQxjZ6v8roDwVuIkqMK3/ka3+/0MAKn4FKn4D5uof/5GtZmCPgEpsQHNDBDsDitVwt5tA+RZQ/pn/qFYj3PQEzHsC5WnA3QyPmQQU3+5AE0VYDTfDBcxzgQbik/8YVv93gMp9AbK/cEAD8T+m1TBb/oD8veEHhs0IE2GmxADZMRAmz4//WKxGkv3DA2Gm/MeqcA/Ujj1w1hHsCv/LQKQz/megRzyawgqIvAxMRwsuhbCEAEvGT3AphEUwNCU5IEv9R8lcUH9/wAxE5HAEgjccSBI8X3CbKOyBxAnhxm3i/w1IEgdQZFA98/+PCFydDKo6VKsZmGPQ0wgOq/+fgYvfQTORkeq1AgCIAvD7+THsDgAAAABJRU5ErkJggg==',
'W' => 'iVBORw0KGgoAAAANSUhEUgAAACgAAAAoCAAAAACpleexAAAAFXRFWHRDcmVhdGlvbiBUaW1lAAfTBQ4QFhZRKnzkAAAAB3RJTUUH0wUOEDIR66frkQAAAAlwSFlzAAALEgAACxIB0t1+/AAAAXNJREFUeNrtlK1ywkAUhZdMZsJMKyIqKhAIBAKBiEBEVCDyCJV9iIo+Do9QGRERgUBEVCAqKhAIREVERURnTvfn3t27xSA6g+kOQ/ZkP/aec5NlBHXZSC7k/sE/AhUwoVkDPQ58/2RUQ2IC6B1XpN7MV8tg62/pUdjSDO7OwR2J0pbekpqZYlMG50bNSGwBDQ4pyV5YtCZ7mqZf1mO2IN2Jynba0XRx49pThjQCbEKWFfVRpIlBzlK4PuLdpxEWlTr4LHvYMEDOaTYS3HCW3DAJt8mmaSXYchZbOfEzkyYGZRbrEbX8qe7GMpLqFeyxV9F4fon1pwcxjxbqJpJTBPBJLoyHYSz1I3xq78aOMssepHZZHFjKhbX9/AZd6e9bsdABeyHTQXiE2PLO6PugCwiP/r1QVLYSlpXwKE1Wno7b7jY+hoWj0aegPyA9+jPrzgqwZJ0j8hhMVtElmDoD19FFPAvamc+sOXBm+KdYEzC63p/9D7Tr72kj/8qjAAAAAElFTkSuQmCC',
'X' => 'iVBORw0KGgoAAAANSUhEUgAAACgAAAAoCAAAAACpleexAAAAFXRFWHRDcmVhdGlvbiBUaW1lAAfTBQ4QHi/G9n7kAAAAB3RJTUUH0wUOEDIXAsROpAAAAAlwSFlzAAALEgAACxIB0t1+/AAAAT9JREFUeNpj/M9AHGAiUt3IVhjKCAFr4RJroSKBMIH/YPBEAMITeQLh//8gAxHggQlAFf6fAdXnA+WnQPkT/qMp/O8AlVkA5h2A8kz+YCi8wQGREngA5PxQgXBYzvzHUPi/A2qIA5BdAmUX/Mei8I8BVHbK/wssEJbMB2wK/5+ASvPcgGlZ8x+rQriFAmghgKHwiwJKXPA8wKXw/x4UhT3/cSr8n4CkzuAPHoVvRODqWE6gyPxHTT1ffiAUCjCgAhRtDkgSFnisnoJixAScCh/wEBk8DmiucsChcA5MQQSMMQWrQlgiZ0iAByey5QiFPlBZnS//v+hgxjZc4QKYKVeAnCswby3AUAi3eAGKNoEn6Ap94A5EjXUfNIUrEA6EALgzl6AohCUGsAMhAOZMkTfICkMw3I5wZgiEyzicimYAFRFkVwgDfJ0AAAAASUVORK5CYII=',
'Y' => 'iVBORw0KGgoAAAANSUhEUgAAACgAAAAoCAAAAACpleexAAAAFXRFWHRDcmVhdGlvbiBUaW1lAAfTBQ4QHjkyIsu1AAAAB3RJTUUH0wUOEDIkvRQvsgAAAAlwSFlzAAALEgAACxIB0t1+/AAAANJJREFUeNrt1L0NgzAQBWAcUVB6AAZgBAoKhmAICoZgCAoKxmAECkbwABSUlBRILwF8duwYhFJEihJ37+6T5T9g8K6N20X3FdDDNjKKOeTIqZLtWcKBU73bCx1lPhgQNTWieY1zRLmGCZFQp1xTSSmBDUUgW754BF+GQLxAPUkMxMb0FlzUsqpKLXhxQPRqo+oIerggCvuMC7jhFJounA4gWhO2OIL6Jp/uzglHrh0fTyAaDRucQaTkUpxDQVBYDWZ/hYze6bsv/A8/DNlP/kgvwzuer4kCMGPZDgAAAABJRU5ErkJggg==',
'Z' => 'iVBORw0KGgoAAAANSUhEUgAAACgAAAAoCAAAAACpleexAAAAFXRFWHRDcmVhdGlvbiBUaW1lAAfTBQ4QHwfqWOdfAAAAB3RJTUUH0wUOEDIrLasyIwAAAAlwSFlzAAALEgAACxIB0t1+/AAAAL5JREFUeNrl1C0OwkAQBWCWQIJEVPQIFT0GAlHBMRBIBKIHqahAIDlERY9R0UOs3ORh5qVLunmp5GfUZvczbzKzDqtltV7ofgtueHCp16h33xBGwn0KYqoTO/J868Csaj418e0cPujOkLDfmTsECcfcXOGhoC/NZQMUDBUDd5DwxiAtJGzprpCw48xVQcIhM1d6KOgLc/kIBcORgXtIeGGQOyRs6Oq0g7P92YbkRE7bRZhcwhh+6nLF5f7yx30B8Z7FgxzMWtEAAAAASUVORK5CYII=',
);
return $_png;
}
?>

View File

@@ -21,6 +21,19 @@
*
***************************************************************************/
/*
This code has been modified from its original form by psoTFX @ phpbb.com
Changes introduce the back-ported phpBB 2.2 visual confirmation code.
NOTE: Anyone using the modified code contained within this script MUST include
a relevant message such as this in usercp_register.php ... failure to do so
will affect a breach of Section 2a of the GPL and our copyright
png visual confirmation system : (c) phpBB Group, 2003 : All Rights Reserved
*/
if ( !defined('IN_PHPBB') )
{
die("Hacking attempt");
@@ -94,6 +107,7 @@ if (
}
$strip_var_list = array('username' => 'username', 'email' => 'email', 'icq' => 'icq', 'aim' => 'aim', 'msn' => 'msn', 'yim' => 'yim', 'website' => 'website', 'location' => 'location', 'occupation' => 'occupation', 'interests' => 'interests');
$strip_var_list['confirm_code'] = 'confirm_code';
// Strip all tags from data ... may p**s some people off, bah, strip_tags is
// doing the job but can still break HTML output ... have no choice, have
@@ -253,6 +267,57 @@ if ( isset($HTTP_POST_VARS['submit']) )
}
}
if ($board_config['enable_confirm'] && $mode == 'register')
{
if (empty($HTTP_POST_VARS['confirm_id']))
{
$error = TRUE;
$error_msg .= ( ( isset($error_msg) ) ? '<br />' : '' ) . $lang['Confirm_code_wrong'];
}
else
{
$confirm_id = htmlspecialchars($HTTP_POST_VARS['confirm_id']);
if (!preg_match('/^[A-Za-z0-9]+$/', $confirm_id))
{
$confirm_id = '';
}
$sql = 'SELECT code
FROM ' . CONFIRM_TABLE . "
WHERE confirm_id = '$confirm_id'
AND session_id = '" . $userdata['session_id'] . "'";
if (!($result = $db->sql_query($sql)))
{
message_die(GENERAL_ERROR, 'Could not obtain confirmation code', __LINE__, __FILE__, $sql);
}
if ($row = $db->sql_fetchrow($result))
{
if ($row['code'] != $confirm_code)
{
$error = TRUE;
$error_msg .= ( ( isset($error_msg) ) ? '<br />' : '' ) . $lang['Confirm_code_wrong'];
}
else
{
$sql = 'DELETE FROM ' . CONFIRM_TABLE . "
WHERE confirm_id = '$confirm_id'
AND session_id = '" . $userdata['session_id'] . "'";
if (!$db->sql_query($sql))
{
message_die(GENERAL_ERROR, 'Could not delete confirmation code', __LINE__, __FILE__, $sql);
}
}
}
else
{
$error = TRUE;
$error_msg .= ( ( isset($error_msg) ) ? '<br />' : '' ) . $lang['Confirm_code_wrong'];
}
$db->sql_freeresult($result);
}
}
$passwd_sql = '';
if ( !empty($new_password) && !empty($password_confirm) )
{
@@ -344,9 +409,9 @@ if ( isset($HTTP_POST_VARS['submit']) )
// Error is already triggered, since one field is empty.
$error = TRUE;
}
else if ( $username != $userdata['username'] || $mode == 'register' )
else if ( $username != $userdata['username'] || $mode == 'register')
{
if (strtolower($username) != strtolower($userdata['username']))
if (strtolower($username) != strtolower($userdata['username']) || $mode == 'register')
{
$result = validate_username($username);
if ( $result['error'] )
@@ -389,12 +454,12 @@ if ( isset($HTTP_POST_VARS['submit']) )
{
$avatar_sql = user_avatar_delete($userdata['user_avatar_type'], $userdata['user_avatar']);
}
else
if ( ( !empty($user_avatar_upload) || !empty($user_avatar_name) ) && $board_config['allow_avatar_upload'] )
{
if ( !empty($user_avatar_upload) )
{
$avatar_mode = ( !empty($user_avatar_name) ) ? 'local' : 'remote';
$avatar_mode = (empty($user_avatar_name)) ? 'remote' : 'local';
$avatar_sql = user_avatar_upload($mode, $avatar_mode, $userdata['user_avatar'], $userdata['user_avatar_type'], $error, $error_msg, $user_avatar_upload, $user_avatar_name, $user_avatar_size, $user_avatar_filetype);
}
else if ( !empty($user_avatar_name) )
@@ -835,6 +900,83 @@ else
$template->assign_block_vars('switch_namechange_disallowed', array());
}
// Visual Confirmation
$confirm_image = '';
if (!empty($board_config['enable_confirm']) && $mode == 'register')
{
$sql = 'SELECT session_id
FROM ' . SESSIONS_TABLE;
if (!($result = $db->sql_query($sql)))
{
message_die(GENERAL_ERROR, 'Could not select session data', '', __LINE__, __FILE__, $sql);
}
if ($row = $db->sql_fetchrow($result))
{
$confirm_sql = '';
do
{
$confirm_sql .= (($confirm_sql != '') ? ', ' : '') . "'" . $row['session_id'] . "'";
}
while ($row = $db->sql_fetchrow($result));
$sql = 'DELETE FROM ' . CONFIRM_TABLE . "
WHERE session_id NOT IN ($confirm_sql)";
if (!$db->sql_query($sql))
{
message_die(GENERAL_ERROR, 'Could not delete stale confirm data', '', __LINE__, __FILE__, $sql);
}
}
$db->sql_freeresult($result);
$sql = 'SELECT COUNT(session_id) AS attempts
FROM ' . CONFIRM_TABLE . "
WHERE session_id = '" . $userdata['session_id'] . "'";
if (!($result = $db->sql_query($sql)))
{
message_die(GENERAL_ERROR, 'Could not obtain confirm code count', '', __LINE__, __FILE__, $sql);
}
if ($row = $db->sql_fetchrow($result))
{
if ($row['attempts'] > 3)
{
message_die(GENERAL_MESSAGE, $lang['Too_many_registers']);
}
}
$db->sql_freeresult($result);
$confirm_chars = array('A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '1', '2', '3', '4', '5', '6', '7', '8', '9');
list($usec, $sec) = explode(' ', microtime());
mt_srand($sec * $usec);
$max_chars = count($confirm_chars) - 1;
$code = '';
for ($i = 0; $i < 6; $i++)
{
$code .= $confirm_chars[mt_rand(0, $max_chars)];
}
$confirm_id = md5(uniqid($user_ip));
$sql = 'INSERT INTO ' . CONFIRM_TABLE . " (confirm_id, session_id, code)
VALUES ('$confirm_id', '". $userdata['session_id'] . "', '$code')";
if (!$db->sql_query($sql))
{
message_die(GENERAL_ERROR, 'Could not insert new confirm code information', '', __LINE__, __FILE__, $sql);
}
unset($code);
$confirm_image = (@extension_loaded('zlib')) ? '<img src="' . append_sid("profile.$phpEx?mode=confirm&amp;id=$confirm_id") . '" alt="" title="" />' : '<img src="' . append_sid("profile.$phpEx?mode=confirm&amp;id=$confirm_id&amp;c=1") . '" alt="" title="" /><img src="' . append_sid("profile.$phpEx?mode=confirm&amp;id=$confirm_id&amp;c=2") . '" alt="" title="" /><img src="' . append_sid("profile.$phpEx?mode=confirm&amp;id=$confirm_id&amp;c=3") . '" alt="" title="" /><img src="' . append_sid("profile.$phpEx?mode=confirm&amp;id=$confirm_id&amp;c=4") . '" alt="" title="" /><img src="' . append_sid("profile.$phpEx?mode=confirm&amp;id=$confirm_id&amp;c=5") . '" alt="" title="" /><img src="' . append_sid("profile.$phpEx?mode=confirm&amp;id=$confirm_id&amp;c=6") . '" alt="" title="" />';
$s_hidden_fields .= '<input type="hidden" name="confirm_id" value="' . $confirm_id . '" />';
$template->assign_block_vars('switch_confirm', array());
}
//
// Let's do an overall check for settings/versions which would prevent
// us from doing file uploads....
@@ -848,6 +990,7 @@ else
'NEW_PASSWORD' => $new_password,
'PASSWORD_CONFIRM' => $password_confirm,
'EMAIL' => $email,
'CONFIRM_IMG' => $confirm_image,
'YIM' => $yim,
'ICQ' => $icq,
'MSN' => $msn,
@@ -942,6 +1085,10 @@ else
'L_PROFILE_INFO_NOTICE' => $lang['Profile_info_warn'],
'L_EMAIL_ADDRESS' => $lang['Email_address'],
'L_CONFIRM_CODE_IMPAIRED' => sprintf($lang['Confirm_code_impaired'], '<a href="mailto:' . $board_config['board_email'] . '">', '</a>'),
'L_CONFIRM_CODE' => $lang['Confirm_code'],
'L_CONFIRM_CODE_EXPLAIN' => $lang['Confirm_code_explain'],
'S_ALLOW_AVATAR_UPLOAD' => $board_config['allow_avatar_upload'],
'S_ALLOW_AVATAR_LOCAL' => $board_config['allow_avatar_local'],
'S_ALLOW_AVATAR_REMOTE' => $board_config['allow_avatar_remote'],

View File

@@ -29,7 +29,7 @@ if ( !defined('IN_PHPBB') )
if ( isset($HTTP_POST_VARS['submit']) )
{
$username = ( !empty($HTTP_POST_VARS['username']) ) ? trim(strip_tags($HTTP_POST_VARS['username'])) : '';
$username = ( !empty($HTTP_POST_VARS['username']) ) ? phpbb_clean_username($HTTP_POST_VARS['username']) : '';
$email = ( !empty($HTTP_POST_VARS['email']) ) ? trim(strip_tags(htmlspecialchars($HTTP_POST_VARS['email']))) : '';
$sql = "SELECT user_id, username, user_email, user_active, user_lang

View File

@@ -33,6 +33,11 @@ if ( empty($HTTP_GET_VARS[POST_USERS_URL]) || $HTTP_GET_VARS[POST_USERS_URL] ==
}
$profiledata = get_userdata($HTTP_GET_VARS[POST_USERS_URL]);
if (!$profiledata)
{
message_die(GENERAL_MESSAGE, $lang['No_user_id_specified']);
}
$sql = "SELECT *
FROM " . RANKS_TABLE . "
ORDER BY rank_special, rank_min";
@@ -160,8 +165,8 @@ $yim_img = ( $profiledata['user_yim'] ) ? '<a href="http://edit.yahoo.com/config
$yim = ( $profiledata['user_yim'] ) ? '<a href="http://edit.yahoo.com/config/send_webmesg?.target=' . $profiledata['user_yim'] . '&amp;.src=pg">' . $lang['YIM'] . '</a>' : '';
$temp_url = append_sid("search.$phpEx?search_author=" . urlencode($profiledata['username']) . "&amp;showresults=posts");
$search_img = '<a href="' . $temp_url . '"><img src="' . $images['icon_search'] . '" alt="' . $lang['Search_user_posts'] . '" title="' . $lang['Search_user_posts'] . '" border="0" /></a>';
$search = '<a href="' . $temp_url . '">' . $lang['Search_user_posts'] . '</a>';
$search_img = '<a href="' . $temp_url . '"><img src="' . $images['icon_search'] . '" alt="' . $lang['Search_user_posts'] . '" title="' . sprintf($lang['Search_user_posts'], $profiledata['username']) . '" border="0" /></a>';
$search = '<a href="' . $temp_url . '">' . sprintf($lang['Search_user_posts'], $profiledata['username']) . '</a>';
//
// Generate page
@@ -169,6 +174,15 @@ $search = '<a href="' . $temp_url . '">' . $lang['Search_user_posts'] . '</a>';
$page_title = $lang['Viewing_profile'];
include($phpbb_root_path . 'includes/page_header.'.$phpEx);
if (function_exists('get_html_translation_table'))
{
$u_search_author = urlencode(strtr($profiledata['username'], array_flip(get_html_translation_table(HTML_ENTITIES))));
}
else
{
$u_search_author = urlencode(str_replace(array('&amp;', '&#039;', '&quot;', '&lt;', '&gt;'), array('&', "'", '"', '<', '>'), $profiledata['username']));
}
$template->assign_vars(array(
'USERNAME' => $profiledata['username'],
'JOINED' => create_date($lang['DATE_FORMAT'], $profiledata['user_regdate'], $board_config['board_timezone']),
@@ -223,7 +237,7 @@ $template->assign_vars(array(
'L_OCCUPATION' => $lang['Occupation'],
'L_INTERESTS' => $lang['Interests'],
'U_SEARCH_USER' => append_sid("search.$phpEx?search_author=" . urlencode($profiledata['username'])),
'U_SEARCH_USER' => append_sid("search.$phpEx?search_author=" . $u_search_author),
'S_PROFILE_ACTION' => append_sid("profile.$phpEx"))
);

View File

@@ -225,6 +225,23 @@ function guess_lang()
error_reporting (E_ERROR | E_WARNING | E_PARSE); // This will NOT report uninitialized variables
set_magic_quotes_runtime(0); // Disable magic_quotes_runtime
// PHP5 with register_long_arrays off?
if (!isset($HTTP_POST_VARS) && isset($_POST))
{
$HTTP_POST_VARS = $_POST;
$HTTP_GET_VARS = $_GET;
$HTTP_SERVER_VARS = $_SERVER;
$HTTP_COOKIE_VARS = $_COOKIE;
$HTTP_ENV_VARS = $_ENV;
$HTTP_POST_FILES = $_FILES;
// _SESSION is the only superglobal which is conditionally set
if (isset($_SESSION))
{
$HTTP_SESSION_VARS = $_SESSION;
}
}
// Slash data if it isn't slashed
if (!get_magic_quotes_gpc())
{

View File

@@ -69,7 +69,7 @@ INSERT INTO phpbb_config (config_name, config_value) VALUES ('record_online_date
INSERT INTO phpbb_config (config_name, config_value) VALUES ('server_name', 'www.yourdomain.tld');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('server_port', '80');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('script_path', '/phpBB2/');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('version', '.0.9');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('version', '.0.17');
/*
-- Categories
@@ -91,7 +91,7 @@ INSERT INTO phpbb_forums (forum_id, cat_id, forum_name, forum_desc, forum_status
Default Admin --> username: admin
password: admin (change this or remove it once everything is working!)
*/
INSERT INTO phpbb_users (user_id, username, user_level, user_regdate, user_password, user_email, user_icq, user_website, user_occ, user_from, user_interests, user_sig, user_viewemail, user_style, user_aim, user_yim, user_msnm, user_posts, user_attachsig, user_allowsmile, user_allowhtml, user_allowbbcode, user_allow_pm, user_notify_pm, user_allow_viewonline, user_rank, user_avatar, user_lang, user_timezone, user_dateformat, user_actkey, user_newpasswd, user_notify, user_active) VALUES ( -1, 'Anonymous', 0, 0, '', '', '', '', '', '', '', '', 0, NULL, '', '', '', 0, 0, 1, 0, 1, 0, 1, 1, NULL, '', '', 0, '', '', '', 0, 0);
INSERT INTO phpbb_users (user_id, username, user_level, user_regdate, user_password, user_email, user_icq, user_website, user_occ, user_from, user_interests, user_sig, user_viewemail, user_style, user_aim, user_yim, user_msnm, user_posts, user_attachsig, user_allowsmile, user_allowhtml, user_allowbbcode, user_allow_pm, user_notify_pm, user_allow_viewonline, user_rank, user_avatar, user_lang, user_timezone, user_dateformat, user_actkey, user_newpasswd, user_notify, user_active) VALUES ( -1, 'Anonymous', 0, 0, '', '', '', '', '', '', '', '', 0, NULL, '', '', '', 0, 0, 1, 1, 1, 0, 1, 1, NULL, '', '', 0, '', '', '', 0, 0);
INSERT INTO phpbb_users (user_id, username, user_level, user_regdate, user_password, user_email, user_icq, user_website, user_occ, user_from, user_interests, user_sig, user_viewemail, user_style, user_aim, user_yim, user_msnm, user_posts, user_attachsig, user_allowsmile, user_allowhtml, user_allowbbcode, user_allow_pm, user_notify_pm, user_popup_pm, user_allow_viewonline, user_rank, user_avatar, user_lang, user_timezone, user_dateformat, user_actkey, user_newpasswd, user_notify, user_active) VALUES ( 2, 'Admin', 1, 0, '21232f297a57a5a743894a0e4a801fc3', 'admin@yourdomain.com', '', '', '', '', '', '', 1, 1, '', '', '', 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, '', 'english', 0, 'd M Y h:i a', '', '', 0, 1);

View File

@@ -190,7 +190,8 @@ CREATE TABLE [phpbb_sessions] (
[session_time] [int] NULL ,
[session_ip] [char] (8) NOT NULL ,
[session_page] [int] NULL ,
[session_logged_in] [smallint] NULL
[session_logged_in] [smallint] NULL,
[session_admin] [smallint] NULL
) ON [PRIMARY]
GO

View File

@@ -62,7 +62,7 @@ INSERT INTO phpbb_config (config_name, config_value) VALUES ('record_online_date
INSERT INTO phpbb_config (config_name, config_value) VALUES ('server_name', 'www.myserver.tld');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('server_port', '80');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('script_path', '/phpBB2/');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('version', '.0.9');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('version', '.0.17');
# -- Categories
@@ -74,7 +74,7 @@ INSERT INTO phpbb_forums (forum_id, forum_name, forum_desc, cat_id, forum_order,
# -- Users
INSERT INTO phpbb_users (user_id, username, user_level, user_regdate, user_password, user_email, user_icq, user_website, user_occ, user_from, user_interests, user_sig, user_viewemail, user_style, user_aim, user_yim, user_msnm, user_posts, user_attachsig, user_allowsmile, user_allowhtml, user_allowbbcode, user_allow_pm, user_notify_pm, user_allow_viewonline, user_rank, user_avatar, user_lang, user_timezone, user_dateformat, user_actkey, user_newpasswd, user_notify, user_active) VALUES ( -1, 'Anonymous', 0, 0, '', '', '', '', '', '', '', '', 0, NULL, '', '', '', 0, 0, 1, 0, 1, 0, 1, 1, NULL, '', '', 0, '', '', '', 0, 0);
INSERT INTO phpbb_users (user_id, username, user_level, user_regdate, user_password, user_email, user_icq, user_website, user_occ, user_from, user_interests, user_sig, user_viewemail, user_style, user_aim, user_yim, user_msnm, user_posts, user_attachsig, user_allowsmile, user_allowhtml, user_allowbbcode, user_allow_pm, user_notify_pm, user_allow_viewonline, user_rank, user_avatar, user_lang, user_timezone, user_dateformat, user_actkey, user_newpasswd, user_notify, user_active) VALUES ( -1, 'Anonymous', 0, 0, '', '', '', '', '', '', '', '', 0, NULL, '', '', '', 0, 0, 1, 1, 1, 0, 1, 1, NULL, '', '', 0, '', '', '', 0, 0);
# -- username: admin password: admin (change this or remove it once everything is working!)
INSERT INTO phpbb_users (user_id, username, user_level, user_regdate, user_password, user_email, user_icq, user_website, user_occ, user_from, user_interests, user_sig, user_viewemail, user_style, user_aim, user_yim, user_msnm, user_posts, user_attachsig, user_allowsmile, user_allowhtml, user_allowbbcode, user_allow_pm, user_notify_pm, user_popup_pm, user_allow_viewonline, user_rank, user_avatar, user_lang, user_timezone, user_dateformat, user_actkey, user_newpasswd, user_notify, user_active) VALUES ( 2, 'Admin', 1, 0, '21232f297a57a5a743894a0e4a801fc3', 'admin@yourdomain.com', '', '', '', '', '', '', 1, 1, '', '', '', 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, '', 'english', 0, 'd M Y h:i a', '', '', 0, 1);

View File

@@ -305,6 +305,7 @@ CREATE TABLE phpbb_sessions (
session_ip char(8) DEFAULT '0' NOT NULL,
session_page int(11) DEFAULT '0' NOT NULL,
session_logged_in tinyint(1) DEFAULT '0' NOT NULL,
session_admin tinyint(2) DEFAULT '0' NOT NULL,
PRIMARY KEY (session_id),
KEY session_user_id (session_user_id),
KEY session_id_ip_user_id (session_id, session_ip, session_user_id)

View File

@@ -63,7 +63,7 @@ INSERT INTO phpbb_config (config_name, config_value) VALUES ('record_online_date
INSERT INTO phpbb_config (config_name, config_value) VALUES ('server_name', 'www.yourdomain.tld');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('server_port', '80');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('script_path', '/phpBB2/');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('version', '.0.9');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('version', '.0.17');
-- Categories
INSERT INTO phpbb_categories (cat_id, cat_title, cat_order) VALUES (1, 'Test category 1', 10);
@@ -73,7 +73,7 @@ INSERT INTO phpbb_categories (cat_id, cat_title, cat_order) VALUES (1, 'Test cat
INSERT INTO phpbb_forums (forum_id, forum_name, forum_desc, cat_id, forum_order, forum_posts, forum_topics, forum_last_post_id, auth_view, auth_read, auth_post, auth_reply, auth_edit, auth_delete, auth_announce, auth_sticky, auth_pollcreate, auth_vote, auth_attachments) VALUES (1, 'Test Forum 1', 'This is just a test forum.', 1, 10, 1, 1, 1, 0, 0, 0, 0, 1, 1, 3, 3, 1, 1, 3);
-- Users
INSERT INTO phpbb_users (user_id, username, user_level, user_regdate, user_password, user_email, user_icq, user_website, user_occ, user_from, user_interests, user_sig, user_viewemail, user_style, user_aim, user_yim, user_msnm, user_posts, user_attachsig, user_allowsmile, user_allowhtml, user_allowbbcode, user_allow_pm, user_notify_pm, user_allow_viewonline, user_rank, user_avatar, user_lang, user_timezone, user_dateformat, user_actkey, user_newpasswd, user_notify, user_active) VALUES ( -1, 'Anonymous', 0, 0, '', '', '', '', '', '', '', '', 0, NULL, '', '', '', 0, 0, 1, 0, 1, 0, 1, 1, NULL, '', '', 0, '', '', '', 0, 0);
INSERT INTO phpbb_users (user_id, username, user_level, user_regdate, user_password, user_email, user_icq, user_website, user_occ, user_from, user_interests, user_sig, user_viewemail, user_style, user_aim, user_yim, user_msnm, user_posts, user_attachsig, user_allowsmile, user_allowhtml, user_allowbbcode, user_allow_pm, user_notify_pm, user_allow_viewonline, user_rank, user_avatar, user_lang, user_timezone, user_dateformat, user_actkey, user_newpasswd, user_notify, user_active) VALUES ( -1, 'Anonymous', 0, 0, '', '', '', '', '', '', '', '', 0, NULL, '', '', '', 0, 0, 1, 1, 1, 0, 1, 1, NULL, '', '', 0, '', '', '', 0, 0);
-- username: admin password: admin (change this or remove it once everything is working!)
INSERT INTO phpbb_users (user_id, username, user_level, user_regdate, user_password, user_email, user_icq, user_website, user_occ, user_from, user_interests, user_sig, user_viewemail, user_style, user_aim, user_yim, user_msnm, user_posts, user_attachsig, user_allowsmile, user_allowhtml, user_allowbbcode, user_allow_pm, user_notify_pm, user_popup_pm, user_allow_viewonline, user_rank, user_avatar, user_lang, user_timezone, user_dateformat, user_actkey, user_newpasswd, user_notify, user_active) VALUES ( 2, 'Admin', 1, 0, '21232f297a57a5a743894a0e4a801fc3', 'admin@yourdomain.com', '', '', '', '', '', '', 1, 1, '', '', '', 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, '', 'english', 0, 'd M Y h:i a', '', '', 0, 1);

View File

@@ -289,6 +289,7 @@ CREATE TABLE phpbb_sessions (
session_ip char(8) DEFAULT '0' NOT NULL,
session_page int4 DEFAULT '0' NOT NULL,
session_logged_in int2 DEFAULT '0' NOT NULL,
session_admin int2 DEFAULT '0' NOT NULL,
CONSTRAINT phpbb_session_pkey PRIMARY KEY (session_id)
);
CREATE INDEX session_user_id_phpbb_sessions_index ON phpbb_sessions (session_user_id);

View File

@@ -1,665 +0,0 @@
<?php
/***************************************************************************
* update_to_xxx.php
* -------------------
* begin : Wednesday, May 16, 2002
* copyright : (C) 2001 The phpBB Group
* email : support@phpbb.com
*
* $Id$
*
***************************************************************************/
/***************************************************************************
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
***************************************************************************/
function _sql($sql, &$errored, &$error_ary, $echo_dot = true)
{
global $db;
if( !($result = $db->sql_query($sql)) )
{
$errored = true;
$error_ary['sql'][] = ( is_array($sql) ) ? $sql[$i] : $sql;
$error_ary['error_code'][] = $db->sql_error();
}
if ( $echo_dot )
{
echo ".";
flush();
}
return $result;
}
define('IN_PHPBB', 1);
$phpbb_root_path = './../';
include($phpbb_root_path . 'extension.inc');
include($phpbb_root_path . 'config.'.$phpEx);
include($phpbb_root_path . 'includes/constants.'.$phpEx);
include($phpbb_root_path . 'includes/functions.'.$phpEx);
include($phpbb_root_path . 'includes/functions_admin.'.$phpEx);
include($phpbb_root_path . 'includes/db.'.$phpEx);
//
//
//
$updates_to_version = ".0.2";
//
//
//
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;">
<meta http-equiv="Content-Style-Type" content="text/css">
<style type="text/css">
<!--
font,th,td,p,body { font-family: "Courier New", courier; font-size: 11pt }
a:link,a:active,a:visited { color : #006699; }
a:hover { text-decoration: underline; color : #DD6900;}
hr { height: 0px; border: solid #D1D7DC 0px; border-top-width: 1px;}
.maintitle,h1,h2 {font-weight: bold; font-size: 22px; font-family: "Trebuchet MS",Verdana, Arial, Helvetica, sans-serif; text-decoration: none; line-height : 120%; color : #000000;}
.ok {color:green}
/* Import the fancy styles for IE only (NS4.x doesn't use the @import function) */
@import url("../templates/subSilver/formIE.css");
-->
</style>
</head>
<body bgcolor="#FFFFFF" text="#000000" link="#006699" vlink="#5584AA">
<table width="100%" border="0" cellspacing="0" cellpadding="10" align="center">
<tr>
<td><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><img src="../templates/subSilver/images/logo_phpBB.gif" border="0" alt="Forum Home" vspace="1" /></td>
<td align="center" width="100%" valign="middle"><span class="maintitle">Updating to latest stable release</span></td>
</tr>
</table></td>
</tr>
</table>
<br clear="all" />
<h2>Information</h2>
<?php
echo '<p>Database type &nbsp; &nbsp;:: <b>' . SQL_LAYER . '</b><br />';
$sql = "SELECT config_value
FROM " . CONFIG_TABLE . "
WHERE config_name = 'version'";
if ( !($result = $db->sql_query($sql)) )
{
die("Couldn't obtain version info");
}
$row = $db->sql_fetchrow($result);
$sql = array();
switch ( $row['config_value'] )
{
case '':
echo 'Previous version :: <b>&lt; RC-3</b></p><br />';
break;
case 'RC-3':
echo 'Previous version :: <b>RC-3</b></p><br />';
break;
case 'RC-4':
echo 'Previous version :: <b>RC-4</b></p><br />';
break;
default:
echo 'Previous version :: <b>2' . $row['config_value'] . '</b><br />';
break;
}
echo 'Updated version &nbsp;:: <b>2' . $updates_to_version . '</b></p>' ."\n";
switch ( $row['config_value'] )
{
case '':
switch ( SQL_LAYER )
{
case 'mysql':
case 'mysql4':
$sql[] = "ALTER TABLE " . USERS_TABLE . " DROP
COLUMN user_autologin_key";
$sql[] = "ALTER TABLE " . RANKS_TABLE . " DROP
COLUMN rank_max";
$sql[] = "ALTER TABLE " . USERS_TABLE . "
ADD COLUMN user_session_time int(11) DEFAULT '0' NOT NULL,
ADD COLUMN user_session_page smallint(5) DEFAULT '0' NOT NULL,
ADD INDEX (user_session_time)";
$sql[] = "ALTER TABLE " . SEARCH_TABLE . "
MODIFY search_id int(11) NOT NULL";
$sql[] = "ALTER TABLE " . TOPICS_TABLE . "
MODIFY topic_moved_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL,
ADD COLUMN topic_first_post_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL,
ADD INDEX (topic_first_post_id)";
$sql[] = "ALTER TABLE " . THEMES_NAME_TABLE . "
ADD COLUMN tr_class1_name varchar(50) NULL,
ADD COLUMN tr_class2_name varchar(50) NULL,
ADD COLUMN tr_class3_name varchar(50) NULL,
ADD COLUMN th_class1_name varchar(50) NULL,
ADD COLUMN th_class2_name varchar(50) NULL,
ADD COLUMN th_class3_name varchar(50) NULL,
ADD COLUMN td_class1_name varchar(50) NULL,
ADD COLUMN td_class2_name varchar(50) NULL,
ADD COLUMN td_class3_name varchar(50) NULL,
ADD COLUMN span_class1_name varchar(50) NULL,
ADD COLUMN span_class2_name varchar(50) NULL,
ADD COLUMN span_class3_name varchar(50) NULL";
break;
case 'postgresql':
$sql[] = "ALTER TABLE " . USERS_TABLE . "
ADD COLUMN user_session_time int4";
$sql[] = "ALTER TABLE " . USERS_TABLE . "
ADD COLUMN user_session_page int2";
$sql[] = "ALTER TABLE " . USERS_TABLE . "
ALTER COLUMN user_session_time SET DEFAULT '0'";
$sql[] = "ALTER TABLE " . USERS_TABLE . "
ALTER COLUMN user_session_page SET DEFAULT '0'";
$sql[] = "CREATE INDEX user_session_time_" . $table_prefix . "users_index
ON " . USERS_TABLE . " (user_session_time)";
$sql[] = "ALTER TABLE " . TOPICS_TABLE . "
ADD COLUMN topic_first_post_id int4";
$sql[] = "CREATE INDEX topic_first_post_id_" . $table_prefix . "topics_index
ON " . TOPICS_TABLE . " (topic_first_post_id)";
$sql[] = "ALTER TABLE " . THEMES_NAME_TABLE . "
ADD COLUMN tr_class1_name varchar(50) NULL";
$sql[] = "ALTER TABLE " . THEMES_NAME_TABLE . "
ADD COLUMN tr_class2_name varchar(50) NULL";
$sql[] = "ALTER TABLE " . THEMES_NAME_TABLE . "
ADD COLUMN tr_class3_name varchar(50) NULL";
$sql[] = "ALTER TABLE " . THEMES_NAME_TABLE . "
ADD COLUMN th_class1_name varchar(50) NULL";
$sql[] = "ALTER TABLE " . THEMES_NAME_TABLE . "
ADD COLUMN th_class2_name varchar(50) NULL";
$sql[] = "ALTER TABLE " . THEMES_NAME_TABLE . "
ADD COLUMN th_class3_name varchar(50) NULL";
$sql[] = "ALTER TABLE " . THEMES_NAME_TABLE . "
ADD COLUMN td_class1_name varchar(50) NULL";
$sql[] = "ALTER TABLE " . THEMES_NAME_TABLE . "
ADD COLUMN td_class2_name varchar(50) NULL";
$sql[] = "ALTER TABLE " . THEMES_NAME_TABLE . "
ADD COLUMN td_class3_name varchar(50) NULL";
$sql[] = "ALTER TABLE " . THEMES_NAME_TABLE . "
ADD COLUMN span_class1_name varchar(50) NULL";
$sql[] = "ALTER TABLE " . THEMES_NAME_TABLE . "
ADD COLUMN span_class2_name varchar(50) NULL";
$sql[] = "ALTER TABLE " . THEMES_NAME_TABLE . "
ADD COLUMN span_class3_name varchar(50) NULL";
break;
case 'mssql-odbc':
case 'mssql':
$sql[] = "ALTER TABLE " . USERS_TABLE . " DROP
COLUMN user_autologin_key";
$sql[] = "ALTER TABLE " . USERS_TABLE . " ADD
user_session_time int NOT NULL,
user_session_page smallint NOT NULL,
CONSTRAINT [DF_" . $table_prefix . "users_user_session_time] DEFAULT (0) FOR [user_session_time],
CONSTRAINT [DF_" . $table_prefix . "users_user_session_page] DEFAULT (0) FOR [user_session_page]";
$sql[] = "CREATE INDEX [IX_" . $table_prefix . "users]
ON [" . USERS_TABLE . "]([user_session_time]) ON [PRIMARY]";
/* ---------------------------------------------------------------------
DROP FORUM TABLE -- if this may cause you problems you can safely
comment it out, remember to manually remove the IDENTITY setting on
the forum_id column
--------------------------------------------------------------------- */
$sql [] = "ALTER TABLE " . FORUMS_TABLE . " DROP
CONSTRAINT [DF_" . $table_prefix . "forums_forum_posts],
CONSTRAINT [DF_" . $table_prefix . "forums_forum_topics],
CONSTRAINT [DF_" . $table_prefix . "forums_forum_last_post_id],
CONSTRAINT [DF_" . $table_prefix . "forums_prune_enable],
CONSTRAINT [DF_" . $table_prefix . "forums_auth_view],
CONSTRAINT [DF_" . $table_prefix . "forums_auth_read],
CONSTRAINT [DF_" . $table_prefix . "forums_auth_post],
CONSTRAINT [DF_" . $table_prefix . "forums_auth_reply],
CONSTRAINT [DF_" . $table_prefix . "forums_auth_edit],
CONSTRAINT [DF_" . $table_prefix . "forums_auth_delete],
CONSTRAINT [DF_" . $table_prefix . "forums_auth_sticky],
CONSTRAINT [DF_" . $table_prefix . "forums_auth_announce],
CONSTRAINT [DF_" . $table_prefix . "forums_auth_vote],
CONSTRAINT [DF_" . $table_prefix . "forums_auth_pollcreate],
CONSTRAINT [DF_" . $table_prefix . "forums_auth_attachments]";
$sql[] = "CREATE TABLE Tmp_" . FORUMS_TABLE . "
(forum_id int NOT NULL, cat_id int NOT NULL, forum_name varchar(100) NOT NULL, forum_desc varchar(255) NULL, forum_status smallint NOT NULL, forum_order int NOT NULL, forum_posts int NOT NULL, forum_topics smallint NOT NULL, forum_last_post_id int NOT NULL, prune_next int NULL, prune_enable smallint NOT NULL, auth_view smallint NOT NULL, auth_read smallint NOT NULL, auth_post smallint NOT NULL, auth_reply smallint NOT NULL, auth_edit smallint NOT NULL, auth_delete smallint NOT NULL, auth_sticky smallint NOT NULL, auth_announce smallint NOT NULL, auth_vote smallint NOT NULL, auth_pollcreate smallint NOT NULL, auth_attachments smallint NOT NULL) ON [PRIMARY]";
$sql[] = "ALTER TABLE [Tmp_" . FORUMS_TABLE . "] WITH NOCHECK ADD
CONSTRAINT [DF_" . $table_prefix . "forums_forum_posts] DEFAULT (0) FOR [forum_posts],
CONSTRAINT [DF_" . $table_prefix . "forums_forum_topics] DEFAULT (0) FOR [forum_topics],
CONSTRAINT [DF_" . $table_prefix . "forums_forum_last_post_id] DEFAULT (0) FOR [forum_last_post_id],
CONSTRAINT [DF_" . $table_prefix . "forums_prune_enable] DEFAULT (0) FOR [prune_enable],
CONSTRAINT [DF_" . $table_prefix . "forums_auth_view] DEFAULT (0) FOR [auth_view],
CONSTRAINT [DF_" . $table_prefix . "forums_auth_read] DEFAULT (0) FOR [auth_read],
CONSTRAINT [DF_" . $table_prefix . "forums_auth_post] DEFAULT (0) FOR [auth_post],
CONSTRAINT [DF_" . $table_prefix . "forums_auth_reply] DEFAULT (0) FOR [auth_reply],
CONSTRAINT [DF_" . $table_prefix . "forums_auth_edit] DEFAULT (0) FOR [auth_edit],
CONSTRAINT [DF_" . $table_prefix . "forums_auth_delete] DEFAULT (0) FOR [auth_delete],
CONSTRAINT [DF_" . $table_prefix . "forums_auth_sticky] DEFAULT (0) FOR [auth_sticky],
CONSTRAINT [DF_" . $table_prefix . "forums_auth_announce] DEFAULT (0) FOR [auth_announce],
CONSTRAINT [DF_" . $table_prefix . "forums_auth_vote] DEFAULT (0) FOR [auth_vote],
CONSTRAINT [DF_" . $table_prefix . "forums_auth_pollcreate] DEFAULT (0) FOR [auth_pollcreate],
CONSTRAINT [DF_" . $table_prefix . "forums_auth_attachments] DEFAULT (0) FOR [auth_attachments]";
$sql[] = "INSERT INTO Tmp_" . FORUMS_TABLE . " (forum_id, cat_id, forum_name, forum_desc, forum_status, forum_order, forum_posts, forum_topics, forum_last_post_id, prune_next, prune_enable, auth_view, auth_read, auth_post, auth_reply, auth_edit, auth_delete, auth_sticky, auth_announce, auth_vote, auth_pollcreate, auth_attachments)
SELECT forum_id, cat_id, forum_name, forum_desc, forum_status, forum_order, forum_posts, forum_topics, forum_last_post_id, prune_next, prune_enable, auth_view, auth_read, auth_post, auth_reply, auth_edit, auth_delete, auth_sticky, auth_announce, auth_vote, auth_pollcreate, auth_attachments FROM " . FORUMS_TABLE . " TABLOCKX";
$sql[] = "DROP TABLE " . FORUMS_TABLE;
$sql[] = "EXECUTE sp_rename N'Tmp_" . FORUMS_TABLE . "', N'" . FORUMS_TABLE . "', 'OBJECT'";
$sql[] = "ALTER TABLE " . FORUMS_TABLE . " ADD
CONSTRAINT [PK_" . $table_prefix . "forums] PRIMARY KEY CLUSTERED (forum_id) ON [PRIMARY]";
$sql[] = "CREATE NONCLUSTERED INDEX [IX_" . $table_prefix . "forums]
ON " . FORUMS_TABLE . " (cat_id, forum_order, forum_last_post_id) ON [PRIMARY]";
/* --------------------------------------------------------------
END OF DROP FORUM -- don't remove anything after this point!
-------------------------------------------------------------- */
/* ---------------------------------------------------------------------
DROP GROUP TABLE -- if this may cause you problems you can safely
comment it out, remember to manually add the IDENTITY setting on
the group_id column
--------------------------------------------------------------------- */
$sql[] = "CREATE TABLE Tmp_" . GROUPS_TABLE . "
(group_id int IDENTITY (1, 1) NOT NULL, group_type smallint NULL, group_name varchar(50) NOT NULL, group_description varchar(255) NOT NULL, group_moderator int NULL, group_single_user smallint NOT NULL) ON [PRIMARY]";
$sql[] = "INSERT INTO Tmp_" . GROUPS_TABLE . " (group_id, group_type, group_name, group_description, group_moderator, group_single_user)
SELECT group_id, group_type, group_name, group_description, group_moderator, group_single_user FROM " . GROUPS_TABLE . " TABLOCKX";
$sql[] = "DROP TABLE " . GROUPS_TABLE;
$sql[] = "EXECUTE sp_rename N'Tmp_" . GROUPS_TABLE . "', N'" . GROUPS_TABLE . "', 'OBJECT'";
$sql[] = "ALTER TABLE " . GROUPS_TABLE . " ADD
CONSTRAINT [PK_" . $table_prefix . "groups] PRIMARY KEY CLUSTERED (group_id) ON [PRIMARY]";
$sql[] = "CREATE INDEX [IX_" . $table_prefix . "groups]
ON " . GROUPS_TABLE . " (group_single_user) ON [PRIMARY]";
/* --------------------------------------------------------------
END OF DROP GROUP -- don't remove anything after this point!
-------------------------------------------------------------- */
$sql[] = "DROP INDEX " . RANKS_TABLE . ".IX_" . $table_prefix . "ranks";
$sql[] = "ALTER TABLE " . RANKS_TABLE . " DROP
COLUMN rank_max";
$sql[] = "CREATE INDEX [IX_" . $table_prefix . "ranks]
ON [" . RANKS_TABLE . "]([rank_min], [rank_special]) ON [PRIMARY]";
$sql[] = "DROP INDEX " . TOPICS_TABLE . ".IX_" . $table_prefix . "topics";
$sql[] = "ALTER TABLE " . TOPICS_TABLE . " ADD
topic_first_post_id int NULL,
CONSTRAINT [DF_" . $table_prefix . "topics_topic_first_post_id] FOR [topic_first_post_id]";
$sql[] = "CREATE INDEX [IX_" . $table_prefix . "topics]
ON [" . TOPICS_TABLE . "]([forum_id], [topic_type], [topic_first_post_id], [topic_last_post_id]) ON [PRIMARY]";
$sql[] = "ALTER TABLE " . SEARCH_WORD_TABLE . " DROP
CONSTRAINT [PK_" . $table_prefix . "search_wordlist]";
$sql[] = "CREATE UNIQUE INDEX [IX_" . $table_prefix . "search_wordlist]
ON [" . SEARCH_WORD_TABLE . "]([word_text]) WITH IGNORE_DUP_KEY ON [PRIMARY]";
$sql[] = "CREATE INDEX [IX_" . $table_prefix . "search_wordlist_1]
ON [" . SEARCH_WORD_TABLE . "]([word_common]) ON [PRIMARY]";
$sql[] = "CREATE INDEX [IX_" . $table_prefix . "search_wordmatch_1]
ON [" . SEARCH_MATCH_TABLE . "]([word_id]) ON [PRIMARY]";
$sql[] = "ALTER TABLE " . THEMES_NAME_TABLE . " ADD
tr_class1_name varchar(50) NULL,
tr_class2_name varchar(50) NULL,
tr_class3_name varchar(50) NULL,
th_class1_name varchar(50) NULL,
th_class2_name varchar(50) NULL,
th_class3_name varchar(50) NULL,
td_class1_name varchar(50) NULL,
td_class2_name varchar(50) NULL,
td_class3_name varchar(50) NULL,
span_class1_name varchar(50) NULL,
span_class2_name varchar(50) NULL,
span_class3_name varchar(50) NULL";
break;
case 'msaccess':
$sql[] = "ALTER TABLE " . USERS_TABLE . " DROP
COLUMN user_autologin_key";
$sql[] = "ALTER TABLE " . USERS_TABLE . " ADD
user_session_time int NOT NULL,
user_session_page smallint NOT NULL";
$sql[] = "CREATE INDEX user_session_time
ON " . USERS_TABLE . " (user_session_time)";
$sql[] = "ALTER TABLE " . TOPICS_TABLE . " ADD
topic_first_post_id int NULL";
$sql[] = "CREATE INDEX topic_first_post_id
ON " . TOPICS_TABLE . " (topic_first_post_id)";
$sql[] = "ALTER TABLE " . THEMES_NAME_TABLE . " ADD
tr_class1_name varchar(50) NULL,
tr_class2_name varchar(50) NULL,
tr_class3_name varchar(50) NULL,
th_class1_name varchar(50) NULL,
th_class2_name varchar(50) NULL,
th_class3_name varchar(50) NULL,
td_class1_name varchar(50) NULL,
td_class2_name varchar(50) NULL,
td_class3_name varchar(50) NULL,
span_class1_name varchar(50) NULL,
span_class2_name varchar(50) NULL,
span_class3_name varchar(50) NULL";
break;
default:
die("No DB LAYER found!");
break;
}
case 'RC-3':
case 'RC-4':
case '.0.0':
switch ( SQL_LAYER )
{
case 'mysql':
case 'mysql4':
$sql[] = "ALTER TABLE " . USERS_TABLE . "
MODIFY COLUMN user_id mediumint(8) NOT NULL,
MODIFY COLUMN user_timezone decimal(4,2) DEFAULT '0' NOT NULL";
break;
case 'postgresql':
$sql[] = "ALTER TABLE " . USERS_TABLE . "
RENAME COLUMN user_timezone TO user_timezone_old";
$sql[] = "ALTER TABLE " . USERS_TABLE . "
ADD COLUMN user_timezone decimal(4)";
break;
case 'mssql':
case 'mssql-odbc':
$sql[] = "ALTER TABLE " . USERS_TABLE . "
ALTER COLUMN [user_timezone] [decimal] (4,2) NOT NULL";
/* ---------------------------------------------------------------------
DROP GROUP TABLE -- if this may cause you problems you can safely
comment it out, remember to manually add the IDENTITY setting on
the group_id column
--------------------------------------------------------------------- */
$sql[] = "CREATE TABLE Tmp_" . GROUPS_TABLE . "
(group_id int IDENTITY (1, 1) NOT NULL, group_type smallint NULL, group_name varchar(50) NOT NULL, group_description varchar(255) NOT NULL, group_moderator int NULL, group_single_user smallint NOT NULL) ON [PRIMARY]";
$sql[] = "INSERT INTO Tmp_" . GROUPS_TABLE . " (group_id, group_type, group_name, group_description, group_moderator, group_single_user)
SELECT group_id, group_type, group_name, group_description, group_moderator, group_single_user FROM " . GROUPS_TABLE . " TABLOCKX";
$sql[] = "DROP TABLE " . GROUPS_TABLE;
$sql[] = "EXECUTE sp_rename N'Tmp_" . GROUPS_TABLE . "', N'" . GROUPS_TABLE . "', 'OBJECT'";
$sql[] = "ALTER TABLE " . GROUPS_TABLE . " ADD
CONSTRAINT [PK_" . $table_prefix . "groups] PRIMARY KEY CLUSTERED (group_id) ON [PRIMARY]";
$sql[] = "CREATE INDEX [IX_" . $table_prefix . "groups]
ON " . GROUPS_TABLE . " (group_single_user) ON [PRIMARY]";
/* --------------------------------------------------------------
END OF DROP GROUP -- don't remove anything after this point!
-------------------------------------------------------------- */
break;
}
case '.0.1':
switch ( SQL_LAYER )
{
case 'mysql':
case 'mysql4':
$sql[] = "ALTER TABLE " . GROUPS_TABLE . "
MODIFY COLUMN group_id mediumint(8) NOT NULL auto_increment";
break;
case 'mssql':
case 'mssql-odbc':
/* ---------------------------------------------------------------------
DROP GROUP TABLE -- if this may cause you problems you can safely
comment it out, remember to manually add the IDENTITY setting on
the group_id column
--------------------------------------------------------------------- */
$sql[] = "CREATE TABLE Tmp_" . GROUPS_TABLE . "
(group_id int IDENTITY (1, 1) NOT NULL, group_type smallint NULL, group_name varchar(50) NOT NULL, group_description varchar(255) NOT NULL, group_moderator int NULL, group_single_user smallint NOT NULL) ON [PRIMARY]";
$sql[] = "INSERT INTO Tmp_" . GROUPS_TABLE . " (group_id, group_type, group_name, group_description, group_moderator, group_single_user)
SELECT group_id, group_type, group_name, group_description, group_moderator, group_single_user FROM " . GROUPS_TABLE . " TABLOCKX";
$sql[] = "DROP TABLE " . GROUPS_TABLE;
$sql[] = "EXECUTE sp_rename N'Tmp_" . GROUPS_TABLE . "', N'" . GROUPS_TABLE . "', 'OBJECT'";
$sql[] = "ALTER TABLE " . GROUPS_TABLE . " ADD
CONSTRAINT [PK_" . $table_prefix . "groups] PRIMARY KEY CLUSTERED (group_id) ON [PRIMARY]";
$sql[] = "CREATE INDEX [IX_" . $table_prefix . "groups]
ON " . GROUPS_TABLE . " (group_single_user) ON [PRIMARY]";
/* --------------------------------------------------------------
END OF DROP GROUP -- don't remove anything after this point!
-------------------------------------------------------------- */
break;
}
}
echo "<h2>Updating database schema</h2>\n";
echo "<p>Progress :: <b>";
flush();
$error_ary = array();
$errored = false;
if ( count($sql) )
{
for($i = 0; $i < count($sql); $i++)
{
_sql($sql[$i], $errored, $error_ary);
}
echo "</b> <b class=\"ok\">Done</b><br />Result &nbsp; :: \n";
if ( $errored )
{
echo " <b>Some queries failed, the statements and errors are listing below</b>\n<ul>";
for($i = 0; $i < count($error_ary['sql']); $i++)
{
echo "<li>Error :: <b>" . $error_ary['error_code'][$i]['message'] . "</b><br />";
echo "SQL &nbsp; :: <b>" . $error_ary['sql'][$i] . "</b><br /><br /></li>";
}
echo "</ul>\n<p>This is probably nothing to worry about, update will continue. Should this fail to complete you may need to seek help at our development board. See <a href=\"docs\README.html\">README</a> for details on how to obtain advice.</p>\n";
}
else
{
echo "<b>No errors</b>\n";
}
}
else
{
echo " No updates required</b></p>\n";
}
//
//
//
unset($sql);
$error_ary = array();
$errored = false;
echo "<h2>Updating data</h2>\n";
echo "<p>Progress :: <b>";
flush();
switch ( $row['config_value'] )
{
case '':
$sql = "SELECT themes_id
FROM " . THEMES_TABLE . "
WHERE template_name = 'subSilver'";
$result = _sql($sql, $errored, $error_ary);
if( $row = $db->sql_fetchrow($result) )
{
$theme_id = $row['themes_id'];
$sql = "UPDATE " . THEMES_TABLE . "
SET head_stylesheet = 'subSilver.css', body_background = '', body_bgcolor = 'E5E5E5', body_text = '000000', body_link = '006699', body_vlink = '5493B4', body_alink = '', body_hlink = 'DD6900', tr_color1 = 'EFEFEF', tr_color2 = 'DEE3E7', tr_color3 = 'D1D7DC', tr_class1 = '', tr_class2 = '', tr_class3 = '', th_color1 = '98AAB1', th_color2 = '006699', th_color3 = 'FFFFFF', th_class1 = 'cellpic1.gif', th_class2 = 'cellpic3.gif', th_class3 = 'cellpic2.jpg', td_color1 = 'FAFAFA', td_color2 = 'FFFFFF', td_color3 = '', td_class1 = 'row1', td_class2 = 'row2', td_class3 = '', fontface1 = 'Verdana, Arial, Helvetica, sans-serif', fontface2 = 'Trebuchet MS', fontface3 = 'Courier, ''Courier New'', sans-serif', fontsize1 = 10, fontsize2 = 11, fontsize3 = 12, fontcolor1 = '444444', fontcolor2 = '006600', fontcolor3 = 'FFA34F', span_class1 = '', span_class2 = '', span_class3 = ''
WHERE themes_id = $theme_id";
_sql($sql, $errored, $error_ary);
$sql = "DELETE FROM " . THEMES_NAME_TABLE . "
WHERE themes_id = $theme_id";
_sql($sql, $errored, $error_ary);
$sql = "INSERT INTO " . THEMES_NAME_TABLE . " (themes_id, tr_color1_name, tr_color2_name, tr_color3_name, tr_class1_name, tr_class2_name, tr_class3_name, th_color1_name, th_color2_name, th_color3_name, th_class1_name, th_class2_name, th_class3_name, td_color1_name, td_color2_name, td_color3_name, td_class1_name, td_class2_name, td_class3_name, fontface1_name, fontface2_name, fontface3_name, fontsize1_name, fontsize2_name, fontsize3_name, fontcolor1_name, fontcolor2_name, fontcolor3_name, span_class1_name, span_class2_name, span_class3_name)
VALUES ($theme_id, 'The lightest row colour', 'The medium row color', 'The darkest row colour', '', '', '', 'Border round the whole page', 'Outer table border', 'Inner table border', 'Silver gradient picture', 'Blue gradient picture', 'Fade-out gradient on index', 'Background for quote boxes', 'All white areas', '', 'Background for topic posts', '2nd background for topic posts', '', 'Main fonts', 'Additional topic title font', 'Form fonts', 'Smallest font size', 'Medium font size', 'Normal font size (post body etc)', 'Quote & copyright text', 'Code text colour', 'Main table header text colour', '', '', '')";
_sql($sql, $errored, $error_ary);
}
$sql = "SELECT MIN(post_id) AS first_post_id, topic_id
FROM " . POSTS_TABLE . "
GROUP BY topic_id
ORDER BY topic_id ASC";
$result = _sql($sql, $errored, $error_ary);
if ( $row = $db->sql_fetchrow($result) )
{
do
{
$sql = "UPDATE " . TOPICS_TABLE . "
SET topic_first_post_id = " . $row['first_post_id'] . "
WHERE topic_id = " . $row['topic_id'];
_sql($sql, $errored, $error_ary);
}
while ( $row = $db->sql_fetchrow($result) );
}
$sql = "SELECT DISTINCT u.user_id
FROM " . USERS_TABLE . " u, " . USER_GROUP_TABLE . " ug, " . AUTH_ACCESS_TABLE . " aa
WHERE aa.auth_mod = 1
AND ug.group_id = aa.group_id
AND u.user_id = ug.user_id
AND u.user_level <> " . ADMIN;
$result = _sql($sql, $errored, $error_ary);
$mod_user = array();
while ( $row = $db->sql_fetchrow($result) )
{
$mod_user[] = $row['user_id'];
}
if ( count($mod_user) )
{
$sql = "UPDATE " . USERS_TABLE . "
SET user_level = " . MOD . "
WHERE user_id IN (" . implode(', ', $mod_user) . ")";
_sql($sql, $errored, $error_ary);
}
$sql = "INSERT INTO " . CONFIG_TABLE . " (config_name, config_value)
VALUES ('server_name', 'www.myserver.tld')";
_sql($sql, $errored, $error_ary);
$sql = "INSERT INTO " . CONFIG_TABLE . " (config_name, config_value)
VALUES ('script_path', '/phpBB2/')";
_sql($sql, $errored, $error_ary);
$sql = "INSERT INTO " . CONFIG_TABLE . " (config_name, config_value)
VALUES ('server_port', '80')";
_sql($sql, $errored, $error_ary);
$sql = "INSERT INTO " . CONFIG_TABLE . " (config_name, config_value)
VALUES ('record_online_users', '1')";
_sql($sql, $errored, $error_ary);
$sql = "INSERT INTO " . CONFIG_TABLE . " (config_name, config_value)
VALUES ('record_online_date', '" . time() . "')";
_sql($sql, $errored, $error_ary);
case 'RC-3':
case 'RC-4':
case '.0.0':
case '.0.1':
if ( SQL_LAYER == 'postgresql' )
{
$sql = "SELECT user_id, user_timezone_old
FROM " . USERS_TABLE;
$result = _sql($sql, $errored, $error_ary);
while ( $row = $db->sql_fetchrow($result) )
{
$sql = "UPDATE " . USERS_TABLE . "
SET user_timezone = " . $row['user_timezone_old'] . "
WHERE user_id = " . $row['user_id'];
_sql($sql, $errored, $error_ary);
}
}
$sql = "SELECT topic_id, topic_moved_id
FROM " . TOPICS_TABLE . "
WHERE topic_moved_id <> 0";
$result = _sql($sql, $errored, $error_ary);
$topic_ary = array();
while ( $row = $db->sql_fetchrow($result) )
{
$topic_ary[$row['topic_id']] = $row['topic_moved_id'];
}
while ( list($topic_id, $topic_moved_id) = each($topic_ary) )
{
$sql = "SELECT MAX(post_id) AS last_post, MIN(post_id) AS first_post, COUNT(post_id) AS total_posts
FROM " . POSTS_TABLE . "
WHERE topic_id = $topic_moved_id";
$result = _sql($sql, $errored, $error_ary);
$sql = ( $row = $db->sql_fetchrow($result) ) ? "UPDATE " . TOPICS_TABLE . " SET topic_replies = " . ( $row['total_posts'] - 1 ) . ", topic_first_post_id = " . $row['first_post'] . ", topic_last_post_id = " . $row['last_post'] . " WHERE topic_id = $topic_id" : "DELETE FROM " . TOPICS_TABLE . " WHERE topic_id = " . $row['topic_id'];
_sql($sql, $errored, $error_ary);
}
unset($sql);
$sql = "UPDATE " . CONFIG_TABLE . "
SET config_value = '$updates_to_version'
WHERE config_name = 'version'";
_sql($sql, $errored, $error_ary);
sync('all forums');
echo "</b> <b class=\"ok\">Done</b><br />Result &nbsp; :: \n";
if ( $errored )
{
echo " <b>Some queries failed, the statements and errors are listing below</b>\n<ul>";
for($i = 0; $i < count($error_ary['sql']); $i++)
{
echo "<li>Error :: <b>" . $error_ary['error_code'][$i]['message'] . "</b><br />";
echo "SQL &nbsp; :: <b>" . $error_ary['sql'][$i] . "</b><br /><br /></li>";
}
echo "</ul>\n<p>This is probably nothing to worry about, update will continue. Should this fail to complete you may need to seek help at our development board. See <a href=\"docs\README.html\">README</a> for details on how to obtain advice.</p>\n";
}
else
{
echo "<b>No errors</b>\n";
}
break;
default:
echo " No updates where required</b></p>\n";
break;
}
echo "<h2>Update completed</h2>\n";
echo "\n<p>You should now visit the General Configuration settings page in the <a href=\"../admin/\">Administration Panel</a> and check the General Configuration of the board. If you updated from versions prior to RC-3 you <b>must</b> update some entries. If you do not do this emails sent from the board will contain incorrect information. Don't forget to delete this file!</p>\n";
?>
<br clear="all" />
</body>
</html>

View File

@@ -1,668 +0,0 @@
<?php
/***************************************************************************
* update_to_xxx.php
* -------------------
* begin : Wednesday, May 16, 2002
* copyright : (C) 2001 The phpBB Group
* email : support@phpbb.com
*
* $Id$
*
***************************************************************************/
/***************************************************************************
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
***************************************************************************/
function _sql($sql, &$errored, &$error_ary, $echo_dot = true)
{
global $db;
if( !($result = $db->sql_query($sql)) )
{
$errored = true;
$error_ary['sql'][] = ( is_array($sql) ) ? $sql[$i] : $sql;
$error_ary['error_code'][] = $db->sql_error();
}
if ( $echo_dot )
{
echo ".";
flush();
}
return $result;
}
define('IN_PHPBB', 1);
$phpbb_root_path = './../';
include($phpbb_root_path . 'extension.inc');
include($phpbb_root_path . 'config.'.$phpEx);
include($phpbb_root_path . 'includes/constants.'.$phpEx);
include($phpbb_root_path . 'includes/functions.'.$phpEx);
include($phpbb_root_path . 'includes/functions_admin.'.$phpEx);
include($phpbb_root_path . 'includes/db.'.$phpEx);
//
//
//
$updates_to_version = ".0.3";
//
//
//
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;">
<meta http-equiv="Content-Style-Type" content="text/css">
<style type="text/css">
<!--
font,th,td,p,body { font-family: "Courier New", courier; font-size: 11pt }
a:link,a:active,a:visited { color : #006699; }
a:hover { text-decoration: underline; color : #DD6900;}
hr { height: 0px; border: solid #D1D7DC 0px; border-top-width: 1px;}
.maintitle,h1,h2 {font-weight: bold; font-size: 22px; font-family: "Trebuchet MS",Verdana, Arial, Helvetica, sans-serif; text-decoration: none; line-height : 120%; color : #000000;}
.ok {color:green}
/* Import the fancy styles for IE only (NS4.x doesn't use the @import function) */
@import url("../templates/subSilver/formIE.css");
-->
</style>
</head>
<body bgcolor="#FFFFFF" text="#000000" link="#006699" vlink="#5584AA">
<table width="100%" border="0" cellspacing="0" cellpadding="10" align="center">
<tr>
<td><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><img src="../templates/subSilver/images/logo_phpBB.gif" border="0" alt="Forum Home" vspace="1" /></td>
<td align="center" width="100%" valign="middle"><span class="maintitle">Updating to latest stable release</span></td>
</tr>
</table></td>
</tr>
</table>
<br clear="all" />
<h2>Information</h2>
<?php
echo '<p>Database type &nbsp; &nbsp;:: <b>' . SQL_LAYER . '</b><br />';
$sql = "SELECT config_value
FROM " . CONFIG_TABLE . "
WHERE config_name = 'version'";
if ( !($result = $db->sql_query($sql)) )
{
die("Couldn't obtain version info");
}
$row = $db->sql_fetchrow($result);
$sql = array();
switch ( $row['config_value'] )
{
case '':
echo 'Previous version :: <b>&lt; RC-3</b></p><br />';
break;
case 'RC-3':
echo 'Previous version :: <b>RC-3</b></p><br />';
break;
case 'RC-4':
echo 'Previous version :: <b>RC-4</b></p><br />';
break;
default:
echo 'Previous version :: <b>2' . $row['config_value'] . '</b><br />';
break;
}
echo 'Updated version &nbsp;:: <b>2' . $updates_to_version . '</b></p>' ."\n";
switch ( $row['config_value'] )
{
case '':
switch ( SQL_LAYER )
{
case 'mysql':
case 'mysql4':
$sql[] = "ALTER TABLE " . USERS_TABLE . " DROP
COLUMN user_autologin_key";
$sql[] = "ALTER TABLE " . RANKS_TABLE . " DROP
COLUMN rank_max";
$sql[] = "ALTER TABLE " . USERS_TABLE . "
ADD COLUMN user_session_time int(11) DEFAULT '0' NOT NULL,
ADD COLUMN user_session_page smallint(5) DEFAULT '0' NOT NULL,
ADD INDEX (user_session_time)";
$sql[] = "ALTER TABLE " . SEARCH_TABLE . "
MODIFY search_id int(11) NOT NULL";
$sql[] = "ALTER TABLE " . TOPICS_TABLE . "
MODIFY topic_moved_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL,
ADD COLUMN topic_first_post_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL,
ADD INDEX (topic_first_post_id)";
$sql[] = "ALTER TABLE " . THEMES_NAME_TABLE . "
ADD COLUMN tr_class1_name varchar(50) NULL,
ADD COLUMN tr_class2_name varchar(50) NULL,
ADD COLUMN tr_class3_name varchar(50) NULL,
ADD COLUMN th_class1_name varchar(50) NULL,
ADD COLUMN th_class2_name varchar(50) NULL,
ADD COLUMN th_class3_name varchar(50) NULL,
ADD COLUMN td_class1_name varchar(50) NULL,
ADD COLUMN td_class2_name varchar(50) NULL,
ADD COLUMN td_class3_name varchar(50) NULL,
ADD COLUMN span_class1_name varchar(50) NULL,
ADD COLUMN span_class2_name varchar(50) NULL,
ADD COLUMN span_class3_name varchar(50) NULL";
break;
case 'postgresql':
$sql[] = "ALTER TABLE " . USERS_TABLE . "
ADD COLUMN user_session_time int4";
$sql[] = "ALTER TABLE " . USERS_TABLE . "
ADD COLUMN user_session_page int2";
$sql[] = "ALTER TABLE " . USERS_TABLE . "
ALTER COLUMN user_session_time SET DEFAULT '0'";
$sql[] = "ALTER TABLE " . USERS_TABLE . "
ALTER COLUMN user_session_page SET DEFAULT '0'";
$sql[] = "CREATE INDEX user_session_time_" . $table_prefix . "users_index
ON " . USERS_TABLE . " (user_session_time)";
$sql[] = "ALTER TABLE " . TOPICS_TABLE . "
ADD COLUMN topic_first_post_id int4";
$sql[] = "CREATE INDEX topic_first_post_id_" . $table_prefix . "topics_index
ON " . TOPICS_TABLE . " (topic_first_post_id)";
$sql[] = "ALTER TABLE " . THEMES_NAME_TABLE . "
ADD COLUMN tr_class1_name varchar(50) NULL";
$sql[] = "ALTER TABLE " . THEMES_NAME_TABLE . "
ADD COLUMN tr_class2_name varchar(50) NULL";
$sql[] = "ALTER TABLE " . THEMES_NAME_TABLE . "
ADD COLUMN tr_class3_name varchar(50) NULL";
$sql[] = "ALTER TABLE " . THEMES_NAME_TABLE . "
ADD COLUMN th_class1_name varchar(50) NULL";
$sql[] = "ALTER TABLE " . THEMES_NAME_TABLE . "
ADD COLUMN th_class2_name varchar(50) NULL";
$sql[] = "ALTER TABLE " . THEMES_NAME_TABLE . "
ADD COLUMN th_class3_name varchar(50) NULL";
$sql[] = "ALTER TABLE " . THEMES_NAME_TABLE . "
ADD COLUMN td_class1_name varchar(50) NULL";
$sql[] = "ALTER TABLE " . THEMES_NAME_TABLE . "
ADD COLUMN td_class2_name varchar(50) NULL";
$sql[] = "ALTER TABLE " . THEMES_NAME_TABLE . "
ADD COLUMN td_class3_name varchar(50) NULL";
$sql[] = "ALTER TABLE " . THEMES_NAME_TABLE . "
ADD COLUMN span_class1_name varchar(50) NULL";
$sql[] = "ALTER TABLE " . THEMES_NAME_TABLE . "
ADD COLUMN span_class2_name varchar(50) NULL";
$sql[] = "ALTER TABLE " . THEMES_NAME_TABLE . "
ADD COLUMN span_class3_name varchar(50) NULL";
break;
case 'mssql-odbc':
case 'mssql':
$sql[] = "ALTER TABLE " . USERS_TABLE . " DROP
COLUMN user_autologin_key";
$sql[] = "ALTER TABLE " . USERS_TABLE . " ADD
user_session_time int NOT NULL,
user_session_page smallint NOT NULL,
CONSTRAINT [DF_" . $table_prefix . "users_user_session_time] DEFAULT (0) FOR [user_session_time],
CONSTRAINT [DF_" . $table_prefix . "users_user_session_page] DEFAULT (0) FOR [user_session_page]";
$sql[] = "CREATE INDEX [IX_" . $table_prefix . "users]
ON [" . USERS_TABLE . "]([user_session_time]) ON [PRIMARY]";
/* ---------------------------------------------------------------------
DROP FORUM TABLE -- if this may cause you problems you can safely
comment it out, remember to manually remove the IDENTITY setting on
the forum_id column
--------------------------------------------------------------------- */
$sql [] = "ALTER TABLE " . FORUMS_TABLE . " DROP
CONSTRAINT [DF_" . $table_prefix . "forums_forum_posts],
CONSTRAINT [DF_" . $table_prefix . "forums_forum_topics],
CONSTRAINT [DF_" . $table_prefix . "forums_forum_last_post_id],
CONSTRAINT [DF_" . $table_prefix . "forums_prune_enable],
CONSTRAINT [DF_" . $table_prefix . "forums_auth_view],
CONSTRAINT [DF_" . $table_prefix . "forums_auth_read],
CONSTRAINT [DF_" . $table_prefix . "forums_auth_post],
CONSTRAINT [DF_" . $table_prefix . "forums_auth_reply],
CONSTRAINT [DF_" . $table_prefix . "forums_auth_edit],
CONSTRAINT [DF_" . $table_prefix . "forums_auth_delete],
CONSTRAINT [DF_" . $table_prefix . "forums_auth_sticky],
CONSTRAINT [DF_" . $table_prefix . "forums_auth_announce],
CONSTRAINT [DF_" . $table_prefix . "forums_auth_vote],
CONSTRAINT [DF_" . $table_prefix . "forums_auth_pollcreate],
CONSTRAINT [DF_" . $table_prefix . "forums_auth_attachments]";
$sql[] = "CREATE TABLE Tmp_" . FORUMS_TABLE . "
(forum_id int NOT NULL, cat_id int NOT NULL, forum_name varchar(100) NOT NULL, forum_desc varchar(255) NULL, forum_status smallint NOT NULL, forum_order int NOT NULL, forum_posts int NOT NULL, forum_topics smallint NOT NULL, forum_last_post_id int NOT NULL, prune_next int NULL, prune_enable smallint NOT NULL, auth_view smallint NOT NULL, auth_read smallint NOT NULL, auth_post smallint NOT NULL, auth_reply smallint NOT NULL, auth_edit smallint NOT NULL, auth_delete smallint NOT NULL, auth_sticky smallint NOT NULL, auth_announce smallint NOT NULL, auth_vote smallint NOT NULL, auth_pollcreate smallint NOT NULL, auth_attachments smallint NOT NULL) ON [PRIMARY]";
$sql[] = "ALTER TABLE [Tmp_" . FORUMS_TABLE . "] WITH NOCHECK ADD
CONSTRAINT [DF_" . $table_prefix . "forums_forum_posts] DEFAULT (0) FOR [forum_posts],
CONSTRAINT [DF_" . $table_prefix . "forums_forum_topics] DEFAULT (0) FOR [forum_topics],
CONSTRAINT [DF_" . $table_prefix . "forums_forum_last_post_id] DEFAULT (0) FOR [forum_last_post_id],
CONSTRAINT [DF_" . $table_prefix . "forums_prune_enable] DEFAULT (0) FOR [prune_enable],
CONSTRAINT [DF_" . $table_prefix . "forums_auth_view] DEFAULT (0) FOR [auth_view],
CONSTRAINT [DF_" . $table_prefix . "forums_auth_read] DEFAULT (0) FOR [auth_read],
CONSTRAINT [DF_" . $table_prefix . "forums_auth_post] DEFAULT (0) FOR [auth_post],
CONSTRAINT [DF_" . $table_prefix . "forums_auth_reply] DEFAULT (0) FOR [auth_reply],
CONSTRAINT [DF_" . $table_prefix . "forums_auth_edit] DEFAULT (0) FOR [auth_edit],
CONSTRAINT [DF_" . $table_prefix . "forums_auth_delete] DEFAULT (0) FOR [auth_delete],
CONSTRAINT [DF_" . $table_prefix . "forums_auth_sticky] DEFAULT (0) FOR [auth_sticky],
CONSTRAINT [DF_" . $table_prefix . "forums_auth_announce] DEFAULT (0) FOR [auth_announce],
CONSTRAINT [DF_" . $table_prefix . "forums_auth_vote] DEFAULT (0) FOR [auth_vote],
CONSTRAINT [DF_" . $table_prefix . "forums_auth_pollcreate] DEFAULT (0) FOR [auth_pollcreate],
CONSTRAINT [DF_" . $table_prefix . "forums_auth_attachments] DEFAULT (0) FOR [auth_attachments]";
$sql[] = "INSERT INTO Tmp_" . FORUMS_TABLE . " (forum_id, cat_id, forum_name, forum_desc, forum_status, forum_order, forum_posts, forum_topics, forum_last_post_id, prune_next, prune_enable, auth_view, auth_read, auth_post, auth_reply, auth_edit, auth_delete, auth_sticky, auth_announce, auth_vote, auth_pollcreate, auth_attachments)
SELECT forum_id, cat_id, forum_name, forum_desc, forum_status, forum_order, forum_posts, forum_topics, forum_last_post_id, prune_next, prune_enable, auth_view, auth_read, auth_post, auth_reply, auth_edit, auth_delete, auth_sticky, auth_announce, auth_vote, auth_pollcreate, auth_attachments FROM " . FORUMS_TABLE . " TABLOCKX";
$sql[] = "DROP TABLE " . FORUMS_TABLE;
$sql[] = "EXECUTE sp_rename N'Tmp_" . FORUMS_TABLE . "', N'" . FORUMS_TABLE . "', 'OBJECT'";
$sql[] = "ALTER TABLE " . FORUMS_TABLE . " ADD
CONSTRAINT [PK_" . $table_prefix . "forums] PRIMARY KEY CLUSTERED (forum_id) ON [PRIMARY]";
$sql[] = "CREATE NONCLUSTERED INDEX [IX_" . $table_prefix . "forums]
ON " . FORUMS_TABLE . " (cat_id, forum_order, forum_last_post_id) ON [PRIMARY]";
/* --------------------------------------------------------------
END OF DROP FORUM -- don't remove anything after this point!
-------------------------------------------------------------- */
/* ---------------------------------------------------------------------
DROP GROUP TABLE -- if this may cause you problems you can safely
comment it out, remember to manually add the IDENTITY setting on
the group_id column
--------------------------------------------------------------------- */
$sql[] = "CREATE TABLE Tmp_" . GROUPS_TABLE . "
(group_id int IDENTITY (1, 1) NOT NULL, group_type smallint NULL, group_name varchar(50) NOT NULL, group_description varchar(255) NOT NULL, group_moderator int NULL, group_single_user smallint NOT NULL) ON [PRIMARY]";
$sql[] = "INSERT INTO Tmp_" . GROUPS_TABLE . " (group_id, group_type, group_name, group_description, group_moderator, group_single_user)
SELECT group_id, group_type, group_name, group_description, group_moderator, group_signle_user FROM " . GROUPS_TABLE . " TABLOCKX";
$sql[] = "DROP TABLE " . GROUPS_TABLE;
$sql[] = "EXECUTE sp_rename N'Tmp_" . GROUPS_TABLE . "', N'" . GROUPS_TABLE . "', 'OBJECT'";
$sql[] = "ALTER TABLE " . GROUPS_TABLE . " ADD
CONSTRAINT [PK_" . $table_prefix . "groups] PRIMARY KEY CLUSTERED (group_id) ON [PRIMARY]";
$sql[] = "CREATE INDEX [IX_" . $table_prefix . "groups]
ON " . GROUPS_TABLE . " (group_single_user) ON [PRIMARY]";
/* --------------------------------------------------------------
END OF DROP GROUP -- don't remove anything after this point!
-------------------------------------------------------------- */
$sql[] = "DROP INDEX " . RANKS_TABLE . ".IX_" . $table_prefix . "ranks";
$sql[] = "ALTER TABLE " . RANKS_TABLE . " DROP
COLUMN rank_max";
$sql[] = "CREATE INDEX [IX_" . $table_prefix . "ranks]
ON [" . RANKS_TABLE . "]([rank_min], [rank_special]) ON [PRIMARY]";
$sql[] = "DROP INDEX " . TOPICS_TABLE . ".IX_" . $table_prefix . "topics";
$sql[] = "ALTER TABLE " . TOPICS_TABLE . " ADD
topic_first_post_id int NULL,
CONSTRAINT [DF_" . $table_prefix . "topics_topic_first_post_id] FOR [topic_first_post_id]";
$sql[] = "CREATE INDEX [IX_" . $table_prefix . "topics]
ON [" . TOPICS_TABLE . "]([forum_id], [topic_type], [topic_first_post_id], [topic_last_post_id]) ON [PRIMARY]";
$sql[] = "ALTER TABLE " . SEARCH_WORD_TABLE . " DROP
CONSTRAINT [PK_" . $table_prefix . "search_wordlist]";
$sql[] = "CREATE UNIQUE INDEX [IX_" . $table_prefix . "search_wordlist]
ON [" . SEARCH_WORD_TABLE . "]([word_text]) WITH IGNORE_DUP_KEY ON [PRIMARY]";
$sql[] = "CREATE INDEX [IX_" . $table_prefix . "search_wordlist_1]
ON [" . SEARCH_WORD_TABLE . "]([word_common]) ON [PRIMARY]";
$sql[] = "CREATE INDEX [IX_" . $table_prefix . "search_wordmatch_1]
ON [" . SEARCH_MATCH_TABLE . "]([word_id]) ON [PRIMARY]";
$sql[] = "ALTER TABLE " . THEMES_NAME_TABLE . " ADD
tr_class1_name varchar(50) NULL,
tr_class2_name varchar(50) NULL,
tr_class3_name varchar(50) NULL,
th_class1_name varchar(50) NULL,
th_class2_name varchar(50) NULL,
th_class3_name varchar(50) NULL,
td_class1_name varchar(50) NULL,
td_class2_name varchar(50) NULL,
td_class3_name varchar(50) NULL,
span_class1_name varchar(50) NULL,
span_class2_name varchar(50) NULL,
span_class3_name varchar(50) NULL";
break;
case 'msaccess':
$sql[] = "ALTER TABLE " . USERS_TABLE . " DROP
COLUMN user_autologin_key";
$sql[] = "ALTER TABLE " . USERS_TABLE . " ADD
user_session_time int NOT NULL,
user_session_page smallint NOT NULL";
$sql[] = "CREATE INDEX user_session_time
ON " . USERS_TABLE . " (user_session_time)";
$sql[] = "ALTER TABLE " . TOPICS_TABLE . " ADD
topic_first_post_id int NULL";
$sql[] = "CREATE INDEX topic_first_post_id
ON " . TOPICS_TABLE . " (topic_first_post_id)";
$sql[] = "ALTER TABLE " . THEMES_NAME_TABLE . " ADD
tr_class1_name varchar(50) NULL,
tr_class2_name varchar(50) NULL,
tr_class3_name varchar(50) NULL,
th_class1_name varchar(50) NULL,
th_class2_name varchar(50) NULL,
th_class3_name varchar(50) NULL,
td_class1_name varchar(50) NULL,
td_class2_name varchar(50) NULL,
td_class3_name varchar(50) NULL,
span_class1_name varchar(50) NULL,
span_class2_name varchar(50) NULL,
span_class3_name varchar(50) NULL";
break;
default:
die("No DB LAYER found!");
break;
}
case 'RC-3':
case 'RC-4':
case '.0.0':
switch ( SQL_LAYER )
{
case 'mysql':
case 'mysql4':
$sql[] = "ALTER TABLE " . USERS_TABLE . "
MODIFY COLUMN user_id mediumint(8) NOT NULL,
MODIFY COLUMN user_timezone decimal(4,2) DEFAULT '0' NOT NULL";
break;
case 'postgresql':
$sql[] = "ALTER TABLE " . USERS_TABLE . "
RENAME COLUMN user_timezone TO user_timezone_old";
$sql[] = "ALTER TABLE " . USERS_TABLE . "
ADD COLUMN user_timezone decimal(4)";
break;
case 'mssql':
case 'mssql-odbc':
$sql[] = "ALTER TABLE " . USERS_TABLE . "
ALTER COLUMN [user_timezone] [decimal] (4,2) NOT NULL";
/* ---------------------------------------------------------------------
DROP GROUP TABLE -- if this may cause you problems you can safely
comment it out, remember to manually add the IDENTITY setting on
the group_id column
--------------------------------------------------------------------- */
$sql[] = "CREATE TABLE Tmp_" . GROUPS_TABLE . "
(group_id int IDENTITY (1, 1) NOT NULL, group_type smallint NULL, group_name varchar(50) NOT NULL, group_description varchar(255) NOT NULL, group_moderator int NULL, group_single_user smallint NOT NULL) ON [PRIMARY]";
$sql[] = "INSERT INTO Tmp_" . GROUPS_TABLE . " (group_id, group_type, group_name, group_description, group_moderator, group_single_user)
SELECT group_id, group_type, group_name, group_description, group_moderator, group_signle_user FROM " . GROUPS_TABLE . " TABLOCKX";
$sql[] = "DROP TABLE " . GROUPS_TABLE;
$sql[] = "EXECUTE sp_rename N'Tmp_" . GROUPS_TABLE . "', N'" . GROUPS_TABLE . "', 'OBJECT'";
$sql[] = "ALTER TABLE " . GROUPS_TABLE . " ADD
CONSTRAINT [PK_" . $table_prefix . "groups] PRIMARY KEY CLUSTERED (group_id) ON [PRIMARY]";
$sql[] = "CREATE INDEX [IX_" . $table_prefix . "groups]
ON " . GROUPS_TABLE . " (group_single_user) ON [PRIMARY]";
/* --------------------------------------------------------------
END OF DROP GROUP -- don't remove anything after this point!
-------------------------------------------------------------- */
break;
}
case '.0.1':
switch ( SQL_LAYER )
{
case 'mysql':
case 'mysql4':
$sql[] = "ALTER TABLE " . GROUPS_TABLE . "
MODIFY COLUMN group_id mediumint(8) NOT NULL auto_increment";
break;
case 'mssql':
case 'mssql-odbc':
/* ---------------------------------------------------------------------
DROP GROUP TABLE -- if this may cause you problems you can safely
comment it out, remember to manually add the IDENTITY setting on
the group_id column
--------------------------------------------------------------------- */
$sql[] = "CREATE TABLE Tmp_" . GROUPS_TABLE . "
(group_id int IDENTITY (1, 1) NOT NULL, group_type smallint NULL, group_name varchar(50) NOT NULL, group_description varchar(255) NOT NULL, group_moderator int NULL, group_single_user smallint NOT NULL) ON [PRIMARY]";
$sql[] = "INSERT INTO Tmp_" . GROUPS_TABLE . " (group_id, group_type, group_name, group_description, group_moderator, group_single_user)
SELECT group_id, group_type, group_name, group_description, group_moderator, group_signle_user FROM " . GROUPS_TABLE . " TABLOCKX";
$sql[] = "DROP TABLE " . GROUPS_TABLE;
$sql[] = "EXECUTE sp_rename N'Tmp_" . GROUPS_TABLE . "', N'" . GROUPS_TABLE . "', 'OBJECT'";
$sql[] = "ALTER TABLE " . GROUPS_TABLE . " ADD
CONSTRAINT [PK_" . $table_prefix . "groups] PRIMARY KEY CLUSTERED (group_id) ON [PRIMARY]";
$sql[] = "CREATE INDEX [IX_" . $table_prefix . "groups]
ON " . GROUPS_TABLE . " (group_single_user) ON [PRIMARY]";
/* --------------------------------------------------------------
END OF DROP GROUP -- don't remove anything after this point!
-------------------------------------------------------------- */
break;
}
}
echo "<h2>Updating database schema</h2>\n";
echo "<p>Progress :: <b>";
flush();
$error_ary = array();
$errored = false;
if ( count($sql) )
{
for($i = 0; $i < count($sql); $i++)
{
_sql($sql[$i], $errored, $error_ary);
}
echo "</b> <b class=\"ok\">Done</b><br />Result &nbsp; :: \n";
if ( $errored )
{
echo " <b>Some queries failed, the statements and errors are listing below</b>\n<ul>";
for($i = 0; $i < count($error_ary['sql']); $i++)
{
echo "<li>Error :: <b>" . $error_ary['error_code'][$i]['message'] . "</b><br />";
echo "SQL &nbsp; :: <b>" . $error_ary['sql'][$i] . "</b><br /><br /></li>";
}
echo "</ul>\n<p>This is probably nothing to worry about, update will continue. Should this fail to complete you may need to seek help at our development board. See <a href=\"docs\README.html\">README</a> for details on how to obtain advice.</p>\n";
}
else
{
echo "<b>No errors</b>\n";
}
}
else
{
echo " No updates required</b></p>\n";
}
//
//
//
unset($sql);
$error_ary = array();
$errored = false;
echo "<h2>Updating data</h2>\n";
echo "<p>Progress :: <b>";
flush();
switch ( $row['config_value'] )
{
case '':
$sql = "SELECT themes_id
FROM " . THEMES_TABLE . "
WHERE template_name = 'subSilver'";
$result = _sql($sql, $errored, $error_ary);
if( $row = $db->sql_fetchrow($result) )
{
$theme_id = $row['themes_id'];
$sql = "UPDATE " . THEMES_TABLE . "
SET head_stylesheet = 'subSilver.css', body_background = '', body_bgcolor = 'E5E5E5', body_text = '000000', body_link = '006699', body_vlink = '5493B4', body_alink = '', body_hlink = 'DD6900', tr_color1 = 'EFEFEF', tr_color2 = 'DEE3E7', tr_color3 = 'D1D7DC', tr_class1 = '', tr_class2 = '', tr_class3 = '', th_color1 = '98AAB1', th_color2 = '006699', th_color3 = 'FFFFFF', th_class1 = 'cellpic1.gif', th_class2 = 'cellpic3.gif', th_class3 = 'cellpic2.jpg', td_color1 = 'FAFAFA', td_color2 = 'FFFFFF', td_color3 = '', td_class1 = 'row1', td_class2 = 'row2', td_class3 = '', fontface1 = 'Verdana, Arial, Helvetica, sans-serif', fontface2 = 'Trebuchet MS', fontface3 = 'Courier, ''Courier New'', sans-serif', fontsize1 = 10, fontsize2 = 11, fontsize3 = 12, fontcolor1 = '444444', fontcolor2 = '006600', fontcolor3 = 'FFA34F', span_class1 = '', span_class2 = '', span_class3 = ''
WHERE themes_id = $theme_id";
_sql($sql, $errored, $error_ary);
$sql = "DELETE FROM " . THEMES_NAME_TABLE . "
WHERE themes_id = $theme_id";
_sql($sql, $errored, $error_ary);
$sql = "INSERT INTO " . THEMES_NAME_TABLE . " (themes_id, tr_color1_name, tr_color2_name, tr_color3_name, tr_class1_name, tr_class2_name, tr_class3_name, th_color1_name, th_color2_name, th_color3_name, th_class1_name, th_class2_name, th_class3_name, td_color1_name, td_color2_name, td_color3_name, td_class1_name, td_class2_name, td_class3_name, fontface1_name, fontface2_name, fontface3_name, fontsize1_name, fontsize2_name, fontsize3_name, fontcolor1_name, fontcolor2_name, fontcolor3_name, span_class1_name, span_class2_name, span_class3_name)
VALUES ($theme_id, 'The lightest row colour', 'The medium row color', 'The darkest row colour', '', '', '', 'Border round the whole page', 'Outer table border', 'Inner table border', 'Silver gradient picture', 'Blue gradient picture', 'Fade-out gradient on index', 'Background for quote boxes', 'All white areas', '', 'Background for topic posts', '2nd background for topic posts', '', 'Main fonts', 'Additional topic title font', 'Form fonts', 'Smallest font size', 'Medium font size', 'Normal font size (post body etc)', 'Quote & copyright text', 'Code text colour', 'Main table header text colour', '', '', '')";
_sql($sql, $errored, $error_ary);
}
$sql = "SELECT MIN(post_id) AS first_post_id, topic_id
FROM " . POSTS_TABLE . "
GROUP BY topic_id
ORDER BY topic_id ASC";
$result = _sql($sql, $errored, $error_ary);
if ( $row = $db->sql_fetchrow($result) )
{
do
{
$sql = "UPDATE " . TOPICS_TABLE . "
SET topic_first_post_id = " . $row['first_post_id'] . "
WHERE topic_id = " . $row['topic_id'];
_sql($sql, $errored, $error_ary);
}
while ( $row = $db->sql_fetchrow($result) );
}
$sql = "SELECT DISTINCT u.user_id
FROM " . USERS_TABLE . " u, " . USER_GROUP_TABLE . " ug, " . AUTH_ACCESS_TABLE . " aa
WHERE aa.auth_mod = 1
AND ug.group_id = aa.group_id
AND u.user_id = ug.user_id
AND u.user_level <> " . ADMIN;
$result = _sql($sql, $errored, $error_ary);
$mod_user = array();
while ( $row = $db->sql_fetchrow($result) )
{
$mod_user[] = $row['user_id'];
}
if ( count($mod_user) )
{
$sql = "UPDATE " . USERS_TABLE . "
SET user_level = " . MOD . "
WHERE user_id IN (" . implode(', ', $mod_user) . ")";
_sql($sql, $errored, $error_ary);
}
$sql = "INSERT INTO " . CONFIG_TABLE . " (config_name, config_value)
VALUES ('server_name', 'www.myserver.tld')";
_sql($sql, $errored, $error_ary);
$sql = "INSERT INTO " . CONFIG_TABLE . " (config_name, config_value)
VALUES ('script_path', '/phpBB2/')";
_sql($sql, $errored, $error_ary);
$sql = "INSERT INTO " . CONFIG_TABLE . " (config_name, config_value)
VALUES ('server_port', '80')";
_sql($sql, $errored, $error_ary);
$sql = "INSERT INTO " . CONFIG_TABLE . " (config_name, config_value)
VALUES ('record_online_users', '1')";
_sql($sql, $errored, $error_ary);
$sql = "INSERT INTO " . CONFIG_TABLE . " (config_name, config_value)
VALUES ('record_online_date', '" . time() . "')";
_sql($sql, $errored, $error_ary);
case 'RC-3':
case 'RC-4':
case '.0.0':
case '.0.1':
if ( SQL_LAYER == 'postgresql' )
{
$sql = "SELECT user_id, user_timezone_old
FROM " . USERS_TABLE;
$result = _sql($sql, $errored, $error_ary);
while ( $row = $db->sql_fetchrow($result) )
{
$sql = "UPDATE " . USERS_TABLE . "
SET user_timezone = " . $row['user_timezone_old'] . "
WHERE user_id = " . $row['user_id'];
_sql($sql, $errored, $error_ary);
}
}
$sql = "SELECT topic_id, topic_moved_id
FROM " . TOPICS_TABLE . "
WHERE topic_moved_id <> 0";
$result = _sql($sql, $errored, $error_ary);
$topic_ary = array();
while ( $row = $db->sql_fetchrow($result) )
{
$topic_ary[$row['topic_id']] = $row['topic_moved_id'];
}
while ( list($topic_id, $topic_moved_id) = each($topic_ary) )
{
$sql = "SELECT MAX(post_id) AS last_post, MIN(post_id) AS first_post, COUNT(post_id) AS total_posts
FROM " . POSTS_TABLE . "
WHERE topic_id = $topic_moved_id";
$result = _sql($sql, $errored, $error_ary);
$sql = ( $row = $db->sql_fetchrow($result) ) ? "UPDATE " . TOPICS_TABLE . " SET topic_replies = " . ( $row['total_posts'] - 1 ) . ", topic_first_post_id = " . $row['first_post'] . ", topic_last_post_id = " . $row['last_post'] . " WHERE topic_id = $topic_id" : "DELETE FROM " . TOPICS_TABLE . " WHERE topic_id = " . $row['topic_id'];
_sql($sql, $errored, $error_ary);
}
unset($sql);
sync('all forums');
case '.0.2':
$sql = "UPDATE " . CONFIG_TABLE . "
SET config_value = '$updates_to_version'
WHERE config_name = 'version'";
_sql($sql, $errored, $error_ary);
echo "</b> <b class=\"ok\">Done</b><br />Result &nbsp; :: \n";
if ( $errored )
{
echo " <b>Some queries failed, the statements and errors are listing below</b>\n<ul>";
for($i = 0; $i < count($error_ary['sql']); $i++)
{
echo "<li>Error :: <b>" . $error_ary['error_code'][$i]['message'] . "</b><br />";
echo "SQL &nbsp; :: <b>" . $error_ary['sql'][$i] . "</b><br /><br /></li>";
}
echo "</ul>\n<p>This is probably nothing to worry about, update will continue. Should this fail to complete you may need to seek help at our development board. See <a href=\"docs\README.html\">README</a> for details on how to obtain advice.</p>\n";
}
else
{
echo "<b>No errors</b>\n";
}
break;
default:
echo " No updates where required</b></p>\n";
break;
}
echo "<h2>Update completed</h2>\n";
echo "\n<p>You should now visit the General Configuration settings page in the <a href=\"../admin/\">Administration Panel</a> and check the General Configuration of the board. If you updated from versions prior to RC-3 you <b>must</b> update some entries. If you do not do this emails sent from the board will contain incorrect information. Don't forget to delete this file!</p>\n";
?>
<br clear="all" />
</body>
</html>

View File

@@ -1,893 +0,0 @@
<?php
/***************************************************************************
* update_to_xxx.php
* -------------------
* begin : Wednesday, May 16, 2002
* copyright : (C) 2001 The phpBB Group
* email : support@phpbb.com
*
* $Id$
*
***************************************************************************/
/***************************************************************************
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
***************************************************************************/
function _sql($sql, &$errored, &$error_ary, $echo_dot = true)
{
global $db;
if (!($result = $db->sql_query($sql)))
{
$errored = true;
$error_ary['sql'][] = (is_array($sql)) ? $sql[$i] : $sql;
$error_ary['error_code'][] = $db->sql_error();
}
if ($echo_dot)
{
echo ". \n";
flush();
}
return $result;
}
@set_time_limit(120);
define('IN_PHPBB', 1);
$phpbb_root_path = './../';
include($phpbb_root_path . 'extension.inc');
include($phpbb_root_path . 'config.'.$phpEx);
if(!isset($dbms))
{
die("Please read: <a href='../docs/INSTALL.html'>INSTALL.html</a> before attempting to update.");
}
include($phpbb_root_path . 'includes/constants.'.$phpEx);
include($phpbb_root_path . 'includes/functions.'.$phpEx);
include($phpbb_root_path . 'includes/functions_admin.'.$phpEx);
include($phpbb_root_path . 'includes/functions_search.'.$phpEx);
include($phpbb_root_path . 'includes/db.'.$phpEx);
//
//
//
$updates_to_version = ".0.4";
//
//
//
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;">
<meta http-equiv="Content-Style-Type" content="text/css">
<style type="text/css">
<!--
font,th,td,p,body { font-family: "Courier New", courier; font-size: 11pt }
a:link,a:active,a:visited { color : #006699; }
a:hover { text-decoration: underline; color : #DD6900;}
hr { height: 0px; border: solid #D1D7DC 0px; border-top-width: 1px;}
.maintitle,h1,h2 {font-weight: bold; font-size: 22px; font-family: "Trebuchet MS",Verdana, Arial, Helvetica, sans-serif; text-decoration: none; line-height : 120%; color : #000000;}
.ok {color:green}
/* Import the fancy styles for IE only (NS4.x doesn't use the @import function) */
@import url("../templates/subSilver/formIE.css");
-->
</style>
</head>
<body bgcolor="#FFFFFF" text="#000000" link="#006699" vlink="#5584AA">
<table width="100%" border="0" cellspacing="0" cellpadding="10" align="center">
<tr>
<td><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><img src="../templates/subSilver/images/logo_phpBB.gif" border="0" alt="Forum Home" vspace="1" /></td>
<td align="center" width="100%" valign="middle"><span class="maintitle">Updating to latest stable release</span></td>
</tr>
</table></td>
</tr>
</table>
<br clear="all" />
<h2>Information</h2>
<?php
echo '<p>Database type &nbsp; &nbsp;:: <b>' . SQL_LAYER . '</b><br />';
$sql = "SELECT config_value
FROM " . CONFIG_TABLE . "
WHERE config_name = 'version'";
if (!($result = $db->sql_query($sql)))
{
die("Couldn't obtain version info");
}
$row = $db->sql_fetchrow($result);
$sql = array();
switch ($row['config_value'])
{
case '':
echo 'Previous version :: <b>&lt; RC-3</b></p><br />';
break;
case 'RC-3':
echo 'Previous version :: <b>RC-3</b></p><br />';
break;
case 'RC-4':
echo 'Previous version :: <b>RC-4</b></p><br />';
break;
default:
echo 'Previous version :: <b>2' . $row['config_value'] . '</b><br />';
break;
}
echo 'Updated version &nbsp;:: <b>2' . $updates_to_version . '</b></p>' ."\n";
//
// Schema updates
//
switch ($row['config_value'])
{
case '':
switch (SQL_LAYER)
{
case 'mysql':
case 'mysql4':
$sql[] = "ALTER TABLE " . USERS_TABLE . " DROP
COLUMN user_autologin_key";
$sql[] = "ALTER TABLE " . RANKS_TABLE . " DROP
COLUMN rank_max";
$sql[] = "ALTER TABLE " . USERS_TABLE . "
ADD COLUMN user_session_time int(11) DEFAULT '0' NOT NULL,
ADD COLUMN user_session_page smallint(5) DEFAULT '0' NOT NULL,
ADD INDEX (user_session_time)";
$sql[] = "ALTER TABLE " . SEARCH_TABLE . "
MODIFY search_id int(11) NOT NULL";
$sql[] = "ALTER TABLE " . TOPICS_TABLE . "
MODIFY topic_moved_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL,
ADD COLUMN topic_first_post_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL,
ADD INDEX (topic_first_post_id)";
$sql[] = "ALTER TABLE " . THEMES_NAME_TABLE . "
ADD COLUMN tr_class1_name varchar(50) NULL,
ADD COLUMN tr_class2_name varchar(50) NULL,
ADD COLUMN tr_class3_name varchar(50) NULL,
ADD COLUMN th_class1_name varchar(50) NULL,
ADD COLUMN th_class2_name varchar(50) NULL,
ADD COLUMN th_class3_name varchar(50) NULL,
ADD COLUMN td_class1_name varchar(50) NULL,
ADD COLUMN td_class2_name varchar(50) NULL,
ADD COLUMN td_class3_name varchar(50) NULL,
ADD COLUMN span_class1_name varchar(50) NULL,
ADD COLUMN span_class2_name varchar(50) NULL,
ADD COLUMN span_class3_name varchar(50) NULL";
break;
case 'postgresql':
$sql[] = "ALTER TABLE " . USERS_TABLE . "
ADD COLUMN user_session_time int4";
$sql[] = "ALTER TABLE " . USERS_TABLE . "
ADD COLUMN user_session_page int2";
$sql[] = "ALTER TABLE " . USERS_TABLE . "
ALTER COLUMN user_session_time SET DEFAULT '0'";
$sql[] = "ALTER TABLE " . USERS_TABLE . "
ALTER COLUMN user_session_page SET DEFAULT '0'";
$sql[] = "CREATE INDEX user_session_time_" . $table_prefix . "users_index
ON " . USERS_TABLE . " (user_session_time)";
$sql[] = "ALTER TABLE " . TOPICS_TABLE . "
ADD COLUMN topic_first_post_id int4";
$sql[] = "CREATE INDEX topic_first_post_id_" . $table_prefix . "topics_index
ON " . TOPICS_TABLE . " (topic_first_post_id)";
$sql[] = "ALTER TABLE " . THEMES_NAME_TABLE . "
ADD COLUMN tr_class1_name varchar(50) NULL";
$sql[] = "ALTER TABLE " . THEMES_NAME_TABLE . "
ADD COLUMN tr_class2_name varchar(50) NULL";
$sql[] = "ALTER TABLE " . THEMES_NAME_TABLE . "
ADD COLUMN tr_class3_name varchar(50) NULL";
$sql[] = "ALTER TABLE " . THEMES_NAME_TABLE . "
ADD COLUMN th_class1_name varchar(50) NULL";
$sql[] = "ALTER TABLE " . THEMES_NAME_TABLE . "
ADD COLUMN th_class2_name varchar(50) NULL";
$sql[] = "ALTER TABLE " . THEMES_NAME_TABLE . "
ADD COLUMN th_class3_name varchar(50) NULL";
$sql[] = "ALTER TABLE " . THEMES_NAME_TABLE . "
ADD COLUMN td_class1_name varchar(50) NULL";
$sql[] = "ALTER TABLE " . THEMES_NAME_TABLE . "
ADD COLUMN td_class2_name varchar(50) NULL";
$sql[] = "ALTER TABLE " . THEMES_NAME_TABLE . "
ADD COLUMN td_class3_name varchar(50) NULL";
$sql[] = "ALTER TABLE " . THEMES_NAME_TABLE . "
ADD COLUMN span_class1_name varchar(50) NULL";
$sql[] = "ALTER TABLE " . THEMES_NAME_TABLE . "
ADD COLUMN span_class2_name varchar(50) NULL";
$sql[] = "ALTER TABLE " . THEMES_NAME_TABLE . "
ADD COLUMN span_class3_name varchar(50) NULL";
break;
case 'mssql-odbc':
case 'mssql':
$sql[] = "ALTER TABLE " . USERS_TABLE . " DROP
COLUMN user_autologin_key";
$sql[] = "ALTER TABLE " . USERS_TABLE . " ADD
user_session_time int NOT NULL,
user_session_page smallint NOT NULL,
CONSTRAINT [DF_" . $table_prefix . "users_user_session_time] DEFAULT (0) FOR [user_session_time],
CONSTRAINT [DF_" . $table_prefix . "users_user_session_page] DEFAULT (0) FOR [user_session_page]";
$sql[] = "CREATE INDEX [IX_" . $table_prefix . "users]
ON [" . USERS_TABLE . "]([user_session_time]) ON [PRIMARY]";
/* ---------------------------------------------------------------------
DROP FORUM TABLE -- if this may cause you problems you can safely
comment it out, remember to manually remove the IDENTITY setting on
the forum_id column
--------------------------------------------------------------------- */
$sql [] = "ALTER TABLE " . FORUMS_TABLE . " DROP
CONSTRAINT [DF_" . $table_prefix . "forums_forum_posts],
CONSTRAINT [DF_" . $table_prefix . "forums_forum_topics],
CONSTRAINT [DF_" . $table_prefix . "forums_forum_last_post_id],
CONSTRAINT [DF_" . $table_prefix . "forums_prune_enable],
CONSTRAINT [DF_" . $table_prefix . "forums_auth_view],
CONSTRAINT [DF_" . $table_prefix . "forums_auth_read],
CONSTRAINT [DF_" . $table_prefix . "forums_auth_post],
CONSTRAINT [DF_" . $table_prefix . "forums_auth_reply],
CONSTRAINT [DF_" . $table_prefix . "forums_auth_edit],
CONSTRAINT [DF_" . $table_prefix . "forums_auth_delete],
CONSTRAINT [DF_" . $table_prefix . "forums_auth_sticky],
CONSTRAINT [DF_" . $table_prefix . "forums_auth_announce],
CONSTRAINT [DF_" . $table_prefix . "forums_auth_vote],
CONSTRAINT [DF_" . $table_prefix . "forums_auth_pollcreate],
CONSTRAINT [DF_" . $table_prefix . "forums_auth_attachments]";
$sql[] = "CREATE TABLE Tmp_" . FORUMS_TABLE . "
(forum_id int NOT NULL, cat_id int NOT NULL, forum_name varchar(100) NOT NULL, forum_desc varchar(255) NULL, forum_status smallint NOT NULL, forum_order int NOT NULL, forum_posts int NOT NULL, forum_topics smallint NOT NULL, forum_last_post_id int NOT NULL, prune_next int NULL, prune_enable smallint NOT NULL, auth_view smallint NOT NULL, auth_read smallint NOT NULL, auth_post smallint NOT NULL, auth_reply smallint NOT NULL, auth_edit smallint NOT NULL, auth_delete smallint NOT NULL, auth_sticky smallint NOT NULL, auth_announce smallint NOT NULL, auth_vote smallint NOT NULL, auth_pollcreate smallint NOT NULL, auth_attachments smallint NOT NULL) ON [PRIMARY]";
$sql[] = "ALTER TABLE [Tmp_" . FORUMS_TABLE . "] WITH NOCHECK ADD
CONSTRAINT [DF_" . $table_prefix . "forums_forum_posts] DEFAULT (0) FOR [forum_posts],
CONSTRAINT [DF_" . $table_prefix . "forums_forum_topics] DEFAULT (0) FOR [forum_topics],
CONSTRAINT [DF_" . $table_prefix . "forums_forum_last_post_id] DEFAULT (0) FOR [forum_last_post_id],
CONSTRAINT [DF_" . $table_prefix . "forums_prune_enable] DEFAULT (0) FOR [prune_enable],
CONSTRAINT [DF_" . $table_prefix . "forums_auth_view] DEFAULT (0) FOR [auth_view],
CONSTRAINT [DF_" . $table_prefix . "forums_auth_read] DEFAULT (0) FOR [auth_read],
CONSTRAINT [DF_" . $table_prefix . "forums_auth_post] DEFAULT (0) FOR [auth_post],
CONSTRAINT [DF_" . $table_prefix . "forums_auth_reply] DEFAULT (0) FOR [auth_reply],
CONSTRAINT [DF_" . $table_prefix . "forums_auth_edit] DEFAULT (0) FOR [auth_edit],
CONSTRAINT [DF_" . $table_prefix . "forums_auth_delete] DEFAULT (0) FOR [auth_delete],
CONSTRAINT [DF_" . $table_prefix . "forums_auth_sticky] DEFAULT (0) FOR [auth_sticky],
CONSTRAINT [DF_" . $table_prefix . "forums_auth_announce] DEFAULT (0) FOR [auth_announce],
CONSTRAINT [DF_" . $table_prefix . "forums_auth_vote] DEFAULT (0) FOR [auth_vote],
CONSTRAINT [DF_" . $table_prefix . "forums_auth_pollcreate] DEFAULT (0) FOR [auth_pollcreate],
CONSTRAINT [DF_" . $table_prefix . "forums_auth_attachments] DEFAULT (0) FOR [auth_attachments]";
$sql[] = "INSERT INTO Tmp_" . FORUMS_TABLE . " (forum_id, cat_id, forum_name, forum_desc, forum_status, forum_order, forum_posts, forum_topics, forum_last_post_id, prune_next, prune_enable, auth_view, auth_read, auth_post, auth_reply, auth_edit, auth_delete, auth_sticky, auth_announce, auth_vote, auth_pollcreate, auth_attachments)
SELECT forum_id, cat_id, forum_name, forum_desc, forum_status, forum_order, forum_posts, forum_topics, forum_last_post_id, prune_next, prune_enable, auth_view, auth_read, auth_post, auth_reply, auth_edit, auth_delete, auth_sticky, auth_announce, auth_vote, auth_pollcreate, auth_attachments FROM " . FORUMS_TABLE . " TABLOCKX";
$sql[] = "DROP TABLE " . FORUMS_TABLE;
$sql[] = "EXECUTE sp_rename N'Tmp_" . FORUMS_TABLE . "', N'" . FORUMS_TABLE . "', 'OBJECT'";
$sql[] = "ALTER TABLE " . FORUMS_TABLE . " ADD
CONSTRAINT [PK_" . $table_prefix . "forums] PRIMARY KEY CLUSTERED (forum_id) ON [PRIMARY]";
$sql[] = "CREATE NONCLUSTERED INDEX [IX_" . $table_prefix . "forums]
ON " . FORUMS_TABLE . " (cat_id, forum_order, forum_last_post_id) ON [PRIMARY]";
/* --------------------------------------------------------------
END OF DROP FORUM -- don't remove anything after this point!
-------------------------------------------------------------- */
$sql[] = "DROP INDEX " . RANKS_TABLE . ".IX_" . $table_prefix . "ranks";
$sql[] = "ALTER TABLE " . RANKS_TABLE . " DROP
COLUMN rank_max";
$sql[] = "CREATE INDEX [IX_" . $table_prefix . "ranks]
ON [" . RANKS_TABLE . "]([rank_min], [rank_special]) ON [PRIMARY]";
$sql[] = "DROP INDEX " . TOPICS_TABLE . ".IX_" . $table_prefix . "topics";
$sql[] = "ALTER TABLE " . TOPICS_TABLE . " ADD
topic_first_post_id int NULL,
CONSTRAINT [DF_" . $table_prefix . "topics_topic_first_post_id] FOR [topic_first_post_id]";
$sql[] = "CREATE INDEX [IX_" . $table_prefix . "topics]
ON [" . TOPICS_TABLE . "]([forum_id], [topic_type], [topic_first_post_id], [topic_last_post_id]) ON [PRIMARY]";
$sql[] = "ALTER TABLE " . SEARCH_WORD_TABLE . " DROP
CONSTRAINT [PK_" . $table_prefix . "search_wordlist]";
$sql[] = "CREATE UNIQUE INDEX [IX_" . $table_prefix . "search_wordlist]
ON [" . SEARCH_WORD_TABLE . "]([word_text]) WITH IGNORE_DUP_KEY ON [PRIMARY]";
$sql[] = "CREATE INDEX [IX_" . $table_prefix . "search_wordlist_1]
ON [" . SEARCH_WORD_TABLE . "]([word_common]) ON [PRIMARY]";
$sql[] = "CREATE INDEX [IX_" . $table_prefix . "search_wordmatch_1]
ON [" . SEARCH_MATCH_TABLE . "]([word_id]) ON [PRIMARY]";
$sql[] = "ALTER TABLE " . THEMES_NAME_TABLE . " ADD
tr_class1_name varchar(50) NULL,
tr_class2_name varchar(50) NULL,
tr_class3_name varchar(50) NULL,
th_class1_name varchar(50) NULL,
th_class2_name varchar(50) NULL,
th_class3_name varchar(50) NULL,
td_class1_name varchar(50) NULL,
td_class2_name varchar(50) NULL,
td_class3_name varchar(50) NULL,
span_class1_name varchar(50) NULL,
span_class2_name varchar(50) NULL,
span_class3_name varchar(50) NULL";
break;
case 'msaccess':
$sql[] = "ALTER TABLE " . USERS_TABLE . " DROP
COLUMN user_autologin_key";
$sql[] = "ALTER TABLE " . USERS_TABLE . " ADD
user_session_time int NOT NULL,
user_session_page smallint NOT NULL";
$sql[] = "CREATE INDEX user_session_time
ON " . USERS_TABLE . " (user_session_time)";
$sql[] = "ALTER TABLE " . TOPICS_TABLE . " ADD
topic_first_post_id int NULL";
$sql[] = "CREATE INDEX topic_first_post_id
ON " . TOPICS_TABLE . " (topic_first_post_id)";
$sql[] = "ALTER TABLE " . THEMES_NAME_TABLE . " ADD
tr_class1_name varchar(50) NULL,
tr_class2_name varchar(50) NULL,
tr_class3_name varchar(50) NULL,
th_class1_name varchar(50) NULL,
th_class2_name varchar(50) NULL,
th_class3_name varchar(50) NULL,
td_class1_name varchar(50) NULL,
td_class2_name varchar(50) NULL,
td_class3_name varchar(50) NULL,
span_class1_name varchar(50) NULL,
span_class2_name varchar(50) NULL,
span_class3_name varchar(50) NULL";
break;
default:
die("No DB LAYER found!");
break;
}
case 'RC-3':
case 'RC-4':
case '.0.0':
switch (SQL_LAYER)
{
case 'mysql':
case 'mysql4':
$sql[] = "ALTER TABLE " . USERS_TABLE . "
MODIFY COLUMN user_id mediumint(8) NOT NULL,
MODIFY COLUMN user_timezone decimal(5,2) DEFAULT '0' NOT NULL";
break;
case 'postgresql':
$sql[] = "ALTER TABLE " . USERS_TABLE . "
RENAME COLUMN user_timezone TO user_timezone_old";
$sql[] = "ALTER TABLE " . USERS_TABLE . "
ADD COLUMN user_timezone decimal(5)";
break;
case 'mssql':
case 'mssql-odbc':
$sql[] = "ALTER TABLE " . USERS_TABLE . "
ALTER COLUMN [user_timezone] [decimal] (5,2) NOT NULL";
break;
}
case '.0.1':
switch (SQL_LAYER)
{
case 'mysql':
case 'mysql4':
$sql[] = "ALTER TABLE " . GROUPS_TABLE . "
MODIFY COLUMN group_id mediumint(8) NOT NULL auto_increment";
break;
case 'mssql':
case 'mssql-odbc':
/* ---------------------------------------------------------------------
DROP GROUP TABLE -- if this may cause you problems you can safely
comment it out, remember to manually add the IDENTITY setting on
the group_id column
--------------------------------------------------------------------- */
$sql[] = "CREATE TABLE Tmp_" . GROUPS_TABLE . "
(group_id int IDENTITY (1, 1) NOT NULL, group_type smallint NULL, group_name varchar(50) NOT NULL, group_description varchar(255) NOT NULL, group_moderator int NULL, group_single_user smallint NOT NULL) ON [PRIMARY]";
$sql[] = "SET IDENTITY_INSERT " . GROUPS_TABLE . " ON";
$sql[] = "INSERT INTO Tmp_" . GROUPS_TABLE . " (group_id, group_type, group_name, group_description, group_moderator, group_single_user)
SELECT group_id, group_type, group_name, group_description, group_moderator, group_single_user FROM " . GROUPS_TABLE . " TABLOCKX";
$sql[] = "SET IDENTITY_INSERT " . GROUPS_TABLE . " OFF";
$sql[] = "DROP TABLE " . GROUPS_TABLE;
$sql[] = "EXECUTE sp_rename N'Tmp_" . GROUPS_TABLE . "', N'" . GROUPS_TABLE . "', 'OBJECT'";
$sql[] = "ALTER TABLE " . GROUPS_TABLE . " ADD
CONSTRAINT [PK_" . $table_prefix . "groups] PRIMARY KEY CLUSTERED (group_id) ON [PRIMARY]";
$sql[] = "CREATE INDEX [IX_" . $table_prefix . "groups]
ON " . GROUPS_TABLE . " (group_single_user) ON [PRIMARY]";
/* --------------------------------------------------------------
END OF DROP GROUP -- don't remove anything after this point!
-------------------------------------------------------------- */
break;
}
case '.0.3':
switch (SQL_LAYER)
{
case 'mysql':
case 'mysql4':
// Add indexes to post_id in search match table (+ word_id for MS Access)
$sql[] = "ALTER TABLE " . SEARCH_MATCH_TABLE . "
ADD INDEX post_id (post_id)";
// Modify user_timezone to decimal(5,2) for mysql ... mysql4/mssql/pgsql/msaccess
// should be completely unaffected
// Change default user_notify to 0
$sql[] = "ALTER TABLE " . USERS_TABLE . "
MODIFY COLUMN user_timezone decimal(5,2) DEFAULT '0' NOT NULL,
MODIFY COLUMN user_notify tinyint(1) DEFAULT '0' NOT NULL";
// Adjust field type for prune_days, prune_freq ... was too small
$sql[] = "ALTER TABLE " . PRUNE_TABLE . "
MODIFY COLUMN prune_days smallint(5) UNSIGNED NOT NULL,
MODIFY COLUMN prune_freq smallint(5) UNSIGNED NOT NULL";
break;
case 'mssql':
case 'mssql-odbc':
// Add missing defaults to MSSQL post table schema
$sql[] = "ALTER TABLE [" . POSTS_TABLE . "] WITH NOCHECK ADD
CONSTRAINT [DF_" . POSTS_TABLE . "_enable_bbcode] DEFAULT (1) FOR [enable_bbcode],
CONSTRAINT [DF_" . POSTS_TABLE . "_enable_html] DEFAULT (0) FOR [enable_html],
CONSTRAINT [DF_" . POSTS_TABLE . "_enable_smilies] DEFAULT (1) FOR [enable_smilies],
CONSTRAINT [DF_" . POSTS_TABLE . "_enable_sig] DEFAULT (1) FOR [enable_sig],
CONSTRAINT [DF_" . POSTS_TABLE . "_post_edit_count] DEFAULT (0) FOR [post_edit_count]";
case 'msaccess':
// Add indexes to post_id in search match table (+ word_id for MS Access)
$sql[] = "CREATE INDEX " . SEARCH_MATCH_TABLE . "
ON " . SEARCH_MATCH_TABLE . " ([post_id])";
$sql[] = "CREATE INDEX " . SEARCH_MATCH_TABLE . "_1
ON " . SEARCH_MATCH_TABLE . " ([word_id])";
break;
case 'postgresql':
// Add indexes to post_id in search match table (+ word_id for MS Access)
$sql[] = "CREATE INDEX post_id_" . SEARCH_MATCH_TABLE . "
ON " . SEARCH_MATCH_TABLE . " (post_id)";
// Regenerate groups table with incremented group_id for pgsql
// ... missing in 2.0.3 ...
$sql[] = "CREATE SEQUENCE " . GROUPS_TABLE . "_id_seq start 3 increment 1 maxvalue 2147483647 minvalue 1 cache 1";
$sql[] = "CREATE TABLE tmp_" . GROUPS_TABLE . "
AS SELECT group_id, group_name, group_type, group_description, group_moderator, group_single_user
FROM " . GROUPS_TABLE;
$sql[] = "DROP TABLE " . GROUPS_TABLE;
$sql[] = "CREATE TABLE phpbb_groups (group_id int DEFAULT nextval('" . GROUPS_TABLE . "_id_seq'::text) NOT NULL, group_name varchar(40) NOT NULL, group_type int2 DEFAULT '1' NOT NULL, group_description varchar(255) NOT NULL, group_moderator int4 DEFAULT '0' NOT NULL, group_single_user int2 DEFAULT '0' NOT NULL, CONSTRAINT phpbb_groups_pkey PRIMARY KEY (group_id))";
$sql[] = "INSERT INTO " . GROUPS_TABLE . " (group_id, group_name, group_type, group_description, group_moderator, group_single_user)
SELECT group_id, group_name, group_type, group_description, group_moderator, group_single_user
FROM tmp_" . GROUPS_TABLE;
$sql[] = "DROP TABLE tmp_" . GROUPS_TABLE;
break;
}
}
echo "<h2>Updating database schema</h2>\n";
echo "<p>Progress :: <b>";
flush();
$error_ary = array();
$errored = false;
if (count($sql))
{
for ($i = 0; $i < count($sql); $i++)
{
_sql($sql[$i], $errored, $error_ary);
}
echo "</b> <b class=\"ok\">Done</b><br />Result &nbsp; :: \n";
if ($errored)
{
echo " <b>Some queries failed, the statements and errors are listing below</b>\n<ul>";
for ($i = 0; $i < count($error_ary['sql']); $i++)
{
echo "<li>Error :: <b>" . $error_ary['error_code'][$i]['message'] . "</b><br />";
echo "SQL &nbsp; :: <b>" . $error_ary['sql'][$i] . "</b><br /><br /></li>";
}
echo "</ul>\n<p>This is probably nothing to worry about, update will continue. Should this fail to complete you may need to seek help at our development board. See <a href=\"docs\README.html\">README</a> for details on how to obtain advice.</p>\n";
}
else
{
echo "<b>No errors</b>\n";
}
}
else
{
echo " No updates required</b></p>\n";
}
//
// Data updates
//
unset($sql);
$error_ary = array();
$errored = false;
echo "<h2>Updating data</h2>\n";
echo "<p>Progress :: <b>";
flush();
switch ($row['config_value'])
{
case '':
$sql = "SELECT themes_id
FROM " . THEMES_TABLE . "
WHERE template_name = 'subSilver'";
$result = _sql($sql, $errored, $error_ary);
if ($row = $db->sql_fetchrow($result))
{
$theme_id = $row['themes_id'];
$sql = "UPDATE " . THEMES_TABLE . "
SET head_stylesheet = 'subSilver.css', body_background = '', body_bgcolor = 'E5E5E5', body_text = '000000', body_link = '006699', body_vlink = '5493B4', body_alink = '', body_hlink = 'DD6900', tr_color1 = 'EFEFEF', tr_color2 = 'DEE3E7', tr_color3 = 'D1D7DC', tr_class1 = '', tr_class2 = '', tr_class3 = '', th_color1 = '98AAB1', th_color2 = '006699', th_color3 = 'FFFFFF', th_class1 = 'cellpic1.gif', th_class2 = 'cellpic3.gif', th_class3 = 'cellpic2.jpg', td_color1 = 'FAFAFA', td_color2 = 'FFFFFF', td_color3 = '', td_class1 = 'row1', td_class2 = 'row2', td_class3 = '', fontface1 = 'Verdana, Arial, Helvetica, sans-serif', fontface2 = 'Trebuchet MS', fontface3 = 'Courier, ''Courier New'', sans-serif', fontsize1 = 10, fontsize2 = 11, fontsize3 = 12, fontcolor1 = '444444', fontcolor2 = '006600', fontcolor3 = 'FFA34F', span_class1 = '', span_class2 = '', span_class3 = ''
WHERE themes_id = $theme_id";
_sql($sql, $errored, $error_ary);
$sql = "DELETE FROM " . THEMES_NAME_TABLE . "
WHERE themes_id = $theme_id";
_sql($sql, $errored, $error_ary);
$sql = "INSERT INTO " . THEMES_NAME_TABLE . " (themes_id, tr_color1_name, tr_color2_name, tr_color3_name, tr_class1_name, tr_class2_name, tr_class3_name, th_color1_name, th_color2_name, th_color3_name, th_class1_name, th_class2_name, th_class3_name, td_color1_name, td_color2_name, td_color3_name, td_class1_name, td_class2_name, td_class3_name, fontface1_name, fontface2_name, fontface3_name, fontsize1_name, fontsize2_name, fontsize3_name, fontcolor1_name, fontcolor2_name, fontcolor3_name, span_class1_name, span_class2_name, span_class3_name)
VALUES ($theme_id, 'The lightest row colour', 'The medium row color', 'The darkest row colour', '', '', '', 'Border round the whole page', 'Outer table border', 'Inner table border', 'Silver gradient picture', 'Blue gradient picture', 'Fade-out gradient on index', 'Background for quote boxes', 'All white areas', '', 'Background for topic posts', '2nd background for topic posts', '', 'Main fonts', 'Additional topic title font', 'Form fonts', 'Smallest font size', 'Medium font size', 'Normal font size (post body etc)', 'Quote & copyright text', 'Code text colour', 'Main table header text colour', '', '', '')";
_sql($sql, $errored, $error_ary);
}
$db->sql_freeresult($result);
$sql = "SELECT MIN(post_id) AS first_post_id, topic_id
FROM " . POSTS_TABLE . "
GROUP BY topic_id
ORDER BY topic_id ASC";
$result = _sql($sql, $errored, $error_ary);
if ($row = $db->sql_fetchrow($result))
{
do
{
$sql = "UPDATE " . TOPICS_TABLE . "
SET topic_first_post_id = " . $row['first_post_id'] . "
WHERE topic_id = " . $row['topic_id'];
_sql($sql, $errored, $error_ary);
}
while ($row = $db->sql_fetchrow($result));
}
$db->sql_freeresult($result);
$sql = "SELECT DISTINCT u.user_id
FROM " . USERS_TABLE . " u, " . USER_GROUP_TABLE . " ug, " . AUTH_ACCESS_TABLE . " aa
WHERE aa.auth_mod = 1
AND ug.group_id = aa.group_id
AND u.user_id = ug.user_id
AND u.user_level <> " . ADMIN;
$result = _sql($sql, $errored, $error_ary);
$mod_user = array();
while ($row = $db->sql_fetchrow($result))
{
$mod_user[] = $row['user_id'];
}
$db->sql_freeresult($result);
if (count($mod_user))
{
$sql = "UPDATE " . USERS_TABLE . "
SET user_level = " . MOD . "
WHERE user_id IN (" . implode(', ', $mod_user) . ")";
_sql($sql, $errored, $error_ary);
}
$sql = "INSERT INTO " . CONFIG_TABLE . " (config_name, config_value)
VALUES ('server_name', 'www.myserver.tld')";
_sql($sql, $errored, $error_ary);
$sql = "INSERT INTO " . CONFIG_TABLE . " (config_name, config_value)
VALUES ('script_path', '/phpBB2/')";
_sql($sql, $errored, $error_ary);
$sql = "INSERT INTO " . CONFIG_TABLE . " (config_name, config_value)
VALUES ('server_port', '80')";
_sql($sql, $errored, $error_ary);
$sql = "INSERT INTO " . CONFIG_TABLE . " (config_name, config_value)
VALUES ('record_online_users', '1')";
_sql($sql, $errored, $error_ary);
$sql = "INSERT INTO " . CONFIG_TABLE . " (config_name, config_value)
VALUES ('record_online_date', '" . time() . "')";
_sql($sql, $errored, $error_ary);
case 'RC-3':
case 'RC-4':
case '.0.0':
case '.0.1':
if (SQL_LAYER == 'postgresql')
{
$sql = "SELECT user_id, user_timezone_old
FROM " . USERS_TABLE;
$result = _sql($sql, $errored, $error_ary);
while ($row = $db->sql_fetchrow($result))
{
$sql = "UPDATE " . USERS_TABLE . "
SET user_timezone = " . $row['user_timezone_old'] . "
WHERE user_id = " . $row['user_id'];
_sql($sql, $errored, $error_ary);
}
$db->sql_freeresult($result);
}
$sql = "SELECT topic_id, topic_moved_id
FROM " . TOPICS_TABLE . "
WHERE topic_moved_id <> 0
AND topic_status = " . TOPIC_MOVED;
$result = _sql($sql, $errored, $error_ary);
$topic_ary = array();
while ($row = $db->sql_fetchrow($result))
{
$topic_ary[$row['topic_id']] = $row['topic_moved_id'];
}
$db->sql_freeresult($result);
while (list($topic_id, $topic_moved_id) = each($topic_ary))
{
$sql = "SELECT MAX(post_id) AS last_post, MIN(post_id) AS first_post, COUNT(post_id) AS total_posts
FROM " . POSTS_TABLE . "
WHERE topic_id = $topic_moved_id";
$result = _sql($sql, $errored, $error_ary);
$sql = ($row = $db->sql_fetchrow($result)) ? "UPDATE " . TOPICS_TABLE . " SET topic_replies = " . ($row['total_posts'] - 1) . ", topic_first_post_id = " . $row['first_post'] . ", topic_last_post_id = " . $row['last_post'] . " WHERE topic_id = $topic_id" : "DELETE FROM " . TOPICS_TABLE . " WHERE topic_id = " . $row['topic_id'];
_sql($sql, $errored, $error_ary);
}
unset($sql);
sync('all forums');
case '.0.2':
case '.0.3':
// Topics will resync automatically
// Remove stop words from search match and search words
$dirname = 'language';
$dir = opendir($phpbb_root_path . $dirname);
while ($file = readdir($dir))
{
if (preg_match("#^lang_#i", $file) && !is_file($phpbb_root_path . $dirname . "/" . $file) && !is_link($phpbb_root_path . $dirname . "/" . $file) && file_exists($phpbb_root_path . $dirname . "/" . $file . '/search_stopwords.txt'))
{
$stopword_list = trim(preg_replace('#([\w\.\-_\+\'<27><>-<2D>\\\]+?)[ \n\r]*?(,|$)#', '\'\1\'\2', str_replace("'", "\'", implode(', ', file($phpbb_root_path . $dirname . "/" . $file . '/search_stopwords.txt')))));
$sql = "SELECT word_id
FROM " . SEARCH_WORD_TABLE . "
WHERE word_text IN ($stopword_list)";
$result = _sql($sql, $errored, $error_ary);
$word_id_sql = '';
if ($row = $db->sql_fetchrow($result))
{
do
{
$word_id_sql .= (($word_id_sql != '') ? ', ' : '') . $row['word_id'];
}
while ($row = $db->sql_fetchrow($result));
$sql = "DELETE FROM " . SEARCH_WORD_TABLE . "
WHERE word_id IN ($word_id_sql)";
_sql($sql, $errored, $error_ary);
$sql = "DELETE FROM " . SEARCH_MATCH_TABLE . "
WHERE word_id IN ($word_id_sql)";
_sql($sql, $errored, $error_ary);
}
$db->sql_freeresult($result);
}
}
closedir($dir);
// Mark common words ...
remove_common('global', 4/10);
// remove superfluous polls ... grab polls with topics then delete polls
// not in that list
$sql = "SELECT v.vote_id
FROM " . TOPICS_TABLE . " t, " . VOTE_DESC_TABLE . " v
WHERE v.topic_id = t.topic_id";
$result = _sql($sql, $errored, $error_ary);
$vote_id_sql = '';
if ($row = $db->sql_fetchrow($result))
{
do
{
$vote_id_sql .= (($vote_id_sql != '') ? ', ' : '') . $row['vote_id'];
}
while ($row = $db->sql_fetchrow($result));
$sql = "DELETE FROM " . VOTE_DESC_TABLE . "
WHERE vote_id NOT IN ($vote_id_sql)";
_sql($sql, $errored, $error_ary);
$sql = "DELETE FROM " . VOTE_RESULTS_TABLE . "
WHERE vote_id NOT IN ($vote_id_sql)";
_sql($sql, $errored, $error_ary);
$sql = "DELETE FROM " . VOTE_USERS_TABLE . "
WHERE vote_id NOT IN ($vote_id_sql)";
_sql($sql, $errored, $error_ary);
}
$db->sql_freeresult($result);
// update pm counters
$sql = "SELECT privmsgs_to_userid, COUNT(privmsgs_id) AS unread_count
FROM " . PRIVMSGS_TABLE . "
WHERE privmsgs_type = " . PRIVMSGS_UNREAD_MAIL . "
GROUP BY privmsgs_to_userid";
$result = _sql($sql, $errored, $error_ary);
if ($row = $db->sql_fetchrow($result))
{
$update_users = array();
do
{
$update_users[$row['unread_count']][] = $row['privmsgs_to_userid'];
}
while ($row = $db->sql_fetchrow($result));
while (list($num, $user_ary) = each($update_users))
{
$user_ids = implode(', ', $user_ary);
$sql = "UPDATE " . USERS_TABLE . "
SET user_unread_privmsg = $num
WHERE user_id IN ($user_ids)";
_sql($sql, $errored, $error_ary);
}
unset($update_list);
}
$db->sql_freeresult($result);
$sql = "SELECT privmsgs_to_userid, COUNT(privmsgs_id) AS new_count
FROM " . PRIVMSGS_TABLE . "
WHERE privmsgs_type = " . PRIVMSGS_NEW_MAIL . "
GROUP BY privmsgs_to_userid";
$result = _sql($sql, $errored, $error_ary);
if ($row = $db->sql_fetchrow($result))
{
$update_users = array();
do
{
$update_users[$row['new_count']][] = $row['privmsgs_to_userid'];
}
while ($row = $db->sql_fetchrow($result));
while (list($num, $user_ary) = each($update_users))
{
$user_ids = implode(', ', $user_ary);
$sql = "UPDATE " . USERS_TABLE . "
SET user_new_privmsg = $num
WHERE user_id IN ($user_ids)";
_sql($sql, $errored, $error_ary);
}
unset($update_list);
}
$db->sql_freeresult($result);
// Remove superfluous watched topics
$sql = "SELECT t.topic_id
FROM " . TOPICS_TABLE . " t, " . TOPICS_WATCH_TABLE . " w
WHERE w.topic_id = t.topic_id";
$result = _sql($sql, $errored, $error_ary);
$topic_id_sql = '';
if ($row = $db->sql_fetchrow($result))
{
do
{
$topic_id_sql .= (($topic_id_sql != '') ? ', ' : '') . $row['topic_id'];
}
while ($row = $db->sql_fetchrow($result));
$sql = "DELETE FROM " . TOPICS_WATCH_TABLE . "
WHERE topic_id NOT IN ($topic_id_sql)";
_sql($sql, $errored, $error_ary);
}
$db->sql_freeresult($result);
// Reset any email addresses which are non-compliant ... something
// not done in the upgrade script and thus which may affect some
// mysql users
switch (SQL_LAYER)
{
case 'mysql':
$sql = "UPDATE " . USERS_TABLE . "
SET user_email = ''
WHERE user_email NOT REGEXP '^[a-zA-Z0-9_\+\.\-]+@.*[a-zA-Z0-9_\-]+\.[a-zA-Z]{2,}$'";
_sql($sql, $errored, $error_ary);
}
// Optimize/vacuum analyze the tables where appropriate
// this should be done for each version in future along with
// the version number update
switch (SQL_LAYER)
{
case 'mysql':
case 'mysql4':
$sql = 'OPTIMIZE TABLE ' . $table_prefix . 'auth_access, ' . $table_prefix . 'banlist, ' . $table_prefix . 'categories, ' . $table_prefix . 'config, ' . $table_prefix . 'disallow, ' . $table_prefix . 'forum_prune, ' . $table_prefix . 'forums, ' . $table_prefix . 'groups, ' . $table_prefix . 'posts, ' . $table_prefix . 'posts_text, ' . $table_prefix . 'privmsgs, ' . $table_prefix . 'privmsgs_text, ' . $table_prefix . 'ranks, ' . $table_prefix . 'search_results, ' . $table_prefix . 'search_wordlist, ' . $table_prefix . 'search_wordmatch, ' . $table_prefix . 'smilies, ' . $table_prefix . 'themes, ' . $table_prefix . 'themes_name, ' . $table_prefix . 'topics, ' . $table_prefix . 'topics_watch, ' . $table_prefix . 'user_group, ' . $table_prefix . 'users, ' . $table_prefix . 'vote_desc, ' . $table_prefix . 'vote_results, ' . $table_prefix . 'vote_voters, ' . $table_prefix . 'words';
_sql($sql, $errored, $error_ary);
break;
case 'postgresql':
_sql("VACUUM ANALYZE", $errored, $error_ary);
break;
}
// Very last thing, update the version
$sql = "UPDATE " . CONFIG_TABLE . "
SET config_value = '$updates_to_version'
WHERE config_name = 'version'";
_sql($sql, $errored, $error_ary);
echo "</b> <b class=\"ok\">Done</b><br />Result &nbsp; :: \n";
if ($errored)
{
echo " <b>Some queries failed, the statements and errors are listing below</b>\n<ul>";
for ($i = 0; $i < count($error_ary['sql']); $i++)
{
echo "<li>Error :: <b>" . $error_ary['error_code'][$i]['message'] . "</b><br />";
echo "SQL &nbsp; :: <b>" . $error_ary['sql'][$i] . "</b><br /><br /></li>";
}
echo "</ul>\n<p>This is probably nothing to worry about, update will continue. Should this fail to complete you may need to seek help at our development board. See <a href=\"docs\README.html\">README</a> for details on how to obtain advice.</p>\n";
}
else
{
echo "<b>No errors</b>\n";
}
break;
default:
echo " No updates where required</b></p>\n";
break;
}
echo "<h2>Update completed</h2>\n";
echo "\n<p>You should now visit the General Configuration settings page in the <a href=\"../admin/\">Administration Panel</a> and check the General Configuration of the board. If you updated from versions prior to RC-3 you <b>must</b> update some entries. If you do not do this emails sent from the board will contain incorrect information. Don't forget to delete this file!</p>\n";
?>
<br clear="all" />
</body>
</html>

View File

@@ -1,942 +0,0 @@
<?php
/***************************************************************************
* update_to_xxx.php
* -------------------
* begin : Wednesday, May 16, 2002
* copyright : (C) 2001 The phpBB Group
* email : support@phpbb.com
*
* $Id$
*
***************************************************************************/
/***************************************************************************
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
***************************************************************************/
function _sql($sql, &$errored, &$error_ary, $echo_dot = true)
{
global $db;
if (!($result = $db->sql_query($sql)))
{
$errored = true;
$error_ary['sql'][] = (is_array($sql)) ? $sql[$i] : $sql;
$error_ary['error_code'][] = $db->sql_error();
}
if ($echo_dot)
{
echo ". \n";
flush();
}
return $result;
}
@set_time_limit(120);
define('IN_PHPBB', 1);
$phpbb_root_path = './../';
include($phpbb_root_path . 'extension.inc');
include($phpbb_root_path . 'config.'.$phpEx);
if(!isset($dbms))
{
die("Please read: <a href='../docs/INSTALL.html'>INSTALL.html</a> before attempting to update.");
}
include($phpbb_root_path . 'includes/constants.'.$phpEx);
include($phpbb_root_path . 'includes/functions.'.$phpEx);
include($phpbb_root_path . 'includes/functions_admin.'.$phpEx);
include($phpbb_root_path . 'includes/functions_search.'.$phpEx);
include($phpbb_root_path . 'includes/db.'.$phpEx);
//
//
//
$updates_to_version = ".0.5";
//
//
//
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;">
<meta http-equiv="Content-Style-Type" content="text/css">
<style type="text/css">
<!--
font,th,td,p,body { font-family: "Courier New", courier; font-size: 11pt }
a:link,a:active,a:visited { color : #006699; }
a:hover { text-decoration: underline; color : #DD6900;}
hr { height: 0px; border: solid #D1D7DC 0px; border-top-width: 1px;}
.maintitle,h1,h2 {font-weight: bold; font-size: 22px; font-family: "Trebuchet MS",Verdana, Arial, Helvetica, sans-serif; text-decoration: none; line-height : 120%; color : #000000;}
.ok {color:green}
/* Import the fancy styles for IE only (NS4.x doesn't use the @import function) */
@import url("../templates/subSilver/formIE.css");
-->
</style>
</head>
<body bgcolor="#FFFFFF" text="#000000" link="#006699" vlink="#5584AA">
<table width="100%" border="0" cellspacing="0" cellpadding="10" align="center">
<tr>
<td><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><img src="../templates/subSilver/images/logo_phpBB.gif" border="0" alt="Forum Home" vspace="1" /></td>
<td align="center" width="100%" valign="middle"><span class="maintitle">Updating to latest stable release</span></td>
</tr>
</table></td>
</tr>
</table>
<br clear="all" />
<h2>Information</h2>
<?php
echo '<p>Database type &nbsp; &nbsp;:: <b>' . SQL_LAYER . '</b><br />';
$sql = "SELECT config_value
FROM " . CONFIG_TABLE . "
WHERE config_name = 'version'";
if (!($result = $db->sql_query($sql)))
{
die("Couldn't obtain version info");
}
$row = $db->sql_fetchrow($result);
$sql = array();
switch ($row['config_value'])
{
case '':
echo 'Previous version :: <b>&lt; RC-3</b></p><br />';
break;
case 'RC-3':
echo 'Previous version :: <b>RC-3</b></p><br />';
break;
case 'RC-4':
echo 'Previous version :: <b>RC-4</b></p><br />';
break;
default:
echo 'Previous version :: <b>2' . $row['config_value'] . '</b><br />';
break;
}
echo 'Updated version &nbsp;:: <b>2' . $updates_to_version . '</b></p>' ."\n";
//
// Schema updates
//
switch ($row['config_value'])
{
case '':
switch (SQL_LAYER)
{
case 'mysql':
case 'mysql4':
$sql[] = "ALTER TABLE " . USERS_TABLE . " DROP
COLUMN user_autologin_key";
$sql[] = "ALTER TABLE " . RANKS_TABLE . " DROP
COLUMN rank_max";
$sql[] = "ALTER TABLE " . USERS_TABLE . "
ADD COLUMN user_session_time int(11) DEFAULT '0' NOT NULL,
ADD COLUMN user_session_page smallint(5) DEFAULT '0' NOT NULL,
ADD INDEX (user_session_time)";
$sql[] = "ALTER TABLE " . SEARCH_TABLE . "
MODIFY search_id int(11) NOT NULL";
$sql[] = "ALTER TABLE " . TOPICS_TABLE . "
MODIFY topic_moved_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL,
ADD COLUMN topic_first_post_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL,
ADD INDEX (topic_first_post_id)";
$sql[] = "ALTER TABLE " . THEMES_NAME_TABLE . "
ADD COLUMN tr_class1_name varchar(50) NULL,
ADD COLUMN tr_class2_name varchar(50) NULL,
ADD COLUMN tr_class3_name varchar(50) NULL,
ADD COLUMN th_class1_name varchar(50) NULL,
ADD COLUMN th_class2_name varchar(50) NULL,
ADD COLUMN th_class3_name varchar(50) NULL,
ADD COLUMN td_class1_name varchar(50) NULL,
ADD COLUMN td_class2_name varchar(50) NULL,
ADD COLUMN td_class3_name varchar(50) NULL,
ADD COLUMN span_class1_name varchar(50) NULL,
ADD COLUMN span_class2_name varchar(50) NULL,
ADD COLUMN span_class3_name varchar(50) NULL";
break;
case 'postgresql':
$sql[] = "ALTER TABLE " . USERS_TABLE . "
ADD COLUMN user_session_time int4";
$sql[] = "ALTER TABLE " . USERS_TABLE . "
ADD COLUMN user_session_page int2";
$sql[] = "ALTER TABLE " . USERS_TABLE . "
ALTER COLUMN user_session_time SET DEFAULT '0'";
$sql[] = "ALTER TABLE " . USERS_TABLE . "
ALTER COLUMN user_session_page SET DEFAULT '0'";
$sql[] = "CREATE INDEX user_session_time_" . $table_prefix . "users_index
ON " . USERS_TABLE . " (user_session_time)";
$sql[] = "ALTER TABLE " . TOPICS_TABLE . "
ADD COLUMN topic_first_post_id int4";
$sql[] = "CREATE INDEX topic_first_post_id_" . $table_prefix . "topics_index
ON " . TOPICS_TABLE . " (topic_first_post_id)";
$sql[] = "ALTER TABLE " . THEMES_NAME_TABLE . "
ADD COLUMN tr_class1_name varchar(50) NULL";
$sql[] = "ALTER TABLE " . THEMES_NAME_TABLE . "
ADD COLUMN tr_class2_name varchar(50) NULL";
$sql[] = "ALTER TABLE " . THEMES_NAME_TABLE . "
ADD COLUMN tr_class3_name varchar(50) NULL";
$sql[] = "ALTER TABLE " . THEMES_NAME_TABLE . "
ADD COLUMN th_class1_name varchar(50) NULL";
$sql[] = "ALTER TABLE " . THEMES_NAME_TABLE . "
ADD COLUMN th_class2_name varchar(50) NULL";
$sql[] = "ALTER TABLE " . THEMES_NAME_TABLE . "
ADD COLUMN th_class3_name varchar(50) NULL";
$sql[] = "ALTER TABLE " . THEMES_NAME_TABLE . "
ADD COLUMN td_class1_name varchar(50) NULL";
$sql[] = "ALTER TABLE " . THEMES_NAME_TABLE . "
ADD COLUMN td_class2_name varchar(50) NULL";
$sql[] = "ALTER TABLE " . THEMES_NAME_TABLE . "
ADD COLUMN td_class3_name varchar(50) NULL";
$sql[] = "ALTER TABLE " . THEMES_NAME_TABLE . "
ADD COLUMN span_class1_name varchar(50) NULL";
$sql[] = "ALTER TABLE " . THEMES_NAME_TABLE . "
ADD COLUMN span_class2_name varchar(50) NULL";
$sql[] = "ALTER TABLE " . THEMES_NAME_TABLE . "
ADD COLUMN span_class3_name varchar(50) NULL";
break;
case 'mssql-odbc':
case 'mssql':
$sql[] = "ALTER TABLE " . USERS_TABLE . " DROP
COLUMN user_autologin_key";
$sql[] = "ALTER TABLE " . USERS_TABLE . " ADD
user_session_time int NOT NULL,
user_session_page smallint NOT NULL,
CONSTRAINT [DF_" . $table_prefix . "users_user_session_time] DEFAULT (0) FOR [user_session_time],
CONSTRAINT [DF_" . $table_prefix . "users_user_session_page] DEFAULT (0) FOR [user_session_page]";
$sql[] = "CREATE INDEX [IX_" . $table_prefix . "users]
ON [" . USERS_TABLE . "]([user_session_time]) ON [PRIMARY]";
/* ---------------------------------------------------------------------
DROP FORUM TABLE -- if this may cause you problems you can safely
comment it out, remember to manually remove the IDENTITY setting on
the forum_id column
--------------------------------------------------------------------- */
$sql [] = "ALTER TABLE " . FORUMS_TABLE . " DROP
CONSTRAINT [DF_" . $table_prefix . "forums_forum_posts],
CONSTRAINT [DF_" . $table_prefix . "forums_forum_topics],
CONSTRAINT [DF_" . $table_prefix . "forums_forum_last_post_id],
CONSTRAINT [DF_" . $table_prefix . "forums_prune_enable],
CONSTRAINT [DF_" . $table_prefix . "forums_auth_view],
CONSTRAINT [DF_" . $table_prefix . "forums_auth_read],
CONSTRAINT [DF_" . $table_prefix . "forums_auth_post],
CONSTRAINT [DF_" . $table_prefix . "forums_auth_reply],
CONSTRAINT [DF_" . $table_prefix . "forums_auth_edit],
CONSTRAINT [DF_" . $table_prefix . "forums_auth_delete],
CONSTRAINT [DF_" . $table_prefix . "forums_auth_sticky],
CONSTRAINT [DF_" . $table_prefix . "forums_auth_announce],
CONSTRAINT [DF_" . $table_prefix . "forums_auth_vote],
CONSTRAINT [DF_" . $table_prefix . "forums_auth_pollcreate],
CONSTRAINT [DF_" . $table_prefix . "forums_auth_attachments]";
$sql[] = "CREATE TABLE Tmp_" . FORUMS_TABLE . "
(forum_id int NOT NULL, cat_id int NOT NULL, forum_name varchar(100) NOT NULL, forum_desc varchar(255) NULL, forum_status smallint NOT NULL, forum_order int NOT NULL, forum_posts int NOT NULL, forum_topics smallint NOT NULL, forum_last_post_id int NOT NULL, prune_next int NULL, prune_enable smallint NOT NULL, auth_view smallint NOT NULL, auth_read smallint NOT NULL, auth_post smallint NOT NULL, auth_reply smallint NOT NULL, auth_edit smallint NOT NULL, auth_delete smallint NOT NULL, auth_sticky smallint NOT NULL, auth_announce smallint NOT NULL, auth_vote smallint NOT NULL, auth_pollcreate smallint NOT NULL, auth_attachments smallint NOT NULL) ON [PRIMARY]";
$sql[] = "ALTER TABLE [Tmp_" . FORUMS_TABLE . "] WITH NOCHECK ADD
CONSTRAINT [DF_" . $table_prefix . "forums_forum_posts] DEFAULT (0) FOR [forum_posts],
CONSTRAINT [DF_" . $table_prefix . "forums_forum_topics] DEFAULT (0) FOR [forum_topics],
CONSTRAINT [DF_" . $table_prefix . "forums_forum_last_post_id] DEFAULT (0) FOR [forum_last_post_id],
CONSTRAINT [DF_" . $table_prefix . "forums_prune_enable] DEFAULT (0) FOR [prune_enable],
CONSTRAINT [DF_" . $table_prefix . "forums_auth_view] DEFAULT (0) FOR [auth_view],
CONSTRAINT [DF_" . $table_prefix . "forums_auth_read] DEFAULT (0) FOR [auth_read],
CONSTRAINT [DF_" . $table_prefix . "forums_auth_post] DEFAULT (0) FOR [auth_post],
CONSTRAINT [DF_" . $table_prefix . "forums_auth_reply] DEFAULT (0) FOR [auth_reply],
CONSTRAINT [DF_" . $table_prefix . "forums_auth_edit] DEFAULT (0) FOR [auth_edit],
CONSTRAINT [DF_" . $table_prefix . "forums_auth_delete] DEFAULT (0) FOR [auth_delete],
CONSTRAINT [DF_" . $table_prefix . "forums_auth_sticky] DEFAULT (0) FOR [auth_sticky],
CONSTRAINT [DF_" . $table_prefix . "forums_auth_announce] DEFAULT (0) FOR [auth_announce],
CONSTRAINT [DF_" . $table_prefix . "forums_auth_vote] DEFAULT (0) FOR [auth_vote],
CONSTRAINT [DF_" . $table_prefix . "forums_auth_pollcreate] DEFAULT (0) FOR [auth_pollcreate],
CONSTRAINT [DF_" . $table_prefix . "forums_auth_attachments] DEFAULT (0) FOR [auth_attachments]";
$sql[] = "INSERT INTO Tmp_" . FORUMS_TABLE . " (forum_id, cat_id, forum_name, forum_desc, forum_status, forum_order, forum_posts, forum_topics, forum_last_post_id, prune_next, prune_enable, auth_view, auth_read, auth_post, auth_reply, auth_edit, auth_delete, auth_sticky, auth_announce, auth_vote, auth_pollcreate, auth_attachments)
SELECT forum_id, cat_id, forum_name, forum_desc, forum_status, forum_order, forum_posts, forum_topics, forum_last_post_id, prune_next, prune_enable, auth_view, auth_read, auth_post, auth_reply, auth_edit, auth_delete, auth_sticky, auth_announce, auth_vote, auth_pollcreate, auth_attachments FROM " . FORUMS_TABLE . " TABLOCKX";
$sql[] = "DROP TABLE " . FORUMS_TABLE;
$sql[] = "EXECUTE sp_rename N'Tmp_" . FORUMS_TABLE . "', N'" . FORUMS_TABLE . "', 'OBJECT'";
$sql[] = "ALTER TABLE " . FORUMS_TABLE . " ADD
CONSTRAINT [PK_" . $table_prefix . "forums] PRIMARY KEY CLUSTERED (forum_id) ON [PRIMARY]";
$sql[] = "CREATE NONCLUSTERED INDEX [IX_" . $table_prefix . "forums]
ON " . FORUMS_TABLE . " (cat_id, forum_order, forum_last_post_id) ON [PRIMARY]";
/* --------------------------------------------------------------
END OF DROP FORUM -- don't remove anything after this point!
-------------------------------------------------------------- */
$sql[] = "DROP INDEX " . RANKS_TABLE . ".IX_" . $table_prefix . "ranks";
$sql[] = "ALTER TABLE " . RANKS_TABLE . " DROP
COLUMN rank_max";
$sql[] = "CREATE INDEX [IX_" . $table_prefix . "ranks]
ON [" . RANKS_TABLE . "]([rank_min], [rank_special]) ON [PRIMARY]";
$sql[] = "DROP INDEX " . TOPICS_TABLE . ".IX_" . $table_prefix . "topics";
$sql[] = "ALTER TABLE " . TOPICS_TABLE . " ADD
topic_first_post_id int NULL,
CONSTRAINT [DF_" . $table_prefix . "topics_topic_first_post_id] FOR [topic_first_post_id]";
$sql[] = "CREATE INDEX [IX_" . $table_prefix . "topics]
ON [" . TOPICS_TABLE . "]([forum_id], [topic_type], [topic_first_post_id], [topic_last_post_id]) ON [PRIMARY]";
$sql[] = "ALTER TABLE " . SEARCH_WORD_TABLE . " DROP
CONSTRAINT [PK_" . $table_prefix . "search_wordlist]";
$sql[] = "CREATE UNIQUE INDEX [IX_" . $table_prefix . "search_wordlist]
ON [" . SEARCH_WORD_TABLE . "]([word_text]) WITH IGNORE_DUP_KEY ON [PRIMARY]";
$sql[] = "CREATE INDEX [IX_" . $table_prefix . "search_wordlist_1]
ON [" . SEARCH_WORD_TABLE . "]([word_common]) ON [PRIMARY]";
$sql[] = "CREATE INDEX [IX_" . $table_prefix . "search_wordmatch_1]
ON [" . SEARCH_MATCH_TABLE . "]([word_id]) ON [PRIMARY]";
$sql[] = "ALTER TABLE " . THEMES_NAME_TABLE . " ADD
tr_class1_name varchar(50) NULL,
tr_class2_name varchar(50) NULL,
tr_class3_name varchar(50) NULL,
th_class1_name varchar(50) NULL,
th_class2_name varchar(50) NULL,
th_class3_name varchar(50) NULL,
td_class1_name varchar(50) NULL,
td_class2_name varchar(50) NULL,
td_class3_name varchar(50) NULL,
span_class1_name varchar(50) NULL,
span_class2_name varchar(50) NULL,
span_class3_name varchar(50) NULL";
break;
case 'msaccess':
$sql[] = "ALTER TABLE " . USERS_TABLE . " DROP
COLUMN user_autologin_key";
$sql[] = "ALTER TABLE " . USERS_TABLE . " ADD
user_session_time int NOT NULL,
user_session_page smallint NOT NULL";
$sql[] = "CREATE INDEX user_session_time
ON " . USERS_TABLE . " (user_session_time)";
$sql[] = "ALTER TABLE " . TOPICS_TABLE . " ADD
topic_first_post_id int NULL";
$sql[] = "CREATE INDEX topic_first_post_id
ON " . TOPICS_TABLE . " (topic_first_post_id)";
$sql[] = "ALTER TABLE " . THEMES_NAME_TABLE . " ADD
tr_class1_name varchar(50) NULL,
tr_class2_name varchar(50) NULL,
tr_class3_name varchar(50) NULL,
th_class1_name varchar(50) NULL,
th_class2_name varchar(50) NULL,
th_class3_name varchar(50) NULL,
td_class1_name varchar(50) NULL,
td_class2_name varchar(50) NULL,
td_class3_name varchar(50) NULL,
span_class1_name varchar(50) NULL,
span_class2_name varchar(50) NULL,
span_class3_name varchar(50) NULL";
break;
default:
die("No DB LAYER found!");
break;
}
case 'RC-3':
case 'RC-4':
case '.0.0':
switch (SQL_LAYER)
{
case 'mysql':
case 'mysql4':
$sql[] = "ALTER TABLE " . USERS_TABLE . "
MODIFY COLUMN user_id mediumint(8) NOT NULL,
MODIFY COLUMN user_timezone decimal(5,2) DEFAULT '0' NOT NULL";
break;
case 'postgresql':
$sql[] = "ALTER TABLE " . USERS_TABLE . "
RENAME COLUMN user_timezone TO user_timezone_old";
$sql[] = "ALTER TABLE " . USERS_TABLE . "
ADD COLUMN user_timezone decimal(5)";
break;
case 'mssql':
case 'mssql-odbc':
$sql[] = "ALTER TABLE " . USERS_TABLE . "
ALTER COLUMN [user_timezone] [decimal] (5,2) NOT NULL";
break;
}
case '.0.1':
switch (SQL_LAYER)
{
case 'mysql':
case 'mysql4':
$sql[] = "ALTER TABLE " . GROUPS_TABLE . "
MODIFY COLUMN group_id mediumint(8) NOT NULL auto_increment";
break;
case 'mssql':
case 'mssql-odbc':
/* ---------------------------------------------------------------------
DROP GROUP TABLE -- if this may cause you problems you can safely
comment it out, remember to manually add the IDENTITY setting on
the group_id column
--------------------------------------------------------------------- */
$sql[] = "CREATE TABLE Tmp_" . GROUPS_TABLE . "
(group_id int IDENTITY (1, 1) NOT NULL, group_type smallint NULL, group_name varchar(50) NOT NULL, group_description varchar(255) NOT NULL, group_moderator int NULL, group_single_user smallint NOT NULL) ON [PRIMARY]";
$sql[] = "SET IDENTITY_INSERT " . GROUPS_TABLE . " ON";
$sql[] = "INSERT INTO Tmp_" . GROUPS_TABLE . " (group_id, group_type, group_name, group_description, group_moderator, group_single_user)
SELECT group_id, group_type, group_name, group_description, group_moderator, group_single_user FROM " . GROUPS_TABLE . " TABLOCKX";
$sql[] = "SET IDENTITY_INSERT " . GROUPS_TABLE . " OFF";
$sql[] = "DROP TABLE " . GROUPS_TABLE;
$sql[] = "EXECUTE sp_rename N'Tmp_" . GROUPS_TABLE . "', N'" . GROUPS_TABLE . "', 'OBJECT'";
$sql[] = "ALTER TABLE " . GROUPS_TABLE . " ADD
CONSTRAINT [PK_" . $table_prefix . "groups] PRIMARY KEY CLUSTERED (group_id) ON [PRIMARY]";
$sql[] = "CREATE INDEX [IX_" . $table_prefix . "groups]
ON " . GROUPS_TABLE . " (group_single_user) ON [PRIMARY]";
/* --------------------------------------------------------------
END OF DROP GROUP -- don't remove anything after this point!
-------------------------------------------------------------- */
break;
}
case '.0.3':
switch (SQL_LAYER)
{
case 'mysql':
case 'mysql4':
// Add indexes to post_id in search match table (+ word_id for MS Access)
$sql[] = "ALTER TABLE " . SEARCH_MATCH_TABLE . "
ADD INDEX post_id (post_id)";
// Modify user_timezone to decimal(5,2) for mysql ... mysql4/mssql/pgsql/msaccess
// should be completely unaffected
// Change default user_notify to 0
$sql[] = "ALTER TABLE " . USERS_TABLE . "
MODIFY COLUMN user_timezone decimal(5,2) DEFAULT '0' NOT NULL,
MODIFY COLUMN user_notify tinyint(1) DEFAULT '0' NOT NULL";
// Adjust field type for prune_days, prune_freq ... was too small
$sql[] = "ALTER TABLE " . PRUNE_TABLE . "
MODIFY COLUMN prune_days smallint(5) UNSIGNED NOT NULL,
MODIFY COLUMN prune_freq smallint(5) UNSIGNED NOT NULL";
break;
case 'msaccess':
// Add indexes to post_id in search match table (+ word_id for MS Access)
$sql[] = "CREATE INDEX " . SEARCH_MATCH_TABLE . "
ON " . SEARCH_MATCH_TABLE . " ([post_id])";
$sql[] = "CREATE INDEX " . SEARCH_MATCH_TABLE . "_1
ON " . SEARCH_MATCH_TABLE . " ([word_id])";
break;
case 'postgresql':
// Add indexes to post_id in search match table (+ word_id for MS Access)
$sql[] = "CREATE INDEX post_id_" . SEARCH_MATCH_TABLE . "
ON " . SEARCH_MATCH_TABLE . " (post_id)";
// Regenerate groups table with incremented group_id for pgsql
// ... missing in 2.0.3 ...
$sql[] = "CREATE SEQUENCE " . GROUPS_TABLE . "_id_seq start 3 increment 1 maxvalue 2147483647 minvalue 1 cache 1";
$sql[] = "CREATE TABLE tmp_" . GROUPS_TABLE . "
AS SELECT group_id, group_name, group_type, group_description, group_moderator, group_single_user
FROM " . GROUPS_TABLE;
$sql[] = "DROP TABLE " . GROUPS_TABLE;
$sql[] = "CREATE TABLE phpbb_groups (group_id int DEFAULT nextval('" . GROUPS_TABLE . "_id_seq'::text) NOT NULL, group_name varchar(40) NOT NULL, group_type int2 DEFAULT '1' NOT NULL, group_description varchar(255) NOT NULL, group_moderator int4 DEFAULT '0' NOT NULL, group_single_user int2 DEFAULT '0' NOT NULL, CONSTRAINT phpbb_groups_pkey PRIMARY KEY (group_id))";
$sql[] = "INSERT INTO " . GROUPS_TABLE . " (group_id, group_name, group_type, group_description, group_moderator, group_single_user)
SELECT group_id, group_name, group_type, group_description, group_moderator, group_single_user
FROM tmp_" . GROUPS_TABLE;
$sql[] = "DROP TABLE tmp_" . GROUPS_TABLE;
break;
}
case '.0.4':
switch (SQL_LAYER)
{
case 'mssql':
case 'mssql-odbc':
// Add missing defaults to MSSQL post table schema, failed in previous updates
$sql[] = "ALTER TABLE [" . POSTS_TABLE . "] WITH NOCHECK ADD
CONSTRAINT [DF_" . POSTS_TABLE . "_enable_bbcode] DEFAULT (1) FOR [enable_bbcode],
CONSTRAINT [DF_" . POSTS_TABLE . "_enable_html] DEFAULT (0) FOR [enable_html],
CONSTRAINT [DF_" . POSTS_TABLE . "_enable_smilies] DEFAULT (1) FOR [enable_smilies],
CONSTRAINT [DF_" . POSTS_TABLE . "_enable_sig] DEFAULT (1) FOR [enable_sig],
CONSTRAINT [DF_" . POSTS_TABLE . "_post_edit_count] DEFAULT (0) FOR [post_edit_count]";
break;
}
// Add tables for visual confirmation ... saves me the trouble of writing a seperate
// script :D
switch (SQL_LAYER)
{
case 'mysql':
case 'mysql4':
$sql[] = 'CREATE TABLE ' . $table_prefix . 'confirm (confirm_id char(32) DEFAULT \'\' NOT NULL, session_id char(32) DEFAULT \'\' NOT NULL, code char(6) DEFAULT \'\' NOT NULL, PRIMARY KEY (session_id, confirm_id))';
break;
case 'mssql':
case 'mssql-odbc':
$sql[] = 'CREATE TABLE [' . $table_prefix . 'confirm] ([confirm_id] [char] (32) NOT NULL , [session_id] [char] (32) NOT NULL , [code] [char] (6) NOT NULL ) ON [PRIMARY]';
$sql[] = 'ALTER TABLE [' . $table_prefix . 'confirm] WITH NOCHECK ADD CONSTRAINT [PK_' . $table_prefix . 'confirm] PRIMARY KEY CLUSTERED ( [session_id],[confirm_id]) ON [PRIMARY]';
$sql[] = 'ALTER TABLE [' . $table_prefix . 'confirm] WITH NOCHECK ADD CONSTRAINT [DF_' . $table_prefix . 'confirm_confirm_id] DEFAULT (\'\') FOR [confirm_id], CONSTRAINT [DF_' . $table_prefix . 'confirm_session_id] DEFAULT (\'\') FOR [session_id], CONSTRAINT [DF_' . $table_prefix . 'confirm_code] DEFAULT (\'\') FOR [code]';
break;
case 'msaccess':
$sql[] = 'CREATE TABLE ' . $table_prefix . 'confirm (confirm_id char(32) NOT NULL, session_id char(32) NOT NULL, code char(6) NOT NULL)';
$sql[] = 'ALTER TABLE ' . $table_prefix . 'confirm ADD (PRIMARY KEY (session_id, confirm_id))';
break;
case 'postgresql':
$sql[] = 'CREATE TABLE ' . $table_prefix . 'confirm (confirm_id char(32) DEFAULT \'\' NOT NULL, session_id char(32) DEFAULT \'\' NOT NULL, code char(6) DEFAULT \'\' NOT NULL, CONSTRAINT phpbb_confirm_pkey PRIMARY KEY (session_id, confirm_id))';
break;
}
break;
}
echo "<h2>Updating database schema</h2>\n";
echo "<p>Progress :: <b>";
flush();
$error_ary = array();
$errored = false;
if (count($sql))
{
for ($i = 0; $i < count($sql); $i++)
{
_sql($sql[$i], $errored, $error_ary);
}
echo "</b> <b class=\"ok\">Done</b><br />Result &nbsp; :: \n";
if ($errored)
{
echo " <b>Some queries failed, the statements and errors are listing below</b>\n<ul>";
for ($i = 0; $i < count($error_ary['sql']); $i++)
{
echo "<li>Error :: <b>" . $error_ary['error_code'][$i]['message'] . "</b><br />";
echo "SQL &nbsp; :: <b>" . $error_ary['sql'][$i] . "</b><br /><br /></li>";
}
echo "</ul>\n<p>This is probably nothing to worry about, update will continue. Should this fail to complete you may need to seek help at our development board. See <a href=\"docs\README.html\">README</a> for details on how to obtain advice.</p>\n";
}
else
{
echo "<b>No errors</b>\n";
}
}
else
{
echo " No updates required</b></p>\n";
}
//
// Data updates
//
unset($sql);
$error_ary = array();
$errored = false;
echo "<h2>Updating data</h2>\n";
echo "<p>Progress :: <b>";
flush();
switch ($row['config_value'])
{
case '':
$sql = "SELECT themes_id
FROM " . THEMES_TABLE . "
WHERE template_name = 'subSilver'";
$result = _sql($sql, $errored, $error_ary);
if ($row = $db->sql_fetchrow($result))
{
$theme_id = $row['themes_id'];
$sql = "UPDATE " . THEMES_TABLE . "
SET head_stylesheet = 'subSilver.css', body_background = '', body_bgcolor = 'E5E5E5', body_text = '000000', body_link = '006699', body_vlink = '5493B4', body_alink = '', body_hlink = 'DD6900', tr_color1 = 'EFEFEF', tr_color2 = 'DEE3E7', tr_color3 = 'D1D7DC', tr_class1 = '', tr_class2 = '', tr_class3 = '', th_color1 = '98AAB1', th_color2 = '006699', th_color3 = 'FFFFFF', th_class1 = 'cellpic1.gif', th_class2 = 'cellpic3.gif', th_class3 = 'cellpic2.jpg', td_color1 = 'FAFAFA', td_color2 = 'FFFFFF', td_color3 = '', td_class1 = 'row1', td_class2 = 'row2', td_class3 = '', fontface1 = 'Verdana, Arial, Helvetica, sans-serif', fontface2 = 'Trebuchet MS', fontface3 = 'Courier, ''Courier New'', sans-serif', fontsize1 = 10, fontsize2 = 11, fontsize3 = 12, fontcolor1 = '444444', fontcolor2 = '006600', fontcolor3 = 'FFA34F', span_class1 = '', span_class2 = '', span_class3 = ''
WHERE themes_id = $theme_id";
_sql($sql, $errored, $error_ary);
$sql = "DELETE FROM " . THEMES_NAME_TABLE . "
WHERE themes_id = $theme_id";
_sql($sql, $errored, $error_ary);
$sql = "INSERT INTO " . THEMES_NAME_TABLE . " (themes_id, tr_color1_name, tr_color2_name, tr_color3_name, tr_class1_name, tr_class2_name, tr_class3_name, th_color1_name, th_color2_name, th_color3_name, th_class1_name, th_class2_name, th_class3_name, td_color1_name, td_color2_name, td_color3_name, td_class1_name, td_class2_name, td_class3_name, fontface1_name, fontface2_name, fontface3_name, fontsize1_name, fontsize2_name, fontsize3_name, fontcolor1_name, fontcolor2_name, fontcolor3_name, span_class1_name, span_class2_name, span_class3_name)
VALUES ($theme_id, 'The lightest row colour', 'The medium row color', 'The darkest row colour', '', '', '', 'Border round the whole page', 'Outer table border', 'Inner table border', 'Silver gradient picture', 'Blue gradient picture', 'Fade-out gradient on index', 'Background for quote boxes', 'All white areas', '', 'Background for topic posts', '2nd background for topic posts', '', 'Main fonts', 'Additional topic title font', 'Form fonts', 'Smallest font size', 'Medium font size', 'Normal font size (post body etc)', 'Quote & copyright text', 'Code text colour', 'Main table header text colour', '', '', '')";
_sql($sql, $errored, $error_ary);
}
$db->sql_freeresult($result);
$sql = "SELECT MIN(post_id) AS first_post_id, topic_id
FROM " . POSTS_TABLE . "
GROUP BY topic_id
ORDER BY topic_id ASC";
$result = _sql($sql, $errored, $error_ary);
if ($row = $db->sql_fetchrow($result))
{
do
{
$sql = "UPDATE " . TOPICS_TABLE . "
SET topic_first_post_id = " . $row['first_post_id'] . "
WHERE topic_id = " . $row['topic_id'];
_sql($sql, $errored, $error_ary);
}
while ($row = $db->sql_fetchrow($result));
}
$db->sql_freeresult($result);
$sql = "SELECT DISTINCT u.user_id
FROM " . USERS_TABLE . " u, " . USER_GROUP_TABLE . " ug, " . AUTH_ACCESS_TABLE . " aa
WHERE aa.auth_mod = 1
AND ug.group_id = aa.group_id
AND u.user_id = ug.user_id
AND u.user_level <> " . ADMIN;
$result = _sql($sql, $errored, $error_ary);
$mod_user = array();
while ($row = $db->sql_fetchrow($result))
{
$mod_user[] = $row['user_id'];
}
$db->sql_freeresult($result);
if (count($mod_user))
{
$sql = "UPDATE " . USERS_TABLE . "
SET user_level = " . MOD . "
WHERE user_id IN (" . implode(', ', $mod_user) . ")";
_sql($sql, $errored, $error_ary);
}
$sql = "INSERT INTO " . CONFIG_TABLE . " (config_name, config_value)
VALUES ('server_name', 'www.myserver.tld')";
_sql($sql, $errored, $error_ary);
$sql = "INSERT INTO " . CONFIG_TABLE . " (config_name, config_value)
VALUES ('script_path', '/phpBB2/')";
_sql($sql, $errored, $error_ary);
$sql = "INSERT INTO " . CONFIG_TABLE . " (config_name, config_value)
VALUES ('server_port', '80')";
_sql($sql, $errored, $error_ary);
$sql = "INSERT INTO " . CONFIG_TABLE . " (config_name, config_value)
VALUES ('record_online_users', '1')";
_sql($sql, $errored, $error_ary);
$sql = "INSERT INTO " . CONFIG_TABLE . " (config_name, config_value)
VALUES ('record_online_date', '" . time() . "')";
_sql($sql, $errored, $error_ary);
case 'RC-3':
case 'RC-4':
case '.0.0':
case '.0.1':
if (SQL_LAYER == 'postgresql')
{
$sql = "SELECT user_id, user_timezone_old
FROM " . USERS_TABLE;
$result = _sql($sql, $errored, $error_ary);
while ($row = $db->sql_fetchrow($result))
{
$sql = "UPDATE " . USERS_TABLE . "
SET user_timezone = " . $row['user_timezone_old'] . "
WHERE user_id = " . $row['user_id'];
_sql($sql, $errored, $error_ary);
}
$db->sql_freeresult($result);
}
$sql = "SELECT topic_id, topic_moved_id
FROM " . TOPICS_TABLE . "
WHERE topic_moved_id <> 0
AND topic_status = " . TOPIC_MOVED;
$result = _sql($sql, $errored, $error_ary);
$topic_ary = array();
while ($row = $db->sql_fetchrow($result))
{
$topic_ary[$row['topic_id']] = $row['topic_moved_id'];
}
$db->sql_freeresult($result);
while (list($topic_id, $topic_moved_id) = each($topic_ary))
{
$sql = "SELECT MAX(post_id) AS last_post, MIN(post_id) AS first_post, COUNT(post_id) AS total_posts
FROM " . POSTS_TABLE . "
WHERE topic_id = $topic_moved_id";
$result = _sql($sql, $errored, $error_ary);
$sql = ($row = $db->sql_fetchrow($result)) ? "UPDATE " . TOPICS_TABLE . " SET topic_replies = " . ($row['total_posts'] - 1) . ", topic_first_post_id = " . $row['first_post'] . ", topic_last_post_id = " . $row['last_post'] . " WHERE topic_id = $topic_id" : "DELETE FROM " . TOPICS_TABLE . " WHERE topic_id = " . $row['topic_id'];
_sql($sql, $errored, $error_ary);
}
unset($sql);
sync('all forums');
case '.0.2':
case '.0.3':
// Topics will resync automatically
// Remove stop words from search match and search words
$dirname = 'language';
$dir = opendir($phpbb_root_path . $dirname);
while ($file = readdir($dir))
{
if (preg_match("#^lang_#i", $file) && !is_file($phpbb_root_path . $dirname . "/" . $file) && !is_link($phpbb_root_path . $dirname . "/" . $file) && file_exists($phpbb_root_path . $dirname . "/" . $file . '/search_stopwords.txt'))
{
$stopword_list = trim(preg_replace('#([\w\.\-_\+\'<27><>-<2D>\\\]+?)[ \n\r]*?(,|$)#', '\'\1\'\2', str_replace("'", "\'", implode(', ', file($phpbb_root_path . $dirname . "/" . $file . '/search_stopwords.txt')))));
$sql = "SELECT word_id
FROM " . SEARCH_WORD_TABLE . "
WHERE word_text IN ($stopword_list)";
$result = _sql($sql, $errored, $error_ary);
$word_id_sql = '';
if ($row = $db->sql_fetchrow($result))
{
do
{
$word_id_sql .= (($word_id_sql != '') ? ', ' : '') . $row['word_id'];
}
while ($row = $db->sql_fetchrow($result));
$sql = "DELETE FROM " . SEARCH_WORD_TABLE . "
WHERE word_id IN ($word_id_sql)";
_sql($sql, $errored, $error_ary);
$sql = "DELETE FROM " . SEARCH_MATCH_TABLE . "
WHERE word_id IN ($word_id_sql)";
_sql($sql, $errored, $error_ary);
}
$db->sql_freeresult($result);
}
}
closedir($dir);
// Mark common words ...
remove_common('global', 4/10);
// remove superfluous polls ... grab polls with topics then delete polls
// not in that list
$sql = "SELECT v.vote_id
FROM " . TOPICS_TABLE . " t, " . VOTE_DESC_TABLE . " v
WHERE v.topic_id = t.topic_id";
$result = _sql($sql, $errored, $error_ary);
$vote_id_sql = '';
if ($row = $db->sql_fetchrow($result))
{
do
{
$vote_id_sql .= (($vote_id_sql != '') ? ', ' : '') . $row['vote_id'];
}
while ($row = $db->sql_fetchrow($result));
$sql = "DELETE FROM " . VOTE_DESC_TABLE . "
WHERE vote_id NOT IN ($vote_id_sql)";
_sql($sql, $errored, $error_ary);
$sql = "DELETE FROM " . VOTE_RESULTS_TABLE . "
WHERE vote_id NOT IN ($vote_id_sql)";
_sql($sql, $errored, $error_ary);
$sql = "DELETE FROM " . VOTE_USERS_TABLE . "
WHERE vote_id NOT IN ($vote_id_sql)";
_sql($sql, $errored, $error_ary);
}
$db->sql_freeresult($result);
// update pm counters
$sql = "SELECT privmsgs_to_userid, COUNT(privmsgs_id) AS unread_count
FROM " . PRIVMSGS_TABLE . "
WHERE privmsgs_type = " . PRIVMSGS_UNREAD_MAIL . "
GROUP BY privmsgs_to_userid";
$result = _sql($sql, $errored, $error_ary);
if ($row = $db->sql_fetchrow($result))
{
$update_users = array();
do
{
$update_users[$row['unread_count']][] = $row['privmsgs_to_userid'];
}
while ($row = $db->sql_fetchrow($result));
while (list($num, $user_ary) = each($update_users))
{
$user_ids = implode(', ', $user_ary);
$sql = "UPDATE " . USERS_TABLE . "
SET user_unread_privmsg = $num
WHERE user_id IN ($user_ids)";
_sql($sql, $errored, $error_ary);
}
unset($update_list);
}
$db->sql_freeresult($result);
$sql = "SELECT privmsgs_to_userid, COUNT(privmsgs_id) AS new_count
FROM " . PRIVMSGS_TABLE . "
WHERE privmsgs_type = " . PRIVMSGS_NEW_MAIL . "
GROUP BY privmsgs_to_userid";
$result = _sql($sql, $errored, $error_ary);
if ($row = $db->sql_fetchrow($result))
{
$update_users = array();
do
{
$update_users[$row['new_count']][] = $row['privmsgs_to_userid'];
}
while ($row = $db->sql_fetchrow($result));
while (list($num, $user_ary) = each($update_users))
{
$user_ids = implode(', ', $user_ary);
$sql = "UPDATE " . USERS_TABLE . "
SET user_new_privmsg = $num
WHERE user_id IN ($user_ids)";
_sql($sql, $errored, $error_ary);
}
unset($update_list);
}
$db->sql_freeresult($result);
// Remove superfluous watched topics
$sql = "SELECT t.topic_id
FROM " . TOPICS_TABLE . " t, " . TOPICS_WATCH_TABLE . " w
WHERE w.topic_id = t.topic_id";
$result = _sql($sql, $errored, $error_ary);
$topic_id_sql = '';
if ($row = $db->sql_fetchrow($result))
{
do
{
$topic_id_sql .= (($topic_id_sql != '') ? ', ' : '') . $row['topic_id'];
}
while ($row = $db->sql_fetchrow($result));
$sql = "DELETE FROM " . TOPICS_WATCH_TABLE . "
WHERE topic_id NOT IN ($topic_id_sql)";
_sql($sql, $errored, $error_ary);
}
$db->sql_freeresult($result);
// Reset any email addresses which are non-compliant ... something
// not done in the upgrade script and thus which may affect some
// mysql users
switch (SQL_LAYER)
{
case 'mysql':
$sql = "UPDATE " . USERS_TABLE . "
SET user_email = ''
WHERE user_email NOT REGEXP '^[a-zA-Z0-9_\+\.\-]+@.*[a-zA-Z0-9_\-]+\.[a-zA-Z]{2,}$'";
_sql($sql, $errored, $error_ary);
}
case '.0.4':
// Add the confirmation code switch ... save time and trouble elsewhere
$sql = 'INSERT INTO ' . CONFIG_TABLE . " (config_name, config_value)
VALUES ('enable_confirm', '0')";
_sql($sql, $errored, $error_ary);
$sql = "INSERT INTO " . CONFIG_TABLE . " (config_name, config_value)
VALUES ('sendmail_fix', '0')";
_sql($sql, $errored, $error_ary);
break;
default:
echo " No updates where required</b></p>\n";
break;
}
echo "<h2>Updating version and optimizing tables</h2>\n";
echo "<p>Progress :: <b>";
flush();
// update the version
$sql = "UPDATE " . CONFIG_TABLE . "
SET config_value = '$updates_to_version'
WHERE config_name = 'version'";
_sql($sql, $errored, $error_ary);
// Optimize/vacuum analyze the tables where appropriate
// this should be done for each version in future along with
// the version number update
switch (SQL_LAYER)
{
case 'mysql':
case 'mysql4':
$sql = 'OPTIMIZE TABLE ' . $table_prefix . 'auth_access, ' . $table_prefix . 'banlist, ' . $table_prefix . 'categories, ' . $table_prefix . 'config, ' . $table_prefix . 'disallow, ' . $table_prefix . 'forum_prune, ' . $table_prefix . 'forums, ' . $table_prefix . 'groups, ' . $table_prefix . 'posts, ' . $table_prefix . 'posts_text, ' . $table_prefix . 'privmsgs, ' . $table_prefix . 'privmsgs_text, ' . $table_prefix . 'ranks, ' . $table_prefix . 'search_results, ' . $table_prefix . 'search_wordlist, ' . $table_prefix . 'search_wordmatch, ' . $table_prefix . 'smilies, ' . $table_prefix . 'themes, ' . $table_prefix . 'themes_name, ' . $table_prefix . 'topics, ' . $table_prefix . 'topics_watch, ' . $table_prefix . 'user_group, ' . $table_prefix . 'users, ' . $table_prefix . 'vote_desc, ' . $table_prefix . 'vote_results, ' . $table_prefix . 'vote_voters, ' . $table_prefix . 'words';
_sql($sql, $errored, $error_ary);
break;
case 'postgresql':
_sql("VACUUM ANALYZE", $errored, $error_ary);
break;
}
echo "</b> <b class=\"ok\">Done</b><br />Result &nbsp; :: \n";
if ($errored)
{
echo " <b>Some queries failed, the statements and errors are listing below</b>\n<ul>";
for ($i = 0; $i < count($error_ary['sql']); $i++)
{
echo "<li>Error :: <b>" . $error_ary['error_code'][$i]['message'] . "</b><br />";
echo "SQL &nbsp; :: <b>" . $error_ary['sql'][$i] . "</b><br /><br /></li>";
}
echo "</ul>\n<p>This is probably nothing to worry about, update will continue. Should this fail to complete you may need to seek help at our development board. See <a href=\"docs\README.html\">README</a> for details on how to obtain advice.</p>\n";
}
else
{
echo "<b>No errors</b>\n";
}
echo "<h2>Update completed</h2>\n";
echo "\n<p>You should now visit the General Configuration settings page in the <a href=\"../admin/\">Administration Panel</a> and check the General Configuration of the board. If you updated from versions prior to RC-3 you <b>must</b> update some entries. If you do not do this emails sent from the board will contain incorrect information. Don't forget to delete this file!</p>\n";
?>
<br clear="all" />
</body>
</html>

View File

@@ -1,963 +0,0 @@
<?php
/***************************************************************************
* update_to_xxx.php
* -------------------
* begin : Wednesday, May 16, 2002
* copyright : (C) 2001 The phpBB Group
* email : support@phpbb.com
*
* $Id$
*
***************************************************************************/
/***************************************************************************
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
***************************************************************************/
function _sql($sql, &$errored, &$error_ary, $echo_dot = true)
{
global $db;
if (!($result = $db->sql_query($sql)))
{
$errored = true;
$error_ary['sql'][] = (is_array($sql)) ? $sql[$i] : $sql;
$error_ary['error_code'][] = $db->sql_error();
}
if ($echo_dot)
{
echo ". \n";
flush();
}
return $result;
}
@set_time_limit(120);
define('IN_PHPBB', 1);
$phpbb_root_path = './../';
include($phpbb_root_path . 'extension.inc');
include($phpbb_root_path . 'config.'.$phpEx);
if(!isset($dbms))
{
die("Please read: <a href='../docs/INSTALL.html'>INSTALL.html</a> before attempting to update.");
}
include($phpbb_root_path . 'includes/constants.'.$phpEx);
include($phpbb_root_path . 'includes/functions.'.$phpEx);
include($phpbb_root_path . 'includes/functions_admin.'.$phpEx);
include($phpbb_root_path . 'includes/functions_search.'.$phpEx);
include($phpbb_root_path . 'includes/db.'.$phpEx);
//
//
//
$updates_to_version = ".0.6";
//
//
//
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;">
<meta http-equiv="Content-Style-Type" content="text/css">
<style type="text/css">
<!--
font,th,td,p,body { font-family: "Courier New", courier; font-size: 11pt }
a:link,a:active,a:visited { color : #006699; }
a:hover { text-decoration: underline; color : #DD6900;}
hr { height: 0px; border: solid #D1D7DC 0px; border-top-width: 1px;}
.maintitle,h1,h2 {font-weight: bold; font-size: 22px; font-family: "Trebuchet MS",Verdana, Arial, Helvetica, sans-serif; text-decoration: none; line-height : 120%; color : #000000;}
.ok {color:green}
/* Import the fancy styles for IE only (NS4.x doesn't use the @import function) */
@import url("../templates/subSilver/formIE.css");
-->
</style>
</head>
<body bgcolor="#FFFFFF" text="#000000" link="#006699" vlink="#5584AA">
<table width="100%" border="0" cellspacing="0" cellpadding="10" align="center">
<tr>
<td><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><img src="../templates/subSilver/images/logo_phpBB.gif" border="0" alt="Forum Home" vspace="1" /></td>
<td align="center" width="100%" valign="middle"><span class="maintitle">Updating to latest stable release</span></td>
</tr>
</table></td>
</tr>
</table>
<br clear="all" />
<h2>Information</h2>
<?php
echo '<p>Database type &nbsp; &nbsp;:: <b>' . SQL_LAYER . '</b><br />';
$sql = "SELECT config_value
FROM " . CONFIG_TABLE . "
WHERE config_name = 'version'";
if (!($result = $db->sql_query($sql)))
{
die("Couldn't obtain version info");
}
$row = $db->sql_fetchrow($result);
$sql = array();
switch ($row['config_value'])
{
case '':
echo 'Previous version :: <b>&lt; RC-3</b></p><br />';
break;
case 'RC-3':
echo 'Previous version :: <b>RC-3</b></p><br />';
break;
case 'RC-4':
echo 'Previous version :: <b>RC-4</b></p><br />';
break;
default:
echo 'Previous version :: <b>2' . $row['config_value'] . '</b><br />';
break;
}
echo 'Updated version &nbsp;:: <b>2' . $updates_to_version . '</b></p>' ."\n";
//
// Schema updates
//
switch ($row['config_value'])
{
case '':
switch (SQL_LAYER)
{
case 'mysql':
case 'mysql4':
$sql[] = "ALTER TABLE " . USERS_TABLE . " DROP
COLUMN user_autologin_key";
$sql[] = "ALTER TABLE " . RANKS_TABLE . " DROP
COLUMN rank_max";
$sql[] = "ALTER TABLE " . USERS_TABLE . "
ADD COLUMN user_session_time int(11) DEFAULT '0' NOT NULL,
ADD COLUMN user_session_page smallint(5) DEFAULT '0' NOT NULL,
ADD INDEX (user_session_time)";
$sql[] = "ALTER TABLE " . SEARCH_TABLE . "
MODIFY search_id int(11) NOT NULL";
$sql[] = "ALTER TABLE " . TOPICS_TABLE . "
MODIFY topic_moved_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL,
ADD COLUMN topic_first_post_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL,
ADD INDEX (topic_first_post_id)";
$sql[] = "ALTER TABLE " . THEMES_NAME_TABLE . "
ADD COLUMN tr_class1_name varchar(50) NULL,
ADD COLUMN tr_class2_name varchar(50) NULL,
ADD COLUMN tr_class3_name varchar(50) NULL,
ADD COLUMN th_class1_name varchar(50) NULL,
ADD COLUMN th_class2_name varchar(50) NULL,
ADD COLUMN th_class3_name varchar(50) NULL,
ADD COLUMN td_class1_name varchar(50) NULL,
ADD COLUMN td_class2_name varchar(50) NULL,
ADD COLUMN td_class3_name varchar(50) NULL,
ADD COLUMN span_class1_name varchar(50) NULL,
ADD COLUMN span_class2_name varchar(50) NULL,
ADD COLUMN span_class3_name varchar(50) NULL";
break;
case 'postgresql':
$sql[] = "ALTER TABLE " . USERS_TABLE . "
ADD COLUMN user_session_time int4";
$sql[] = "ALTER TABLE " . USERS_TABLE . "
ADD COLUMN user_session_page int2";
$sql[] = "ALTER TABLE " . USERS_TABLE . "
ALTER COLUMN user_session_time SET DEFAULT '0'";
$sql[] = "ALTER TABLE " . USERS_TABLE . "
ALTER COLUMN user_session_page SET DEFAULT '0'";
$sql[] = "CREATE INDEX user_session_time_" . $table_prefix . "users_index
ON " . USERS_TABLE . " (user_session_time)";
$sql[] = "ALTER TABLE " . TOPICS_TABLE . "
ADD COLUMN topic_first_post_id int4";
$sql[] = "CREATE INDEX topic_first_post_id_" . $table_prefix . "topics_index
ON " . TOPICS_TABLE . " (topic_first_post_id)";
$sql[] = "ALTER TABLE " . THEMES_NAME_TABLE . "
ADD COLUMN tr_class1_name varchar(50) NULL";
$sql[] = "ALTER TABLE " . THEMES_NAME_TABLE . "
ADD COLUMN tr_class2_name varchar(50) NULL";
$sql[] = "ALTER TABLE " . THEMES_NAME_TABLE . "
ADD COLUMN tr_class3_name varchar(50) NULL";
$sql[] = "ALTER TABLE " . THEMES_NAME_TABLE . "
ADD COLUMN th_class1_name varchar(50) NULL";
$sql[] = "ALTER TABLE " . THEMES_NAME_TABLE . "
ADD COLUMN th_class2_name varchar(50) NULL";
$sql[] = "ALTER TABLE " . THEMES_NAME_TABLE . "
ADD COLUMN th_class3_name varchar(50) NULL";
$sql[] = "ALTER TABLE " . THEMES_NAME_TABLE . "
ADD COLUMN td_class1_name varchar(50) NULL";
$sql[] = "ALTER TABLE " . THEMES_NAME_TABLE . "
ADD COLUMN td_class2_name varchar(50) NULL";
$sql[] = "ALTER TABLE " . THEMES_NAME_TABLE . "
ADD COLUMN td_class3_name varchar(50) NULL";
$sql[] = "ALTER TABLE " . THEMES_NAME_TABLE . "
ADD COLUMN span_class1_name varchar(50) NULL";
$sql[] = "ALTER TABLE " . THEMES_NAME_TABLE . "
ADD COLUMN span_class2_name varchar(50) NULL";
$sql[] = "ALTER TABLE " . THEMES_NAME_TABLE . "
ADD COLUMN span_class3_name varchar(50) NULL";
break;
case 'mssql-odbc':
case 'mssql':
$sql[] = "ALTER TABLE " . USERS_TABLE . " DROP
COLUMN user_autologin_key";
$sql[] = "ALTER TABLE " . USERS_TABLE . " ADD
user_session_time int NOT NULL,
user_session_page smallint NOT NULL,
CONSTRAINT [DF_" . $table_prefix . "users_user_session_time] DEFAULT (0) FOR [user_session_time],
CONSTRAINT [DF_" . $table_prefix . "users_user_session_page] DEFAULT (0) FOR [user_session_page]";
$sql[] = "CREATE INDEX [IX_" . $table_prefix . "users]
ON [" . USERS_TABLE . "]([user_session_time]) ON [PRIMARY]";
/* ---------------------------------------------------------------------
DROP FORUM TABLE -- if this may cause you problems you can safely
comment it out, remember to manually remove the IDENTITY setting on
the forum_id column
--------------------------------------------------------------------- */
$sql [] = "ALTER TABLE " . FORUMS_TABLE . " DROP
CONSTRAINT [DF_" . $table_prefix . "forums_forum_posts],
CONSTRAINT [DF_" . $table_prefix . "forums_forum_topics],
CONSTRAINT [DF_" . $table_prefix . "forums_forum_last_post_id],
CONSTRAINT [DF_" . $table_prefix . "forums_prune_enable],
CONSTRAINT [DF_" . $table_prefix . "forums_auth_view],
CONSTRAINT [DF_" . $table_prefix . "forums_auth_read],
CONSTRAINT [DF_" . $table_prefix . "forums_auth_post],
CONSTRAINT [DF_" . $table_prefix . "forums_auth_reply],
CONSTRAINT [DF_" . $table_prefix . "forums_auth_edit],
CONSTRAINT [DF_" . $table_prefix . "forums_auth_delete],
CONSTRAINT [DF_" . $table_prefix . "forums_auth_sticky],
CONSTRAINT [DF_" . $table_prefix . "forums_auth_announce],
CONSTRAINT [DF_" . $table_prefix . "forums_auth_vote],
CONSTRAINT [DF_" . $table_prefix . "forums_auth_pollcreate],
CONSTRAINT [DF_" . $table_prefix . "forums_auth_attachments]";
$sql[] = "CREATE TABLE Tmp_" . FORUMS_TABLE . "
(forum_id int NOT NULL, cat_id int NOT NULL, forum_name varchar(100) NOT NULL, forum_desc varchar(255) NULL, forum_status smallint NOT NULL, forum_order int NOT NULL, forum_posts int NOT NULL, forum_topics smallint NOT NULL, forum_last_post_id int NOT NULL, prune_next int NULL, prune_enable smallint NOT NULL, auth_view smallint NOT NULL, auth_read smallint NOT NULL, auth_post smallint NOT NULL, auth_reply smallint NOT NULL, auth_edit smallint NOT NULL, auth_delete smallint NOT NULL, auth_sticky smallint NOT NULL, auth_announce smallint NOT NULL, auth_vote smallint NOT NULL, auth_pollcreate smallint NOT NULL, auth_attachments smallint NOT NULL) ON [PRIMARY]";
$sql[] = "ALTER TABLE [Tmp_" . FORUMS_TABLE . "] WITH NOCHECK ADD
CONSTRAINT [DF_" . $table_prefix . "forums_forum_posts] DEFAULT (0) FOR [forum_posts],
CONSTRAINT [DF_" . $table_prefix . "forums_forum_topics] DEFAULT (0) FOR [forum_topics],
CONSTRAINT [DF_" . $table_prefix . "forums_forum_last_post_id] DEFAULT (0) FOR [forum_last_post_id],
CONSTRAINT [DF_" . $table_prefix . "forums_prune_enable] DEFAULT (0) FOR [prune_enable],
CONSTRAINT [DF_" . $table_prefix . "forums_auth_view] DEFAULT (0) FOR [auth_view],
CONSTRAINT [DF_" . $table_prefix . "forums_auth_read] DEFAULT (0) FOR [auth_read],
CONSTRAINT [DF_" . $table_prefix . "forums_auth_post] DEFAULT (0) FOR [auth_post],
CONSTRAINT [DF_" . $table_prefix . "forums_auth_reply] DEFAULT (0) FOR [auth_reply],
CONSTRAINT [DF_" . $table_prefix . "forums_auth_edit] DEFAULT (0) FOR [auth_edit],
CONSTRAINT [DF_" . $table_prefix . "forums_auth_delete] DEFAULT (0) FOR [auth_delete],
CONSTRAINT [DF_" . $table_prefix . "forums_auth_sticky] DEFAULT (0) FOR [auth_sticky],
CONSTRAINT [DF_" . $table_prefix . "forums_auth_announce] DEFAULT (0) FOR [auth_announce],
CONSTRAINT [DF_" . $table_prefix . "forums_auth_vote] DEFAULT (0) FOR [auth_vote],
CONSTRAINT [DF_" . $table_prefix . "forums_auth_pollcreate] DEFAULT (0) FOR [auth_pollcreate],
CONSTRAINT [DF_" . $table_prefix . "forums_auth_attachments] DEFAULT (0) FOR [auth_attachments]";
$sql[] = "INSERT INTO Tmp_" . FORUMS_TABLE . " (forum_id, cat_id, forum_name, forum_desc, forum_status, forum_order, forum_posts, forum_topics, forum_last_post_id, prune_next, prune_enable, auth_view, auth_read, auth_post, auth_reply, auth_edit, auth_delete, auth_sticky, auth_announce, auth_vote, auth_pollcreate, auth_attachments)
SELECT forum_id, cat_id, forum_name, forum_desc, forum_status, forum_order, forum_posts, forum_topics, forum_last_post_id, prune_next, prune_enable, auth_view, auth_read, auth_post, auth_reply, auth_edit, auth_delete, auth_sticky, auth_announce, auth_vote, auth_pollcreate, auth_attachments FROM " . FORUMS_TABLE . " TABLOCKX";
$sql[] = "DROP TABLE " . FORUMS_TABLE;
$sql[] = "EXECUTE sp_rename N'Tmp_" . FORUMS_TABLE . "', N'" . FORUMS_TABLE . "', 'OBJECT'";
$sql[] = "ALTER TABLE " . FORUMS_TABLE . " ADD
CONSTRAINT [PK_" . $table_prefix . "forums] PRIMARY KEY CLUSTERED (forum_id) ON [PRIMARY]";
$sql[] = "CREATE NONCLUSTERED INDEX [IX_" . $table_prefix . "forums]
ON " . FORUMS_TABLE . " (cat_id, forum_order, forum_last_post_id) ON [PRIMARY]";
/* --------------------------------------------------------------
END OF DROP FORUM -- don't remove anything after this point!
-------------------------------------------------------------- */
$sql[] = "DROP INDEX " . RANKS_TABLE . ".IX_" . $table_prefix . "ranks";
$sql[] = "ALTER TABLE " . RANKS_TABLE . " DROP
COLUMN rank_max";
$sql[] = "CREATE INDEX [IX_" . $table_prefix . "ranks]
ON [" . RANKS_TABLE . "]([rank_min], [rank_special]) ON [PRIMARY]";
$sql[] = "DROP INDEX " . TOPICS_TABLE . ".IX_" . $table_prefix . "topics";
$sql[] = "ALTER TABLE " . TOPICS_TABLE . " ADD
topic_first_post_id int NULL,
CONSTRAINT [DF_" . $table_prefix . "topics_topic_first_post_id] FOR [topic_first_post_id]";
$sql[] = "CREATE INDEX [IX_" . $table_prefix . "topics]
ON [" . TOPICS_TABLE . "]([forum_id], [topic_type], [topic_first_post_id], [topic_last_post_id]) ON [PRIMARY]";
$sql[] = "ALTER TABLE " . SEARCH_WORD_TABLE . " DROP
CONSTRAINT [PK_" . $table_prefix . "search_wordlist]";
$sql[] = "CREATE UNIQUE INDEX [IX_" . $table_prefix . "search_wordlist]
ON [" . SEARCH_WORD_TABLE . "]([word_text]) WITH IGNORE_DUP_KEY ON [PRIMARY]";
$sql[] = "CREATE INDEX [IX_" . $table_prefix . "search_wordlist_1]
ON [" . SEARCH_WORD_TABLE . "]([word_common]) ON [PRIMARY]";
$sql[] = "CREATE INDEX [IX_" . $table_prefix . "search_wordmatch_1]
ON [" . SEARCH_MATCH_TABLE . "]([word_id]) ON [PRIMARY]";
$sql[] = "ALTER TABLE " . THEMES_NAME_TABLE . " ADD
tr_class1_name varchar(50) NULL,
tr_class2_name varchar(50) NULL,
tr_class3_name varchar(50) NULL,
th_class1_name varchar(50) NULL,
th_class2_name varchar(50) NULL,
th_class3_name varchar(50) NULL,
td_class1_name varchar(50) NULL,
td_class2_name varchar(50) NULL,
td_class3_name varchar(50) NULL,
span_class1_name varchar(50) NULL,
span_class2_name varchar(50) NULL,
span_class3_name varchar(50) NULL";
break;
case 'msaccess':
$sql[] = "ALTER TABLE " . USERS_TABLE . " DROP
COLUMN user_autologin_key";
$sql[] = "ALTER TABLE " . USERS_TABLE . " ADD
user_session_time int NOT NULL,
user_session_page smallint NOT NULL";
$sql[] = "CREATE INDEX user_session_time
ON " . USERS_TABLE . " (user_session_time)";
$sql[] = "ALTER TABLE " . TOPICS_TABLE . " ADD
topic_first_post_id int NULL";
$sql[] = "CREATE INDEX topic_first_post_id
ON " . TOPICS_TABLE . " (topic_first_post_id)";
$sql[] = "ALTER TABLE " . THEMES_NAME_TABLE . " ADD
tr_class1_name varchar(50) NULL,
tr_class2_name varchar(50) NULL,
tr_class3_name varchar(50) NULL,
th_class1_name varchar(50) NULL,
th_class2_name varchar(50) NULL,
th_class3_name varchar(50) NULL,
td_class1_name varchar(50) NULL,
td_class2_name varchar(50) NULL,
td_class3_name varchar(50) NULL,
span_class1_name varchar(50) NULL,
span_class2_name varchar(50) NULL,
span_class3_name varchar(50) NULL";
break;
default:
die("No DB LAYER found!");
break;
}
case 'RC-3':
case 'RC-4':
case '.0.0':
switch (SQL_LAYER)
{
case 'mysql':
case 'mysql4':
$sql[] = "ALTER TABLE " . USERS_TABLE . "
MODIFY COLUMN user_id mediumint(8) NOT NULL,
MODIFY COLUMN user_timezone decimal(5,2) DEFAULT '0' NOT NULL";
break;
case 'postgresql':
$sql[] = "ALTER TABLE " . USERS_TABLE . "
RENAME COLUMN user_timezone TO user_timezone_old";
$sql[] = "ALTER TABLE " . USERS_TABLE . "
ADD COLUMN user_timezone decimal(5)";
break;
case 'mssql':
case 'mssql-odbc':
$sql[] = "ALTER TABLE " . USERS_TABLE . "
ALTER COLUMN [user_timezone] [decimal] (5,2) NOT NULL";
break;
}
case '.0.1':
switch (SQL_LAYER)
{
case 'mysql':
case 'mysql4':
$sql[] = "ALTER TABLE " . GROUPS_TABLE . "
MODIFY COLUMN group_id mediumint(8) NOT NULL auto_increment";
break;
case 'mssql':
case 'mssql-odbc':
/* ---------------------------------------------------------------------
DROP GROUP TABLE -- if this may cause you problems you can safely
comment it out, remember to manually add the IDENTITY setting on
the group_id column
--------------------------------------------------------------------- */
$sql[] = "CREATE TABLE Tmp_" . GROUPS_TABLE . "
(group_id int IDENTITY (1, 1) NOT NULL, group_type smallint NULL, group_name varchar(50) NOT NULL, group_description varchar(255) NOT NULL, group_moderator int NULL, group_single_user smallint NOT NULL) ON [PRIMARY]";
$sql[] = "SET IDENTITY_INSERT " . GROUPS_TABLE . " ON";
$sql[] = "INSERT INTO Tmp_" . GROUPS_TABLE . " (group_id, group_type, group_name, group_description, group_moderator, group_single_user)
SELECT group_id, group_type, group_name, group_description, group_moderator, group_single_user FROM " . GROUPS_TABLE . " TABLOCKX";
$sql[] = "SET IDENTITY_INSERT " . GROUPS_TABLE . " OFF";
$sql[] = "DROP TABLE " . GROUPS_TABLE;
$sql[] = "EXECUTE sp_rename N'Tmp_" . GROUPS_TABLE . "', N'" . GROUPS_TABLE . "', 'OBJECT'";
$sql[] = "ALTER TABLE " . GROUPS_TABLE . " ADD
CONSTRAINT [PK_" . $table_prefix . "groups] PRIMARY KEY CLUSTERED (group_id) ON [PRIMARY]";
$sql[] = "CREATE INDEX [IX_" . $table_prefix . "groups]
ON " . GROUPS_TABLE . " (group_single_user) ON [PRIMARY]";
/* --------------------------------------------------------------
END OF DROP GROUP -- don't remove anything after this point!
-------------------------------------------------------------- */
break;
}
case '.0.3':
switch (SQL_LAYER)
{
case 'mysql':
case 'mysql4':
// Add indexes to post_id in search match table (+ word_id for MS Access)
$sql[] = "ALTER TABLE " . SEARCH_MATCH_TABLE . "
ADD INDEX post_id (post_id)";
// Modify user_timezone to decimal(5,2) for mysql ... mysql4/mssql/pgsql/msaccess
// should be completely unaffected
// Change default user_notify to 0
$sql[] = "ALTER TABLE " . USERS_TABLE . "
MODIFY COLUMN user_timezone decimal(5,2) DEFAULT '0' NOT NULL,
MODIFY COLUMN user_notify tinyint(1) DEFAULT '0' NOT NULL";
// Adjust field type for prune_days, prune_freq ... was too small
$sql[] = "ALTER TABLE " . PRUNE_TABLE . "
MODIFY COLUMN prune_days smallint(5) UNSIGNED NOT NULL,
MODIFY COLUMN prune_freq smallint(5) UNSIGNED NOT NULL";
break;
case 'msaccess':
// Add indexes to post_id in search match table (+ word_id for MS Access)
$sql[] = "CREATE INDEX " . SEARCH_MATCH_TABLE . "
ON " . SEARCH_MATCH_TABLE . " ([post_id])";
$sql[] = "CREATE INDEX " . SEARCH_MATCH_TABLE . "_1
ON " . SEARCH_MATCH_TABLE . " ([word_id])";
break;
case 'postgresql':
// Add indexes to post_id in search match table (+ word_id for MS Access)
$sql[] = "CREATE INDEX post_id_" . SEARCH_MATCH_TABLE . "
ON " . SEARCH_MATCH_TABLE . " (post_id)";
// Regenerate groups table with incremented group_id for pgsql
// ... missing in 2.0.3 ...
$sql[] = "CREATE SEQUENCE " . GROUPS_TABLE . "_id_seq start 3 increment 1 maxvalue 2147483647 minvalue 1 cache 1";
$sql[] = "CREATE TABLE tmp_" . GROUPS_TABLE . "
AS SELECT group_id, group_name, group_type, group_description, group_moderator, group_single_user
FROM " . GROUPS_TABLE;
$sql[] = "DROP TABLE " . GROUPS_TABLE;
$sql[] = "CREATE TABLE phpbb_groups (group_id int DEFAULT nextval('" . GROUPS_TABLE . "_id_seq'::text) NOT NULL, group_name varchar(40) NOT NULL, group_type int2 DEFAULT '1' NOT NULL, group_description varchar(255) NOT NULL, group_moderator int4 DEFAULT '0' NOT NULL, group_single_user int2 DEFAULT '0' NOT NULL, CONSTRAINT phpbb_groups_pkey PRIMARY KEY (group_id))";
$sql[] = "INSERT INTO " . GROUPS_TABLE . " (group_id, group_name, group_type, group_description, group_moderator, group_single_user)
SELECT group_id, group_name, group_type, group_description, group_moderator, group_single_user
FROM tmp_" . GROUPS_TABLE;
$sql[] = "DROP TABLE tmp_" . GROUPS_TABLE;
break;
}
case '.0.4':
switch (SQL_LAYER)
{
case 'mssql':
case 'mssql-odbc':
// Add missing defaults to MSSQL post table schema, failed in previous updates
$sql[] = "ALTER TABLE [" . POSTS_TABLE . "] WITH NOCHECK ADD
CONSTRAINT [DF_" . POSTS_TABLE . "_enable_bbcode] DEFAULT (1) FOR [enable_bbcode],
CONSTRAINT [DF_" . POSTS_TABLE . "_enable_html] DEFAULT (0) FOR [enable_html],
CONSTRAINT [DF_" . POSTS_TABLE . "_enable_smilies] DEFAULT (1) FOR [enable_smilies],
CONSTRAINT [DF_" . POSTS_TABLE . "_enable_sig] DEFAULT (1) FOR [enable_sig],
CONSTRAINT [DF_" . POSTS_TABLE . "_post_edit_count] DEFAULT (0) FOR [post_edit_count]";
break;
}
// Add tables for visual confirmation ... saves me the trouble of writing a seperate
// script :D
switch (SQL_LAYER)
{
case 'mysql':
case 'mysql4':
$sql[] = 'CREATE TABLE ' . $table_prefix . 'confirm (confirm_id char(32) DEFAULT \'\' NOT NULL, session_id char(32) DEFAULT \'\' NOT NULL, code char(6) DEFAULT \'\' NOT NULL, PRIMARY KEY (session_id, confirm_id))';
break;
case 'mssql':
case 'mssql-odbc':
$sql[] = 'CREATE TABLE [' . $table_prefix . 'confirm] ([confirm_id] [char] (32) NOT NULL , [session_id] [char] (32) NOT NULL , [code] [char] (6) NOT NULL ) ON [PRIMARY]';
$sql[] = 'ALTER TABLE [' . $table_prefix . 'confirm] WITH NOCHECK ADD CONSTRAINT [PK_' . $table_prefix . 'confirm] PRIMARY KEY CLUSTERED ( [session_id],[confirm_id]) ON [PRIMARY]';
$sql[] = 'ALTER TABLE [' . $table_prefix . 'confirm] WITH NOCHECK ADD CONSTRAINT [DF_' . $table_prefix . 'confirm_confirm_id] DEFAULT (\'\') FOR [confirm_id], CONSTRAINT [DF_' . $table_prefix . 'confirm_session_id] DEFAULT (\'\') FOR [session_id], CONSTRAINT [DF_' . $table_prefix . 'confirm_code] DEFAULT (\'\') FOR [code]';
break;
case 'msaccess':
$sql[] = 'CREATE TABLE ' . $table_prefix . 'confirm (confirm_id char(32) NOT NULL, session_id char(32) NOT NULL, code char(6) NOT NULL)';
$sql[] = 'ALTER TABLE ' . $table_prefix . 'confirm ADD (PRIMARY KEY (session_id, confirm_id))';
break;
case 'postgresql':
$sql[] = 'CREATE TABLE ' . $table_prefix . 'confirm (confirm_id char(32) DEFAULT \'\' NOT NULL, session_id char(32) DEFAULT \'\' NOT NULL, code char(6) DEFAULT \'\' NOT NULL, CONSTRAINT phpbb_confirm_pkey PRIMARY KEY (session_id, confirm_id))';
break;
}
break;
}
echo "<h2>Updating database schema</h2>\n";
echo "<p>Progress :: <b>";
flush();
$error_ary = array();
$errored = false;
if (count($sql))
{
for ($i = 0; $i < count($sql); $i++)
{
_sql($sql[$i], $errored, $error_ary);
}
echo "</b> <b class=\"ok\">Done</b><br />Result &nbsp; :: \n";
if ($errored)
{
echo " <b>Some queries failed, the statements and errors are listing below</b>\n<ul>";
for ($i = 0; $i < count($error_ary['sql']); $i++)
{
echo "<li>Error :: <b>" . $error_ary['error_code'][$i]['message'] . "</b><br />";
echo "SQL &nbsp; :: <b>" . $error_ary['sql'][$i] . "</b><br /><br /></li>";
}
echo "</ul>\n<p>This is probably nothing to worry about, update will continue. Should this fail to complete you may need to seek help at our development board. See <a href=\"docs\README.html\">README</a> for details on how to obtain advice.</p>\n";
}
else
{
echo "<b>No errors</b>\n";
}
}
else
{
echo " No updates required</b></p>\n";
}
//
// Data updates
//
unset($sql);
$error_ary = array();
$errored = false;
echo "<h2>Updating data</h2>\n";
echo "<p>Progress :: <b>";
flush();
switch ($row['config_value'])
{
case '':
$sql = "SELECT themes_id
FROM " . THEMES_TABLE . "
WHERE template_name = 'subSilver'";
$result = _sql($sql, $errored, $error_ary);
if ($row = $db->sql_fetchrow($result))
{
$theme_id = $row['themes_id'];
$sql = "UPDATE " . THEMES_TABLE . "
SET head_stylesheet = 'subSilver.css', body_background = '', body_bgcolor = 'E5E5E5', body_text = '000000', body_link = '006699', body_vlink = '5493B4', body_alink = '', body_hlink = 'DD6900', tr_color1 = 'EFEFEF', tr_color2 = 'DEE3E7', tr_color3 = 'D1D7DC', tr_class1 = '', tr_class2 = '', tr_class3 = '', th_color1 = '98AAB1', th_color2 = '006699', th_color3 = 'FFFFFF', th_class1 = 'cellpic1.gif', th_class2 = 'cellpic3.gif', th_class3 = 'cellpic2.jpg', td_color1 = 'FAFAFA', td_color2 = 'FFFFFF', td_color3 = '', td_class1 = 'row1', td_class2 = 'row2', td_class3 = '', fontface1 = 'Verdana, Arial, Helvetica, sans-serif', fontface2 = 'Trebuchet MS', fontface3 = 'Courier, ''Courier New'', sans-serif', fontsize1 = 10, fontsize2 = 11, fontsize3 = 12, fontcolor1 = '444444', fontcolor2 = '006600', fontcolor3 = 'FFA34F', span_class1 = '', span_class2 = '', span_class3 = ''
WHERE themes_id = $theme_id";
_sql($sql, $errored, $error_ary);
$sql = "DELETE FROM " . THEMES_NAME_TABLE . "
WHERE themes_id = $theme_id";
_sql($sql, $errored, $error_ary);
$sql = "INSERT INTO " . THEMES_NAME_TABLE . " (themes_id, tr_color1_name, tr_color2_name, tr_color3_name, tr_class1_name, tr_class2_name, tr_class3_name, th_color1_name, th_color2_name, th_color3_name, th_class1_name, th_class2_name, th_class3_name, td_color1_name, td_color2_name, td_color3_name, td_class1_name, td_class2_name, td_class3_name, fontface1_name, fontface2_name, fontface3_name, fontsize1_name, fontsize2_name, fontsize3_name, fontcolor1_name, fontcolor2_name, fontcolor3_name, span_class1_name, span_class2_name, span_class3_name)
VALUES ($theme_id, 'The lightest row colour', 'The medium row color', 'The darkest row colour', '', '', '', 'Border round the whole page', 'Outer table border', 'Inner table border', 'Silver gradient picture', 'Blue gradient picture', 'Fade-out gradient on index', 'Background for quote boxes', 'All white areas', '', 'Background for topic posts', '2nd background for topic posts', '', 'Main fonts', 'Additional topic title font', 'Form fonts', 'Smallest font size', 'Medium font size', 'Normal font size (post body etc)', 'Quote & copyright text', 'Code text colour', 'Main table header text colour', '', '', '')";
_sql($sql, $errored, $error_ary);
}
$db->sql_freeresult($result);
$sql = "SELECT MIN(post_id) AS first_post_id, topic_id
FROM " . POSTS_TABLE . "
GROUP BY topic_id
ORDER BY topic_id ASC";
$result = _sql($sql, $errored, $error_ary);
if ($row = $db->sql_fetchrow($result))
{
do
{
$sql = "UPDATE " . TOPICS_TABLE . "
SET topic_first_post_id = " . $row['first_post_id'] . "
WHERE topic_id = " . $row['topic_id'];
_sql($sql, $errored, $error_ary);
}
while ($row = $db->sql_fetchrow($result));
}
$db->sql_freeresult($result);
$sql = "SELECT DISTINCT u.user_id
FROM " . USERS_TABLE . " u, " . USER_GROUP_TABLE . " ug, " . AUTH_ACCESS_TABLE . " aa
WHERE aa.auth_mod = 1
AND ug.group_id = aa.group_id
AND u.user_id = ug.user_id
AND u.user_level <> " . ADMIN;
$result = _sql($sql, $errored, $error_ary);
$mod_user = array();
while ($row = $db->sql_fetchrow($result))
{
$mod_user[] = $row['user_id'];
}
$db->sql_freeresult($result);
if (count($mod_user))
{
$sql = "UPDATE " . USERS_TABLE . "
SET user_level = " . MOD . "
WHERE user_id IN (" . implode(', ', $mod_user) . ")";
_sql($sql, $errored, $error_ary);
}
$sql = "INSERT INTO " . CONFIG_TABLE . " (config_name, config_value)
VALUES ('server_name', 'www.myserver.tld')";
_sql($sql, $errored, $error_ary);
$sql = "INSERT INTO " . CONFIG_TABLE . " (config_name, config_value)
VALUES ('script_path', '/phpBB2/')";
_sql($sql, $errored, $error_ary);
$sql = "INSERT INTO " . CONFIG_TABLE . " (config_name, config_value)
VALUES ('server_port', '80')";
_sql($sql, $errored, $error_ary);
$sql = "INSERT INTO " . CONFIG_TABLE . " (config_name, config_value)
VALUES ('record_online_users', '1')";
_sql($sql, $errored, $error_ary);
$sql = "INSERT INTO " . CONFIG_TABLE . " (config_name, config_value)
VALUES ('record_online_date', '" . time() . "')";
_sql($sql, $errored, $error_ary);
case 'RC-3':
case 'RC-4':
case '.0.0':
case '.0.1':
if (SQL_LAYER == 'postgresql')
{
$sql = "SELECT user_id, user_timezone_old
FROM " . USERS_TABLE;
$result = _sql($sql, $errored, $error_ary);
while ($row = $db->sql_fetchrow($result))
{
$sql = "UPDATE " . USERS_TABLE . "
SET user_timezone = " . $row['user_timezone_old'] . "
WHERE user_id = " . $row['user_id'];
_sql($sql, $errored, $error_ary);
}
$db->sql_freeresult($result);
}
$sql = "SELECT topic_id, topic_moved_id
FROM " . TOPICS_TABLE . "
WHERE topic_moved_id <> 0
AND topic_status = " . TOPIC_MOVED;
$result = _sql($sql, $errored, $error_ary);
$topic_ary = array();
while ($row = $db->sql_fetchrow($result))
{
$topic_ary[$row['topic_id']] = $row['topic_moved_id'];
}
$db->sql_freeresult($result);
while (list($topic_id, $topic_moved_id) = each($topic_ary))
{
$sql = "SELECT MAX(post_id) AS last_post, MIN(post_id) AS first_post, COUNT(post_id) AS total_posts
FROM " . POSTS_TABLE . "
WHERE topic_id = $topic_moved_id";
$result = _sql($sql, $errored, $error_ary);
$sql = ($row = $db->sql_fetchrow($result)) ? "UPDATE " . TOPICS_TABLE . " SET topic_replies = " . ($row['total_posts'] - 1) . ", topic_first_post_id = " . $row['first_post'] . ", topic_last_post_id = " . $row['last_post'] . " WHERE topic_id = $topic_id" : "DELETE FROM " . TOPICS_TABLE . " WHERE topic_id = " . $row['topic_id'];
_sql($sql, $errored, $error_ary);
}
unset($sql);
sync('all forums');
case '.0.2':
case '.0.3':
// Topics will resync automatically
// Remove stop words from search match and search words
$dirname = 'language';
$dir = opendir($phpbb_root_path . $dirname);
while ($file = readdir($dir))
{
if (preg_match("#^lang_#i", $file) && !is_file($phpbb_root_path . $dirname . "/" . $file) && !is_link($phpbb_root_path . $dirname . "/" . $file) && file_exists($phpbb_root_path . $dirname . "/" . $file . '/search_stopwords.txt'))
{
$stopword_list = trim(preg_replace('#([\w\.\-_\+\'<27><>-<2D>\\\]+?)[ \n\r]*?(,|$)#', '\'\1\'\2', str_replace("'", "\'", implode(', ', file($phpbb_root_path . $dirname . "/" . $file . '/search_stopwords.txt')))));
$sql = "SELECT word_id
FROM " . SEARCH_WORD_TABLE . "
WHERE word_text IN ($stopword_list)";
$result = _sql($sql, $errored, $error_ary);
$word_id_sql = '';
if ($row = $db->sql_fetchrow($result))
{
do
{
$word_id_sql .= (($word_id_sql != '') ? ', ' : '') . $row['word_id'];
}
while ($row = $db->sql_fetchrow($result));
$sql = "DELETE FROM " . SEARCH_WORD_TABLE . "
WHERE word_id IN ($word_id_sql)";
_sql($sql, $errored, $error_ary);
$sql = "DELETE FROM " . SEARCH_MATCH_TABLE . "
WHERE word_id IN ($word_id_sql)";
_sql($sql, $errored, $error_ary);
}
$db->sql_freeresult($result);
}
}
closedir($dir);
// Mark common words ...
remove_common('global', 4/10);
// remove superfluous polls ... grab polls with topics then delete polls
// not in that list
$sql = "SELECT v.vote_id
FROM " . TOPICS_TABLE . " t, " . VOTE_DESC_TABLE . " v
WHERE v.topic_id = t.topic_id";
$result = _sql($sql, $errored, $error_ary);
$vote_id_sql = '';
if ($row = $db->sql_fetchrow($result))
{
do
{
$vote_id_sql .= (($vote_id_sql != '') ? ', ' : '') . $row['vote_id'];
}
while ($row = $db->sql_fetchrow($result));
$sql = "DELETE FROM " . VOTE_DESC_TABLE . "
WHERE vote_id NOT IN ($vote_id_sql)";
_sql($sql, $errored, $error_ary);
$sql = "DELETE FROM " . VOTE_RESULTS_TABLE . "
WHERE vote_id NOT IN ($vote_id_sql)";
_sql($sql, $errored, $error_ary);
$sql = "DELETE FROM " . VOTE_USERS_TABLE . "
WHERE vote_id NOT IN ($vote_id_sql)";
_sql($sql, $errored, $error_ary);
}
$db->sql_freeresult($result);
// update pm counters
$sql = "SELECT privmsgs_to_userid, COUNT(privmsgs_id) AS unread_count
FROM " . PRIVMSGS_TABLE . "
WHERE privmsgs_type = " . PRIVMSGS_UNREAD_MAIL . "
GROUP BY privmsgs_to_userid";
$result = _sql($sql, $errored, $error_ary);
if ($row = $db->sql_fetchrow($result))
{
$update_users = array();
do
{
$update_users[$row['unread_count']][] = $row['privmsgs_to_userid'];
}
while ($row = $db->sql_fetchrow($result));
while (list($num, $user_ary) = each($update_users))
{
$user_ids = implode(', ', $user_ary);
$sql = "UPDATE " . USERS_TABLE . "
SET user_unread_privmsg = $num
WHERE user_id IN ($user_ids)";
_sql($sql, $errored, $error_ary);
}
unset($update_list);
}
$db->sql_freeresult($result);
$sql = "SELECT privmsgs_to_userid, COUNT(privmsgs_id) AS new_count
FROM " . PRIVMSGS_TABLE . "
WHERE privmsgs_type = " . PRIVMSGS_NEW_MAIL . "
GROUP BY privmsgs_to_userid";
$result = _sql($sql, $errored, $error_ary);
if ($row = $db->sql_fetchrow($result))
{
$update_users = array();
do
{
$update_users[$row['new_count']][] = $row['privmsgs_to_userid'];
}
while ($row = $db->sql_fetchrow($result));
while (list($num, $user_ary) = each($update_users))
{
$user_ids = implode(', ', $user_ary);
$sql = "UPDATE " . USERS_TABLE . "
SET user_new_privmsg = $num
WHERE user_id IN ($user_ids)";
_sql($sql, $errored, $error_ary);
}
unset($update_list);
}
$db->sql_freeresult($result);
// Remove superfluous watched topics
$sql = "SELECT t.topic_id
FROM " . TOPICS_TABLE . " t, " . TOPICS_WATCH_TABLE . " w
WHERE w.topic_id = t.topic_id";
$result = _sql($sql, $errored, $error_ary);
$topic_id_sql = '';
if ($row = $db->sql_fetchrow($result))
{
do
{
$topic_id_sql .= (($topic_id_sql != '') ? ', ' : '') . $row['topic_id'];
}
while ($row = $db->sql_fetchrow($result));
$sql = "DELETE FROM " . TOPICS_WATCH_TABLE . "
WHERE topic_id NOT IN ($topic_id_sql)";
_sql($sql, $errored, $error_ary);
}
$db->sql_freeresult($result);
// Reset any email addresses which are non-compliant ... something
// not done in the upgrade script and thus which may affect some
// mysql users
switch (SQL_LAYER)
{
case 'mysql':
$sql = "UPDATE " . USERS_TABLE . "
SET user_email = ''
WHERE user_email NOT REGEXP '^[a-zA-Z0-9_\+\.\-]+@.*[a-zA-Z0-9_\-]+\.[a-zA-Z]{2,}$'";
_sql($sql, $errored, $error_ary);
}
case '.0.4':
// Add the confirmation code switch ... save time and trouble elsewhere
$sql = 'INSERT INTO ' . CONFIG_TABLE . " (config_name, config_value)
VALUES ('enable_confirm', '0')";
_sql($sql, $errored, $error_ary);
$sql = "INSERT INTO " . CONFIG_TABLE . " (config_name, config_value)
VALUES ('sendmail_fix', '0')";
_sql($sql, $errored, $error_ary);
case '.0.5':
$sql = "SELECT user_id, username
FROM " . USERS_TABLE;
$result = _sql($sql, $errored, $error_ary);
while ($row = $db->sql_fetchrow($result))
{
if (!preg_match('#(&gt;)|(&lt;)|(&quot)|(&amp;)#', $row['username']))
{
if ($row['username'] != htmlspecialchars($row['username']))
{
$sql = "UPDATE " . USERS_TABLE . "
SET username = '" . str_replace("'", "''", htmlspecialchars($row['username'])) . "'
WHERE user_id = " . $row['user_id'];
_sql($sql, $errored, $error_ary);
}
}
}
$db->sql_freeresult($result);
break;
default:
echo " No updates where required</b></p>\n";
break;
}
echo "<h2>Updating version and optimizing tables</h2>\n";
echo "<p>Progress :: <b>";
flush();
// update the version
$sql = "UPDATE " . CONFIG_TABLE . "
SET config_value = '$updates_to_version'
WHERE config_name = 'version'";
_sql($sql, $errored, $error_ary);
// Optimize/vacuum analyze the tables where appropriate
// this should be done for each version in future along with
// the version number update
switch (SQL_LAYER)
{
case 'mysql':
case 'mysql4':
$sql = 'OPTIMIZE TABLE ' . $table_prefix . 'auth_access, ' . $table_prefix . 'banlist, ' . $table_prefix . 'categories, ' . $table_prefix . 'config, ' . $table_prefix . 'disallow, ' . $table_prefix . 'forum_prune, ' . $table_prefix . 'forums, ' . $table_prefix . 'groups, ' . $table_prefix . 'posts, ' . $table_prefix . 'posts_text, ' . $table_prefix . 'privmsgs, ' . $table_prefix . 'privmsgs_text, ' . $table_prefix . 'ranks, ' . $table_prefix . 'search_results, ' . $table_prefix . 'search_wordlist, ' . $table_prefix . 'search_wordmatch, ' . $table_prefix . 'smilies, ' . $table_prefix . 'themes, ' . $table_prefix . 'themes_name, ' . $table_prefix . 'topics, ' . $table_prefix . 'topics_watch, ' . $table_prefix . 'user_group, ' . $table_prefix . 'users, ' . $table_prefix . 'vote_desc, ' . $table_prefix . 'vote_results, ' . $table_prefix . 'vote_voters, ' . $table_prefix . 'words';
_sql($sql, $errored, $error_ary);
break;
case 'postgresql':
_sql("VACUUM ANALYZE", $errored, $error_ary);
break;
}
echo "</b> <b class=\"ok\">Done</b><br />Result &nbsp; :: \n";
if ($errored)
{
echo " <b>Some queries failed, the statements and errors are listing below</b>\n<ul>";
for ($i = 0; $i < count($error_ary['sql']); $i++)
{
echo "<li>Error :: <b>" . $error_ary['error_code'][$i]['message'] . "</b><br />";
echo "SQL &nbsp; :: <b>" . $error_ary['sql'][$i] . "</b><br /><br /></li>";
}
echo "</ul>\n<p>This is probably nothing to worry about, update will continue. Should this fail to complete you may need to seek help at our development board. See <a href=\"docs\README.html\">README</a> for details on how to obtain advice.</p>\n";
}
else
{
echo "<b>No errors</b>\n";
}
echo "<h2>Update completed</h2>\n";
echo "\n<p>You should now visit the General Configuration settings page in the <a href=\"../admin/\">Administration Panel</a> and check the General Configuration of the board. If you updated from versions prior to RC-3 you <b>must</b> update some entries. If you do not do this emails sent from the board will contain incorrect information. Don't forget to delete this file!</p>\n";
?>
<br clear="all" />
</body>
</html>

View File

@@ -1,963 +0,0 @@
<?php
/***************************************************************************
* update_to_xxx.php
* -------------------
* begin : Wednesday, May 16, 2002
* copyright : (C) 2001 The phpBB Group
* email : support@phpbb.com
*
* $Id$
*
***************************************************************************/
/***************************************************************************
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
***************************************************************************/
function _sql($sql, &$errored, &$error_ary, $echo_dot = true)
{
global $db;
if (!($result = $db->sql_query($sql)))
{
$errored = true;
$error_ary['sql'][] = (is_array($sql)) ? $sql[$i] : $sql;
$error_ary['error_code'][] = $db->sql_error();
}
if ($echo_dot)
{
echo ". \n";
flush();
}
return $result;
}
@set_time_limit(120);
define('IN_PHPBB', 1);
$phpbb_root_path = './../';
include($phpbb_root_path . 'extension.inc');
include($phpbb_root_path . 'config.'.$phpEx);
if(!isset($dbms))
{
die("Please read: <a href='../docs/INSTALL.html'>INSTALL.html</a> before attempting to update.");
}
include($phpbb_root_path . 'includes/constants.'.$phpEx);
include($phpbb_root_path . 'includes/functions.'.$phpEx);
include($phpbb_root_path . 'includes/functions_admin.'.$phpEx);
include($phpbb_root_path . 'includes/functions_search.'.$phpEx);
include($phpbb_root_path . 'includes/db.'.$phpEx);
//
//
//
$updates_to_version = ".0.7";
//
//
//
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;">
<meta http-equiv="Content-Style-Type" content="text/css">
<style type="text/css">
<!--
font,th,td,p,body { font-family: "Courier New", courier; font-size: 11pt }
a:link,a:active,a:visited { color : #006699; }
a:hover { text-decoration: underline; color : #DD6900;}
hr { height: 0px; border: solid #D1D7DC 0px; border-top-width: 1px;}
.maintitle,h1,h2 {font-weight: bold; font-size: 22px; font-family: "Trebuchet MS",Verdana, Arial, Helvetica, sans-serif; text-decoration: none; line-height : 120%; color : #000000;}
.ok {color:green}
/* Import the fancy styles for IE only (NS4.x doesn't use the @import function) */
@import url("../templates/subSilver/formIE.css");
-->
</style>
</head>
<body bgcolor="#FFFFFF" text="#000000" link="#006699" vlink="#5584AA">
<table width="100%" border="0" cellspacing="0" cellpadding="10" align="center">
<tr>
<td><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><img src="../templates/subSilver/images/logo_phpBB.gif" border="0" alt="Forum Home" vspace="1" /></td>
<td align="center" width="100%" valign="middle"><span class="maintitle">Updating to latest stable release</span></td>
</tr>
</table></td>
</tr>
</table>
<br clear="all" />
<h2>Information</h2>
<?php
echo '<p>Database type &nbsp; &nbsp;:: <b>' . SQL_LAYER . '</b><br />';
$sql = "SELECT config_value
FROM " . CONFIG_TABLE . "
WHERE config_name = 'version'";
if (!($result = $db->sql_query($sql)))
{
die("Couldn't obtain version info");
}
$row = $db->sql_fetchrow($result);
$sql = array();
switch ($row['config_value'])
{
case '':
echo 'Previous version :: <b>&lt; RC-3</b></p><br />';
break;
case 'RC-3':
echo 'Previous version :: <b>RC-3</b></p><br />';
break;
case 'RC-4':
echo 'Previous version :: <b>RC-4</b></p><br />';
break;
default:
echo 'Previous version :: <b>2' . $row['config_value'] . '</b><br />';
break;
}
echo 'Updated version &nbsp;:: <b>2' . $updates_to_version . '</b></p>' ."\n";
//
// Schema updates
//
switch ($row['config_value'])
{
case '':
switch (SQL_LAYER)
{
case 'mysql':
case 'mysql4':
$sql[] = "ALTER TABLE " . USERS_TABLE . " DROP
COLUMN user_autologin_key";
$sql[] = "ALTER TABLE " . RANKS_TABLE . " DROP
COLUMN rank_max";
$sql[] = "ALTER TABLE " . USERS_TABLE . "
ADD COLUMN user_session_time int(11) DEFAULT '0' NOT NULL,
ADD COLUMN user_session_page smallint(5) DEFAULT '0' NOT NULL,
ADD INDEX (user_session_time)";
$sql[] = "ALTER TABLE " . SEARCH_TABLE . "
MODIFY search_id int(11) NOT NULL";
$sql[] = "ALTER TABLE " . TOPICS_TABLE . "
MODIFY topic_moved_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL,
ADD COLUMN topic_first_post_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL,
ADD INDEX (topic_first_post_id)";
$sql[] = "ALTER TABLE " . THEMES_NAME_TABLE . "
ADD COLUMN tr_class1_name varchar(50) NULL,
ADD COLUMN tr_class2_name varchar(50) NULL,
ADD COLUMN tr_class3_name varchar(50) NULL,
ADD COLUMN th_class1_name varchar(50) NULL,
ADD COLUMN th_class2_name varchar(50) NULL,
ADD COLUMN th_class3_name varchar(50) NULL,
ADD COLUMN td_class1_name varchar(50) NULL,
ADD COLUMN td_class2_name varchar(50) NULL,
ADD COLUMN td_class3_name varchar(50) NULL,
ADD COLUMN span_class1_name varchar(50) NULL,
ADD COLUMN span_class2_name varchar(50) NULL,
ADD COLUMN span_class3_name varchar(50) NULL";
break;
case 'postgresql':
$sql[] = "ALTER TABLE " . USERS_TABLE . "
ADD COLUMN user_session_time int4";
$sql[] = "ALTER TABLE " . USERS_TABLE . "
ADD COLUMN user_session_page int2";
$sql[] = "ALTER TABLE " . USERS_TABLE . "
ALTER COLUMN user_session_time SET DEFAULT '0'";
$sql[] = "ALTER TABLE " . USERS_TABLE . "
ALTER COLUMN user_session_page SET DEFAULT '0'";
$sql[] = "CREATE INDEX user_session_time_" . $table_prefix . "users_index
ON " . USERS_TABLE . " (user_session_time)";
$sql[] = "ALTER TABLE " . TOPICS_TABLE . "
ADD COLUMN topic_first_post_id int4";
$sql[] = "CREATE INDEX topic_first_post_id_" . $table_prefix . "topics_index
ON " . TOPICS_TABLE . " (topic_first_post_id)";
$sql[] = "ALTER TABLE " . THEMES_NAME_TABLE . "
ADD COLUMN tr_class1_name varchar(50) NULL";
$sql[] = "ALTER TABLE " . THEMES_NAME_TABLE . "
ADD COLUMN tr_class2_name varchar(50) NULL";
$sql[] = "ALTER TABLE " . THEMES_NAME_TABLE . "
ADD COLUMN tr_class3_name varchar(50) NULL";
$sql[] = "ALTER TABLE " . THEMES_NAME_TABLE . "
ADD COLUMN th_class1_name varchar(50) NULL";
$sql[] = "ALTER TABLE " . THEMES_NAME_TABLE . "
ADD COLUMN th_class2_name varchar(50) NULL";
$sql[] = "ALTER TABLE " . THEMES_NAME_TABLE . "
ADD COLUMN th_class3_name varchar(50) NULL";
$sql[] = "ALTER TABLE " . THEMES_NAME_TABLE . "
ADD COLUMN td_class1_name varchar(50) NULL";
$sql[] = "ALTER TABLE " . THEMES_NAME_TABLE . "
ADD COLUMN td_class2_name varchar(50) NULL";
$sql[] = "ALTER TABLE " . THEMES_NAME_TABLE . "
ADD COLUMN td_class3_name varchar(50) NULL";
$sql[] = "ALTER TABLE " . THEMES_NAME_TABLE . "
ADD COLUMN span_class1_name varchar(50) NULL";
$sql[] = "ALTER TABLE " . THEMES_NAME_TABLE . "
ADD COLUMN span_class2_name varchar(50) NULL";
$sql[] = "ALTER TABLE " . THEMES_NAME_TABLE . "
ADD COLUMN span_class3_name varchar(50) NULL";
break;
case 'mssql-odbc':
case 'mssql':
$sql[] = "ALTER TABLE " . USERS_TABLE . " DROP
COLUMN user_autologin_key";
$sql[] = "ALTER TABLE " . USERS_TABLE . " ADD
user_session_time int NOT NULL,
user_session_page smallint NOT NULL,
CONSTRAINT [DF_" . $table_prefix . "users_user_session_time] DEFAULT (0) FOR [user_session_time],
CONSTRAINT [DF_" . $table_prefix . "users_user_session_page] DEFAULT (0) FOR [user_session_page]";
$sql[] = "CREATE INDEX [IX_" . $table_prefix . "users]
ON [" . USERS_TABLE . "]([user_session_time]) ON [PRIMARY]";
/* ---------------------------------------------------------------------
DROP FORUM TABLE -- if this may cause you problems you can safely
comment it out, remember to manually remove the IDENTITY setting on
the forum_id column
--------------------------------------------------------------------- */
$sql [] = "ALTER TABLE " . FORUMS_TABLE . " DROP
CONSTRAINT [DF_" . $table_prefix . "forums_forum_posts],
CONSTRAINT [DF_" . $table_prefix . "forums_forum_topics],
CONSTRAINT [DF_" . $table_prefix . "forums_forum_last_post_id],
CONSTRAINT [DF_" . $table_prefix . "forums_prune_enable],
CONSTRAINT [DF_" . $table_prefix . "forums_auth_view],
CONSTRAINT [DF_" . $table_prefix . "forums_auth_read],
CONSTRAINT [DF_" . $table_prefix . "forums_auth_post],
CONSTRAINT [DF_" . $table_prefix . "forums_auth_reply],
CONSTRAINT [DF_" . $table_prefix . "forums_auth_edit],
CONSTRAINT [DF_" . $table_prefix . "forums_auth_delete],
CONSTRAINT [DF_" . $table_prefix . "forums_auth_sticky],
CONSTRAINT [DF_" . $table_prefix . "forums_auth_announce],
CONSTRAINT [DF_" . $table_prefix . "forums_auth_vote],
CONSTRAINT [DF_" . $table_prefix . "forums_auth_pollcreate],
CONSTRAINT [DF_" . $table_prefix . "forums_auth_attachments]";
$sql[] = "CREATE TABLE Tmp_" . FORUMS_TABLE . "
(forum_id int NOT NULL, cat_id int NOT NULL, forum_name varchar(100) NOT NULL, forum_desc varchar(255) NULL, forum_status smallint NOT NULL, forum_order int NOT NULL, forum_posts int NOT NULL, forum_topics smallint NOT NULL, forum_last_post_id int NOT NULL, prune_next int NULL, prune_enable smallint NOT NULL, auth_view smallint NOT NULL, auth_read smallint NOT NULL, auth_post smallint NOT NULL, auth_reply smallint NOT NULL, auth_edit smallint NOT NULL, auth_delete smallint NOT NULL, auth_sticky smallint NOT NULL, auth_announce smallint NOT NULL, auth_vote smallint NOT NULL, auth_pollcreate smallint NOT NULL, auth_attachments smallint NOT NULL) ON [PRIMARY]";
$sql[] = "ALTER TABLE [Tmp_" . FORUMS_TABLE . "] WITH NOCHECK ADD
CONSTRAINT [DF_" . $table_prefix . "forums_forum_posts] DEFAULT (0) FOR [forum_posts],
CONSTRAINT [DF_" . $table_prefix . "forums_forum_topics] DEFAULT (0) FOR [forum_topics],
CONSTRAINT [DF_" . $table_prefix . "forums_forum_last_post_id] DEFAULT (0) FOR [forum_last_post_id],
CONSTRAINT [DF_" . $table_prefix . "forums_prune_enable] DEFAULT (0) FOR [prune_enable],
CONSTRAINT [DF_" . $table_prefix . "forums_auth_view] DEFAULT (0) FOR [auth_view],
CONSTRAINT [DF_" . $table_prefix . "forums_auth_read] DEFAULT (0) FOR [auth_read],
CONSTRAINT [DF_" . $table_prefix . "forums_auth_post] DEFAULT (0) FOR [auth_post],
CONSTRAINT [DF_" . $table_prefix . "forums_auth_reply] DEFAULT (0) FOR [auth_reply],
CONSTRAINT [DF_" . $table_prefix . "forums_auth_edit] DEFAULT (0) FOR [auth_edit],
CONSTRAINT [DF_" . $table_prefix . "forums_auth_delete] DEFAULT (0) FOR [auth_delete],
CONSTRAINT [DF_" . $table_prefix . "forums_auth_sticky] DEFAULT (0) FOR [auth_sticky],
CONSTRAINT [DF_" . $table_prefix . "forums_auth_announce] DEFAULT (0) FOR [auth_announce],
CONSTRAINT [DF_" . $table_prefix . "forums_auth_vote] DEFAULT (0) FOR [auth_vote],
CONSTRAINT [DF_" . $table_prefix . "forums_auth_pollcreate] DEFAULT (0) FOR [auth_pollcreate],
CONSTRAINT [DF_" . $table_prefix . "forums_auth_attachments] DEFAULT (0) FOR [auth_attachments]";
$sql[] = "INSERT INTO Tmp_" . FORUMS_TABLE . " (forum_id, cat_id, forum_name, forum_desc, forum_status, forum_order, forum_posts, forum_topics, forum_last_post_id, prune_next, prune_enable, auth_view, auth_read, auth_post, auth_reply, auth_edit, auth_delete, auth_sticky, auth_announce, auth_vote, auth_pollcreate, auth_attachments)
SELECT forum_id, cat_id, forum_name, forum_desc, forum_status, forum_order, forum_posts, forum_topics, forum_last_post_id, prune_next, prune_enable, auth_view, auth_read, auth_post, auth_reply, auth_edit, auth_delete, auth_sticky, auth_announce, auth_vote, auth_pollcreate, auth_attachments FROM " . FORUMS_TABLE . " TABLOCKX";
$sql[] = "DROP TABLE " . FORUMS_TABLE;
$sql[] = "EXECUTE sp_rename N'Tmp_" . FORUMS_TABLE . "', N'" . FORUMS_TABLE . "', 'OBJECT'";
$sql[] = "ALTER TABLE " . FORUMS_TABLE . " ADD
CONSTRAINT [PK_" . $table_prefix . "forums] PRIMARY KEY CLUSTERED (forum_id) ON [PRIMARY]";
$sql[] = "CREATE NONCLUSTERED INDEX [IX_" . $table_prefix . "forums]
ON " . FORUMS_TABLE . " (cat_id, forum_order, forum_last_post_id) ON [PRIMARY]";
/* --------------------------------------------------------------
END OF DROP FORUM -- don't remove anything after this point!
-------------------------------------------------------------- */
$sql[] = "DROP INDEX " . RANKS_TABLE . ".IX_" . $table_prefix . "ranks";
$sql[] = "ALTER TABLE " . RANKS_TABLE . " DROP
COLUMN rank_max";
$sql[] = "CREATE INDEX [IX_" . $table_prefix . "ranks]
ON [" . RANKS_TABLE . "]([rank_min], [rank_special]) ON [PRIMARY]";
$sql[] = "DROP INDEX " . TOPICS_TABLE . ".IX_" . $table_prefix . "topics";
$sql[] = "ALTER TABLE " . TOPICS_TABLE . " ADD
topic_first_post_id int NULL,
CONSTRAINT [DF_" . $table_prefix . "topics_topic_first_post_id] FOR [topic_first_post_id]";
$sql[] = "CREATE INDEX [IX_" . $table_prefix . "topics]
ON [" . TOPICS_TABLE . "]([forum_id], [topic_type], [topic_first_post_id], [topic_last_post_id]) ON [PRIMARY]";
$sql[] = "ALTER TABLE " . SEARCH_WORD_TABLE . " DROP
CONSTRAINT [PK_" . $table_prefix . "search_wordlist]";
$sql[] = "CREATE UNIQUE INDEX [IX_" . $table_prefix . "search_wordlist]
ON [" . SEARCH_WORD_TABLE . "]([word_text]) WITH IGNORE_DUP_KEY ON [PRIMARY]";
$sql[] = "CREATE INDEX [IX_" . $table_prefix . "search_wordlist_1]
ON [" . SEARCH_WORD_TABLE . "]([word_common]) ON [PRIMARY]";
$sql[] = "CREATE INDEX [IX_" . $table_prefix . "search_wordmatch_1]
ON [" . SEARCH_MATCH_TABLE . "]([word_id]) ON [PRIMARY]";
$sql[] = "ALTER TABLE " . THEMES_NAME_TABLE . " ADD
tr_class1_name varchar(50) NULL,
tr_class2_name varchar(50) NULL,
tr_class3_name varchar(50) NULL,
th_class1_name varchar(50) NULL,
th_class2_name varchar(50) NULL,
th_class3_name varchar(50) NULL,
td_class1_name varchar(50) NULL,
td_class2_name varchar(50) NULL,
td_class3_name varchar(50) NULL,
span_class1_name varchar(50) NULL,
span_class2_name varchar(50) NULL,
span_class3_name varchar(50) NULL";
break;
case 'msaccess':
$sql[] = "ALTER TABLE " . USERS_TABLE . " DROP
COLUMN user_autologin_key";
$sql[] = "ALTER TABLE " . USERS_TABLE . " ADD
user_session_time int NOT NULL,
user_session_page smallint NOT NULL";
$sql[] = "CREATE INDEX user_session_time
ON " . USERS_TABLE . " (user_session_time)";
$sql[] = "ALTER TABLE " . TOPICS_TABLE . " ADD
topic_first_post_id int NULL";
$sql[] = "CREATE INDEX topic_first_post_id
ON " . TOPICS_TABLE . " (topic_first_post_id)";
$sql[] = "ALTER TABLE " . THEMES_NAME_TABLE . " ADD
tr_class1_name varchar(50) NULL,
tr_class2_name varchar(50) NULL,
tr_class3_name varchar(50) NULL,
th_class1_name varchar(50) NULL,
th_class2_name varchar(50) NULL,
th_class3_name varchar(50) NULL,
td_class1_name varchar(50) NULL,
td_class2_name varchar(50) NULL,
td_class3_name varchar(50) NULL,
span_class1_name varchar(50) NULL,
span_class2_name varchar(50) NULL,
span_class3_name varchar(50) NULL";
break;
default:
die("No DB LAYER found!");
break;
}
case 'RC-3':
case 'RC-4':
case '.0.0':
switch (SQL_LAYER)
{
case 'mysql':
case 'mysql4':
$sql[] = "ALTER TABLE " . USERS_TABLE . "
MODIFY COLUMN user_id mediumint(8) NOT NULL,
MODIFY COLUMN user_timezone decimal(5,2) DEFAULT '0' NOT NULL";
break;
case 'postgresql':
$sql[] = "ALTER TABLE " . USERS_TABLE . "
RENAME COLUMN user_timezone TO user_timezone_old";
$sql[] = "ALTER TABLE " . USERS_TABLE . "
ADD COLUMN user_timezone decimal(5)";
break;
case 'mssql':
case 'mssql-odbc':
$sql[] = "ALTER TABLE " . USERS_TABLE . "
ALTER COLUMN [user_timezone] [decimal] (5,2) NOT NULL";
break;
}
case '.0.1':
switch (SQL_LAYER)
{
case 'mysql':
case 'mysql4':
$sql[] = "ALTER TABLE " . GROUPS_TABLE . "
MODIFY COLUMN group_id mediumint(8) NOT NULL auto_increment";
break;
case 'mssql':
case 'mssql-odbc':
/* ---------------------------------------------------------------------
DROP GROUP TABLE -- if this may cause you problems you can safely
comment it out, remember to manually add the IDENTITY setting on
the group_id column
--------------------------------------------------------------------- */
$sql[] = "CREATE TABLE Tmp_" . GROUPS_TABLE . "
(group_id int IDENTITY (1, 1) NOT NULL, group_type smallint NULL, group_name varchar(50) NOT NULL, group_description varchar(255) NOT NULL, group_moderator int NULL, group_single_user smallint NOT NULL) ON [PRIMARY]";
$sql[] = "SET IDENTITY_INSERT " . GROUPS_TABLE . " ON";
$sql[] = "INSERT INTO Tmp_" . GROUPS_TABLE . " (group_id, group_type, group_name, group_description, group_moderator, group_single_user)
SELECT group_id, group_type, group_name, group_description, group_moderator, group_single_user FROM " . GROUPS_TABLE . " TABLOCKX";
$sql[] = "SET IDENTITY_INSERT " . GROUPS_TABLE . " OFF";
$sql[] = "DROP TABLE " . GROUPS_TABLE;
$sql[] = "EXECUTE sp_rename N'Tmp_" . GROUPS_TABLE . "', N'" . GROUPS_TABLE . "', 'OBJECT'";
$sql[] = "ALTER TABLE " . GROUPS_TABLE . " ADD
CONSTRAINT [PK_" . $table_prefix . "groups] PRIMARY KEY CLUSTERED (group_id) ON [PRIMARY]";
$sql[] = "CREATE INDEX [IX_" . $table_prefix . "groups]
ON " . GROUPS_TABLE . " (group_single_user) ON [PRIMARY]";
/* --------------------------------------------------------------
END OF DROP GROUP -- don't remove anything after this point!
-------------------------------------------------------------- */
break;
}
case '.0.3':
switch (SQL_LAYER)
{
case 'mysql':
case 'mysql4':
// Add indexes to post_id in search match table (+ word_id for MS Access)
$sql[] = "ALTER TABLE " . SEARCH_MATCH_TABLE . "
ADD INDEX post_id (post_id)";
// Modify user_timezone to decimal(5,2) for mysql ... mysql4/mssql/pgsql/msaccess
// should be completely unaffected
// Change default user_notify to 0
$sql[] = "ALTER TABLE " . USERS_TABLE . "
MODIFY COLUMN user_timezone decimal(5,2) DEFAULT '0' NOT NULL,
MODIFY COLUMN user_notify tinyint(1) DEFAULT '0' NOT NULL";
// Adjust field type for prune_days, prune_freq ... was too small
$sql[] = "ALTER TABLE " . PRUNE_TABLE . "
MODIFY COLUMN prune_days smallint(5) UNSIGNED NOT NULL,
MODIFY COLUMN prune_freq smallint(5) UNSIGNED NOT NULL";
break;
case 'msaccess':
// Add indexes to post_id in search match table (+ word_id for MS Access)
$sql[] = "CREATE INDEX " . SEARCH_MATCH_TABLE . "
ON " . SEARCH_MATCH_TABLE . " ([post_id])";
$sql[] = "CREATE INDEX " . SEARCH_MATCH_TABLE . "_1
ON " . SEARCH_MATCH_TABLE . " ([word_id])";
break;
case 'postgresql':
// Add indexes to post_id in search match table (+ word_id for MS Access)
$sql[] = "CREATE INDEX post_id_" . SEARCH_MATCH_TABLE . "
ON " . SEARCH_MATCH_TABLE . " (post_id)";
// Regenerate groups table with incremented group_id for pgsql
// ... missing in 2.0.3 ...
$sql[] = "CREATE SEQUENCE " . GROUPS_TABLE . "_id_seq start 3 increment 1 maxvalue 2147483647 minvalue 1 cache 1";
$sql[] = "CREATE TABLE tmp_" . GROUPS_TABLE . "
AS SELECT group_id, group_name, group_type, group_description, group_moderator, group_single_user
FROM " . GROUPS_TABLE;
$sql[] = "DROP TABLE " . GROUPS_TABLE;
$sql[] = "CREATE TABLE phpbb_groups (group_id int DEFAULT nextval('" . GROUPS_TABLE . "_id_seq'::text) NOT NULL, group_name varchar(40) NOT NULL, group_type int2 DEFAULT '1' NOT NULL, group_description varchar(255) NOT NULL, group_moderator int4 DEFAULT '0' NOT NULL, group_single_user int2 DEFAULT '0' NOT NULL, CONSTRAINT phpbb_groups_pkey PRIMARY KEY (group_id))";
$sql[] = "INSERT INTO " . GROUPS_TABLE . " (group_id, group_name, group_type, group_description, group_moderator, group_single_user)
SELECT group_id, group_name, group_type, group_description, group_moderator, group_single_user
FROM tmp_" . GROUPS_TABLE;
$sql[] = "DROP TABLE tmp_" . GROUPS_TABLE;
break;
}
case '.0.4':
switch (SQL_LAYER)
{
case 'mssql':
case 'mssql-odbc':
// Add missing defaults to MSSQL post table schema, failed in previous updates
$sql[] = "ALTER TABLE [" . POSTS_TABLE . "] WITH NOCHECK ADD
CONSTRAINT [DF_" . POSTS_TABLE . "_enable_bbcode] DEFAULT (1) FOR [enable_bbcode],
CONSTRAINT [DF_" . POSTS_TABLE . "_enable_html] DEFAULT (0) FOR [enable_html],
CONSTRAINT [DF_" . POSTS_TABLE . "_enable_smilies] DEFAULT (1) FOR [enable_smilies],
CONSTRAINT [DF_" . POSTS_TABLE . "_enable_sig] DEFAULT (1) FOR [enable_sig],
CONSTRAINT [DF_" . POSTS_TABLE . "_post_edit_count] DEFAULT (0) FOR [post_edit_count]";
break;
}
// Add tables for visual confirmation ... saves me the trouble of writing a seperate
// script :D
switch (SQL_LAYER)
{
case 'mysql':
case 'mysql4':
$sql[] = 'CREATE TABLE ' . $table_prefix . 'confirm (confirm_id char(32) DEFAULT \'\' NOT NULL, session_id char(32) DEFAULT \'\' NOT NULL, code char(6) DEFAULT \'\' NOT NULL, PRIMARY KEY (session_id, confirm_id))';
break;
case 'mssql':
case 'mssql-odbc':
$sql[] = 'CREATE TABLE [' . $table_prefix . 'confirm] ([confirm_id] [char] (32) NOT NULL , [session_id] [char] (32) NOT NULL , [code] [char] (6) NOT NULL ) ON [PRIMARY]';
$sql[] = 'ALTER TABLE [' . $table_prefix . 'confirm] WITH NOCHECK ADD CONSTRAINT [PK_' . $table_prefix . 'confirm] PRIMARY KEY CLUSTERED ( [session_id],[confirm_id]) ON [PRIMARY]';
$sql[] = 'ALTER TABLE [' . $table_prefix . 'confirm] WITH NOCHECK ADD CONSTRAINT [DF_' . $table_prefix . 'confirm_confirm_id] DEFAULT (\'\') FOR [confirm_id], CONSTRAINT [DF_' . $table_prefix . 'confirm_session_id] DEFAULT (\'\') FOR [session_id], CONSTRAINT [DF_' . $table_prefix . 'confirm_code] DEFAULT (\'\') FOR [code]';
break;
case 'msaccess':
$sql[] = 'CREATE TABLE ' . $table_prefix . 'confirm (confirm_id char(32) NOT NULL, session_id char(32) NOT NULL, code char(6) NOT NULL)';
$sql[] = 'ALTER TABLE ' . $table_prefix . 'confirm ADD (PRIMARY KEY (session_id, confirm_id))';
break;
case 'postgresql':
$sql[] = 'CREATE TABLE ' . $table_prefix . 'confirm (confirm_id char(32) DEFAULT \'\' NOT NULL, session_id char(32) DEFAULT \'\' NOT NULL, code char(6) DEFAULT \'\' NOT NULL, CONSTRAINT phpbb_confirm_pkey PRIMARY KEY (session_id, confirm_id))';
break;
}
break;
}
echo "<h2>Updating database schema</h2>\n";
echo "<p>Progress :: <b>";
flush();
$error_ary = array();
$errored = false;
if (count($sql))
{
for ($i = 0; $i < count($sql); $i++)
{
_sql($sql[$i], $errored, $error_ary);
}
echo "</b> <b class=\"ok\">Done</b><br />Result &nbsp; :: \n";
if ($errored)
{
echo " <b>Some queries failed, the statements and errors are listing below</b>\n<ul>";
for ($i = 0; $i < count($error_ary['sql']); $i++)
{
echo "<li>Error :: <b>" . $error_ary['error_code'][$i]['message'] . "</b><br />";
echo "SQL &nbsp; :: <b>" . $error_ary['sql'][$i] . "</b><br /><br /></li>";
}
echo "</ul>\n<p>This is probably nothing to worry about, update will continue. Should this fail to complete you may need to seek help at our development board. See <a href=\"docs\README.html\">README</a> for details on how to obtain advice.</p>\n";
}
else
{
echo "<b>No errors</b>\n";
}
}
else
{
echo " No updates required</b></p>\n";
}
//
// Data updates
//
unset($sql);
$error_ary = array();
$errored = false;
echo "<h2>Updating data</h2>\n";
echo "<p>Progress :: <b>";
flush();
switch ($row['config_value'])
{
case '':
$sql = "SELECT themes_id
FROM " . THEMES_TABLE . "
WHERE template_name = 'subSilver'";
$result = _sql($sql, $errored, $error_ary);
if ($row = $db->sql_fetchrow($result))
{
$theme_id = $row['themes_id'];
$sql = "UPDATE " . THEMES_TABLE . "
SET head_stylesheet = 'subSilver.css', body_background = '', body_bgcolor = 'E5E5E5', body_text = '000000', body_link = '006699', body_vlink = '5493B4', body_alink = '', body_hlink = 'DD6900', tr_color1 = 'EFEFEF', tr_color2 = 'DEE3E7', tr_color3 = 'D1D7DC', tr_class1 = '', tr_class2 = '', tr_class3 = '', th_color1 = '98AAB1', th_color2 = '006699', th_color3 = 'FFFFFF', th_class1 = 'cellpic1.gif', th_class2 = 'cellpic3.gif', th_class3 = 'cellpic2.jpg', td_color1 = 'FAFAFA', td_color2 = 'FFFFFF', td_color3 = '', td_class1 = 'row1', td_class2 = 'row2', td_class3 = '', fontface1 = 'Verdana, Arial, Helvetica, sans-serif', fontface2 = 'Trebuchet MS', fontface3 = 'Courier, ''Courier New'', sans-serif', fontsize1 = 10, fontsize2 = 11, fontsize3 = 12, fontcolor1 = '444444', fontcolor2 = '006600', fontcolor3 = 'FFA34F', span_class1 = '', span_class2 = '', span_class3 = ''
WHERE themes_id = $theme_id";
_sql($sql, $errored, $error_ary);
$sql = "DELETE FROM " . THEMES_NAME_TABLE . "
WHERE themes_id = $theme_id";
_sql($sql, $errored, $error_ary);
$sql = "INSERT INTO " . THEMES_NAME_TABLE . " (themes_id, tr_color1_name, tr_color2_name, tr_color3_name, tr_class1_name, tr_class2_name, tr_class3_name, th_color1_name, th_color2_name, th_color3_name, th_class1_name, th_class2_name, th_class3_name, td_color1_name, td_color2_name, td_color3_name, td_class1_name, td_class2_name, td_class3_name, fontface1_name, fontface2_name, fontface3_name, fontsize1_name, fontsize2_name, fontsize3_name, fontcolor1_name, fontcolor2_name, fontcolor3_name, span_class1_name, span_class2_name, span_class3_name)
VALUES ($theme_id, 'The lightest row colour', 'The medium row color', 'The darkest row colour', '', '', '', 'Border round the whole page', 'Outer table border', 'Inner table border', 'Silver gradient picture', 'Blue gradient picture', 'Fade-out gradient on index', 'Background for quote boxes', 'All white areas', '', 'Background for topic posts', '2nd background for topic posts', '', 'Main fonts', 'Additional topic title font', 'Form fonts', 'Smallest font size', 'Medium font size', 'Normal font size (post body etc)', 'Quote & copyright text', 'Code text colour', 'Main table header text colour', '', '', '')";
_sql($sql, $errored, $error_ary);
}
$db->sql_freeresult($result);
$sql = "SELECT MIN(post_id) AS first_post_id, topic_id
FROM " . POSTS_TABLE . "
GROUP BY topic_id
ORDER BY topic_id ASC";
$result = _sql($sql, $errored, $error_ary);
if ($row = $db->sql_fetchrow($result))
{
do
{
$sql = "UPDATE " . TOPICS_TABLE . "
SET topic_first_post_id = " . $row['first_post_id'] . "
WHERE topic_id = " . $row['topic_id'];
_sql($sql, $errored, $error_ary);
}
while ($row = $db->sql_fetchrow($result));
}
$db->sql_freeresult($result);
$sql = "SELECT DISTINCT u.user_id
FROM " . USERS_TABLE . " u, " . USER_GROUP_TABLE . " ug, " . AUTH_ACCESS_TABLE . " aa
WHERE aa.auth_mod = 1
AND ug.group_id = aa.group_id
AND u.user_id = ug.user_id
AND u.user_level <> " . ADMIN;
$result = _sql($sql, $errored, $error_ary);
$mod_user = array();
while ($row = $db->sql_fetchrow($result))
{
$mod_user[] = $row['user_id'];
}
$db->sql_freeresult($result);
if (count($mod_user))
{
$sql = "UPDATE " . USERS_TABLE . "
SET user_level = " . MOD . "
WHERE user_id IN (" . implode(', ', $mod_user) . ")";
_sql($sql, $errored, $error_ary);
}
$sql = "INSERT INTO " . CONFIG_TABLE . " (config_name, config_value)
VALUES ('server_name', 'www.myserver.tld')";
_sql($sql, $errored, $error_ary);
$sql = "INSERT INTO " . CONFIG_TABLE . " (config_name, config_value)
VALUES ('script_path', '/phpBB2/')";
_sql($sql, $errored, $error_ary);
$sql = "INSERT INTO " . CONFIG_TABLE . " (config_name, config_value)
VALUES ('server_port', '80')";
_sql($sql, $errored, $error_ary);
$sql = "INSERT INTO " . CONFIG_TABLE . " (config_name, config_value)
VALUES ('record_online_users', '1')";
_sql($sql, $errored, $error_ary);
$sql = "INSERT INTO " . CONFIG_TABLE . " (config_name, config_value)
VALUES ('record_online_date', '" . time() . "')";
_sql($sql, $errored, $error_ary);
case 'RC-3':
case 'RC-4':
case '.0.0':
case '.0.1':
if (SQL_LAYER == 'postgresql')
{
$sql = "SELECT user_id, user_timezone_old
FROM " . USERS_TABLE;
$result = _sql($sql, $errored, $error_ary);
while ($row = $db->sql_fetchrow($result))
{
$sql = "UPDATE " . USERS_TABLE . "
SET user_timezone = " . $row['user_timezone_old'] . "
WHERE user_id = " . $row['user_id'];
_sql($sql, $errored, $error_ary);
}
$db->sql_freeresult($result);
}
$sql = "SELECT topic_id, topic_moved_id
FROM " . TOPICS_TABLE . "
WHERE topic_moved_id <> 0
AND topic_status = " . TOPIC_MOVED;
$result = _sql($sql, $errored, $error_ary);
$topic_ary = array();
while ($row = $db->sql_fetchrow($result))
{
$topic_ary[$row['topic_id']] = $row['topic_moved_id'];
}
$db->sql_freeresult($result);
while (list($topic_id, $topic_moved_id) = each($topic_ary))
{
$sql = "SELECT MAX(post_id) AS last_post, MIN(post_id) AS first_post, COUNT(post_id) AS total_posts
FROM " . POSTS_TABLE . "
WHERE topic_id = $topic_moved_id";
$result = _sql($sql, $errored, $error_ary);
$sql = ($row = $db->sql_fetchrow($result)) ? "UPDATE " . TOPICS_TABLE . " SET topic_replies = " . ($row['total_posts'] - 1) . ", topic_first_post_id = " . $row['first_post'] . ", topic_last_post_id = " . $row['last_post'] . " WHERE topic_id = $topic_id" : "DELETE FROM " . TOPICS_TABLE . " WHERE topic_id = " . $row['topic_id'];
_sql($sql, $errored, $error_ary);
}
unset($sql);
sync('all forums');
case '.0.2':
case '.0.3':
// Topics will resync automatically
// Remove stop words from search match and search words
$dirname = 'language';
$dir = opendir($phpbb_root_path . $dirname);
while ($file = readdir($dir))
{
if (preg_match("#^lang_#i", $file) && !is_file($phpbb_root_path . $dirname . "/" . $file) && !is_link($phpbb_root_path . $dirname . "/" . $file) && file_exists($phpbb_root_path . $dirname . "/" . $file . '/search_stopwords.txt'))
{
$stopword_list = trim(preg_replace('#([\w\.\-_\+\'<27><>-<2D>\\\]+?)[ \n\r]*?(,|$)#', '\'\1\'\2', str_replace("'", "\'", implode(', ', file($phpbb_root_path . $dirname . "/" . $file . '/search_stopwords.txt')))));
$sql = "SELECT word_id
FROM " . SEARCH_WORD_TABLE . "
WHERE word_text IN ($stopword_list)";
$result = _sql($sql, $errored, $error_ary);
$word_id_sql = '';
if ($row = $db->sql_fetchrow($result))
{
do
{
$word_id_sql .= (($word_id_sql != '') ? ', ' : '') . $row['word_id'];
}
while ($row = $db->sql_fetchrow($result));
$sql = "DELETE FROM " . SEARCH_WORD_TABLE . "
WHERE word_id IN ($word_id_sql)";
_sql($sql, $errored, $error_ary);
$sql = "DELETE FROM " . SEARCH_MATCH_TABLE . "
WHERE word_id IN ($word_id_sql)";
_sql($sql, $errored, $error_ary);
}
$db->sql_freeresult($result);
}
}
closedir($dir);
// Mark common words ...
remove_common('global', 4/10);
// remove superfluous polls ... grab polls with topics then delete polls
// not in that list
$sql = "SELECT v.vote_id
FROM " . TOPICS_TABLE . " t, " . VOTE_DESC_TABLE . " v
WHERE v.topic_id = t.topic_id";
$result = _sql($sql, $errored, $error_ary);
$vote_id_sql = '';
if ($row = $db->sql_fetchrow($result))
{
do
{
$vote_id_sql .= (($vote_id_sql != '') ? ', ' : '') . $row['vote_id'];
}
while ($row = $db->sql_fetchrow($result));
$sql = "DELETE FROM " . VOTE_DESC_TABLE . "
WHERE vote_id NOT IN ($vote_id_sql)";
_sql($sql, $errored, $error_ary);
$sql = "DELETE FROM " . VOTE_RESULTS_TABLE . "
WHERE vote_id NOT IN ($vote_id_sql)";
_sql($sql, $errored, $error_ary);
$sql = "DELETE FROM " . VOTE_USERS_TABLE . "
WHERE vote_id NOT IN ($vote_id_sql)";
_sql($sql, $errored, $error_ary);
}
$db->sql_freeresult($result);
// update pm counters
$sql = "SELECT privmsgs_to_userid, COUNT(privmsgs_id) AS unread_count
FROM " . PRIVMSGS_TABLE . "
WHERE privmsgs_type = " . PRIVMSGS_UNREAD_MAIL . "
GROUP BY privmsgs_to_userid";
$result = _sql($sql, $errored, $error_ary);
if ($row = $db->sql_fetchrow($result))
{
$update_users = array();
do
{
$update_users[$row['unread_count']][] = $row['privmsgs_to_userid'];
}
while ($row = $db->sql_fetchrow($result));
while (list($num, $user_ary) = each($update_users))
{
$user_ids = implode(', ', $user_ary);
$sql = "UPDATE " . USERS_TABLE . "
SET user_unread_privmsg = $num
WHERE user_id IN ($user_ids)";
_sql($sql, $errored, $error_ary);
}
unset($update_list);
}
$db->sql_freeresult($result);
$sql = "SELECT privmsgs_to_userid, COUNT(privmsgs_id) AS new_count
FROM " . PRIVMSGS_TABLE . "
WHERE privmsgs_type = " . PRIVMSGS_NEW_MAIL . "
GROUP BY privmsgs_to_userid";
$result = _sql($sql, $errored, $error_ary);
if ($row = $db->sql_fetchrow($result))
{
$update_users = array();
do
{
$update_users[$row['new_count']][] = $row['privmsgs_to_userid'];
}
while ($row = $db->sql_fetchrow($result));
while (list($num, $user_ary) = each($update_users))
{
$user_ids = implode(', ', $user_ary);
$sql = "UPDATE " . USERS_TABLE . "
SET user_new_privmsg = $num
WHERE user_id IN ($user_ids)";
_sql($sql, $errored, $error_ary);
}
unset($update_list);
}
$db->sql_freeresult($result);
// Remove superfluous watched topics
$sql = "SELECT t.topic_id
FROM " . TOPICS_TABLE . " t, " . TOPICS_WATCH_TABLE . " w
WHERE w.topic_id = t.topic_id";
$result = _sql($sql, $errored, $error_ary);
$topic_id_sql = '';
if ($row = $db->sql_fetchrow($result))
{
do
{
$topic_id_sql .= (($topic_id_sql != '') ? ', ' : '') . $row['topic_id'];
}
while ($row = $db->sql_fetchrow($result));
$sql = "DELETE FROM " . TOPICS_WATCH_TABLE . "
WHERE topic_id NOT IN ($topic_id_sql)";
_sql($sql, $errored, $error_ary);
}
$db->sql_freeresult($result);
// Reset any email addresses which are non-compliant ... something
// not done in the upgrade script and thus which may affect some
// mysql users
switch (SQL_LAYER)
{
case 'mysql':
$sql = "UPDATE " . USERS_TABLE . "
SET user_email = ''
WHERE user_email NOT REGEXP '^[a-zA-Z0-9_\+\.\-]+@.*[a-zA-Z0-9_\-]+\.[a-zA-Z]{2,}$'";
_sql($sql, $errored, $error_ary);
}
case '.0.4':
// Add the confirmation code switch ... save time and trouble elsewhere
$sql = 'INSERT INTO ' . CONFIG_TABLE . " (config_name, config_value)
VALUES ('enable_confirm', '0')";
_sql($sql, $errored, $error_ary);
$sql = "INSERT INTO " . CONFIG_TABLE . " (config_name, config_value)
VALUES ('sendmail_fix', '0')";
_sql($sql, $errored, $error_ary);
case '.0.5':
$sql = "SELECT user_id, username
FROM " . USERS_TABLE;
$result = _sql($sql, $errored, $error_ary);
while ($row = $db->sql_fetchrow($result))
{
if (!preg_match('#(&gt;)|(&lt;)|(&quot)|(&amp;)#', $row['username']))
{
if ($row['username'] != htmlspecialchars($row['username']))
{
$sql = "UPDATE " . USERS_TABLE . "
SET username = '" . str_replace("'", "''", htmlspecialchars($row['username'])) . "'
WHERE user_id = " . $row['user_id'];
_sql($sql, $errored, $error_ary);
}
}
}
$db->sql_freeresult($result);
break;
default:
echo " No updates where required</b></p>\n";
break;
}
echo "<h2>Updating version and optimizing tables</h2>\n";
echo "<p>Progress :: <b>";
flush();
// update the version
$sql = "UPDATE " . CONFIG_TABLE . "
SET config_value = '$updates_to_version'
WHERE config_name = 'version'";
_sql($sql, $errored, $error_ary);
// Optimize/vacuum analyze the tables where appropriate
// this should be done for each version in future along with
// the version number update
switch (SQL_LAYER)
{
case 'mysql':
case 'mysql4':
$sql = 'OPTIMIZE TABLE ' . $table_prefix . 'auth_access, ' . $table_prefix . 'banlist, ' . $table_prefix . 'categories, ' . $table_prefix . 'config, ' . $table_prefix . 'disallow, ' . $table_prefix . 'forum_prune, ' . $table_prefix . 'forums, ' . $table_prefix . 'groups, ' . $table_prefix . 'posts, ' . $table_prefix . 'posts_text, ' . $table_prefix . 'privmsgs, ' . $table_prefix . 'privmsgs_text, ' . $table_prefix . 'ranks, ' . $table_prefix . 'search_results, ' . $table_prefix . 'search_wordlist, ' . $table_prefix . 'search_wordmatch, ' . $table_prefix . 'smilies, ' . $table_prefix . 'themes, ' . $table_prefix . 'themes_name, ' . $table_prefix . 'topics, ' . $table_prefix . 'topics_watch, ' . $table_prefix . 'user_group, ' . $table_prefix . 'users, ' . $table_prefix . 'vote_desc, ' . $table_prefix . 'vote_results, ' . $table_prefix . 'vote_voters, ' . $table_prefix . 'words';
_sql($sql, $errored, $error_ary);
break;
case 'postgresql':
_sql("VACUUM ANALYZE", $errored, $error_ary);
break;
}
echo "</b> <b class=\"ok\">Done</b><br />Result &nbsp; :: \n";
if ($errored)
{
echo " <b>Some queries failed, the statements and errors are listing below</b>\n<ul>";
for ($i = 0; $i < count($error_ary['sql']); $i++)
{
echo "<li>Error :: <b>" . $error_ary['error_code'][$i]['message'] . "</b><br />";
echo "SQL &nbsp; :: <b>" . $error_ary['sql'][$i] . "</b><br /><br /></li>";
}
echo "</ul>\n<p>This is probably nothing to worry about, update will continue. Should this fail to complete you may need to seek help at our development board. See <a href=\"docs\README.html\">README</a> for details on how to obtain advice.</p>\n";
}
else
{
echo "<b>No errors</b>\n";
}
echo "<h2>Update completed</h2>\n";
echo "\n<p>You should now visit the General Configuration settings page in the <a href=\"../admin/\">Administration Panel</a> and check the General Configuration of the board. If you updated from versions prior to RC-3 you <b>must</b> update some entries. If you do not do this emails sent from the board will contain incorrect information. Don't forget to delete this file!</p>\n";
?>
<br clear="all" />
</body>
</html>

View File

@@ -1,963 +0,0 @@
<?php
/***************************************************************************
* update_to_xxx.php
* -------------------
* begin : Wednesday, May 16, 2002
* copyright : (C) 2001 The phpBB Group
* email : support@phpbb.com
*
* $Id$
*
***************************************************************************/
/***************************************************************************
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
***************************************************************************/
function _sql($sql, &$errored, &$error_ary, $echo_dot = true)
{
global $db;
if (!($result = $db->sql_query($sql)))
{
$errored = true;
$error_ary['sql'][] = (is_array($sql)) ? $sql[$i] : $sql;
$error_ary['error_code'][] = $db->sql_error();
}
if ($echo_dot)
{
echo ". \n";
flush();
}
return $result;
}
@set_time_limit(120);
define('IN_PHPBB', 1);
$phpbb_root_path = './../';
include($phpbb_root_path . 'extension.inc');
include($phpbb_root_path . 'config.'.$phpEx);
if(!isset($dbms))
{
die("Please read: <a href='../docs/INSTALL.html'>INSTALL.html</a> before attempting to update.");
}
include($phpbb_root_path . 'includes/constants.'.$phpEx);
include($phpbb_root_path . 'includes/functions.'.$phpEx);
include($phpbb_root_path . 'includes/functions_admin.'.$phpEx);
include($phpbb_root_path . 'includes/functions_search.'.$phpEx);
include($phpbb_root_path . 'includes/db.'.$phpEx);
//
//
//
$updates_to_version = ".0.8";
//
//
//
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;">
<meta http-equiv="Content-Style-Type" content="text/css">
<style type="text/css">
<!--
font,th,td,p,body { font-family: "Courier New", courier; font-size: 11pt }
a:link,a:active,a:visited { color : #006699; }
a:hover { text-decoration: underline; color : #DD6900;}
hr { height: 0px; border: solid #D1D7DC 0px; border-top-width: 1px;}
.maintitle,h1,h2 {font-weight: bold; font-size: 22px; font-family: "Trebuchet MS",Verdana, Arial, Helvetica, sans-serif; text-decoration: none; line-height : 120%; color : #000000;}
.ok {color:green}
/* Import the fancy styles for IE only (NS4.x doesn't use the @import function) */
@import url("../templates/subSilver/formIE.css");
-->
</style>
</head>
<body bgcolor="#FFFFFF" text="#000000" link="#006699" vlink="#5584AA">
<table width="100%" border="0" cellspacing="0" cellpadding="10" align="center">
<tr>
<td><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><img src="../templates/subSilver/images/logo_phpBB.gif" border="0" alt="Forum Home" vspace="1" /></td>
<td align="center" width="100%" valign="middle"><span class="maintitle">Updating to latest stable release</span></td>
</tr>
</table></td>
</tr>
</table>
<br clear="all" />
<h2>Information</h2>
<?php
echo '<p>Database type &nbsp; &nbsp;:: <b>' . SQL_LAYER . '</b><br />';
$sql = "SELECT config_value
FROM " . CONFIG_TABLE . "
WHERE config_name = 'version'";
if (!($result = $db->sql_query($sql)))
{
die("Couldn't obtain version info");
}
$row = $db->sql_fetchrow($result);
$sql = array();
switch ($row['config_value'])
{
case '':
echo 'Previous version :: <b>&lt; RC-3</b></p><br />';
break;
case 'RC-3':
echo 'Previous version :: <b>RC-3</b></p><br />';
break;
case 'RC-4':
echo 'Previous version :: <b>RC-4</b></p><br />';
break;
default:
echo 'Previous version :: <b>2' . $row['config_value'] . '</b><br />';
break;
}
echo 'Updated version &nbsp;:: <b>2' . $updates_to_version . '</b></p>' ."\n";
//
// Schema updates
//
switch ($row['config_value'])
{
case '':
switch (SQL_LAYER)
{
case 'mysql':
case 'mysql4':
$sql[] = "ALTER TABLE " . USERS_TABLE . " DROP
COLUMN user_autologin_key";
$sql[] = "ALTER TABLE " . RANKS_TABLE . " DROP
COLUMN rank_max";
$sql[] = "ALTER TABLE " . USERS_TABLE . "
ADD COLUMN user_session_time int(11) DEFAULT '0' NOT NULL,
ADD COLUMN user_session_page smallint(5) DEFAULT '0' NOT NULL,
ADD INDEX (user_session_time)";
$sql[] = "ALTER TABLE " . SEARCH_TABLE . "
MODIFY search_id int(11) NOT NULL";
$sql[] = "ALTER TABLE " . TOPICS_TABLE . "
MODIFY topic_moved_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL,
ADD COLUMN topic_first_post_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL,
ADD INDEX (topic_first_post_id)";
$sql[] = "ALTER TABLE " . THEMES_NAME_TABLE . "
ADD COLUMN tr_class1_name varchar(50) NULL,
ADD COLUMN tr_class2_name varchar(50) NULL,
ADD COLUMN tr_class3_name varchar(50) NULL,
ADD COLUMN th_class1_name varchar(50) NULL,
ADD COLUMN th_class2_name varchar(50) NULL,
ADD COLUMN th_class3_name varchar(50) NULL,
ADD COLUMN td_class1_name varchar(50) NULL,
ADD COLUMN td_class2_name varchar(50) NULL,
ADD COLUMN td_class3_name varchar(50) NULL,
ADD COLUMN span_class1_name varchar(50) NULL,
ADD COLUMN span_class2_name varchar(50) NULL,
ADD COLUMN span_class3_name varchar(50) NULL";
break;
case 'postgresql':
$sql[] = "ALTER TABLE " . USERS_TABLE . "
ADD COLUMN user_session_time int4";
$sql[] = "ALTER TABLE " . USERS_TABLE . "
ADD COLUMN user_session_page int2";
$sql[] = "ALTER TABLE " . USERS_TABLE . "
ALTER COLUMN user_session_time SET DEFAULT '0'";
$sql[] = "ALTER TABLE " . USERS_TABLE . "
ALTER COLUMN user_session_page SET DEFAULT '0'";
$sql[] = "CREATE INDEX user_session_time_" . $table_prefix . "users_index
ON " . USERS_TABLE . " (user_session_time)";
$sql[] = "ALTER TABLE " . TOPICS_TABLE . "
ADD COLUMN topic_first_post_id int4";
$sql[] = "CREATE INDEX topic_first_post_id_" . $table_prefix . "topics_index
ON " . TOPICS_TABLE . " (topic_first_post_id)";
$sql[] = "ALTER TABLE " . THEMES_NAME_TABLE . "
ADD COLUMN tr_class1_name varchar(50) NULL";
$sql[] = "ALTER TABLE " . THEMES_NAME_TABLE . "
ADD COLUMN tr_class2_name varchar(50) NULL";
$sql[] = "ALTER TABLE " . THEMES_NAME_TABLE . "
ADD COLUMN tr_class3_name varchar(50) NULL";
$sql[] = "ALTER TABLE " . THEMES_NAME_TABLE . "
ADD COLUMN th_class1_name varchar(50) NULL";
$sql[] = "ALTER TABLE " . THEMES_NAME_TABLE . "
ADD COLUMN th_class2_name varchar(50) NULL";
$sql[] = "ALTER TABLE " . THEMES_NAME_TABLE . "
ADD COLUMN th_class3_name varchar(50) NULL";
$sql[] = "ALTER TABLE " . THEMES_NAME_TABLE . "
ADD COLUMN td_class1_name varchar(50) NULL";
$sql[] = "ALTER TABLE " . THEMES_NAME_TABLE . "
ADD COLUMN td_class2_name varchar(50) NULL";
$sql[] = "ALTER TABLE " . THEMES_NAME_TABLE . "
ADD COLUMN td_class3_name varchar(50) NULL";
$sql[] = "ALTER TABLE " . THEMES_NAME_TABLE . "
ADD COLUMN span_class1_name varchar(50) NULL";
$sql[] = "ALTER TABLE " . THEMES_NAME_TABLE . "
ADD COLUMN span_class2_name varchar(50) NULL";
$sql[] = "ALTER TABLE " . THEMES_NAME_TABLE . "
ADD COLUMN span_class3_name varchar(50) NULL";
break;
case 'mssql-odbc':
case 'mssql':
$sql[] = "ALTER TABLE " . USERS_TABLE . " DROP
COLUMN user_autologin_key";
$sql[] = "ALTER TABLE " . USERS_TABLE . " ADD
user_session_time int NOT NULL,
user_session_page smallint NOT NULL,
CONSTRAINT [DF_" . $table_prefix . "users_user_session_time] DEFAULT (0) FOR [user_session_time],
CONSTRAINT [DF_" . $table_prefix . "users_user_session_page] DEFAULT (0) FOR [user_session_page]";
$sql[] = "CREATE INDEX [IX_" . $table_prefix . "users]
ON [" . USERS_TABLE . "]([user_session_time]) ON [PRIMARY]";
/* ---------------------------------------------------------------------
DROP FORUM TABLE -- if this may cause you problems you can safely
comment it out, remember to manually remove the IDENTITY setting on
the forum_id column
--------------------------------------------------------------------- */
$sql [] = "ALTER TABLE " . FORUMS_TABLE . " DROP
CONSTRAINT [DF_" . $table_prefix . "forums_forum_posts],
CONSTRAINT [DF_" . $table_prefix . "forums_forum_topics],
CONSTRAINT [DF_" . $table_prefix . "forums_forum_last_post_id],
CONSTRAINT [DF_" . $table_prefix . "forums_prune_enable],
CONSTRAINT [DF_" . $table_prefix . "forums_auth_view],
CONSTRAINT [DF_" . $table_prefix . "forums_auth_read],
CONSTRAINT [DF_" . $table_prefix . "forums_auth_post],
CONSTRAINT [DF_" . $table_prefix . "forums_auth_reply],
CONSTRAINT [DF_" . $table_prefix . "forums_auth_edit],
CONSTRAINT [DF_" . $table_prefix . "forums_auth_delete],
CONSTRAINT [DF_" . $table_prefix . "forums_auth_sticky],
CONSTRAINT [DF_" . $table_prefix . "forums_auth_announce],
CONSTRAINT [DF_" . $table_prefix . "forums_auth_vote],
CONSTRAINT [DF_" . $table_prefix . "forums_auth_pollcreate],
CONSTRAINT [DF_" . $table_prefix . "forums_auth_attachments]";
$sql[] = "CREATE TABLE Tmp_" . FORUMS_TABLE . "
(forum_id int NOT NULL, cat_id int NOT NULL, forum_name varchar(100) NOT NULL, forum_desc varchar(255) NULL, forum_status smallint NOT NULL, forum_order int NOT NULL, forum_posts int NOT NULL, forum_topics smallint NOT NULL, forum_last_post_id int NOT NULL, prune_next int NULL, prune_enable smallint NOT NULL, auth_view smallint NOT NULL, auth_read smallint NOT NULL, auth_post smallint NOT NULL, auth_reply smallint NOT NULL, auth_edit smallint NOT NULL, auth_delete smallint NOT NULL, auth_sticky smallint NOT NULL, auth_announce smallint NOT NULL, auth_vote smallint NOT NULL, auth_pollcreate smallint NOT NULL, auth_attachments smallint NOT NULL) ON [PRIMARY]";
$sql[] = "ALTER TABLE [Tmp_" . FORUMS_TABLE . "] WITH NOCHECK ADD
CONSTRAINT [DF_" . $table_prefix . "forums_forum_posts] DEFAULT (0) FOR [forum_posts],
CONSTRAINT [DF_" . $table_prefix . "forums_forum_topics] DEFAULT (0) FOR [forum_topics],
CONSTRAINT [DF_" . $table_prefix . "forums_forum_last_post_id] DEFAULT (0) FOR [forum_last_post_id],
CONSTRAINT [DF_" . $table_prefix . "forums_prune_enable] DEFAULT (0) FOR [prune_enable],
CONSTRAINT [DF_" . $table_prefix . "forums_auth_view] DEFAULT (0) FOR [auth_view],
CONSTRAINT [DF_" . $table_prefix . "forums_auth_read] DEFAULT (0) FOR [auth_read],
CONSTRAINT [DF_" . $table_prefix . "forums_auth_post] DEFAULT (0) FOR [auth_post],
CONSTRAINT [DF_" . $table_prefix . "forums_auth_reply] DEFAULT (0) FOR [auth_reply],
CONSTRAINT [DF_" . $table_prefix . "forums_auth_edit] DEFAULT (0) FOR [auth_edit],
CONSTRAINT [DF_" . $table_prefix . "forums_auth_delete] DEFAULT (0) FOR [auth_delete],
CONSTRAINT [DF_" . $table_prefix . "forums_auth_sticky] DEFAULT (0) FOR [auth_sticky],
CONSTRAINT [DF_" . $table_prefix . "forums_auth_announce] DEFAULT (0) FOR [auth_announce],
CONSTRAINT [DF_" . $table_prefix . "forums_auth_vote] DEFAULT (0) FOR [auth_vote],
CONSTRAINT [DF_" . $table_prefix . "forums_auth_pollcreate] DEFAULT (0) FOR [auth_pollcreate],
CONSTRAINT [DF_" . $table_prefix . "forums_auth_attachments] DEFAULT (0) FOR [auth_attachments]";
$sql[] = "INSERT INTO Tmp_" . FORUMS_TABLE . " (forum_id, cat_id, forum_name, forum_desc, forum_status, forum_order, forum_posts, forum_topics, forum_last_post_id, prune_next, prune_enable, auth_view, auth_read, auth_post, auth_reply, auth_edit, auth_delete, auth_sticky, auth_announce, auth_vote, auth_pollcreate, auth_attachments)
SELECT forum_id, cat_id, forum_name, forum_desc, forum_status, forum_order, forum_posts, forum_topics, forum_last_post_id, prune_next, prune_enable, auth_view, auth_read, auth_post, auth_reply, auth_edit, auth_delete, auth_sticky, auth_announce, auth_vote, auth_pollcreate, auth_attachments FROM " . FORUMS_TABLE . " TABLOCKX";
$sql[] = "DROP TABLE " . FORUMS_TABLE;
$sql[] = "EXECUTE sp_rename N'Tmp_" . FORUMS_TABLE . "', N'" . FORUMS_TABLE . "', 'OBJECT'";
$sql[] = "ALTER TABLE " . FORUMS_TABLE . " ADD
CONSTRAINT [PK_" . $table_prefix . "forums] PRIMARY KEY CLUSTERED (forum_id) ON [PRIMARY]";
$sql[] = "CREATE NONCLUSTERED INDEX [IX_" . $table_prefix . "forums]
ON " . FORUMS_TABLE . " (cat_id, forum_order, forum_last_post_id) ON [PRIMARY]";
/* --------------------------------------------------------------
END OF DROP FORUM -- don't remove anything after this point!
-------------------------------------------------------------- */
$sql[] = "DROP INDEX " . RANKS_TABLE . ".IX_" . $table_prefix . "ranks";
$sql[] = "ALTER TABLE " . RANKS_TABLE . " DROP
COLUMN rank_max";
$sql[] = "CREATE INDEX [IX_" . $table_prefix . "ranks]
ON [" . RANKS_TABLE . "]([rank_min], [rank_special]) ON [PRIMARY]";
$sql[] = "DROP INDEX " . TOPICS_TABLE . ".IX_" . $table_prefix . "topics";
$sql[] = "ALTER TABLE " . TOPICS_TABLE . " ADD
topic_first_post_id int NULL,
CONSTRAINT [DF_" . $table_prefix . "topics_topic_first_post_id] FOR [topic_first_post_id]";
$sql[] = "CREATE INDEX [IX_" . $table_prefix . "topics]
ON [" . TOPICS_TABLE . "]([forum_id], [topic_type], [topic_first_post_id], [topic_last_post_id]) ON [PRIMARY]";
$sql[] = "ALTER TABLE " . SEARCH_WORD_TABLE . " DROP
CONSTRAINT [PK_" . $table_prefix . "search_wordlist]";
$sql[] = "CREATE UNIQUE INDEX [IX_" . $table_prefix . "search_wordlist]
ON [" . SEARCH_WORD_TABLE . "]([word_text]) WITH IGNORE_DUP_KEY ON [PRIMARY]";
$sql[] = "CREATE INDEX [IX_" . $table_prefix . "search_wordlist_1]
ON [" . SEARCH_WORD_TABLE . "]([word_common]) ON [PRIMARY]";
$sql[] = "CREATE INDEX [IX_" . $table_prefix . "search_wordmatch_1]
ON [" . SEARCH_MATCH_TABLE . "]([word_id]) ON [PRIMARY]";
$sql[] = "ALTER TABLE " . THEMES_NAME_TABLE . " ADD
tr_class1_name varchar(50) NULL,
tr_class2_name varchar(50) NULL,
tr_class3_name varchar(50) NULL,
th_class1_name varchar(50) NULL,
th_class2_name varchar(50) NULL,
th_class3_name varchar(50) NULL,
td_class1_name varchar(50) NULL,
td_class2_name varchar(50) NULL,
td_class3_name varchar(50) NULL,
span_class1_name varchar(50) NULL,
span_class2_name varchar(50) NULL,
span_class3_name varchar(50) NULL";
break;
case 'msaccess':
$sql[] = "ALTER TABLE " . USERS_TABLE . " DROP
COLUMN user_autologin_key";
$sql[] = "ALTER TABLE " . USERS_TABLE . " ADD
user_session_time int NOT NULL,
user_session_page smallint NOT NULL";
$sql[] = "CREATE INDEX user_session_time
ON " . USERS_TABLE . " (user_session_time)";
$sql[] = "ALTER TABLE " . TOPICS_TABLE . " ADD
topic_first_post_id int NULL";
$sql[] = "CREATE INDEX topic_first_post_id
ON " . TOPICS_TABLE . " (topic_first_post_id)";
$sql[] = "ALTER TABLE " . THEMES_NAME_TABLE . " ADD
tr_class1_name varchar(50) NULL,
tr_class2_name varchar(50) NULL,
tr_class3_name varchar(50) NULL,
th_class1_name varchar(50) NULL,
th_class2_name varchar(50) NULL,
th_class3_name varchar(50) NULL,
td_class1_name varchar(50) NULL,
td_class2_name varchar(50) NULL,
td_class3_name varchar(50) NULL,
span_class1_name varchar(50) NULL,
span_class2_name varchar(50) NULL,
span_class3_name varchar(50) NULL";
break;
default:
die("No DB LAYER found!");
break;
}
case 'RC-3':
case 'RC-4':
case '.0.0':
switch (SQL_LAYER)
{
case 'mysql':
case 'mysql4':
$sql[] = "ALTER TABLE " . USERS_TABLE . "
MODIFY COLUMN user_id mediumint(8) NOT NULL,
MODIFY COLUMN user_timezone decimal(5,2) DEFAULT '0' NOT NULL";
break;
case 'postgresql':
$sql[] = "ALTER TABLE " . USERS_TABLE . "
RENAME COLUMN user_timezone TO user_timezone_old";
$sql[] = "ALTER TABLE " . USERS_TABLE . "
ADD COLUMN user_timezone decimal(5)";
break;
case 'mssql':
case 'mssql-odbc':
$sql[] = "ALTER TABLE " . USERS_TABLE . "
ALTER COLUMN [user_timezone] [decimal] (5,2) NOT NULL";
break;
}
case '.0.1':
switch (SQL_LAYER)
{
case 'mysql':
case 'mysql4':
$sql[] = "ALTER TABLE " . GROUPS_TABLE . "
MODIFY COLUMN group_id mediumint(8) NOT NULL auto_increment";
break;
case 'mssql':
case 'mssql-odbc':
/* ---------------------------------------------------------------------
DROP GROUP TABLE -- if this may cause you problems you can safely
comment it out, remember to manually add the IDENTITY setting on
the group_id column
--------------------------------------------------------------------- */
$sql[] = "CREATE TABLE Tmp_" . GROUPS_TABLE . "
(group_id int IDENTITY (1, 1) NOT NULL, group_type smallint NULL, group_name varchar(50) NOT NULL, group_description varchar(255) NOT NULL, group_moderator int NULL, group_single_user smallint NOT NULL) ON [PRIMARY]";
$sql[] = "SET IDENTITY_INSERT " . GROUPS_TABLE . " ON";
$sql[] = "INSERT INTO Tmp_" . GROUPS_TABLE . " (group_id, group_type, group_name, group_description, group_moderator, group_single_user)
SELECT group_id, group_type, group_name, group_description, group_moderator, group_single_user FROM " . GROUPS_TABLE . " TABLOCKX";
$sql[] = "SET IDENTITY_INSERT " . GROUPS_TABLE . " OFF";
$sql[] = "DROP TABLE " . GROUPS_TABLE;
$sql[] = "EXECUTE sp_rename N'Tmp_" . GROUPS_TABLE . "', N'" . GROUPS_TABLE . "', 'OBJECT'";
$sql[] = "ALTER TABLE " . GROUPS_TABLE . " ADD
CONSTRAINT [PK_" . $table_prefix . "groups] PRIMARY KEY CLUSTERED (group_id) ON [PRIMARY]";
$sql[] = "CREATE INDEX [IX_" . $table_prefix . "groups]
ON " . GROUPS_TABLE . " (group_single_user) ON [PRIMARY]";
/* --------------------------------------------------------------
END OF DROP GROUP -- don't remove anything after this point!
-------------------------------------------------------------- */
break;
}
case '.0.3':
switch (SQL_LAYER)
{
case 'mysql':
case 'mysql4':
// Add indexes to post_id in search match table (+ word_id for MS Access)
$sql[] = "ALTER TABLE " . SEARCH_MATCH_TABLE . "
ADD INDEX post_id (post_id)";
// Modify user_timezone to decimal(5,2) for mysql ... mysql4/mssql/pgsql/msaccess
// should be completely unaffected
// Change default user_notify to 0
$sql[] = "ALTER TABLE " . USERS_TABLE . "
MODIFY COLUMN user_timezone decimal(5,2) DEFAULT '0' NOT NULL,
MODIFY COLUMN user_notify tinyint(1) DEFAULT '0' NOT NULL";
// Adjust field type for prune_days, prune_freq ... was too small
$sql[] = "ALTER TABLE " . PRUNE_TABLE . "
MODIFY COLUMN prune_days smallint(5) UNSIGNED NOT NULL,
MODIFY COLUMN prune_freq smallint(5) UNSIGNED NOT NULL";
break;
case 'msaccess':
// Add indexes to post_id in search match table (+ word_id for MS Access)
$sql[] = "CREATE INDEX " . SEARCH_MATCH_TABLE . "
ON " . SEARCH_MATCH_TABLE . " ([post_id])";
$sql[] = "CREATE INDEX " . SEARCH_MATCH_TABLE . "_1
ON " . SEARCH_MATCH_TABLE . " ([word_id])";
break;
case 'postgresql':
// Add indexes to post_id in search match table (+ word_id for MS Access)
$sql[] = "CREATE INDEX post_id_" . SEARCH_MATCH_TABLE . "
ON " . SEARCH_MATCH_TABLE . " (post_id)";
// Regenerate groups table with incremented group_id for pgsql
// ... missing in 2.0.3 ...
$sql[] = "CREATE SEQUENCE " . GROUPS_TABLE . "_id_seq start 3 increment 1 maxvalue 2147483647 minvalue 1 cache 1";
$sql[] = "CREATE TABLE tmp_" . GROUPS_TABLE . "
AS SELECT group_id, group_name, group_type, group_description, group_moderator, group_single_user
FROM " . GROUPS_TABLE;
$sql[] = "DROP TABLE " . GROUPS_TABLE;
$sql[] = "CREATE TABLE phpbb_groups (group_id int DEFAULT nextval('" . GROUPS_TABLE . "_id_seq'::text) NOT NULL, group_name varchar(40) NOT NULL, group_type int2 DEFAULT '1' NOT NULL, group_description varchar(255) NOT NULL, group_moderator int4 DEFAULT '0' NOT NULL, group_single_user int2 DEFAULT '0' NOT NULL, CONSTRAINT phpbb_groups_pkey PRIMARY KEY (group_id))";
$sql[] = "INSERT INTO " . GROUPS_TABLE . " (group_id, group_name, group_type, group_description, group_moderator, group_single_user)
SELECT group_id, group_name, group_type, group_description, group_moderator, group_single_user
FROM tmp_" . GROUPS_TABLE;
$sql[] = "DROP TABLE tmp_" . GROUPS_TABLE;
break;
}
case '.0.4':
switch (SQL_LAYER)
{
case 'mssql':
case 'mssql-odbc':
// Add missing defaults to MSSQL post table schema, failed in previous updates
$sql[] = "ALTER TABLE [" . POSTS_TABLE . "] WITH NOCHECK ADD
CONSTRAINT [DF_" . POSTS_TABLE . "_enable_bbcode] DEFAULT (1) FOR [enable_bbcode],
CONSTRAINT [DF_" . POSTS_TABLE . "_enable_html] DEFAULT (0) FOR [enable_html],
CONSTRAINT [DF_" . POSTS_TABLE . "_enable_smilies] DEFAULT (1) FOR [enable_smilies],
CONSTRAINT [DF_" . POSTS_TABLE . "_enable_sig] DEFAULT (1) FOR [enable_sig],
CONSTRAINT [DF_" . POSTS_TABLE . "_post_edit_count] DEFAULT (0) FOR [post_edit_count]";
break;
}
// Add tables for visual confirmation ... saves me the trouble of writing a seperate
// script :D
switch (SQL_LAYER)
{
case 'mysql':
case 'mysql4':
$sql[] = 'CREATE TABLE ' . $table_prefix . 'confirm (confirm_id char(32) DEFAULT \'\' NOT NULL, session_id char(32) DEFAULT \'\' NOT NULL, code char(6) DEFAULT \'\' NOT NULL, PRIMARY KEY (session_id, confirm_id))';
break;
case 'mssql':
case 'mssql-odbc':
$sql[] = 'CREATE TABLE [' . $table_prefix . 'confirm] ([confirm_id] [char] (32) NOT NULL , [session_id] [char] (32) NOT NULL , [code] [char] (6) NOT NULL ) ON [PRIMARY]';
$sql[] = 'ALTER TABLE [' . $table_prefix . 'confirm] WITH NOCHECK ADD CONSTRAINT [PK_' . $table_prefix . 'confirm] PRIMARY KEY CLUSTERED ( [session_id],[confirm_id]) ON [PRIMARY]';
$sql[] = 'ALTER TABLE [' . $table_prefix . 'confirm] WITH NOCHECK ADD CONSTRAINT [DF_' . $table_prefix . 'confirm_confirm_id] DEFAULT (\'\') FOR [confirm_id], CONSTRAINT [DF_' . $table_prefix . 'confirm_session_id] DEFAULT (\'\') FOR [session_id], CONSTRAINT [DF_' . $table_prefix . 'confirm_code] DEFAULT (\'\') FOR [code]';
break;
case 'msaccess':
$sql[] = 'CREATE TABLE ' . $table_prefix . 'confirm (confirm_id char(32) NOT NULL, session_id char(32) NOT NULL, code char(6) NOT NULL)';
$sql[] = 'ALTER TABLE ' . $table_prefix . 'confirm ADD (PRIMARY KEY (session_id, confirm_id))';
break;
case 'postgresql':
$sql[] = 'CREATE TABLE ' . $table_prefix . 'confirm (confirm_id char(32) DEFAULT \'\' NOT NULL, session_id char(32) DEFAULT \'\' NOT NULL, code char(6) DEFAULT \'\' NOT NULL, CONSTRAINT phpbb_confirm_pkey PRIMARY KEY (session_id, confirm_id))';
break;
}
break;
}
echo "<h2>Updating database schema</h2>\n";
echo "<p>Progress :: <b>";
flush();
$error_ary = array();
$errored = false;
if (count($sql))
{
for ($i = 0; $i < count($sql); $i++)
{
_sql($sql[$i], $errored, $error_ary);
}
echo "</b> <b class=\"ok\">Done</b><br />Result &nbsp; :: \n";
if ($errored)
{
echo " <b>Some queries failed, the statements and errors are listing below</b>\n<ul>";
for ($i = 0; $i < count($error_ary['sql']); $i++)
{
echo "<li>Error :: <b>" . $error_ary['error_code'][$i]['message'] . "</b><br />";
echo "SQL &nbsp; :: <b>" . $error_ary['sql'][$i] . "</b><br /><br /></li>";
}
echo "</ul>\n<p>This is probably nothing to worry about, update will continue. Should this fail to complete you may need to seek help at our development board. See <a href=\"docs\README.html\">README</a> for details on how to obtain advice.</p>\n";
}
else
{
echo "<b>No errors</b>\n";
}
}
else
{
echo " No updates required</b></p>\n";
}
//
// Data updates
//
unset($sql);
$error_ary = array();
$errored = false;
echo "<h2>Updating data</h2>\n";
echo "<p>Progress :: <b>";
flush();
switch ($row['config_value'])
{
case '':
$sql = "SELECT themes_id
FROM " . THEMES_TABLE . "
WHERE template_name = 'subSilver'";
$result = _sql($sql, $errored, $error_ary);
if ($row = $db->sql_fetchrow($result))
{
$theme_id = $row['themes_id'];
$sql = "UPDATE " . THEMES_TABLE . "
SET head_stylesheet = 'subSilver.css', body_background = '', body_bgcolor = 'E5E5E5', body_text = '000000', body_link = '006699', body_vlink = '5493B4', body_alink = '', body_hlink = 'DD6900', tr_color1 = 'EFEFEF', tr_color2 = 'DEE3E7', tr_color3 = 'D1D7DC', tr_class1 = '', tr_class2 = '', tr_class3 = '', th_color1 = '98AAB1', th_color2 = '006699', th_color3 = 'FFFFFF', th_class1 = 'cellpic1.gif', th_class2 = 'cellpic3.gif', th_class3 = 'cellpic2.jpg', td_color1 = 'FAFAFA', td_color2 = 'FFFFFF', td_color3 = '', td_class1 = 'row1', td_class2 = 'row2', td_class3 = '', fontface1 = 'Verdana, Arial, Helvetica, sans-serif', fontface2 = 'Trebuchet MS', fontface3 = 'Courier, ''Courier New'', sans-serif', fontsize1 = 10, fontsize2 = 11, fontsize3 = 12, fontcolor1 = '444444', fontcolor2 = '006600', fontcolor3 = 'FFA34F', span_class1 = '', span_class2 = '', span_class3 = ''
WHERE themes_id = $theme_id";
_sql($sql, $errored, $error_ary);
$sql = "DELETE FROM " . THEMES_NAME_TABLE . "
WHERE themes_id = $theme_id";
_sql($sql, $errored, $error_ary);
$sql = "INSERT INTO " . THEMES_NAME_TABLE . " (themes_id, tr_color1_name, tr_color2_name, tr_color3_name, tr_class1_name, tr_class2_name, tr_class3_name, th_color1_name, th_color2_name, th_color3_name, th_class1_name, th_class2_name, th_class3_name, td_color1_name, td_color2_name, td_color3_name, td_class1_name, td_class2_name, td_class3_name, fontface1_name, fontface2_name, fontface3_name, fontsize1_name, fontsize2_name, fontsize3_name, fontcolor1_name, fontcolor2_name, fontcolor3_name, span_class1_name, span_class2_name, span_class3_name)
VALUES ($theme_id, 'The lightest row colour', 'The medium row color', 'The darkest row colour', '', '', '', 'Border round the whole page', 'Outer table border', 'Inner table border', 'Silver gradient picture', 'Blue gradient picture', 'Fade-out gradient on index', 'Background for quote boxes', 'All white areas', '', 'Background for topic posts', '2nd background for topic posts', '', 'Main fonts', 'Additional topic title font', 'Form fonts', 'Smallest font size', 'Medium font size', 'Normal font size (post body etc)', 'Quote & copyright text', 'Code text colour', 'Main table header text colour', '', '', '')";
_sql($sql, $errored, $error_ary);
}
$db->sql_freeresult($result);
$sql = "SELECT MIN(post_id) AS first_post_id, topic_id
FROM " . POSTS_TABLE . "
GROUP BY topic_id
ORDER BY topic_id ASC";
$result = _sql($sql, $errored, $error_ary);
if ($row = $db->sql_fetchrow($result))
{
do
{
$sql = "UPDATE " . TOPICS_TABLE . "
SET topic_first_post_id = " . $row['first_post_id'] . "
WHERE topic_id = " . $row['topic_id'];
_sql($sql, $errored, $error_ary);
}
while ($row = $db->sql_fetchrow($result));
}
$db->sql_freeresult($result);
$sql = "SELECT DISTINCT u.user_id
FROM " . USERS_TABLE . " u, " . USER_GROUP_TABLE . " ug, " . AUTH_ACCESS_TABLE . " aa
WHERE aa.auth_mod = 1
AND ug.group_id = aa.group_id
AND u.user_id = ug.user_id
AND u.user_level <> " . ADMIN;
$result = _sql($sql, $errored, $error_ary);
$mod_user = array();
while ($row = $db->sql_fetchrow($result))
{
$mod_user[] = $row['user_id'];
}
$db->sql_freeresult($result);
if (count($mod_user))
{
$sql = "UPDATE " . USERS_TABLE . "
SET user_level = " . MOD . "
WHERE user_id IN (" . implode(', ', $mod_user) . ")";
_sql($sql, $errored, $error_ary);
}
$sql = "INSERT INTO " . CONFIG_TABLE . " (config_name, config_value)
VALUES ('server_name', 'www.myserver.tld')";
_sql($sql, $errored, $error_ary);
$sql = "INSERT INTO " . CONFIG_TABLE . " (config_name, config_value)
VALUES ('script_path', '/phpBB2/')";
_sql($sql, $errored, $error_ary);
$sql = "INSERT INTO " . CONFIG_TABLE . " (config_name, config_value)
VALUES ('server_port', '80')";
_sql($sql, $errored, $error_ary);
$sql = "INSERT INTO " . CONFIG_TABLE . " (config_name, config_value)
VALUES ('record_online_users', '1')";
_sql($sql, $errored, $error_ary);
$sql = "INSERT INTO " . CONFIG_TABLE . " (config_name, config_value)
VALUES ('record_online_date', '" . time() . "')";
_sql($sql, $errored, $error_ary);
case 'RC-3':
case 'RC-4':
case '.0.0':
case '.0.1':
if (SQL_LAYER == 'postgresql')
{
$sql = "SELECT user_id, user_timezone_old
FROM " . USERS_TABLE;
$result = _sql($sql, $errored, $error_ary);
while ($row = $db->sql_fetchrow($result))
{
$sql = "UPDATE " . USERS_TABLE . "
SET user_timezone = " . $row['user_timezone_old'] . "
WHERE user_id = " . $row['user_id'];
_sql($sql, $errored, $error_ary);
}
$db->sql_freeresult($result);
}
$sql = "SELECT topic_id, topic_moved_id
FROM " . TOPICS_TABLE . "
WHERE topic_moved_id <> 0
AND topic_status = " . TOPIC_MOVED;
$result = _sql($sql, $errored, $error_ary);
$topic_ary = array();
while ($row = $db->sql_fetchrow($result))
{
$topic_ary[$row['topic_id']] = $row['topic_moved_id'];
}
$db->sql_freeresult($result);
while (list($topic_id, $topic_moved_id) = each($topic_ary))
{
$sql = "SELECT MAX(post_id) AS last_post, MIN(post_id) AS first_post, COUNT(post_id) AS total_posts
FROM " . POSTS_TABLE . "
WHERE topic_id = $topic_moved_id";
$result = _sql($sql, $errored, $error_ary);
$sql = ($row = $db->sql_fetchrow($result)) ? "UPDATE " . TOPICS_TABLE . " SET topic_replies = " . ($row['total_posts'] - 1) . ", topic_first_post_id = " . $row['first_post'] . ", topic_last_post_id = " . $row['last_post'] . " WHERE topic_id = $topic_id" : "DELETE FROM " . TOPICS_TABLE . " WHERE topic_id = " . $row['topic_id'];
_sql($sql, $errored, $error_ary);
}
unset($sql);
sync('all forums');
case '.0.2':
case '.0.3':
// Topics will resync automatically
// Remove stop words from search match and search words
$dirname = 'language';
$dir = opendir($phpbb_root_path . $dirname);
while ($file = readdir($dir))
{
if (preg_match("#^lang_#i", $file) && !is_file($phpbb_root_path . $dirname . "/" . $file) && !is_link($phpbb_root_path . $dirname . "/" . $file) && file_exists($phpbb_root_path . $dirname . "/" . $file . '/search_stopwords.txt'))
{
$stopword_list = trim(preg_replace('#([\w\.\-_\+\'<27><>-<2D>\\\]+?)[ \n\r]*?(,|$)#', '\'\1\'\2', str_replace("'", "\'", implode(', ', file($phpbb_root_path . $dirname . "/" . $file . '/search_stopwords.txt')))));
$sql = "SELECT word_id
FROM " . SEARCH_WORD_TABLE . "
WHERE word_text IN ($stopword_list)";
$result = _sql($sql, $errored, $error_ary);
$word_id_sql = '';
if ($row = $db->sql_fetchrow($result))
{
do
{
$word_id_sql .= (($word_id_sql != '') ? ', ' : '') . $row['word_id'];
}
while ($row = $db->sql_fetchrow($result));
$sql = "DELETE FROM " . SEARCH_WORD_TABLE . "
WHERE word_id IN ($word_id_sql)";
_sql($sql, $errored, $error_ary);
$sql = "DELETE FROM " . SEARCH_MATCH_TABLE . "
WHERE word_id IN ($word_id_sql)";
_sql($sql, $errored, $error_ary);
}
$db->sql_freeresult($result);
}
}
closedir($dir);
// Mark common words ...
remove_common('global', 4/10);
// remove superfluous polls ... grab polls with topics then delete polls
// not in that list
$sql = "SELECT v.vote_id
FROM " . TOPICS_TABLE . " t, " . VOTE_DESC_TABLE . " v
WHERE v.topic_id = t.topic_id";
$result = _sql($sql, $errored, $error_ary);
$vote_id_sql = '';
if ($row = $db->sql_fetchrow($result))
{
do
{
$vote_id_sql .= (($vote_id_sql != '') ? ', ' : '') . $row['vote_id'];
}
while ($row = $db->sql_fetchrow($result));
$sql = "DELETE FROM " . VOTE_DESC_TABLE . "
WHERE vote_id NOT IN ($vote_id_sql)";
_sql($sql, $errored, $error_ary);
$sql = "DELETE FROM " . VOTE_RESULTS_TABLE . "
WHERE vote_id NOT IN ($vote_id_sql)";
_sql($sql, $errored, $error_ary);
$sql = "DELETE FROM " . VOTE_USERS_TABLE . "
WHERE vote_id NOT IN ($vote_id_sql)";
_sql($sql, $errored, $error_ary);
}
$db->sql_freeresult($result);
// update pm counters
$sql = "SELECT privmsgs_to_userid, COUNT(privmsgs_id) AS unread_count
FROM " . PRIVMSGS_TABLE . "
WHERE privmsgs_type = " . PRIVMSGS_UNREAD_MAIL . "
GROUP BY privmsgs_to_userid";
$result = _sql($sql, $errored, $error_ary);
if ($row = $db->sql_fetchrow($result))
{
$update_users = array();
do
{
$update_users[$row['unread_count']][] = $row['privmsgs_to_userid'];
}
while ($row = $db->sql_fetchrow($result));
while (list($num, $user_ary) = each($update_users))
{
$user_ids = implode(', ', $user_ary);
$sql = "UPDATE " . USERS_TABLE . "
SET user_unread_privmsg = $num
WHERE user_id IN ($user_ids)";
_sql($sql, $errored, $error_ary);
}
unset($update_list);
}
$db->sql_freeresult($result);
$sql = "SELECT privmsgs_to_userid, COUNT(privmsgs_id) AS new_count
FROM " . PRIVMSGS_TABLE . "
WHERE privmsgs_type = " . PRIVMSGS_NEW_MAIL . "
GROUP BY privmsgs_to_userid";
$result = _sql($sql, $errored, $error_ary);
if ($row = $db->sql_fetchrow($result))
{
$update_users = array();
do
{
$update_users[$row['new_count']][] = $row['privmsgs_to_userid'];
}
while ($row = $db->sql_fetchrow($result));
while (list($num, $user_ary) = each($update_users))
{
$user_ids = implode(', ', $user_ary);
$sql = "UPDATE " . USERS_TABLE . "
SET user_new_privmsg = $num
WHERE user_id IN ($user_ids)";
_sql($sql, $errored, $error_ary);
}
unset($update_list);
}
$db->sql_freeresult($result);
// Remove superfluous watched topics
$sql = "SELECT t.topic_id
FROM " . TOPICS_TABLE . " t, " . TOPICS_WATCH_TABLE . " w
WHERE w.topic_id = t.topic_id";
$result = _sql($sql, $errored, $error_ary);
$topic_id_sql = '';
if ($row = $db->sql_fetchrow($result))
{
do
{
$topic_id_sql .= (($topic_id_sql != '') ? ', ' : '') . $row['topic_id'];
}
while ($row = $db->sql_fetchrow($result));
$sql = "DELETE FROM " . TOPICS_WATCH_TABLE . "
WHERE topic_id NOT IN ($topic_id_sql)";
_sql($sql, $errored, $error_ary);
}
$db->sql_freeresult($result);
// Reset any email addresses which are non-compliant ... something
// not done in the upgrade script and thus which may affect some
// mysql users
switch (SQL_LAYER)
{
case 'mysql':
$sql = "UPDATE " . USERS_TABLE . "
SET user_email = ''
WHERE user_email NOT REGEXP '^[a-zA-Z0-9_\+\.\-]+@.*[a-zA-Z0-9_\-]+\.[a-zA-Z]{2,}$'";
_sql($sql, $errored, $error_ary);
}
case '.0.4':
// Add the confirmation code switch ... save time and trouble elsewhere
$sql = 'INSERT INTO ' . CONFIG_TABLE . " (config_name, config_value)
VALUES ('enable_confirm', '0')";
_sql($sql, $errored, $error_ary);
$sql = "INSERT INTO " . CONFIG_TABLE . " (config_name, config_value)
VALUES ('sendmail_fix', '0')";
_sql($sql, $errored, $error_ary);
case '.0.5':
$sql = "SELECT user_id, username
FROM " . USERS_TABLE;
$result = _sql($sql, $errored, $error_ary);
while ($row = $db->sql_fetchrow($result))
{
if (!preg_match('#(&gt;)|(&lt;)|(&quot)|(&amp;)#', $row['username']))
{
if ($row['username'] != htmlspecialchars($row['username']))
{
$sql = "UPDATE " . USERS_TABLE . "
SET username = '" . str_replace("'", "''", htmlspecialchars($row['username'])) . "'
WHERE user_id = " . $row['user_id'];
_sql($sql, $errored, $error_ary);
}
}
}
$db->sql_freeresult($result);
break;
default:
echo " No updates where required</b></p>\n";
break;
}
echo "<h2>Updating version and optimizing tables</h2>\n";
echo "<p>Progress :: <b>";
flush();
// update the version
$sql = "UPDATE " . CONFIG_TABLE . "
SET config_value = '$updates_to_version'
WHERE config_name = 'version'";
_sql($sql, $errored, $error_ary);
// Optimize/vacuum analyze the tables where appropriate
// this should be done for each version in future along with
// the version number update
switch (SQL_LAYER)
{
case 'mysql':
case 'mysql4':
$sql = 'OPTIMIZE TABLE ' . $table_prefix . 'auth_access, ' . $table_prefix . 'banlist, ' . $table_prefix . 'categories, ' . $table_prefix . 'config, ' . $table_prefix . 'disallow, ' . $table_prefix . 'forum_prune, ' . $table_prefix . 'forums, ' . $table_prefix . 'groups, ' . $table_prefix . 'posts, ' . $table_prefix . 'posts_text, ' . $table_prefix . 'privmsgs, ' . $table_prefix . 'privmsgs_text, ' . $table_prefix . 'ranks, ' . $table_prefix . 'search_results, ' . $table_prefix . 'search_wordlist, ' . $table_prefix . 'search_wordmatch, ' . $table_prefix . 'smilies, ' . $table_prefix . 'themes, ' . $table_prefix . 'themes_name, ' . $table_prefix . 'topics, ' . $table_prefix . 'topics_watch, ' . $table_prefix . 'user_group, ' . $table_prefix . 'users, ' . $table_prefix . 'vote_desc, ' . $table_prefix . 'vote_results, ' . $table_prefix . 'vote_voters, ' . $table_prefix . 'words';
_sql($sql, $errored, $error_ary);
break;
case 'postgresql':
_sql("VACUUM ANALYZE", $errored, $error_ary);
break;
}
echo "</b> <b class=\"ok\">Done</b><br />Result &nbsp; :: \n";
if ($errored)
{
echo " <b>Some queries failed, the statements and errors are listing below</b>\n<ul>";
for ($i = 0; $i < count($error_ary['sql']); $i++)
{
echo "<li>Error :: <b>" . $error_ary['error_code'][$i]['message'] . "</b><br />";
echo "SQL &nbsp; :: <b>" . $error_ary['sql'][$i] . "</b><br /><br /></li>";
}
echo "</ul>\n<p>This is probably nothing to worry about, update will continue. Should this fail to complete you may need to seek help at our development board. See <a href=\"docs\README.html\">README</a> for details on how to obtain advice.</p>\n";
}
else
{
echo "<b>No errors</b>\n";
}
echo "<h2>Update completed</h2>\n";
echo "\n<p>You should now visit the General Configuration settings page in the <a href=\"../admin/\">Administration Panel</a> and check the General Configuration of the board. If you updated from versions prior to RC-3 you <b>must</b> update some entries. If you do not do this emails sent from the board will contain incorrect information. Don't forget to delete this file!</p>\n";
?>
<br clear="all" />
</body>
</html>

View File

@@ -59,7 +59,7 @@ include($phpbb_root_path . 'includes/db.'.$phpEx);
//
//
//
$updates_to_version = ".0.9";
$updates_to_version = '.0.17';
//
//
//
@@ -420,6 +420,8 @@ switch ($row['config_value'])
}
case '.0.2':
case '.0.3':
switch (SQL_LAYER)
@@ -513,6 +515,45 @@ switch ($row['config_value'])
break;
}
case '.0.5':
case '.0.6':
case '.0.7':
case '.0.8':
case '.0.9':
case '.0.10':
case '.0.11':
case '.0.12':
case '.0.13':
case '.0.14':
switch (SQL_LAYER)
{
case 'mysql':
case 'mysql4':
$sql[] = "ALTER TABLE " . SESSIONS_TABLE . "
ADD COLUMN session_admin tinyint(2) DEFAULT '0' NOT NULL";
break;
case 'postgresql':
$sql[] = "ALTER TABLE " . SESSIONS_TABLE . "
ADD COLUMN session_admin int2";
$sql[] = "ALTER TABLE " . SESSIONS_TABLE . "
ALTER COLUMN session_admin SET DEFAULT '0'";
break;
case 'mssql-odbc':
case 'mssql':
$sql[] = "ALTER TABLE " . SESSIONS_TABLE . " ADD
session_admin smallint NOT NULL,
CONSTRAINT [DF_" . $table_prefix . "sessions_session_admin] DEFAULT (0) FOR [session_admin]";
break;
case 'msaccess':
$sql[] = "ALTER TABLE " . SESSIONS_TABLE . " ADD
session_admin smallint NOT NULL";
break;
}
break;
}
@@ -900,6 +941,23 @@ switch ($row['config_value'])
}
$db->sql_freeresult($result);
case '.0.6':
case '.0.7':
case '.0.8':
case '.0.9':
case '.0.10':
case '.0.11':
case '.0.12':
case '.0.13':
case '.0.14':
$sql = 'UPDATE ' . USERS_TABLE . ' SET user_allowhtml = 1 WHERE user_id = ' . ANONYMOUS;
_sql($sql, $errored, $error_ary);
// We reset those having autologin enabled and forcing the re-assignment of a session id
$sql = 'DELETE FROM ' . SESSIONS_TABLE;
_sql($sql, $errored, $error_ary);
break;
default:
@@ -953,6 +1011,7 @@ else
}
echo "<h2>Update completed</h2>\n";
echo "\n" . '<p style="color:red">Please make sure you have updated your board files too, this file is only updating your database.</p>';
echo "\n<p>You should now visit the General Configuration settings page in the <a href=\"../admin/\">Administration Panel</a> and check the General Configuration of the board. If you updated from versions prior to RC-3 you <b>must</b> update some entries. If you do not do this emails sent from the board will contain incorrect information. Don't forget to delete this file!</p>\n";
?>

View File

@@ -724,6 +724,18 @@ $lang['Install_No_Ext'] = 'The PHP configuration on your server doesn\'t support
$lang['Install_No_PCRE'] = 'phpBB2 Requires the Perl-Compatible Regular Expressions Module for PHP which your PHP configuration doesn\'t appear to support!';
//
// Version Check
//
$lang['Version_up_to_date'] = 'Your installation is up to date, no updates are available for your version of phpBB.';
$lang['Version_not_up_to_date'] = 'Your installation does <b>not</b> seem to be up to date. Updates are available for your version of phpBB, please visit <a href="http://www.phpbb.com/downloads.php" target="_new">http://www.phpbb.com/downloads.php</a> to obtain the latest version.';
$lang['Latest_version_info'] = 'The latest available version is <b>phpBB %s</b>.';
$lang['Current_version_info'] = 'You are running <b>phpBB %s</b>.';
$lang['Connect_socket_error'] = 'Unable to open connection to phpBB Server, reported error is:<br />%s';
$lang['Socket_functions_disabled'] = 'Unable to use socket functions.';
$lang['Mailing_list_subscribe_reminder'] = 'For the latest information on updates to phpBB, why not <a href="http://www.phpbb.com/support/" target="_new">subscribe to our mailing list</a>.';
$lang['Version_information'] = 'Version Information';
//
// That's all Folks!
// -------------------------------------------------

View File

@@ -1018,6 +1018,8 @@ $lang['Critical_Error'] = 'Critical Error';
$lang['An_error_occured'] = 'An Error Occurred';
$lang['A_critical_error'] = 'A Critical Error Occurred';
$lang['Admin_reauthenticate'] = 'To administer the board you must re-authenticate yourself.';
//
// That's all, Folks!
// -------------------------------------------------

View File

@@ -52,11 +52,9 @@ else
if( isset($HTTP_POST_VARS['login']) || isset($HTTP_GET_VARS['login']) || isset($HTTP_POST_VARS['logout']) || isset($HTTP_GET_VARS['logout']) )
{
if( ( isset($HTTP_POST_VARS['login']) || isset($HTTP_GET_VARS['login']) ) && !$userdata['session_logged_in'] )
if( ( isset($HTTP_POST_VARS['login']) || isset($HTTP_GET_VARS['login']) ) && (!$userdata['session_logged_in'] || isset($HTTP_POST_VARS['admin'])) )
{
$username = isset($HTTP_POST_VARS['username']) ? trim(htmlspecialchars($HTTP_POST_VARS['username'])) : '';
$username = substr(str_replace("\\'", "'", $username), 0, 25);
$username = str_replace("'", "\\'", $username);
$username = isset($HTTP_POST_VARS['username']) ? phpbb_clean_username($HTTP_POST_VARS['username']) : '';
$password = isset($HTTP_POST_VARS['password']) ? $HTTP_POST_VARS['password'] : '';
$sql = "SELECT user_id, username, user_password, user_active, user_level
@@ -79,7 +77,8 @@ if( isset($HTTP_POST_VARS['login']) || isset($HTTP_GET_VARS['login']) || isset($
{
$autologin = ( isset($HTTP_POST_VARS['autologin']) ) ? TRUE : 0;
$session_id = session_begin($row['user_id'], $user_ip, PAGE_INDEX, FALSE, $autologin);
$admin = (isset($HTTP_POST_VARS['admin'])) ? 1 : 0;
$session_id = session_begin($row['user_id'], $user_ip, PAGE_INDEX, FALSE, $autologin, $admin);
if( $session_id )
{
@@ -96,6 +95,11 @@ if( isset($HTTP_POST_VARS['login']) || isset($HTTP_GET_VARS['login']) || isset($
$redirect = ( !empty($HTTP_POST_VARS['redirect']) ) ? str_replace('&amp;', '&', htmlspecialchars($HTTP_POST_VARS['redirect'])) : '';
$redirect = str_replace('?', '&', $redirect);
if (strstr(urldecode($redirect), "\n") || strstr(urldecode($redirect), "\r"))
{
message_die(GENERAL_ERROR, 'Tried to redirect to potentially insecure url.');
}
$template->assign_vars(array(
'META' => "<meta http-equiv=\"refresh\" content=\"3;url=login.$phpEx?redirect=$redirect\">")
);
@@ -111,6 +115,11 @@ if( isset($HTTP_POST_VARS['login']) || isset($HTTP_GET_VARS['login']) || isset($
$redirect = ( !empty($HTTP_POST_VARS['redirect']) ) ? str_replace('&amp;', '&', htmlspecialchars($HTTP_POST_VARS['redirect'])) : "";
$redirect = str_replace("?", "&", $redirect);
if (strstr(urldecode($redirect), "\n") || strstr(urldecode($redirect), "\r"))
{
message_die(GENERAL_ERROR, 'Tried to redirect to potentially insecure url.');
}
$template->assign_vars(array(
'META' => "<meta http-equiv=\"refresh\" content=\"3;url=login.$phpEx?redirect=$redirect\">")
);
@@ -150,7 +159,7 @@ else
// Do a full login page dohickey if
// user not already logged in
//
if( !$userdata['session_logged_in'] )
if( !$userdata['session_logged_in'] || (isset($HTTP_GET_VARS['admin']) && $userdata['session_logged_in'] && $userdata['user_level'] == ADMIN))
{
$page_title = $lang['Login'];
include($phpbb_root_path . 'includes/page_header.'.$phpEx);
@@ -199,12 +208,13 @@ else
$username = ( $userdata['user_id'] != ANONYMOUS ) ? $userdata['username'] : '';
$s_hidden_fields = '<input type="hidden" name="redirect" value="' . $forward_page . '" />';
$s_hidden_fields .= (isset($HTTP_GET_VARS['admin'])) ? '<input type="hidden" name="admin" value="1" />' : '';
make_jumpbox('viewforum.'.$phpEx, $forum_id);
$template->assign_vars(array(
'USERNAME' => $username,
'L_ENTER_PASSWORD' => $lang['Enter_password'],
'L_ENTER_PASSWORD' => (isset($HTTP_GET_VARS['admin'])) ? $lang['Admin_reauthenticate'] : $lang['Enter_password'],
'L_SEND_PASSWORD' => $lang['Forgotten_password'],
'U_SEND_PASSWORD' => append_sid("profile.$phpEx?mode=sendpassword"),

View File

@@ -131,6 +131,11 @@ if ( !empty($topic_id) )
}
$topic_row = $db->sql_fetchrow($result);
if (!$topic_row)
{
message_die(GENERAL_MESSAGE, 'Topic_post_not_exist');
}
$forum_topics = ( $topic_row['forum_topics'] == 0 ) ? 1 : $topic_row['forum_topics'];
$forum_id = $topic_row['forum_id'];
$forum_name = $topic_row['forum_name'];
@@ -146,6 +151,11 @@ else if ( !empty($forum_id) )
}
$topic_row = $db->sql_fetchrow($result);
if (!$topic_row)
{
message_die(GENERAL_MESSAGE, 'Forum_not_exist');
}
$forum_topics = ( $topic_row['forum_topics'] == 0 ) ? 1 : $topic_row['forum_topics'];
$forum_name = $topic_row['forum_name'];
}
@@ -453,6 +463,20 @@ switch( $mode )
$new_forum_id = intval($HTTP_POST_VARS['new_forum']);
$old_forum_id = $forum_id;
$sql = 'SELECT forum_id FROM ' . FORUMS_TABLE . '
WHERE forum_id = ' . $new_forum_id;
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Could not select from forums table', '', __LINE__, __FILE__, $sql);
}
if (!$db->sql_fetchrow($result))
{
message_die(GENERAL_MESSAGE, 'New forum does not exist');
}
$db->sql_freeresult($result);
if ( $new_forum_id != $old_forum_id )
{
$topics = ( isset($HTTP_POST_VARS['topic_id_list']) ) ? $HTTP_POST_VARS['topic_id_list'] : array($topic_id);
@@ -746,6 +770,20 @@ switch( $mode )
$new_forum_id = intval($HTTP_POST_VARS['new_forum_id']);
$topic_time = time();
$sql = 'SELECT forum_id FROM ' . FORUMS_TABLE . '
WHERE forum_id = ' . $new_forum_id;
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Could not select from forums table', '', __LINE__, __FILE__, $sql);
}
if (!$db->sql_fetchrow($result))
{
message_die(GENERAL_MESSAGE, 'New forum does not exist');
}
$db->sql_freeresult($result);
$sql = "INSERT INTO " . TOPICS_TABLE . " (topic_title, topic_poster, topic_time, forum_id, topic_status, topic_type)
VALUES ('" . str_replace("\'", "''", $post_subject) . "', $first_poster, " . $topic_time . ", $new_forum_id, " . TOPIC_UNLOCKED . ", " . POST_NORMAL . ")";
if (!($db->sql_query($sql, BEGIN_TRANSACTION)))

View File

@@ -1105,4 +1105,4 @@ $template->pparse('body');
include($phpbb_root_path . 'includes/page_tail.'.$phpEx);
?>
?>

View File

@@ -563,9 +563,9 @@ else if ( $mode == 'read' )
// If the board has HTML off but the post has HTML
// on then we process it, else leave it alone
//
if ( !$board_config['allow_html'] )
if ( !$board_config['allow_html'] || !$userdata['user_allowhtml'])
{
if ( $user_sig != '' && $privmsg['privmsgs_enable_sig'] && $userdata['user_allowhtml'] )
if ( $user_sig != '')
{
$user_sig = preg_replace('#(<)([\/]?.*?)(>)#is', "&lt;\\2&gt;", $user_sig);
}
@@ -698,47 +698,57 @@ else if ( ( $delete && $mark_list ) || $delete_all )
}
else if ( $confirm )
{
if ( $delete_all )
$delete_sql_id = '';
if (!$delete_all)
{
switch($folder)
for ($i = 0; $i < count($mark_list); $i++)
{
case 'inbox':
$delete_type = "privmsgs_to_userid = " . $userdata['user_id'] . " AND (
privmsgs_type = " . PRIVMSGS_READ_MAIL . " OR privmsgs_type = " . PRIVMSGS_NEW_MAIL . " OR privmsgs_type = " . PRIVMSGS_UNREAD_MAIL . " )";
break;
case 'outbox':
$delete_type = "privmsgs_from_userid = " . $userdata['user_id'] . " AND ( privmsgs_type = " . PRIVMSGS_NEW_MAIL . " OR privmsgs_type = " . PRIVMSGS_UNREAD_MAIL . " )";
break;
case 'sentbox':
$delete_type = "privmsgs_from_userid = " . $userdata['user_id'] . " AND privmsgs_type = " . PRIVMSGS_SENT_MAIL;
break;
case 'savebox':
$delete_type = "( ( privmsgs_from_userid = " . $userdata['user_id'] . "
AND privmsgs_type = " . PRIVMSGS_SAVED_OUT_MAIL . " )
OR ( privmsgs_to_userid = " . $userdata['user_id'] . "
AND privmsgs_type = " . PRIVMSGS_SAVED_IN_MAIL . " ) )";
break;
$delete_sql_id .= (($delete_sql_id != '') ? ', ' : '') . intval($mark_list[$i]);
}
$sql = "SELECT privmsgs_id
FROM " . PRIVMSGS_TABLE . "
WHERE $delete_type";
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Could not obtain id list to delete all messages', '', __LINE__, __FILE__, $sql);
}
while ( $row = $db->sql_fetchrow($result) )
{
$mark_list[] = $row['privmsgs_id'];
}
unset($delete_type);
$delete_sql_id = "AND privmsgs_id IN ($delete_sql_id)";
}
switch($folder)
{
case 'inbox':
$delete_type = "privmsgs_to_userid = " . $userdata['user_id'] . " AND (
privmsgs_type = " . PRIVMSGS_READ_MAIL . " OR privmsgs_type = " . PRIVMSGS_NEW_MAIL . " OR privmsgs_type = " . PRIVMSGS_UNREAD_MAIL . " )";
break;
case 'outbox':
$delete_type = "privmsgs_from_userid = " . $userdata['user_id'] . " AND ( privmsgs_type = " . PRIVMSGS_NEW_MAIL . " OR privmsgs_type = " . PRIVMSGS_UNREAD_MAIL . " )";
break;
case 'sentbox':
$delete_type = "privmsgs_from_userid = " . $userdata['user_id'] . " AND privmsgs_type = " . PRIVMSGS_SENT_MAIL;
break;
case 'savebox':
$delete_type = "( ( privmsgs_from_userid = " . $userdata['user_id'] . "
AND privmsgs_type = " . PRIVMSGS_SAVED_OUT_MAIL . " )
OR ( privmsgs_to_userid = " . $userdata['user_id'] . "
AND privmsgs_type = " . PRIVMSGS_SAVED_IN_MAIL . " ) )";
break;
}
$sql = "SELECT privmsgs_id
FROM " . PRIVMSGS_TABLE . "
WHERE $delete_type $delete_sql_id";
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Could not obtain id list to delete messages', '', __LINE__, __FILE__, $sql);
}
$mark_list = array();
while ( $row = $db->sql_fetchrow($result) )
{
$mark_list[] = $row['privmsgs_id'];
}
unset($delete_type);
if ( count($mark_list) )
{
$delete_sql_id = '';
@@ -1132,7 +1142,7 @@ else if ( $submit || $refresh || $mode != '' )
{
if ( !empty($HTTP_POST_VARS['username']) )
{
$to_username = $HTTP_POST_VARS['username'];
$to_username = phpbb_clean_username($HTTP_POST_VARS['username']);
$sql = "SELECT user_id, user_notify_pm, user_email, user_lang, user_active
FROM " . USERS_TABLE . "
@@ -1337,7 +1347,8 @@ else if ( $submit || $refresh || $mode != '' )
// passed to the script, process it a little, do some checks
// where neccessary, etc.
//
$to_username = ( isset($HTTP_POST_VARS['username']) ) ? trim(strip_tags(stripslashes($HTTP_POST_VARS['username']))) : '';
$to_username = (isset($HTTP_POST_VARS['username']) ) ? trim(htmlspecialchars(stripslashes($HTTP_POST_VARS['username']))) : '';
$privmsg_subject = ( isset($HTTP_POST_VARS['subject']) ) ? trim(strip_tags(stripslashes($HTTP_POST_VARS['subject']))) : '';
$privmsg_message = ( isset($HTTP_POST_VARS['message']) ) ? trim($HTTP_POST_VARS['message']) : '';
$privmsg_message = preg_replace('#<textarea>#si', '&lt;textarea&gt;', $privmsg_message);
@@ -1493,6 +1504,10 @@ else if ( $submit || $refresh || $mode != '' )
$mode = 'reply';
}
}
else
{
$privmsg_subject = $privmsg_message = '';
}
}
//
@@ -1527,9 +1542,9 @@ else if ( $submit || $refresh || $mode != '' )
//
// Finalise processing as per viewtopic
//
if ( !$html_on )
if ( !$html_on || !$board_config['allow_html'] || !$userdata['user_allowhtml'] )
{
if ( $user_sig != '' || !$userdata['user_allowhtml'] )
if ( $user_sig != '' )
{
$user_sig = preg_replace('#(<)([\/]?.*?)(>)#is', "&lt;\\2&gt;", $user_sig);
}
@@ -1707,7 +1722,7 @@ else if ( $submit || $refresh || $mode != '' )
$template->assign_vars(array(
'SUBJECT' => $privmsg_subject,
'USERNAME' => preg_replace($html_entities_match, $html_entities_replace, $to_username),
'USERNAME' => $to_username,
'MESSAGE' => $privmsg_message,
'HTML_STATUS' => $html_status,
'SMILIES_STATUS' => $smilies_status,
@@ -2019,6 +2034,10 @@ if ( $folder != 'outbox' )
break;
}
}
else
{
$inbox_limit_img_length = $inbox_limit_pct = $l_box_size_status = '';
}
//
// Dump vars to template
@@ -2152,4 +2171,4 @@ $template->pparse('body');
include($phpbb_root_path . 'includes/page_tail.'.$phpEx);
?>
?>

View File

@@ -100,6 +100,17 @@ if ( isset($HTTP_GET_VARS['mode']) || isset($HTTP_POST_VARS['mode']) )
include($phpbb_root_path . 'includes/usercp_register.'.$phpEx);
exit;
}
else if ( $mode == 'confirm' )
{
// Visual Confirmation
if ( $userdata['session_logged_in'] )
{
exit;
}
include($phpbb_root_path . 'includes/usercp_confirm.'.$phpEx);
exit;
}
else if ( $mode == 'sendpassword' )
{
include($phpbb_root_path . 'includes/usercp_sendpasswd.'.$phpEx);

View File

@@ -60,6 +60,7 @@ else
if ( isset($HTTP_POST_VARS['search_author']) || isset($HTTP_GET_VARS['search_author']))
{
$search_author = ( isset($HTTP_POST_VARS['search_author']) ) ? $HTTP_POST_VARS['search_author'] : $HTTP_GET_VARS['search_author'];
$search_author = phpbb_clean_username($search_author);
}
else
{
@@ -196,6 +197,11 @@ else if ( $search_keywords != '' || $search_author != '' || $search_id )
}
else
{
if (preg_match('#^[\*%]+$#', trim($search_author)) || preg_match('#^[^\*]{1,2}$#', str_replace(array('*', '%'), '', trim($search_author))))
{
$search_author = '';
}
$search_author = str_replace('*', '%', trim($search_author));
$sql = "SELECT user_id
@@ -263,6 +269,12 @@ else if ( $search_keywords != '' || $search_author != '' || $search_id )
for($i = 0; $i < count($split_search); $i++)
{
if (preg_match('#^[\*%]+$#', trim($split_search[$i])) || preg_match('#^[^\*]{1,2}$#', str_replace(array('*', '%'), '', trim($split_search[$i]))))
{
$split_search[$i] = '';
continue;
}
switch ( $split_search[$i] )
{
case 'and':
@@ -406,6 +418,11 @@ else if ( $search_keywords != '' || $search_author != '' || $search_id )
//
if ( $search_author != '' )
{
if (preg_match('#^[\*%]+$#', trim($search_author)) || preg_match('#^[^\*]{1,2}$#', str_replace(array('*', '%'), '', trim($search_author))))
{
$search_author = '';
}
$search_author = str_replace('*', '%', trim(str_replace("\'", "''", $search_author)));
}

View File

@@ -35,6 +35,10 @@
<td class="row1">{L_ACCT_ACTIVATION}</td>
<td class="row2"><input type="radio" name="require_activation" value="{ACTIVATION_NONE}" {ACTIVATION_NONE_CHECKED} />{L_NONE}&nbsp; &nbsp;<input type="radio" name="require_activation" value="{ACTIVATION_USER}" {ACTIVATION_USER_CHECKED} />{L_USER}&nbsp; &nbsp;<input type="radio" name="require_activation" value="{ACTIVATION_ADMIN}" {ACTIVATION_ADMIN_CHECKED} />{L_ADMIN}</td>
</tr>
<tr>
<td class="row1">{L_VISUAL_CONFIRM}<br /><span class="gensmall">{L_VISUAL_CONFIRM_EXPLAIN}</span></td>
<td class="row2"><input type="radio" name="enable_confirm" value="1" {CONFIRM_ENABLE} />{L_YES}&nbsp; &nbsp;<input type="radio" name="enable_confirm" value="0" {CONFIRM_DISABLE} />{L_NO}</td>
</tr>
<tr>
<td class="row1">{L_BOARD_EMAIL_FORM}<br /><span class="gensmall">{L_BOARD_EMAIL_FORM_EXPLAIN}</span></td>
<td class="row2"><input type="radio" name="board_email_form" value="1" {BOARD_EMAIL_FORM_ENABLE} /> {L_ENABLED}&nbsp;&nbsp;<input type="radio" name="board_email_form" value="0" {BOARD_EMAIL_FORM_DISABLE} /> {L_DISABLED}</td>

View File

@@ -77,3 +77,9 @@
</table>
<br />
<h1>{L_VERSION_INFORMATION}</h1>
{VERSION_INFO}
<br />

View File

@@ -34,7 +34,7 @@
</tr>
<!-- BEGIN faq_row -->
<tr>
<td class="{faq_block.faq_row.ROW_CLASS}" align="left" valign="top"><span class="postbody"><a name="{faq_block.faq_row.U_FAQ_ID}"></a><b>{faq_block.faq_row.FAQ_QUESTION}</b></span><br /><span class="postbody">{faq_block.faq_row.FAQ_ANSWER}<br /><a class="postlink" href="#Top">{L_BACK_TO_TOP}</a></span></td>
<td class="{faq_block.faq_row.ROW_CLASS}" align="left" valign="top"><span class="postbody"><a name="{faq_block.faq_row.U_FAQ_ID}"></a><b>{faq_block.faq_row.FAQ_QUESTION}</b></span><br /><span class="postbody">{faq_block.faq_row.FAQ_ANSWER}<br /><a class="postlink" href="#top">{L_BACK_TO_TOP}</a></span></td>
</tr>
<tr>
<td class="spaceRow" height="1"><img src="templates/subSilver/images/spacer.gif" alt="" width="1" height="1" /></td>

View File

@@ -19,13 +19,13 @@
<tr>
<td width="45%" align="right"><span class="gen">{L_USERNAME}:</span></td>
<td>
<input type="text" name="username" size="25" maxlength="40" value="{USERNAME}" />
<input type="text" class="post" name="username" size="25" maxlength="40" value="{USERNAME}" />
</td>
</tr>
<tr>
<td align="right"><span class="gen">{L_PASSWORD}:</span></td>
<td>
<input type="password" name="password" size="25" maxlength="32" />
<input type="password" class="post" name="password" size="25" maxlength="32" />
</td>
</tr>
<tr align="center">

View File

@@ -4,13 +4,13 @@
We request you retain the full copyright notice below including the link to www.phpbb.com.
This not only gives respect to the large amount of time given freely by the developers
but also helps build interest, traffic and use of phpBB 2.0. If you cannot (for good
reason) retain the full copyright we request you at least leave in place the
Powered by phpBB {PHPBB_VERSION} line, with phpBB linked to www.phpbb.com. If you refuse
to include even this then support on our forums may be affected.
reason) retain the full copyright we request you at least leave in place the
Powered by phpBB line, with phpBB linked to www.phpbb.com. If you refuse
to include even this then support on our forums may be affected.
The phpBB Group : 2002
// -->
Powered by <a href="http://www.phpbb.com/" target="_phpbb" class="copyright">phpBB</a> {PHPBB_VERSION} &copy; 2001, 2002 phpBB Group<br />{TRANSLATION_INFO}</span></div>
Powered by <a href="http://www.phpbb.com/" target="_phpbb" class="copyright">phpBB</a> &copy; 2001, 2005 phpBB Group<br />{TRANSLATION_INFO}</span></div>
</td>
</tr>
</table>

View File

@@ -5,12 +5,12 @@
This not only gives respect to the large amount of time given freely by the developers
but also helps build interest, traffic and use of phpBB 2.0. If you cannot (for good
reason) retain the full copyright we request you at least leave in place the
Powered by phpBB {PHPBB_VERSION} line, with phpBB linked to www.phpbb.com. If you refuse
Powered by phpBB line, with phpBB linked to www.phpbb.com. If you refuse
to include even this then support on our forums may be affected.
The phpBB Group : 2002
// -->
Powered by <a href="http://www.phpbb.com/" target="_phpbb" class="copyright">phpBB</a> {PHPBB_VERSION} &copy; 2001,2002 phpBB Group</span></div>
Powered by <a href="http://www.phpbb.com/" target="_phpbb" class="copyright">phpBB</a> &copy; 2001, 2005 phpBB Group</span></div>
</td>
</tr>
</table>

View File

@@ -286,4 +286,4 @@ $template->pparse('body');
include($phpbb_root_path . 'includes/page_tail.'.$phpEx);
?>
?>

View File

@@ -483,7 +483,7 @@ $highlight_match = $highlight = '';
if (isset($HTTP_GET_VARS['highlight']))
{
// Split words and phrases
$words = explode(' ', trim(htmlspecialchars(urldecode($HTTP_GET_VARS['highlight']))));
$words = explode(' ', trim(htmlspecialchars($HTTP_GET_VARS['highlight'])));
for($i = 0; $i < sizeof($words); $i++)
{
@@ -495,6 +495,7 @@ if (isset($HTTP_GET_VARS['highlight']))
unset($words);
$highlight = urlencode($HTTP_GET_VARS['highlight']);
$highlight_match = phpbb_rtrim($highlight_match, "\\");
}
//
@@ -988,8 +989,8 @@ for($i = 0; $i < $total_posts; $i++)
$quote = '<a href="' . $temp_url . '">' . $lang['Reply_with_quote'] . '</a>';
$temp_url = append_sid("search.$phpEx?search_author=" . urlencode($postrow[$i]['username']) . "&amp;showresults=posts");
$search_img = '<a href="' . $temp_url . '"><img src="' . $images['icon_search'] . '" alt="' . $lang['Search_user_posts'] . '" title="' . $lang['Search_user_posts'] . '" border="0" /></a>';
$search = '<a href="' . $temp_url . '">' . $lang['Search_user_posts'] . '</a>';
$search_img = '<a href="' . $temp_url . '"><img src="' . $images['icon_search'] . '" alt="' . $lang['Search_user_posts'] . '" title="' . sprintf($lang['Search_user_posts'], $postrow[$i]['username']) . '" border="0" /></a>';
$search = '<a href="' . $temp_url . '">' . sprintf($lang['Search_user_posts'], $postrow[$i]['username']) . '</a>';
if ( ( $userdata['user_id'] == $poster_id && $is_auth['auth_edit'] ) || $is_auth['auth_mod'] )
{
@@ -1048,9 +1049,9 @@ for($i = 0; $i < $total_posts; $i++)
// If the board has HTML off but the post has HTML
// on then we process it, else leave it alone
//
if ( !$board_config['allow_html'] )
if ( !$board_config['allow_html'] || !$userdata['user_allowhtml'])
{
if ( $user_sig != '' && $userdata['user_allowhtml'] )
if ( $user_sig != '' )
{
$user_sig = preg_replace('#(<)([\/]?.*?)(>)#is', "&lt;\\2&gt;", $user_sig);
}
@@ -1106,7 +1107,7 @@ for($i = 0; $i < $total_posts; $i++)
{
// This was shamelessly 'borrowed' from volker at multiartstudio dot de
// via php.net's annotated manual
$message = str_replace('\"', '"', substr(preg_replace('#(\>(((?>([^><]+|(?R)))*)\<))#se', "preg_replace('#\b(" . $highlight_match . ")\b#i', '<span style=\"color:#" . $theme['fontcolor3'] . "\"><b>\\\\1</b></span>', '\\0')", '>' . $message . '<'), 1, -1));
$message = str_replace('\"', '"', substr(@preg_replace('#(\>(((?>([^><]+|(?R)))*)\<))#se', "@preg_replace('#\b(" . str_replace('\\', '\\\\', addslashes($highlight_match)) . ")\b#i', '<span style=\"color:#" . $theme['fontcolor3'] . "\"><b>\\\\1</b></span>', '\\0')", '>' . $message . '<'), 1, -1));
}
//
@@ -1118,10 +1119,10 @@ for($i = 0; $i < $total_posts; $i++)
if ($user_sig != '')
{
$user_sig = str_replace('\"', '"', substr(preg_replace('#(\>(((?>([^><]+|(?R)))*)\<))#se', "preg_replace(\$orig_word, \$replacement_word, '\\0')", '>' . $user_sig . '<'), 1, -1));
$user_sig = str_replace('\"', '"', substr(@preg_replace('#(\>(((?>([^><]+|(?R)))*)\<))#se', "@preg_replace(\$orig_word, \$replacement_word, '\\0')", '>' . $user_sig . '<'), 1, -1));
}
$message = str_replace('\"', '"', substr(preg_replace('#(\>(((?>([^><]+|(?R)))*)\<))#se', "preg_replace(\$orig_word, \$replacement_word, '\\0')", '>' . $message . '<'), 1, -1));
$message = str_replace('\"', '"', substr(@preg_replace('#(\>(((?>([^><]+|(?R)))*)\<))#se', "@preg_replace(\$orig_word, \$replacement_word, '\\0')", '>' . $message . '<'), 1, -1));
}
//
@@ -1212,4 +1213,4 @@ $template->pparse('body');
include($phpbb_root_path . 'includes/page_tail.'.$phpEx);
?>
?>