1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-07-31 14:00:31 +02:00

some arrangements...

git-svn-id: file:///svn/phpbb/trunk@3883 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
Meik Sievertsen
2003-04-18 13:07:19 +00:00
parent 25015ecc0b
commit 2bd1ced339
8 changed files with 347 additions and 499 deletions

View File

@@ -392,10 +392,43 @@ if ( ($mode == 'delete') && ((($poster_id == $user->data['user_id']) && ($user->
'user_id' => $poster_id
);
$msg = delete_post($mode, $post_id, $topic_id, $forum_id, $post_data);
// We have a problem...
trigger_error($msg);
$search = new fulltext_search();
include($phpbb_root_path . 'includes/functions_admin.' . $phpEx);
// User tries to delete the post twice ? Exit... we do not want the topics table screwed up.
if (!delete_posts('post_id', array($post_id)))
{
trigger_error($user->lang['ALREADY_DELETED']);
}
// Only one post... delete topic
if ($post_data['topic_first_post_id'] == $post_data['topic_last_post_id'])
{
delete_topics('topic_id', array($topic_id));
}
// TODO: delete common words... maybe just call search_tidy ?
// $search->del_words($post_id);
if ($post_data['topic_first_post_id'] == $post_data['topic_last_post_id'])
{
$meta_info = '<meta http-equiv="refresh" content="5; url=viewforum.' . $phpEx . $SID . '&amp;f=' . $forum_id . '">';
$message = $user->lang['DELETED'];
}
else
{
$meta_info = '<meta http-equiv="refresh" content="5; url=viewtopic.' . $phpEx . $SID . '&amp;f=' . $forum_id . '&amp;t=' . $topic_id . '&amp;p=' . $post_data['next_post_id'] . '#' . $post_data['next_post_id'] . '">';
$message = $user->lang['DELETED'] . '<br /><br />' . sprintf($user->lang['RETURN_TOPIC'], '<a href="viewtopic.' . $phpEx . $SID . '&amp;f=' . $forum_id . '&amp;t=' . $topic_id . '&amp;p=' . $post_data['next_post_id'] . '#' . $post_data['next_post_id'] . '">', '</a>');
}
$template->assign_vars(array(
'META' => $meta_info)
);
$message .= '<br /><br />' . sprintf($user->lang['RETURN_FORUM'], '<a href="viewforum.' . $phpEx . $SID . '&amp;f=' . $forum_id . '">', '</a>');
trigger_error($message);
}
else
{
@@ -466,7 +499,24 @@ if (($submit) || ($preview) || ($refresh))
if ( ($poll_delete) && ($mode == 'edit' && !empty($poll_options) && ((empty($poll_last_vote) && $poster_id == $user->data['user_id'] && $perm['u_delete']) || $perm['m_delete'])) )
{
delete_poll($topic_id);
// Delete Poll
$sql = "DELETE FROM " . POLL_OPTIONS_TABLE . "
WHERE topic_id = " . $topic_id;
$db->sql_query($sql);
$sql = "DELETE FROM " . POLL_VOTES_TABLE . "
WHERE topic_id = " . $topic_id;
$db->sql_query($sql);
$topic_sql = array(
'poll_title' => '',
'poll_start' => 0,
'poll_length' => 0,
'poll_last_vote' => 0
);
$sql = 'UPDATE ' . TOPICS_TABLE . ' SET ' . $db->sql_build_array('UPDATE', $topic_sql) . ' WHERE topic_id = ' . $topic_id;
$db->sql_query($sql);
$poll_title = '';
$poll_length = '';
@@ -734,7 +784,33 @@ get_moderators($moderators, $forum_id);
generate_smilies('inline');
// Generate Topic icons
$s_topic_icons = generate_topic_icons($mode, $enable_icons);
$s_topic_icons = false;
if ($enable_icons)
{
// Grab icons
$icons = array();
obtain_icons($icons);
if (sizeof($icons))
{
foreach ($icons as $id => $data)
{
if ($data['display'])
{
$template->assign_block_vars('topic_icon', array(
'ICON_ID' => $id,
'ICON_IMG' => $phpbb_root_path . $config['icons_path'] . '/' . $data['img'],
'ICON_WIDTH' => $data['width'],
'ICON_HEIGHT' => $data['height'],
'S_ICON_CHECKED' => ($id == $icon_id && $mode != 'reply') ? ' checked="checked"' : '')
);
}
}
$s_topic_icons = true;
}
}
// Topic type selection ... only for first post in topic.
$topic_type_toggle = '';
@@ -959,4 +1035,128 @@ if ($mode == 'reply' || $mode == 'quote')
include($phpbb_root_path . 'includes/page_tail.'.$phpEx);
// FUNCTIONS
// Topic Review
function topic_review($topic_id, $is_inline_review = false)
{
global $censors, $user, $auth, $db, $template, $config, $phpbb_root_path, $phpEx;
// Define censored word matches
if (empty($censors))
{
$censors = array();
obtain_word_list($censors);
}
if (!$is_inline_review)
{
// Get topic info ...
$sql = "SELECT t.topic_title, f.forum_id
FROM " . TOPICS_TABLE . " t, " . FORUMS_TABLE . " f
WHERE t.topic_id = $topic_id
AND f.forum_id = t.forum_id";
$result = $db->sql_query($sql);
if (!($row = $db->sql_fetchrow($result)))
{
trigger_error($user->lang['NO_TOPIC']);
}
$forum_id = intval($row['forum_id']);
$topic_title = $row['topic_title'];
if (!$auth->acl_get('f_read', $forum_id))
{
trigger_error($user->lang['SORRY_AUTH_READ']);
}
if (count($censors['match']))
{
$topic_title = preg_replace($censors['match'], $censors['replace'], $topic_title);
}
}
else
{
$template->assign_vars(array(
'S_DISPLAY_INLINE' => true)
);
}
// Go ahead and pull all data for this topic
$sql = "SELECT u.username, u.user_id, p.*
FROM " . POSTS_TABLE . " p, " . USERS_TABLE . " u
WHERE p.topic_id = $topic_id
AND p.poster_id = u.user_id
ORDER BY p.post_time DESC";
$result = $db->sql_query_limit($sql, $config['posts_per_page']);
// Okay, let's do the loop, yeah come on baby let's do the loop
// and it goes like this ...
if ($row = $db->sql_fetchrow($result))
{
$i = 0;
do
{
$poster_id = $row['user_id'];
$poster = $row['username'];
// Handle anon users posting with usernames
if ($poster_id == ANONYMOUS && $row['post_username'] != '')
{
$poster = $row['post_username'];
$poster_rank = $user->lang['GUEST'];
}
$post_subject = ($row['post_subject'] != '') ? $row['post_subject'] : '';
$message = $row['post_text'];
$message = (empty($row['enable_smilies']) || empty($config['allow_smilies'])) ? preg_replace('#<!\-\- s(.*?) \-\-><img src="\{SMILE_PATH\}\/.*? \/><!\-\- s\1 \-\->#', '\1', $message) : str_replace('<img src="{SMILE_PATH}', '<img src="' . $phpbb_root_path . $config['smilies_path'], $message);
if (count($censors['match']))
{
$post_subject = preg_replace($censors['match'], $censors['replace'], $post_subject);
$message = preg_replace($censors['match'], $censors['replace'], $message);
}
$template->assign_block_vars('postrow', array(
'MINI_POST_IMG' => $user->img('icon_post', $user->lang['POST']),
'POSTER_NAME' => $poster,
'POST_DATE' => $user->format_date($row['post_time']),
'POST_SUBJECT' => $post_subject,
'MESSAGE' => nl2br($message),
'S_ROW_COUNT' => $i++)
);
}
while ($row = $db->sql_fetchrow($result));
}
else
{
trigger_error($user->lang['NO_TOPIC']);
}
$db->sql_freeresult($result);
$template->assign_vars(array(
'L_MESSAGE' => $user->lang['MESSAGE'],
'L_POSTED' => $user->lang['POSTED'],
'L_POST_SUBJECT'=> $user->lang['POST_SUBJECT'],
'L_TOPIC_REVIEW'=> $user->lang['TOPIC_REVIEW'])
);
if (!$is_inline_review)
{
$page_title = $user->lang['TOPIC_REVIEW'] . ' - ' . $topic_title;
include($phpbb_root_path . 'includes/page_header.'.$phpEx);
$template->set_filenames(array(
'body' => 'posting_topic_review.html')
);
include($phpbb_root_path . 'includes/page_tail.'.$phpEx);
}
}
?>