Code: Selecteer alles
#
#-----[ OPEN ]------------------------------------------
#
viewtopic.php
#
#-----[ FIND ]------------------------------------------
#
$sql = "SELECT t.topic_id, t.topic_title, t.topic_status, t.topic_replies, t.topic_time, t.topic_type, t.topic_vote, t.topic_last_post_id, f.forum_name, f.forum_status, f.forum_id, f.auth_view, f.auth_read, f.auth_post, f.auth_reply, f.auth_edit, f.auth_delete, f.auth_sticky, f.auth_announce, f.auth_pollcreate, f.auth_vote, f.auth_attachments" . $count_sql . "
#
#-----[ IN-LINE FIND ]---------------------------------------------------
#
t.topic_id, t.topic_title, t.topic_status, t.topic_replies, t.topic_time, t.topic_type, t.topic_vote, t.topic_last_post_id
#
#-----[ IN-LINE REPLACE WITH ]---------------------------------------------------
#
t.*
#
#-----[ FIND ]------------------------------------------
#
if ( $is_auth['auth_mod'] )
{
$temp_url = "modcp.$phpEx?mode=ip&" . POST_POST_URL . "=" . $postrow[$i]['post_id'] . "&" . POST_TOPIC_URL . "=" . $topic_id . "&sid=" . $userdata['session_id'];
$ip_img = '<a href="' . $temp_url . '"><img src="' . $images['icon_ip'] . '" alt="' . $lang['View_IP'] . '" title="' . $lang['View_IP'] . '" border="0" /></a>';
$ip = '<a href="' . $temp_url . '">' . $lang['View_IP'] . '</a>';
$temp_url = "posting.$phpEx?mode=delete&" . POST_POST_URL . "=" . $postrow[$i]['post_id'] . "&sid=" . $userdata['session_id'];
$delpost_img = '<a href="' . $temp_url . '"><img src="' . $images['icon_delpost'] . '" alt="' . $lang['Delete_post'] . '" title="' . $lang['Delete_post'] . '" border="0" /></a>';
$delpost = '<a href="' . $temp_url . '">' . $lang['Delete_post'] . '</a>';
}
#
#-----[ BEFORE, ADD ]------------------------------------------
#
// START (UN)LOCK POST BY TOPIC STARTER
if ( $forum_topic_data['topic_poster'] == $userdata['user_id'] && $forum_topic_data['topic_status'] == TOPIC_UNLOCKED && $is_auth['auth_lock'])
{
$start = ( isset($HTTP_GET_VARS['start']) ) ? intval($HTTP_GET_VARS['start']) : 0;
$delete = ( isset($HTTP_POST_VARS['delete']) ) ? TRUE : FALSE;
if ( isset($HTTP_POST_VARS['mode']) || isset($HTTP_GET_VARS['mode']) )
{
$mode = ( isset($HTTP_POST_VARS['mode']) ) ? $HTTP_POST_VARS['mode'] : $HTTP_GET_VARS['mode'];
$mode = htmlspecialchars($mode);
}
else
{
if ( $delete )
{
$mode = 'delete';
}
else
{
$mode = '';
}
}
switch( $mode )
{
case 'delete':
if (!$is_auth['auth_delete'])
{
message_die(MESSAGE, sprintf($lang['Sorry_auth_delete'], $is_auth['auth_delete_type']));
}
$page_title = $lang['Mod_CP'];
include($phpbb_root_path . 'includes/page_header.'.$phpEx);
if ( $confirm )
{
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);
$topic_id_sql = '';
for($i = 0; $i < count($topics); $i++)
{
$topic_id_sql .= ( ( $topic_id_sql != '' ) ? ', ' : '' ) . intval($topics[$i]);
}
$sql = "SELECT topic_id
FROM " . TOPICS_TABLE . "
WHERE topic_id IN ($topic_id_sql)
AND forum_id = $forum_id";
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Could not get topic id information', '', __LINE__, __FILE__, $sql);
}
$topic_id_sql = '';
while ($row = $db->sql_fetchrow($result))
{
$topic_id_sql .= (($topic_id_sql != '') ? ', ' : '') . intval($row['topic_id']);
}
$db->sql_freeresult($result);
$sql = "SELECT poster_id, COUNT(post_id) AS posts
FROM " . POSTS_TABLE . "
WHERE topic_id IN ($topic_id_sql)
GROUP BY poster_id";
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Could not get poster id information', '', __LINE__, __FILE__, $sql);
}
$count_sql = array();
while ( $row = $db->sql_fetchrow($result) )
{
$count_sql[] = "UPDATE " . USERS_TABLE . "
SET user_posts = user_posts - " . $row['posts'] . "
WHERE user_id = " . $row['poster_id'];
}
$db->sql_freeresult($result);
if ( sizeof($count_sql) )
{
for($i = 0; $i < sizeof($count_sql); $i++)
{
if ( !$db->sql_query($count_sql[$i]) )
{
message_die(GENERAL_ERROR, 'Could not update user post count information', '', __LINE__, __FILE__, $sql);
}
}
}
$sql = "SELECT post_id
FROM " . POSTS_TABLE . "
WHERE topic_id IN ($topic_id_sql)";
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Could not get post id information', '', __LINE__, __FILE__, $sql);
}
$post_id_sql = '';
while ( $row = $db->sql_fetchrow($result) )
{
$post_id_sql .= ( ( $post_id_sql != '' ) ? ', ' : '' ) . intval($row['post_id']);
}
$db->sql_freeresult($result);
$sql = "SELECT vote_id
FROM " . VOTE_DESC_TABLE . "
WHERE topic_id IN ($topic_id_sql)";
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Could not get vote id information', '', __LINE__, __FILE__, $sql);
}
$vote_id_sql = '';
while ( $row = $db->sql_fetchrow($result) )
{
$vote_id_sql .= ( ( $vote_id_sql != '' ) ? ', ' : '' ) . $row['vote_id'];
}
$db->sql_freeresult($result);
//
// Got all required info so go ahead and start deleting everything
//
$sql = "DELETE
FROM " . TOPICS_TABLE . "
WHERE topic_id IN ($topic_id_sql)
OR topic_moved_id IN ($topic_id_sql)";
if ( !$db->sql_query($sql, BEGIN_TRANSACTION) )
{
message_die(GENERAL_ERROR, 'Could not delete topics', '', __LINE__, __FILE__, $sql);
}
if ( $post_id_sql != '' )
{
$sql = "DELETE
FROM " . POSTS_TABLE . "
WHERE post_id IN ($post_id_sql)";
if ( !$db->sql_query($sql) )
{
message_die(GENERAL_ERROR, 'Could not delete posts', '', __LINE__, __FILE__, $sql);
}
$sql = "DELETE
FROM " . POSTS_TEXT_TABLE . "
WHERE post_id IN ($post_id_sql)";
if ( !$db->sql_query($sql) )
{
message_die(GENERAL_ERROR, 'Could not delete posts text', '', __LINE__, __FILE__, $sql);
}
remove_search_post($post_id_sql);
}
if ( $vote_id_sql != '' )
{
$sql = "DELETE
FROM " . VOTE_DESC_TABLE . "
WHERE vote_id IN ($vote_id_sql)";
if ( !$db->sql_query($sql) )
{
message_die(GENERAL_ERROR, 'Could not delete vote descriptions', '', __LINE__, __FILE__, $sql);
}
$sql = "DELETE
FROM " . VOTE_RESULTS_TABLE . "
WHERE vote_id IN ($vote_id_sql)";
if ( !$db->sql_query($sql) )
{
message_die(GENERAL_ERROR, 'Could not delete vote results', '', __LINE__, __FILE__, $sql);
}
$sql = "DELETE
FROM " . VOTE_USERS_TABLE . "
WHERE vote_id IN ($vote_id_sql)";
if ( !$db->sql_query($sql) )
{
message_die(GENERAL_ERROR, 'Could not delete vote users', '', __LINE__, __FILE__, $sql);
}
}
$sql = "DELETE
FROM " . TOPICS_WATCH_TABLE . "
WHERE topic_id IN ($topic_id_sql)";
if ( !$db->sql_query($sql, END_TRANSACTION) )
{
message_die(GENERAL_ERROR, 'Could not delete watched post list', '', __LINE__, __FILE__, $sql);
}
sync('forum', $forum_id);
if ( !empty($topic_id) )
{
$redirect_page = "viewforum.$phpEx?" . POST_FORUM_URL . "=$forum_id&sid=" . $userdata['session_id'];
$l_redirect = sprintf($lang['Click_return_forum'], '<a href="' . $redirect_page . '">', '</a>');
}
else
{
$redirect_page = "modcp.$phpEx?" . POST_FORUM_URL . "=$forum_id&sid=" . $userdata['session_id'];
$l_redirect = sprintf($lang['Click_return_modcp'], '<a href="' . $redirect_page . '">', '</a>');
}
$template->assign_vars(array(
'META' => '<meta http-equiv="refresh" content="3;url=' . $redirect_page . '">')
);
message_die(GENERAL_MESSAGE, $lang['Topics_Removed'] . '<br /><br />' . $l_redirect);
}
else
{
// Not confirmed, show confirmation message
if ( empty($HTTP_POST_VARS['topic_id_list']) && empty($topic_id) )
{
message_die(GENERAL_MESSAGE, $lang['None_selected']);
}
$hidden_fields = '<input type="hidden" name="sid" value="' . $userdata['session_id'] . '" /><input type="hidden" name="mode" value="' . $mode . '" /><input type="hidden" name="' . POST_FORUM_URL . '" value="' . $forum_id . '" />';
if ( isset($HTTP_POST_VARS['topic_id_list']) )
{
$topics = $HTTP_POST_VARS['topic_id_list'];
for($i = 0; $i < count($topics); $i++)
{
$hidden_fields .= '<input type="hidden" name="topic_id_list[]" value="' . intval($topics[$i]) . '" />';
}
}
else
{
$hidden_fields .= '<input type="hidden" name="' . POST_TOPIC_URL . '" value="' . $topic_id . '" />';
}
//
// Set template files
//
$template->set_filenames(array(
'confirm' => 'confirm_body.tpl')
);
$template->assign_vars(array(
'MESSAGE_TITLE' => $lang['Confirm'],
'MESSAGE_TEXT' => $lang['Confirm_delete_topic'],
'L_YES' => $lang['Yes'],
'L_NO' => $lang['No'],
'S_CONFIRM_ACTION' => append_sid("modcp.$phpEx"),
'S_HIDDEN_FIELDS' => $hidden_fields)
);
$template->pparse('confirm');
include($phpbb_root_path . 'includes/page_tail.'.$phpEx);
}
break;
}
$topic_mod .= "<a href=\"modcp.$phpEx?" . POST_TOPIC_URL . "=$topic_id&mode=delete&sid=" . $userdata['session_id'] . '"><img src="' . $images['topic_mod_delete'] . '" alt="' . $lang['Delete_topic'] . '" title="' . $lang['Delete_topic'] . '" border="0" /></a> ';
if ( $forum_topic_data['topic_status'] == TOPIC_UNLOCKED )
{
$temp_url = "viewtopic.$phpEx?mode=delete&" . POST_TOPIC_URL . "=$topic_id&sid=" . $userdata['session_id'];
$delete_img_by_starter = '<a href="' . $temp_url . '"><img src="' . $images['topic_mod_delete'] . '" alt="' . $lang['Delete_topic'] . '" title="' . $lang['Delete_topic'] . '" border="0" /></a>';
$delete_by_starter = '<a href="' . $temp_url . '">' . $lang['Delete_topic'] . '</a>';
}
else
{
$delete_img_by_starter = '';
$delete_by_starter = '';
}
}
// END
#
#-----[ FIND ]------------------------------------------
#
'DELETE' => $delpost,
#
#-----[ AFTER, ADD ]------------------------------------------
#
'DELETE_IMG_BY_STARTER' => $delete_img_by_starter,
#
#-----[ OPEN ]------------------------------------------
# Make sure to edit this file for every theme you use!
#
templates/subSilver/viewtopic_body.tpl
#
#-----[ FIND ]------------------------------------------
#
<td width="100%"><a href="{postrow.U_MINI_POST}"><img src="{postrow.MINI_POST_IMG}" width="12" height="9" alt="{postrow.L_MINI_POST_ALT}" title="{postrow.L_MINI_POST_ALT}" border="0" /></a><span class="postdetails">{L_POSTED}: {postrow.POST_DATE}<span class="gen"> </span> {L_POST_SUBJECT}: {postrow.POST_SUBJECT}</span></td>
#
#-----[ IN-LINE FIND ]------------------------------------------
#
<td width="100%">
#
#-----[ IN-LINE AFTER, ADD ]------------------------------------------
#
{postrow.DELETE_IMG_BY_STARTER}
#
#-----[ SAVE/CLOSE ALLE FILES ]------------------------------------------
#
# EoM