Redirect path changes

git-svn-id: file:///svn/phpbb/trunk@3647 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
Paul S. Owen 2003-03-13 12:18:52 +00:00
parent 8bb5de9861
commit 461ae0f7e0
7 changed files with 289 additions and 275 deletions

View file

@ -222,7 +222,7 @@ switch ($mode)
$forum_id = $db->sql_nextid(); $forum_id = $db->sql_nextid();
// Redirect to permissions // Redirect to permissions
redirect('admin/admin_permissions.' . $phpEx . $SID . '&mode=forums&f=' . $forum_id); redirect('adm/admin_permissions.' . $phpEx . $SID . '&mode=forums&f=' . $forum_id);
break; break;

View file

@ -1,6 +1,6 @@
<?php <?php
/*************************************************************************** /***************************************************************************
* index.php [ admin/ ] * index.php [ adm/ ]
* ------------------- * -------------------
* begin : Saturday, Feb 13, 2001 * begin : Saturday, Feb 13, 2001
* copyright : (C) 2001 The phpBB Group * copyright : (C) 2001 The phpBB Group

View file

@ -868,11 +868,11 @@ function msg_handler($errno, $msg_text, $errfile, $errline)
$db->sql_close(); $db->sql_close();
} }
echo '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html><head><meta http-equiv="Content-Type" content="text/html; charset=iso-8869-1"><meta http-equiv="Content-Style-Type" content="text/css"><link rel="stylesheet" href="' . $phpbb_root_path . 'admin/subSilver.css" type="text/css"><style type="text/css">' . "\n"; echo '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html><head><meta http-equiv="Content-Type" content="text/html; charset=iso-8869-1"><meta http-equiv="Content-Style-Type" content="text/css"><link rel="stylesheet" href="' . $phpbb_root_path . 'adm/subSilver.css" type="text/css"><style type="text/css">' . "\n";
echo 'th { background-image: url(\'' . $phpbb_root_path . 'admin/images/cellpic3.gif\') }' . "\n"; echo 'th { background-image: url(\'' . $phpbb_root_path . 'adm/images/cellpic3.gif\') }' . "\n";
echo 'td.cat { background-image: url(\'' . $phpbb_root_path . 'admin/images/cellpic1.gif\') }' . "\n"; echo 'td.cat { background-image: url(\'' . $phpbb_root_path . 'adm/images/cellpic1.gif\') }' . "\n";
echo '</style><title>' . $msg_title . '</title></head><body>'; echo '</style><title>' . $msg_title . '</title></head><body>';
echo '<table width="100%" cellspacing="0" cellpadding="0" border="0"><tr><td><img src="' . $phpbb_root_path . 'admin/images/header_left.jpg" width="200" height="60" alt="phpBB Logo" title="phpBB Logo" border="0"/></td><td width="100%" background="' . $phpbb_root_path . 'admin/images/header_bg.jpg" height="60" align="right" nowrap="nowrap"><span class="maintitle">General Error</span> &nbsp; &nbsp; &nbsp;</td></tr></table><br clear="all" /><table width="85%" cellspacing="0" cellpadding="0" border="0" align="center"><tr><td><br clear="all" />' . $msg_text . '<hr />Please notify the board administrator or webmaster : <a href="mailto:' . $config['board_email'] . '">' . $config['board_email'] . '</a></td></tr></table><br clear="all" /></body></html>'; echo '<table width="100%" cellspacing="0" cellpadding="0" border="0"><tr><td><img src="' . $phpbb_root_path . 'adm/images/header_left.jpg" width="200" height="60" alt="phpBB Logo" title="phpBB Logo" border="0"/></td><td width="100%" background="' . $phpbb_root_path . 'adm/images/header_bg.jpg" height="60" align="right" nowrap="nowrap"><span class="maintitle">General Error</span> &nbsp; &nbsp; &nbsp;</td></tr></table><br clear="all" /><table width="85%" cellspacing="0" cellpadding="0" border="0" align="center"><tr><td><br clear="all" />' . $msg_text . '<hr />Please notify the board administrator or webmaster : <a href="mailto:' . $config['board_email'] . '">' . $config['board_email'] . '</a></td></tr></table><br clear="all" /></body></html>';
exit; exit;
break; break;

View file

@ -53,7 +53,7 @@ if (defined('DEBUG'))
$template->assign_vars(array( $template->assign_vars(array(
'PHPBB_VERSION' => $config['version'], 'PHPBB_VERSION' => $config['version'],
'ADMIN_LINK' => ($auth->acl_get('a_')) ? sprintf($user->lang['ACP'], '<a href="' . "admin/index.$phpEx?sid=" . $user->data['session_id'] . '">', '</a>') . '<br /><br />' : '', 'ADMIN_LINK' => ($auth->acl_get('a_')) ? sprintf($user->lang['ACP'], '<a href="' . "adm/index.$phpEx?sid=" . $user->data['session_id'] . '">', '</a>') . '<br /><br />' : '',
'DEBUG_OUTPUT' => (defined('DEBUG')) ? $debug_output : '' 'DEBUG_OUTPUT' => (defined('DEBUG')) ? $debug_output : ''
)); ));

View file

@ -341,7 +341,7 @@ else if( !empty($_POST['ftp_file']) && !defined("PHPBB_INSTALLED") )
// //
$s_hidden_fields = '<input type="hidden" name="username" value="' . $admin_name . '" />'; $s_hidden_fields = '<input type="hidden" name="username" value="' . $admin_name . '" />';
$s_hidden_fields .= '<input type="hidden" name="password" value="' . $admin_pass1 . '" />'; $s_hidden_fields .= '<input type="hidden" name="password" value="' . $admin_pass1 . '" />';
$s_hidden_fields .= '<input type="hidden" name="redirect" value="admin/index.php" />'; $s_hidden_fields .= '<input type="hidden" name="redirect" value="adm/index.php" />';
$s_hidden_fields .= '<input type="hidden" name="submit" value="' . $lang['Login'] . '" />'; $s_hidden_fields .= '<input type="hidden" name="submit" value="' . $lang['Login'] . '" />';
page_header($lang['Inst_Step_2'], "../login.$phpEx"); page_header($lang['Inst_Step_2'], "../login.$phpEx");
@ -859,7 +859,7 @@ else
{ {
$s_hidden_fields = '<input type="hidden" name="username" value="' . $admin_name . '" />'; $s_hidden_fields = '<input type="hidden" name="username" value="' . $admin_name . '" />';
$s_hidden_fields .= '<input type="hidden" name="password" value="' . $admin_pass1 . '" />'; $s_hidden_fields .= '<input type="hidden" name="password" value="' . $admin_pass1 . '" />';
$s_hidden_fields .= '<input type="hidden" name="redirect" value="admin/index.php" />'; $s_hidden_fields .= '<input type="hidden" name="redirect" value="adm/index.php" />';
$s_hidden_fields .= '<input type="hidden" name="login" value="true" />'; $s_hidden_fields .= '<input type="hidden" name="login" value="true" />';
} }
else else
@ -897,11 +897,11 @@ function page_header($l_instructions, $s_action)
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html> <html>
<head> <head>
<link rel="stylesheet" href="../admin/subSilver.css" type="text/css"> <link rel="stylesheet" href="../adm/subSilver.css" type="text/css">
<style type="text/css"> <style type="text/css">
<!-- <!--
th { background-image: url('../admin/images/cellpic3.gif') } th { background-image: url('../adm/images/cellpic3.gif') }
td.cat { background-image: url('../admin/images/cellpic1.gif') } td.cat { background-image: url('../adm/images/cellpic1.gif') }
//--> //-->
</style> </style>
<title><?php echo $lang['Welcome_install']; ?></title> <title><?php echo $lang['Welcome_install']; ?></title>
@ -910,8 +910,8 @@ td.cat { background-image: url('../admin/images/cellpic1.gif') }
<table width="100%" cellspacing="0" cellpadding="0" border="0"> <table width="100%" cellspacing="0" cellpadding="0" border="0">
<tr> <tr>
<td><img src="../admin/images/header_left.jpg" width="200" height="60" alt="phpBB Logo" title="phpBB Logo" border="0"/></td> <td><img src="../adm/images/header_left.jpg" width="200" height="60" alt="phpBB Logo" title="phpBB Logo" border="0"/></td>
<td width="100%" background="../admin/images/header_bg.jpg" height="60" align="right" nowrap="nowrap"><span class="maintitle"><?php echo $lang['Welcome_install']; ?></span> &nbsp; &nbsp; &nbsp;</td> <td width="100%" background="../adm/images/header_bg.jpg" height="60" align="right" nowrap="nowrap"><span class="maintitle"><?php echo $lang['Welcome_install']; ?></span> &nbsp; &nbsp; &nbsp;</td>
</tr> </tr>
</table> </table>

View file

@ -20,7 +20,7 @@ $db = new sql_db($dbhost, $dbuser, $dbpasswd, $dbname, $dbport, false);
// //
// Updates to this version ... // Updates to this version ...
// //
$version = '2.1.0 [20020820]'; $version = '2.1.1 [20030221]';
// ---------------- // ----------------
// BEGIN VARS DEFNS // BEGIN VARS DEFNS
@ -135,7 +135,7 @@ page_header();
<?php <?php
switch ( $this_version ) switch ($this_version)
{ {
case '.0.0': case '.0.0':
case '.0.1': case '.0.1':
@ -163,9 +163,9 @@ switch ( $this_version )
); );
$sql = ''; $sql = '';
foreach ( $anon_id_tbl as $table => $field_ary ) foreach ($anon_id_tbl as $table => $field_ary)
{ {
foreach ( $field_ary as $field ) foreach ($field_ary as $field)
{ {
$sql = "UPDATE " . $table_prefix . "$table $sql = "UPDATE " . $table_prefix . "$table
SET $field = " . ANONYMOUS . " SET $field = " . ANONYMOUS . "
@ -188,7 +188,7 @@ switch ( $this_version )
<h1>Updating current schema</h1> <h1>Updating current schema</h1>
<?php <?php
/*
// //
// Get schema // Get schema
// //
@ -205,7 +205,7 @@ $create_def = $schema['create_def'];
$result = $db->sql_query('SHOW TABLES'); $result = $db->sql_query('SHOW TABLES');
$currenttables = array(); $currenttables = array();
while( $table = $db->sql_fetchrow($result) ) while($table = $db->sql_fetchrow($result))
{ {
$currenttables[] = $table[0]; $currenttables[] = $table[0];
} }
@ -213,9 +213,9 @@ while( $table = $db->sql_fetchrow($result) )
// //
// Check what tables we need to CREATE // Check what tables we need to CREATE
// //
foreach( $table_def as $table => $definition ) foreach($table_def as $table => $definition)
{ {
if ( !in_array($table, $currenttables) ) if (!in_array($table, $currenttables))
{ {
gen_str_init("* Creating <b>$table</b>"); gen_str_init("* Creating <b>$table</b>");
@ -228,7 +228,7 @@ foreach( $table_def as $table => $definition )
// //
// Loop tables in schema // Loop tables in schema
// //
foreach ( $field_def as $table => $table_def ) foreach ($field_def as $table => $table_def)
{ {
// Loop fields in table // Loop fields in table
gen_str_init("* Updating table <b>$table</b>"); gen_str_init("* Updating table <b>$table</b>");
@ -238,17 +238,17 @@ foreach ( $field_def as $table => $table_def )
$result = $db->sql_query($sql); $result = $db->sql_query($sql);
$current_fields = array(); $current_fields = array();
while ( $row = $db->sql_fetchrow($result) ) while ($row = $db->sql_fetchrow($result))
{ {
$current_fields[] = $row['Field']; $current_fields[] = $row['Field'];
} }
$alter_sql = "ALTER TABLE $table "; $alter_sql = "ALTER TABLE $table ";
if ( is_array($table_def) ) if (is_array($table_def))
{ {
foreach ( $table_def as $field => $definition ) foreach ($table_def as $field => $definition)
{ {
if ( $field == '' ) if ($field == '')
{ {
// //
// Skip empty fields if any (shouldn't be needed) // Skip empty fields if any (shouldn't be needed)
@ -271,7 +271,7 @@ foreach ( $field_def as $table => $table_def )
// If the current is not a key of $current_def and it is not a field that is // If the current is not a key of $current_def and it is not a field that is
// to be renamed then the field doesn't currently exist. // to be renamed then the field doesn't currently exist.
// //
$changes[] = ( !in_array($field, $current_fields) && $oldfield == $field ) ? " ADD $field " . $create_def[$table][$field] : " CHANGE $oldfield $field " . $create_def[$table][$field]; $changes[] = (!in_array($field, $current_fields) && $oldfield == $field) ? " ADD $field " . $create_def[$table][$field] : " CHANGE $oldfield $field " . $create_def[$table][$field];
} }
} }
@ -285,18 +285,18 @@ foreach ( $field_def as $table => $table_def )
$result = $db->sql_query($sql); $result = $db->sql_query($sql);
$indices = array(); $indices = array();
while( $row = $db->sql_fetchrow($result) ) while($row = $db->sql_fetchrow($result))
{ {
$indices[] = $row['Key_name']; $indices[] = $row['Key_name'];
} }
if ( is_array($key_def[$table]) ) if (is_array($key_def[$table]))
{ {
foreach ( $key_def[$table] as $key_name => $key_field ) foreach ($key_def[$table] as $key_name => $key_field)
{ {
if ( !in_array($key_name, $indices) ) if (!in_array($key_name, $indices))
{ {
$alter_sql .= ( $key_name == 'PRIMARY' ) ? ", ADD PRIMARY KEY ($key_field)" : ", ADD INDEX $key_name ($key_field)"; $alter_sql .= ($key_name == 'PRIMARY') ? ", ADD PRIMARY KEY ($key_field)" : ", ADD INDEX $key_name ($key_field)";
} }
} }
} }
@ -307,7 +307,7 @@ foreach ( $field_def as $table => $table_def )
gen_str_ok(); gen_str_ok();
} }
*/
?> ?>
<h1>Updating table data</h1> <h1>Updating table data</h1>
@ -315,7 +315,7 @@ foreach ( $field_def as $table => $table_def )
<?php <?php
switch ( $this_version ) switch ($this_version)
{ {
case '.0.0': case '.0.0':
case '.0.1': case '.0.1':
@ -391,7 +391,7 @@ switch ( $this_version )
$result = $db->sql_query($sql); $result = $db->sql_query($sql);
$sql_ary = array(); $sql_ary = array();
if ( $row = $db->sql_fetchrow($result) ) if ($row = $db->sql_fetchrow($result))
{ {
do do
{ {
@ -400,7 +400,7 @@ switch ( $this_version )
WHERE ban_id = " . $row['ban_id']; WHERE ban_id = " . $row['ban_id'];
$db->sql_query($sql); $db->sql_query($sql);
} }
while ( $row = $db->sql_fetchrow($result) ); while ($row = $db->sql_fetchrow($result));
} }
$db->sql_freeresult($result); $db->sql_freeresult($result);
@ -419,16 +419,16 @@ switch ( $this_version )
// ), // ),
$batchsize = 1000; $batchsize = 1000;
foreach ( $upd_ip_sql as $table => $field_ary ) foreach ($upd_ip_sql as $table => $field_ary)
{ {
foreach ( $field_ary as $field ) foreach ($field_ary as $field)
{ {
gen_str_init("* Decoding <b>$table.$field</b>"); gen_str_init("* Decoding <b>$table.$field</b>");
$db->sql_return_on_error(true); $db->sql_return_on_error(true);
$sql = "SELECT MAX($field) AS max_id $sql = "SELECT MAX($field) AS max_id
FROM " . $table_prefix . "$table"; FROM " . $table_prefix . "$table";
if ( $result = $db->sql_query($sql) ) if ($result = $db->sql_query($sql))
{ {
$db->sql_return_on_error(false); $db->sql_return_on_error(false);
@ -449,7 +449,7 @@ switch ( $this_version )
AND $batchend"; AND $batchend";
$result = $db->sql_query($sql); $result = $db->sql_query($sql);
if ( $row = $db->sql_fetchrow($result) ) if ($row = $db->sql_fetchrow($result))
{ {
do do
{ {
@ -458,7 +458,7 @@ switch ( $this_version )
WHERE $field LIKE '" . $row[$field] . "'"; WHERE $field LIKE '" . $row[$field] . "'";
$db->sql_query($sql); $db->sql_query($sql);
} }
while ( $row = $db->sql_fetchrow($result) ); while ($row = $db->sql_fetchrow($result));
} }
$db->sql_freeresult($result); $db->sql_freeresult($result);
} }
@ -530,7 +530,7 @@ switch ( $this_version )
"UPDATE " . $table_prefix . "config SET config_value = '1' WHERE config_name = 'default_style'", "UPDATE " . $table_prefix . "config SET config_value = '1' WHERE config_name = 'default_style'",
); );
if ( SQL_LAYER == 'mysql' || SQL_LAYER == 'mysql4' ) if (SQL_LAYER == 'mysql' || SQL_LAYER == 'mysql4')
{ {
$sql_ary[] = "ALTER TABLE " . $table_prefix . "users AUTO_INCREMENT = 1"; $sql_ary[] = "ALTER TABLE " . $table_prefix . "users AUTO_INCREMENT = 1";
} }
@ -546,9 +546,7 @@ switch ( $this_version )
gen_str_ok(); gen_str_ok();
gen_str_init('* Updating <b>permissions</b>'); gen_str_init('* Updating <b>permissions</b>');
//
// Grab user id of first user with user_level of ADMIN // Grab user id of first user with user_level of ADMIN
//
$sql = "SELECT user_id $sql = "SELECT user_id
FROM " . $table_prefix . "users FROM " . $table_prefix . "users
WHERE user_level = 1 WHERE user_level = 1
@ -568,7 +566,7 @@ switch ( $this_version )
$result = $db->sql_query($sql); $result = $db->sql_query($sql);
$forum_access = array(); $forum_access = array();
while ( $row = $db->sql_fetchrow($result) ) while ($row = $db->sql_fetchrow($result))
{ {
$forum_access[] = $row; $forum_access[] = $row;
} }
@ -585,7 +583,7 @@ switch ( $this_version )
$result = $db->sql_query($sql); $result = $db->sql_query($sql);
$user_access = array(); $user_access = array();
while ( $row = $db->sql_fetchrow($result) ) while ($row = $db->sql_fetchrow($result))
{ {
$user_access[$row['forum_id']] = $row; $user_access[$row['forum_id']] = $row;
} }
@ -601,7 +599,7 @@ switch ( $this_version )
$result = $db->sql_query($sql); $result = $db->sql_query($sql);
$group_access = array(); $group_access = array();
while ( $row = $db->sql_fetchrow($result) ) while ($row = $db->sql_fetchrow($result))
{ {
$group_access[$row['forum_id']] = $row; $group_access[$row['forum_id']] = $row;
} }
@ -617,20 +615,20 @@ switch ( $this_version )
$result = $db->sql_query($sql); $result = $db->sql_query($sql);
$delete_ug_sql = ''; $delete_ug_sql = '';
if ( $row = $db->sql_fetchrow($result) ) if ($row = $db->sql_fetchrow($result))
{ {
do do
{ {
$delete_ug_sql .= ( ( $delete_ug_sql != '' ) ? ', ' : '' ) . $row['group_id']; $delete_ug_sql .= (($delete_ug_sql != '') ? ', ' : '') . $row['group_id'];
} }
while ( $row = $db->sql_fetchrow($result) ); while ($row = $db->sql_fetchrow($result));
} }
$db->sql_freeresult($result); $db->sql_freeresult($result);
// //
// Clean up user_group and groups // Clean up user_group and groups
// //
if ( $delete_ug_sql ) if ($delete_ug_sql)
{ {
$sql = "DELETE FROM " . $table_prefix . "user_group $sql = "DELETE FROM " . $table_prefix . "user_group
WHERE group_id NOT IN ($delete_ug_sql)"; WHERE group_id NOT IN ($delete_ug_sql)";
@ -657,7 +655,7 @@ switch ( $this_version )
$all_options = array_merge($auth_options, array_merge($auth_mod_options, $auth_admin_options)); $all_options = array_merge($auth_options, array_merge($auth_mod_options, $auth_admin_options));
$option_ids = array(); $option_ids = array();
foreach ( $all_options as $value ) foreach ($all_options as $value)
{ {
$sql = "INSERT INTO " . $table_prefix . "auth_options (auth_value) $sql = "INSERT INTO " . $table_prefix . "auth_options (auth_value)
VALUES ('$value')"; VALUES ('$value')";
@ -666,7 +664,7 @@ switch ( $this_version )
$option_ids[$value] = $db->sql_nextid(); $option_ids[$value] = $db->sql_nextid();
} }
foreach ( $new_groups as $k => $sql ) foreach ($new_groups as $k => $sql)
{ {
$db->sql_query($sql); $db->sql_query($sql);
$$k = $db->sql_nextid(); $$k = $db->sql_nextid();
@ -707,11 +705,11 @@ switch ( $this_version )
$group_acl = array(); $group_acl = array();
$user_acl = array(); $user_acl = array();
foreach ( $forum_access as $forum ) foreach ($forum_access as $forum)
{ {
foreach( $auth_map as $k => $v ) foreach($auth_map as $k => $v)
{ {
switch ( $forum[$k] ) switch ($forum[$k])
{ {
case AUTH_ALL: case AUTH_ALL:
$group_acl[$guest_id][$forum['forum_id']][$v] = ACL_ALLOW; $group_acl[$guest_id][$forum['forum_id']][$v] = ACL_ALLOW;
@ -724,22 +722,22 @@ switch ( $this_version )
break; break;
case AUTH_ACL: case AUTH_ACL:
foreach( $group_access as $forum_id => $access ) foreach($group_access as $forum_id => $access)
{ {
if ( $forum_id == $forum['forum_id'] ) if ($forum_id == $forum['forum_id'])
{ {
if ( !empty($access[$k]) ) if (!empty($access[$k]))
{ {
$group_acl[$access['group_id']][$forum['forum_id']][$v] = ACL_ALLOW; $group_acl[$access['group_id']][$forum['forum_id']][$v] = ACL_ALLOW;
} }
} }
} }
foreach( $user_access as $forum_id => $access ) foreach($user_access as $forum_id => $access)
{ {
if ( $forum_id == $forum['forum_id'] ) if ($forum_id == $forum['forum_id'])
{ {
if ( !empty($access[$k]) ) if (!empty($access[$k]))
{ {
$user_acl[$access['user_id']][$forum['forum_id']][$v] = ACL_ALLOW; $user_acl[$access['user_id']][$forum['forum_id']][$v] = ACL_ALLOW;
} }
@ -750,22 +748,22 @@ switch ( $this_version )
case AUTH_MOD: case AUTH_MOD:
$group_acl[$super_mod_id][$forum['forum_id']][$v] = ACL_ALLOW; $group_acl[$super_mod_id][$forum['forum_id']][$v] = ACL_ALLOW;
foreach( $group_access as $forum_id => $access ) foreach($group_access as $forum_id => $access)
{ {
if ( $forum_id == $forum['forum_id'] ) if ($forum_id == $forum['forum_id'])
{ {
if ( !empty($access[$k]) ) if (!empty($access[$k]))
{ {
$group_acl[$access['group_id']][$forum['forum_id']][$v] = ACL_ALLOW; $group_acl[$access['group_id']][$forum['forum_id']][$v] = ACL_ALLOW;
} }
} }
} }
foreach( $user_access as $forum_id => $access ) foreach($user_access as $forum_id => $access)
{ {
if ( $forum_id == $forum['forum_id'] ) if ($forum_id == $forum['forum_id'])
{ {
if ( !empty($access[$k]) ) if (!empty($access[$k]))
{ {
$user_acl[$access['user_id']][$forum['forum_id']][$v] = ACL_ALLOW; $user_acl[$access['user_id']][$forum['forum_id']][$v] = ACL_ALLOW;
} }
@ -801,9 +799,9 @@ switch ( $this_version )
// //
// Do Moderators // Do Moderators
// //
foreach( $user_access as $forum_id => $access ) foreach($user_access as $forum_id => $access)
{ {
if ( !empty($access['auth_mod']) ) if (!empty($access['auth_mod']))
{ {
$sql_ary[] = "INSERT INTO " . $table_prefix . "auth_users (user_id, forum_id, auth_option_id, auth_allow_deny) $sql_ary[] = "INSERT INTO " . $table_prefix . "auth_users (user_id, forum_id, auth_option_id, auth_allow_deny)
SELECT " . $access['user_id'] . ", $forum_id, auth_option_id, " . ACL_ALLOW . " SELECT " . $access['user_id'] . ", $forum_id, auth_option_id, " . ACL_ALLOW . "
@ -817,9 +815,9 @@ switch ( $this_version )
} }
} }
foreach( $group_access as $forum_id => $access ) foreach($group_access as $forum_id => $access)
{ {
if ( !empty($access['auth_mod']) ) if (!empty($access['auth_mod']))
{ {
$sql_ary[] = "INSERT INTO " . $table_prefix . "auth_groups (group_id, forum_id, auth_option_id, auth_allow_deny) $sql_ary[] = "INSERT INTO " . $table_prefix . "auth_groups (group_id, forum_id, auth_option_id, auth_allow_deny)
SELECT " . $access['group_id'] . ", $forum_id, auth_option_id, " . ACL_ALLOW . " SELECT " . $access['group_id'] . ", $forum_id, auth_option_id, " . ACL_ALLOW . "
@ -836,11 +834,11 @@ switch ( $this_version )
// //
// Rest of access list // Rest of access list
// //
foreach ( $user_acl as $user_id => $user_acl_ary ) foreach ($user_acl as $user_id => $user_acl_ary)
{ {
foreach ( $user_acl_ary as $forum_id => $auth ) foreach ($user_acl_ary as $forum_id => $auth)
{ {
foreach ( $auth as $auth_value => $allow ) foreach ($auth as $auth_value => $allow)
{ {
$auth_option_id = $option_ids[$auth_value]; $auth_option_id = $option_ids[$auth_value];
$sql_ary[] = "INSERT INTO " . $table_prefix . "auth_users (user_id, forum_id, auth_option_id, auth_allow_deny) VALUES ($user_id, $forum_id, $auth_option_id, $allow)"; $sql_ary[] = "INSERT INTO " . $table_prefix . "auth_users (user_id, forum_id, auth_option_id, auth_allow_deny) VALUES ($user_id, $forum_id, $auth_option_id, $allow)";
@ -848,11 +846,11 @@ switch ( $this_version )
} }
} }
foreach ( $group_acl as $group_id => $group_acl_ary ) foreach ($group_acl as $group_id => $group_acl_ary)
{ {
foreach ( $group_acl_ary as $forum_id => $auth ) foreach ($group_acl_ary as $forum_id => $auth)
{ {
foreach ( $auth as $auth_value => $allow ) foreach ($auth as $auth_value => $allow)
{ {
$auth_option_id = $option_ids[$auth_value]; $auth_option_id = $option_ids[$auth_value];
$sql_ary[] = "INSERT INTO " . $table_prefix . "auth_groups (group_id, forum_id, auth_option_id, auth_allow_deny) VALUES ($group_id, $forum_id, $auth_option_id, $allow)"; $sql_ary[] = "INSERT INTO " . $table_prefix . "auth_groups (group_id, forum_id, auth_option_id, auth_allow_deny) VALUES ($group_id, $forum_id, $auth_option_id, $allow)";
@ -860,14 +858,14 @@ switch ( $this_version )
} }
} }
foreach ( $sql_ary as $sql ) foreach ($sql_ary as $sql)
{ {
$db->sql_query($sql); $db->sql_query($sql);
} }
gen_str_ok(); gen_str_ok();
case '2.1.0 [20020816]': case '2.1.1 [20030221]':
$sql_ary = array(); $sql_ary = array();
@ -876,7 +874,7 @@ switch ( $this_version )
$sql_ary[] = "UPDATE " . $table_prefix . "posts_text $sql_ary[] = "UPDATE " . $table_prefix . "posts_text
SET post_checksum = MD5(post_text)"; SET post_checksum = MD5(post_text)";
foreach ( $sql_ary as $sql ) foreach ($sql_ary as $sql)
{ {
$db->sql_query($sql); $db->sql_query($sql);
} }
@ -884,7 +882,21 @@ switch ( $this_version )
gen_str_ok(); gen_str_ok();
gen_str_init('* Updating <b>forum post info</b>'); gen_str_init('* Updating <b>forum post info</b>');
switch ( SQL_LAYER ) $sql = "SELECT topic_id, MIN(post_id) AS first_post_id, MAX(post_id) AS last_post_id, COUNT(post_id) AS total_posts
FROM {$table_prefix}posts
GROUP BY topic_id";
$result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result))
{
$sql = "UPDATE {$table_prefix}topics
SET topic_first_post_id = " . $row['first_post_id'] . ", topic_last_post_id = " . $row['last_post_id'] . ", topic_replies = " . ($row['total_posts'] - 1) . "
WHERE topic_id = " . $row['topic_id'];
$db->sql_query($sql);
}
$db->sql_freeresult($result);
switch (SQL_LAYER)
{ {
case 'oracle': case 'oracle':
$sql = "SELECT f.*, p.post_time, p.post_username, u.username, u.user_id $sql = "SELECT f.*, p.post_time, p.post_username, u.username, u.user_id
@ -895,20 +907,20 @@ switch ( $this_version )
default: default:
$sql = "SELECT f.forum_id, p.post_time, p.post_username, u.username, u.user_id $sql = "SELECT f.forum_id, p.post_time, p.post_username, u.username, u.user_id
FROM (( " . $table_prefix . "forums f FROM ((" . $table_prefix . "forums f
LEFT JOIN " . $table_prefix . "posts p ON p.post_id = f.forum_last_post_id ) LEFT JOIN " . $table_prefix . "posts p ON p.post_id = f.forum_last_post_id)
LEFT JOIN " . $table_prefix . "users u ON u.user_id = p.poster_id )"; LEFT JOIN " . $table_prefix . "users u ON u.user_id = p.poster_id)";
break; break;
} }
$result = $db->sql_query($sql); $result = $db->sql_query($sql);
$sql_ary = array(); $sql_ary = array();
while ( $row = $db->sql_fetchrow($result) ) while ($row = $db->sql_fetchrow($result))
{ {
$forum_id = $row['forum_id']; $forum_id = $row['forum_id'];
$sql_ary[] = "UPDATE " . $table_prefix . "forums $sql_ary[] = "UPDATE " . $table_prefix . "forums
SET forum_last_poster_id = " . ( ( $row['user_id'] ) ? $row['user_id'] : ANONYMOUS ) . ", forum_last_poster_name = '" . addslashes($row['post_username']) . "', forum_last_post_time = " . $row['post_time'] . " SET forum_last_poster_id = " . (($row['user_id'] != ANONYMOUS) ? $row['user_id'] : ANONYMOUS) . ", forum_last_poster_name = '" . (($row['user_id'] != ANONYMOUS) ? addslashes($row['username']) : addslashes($row['post_username'])) . "', forum_last_post_time = " . $row['post_time'] . "
WHERE forum_id = $forum_id"; WHERE forum_id = $forum_id";
$sql = "SELECT t.*, u.username, u.user_id, u2.username as user2, u2.user_id as id2, p.post_username, p2.post_username AS post_username2, p2.post_time $sql = "SELECT t.*, u.username, u.user_id, u2.username as user2, u2.user_id as id2, p.post_username, p2.post_username AS post_username2, p2.post_time
@ -920,10 +932,10 @@ switch ( $this_version )
AND u2.user_id = p2.poster_id"; AND u2.user_id = p2.poster_id";
$result2 = $db->sql_query($sql); $result2 = $db->sql_query($sql);
while ( $row2 = $db->sql_fetchrow($result2) ) while ($row2 = $db->sql_fetchrow($result2))
{ {
$sql_ary[] = "UPDATE " . $table_prefix . "topics $sql_ary[] = "UPDATE " . $table_prefix . "topics
SET topic_first_poster_name = '" . addslashes($row2['post_username']) . "', topic_last_poster_id = " . ( ( $row2['id2'] ) ? $row2['id2'] : ANONYMOUS ) . ", topic_last_post_time = " . $row2['post_time'] . ", topic_last_poster_name = '" . addslashes($row2['post_username2']) . "' SET topic_poster = " . $row['user_id'] . ", topic_first_poster_name = '" . (($row2['user_id'] != ANONYMOUS && $row2['user_id']) ? addslashes($row2['username']) : addslashes($row2['post_username'])) . "', topic_last_poster_id = " . (($row2['id2'] != ANONYMOUS && $row2['id2']) ? $row2['id2'] : ANONYMOUS) . ", topic_last_post_time = " . $row2['post_time'] . ", topic_last_poster_name = '" . (($row2['id2'] != ANONYMOUS && $row2['id2']) ? addslashes($row2['user2']) : addslashes($row2['post_username2'])) . "'
WHERE topic_id = " . $row2['topic_id']; WHERE topic_id = " . $row2['topic_id'];
} }
$db->sql_freeresult($result2); $db->sql_freeresult($result2);
@ -932,8 +944,9 @@ switch ( $this_version )
} }
$db->sql_freeresult($result); $db->sql_freeresult($result);
foreach ( $sql_ary as $sql ) foreach ($sql_ary as $sql)
{ {
echo $sql . "<br />";
$db->sql_query($sql); $db->sql_query($sql);
} }
@ -941,9 +954,10 @@ switch ( $this_version )
case '2.1.0 [20020817]': case '2.1.0 [20020817]':
$sql = "INSERT INTO phpbb_config (config_name, config_value) // $sql = "INSERT INTO phpbb_config (config_name, config_value)
VALUES ('ip_check', '4')"; // VALUES ('ip_check', '4')";
$db->sql_query($sql); // $db->sql_query($sql);
break;
default; default;
print "<span class=\"updtext\">* No updates needed</span><br />\n"; print "<span class=\"updtext\">* No updates needed</span><br />\n";
@ -996,11 +1010,11 @@ function page_header()
<head> <head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-15"> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-15">
<meta http-equiv="Content-Style-Type" content="text/css"> <meta http-equiv="Content-Style-Type" content="text/css">
<link rel="stylesheet" href="../admin/subSilver.css" type="text/css"> <link rel="stylesheet" href="../adm/subSilver.css" type="text/css">
<style type="text/css"> <style type="text/css">
<!-- <!--
th { background-image: url('../admin/images/cellpic3.gif') } th { background-image: url('../adm/images/cellpic3.gif') }
td.cat { background-image: url('../admin/images/cellpic1.gif') } td.cat { background-image: url('../adm/images/cellpic1.gif') }
h1 { margin-left:15px } h1 { margin-left:15px }
@ -1018,8 +1032,8 @@ h1 { margin-left:15px }
<table width="100%" cellspacing="0" cellpadding="0" border="0"> <table width="100%" cellspacing="0" cellpadding="0" border="0">
<tr> <tr>
<td><img src="../admin/images/header_left.jpg" width="200" height="60" alt="phpBB Logo" title="phpBB Logo" border="0"/></td> <td><img src="../adm/images/header_left.jpg" width="200" height="60" alt="phpBB Logo" title="phpBB Logo" border="0"/></td>
<td width="100%" background="../admin/images/header_bg.jpg" height="60" align="right" nowrap="nowrap"><span class="maintitle">Update Script</span> &nbsp; &nbsp; &nbsp;</td> <td width="100%" background="../adm/images/header_bg.jpg" height="60" align="right" nowrap="nowrap"><span class="maintitle">Update Script</span> &nbsp; &nbsp; &nbsp;</td>
</tr> </tr>
</table> </table>
@ -1078,7 +1092,7 @@ function get_schema()
{ {
$line = $schemafile[$i]; $line = $schemafile[$i];
if ( preg_match('/^CREATE TABLE (\w+)/i', $line, $matches) ) if (preg_match('/^CREATE TABLE (\w+)/i', $line, $matches))
{ {
// Start of a new table definition, set some variables and go to the next line. // Start of a new table definition, set some variables and go to the next line.
$tabledata = 1; $tabledata = 1;
@ -1088,7 +1102,7 @@ function get_schema()
continue; continue;
} }
if ( preg_match('/^\);/', $line) ) if (preg_match('/^\);/', $line))
{ {
// End of the table definition // End of the table definition
// After this we will skip everything until the next 'CREATE' line // After this we will skip everything until the next 'CREATE' line
@ -1096,12 +1110,12 @@ function get_schema()
$table_def[$table] .= ')'; // We don't need the closing semicolon $table_def[$table] .= ')'; // We don't need the closing semicolon
} }
if ( $tabledata == 1 ) if ($tabledata == 1)
{ {
// We are inside a table definition, parse this line. // We are inside a table definition, parse this line.
// Add the current line to the complete table definition: // Add the current line to the complete table definition:
$table_def[$table] .= $line; $table_def[$table] .= $line;
if ( preg_match('/^\s*(\w+)\s+(\w+)\(([\d,]+)\)(.*)$/', $line, $matches) ) if (preg_match('/^\s*(\w+)\s+(\w+)\(([\d,]+)\)(.*)$/', $line, $matches))
{ {
// This is a column definition // This is a column definition
$field = $matches[1]; $field = $matches[1];
@ -1111,8 +1125,8 @@ function get_schema()
preg_match('/DEFAULT (NULL|\'.*?\')[,\s](.*)$/i', $matches[4], $match); preg_match('/DEFAULT (NULL|\'.*?\')[,\s](.*)$/i', $matches[4], $match);
$default = $match[1]; $default = $match[1];
$notnull = ( preg_match('/NOT NULL/i', $matches[4]) ) ? 1 : 0; $notnull = (preg_match('/NOT NULL/i', $matches[4])) ? 1 : 0;
$auto_increment = ( preg_match('/auto_increment/i', $matches[4]) ) ? 1 : 0; $auto_increment = (preg_match('/auto_increment/i', $matches[4])) ? 1 : 0;
$field_def[$table][$field] = array( $field_def[$table][$field] = array(
'type' => $type, 'type' => $type,
@ -1123,17 +1137,17 @@ function get_schema()
); );
} }
if ( preg_match('/\s*PRIMARY\s+KEY\s*\((.*)\).*/', $line, $matches) ) if (preg_match('/\s*PRIMARY\s+KEY\s*\((.*)\).*/', $line, $matches))
{ {
// Primary key // Primary key
$key_def[$table]['PRIMARY'] = $matches[1]; $key_def[$table]['PRIMARY'] = $matches[1];
} }
else if ( preg_match('/\s*KEY\s+(\w+)\s*\((.*)\)/', $line, $matches) ) else if (preg_match('/\s*KEY\s+(\w+)\s*\((.*)\)/', $line, $matches))
{ {
// Normal key // Normal key
$key_def[$table][$matches[1]] = $matches[2]; $key_def[$table][$matches[1]] = $matches[2];
} }
else if ( preg_match('/^\s*(\w+)\s*(.*?),?\s*$/', $line, $matches) ) else if (preg_match('/^\s*(\w+)\s*(.*?),?\s*$/', $line, $matches))
{ {
// Column definition // Column definition
$create_def[$table][$matches[1]] = $matches[2]; $create_def[$table][$matches[1]] = $matches[2];
@ -1164,7 +1178,7 @@ function get_inserts()
for($i = 0; $i < count($insertfile); $i++) for($i = 0; $i < count($insertfile); $i++)
{ {
if ( preg_match('/(INSERT INTO (\w+)\s.*);/i', str_replace('phpbb_', $table_prefix, $insertfile[$i]), $matches) ) if (preg_match('/(INSERT INTO (\w+)\s.*);/i', str_replace('phpbb_', $table_prefix, $insertfile[$i]), $matches))
{ {
$returnvalue[$matches[2]][] = $matches[1]; $returnvalue[$matches[2]][] = $matches[1];
} }

View file

@ -1500,7 +1500,7 @@ if ( !empty($next) )
} }
query($alter_sql, "Couldn't alter table $table"); query($alter_sql, "Couldn't alter table $table");
print "<span class=\"ok\"><b>OK</b></span><br />\n";
flush(); flush();
} }