示例#1
0
function make_forum_select($box_name, $ignore_forum = false, $select_forum = '')
{
    $not_auth_forums = user_not_auth_forums(AUTH_VIEW);
    $ignore_forum_sql = $not_auth_forums ? "AND f.forum_id NOT IN({$not_auth_forums})" : '';
    $sql = 'SELECT c.cat_id, c.cat_title, f.forum_id, f.forum_name, f.forum_parent
		FROM ' . FORUMS_TABLE . ' f, ' . CATEGORIES_TABLE . " c\n\t\tWHERE f.cat_id = c.cat_id\n\t\t\t{$ignore_forum_sql}\n\t\tORDER BY c.cat_order, f.cat_id, f.forum_order";
    if (!($result = DB()->sql_query($sql))) {
        message_die(GENERAL_ERROR, 'Could not query cat/forum info', '', __LINE__, __FILE__, $sql);
    }
    if ($rowset = @DB()->sql_fetchrowset($result)) {
        DB()->sql_freeresult($result);
        $forum_list = '';
        foreach ($rowset as $rid => $row) {
            $cat_forum[$row['cat_id']]['cat_title'] = $row['cat_title'];
            $cat_forum[$row['cat_id']]['f'][$row['forum_id']] = $row;
        }
        foreach ($cat_forum as $cid => $c) {
            $forum_list .= '<optgroup label="&nbsp;' . $c['cat_title'] . '">';
            foreach ($c['f'] as $fid => $f) {
                $selected = $f['forum_id'] == $select_forum ? ' selected="selected"' : '';
                $disabled = $f['forum_id'] == $ignore_forum ? ' disabled="disabled"' : '';
                $forum_list .= '<option value="' . $f['forum_id'] . '" ' . $selected . $disabled . '>' . ($f['forum_parent'] ? SF_SEL_SPACER : '') . $f['forum_name'] . '</option>';
            }
            $forum_list .= '</optgroup>';
        }
    } else {
        $forum_list = '<option value="-1">-- ! No Forums ! --</option>';
    }
    return '<select name="' . $box_name . '">' . $forum_list . '</select>';
}
示例#2
0
}
if ($total_users == 0) {
    $l_total_user_s = $lang['Registered_users_zero_total'];
} else {
    if ($total_users == 1) {
        $l_total_user_s = $lang['Registered_user_total'];
    } else {
        $l_total_user_s = $lang['Registered_users_total'];
    }
}
//
// Start page proper
//
$cat_forums = $forum_data = array();
$curr_sf_num = $last_sf_id = $last_root_forum_id = NULL;
$not_auth_forums = user_not_auth_forums(AUTH_VIEW);
$ignore_forum_sql = $not_auth_forums ? "AND f.forum_id NOT IN({$not_auth_forums})" : '';
//flt - add [, t.topic_id AS last_topic_id, t.topic_title AS last_topic_title] and [LEFT JOIN " . TOPICS_TABLE ...]
$sql = 'SELECT c.cat_title, f.*, p.post_time, p.post_username, u.username, u.user_id, t.topic_id AS last_topic_id, t.topic_title AS last_topic_title
	FROM ' . CATEGORIES_TABLE . ' c
		LEFT JOIN ' . FORUMS_TABLE . " f ON f.cat_id = c.cat_id {$ignore_forum_sql}\r\n\t\tLEFT JOIN " . POSTS_TABLE . ' p ON p.post_id = f.forum_last_post_id
		LEFT JOIN ' . USERS_TABLE . ' u ON u.user_id = p.poster_id
		LEFT JOIN ' . TOPICS_TABLE . ' t ON t.topic_last_post_id = f.forum_last_post_id
	ORDER BY c.cat_order, f.cat_id, f.forum_order';
