Exemplo n.º 1
0
                require PANTHER_ROOT . 'include/search_idx.php';
            }
            update_search_index('post', $post_id, $post['message']);
            $ps = $db->select('posts', 'id, poster, posted', $topic_data, 'topic_id=:id AND approved=1 AND deleted=0', 'id DESC LIMIT 1');
            list($last_id, $poster, $posted) = $ps->fetch(PDO::FETCH_NUM);
            $ps = $db->select('topics', 'num_replies', $topic_data, 'id=:id');
            $num_replies = $ps->fetchColumn();
            $update = array('num_replies' => $num_replies + 1, 'last_post' => $posted, 'last_post_id' => $last_id, 'last_poster' => $poster);
            $db->update('topics', $update, 'id=:id', $topic_data);
            update_search_index('post', $post_id, $post['message']);
            update_forum($post['forum_id']);
            redirect(panther_link($panther_url['admin_deleted']), $lang_admin_deleted['Post approved redirect']);
        }
    } else {
        if ($is_topic_post) {
            permanently_delete_topic($post['topic_id']);
            redirect(panther_link($panther_url['admin_deleted']), $lang_admin_deleted['Topic deleted redirect']);
        } else {
            permanently_delete_post($post_id);
            redirect(panther_link($panther_url['admin_deleted']), $lang_admin_deleted['Post deleted redirect']);
        }
    }
}
$ps = $db->run('SELECT t.id AS topic_id, t.forum_id, p.poster, p.poster_id, p.posted, p.message, p.id AS pid, p.hide_smilies, t.subject, f.forum_name FROM ' . $db->prefix . 'posts AS p LEFT JOIN ' . $db->prefix . 'topics AS t ON p.topic_id=t.id LEFT JOIN ' . $db->prefix . 'forums AS f ON t.forum_id=f.id WHERE p.deleted=1 OR t.deleted=1 ORDER BY p.posted DESC');
require PANTHER_ROOT . 'include/parser.php';
$page_title = array($panther_config['o_board_title'], $lang_admin_common['Admin'], $lang_admin_common['Deleted']);
define('PANTHER_ACTIVE_PAGE', 'admin');
require PANTHER_ROOT . 'header.php';
generate_admin_menu('deleted');
$posts = array();
foreach ($ps as $cur_post) {
Exemplo n.º 2
0
function delete_topic($topic_id)
{
    global $db, $panther_config;
    // Delete the topic and any redirect topics
    attach_delete_thread($topic_id);
    $data = array(':id' => $topic_id);
    $topic = array(':id' => $topic_id, ':moved_to' => $topic_id);
    $update = array('deleted' => 1);
    $post_ids = array();
    $db->update('topics', $update, 'id=:id OR moved_to=:moved_to', $topic);
    $db->delete('polls', 'topic_id=:id', $data);
    // Get all post IDs from this topic.
    $ps = $db->select('posts', 'id', $data, 'topic_id=:id');
    foreach ($ps as $cur_post) {
        $post_ids[] = $cur_post['id'];
    }
    // Make sure we have a list of post IDs
    if (!empty($post_ids)) {
        strip_search_index($post_ids);
        // Should be an array
        $db->update('posts', $update, 'topic_id=:id', $data);
    }
    if ($panther_config['o_delete_full'] == '1') {
        permanently_delete_topic($topic_id);
    }
}