1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-09-12 01:00:43 +02:00

Compare commits

..

1 Commits

Author SHA1 Message Date
(no author)
cfb5d59ce0 This commit was manufactured by cvs2svn to create tag
'release_2_0_10'.

git-svn-id: file:///svn/phpbb/tags/release_2_0_10@4935 89ea8834-ac86-4346-8a33-228a782c2dd0
2004-07-17 13:52:52 +00:00
109 changed files with 8522 additions and 3330 deletions

View File

@@ -16,7 +16,7 @@ define('IN_PHPBB', 1);
if( !empty($setmodules) )
{
$file = basename(__FILE__);
$module['General']['Configuration'] = $file;
$module['General']['Configuration'] = "$file";
return;
}
@@ -49,24 +49,7 @@ else
if ($config_name == 'cookie_name')
{
$new['cookie_name'] = str_replace('.', '_', $new['cookie_name']);
}
// Attempt to prevent a common mistake with this value,
// http:// is the protocol and not part of the server name
if ($config_name == 'server_name')
{
$new['server_name'] = str_replace('http://', '', $new['server_name']);
}
// Attempt to prevent a mistake with this value.
if ($config_name == 'avatar_path')
{
$new['avatar_path'] = trim($new['avatar_path']);
if (strstr($new['avatar_path'], "\0") || !is_dir($phpbb_root_path . $new['avatar_path']) || !is_writable($phpbb_root_path . $new['avatar_path']))
{
$new['avatar_path'] = $default_config['avatar_path'];
}
$cookie_name = str_replace('.', '_', $new['cookie_name']);
}
if( isset($HTTP_POST_VARS['submit']) )
@@ -114,12 +97,6 @@ $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"' : '';
$allow_autologin_yes = ($new['allow_autologin']) ? 'checked="checked"' : '';
$allow_autologin_no = (!$new['allow_autologin']) ? 'checked="checked"' : '';
$board_email_form_yes = ( $new['board_email_form'] ) ? "checked=\"checked\"" : "";
$board_email_form_no = ( !$new['board_email_form'] ) ? "checked=\"checked\"" : "";
@@ -183,12 +160,6 @@ $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_ALLOW_AUTOLOGIN" => $lang['Allow_autologin'],
"L_ALLOW_AUTOLOGIN_EXPLAIN" => $lang['Allow_autologin_explain'],
"L_AUTOLOGIN_TIME" => $lang['Autologin_time'],
"L_AUTOLOGIN_TIME_EXPLAIN" => $lang['Autologin_time_explain'],
"L_COOKIE_SETTINGS" => $lang['Cookie_settings'],
"L_COOKIE_SETTINGS_EXPLAIN" => $lang['Cookie_settings_explain'],
"L_COOKIE_DOMAIN" => $lang['Cookie_domain'],
@@ -208,16 +179,6 @@ $template->assign_vars(array(
"L_MAX_POLL_OPTIONS" => $lang['Max_poll_options'],
"L_FLOOD_INTERVAL" => $lang['Flood_Interval'],
"L_FLOOD_INTERVAL_EXPLAIN" => $lang['Flood_Interval_explain'],
"L_SEARCH_FLOOD_INTERVAL" => $lang['Search_Flood_Interval'],
"L_SEARCH_FLOOD_INTERVAL_EXPLAIN" => $lang['Search_Flood_Interval_explain'],
'L_MAX_LOGIN_ATTEMPTS' => $lang['Max_login_attempts'],
'L_MAX_LOGIN_ATTEMPTS_EXPLAIN' => $lang['Max_login_attempts_explain'],
'L_LOGIN_RESET_TIME' => $lang['Login_reset_time'],
'L_LOGIN_RESET_TIME_EXPLAIN' => $lang['Login_reset_time_explain'],
'MAX_LOGIN_ATTEMPTS' => $new['max_login_attempts'],
'LOGIN_RESET_TIME' => $new['login_reset_time'],
"L_BOARD_EMAIL_FORM" => $lang['Board_email_form'],
"L_BOARD_EMAIL_FORM_EXPLAIN" => $lang['Board_email_form_explain'],
"L_TOPICS_PER_PAGE" => $lang['Topics_per_page'],
@@ -288,14 +249,11 @@ $template->assign_vars(array(
"ACTIVATION_ADMIN_CHECKED" => $activation_admin,
"CONFIRM_ENABLE" => $confirm_yes,
"CONFIRM_DISABLE" => $confirm_no,
'ALLOW_AUTOLOGIN_YES' => $allow_autologin_yes,
'ALLOW_AUTOLOGIN_NO' => $allow_autologin_no,
'AUTOLOGIN_TIME' => (int) $new['max_autologin_time'],
"ACTIVATION_NONE_CHECKED" => $activation_none,
"BOARD_EMAIL_FORM_ENABLE" => $board_email_form_yes,
"BOARD_EMAIL_FORM_DISABLE" => $board_email_form_no,
"MAX_POLL_OPTIONS" => $new['max_poll_options'],
"FLOOD_INTERVAL" => $new['flood_interval'],
"SEARCH_FLOOD_INTERVAL" => $new['search_flood_interval'],
"TOPICS_PER_PAGE" => $new['topics_per_page'],
"POSTS_PER_PAGE" => $new['posts_per_page'],
"HOT_TOPIC" => $new['hot_threshold'],

View File

@@ -499,9 +499,9 @@ function get_table_content_postgresql($table, $handler)
while($row = $db->sql_fetchrow($result))
{
$schema_vals = '';
$schema_fields = '';
$schema_insert = '';
unset($schema_vals);
unset($schema_fields);
unset($schema_insert);
//
// Build the SQL statement to recreate the data.
//
@@ -516,7 +516,7 @@ function get_table_content_postgresql($table, $handler)
}
elseif (eregi("date|timestamp", $aryType[$i]))
{
if (empty($strVal))
if ($empty($strVal))
{
$strQuote = "";
}
@@ -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', 'confirm', 'sessions_keys');
$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');
$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

@@ -25,7 +25,7 @@ define('IN_PHPBB', 1);
if( !empty($setmodules) )
{
$filename = basename(__FILE__);
$module['Users']['Disallow'] = $filename;
$module['Users']['Disallow'] = append_sid($filename);
return;
}
@@ -45,7 +45,7 @@ if( isset($HTTP_POST_VARS['add_name']) )
if ($disallowed_user == '')
{
message_die(GENERAL_MESSAGE, $lang['Fields_empty']);
message_die(MESSAGE, $lang['Fields_empty']);
}
if( !validate_username($disallowed_user) )
{

View File

@@ -39,8 +39,8 @@ include($phpbb_root_path . 'includes/functions_admin.'.$phpEx);
$forum_auth_ary = array(
"auth_view" => AUTH_ALL,
"auth_read" => AUTH_ALL,
"auth_post" => AUTH_REG,
"auth_reply" => AUTH_REG,
"auth_post" => AUTH_ALL,
"auth_reply" => AUTH_ALL,
"auth_edit" => AUTH_REG,
"auth_delete" => AUTH_REG,
"auth_sticky" => AUTH_MOD,
@@ -233,7 +233,6 @@ 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
//
@@ -1025,4 +1024,4 @@ $template->pparse("body");
include('./page_footer_admin.'.$phpEx);
?>
?>

View File

@@ -104,26 +104,21 @@ if ( isset($HTTP_POST_VARS['edit']) || isset($HTTP_POST_VARS['new']) )
//
// Ok, now we know everything about them, let's show the page.
//
if ($group_info['group_moderator'] != '')
$sql = "SELECT user_id, username
FROM " . USERS_TABLE . "
WHERE user_id <> " . ANONYMOUS . "
ORDER BY username";
if ( !($result = $db->sql_query($sql)) )
{
$sql = "SELECT user_id, username
FROM " . USERS_TABLE . "
WHERE user_id = " . $group_info['group_moderator'];
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Could not obtain user info for moderator list', '', __LINE__, __FILE__, $sql);
}
if ( !($row = $db->sql_fetchrow($result)) )
{
message_die(GENERAL_ERROR, 'Could not obtain user info for moderator list', '', __LINE__, __FILE__, $sql);
}
$group_moderator = $row['username'];
message_die(GENERAL_ERROR, 'Could not obtain user info for moderator list', '', __LINE__, __FILE__, $sql);
}
else
while ( $row = $db->sql_fetchrow($result) )
{
$group_moderator = '';
if ( $row['user_id'] == $group_info['group_moderator'] )
{
$group_moderator = $row['username'];
}
}
$group_open = ( $group_info['group_type'] == GROUP_OPEN ) ? ' checked="checked"' : '';
@@ -255,7 +250,7 @@ else if ( isset($HTTP_POST_VARS['group_update']) )
else
{
$group_type = isset($HTTP_POST_VARS['group_type']) ? intval($HTTP_POST_VARS['group_type']) : GROUP_OPEN;
$group_name = isset($HTTP_POST_VARS['group_name']) ? htmlspecialchars(trim($HTTP_POST_VARS['group_name'])) : '';
$group_name = isset($HTTP_POST_VARS['group_name']) ? trim($HTTP_POST_VARS['group_name']) : '';
$group_description = isset($HTTP_POST_VARS['group_description']) ? trim($HTTP_POST_VARS['group_description']) : '';
$group_moderator = isset($HTTP_POST_VARS['username']) ? $HTTP_POST_VARS['username'] : '';
$delete_old_moderator = isset($HTTP_POST_VARS['delete_old_moderator']) ? true : false;

View File

@@ -19,34 +19,25 @@
*
***************************************************************************/
define('IN_PHPBB', 1);
if( !empty($setmodules) )
{
$file = basename(__FILE__);
$module['Users']['Ranks'] = $file;
$module['Users']['Ranks'] = "$file";
return;
}
define('IN_PHPBB', 1);
//
// Let's set the root dir for phpBB
//
$phpbb_root_path = "./../";
require($phpbb_root_path . 'extension.inc');
$cancel = ( isset($HTTP_POST_VARS['cancel']) ) ? true : false;
$no_page_header = $cancel;
require('./pagestart.' . $phpEx);
if ($cancel)
{
redirect('admin/' . append_sid("admin_ranks.$phpEx", true));
}
if( isset($HTTP_GET_VARS['mode']) || isset($HTTP_POST_VARS['mode']) )
{
$mode = (isset($HTTP_GET_VARS['mode'])) ? $HTTP_GET_VARS['mode'] : $HTTP_POST_VARS['mode'];
$mode = ($HTTP_GET_VARS['mode']) ? $HTTP_GET_VARS['mode'] : $HTTP_POST_VARS['mode'];
$mode = htmlspecialchars($mode);
}
else
@@ -68,8 +59,6 @@ else
}
}
// Restrict mode input to valid options
$mode = ( in_array($mode, array('add', 'edit', 'save', 'delete')) ) ? $mode : '';
if( $mode != "" )
{
@@ -224,10 +213,8 @@ if( $mode != "" )
{
$rank_id = 0;
}
$confirm = isset($HTTP_POST_VARS['confirm']);
if( $rank_id && $confirm )
if( $rank_id )
{
$sql = "DELETE FROM " . RANKS_TABLE . "
WHERE rank_id = $rank_id";
@@ -251,95 +238,135 @@ if( $mode != "" )
message_die(GENERAL_MESSAGE, $message);
}
elseif( $rank_id && !$confirm)
{
// Present the confirmation screen to the user
$template->set_filenames(array(
'body' => 'admin/confirm_body.tpl')
);
$hidden_fields = '<input type="hidden" name="mode" value="delete" /><input type="hidden" name="id" value="' . $rank_id . '" />';
$template->assign_vars(array(
'MESSAGE_TITLE' => $lang['Confirm'],
'MESSAGE_TEXT' => $lang['Confirm_delete_rank'],
'L_YES' => $lang['Yes'],
'L_NO' => $lang['No'],
'S_CONFIRM_ACTION' => append_sid("admin_ranks.$phpEx"),
'S_HIDDEN_FIELDS' => $hidden_fields)
);
}
else
{
message_die(GENERAL_MESSAGE, $lang['Must_select_rank']);
}
}
$template->pparse("body");
include('./page_footer_admin.'.$phpEx);
}
//
// Show the default page
//
$template->set_filenames(array(
"body" => "admin/ranks_list_body.tpl")
);
$sql = "SELECT * FROM " . RANKS_TABLE . "
ORDER BY rank_min ASC, rank_special ASC";
if( !$result = $db->sql_query($sql) )
{
message_die(GENERAL_ERROR, "Couldn't obtain ranks data", "", __LINE__, __FILE__, $sql);
}
$rank_count = $db->sql_numrows($result);
$rank_rows = $db->sql_fetchrowset($result);
$template->assign_vars(array(
"L_RANKS_TITLE" => $lang['Ranks_title'],
"L_RANKS_TEXT" => $lang['Ranks_explain'],
"L_RANK" => $lang['Rank_title'],
"L_RANK_MINIMUM" => $lang['Rank_minimum'],
"L_SPECIAL_RANK" => $lang['Rank_special'],
"L_EDIT" => $lang['Edit'],
"L_DELETE" => $lang['Delete'],
"L_ADD_RANK" => $lang['Add_new_rank'],
"L_ACTION" => $lang['Action'],
"S_RANKS_ACTION" => append_sid("admin_ranks.$phpEx"))
);
for($i = 0; $i < $rank_count; $i++)
{
$rank = $rank_rows[$i]['rank_title'];
$special_rank = $rank_rows[$i]['rank_special'];
$rank_id = $rank_rows[$i]['rank_id'];
$rank_min = $rank_rows[$i]['rank_min'];
if( $special_rank == 1 )
else
{
$rank_min = $rank_max = "-";
}
//
// They didn't feel like giving us any information. Oh, too bad, we'll just display the
// list then...
//
$template->set_filenames(array(
"body" => "admin/ranks_list_body.tpl")
);
$sql = "SELECT * FROM " . RANKS_TABLE . "
ORDER BY rank_min, rank_title";
if( !$result = $db->sql_query($sql) )
{
message_die(GENERAL_ERROR, "Couldn't obtain ranks data", "", __LINE__, __FILE__, $sql);
}
$rank_rows = $db->sql_fetchrowset($result);
$rank_count = count($rank_rows);
$template->assign_vars(array(
"L_RANKS_TITLE" => $lang['Ranks_title'],
"L_RANKS_TEXT" => $lang['Ranks_explain'],
"L_RANK" => $lang['Rank_title'],
"L_RANK_MINIMUM" => $lang['Rank_minimum'],
"L_SPECIAL_RANK" => $lang['Special_rank'],
"L_EDIT" => $lang['Edit'],
"L_DELETE" => $lang['Delete'],
"L_ADD_RANK" => $lang['Add_new_rank'],
"L_ACTION" => $lang['Action'],
"S_RANKS_ACTION" => append_sid("admin_ranks.$phpEx"))
);
for( $i = 0; $i < $rank_count; $i++)
{
$rank = $rank_rows[$i]['rank_title'];
$special_rank = $rank_rows[$i]['rank_special'];
$rank_id = $rank_rows[$i]['rank_id'];
$rank_min = $rank_rows[$i]['rank_min'];
$row_color = ( !($i % 2) ) ? $theme['td_color1'] : $theme['td_color2'];
$row_class = ( !($i % 2) ) ? $theme['td_class1'] : $theme['td_class2'];
$rank_is_special = ( $special_rank ) ? $lang['Yes'] : $lang['No'];
if($special_rank)
{
$rank_min = $rank_max = "-";
}
$row_color = ( !($i % 2) ) ? $theme['td_color1'] : $theme['td_color2'];
$row_class = ( !($i % 2) ) ? $theme['td_class1'] : $theme['td_class2'];
$template->assign_block_vars("ranks", array(
"ROW_COLOR" => "#" . $row_color,
"ROW_CLASS" => $row_class,
"RANK" => $rank,
"SPECIAL_RANK" => $rank_is_special,
"RANK_MIN" => $rank_min,
$template->assign_block_vars("ranks", array(
"ROW_COLOR" => "#" . $row_color,
"ROW_CLASS" => $row_class,
"RANK" => $rank,
"RANK_MIN" => $rank_min,
"U_RANK_EDIT" => append_sid("admin_ranks.$phpEx?mode=edit&amp;id=$rank_id"),
"U_RANK_DELETE" => append_sid("admin_ranks.$phpEx?mode=delete&amp;id=$rank_id"))
"SPECIAL_RANK" => ( $special_rank == 1 ) ? $lang['Yes'] : $lang['No'],
"U_RANK_EDIT" => append_sid("admin_ranks.$phpEx?mode=edit&amp;id=$rank_id"),
"U_RANK_DELETE" => append_sid("admin_ranks.$phpEx?mode=delete&amp;id=$rank_id"))
);
}
}
}
else
{
//
// Show the default page
//
$template->set_filenames(array(
"body" => "admin/ranks_list_body.tpl")
);
$sql = "SELECT * FROM " . RANKS_TABLE . "
ORDER BY rank_min ASC, rank_special ASC";
if( !$result = $db->sql_query($sql) )
{
message_die(GENERAL_ERROR, "Couldn't obtain ranks data", "", __LINE__, __FILE__, $sql);
}
$rank_count = $db->sql_numrows($result);
$rank_rows = $db->sql_fetchrowset($result);
$template->assign_vars(array(
"L_RANKS_TITLE" => $lang['Ranks_title'],
"L_RANKS_TEXT" => $lang['Ranks_explain'],
"L_RANK" => $lang['Rank_title'],
"L_RANK_MINIMUM" => $lang['Rank_minimum'],
"L_SPECIAL_RANK" => $lang['Rank_special'],
"L_EDIT" => $lang['Edit'],
"L_DELETE" => $lang['Delete'],
"L_ADD_RANK" => $lang['Add_new_rank'],
"L_ACTION" => $lang['Action'],
"S_RANKS_ACTION" => append_sid("admin_ranks.$phpEx"))
);
for($i = 0; $i < $rank_count; $i++)
{
$rank = $rank_rows[$i]['rank_title'];
$special_rank = $rank_rows[$i]['rank_special'];
$rank_id = $rank_rows[$i]['rank_id'];
$rank_min = $rank_rows[$i]['rank_min'];
if( $special_rank == 1 )
{
$rank_min = $rank_max = "-";
}
$row_color = ( !($i % 2) ) ? $theme['td_color1'] : $theme['td_color2'];
$row_class = ( !($i % 2) ) ? $theme['td_class1'] : $theme['td_class2'];
$rank_is_special = ( $special_rank ) ? $lang['Yes'] : $lang['No'];
$template->assign_block_vars("ranks", array(
"ROW_COLOR" => "#" . $row_color,
"ROW_CLASS" => $row_class,
"RANK" => $rank,
"SPECIAL_RANK" => $rank_is_special,
"RANK_MIN" => $rank_min,
"U_RANK_EDIT" => append_sid("admin_ranks.$phpEx?mode=edit&amp;id=$rank_id"),
"U_RANK_DELETE" => append_sid("admin_ranks.$phpEx?mode=delete&amp;id=$rank_id"))
);
}
}
$template->pparse("body");

View File

@@ -49,17 +49,8 @@ if( isset($HTTP_GET_VARS['export_pack']) )
$phpbb_root_path = "./../";
require($phpbb_root_path . 'extension.inc');
$cancel = ( isset($HTTP_POST_VARS['cancel']) ) ? true : false;
$no_page_header = $cancel;
require('./pagestart.' . $phpEx);
if ($cancel)
{
redirect('admin/' . append_sid("admin_smilies.$phpEx", true));
}
//
// Check to see what mode we should operate in.
//
@@ -325,43 +316,17 @@ else if ( $mode != "" )
$smiley_id = ( !empty($HTTP_POST_VARS['id']) ) ? $HTTP_POST_VARS['id'] : $HTTP_GET_VARS['id'];
$smiley_id = intval($smiley_id);
$confirm = isset($HTTP_POST_VARS['confirm']);
if( $confirm )
$sql = "DELETE FROM " . SMILIES_TABLE . "
WHERE smilies_id = " . $smiley_id;
$result = $db->sql_query($sql);
if( !$result )
{
$sql = "DELETE FROM " . SMILIES_TABLE . "
WHERE smilies_id = " . $smiley_id;
$result = $db->sql_query($sql);
if( !$result )
{
message_die(GENERAL_ERROR, "Couldn't delete smiley", "", __LINE__, __FILE__, $sql);
}
$message = $lang['smiley_del_success'] . "<br /><br />" . sprintf($lang['Click_return_smileadmin'], "<a href=\"" . append_sid("admin_smilies.$phpEx") . "\">", "</a>") . "<br /><br />" . sprintf($lang['Click_return_admin_index'], "<a href=\"" . append_sid("index.$phpEx?pane=right") . "\">", "</a>");
message_die(GENERAL_MESSAGE, $message);
message_die(GENERAL_ERROR, "Couldn't delete smiley", "", __LINE__, __FILE__, $sql);
}
else
{
// Present the confirmation screen to the user
$template->set_filenames(array(
'body' => 'admin/confirm_body.tpl')
);
$hidden_fields = '<input type="hidden" name="mode" value="delete" /><input type="hidden" name="id" value="' . $smiley_id . '" />';
$message = $lang['smiley_del_success'] . "<br /><br />" . sprintf($lang['Click_return_smileadmin'], "<a href=\"" . append_sid("admin_smilies.$phpEx") . "\">", "</a>") . "<br /><br />" . sprintf($lang['Click_return_admin_index'], "<a href=\"" . append_sid("index.$phpEx?pane=right") . "\">", "</a>");
$template->assign_vars(array(
'MESSAGE_TITLE' => $lang['Confirm'],
'MESSAGE_TEXT' => $lang['Confirm_delete_smiley'],
'L_YES' => $lang['Yes'],
'L_NO' => $lang['No'],
'S_CONFIRM_ACTION' => append_sid("admin_smilies.$phpEx"),
'S_HIDDEN_FIELDS' => $hidden_fields)
);
$template->pparse('body');
}
message_die(GENERAL_MESSAGE, $message);
break;
case 'edit':
@@ -437,18 +402,15 @@ else if ( $mode != "" )
// Get the submitted data, being careful to ensure that we only
// accept the data we are looking for.
//
$smile_code = ( isset($HTTP_POST_VARS['smile_code']) ) ? trim($HTTP_POST_VARS['smile_code']) : '';
$smile_url = ( isset($HTTP_POST_VARS['smile_url']) ) ? trim($HTTP_POST_VARS['smile_url']) : '';
$smile_url = phpbb_ltrim(basename($smile_url), "'");
$smile_emotion = ( isset($HTTP_POST_VARS['smile_emotion']) ) ? htmlspecialchars(trim($HTTP_POST_VARS['smile_emotion'])) : '';
$smile_id = ( isset($HTTP_POST_VARS['smile_id']) ) ? intval($HTTP_POST_VARS['smile_id']) : 0;
$smile_code = trim($smile_code);
$smile_url = trim($smile_url);
$smile_code = ( isset($HTTP_POST_VARS['smile_code']) ) ? trim($HTTP_POST_VARS['smile_code']) : trim($HTTP_GET_VARS['smile_code']);
$smile_url = ( isset($HTTP_POST_VARS['smile_url']) ) ? trim($HTTP_POST_VARS['smile_url']) : trim($HTTP_GET_VARS['smile_url']);
$smile_emotion = ( isset($HTTP_POST_VARS['smile_emotion']) ) ? trim($HTTP_POST_VARS['smile_emotion']) : trim($HTTP_GET_VARS['smile_emotion']);
$smile_id = ( isset($HTTP_POST_VARS['smile_id']) ) ? intval($HTTP_POST_VARS['smile_id']) : intval($HTTP_GET_VARS['smile_id']);
// If no code was entered complain ...
if ($smile_code == '' || $smile_url == '')
{
message_die(GENERAL_MESSAGE, $lang['Fields_empty']);
message_die(MESSAGE, $lang['Fields_empty']);
}
//
@@ -482,17 +444,14 @@ else if ( $mode != "" )
// Get the submitted data being careful to ensure the the data
// we recieve and process is only the data we are looking for.
//
$smile_code = ( isset($HTTP_POST_VARS['smile_code']) ) ? $HTTP_POST_VARS['smile_code'] : '';
$smile_url = ( isset($HTTP_POST_VARS['smile_url']) ) ? $HTTP_POST_VARS['smile_url'] : '';
$smile_url = phpbb_ltrim(basename($smile_url), "'");
$smile_emotion = ( isset($HTTP_POST_VARS['smile_emotion']) ) ? htmlspecialchars(trim($HTTP_POST_VARS['smile_emotion'])) : '';
$smile_code = trim($smile_code);
$smile_url = trim($smile_url);
$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'];
// If no code was entered complain ...
if ($smile_code == '' || $smile_url == '')
{
message_die(GENERAL_MESSAGE, $lang['Fields_empty']);
message_die(MESSAGE, $lang['Fields_empty']);
}
//
@@ -594,4 +553,4 @@ else
//
include('./page_footer_admin.'.$phpEx);
?>
?>

View File

@@ -27,7 +27,7 @@ if( !empty($setmodules) )
$file = basename(__FILE__);
$module['Styles']['Add_new'] = "$file?mode=addnew";
$module['Styles']['Create_new'] = "$file?mode=create";
$module['Styles']['Manage'] = $file;
$module['Styles']['Manage'] = "$file";
$module['Styles']['Export'] = "$file?mode=export";
return;
}
@@ -75,7 +75,7 @@ switch( $mode )
if( isset($install_to) )
{
include($phpbb_root_path. "templates/" . basename($install_to) . "/theme_info.cfg");
include($phpbb_root_path. "templates/" . $install_to . "/theme_info.cfg");
$template_name = $$install_to;
$found = FALSE;
@@ -582,7 +582,6 @@ switch( $mode )
"L_SIMPLE_NAME" => $lang['Simple_name'],
"L_VALUE" => $lang['Value'],
"L_STYLESHEET" => $lang['Stylesheet'],
"L_STYLESHEET_EXPLAIN" => $lang['Stylesheet_explain'],
"L_BACKGROUND_IMAGE" => $lang['Background_image'],
"L_BACKGROUND_COLOR" => $lang['Background_color'],
"L_BODY_TEXT_COLOR" => $lang['Text_color'],
@@ -740,7 +739,7 @@ switch( $mode )
@umask(0111);
$fp = @fopen($phpbb_root_path . 'templates/' . basename($template_name) . '/theme_info.cfg', 'w');
$fp = @fopen($phpbb_root_path . 'templates/' . $template_name . '/theme_info.cfg', 'w');
if( !$fp )
{
@@ -836,7 +835,7 @@ switch( $mode )
// Set template files
//
$template->set_filenames(array(
"confirm" => "admin/confirm_body.tpl")
"confirm" => "confirm_body.tpl")
);
$template->assign_vars(array(

View File

@@ -251,10 +251,9 @@ if ( isset($HTTP_POST_VARS['submit']) && ( ( $mode == 'user' && $user_id ) || (
}
}
$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';
$sql = "SELECT *
FROM " . FORUMS_TABLE . " f
ORDER BY forum_order";
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, "Couldn't obtain forum information", "", __LINE__, __FILE__, $sql);
@@ -415,7 +414,6 @@ 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";
@@ -510,48 +508,6 @@ 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);
}
}
@@ -570,10 +526,9 @@ else if ( ( $mode == 'user' && ( isset($HTTP_POST_VARS['username']) || $user_id
//
// Front end
//
$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";
$sql = "SELECT *
FROM " . FORUMS_TABLE . " f
ORDER BY forum_order";
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, "Couldn't obtain forum information", "", __LINE__, __FILE__, $sql);
@@ -606,7 +561,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, ug.user_pending 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 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)) )
{
@@ -809,7 +764,7 @@ else if ( ( $mode == 'user' && ( isset($HTTP_POST_VARS['username']) || $user_id
$i++;
}
// @reset($auth_user);
@reset($auth_user);
if ( $mode == 'user' )
{
@@ -832,26 +787,20 @@ else if ( ( $mode == 'user' && ( isset($HTTP_POST_VARS['username']) || $user_id
}
}
$t_usergroup_list = $t_pending_list = '';
if( count($name) )
{
$t_usergroup_list = '';
for($i = 0; $i < count($ug_info); $i++)
{
$ug = ( $mode == 'user' ) ? 'group&amp;' . POST_GROUPS_URL : 'user&amp;' . POST_USERS_URL;
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>';
}
$t_usergroup_list .= ( ( $t_usergroup_list != '' ) ? ', ' : '' ) . '<a href="' . append_sid("admin_ug_auth.$phpEx?mode=$ug=" . $id[$i]) . '">' . $name[$i] . '</a>';
}
}
$t_usergroup_list = ($t_usergroup_list == '') ? $lang['None'] : $t_usergroup_list;
$t_pending_list = ($t_pending_list == '') ? $lang['None'] : $t_pending_list;
else
{
$t_usergroup_list = $lang['None'];
}
$s_column_span = 2; // Two columns always present
if( !$adv )
@@ -908,7 +857,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 . '<br />' . $lang['Pending_members'] . ' : ' . $t_pending_list)
'GROUP_MEMBERSHIP' => $lang['Usergroup_members'] . ' : ' . $t_usergroup_list)
);
}

View File

@@ -155,7 +155,7 @@ if ( isset($HTTP_POST_VARS['submit']) )
// contained in the annotated php manual at php.com (ereg
// section)
//
if (preg_match('/^(([a-z0-9&\'\.\-_\+])|(\*))+@(([a-z0-9\-])|(\*))+\.([a-z0-9\-]+\.)*?[a-z]+$/is', trim($email_list_temp[$i])))
if (preg_match('#^(([a-z0-9&.-_+])|(\*))+@[a-z0-9\-]+\.([a-z0-9\-]+\.)*?[a-z]+$#is', trim($email_list_temp[$i])))
{
$email_list[] = trim($email_list_temp[$i]);
}

View File

@@ -71,7 +71,7 @@ if ( $mode == 'edit' || $mode == 'save' && ( isset($HTTP_POST_VARS['username'])
message_die(GENERAL_MESSAGE, $lang['No_user_id_specified'] );
}
if( $HTTP_POST_VARS['deleteuser'] && ( $userdata['user_id'] != $user_id ) )
if( $HTTP_POST_VARS['deleteuser'] )
{
$sql = "SELECT g.group_id
FROM " . USER_GROUP_TABLE . " ug, " . GROUPS_TABLE . " g
@@ -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 = '" . str_replace("\\'", "''", addslashes($this_userdata['username'])) . "'
SET poster_id = " . DELETED . ", post_username = '$username'
WHERE poster_id = $user_id";
if( !$db->sql_query($sql) )
{
@@ -177,20 +177,6 @@ if ( $mode == 'edit' || $mode == 'save' && ( isset($HTTP_POST_VARS['username'])
message_die(GENERAL_ERROR, 'Could not delete user from banlist table', '', __LINE__, __FILE__, $sql);
}
$sql = "DELETE FROM " . SESSIONS_TABLE . "
WHERE session_user_id = $user_id";
if ( !$db->sql_query($sql) )
{
message_die(GENERAL_ERROR, 'Could not delete sessions for this user', '', __LINE__, __FILE__, $sql);
}
$sql = "DELETE FROM " . SESSIONS_KEYS_TABLE . "
WHERE user_id = $user_id";
if ( !$db->sql_query($sql) )
{
message_die(GENERAL_ERROR, 'Could not delete auto-login keys for this user', '', __LINE__, __FILE__, $sql);
}
$sql = "SELECT privmsgs_id
FROM " . PRIVMSGS_TABLE . "
WHERE privmsgs_from_userid = $user_id
@@ -231,7 +217,7 @@ if ( $mode == 'edit' || $mode == 'save' && ( isset($HTTP_POST_VARS['username'])
message_die(GENERAL_MESSAGE, $message);
}
$username = ( !empty($HTTP_POST_VARS['username']) ) ? phpbb_clean_username($HTTP_POST_VARS['username']) : '';
$username = ( !empty($HTTP_POST_VARS['username']) ) ? trim(strip_tags(htmlspecialchars($HTTP_POST_VARS['username']))) : '';
$email = ( !empty($HTTP_POST_VARS['email']) ) ? trim(strip_tags(htmlspecialchars( $HTTP_POST_VARS['email'] ) )) : '';
$password = ( !empty($HTTP_POST_VARS['password']) ) ? trim(strip_tags(htmlspecialchars( $HTTP_POST_VARS['password'] ) )) : '';
@@ -261,13 +247,13 @@ if ( $mode == 'edit' || $mode == 'save' && ( isset($HTTP_POST_VARS['username'])
$allowbbcode = ( isset( $HTTP_POST_VARS['allowbbcode']) ) ? intval( $HTTP_POST_VARS['allowbbcode'] ) : $board_config['allow_bbcode'];
$allowsmilies = ( isset( $HTTP_POST_VARS['allowsmilies']) ) ? intval( $HTTP_POST_VARS['allowsmilies'] ) : $board_config['allow_smilies'];
$user_style = ( isset( $HTTP_POST_VARS['style'] ) ) ? intval( $HTTP_POST_VARS['style'] ) : $board_config['default_style'];
$user_style = ( $HTTP_POST_VARS['style'] ) ? intval( $HTTP_POST_VARS['style'] ) : $board_config['default_style'];
$user_lang = ( $HTTP_POST_VARS['language'] ) ? $HTTP_POST_VARS['language'] : $board_config['default_lang'];
$user_timezone = ( isset( $HTTP_POST_VARS['timezone']) ) ? doubleval( $HTTP_POST_VARS['timezone'] ) : $board_config['board_timezone'];
$user_template = ( $HTTP_POST_VARS['template'] ) ? $HTTP_POST_VARS['template'] : $board_config['board_template'];
$user_dateformat = ( $HTTP_POST_VARS['dateformat'] ) ? trim( $HTTP_POST_VARS['dateformat'] ) : $board_config['default_dateformat'];
$user_avatar_local = ( isset( $HTTP_POST_VARS['avatarselect'] ) && !empty($HTTP_POST_VARS['submitavatar'] ) && $board_config['allow_avatar_local'] ) ? $HTTP_POST_VARS['avatarselect'] : ( ( isset( $HTTP_POST_VARS['avatarlocal'] ) ) ? $HTTP_POST_VARS['avatarlocal'] : '' );
$user_avatar_category = ( isset($HTTP_POST_VARS['avatarcatname']) && $board_config['allow_avatar_local'] ) ? htmlspecialchars($HTTP_POST_VARS['avatarcatname']) : '' ;
$user_avatar_remoteurl = ( !empty($HTTP_POST_VARS['avatarremoteurl']) ) ? trim( $HTTP_POST_VARS['avatarremoteurl'] ) : '';
$user_avatar_url = ( !empty($HTTP_POST_VARS['avatarurl']) ) ? trim( $HTTP_POST_VARS['avatarurl'] ) : '';
@@ -307,7 +293,7 @@ if ( $mode == 'edit' || $mode == 'save' && ( isset($HTTP_POST_VARS['username'])
if ( !isset($HTTP_POST_VARS['cancelavatar']))
{
$user_avatar = $user_avatar_category . '/' . $user_avatar_local;
$user_avatar = $user_avatar_local;
$user_avatar_type = USER_AVATAR_GALLERY;
}
}
@@ -403,9 +389,9 @@ if ( $mode == 'edit' || $mode == 'save' && ( isset($HTTP_POST_VARS['username'])
{
if( $this_userdata['user_avatar_type'] == USER_AVATAR_UPLOAD && $this_userdata['user_avatar'] != "" )
{
if( @file_exists(@phpbb_realpath('./../' . $board_config['avatar_path'] . "/" . $this_userdata['user_avatar'])) )
if( @file_exists(@phpbb_realpath("./" . $board_config['avatar_path'] . "/" . $this_userdata['user_avatar'])) )
{
@unlink('./../' . $board_config['avatar_path'] . "/" . $this_userdata['user_avatar']);
@unlink("./" . $board_config['avatar_path'] . "/" . $this_userdata['user_avatar']);
}
}
$avatar_sql = ", user_avatar = '', user_avatar_type = " . USER_AVATAR_NONE;
@@ -659,7 +645,7 @@ if ( $mode == 'edit' || $mode == 'save' && ( isset($HTTP_POST_VARS['username'])
}
else if( $user_avatar_local != "" && $avatar_sql == "" && !$error )
{
$avatar_sql = ", user_avatar = '" . str_replace("\'", "''", phpbb_ltrim(basename($user_avatar_category), "'") . '/' . phpbb_ltrim(basename($user_avatar_local), "'")) . "', user_avatar_type = " . USER_AVATAR_GALLERY;
$avatar_sql = ", user_avatar = '" . str_replace("\'", "''", $user_avatar_local) . "', user_avatar_type = " . USER_AVATAR_GALLERY;
}
//
@@ -695,19 +681,13 @@ if ( $mode == 'edit' || $mode == 'save' && ( isset($HTTP_POST_VARS['username'])
message_die(GENERAL_ERROR, 'Error removing user session', '', __LINE__, __FILE__, $sql);
}
}
// We remove all stored login keys since the password has been updated
// and change the current one (if applicable)
if ( !empty($passwd_sql) )
{
session_reset_keys($user_id, $user_ip);
}
$message .= $lang['Admin_user_updated'];
}
else
{
message_die(GENERAL_ERROR, 'Admin_user_fail', '', __LINE__, __FILE__, $sql);
$error = TRUE;
$error_msg .= ( ( isset($error_msg) ) ? '<br />' : '' ) . $lang['Admin_user_fail'];
}
$message .= '<br /><br />' . sprintf($lang['Click_return_useradmin'], '<a href="' . append_sid("admin_users.$phpEx") . '">', '</a>') . '<br /><br />' . sprintf($lang['Click_return_admin_index'], '<a href="' . append_sid("index.$phpEx?pane=right") . '">', '</a>');
@@ -842,7 +822,7 @@ if ( $mode == 'edit' || $mode == 'save' && ( isset($HTTP_POST_VARS['username'])
{
if( preg_match("/(\.gif$|\.png$|\.jpg)$/is", $sub_file) )
{
$avatar_images[$file][$avatar_row_count][$avatar_col_count] = $sub_file;
$avatar_images[$file][$avatar_row_count][$avatar_col_count] = $file . "/" . $sub_file;
$avatar_col_count++;
if( $avatar_col_count == 5 )
@@ -887,7 +867,7 @@ if ( $mode == 'edit' || $mode == 'save' && ( isset($HTTP_POST_VARS['username'])
for($j = 0; $j < count($avatar_images[$category][$i]); $j++)
{
$template->assign_block_vars("avatar_row.avatar_column", array(
"AVATAR_IMAGE" => "../" . $board_config['avatar_gallery_path'] . '/' . $category . '/' . $avatar_images[$category][$i][$j])
"AVATAR_IMAGE" => "../" . $board_config['avatar_gallery_path'] . "/" . $avatar_images[$category][$i][$j])
);
$template->assign_block_vars("avatar_row.avatar_option_column", array(
@@ -898,7 +878,7 @@ if ( $mode == 'edit' || $mode == 'save' && ( isset($HTTP_POST_VARS['username'])
$coppa = ( ( !$HTTP_POST_VARS['coppa'] && !$HTTP_GET_VARS['coppa'] ) || $mode == "register") ? 0 : TRUE;
$s_hidden_fields = '<input type="hidden" name="mode" value="edit" /><input type="hidden" name="agreed" value="true" /><input type="hidden" name="coppa" value="' . $coppa . '" /><input type="hidden" name="avatarcatname" value="' . $category . '" />';
$s_hidden_fields = '<input type="hidden" name="mode" value="edit" /><input type="hidden" name="agreed" value="true" /><input type="hidden" name="coppa" value="' . $coppa . '" />';
$s_hidden_fields .= '<input type="hidden" name="id" value="' . $user_id . '" />';
$s_hidden_fields .= '<input type="hidden" name="username" value="' . str_replace("\"", "&quot;", $username) . '" />';
@@ -954,7 +934,7 @@ if ( $mode == 'edit' || $mode == 'save' && ( isset($HTTP_POST_VARS['username'])
if( !empty($user_avatar_local) )
{
$s_hidden_fields .= '<input type="hidden" name="avatarlocal" value="' . $user_avatar_local . '" /><input type="hidden" name="avatarcatname" value="' . $user_avatar_category . '" />';
$s_hidden_fields .= '<input type="hidden" name="avatarlocal" value="' . $user_avatar_local . '" />';
}
if( $user_avatar_type )

View File

@@ -20,34 +20,25 @@
*
***************************************************************************/
define('IN_PHPBB', 1);
if( !empty($setmodules) )
{
$file = basename(__FILE__);
$module['General']['Word_Censor'] = $file;
$module['General']['Word_Censor'] = "$file";
return;
}
define('IN_PHPBB', 1);
//
// Load default header
//
$phpbb_root_path = "./../";
require($phpbb_root_path . 'extension.inc');
$cancel = ( isset($HTTP_POST_VARS['cancel']) ) ? true : false;
$no_page_header = $cancel;
require('./pagestart.' . $phpEx);
if ($cancel)
{
redirect('admin/' . append_sid("admin_words.$phpEx", true));
}
if( isset($HTTP_GET_VARS['mode']) || isset($HTTP_POST_VARS['mode']) )
{
$mode = (isset($HTTP_GET_VARS['mode'])) ? $HTTP_GET_VARS['mode'] : $HTTP_POST_VARS['mode'];
$mode = ($HTTP_GET_VARS['mode']) ? $HTTP_GET_VARS['mode'] : $HTTP_POST_VARS['mode'];
$mode = htmlspecialchars($mode);
}
else
@@ -69,9 +60,6 @@ else
}
}
// Restrict mode input to valid options
$mode = ( in_array($mode, array('add', 'edit', 'save', 'delete')) ) ? $mode : '';
if( $mode != "" )
{
if( $mode == "edit" || $mode == "add" )
@@ -82,7 +70,6 @@ if( $mode != "" )
"body" => "admin/words_edit_body.tpl")
);
$word_info = array('word' => '', 'replacement' => '');
$s_hidden_fields = '';
if( $mode == "edit" )
@@ -171,9 +158,7 @@ if( $mode != "" )
$word_id = 0;
}
$confirm = isset($HTTP_POST_VARS['confirm']);
if( $word_id && $confirm )
if( $word_id )
{
$sql = "DELETE FROM " . WORDS_TABLE . "
WHERE word_id = $word_id";
@@ -187,26 +172,6 @@ if( $mode != "" )
message_die(GENERAL_MESSAGE, $message);
}
elseif( $word_id && !$confirm)
{
// Present the confirmation screen to the user
$template->set_filenames(array(
'body' => 'admin/confirm_body.tpl')
);
$hidden_fields = '<input type="hidden" name="mode" value="delete" /><input type="hidden" name="id" value="' . $word_id . '" />';
$template->assign_vars(array(
'MESSAGE_TITLE' => $lang['Confirm'],
'MESSAGE_TEXT' => $lang['Confirm_delete_word'],
'L_YES' => $lang['Yes'],
'L_NO' => $lang['No'],
'S_CONFIRM_ACTION' => append_sid("admin_words.$phpEx"),
'S_HIDDEN_FIELDS' => $hidden_fields)
);
}
else
{
message_die(GENERAL_MESSAGE, $lang['No_word_selected']);
@@ -228,7 +193,6 @@ else
}
$word_rows = $db->sql_fetchrowset($result);
$db->sql_freeresult($result);
$word_count = count($word_rows);
$template->assign_vars(array(

View File

@@ -60,7 +60,7 @@ if( isset($HTTP_GET_VARS['pane']) && $HTTP_GET_VARS['pane'] == 'left' )
{
if( preg_match("/^admin_.*?\." . $phpEx . "$/", $file) )
{
include('./' . $file);
include($file);
}
}
@@ -234,9 +234,9 @@ elseif( isset($HTTP_GET_VARS['pane']) && $HTTP_GET_VARS['pane'] == 'right' )
$row = $db->sql_fetchrow($result);
$version = $row['mysql_version'];
if( preg_match("/^(3\.23|4\.|5\.)/", $version) )
if( preg_match("/^(3\.23|4\.)/", $version) )
{
$db_name = ( preg_match("/^(3\.23\.[6-9])|(3\.23\.[1-9][1-9])|(4\.)|(5\.)/", $version) ) ? "`$dbname`" : $dbname;
$db_name = ( preg_match("/^(3\.23\.[6-9])|(3\.23\.[1-9][1-9])|(4\.)/", $version) ) ? "`$dbname`" : $dbname;
$sql = "SHOW TABLE STATUS
FROM " . $db_name;
@@ -560,71 +560,6 @@ 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, 10))
{
@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

@@ -25,8 +25,6 @@ if ( !defined('IN_PHPBB') )
die("Hacking attempt");
}
global $do_gzip_compress;
//
// Show the overall footer.
//
@@ -35,8 +33,8 @@ $template->set_filenames(array(
);
$template->assign_vars(array(
'PHPBB_VERSION' => ($userdata['user_level'] == ADMIN && $userdata['user_id'] != ANONYMOUS) ? '2' . $board_config['version'] : '',
'TRANSLATION_INFO' => (isset($lang['TRANSLATION_INFO'])) ? $lang['TRANSLATION_INFO'] : ((isset($lang['TRANSLATION'])) ? $lang['TRANSLATION'] : ''))
'PHPBB_VERSION' => '2' . $board_config['version'],
'TRANSLATION_INFO' => $lang['TRANSLATION_INFO'])
);
$template->pparse('page_footer');

View File

@@ -35,7 +35,7 @@ if ( $board_config['gzip_compress'] )
{
$phpver = phpversion();
$useragent = (isset($HTTP_SERVER_VARS['HTTP_USER_AGENT'])) ? $HTTP_SERVER_VARS['HTTP_USER_AGENT'] : getenv('HTTP_USER_AGENT');
$useragent = (isset($_SERVER["HTTP_USER_AGENT"]) ) ? $_SERVER["HTTP_USER_AGENT"] : $HTTP_USER_AGENT;
if ( $phpver >= '4.0.4pl1' && ( strstr($useragent,'compatible') || strstr($useragent,'Gecko') ) )
{
@@ -132,18 +132,6 @@ $template->assign_vars(array(
'T_SPAN_CLASS3' => $theme['span_class3'])
);
// Work around for "current" Apache 2 + PHP module which seems to not
// cope with private cache control setting
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');
}
else
{
header ('Cache-Control: private, pre-check=0, post-check=0, max-age=0');
}
header ('Expires: 0');
header ('Pragma: no-cache');
$template->pparse('header');

View File

@@ -40,7 +40,7 @@ init_userprefs($userdata);
if (!$userdata['session_logged_in'])
{
redirect(append_sid("login.$phpEx?redirect=admin/index.$phpEx", true));
redirect(append_sid("login.$phpEx?redirect=admin/", true));
}
else if ($userdata['user_level'] != ADMIN)
{
@@ -49,12 +49,14 @@ else if ($userdata['user_level'] != ADMIN)
if ($HTTP_GET_VARS['sid'] != $userdata['session_id'])
{
redirect("index.$phpEx?sid=" . $userdata['session_id']);
}
$url = str_replace(preg_replace('#^\/?(.*?)\/?$#', '\1', trim($board_config['server_name'])), '', $HTTP_SERVER_VARS['REQUEST_URI']);
$url = str_replace(preg_replace('#^\/?(.*?)\/?$#', '\1', trim($board_config['script_path'])), '', $url);
$url = str_replace('//', '/', $url);
$url = preg_replace('/sid=([^&]*)(&?)/i', '', $url);
$url = preg_replace('/\?$/', '', $url);
$url .= ((strpos($url, '?')) ? '&' : '?') . 'sid=' . $userdata['session_id'];
if (!$userdata['session_admin'])
{
redirect(append_sid("login.$phpEx?redirect=admin/index.$phpEx&admin=1", true));
redirect("index.$phpEx?sid=" . $userdata['session_id']);
}
if (empty($no_page_header))

View File

@@ -24,15 +24,60 @@ 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
// The following code (unsetting globals)
// Thanks to Matt Kavanagh and Stefan Esser for providing feedback as well as patch files
$ini_val = (@phpversion() >= '4.0.0') ? 'ini_get' : 'get_cfg_var';
// Unset globally registered vars - PHP5 ... hhmmm
if (@$ini_val('register_globals') == '1' || strtolower(@$ini_val('register_globals')) == 'on')
{
$var_prefix = 'HTTP';
$var_suffix = '_VARS';
$test = array('_GET', '_POST', '_SERVER', '_COOKIE', '_ENV');
foreach ($test as $var)
{
if (is_array(${$var_prefix . $var . $var_suffix}))
{
unset_vars(${$var_prefix . $var . $var_suffix});
@reset(${$var_prefix . $var . $var_suffix});
}
if (is_array(${$var}))
{
unset_vars(${$var});
@reset(${$var});
}
}
if (is_array(${'_FILES'}))
{
unset_vars(${'_FILES'});
@reset(${'_FILES'});
}
if (is_array(${'HTTP_POST_FILES'}))
{
unset_vars(${'HTTP_POST_FILES'});
@reset(${'HTTP_POST_FILES'});
}
}
// PHP5 with register_long_arrays off?
if (@phpversion() >= '5.0.0' && (!@ini_get('register_long_arrays') || @ini_get('register_long_arrays') == '0' || strtolower(@ini_get('register_long_arrays')) == 'off'))
if (!isset($HTTP_POST_VARS) && isset($_POST))
{
$HTTP_POST_VARS = $_POST;
$HTTP_GET_VARS = $_GET;
@@ -40,56 +85,6 @@ if (@phpversion() >= '5.0.0' && (!@ini_get('register_long_arrays') || @ini_get('
$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;
}
}
// Protect against GLOBALS tricks
if (isset($HTTP_POST_VARS['GLOBALS']) || isset($HTTP_POST_FILES['GLOBALS']) || isset($HTTP_GET_VARS['GLOBALS']) || isset($HTTP_COOKIE_VARS['GLOBALS']))
{
die("Hacking attempt");
}
// Protect against HTTP_SESSION_VARS tricks
if (isset($HTTP_SESSION_VARS) && !is_array($HTTP_SESSION_VARS))
{
die("Hacking attempt");
}
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');
// 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) || !is_array($HTTP_SESSION_VARS))
{
$HTTP_SESSION_VARS = array();
}
// 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))
{
if (in_array($var, $not_unset))
{
die('Hacking attempt!');
}
unset($$var);
}
unset($input);
}
//
@@ -171,14 +166,13 @@ $theme = array();
$images = array();
$lang = array();
$nav_links = array();
$dss_seeded = false;
$gen_simple_header = FALSE;
include($phpbb_root_path . 'config.'.$phpEx);
if( !defined("PHPBB_INSTALLED") )
{
header('Location: ' . $phpbb_root_path . 'install/install.' . $phpEx);
header("Location: install/install.$phpEx");
exit;
}
@@ -189,9 +183,6 @@ include($phpbb_root_path . 'includes/auth.'.$phpEx);
include($phpbb_root_path . 'includes/functions.'.$phpEx);
include($phpbb_root_path . 'includes/db.'.$phpEx);
// We do not need this any longer, unset for safety purposes
unset($dbpasswd);
//
// Obtain and encode users IP
//
@@ -200,7 +191,7 @@ unset($dbpasswd);
// 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'] : getenv('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'] : $REMOTE_ADDR );
$user_ip = encode_ip($client_ip);
//
@@ -222,7 +213,7 @@ while ( $row = $db->sql_fetchrow($result) )
if (file_exists('install') || file_exists('contrib'))
{
message_die(GENERAL_MESSAGE, 'Please_remove_install_contrib');
message_die(GENERAL_MESSAGE, 'Please ensure both the install/ and contrib/ directories are deleted');
}
//

View File

@@ -289,7 +289,7 @@ class sql_db
while( list($key, $value) = @each($row) )
{
$row[$key] = ($value === ' ') ? '' : stripslashes($value);
$row[$key] = stripslashes($value);
}
@reset($row);
@@ -317,7 +317,7 @@ class sql_db
{
while( list($key, $value) = @each($row) )
{
$rowset[$i][$key] = ($value === ' ') ? '' : stripslashes($value);
$rowset[$i][$key] = stripslashes($value);
}
$i++;
}
@@ -356,7 +356,7 @@ class sql_db
if( empty($this->row[$query_id]) )
{
$this->row[$query_id] = @mssql_fetch_array($query_id);
$result = ($this->row[$query_id][$field] === ' ') ? '' : stripslashes($this->row[$query_id][$field]);
$result = stripslashes($this->row[$query_id][$field]);
}
}

View File

@@ -259,7 +259,7 @@ class sql_db
{
if($this->rowset[$query_id])
{
$result = $this->rowset[$query_id][0][$field];
$result = $this->rowset[$query_id][$field];
}
else if($this->row[$query_id])
{

View File

@@ -271,7 +271,7 @@ class sql_db
{
if( $this->rowset[$query_id] )
{
$result = $this->rowset[$query_id][0][$field];
$result = $this->rowset[$query_id][$field];
}
else if( $this->row[$query_id] )
{

472
phpBB/db/oracle.php Normal file
View File

@@ -0,0 +1,472 @@
<?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

@@ -1,6 +1 @@
Please see: http://www.phpbb.com/about.php for a list of all the people involved in phpBB.
Please see: http://www.phpbb.com/about.php for a list of people involved within the security audit of phpBB (since phpBB 2.0.17).
[September 2005]
Our special thanks goes to our former developer and manager psoTFX (Paul S. Owen) for being a wonderful teammate and talented programer.
He was a driving force in the project for over 3 years and helped a lot in making phpBB what it is now.

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.x :: Changelog</title>
<title>phpBB 2.0.10 :: 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.x CHANGELOG</span></td>
<td align="center" width="100%" valign="middle"><span class="maintitle">phpBB 2.0.10 CHANGELOG</span></td>
</tr>
</table>
@@ -32,18 +32,6 @@ p,ul,td {font-size:10pt;}
<ol>
<li><a href="#changelog">Changelog</a></li>
<ol type="i">
<li><a href="#2021">Changes since 2.0.21</a></li>
<li><a href="#2020">Changes since 2.0.20</a></li>
<li><a href="#2019">Changes since 2.0.19</a></li>
<li><a href="#2018">Changes since 2.0.18</a></li>
<li><a href="#2017">Changes since 2.0.17</a></li>
<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>
@@ -67,241 +55,7 @@ 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="2021"></a><h3 class="h3">l.i. Changes since 2.0.21</h3>
<ul>
<li>[Fix] Check for user's existence prior to showing email form</li>
<li>[Fix] New members of moderator groups should always become moderators (Bug #382)</li>
<li>[Fix] Proper message when replying to non-existant topics (Bug #459)</li>
<li>[Fix] Changed column type of search_array to store more ids (Bug #4058)</li>
<li>[Fix] Fixed annoyance with font-size selector (Bug #4612)</li>
<li>[Fix] Fix optimize line in database updater (Bug #6186)</li>
<li>[Sec] Check for the avatar upload directory reinforced</li>
<li>[Sec] Changes to the criteria for "bad" redirection targets - kellanved</li>
<li>[Sec] Fixed a non-persistent XSS issue in private messaging</li>
<li>[Sec] Fixing possible negative start parameter - SpiderZ.</li>
<li>[Sec] Added session checks to various forms - kellanved</li>
</ul>
<a name="2020"></a><h3 class="h3">l.ii. Changes since 2.0.20</h3>
<ul>
<li>[Fix] Changes to random number generator code to explicitly truncate the length of the string</li>
<li>[Fix] Quoting on boards with HTML enabled</li>
<li>[Fix] Special characters on boards with HTML enabled</li>
<li>[Fix] Redirect to list if cancelling deletion of ranks, smilies or word censors</li>
<li>[Fix] Missing error message if an inactive user tried to login (Bug #1598)</li>
<li>[Fix] Do not alter post counts when just removing a poll (Bug #1602)</li>
<li>[Fix] Correct error in removal of old session keys</li>
<li>[Fix] Changed filtering of short search terms</li>
<li>[Sec] Improved filtering on language selection (also addresses a number of bug reports related to missing languages)</li>
<li>[Change] Backported more efficient highlighting code from Olympus</li>
<li>[Change] Backported zlib emulation code so that there is only a single confirmation image even if zlib is not available</li>
</ul>
<a name="2019"></a><h3 class="h3">l.iii. Changes since 2.0.19</h3>
<ul>
<li>[Fix] Prevent login attempts from incrementing for inactive users</li>
<li>[Fix] Do not check maximum login attempts on re-authentication to the admin panel - tomknight</li>
<li>[Fix] Regenerate session keys on password change</li>
<li>[Fix] retrieving category rows in index.php (Bug #90)</li>
<li>[Fix] improved index performance by determining the permissions before iterating through all forums (Bug #91)</li>
<li>[Fix] Better handling of short usernames within the search (bug #105)</li>
<li>[Fix] Send a no-cache header on admin pages as well as normal board pages (Bug #149)</li>
<li>[Fix] Apply word censors to the message when quoting it (Bug #405)</li>
<li>[Fix] Improved performance of query in admin_groups (Bug #753)</li>
<li>[Fix] Workaround for an issue in either PHP or MSSQL resulting in a space being returned instead of an empty string (bug #830)</li>
<li>[Fix] Correct use of default_style config value (Bug #861)</li>
<li>[Fix] Replace unneeded unset calls in admin_db_utilities.php - vanderaj</li>
<li>[Fix] Improved error handling in modcp.php</li>
<li>[Fix] Improved handling of forums to which the user does not have any explicit permissions - vanderaj</li>
<li>[Fix] Assorted fixes and cleanup of admin_ranks.php, now requires confirmation of deletions</li>
<li>[Fix] Assorted fixes and cleanup of admin_words.php, now requires confirmation of deletions</li>
<li>[Fix] Addition and editing of smilies can no longer be performed via GET, now requires confirmation of deletions</li>
<li>[Fix] Escape group names in admin_groups.php</li>
<li>[Sec] Replace strip_tags with htmlspecialchars in private message subject</li>
<li>[Sec] Some changes to HTML handling if enabled</li>
<li>[Sec] Escape any special characters in reverse dns - Anthrax101</li>
<li>[Sec] Typecast poll id values - Anthrax101</li>
<li>[Sec] Added configurable search flood control to reduce the effect of DoS style attacks</li>
<li>[Sec] Changed the way we create "random" values for use as keys - chinchilla/Anthrax101</li>
<li>[Change] Changed handling of the case where a selected style doesn't exist in the database</li>
<li>[Change] Changed handling of topic pruning to improve performance</li>
<li>[Change] Changed default forum permissions to only allow registered users to post in new forums</li>
</ul>
<a name="2018"></a><h3 class="h3">l.iv. Changes since 2.0.18</h3>
<ul>
<li>[Fix] corrected index on session keys table under MS SQL</li>
<li>[Fix] added session keys table to backup</li>
<li>[Fix] delete session keys entries when deleting user</li>
<li>[Fix] changes to support MySQL 5.0</li>
<li>[Fix] changes to some of the admin files to improve efficiency and remove a potential error condition when building the menu</li>
<li>[Fix] change truncation of username length in usercp_register.php - BFUK</li>
<li>[Fix] incorrect path to avatars in admin_users.php (Bug #667)</li>
<li>[Fix] fixed get_userdata to support correct sql escaping (non-mysql dbs) - jarnaez</li>
<li>[Fix] fixed captcha for those not having the zlib extension enabled</li>
<li>[Change] Placed version information above who is online in admin panel for better visual presence</li>
<li>[Sec] fixed XSS issue (only valid for Internet Explorer) within the url bbcode</li>
<li>[Sec] fixed XSS issue if html tags are allowed and enabled</li>
<li>[Sec] added configurable maximum login attempts to prevent dictionary attacks</li>
</ul>
<a name="2017"></a><h3 class="h3">l.v. Changes since 2.0.17</h3>
<ul>
<li>[Fix] incorrect handling of password resets if admin activation is enabled (Bug #88)</li>
<li>[Fix] wrong topic redirection after login redirect (Bug #94)</li>
<li>[Fix] improved handling of username lists in admin_ug_auth.php (Bug #98)</li>
<li>[Fix] incorrect removal of bbcode_uid values if bbcode has been turned off (Bug #100)</li>
<li>[Fix] correctly preview signature if editing other users posts (Bug #101)</li>
<li>[Fix] incorrect alt tag on generated search images in groupcp.php, viewtopic.php and usercp_viewprofile.php (Bug #102)</li>
<li>[Fix] consistent forum ordering in all dropdown boxes (Bug #106)</li>
<li>[Fix] correctly get compression status in page_tail.php and page_footer_admin.php (Bug #117)</li>
<li>[Fix] set page title on summary page of groupcp.php (bug #125)</li>
<li>[Fix] correctly test style and avatar in usercp_register.php (bug #129 and #317)</li>
<li>[Fix] handling of reactivation notifications if admin activation is enabled (Bug #145)</li>
<li>[Fix] handling of both forms of translation information used in language packs (Bug #159)</li>
<li>[Fix] key length for activation keys fixed in usercp_sendpassword.php (Bug #171)</li>
<li>[Fix] use GENERAL_MESSAGE constant in message_die instead of MESSAGE (Bug #176)</li>
<li>[Fix] incorrect handling of move stubs (Bug #179)</li>
<li>[Fix] wrong mode_type in memberlist (Bug #187)</li>
<li>[Fix] SQL errors when setting maximum PMs to 0 (Bug #188)</li>
<li>[Fix] removed unused variable from topic_notify email template (Bug #210)</li>
<li>[Fix] removed unset variable from smilies popup window title (Bug #224)</li>
<li>[Fix] removed duplicate template assignment from admin_board.php (Bug #226)</li>
<li>[Fix] incorrect search link for guest posts in modcp.php (Bug #254)</li>
<li>[Fix] all users removed from topics watch table on special occassions (Bug #271)</li>
<li>[Fix] correctly check returned value from strpos in append_sid function (Bug #275)</li>
<li>[Fix] correctly display username in private message notification (Bug #278)</li>
<li>[Fix] fixed "var-by-ref" errors (Bug #322)</li>
<li>[Fix] changed redirection to installation (Bug #325)</li>
<li>[Fix] added timout of 10 seconds to version check (Bug #348)</li>
<li>[Fix] fixed user_level default in postgresql schema file (Bug #444)</li>
<li>[Fix] multiple minor HTML issues with subSilver</li>
<li>[Change] deprecated the use of some PHP 3 compatability functions in favour of the native equivalents</li>
<li>[Change] added 60 days limit for grabbing unread topics in index.php</li>
<li>[Sec] backport of session keys system from olympus</li>
<li>[Sec] fixed email bans to use the same pattern as email validation and allow wildcard domain bans</li>
<li>[Sec] fixed validation of topic type when posting</li>
<li>[Sec] unset database password once it is no longer needed</li>
<li>[Sec] fixed potential to select images outside the specified path as avatars or smilies</li>
<li>[Sec] fix globals de-registration code for PHP5 - (Stefan Esser/Matt Kavanagh)</li>
<li>[Sec] changed avatar gallery code sections to prevent possible injection points (AnthraX101)</li>
<li>[Sec] signature field is not properly sanitised for user input when an error occurs while accessing the avatar gallery (AnthraX101)</li>
<li>[Sec] check to_username and ownership when editing a PM (AnthraX101)</li>
<li>[Sec] fixed ability to edit PM's you did not send (depablo84)</li>
<li>[Sec] compare imagetype on avatar uploading to match the file extension from uploaded file</li>
</ul>
<a name="2016"></a><h3 class="h3">l.vi. 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.vii. 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.viii. 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.ix. 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.x. 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.xi. 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.xii. 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.xiii. Changes since 2.0.9</h3>
<a name="209"></a><h3 class="h3">l.i. Changes since 2.0.9</h3>
<ul>
<li>Fixed deleting of styles in admin_styles.php</li>
@@ -314,7 +68,7 @@ p,ul,td {font-size:10pt;}
<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.xiv. Changes since 2.0.8</h3>
<a name="208"></a><h3 class="h3">l.ii. Changes since 2.0.8</h3>
<ul>
<li>Fixed one vulnerability in admin_board.php - <b>Xore</b></li>
@@ -333,7 +87,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.xv. Changes since 2.0.7</h3>
<a name="207"></a><h3 class="h3">l.iii. Changes since 2.0.7</h3>
<ul>
<li>Fixed several vulnerabilities in admin pages</li>
@@ -345,7 +99,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.xvi. Changes since 2.0.6</h3>
<a name="206"></a><h3 class="h3">1.iv. Changes since 2.0.6</h3>
<ul>
<li>Fixed several vulnerabilities in modcp - <b>Robert Lavierck</b></li>
@@ -359,7 +113,7 @@ p,ul,td {font-size:10pt;}
<li>Fixed potential vulnerability in avatar gallery</li>
</ul>
<a name="205"></a><h3 class="h3">1.xvii. Changes since 2.0.5</h3>
<a name="205"></a><h3 class="h3">1.v. Changes since 2.0.5</h3>
<ul>
<li>Fixed various email issues</li>
@@ -375,7 +129,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.xviii. Changes since 2.0.4</h3>
<a name="204"></a><h3 class="h3">1.vi. Changes since 2.0.4</h3>
<ul>
<li>Removed user facing session_id checks</li>
@@ -447,7 +201,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.xix. Changes since 2.0.3</h3>
<a name="203"></a><h3 class="h3">1.vii. Changes since 2.0.3</h3>
<ul>
<li>Fixed cross-browser scripting issue with highlight param</li>
@@ -574,7 +328,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.xx. Changes since 2.0.2</h3>
<a name="202"></a><h3 class="h3">1.viii. Changes since 2.0.2</h3>
<ul>
<li>Fixed potential cross-site scripting vulnerability with avatars - <b>Showscout</b></li>
@@ -583,7 +337,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.xxi. Changes since 2.0.1</h3>
<a name="201"></a><h3 class="h3">1.ix. Changes since 2.0.1</h3>
<ul>
<li>Fixed missing "username" lang variable in user admin template</li>
@@ -618,7 +372,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.xxii. Changes since 2.0.0</h3>
<a name="200"></a><h3 class="h3">1.x. Changes since 2.0.0</h3>
<ul>
<li>Fixed delete image bug for normal users</li>
@@ -675,7 +429,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.xxiii. Changes since RC-4</h3>
<a name="final"></a><h3 class="h3">1.xi. Changes since RC-4</h3>
<ul>
<li>Fixed improper report of general error when posting messages containing errors</li>
@@ -705,7 +459,7 @@ p,ul,td {font-size:10pt;}
<li>Fixed various remaining usergroup display issues</li>
</ul>
<a name="rc4"></a><h3 class="h3">1.xxiv. Changes since RC-3</h3>
<a name="rc4"></a><h3 class="h3">1.xii. Changes since RC-3</h3>
<ul>
<li>Addressed serious security issue with included files</li>
@@ -736,7 +490,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.xxv. Changes since RC-2</h3>
<a name="rc3"></a><h3 class="h3">1.xiii. Changes since RC-2</h3>
<ul>
<li>Fixed infamous install parse error</li>
@@ -769,7 +523,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.xxvi. Changes since RC-1</h3>
<a name="rc2"></a><h3 class="h3">1.xiv. Changes since RC-1</h3>
<ul>
<li>Fixed numerous PostgreSQL related issues</li>
@@ -789,7 +543,7 @@ p,ul,td {font-size:10pt;}
<li>Various other fixes and updates</li>
</ul>
<a name="rc1"></a><h3 class="h3">1.xxvii. Changes since RC-1 (pre)</h3>
<a name="rc1"></a><h3 class="h3">1.xv. Changes since RC-1 (pre)</h3>
<ul>
<li>Upgrade script completed for initial fully functional release</li>

View File

@@ -162,23 +162,21 @@ h3 {font-size:12pt;}
<p>If you want to allow your users to make use of HTML in posts you need to do two things. Firstly enable HTML in Admin -> General -> Configuration. Secondly to need to make sure that the tags your users will post are in the Allowed HTML Tags field (again Admin -> General -> Configuration). If users post using tags not on this list they won't be displayed as HTML! eg. to enable someone to post Flash you could add the embed tag to this field. Be careful which tags you allow, it is very easy to break the boards own output if the wrong tags are used in posts. </p></p></li>
<li><b>Can I suggest a feature for phpBB 3.0?</b>
<li><b>Can I suggest a feature for phpBB 2.2?</b>
<p>No, the feature list for phpBB 3.0 is now frozen and no new features will be added to that list. At the moment we do not accept new feature requests.</p>
<!--
You may however add requests for the next release after that, 3.2, in our feature tracker:</p>
<p>Yes you most certainly can, phpBB 2.0.0 is now feature frozen and only bug fix releases will be made from this line. However, work has already started on the next release of phpBB, phpBB 2.2. We already have a number of features in mind and these are listed on our task manager:</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><a href="http://sourceforge.net/pm/task.php?group_project_id=13524&group_id=7885&func=browse" target="_tasks">http://sourceforge.net/pm/task.php?group_project_id=13524&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>Some of these features will also be discussed on forums at <a href="http://www.phpbb.com/phpBB/">http://www.phpbb.com/phpBB/</a>.</p>
<p>To suggest a feature first consult the task list mentioned above, if your idea is already listed then the chances are good that it will appear in 2.2. If your suggestion is not listed please submit it to our feature request tracker:</p>
<p><a href="http://sourceforge.net/tracker/index.php?group_id=7885&atid=357885" target="_features">http://sourceforge.net/tracker/index.php?group_id=7885&atid=357885</a>.</p>
<p>Before submitting please read through the already present suggestions, if one matches or is similar to yours please add to it rather than creating a new entry.</p>
<p>We make no promises to the inclusion of features but we will endeavour to introduce the most requested or most interesting ones.</p></li>
//-->
<p>If you wish to follow the progress of phpBB 3.0 you may like to visit our development forum to see how things are progressing:</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>
<li><b>Why is phpBB 1.x faster than phpBB 2.0?</b>

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.x :: Install</title>
<title>phpBB 2.0.10 :: 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.x INSTALL</span></td>
<td align="center" width="100%" valign="middle"><span class="maintitle">phpBB 2.0.10 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.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>
<p>A basic overview of running phpBB 2.0.10 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>
<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 phpBB2 requires the following:</p>
<p>Installation of phpBB 2.0.10 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 (4.0.3 and above) with support for the database you intend to use above</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>
</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_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>You should now run <b>install/update_to_210.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_latest.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_210.php and instead, manually alter the forum_id column to remove the IDENTITY setting (if it exists).</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>
<p>Once the update_to_210.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,37 +186,35 @@ 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>
<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>
<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 the latest version. You should select the appropriate archive for your current version, e.g. if you currently have 2.0.21 you should select the phpBB-2.0.21_to_2.0.22.zip/tar.gz file.</p>
<p>This package contains a number of archives, each contains the files changed from a given release to 2.0.10. 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.10.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_latest.php</b> after you have finished updating the files. This will update your database schema and increment the version number.</p>
<p>As for the other upgrade procedures you should run <b>install/update_to_210.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_patch"></a><h3 class="h3">7.iii. Patch file</h3>
<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.21 you need the phpBB-2.0.21_to_2.0.22.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.6 you need the phpBB-2.0.6_to_2.0.10.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_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>
<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_210.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>
<a name="#upgradeSTABLE_all"></a><h3 class="h3">7.iv. All package types</h3>
<p>If you have non-English language packs installed you may want to see if a new version has been made available. A number of missing strings have been added which, though not essential, may be beneficial to users. Please note that at this time not all language packs have been updated so you should be prepared to periodically check for updates.</p>
<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.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>Once you have succssfully installed phpBB 2.0.10 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>
@@ -234,7 +232,7 @@ p,ul,td {font-size:10pt;}
<a name="safemode"></a><h3 class="h3">8.ii. Safe Mode</h3>
<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>phpBB 2.0.10 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.x :: Readme</title>
<title>phpBB 2.0.10 :: 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.x README</span></td>
<td align="center" width="100%" valign="middle"><span class="maintitle">phpBB 2.0.10 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_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><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>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 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><b>Please note</b> that users who have upgraded to 2.0.10 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/support/guide/" target="_new">http://www.phpbb.com/support/guide/</a></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>This covers everything from installation through setting permissions and managing users.</p>
@@ -130,19 +130,23 @@ 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 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>
<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>
<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 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>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><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><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>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 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>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><a href="http://area51.phpbb.com/phpBB/" target="_new">http://area51.phpbb.com/phpBB/</a></p>
<p><a href="http://area51.phpbb.com/phpBB 2/" target="_new">http://area51.phpbb.com/phpBB 2/</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>
@@ -173,9 +177,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 to our security tracker:</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 directly to one or more of the developers.</p>
<p><a href="http://www.phpbb.com/security/" target="_new">http://www.phpbb.com/security/</a></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>
<a name="curbugs"></a><h2 class="h2"><u>6. Overview of current bug list</u></h2>
@@ -187,18 +191,16 @@ 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>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>
<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 )
</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.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 />
<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 PHP 3.x and 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

@@ -99,9 +99,9 @@ function generate_user_info(&$row, $date_format, $group_mod, &$from, &$posts, &$
$yim_img = ( $row['user_yim'] ) ? '<a href="http://edit.yahoo.com/config/send_webmesg?.target=' . $row['user_yim'] . '&amp;.src=pg"><img src="' . $images['icon_yim'] . '" alt="' . $lang['YIM'] . '" title="' . $lang['YIM'] . '" border="0" /></a>' : '';
$yim = ( $row['user_yim'] ) ? '<a href="http://edit.yahoo.com/config/send_webmesg?.target=' . $row['user_yim'] . '&amp;.src=pg">' . $lang['YIM'] . '</a>' : '';
$temp_url = append_sid("search.$phpEx?search_author=" . urlencode($row['username']) . "&amp;showresults=posts");
$search_img = '<a href="' . $temp_url . '"><img src="' . $images['icon_search'] . '" alt="' . sprintf($lang['Search_user_posts'], $row['username']) . '" title="' . sprintf($lang['Search_user_posts'], $row['username']) . '" border="0" /></a>';
$search = '<a href="' . $temp_url . '">' . sprintf($lang['Search_user_posts'], $row['username']) . '</a>';
$temp_url = append_sid("search.$phpEx?search_author=" . urlencode($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>';
return;
}
@@ -148,7 +148,6 @@ $confirm = ( isset($HTTP_POST_VARS['confirm']) ) ? TRUE : 0;
$cancel = ( isset($HTTP_POST_VARS['cancel']) ) ? TRUE : 0;
$start = ( isset($HTTP_GET_VARS['start']) ) ? intval($HTTP_GET_VARS['start']) : 0;
$start = ($start < 0) ? 0 : $start;
//
// Default var values
@@ -338,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)) || $row['is_auth_mod'] == 0 )
if ( !($row = $db->sql_fetchrow($result)) )
{
$sql = "UPDATE " . USERS_TABLE . "
SET user_level = " . USER . "
@@ -419,24 +418,21 @@ else if ( $group_id )
FROM " . AUTH_ACCESS_TABLE . " aa
WHERE aa.group_id = g.group_id
)
)
ORDER BY aa.auth_mod DESC";
)";
break;
case 'oracle':
$sql = "SELECT g.group_moderator, g.group_type, aa.auth_mod
FROM " . GROUPS_TABLE . " g, " . AUTH_ACCESS_TABLE . " aa
WHERE g.group_id = $group_id
AND aa.group_id (+) = g.group_id
ORDER BY aa.auth_mod DESC";
AND aa.group_id (+) = g.group_id";
break;
default:
$sql = "SELECT g.group_moderator, g.group_type, aa.auth_mod
FROM ( " . GROUPS_TABLE . " g
LEFT JOIN " . AUTH_ACCESS_TABLE . " aa ON aa.group_id = g.group_id )
WHERE g.group_id = $group_id
ORDER BY aa.auth_mod DESC";
WHERE g.group_id = $group_id";
break;
}
if ( !($result = $db->sql_query($sql)) )
@@ -476,7 +472,7 @@ else if ( $group_id )
if ( isset($HTTP_POST_VARS['add']) )
{
$username = ( isset($HTTP_POST_VARS['username']) ) ? phpbb_clean_username($HTTP_POST_VARS['username']) : '';
$username = ( isset($HTTP_POST_VARS['username']) ) ? htmlspecialchars($HTTP_POST_VARS['username']) : '';
$sql = "SELECT user_id, user_email, user_lang, user_level
FROM " . USERS_TABLE . "
@@ -1222,7 +1218,6 @@ else
//
// Load and process templates
//
$page_title = $lang['Group_Control_Panel'];
include($phpbb_root_path . 'includes/page_header.'.$phpEx);
$template->set_filenames(array(

View File

@@ -234,7 +234,6 @@ function auth($type, $forum_id, $userdata, $f_access = '')
{
$value = $f_access[$k][$key];
$f_forum_id = $f_access[$k]['forum_id'];
$u_access[$f_forum_id] = isset($u_access[$f_forum_id]) ? $u_access[$f_forum_id] : array();
switch( $value )
{
@@ -283,7 +282,6 @@ function auth($type, $forum_id, $userdata, $f_access = '')
for($k = 0; $k < count($f_access); $k++)
{
$f_forum_id = $f_access[$k]['forum_id'];
$u_access[$f_forum_id] = isset($u_access[$f_forum_id]) ? $u_access[$f_forum_id] : array();
$auth_user[$f_forum_id]['auth_mod'] = ( $userdata['session_logged_in'] ) ? auth_check_user(AUTH_MOD, 'auth_mod', $u_access[$f_forum_id], $is_admin) : 0;
}

View File

@@ -124,8 +124,6 @@ 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;
@@ -196,23 +194,23 @@ function bbencode_second_pass($text, $uid)
// [img]image_url_here[/img] code..
// This one gets first-passed..
$patterns[] = "#\[img:$uid\]([^?](?:[^\[]+|\[(?!url))*?)\[/img:$uid\]#i";
$patterns[] = "#\[img:$uid\](.*?)\[/img:$uid\]#si";
$replacements[] = $bbcode_tpl['img'];
// matches a [url]xxxx://www.phpbb.com[/url] code..
$patterns[] = "#\[url\]([\w]+?://([\w\#$%&~/.\-;:=,?@\]+]+|\[(?!url=))*?)\[/url\]#is";
$patterns[] = "#\[url\]([\w]+?://[^ \"\n\r\t<]*?)\[/url\]#is";
$replacements[] = $bbcode_tpl['url1'];
// [url]www.phpbb.com[/url] code.. (no xxxx:// prefix).
$patterns[] = "#\[url\]((www|ftp)\.([\w\#$%&~/.\-;:=,?@\]+]+|\[(?!url=))*?)\[/url\]#is";
$patterns[] = "#\[url\]((www|ftp)\.[^ \"\n\r\t<]*?)\[/url\]#is";
$replacements[] = $bbcode_tpl['url2'];
// [url=xxxx://www.phpbb.com]phpBB[/url] code..
$patterns[] = "#\[url=([\w]+?://[\w\#$%&~/.\-;:=,?@\[\]+]*?)\]([^?\n\r\t].*?)\[/url\]#is";
$patterns[] = "#\[url=([\w]+?://[^ \"\n\r\t<]*?)\](.*?)\[/url\]#is";
$replacements[] = $bbcode_tpl['url3'];
// [url=www.phpbb.com]phpBB[/url] code.. (no xxxx:// prefix).
$patterns[] = "#\[url=((www|ftp)\.[\w\#$%&~/.\-;:=,?@\[\]+]*?)\]([^?\n\r\t].*?)\[/url\]#is";
$patterns[] = "#\[url=((www|ftp)\.[^ \"\n\r\t<]*?)\](.*?)\[/url\]#is";
$replacements[] = $bbcode_tpl['url4'];
// [email]user@domain.tld[/email] code..
@@ -235,7 +233,7 @@ function make_bbcode_uid()
{
// Unique ID for this message..
$uid = dss_rand();
$uid = md5(mt_rand());
$uid = substr($uid, 0, BBCODE_UID_LEN);
return $uid;
@@ -252,7 +250,7 @@ function bbencode_first_pass($text, $uid)
// [QUOTE] and [/QUOTE] for posting replies with quote, or just for quoting stuff.
$text = bbencode_first_pass_pda($text, $uid, '[quote]', '[/quote]', '', false, '');
$text = bbencode_first_pass_pda($text, $uid, '/\[quote=\\\\&quot;(.*?)\\\\&quot;\]/is', '[/quote]', '', false, '', "[quote:$uid=\\\"\\1\\\"]");
$text = bbencode_first_pass_pda($text, $uid, '/\[quote=(\\\".*?\\\")\]/is', '[/quote]', '', false, '', "[quote:$uid=\\1]");
// [list] and [list=x] for (un)ordered lists.
$open_tag = array();
@@ -389,15 +387,15 @@ function bbencode_first_pass_pda($text, $uid, $open_tag, $close_tag, $close_tag_
//
// We're going to try and catch usernames with "[' characters.
//
if( preg_match('#\[quote=\\\&quot;#si', $possible_start, $match) && !preg_match('#\[quote=\\\&quot;(.*?)\\\&quot;\]#si', $possible_start) )
if( preg_match('#\[quote=\\\"#si', $possible_start, $match) && !preg_match('#\[quote=\\\"(.*?)\\\"\]#si', $possible_start) )
{
// OK we are in a quote tag that probably contains a ] bracket.
// Grab a bit more of the string to hopefully get all of it..
if ($close_pos = strpos($text, '&quot;]', $curr_pos + 14))
if ($close_pos = strpos($text, '"]', $curr_pos + 9))
{
if (strpos(substr($text, $curr_pos + 14, $close_pos - ($curr_pos + 14)), '[quote') === false)
if (strpos(substr($text, $curr_pos + 9, $close_pos - ($curr_pos + 9)), '[quote') === false)
{
$possible_start = substr($text, $curr_pos, $close_pos - $curr_pos + 7);
$possible_start = substr($text, $curr_pos, $close_pos - $curr_pos + 2);
}
}
}
@@ -432,7 +430,7 @@ function bbencode_first_pass_pda($text, $uid, $open_tag, $close_tag, $close_tag_
// We have an opening tag.
// Push its position, the text we matched, and its index in the open_tag array on to the stack, and then keep going to the right.
$match = array("pos" => $curr_pos, "tag" => $which_start_tag, "index" => $start_tag_index);
array_push($stack, $match);
bbcode_array_push($stack, $match);
//
// Rather than just increment $curr_pos
// Set it to the ending of the tag we just found
@@ -454,7 +452,7 @@ function bbencode_first_pass_pda($text, $uid, $open_tag, $close_tag, $close_tag_
// There exists a starting tag.
$curr_nesting_depth = sizeof($stack);
// We need to do 2 replacements now.
$match = array_pop($stack);
$match = bbcode_array_pop($stack);
$start_index = $match['pos'];
$start_tag = $match['tag'];
$start_length = strlen($start_tag);
@@ -520,7 +518,7 @@ function bbencode_first_pass_pda($text, $uid, $open_tag, $close_tag, $close_tag_
// otherwise, we go back to the start.
if (sizeof($stack) > 0)
{
$match = array_pop($stack);
$match = bbcode_array_pop($stack);
$curr_pos = $match['pos'];
// bbcode_array_push($stack, $match);
// ++$curr_pos;
@@ -616,7 +614,6 @@ 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;
@@ -624,13 +621,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]+?://[\w\#$%&~/.\-;:=,?@\[\]+]*)#is", "\\1<a href=\"\\2\" target=\"_blank\">\\2</a>", $ret);
$ret = preg_replace("#(^|[\n ])([\w]+?://[^ \"\n\r\t<]*)#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)\.[\w\#$%&~/.\-;:=,?@\[\]+]*)#is", "\\1<a href=\"http://\\2\" target=\"_blank\">\\2</a>", $ret);
$ret = preg_replace("#(^|[\n ])((www|ftp)\.[^ \"\t\n\r<]*)#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 ".".
@@ -700,7 +697,6 @@ function escape_slashes($input)
* This function does exactly what the PHP4 function array_push() does
* however, to keep phpBB compatable with PHP 3 we had to come up with our own
* method of doing it.
* This function was deprecated in phpBB 2.0.18
*/
function bbcode_array_push(&$stack, $value)
{
@@ -712,7 +708,6 @@ function bbcode_array_push(&$stack, $value)
* This function does exactly what the PHP4 function array_pop() does
* however, to keep phpBB compatable with PHP 3 we had to come up with our own
* method of doing it.
* This function was deprecated in phpBB 2.0.18
*/
function bbcode_array_pop(&$stack)
{
@@ -763,7 +758,7 @@ function smilies_pass($message)
for ($i = 0; $i < count($smilies); $i++)
{
$orig[] = "/(?<=.\W|\W.|^\W)" . preg_quote($smilies[$i]['code'], "/") . "(?=.\W|\W.|\W$)/";
$orig[] = "/(?<=.\W|\W.|^\W)" . phpbb_preg_quote($smilies[$i]['code'], "/") . "(?=.\W|\W.|\W$)/";
$repl[] = '<img src="'. $board_config['smilies_path'] . '/' . $smilies[$i]['smile_url'] . '" alt="' . $smilies[$i]['emoticon'] . '" border="0" />';
}
}

View File

@@ -148,7 +148,6 @@ 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');
@@ -167,7 +166,6 @@ define('SEARCH_TABLE', $table_prefix.'search_results');
define('SEARCH_WORD_TABLE', $table_prefix.'search_wordlist');
define('SEARCH_MATCH_TABLE', $table_prefix.'search_wordmatch');
define('SESSIONS_TABLE', $table_prefix.'sessions');
define('SESSIONS_KEYS_TABLE', $table_prefix.'sessions_keys');
define('SMILIES_TABLE', $table_prefix.'smilies');
define('THEMES_TABLE', $table_prefix.'themes');
define('THEMES_NAME_TABLE', $table_prefix.'themes_name');

View File

@@ -60,7 +60,7 @@ switch($dbms)
$db = new sql_db($dbhost, $dbuser, $dbpasswd, $dbname, false);
if(!$db->db_connect_id)
{
message_die(CRITICAL_ERROR, "Could not connect to the database");
message_die(CRITICAL_ERROR, "Could not connect to the database");
}
?>

View File

@@ -164,7 +164,7 @@ class emailer
if (preg_match('#^(Subject:(.*?))$#m', $this->msg, $match))
{
$this->subject = (trim($match[2]) != '') ? trim($match[2]) : (($this->subject != '') ? $this->subject : 'No Subject');
$drop_header .= '[\r\n]*?' . preg_quote($match[1], '#');
$drop_header .= '[\r\n]*?' . phpbb_preg_quote($match[1], '#');
}
else
{
@@ -174,7 +174,7 @@ class emailer
if (preg_match('#^(Charset:(.*?))$#m', $this->msg, $match))
{
$this->encoding = (trim($match[2]) != '') ? trim($match[2]) : trim($lang['ENCODING']);
$drop_header .= '[\r\n]*?' . preg_quote($match[1], '#');
$drop_header .= '[\r\n]*?' . phpbb_preg_quote($match[1], '#');
}
else
{
@@ -261,7 +261,7 @@ class emailer
$str = chunk_split(base64_encode($str), $length, $spacer);
// remove trailing spacer and add start and end delimiters
$str = preg_replace('#' . preg_quote($spacer, '#') . '$#', '', $str);
$str = preg_replace('#' . phpbb_preg_quote($spacer, '#') . '$#', '', $str);
return $start . $str . $end;
}

View File

@@ -74,102 +74,6 @@ 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;
}
/**
* This function is a wrapper for ltrim, as charlist is only supported in php >= 4.1.0
* Added in phpBB 2.0.18
*/
function phpbb_ltrim($str, $charlist = false)
{
if ($charlist === false)
{
return ltrim($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{0} == $charlist)
{
$str = substr($str, 1);
}
}
else
{
$str = ltrim($str, $charlist);
}
return $str;
}
// 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;
}
/**
* Our own generator of random values
* This uses a constantly changing value as the base for generating the values
* The board wide setting is updated once per page if this code is called
* With thanks to Anthrax101 for the inspiration on this one
* Added in phpBB 2.0.20
*/
function dss_rand()
{
global $db, $board_config, $dss_seeded;
$val = $board_config['rand_seed'] . microtime();
$val = md5($val);
$board_config['rand_seed'] = md5($board_config['rand_seed'] . $val . 'a');
if($dss_seeded !== true)
{
$sql = "UPDATE " . CONFIG_TABLE . " SET
config_value = '" . $board_config['rand_seed'] . "'
WHERE config_name = 'rand_seed'";
if( !$db->sql_query($sql) )
{
message_die(GENERAL_ERROR, "Unable to reseed PRNG", "", __LINE__, __FILE__, $sql);
}
$dss_seeded = true;
}
return substr($val, 4, 16);
}
//
// Get Userdata, $user can be username or user_id. If force_str is true, the username will be forced.
//
@@ -177,9 +81,11 @@ function get_userdata($user, $force_str = false)
{
global $db;
if (!is_numeric($user) || $force_str)
if (intval($user) == 0 || $force_str)
{
$user = phpbb_clean_username($user);
$user = trim(htmlspecialchars($user));
$user = substr(str_replace("\\'", "'", $user), 0, 25);
$user = str_replace("'", "\\'", $user);
}
else
{
@@ -189,7 +95,7 @@ function get_userdata($user, $force_str = false)
$sql = "SELECT *
FROM " . USERS_TABLE . "
WHERE ";
$sql .= ( ( is_integer($user) ) ? "user_id = $user" : "username = '" . str_replace("\'", "''", $user) . "'" ) . " AND user_id <> " . ANONYMOUS;
$sql .= ( ( is_integer($user) ) ? "user_id = $user" : "username = '" . $user . "'" ) . " AND user_id <> " . ANONYMOUS;
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Tried obtaining data for a non-existent user', '', __LINE__, __FILE__, $sql);
@@ -309,14 +215,14 @@ function make_jumpbox($action, $match_forum_id = 0)
function init_userprefs($userdata)
{
global $board_config, $theme, $images;
global $template, $lang, $phpEx, $phpbb_root_path, $db;
global $template, $lang, $phpEx, $phpbb_root_path;
global $nav_links;
if ( $userdata['user_id'] != ANONYMOUS )
{
if ( !empty($userdata['user_lang']))
{
$default_lang = phpbb_ltrim(basename(phpbb_rtrim($userdata['user_lang'])), "'");
$board_config['default_lang'] = $userdata['user_lang'];
}
if ( !empty($userdata['user_dateformat']) )
@@ -329,61 +235,12 @@ function init_userprefs($userdata)
$board_config['board_timezone'] = $userdata['user_timezone'];
}
}
else
if ( !file_exists(@phpbb_realpath($phpbb_root_path . 'language/lang_' . $board_config['default_lang'] . '/lang_main.'.$phpEx)) )
{
$default_lang = phpbb_ltrim(basename(phpbb_rtrim($board_config['default_lang'])), "'");
$board_config['default_lang'] = 'english';
}
if ( !file_exists(@phpbb_realpath($phpbb_root_path . 'language/lang_' . $default_lang . '/lang_main.'.$phpEx)) )
{
if ( $userdata['user_id'] != ANONYMOUS )
{
// For logged in users, try the board default language next
$default_lang = phpbb_ltrim(basename(phpbb_rtrim($board_config['default_lang'])), "'");
}
else
{
// For guests it means the default language is not present, try english
// This is a long shot since it means serious errors in the setup to reach here,
// but english is part of a new install so it's worth us trying
$default_lang = 'english';
}
if ( !file_exists(@phpbb_realpath($phpbb_root_path . 'language/lang_' . $default_lang . '/lang_main.'.$phpEx)) )
{
message_die(CRITICAL_ERROR, 'Could not locate valid language pack');
}
}
// If we've had to change the value in any way then let's write it back to the database
// before we go any further since it means there is something wrong with it
if ( $userdata['user_id'] != ANONYMOUS && $userdata['user_lang'] !== $default_lang )
{
$sql = 'UPDATE ' . USERS_TABLE . "
SET user_lang = '" . $default_lang . "'
WHERE user_lang = '" . $userdata['user_lang'] . "'";
if ( !($result = $db->sql_query($sql)) )
{
message_die(CRITICAL_ERROR, 'Could not update user language info');
}
$userdata['user_lang'] = $default_lang;
}
elseif ( $userdata['user_id'] === ANONYMOUS && $board_config['default_lang'] !== $default_lang )
{
$sql = 'UPDATE ' . CONFIG_TABLE . "
SET config_value = '" . $default_lang . "'
WHERE config_name = 'default_lang'";
if ( !($result = $db->sql_query($sql)) )
{
message_die(CRITICAL_ERROR, 'Could not update user language info');
}
}
$board_config['default_lang'] = $default_lang;
include($phpbb_root_path . 'language/lang_' . $board_config['default_lang'] . '/lang_main.' . $phpEx);
if ( defined('IN_ADMIN') )
@@ -442,9 +299,9 @@ function setup_style($style)
{
global $db, $board_config, $template, $images, $phpbb_root_path;
$sql = 'SELECT *
FROM ' . THEMES_TABLE . '
WHERE themes_id = ' . (int) $style;
$sql = "SELECT *
FROM " . THEMES_TABLE . "
WHERE themes_id = $style";
if ( !($result = $db->sql_query($sql)) )
{
message_die(CRITICAL_ERROR, 'Could not query database for theme info');
@@ -452,40 +309,7 @@ function setup_style($style)
if ( !($row = $db->sql_fetchrow($result)) )
{
// We are trying to setup a style which does not exist in the database
// Try to fallback to the board default (if the user had a custom style)
// and then any users using this style to the default if it succeeds
if ( $style != $board_config['default_style'])
{
$sql = 'SELECT *
FROM ' . THEMES_TABLE . '
WHERE themes_id = ' . (int) $board_config['default_style'];
if ( !($result = $db->sql_query($sql)) )
{
message_die(CRITICAL_ERROR, 'Could not query database for theme info');
}
if ( $row = $db->sql_fetchrow($result) )
{
$db->sql_freeresult($result);
$sql = 'UPDATE ' . USERS_TABLE . '
SET user_style = ' . (int) $board_config['default_style'] . "
WHERE user_style = $style";
if ( !($result = $db->sql_query($sql)) )
{
message_die(CRITICAL_ERROR, 'Could not update user theme info');
}
}
else
{
message_die(CRITICAL_ERROR, "Could not get theme data for themes_id [$style]");
}
}
else
{
message_die(CRITICAL_ERROR, "Could not get theme data for themes_id [$style]");
}
message_die(CRITICAL_ERROR, "Could not get theme data for themes_id [$style]");
}
$template_path = 'templates/' ;
@@ -681,7 +505,7 @@ function obtain_word_list(&$orig_word, &$replacement_word)
{
do
{
$orig_word[] = '#\b(' . str_replace('\*', '\w*?', preg_quote($row['word'], '#')) . ')\b#i';
$orig_word[] = '#\b(' . str_replace('\*', '\w*?', phpbb_preg_quote($row['word'], '#')) . ')\b#i';
$replacement_word[] = $row['replacement'];
}
while ( $row = $db->sql_fetchrow($result) );
@@ -720,7 +544,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;
@@ -747,7 +571,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 : ' . basename($err_file);
$debug_text .= '</br /><br />Line : ' . $err_line . '<br />File : ' . $err_file;
}
}
@@ -774,7 +598,11 @@ function message_die($msg_code, $msg_text = '', $msg_title = '', $err_line = '',
}
}
if ( empty($template) || empty($theme) )
if ( empty($template) )
{
$template = new Template($phpbb_root_path . 'templates/' . $board_config['board_template']);
}
if ( empty($theme) )
{
$theme = setup_style($board_config['default_style']);
}
@@ -917,7 +745,7 @@ function redirect($url)
$db->sql_close();
}
if (strstr(urldecode($url), "\n") || strstr(urldecode($url), "\r") || strstr(urldecode($url), ';url'))
if (strstr(urldecode($url), "\n") || strstr(urldecode($url), "\r"))
{
message_die(GENERAL_ERROR, 'Tried to redirect to potentially insecure url.');
}

View File

@@ -30,10 +30,9 @@ function make_forum_select($box_name, $ignore_forum = false, $select_forum = '')
$is_auth_ary = auth(AUTH_READ, AUTH_LIST_ALL, $userdata);
$sql = 'SELECT f.forum_id, f.forum_name
FROM ' . CATEGORIES_TABLE . ' c, ' . FORUMS_TABLE . ' f
WHERE f.cat_id = c.cat_id
ORDER BY c.cat_order, f.forum_order';
$sql = "SELECT forum_id, forum_name
FROM " . FORUMS_TABLE . "
ORDER BY cat_id, forum_order";
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Couldn not obtain forums information', '', __LINE__, __FILE__, $sql);
@@ -141,45 +140,10 @@ function sync($type, $id = false)
if ( $row = $db->sql_fetchrow($result) )
{
if ($row['total_posts'])
$sql = ( $row['total_posts'] ) ? "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 = $id" : "DELETE FROM " . TOPICS_TABLE . " WHERE topic_id = $id";
if ( !$db->sql_query($sql) )
{
// Correct the details of this topic
$sql = '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 = $id";
if (!$db->sql_query($sql))
{
message_die(GENERAL_ERROR, 'Could not update topic', '', __LINE__, __FILE__, $sql);
}
}
else
{
// There are no replies to this topic
// Check if it is a move stub
$sql = 'SELECT topic_moved_id
FROM ' . TOPICS_TABLE . "
WHERE topic_id = $id";
if (!($result = $db->sql_query($sql)))
{
message_die(GENERAL_ERROR, 'Could not get topic ID', '', __LINE__, __FILE__, $sql);
}
if ($row = $db->sql_fetchrow($result))
{
if (!$row['topic_moved_id'])
{
$sql = 'DELETE FROM ' . TOPICS_TABLE . " WHERE topic_id = $id";
if (!$db->sql_query($sql))
{
message_die(GENERAL_ERROR, 'Could not remove topic', '', __LINE__, __FILE__, $sql);
}
}
}
$db->sql_freeresult($result);
message_die(GENERAL_ERROR, 'Could not update topic', '', __LINE__, __FILE__, $sql);
}
}
break;

View File

@@ -25,8 +25,8 @@ if (!defined('IN_PHPBB'))
die('Hacking attempt');
}
$html_entities_match = array('#&(?!(\#[0-9]+;))#', '#<#', '#>#', '#"#');
$html_entities_replace = array('&amp;', '&lt;', '&gt;', '&quot;');
$html_entities_match = array('#&(?!(\#[0-9]+;))#', '#<#', '#>#');
$html_entities_replace = array('&amp;', '&lt;', '&gt;');
$unhtml_specialchars_match = array('#&gt;#', '#&lt;#', '#&quot;#', '#&amp;#');
$unhtml_specialchars_replace = array('>', '<', '"', '&');
@@ -46,26 +46,57 @@ function prepare_message($message, $html_on, $bbcode_on, $smile_on, $bbcode_uid
if ($html_on)
{
// If HTML is on, we try to make it safe
// This approach is quite agressive and anything that does not look like a valid tag
// is going to get converted to HTML entities
$message = stripslashes($message);
$html_match = '#<[^\w<]*(\w+)((?:"[^"]*"|\'[^\']*\'|[^<>\'"])+)?>#';
$matches = array();
$allowed_html_tags = split(',', $board_config['allow_html_tags']);
$message_split = preg_split($html_match, $message);
preg_match_all($html_match, $message, $matches);
$end_html = 0;
$start_html = 1;
$tmp_message = '';
$message = ' ' . $message . ' ';
$message = '';
foreach ($message_split as $part)
while ($start_html = strpos($message, '<', $start_html))
{
$tag = array(array_shift($matches[0]), array_shift($matches[1]), array_shift($matches[2]));
$message .= preg_replace($html_entities_match, $html_entities_replace, $part) . clean_html($tag);
$tmp_message .= preg_replace($html_entities_match, $html_entities_replace, substr($message, $end_html + 1, ($start_html - $end_html - 1)));
if ($end_html = strpos($message, '>', $start_html))
{
$length = $end_html - $start_html + 1;
$hold_string = substr($message, $start_html, $length);
if (($unclosed_open = strrpos(' ' . $hold_string, '<')) != 1)
{
$tmp_message .= preg_replace($html_entities_match, $html_entities_replace, substr($hold_string, 0, $unclosed_open - 1));
$hold_string = substr($hold_string, $unclosed_open - 1);
}
$tagallowed = false;
for ($i = 0; $i < sizeof($allowed_html_tags); $i++)
{
$match_tag = trim($allowed_html_tags[$i]);
if (preg_match('#^<\/?' . $match_tag . '[> ]#i', $hold_string))
{
$tagallowed = (preg_match('#^<\/?' . $match_tag . ' .*?(style[\t ]*?=|on[\w]+[\t ]*?=)#i', $hold_string)) ? false : true;
}
}
$tmp_message .= ($length && !$tagallowed) ? preg_replace($html_entities_match, $html_entities_replace, $hold_string) : $hold_string;
$start_html += $length;
}
else
{
$tmp_message .= preg_replace($html_entities_match, $html_entities_replace, substr($message, $start_html, strlen($message)));
$start_html = strlen($message);
$end_html = $start_html;
}
}
$message = addslashes($message);
$message = str_replace('&quot;', '\&quot;', $message);
if (!$end_html || ($end_html != strlen($message) && $tmp_message != ''))
{
$tmp_message .= preg_replace($html_entities_match, $html_entities_replace, substr($message, $end_html + 1));
}
$message = ($tmp_message != '') ? trim($tmp_message) : trim($message);
}
else
{
@@ -97,7 +128,7 @@ function prepare_post(&$mode, &$post_data, &$bbcode_on, &$html_on, &$smilies_on,
// Check username
if (!empty($username))
{
$username = phpbb_clean_username($username);
$username = trim(strip_tags($username));
if (!$userdata['session_logged_in'] || ($userdata['session_logged_in'] && $username != $userdata['username']))
{
@@ -156,7 +187,7 @@ function prepare_post(&$mode, &$post_data, &$bbcode_on, &$html_on, &$smilies_on,
$option_text = trim($option_text);
if (!empty($option_text))
{
$temp_option_text[intval($option_id)] = htmlspecialchars($option_text);
$temp_option_text[$option_id] = htmlspecialchars($option_text);
}
}
$option_text = $temp_option_text;
@@ -182,7 +213,7 @@ function prepare_post(&$mode, &$post_data, &$bbcode_on, &$html_on, &$smilies_on,
//
// Post a new topic/reply/poll or edit existing post/poll
//
function submit_post($mode, &$post_data, &$message, &$meta, &$forum_id, &$topic_id, &$post_id, &$poll_id, &$topic_type, &$bbcode_on, &$html_on, &$smilies_on, &$attach_sig, &$bbcode_uid, $post_username, $post_subject, $post_message, $poll_title, &$poll_options, &$poll_length)
function submit_post($mode, &$post_data, &$message, &$meta, &$forum_id, &$topic_id, &$post_id, &$poll_id, &$topic_type, &$bbcode_on, &$html_on, &$smilies_on, &$attach_sig, &$bbcode_uid, &$post_username, &$post_subject, &$post_message, &$poll_title, &$poll_options, &$poll_length)
{
global $board_config, $lang, $db, $phpbb_root_path, $phpEx;
global $userdata, $user_ip;
@@ -413,15 +444,12 @@ function update_post_stats(&$mode, &$post_data, &$forum_id, &$topic_id, &$post_i
$topic_update_sql .= 'topic_vote = 0';
}
if ($mode != 'poll_delete')
$sql = "UPDATE " . FORUMS_TABLE . " SET
$forum_update_sql
WHERE forum_id = $forum_id";
if (!$db->sql_query($sql))
{
$sql = "UPDATE " . FORUMS_TABLE . " SET
$forum_update_sql
WHERE forum_id = $forum_id";
if (!$db->sql_query($sql))
{
message_die(GENERAL_ERROR, 'Error in posting', '', __LINE__, __FILE__, $sql);
}
message_die(GENERAL_ERROR, 'Error in posting', '', __LINE__, __FILE__, $sql);
}
if ($topic_update_sql != '')
@@ -550,7 +578,16 @@ function user_notification($mode, &$post_data, &$topic_title, &$forum_id, &$topi
$current_time = time();
if ($mode != 'delete')
if ($mode == 'delete')
{
$delete_sql = (!$post_data['first_post'] && !$post_data['last_post']) ? " AND user_id = " . $userdata['user_id'] : '';
$sql = "DELETE FROM " . TOPICS_WATCH_TABLE . " WHERE topic_id = $topic_id" . $delete_sql;
if (!$db->sql_query($sql))
{
message_die(GENERAL_ERROR, 'Could not change topic notify data', '', __LINE__, __FILE__, $sql);
}
}
else
{
if ($mode == 'reply')
{
@@ -732,7 +769,7 @@ function generate_smilies($mode, $page_id)
$gen_simple_header = TRUE;
$page_title = $lang['Emoticons'];
$page_title = $lang['Emoticons'] . " - $topic_title";
include($phpbb_root_path . 'includes/page_header.'.$phpEx);
$template->set_filenames(array(
@@ -822,66 +859,4 @@ function generate_smilies($mode, $page_id)
}
}
/**
* Called from within prepare_message to clean included HTML tags if HTML is
* turned on for that post
* @param array $tag Matching text from the message to parse
*/
function clean_html($tag)
{
global $board_config;
if (empty($tag[0]))
{
return '';
}
$allowed_html_tags = preg_split('/, */', strtolower($board_config['allow_html_tags']));
$disallowed_attributes = '/^(?:style|on)/i';
// Check if this is an end tag
preg_match('/<[^\w\/]*\/[\W]*(\w+)/', $tag[0], $matches);
if (sizeof($matches))
{
if (in_array(strtolower($matches[1]), $allowed_html_tags))
{
return '</' . $matches[1] . '>';
}
else
{
return htmlspecialchars('</' . $matches[1] . '>');
}
}
// Check if this is an allowed tag
if (in_array(strtolower($tag[1]), $allowed_html_tags))
{
$attributes = '';
if (!empty($tag[2]))
{
preg_match_all('/[\W]*?(\w+)[\W]*?=[\W]*?(["\'])((?:(?!\2).)*)\2/', $tag[2], $test);
for ($i = 0; $i < sizeof($test[0]); $i++)
{
if (preg_match($disallowed_attributes, $test[1][$i]))
{
continue;
}
$attributes .= ' ' . $test[1][$i] . '=' . $test[2][$i] . str_replace(array('[', ']'), array('&#91;', '&#93;'), htmlspecialchars($test[3][$i])) . $test[2][$i];
}
}
if (in_array(strtolower($tag[1]), $allowed_html_tags))
{
return '<' . $tag[1] . $attributes . '>';
}
else
{
return htmlspecialchars('<' . $tag[1] . $attributes . '>');
}
}
// Finally, this is not an allowed tag so strip all the attibutes and escape it
else
{
return htmlspecialchars('<' . $tag[1] . '>');
}
}
?>

View File

@@ -89,7 +89,7 @@ function clean_words($mode, &$entry, &$stopword_list, &$synonym_list)
return $entry;
}
function split_words($entry, $mode = 'post')
function split_words(&$entry, $mode = 'post')
{
// If you experience problems with the new method, uncomment this block.
/*
@@ -435,7 +435,7 @@ function username_search($search_match)
$username_list = '';
if ( !empty($search_match) )
{
$username_search = preg_replace('/\*/', '%', phpbb_clean_username($search_match));
$username_search = preg_replace('/\*/', '%', trim(strip_tags($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)) ? phpbb_clean_username($search_match) : '',
'USERNAME' => ( !empty($search_match) ) ? strip_tags($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,15 +30,17 @@ function validate_username($username)
global $db, $lang, $userdata;
// Remove doubled up spaces
$username = preg_replace('#\s+#', ' ', trim($username));
$username = phpbb_clean_username($username);
$username = preg_replace('#\s+#', ' ', $username);
// Limit username length
$username = substr(str_replace("\'", "'", $username), 0, 25);
$username = str_replace("'", "''", $username);
$sql = "SELECT username
FROM " . USERS_TABLE . "
FROM " . USERS_TABLE . "
WHERE LOWER(username) = '" . strtolower($username) . "'";
if ($result = $db->sql_query($sql))
{
while ($row = $db->sql_fetchrow($result))
if ($row = $db->sql_fetchrow($result))
{
if (($userdata['session_logged_in'] && $row['username'] != $userdata['username']) || !$userdata['session_logged_in'])
{
@@ -70,7 +72,7 @@ function validate_username($username)
{
do
{
if (preg_match("#\b(" . str_replace("\*", ".*?", preg_quote($row['disallow_username'], '#')) . ")\b#i", $username))
if (preg_match("#\b(" . str_replace("\*", ".*?", phpbb_preg_quote($row['disallow_username'], '#')) . ")\b#i", $username))
{
$db->sql_freeresult($result);
return array('error' => true, 'error_msg' => $lang['Username_disallowed']);
@@ -89,7 +91,7 @@ function validate_username($username)
{
do
{
if (preg_match("#\b(" . str_replace("\*", ".*?", preg_quote($row['word'], '#')) . ")\b#i", $username))
if (preg_match("#\b(" . str_replace("\*", ".*?", phpbb_preg_quote($row['word'], '#')) . ")\b#i", $username))
{
$db->sql_freeresult($result);
return array('error' => true, 'error_msg' => $lang['Username_disallowed']);

View File

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

View File

@@ -25,8 +25,6 @@ if ( !defined('IN_PHPBB') )
die('Hacking attempt');
}
global $do_gzip_compress;
//
// Show the overall footer.
//
@@ -37,7 +35,8 @@ $template->set_filenames(array(
);
$template->assign_vars(array(
'TRANSLATION_INFO' => (isset($lang['TRANSLATION_INFO'])) ? $lang['TRANSLATION_INFO'] : ((isset($lang['TRANSLATION'])) ? $lang['TRANSLATION'] : ''),
'PHPBB_VERSION' => '2' . $board_config['version'],
'TRANSLATION_INFO' => ( isset($lang['TRANSLATION_INFO']) ) ? $lang['TRANSLATION_INFO'] : '',
'ADMIN_LINK' => $admin_link)
);

View File

@@ -31,21 +31,6 @@ function prune($forum_id, $prune_date, $prune_all = false)
{
global $db, $lang;
// Before pruning, lets try to clean up the invalid topic entries
$sql = 'SELECT topic_id FROM ' . TOPICS_TABLE . '
WHERE topic_last_post_id = 0';
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Could not obtain lists of topics to sync', '', __LINE__, __FILE__, $sql);
}
while( $row = $db->sql_fetchrow($result) )
{
sync('topic', $row['topic_id']);
}
$db->sql_freeresult($result);
$prune_all = ($prune_all) ? '' : 'AND t.topic_vote = 0 AND t.topic_type <> ' . POST_ANNOUNCE;
//
// Those without polls and announcements ... unless told otherwise!
@@ -54,7 +39,8 @@ function prune($forum_id, $prune_date, $prune_all = false)
FROM " . POSTS_TABLE . " p, " . TOPICS_TABLE . " t
WHERE t.forum_id = $forum_id
$prune_all
AND p.post_id = t.topic_last_post_id";
AND ( p.post_id = t.topic_last_post_id
OR t.topic_last_post_id = 0 )";
if ( $prune_date != '' )
{
$sql .= " AND p.post_time < $prune_date";

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, $admin = 0)
function session_begin($user_id, $user_ip, $page_id, $auto_create = 0, $enable_autologin = 0)
{
global $db, $board_config;
global $HTTP_COOKIE_VARS, $HTTP_GET_VARS, $SID;
@@ -53,94 +53,65 @@ 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'];
//
// Are auto-logins allowed?
// If allow_autologin is not set or is true then they are
// (same behaviour as old 2.0.x session code)
// Try and pull the last time stored in a cookie, if it exists
//
if (isset($board_config['allow_autologin']) && !$board_config['allow_autologin'])
$sql = "SELECT *
FROM " . USERS_TABLE . "
WHERE user_id = $user_id";
if ( !($result = $db->sql_query($sql)) )
{
$enable_autologin = $sessiondata['autologinid'] = false;
message_die(CRITICAL_ERROR, 'Could not obtain lastvisit data from user table', '', __LINE__, __FILE__, $sql);
}
//
// First off attempt to join with the autologin value if we have one
// If not, just use the user_id value
//
$userdata = array();
$userdata = $db->sql_fetchrow($result);
if ($user_id != ANONYMOUS)
if ( $user_id != ANONYMOUS )
{
if (isset($sessiondata['autologinid']) && (string) $sessiondata['autologinid'] != '' && $user_id)
{
$sql = 'SELECT u.*
FROM ' . USERS_TABLE . ' u, ' . SESSIONS_KEYS_TABLE . ' k
WHERE u.user_id = ' . (int) $user_id . "
AND u.user_active = 1
AND k.user_id = u.user_id
AND k.key_id = '" . md5($sessiondata['autologinid']) . "'";
if (!($result = $db->sql_query($sql)))
{
message_die(CRITICAL_ERROR, 'Error doing DB query userdata row fetch', '', __LINE__, __FILE__, $sql);
}
$auto_login_key = $userdata['user_password'];
$userdata = $db->sql_fetchrow($result);
$db->sql_freeresult($result);
$enable_autologin = $login = 1;
if ( $auto_create )
{
if ( isset($sessiondata['autologinid']) && $userdata['user_active'] )
{
// We have to login automagically
if( $sessiondata['autologinid'] == $auto_login_key )
{
// autologinid matches password
$login = 1;
$enable_autologin = 1;
}
else
{
// No match; don't login, set as anonymous user
$login = 0;
$enable_autologin = 0;
$user_id = $userdata['user_id'] = ANONYMOUS;
}
}
else
{
// Autologin is not set. Don't login, set as anonymous user
$login = 0;
$enable_autologin = 0;
$user_id = $userdata['user_id'] = ANONYMOUS;
}
}
else if (!$auto_create)
else
{
$sessiondata['autologinid'] = '';
$sessiondata['userid'] = $user_id;
$sql = 'SELECT *
FROM ' . USERS_TABLE . '
WHERE user_id = ' . (int) $user_id . '
AND user_active = 1';
if (!($result = $db->sql_query($sql)))
{
message_die(CRITICAL_ERROR, 'Error doing DB query userdata row fetch', '', __LINE__, __FILE__, $sql);
}
$userdata = $db->sql_fetchrow($result);
$db->sql_freeresult($result);
$login = 1;
}
}
//
// At this point either $userdata should be populated or
// one of the below is true
// * Key didn't match one in the DB
// * User does not exist
// * User is inactive
//
if (!sizeof($userdata) || !is_array($userdata) || !$userdata)
else
{
$sessiondata['autologinid'] = '';
$sessiondata['userid'] = $user_id = ANONYMOUS;
$enable_autologin = $login = 0;
$sql = 'SELECT *
FROM ' . USERS_TABLE . '
WHERE user_id = ' . (int) $user_id;
if (!($result = $db->sql_query($sql)))
{
message_die(CRITICAL_ERROR, 'Error doing DB query userdata row fetch', '', __LINE__, __FILE__, $sql);
}
$userdata = $db->sql_fetchrow($result);
$db->sql_freeresult($result);
$login = 0;
$enable_autologin = 0;
}
//
// Initial ban check against user id, IP and email address
//
@@ -172,16 +143,16 @@ 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, session_admin = $admin
SET session_user_id = $user_id, session_start = $current_time, session_time = $current_time, session_page = $page_id, session_logged_in = $login
WHERE session_id = '" . $session_id . "'
AND session_ip = '$user_ip'";
if ( !$db->sql_query($sql) || !$db->sql_affectedrows() )
{
$session_id = md5(dss_rand());
$session_id = md5(uniqid($user_ip));
$sql = "INSERT INTO " . SESSIONS_TABLE . "
(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)";
(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)";
if ( !$db->sql_query($sql) )
{
message_die(CRITICAL_ERROR, 'Error creating new session', '', __LINE__, __FILE__, $sql);
@@ -189,55 +160,20 @@ function session_begin($user_id, $user_ip, $page_id, $auto_create = 0, $enable_a
}
if ( $user_id != ANONYMOUS )
{
{// ( $userdata['user_session_time'] > $expiry_time && $auto_create ) ? $userdata['user_lastvisit'] : (
$last_visit = ( $userdata['user_session_time'] > 0 ) ? $userdata['user_session_time'] : $current_time;
if (!$admin)
$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) )
{
$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);
}
message_die(CRITICAL_ERROR, 'Error updating last visit time', '', __LINE__, __FILE__, $sql);
}
$userdata['user_lastvisit'] = $last_visit;
//
// Regenerate the auto-login key
//
if ($enable_autologin)
{
$auto_login_key = dss_rand() . dss_rand();
if (isset($sessiondata['autologinid']) && (string) $sessiondata['autologinid'] != '')
{
$sql = 'UPDATE ' . SESSIONS_KEYS_TABLE . "
SET last_ip = '$user_ip', key_id = '" . md5($auto_login_key) . "', last_login = $current_time
WHERE key_id = '" . md5($sessiondata['autologinid']) . "'";
}
else
{
$sql = 'INSERT INTO ' . SESSIONS_KEYS_TABLE . "(key_id, user_id, last_ip, last_login)
VALUES ('" . md5($auto_login_key) . "', $user_id, '$user_ip', $current_time)";
}
if ( !$db->sql_query($sql) )
{
message_die(CRITICAL_ERROR, 'Error updating session key', '', __LINE__, __FILE__, $sql);
}
$sessiondata['autologinid'] = $auto_login_key;
unset($auto_login_key);
}
else
{
$sessiondata['autologinid'] = '';
}
// $sessiondata['autologinid'] = (!$admin) ? (( $enable_autologin && $sessionmethod == SESSION_METHOD_COOKIE ) ? $auto_login_key : '') : $sessiondata['autologinid'];
$sessiondata['autologinid'] = ( $enable_autologin && $sessionmethod == SESSION_METHOD_COOKIE ) ? $auto_login_key : '';
$sessiondata['userid'] = $user_id;
}
@@ -248,8 +184,6 @@ 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;
$userdata['session_key'] = $sessiondata['autologinid'];
setcookie($cookiename . '_data', serialize($sessiondata), $current_time + 31536000, $cookiepath, $cookiedomain, $cookiesecure);
setcookie($cookiename . '_sid', $session_id, 0, $cookiepath, $cookiedomain, $cookiesecure);
@@ -295,8 +229,6 @@ function session_pagestart($user_ip, $thispage_id)
$session_id = '';
}
$thispage_id = (int) $thispage_id;
//
// Does a session exist?
//
@@ -339,11 +271,8 @@ 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$update_admin
SET session_time = $current_time, session_page = $thispage_id
WHERE session_id = '" . $userdata['session_id'] . "'";
if ( !$db->sql_query($sql) )
{
@@ -353,7 +282,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) )
{
@@ -361,18 +290,22 @@ function session_pagestart($user_ip, $thispage_id)
}
}
session_clean($userdata['session_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'";
if ( !$db->sql_query($sql) )
{
message_die(CRITICAL_ERROR, 'Error clearing sessions table', '', __LINE__, __FILE__, $sql);
}
setcookie($cookiename . '_data', serialize($sessiondata), $current_time + 31536000, $cookiepath, $cookiedomain, $cookiesecure);
setcookie($cookiename . '_sid', $session_id, 0, $cookiepath, $cookiedomain, $cookiesecure);
}
// Add the session_key to the userdata array if it is set
if ( isset($sessiondata['autologinid']) && $sessiondata['autologinid'] != '' )
{
$userdata['session_key'] = $sessiondata['autologinid'];
}
return $userdata;
}
}
@@ -393,14 +326,14 @@ function session_pagestart($user_ip, $thispage_id)
}
/**
* Terminates the specified session
* It will delete the entry in the sessions table for this session,
* remove the corresponding auto-login key and reset the cookies
*/
//
// session_end closes out a session
// deleting the corresponding entry
// in the sessions table
//
function session_end($session_id, $user_id)
{
global $db, $lang, $board_config, $userdata;
global $db, $lang, $board_config;
global $HTTP_COOKIE_VARS, $HTTP_GET_VARS, $SID;
$cookiename = $board_config['cookie_name'];
@@ -410,6 +343,20 @@ function session_end($session_id, $user_id)
$current_time = time();
//
// Pull cookiedata or grab the URI propagated sid
//
if ( isset($HTTP_COOKIE_VARS[$cookiename . '_sid']) )
{
$session_id = isset( $HTTP_COOKIE_VARS[$cookiename . '_sid'] ) ? $HTTP_COOKIE_VARS[$cookiename . '_sid'] : '';
$sessionmethod = SESSION_METHOD_COOKIE;
}
else
{
$session_id = ( isset($HTTP_GET_VARS['sid']) ) ? $HTTP_GET_VARS['sid'] : '';
$sessionmethod = SESSION_METHOD_GET;
}
if (!preg_match('/^[A-Za-z0-9]*$/', $session_id))
{
return;
@@ -418,7 +365,7 @@ function session_end($session_id, $user_id)
//
// Delete existing session
//
$sql = 'DELETE FROM ' . SESSIONS_TABLE . "
$sql = "DELETE FROM " . SESSIONS_TABLE . "
WHERE session_id = '$session_id'
AND session_user_id = $user_id";
if ( !$db->sql_query($sql) )
@@ -426,137 +373,12 @@ function session_end($session_id, $user_id)
message_die(CRITICAL_ERROR, 'Error removing user session', '', __LINE__, __FILE__, $sql);
}
//
// Remove this auto-login entry (if applicable)
//
if ( isset($userdata['session_key']) && $userdata['session_key'] != '' )
{
$autologin_key = md5($userdata['session_key']);
$sql = 'DELETE FROM ' . SESSIONS_KEYS_TABLE . '
WHERE user_id = ' . (int) $user_id . "
AND key_id = '$autologin_key'";
if ( !$db->sql_query($sql) )
{
message_die(CRITICAL_ERROR, 'Error removing auto-login key', '', __LINE__, __FILE__, $sql);
}
}
//
// We expect that message_die will be called after this function,
// but just in case it isn't, reset $userdata to the details for a guest
//
$sql = 'SELECT *
FROM ' . USERS_TABLE . '
WHERE user_id = ' . ANONYMOUS;
if ( !($result = $db->sql_query($sql)) )
{
message_die(CRITICAL_ERROR, 'Error obtaining user details', '', __LINE__, __FILE__, $sql);
}
if ( !($userdata = $db->sql_fetchrow($result)) )
{
message_die(CRITICAL_ERROR, 'Error obtaining user details', '', __LINE__, __FILE__, $sql);
}
$db->sql_freeresult($result);
setcookie($cookiename . '_data', '', $current_time - 31536000, $cookiepath, $cookiedomain, $cookiesecure);
setcookie($cookiename . '_sid', '', $current_time - 31536000, $cookiepath, $cookiedomain, $cookiesecure);
return true;
}
/**
* Removes expired sessions and auto-login keys from the database
*/
function session_clean($session_id)
{
global $board_config, $db;
//
// Delete expired sessions
//
$sql = 'DELETE FROM ' . SESSIONS_TABLE . '
WHERE session_time < ' . (time() - (int) $board_config['session_length']) . "
AND session_id <> '$session_id'";
if ( !$db->sql_query($sql) )
{
message_die(CRITICAL_ERROR, 'Error clearing sessions table', '', __LINE__, __FILE__, $sql);
}
//
// Delete expired auto-login keys
// If max_autologin_time is not set then keys will never be deleted
// (same behaviour as old 2.0.x session code)
//
if (!empty($board_config['max_autologin_time']) && $board_config['max_autologin_time'] > 0)
{
$sql = 'DELETE FROM ' . SESSIONS_KEYS_TABLE . '
WHERE last_login < ' . (time() - (86400 * (int) $board_config['max_autologin_time']));
$db->sql_query($sql);
}
return true;
}
/**
* Reset all login keys for the specified user
* Called on password changes
*/
function session_reset_keys($user_id, $user_ip)
{
global $db, $userdata, $board_config;
$key_sql = ($user_id == $userdata['user_id'] && !empty($userdata['session_key'])) ? "AND key_id != '" . md5($userdata['session_key']) . "'" : '';
$sql = 'DELETE FROM ' . SESSIONS_KEYS_TABLE . '
WHERE user_id = ' . (int) $user_id . "
$key_sql";
if ( !$db->sql_query($sql) )
{
message_die(CRITICAL_ERROR, 'Error removing auto-login keys', '', __LINE__, __FILE__, $sql);
}
$where_sql = 'session_user_id = ' . (int) $user_id;
$where_sql .= ($user_id == $userdata['user_id']) ? " AND session_id <> '" . $userdata['session_id'] . "'" : '';
$sql = 'DELETE FROM ' . SESSIONS_TABLE . "
WHERE $where_sql";
if ( !$db->sql_query($sql) )
{
message_die(CRITICAL_ERROR, 'Error removing user session(s)', '', __LINE__, __FILE__, $sql);
}
if ( !empty($key_sql) )
{
$auto_login_key = dss_rand() . dss_rand();
$current_time = time();
$sql = 'UPDATE ' . SESSIONS_KEYS_TABLE . "
SET last_ip = '$user_ip', key_id = '" . md5($auto_login_key) . "', last_login = $current_time
WHERE key_id = '" . md5($userdata['session_key']) . "'";
if ( !$db->sql_query($sql) )
{
message_die(CRITICAL_ERROR, 'Error updating session key', '', __LINE__, __FILE__, $sql);
}
// And now rebuild the cookie
$sessiondata['userid'] = $user_id;
$sessiondata['autologinid'] = $auto_login_key;
$cookiename = $board_config['cookie_name'];
$cookiepath = $board_config['cookie_path'];
$cookiedomain = $board_config['cookie_domain'];
$cookiesecure = $board_config['cookie_secure'];
setcookie($cookiename . '_data', serialize($sessiondata), $current_time + 31536000, $cookiepath, $cookiedomain, $cookiesecure);
$userdata['session_key'] = $auto_login_key;
unset($sessiondata);
unset($auto_login_key);
}
}
//
// Append $SID to a url. Borrowed from phplib and modified. This is an
// extra routine utilised by the session code above and acts as a wrapper
@@ -569,7 +391,7 @@ function append_sid($url, $non_html_amp = false)
if ( !empty($SID) && !preg_match('#sid=#', $url) )
{
$url .= ( ( strpos($url, '?') !== false ) ? ( ( $non_html_amp ) ? '&' : '&amp;' ) : '?' ) . $SID;
$url .= ( ( strpos($url, '?') != false ) ? ( ( $non_html_amp ) ? '&' : '&amp;' ) : '?' ) . $SID;
}
return $url;

View File

@@ -27,8 +27,7 @@ define('SMTP_INCLUDED', 1);
// using SMTP Extensions
//
function server_parse($socket, $response, $line = __LINE__)
{
$server_response = '';
{
while (substr($server_response, 3, 1) != ' ')
{
if (!($server_response = fgets($socket, 256)))
@@ -107,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 = ($rp_filename = phpbb_realpath($this->root . '/' . $filename)) ? $rp_filename : $filename;
$filename = phpbb_realpath($this->root . '/' . $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) || !$topic_id)
if ( !isset($topic_id) )
{
message_die(GENERAL_MESSAGE, 'Topic_post_not_exist');
message_die(GENERAL_MESSAGE, 'Topic_not_exist');
}
//
@@ -225,4 +225,4 @@ function topic_review($topic_id, $is_inline_review)
}
}
?>
?>

View File

@@ -47,18 +47,6 @@ 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 && $row['user_newpasswd'] == '')
{
if (!$userdata['session_logged_in'])
{
redirect(append_sid('login.' . $phpEx . '?redirect=profile.' . $phpEx . '&mode=activate&' . POST_USERS_URL . '=' . $row['user_id'] . '&act_key=' . trim($HTTP_GET_VARS['act_key'])));
}
else if ($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,7 +51,6 @@ 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)) )
@@ -63,26 +62,12 @@ function user_avatar_delete($avatar_type, $avatar_file)
return ", user_avatar = '', user_avatar_type = " . USER_AVATAR_NONE;
}
function user_avatar_gallery($mode, &$error, &$error_msg, $avatar_filename, $avatar_category)
function user_avatar_gallery($mode, &$error, &$error_msg, $avatar_filename)
{
global $board_config;
$avatar_filename = phpbb_ltrim(basename($avatar_filename), "'");
$avatar_category = phpbb_ltrim(basename($avatar_category), "'");
if(!preg_match('/(\.gif$|\.png$|\.jpg|\.jpeg)$/is', $avatar_filename))
if ( file_exists(@phpbb_realpath($board_config['avatar_gallery_path'] . '/' . $avatar_filename)) && ($mode == 'editprofile') )
{
return '';
}
if ($avatar_filename == "" || $avatar_category == "")
{
return '';
}
if ( file_exists(@phpbb_realpath($board_config['avatar_gallery_path'] . '/' . $avatar_category . '/' . $avatar_filename)) && ($mode == 'editprofile') )
{
$return = ", user_avatar = '" . str_replace("\'", "''", $avatar_category . '/' . $avatar_filename) . "', user_avatar_type = " . USER_AVATAR_GALLERY;
$return = ", user_avatar = '" . str_replace("\'", "''", $avatar_filename) . "', user_avatar_type = " . USER_AVATAR_GALLERY;
}
else
{
@@ -93,15 +78,11 @@ function user_avatar_gallery($mode, &$error, &$error_msg, $avatar_filename, $ava
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;
}
$avatar_filename = substr($avatar_filename, 0, 100);
if ( !preg_match("#^((ht|f)tp://)([^ \?&=\#\"\n\r\t<]*?(\.(jpg|jpeg|gif|png))$)#is", $avatar_filename) )
{
$error = true;
@@ -119,10 +100,7 @@ function user_avatar_upload($mode, $avatar_mode, &$current_avatar, &$current_typ
$ini_val = ( @phpversion() >= '4.0.0' ) ? 'ini_get' : 'get_cfg_var';
$width = $height = 0;
$type = '';
if ( $avatar_mode == 'remote' && preg_match('/^(http:\/\/)?([\w\-\.]+)\:?([0-9]*)\/([^ \?&=\#\"\n\r\t<]*?(\.(jpg|jpeg|gif|png)))$/', $avatar_filename, $url_ary) )
if ( $avatar_mode == 'remote' && preg_match('/^(http:\/\/)?([\w\-\.]+)\:?([0-9]*)\/(.*)$/', $avatar_filename, $url_ary) )
{
if ( empty($url_ary[4]) )
{
@@ -179,7 +157,7 @@ function user_avatar_upload($mode, $avatar_mode, &$current_avatar, &$current_typ
message_die(GENERAL_ERROR, 'Could not write avatar file to local storage. Please contact the board administrator with this message', '', __LINE__, __FILE__);
}
list($width, $height, $type) = @getimagesize($tmp_filename);
list($width, $height) = @getimagesize($tmp_filename);
}
else
{
@@ -205,7 +183,7 @@ function user_avatar_upload($mode, $avatar_mode, &$current_avatar, &$current_typ
return;
}
list($width, $height, $type) = @getimagesize($avatar_filename);
list($width, $height) = @getimagesize($avatar_filename);
}
if ( !($imgtype = check_image_type($avatar_filetype, $error, $error_msg)) )
@@ -213,51 +191,16 @@ function user_avatar_upload($mode, $avatar_mode, &$current_avatar, &$current_typ
return;
}
switch ($type)
{
// GIF
case 1:
if ($imgtype != '.gif')
{
@unlink($tmp_filename);
message_die(GENERAL_ERROR, 'Unable to upload file', '', __LINE__, __FILE__);
}
break;
// JPG, JPC, JP2, JPX, JB2
case 2:
case 9:
case 10:
case 11:
case 12:
if ($imgtype != '.jpg' && $imgtype != '.jpeg')
{
@unlink($tmp_filename);
message_die(GENERAL_ERROR, 'Unable to upload file', '', __LINE__, __FILE__);
}
break;
// PNG
case 3:
if ($imgtype != '.png')
{
@unlink($tmp_filename);
message_die(GENERAL_ERROR, 'Unable to upload file', '', __LINE__, __FILE__);
}
break;
default:
@unlink($tmp_filename);
message_die(GENERAL_ERROR, 'Unable to upload file', '', __LINE__, __FILE__);
}
if ( $width > 0 && $height > 0 && $width <= $board_config['avatar_max_width'] && $height <= $board_config['avatar_max_height'] )
if ( $width <= $board_config['avatar_max_width'] && $height <= $board_config['avatar_max_height'] )
{
$new_filename = uniqid(rand()) . $imgtype;
if ( $mode == 'editprofile' && $current_type == USER_AVATAR_UPLOAD && $current_avatar != '' )
{
user_avatar_delete($current_type, $current_avatar);
if ( file_exists(@phpbb_realpath('./' . $board_config['avatar_path'] . '/' . $current_avatar)) )
{
@unlink('./' . $board_config['avatar_path'] . '/' . $current_avatar);
}
}
if( $avatar_mode == 'remote' )
@@ -281,10 +224,6 @@ 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");
}
@@ -323,7 +262,7 @@ function display_avatar_gallery($mode, &$category, &$user_id, &$email, &$current
{
if( preg_match('/(\.gif$|\.png$|\.jpg|\.jpeg)$/is', $sub_file) )
{
$avatar_images[$file][$avatar_row_count][$avatar_col_count] = $sub_file;
$avatar_images[$file][$avatar_row_count][$avatar_col_count] = $file . '/' . $sub_file;
$avatar_name[$file][$avatar_row_count][$avatar_col_count] = ucfirst(str_replace("_", " ", preg_replace('/^(.*)\..*$/', '\1', $sub_file)));
$avatar_col_count++;
@@ -369,7 +308,7 @@ function display_avatar_gallery($mode, &$category, &$user_id, &$email, &$current
for($j = 0; $j < count($avatar_images[$category][$i]); $j++)
{
$template->assign_block_vars('avatar_row.avatar_column', array(
"AVATAR_IMAGE" => $board_config['avatar_gallery_path'] . '/' . $category . '/' . $avatar_images[$category][$i][$j],
"AVATAR_IMAGE" => $board_config['avatar_gallery_path'] . '/' . $avatar_images[$category][$i][$j],
"AVATAR_NAME" => $avatar_name[$category][$i][$j])
);
@@ -381,7 +320,7 @@ function display_avatar_gallery($mode, &$category, &$user_id, &$email, &$current
$params = array('coppa', 'user_id', 'username', 'email', 'current_email', 'cur_password', 'new_password', 'password_confirm', 'icq', 'aim', 'msn', 'yim', 'website', 'location', 'occupation', 'interests', 'signature', 'viewemail', 'notifypm', 'popup_pm', 'notifyreply', 'attachsig', 'allowhtml', 'allowbbcode', 'allowsmilies', 'hideonline', 'style', 'language', 'timezone', 'dateformat');
$s_hidden_vars = '<input type="hidden" name="sid" value="' . $session_id . '" /><input type="hidden" name="agreed" value="true" /><input type="hidden" name="avatarcatname" value="' . $category . '" />';
$s_hidden_vars = '<input type="hidden" name="sid" value="' . $session_id . '" /><input type="hidden" name="agreed" value="true" />';
for($i = 0; $i < count($params); $i++)
{

View File

@@ -1,460 +0,0 @@
<?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;
}
// We can we will generate a single filtered png
// Thanks to DavidMJ for emulating zlib within the code :)
$_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($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;
// 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($raw_image, $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);
if (@extension_loaded('zlib'))
{
$raw_image = gzcompress($raw_image);
$length = strlen($raw_image);
}
else
{
// The total length of this image, uncompressed, is just a calculation of pixels
$length = ($width + 1) * $height;
// Adler-32 hash generation
// Optimized Adler-32 loop ported from the GNU Classpath project
$temp_length = $length;
$s1 = 1;
$s2 = $index = 0;
while ($temp_length > 0)
{
// We can defer the modulo operation:
// s1 maximally grows from 65521 to 65521 + 255 * 3800
// s2 maximally grows by 3800 * median(s1) = 2090079800 < 2^31
$substract_value = ($temp_length < 3800) ? $temp_length : 3800;
$temp_length -= $substract_value;
while (--$substract_value >= 0)
{
$s1 += ord($raw_image[$index]);
$s2 += $s1;
$index++;
}
$s1 %= 65521;
$s2 %= 65521;
}
$adler_hash = pack('N', ($s2 << 16) | $s1);
// This is the same thing as gzcompress($raw_image, 0) but does not need zlib
$raw_image = pack('C3v2', 0x78, 0x01, 0x01, $length, ~$length) . $raw_image . $adler_hash;
// The Zlib header + Adler hash make us add on 11
$length += 11;
}
// IDAT
$image .= png_chunk($length, 'IDAT', $raw_image);
// 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

@@ -52,67 +52,84 @@ $sql = "SELECT username, user_email, user_viewemail, user_lang
WHERE user_id = $user_id";
if ( $result = $db->sql_query($sql) )
{
if ( $row = $db->sql_fetchrow($result) )
{
$row = $db->sql_fetchrow($result);
$username = $row['username'];
$user_email = $row['user_email'];
$user_lang = $row['user_lang'];
if ( $row['user_viewemail'] || $userdata['user_level'] == ADMIN )
$username = $row['username'];
$user_email = $row['user_email'];
$user_lang = $row['user_lang'];
if ( $row['user_viewemail'] || $userdata['user_level'] == ADMIN )
{
if ( time() - $userdata['user_emailtime'] < $board_config['flood_interval'] )
{
if ( time() - $userdata['user_emailtime'] < $board_config['flood_interval'] )
message_die(GENERAL_MESSAGE, $lang['Flood_email_limit']);
}
if ( isset($HTTP_POST_VARS['submit']) )
{
$error = FALSE;
if ( !empty($HTTP_POST_VARS['subject']) )
{
message_die(GENERAL_MESSAGE, $lang['Flood_email_limit']);
$subject = trim(stripslashes($HTTP_POST_VARS['subject']));
}
if ( isset($HTTP_POST_VARS['submit']) )
else
{
$error = FALSE;
if ( !empty($HTTP_POST_VARS['subject']) )
$error = TRUE;
$error_msg = ( !empty($error_msg) ) ? $error_msg . '<br />' . $lang['Empty_subject_email'] : $lang['Empty_subject_email'];
}
if ( !empty($HTTP_POST_VARS['message']) )
{
$message = trim(stripslashes($HTTP_POST_VARS['message']));
}
else
{
$error = TRUE;
$error_msg = ( !empty($error_msg) ) ? $error_msg . '<br />' . $lang['Empty_message_email'] : $lang['Empty_message_email'];
}
if ( !$error )
{
$sql = "UPDATE " . USERS_TABLE . "
SET user_emailtime = " . time() . "
WHERE user_id = " . $userdata['user_id'];
if ( $result = $db->sql_query($sql) )
{
$subject = trim(stripslashes($HTTP_POST_VARS['subject']));
}
else
{
$error = TRUE;
$error_msg = ( !empty($error_msg) ) ? $error_msg . '<br />' . $lang['Empty_subject_email'] : $lang['Empty_subject_email'];
}
if ( !empty($HTTP_POST_VARS['message']) )
{
$message = trim(stripslashes($HTTP_POST_VARS['message']));
}
else
{
$error = TRUE;
$error_msg = ( !empty($error_msg) ) ? $error_msg . '<br />' . $lang['Empty_message_email'] : $lang['Empty_message_email'];
}
if ( !$error )
{
$sql = "UPDATE " . USERS_TABLE . "
SET user_emailtime = " . time() . "
WHERE user_id = " . $userdata['user_id'];
if ( $result = $db->sql_query($sql) )
include($phpbb_root_path . 'includes/emailer.'.$phpEx);
$emailer = new emailer($board_config['smtp_delivery']);
$emailer->from($userdata['user_email']);
$emailer->replyto($userdata['user_email']);
$email_headers = 'X-AntiAbuse: Board servername - ' . $server_name . "\n";
$email_headers .= 'X-AntiAbuse: User_id - ' . $userdata['user_id'] . "\n";
$email_headers .= 'X-AntiAbuse: Username - ' . $userdata['username'] . "\n";
$email_headers .= 'X-AntiAbuse: User IP - ' . decode_ip($user_ip) . "\n";
$emailer->use_template('profile_send_email', $user_lang);
$emailer->email_address($user_email);
$emailer->set_subject($subject);
$emailer->extra_headers($email_headers);
$emailer->assign_vars(array(
'SITENAME' => $board_config['sitename'],
'BOARD_EMAIL' => $board_config['board_email'],
'FROM_USERNAME' => $userdata['username'],
'TO_USERNAME' => $username,
'MESSAGE' => $message)
);
$emailer->send();
$emailer->reset();
if ( !empty($HTTP_POST_VARS['cc_email']) )
{
include($phpbb_root_path . 'includes/emailer.'.$phpEx);
$emailer = new emailer($board_config['smtp_delivery']);
$emailer->from($userdata['user_email']);
$emailer->replyto($userdata['user_email']);
$email_headers = 'X-AntiAbuse: Board servername - ' . $server_name . "\n";
$email_headers .= 'X-AntiAbuse: User_id - ' . $userdata['user_id'] . "\n";
$email_headers .= 'X-AntiAbuse: Username - ' . $userdata['username'] . "\n";
$email_headers .= 'X-AntiAbuse: User IP - ' . decode_ip($user_ip) . "\n";
$emailer->use_template('profile_send_email', $user_lang);
$emailer->email_address($user_email);
$emailer->use_template('profile_send_email');
$emailer->email_address($userdata['user_email']);
$emailer->set_subject($subject);
$emailer->extra_headers($email_headers);
$emailer->assign_vars(array(
'SITENAME' => $board_config['sitename'],
'BOARD_EMAIL' => $board_config['board_email'],
@@ -122,95 +139,72 @@ if ( $result = $db->sql_query($sql) )
);
$emailer->send();
$emailer->reset();
if ( !empty($HTTP_POST_VARS['cc_email']) )
{
$emailer->from($userdata['user_email']);
$emailer->replyto($userdata['user_email']);
$emailer->use_template('profile_send_email');
$emailer->email_address($userdata['user_email']);
$emailer->set_subject($subject);
$emailer->assign_vars(array(
'SITENAME' => $board_config['sitename'],
'BOARD_EMAIL' => $board_config['board_email'],
'FROM_USERNAME' => $userdata['username'],
'TO_USERNAME' => $username,
'MESSAGE' => $message)
);
$emailer->send();
$emailer->reset();
}
$template->assign_vars(array(
'META' => '<meta http-equiv="refresh" content="5;url=' . append_sid("index.$phpEx") . '">')
);
$message = $lang['Email_sent'] . '<br /><br />' . sprintf($lang['Click_return_index'], '<a href="' . append_sid("index.$phpEx") . '">', '</a>');
message_die(GENERAL_MESSAGE, $message);
}
else
{
message_die(GENERAL_ERROR, 'Could not update last email time', '', __LINE__, __FILE__, $sql);
}
$template->assign_vars(array(
'META' => '<meta http-equiv="refresh" content="5;url=' . append_sid("index.$phpEx") . '">')
);
$message = $lang['Email_sent'] . '<br /><br />' . sprintf($lang['Click_return_index'], '<a href="' . append_sid("index.$phpEx") . '">', '</a>');
message_die(GENERAL_MESSAGE, $message);
}
else
{
message_die(GENERAL_ERROR, 'Could not update last email time', '', __LINE__, __FILE__, $sql);
}
}
include($phpbb_root_path . 'includes/page_header.'.$phpEx);
$template->set_filenames(array(
'body' => 'profile_send_email.tpl')
);
make_jumpbox('viewforum.'.$phpEx);
if ( $error )
{
$template->set_filenames(array(
'reg_header' => 'error_body.tpl')
);
$template->assign_vars(array(
'ERROR_MESSAGE' => $error_msg)
);
$template->assign_var_from_handle('ERROR_BOX', 'reg_header');
}
$template->assign_vars(array(
'USERNAME' => $username,
'S_HIDDEN_FIELDS' => '',
'S_POST_ACTION' => append_sid("profile.$phpEx?mode=email&amp;" . POST_USERS_URL . "=$user_id"),
'L_SEND_EMAIL_MSG' => $lang['Send_email_msg'],
'L_RECIPIENT' => $lang['Recipient'],
'L_SUBJECT' => $lang['Subject'],
'L_MESSAGE_BODY' => $lang['Message_body'],
'L_MESSAGE_BODY_DESC' => $lang['Email_message_desc'],
'L_EMPTY_SUBJECT_EMAIL' => $lang['Empty_subject_email'],
'L_EMPTY_MESSAGE_EMAIL' => $lang['Empty_message_email'],
'L_OPTIONS' => $lang['Options'],
'L_CC_EMAIL' => $lang['CC_email'],
'L_SPELLCHECK' => $lang['Spellcheck'],
'L_SEND_EMAIL' => $lang['Send_email'])
);
$template->pparse('body');
include($phpbb_root_path . 'includes/page_tail.'.$phpEx);
}
else
include($phpbb_root_path . 'includes/page_header.'.$phpEx);
$template->set_filenames(array(
'body' => 'profile_send_email.tpl')
);
make_jumpbox('viewforum.'.$phpEx);
if ( $error )
{
message_die(GENERAL_MESSAGE, $lang['User_prevent_email']);
$template->set_filenames(array(
'reg_header' => 'error_body.tpl')
);
$template->assign_vars(array(
'ERROR_MESSAGE' => $error_msg)
);
$template->assign_var_from_handle('ERROR_BOX', 'reg_header');
}
$template->assign_vars(array(
'USERNAME' => $username,
'S_HIDDEN_FIELDS' => '',
'S_POST_ACTION' => append_sid("profile.$phpEx?mode=email&amp;" . POST_USERS_URL . "=$user_id"),
'L_SEND_EMAIL_MSG' => $lang['Send_email_msg'],
'L_RECIPIENT' => $lang['Recipient'],
'L_SUBJECT' => $lang['Subject'],
'L_MESSAGE_BODY' => $lang['Message_body'],
'L_MESSAGE_BODY_DESC' => $lang['Email_message_desc'],
'L_EMPTY_SUBJECT_EMAIL' => $lang['Empty_subject_email'],
'L_EMPTY_MESSAGE_EMAIL' => $lang['Empty_message_email'],
'L_OPTIONS' => $lang['Options'],
'L_CC_EMAIL' => $lang['CC_email'],
'L_SPELLCHECK' => $lang['Spellcheck'],
'L_SEND_EMAIL' => $lang['Send_email'])
);
$template->pparse('body');
include($phpbb_root_path . 'includes/page_tail.'.$phpEx);
}
else
{
message_die(GENERAL_MESSAGE, $lang['User_not_exist']);
message_die(GENERAL_MESSAGE, $lang['User_prevent_email']);
}
}
else
{
message_die(GENERAL_ERROR, 'Could not select user data', '', __LINE__, __FILE__, $sql);
message_die(GENERAL_MESSAGE, $lang['User_not_exist']);
}
?>

View File

@@ -21,19 +21,6 @@
*
***************************************************************************/
/*
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");
@@ -73,7 +60,6 @@ function show_coppa()
// ---------------------------------------
$error = FALSE;
$error_msg = '';
$page_title = ( $mode == 'editprofile' ) ? $lang['Edit_profile'] : $lang['Register'];
if ( $mode == 'register' && !isset($HTTP_POST_VARS['agreed']) && !isset($HTTP_GET_VARS['agreed']) )
@@ -107,7 +93,7 @@ if (
$current_email = trim(htmlspecialchars($HTTP_POST_VARS['current_email']));
}
$strip_var_list = array('email' => 'email', 'icq' => 'icq', 'aim' => 'aim', 'msn' => 'msn', 'yim' => 'yim', 'website' => 'website', 'location' => 'location', 'occupation' => 'occupation', 'interests' => 'interests', 'confirm_code' => 'confirm_code');
$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 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
@@ -120,8 +106,6 @@ if (
}
}
$username = ( !empty($HTTP_POST_VARS['username']) ) ? phpbb_clean_username($HTTP_POST_VARS['username']) : '';
$trim_var_list = array('cur_password' => 'cur_password', 'new_password' => 'new_password', 'password_confirm' => 'password_confirm', 'signature' => 'signature');
while( list($var, $param) = @each($trim_var_list) )
@@ -132,8 +116,7 @@ if (
}
}
$signature = (isset($signature)) ? str_replace('<br />', "\n", $signature) : '';
$signature_bbcode_uid = '';
$signature = str_replace('<br />', "\n", $signature);
// Run some validation on the optional fields. These are pass-by-ref, so they'll be changed to
// empty strings if they fail.
@@ -144,7 +127,6 @@ if (
$notifyreply = ( isset($HTTP_POST_VARS['notifyreply']) ) ? ( ($HTTP_POST_VARS['notifyreply']) ? TRUE : 0 ) : 0;
$notifypm = ( isset($HTTP_POST_VARS['notifypm']) ) ? ( ($HTTP_POST_VARS['notifypm']) ? TRUE : 0 ) : TRUE;
$popup_pm = ( isset($HTTP_POST_VARS['popup_pm']) ) ? ( ($HTTP_POST_VARS['popup_pm']) ? TRUE : 0 ) : TRUE;
$sid = (isset($HTTP_POST_VARS['sid'])) ? $HTTP_POST_VARS['sid'] : 0;
if ( $mode == 'register' )
{
@@ -156,7 +138,7 @@ if (
}
else
{
$attachsig = ( isset($HTTP_POST_VARS['attachsig']) ) ? ( ($HTTP_POST_VARS['attachsig']) ? TRUE : 0 ) : $userdata['user_attachsig'];
$attachsig = ( isset($HTTP_POST_VARS['attachsig']) ) ? ( ($HTTP_POST_VARS['attachsig']) ? TRUE : 0 ) : 0;
$allowhtml = ( isset($HTTP_POST_VARS['allowhtml']) ) ? ( ($HTTP_POST_VARS['allowhtml']) ? TRUE : 0 ) : $userdata['user_allowhtml'];
$allowbbcode = ( isset($HTTP_POST_VARS['allowbbcode']) ) ? ( ($HTTP_POST_VARS['allowbbcode']) ? TRUE : 0 ) : $userdata['user_allowbbcode'];
@@ -196,7 +178,6 @@ if (
$user_dateformat = ( !empty($HTTP_POST_VARS['dateformat']) ) ? trim(htmlspecialchars($HTTP_POST_VARS['dateformat'])) : $board_config['default_dateformat'];
$user_avatar_local = ( isset($HTTP_POST_VARS['avatarselect']) && !empty($HTTP_POST_VARS['submitavatar']) && $board_config['allow_avatar_local'] ) ? htmlspecialchars($HTTP_POST_VARS['avatarselect']) : ( ( isset($HTTP_POST_VARS['avatarlocal']) ) ? htmlspecialchars($HTTP_POST_VARS['avatarlocal']) : '' );
$user_avatar_category = ( isset($HTTP_POST_VARS['avatarcatname']) && $board_config['allow_avatar_local'] ) ? htmlspecialchars($HTTP_POST_VARS['avatarcatname']) : '' ;
$user_avatar_remoteurl = ( !empty($HTTP_POST_VARS['avatarremoteurl']) ) ? trim(htmlspecialchars($HTTP_POST_VARS['avatarremoteurl'])) : '';
$user_avatar_upload = ( !empty($HTTP_POST_VARS['avatarurl']) ) ? trim($HTTP_POST_VARS['avatarurl']) : ( ( $HTTP_POST_FILES['avatar']['tmp_name'] != "none") ? $HTTP_POST_FILES['avatar']['tmp_name'] : '' );
@@ -204,8 +185,8 @@ if (
$user_avatar_size = ( !empty($HTTP_POST_FILES['avatar']['size']) ) ? $HTTP_POST_FILES['avatar']['size'] : 0;
$user_avatar_filetype = ( !empty($HTTP_POST_FILES['avatar']['type']) ) ? $HTTP_POST_FILES['avatar']['type'] : '';
$user_avatar = ( empty($user_avatar_local) && $mode == 'editprofile' ) ? $userdata['user_avatar'] : '';
$user_avatar_type = ( empty($user_avatar_local) && $mode == 'editprofile' ) ? $userdata['user_avatar_type'] : '';
$user_avatar = ( empty($user_avatar_loc) && $mode == 'editprofile' ) ? $userdata['user_avatar'] : '';
$user_avatar_type = ( empty($user_avatar_loc) && $mode == 'editprofile' ) ? $userdata['user_avatar_type'] : '';
if ( (isset($HTTP_POST_VARS['avatargallery']) || isset($HTTP_POST_VARS['submitavatar']) || isset($HTTP_POST_VARS['cancelavatar'])) && (!isset($HTTP_POST_VARS['submit'])) )
{
@@ -224,14 +205,14 @@ if (
$location = stripslashes($location);
$occupation = stripslashes($occupation);
$interests = stripslashes($interests);
$signature = htmlspecialchars(stripslashes($signature));
$signature = stripslashes($signature);
$user_lang = stripslashes($user_lang);
$user_dateformat = stripslashes($user_dateformat);
if ( !isset($HTTP_POST_VARS['cancelavatar']))
{
$user_avatar = $user_avatar_category . '/' . $user_avatar_local;
$user_avatar = $user_avatar_local;
$user_avatar_type = USER_AVATAR_GALLERY;
}
}
@@ -254,13 +235,6 @@ if ( isset($HTTP_POST_VARS['submit']) )
{
include($phpbb_root_path . 'includes/usercp_avatar.'.$phpEx);
// session id check
if ($sid == '' || $sid != $userdata['session_id'])
{
$error = true;
$error_msg .= ( ( isset($error_msg) ) ? '<br />' : '' ) . $lang['Session_invalid'];
}
$passwd_sql = '';
if ( $mode == 'editprofile' )
{
@@ -279,57 +253,6 @@ 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) )
{
@@ -421,9 +344,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']) || $mode == 'register')
if (strtolower($username) != strtolower($userdata['username']))
{
$result = validate_username($username);
if ( $result['error'] )
@@ -448,7 +371,7 @@ if ( isset($HTTP_POST_VARS['submit']) )
$error_msg .= ( ( isset($error_msg) ) ? '<br />' : '' ) . $lang['Signature_too_long'];
}
if ( !isset($signature_bbcode_uid) || $signature_bbcode_uid == '' )
if ( $signature_bbcode_uid == '' )
{
$signature_bbcode_uid = ( $allowbbcode ) ? make_bbcode_uid() : '';
}
@@ -466,12 +389,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)) ? 'remote' : 'local';
$avatar_mode = ( !empty($user_avatar_name) ) ? 'local' : 'remote';
$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) )
@@ -484,13 +407,19 @@ if ( isset($HTTP_POST_VARS['submit']) )
}
else if ( $user_avatar_remoteurl != '' && $board_config['allow_avatar_remote'] )
{
user_avatar_delete($userdata['user_avatar_type'], $userdata['user_avatar']);
if ( @file_exists(@phpbb_realpath('./' . $board_config['avatar_path'] . '/' . $userdata['user_avatar'])) )
{
@unlink(@phpbb_realpath('./' . $board_config['avatar_path'] . '/' . $userdata['user_avatar']));
}
$avatar_sql = user_avatar_url($mode, $error, $error_msg, $user_avatar_remoteurl);
}
else if ( $user_avatar_local != '' && $board_config['allow_avatar_local'] )
{
user_avatar_delete($userdata['user_avatar_type'], $userdata['user_avatar']);
$avatar_sql = user_avatar_gallery($mode, $error, $error_msg, $user_avatar_local, $user_avatar_category);
if ( @file_exists(@phpbb_realpath('./' . $board_config['avatar_path'] . '/' . $userdata['user_avatar'])) )
{
@unlink(@phpbb_realpath('./' . $board_config['avatar_path'] . '/' . $userdata['user_avatar']));
}
$avatar_sql = user_avatar_gallery($mode, $error, $error_msg, $user_avatar_local);
}
if ( !$error )
@@ -530,13 +459,6 @@ if ( isset($HTTP_POST_VARS['submit']) )
message_die(GENERAL_ERROR, 'Could not update users table', '', __LINE__, __FILE__, $sql);
}
// We remove all stored login keys since the password has been updated
// and change the current one (if applicable)
if ( !empty($passwd_sql) )
{
session_reset_keys($user_id, $user_ip);
}
if ( !$user_active )
{
//
@@ -545,56 +467,22 @@ if ( isset($HTTP_POST_VARS['submit']) )
include($phpbb_root_path . 'includes/emailer.'.$phpEx);
$emailer = new emailer($board_config['smtp_delivery']);
if ( $board_config['require_activation'] != USER_ACTIVATION_ADMIN )
{
$emailer->from($board_config['board_email']);
$emailer->replyto($board_config['board_email']);
$emailer->use_template('user_activate', stripslashes($user_lang));
$emailer->email_address($email);
$emailer->set_subject($lang['Reactivate']);
$emailer->assign_vars(array(
'SITENAME' => $board_config['sitename'],
'USERNAME' => preg_replace($unhtml_specialchars_match, $unhtml_specialchars_replace, substr(str_replace("\'", "'", $username), 0, 25)),
'EMAIL_SIG' => (!empty($board_config['board_email_sig'])) ? str_replace('<br />', "\n", "-- \n" . $board_config['board_email_sig']) : '',
'U_ACTIVATE' => $server_url . '?mode=activate&' . POST_USERS_URL . '=' . $user_id . '&act_key=' . $user_actkey)
);
$emailer->send();
$emailer->reset();
}
else if ( $board_config['require_activation'] == USER_ACTIVATION_ADMIN )
{
$sql = 'SELECT user_email, user_lang
FROM ' . USERS_TABLE . '
WHERE user_level = ' . ADMIN;
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Could not select Administrators', '', __LINE__, __FILE__, $sql);
}
while ($row = $db->sql_fetchrow($result))
{
$emailer->from($board_config['board_email']);
$emailer->replyto($board_config['board_email']);
$emailer->email_address(trim($row['user_email']));
$emailer->use_template("admin_activate", $row['user_lang']);
$emailer->set_subject($lang['Reactivate']);
$emailer->assign_vars(array(
'USERNAME' => preg_replace($unhtml_specialchars_match, $unhtml_specialchars_replace, substr(str_replace("\'", "'", $username), 0, 25)),
'EMAIL_SIG' => str_replace('<br />', "\n", "-- \n" . $board_config['board_email_sig']),
'U_ACTIVATE' => $server_url . '?mode=activate&' . POST_USERS_URL . '=' . $user_id . '&act_key=' . $user_actkey)
);
$emailer->send();
$emailer->reset();
}
$db->sql_freeresult($result);
}
$emailer->from($board_config['board_email']);
$emailer->replyto($board_config['board_email']);
$emailer->use_template('user_activate', stripslashes($user_lang));
$emailer->email_address($email);
$emailer->set_subject($lang['Reactivate']);
$emailer->assign_vars(array(
'SITENAME' => $board_config['sitename'],
'USERNAME' => preg_replace($unhtml_specialchars_match, $unhtml_specialchars_replace, substr(str_replace("\'", "'", $username), 0, 25)),
'EMAIL_SIG' => (!empty($board_config['board_email_sig'])) ? str_replace('<br />', "\n", "-- \n" . $board_config['board_email_sig']) : '',
'U_ACTIVATE' => $server_url . '?mode=activate&' . POST_USERS_URL . '=' . $user_id . '&act_key=' . $user_actkey)
);
$emailer->send();
$emailer->reset();
$message = $lang['Profile_updated_inactive'] . '<br /><br />' . sprintf($lang['Click_return_index'], '<a href="' . append_sid("index.$phpEx") . '">', '</a>');
}
@@ -779,7 +667,6 @@ if ( $error )
//
$username = stripslashes($username);
$email = stripslashes($email);
$cur_password = '';
$new_password = '';
$password_confirm = '';
@@ -804,7 +691,6 @@ else if ( $mode == 'editprofile' && !isset($HTTP_POST_VARS['avatargallery']) &&
$user_id = $userdata['user_id'];
$username = $userdata['username'];
$email = $userdata['user_email'];
$cur_password = '';
$new_password = '';
$password_confirm = '';
@@ -867,7 +753,7 @@ if( isset($HTTP_POST_VARS['avatargallery']) && !$error )
$allowviewonline = !$allowviewonline;
display_avatar_gallery($mode, $avatar_category, $user_id, $email, $current_email, $coppa, $username, $email, $new_password, $cur_password, $password_confirm, $icq, $aim, $msn, $yim, $website, $location, $occupation, $interests, $signature, $viewemail, $notifypm, $popup_pm, $notifyreply, $attachsig, $allowhtml, $allowbbcode, $allowsmilies, $allowviewonline, $user_style, $user_lang, $user_timezone, $user_dateformat, $userdata['session_id']);
display_avatar_gallery($mode, $avatar_category, $user_id, $email, $current_email, $coppa, $username, $email, &$new_password, &$cur_password, $password_confirm, $icq, $aim, $msn, $yim, $website, $location, $occupation, $interests, $signature, $viewemail, $notifypm, $popup_pm, $notifyreply, $attachsig, $allowhtml, $allowbbcode, $allowsmilies, $allowviewonline, $user_style, $user_lang, $user_timezone, $user_dateformat, $userdata['session_id']);
}
else
{
@@ -878,9 +764,9 @@ else
$coppa = FALSE;
}
if ( !isset($user_style) )
if ( !isset($user_template) )
{
$user_style = $board_config['default_style'];
$selected_template = $board_config['system_template'];
}
$avatar_img = '';
@@ -901,7 +787,6 @@ else
}
$s_hidden_fields = '<input type="hidden" name="mode" value="' . $mode . '" /><input type="hidden" name="agreed" value="true" /><input type="hidden" name="coppa" value="' . $coppa . '" />';
$s_hidden_fields .= '<input type="hidden" name="sid" value="' . $userdata['session_id'] . '" />';
if( $mode == 'editprofile' )
{
$s_hidden_fields .= '<input type="hidden" name="user_id" value="' . $userdata['user_id'] . '" />';
@@ -914,7 +799,7 @@ else
if ( !empty($user_avatar_local) )
{
$s_hidden_fields .= '<input type="hidden" name="avatarlocal" value="' . $user_avatar_local . '" /><input type="hidden" name="avatarcatname" value="' . $user_avatar_category . '" />';
$s_hidden_fields .= '<input type="hidden" name="avatarlocal" value="' . $user_avatar_local . '" />';
}
$html_status = ( $userdata['user_allowhtml'] && $board_config['allow_html'] ) ? $lang['HTML_is_ON'] : $lang['HTML_is_OFF'];
@@ -950,76 +835,6 @@ 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);
// Generate the required confirmation code
// NB 0 (zero) could get confused with O (the letter) so we make change it
$code = dss_rand();
$code = substr(str_replace('0', 'Z', strtoupper(base_convert($code, 16, 35))), 2, 6);
$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 = '<img src="' . append_sid("profile.$phpEx?mode=confirm&amp;id=$confirm_id") . '" 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....
@@ -1028,12 +843,11 @@ else
$form_enctype = ( @$ini_val('file_uploads') == '0' || strtolower(@$ini_val('file_uploads') == 'off') || phpversion() == '4.0.4pl1' || !$board_config['allow_avatar_upload'] || ( phpversion() < '4.0.3' && @$ini_val('open_basedir') != '' ) ) ? '' : 'enctype="multipart/form-data"';
$template->assign_vars(array(
'USERNAME' => isset($username) ? $username : '',
'CUR_PASSWORD' => isset($cur_password) ? $cur_password : '',
'NEW_PASSWORD' => isset($new_password) ? $new_password : '',
'PASSWORD_CONFIRM' => isset($password_confirm) ? $password_confirm : '',
'EMAIL' => isset($email) ? $email : '',
'CONFIRM_IMG' => $confirm_image,
'USERNAME' => $username,
'CUR_PASSWORD' => $cur_password,
'NEW_PASSWORD' => $new_password,
'PASSWORD_CONFIRM' => $password_confirm,
'EMAIL' => $email,
'YIM' => $yim,
'ICQ' => $icq,
'MSN' => $msn,
@@ -1128,10 +942,6 @@ 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']) ) ? phpbb_clean_username($HTTP_POST_VARS['username']) : '';
$username = ( !empty($HTTP_POST_VARS['username']) ) ? trim(strip_tags($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
@@ -50,7 +50,7 @@ if ( isset($HTTP_POST_VARS['submit']) )
$user_actkey = gen_rand_string(true);
$key_len = 54 - strlen($server_url);
$key_len = ($key_len > 6) ? $key_len : 6;
$key_len = ( $str_len > 6 ) ? $key_len : 6;
$user_actkey = substr($user_actkey, 0, $key_len);
$user_password = gen_rand_string(false);

View File

@@ -33,11 +33,6 @@ 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";
@@ -165,8 +160,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="' . sprintf($lang['Search_user_posts'], $profiledata['username']) . '" title="' . sprintf($lang['Search_user_posts'], $profiledata['username']) . '" border="0" /></a>';
$search = '<a href="' . $temp_url . '">' . sprintf($lang['Search_user_posts'], $profiledata['username']) . '</a>';
$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>';
//
// Generate page
@@ -174,15 +169,6 @@ $search = '<a href="' . $temp_url . '">' . sprintf($lang['Search_user_posts'], $
$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']),
@@ -237,7 +223,7 @@ $template->assign_vars(array(
'L_OCCUPATION' => $lang['Occupation'],
'L_INTERESTS' => $lang['Interests'],
'U_SEARCH_USER' => append_sid("search.$phpEx?search_author=" . $u_search_author),
'U_SEARCH_USER' => append_sid("search.$phpEx?search_author=" . urlencode($profiledata['username'])),
'S_PROFILE_ACTION' => append_sid("profile.$phpEx"))
);

View File

@@ -119,10 +119,7 @@ if( !($result = $db->sql_query($sql)) )
}
$category_rows = array();
while ($row = $db->sql_fetchrow($result))
{
$category_rows[] = $row;
}
while( $category_rows[] = $db->sql_fetchrow($result) );
$db->sql_freeresult($result);
if( ( $total_categories = count($category_rows) ) )
@@ -186,14 +183,8 @@ if( ( $total_categories = count($category_rows) ) )
// Obtain a list of topic ids which contain
// posts made since user last visited
//
if ($userdata['session_logged_in'])
if ( $userdata['session_logged_in'] )
{
// 60 days limit
if ($userdata['user_lastvisit'] < (time() - 5184000))
{
$userdata['user_lastvisit'] = time() - 5184000;
}
$sql = "SELECT t.forum_id, t.topic_id, p.post_time
FROM " . TOPICS_TABLE . " t, " . POSTS_TABLE . " p
WHERE p.post_id = t.topic_last_post_id
@@ -302,19 +293,6 @@ if( ( $total_categories = count($category_rows) ) )
'U_MARK_READ' => append_sid("index.$phpEx?mark=forums"))
);
//
// Let's decide which categories we should display
//
$display_categories = array();
for ($i = 0; $i < $total_forums; $i++ )
{
if ($is_auth_ary[$forum_data[$i]['forum_id']]['auth_view'])
{
$display_categories[$forum_data[$i]['cat_id']] = true;
}
}
//
// Okay, let's build the index
//
@@ -322,11 +300,23 @@ if( ( $total_categories = count($category_rows) ) )
{
$cat_id = $category_rows[$i]['cat_id'];
//
// Should we display this category/forum set?
//
$display_forums = false;
for($j = 0; $j < $total_forums; $j++)
{
if ( $is_auth_ary[$forum_data[$j]['forum_id']]['auth_view'] && $forum_data[$j]['cat_id'] == $cat_id )
{
$display_forums = true;
}
}
//
// Yes, we should, so first dump out the category
// title, then, if appropriate the forum list
//
if (isset($display_categories[$cat_id]) && $display_categories[$cat_id])
if ( $display_forums )
{
$template->assign_block_vars('catrow', array(
'CAT_ID' => $cat_id,

View File

@@ -225,23 +225,6 @@ 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())
{
@@ -333,7 +316,7 @@ $available_dbms = array(
'COMMENTS' => 'remove_remarks'
),
'mysql4' => array(
'LABEL' => 'MySQL 4.x/5.x',
'LABEL' => 'MySQL 4.x',
'SCHEMA' => 'mysql',
'DELIM' => ';',
'DELIM_BASIC' => ';',

View File

@@ -41,9 +41,7 @@ INSERT INTO phpbb_config (config_name, config_value) VALUES ('max_sentbox_privms
INSERT INTO phpbb_config (config_name, config_value) VALUES ('max_savebox_privmsgs','50');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('board_email_sig','Thanks, The Management');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('board_email','youraddress@yourdomain.com');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('enable_confirm', '1');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_autologin','1');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('max_autologin_time','0');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('enable_confirm', '0');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('smtp_delivery','0');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('smtp_host','');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('smtp_username','');
@@ -51,10 +49,6 @@ INSERT INTO phpbb_config (config_name, config_value) VALUES ('smtp_password','')
INSERT INTO phpbb_config (config_name, config_value) VALUES ('sendmail_fix','0');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('require_activation','0');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('flood_interval','15');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('search_flood_interval','15');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('search_min_chars','3');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('max_login_attempts', '5');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('login_reset_time', '30');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('board_email_form','0');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('avatar_filesize','6144');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('avatar_max_width','80');
@@ -75,8 +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.22');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('rand_seed', '0');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('version', '.0.10');
/*
-- Categories
@@ -91,14 +84,14 @@ SET IDENTITY_INSERT phpbb_categories OFF;
/*
-- Forums
*/
INSERT INTO phpbb_forums (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_announce, auth_sticky, auth_pollcreate, auth_vote, auth_attachments) VALUES (1, 1, 'Test Forum 1', 'This is just a test forum, nothing special here.', '', 1, 1, 1, 1, '', 1, '', '', 1, 1, 1, 1, 3, 3, 1, 1, 3);
INSERT INTO phpbb_forums (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_announce, auth_sticky, auth_pollcreate, auth_vote, auth_attachments) VALUES (1, 1, 'Test Forum 1', 'This is just a test forum, nothing special here.', '', 1, 1, 1, 1, '', 1, '', '', '', '', 1, 1, 3, 3, 1, 1, 3);
/*
-- Users
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, 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_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_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

@@ -165,7 +165,6 @@ GO
CREATE TABLE [phpbb_search_results] (
[search_id] [int] NOT NULL ,
[session_id] [char] (32) NOT NULL ,
[search_time] [int] NOT NULL ,
[search_array] [text] NOT NULL
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
@@ -191,16 +190,7 @@ CREATE TABLE [phpbb_sessions] (
[session_time] [int] NULL ,
[session_ip] [char] (8) NOT NULL ,
[session_page] [int] NULL ,
[session_logged_in] [smallint] NULL,
[session_admin] [smallint] NULL
) ON [PRIMARY]
GO
CREATE TABLE [phpbb_sessions_keys] (
[key_id] [char] (32) NOT NULL ,
[user_id] [int] NOT NULL ,
[last_ip] [char] (8) NOT NULL ,
[last_login] [int] NOT NULL
[session_logged_in] [smallint] NULL
) ON [PRIMARY]
GO
@@ -343,8 +333,6 @@ CREATE TABLE [phpbb_users] (
[user_new_privmsg] [smallint] NOT NULL ,
[user_unread_privmsg] [smallint] NOT NULL ,
[user_last_privmsg] [int] NOT NULL ,
[user_login_tries] [smallint] NOT NULL ,
[user_last_login_try] [int] NOT NULL ,
[user_emailtime] [int] NOT NULL ,
[user_viewemail] [smallint] NULL ,
[user_attachsig] [smallint] NULL ,
@@ -594,10 +582,6 @@ ALTER TABLE [phpbb_posts] WITH NOCHECK ADD
CONSTRAINT [DF_phpbb_posts_post_edit_count] DEFAULT (0) FOR [post_edit_count]
GO
ALTER TABLE [phpbb_search_results] WITH NOCHECK ADD
CONSTRAINT [DF_phpbb_search_results_search_time] DEFAULT (0) FOR [search_time]
GO
ALTER TABLE [phpbb_search_wordlist] WITH NOCHECK ADD
CONSTRAINT [DF_phpbb_search_wordlist_word_common] DEFAULT (0) FOR [word_common]
GO
@@ -620,8 +604,6 @@ ALTER TABLE [phpbb_users] WITH NOCHECK ADD
CONSTRAINT [DF_phpbb_users_user_new_privmsg] DEFAULT (0) FOR [user_new_privmsg],
CONSTRAINT [DF_phpbb_users_user_unread_privmsg] DEFAULT (0) FOR [user_unread_privmsg],
CONSTRAINT [DF_phpbb_users_user_last_privmsg] DEFAULT (0) FOR [user_last_privmsg],
CONSTRAINT [DF_phpbb_users_user_login_tries] DEFAULT (0) FOR [user_login_tries],
CONSTRAINT [DF_phpbb_users_user_last_login_try] DEFAULT (0) FOR [user_last_login_try],
CONSTRAINT [DF_phpbb_users_user_emailtime] DEFAULT (0) FOR [user_emailtime],
CONSTRAINT [DF_phpbb_users_user_viewemail] DEFAULT (1) FOR [user_viewemail],
CONSTRAINT [DF_phpbb_users_user_attachsig] DEFAULT (1) FOR [user_attachsig],
@@ -633,7 +615,6 @@ ALTER TABLE [phpbb_users] WITH NOCHECK ADD
CONSTRAINT [DF_phpbb_users_user_allow_viewonline] DEFAULT (1) FOR [user_allow_viewonline],
CONSTRAINT [DF_phpbb_users_user_notify_pm] DEFAULT (0) FOR [user_notify_pm],
CONSTRAINT [DF_phpbb_users_user_popup_pm] DEFAULT (1) FOR [user_popup_pm],
CONSTRAINT [DF_phpbb_users_user_dateformat] DEFAULT('d M Y H:i') FOR [user_dateformat],
CONSTRAINT [DF_phpbb_users_user_avatar_type] DEFAULT (0) FOR [user_avatar_type]
GO
@@ -685,12 +666,6 @@ GO
CREATE INDEX [IX_phpbb_sessions] ON [phpbb_sessions]([session_id], [session_user_id], [session_ip], [session_logged_in]) ON [PRIMARY]
GO
CREATE INDEX [IX_phpbb_sessions_keys] ON [phpbb_sessions_keys]([key_id], [user_id]) ON [PRIMARY]
GO
CREATE INDEX [IX_phpbb_sessions_keys_1] ON [phpbb_sessions_keys]([last_login]) ON [PRIMARY]
GO
CREATE INDEX [IX_phpbb_topics] ON [phpbb_topics]([forum_id], [topic_type], [topic_first_post_id], [topic_last_post_id]) ON [PRIMARY]
GO

View File

@@ -23,9 +23,7 @@ INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_theme_create
INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_avatar_local','0');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_avatar_remote','0');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_avatar_upload','0');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('enable_confirm', '1');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_autologin','1');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('max_autologin_time','0');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('enable_confirm', '0');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('override_user_style','0');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('posts_per_page','15');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('topics_per_page','50');
@@ -44,10 +42,6 @@ INSERT INTO phpbb_config (config_name, config_value) VALUES ('smtp_password','')
INSERT INTO phpbb_config (config_name, config_value) VALUES ('sendmail_fix','0');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('require_activation','0');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('flood_interval','15');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('search_flood_interval','15');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('search_min_chars','3');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('max_login_attempts', '5');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('login_reset_time', '30');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('board_email_form','0');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('avatar_filesize','6144');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('avatar_max_width','80');
@@ -68,8 +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.22');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('rand_seed', '0');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('version', '.0.10');
# -- Categories
@@ -77,11 +70,11 @@ INSERT INTO phpbb_categories (cat_id, cat_title, cat_order) VALUES (1, 'Test cat
# -- Forums
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, 1, 1, 1, 1, 3, 3, 1, 1, 3);
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, 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_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);
# -- 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);
@@ -111,7 +104,7 @@ INSERT INTO phpbb_posts_text (post_id, post_subject, post_text) VALUES (1, NULL,
# -- Themes
INSERT INTO phpbb_themes (themes_id, template_name, style_name, head_stylesheet, body_background, body_bgcolor, body_text, body_link, body_vlink, body_alink, body_hlink, tr_color1, tr_color2, tr_color3, tr_class1, tr_class2, tr_class3, th_color1, th_color2, th_color3, th_class1, th_class2, th_class3, td_color1, td_color2, td_color3, td_class1, td_class2, td_class3, fontface1, fontface2, fontface3, fontsize1, fontsize2, fontsize3, fontcolor1, fontcolor2, fontcolor3, span_class1, span_class2, span_class3) VALUES (1, 'subSilver', 'subSilver', 'subSilver.css', '', 'E5E5E5', '000000', '006699', '5493B4', '', 'DD6900', 'EFEFEF', 'DEE3E7', 'D1D7DC', '', '', '', '98AAB1', '006699', 'FFFFFF', 'cellpic1.gif', 'cellpic3.gif', 'cellpic2.jpg', 'FAFAFA', 'FFFFFF', '', 'row1', 'row2', '', 'Verdana, Arial, Helvetica, sans-serif', 'Trebuchet MS', 'Courier, ''Courier New'', sans-serif', 10, 11, 12, '444444', '006600', 'FFA34F', '', '', '');
INSERT INTO phpbb_themes (themes_id, template_name, style_name, head_stylesheet, body_background, body_bgcolor, body_text, body_link, body_vlink, body_alink, body_hlink, tr_color1, tr_color2, tr_color3, tr_class1, tr_class2, tr_class3, th_color1, th_color2, th_color3, th_class1, th_class2, th_class3, td_color1, td_color2, td_color3, td_class1, td_class2, td_class3, fontface1, fontface2, fontface3, fontsize1, fontsize2, fontsize3, fontcolor1, fontcolor2, fontcolor3, span_class1, span_class2, span_class3) VALUES (1, 'subSilver', 'subSilver', 'subSilver.css', '', 'E5E5E5', '000000', '006699', '5493B4', '', 'DD6900', 'EFEFEF', 'DEE3E7', 'D1D7DC', '', '', '', '98AAB1', '006699', 'FFFFFF', 'cellpic1.gif', 'cellpic3.gif', 'cellpic2.jpg', 'FAFAFA', 'FFFFFF', '', 'row1', 'row2', '', 'Verdana, Arial, Helvetica, sans-serif', 'Trebuchet MS', 'Courier, \'Courier New\', sans-serif', 10, 11, 12, '444444', '006600', 'FFA34F', '', '', '');
INSERT INTO phpbb_themes_name (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 (1, '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', '', '', '');

View File

@@ -194,7 +194,7 @@ CREATE TABLE phpbb_posts (
#
CREATE TABLE phpbb_posts_text (
post_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL,
bbcode_uid char(10) DEFAULT '' NOT NULL,
bbcode_uid char(10) NOT NULL,
post_subject char(60),
post_text text,
PRIMARY KEY (post_id)
@@ -256,8 +256,7 @@ CREATE TABLE phpbb_ranks (
CREATE TABLE phpbb_search_results (
search_id int(11) UNSIGNED NOT NULL default '0',
session_id char(32) NOT NULL default '',
search_time int(11) DEFAULT '0' NOT NULL,
search_array mediumtext NOT NULL,
search_array text NOT NULL,
PRIMARY KEY (search_id),
KEY session_id (session_id)
);
@@ -306,25 +305,11 @@ 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)
);
# --------------------------------------------------------
#
# Table structure for table `phpbb_sessions_keys`
#
CREATE TABLE phpbb_sessions_keys (
key_id varchar(32) DEFAULT '0' NOT NULL,
user_id mediumint(8) DEFAULT '0' NOT NULL,
last_ip varchar(8) DEFAULT '0' NOT NULL,
last_login int(11) DEFAULT '0' NOT NULL,
PRIMARY KEY (key_id, user_id),
KEY last_login (last_login)
);
# --------------------------------------------------------
#
@@ -493,8 +478,6 @@ CREATE TABLE phpbb_users (
user_new_privmsg smallint(5) UNSIGNED DEFAULT '0' NOT NULL,
user_unread_privmsg smallint(5) UNSIGNED DEFAULT '0' NOT NULL,
user_last_privmsg int(11) DEFAULT '0' NOT NULL,
user_login_tries smallint(5) UNSIGNED DEFAULT '0' NOT NULL,
user_last_login_try int(11) DEFAULT '0' NOT NULL,
user_emailtime int(11),
user_viewemail tinyint(1),
user_attachsig tinyint(1),

View File

@@ -24,9 +24,7 @@ INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_theme_create
INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_avatar_local','0');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_avatar_remote','0');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_avatar_upload','0');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('enable_confirm', '1');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_autologin','1');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('max_autologin_time','0');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('enable_confirm', '0');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('override_user_style','0');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('posts_per_page','15');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('topics_per_page','50');
@@ -45,10 +43,6 @@ INSERT INTO phpbb_config (config_name, config_value) VALUES ('smtp_password','')
INSERT INTO phpbb_config (config_name, config_value) VALUES ('sendmail_fix','0');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('require_activation','0');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('flood_interval','15');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('search_flood_interval','15');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('search_min_chars','3');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('max_login_attempts', '5');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('login_reset_time', '30');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('board_email_form','0');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('avatar_filesize','6144');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('avatar_max_width','80');
@@ -69,18 +63,17 @@ 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.22');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('rand_seed', '0');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('version', '.0.10');
-- Categories
INSERT INTO phpbb_categories (cat_id, cat_title, cat_order) VALUES (1, 'Test category 1', 10);
-- Forums
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, 1, 1, 1, 1, 3, 3, 1, 1, 3);
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, 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_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);
-- 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

@@ -248,7 +248,6 @@ CREATE TABLE phpbb_ranks (
CREATE TABLE phpbb_search_results (
search_id int4 NOT NULL default '0',
session_id char(32) NOT NULL default '',
search_time int4 DEFAULT '0' NOT NULL,
search_array text NOT NULL,
CONSTRAINT phpbb_search_results_pkey PRIMARY KEY (search_id)
);
@@ -290,23 +289,11 @@ 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);
CREATE INDEX session_id_ip_user_id_phpbb_sessions_index ON phpbb_sessions (session_id, session_ip, session_user_id);
/* --------------------------------------------------------
Table structure for table phpbb_sessions_keys
-------------------------------------------------------- */
CREATE TABLE phpbb_sessions_keys (
key_id char(32) DEFAULT '0' NOT NULL,
user_id int4 DEFAULT '0' NOT NULL,
last_ip char(8) DEFAULT '0' NOT NULL,
last_login int4 DEFAULT '0' NOT NULL,
CONSTRAINT phpbb_sessions_keys_pkey PRIMARY KEY (key_id, user_id)
);
CREATE INDEX last_login_phpbb_sessions_keys_index ON phpbb_sessions_keys (last_login);
/* --------------------------------------------------------
Table structure for table phpbb_smilies
@@ -489,8 +476,6 @@ CREATE TABLE phpbb_users (
user_new_privmsg int2 DEFAULT '0' NOT NULL,
user_unread_privmsg int2 DEFAULT '0' NOT NULL,
user_last_privmsg int4 DEFAULT '0' NOT NULL,
user_login_tries int2 DEFAULT '0' NOT NULL,
user_last_login_try int4 DEFAULT '0' NOT NULL,
user_emailtime int4,
user_viewemail int2,
user_attachsig int2,
@@ -503,10 +488,10 @@ CREATE TABLE phpbb_users (
user_rank int4 DEFAULT '0',
user_avatar varchar(100),
user_avatar_type int2 DEFAULT '0' NOT NULL,
user_level int4 DEFAULT '0',
user_level int4 DEFAULT '1',
user_lang varchar(255),
user_timezone decimal(5,2) DEFAULT '0.0' NOT NULL,
user_dateformat varchar(14) DEFAULT 'd M Y H:i' NOT NULL,
user_timezone decimal(5) DEFAULT '0' NOT NULL,
user_dateformat varchar(14) DEFAULT 'd M Y H:m' NOT NULL,
user_notify_pm int2 DEFAULT '0' NOT NULL,
user_popup_pm int2 DEFAULT '0' NOT NULL,
user_notify int2,

View File

@@ -0,0 +1,665 @@
<?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

@@ -0,0 +1,668 @@
<?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

@@ -0,0 +1,893 @@
<?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

@@ -0,0 +1,942 @@
<?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

@@ -59,7 +59,7 @@ include($phpbb_root_path . 'includes/db.'.$phpEx);
//
//
//
$updates_to_version = '.0.22';
$updates_to_version = ".0.6";
//
//
//
@@ -420,8 +420,6 @@ switch ($row['config_value'])
}
case '.0.2':
case '.0.3':
switch (SQL_LAYER)
@@ -465,7 +463,7 @@ switch ($row['config_value'])
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 {$table_prefix}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 {$table_prefix}groups_pkey PRIMARY KEY (group_id))";
$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;
@@ -511,165 +509,10 @@ switch ($row['config_value'])
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 {$table_prefix}confirm_pkey PRIMARY KEY (session_id, confirm_id))';
$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;
}
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;
}
case '.0.15':
case '.0.16':
case '.0.17':
// Add tables for session keys
switch (SQL_LAYER)
{
case 'mysql':
case 'mysql4':
$sql[] = 'CREATE TABLE ' . $table_prefix . 'sessions_keys (key_id varchar(32) DEFAULT \'0\' NOT NULL, user_id mediumint(8) DEFAULT \'0\' NOT NULL, last_ip varchar(8) DEFAULT \'0\' NOT NULL, last_login int(11) DEFAULT \'0\' NOT NULL, PRIMARY KEY (key_id, user_id), KEY last_login (last_login))';
break;
case 'mssql':
case 'mssql-odbc':
$sql[] = 'CREATE TABLE [' . $table_prefix . 'sessions_keys] ([key_id] [char] (32) NOT NULL , [user_id] [int] NOT NULL , [last_ip] [char] (8) NOT NULL , [last_login] [int] NOT NULL) ON [PRIMARY]';
$sql[] = 'CREATE INDEX [IX_' . $table_prefix . 'sessions_keys] ON [' . $table_prefix . 'sessions_keys]([key_id], [user_id]) ON [PRIMARY]';
$sql[] = 'CREATE INDEX [IX_' . $table_prefix . 'sessions_keys_1] ON [' . $table_prefix . 'sessions_keys]([last_login]) ON [PRIMARY]';
break;
case 'msaccess':
$sql[] = 'CREATE TABLE ' . $table_prefix . 'sessions_keys (key_id char(32) NOT NULL, user_id int NOT NULL, last_ip char(8) NOT NULL, last_login int NOT NULL)';
$sql[] = 'ALTER TABLE ' . $table_prefix . 'sessions_keys ADD PRIMARY KEY (key_id, user_id)';
break;
case 'postgresql':
$sql[] = 'CREATE TABLE ' . $table_prefix . 'sessions_keys (key_id char(32) DEFAULT \'0\' NOT NULL, user_id int4 DEFAULT \'0\' NOT NULL, last_ip char(8) DEFAULT \'0\' NOT NULL, last_login int4 DEFAULT \'0\' NOT NULL, CONSTRAINT ' . $table_prefix . 'sessions_keys_pkey PRIMARY KEY (key_id, user_id))';
$sql[] = 'CREATE INDEX last_login_' . $table_prefix . 'sessions_keys_index ON ' . $table_prefix . 'sessions_keys (last_login)';
break;
}
case '.0.18':
// Add login columns to user table
switch (SQL_LAYER)
{
case 'mysql':
case 'mysql4':
$sql[] = "ALTER TABLE " . USERS_TABLE . "
ADD COLUMN user_login_tries smallint(5) UNSIGNED DEFAULT '0' NOT NULL";
$sql[] = "ALTER TABLE " . USERS_TABLE . "
ADD COLUMN user_last_login_try int(11) DEFAULT '0' NOT NULL";
break;
case 'postgresql':
$sql[] = "ALTER TABLE " . USERS_TABLE . "
ADD COLUMN user_login_tries int2";
$sql[] = "ALTER TABLE " . USERS_TABLE . "
ALTER COLUMN user_login_tries SET DEFAULT '0'";
$sql[] = "ALTER TABLE " . USERS_TABLE . "
ADD COLUMN user_last_login_try int4";
$sql[] = "ALTER TABLE " . USERS_TABLE . "
ALTER COLUMN user_last_login_try SET DEFAULT '0'";
break;
case 'mssql-odbc':
case 'mssql':
$sql[] = "ALTER TABLE " . USERS_TABLE . " ADD
user_login_tries smallint NOT NULL,
CONSTRAINT [DF_" . $table_prefix . "users_user_login_tries] DEFAULT (0) FOR [user_login_tries]";
$sql[] = "ALTER TABLE " . USERS_TABLE . " ADD
user_last_login_try int NOT NULL,
CONSTRAINT [DF_" . $table_prefix . "users_user_last_login_try] DEFAULT (0) FOR [user_last_login_try]";
break;
case 'msaccess':
$sql[] = "ALTER TABLE " . USERS_TABLE . " ADD
user_login_tries smallint NOT NULL";
$sql[] = "ALTER TABLE " . USERS_TABLE . " ADD
user_last_login_try int NOT NULL";
break;
}
case '.0.19':
// Add search time to the search table
switch (SQL_LAYER)
{
case 'mysql':
case 'mysql4':
$sql[] = "ALTER TABLE " . SEARCH_TABLE . "
ADD COLUMN search_time int(11) DEFAULT '0' NOT NULL";
break;
case 'postgresql':
$sql[] = "ALTER TABLE " . SEARCH_TABLE . "
ADD COLUMN search_time int4";
$sql[] = "ALTER TABLE " . SEARCH_TABLE . "
ALTER COLUMN search_time SET DEFAULT '0'";
break;
case 'mssql-odbc':
case 'mssql':
$sql[] = "ALTER TABLE " . SEARCH_TABLE . " ADD
search_time int NOT NULL,
CONSTRAINT [DF_" . $table_prefix . "search_results_search_time] DEFAULT (0) FOR [search_time]";
break;
case 'msaccess':
$sql[] = "ALTER TABLE " . SEARCH_TABLE . " ADD
search_time int NOT NULL";
break;
}
break;
case '.0.21':
// MySQL only change
switch (SQL_LAYER)
{
case 'mysql':
case 'mysql4':
$sql[] = 'ALTER TABLE ' . SEARCH_TABLE . '
MODIFY COLUMN search_array MEDIUMTEXT NOT NULL';
}
break;
}
@@ -873,7 +716,7 @@ switch ($row['config_value'])
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\.\-_\+\'-\\\]+?)[ \n\r]*?(,|$)#', '\'\1\'\2', str_replace("'", "\'", implode(', ', file($phpbb_root_path . $dirname . "/" . $file . '/search_stopwords.txt')))));
$stopword_list = trim(preg_replace('#([\w\.\-_\+\'±µ-ÿ\\\]+?)[ \n\r]*?(,|$)#', '\'\1\'\2', str_replace("'", "\'", implode(', ', file($phpbb_root_path . $dirname . "/" . $file . '/search_stopwords.txt')))));
$sql = "SELECT word_id
FROM " . SEARCH_WORD_TABLE . "
@@ -1057,72 +900,10 @@ 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);
case '.0.15':
case '.0.16':
case '.0.17':
$sql = 'UPDATE ' . USERS_TABLE . ' SET user_active = 0 WHERE user_id = ' . ANONYMOUS;
_sql($sql, $errored, $error_ary);
$sql = 'INSERT INTO ' . CONFIG_TABLE . " (config_name, config_value)
VALUES ('allow_autologin', '1')";
_sql($sql, $errored, $error_ary);
$sql = 'INSERT INTO ' . CONFIG_TABLE . " (config_name, config_value)
VALUES ('max_autologin_time', '0')";
_sql($sql, $errored, $error_ary);
case '.0.18':
$sql = 'INSERT INTO ' . CONFIG_TABLE . " (config_name, config_value)
VALUES ('max_login_attempts', '5')";
_sql($sql, $errored, $error_ary);
$sql = 'INSERT INTO ' . CONFIG_TABLE . " (config_name, config_value)
VALUES ('login_reset_time', '30')";
_sql($sql, $errored, $error_ary);
case '.0.19':
$sql = 'INSERT INTO ' . CONFIG_TABLE . " (config_name, config_value)
VALUES ('search_flood_interval', '15')";
_sql($sql, $errored, $error_ary);
$sql = 'INSERT INTO ' . CONFIG_TABLE . " (config_name, config_value)
VALUES ('rand_seed', '0')";
_sql($sql, $errored, $error_ary);
case '.0.20':
$sql = 'INSERT INTO ' . CONFIG_TABLE . " (config_name, config_value)
VALUES ('search_min_chars', '3')";
_sql($sql, $errored, $error_ary);
// We reset those having autologin enabled and forcing the re-assignment of a session id
// since there have been changes to the way these are handled from previous versions
$sql = 'DELETE FROM ' . SESSIONS_TABLE;
_sql($sql, $errored, $error_ary);
$sql = 'DELETE FROM ' . SESSIONS_KEYS_TABLE;
_sql($sql, $errored, $error_ary);
break;
default:
echo " No updates were required</b></p>\n";
echo " No updates where required</b></p>\n";
break;
}
@@ -1143,7 +924,7 @@ 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 . 'sessions_keys, ' . $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 = '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;
@@ -1172,7 +953,6 @@ 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

@@ -0,0 +1,963 @@
<?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

@@ -0,0 +1,963 @@
<?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

@@ -0,0 +1,963 @@
<?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.9";
//
//
//
?>
<!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

@@ -0,0 +1,963 @@
<?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.10";
//
//
//
?>
<!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

@@ -3,7 +3,7 @@ Charset: iso-8859-1
Dear {GROUP_MODERATOR},
A user has requested to join a group you moderate on {SITENAME}.
A user has requested to join a group you moderator on {SITENAME}.
To approve or deny this request for group membership please visit the following link:
{U_GROUPCP}

View File

@@ -1,7 +1,7 @@
Subject: Topic Reply Notification - {TOPIC_TITLE}
Charset: iso-8859-1
Hello,
Hello {USERNAME},
You are receiving this email because you are watching the topic, "{TOPIC_TITLE}" at {SITENAME}. This topic has received a reply since your last visit. You can use the following link to view the replies made, no more notifications will be sent until you visit the topic.

View File

@@ -9,7 +9,7 @@ To use the new password you need to activate it. To do this click the link provi
{U_ACTIVATE}
If successful you will be able to login using the following password:
If sucessful you will be able to login using the following password:
Password: {PASSWORD}

View File

@@ -335,16 +335,6 @@ $lang['Session_length'] = 'Session length [ seconds ]';
$lang['Visual_confirm'] = 'Enable Visual Confirmation';
$lang['Visual_confirm_explain'] = 'Requires users enter a code defined by an image when registering.';
// Autologin Keys - added 2.0.18
$lang['Allow_autologin'] = 'Allow automatic logins';
$lang['Allow_autologin_explain'] = 'Determines whether users are allowed to select to be automatically logged in when visiting the forum';
$lang['Autologin_time'] = 'Automatic login key expiry';
$lang['Autologin_time_explain'] = 'How long a autologin key is valid for in days if the user does not visit the board. Set to zero to disable expiry.';
// Search Flood Control - added 2.0.20
$lang['Search_Flood_Interval'] = 'Search Flood Interval';
$lang['Search_Flood_Interval_explain'] = 'Number of seconds a user must wait between search requests';
//
// Forum Management
//
@@ -429,7 +419,6 @@ $lang['smiley_import_success'] = 'The Smiley Pack was imported successfully!';
$lang['smiley_del_success'] = 'The Smiley was successfully removed';
$lang['Click_return_smileadmin'] = 'Click %sHere%s to return to Smiley Administration';
$lang['Confirm_delete_smiley'] = 'Are you sure you want to delete this Smiley?';
//
// User Management
@@ -523,8 +512,6 @@ $lang['Word_removed'] = 'The selected word censor has been successfully removed'
$lang['Click_return_wordadmin'] = 'Click %sHere%s to return to Word Censor Administration';
$lang['Confirm_delete_word'] = 'Are you sure you want to delete this word censor?';
//
// Mass Email
@@ -564,7 +551,6 @@ $lang['No_update_ranks'] = 'The rank was successfully deleted. However, user acc
$lang['Click_return_rankadmin'] = 'Click %sHere%s to return to Rank Administration';
$lang['Confirm_delete_rank'] = 'Are you sure you want to delete this rank?';
//
// Disallow Username Admin
@@ -635,7 +621,6 @@ $lang['Value'] = 'Value';
$lang['Save_Settings'] = 'Save Settings';
$lang['Stylesheet'] = 'CSS Stylesheet';
$lang['Stylesheet_explain'] = 'Filename for CSS stylesheet to use for this theme.';
$lang['Background_image'] = 'Background Image';
$lang['Background_color'] = 'Background Colour';
$lang['Theme_name'] = 'Theme Name';
@@ -739,26 +724,6 @@ $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';
//
// Login attempts configuration
//
$lang['Max_login_attempts'] = 'Allowed login attempts';
$lang['Max_login_attempts_explain'] = 'The number of allowed board login attempts.';
$lang['Login_reset_time'] = 'Login lock time';
$lang['Login_reset_time_explain'] = 'Time in minutes the user have to wait until he is allowed to login again after exceeding the number of allowed login attempts.';
//
// That's all Folks!
// -------------------------------------------------

View File

@@ -274,6 +274,7 @@ $lang['Oldest_First'] = 'Oldest First';
$lang['Back_to_top'] = 'Back to top';
$lang['Read_profile'] = 'View user\'s profile';
$lang['Send_email'] = 'Send e-mail to user';
$lang['Visit_website'] = 'Visit poster\'s website';
$lang['ICQ_status'] = 'ICQ Status';
$lang['Edit_delete_post'] = 'Edit/Delete this post';
@@ -366,6 +367,7 @@ $lang['Smilies_are_OFF'] = 'Smilies are <u>OFF</u>';
$lang['Attach_signature'] = 'Attach signature (signatures can be changed in profile)';
$lang['Notify'] = 'Notify me when a reply is posted';
$lang['Delete_post'] = 'Delete this post';
$lang['Stored'] = 'Your message has been entered successfully.';
$lang['Deleted'] = 'Your message has been deleted successfully.';
@@ -525,8 +527,10 @@ $lang['Website'] = 'Website';
$lang['Location'] = 'Location';
$lang['Contact'] = 'Contact';
$lang['Email_address'] = 'E-mail address';
$lang['Email'] = 'E-mail';
$lang['Send_private_message'] = 'Send private message';
$lang['Hidden_email'] = '[ Hidden ]';
$lang['Search_user_posts'] = 'Search for posts by this user';
$lang['Interests'] = 'Interests';
$lang['Occupation'] = 'Occupation';
$lang['Poster_rank'] = 'Poster rank';
@@ -600,6 +604,7 @@ $lang['Profile_updated_inactive'] = 'Your profile has been updated. However, you
$lang['Password_mismatch'] = 'The passwords you entered did not match.';
$lang['Current_password_mismatch'] = 'The current password you supplied does not match that stored in the database.';
$lang['Password_long'] = 'Your password must be no more than 32 characters.';
$lang['Too_many_registers'] = 'You have made too many registration attempts. Please try again later.';
$lang['Username_taken'] = 'Sorry, but this username has already been taken.';
$lang['Username_invalid'] = 'Sorry, but this username contains an invalid character such as \'.';
$lang['Username_disallowed'] = 'Sorry, but this username has been disallowed.';
@@ -784,7 +789,6 @@ $lang['No_searchable_forums'] = 'You do not have permissions to search any forum
$lang['No_search_match'] = 'No topics or posts met your search criteria';
$lang['Found_search_match'] = 'Search found %d match'; // eg. Search found 1 match
$lang['Found_search_matches'] = 'Search found %d matches'; // eg. Search found 24 matches
$lang['Search_Flood_Error'] = 'You cannot make another search so soon after your last; please try again in a short while.';
$lang['Close_window'] = 'Close Window';
@@ -1014,12 +1018,6 @@ $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.';
$lang['Login_attempts_exceeded'] = 'The maximum number of %s login attempts has been exceeded. You are not allowed to login for the next %s minutes.';
$lang['Please_remove_install_contrib'] = 'Please ensure both the install/ and contrib/ directories are deleted';
$lang['Session_invalid'] = 'Invalid Session. Please resubmit the form.';
//
// That's all, Folks!
// -------------------------------------------------

View File

@@ -52,12 +52,14 @@ 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'] || isset($HTTP_POST_VARS['admin'])) )
if( ( isset($HTTP_POST_VARS['login']) || isset($HTTP_GET_VARS['login']) ) && !$userdata['session_logged_in'] )
{
$username = isset($HTTP_POST_VARS['username']) ? phpbb_clean_username($HTTP_POST_VARS['username']) : '';
$username = isset($HTTP_POST_VARS['username']) ? trim(htmlspecialchars($HTTP_POST_VARS['username'])) : '';
$username = substr(str_replace("\\'", "'", $username), 0, 25);
$username = str_replace("'", "\\'", $username);
$password = isset($HTTP_POST_VARS['password']) ? $HTTP_POST_VARS['password'] : '';
$sql = "SELECT user_id, username, user_password, user_active, user_level, user_login_tries, user_last_login_try
$sql = "SELECT user_id, username, user_password, user_active, user_level
FROM " . USERS_TABLE . "
WHERE username = '" . str_replace("\\'", "''", $username) . "'";
if ( !($result = $db->sql_query($sql)) )
@@ -73,29 +75,11 @@ if( isset($HTTP_POST_VARS['login']) || isset($HTTP_GET_VARS['login']) || isset($
}
else
{
// If the last login is more than x minutes ago, then reset the login tries/time
if ($row['user_last_login_try'] && $board_config['login_reset_time'] && $row['user_last_login_try'] < (time() - ($board_config['login_reset_time'] * 60)))
{
$db->sql_query('UPDATE ' . USERS_TABLE . ' SET user_login_tries = 0, user_last_login_try = 0 WHERE user_id = ' . $row['user_id']);
$row['user_last_login_try'] = $row['user_login_tries'] = 0;
}
// Check to see if user is allowed to login again... if his tries are exceeded
if ($row['user_last_login_try'] && $board_config['login_reset_time'] && $board_config['max_login_attempts'] &&
$row['user_last_login_try'] >= (time() - ($board_config['login_reset_time'] * 60)) && $row['user_login_tries'] >= $board_config['max_login_attempts'] && $userdata['user_level'] != ADMIN)
{
message_die(GENERAL_MESSAGE, sprintf($lang['Login_attempts_exceeded'], $board_config['max_login_attempts'], $board_config['login_reset_time']));
}
if( md5($password) == $row['user_password'] && $row['user_active'] )
{
$autologin = ( isset($HTTP_POST_VARS['autologin']) ) ? TRUE : 0;
$admin = (isset($HTTP_POST_VARS['admin'])) ? 1 : 0;
$session_id = session_begin($row['user_id'], $user_ip, PAGE_INDEX, FALSE, $autologin, $admin);
// Reset login tries
$db->sql_query('UPDATE ' . USERS_TABLE . ' SET user_login_tries = 0, user_last_login_try = 0 WHERE user_id = ' . $row['user_id']);
$session_id = session_begin($row['user_id'], $user_ip, PAGE_INDEX, FALSE, $autologin);
if( $session_id )
{
@@ -107,34 +91,24 @@ if( isset($HTTP_POST_VARS['login']) || isset($HTTP_GET_VARS['login']) || isset($
message_die(CRITICAL_ERROR, "Couldn't start session : login", "", __LINE__, __FILE__);
}
}
// Only store a failed login attempt for an active user - inactive users can't login even with a correct password
elseif( $row['user_active'] )
else
{
// Save login tries and last login
if ($row['user_id'] != ANONYMOUS)
$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"))
{
$sql = 'UPDATE ' . USERS_TABLE . '
SET user_login_tries = user_login_tries + 1, user_last_login_try = ' . time() . '
WHERE user_id = ' . $row['user_id'];
$db->sql_query($sql);
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\">")
);
$message = $lang['Error_login'] . '<br /><br />' . sprintf($lang['Click_return_login'], "<a href=\"login.$phpEx?redirect=$redirect\">", '</a>') . '<br /><br />' . sprintf($lang['Click_return_index'], '<a href="' . append_sid("index.$phpEx") . '">', '</a>');
message_die(GENERAL_MESSAGE, $message);
}
$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") || strstr(urldecode($redirect), ';url'))
{
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\">")
);
$message = $lang['Error_login'] . '<br /><br />' . sprintf($lang['Click_return_login'], "<a href=\"login.$phpEx?redirect=$redirect\">", '</a>') . '<br /><br />' . sprintf($lang['Click_return_index'], '<a href="' . append_sid("index.$phpEx") . '">', '</a>');
message_die(GENERAL_MESSAGE, $message);
}
}
else
@@ -142,7 +116,7 @@ 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") || strstr(urldecode($redirect), ';url'))
if (strstr(urldecode($redirect), "\n") || strstr(urldecode($redirect), "\r"))
{
message_die(GENERAL_ERROR, 'Tried to redirect to potentially insecure url.');
}
@@ -158,12 +132,6 @@ if( isset($HTTP_POST_VARS['login']) || isset($HTTP_GET_VARS['login']) || isset($
}
else if( ( isset($HTTP_GET_VARS['logout']) || isset($HTTP_POST_VARS['logout']) ) && $userdata['session_logged_in'] )
{
// session id check
if ($sid == '' || $sid != $userdata['session_id'])
{
message_die(GENERAL_ERROR, 'Invalid_session');
}
if( $userdata['session_logged_in'] )
{
session_end($userdata['session_id'], $userdata['user_id']);
@@ -192,7 +160,7 @@ else
// Do a full login page dohickey if
// user not already logged in
//
if( !$userdata['session_logged_in'] || (isset($HTTP_GET_VARS['admin']) && $userdata['session_logged_in'] && $userdata['user_level'] == ADMIN))
if( !$userdata['session_logged_in'] )
{
$page_title = $lang['Login'];
include($phpbb_root_path . 'includes/page_header.'.$phpEx);
@@ -201,8 +169,6 @@ else
'body' => 'login_body.tpl')
);
$forward_page = '';
if( isset($HTTP_POST_VARS['redirect']) || isset($HTTP_GET_VARS['redirect']) )
{
$forward_to = $HTTP_SERVER_VARS['QUERY_STRING'];
@@ -214,6 +180,8 @@ else
if(count($forward_match) > 1)
{
$forward_page = '';
for($i = 1; $i < count($forward_match); $i++)
{
if( !ereg("sid=", $forward_match[$i]) )
@@ -233,17 +201,20 @@ else
}
}
}
else
{
$forward_page = '';
}
$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);
make_jumpbox('viewforum.'.$phpEx, $forum_id);
$template->assign_vars(array(
'USERNAME' => $username,
'L_ENTER_PASSWORD' => (isset($HTTP_GET_VARS['admin'])) ? $lang['Admin_reauthenticate'] : $lang['Enter_password'],
'L_ENTER_PASSWORD' => $lang['Enter_password'],
'L_SEND_PASSWORD' => $lang['Forgotten_password'],
'U_SEND_PASSWORD' => append_sid("profile.$phpEx?mode=sendpassword"),

View File

@@ -34,7 +34,6 @@ init_userprefs($userdata);
//
$start = ( isset($HTTP_GET_VARS['start']) ) ? intval($HTTP_GET_VARS['start']) : 0;
$start = ($start < 0) ? 0 : $start;
if ( isset($HTTP_GET_VARS['mode']) || isset($HTTP_POST_VARS['mode']) )
{
@@ -62,7 +61,7 @@ else
// Memberlist sorting
//
$mode_types_text = array($lang['Sort_Joined'], $lang['Sort_Username'], $lang['Sort_Location'], $lang['Sort_Posts'], $lang['Sort_Email'], $lang['Sort_Website'], $lang['Sort_Top_Ten']);
$mode_types = array('joined', 'username', 'location', 'posts', 'email', 'website', 'topten');
$mode_types = array('joindate', 'username', 'location', 'posts', 'email', 'website', 'topten');
$select_sort_mode = '<select name="mode">';
for($i = 0; $i < count($mode_types_text); $i++)
@@ -229,8 +228,8 @@ if ( $row = $db->sql_fetchrow($result) )
$yim = ( $row['user_yim'] ) ? '<a href="http://edit.yahoo.com/config/send_webmesg?.target=' . $row['user_yim'] . '&amp;.src=pg">' . $lang['YIM'] . '</a>' : '';
$temp_url = append_sid("search.$phpEx?search_author=" . urlencode($username) . "&amp;showresults=posts");
$search_img = '<a href="' . $temp_url . '"><img src="' . $images['icon_search'] . '" alt="' . sprintf($lang['Search_user_posts'], $username) . '" title="' . sprintf($lang['Search_user_posts'], $username) . '" border="0" /></a>';
$search = '<a href="' . $temp_url . '">' . sprintf($lang['Search_user_posts'], $username) . '</a>';
$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>';
$row_color = ( !($i % 2) ) ? $theme['td_color1'] : $theme['td_color2'];
$row_class = ( !($i % 2) ) ? $theme['td_class1'] : $theme['td_class2'];

View File

@@ -71,7 +71,6 @@ $confirm = ( $HTTP_POST_VARS['confirm'] ) ? TRUE : 0;
// Continue var definitions
//
$start = ( isset($HTTP_GET_VARS['start']) ) ? intval($HTTP_GET_VARS['start']) : 0;
$start = ($start < 0) ? 0 : $start;
$delete = ( isset($HTTP_POST_VARS['delete']) ) ? TRUE : FALSE;
$move = ( isset($HTTP_POST_VARS['move']) ) ? TRUE : FALSE;
@@ -132,11 +131,6 @@ 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'];
@@ -152,11 +146,6 @@ 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'];
}
@@ -223,7 +212,7 @@ switch( $mode )
case 'delete':
if (!$is_auth['auth_delete'])
{
message_die(GENERAL_MESSAGE, sprintf($lang['Sorry_auth_delete'], $is_auth['auth_delete_type']));
message_die(MESSAGE, sprintf($lang['Sorry_auth_delete'], $is_auth['auth_delete_type']));
}
$page_title = $lang['Mod_CP'];
@@ -231,11 +220,6 @@ switch( $mode )
if ( $confirm )
{
if ( empty($HTTP_POST_VARS['topic_id_list']) && empty($topic_id) )
{
message_die(GENERAL_MESSAGE, $lang['None_selected']);
}
include($phpbb_root_path . 'includes/functions_search.'.$phpEx);
$topics = ( isset($HTTP_POST_VARS['topic_id_list']) ) ? $HTTP_POST_VARS['topic_id_list'] : array($topic_id);
@@ -262,11 +246,6 @@ switch( $mode )
}
$db->sql_freeresult($result);
if ( $topic_id_sql == '')
{
message_die(GENERAL_MESSAGE, $lang['None_selected']);
}
$sql = "SELECT poster_id, COUNT(post_id) AS posts
FROM " . POSTS_TABLE . "
WHERE topic_id IN ($topic_id_sql)
@@ -474,20 +453,6 @@ 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);
@@ -748,11 +713,6 @@ switch( $mode )
}
$db->sql_freeresult($result);
if ($post_id_sql == '')
{
message_die(GENERAL_MESSAGE, $lang['None_selected']);
}
$sql = "SELECT post_id, poster_id, topic_id, post_time
FROM " . POSTS_TABLE . "
WHERE post_id IN ($post_id_sql)
@@ -786,20 +746,6 @@ 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)))
@@ -1003,7 +949,7 @@ switch( $mode )
}
$ip_this_post = decode_ip($post_row['poster_ip']);
$ip_this_post = ( $rdns_ip_num == $ip_this_post ) ? htmlspecialchars(gethostbyaddr($ip_this_post)) : $ip_this_post;
$ip_this_post = ( $rdns_ip_num == $ip_this_post ) ? gethostbyaddr($ip_this_post) : $ip_this_post;
$poster_id = $post_row['poster_id'];
@@ -1049,7 +995,7 @@ switch( $mode )
}
$ip = decode_ip($row['poster_ip']);
$ip = ( $rdns_ip_num == $row['poster_ip'] || $rdns_ip_num == 'all') ? htmlspecialchars(gethostbyaddr($ip)) : $ip;
$ip = ( $rdns_ip_num == $row['poster_ip'] || $rdns_ip_num == 'all') ? gethostbyaddr($ip) : $ip;
$row_color = ( !($i % 2) ) ? $theme['td_color1'] : $theme['td_color2'];
$row_class = ( !($i % 2) ) ? $theme['td_class1'] : $theme['td_class2'];
@@ -1101,7 +1047,7 @@ switch( $mode )
'L_SEARCH_POSTS' => sprintf($lang['Search_user_posts'], $username),
'U_PROFILE' => ($id == ANONYMOUS) ? "modcp.$phpEx?mode=ip&amp;" . POST_POST_URL . "=" . $post_id . "&amp;" . POST_TOPIC_URL . "=" . $topic_id . "&amp;sid=" . $userdata['session_id'] : append_sid("profile.$phpEx?mode=viewprofile&amp;" . POST_USERS_URL . "=$id"),
'U_SEARCHPOSTS' => append_sid("search.$phpEx?search_author=" . (($id == ANONYMOUS) ? 'Anonymous' : urlencode($username)) . "&amp;showresults=topics"))
'U_SEARCHPOSTS' => append_sid("search.$phpEx?search_author=" . urlencode($username) . "&amp;showresults=topics"))
);
$i++;

View File

@@ -44,7 +44,6 @@ while( list($var, $param) = @each($params) )
}
$confirm = isset($HTTP_POST_VARS['confirm']) ? true : false;
$sid = (isset($HTTP_POST_VARS['sid'])) ? $HTTP_POST_VARS['sid'] : 0;
$params = array('forum_id' => POST_FORUM_URL, 'topic_id' => POST_TOPIC_URL, 'post_id' => POST_POST_URL);
while( list($var, $param) = @each($params) )
@@ -60,13 +59,11 @@ while( list($var, $param) = @each($params) )
}
$refresh = $preview || $poll_add || $poll_edit || $poll_delete;
$orig_word = $replacement_word = array();
//
// Set topic type
//
$topic_type = ( !empty($HTTP_POST_VARS['topictype']) ) ? intval($HTTP_POST_VARS['topictype']) : POST_NORMAL;
$topic_type = ( in_array($topic_type, array(POST_NORMAL, POST_STICKY, POST_ANNOUNCE)) ) ? $topic_type : POST_NORMAL;
//
// If the mode is set to topic review then output
@@ -192,7 +189,7 @@ switch ( $mode )
message_die(GENERAL_MESSAGE, $lang['No_topic_id']);
}
$sql = "SELECT f.*, t.topic_status, t.topic_title, t.topic_type
$sql = "SELECT f.*, t.topic_status, t.topic_title
FROM " . FORUMS_TABLE . " f, " . TOPICS_TABLE . " t
WHERE t.topic_id = $topic_id
AND f.forum_id = t.forum_id";
@@ -207,7 +204,7 @@ switch ( $mode )
message_die(GENERAL_MESSAGE, $lang['No_post_id']);
}
$select_sql = (!$submit) ? ', t.topic_title, p.enable_bbcode, p.enable_html, p.enable_smilies, p.enable_sig, p.post_username, pt.post_subject, pt.post_text, pt.bbcode_uid, u.username, u.user_id, u.user_sig, u.user_sig_bbcode_uid' : '';
$select_sql = ( !$submit ) ? ", t.topic_title, p.enable_bbcode, p.enable_html, p.enable_smilies, p.enable_sig, p.post_username, pt.post_subject, pt.post_text, pt.bbcode_uid, u.username, u.user_id, u.user_sig" : '';
$from_sql = ( !$submit ) ? ", " . POSTS_TEXT_TABLE . " pt, " . USERS_TABLE . " u" : '';
$where_sql = ( !$submit ) ? "AND pt.post_id = p.post_id AND u.user_id = p.poster_id" : '';
@@ -223,8 +220,9 @@ switch ( $mode )
message_die(GENERAL_MESSAGE, $lang['No_valid_mode']);
}
if ( ($result = $db->sql_query($sql)) && ($post_info = $db->sql_fetchrow($result)) )
if ( $result = $db->sql_query($sql) )
{
$post_info = $db->sql_fetchrow($result);
$db->sql_freeresult($result);
$forum_id = $post_info['forum_id'];
@@ -314,20 +312,12 @@ if ( ($result = $db->sql_query($sql)) && ($post_info = $db->sql_fetchrow($result
{
$topic_id = $post_info['topic_id'];
}
if ( $mode == 'newtopic' )
{
$post_data['topic_type'] = POST_NORMAL;
}
$post_data['first_post'] = ( $mode == 'newtopic' ) ? true : 0;
$post_data['last_post'] = false;
$post_data['has_poll'] = false;
$post_data['edit_poll'] = false;
}
if ( $mode == 'poll_delete' && !isset($poll_id) )
{
message_die(GENERAL_MESSAGE, $lang['No_such_post']);
}
}
else
{
@@ -431,7 +421,6 @@ if ( ( $delete || $poll_delete || $mode == 'delete' ) && !$confirm )
//
$s_hidden_fields = '<input type="hidden" name="' . POST_POST_URL . '" value="' . $post_id . '" />';
$s_hidden_fields .= ( $delete || $mode == "delete" ) ? '<input type="hidden" name="mode" value="delete" />' : '<input type="hidden" name="mode" value="poll_delete" />';
$s_hidden_fields .= '<input type="hidden" name="sid" value="' . $userdata['session_id'] . '" />';
$l_confirm = ( $delete || $mode == 'delete' ) ? $lang['Confirm_delete'] : $lang['Confirm_delete_poll'];
@@ -543,12 +532,6 @@ else if ( $submit || $confirm )
$return_message = '';
$return_meta = '';
// session id check
if ($sid == '' || $sid != $userdata['session_id'])
{
$error_msg .= (!empty($error_msg)) ? '<br />' . $lang['Session_invalid'] : $lang['Session_invalid'];
}
switch ( $mode )
{
case 'editpost':
@@ -574,11 +557,6 @@ else if ( $submit || $confirm )
case 'delete':
case 'poll_delete':
if ($error_msg != '')
{
message_die(GENERAL_MESSAGE, $error_msg);
}
delete_post($mode, $post_data, $return_message, $return_meta, $forum_id, $topic_id, $post_id, $poll_id);
break;
}
@@ -639,7 +617,7 @@ if( $refresh || isset($HTTP_POST_VARS['del_poll_option']) || $error_msg != '' )
}
else if ( !empty($option_text) )
{
$poll_options[intval($option_id)] = htmlspecialchars(trim(stripslashes($option_text)));
$poll_options[$option_id] = htmlspecialchars(trim(stripslashes($option_text)));
}
}
}
@@ -656,7 +634,6 @@ if( $refresh || isset($HTTP_POST_VARS['del_poll_option']) || $error_msg != '' )
else if ( $mode == 'editpost' )
{
$user_sig = ( $post_info['user_sig'] != '' && $board_config['allow_sig'] ) ? $post_info['user_sig'] : '';
$userdata['user_sig_bbcode_uid'] = $post_info['user_sig_bbcode_uid'];
}
if( $preview )
@@ -941,7 +918,6 @@ if ( $mode == 'newtopic' || ( $mode == 'editpost' && $post_data['first_post'] )
}
$hidden_form_fields = '<input type="hidden" name="mode" value="' . $mode . '" />';
$hidden_form_fields .= '<input type="hidden" name="sid" value="' . $userdata['session_id'] . '" />';
switch( $mode )
{
@@ -1129,4 +1105,4 @@ $template->pparse('body');
include($phpbb_root_path . 'includes/page_tail.'.$phpEx);
?>
?>

View File

@@ -35,8 +35,8 @@ if ( !empty($board_config['privmsg_disable']) )
message_die(GENERAL_MESSAGE, 'PM_disabled');
}
$html_entities_match = array('#&(?!(\#[0-9]+;))#', '#<#', '#>#', '#"#');
$html_entities_replace = array('&amp;', '&lt;', '&gt;', '&quot;');
$html_entities_match = array('#&(?!(\#[0-9]+;))#', '#<#', '#>#');
$html_entities_replace = array('&amp;', '&lt;', '&gt;');
//
// Parameters
@@ -50,7 +50,6 @@ $confirm = ( isset($HTTP_POST_VARS['confirm']) ) ? TRUE : 0;
$delete = ( isset($HTTP_POST_VARS['delete']) ) ? TRUE : 0;
$delete_all = ( isset($HTTP_POST_VARS['deleteall']) ) ? TRUE : 0;
$save = ( isset($HTTP_POST_VARS['save']) ) ? TRUE : 0;
$sid = (isset($HTTP_POST_VARS['sid'])) ? $HTTP_POST_VARS['sid'] : 0;
$refresh = $preview || $submit_search;
@@ -102,7 +101,6 @@ else
}
$start = ( !empty($HTTP_GET_VARS['start']) ) ? intval($HTTP_GET_VARS['start']) : 0;
$start = ($start < 0) ? 0 : $start;
if ( isset($HTTP_POST_VARS[POST_POST_URL]) || isset($HTTP_GET_VARS[POST_POST_URL]) )
{
@@ -297,7 +295,7 @@ else if ( $mode == 'read' )
if ( $sent_info = $db->sql_fetchrow($result) )
{
if ($board_config['max_sentbox_privmsgs'] && $sent_info['sent_items'] >= $board_config['max_sentbox_privmsgs'])
if ( $sent_info['sent_items'] >= $board_config['max_sentbox_privmsgs'] )
{
$sql = "SELECT privmsgs_id FROM " . PRIVMSGS_TABLE . "
WHERE privmsgs_type = " . PRIVMSGS_SENT_MAIL . "
@@ -539,8 +537,8 @@ else if ( $mode == 'read' )
$yim = ( $privmsg['user_yim'] ) ? '<a href="http://edit.yahoo.com/config/send_webmesg?.target=' . $privmsg['user_yim'] . '&amp;.src=pg">' . $lang['YIM'] . '</a>' : '';
$temp_url = append_sid("search.$phpEx?search_author=" . urlencode($username_from) . "&amp;showresults=posts");
$search_img = '<a href="' . $temp_url . '"><img src="' . $images['icon_search'] . '" alt="' . sprintf($lang['Search_user_posts'], $username_from) . '" title="' . sprintf($lang['Search_user_posts'], $username_from) . '" border="0" /></a>';
$search = '<a href="' . $temp_url . '">' . sprintf($lang['Search_user_posts'], $username_from) . '</a>';
$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>';
//
// Processing of post
@@ -565,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'] || !$userdata['user_allowhtml'])
if ( !$board_config['allow_html'] )
{
if ( $user_sig != '')
if ( $user_sig != '' && $privmsg['privmsgs_enable_sig'] && $userdata['user_allowhtml'] )
{
$user_sig = preg_replace('#(<)([\/]?.*?)(>)#is', "&lt;\\2&gt;", $user_sig);
}
@@ -700,57 +698,47 @@ else if ( ( $delete && $mark_list ) || $delete_all )
}
else if ( $confirm )
{
$delete_sql_id = '';
if (!$delete_all)
if ( $delete_all )
{
for ($i = 0; $i < count($mark_list); $i++)
switch($folder)
{
$delete_sql_id .= (($delete_sql_id != '') ? ', ' : '') . intval($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 = "AND privmsgs_id IN ($delete_sql_id)";
$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);
}
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 = '';
@@ -913,7 +901,7 @@ else if ( $save && $mark_list && $folder != 'savebox' && $folder != 'outbox' )
if ( $saved_info = $db->sql_fetchrow($result) )
{
if ($board_config['max_savebox_privmsgs'] && $saved_info['savebox_items'] >= $board_config['max_savebox_privmsgs'] )
if ( $saved_info['savebox_items'] >= $board_config['max_savebox_privmsgs'] )
{
$sql = "SELECT privmsgs_id FROM " . PRIVMSGS_TABLE . "
WHERE ( ( privmsgs_to_userid = " . $userdata['user_id'] . "
@@ -1140,39 +1128,11 @@ else if ( $submit || $refresh || $mode != '' )
//
}
if ($submit && $mode == 'edit')
{
$sql = 'SELECT privmsgs_from_userid
FROM ' . PRIVMSGS_TABLE . '
WHERE privmsgs_id = ' . (int) $privmsg_id . '
AND privmsgs_from_userid = ' . $userdata['user_id'];
if (!($result = $db->sql_query($sql)))
{
message_die(GENERAL_ERROR, "Could not obtain message details", "", __LINE__, __FILE__, $sql);
}
if (!($row = $db->sql_fetchrow($result)))
{
message_die(GENERAL_MESSAGE, $lang['No_such_post']);
}
$db->sql_freeresult($result);
unset($row);
}
if ( $submit )
{
// session id check
if ($sid == '' || $sid != $userdata['session_id'])
{
$error = true;
$error_msg .= ( ( !empty($error_msg) ) ? '<br />' : '' ) . $lang['Session_invalid'];
}
if ( !empty($HTTP_POST_VARS['username']) )
{
$to_username = phpbb_clean_username($HTTP_POST_VARS['username']);
$to_username = $HTTP_POST_VARS['username'];
$sql = "SELECT user_id, user_notify_pm, user_email, user_lang, user_active
FROM " . USERS_TABLE . "
@@ -1184,11 +1144,7 @@ else if ( $submit || $refresh || $mode != '' )
$error_msg = $lang['No_such_user'];
}
if (!($to_userdata = $db->sql_fetchrow($result)))
{
$error = TRUE;
$error_msg = $lang['No_such_user'];
}
$to_userdata = $db->sql_fetchrow($result);
}
else
{
@@ -1196,7 +1152,7 @@ else if ( $submit || $refresh || $mode != '' )
$error_msg .= ( ( !empty($error_msg) ) ? '<br />' : '' ) . $lang['No_to_user'];
}
$privmsg_subject = trim(htmlspecialchars($HTTP_POST_VARS['subject']));
$privmsg_subject = trim(strip_tags($HTTP_POST_VARS['subject']));
if ( empty($privmsg_subject) )
{
$error = TRUE;
@@ -1256,7 +1212,7 @@ else if ( $submit || $refresh || $mode != '' )
if ( $inbox_info = $db->sql_fetchrow($result) )
{
if ($board_config['max_inbox_privmsgs'] && $inbox_info['inbox_items'] >= $board_config['max_inbox_privmsgs'])
if ( $inbox_info['inbox_items'] >= $board_config['max_inbox_privmsgs'] )
{
$sql = "SELECT privmsgs_id FROM " . PRIVMSGS_TABLE . "
WHERE ( privmsgs_type = " . PRIVMSGS_NEW_MAIL . "
@@ -1318,7 +1274,7 @@ else if ( $submit || $refresh || $mode != '' )
if ( !$db->sql_query($sql, END_TRANSACTION) )
{
message_die(GENERAL_ERROR, "Could not insert/update private message sent text.", "", __LINE__, __FILE__, $sql);
message_die(GENERAL_ERROR, "Could not insert/update private message sent text.", "", __LINE__, __FILE__, $sql_info);
}
if ( $mode != 'edit' )
@@ -1353,7 +1309,7 @@ else if ( $submit || $refresh || $mode != '' )
$emailer->set_subject($lang['Notification_subject']);
$emailer->assign_vars(array(
'USERNAME' => stripslashes($to_username),
'USERNAME' => $to_username,
'SITENAME' => $board_config['sitename'],
'EMAIL_SIG' => (!empty($board_config['board_email_sig'])) ? str_replace('<br />', "\n", "-- \n" . $board_config['board_email_sig']) : '',
@@ -1381,11 +1337,10 @@ 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(htmlspecialchars(stripslashes($HTTP_POST_VARS['username']))) : '';
$privmsg_subject = ( isset($HTTP_POST_VARS['subject']) ) ? trim(htmlspecialchars(stripslashes($HTTP_POST_VARS['subject']))) : '';
$to_username = ( isset($HTTP_POST_VARS['username']) ) ? trim(strip_tags(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);
$privmsg_message = preg_replace('#<textarea>#si', '&lt;textarea&gt;', $privmsg_message);
if ( !$preview )
{
$privmsg_message = stripslashes($privmsg_message);
@@ -1458,7 +1413,8 @@ else if ( $submit || $refresh || $mode != '' )
$to_username = $row['username'];
}
}
else if ( $mode == 'edit' )
if ( $mode == 'edit' )
{
$sql = "SELECT pm.*, pmt.privmsgs_bbcode_uid, pmt.privmsgs_text, u.username, u.user_id, u.user_sig
FROM " . PRIVMSGS_TABLE . " pm, " . PRIVMSGS_TEXT_TABLE . " pmt, " . USERS_TABLE . " u
@@ -1489,7 +1445,7 @@ else if ( $submit || $refresh || $mode != '' )
}
$privmsg_message = str_replace('<br />', "\n", $privmsg_message);
// $privmsg_message = preg_replace('#</textarea>#si', '&lt;/textarea&gt;', $privmsg_message);
$privmsg_message = preg_replace('#</textarea>#si', '&lt;/textarea&gt;', $privmsg_message);
$user_sig = ( $board_config['allow_sig'] ) ? (($privmsg['privmsgs_type'] == PRIVMSGS_NEW_MAIL) ? $user_sig : $privmsg['user_sig']) : '';
@@ -1516,11 +1472,7 @@ else if ( $submit || $refresh || $mode != '' )
redirect(append_sid("privmsg.$phpEx?folder=$folder", true));
}
$orig_word = $replacement_word = array();
obtain_word_list($orig_word, $replacement_word);
$privmsg_subject = ( ( !preg_match('/^Re:/', $privmsg['privmsgs_subject']) ) ? 'Re: ' : '' ) . $privmsg['privmsgs_subject'];
$privmsg_subject = preg_replace($orig_word, $replacement_word, $privmsg_subject);
$to_username = $privmsg['username'];
$to_userid = $privmsg['user_id'];
@@ -1532,8 +1484,7 @@ else if ( $submit || $refresh || $mode != '' )
$privmsg_message = preg_replace("/\:(([a-z0-9]:)?)$privmsg_bbcode_uid/si", '', $privmsg_message);
$privmsg_message = str_replace('<br />', "\n", $privmsg_message);
// $privmsg_message = preg_replace('#</textarea>#si', '&lt;/textarea&gt;', $privmsg_message);
$privmsg_message = preg_replace($orig_word, $replacement_word, $privmsg_message);
$privmsg_message = preg_replace('#</textarea>#si', '&lt;/textarea&gt;', $privmsg_message);
$msg_date = create_date($board_config['default_dateformat'], $privmsg['privmsgs_date'], $board_config['board_timezone']);
@@ -1542,10 +1493,6 @@ else if ( $submit || $refresh || $mode != '' )
$mode = 'reply';
}
}
else
{
$privmsg_subject = $privmsg_message = $to_username = '';
}
}
//
@@ -1580,9 +1527,9 @@ else if ( $submit || $refresh || $mode != '' )
//
// Finalise processing as per viewtopic
//
if ( !$html_on || !$board_config['allow_html'] || !$userdata['user_allowhtml'] )
if ( !$html_on )
{
if ( $user_sig != '' )
if ( $user_sig != '' || !$userdata['user_allowhtml'] )
{
$user_sig = preg_replace('#(<)([\/]?.*?)(>)#is', "&lt;\\2&gt;", $user_sig);
}
@@ -1659,7 +1606,6 @@ else if ( $submit || $refresh || $mode != '' )
//
if ($error)
{
$privmsg_message = htmlspecialchars($privmsg_message);
$template->set_filenames(array(
'reg_header' => 'error_body.tpl')
);
@@ -1746,7 +1692,6 @@ else if ( $submit || $refresh || $mode != '' )
$s_hidden_fields = '<input type="hidden" name="folder" value="' . $folder . '" />';
$s_hidden_fields .= '<input type="hidden" name="mode" value="' . $mode . '" />';
$s_hidden_fields .= '<input type="hidden" name="sid" value="' . $userdata['session_id'] . '" />';
if ( $mode == 'edit' )
{
$s_hidden_fields .= '<input type="hidden" name="' . POST_POST_URL . '" value="' . $privmsg_id . '" />';
@@ -1757,9 +1702,12 @@ else if ( $submit || $refresh || $mode != '' )
//
generate_smilies('inline', PAGE_PRIVMSGS);
$privmsg_subject = preg_replace($html_entities_match, $html_entities_replace, $privmsg_subject);
$privmsg_subject = str_replace('"', '&quot;', $privmsg_subject);
$template->assign_vars(array(
'SUBJECT' => $privmsg_subject,
'USERNAME' => $to_username,
'USERNAME' => preg_replace($html_entities_match, $html_entities_replace, $to_username),
'MESSAGE' => $privmsg_message,
'HTML_STATUS' => $html_status,
'SMILIES_STATUS' => $smilies_status,
@@ -1836,6 +1784,7 @@ else if ( $submit || $refresh || $mode != '' )
'S_BBCODE_CHECKED' => ( !$bbcode_on ) ? ' checked="checked"' : '',
'S_SMILIES_CHECKED' => ( !$smilies_on ) ? ' checked="checked"' : '',
'S_SIGNATURE_CHECKED' => ( $attach_sig ) ? ' checked="checked"' : '',
'S_NAMES_SELECT' => $user_names_select,
'S_HIDDEN_FORM_FIELDS' => $s_hidden_fields,
'S_POST_ACTION' => append_sid("privmsg.$phpEx"),
@@ -2070,10 +2019,6 @@ if ( $folder != 'outbox' )
break;
}
}
else
{
$inbox_limit_img_length = $inbox_limit_pct = $l_box_size_status = '';
}
//
// Dump vars to template
@@ -2207,4 +2152,4 @@ $template->pparse('body');
include($phpbb_root_path . 'includes/page_tail.'.$phpEx);
?>
?>

View File

@@ -60,9 +60,18 @@ $server_url = $server_protocol . $server_name . $server_port . $script_name;
//
function gen_rand_string($hash)
{
$rand_str = dss_rand();
$chars = array( 'a', 'A', 'b', 'B', 'c', 'C', 'd', 'D', 'e', 'E', 'f', 'F', 'g', 'G', 'h', 'H', 'i', 'I', 'j', 'J', 'k', 'K', 'l', 'L', 'm', 'M', 'n', 'N', 'o', 'O', 'p', 'P', 'q', 'Q', 'r', 'R', 's', 'S', 't', 'T', 'u', 'U', 'v', 'V', 'w', 'W', 'x', 'X', 'y', 'Y', 'z', 'Z', '1', '2', '3', '4', '5', '6', '7', '8', '9', '0');
$max_chars = count($chars) - 1;
srand( (double) microtime()*1000000);
$rand_str = '';
for($i = 0; $i < 8; $i++)
{
$rand_str = ( $i == 0 ) ? $chars[rand(0, $max_chars)] : $rand_str . $chars[rand(0, $max_chars)];
}
return ( $hash ) ? md5($rand_str) : substr($rand_str, 0, 8);
return ( $hash ) ? md5($rand_str) : $rand_str;
}
//
// End page specific functions
@@ -91,17 +100,6 @@ 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,7 +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);
$search_author = htmlspecialchars($search_author);
}
else
{
@@ -118,7 +118,6 @@ else
}
$start = ( isset($HTTP_GET_VARS['start']) ) ? intval($HTTP_GET_VARS['start']) : 0;
$start = ($start < 0) ? 0 : $start;
$sort_by_types = array($lang['Sort_Time'], $lang['Sort_Post_Subject'], $lang['Sort_Topic_Title'], $lang['Sort_Author'], $lang['Sort_Forum']);
@@ -154,31 +153,12 @@ else if ( $search_keywords != '' || $search_author != '' || $search_id )
//
// Search ID Limiter, decrease this value if you experience further timeout problems with searching forums
$limiter = 5000;
$current_time = time();
//
// Cycle through options ...
//
if ( $search_id == 'newposts' || $search_id == 'egosearch' || $search_id == 'unanswered' || $search_keywords != '' || $search_author != '' )
{
//
// Flood control
//
$where_sql = ($userdata['user_id'] == ANONYMOUS) ? "se.session_ip = '$user_ip'" : 'se.session_user_id = ' . $userdata['user_id'];
$sql = 'SELECT MAX(sr.search_time) AS last_search_time
FROM ' . SEARCH_TABLE . ' sr, ' . SESSIONS_TABLE . " se
WHERE sr.session_id = se.session_id
AND $where_sql";
if ($result = $db->sql_query($sql))
{
if ($row = $db->sql_fetchrow($result))
{
if (intval($row['last_search_time']) > 0 && ($current_time - intval($row['last_search_time'])) < intval($board_config['search_flood_interval']))
{
message_die(GENERAL_MESSAGE, $lang['Search_Flood_Error']);
}
}
}
if ( $search_id == 'newposts' || $search_id == 'egosearch' || ( $search_author != '' && $search_keywords == '' ) )
{
if ( $search_id == 'newposts' )
@@ -218,12 +198,7 @@ else if ( $search_keywords != '' || $search_author != '' || $search_id )
else
{
$search_author = str_replace('*', '%', trim($search_author));
if( ( strpos($search_author, '%') !== false ) && ( strlen(str_replace('%', '', $search_author)) < $board_config['search_min_chars'] ) )
{
$search_author = '';
}
$sql = "SELECT user_id
FROM " . USERS_TABLE . "
WHERE username LIKE '" . str_replace("\'", "''", $search_author) . "'";
@@ -277,9 +252,7 @@ else if ( $search_keywords != '' || $search_author != '' || $search_id )
$synonym_array = @file($phpbb_root_path . 'language/lang_' . $board_config['default_lang'] . '/search_synonyms.txt');
$split_search = array();
$stripped_keywords = stripslashes($search_keywords);
$split_search = ( !strstr($multibyte_charset, $lang['ENCODING']) ) ? split_words(clean_words('search', $stripped_keywords, $stopword_array, $synonym_array), 'search') : split(' ', $search_keywords);
unset($stripped_keywords);
$split_search = ( !strstr($multibyte_charset, $lang['ENCODING']) ) ? split_words(clean_words('search', stripslashes($search_keywords), $stopword_array, $synonym_array), 'search') : split(' ', $search_keywords);
$search_msg_only = ( !$search_fields ) ? "AND m.title_match = 0" : ( ( strstr($multibyte_charset, $lang['ENCODING']) ) ? '' : '' );
@@ -291,12 +264,6 @@ else if ( $search_keywords != '' || $search_author != '' || $search_id )
for($i = 0; $i < count($split_search); $i++)
{
if ( strlen(str_replace(array('*', '%'), '', trim($split_search[$i]))) < $board_config['search_min_chars'] )
{
$split_search[$i] = '';
continue;
}
switch ( $split_search[$i] )
{
case 'and':
@@ -440,12 +407,7 @@ else if ( $search_keywords != '' || $search_author != '' || $search_id )
//
if ( $search_author != '' )
{
$search_author = str_replace('*', '%', trim($search_author));
if( ( strpos($search_author, '%') !== false ) && ( strlen(str_replace('%', '', $search_author)) < $board_config['search_min_chars'] ) )
{
$search_author = '';
}
$search_author = str_replace('*', '%', trim(str_replace("\'", "''", $search_author)));
}
if ( $total_match_count )
@@ -649,13 +611,28 @@ else if ( $search_keywords != '' || $search_author != '' || $search_id )
}
//
// Delete old data from the search result table
// Finish building query (for all combinations)
// and run it ...
//
$sql = 'DELETE FROM ' . SEARCH_TABLE . '
WHERE search_time < ' . ($current_time - (int) $board_config['session_length']);
if ( !$result = $db->sql_query($sql) )
$sql = "SELECT session_id
FROM " . SESSIONS_TABLE;
if ( $result = $db->sql_query($sql) )
{
message_die(GENERAL_ERROR, 'Could not delete old search id sessions', '', __LINE__, __FILE__, $sql);
$delete_search_ids = array();
while( $row = $db->sql_fetchrow($result) )
{
$delete_search_ids[] = "'" . $row['session_id'] . "'";
}
if ( count($delete_search_ids) )
{
$sql = "DELETE FROM " . SEARCH_TABLE . "
WHERE session_id NOT IN (" . implode(", ", $delete_search_ids) . ")";
if ( !$result = $db->sql_query($sql) )
{
message_die(GENERAL_ERROR, 'Could not delete old search id sessions', '', __LINE__, __FILE__, $sql);
}
}
}
//
@@ -696,12 +673,12 @@ else if ( $search_keywords != '' || $search_author != '' || $search_id )
$search_id = mt_rand();
$sql = "UPDATE " . SEARCH_TABLE . "
SET search_id = $search_id, search_time = $current_time, search_array = '" . str_replace("\'", "''", $result_array) . "'
SET search_id = $search_id, search_array = '" . str_replace("\'", "''", $result_array) . "'
WHERE session_id = '" . $userdata['session_id'] . "'";
if ( !($result = $db->sql_query($sql)) || !$db->sql_affectedrows() )
{
$sql = "INSERT INTO " . SEARCH_TABLE . " (search_id, session_id, search_time, search_array)
VALUES($search_id, '" . $userdata['session_id'] . "', $current_time, '" . str_replace("\'", "''", $result_array) . "')";
$sql = "INSERT INTO " . SEARCH_TABLE . " (search_id, session_id, search_array)
VALUES($search_id, '" . $userdata['session_id'] . "', '" . str_replace("\'", "''", $result_array) . "')";
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Could not insert search results', '', __LINE__, __FILE__, $sql);
@@ -1308,7 +1285,7 @@ else if ( $search_keywords != '' || $search_author != '' || $search_id )
$sql = "SELECT c.cat_title, c.cat_id, f.forum_name, f.forum_id
FROM " . CATEGORIES_TABLE . " c, " . FORUMS_TABLE . " f
WHERE f.cat_id = c.cat_id
ORDER BY c.cat_order, f.forum_order";
ORDER BY c.cat_id, f.forum_order";
$result = $db->sql_query($sql);
if ( !$result )
{

View File

@@ -35,18 +35,6 @@
<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_ALLOW_AUTOLOGIN}<br /><span class="gensmall">{L_ALLOW_AUTOLOGIN_EXPLAIN}</span></td>
<td class="row2"><input type="radio" name="allow_autologin" value="1" {ALLOW_AUTOLOGIN_YES} />{L_YES}&nbsp; &nbsp;<input type="radio" name="allow_autologin" value="0" {ALLOW_AUTOLOGIN_NO} />{L_NO}</td>
</tr>
<tr>
<td class="row1">{L_AUTOLOGIN_TIME} <br /><span class="gensmall">{L_AUTOLOGIN_TIME_EXPLAIN}</span></td>
<td class="row2"><input class="post" type="text" size="3" maxlength="4" name="max_autologin_time" value="{AUTOLOGIN_TIME}" /></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>
@@ -55,18 +43,6 @@
<td class="row1">{L_FLOOD_INTERVAL} <br /><span class="gensmall">{L_FLOOD_INTERVAL_EXPLAIN}</span></td>
<td class="row2"><input class="post" type="text" size="3" maxlength="4" name="flood_interval" value="{FLOOD_INTERVAL}" /></td>
</tr>
<tr>
<td class="row1">{L_SEARCH_FLOOD_INTERVAL} <br /><span class="gensmall">{L_SEARCH_FLOOD_INTERVAL_EXPLAIN}</span></td>
<td class="row2"><input class="post" type="text" size="3" maxlength="4" name="search_flood_interval" value="{SEARCH_FLOOD_INTERVAL}" /></td>
</tr>
<tr>
<td class="row1">{L_MAX_LOGIN_ATTEMPTS}<br /><span class="gensmall">{L_MAX_LOGIN_ATTEMPTS_EXPLAIN}</span></td>
<td class="row2"><input class="post" type="text" size="3" maxlength="4" name="max_login_attempts" value="{MAX_LOGIN_ATTEMPTS}" /></td>
</tr>
<tr>
<td class="row1">{L_LOGIN_RESET_TIME}<br /><span class="gensmall">{L_LOGIN_RESET_TIME_EXPLAIN}</span></td>
<td class="row2"><input class="post" type="text" size="3" maxlength="4" name="login_reset_time" value="{LOGIN_RESET_TIME}" /></td>
</tr>
<tr>
<td class="row1">{L_TOPICS_PER_PAGE}</td>
<td class="row2"><input class="post" type="text" name="topics_per_page" size="3" maxlength="4" value="{TOPICS_PER_PAGE}" /></td>

View File

@@ -1,11 +0,0 @@
<table class="forumline" width="100%" cellspacing="1" cellpadding="4" border="0">
<tr>
<th class="thHead" height="25" valign="middle">{MESSAGE_TITLE}</th>
</tr>
<tr>
<td class="row1" align="center"><form action="{S_CONFIRM_ACTION}" method="post"><span class="gen"><br />{MESSAGE_TEXT}<br /><br />{S_HIDDEN_FIELDS}<input type="submit" name="confirm" value="{L_YES}" class="mainoption" />&nbsp;&nbsp;<input type="submit" name="cancel" value="{L_NO}" class="liteoption" /></span></form></td>
</tr>
</table>
<br clear="all" />

View File

@@ -13,7 +13,7 @@
<td class="cat" align="center" valign="middle"><span class="gen"><a href="{catrow.U_CAT_EDIT}">{L_EDIT}</a></span></td>
<td class="cat" align="center" valign="middle"><span class="gen"><a href="{catrow.U_CAT_DELETE}">{L_DELETE}</a></span></td>
<td class="cat" align="center" valign="middle" nowrap="nowrap"><span class="gen"><a href="{catrow.U_CAT_MOVE_UP}">{L_MOVE_UP}</a> <a href="{catrow.U_CAT_MOVE_DOWN}">{L_MOVE_DOWN}</a></span></td>
<td class="catRight" align="center" valign="middle"><span class="gen">&nbsp;</span></td>
<td class="catRight" align="center" valign="middle"><span class="gen">&nbsp</span></td>
</tr>
<!-- BEGIN forumrow -->
<tr>

View File

@@ -43,13 +43,6 @@
<td class="row2"><b>{GZIP_COMPRESSION}</b></td>
</tr>
</table>
<h1>{L_VERSION_INFORMATION}</h1>
{VERSION_INFO}
<br />
<h1>{L_WHO_IS_ONLINE}</h1>
<table width="100%" cellpadding="4" cellspacing="1" border="0" class="forumline">

View File

@@ -1,4 +1,4 @@
<html dir="{S_CONTENT_DIRECTION}">
<html>
<head>
<title>phpBB Administration</title>
<meta http-equiv="Content-Type" content="text/html;">

View File

@@ -1,5 +1,5 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html dir="{S_CONTENT_DIRECTION}">
<html>
<head>
{META}
<meta http-equiv="Content-Type" content="text/html; charset={S_CONTENT_ENCODING}" />

View File

@@ -1,7 +1,7 @@
<h1>{L_STYLES_TITLE}</h1>
<p>{L_STYLES_ADD_TEXT}</p>
<P>{L_STYLES_ADD_TEXT}</p>
<table cellspacing="1" cellpadding="4" border="0" align="center" class="forumline">
<tr>
@@ -16,4 +16,4 @@
<td class="{styles.ROW_CLASS}"><a href="{styles.U_STYLES_INSTALL}">{L_INSTALL}</a></td>
</tr>
<!-- END styles -->
</table>
</table></form>

View File

@@ -21,7 +21,7 @@
<th>{L_SIMPLE_NAME}</th>
</tr>
<tr>
<td class="row1">{L_STYLESHEET}:<br /><span class="gensmall">{L_STYLESHEET_EXPLAIN}</span></td>
<td class="row1">{L_STYLESHEET}:<br /><span class="gensmall">Filename for CSS stylesheet to use for this theme.</span></td>
<td class="row2"><input class="post" type="text" size="25" maxlength="100" name="head_stylesheet" value="{HEAD_STYLESHEET}"></td>
<td class="row2">&nbsp;</td>
</tr>

View File

@@ -1,7 +1,7 @@
<h1>{L_STYLES_TITLE}</h1>
<p>{L_STYLES_TEXT}</p>
<P>{L_STYLES_TEXT}</p>
<table cellspacing="1" cellpadding="4" border="0" align="center" class="forumline">
<tr>
@@ -18,4 +18,4 @@
<td class="{styles.ROW_CLASS}"><a href="{styles.U_STYLES_DELETE}">{L_DELETE}</a></td>
</tr>
<!-- END styles -->
</table>
</table></form>

View File

@@ -236,7 +236,7 @@
<tr>
<td class="row1"><span class="gen">{L_UPLOAD_AVATAR_URL}</span></td>
<td class="row2">
<input class="post" type="text" name="avatarurl" size="40" style="width: 200px" />
<input class="post" type="text" name="avatarurl" size="40" class="post" style="width: 200px" />
</td>
</tr>
<!-- END avatar_remote_upload -->
@@ -244,7 +244,7 @@
<tr>
<td class="row1"><span class="gen">{L_LINK_REMOTE_AVATAR}</span></td>
<td class="row2">
<input class="post" type="text" name="avatarremoteurl" size="40" style="width: 200px" />
<input class="post" type="text" name="avatarremoteurl" size="40" class="post" style="width: 200px" />
</td>
</tr>
<!-- END avatar_remote_link -->

View File

@@ -57,4 +57,4 @@
<!-- BEGIN url --><a href="{URL}" target="_blank" class="postlink">{DESCRIPTION}</a><!-- END url -->
<!-- BEGIN email --><a href="mailto:{EMAIL}">{EMAIL}</a><!-- END email -->
<!-- BEGIN email --><a href="mailto:{EMAIL}">{EMAIL}</A><!-- END email -->

View File

@@ -7,7 +7,7 @@
<table class="forumline" width="100%" cellspacing="1" cellpadding="3" border="0">
<tr>
<th class="thHead" height="25" valign="middle">{MESSAGE_TITLE}</th>
<th class="thHead" height="25" valign="middle"><span class="tableTitle">{MESSAGE_TITLE}</span></th>
</tr>
<tr>
<td class="row1" align="center"><form action="{S_CONFIRM_ACTION}" method="post"><span class="gen"><br />{MESSAGE_TEXT}<br /><br />{S_HIDDEN_FIELDS}<input type="submit" name="confirm" value="{L_YES}" class="mainoption" />&nbsp;&nbsp;<input type="submit" name="cancel" value="{L_NO}" class="liteoption" /></span></form></td>

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

@@ -33,7 +33,7 @@
<!-- BEGIN switch_mod_option -->
<tr>
<td class="row1" width="20%"><span class="gen">{L_GROUP_TYPE}:</span></td>
<td class="row2"><span class="gen"><input type="radio" name="group_type" value="{S_GROUP_OPEN_TYPE}" {S_GROUP_OPEN_CHECKED} /> {L_GROUP_OPEN} &nbsp;&nbsp;<input type="radio" name="group_type" value="{S_GROUP_CLOSED_TYPE}" {S_GROUP_CLOSED_CHECKED} /> {L_GROUP_CLOSED} &nbsp;&nbsp;<input type="radio" name="group_type" value="{S_GROUP_HIDDEN_TYPE}" {S_GROUP_HIDDEN_CHECKED} /> {L_GROUP_HIDDEN} &nbsp;&nbsp; <input class="mainoption" type="submit" name="groupstatus" value="{L_UPDATE}" /></span></td>
<td class="row2"><span class="gen"><span class="gen"><input type="radio" name="group_type" value="{S_GROUP_OPEN_TYPE}" {S_GROUP_OPEN_CHECKED} /> {L_GROUP_OPEN} &nbsp;&nbsp;<input type="radio" name="group_type" value="{S_GROUP_CLOSED_TYPE}" {S_GROUP_CLOSED_CHECKED} /> {L_GROUP_CLOSED} &nbsp;&nbsp;<input type="radio" name="group_type" value="{S_GROUP_HIDDEN_TYPE}" {S_GROUP_HIDDEN_CHECKED} /> {L_GROUP_HIDDEN} &nbsp;&nbsp; <input class="mainoption" type="submit" name="groupstatus" value="{L_UPDATE}" /></span></td>
</tr>
<!-- END switch_mod_option -->
</table>
@@ -99,8 +99,8 @@
<!-- BEGIN switch_mod_option -->
<tr>
<td class="catBottom" colspan="8" align="right">
<span class="cattitle"><input type="submit" name="remove" value="{L_REMOVE_SELECTED}" class="mainoption" /></span>
<td class="catBottom" colspan="8" align="right"><span class="cattitle">
<input type="submit" name="remove" value="{L_REMOVE_SELECTED}" class="mainoption" />
</td>
</tr>
<!-- END switch_mod_option -->

View File

@@ -41,11 +41,7 @@
<table width="100%" cellspacing="0" border="0" align="center" cellpadding="2">
<tr>
<td align="left">
<!-- BEGIN switch_user_logged_in -->
<span class="gensmall"><a href="{U_MARK_READ}" class="gensmall">{L_MARK_FORUMS_READ}</a></span>
<!-- END switch_user_logged_in -->
</td>
<td align="left"><span class="gensmall"><a href="{U_MARK_READ}" class="gensmall">{L_MARK_FORUMS_READ}</a></span></td>
<td align="right"><span class="gensmall">{S_TIMEZONE}</span></td>
</tr>
</table>
@@ -81,10 +77,8 @@
<input class="post" type="text" name="username" size="10" />
&nbsp;&nbsp;&nbsp;{L_PASSWORD}:
<input class="post" type="password" name="password" size="10" maxlength="32" />
<!-- BEGIN switch_allow_autologin -->
&nbsp;&nbsp; &nbsp;&nbsp;{L_AUTO_LOGIN}
<input class="text" type="checkbox" name="autologin" />
<!-- END switch_allow_autologin -->
&nbsp;&nbsp;&nbsp;
<input type="submit" class="mainoption" name="login" value="{L_LOGIN}" />
</span> </td>

View File

@@ -19,20 +19,18 @@
<tr>
<td width="45%" align="right"><span class="gen">{L_USERNAME}:</span></td>
<td>
<input type="text" class="post" name="username" size="25" maxlength="40" value="{USERNAME}" />
<input type="text" 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" class="post" name="password" size="25" maxlength="32" />
<input type="password" name="password" size="25" maxlength="32" />
</td>
</tr>
<!-- BEGIN switch_allow_autologin -->
<tr align="center">
<td colspan="2"><span class="gen">{L_AUTO_LOGIN}: <input type="checkbox" name="autologin" /></span></td>
</tr>
<!-- END switch_allow_autologin -->
<tr align="center">
<td colspan="2">{S_HIDDEN_FIELDS}<input type="submit" name="login" class="mainoption" value="{L_LOGIN}" /></td>
</tr>

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 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 {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.
The phpBB Group : 2002
// -->
Powered by <a href="http://www.phpbb.com/" target="_phpbb" class="copyright">phpBB</a> &copy; 2001, 2005 phpBB Group<br />{TRANSLATION_INFO}</span></div>
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>
</td>
</tr>
</table>

View File

@@ -232,11 +232,11 @@ input.liteoption {
<td align="center" width="100%" valign="middle"><span class="maintitle">{SITENAME}</span><br /><span class="gen">{SITE_DESCRIPTION}<br />&nbsp; </span>
<table cellspacing="0" cellpadding="2" border="0">
<tr>
<td align="center" valign="top" nowrap="nowrap"><span class="mainmenu">&nbsp;<a href="{U_FAQ}" class="mainmenu"><img src="templates/subSilver/images/icon_mini_faq.gif" width="12" height="13" border="0" alt="{L_FAQ}" hspace="3" />{L_FAQ}</a>&nbsp; &nbsp;<a href="{U_SEARCH}" class="mainmenu"><img src="templates/subSilver/images/icon_mini_search.gif" width="12" height="13" border="0" alt="{L_SEARCH}" hspace="3" />{L_SEARCH}</a>&nbsp; &nbsp;<a href="{U_MEMBERLIST}" class="mainmenu"><img src="templates/subSilver/images/icon_mini_members.gif" width="12" height="13" border="0" alt="{L_MEMBERLIST}" hspace="3" />{L_MEMBERLIST}</a>&nbsp; &nbsp;<a href="{U_GROUP_CP}" class="mainmenu"><img src="templates/subSilver/images/icon_mini_groups.gif" width="12" height="13" border="0" alt="{L_USERGROUPS}" hspace="3" />{L_USERGROUPS}</a>&nbsp;
<td align="center" valign="top" nowrap="nowrap"><span class="mainmenu">&nbsp;<a href="{U_FAQ}" class="mainmenu"><img src="templates/subSilver/images/icon_mini_faq.gif" width="12" height="13" border="0" alt="{L_FAQ}" hspace="3" />{L_FAQ}</a></span><span class="mainmenu">&nbsp; &nbsp;<a href="{U_SEARCH}" class="mainmenu"><img src="templates/subSilver/images/icon_mini_search.gif" width="12" height="13" border="0" alt="{L_SEARCH}" hspace="3" />{L_SEARCH}</a>&nbsp; &nbsp;<a href="{U_MEMBERLIST}" class="mainmenu"><img src="templates/subSilver/images/icon_mini_members.gif" width="12" height="13" border="0" alt="{L_MEMBERLIST}" hspace="3" />{L_MEMBERLIST}</a>&nbsp; &nbsp;<a href="{U_GROUP_CP}" class="mainmenu"><img src="templates/subSilver/images/icon_mini_groups.gif" width="12" height="13" border="0" alt="{L_USERGROUPS}" hspace="3" />{L_USERGROUPS}</a>&nbsp;
<!-- BEGIN switch_user_logged_out -->
&nbsp;<a href="{U_REGISTER}" class="mainmenu"><img src="templates/subSilver/images/icon_mini_register.gif" width="12" height="13" border="0" alt="{L_REGISTER}" hspace="3" />{L_REGISTER}</a>&nbsp;
&nbsp;<a href="{U_REGISTER}" class="mainmenu"><img src="templates/subSilver/images/icon_mini_register.gif" width="12" height="13" border="0" alt="{L_REGISTER}" hspace="3" />{L_REGISTER}</a></span>&nbsp;
<!-- END switch_user_logged_out -->
</span></td>
</td>
</tr>
<tr>
<td height="25" align="center" valign="top" nowrap="nowrap"><span class="mainmenu">&nbsp;<a href="{U_PROFILE}" class="mainmenu"><img src="templates/subSilver/images/icon_mini_profile.gif" width="12" height="13" border="0" alt="{L_PROFILE}" hspace="3" />{L_PROFILE}</a>&nbsp; &nbsp;<a href="{U_PRIVATEMSGS}" class="mainmenu"><img src="templates/subSilver/images/icon_mini_message.gif" width="12" height="13" border="0" alt="{PRIVATE_MESSAGE_INFO}" hspace="3" />{PRIVATE_MESSAGE_INFO}</a>&nbsp; &nbsp;<a href="{U_LOGIN_LOGOUT}" class="mainmenu"><img src="templates/subSilver/images/icon_mini_login.gif" width="12" height="13" border="0" alt="{L_LOGIN_LOGOUT}" hspace="3" />{L_LOGIN_LOGOUT}</a>&nbsp;</span></td>

Some files were not shown because too many files have changed in this diff Show More