Fix unecessary ( ) around GROUP BY clause for IP section

git-svn-id: file:///svn/phpbb/trunk@2350 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
Paul S. Owen 2002-03-19 13:07:35 +00:00
parent 92ae184dc4
commit e626b1a893

View file

@ -30,7 +30,7 @@
*/ */
define('IN_PHPBB', true); define('IN_PHPBB', true);
$phpbb_root_path = "./"; $phpbb_root_path = './';
include($phpbb_root_path . 'extension.inc'); include($phpbb_root_path . 'extension.inc');
include($phpbb_root_path . 'common.'.$phpEx); include($phpbb_root_path . 'common.'.$phpEx);
include($phpbb_root_path . 'includes/bbcode.'.$phpEx); include($phpbb_root_path . 'includes/bbcode.'.$phpEx);
@ -45,7 +45,7 @@ if( isset($HTTP_GET_VARS[POST_FORUM_URL]) || isset($HTTP_POST_VARS[POST_FORUM_UR
} }
else else
{ {
$forum_id = ""; $forum_id = '';
} }
if ( isset($HTTP_GET_VARS[POST_POST_URL]) || isset($HTTP_POST_VARS[POST_POST_URL]) ) if ( isset($HTTP_GET_VARS[POST_POST_URL]) || isset($HTTP_POST_VARS[POST_POST_URL]) )
@ -54,7 +54,7 @@ if( isset($HTTP_GET_VARS[POST_POST_URL]) || isset($HTTP_POST_VARS[POST_POST_URL]
} }
else else
{ {
$post_id = ""; $post_id = '';
} }
if ( isset($HTTP_GET_VARS[POST_TOPIC_URL]) || isset($HTTP_POST_VARS[POST_TOPIC_URL]) ) if ( isset($HTTP_GET_VARS[POST_TOPIC_URL]) || isset($HTTP_POST_VARS[POST_TOPIC_URL]) )
@ -63,7 +63,7 @@ if( isset($HTTP_GET_VARS[POST_TOPIC_URL]) || isset($HTTP_POST_VARS[POST_TOPIC_UR
} }
else else
{ {
$topic_id = ""; $topic_id = '';
} }
$confirm = ( $HTTP_POST_VARS['confirm'] ) ? TRUE : 0; $confirm = ( $HTTP_POST_VARS['confirm'] ) ? TRUE : 0;
@ -123,7 +123,7 @@ else
} }
else else
{ {
$mode = ""; $mode = '';
} }
} }
@ -202,14 +202,10 @@ switch($mode)
$topics = ( isset($HTTP_POST_VARS['topic_id_list']) ) ? $HTTP_POST_VARS['topic_id_list'] : array($topic_id); $topics = ( isset($HTTP_POST_VARS['topic_id_list']) ) ? $HTTP_POST_VARS['topic_id_list'] : array($topic_id);
$topic_id_sql = ""; $topic_id_sql = '';
for($i = 0; $i < count($topics); $i++) for($i = 0; $i < count($topics); $i++)
{ {
if( $topic_id_sql != "" ) $topic_id_sql .= ( ( $topic_id_sql != '' ) ? ', ' : '' ) . $topics[$i];
{
$topic_id_sql .= ", ";
}
$topic_id_sql .= $topics[$i];
} }
$sql = "SELECT post_id $sql = "SELECT post_id
@ -217,37 +213,29 @@ switch($mode)
WHERE topic_id IN ($topic_id_sql)"; WHERE topic_id IN ($topic_id_sql)";
if ( !$result = $db->sql_query($sql) ) if ( !$result = $db->sql_query($sql) )
{ {
message_die(GENERAL_ERROR, "Could not get post id information", "", __LINE__, __FILE__, $sql); message_die(GENERAL_ERROR, 'Could not get post id information', '', __LINE__, __FILE__, $sql);
} }
$rowset = $db->sql_fetchrowset($result); $rowset = $db->sql_fetchrowset($result);
$post_id_sql = ""; $post_id_sql = '';
for($i = 0; $i < count($rowset); $i++) for($i = 0; $i < count($rowset); $i++)
{ {
if( $post_id_sql != "" ) $post_id_sql .= ( ( $post_id_sql != '' ) ? ', ' : '' ) . $rowset[$i]['post_id'];
{
$post_id_sql .= ", ";
}
$post_id_sql .= $rowset[$i]['post_id'];
} }
$sql = "SELECT vote_id $sql = "SELECT vote_id
FROM " . VOTE_DESC_TABLE . " FROM " . VOTE_DESC_TABLE . "
WHERE topic_id IN ($topic_id_sql)"; WHERE topic_id IN ($topic_id_sql)";
if( !$result = $db->sql_query($sql) ) if ( !($result = $db->sql_query($sql)) )
{ {
message_die(GENERAL_ERROR, "Could not get vote id information", "", __LINE__, __FILE__, $sql); message_die(GENERAL_ERROR, 'Could not get vote id information', '', __LINE__, __FILE__, $sql);
} }
$rowset = $db->sql_fetchrowset($result); $rowset = $db->sql_fetchrowset($result);
$vote_id_sql = ""; $vote_id_sql = '';
for($i = 0; $i < count($rowset); $i++) for($i = 0; $i < count($rowset); $i++)
{ {
if( $vote_id_sql != "" ) $vote_id_sql .= ( ( $vote_id_sql != '' ) ? ', ' : '' ) . $rowset[$i]['vote_id'];
{
$vote_id_sql .= ", ";
}
$vote_id_sql .= $rowset[$i]['vote_id'];
} }
// //
@ -257,80 +245,79 @@ switch($mode)
FROM " . TOPICS_TABLE . " FROM " . TOPICS_TABLE . "
WHERE topic_id IN ($topic_id_sql) WHERE topic_id IN ($topic_id_sql)
OR topic_moved_id IN ($topic_id_sql)"; OR topic_moved_id IN ($topic_id_sql)";
if( !$result = $db->sql_query($sql, BEGIN_TRANSACTION) ) if ( !($result = $db->sql_query($sql, BEGIN_TRANSACTION)) )
{ {
message_die(GENERAL_ERROR, "Could not delete topics", "", __LINE__, __FILE__, $sql); message_die(GENERAL_ERROR, 'Could not delete topics', '', __LINE__, __FILE__, $sql);
} }
if( $post_id_sql != "" ) if ( $post_id_sql != '' )
{ {
$sql = "DELETE $sql = "DELETE
FROM " . POSTS_TABLE . " FROM " . POSTS_TABLE . "
WHERE post_id IN ($post_id_sql)"; WHERE post_id IN ($post_id_sql)";
if( !$result = $db->sql_query($sql) ) if ( !($result = $db->sql_query($sql)) )
{ {
message_die(GENERAL_ERROR, "Could not delete posts", "", __LINE__, __FILE__, $sql); message_die(GENERAL_ERROR, 'Could not delete posts', '', __LINE__, __FILE__, $sql);
} }
$sql = "DELETE $sql = "DELETE
FROM " . POSTS_TEXT_TABLE . " FROM " . POSTS_TEXT_TABLE . "
WHERE post_id IN ($post_id_sql)"; WHERE post_id IN ($post_id_sql)";
if( !$result = $db->sql_query($sql) ) if ( !($result = $db->sql_query($sql)) )
{ {
message_die(GENERAL_ERROR, "Could not delete posts text", "", __LINE__, __FILE__, $sql); message_die(GENERAL_ERROR, 'Could not delete posts text', '', __LINE__, __FILE__, $sql);
} }
$sql = "DELETE $sql = "DELETE
FROM " . SEARCH_MATCH_TABLE . " FROM " . SEARCH_MATCH_TABLE . "
WHERE post_id IN ($post_id_sql)"; WHERE post_id IN ($post_id_sql)";
if( !$result = $db->sql_query($sql) ) if ( !($result = $db->sql_query($sql)) )
{ {
message_die(GENERAL_ERROR, "Could not delete posts text", "", __LINE__, __FILE__, $sql); message_die(GENERAL_ERROR, 'Could not delete posts text', '', __LINE__, __FILE__, $sql);
} }
// //
// Delete unmatched words // Delete unmatched words
// //
remove_search_post($post_id_sql); remove_search_post($post_id_sql);
} }
if( $vote_id_sql != "" ) if ( $vote_id_sql != '' )
{ {
$sql = "DELETE $sql = "DELETE
FROM " . VOTE_DESC_TABLE . " FROM " . VOTE_DESC_TABLE . "
WHERE vote_id IN ($vote_id_sql)"; WHERE vote_id IN ($vote_id_sql)";
if( !$result = $db->sql_query($sql) ) if ( !($result = $db->sql_query($sql)) )
{ {
message_die(GENERAL_ERROR, "Could not delete vote descriptions", "", __LINE__, __FILE__, $sql); message_die(GENERAL_ERROR, 'Could not delete vote descriptions', '', __LINE__, __FILE__, $sql);
} }
$sql = "DELETE $sql = "DELETE
FROM " . VOTE_RESULTS_TABLE . " FROM " . VOTE_RESULTS_TABLE . "
WHERE vote_id IN ($vote_id_sql)"; WHERE vote_id IN ($vote_id_sql)";
if( !$result = $db->sql_query($sql) ) if ( !($result = $db->sql_query($sql)) )
{ {
message_die(GENERAL_ERROR, "Could not delete vote results", "", __LINE__, __FILE__, $sql); message_die(GENERAL_ERROR, 'Could not delete vote results', '', __LINE__, __FILE__, $sql);
} }
$sql = "DELETE $sql = "DELETE
FROM " . VOTE_USERS_TABLE . " FROM " . VOTE_USERS_TABLE . "
WHERE vote_id IN ($vote_id_sql)"; WHERE vote_id IN ($vote_id_sql)";
if( !$result = $db->sql_query($sql) ) if ( !($result = $db->sql_query($sql)) )
{ {
message_die(GENERAL_ERROR, "Could not delete vote users", "", __LINE__, __FILE__, $sql); message_die(GENERAL_ERROR, 'Could not delete vote users', '', __LINE__, __FILE__, $sql);
} }
} }
$sql = "DELETE $sql = "DELETE
FROM " . TOPICS_WATCH_TABLE . " FROM " . TOPICS_WATCH_TABLE . "
WHERE topic_id IN ($topic_id_sql)"; WHERE topic_id IN ($topic_id_sql)";
if( !$result = $db->sql_query($sql, END_TRANSACTION) ) if ( !($result = $db->sql_query($sql, END_TRANSACTION)) )
{ {
message_die(GENERAL_ERROR, "Could not delete watched post list", "", __LINE__, __FILE__, $sql); message_die(GENERAL_ERROR, 'Could not delete watched post list', '', __LINE__, __FILE__, $sql);
} }
sync("forum", $forum_id); sync('forum', $forum_id);
if ( !empty($topic_id) ) if ( !empty($topic_id) )
{ {
@ -344,10 +331,10 @@ switch($mode)
} }
$template->assign_vars(array( $template->assign_vars(array(
"META" => '<meta http-equiv="refresh" content="3;url=' . $redirect_page . '">') 'META' => '<meta http-equiv="refresh" content="3;url=' . $redirect_page . '">')
); );
message_die(GENERAL_MESSAGE, $lang['Topics_Removed'] . "<br /><br />" . $l_redirect); message_die(GENERAL_MESSAGE, $lang['Topics_Removed'] . '<br /><br />' . $l_redirect);
} }
else else
{ {
@ -355,7 +342,7 @@ switch($mode)
if ( empty($HTTP_POST_VARS['topic_id_list']) && empty($topic_id) ) if ( empty($HTTP_POST_VARS['topic_id_list']) && empty($topic_id) )
{ {
message_die(GENERAL_MESSAGE, $lang['None_selected'], ""); message_die(GENERAL_MESSAGE, $lang['None_selected']);
} }
$hidden_fields = '<input type="hidden" name="mode" value="' . $mode . '" /><input type="hidden" name="' . POST_FORUM_URL . '" value="' . $forum_id . '" />'; $hidden_fields = '<input type="hidden" name="mode" value="' . $mode . '" /><input type="hidden" name="' . POST_FORUM_URL . '" value="' . $forum_id . '" />';
@ -377,21 +364,21 @@ switch($mode)
// Set template files // Set template files
// //
$template->set_filenames(array( $template->set_filenames(array(
"confirm" => "confirm_body.tpl") 'confirm' => 'confirm_body.tpl')
); );
$template->assign_vars(array( $template->assign_vars(array(
"MESSAGE_TITLE" => $lang['Confirm'], 'MESSAGE_TITLE' => $lang['Confirm'],
"MESSAGE_TEXT" => $lang['Confirm_delete_topic'], 'MESSAGE_TEXT' => $lang['Confirm_delete_topic'],
"L_YES" => $lang['Yes'], 'L_YES' => $lang['Yes'],
"L_NO" => $lang['No'], 'L_NO' => $lang['No'],
"S_CONFIRM_ACTION" => append_sid("modcp.$phpEx"), 'S_CONFIRM_ACTION' => append_sid("modcp.$phpEx"),
"S_HIDDEN_FIELDS" => $hidden_fields) 'S_HIDDEN_FIELDS' => $hidden_fields)
); );
$template->pparse("confirm"); $template->pparse('confirm');
include($phpbb_root_path . 'includes/page_tail.'.$phpEx); include($phpbb_root_path . 'includes/page_tail.'.$phpEx);
} }
@ -410,14 +397,10 @@ switch($mode)
{ {
$topics = ( isset($HTTP_POST_VARS['topic_id_list']) ) ? $HTTP_POST_VARS['topic_id_list'] : array($topic_id); $topics = ( isset($HTTP_POST_VARS['topic_id_list']) ) ? $HTTP_POST_VARS['topic_id_list'] : array($topic_id);
$topic_list = ""; $topic_list = '';
for($i = 0; $i < count($topics); $i++) for($i = 0; $i < count($topics); $i++)
{ {
if( $topic_list != "" ) $topic_list .= ( ( $topic_list != '' ) ? ', ' : '' ) . $topics[$i];
{
$topic_list .= ", ";
}
$topic_list .= $topics[$i];
} }
$sql_select = "SELECT * $sql_select = "SELECT *
@ -425,9 +408,9 @@ switch($mode)
WHERE topic_id IN ($topic_list) WHERE topic_id IN ($topic_list)
AND topic_moved_id = 0"; AND topic_moved_id = 0";
if( !$result = $db->sql_query($sql_select, BEGIN_TRANSACTION) ) if ( !($result = $db->sql_query($sql_select, BEGIN_TRANSACTION)) )
{ {
message_die(GENERAL_ERROR, "Could not select from topic table!", "Error", __LINE__, __FILE__, $sql_select); message_die(GENERAL_ERROR, 'Could not select from topic table', '', __LINE__, __FILE__, $sql_select);
} }
$row = $db->sql_fetchrowset($result); $row = $db->sql_fetchrowset($result);
@ -442,39 +425,39 @@ switch($mode)
// Insert topic in the old forum that indicates that the forum has moved. // Insert topic in the old forum that indicates that the forum has moved.
$sql = "INSERT INTO " . TOPICS_TABLE . " (forum_id, topic_title, topic_poster, topic_time, topic_status, topic_type, topic_vote, topic_views, topic_replies, topic_first_post_id, topic_last_post_id, topic_moved_id) $sql = "INSERT INTO " . TOPICS_TABLE . " (forum_id, topic_title, topic_poster, topic_time, topic_status, topic_type, topic_vote, topic_views, topic_replies, topic_first_post_id, topic_last_post_id, topic_moved_id)
VALUES ($old_forum_id, '" . addslashes(str_replace("\'", "''", $row[$i]['topic_title'])) . "', '" . str_replace("\'", "''", $row[$i]['topic_poster']) . "', " . $row[$i]['topic_time'] . ", " . TOPIC_MOVED . ", " . POST_NORMAL . ", " . $row[$i]['topic_vote'] . ", " . $row[$i]['topic_views'] . ", " . $row[$i]['topic_replies'] . ", " . $row[$i]['topic_first_post_id'] . ", " . $row[$i]['topic_last_post_id'] . ", $topic_id)"; VALUES ($old_forum_id, '" . addslashes(str_replace("\'", "''", $row[$i]['topic_title'])) . "', '" . str_replace("\'", "''", $row[$i]['topic_poster']) . "', " . $row[$i]['topic_time'] . ", " . TOPIC_MOVED . ", " . POST_NORMAL . ", " . $row[$i]['topic_vote'] . ", " . $row[$i]['topic_views'] . ", " . $row[$i]['topic_replies'] . ", " . $row[$i]['topic_first_post_id'] . ", " . $row[$i]['topic_last_post_id'] . ", $topic_id)";
if( !$result = $db->sql_query($sql) ) if ( !($result = $db->sql_query($sql)) )
{ {
message_die(GENERAL_ERROR, "Could not insert shadow topic", "Error", __LINE__, __FILE__, $sql); message_die(GENERAL_ERROR, 'Could not insert shadow topic', '', __LINE__, __FILE__, $sql);
} }
} }
$sql = "UPDATE " . TOPICS_TABLE . " $sql = "UPDATE " . TOPICS_TABLE . "
SET forum_id = $new_forum_id SET forum_id = $new_forum_id
WHERE topic_id = $topic_id"; WHERE topic_id = $topic_id";
if( !$result = $db->sql_query($sql) ) if ( !($result = $db->sql_query($sql)) )
{ {
message_die(GENERAL_ERROR, "Could not update old topic", "Error", __LINE__, __FILE__, $sql); message_die(GENERAL_ERROR, 'Could not update old topic', '', __LINE__, __FILE__, $sql);
} }
$sql = "UPDATE " . POSTS_TABLE . " $sql = "UPDATE " . POSTS_TABLE . "
SET forum_id = $new_forum_id SET forum_id = $new_forum_id
WHERE topic_id = $topic_id"; WHERE topic_id = $topic_id";
if( !$result = $db->sql_query($sql) ) if ( !($result = $db->sql_query($sql)) )
{ {
message_die(GENERAL_ERROR, "Could not update post topic ids", "Error", __LINE__, __FILE__, $sql); message_die(GENERAL_ERROR, 'Could not update post topic ids', '', __LINE__, __FILE__, $sql);
} }
} }
// Sync the forum indexes // Sync the forum indexes
sync("forum", $new_forum_id); sync('forum', $new_forum_id);
sync("forum", $old_forum_id); sync('forum', $old_forum_id);
$message = $lang['Topics_Moved'] . "<br /><br />"; $message = $lang['Topics_Moved'] . '<br /><br />';
} }
else else
{ {
$message = $lang['No_Topics_Moved'] . "<br /><br />"; $message = $lang['No_Topics_Moved'] . '<br /><br />';
} }
if ( !empty($topic_id) ) if ( !empty($topic_id) )
@ -488,10 +471,10 @@ switch($mode)
$message .= sprintf($lang['Click_return_modcp'], '<a href="' . $redirect_page . '">', '</a>'); $message .= sprintf($lang['Click_return_modcp'], '<a href="' . $redirect_page . '">', '</a>');
} }
$message = $message . "<br \><br \>" . sprintf($lang['Click_return_forum'], '<a href="' . append_sid("viewforum.$phpEx?" . POST_FORUM_URL . "=$old_forum_id") . '">', '</a>'); $message = $message . '<br \><br \>' . sprintf($lang['Click_return_forum'], '<a href="' . append_sid("viewforum.$phpEx?" . POST_FORUM_URL . "=$old_forum_id") . '">', '</a>');
$template->assign_vars(array( $template->assign_vars(array(
"META" => '<meta http-equiv="refresh" content="3;url=' . $redirect_page . '">') 'META' => '<meta http-equiv="refresh" content="3;url=' . $redirect_page . '">')
); );
message_die(GENERAL_MESSAGE, $message); message_die(GENERAL_MESSAGE, $message);
@ -523,21 +506,21 @@ switch($mode)
// Set template files // Set template files
// //
$template->set_filenames(array( $template->set_filenames(array(
"movetopic" => "modcp_move.tpl") 'movetopic' => 'modcp_move.tpl')
); );
$template->assign_vars(array( $template->assign_vars(array(
"MESSAGE_TITLE" => $lang['Confirm'], 'MESSAGE_TITLE' => $lang['Confirm'],
"MESSAGE_TEXT" => $lang['Confirm_move_topic'], 'MESSAGE_TEXT' => $lang['Confirm_move_topic'],
"L_MOVE_TO_FORUM" => $lang['Move_to_forum'], 'L_MOVE_TO_FORUM' => $lang['Move_to_forum'],
"L_LEAVESHADOW" => $lang['Leave_shadow_topic'], 'L_LEAVESHADOW' => $lang['Leave_shadow_topic'],
"L_YES" => $lang['Yes'], 'L_YES' => $lang['Yes'],
"L_NO" => $lang['No'], 'L_NO' => $lang['No'],
"S_FORUM_BOX" => make_forum_select("new_forum", $forum_id), 'S_FORUM_BOX' => make_forum_select('new_forum', $forum_id),
"S_MODCP_ACTION" => append_sid("modcp.$phpEx"), 'S_MODCP_ACTION' => append_sid("modcp.$phpEx"),
"S_HIDDEN_FIELDS" => $hidden_fields) 'S_HIDDEN_FIELDS' => $hidden_fields)
); );
$template->pparse("movetopic"); $template->pparse("movetopic");
@ -549,23 +532,19 @@ switch($mode)
case 'lock': case 'lock':
$topics = ( isset($HTTP_POST_VARS['topic_id_list']) ) ? $HTTP_POST_VARS['topic_id_list'] : array($topic_id); $topics = ( isset($HTTP_POST_VARS['topic_id_list']) ) ? $HTTP_POST_VARS['topic_id_list'] : array($topic_id);
$topic_id_sql = ""; $topic_id_sql = '';
for($i = 0; $i < count($topics); $i++) for($i = 0; $i < count($topics); $i++)
{ {
if( $topic_id_sql != "") $topic_id_sql .= ( ( $topic_id_sql != '' ) ? ', ' : '' ) . $topics[$i];
{
$topic_id_sql .= ", ";
}
$topic_id_sql .= $topics[$i];
} }
$sql = "UPDATE " . TOPICS_TABLE . " $sql = "UPDATE " . TOPICS_TABLE . "
SET topic_status = " . TOPIC_LOCKED . " SET topic_status = " . TOPIC_LOCKED . "
WHERE topic_id IN ($topic_id_sql) WHERE topic_id IN ($topic_id_sql)
AND topic_moved_id = 0"; AND topic_moved_id = 0";
if( !$result = $db->sql_query($sql) ) if ( !($result = $db->sql_query($sql)) )
{ {
message_die(GENERAL_ERROR, "Coule not update topics table!", "Error", __LINE__, __FILE__, $sql); message_die(GENERAL_ERROR, 'Could not update topics table', '', __LINE__, __FILE__, $sql);
} }
if ( !empty($topic_id) ) if ( !empty($topic_id) )
@ -579,36 +558,32 @@ switch($mode)
$message = sprintf($lang['Click_return_modcp'], '<a href="' . $redirect_page . '">', '</a>'); $message = sprintf($lang['Click_return_modcp'], '<a href="' . $redirect_page . '">', '</a>');
} }
$message = $message . "<br \><br \>" . sprintf($lang['Click_return_forum'], '<a href="' . append_sid("viewforum.$phpEx?" . POST_FORUM_URL . "=$forum_id") . '">', '</a>'); $message = $message . '<br \><br \>' . sprintf($lang['Click_return_forum'], '<a href="' . append_sid("viewforum.$phpEx?" . POST_FORUM_URL . "=$forum_id") . '">', '</a>');
$template->assign_vars(array( $template->assign_vars(array(
"META" => '<meta http-equiv="refresh" content="3;url=' . $redirect_page . '">') 'META' => '<meta http-equiv="refresh" content="3;url=' . $redirect_page . '">')
); );
message_die(GENERAL_MESSAGE, $lang['Topics_Locked'] . "<br /><br />" . $message); message_die(GENERAL_MESSAGE, $lang['Topics_Locked'] . '<br /><br />' . $message);
break; break;
case 'unlock': case 'unlock':
$topics = ( isset($HTTP_POST_VARS['topic_id_list']) ) ? $HTTP_POST_VARS['topic_id_list'] : array($topic_id); $topics = ( isset($HTTP_POST_VARS['topic_id_list']) ) ? $HTTP_POST_VARS['topic_id_list'] : array($topic_id);
$topic_id_sql = ""; $topic_id_sql = '';
for($i = 0; $i < count($topics); $i++) for($i = 0; $i < count($topics); $i++)
{ {
if( $topic_id_sql != "") $topic_id_sql .= ( ( $topic_id_sql != "") ? ', ' : '' ) . $topics[$i];
{
$topic_id_sql .= ", ";
}
$topic_id_sql .= $topics[$i];
} }
$sql = "UPDATE " . TOPICS_TABLE . " $sql = "UPDATE " . TOPICS_TABLE . "
SET topic_status = " . TOPIC_UNLOCKED . " SET topic_status = " . TOPIC_UNLOCKED . "
WHERE topic_id IN ($topic_id_sql) WHERE topic_id IN ($topic_id_sql)
AND topic_moved_id = 0"; AND topic_moved_id = 0";
if( !$result = $db->sql_query($sql) ) if ( !($result = $db->sql_query($sql)) )
{ {
message_die(GENERAL_ERROR, "Could not update topics table!", "Error", __LINE__, __FILE__, $sql); message_die(GENERAL_ERROR, 'Could not update topics table', '', __LINE__, __FILE__, $sql);
} }
if ( !empty($topic_id) ) if ( !empty($topic_id) )
@ -622,13 +597,13 @@ switch($mode)
$message = sprintf($lang['Click_return_modcp'], '<a href="' . $redirect_page . '">', '</a>'); $message = sprintf($lang['Click_return_modcp'], '<a href="' . $redirect_page . '">', '</a>');
} }
$message = $message . "<br \><br \>" . sprintf($lang['Click_return_forum'], '<a href="' . append_sid("viewforum.$phpEx?" . POST_FORUM_URL . "=$forum_id") . '">', '</a>'); $message = $message . '<br \><br \>' . sprintf($lang['Click_return_forum'], '<a href="' . append_sid("viewforum.$phpEx?" . POST_FORUM_URL . "=$forum_id") . '">', '</a>');
$template->assign_vars(array( $template->assign_vars(array(
"META" => '<meta http-equiv="refresh" content="3;url=' . $redirect_page . '">') 'META' => '<meta http-equiv="refresh" content="3;url=' . $redirect_page . '">')
); );
message_die(GENERAL_MESSAGE, $lang['Topics_Unlocked'] . "<br /><br />" . $message); message_die(GENERAL_MESSAGE, $lang['Topics_Unlocked'] . '<br /><br />' . $message);
break; break;
@ -636,16 +611,16 @@ switch($mode)
$page_title = $lang['Mod_CP']; $page_title = $lang['Mod_CP'];
include($phpbb_root_path . 'includes/page_header.'.$phpEx); include($phpbb_root_path . 'includes/page_header.'.$phpEx);
if( $HTTP_POST_VARS['split_type_all'] || $HTTP_POST_VARS['split_type_beyond'] ) if ( isset($HTTP_POST_VARS['split_type_all']) || isset($HTTP_POST_VARS['split_type_beyond']) )
{ {
$posts = $HTTP_POST_VARS['post_id_list']; $posts = $HTTP_POST_VARS['post_id_list'];
$sql = "SELECT poster_id, topic_id, post_time $sql = "SELECT poster_id, topic_id, post_time
FROM " . POSTS_TABLE . " FROM " . POSTS_TABLE . "
WHERE post_id = " . $posts[0]; WHERE post_id = " . $posts[0];
if(!$result = $db->sql_query($sql)) if ( !($result = $db->sql_query($sql)) )
{ {
message_die(GENERAL_ERROR, "Could not get post information", "", __LINE__, __FILE__, $sql); message_die(GENERAL_ERROR, 'Could not get post information', '', __LINE__, __FILE__, $sql);
} }
$post_rowset = $db->sql_fetchrow($result); $post_rowset = $db->sql_fetchrow($result);
@ -654,7 +629,7 @@ switch($mode)
$post_time = $post_rowset['post_time']; $post_time = $post_rowset['post_time'];
$post_subject = trim(strip_tags($HTTP_POST_VARS['subject'])); $post_subject = trim(strip_tags($HTTP_POST_VARS['subject']));
if( empty($subject) ) if ( empty($post_subject) )
{ {
message_die(GENERAL_MESSAGE, $lang['Empty_subject']); message_die(GENERAL_MESSAGE, $lang['Empty_subject']);
} }
@ -664,30 +639,26 @@ switch($mode)
$sql = "INSERT INTO " . TOPICS_TABLE . " (topic_title, topic_poster, topic_time, forum_id, topic_status, topic_type) $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 . ")"; VALUES ('" . str_replace("\'", "''", $post_subject) . "', $first_poster, " . $topic_time . ", $new_forum_id, " . TOPIC_UNLOCKED . ", " . POST_NORMAL . ")";
if(!$result = $db->sql_query($sql, BEGIN_TRANSACTION)) if ( !($result = $db->sql_query($sql, BEGIN_TRANSACTION)) )
{ {
message_die(GENERAL_ERROR, "Could not insert new topic", "", __LINE__, __FILE__, $sql); message_die(GENERAL_ERROR, 'Could not insert new topic', '', __LINE__, __FILE__, $sql);
} }
$new_topic_id = $db->sql_nextid(); $new_topic_id = $db->sql_nextid();
if( $HTTP_POST_VARS['split_type_all'] ) if( !empty($HTTP_POST_VARS['split_type_all']) )
{ {
$post_id_sql = ""; $post_id_sql = '';
for($i = 0; $i < count($posts); $i++) for($i = 0; $i < count($posts); $i++)
{ {
if( $post_id_sql != "" ) $post_id_sql .= ( ( $post_id_sql != '' ) ? ', ' : '' ) . $posts[$i];
{
$post_id_sql .= ", ";
}
$post_id_sql .= $posts[$i];
} }
$sql = "UPDATE " . POSTS_TABLE . " $sql = "UPDATE " . POSTS_TABLE . "
SET topic_id = $new_topic_id, forum_id = $new_forum_id SET topic_id = $new_topic_id, forum_id = $new_forum_id
WHERE post_id IN ($post_id_sql)"; WHERE post_id IN ($post_id_sql)";
} }
else if( $HTTP_POST_VARS['split_type_beyond'] ) else if( !empty($HTTP_POST_VARS['split_type_beyond']) )
{ {
$sql = "UPDATE " . POSTS_TABLE . " $sql = "UPDATE " . POSTS_TABLE . "
SET topic_id = $new_topic_id, forum_id = $new_forum_id SET topic_id = $new_topic_id, forum_id = $new_forum_id
@ -695,21 +666,21 @@ switch($mode)
AND topic_id = $topic_id"; AND topic_id = $topic_id";
} }
if( !$result = $db->sql_query($sql, END_TRANSACTION) ) if( !($result = $db->sql_query($sql, END_TRANSACTION)) )
{ {
message_die(GENERAL_ERROR, "Could not update posts table!", "", __LINE__, __FILE__, $sql); message_die(GENERAL_ERROR, 'Could not update posts table', '', __LINE__, __FILE__, $sql);
} }
sync("topic", $new_topic_id); sync('topic', $new_topic_id);
sync("topic", $topic_id); sync('topic', $topic_id);
sync("forum", $new_forum_id); sync('forum', $new_forum_id);
sync("forum", $forum_id); sync('forum', $forum_id);
$template->assign_vars(array( $template->assign_vars(array(
"META" => '<meta http-equiv="refresh" content="3;url=' . append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id") . '">') 'META' => '<meta http-equiv="refresh" content="3;url=' . append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id") . '">')
); );
$message = $lang['Topic_split'] . "<br /><br />" . sprintf($lang['Click_return_topic'], '<a href="' . append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id") . '">', '</a>'); $message = $lang['Topic_split'] . '<br /><br />' . sprintf($lang['Click_return_topic'], '<a href="' . append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id") . '">', '</a>');
message_die(GENERAL_MESSAGE, $message); message_die(GENERAL_MESSAGE, $message);
} }
else else
@ -718,7 +689,7 @@ switch($mode)
// Set template files // Set template files
// //
$template->set_filenames(array( $template->set_filenames(array(
"split_body" => "modcp_split.tpl") 'split_body' => 'modcp_split.tpl')
); );
$sql = "SELECT u.username, p.*, pt.post_text, pt.bbcode_uid, pt.post_subject, p.post_username $sql = "SELECT u.username, p.*, pt.post_text, pt.bbcode_uid, pt.post_subject, p.post_username
@ -727,9 +698,9 @@ switch($mode)
AND p.poster_id = u.user_id AND p.poster_id = u.user_id
AND p.post_id = pt.post_id AND p.post_id = pt.post_id
ORDER BY p.post_time ASC"; ORDER BY p.post_time ASC";
if(!$result = $db->sql_query($sql)) if ( !($result = $db->sql_query($sql)) )
{ {
message_die(GENERAL_ERROR, "Could not get topic/post information", "", __LINE__, __FILE__, $sql); message_die(GENERAL_ERROR, 'Could not get topic/post information', '', __LINE__, __FILE__, $sql);
} }
$s_hidden_fields = '<input type="hidden" name="' . POST_FORUM_URL . '" value="' . $forum_id . '" /><input type="hidden" name="mode" value="split" />'; $s_hidden_fields = '<input type="hidden" name="' . POST_FORUM_URL . '" value="' . $forum_id . '" /><input type="hidden" name="mode" value="split" />';
@ -739,28 +710,28 @@ switch($mode)
$postrow = $db->sql_fetchrowset($result); $postrow = $db->sql_fetchrowset($result);
$template->assign_vars(array( $template->assign_vars(array(
"L_SPLIT_TOPIC" => $lang['Split_Topic'], 'L_SPLIT_TOPIC' => $lang['Split_Topic'],
"L_SPLIT_TOPIC_EXPLAIN" => $lang['Split_Topic_explain'], 'L_SPLIT_TOPIC_EXPLAIN' => $lang['Split_Topic_explain'],
"L_AUTHOR" => $lang['Author'], 'L_AUTHOR' => $lang['Author'],
"L_MESSAGE" => $lang['Message'], 'L_MESSAGE' => $lang['Message'],
"L_SELECT" => $lang['Select'], 'L_SELECT' => $lang['Select'],
"L_SPLIT_SUBJECT" => $lang['Split_title'], 'L_SPLIT_SUBJECT' => $lang['Split_title'],
"L_SPLIT_FORUM" => $lang['Split_forum'], 'L_SPLIT_FORUM' => $lang['Split_forum'],
"L_POSTED" => $lang['Posted'], 'L_POSTED' => $lang['Posted'],
"L_SPLIT_POSTS" => $lang['Split_posts'], 'L_SPLIT_POSTS' => $lang['Split_posts'],
"L_SUBMIT" => $lang['Submit'], 'L_SUBMIT' => $lang['Submit'],
"L_SPLIT_AFTER" => $lang['Split_after'], 'L_SPLIT_AFTER' => $lang['Split_after'],
"L_POST_SUBJECT" => $lang['Post_subject'], 'L_POST_SUBJECT' => $lang['Post_subject'],
"L_MARK_ALL" => $lang['Mark_all'], 'L_MARK_ALL' => $lang['Mark_all'],
"L_UNMARK_ALL" => $lang['Unmark_all'], 'L_UNMARK_ALL' => $lang['Unmark_all'],
"FORUM_NAME" => $forum_name, 'FORUM_NAME' => $forum_name,
"U_VIEW_FORUM" => append_sid("viewforum.$phpEx?" . POST_FORUM_URL . "=$forum_id"), 'U_VIEW_FORUM' => append_sid("viewforum.$phpEx?" . POST_FORUM_URL . "=$forum_id"),
"S_SPLIT_ACTION" => append_sid("modcp.$phpEx"), 'S_SPLIT_ACTION' => append_sid("modcp.$phpEx"),
"S_HIDDEN_FIELDS" => $s_hidden_fields, 'S_HIDDEN_FIELDS' => $s_hidden_fields,
"S_FORUM_SELECT" => make_forum_select("new_forum_id")) 'S_FORUM_SELECT' => make_forum_select("new_forum_id"))
); );
for($i = 0; $i < $total_posts; $i++) for($i = 0; $i < $total_posts; $i++)
@ -773,7 +744,7 @@ switch($mode)
$bbcode_uid = $postrow[$i]['bbcode_uid']; $bbcode_uid = $postrow[$i]['bbcode_uid'];
$message = $postrow[$i]['post_text']; $message = $postrow[$i]['post_text'];
$post_subject = ( $postrow[$i]['post_subject'] != "" ) ? $postrow[$i]['post_subject'] : $topic_title; $post_subject = ( $postrow[$i]['post_subject'] != '' ) ? $postrow[$i]['post_subject'] : $topic_title;
// //
// If the board has HTML off but the post has HTML // If the board has HTML off but the post has HTML
@ -783,13 +754,13 @@ switch($mode)
{ {
if ( $postrow[$i]['enable_html'] ) if ( $postrow[$i]['enable_html'] )
{ {
$message = preg_replace("#(<)([\/]?.*?)(>)#is", "&lt;\\2&gt;", $message); $message = preg_replace('#(<)([\/]?.*?)(>)#is', '&lt;\\2&gt;', $message);
} }
} }
if( $bbcode_uid != "" ) if ( $bbcode_uid != '' )
{ {
$message = ( $board_config['allow_bbcode'] ) ? bbencode_second_pass($message, $bbcode_uid) : preg_replace("/\:[0-9a-z\:]+\]/si", "]", $message); $message = ( $board_config['allow_bbcode'] ) ? bbencode_second_pass($message, $bbcode_uid) : preg_replace('/\:[0-9a-z\:]+\]/si', ']', $message);
} }
// //
@ -812,33 +783,26 @@ switch($mode)
$message = smilies_pass($message); $message = smilies_pass($message);
} }
$message = str_replace("\n", "<br />", $message); $message = str_replace("\n", '<br />', $message);
$row_color = ( !($i % 2) ) ? $theme['td_color1'] : $theme['td_color2']; $row_color = ( !($i % 2) ) ? $theme['td_color1'] : $theme['td_color2'];
$row_class = ( !($i % 2) ) ? $theme['td_class1'] : $theme['td_class2']; $row_class = ( !($i % 2) ) ? $theme['td_class1'] : $theme['td_class2'];
if($i > 1 || $total_posts > 1) $checkbox = ( $i > 1 || $total_posts > 1 ) ? '<input type="checkbox" name="post_id_list[]" value="' . $post_id . '" />' : '&nbsp;';
{
$checkbox = '<input type="checkbox" name="post_id_list[]" value="' . $post_id . '" />';
}
else
{
$checkbox = '&nbsp;';
}
$template->assign_block_vars("postrow", array( $template->assign_block_vars('postrow', array(
"ROW_COLOR" => "#" . $row_color, 'ROW_COLOR' => '#' . $row_color,
"ROW_CLASS" => $row_class, 'ROW_CLASS' => $row_class,
"POSTER_NAME" => $poster, 'POSTER_NAME' => $poster,
"POST_DATE" => $post_date, 'POST_DATE' => $post_date,
"POST_SUBJECT" => $post_subject, 'POST_SUBJECT' => $post_subject,
"MESSAGE" => $message, 'MESSAGE' => $message,
"SPLIT_CHECKBOX" => $checkbox, 'SPLIT_CHECKBOX' => $checkbox,
"POST_ID" => $post_id) 'POST_ID' => $post_id)
); );
} }
$template->pparse("split_body"); $template->pparse('split_body');
} }
} }
break; break;
@ -851,73 +815,72 @@ switch($mode)
if ( !$post_id ) if ( !$post_id )
{ {
message_die(GENERAL_ERROR, "Error, no post id found", "Error", __LINE__, __FILE__); message_die(GENERAL_MESSAGE, $lang['No_such_post']);
} }
// //
// Set template files // Set template files
// //
$template->set_filenames(array( $template->set_filenames(array(
"viewip" => "modcp_viewip.tpl") 'viewip' => 'modcp_viewip.tpl')
); );
// Look up relevent data for this post // Look up relevent data for this post
$sql = "SELECT poster_ip, poster_id $sql = "SELECT poster_ip, poster_id
FROM " . POSTS_TABLE . " FROM " . POSTS_TABLE . "
WHERE post_id = $post_id"; WHERE post_id = $post_id";
if(!$result = $db->sql_query($sql)) if ( !($result = $db->sql_query($sql)) )
{ {
message_die(GENERAL_ERROR, "Could not get poster IP information", "Error", __LINE__, __FILE__, $sql); message_die(GENERAL_ERROR, 'Could not get poster IP information', '', __LINE__, __FILE__, $sql);
} }
if($db->sql_numrows($result) == 0) if ( !($post_row = $db->sql_fetchrow($result)) )
{ {
message_die(GENERAL_ERROR, "Post doesn't exist", "Error", __LINE__, __FILE__); message_die(GENERAL_MESSAGE, $lang['No_such_post']);
} }
$post_row = $db->sql_fetchrow($result);
$ip_this_post = decode_ip($post_row['poster_ip']); $ip_this_post = decode_ip($post_row['poster_ip']);
$ip_this_post = ( $rdns_ip_num == $ip_this_post ) ? 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']; $poster_id = $post_row['poster_id'];
$template->assign_vars(array( $template->assign_vars(array(
"L_IP_INFO" => $lang['IP_info'], 'L_IP_INFO' => $lang['IP_info'],
"L_THIS_POST_IP" => $lang['This_posts_IP'], 'L_THIS_POST_IP' => $lang['This_posts_IP'],
"L_OTHER_IPS" => $lang['Other_IP_this_user'], 'L_OTHER_IPS' => $lang['Other_IP_this_user'],
"L_OTHER_USERS" => $lang['Users_this_IP'], 'L_OTHER_USERS' => $lang['Users_this_IP'],
"L_LOOKUP_IP" => $lang['Lookup_IP'], 'L_LOOKUP_IP' => $lang['Lookup_IP'],
"L_SEARCH" => $lang['Search'], 'L_SEARCH' => $lang['Search'],
"SEARCH_IMG" => $images['icon_search'], 'SEARCH_IMG' => $images['icon_search'],
"IP" => $ip_this_post, 'IP' => $ip_this_post,
"U_LOOKUP_IP" => append_sid("modcp.$phpEx?mode=ip&amp;" . POST_POST_URL . "=$post_id&amp;" . POST_TOPIC_URL . "=$topic_id&amp;rdns=" . $ip_this_post)) 'U_LOOKUP_IP' => append_sid("modcp.$phpEx?mode=ip&amp;" . POST_POST_URL . "=$post_id&amp;" . POST_TOPIC_URL . "=$topic_id&amp;rdns=" . $ip_this_post))
); );
// //
// Get other IP's this user has posted under // Get other IP's this user has posted under
// //
$sql = "SELECT poster_ip, count(*) as postings $sql = "SELECT poster_ip, COUNT(*) AS postings
FROM " . POSTS_TABLE . " FROM " . POSTS_TABLE . "
WHERE poster_id = $poster_id WHERE poster_id = $poster_id
GROUP BY (poster_ip) GROUP BY poster_ip
ORDER BY postings DESC"; ORDER BY postings DESC";
if(!$result = $db->sql_query($sql)) if ( !($result = $db->sql_query($sql)) )
{ {
message_die(GENERAL_ERROR, "Could not get IP information for this user", "Error", __LINE__, __FILE__, $sql); message_die(GENERAL_ERROR, 'Could not get IP information for this user', '', __LINE__, __FILE__, $sql);
} }
$poster_ips = $db->sql_fetchrowset($result); $poster_ips = $db->sql_fetchrowset($result);
$j = 0; $j = 0;
for($i = 0; $i < count($poster_ips); $i++) for($i = 0; $i < count($poster_ips); $i++)
{ {
if ( $poster_ips[$i]['poster_ip'] == $post_row['poster_ip'] ) if ( $poster_ips[$i]['poster_ip'] == $post_row['poster_ip'] )
{ {
$template->assign_vars(array( $template->assign_vars(array(
"POSTINGS" => $poster_ips[$i]['postings'] . " " .$lang['Posts']) 'POSTINGS' => $poster_ips[$i]['postings'] . ' ' .$lang['Posts'])
); );
continue; continue;
} }
@ -928,13 +891,13 @@ switch($mode)
$row_color = ( !($j % 2) ) ? $theme['td_color1'] : $theme['td_color2']; $row_color = ( !($j % 2) ) ? $theme['td_color1'] : $theme['td_color2'];
$row_class = ( !($j % 2) ) ? $theme['td_class1'] : $theme['td_class2']; $row_class = ( !($j % 2) ) ? $theme['td_class1'] : $theme['td_class2'];
$template->assign_block_vars("iprow", array( $template->assign_block_vars('iprow', array(
"ROW_COLOR" => "#" . $row_color, 'ROW_COLOR' => '#' . $row_color,
"ROW_CLASS" => $row_class, 'ROW_CLASS' => $row_class,
"IP" => $ip, 'IP' => $ip,
"POSTINGS" => $poster_ips[$i]['postings'] . " " .$lang['Posts'], 'POSTINGS' => $poster_ips[$i]['postings'] . ' ' .$lang['Posts'],
"U_LOOKUP_IP" => append_sid("modcp.$phpEx?mode=ip&amp;" . POST_POST_URL . "=$post_id&amp;" . POST_TOPIC_URL . "=$topic_id&amp;rdns=" . $poster_ips[$i]['poster_ip'])) 'U_LOOKUP_IP' => append_sid("modcp.$phpEx?mode=ip&amp;" . POST_POST_URL . "=$post_id&amp;" . POST_TOPIC_URL . "=$topic_id&amp;rdns=" . $poster_ips[$i]['poster_ip']))
); );
} }
@ -947,12 +910,13 @@ switch($mode)
AND p.poster_ip = '" . $post_row['poster_ip'] . "' AND p.poster_ip = '" . $post_row['poster_ip'] . "'
GROUP BY u.user_id, u.username GROUP BY u.user_id, u.username
ORDER BY postings DESC"; ORDER BY postings DESC";
if(!$result = $db->sql_query($sql)) if ( !($result = $db->sql_query($sql)) )
{ {
message_die(GENERAL_ERROR, "Could not get posters information based on IP", "Error", __LINE__, __FILE__, $sql); message_die(GENERAL_ERROR, 'Could not get posters information based on IP', '', __LINE__, __FILE__, $sql);
} }
$poster_ids = $db->sql_fetchrowset($result); $poster_ids = $db->sql_fetchrowset($result);
for($i = 0; $i < count($poster_ids); $i++) for($i = 0; $i < count($poster_ids); $i++)
{ {
$id = $poster_ids[$i]['user_id']; $id = $poster_ids[$i]['user_id'];
@ -961,15 +925,15 @@ switch($mode)
$row_color = ( !($i % 2) ) ? $theme['td_color1'] : $theme['td_color2']; $row_color = ( !($i % 2) ) ? $theme['td_color1'] : $theme['td_color2'];
$row_class = ( !($i % 2) ) ? $theme['td_class1'] : $theme['td_class2']; $row_class = ( !($i % 2) ) ? $theme['td_class1'] : $theme['td_class2'];
$template->assign_block_vars("userrow", array( $template->assign_block_vars('userrow', array(
"ROW_COLOR" => "#" . $row_color, 'ROW_COLOR' => '#' . $row_color,
"ROW_CLASS" => $row_class, 'ROW_CLASS' => $row_class,
"USERNAME" => $username, 'USERNAME' => $username,
"POSTINGS" => $poster_ids[$i]['postings'] . " " .$lang['Posts'], 'POSTINGS' => $poster_ids[$i]['postings'] . ' ' .$lang['Posts'],
"L_SEARCH_POSTS" => sprintf($lang['Search_user_posts'], $username), 'L_SEARCH_POSTS' => sprintf($lang['Search_user_posts'], $username),
"U_PROFILE" => append_sid("profile.$phpEx?mode=viewprofile&amp;" . POST_USERS_URL . "=$id"), 'U_PROFILE' => append_sid("profile.$phpEx?mode=viewprofile&amp;" . POST_USERS_URL . "=$id"),
"U_SEARCHPOSTS" => append_sid("search.$phpEx?search_author=" . urlencode($username) . "&amp;showresults=topics")) 'U_SEARCHPOSTS' => append_sid("search.$phpEx?search_author=" . urlencode($username) . "&amp;showresults=topics"))
); );
} }
@ -988,29 +952,23 @@ switch($mode)
include($phpbb_root_path . 'includes/page_header.'.$phpEx); include($phpbb_root_path . 'includes/page_header.'.$phpEx);
$template->assign_vars(array( $template->assign_vars(array(
"FORUM_NAME" => $forum_name, 'FORUM_NAME' => $forum_name,
"U_VIEW_FORUM" => append_sid("viewforum.$phpEx?" . POST_FORUM_URL . "=$forum_id")) 'L_MOD_CP' => $lang['Mod_CP'],
'L_MOD_CP_EXPLAIN' => $lang['Mod_CP_explain'],
'L_SELECT' => $lang['Select'],
'L_DELETE' => $lang['Delete'],
'L_MOVE' => $lang['Move'],
'L_LOCK' => $lang['Lock'],
'L_UNLOCK' => $lang['Unlock'],
'U_VIEW_FORUM' => append_sid("viewforum.$phpEx?" . POST_FORUM_URL . "=$forum_id"),
'S_HIDDEN_FIELDS' => '<input type="hidden" name="' . POST_FORUM_URL . '" value="' . $forum_id . '">',
'S_MODCP_ACTION' => append_sid("modcp.$phpEx"))
); );
$template->assign_vars(array(
"L_MOD_CP" => $lang['Mod_CP'],
"L_MOD_CP_EXPLAIN" => $lang['Mod_CP_explain'],
"L_SELECT" => $lang['Select'],
"L_DELETE" => $lang['Delete'],
"L_MOVE" => $lang['Move'],
"L_LOCK" => $lang['Lock'],
"L_UNLOCK" => $lang['Unlock'],
"S_HIDDEN_FIELDS" => "<input type=\"hidden\" name=\"" . POST_FORUM_URL . "\" value=\"$forum_id\">",
"S_MODCP_ACTION" => append_sid("modcp.$phpEx"))
);
//
// Set template files
//
$template->set_filenames(array( $template->set_filenames(array(
"body" => "modcp_body.tpl") 'body' => 'modcp_body.tpl')
); );
// //
@ -1027,15 +985,14 @@ switch($mode)
AND p.post_id = t.topic_last_post_id AND p.post_id = t.topic_last_post_id
ORDER BY t.topic_type DESC, p.post_time DESC ORDER BY t.topic_type DESC, p.post_time DESC
LIMIT $start, " . $board_config['topics_per_page']; LIMIT $start, " . $board_config['topics_per_page'];
if ( !($result = $db->sql_query($sql)) ) if ( !($result = $db->sql_query($sql)) )
{ {
message_die(GENERAL_ERROR, "Couldn't obtain topic information", "", __LINE__, __FILE__, $sql); message_die(GENERAL_ERROR, 'Could not obtain topic information', '', __LINE__, __FILE__, $sql);
} }
while ( $row = $db->sql_fetchrow($result) ) while ( $row = $db->sql_fetchrow($result) )
{ {
$topic_title = ""; $topic_title = '';
if ( $row['topic_status'] == TOPIC_LOCKED ) if ( $row['topic_status'] == TOPIC_LOCKED )
{ {
@ -1069,24 +1026,24 @@ switch($mode)
if ( $topic_type == POST_ANNOUNCE ) if ( $topic_type == POST_ANNOUNCE )
{ {
$topic_type = $lang['Topic_Announcement'] . " "; $topic_type = $lang['Topic_Announcement'] . ' ';
} }
else if ( $topic_type == POST_STICKY ) else if ( $topic_type == POST_STICKY )
{ {
$topic_type = $lang['Topic_Sticky'] . " "; $topic_type = $lang['Topic_Sticky'] . ' ';
} }
else if ( $topic_status == TOPIC_MOVED ) else if ( $topic_status == TOPIC_MOVED )
{ {
$topic_type = $lang['Topic_Moved'] . " "; $topic_type = $lang['Topic_Moved'] . ' ';
} }
else else
{ {
$topic_type = ""; $topic_type = '';
} }
if ( $row['topic_vote'] ) if ( $row['topic_vote'] )
{ {
$topic_type .= $lang['Topic_Poll'] . " "; $topic_type .= $lang['Topic_Poll'] . ' ';
} }
$topic_title = $row['topic_title']; $topic_title = $row['topic_title'];
@ -1100,27 +1057,27 @@ switch($mode)
$last_post_time = create_date($board_config['default_dateformat'], $row['post_time'], $board_config['board_timezone']); $last_post_time = create_date($board_config['default_dateformat'], $row['post_time'], $board_config['board_timezone']);
$template->assign_block_vars("topicrow", array( $template->assign_block_vars('topicrow', array(
"U_VIEW_TOPIC" => $u_view_topic, 'U_VIEW_TOPIC' => $u_view_topic,
"FOLDER_IMG" => $folder_image, 'FOLDER_IMG' => $folder_image,
"TOPIC_TYPE" => $topic_type, 'TOPIC_TYPE' => $topic_type,
"TOPIC_TITLE" => $topic_title, 'TOPIC_TITLE' => $topic_title,
"REPLIES" => $topic_replies, 'REPLIES' => $topic_replies,
"LAST_POST" => $last_post_time, 'LAST_POST' => $last_post_time,
"TOPIC_ID" => $topic_id) 'TOPIC_ID' => $topic_id)
); );
} }
$template->assign_vars(array( $template->assign_vars(array(
"PAGINATION" => generate_pagination("modcp.$phpEx?" . POST_FORUM_URL . "=$forum_id", $forum_topics, $board_config['topics_per_page'], $start), 'PAGINATION' => generate_pagination("modcp.$phpEx?" . POST_FORUM_URL . "=$forum_id", $forum_topics, $board_config['topics_per_page'], $start),
"PAGE_NUMBER" => sprintf($lang['Page_of'], ( floor( $start / $board_config['topics_per_page'] ) + 1 ), ceil( $forum_topics / $board_config['topics_per_page'] )), 'PAGE_NUMBER' => sprintf($lang['Page_of'], ( floor( $start / $board_config['topics_per_page'] ) + 1 ), ceil( $forum_topics / $board_config['topics_per_page'] )),
"L_GOTO_PAGE" => $lang['Goto_page']) 'L_GOTO_PAGE' => $lang['Goto_page'])
); );
$template->pparse("body"); $template->pparse('body');
break; break;
} }