if (!($result = DB()->sql_query($sql))) {
    message_die(GENERAL_ERROR, 'Could not query forums information', '', __LINE__, __FILE__, $sql);
}
if ($rowset = DB()->sql_fetchrowset($result)) {
    foreach ($rowset as $rid => $row) {
        if ($cat_id = $row['cat_id']) {
            $cat_forums[$cat_id]['cat_title'] = $row['cat_title'];
示例#3
0
$up_down_ratio = $total_downloaded ? round(($total_uploaded + $total_bonus) / $total_downloaded, 2) : '-';
$auth_key = @$user_tor_info['auth_key'] ? $user_tor_info['auth_key'] : '';
if ($userdata['user_level'] == ADMIN) {
    $template->assign_block_vars('switch_auth_key', array());
    $template->assign_vars(array('AUTH_KEY' => $auth_key));
}
$template->assign_vars(array('TOTAL_UPLOADED' => humn_size($total_uploaded), 'TOTAL_DOWNLOADED' => humn_size($total_downloaded), 'TOTAL_BONUS' => humn_size($total_bonus), 'WHAT_IS_BONUS' => '<a href="' . append_sid("viewtopic.php?t=147") . '" class="genmed">' . $lang['Bt_What_Is_Bonus'] . '</a>', 'UP_DOWN_RATIO' => $up_down_ratio));
// get affected torrents
$sql = "SELECT torrent_id\r\n\t\tFROM " . BT_TRACKER_TABLE . " \r\n\t\tWHERE user_id = " . $profile_user_id;
$result = DB()->sql_query($sql) or message_die(GENERAL_ERROR, 'Cant query affected torrents', '', __LINE__, __FILE__, $sql);
while ($row = DB()->sql_fetchrow($result)) {
    $affected_torrents[] = $row['torrent_id'];
}
unset($row);
// Auth
$ignore_forum_sql = ($f = user_not_auth_forums(AUTH_VIEW)) ? "AND f.forum_id NOT IN({$f})" : '';
if ($affected_count = count($affected_torrents)) {
    $affected_torrents = implode(", ", $affected_torrents);
    $affected_torrents = 'AND tr.torrent_id IN (' . $affected_torrents . ')';
    $leech_cnt = $seed_cnt = $peer_cnt = $speed_up = $speed_down = array();
    $sql = " SELECT f.forum_id, f.forum_name, \r\n\t\t\t\t\tt.topic_id, t.topic_title,\r\n\t\t\t\t\ttr.seeder, tr.releaser, tr.peer_id, tr.speed_up, tr.speed_down, tr.user_id, tr.torrent_id,\r\n\t\t\t\t\ttor.poster_id\t\t\t\t\r\n\t\t\t FROM\t" . FORUMS_TABLE . " f, " . TOPICS_TABLE . " t, " . BT_TRACKER_TABLE . " tr, " . BT_TORRENTS_TABLE . " tor\r\n\t\t\t WHERE\ttr.expire_time > " . TIMENOW . "\r\n\t\t\t AND \ttr.torrent_id = tor.torrent_id\r\n\t\t\t AND \ttor.topic_id = t.topic_id\r\n\t\t\t AND \tt.forum_id = f.forum_id\r\n\r\n\t\t\t\t\t\t{$ignore_forum_sql}\r\n\t\t\t\t\t\t{$affected_torrents}\r\n\t\t\t\r\n\t\t\t ORDER BY f.forum_name, t.topic_title ";
    $result = DB()->sql_query($sql) or message_die(GENERAL_ERROR, 'Could not query ', '', __LINE__, __FILE__, $sql);
    while ($row = DB()->sql_fetchrow($result)) {
        $leech_cnt[$row['torrent_id']] = 0;
        $unsorted[] = $row;
        $speed_up[$row['torrent_id']] += $row['speed_up'];
        $speed_down[$row['torrent_id']] += $row['speed_down'];
        switch ($row['seeder']) {
            case 1:
                $seed_cnt[$row['torrent_id']]++;
                break;