mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-12 06:18:52 +00:00
More fixes ... hopefully corrects for moved topic/pagination issues ... needs testing (run update_to_201.php ... if you are already running 2.0.1 you'll need to modify the case statements in update_to_201 or necessary checks won't complete)
git-svn-id: file:///svn/phpbb/branches/phpBB-2_0_0@2579 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
parent
beb36a67f9
commit
290a897da4
6 changed files with 118 additions and 91 deletions
|
@ -64,7 +64,7 @@ function sync($type, $id)
|
|||
case 'all forums':
|
||||
$sql = "SELECT forum_id
|
||||
FROM " . FORUMS_TABLE;
|
||||
if ( !$result = $db->sql_query($sql) )
|
||||
if ( !($result = $db->sql_query($sql)) )
|
||||
{
|
||||
message_die(GENERAL_ERROR, 'Could not get forum IDs', '', __LINE__, __FILE__, $sql);
|
||||
}
|
||||
|
@ -78,7 +78,7 @@ function sync($type, $id)
|
|||
case 'all topics':
|
||||
$sql = "SELECT topic_id
|
||||
FROM " . TOPICS_TABLE;
|
||||
if ( !$result = $db->sql_query($sql) )
|
||||
if ( !($result = $db->sql_query($sql)) )
|
||||
{
|
||||
message_die(GENERAL_ERROR, 'Could not get topic ID', '', __LINE__, __FILE__, $sql);
|
||||
}
|
||||
|
@ -90,12 +90,10 @@ function sync($type, $id)
|
|||
break;
|
||||
|
||||
case 'forum':
|
||||
$sql = "SELECT MAX(p.post_id) AS last_post, COUNT(p.post_id) AS total
|
||||
FROM " . POSTS_TABLE . " p, " . TOPICS_TABLE . " t
|
||||
WHERE p.forum_id = $id
|
||||
AND t.topic_id = p.topic_id
|
||||
AND t.topic_status <> " . TOPIC_MOVED;
|
||||
if ( !$result = $db->sql_query($sql) )
|
||||
$sql = "SELECT MAX(post_id) AS last_post, COUNT(post_id) AS total
|
||||
FROM " . POSTS_TABLE . "
|
||||
WHERE forum_id = $id";
|
||||
if ( !($result = $db->sql_query($sql)) )
|
||||
{
|
||||
message_die(GENERAL_ERROR, 'Could not get post ID', '', __LINE__, __FILE__, $sql);
|
||||
}
|
||||
|
@ -113,9 +111,8 @@ function sync($type, $id)
|
|||
|
||||
$sql = "SELECT COUNT(topic_id) AS total
|
||||
FROM " . TOPICS_TABLE . "
|
||||
WHERE forum_id = $id
|
||||
AND topic_status <> " . TOPIC_MOVED;
|
||||
if ( !$result = $db->sql_query($sql) )
|
||||
WHERE forum_id = $id";
|
||||
if ( !($result = $db->sql_query($sql)) )
|
||||
{
|
||||
message_die(GENERAL_ERROR, 'Could not get topic count', '', __LINE__, __FILE__, $sql);
|
||||
}
|
||||
|
@ -135,22 +132,19 @@ function sync($type, $id)
|
|||
$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 = $id";
|
||||
if ( !$result = $db->sql_query($sql) )
|
||||
if ( !($result = $db->sql_query($sql)) )
|
||||
{
|
||||
message_die(GENERAL_ERROR, 'Could not get post ID', '', __LINE__, __FILE__, $sql);
|
||||
}
|
||||
|
||||
if ( $row = $db->sql_fetchrow($result) )
|
||||
{
|
||||
$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";
|
||||
$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) )
|
||||
{
|
||||
message_die(GENERAL_ERROR, 'Could not update topic', '', __LINE__, __FILE__, $sql);
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
@ -469,7 +469,8 @@ function update_post_stats(&$mode, &$post_data, &$forum_id, &$topic_id, &$post_i
|
|||
{
|
||||
$sql = "UPDATE " . TOPICS_TABLE . " SET
|
||||
$topic_update_sql
|
||||
WHERE topic_id = $topic_id";
|
||||
WHERE topic_id = $topic_id
|
||||
OR topic_moved_id = $topic_id";
|
||||
if ( !($result = $db->sql_query($sql)) )
|
||||
{
|
||||
message_die(GENERAL_ERROR, 'Error in posting', '', __LINE__, __FILE__, $sql);
|
||||
|
@ -500,7 +501,6 @@ function delete_post($mode, &$post_data, &$message, &$meta, &$forum_id, &$topic_
|
|||
|
||||
include($phpbb_root_path . 'includes/functions_search.'.$phpEx);
|
||||
|
||||
$topic_update_sql = '';
|
||||
if ( $mode != 'poll_delete' )
|
||||
{
|
||||
$sql = "DELETE FROM " . POSTS_TABLE . "
|
||||
|
@ -517,7 +517,6 @@ function delete_post($mode, &$post_data, &$message, &$meta, &$forum_id, &$topic_
|
|||
message_die(GENERAL_ERROR, 'Error in deleting post', '', __LINE__, __FILE__, $sql);
|
||||
}
|
||||
|
||||
$topic_update_sql .= 'topic_replies = topic_replies - 1';
|
||||
if ( $post_data['last_post'] )
|
||||
{
|
||||
if ( $post_data['first_post'] )
|
||||
|
@ -567,31 +566,15 @@ function delete_post($mode, &$post_data, &$message, &$meta, &$forum_id, &$topic_
|
|||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Ok we set variables above that were intended to update the topics table
|
||||
// so let's go ahead and use it already :)
|
||||
//
|
||||
if( !empty($topic_update_sql) && !($post_data['first_post'] && $post_data['last_post']) )
|
||||
{
|
||||
$sql = 'UPDATE ' . TOPICS_TABLE . '
|
||||
SET ' . $topic_update_sql . "
|
||||
WHERE topic_id = $topic_id OR
|
||||
topic_moved_id = $topic_id";
|
||||
if ( !($db->sql_query($sql)) )
|
||||
{
|
||||
message_die(GENERAL_ERROR, 'Error in updating reply counts', '', __LINE__, __FILE__, $sql);
|
||||
}
|
||||
}
|
||||
|
||||
if ( $mode == 'delete' && $post_data['first_post'] && $post_data['last_post'] )
|
||||
{
|
||||
$meta = '<meta http-equiv="refresh" content="3;url=' . append_sid("viewforum.$phpEx?" . POST_FORUM_URL . "=" . $forum_id) . '">';
|
||||
$meta = '<meta http-equiv="refresh" content="3;url=' . append_sid("viewforum.$phpEx?" . POST_FORUM_URL . '=' . $forum_id) . '">';
|
||||
$message = $lang['Deleted'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$meta = '<meta http-equiv="refresh" content="3;url=' . append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . "=" . $topic_id) . '">';
|
||||
$message = ( ( $mode == "poll_delete" ) ? $lang['Poll_delete'] : $lang['Deleted'] ) . '<br /><br />' . sprintf($lang['Click_return_topic'], '<a href="' . append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id") . '">', '</a>');
|
||||
$meta = '<meta http-equiv="refresh" content="3;url=' . append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . '=' . $topic_id) . '">';
|
||||
$message = ( ( $mode == 'poll_delete' ) ? $lang['Poll_delete'] : $lang['Deleted'] ) . '<br /><br />' . sprintf($lang['Click_return_topic'], '<a href="' . append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id") . '">', '</a>');
|
||||
}
|
||||
|
||||
$message .= '<br /><br />' . sprintf($lang['Click_return_forum'], '<a href="' . append_sid("viewforum.$phpEx?" . POST_FORUM_URL . "=$forum_id") . '">', '</a>');
|
||||
|
@ -611,7 +594,7 @@ function user_notification($mode, &$post_data, &$forum_id, &$topic_id, &$post_id
|
|||
|
||||
if ( $mode == 'delete' )
|
||||
{
|
||||
$delete_sql = ( !$post_data['first_post'] && !$post_data['last_post'] ) ? " AND user_id = " . $userdata['user_id'] : "";
|
||||
$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 ( !($result = $db->sql_query($sql)) )
|
||||
{
|
||||
|
@ -663,7 +646,7 @@ function user_notification($mode, &$post_data, &$forum_id, &$topic_id, &$post_id
|
|||
$server_protocol = ( $board_config['cookie_secure'] ) ? 'https://' : 'http://';
|
||||
$server_port = ( $board_config['server_port'] <> 80 ) ? ':' . trim($board_config['server_port']) . '/' : '/';
|
||||
|
||||
$email_headers = "From: " . $board_config['board_email'] . "\nReturn-Path: " . $board_config['board_email'] . "\r\n";
|
||||
$email_headers = 'From: ' . $board_config['board_email'] . "\nReturn-Path: " . $board_config['board_email'] . "\r\n";
|
||||
|
||||
$update_watched_sql = '';
|
||||
if ( $row = $db->sql_fetchrow($result) )
|
||||
|
|
|
@ -125,7 +125,9 @@ $template->assign_vars(array(
|
|||
'L_ITEMS_REQUIRED' => $lang['Items_required'],
|
||||
'L_EMAIL_ADDRESS' => $lang['Email_address'],
|
||||
'L_SUBMIT' => $lang['Submit'],
|
||||
'L_RESET' => $lang['Reset'])
|
||||
'L_RESET' => $lang['Reset'],
|
||||
|
||||
'S_PROFILE_ACTION' => append_sid("profile.$phpEx?mode=sendpassword"))
|
||||
);
|
||||
|
||||
$template->pparse('body');
|
||||
|
|
|
@ -20,11 +20,16 @@ if ( !($result = $db->sql_query($sql)) )
|
|||
|
||||
if ( $row = $db->sql_fetchrow($result) )
|
||||
{
|
||||
if ( $row['config_value'] == 'RC-3' || $row['config_value'] == 'RC-4' || $row['config_value'] == '.0.0' )
|
||||
{
|
||||
if ( $row['config_value'] == 'RC-3' )
|
||||
switch ( $row['config_value'] )
|
||||
{
|
||||
case 'RC-3':
|
||||
case 'RC-4':
|
||||
case '.0.0':
|
||||
$sql = array();
|
||||
|
||||
switch ( $row['config_value'] )
|
||||
{
|
||||
case 'RC-3':
|
||||
switch ( SQL_LAYER )
|
||||
{
|
||||
case 'mysql':
|
||||
|
@ -47,6 +52,7 @@ if ( $row = $db->sql_fetchrow($result) )
|
|||
die("No DB LAYER found!");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
$errored = false;
|
||||
for($i = 0; $i < count($sql); $i++)
|
||||
|
@ -65,6 +71,49 @@ if ( $row = $db->sql_fetchrow($result) )
|
|||
echo " -> <b>COMPLETED</b><br /><br />\n\n";
|
||||
}
|
||||
}
|
||||
|
||||
unset($sql);
|
||||
|
||||
switch ( $row['config_value'] )
|
||||
{
|
||||
case 'RC-3':
|
||||
case 'RC-4':
|
||||
case '.0.0':
|
||||
$sql = "SELECT topic_id, topic_moved_id
|
||||
FROM " . TOPICS_TABLE . "
|
||||
WHERE topic_moved_id <> 0";
|
||||
if ( !($result = $db->sql_query($sql)) )
|
||||
{
|
||||
die("Couldn't update version info");
|
||||
}
|
||||
|
||||
$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";
|
||||
if ( !($result = $db->sql_query($sql)) )
|
||||
{
|
||||
message_die(GENERAL_ERROR, 'Could not get post ID', '', __LINE__, __FILE__, $sql);
|
||||
}
|
||||
|
||||
if ( $row = $db->sql_fetchrow($result) )
|
||||
{
|
||||
$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 = $topic_id";
|
||||
if ( !$db->sql_query($sql) )
|
||||
{
|
||||
message_die(GENERAL_ERROR, 'Could not update topic', '', __LINE__, __FILE__, $sql);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
unset($sql);
|
||||
|
@ -78,6 +127,11 @@ if ( $row = $db->sql_fetchrow($result) )
|
|||
}
|
||||
|
||||
die("UPDATING COMPLETE -> 2.0.1 Final installed");
|
||||
break;
|
||||
|
||||
default:
|
||||
die("NO UPDATES REQUIRED");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -102,7 +102,7 @@ if ( !$is_auth['auth_read'] || !$is_auth['auth_view'] )
|
|||
{
|
||||
if ( !$userdata['session_logged_in'] )
|
||||
{
|
||||
$redirect = POST_FORUM_URL . "=$forum_id" . ( ( isset($start) ) ? "&start=$start" : "" );
|
||||
$redirect = POST_FORUM_URL . "=$forum_id" . ( ( isset($start) ) ? "&start=$start" : '' );
|
||||
$header_location = ( @preg_match("/Microsoft|WebSTAR|Xitami/", getenv("SERVER_SOFTWARE")) ) ? "Refresh: 0; URL=" : "Location: ";
|
||||
header($header_location . append_sid("login.$phpEx?redirect=viewforum.$phpEx&$redirect", true));
|
||||
exit;
|
||||
|
|
|
@ -113,21 +113,15 @@ if ( isset($HTTP_GET_VARS['view']) && empty($HTTP_GET_VARS[POST_POST_URL]) )
|
|||
message_die(GENERAL_ERROR, "Could not obtain newer/older topic information", '', __LINE__, __FILE__, $sql);
|
||||
}
|
||||
|
||||
if ( !($row = $db->sql_fetchrow($result)) )
|
||||
{
|
||||
if( $HTTP_GET_VARS['view'] == 'next' )
|
||||
{
|
||||
message_die(GENERAL_MESSAGE, 'No_newer_topics');
|
||||
}
|
||||
else
|
||||
{
|
||||
message_die(GENERAL_MESSAGE, 'No_older_topics');
|
||||
}
|
||||
}
|
||||
else
|
||||
if ( $row = $db->sql_fetchrow($result) )
|
||||
{
|
||||
$topic_id = $row['topic_id'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$message = ( $HTTP_GET_VARS['view'] == 'next' ) ? 'No_newer_topics' : 'No_older_topics';
|
||||
message_die(GENERAL_MESSAGE, $message);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue