Exemple #1
0
<?php

define('IN_ADMIN', true);
define('FT_ROOT', './../');
require FT_ROOT . 'common.php';
$user->session_start();
if (IS_GUEST) {
    redirect(LOGIN_URL . "?redirect=admin/index.php");
}
if (!IS_ADMIN) {
    die($lang['NOT_ADMIN']);
}
if (!$userdata['session_admin']) {
    $redirect = url_arg($_SERVER['REQUEST_URI'], 'admin', 1);
    redirect("login.php?redirect={$redirect}");
}
if (empty($no_page_header)) {
    require './page_header_admin.php';
}
Exemple #2
0
$pg_url .= $moderation ? "&amp;mod=1" : '';
$pg_url .= $posts_per_page != $bb_cfg['posts_per_page'] ? "&amp;ppp={$posts_per_page}" : '';
generate_pagination($pg_url, $total_replies, $posts_per_page, $start);
//
// Selects
//
$sel_previous_days = array(0 => $lang['ALL_POSTS'], 1 => $lang['1_DAY'], 7 => $lang['7_DAYS'], 14 => $lang['2_WEEKS'], 30 => $lang['1_MONTH'], 90 => $lang['3_MONTHS'], 180 => $lang['6_MONTHS'], 364 => $lang['1_YEAR']);
$sel_post_order_ary = array($lang['OLDEST_FIRST'] => 'asc', $lang['NEWEST_FIRST'] => 'desc');
$topic_has_poll = $t_data['topic_vote'] && !IS_GUEST;
$poll_time_expired = $t_data['topic_time'] < TIMENOW - $bb_cfg['poll_max_days'] * 86400;
$can_manage_poll = $t_data['topic_poster'] == $userdata['user_id'] || $is_auth['auth_mod'];
$can_add_poll = $can_manage_poll && !$topic_has_poll && !$poll_time_expired && !$start;
//
// Send vars to template
//
$template->assign_vars(array('PAGE_URL' => $pg_url, 'PAGE_URL_PPP' => url_arg($pg_url, 'ppp', null), 'PAGE_START' => $start, 'SHOW_JUMPBOX' => true, 'FORUM_ID' => $forum_id, 'FORUM_NAME' => htmlCHR($forum_name), 'TOPIC_ID' => $topic_id, 'PAGE_TITLE' => $topic_title, 'TOPIC_TITLE' => wbr($topic_title), 'PORNO_FORUM' => $t_data['allow_porno_topic'], 'REPLY_IMG' => $reply_img, 'SHOW_BOT_NICK' => $bb_cfg['show_bot_nick'], 'T_POST_REPLY' => $reply_alt, 'HIDE_AVATAR' => $user->opt_js['h_av'], 'HIDE_RANK_IMG' => $user->opt_js['h_rnk_i'] && $bb_cfg['show_rank_image'], 'HIDE_POST_IMG' => $user->opt_js['h_post_i'], 'HIDE_SMILE' => $user->opt_js['h_smile'], 'HIDE_SIGNATURE' => $user->opt_js['h_sig'], 'SPOILER_OPENED' => $user->opt_js['sp_op'], 'SHOW_IMG_AFTER_LOAD' => $user->opt_js['i_aft_l'], 'HIDE_RANK_IMG_DIS' => !$bb_cfg['show_rank_image'], 'PINNED_FIRST_POST' => $t_data['topic_show_first_post'], 'PIN_HREF' => $t_data['topic_show_first_post'] ? "modcp.php?t={$topic_id}&amp;mode=post_unpin" : "modcp.php?t={$topic_id}&amp;mode=post_pin", 'PIN_TITLE' => $t_data['topic_show_first_post'] ? $lang['POST_UNPIN'] : $lang['POST_PIN'], 'AUTH_MOD' => $is_auth['auth_mod'], 'IN_MODERATION' => $moderation, 'SELECT_PPP' => $moderation && $select_ppp && $total_replies > $posts_per_page ? build_select('ppp', $select_ppp, $posts_per_page, null, null, 'onchange="$(\'#ppp\').submit();"') : '', 'S_SELECT_POST_DAYS' => build_select('postdays', array_flip($sel_previous_days), $post_days), 'S_SELECT_POST_ORDER' => build_select('postorder', $sel_post_order_ary, $post_order), 'S_POST_DAYS_ACTION' => TOPIC_URL . $topic_id . "&amp;start={$start}", 'S_AUTH_LIST' => $s_auth_can, 'S_TOPIC_ADMIN' => $topic_mod, 'S_WATCH_TOPIC' => $s_watching_topic, 'S_WATCH_TOPIC_IMG' => $s_watching_topic_img, 'U_VIEW_TOPIC' => TOPIC_URL . $topic_id, 'U_VIEW_FORUM' => $view_forum_url, 'U_VIEW_OLDER_TOPIC' => $view_prev_topic_url, 'U_VIEW_NEWER_TOPIC' => $view_next_topic_url, 'U_POST_NEW_TOPIC' => $new_topic_url, 'U_POST_REPLY_TOPIC' => $reply_topic_url, 'U_SEARCH_SELF' => "search.php?uid={$userdata['user_id']}&t={$topic_id}&dm=1", 'TOPIC_HAS_POLL' => $topic_has_poll, 'POLL_IS_EDITABLE' => !$poll_time_expired, 'POLL_IS_FINISHED' => $t_data['topic_vote'] == POLL_FINISHED, 'CAN_MANAGE_POLL' => $can_manage_poll, 'CAN_ADD_POLL' => $can_add_poll));
// Does this topic contain DL-List?
$template->assign_vars(array('SHOW_TOR_ACT' => false, 'PEERS_FULL_LINK' => false, 'DL_LIST_HREF' => TOPIC_URL . "{$topic_id}&amp;dl=names&amp;spmode=full"));
require INC_DIR . 'torrent_show_dl_list.php';
if ($t_data['topic_attachment']) {
    require ATTACH_DIR . 'attachment_mod.php';
    init_display_post_attachments($t_data['topic_attachment']);
}
//
// Update the topic view counter
//
$sql = "INSERT INTO " . BUF_TOPIC_VIEW . " (topic_id,  topic_views) VALUES ({$topic_id}, 1) ON DUPLICATE KEY UPDATE topic_views = topic_views + 1";
if (!DB()->sql_query($sql)) {
    bb_die('Could not update topic views');
}
//
Exemple #3
0
         }
         // forum_name
         if ($fid =& $row['log_forum_id']) {
             $forum_name = ($fname =& $f_data[$fid]['forum_name']) ? $fname : 'id:' . $row['log_forum_id'];
         }
         // forum_name_new
         if ($fid =& $row['log_forum_id_new']) {
             $forum_name_new = ($fname =& $f_data[$fid]['forum_name']) ? $fname : 'id:' . $row['log_forum_id'];
         }
         break;
 }
 $msg .= " {$row['log_msg']}";
 $row_class = !($row_num & 1) ? $row_class_1 : $row_class_2;
 $datetime_href_s = url_arg($url, $datetime_key, date($dt_format, $row['log_time']));
 $datetime_href_s = url_arg($datetime_href_s, $daysback_key, 1);
 $template->assign_block_vars('log', array('ACTION_DESC' => $lang['LOG_ACTION']['LOG_TYPE'][$log_type_flip[$row['log_type_id']]], 'ACTION_HREF_S' => url_arg($url, $type_key, $row['log_type_id']), 'USER_ID' => $row['log_user_id'], 'USERNAME' => $row['log_username'], 'USER_HREF_S' => url_arg($url, $user_key, $row['log_user_id']), 'USER_IP' => decode_ip($row['log_user_ip']), 'FORUM_ID' => $row['log_forum_id'], 'FORUM_HREF' => BB_ROOT . FORUM_URL . $row['log_forum_id'], 'FORUM_HREF_S' => url_arg($url, $forum_key, $row['log_forum_id']), 'FORUM_NAME' => htmlCHR($forum_name), 'FORUM_ID_NEW' => $row['log_forum_id_new'], 'FORUM_HREF_NEW' => BB_ROOT . FORUM_URL . $row['log_forum_id_new'], 'FORUM_HREF_NEW_S' => url_arg($url, $forum_key, $row['log_forum_id_new']), 'FORUM_NAME_NEW' => htmlCHR($forum_name_new), 'TOPIC_ID' => $row['log_topic_id'], 'TOPIC_HREF' => !$topic_deleted ? BB_ROOT . TOPIC_URL . $row['log_topic_id'] : '', 'TOPIC_HREF_S' => url_arg($url, $topic_key, $row['log_topic_id']), 'TOPIC_TITLE' => $topic_title, 'TOPIC_ID_NEW' => $row['log_topic_id_new'], 'TOPIC_HREF_NEW' => BB_ROOT . TOPIC_URL . $row['log_topic_id_new'], 'TOPIC_HREF_NEW_S' => url_arg($url, $topic_key, $row['log_topic_id_new']), 'TOPIC_TITLE_NEW' => $topic_title_new, 'DATE' => bb_date($row['log_time'], 'j-M'), 'TIME' => bb_date($row['log_time'], 'H:i'), 'DATETIME_HREF_S' => $datetime_href_s, 'MSG' => $msg, 'ROW_CLASS' => $row_class));
 // Topics
 if ($topic_csv && empty($filter['topics'][$row['log_topic_title']])) {
     $template->assign_block_vars('topics', array('TOPIC_TITLE' => $row['log_topic_title']));
     $filter['topics'][$row['log_topic_title']] = true;
 }
 // Forums
 if ($forum_csv && empty($filter['forums'][$forum_name])) {
     $template->assign_block_vars('forums', array('FORUM_NAME' => htmlCHR($forum_name)));
     $filter['forums'][$forum_name] = true;
 }
 // Users
 if ($user_csv && empty($filter['users'][$row['log_username']])) {
     $template->assign_block_vars('users', array('USERNAME' => $row['log_username']));
     $filter['users'][$row['log_username']] = true;
 }
Exemple #4
0
    }
    $template->assign_block_vars('t', array('FORUM_ID' => $forum_id, 'TOPIC_ID' => $topic_id, 'HREF_TOPIC_ID' => $moved ? $topic['topic_moved_id'] : $topic['topic_id'], 'TOPIC_TITLE' => wbr($topic['topic_title']), 'TOPICS_SEPARATOR' => $separator, 'IS_UNREAD' => $is_unread, 'TOPIC_ICON' => get_topic_icon($topic, $is_unread), 'PAGINATION' => $moved ? '' : build_topic_pagination(TOPIC_URL . $topic_id, $replies, $bb_cfg['posts_per_page']), 'REPLIES' => $replies, 'VIEWS' => $topic['topic_views'], 'TOR_STALED' => $forum_data['allow_reg_tracker'] && !($t_type == POST_ANNOUNCE || $t_type == POST_STICKY || $topic['tor_size']), 'TOR_FROZEN' => isset($topic['tor_status']) ? !IS_AM ? isset($bb_cfg['tor_frozen'][$topic['tor_status']]) : '' : '', 'TOR_TYPE' => isset($topic['tor_type']) ? is_gold($topic['tor_type']) : '', 'TOR_STATUS_ICON' => isset($topic['tor_status']) ? $bb_cfg['tor_icons'][$topic['tor_status']] : '', 'TOR_STATUS_TEXT' => isset($topic['tor_status']) ? $lang['TOR_STATUS_NAME'][$topic['tor_status']] : '', 'ATTACH' => $topic['topic_attachment'], 'STATUS' => $topic['topic_status'], 'TYPE' => $topic['topic_type'], 'DL' => $topic['topic_dl_type'] == TOPIC_DL_TYPE_DL && !$forum_data['allow_reg_tracker'], 'POLL' => $topic['topic_vote'], 'DL_CLASS' => isset($topic['dl_status']) ? $dl_link_css[$topic['dl_status']] : '', 'TOPIC_AUTHOR' => profile_url(array('username' => str_short($topic['first_username'], 15), 'user_id' => $topic['first_user_id'], 'user_rank' => $topic['first_user_rank'])), 'LAST_POSTER' => profile_url(array('username' => str_short($topic['last_username'], 15), 'user_id' => $topic['last_user_id'], 'user_rank' => $topic['last_user_rank'])), 'LAST_POST_TIME' => bb_date($topic['topic_last_post_time']), 'LAST_POST_ID' => $topic['topic_last_post_id']));
    if (isset($topic['tor_size'])) {
        $tor_magnet = create_magnet($topic['info_hash'], $topic['auth_key'], $userdata['session_logged_in']);
        $template->assign_block_vars('t.tor', array('SEEDERS' => (int) $topic['seeders'], 'LEECHERS' => (int) $topic['leechers'], 'TOR_SIZE' => humn_size($topic['tor_size']), 'COMPL_CNT' => (int) $topic['complete_count'], 'ATTACH_ID' => $topic['attach_id'], 'MAGNET' => $tor_magnet));
    }
    $found_topics++;
}
unset($topic_rowset);
$pg_url = FORUM_URL . $forum_id;
$pg_url .= $sort_value ? "&sort={$sort_value}" : '';
$pg_url .= $order_value ? "&order={$order_value}" : '';
$template->assign_var('MOD_URL', $pg_url);
$pg_url = FORUM_URL . $forum_id;
$pg_url .= $topic_days ? "&amp;topicdays={$topic_days}" : '';
$pg_url .= $sort_value ? "&amp;sort={$sort_value}" : '';
$pg_url .= $order_value ? "&amp;order={$order_value}" : '';
$pg_url .= $moderation ? "&amp;mod=1" : '';
$pg_url .= $topics_per_page != $bb_cfg['topics_per_page'] ? "&amp;tpp={$topics_per_page}" : '';
if ($found_topics) {
    generate_pagination($pg_url, $forum_topics, $topics_per_page, $start);
} else {
    if ($only_new) {
        $no_topics_msg = $lang['NO_NEW_POSTS'];
    } else {
        $no_topics_msg = $topic_days || $title_match ? $lang['NO_SEARCH_MATCH'] : $lang['NO_TOPICS_POST_ONE'];
    }
    $template->assign_vars(array('NO_TOPICS' => $no_topics_msg));
}
$template->assign_vars(array('PAGE_URL' => $pg_url, 'PAGE_URL_TPP' => url_arg($pg_url, 'tpp', null), 'FOUND_TOPICS' => $found_topics, 'AUTH_MOD' => $is_auth['auth_mod'], 'SESSION_ADMIN' => $userdata['session_admin'], 'MOD_REDIRECT_URL' => $mod_redirect_url, 'MODERATION_ON' => $moderation, 'PRUNE_DAYS' => $forum_data['prune_days'], 'CAT_ID' => $forum_data['cat_id'], 'CAT_TITLE' => $forums['cat_title_html'][$forum_data['cat_id']], 'U_VIEWCAT' => CAT_URL . $forum_data['cat_id'], 'PARENT_FORUM_HREF' => ($parent_id = $forum_data['forum_parent']) ? FORUM_URL . $forum_data['forum_parent'] : '', 'PARENT_FORUM_NAME' => ($parent_id = $forum_data['forum_parent']) ? $forums['forum_name_html'][$parent_id] : ''));
print_page('viewforum.tpl');
Exemple #5
0
        if (empty($topic_rows[$item_id])) {
            continue;
            // if topic was deleted but still remain in search results
        }
        $topic = $topic_rows[$item_id];
        $topic_id = $topic['topic_id'];
        $forum_id = $topic['forum_id'];
        $is_unread = is_unread($topic['topic_last_post_time'], $topic_id, $forum_id);
        $moved = $topic['topic_status'] == TOPIC_MOVED;
        $template->assign_block_vars('t', array('ROW_NUM' => $row_num, 'FORUM_ID' => $forum_id, 'FORUM_NAME' => $forum_name_html[$forum_id], 'TOPIC_ID' => $topic_id, 'HREF_TOPIC_ID' => $moved ? $topic['topic_moved_id'] : $topic['topic_id'], 'TOPIC_TITLE' => wbr($topic['topic_title']), 'IS_UNREAD' => $is_unread, 'TOPIC_ICON' => get_topic_icon($topic, $is_unread), 'PAGINATION' => $moved ? '' : build_topic_pagination(TOPIC_URL . $topic_id, $topic['topic_replies'], $bb_cfg['posts_per_page']), 'REPLIES' => $topic['topic_replies'], 'ATTACH' => $topic['topic_attachment'], 'STATUS' => $topic['topic_status'], 'TYPE' => $topic['topic_type'], 'DL' => $topic['topic_dl_type'] == TOPIC_DL_TYPE_DL, 'POLL' => $topic['topic_vote'], 'DL_CLASS' => isset($topic['dl_status']) ? $dl_link_css[$topic['dl_status']] : '', 'TOPIC_AUTHOR' => profile_url(array('username' => $topic['first_username'], 'user_id' => $topic['first_user_id'], 'user_rank' => $topic['first_user_rank'])), 'LAST_POSTER' => profile_url(array('username' => $topic['last_username'], 'user_id' => $topic['last_user_id'], 'user_rank' => $topic['last_user_rank'])), 'LAST_POST_TIME' => bb_date($topic['topic_last_post_time']), 'LAST_POST_ID' => $topic['topic_last_post_id']));
    }
}
if ($items_display) {
    $items_count = count($items_found);
    $pages = !$items_count ? 1 : ceil($items_count / $per_page);
    $url = $search_id ? url_arg($url, 'id', $search_id) : $url;
    generate_pagination($url, $items_count, $per_page, $start);
    $template->assign_vars(array('PAGE_TITLE' => $lang['SEARCH'], 'SEARCH_MATCHES' => $items_count ? sprintf($lang['FOUND_SEARCH_MATCHES'], $items_count) : '', 'DISPLAY_AS_POSTS' => $post_mode, 'DL_CONTROLS' => $dl_search && $dl_user_id_val == $user_id, 'DL_ACTION' => 'dl_list.php', 'MY_POSTS' => !$post_mode && $my_posts && $user->id == $poster_id_val));
    print_page('search_results.tpl');
}
redirect(basename(__FILE__));
// ----------------------------------------------------------- //
// Functions
//
function fetch_search_ids($sql, $search_type = SEARCH_TYPE_POST)
{
    global $lang, $search_id, $session_id, $items_found, $per_page;
    $items_found = array();
    foreach (DB()->fetch_rowset($sql) as $row) {
        $items_found[] = $row['item_id'];
    }