コード例 #1
0
ファイル: index.php プロジェクト: forummaks/forum_maks
            if (isset($forum_moderators[$forum_id]) && count($forum_moderators[$forum_id]) > 0) {
                $l_moderators = count($forum_moderators[$forum_id]) == 1 ? $lang['Moderator'] : $lang['Moderators'];
                $moderator_list = implode(', ', $forum_moderators[$forum_id]);
            } else {
                $l_moderators = '';
                $moderator_list = '';
            }
            $template->assign_block_vars('catrow.forumrow', array('FORUM_FOLDER_IMG' => $folder_image, 'FORUM_NAME' => $forum_data['forum_name'], 'FORUM_DESC' => $forum_data['forum_desc'], 'LAST_POST' => $last_post, 'MODERATORS' => $moderator_list, 'ORDER' => $forum_data['forum_order'], 'L_MODERATOR' => $l_moderators, 'L_FORUM_FOLDER_ALT' => $folder_alt, 'U_VIEWFORUM' => append_sid("viewforum.php?" . POST_FORUM_URL . "={$forum_id}")));
            //flt
            if ($forum_data['forum_last_post_id']) {
                if ($forum_data['user_id'] == GUEST_UID) {
                    $last_post_uname = $forum_data['post_username'] ? $forum_data['post_username'] : $lang['Guest'];
                } else {
                    $last_post_uname = $forum_data['username'];
                }
                $template->assign_block_vars('catrow.forumrow.last', array('FORUM_LAST_POST' => TRUE, 'SHOW_LAST_TOPIC' => SHOW_FORUM_LAST_TOPIC, 'LAST_TOPIC_HREF' => append_sid("viewtopic.php?" . POST_TOPIC_URL . '=' . $forum_data['last_topic_id']), 'LAST_TOPIC_TIP' => $forum_data['last_topic_title'], 'LAST_TOPIC_TITLE' => str_short($forum_data['last_topic_title'], LAST_TOPIC_MAX_LEN), 'LAST_POST_TIME' => create_date(LAST_POST_DATE_FORMAT, $forum_data['post_time'], $ft_cfg['board_timezone']), 'LAST_POST_HREF' => append_sid("viewtopic.php?" . POST_POST_URL . '=' . $forum_data['forum_last_post_id']) . '#' . $forum_data['forum_last_post_id'], 'LAST_POST_USER_NAME' => $last_post_uname, 'LAST_POST_USER_HREF' => $forum_data['user_id'] != GUEST_UID ? append_sid("profile.php?mode=viewprofile&" . POST_USERS_URL . '=' . $forum_data['user_id']) : '', 'ICON_LATEST_REPLY' => $images['icon_latest_reply']));
            } else {
                $template->assign_block_vars('catrow.forumrow.last', array('FORUM_LAST_POST' => FALSE));
            }
            //flt end
        }
    }
    // for ... categories
} else {
    message_die(GENERAL_MESSAGE, $lang['No_forums']);
}
//bt search
$s_link = "search.php?search_id=dl&dl_status=";
$template->assign_vars(array('L_SEARCH_DL' => $lang['Search_DL'], 'L_SEARCH_DL_WILL' => $lang['Search_DL_Will'], 'L_SEARCH_DL_DOWN' => $lang['Search_DL_Down'], 'L_SEARCH_DL_COMPLETE' => $lang['Search_DL_Complete'], 'L_SEARCH_DL_CANCEL' => $lang['Search_DL_Cancel'], 'U_SEARCH_DL_WILL' => $s_link . DL_STATUS_WILL, 'U_SEARCH_DL_DOWN' => $s_link . DL_STATUS_DOWN, 'U_SEARCH_DL_COMPLETE' => $s_link . DL_STATUS_COMPLETE, 'U_SEARCH_DL_CANCEL' => $s_link . DL_STATUS_CANCEL));
//bt search end
//
コード例 #2
0
ファイル: admin_forums.php プロジェクト: ErR163/torrentpier
function sf_get_list($mode, $exclude = 0, $select = 0)
{
    global $cat_forums, $forum_parent;
    $opt = '';
    if ($mode == 'forum') {
        foreach ($cat_forums as $cid => $c) {
            $opt .= '<optgroup label="&nbsp;' . htmlCHR($c['cat_title']) . '">';
            foreach ($c['f'] as $fid => $f) {
                $selected = $fid == $select ? HTML_SELECTED : '';
                $disabled = $fid == $exclude && !$forum_parent ? HTML_DISABLED : '';
                $style = $disabled ? ' style="color: gray" ' : ($fid == $exclude ? ' style="color: darkred" ' : '');
                $opt .= '<option value="' . $fid . '" ' . $selected . $disabled . $style . '>' . ($f['forum_parent'] ? HTML_SF_SPACER : '') . htmlCHR(str_short($f['forum_name'], 60)) . "&nbsp;</option>\n";
            }
            $opt .= '</optgroup>';
        }
    }
    return $opt;
}
コード例 #3
0
ファイル: group.php プロジェクト: ErR163/torrentpier
 function build_group($params)
 {
     global $lang;
     $options = '';
     foreach ($params as $name => $data) {
         $text = htmlCHR(str_short(rtrim($name), HTML_SELECT_MAX_LENGTH));
         $members = $data['m'] ? $lang['MEMBERS_IN_GROUP'] . ': ' . $data['m'] : $lang['NO_GROUP_MEMBERS'];
         $candidates = $data['c'] ? $lang['PENDING_MEMBERS'] . ': ' . $data['c'] : $lang['NO_PENDING_GROUP_MEMBERS'];
         $options .= '<li class="pad_2"><a href="' . GROUP_URL . $data['id'] . '" class="med bold">' . $text . '</a></li>';
         $options .= $data['rg'] ? '<ul><li class="med">' . $lang['RELEASE_GROUP'] . '</li>' : '<ul>';
         $options .= '<li class="seedmed">' . $members . '</li>';
         if (IS_AM) {
             $options .= '<li class="leechmed">' . $candidates . '</li>';
         }
         $options .= '</ul>';
     }
     return $options;
 }
コード例 #4
0
ファイル: admin_ug_auth.php プロジェクト: ErR163/torrentpier
 if (!($forums = $datastore->get('cat_forums'))) {
     $datastore->update('cat_forums');
     $forums = $datastore->get('cat_forums');
 }
 $base_url = basename(__FILE__) . "?mode=group&amp;g={$group_id}";
 $ug_data = array('group_id' => $group_id);
 $u_access = auth(AUTH_ALL, AUTH_LIST_ALL, $ug_data);
 foreach ($forums['c'] as $c_id => $c_data) {
     $template->assign_block_vars('c', array('CAT_ID' => $c_id, 'CAT_TITLE' => $forums['cat_title_html'][$c_id], 'CAT_HREF' => "{$base_url}&amp;c={$c_id}"));
     if (!($c =& $_REQUEST['c']) or !in_array($c, array('all', $c_id)) or empty($c_data['forums'])) {
         continue;
     }
     foreach ($c_data['forums'] as $f_id) {
         $f_data = $forums['f'][$f_id];
         $auth_mod = $u_access[$f_id]['auth_mod'];
         $template->assign_block_vars('c.f', array('DISABLED' => false, 'FORUM_ID' => $f_id, 'FORUM_NAME' => str_short($forums['forum_name_html'][$f_id], $max_forum_name_length), 'SF_SPACER' => $f_data['forum_parent'] ? HTML_SF_SPACER : '', 'IS_MODERATOR' => (bool) $auth_mod, 'MOD_STATUS' => $auth_mod ? $lang['MODERATOR'] : $lang['NO'], 'MOD_CLASS' => $auth_mod ? 'yesMOD' : 'noMOD', 'AUTH_MOD_VAL' => $auth_mod ? 1 : 0));
         foreach ($forum_auth_fields as $auth_type) {
             $bf_num = $bf['forum_perm'][$auth_type];
             $f_perm = $f_data[$auth_type];
             $auth_via_acl = $u_access[$f_id][$auth_type];
             if ($f_perm == AUTH_ACL) {
                 $disabled = $auth_mod;
                 $perm_sign = $auth_via_acl || $auth_mod ? $yes_sign : $no_sign;
                 $acl_class = $auth_via_acl || $auth_mod ? 'yes' : 'no';
             } else {
                 $disabled = true;
                 $perm_sign = $auth_via_acl ? $yes_sign : $no_sign;
                 $acl_class = $auth_via_acl ? 'yes' : 'no';
             }
             $template->assign_block_vars('c.f.acl', array('DISABLED' => $disabled, 'PERM_SIGN' => $perm_sign, 'ACL_CLASS' => $acl_class, 'FORUM_ID' => $f_id, 'ACL_TYPE_BF' => $bf_num, 'ACL_VAL' => $auth_via_acl ? 1 : 0));
         }
コード例 #5
0
set_tpl_vars($default_cfg_str, $cfg);
set_tpl_vars_lang($default_cfg_str);
set_tpl_vars_bool($default_cfg_bool, $cfg);
set_tpl_vars_lang($default_cfg_bool);
set_tpl_vars($default_cfg_num, $cfg);
set_tpl_vars_lang($default_cfg_num);
set_tpl_vars_lang($db_fields_bool);
// Get Forums list
$sql = "SELECT f.*\n\tFROM " . BB_CATEGORIES . " c, " . BB_FORUMS . " f\n\tWHERE f.cat_id = c.cat_id\n\tORDER BY c.cat_order, f.forum_order";
if (!($result = DB()->sql_query($sql))) {
    bb_die('Could not obtain forum names');
}
$rowset = DB()->sql_fetchrowset($result);
$forum_rows = min($max_forum_rows, count($rowset));
foreach ($db_fields_bool as $field_name => $field_def_val) {
    ${$field_name} = '';
}
foreach ($rowset as $rid => $forum) {
    foreach ($db_fields_bool as $field_name => $field_def_val) {
        $forum_name = $forum['forum_name'];
        $selected = $forum[$field_name] ? ' selected="selected"' : '';
        $forum_name = str_short($forum_name, $max_forum_name_len);
        ${$field_name} .= '<option value="' . $forum['forum_id'] . '" ' . $selected . '>&nbsp;' . ($forum['forum_parent'] ? HTML_SF_SPACER : '') . htmlCHR($forum_name) . "</option>\n";
    }
}
foreach ($db_fields_bool as $field_name => $field_def_val) {
    ${$field_name} = '<select name="' . $field_name . "[]\" multiple=\"multiple\" size=\"{$forum_rows}\">" . ${$field_name} . '</select>';
    $template->assign_vars(array('S_' . strtoupper($field_name) => ${$field_name}));
}
$template->assign_vars(array('L_BT_SHOW_PEERS_MODE_COUNT' => $cfg['bt_show_peers_mode'] == SHOW_PEERS_COUNT ? '<u>' . $lang['BT_SHOW_PEERS_MODE_COUNT'] . '</u>' : $lang['BT_SHOW_PEERS_MODE_COUNT'], 'L_BT_SHOW_PEERS_MODE_NAMES' => $cfg['bt_show_peers_mode'] == SHOW_PEERS_NAMES ? '<u>' . $lang['BT_SHOW_PEERS_MODE_NAMES'] . '</u>' : $lang['BT_SHOW_PEERS_MODE_NAMES'], 'L_BT_SHOW_PEERS_MODE_FULL' => $cfg['bt_show_peers_mode'] == SHOW_PEERS_FULL ? '<u>' . $lang['BT_SHOW_PEERS_MODE_FULL'] . '</u>' : $lang['BT_SHOW_PEERS_MODE_FULL'], 'BT_SHOW_PEERS_MODE_COUNT_VAL' => SHOW_PEERS_COUNT, 'BT_SHOW_PEERS_MODE_NAMES_VAL' => SHOW_PEERS_NAMES, 'BT_SHOW_PEERS_MODE_FULL_VAL' => SHOW_PEERS_FULL, 'BT_SHOW_PEERS_MODE_COUNT_SEL' => $cfg['bt_show_peers_mode'] == SHOW_PEERS_COUNT ? HTML_CHECKED : '', 'BT_SHOW_PEERS_MODE_NAMES_SEL' => $cfg['bt_show_peers_mode'] == SHOW_PEERS_NAMES ? HTML_CHECKED : '', 'BT_SHOW_PEERS_MODE_FULL_SEL' => $cfg['bt_show_peers_mode'] == SHOW_PEERS_FULL ? HTML_CHECKED : '', 'S_HIDDEN_FIELDS' => '', 'S_CONFIG_ACTION' => 'admin_bt_forum_cfg.php'));
print_page('admin_bt_forum_cfg.tpl', 'admin');
コード例 #6
0
ファイル: viewforum.php プロジェクト: ErR163/torrentpier
    $t_type = $topic['topic_type'];
    $separator = '';
    $is_unread = is_unread($topic['topic_last_post_time'], $topic_id, $forum_id);
    if ($t_type == POST_ANNOUNCE && !defined('ANNOUNCE_SEP')) {
        define('ANNOUNCE_SEP', true);
        $separator = $lang['TOPICS_ANNOUNCEMENT'];
    } elseif ($t_type == POST_STICKY && !defined('STICKY_SEP')) {
        define('STICKY_SEP', true);
        $separator = $lang['TOPICS_STICKY'];
    } elseif ($t_type == POST_NORMAL && !defined('NORMAL_SEP')) {
        if (defined('ANNOUNCE_SEP') || defined('STICKY_SEP')) {
            define('NORMAL_SEP', true);
            $separator = $lang['TOPICS_NORMAL'];
        }
    }
    $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}" : '';
コード例 #7
0
ファイル: functions.php プロジェクト: ErR163/torrentpier
 function _build_select_rec($params)
 {
     foreach ($params as $opt_name => $opt_val) {
         $opt_name = rtrim($opt_name);
         if (is_array($opt_val)) {
             $this->cur_attr =& $this->cur_attr[$opt_name];
             $label = htmlCHR(str_short($opt_name, $this->max_length));
             $this->options .= "\t<optgroup label=\"&nbsp;" . $label . "\">\n";
             $this->_build_select_rec($opt_val);
             $this->options .= "\t</optgroup>\n";
             $this->cur_attr =& $this->attr;
         } else {
             $text = htmlCHR(str_short($opt_name, $this->max_length));
             $value = ' value="' . htmlCHR($opt_val) . '"';
             $class = isset($this->cur_attr[$opt_name]['class']) ? ' class="' . $this->cur_attr[$opt_name]['class'] . '"' : '';
             $style = isset($this->cur_attr[$opt_name]['style']) ? ' style="' . $this->cur_attr[$opt_name]['style'] . '"' : '';
             $selected = isset($this->selected[$opt_val]) ? HTML_SELECTED : '';
             $disabled = isset($this->cur_attr[$opt_name]['disabled']) ? HTML_DISABLED : '';
             $this->options .= "\t\t<option" . $class . $style . $selected . $disabled . $value . '>&nbsp;' . $text . "&nbsp;</option>\n";
         }
     }
 }
コード例 #8
0
ファイル: topic_watch.php プロジェクト: ErR163/torrentpier
    if (!($result = DB()->sql_query($sql))) {
        bb_die('Could not delete topic watch information #1');
    }
}
$template->assign_vars(array('PAGE_TITLE' => $lang['WATCHED_TOPICS'], 'S_FORM_ACTION' => BB_ROOT . 'profile.php?mode=watch'));
$sql = "SELECT COUNT(topic_id) as watch_count FROM " . BB_TOPICS_WATCH . " WHERE user_id = {$user_id}";
if (!($result = DB()->sql_query($sql))) {
    bb_die('Could not obtain watch topic information #2');
}
$row = DB()->sql_fetchrow($result);
$watch_count = $row['watch_count'] ? $row['watch_count'] : 0;
DB()->sql_freeresult($result);
if ($watch_count > 0) {
    $sql = "SELECT w.*, t.*, f.*, u.*, u2.username as last_username, u2.user_id as last_user_id,\n\t\tu2.user_level as last_user_level, u2.user_rank as last_user_rank\n\tFROM " . BB_TOPICS_WATCH . " w, " . BB_TOPICS . " t, " . BB_USERS . " u, " . BB_FORUMS . " f, " . BB_POSTS . " p, " . BB_USERS . " u2\n\tWHERE w.topic_id = t.topic_id\n\t\tAND t.forum_id = f.forum_id\n\t\tAND p.post_id = t.topic_last_post_id\n\t\tAND p.poster_id = u2.user_id\n\t\tAND t.topic_poster = u.user_id\n\t\tAND w.user_id = {$user_id}\n\tGROUP BY t.topic_last_post_time DESC\n\tLIMIT {$start}, {$per_page}";
    if (!($result = DB()->sql_query($sql))) {
        bb_die('Could not obtain watch topic information #3');
    }
    $watch = DB()->sql_fetchrowset($result);
    if ($watch) {
        for ($i = 0; $i < count($watch); $i++) {
            $is_unread = is_unread($watch[$i]['topic_last_post_time'], $watch[$i]['topic_id'], $watch[$i]['forum_id']);
            $template->assign_block_vars('watch', array('ROW_CLASS' => !($i % 2) ? 'row1' : 'row2', 'POST_ID' => $watch[$i]['topic_first_post_id'], 'TOPIC_ID' => $watch[$i]['topic_id'], 'TOPIC_TITLE' => wbr(str_short($watch[$i]['topic_title'], 70)), 'FULL_TOPIC_TITLE' => wbr($watch[$i]['topic_title']), 'U_TOPIC' => TOPIC_URL . $watch[$i]['topic_id'], 'FORUM_TITLE' => wbr($watch[$i]['forum_name']), 'U_FORUM' => FORUM_URL . $watch[$i]['forum_id'], 'REPLIES' => $watch[$i]['topic_replies'], 'AUTHOR' => profile_url($watch[$i]), 'LAST_POST' => bb_date($watch[$i]['topic_last_post_time']) . '<br />' . profile_url(array('user_id' => $watch[$i]['last_user_id'], 'username' => $watch[$i]['last_username'], 'user_rank' => $watch[$i]['last_user_rank'])), 'LAST_POST_ID' => $watch[$i]['topic_last_post_id'], 'IS_UNREAD' => $is_unread, 'TOPIC_ICON' => get_topic_icon($watch[$i], $is_unread), 'PAGINATION' => $watch[$i]['topic_status'] == TOPIC_MOVED ? '' : build_topic_pagination(TOPIC_URL . $watch[$i]['topic_id'], $watch[$i]['topic_replies'], $bb_cfg['posts_per_page'])));
        }
        $template->assign_vars(array('MATCHES' => count($watch) == 1 ? sprintf($lang['FOUND_SEARCH_MATCH'], count($watch)) : sprintf($lang['FOUND_SEARCH_MATCHES'], count($watch)), 'PAGINATION' => generate_pagination(BB_ROOT . 'profile.php?mode=watch', $watch_count, $per_page, $start), 'PAGE_NUMBER' => sprintf($lang['PAGE_OF'], floor($start / $per_page) + 1, ceil($watch_count / $per_page)), 'U_PER_PAGE' => BB_ROOT . 'profile.php?mode=watch', 'PER_PAGE' => $per_page));
    }
    DB()->sql_freeresult($result);
} else {
    meta_refresh('index.php', 3);
    bb_die($lang['NO_WATCHED_TOPICS']);
}
print_page('usercp_topic_watch.tpl');
コード例 #9
0
ファイル: index.php プロジェクト: ErR163/torrentpier
        $latest_news = $datastore->get('latest_news');
    }
    $template->assign_vars(array('SHOW_LATEST_NEWS' => true));
    foreach ($latest_news as $news) {
        $template->assign_block_vars('news', array('NEWS_TOPIC_ID' => $news['topic_id'], 'NEWS_TITLE' => str_short($news['topic_title'], $bb_cfg['max_news_title']), 'NEWS_TIME' => bb_date($news['topic_time'], 'd-M', false), 'NEWS_IS_NEW' => is_unread($news['topic_time'], $news['topic_id'], $news['forum_id'])));
    }
}
// Network news
if ($bb_cfg['show_network_news']) {
    if (!($network_news = $datastore->get('network_news'))) {
        $datastore->update('network_news');
        $network_news = $datastore->get('network_news');
    }
    $template->assign_vars(array('SHOW_NETWORK_NEWS' => true));
    foreach ($network_news as $net) {
        $template->assign_block_vars('net', array('NEWS_TOPIC_ID' => $net['topic_id'], 'NEWS_TITLE' => str_short($net['topic_title'], $bb_cfg['max_net_title']), 'NEWS_TIME' => bb_date($net['topic_time'], 'd-M', false), 'NEWS_IS_NEW' => is_unread($net['topic_time'], $net['topic_id'], $net['forum_id'])));
    }
}
if ($bb_cfg['birthday_check_day'] && $bb_cfg['birthday_enabled']) {
    $week_list = $today_list = array();
    $week_all = $today_all = false;
    if ($stats['birthday_week_list']) {
        shuffle($stats['birthday_week_list']);
        foreach ($stats['birthday_week_list'] as $i => $week) {
            if ($i >= 5) {
                $week_all = true;
                continue;
            }
            $week_list[] = profile_url($week) . ' <span class="small">(' . birthday_age($week['user_birthday'] - 1) . ')</span>';
        }
        $week_all = $week_all ? '&nbsp;<a class="txtb" href="#" onclick="ajax.exec({action: \'index_data\', mode: \'birthday_week\'}); return false;" title="' . $lang['ALL'] . '">...</a>' : '';
コード例 #10
0
             bb_die('Could not query attachments #3');
         }
         $ids = DB()->sql_fetchrowset($result);
         $num_ids = DB()->num_rows($result);
         DB()->sql_freeresult($result);
         for ($j = 0; $j < $num_ids; $j++) {
             if ($ids[$j]['post_id'] != 0) {
                 $sql = "SELECT t.topic_title\n\t\t\t\t\tFROM " . BB_TOPICS . " t, " . BB_POSTS . " p\n\t\t\t\t\tWHERE p.post_id = " . intval($ids[$j]['post_id']) . " AND p.topic_id = t.topic_id\n\t\t\t\t\tGROUP BY t.topic_id, t.topic_title";
                 if (!($result = DB()->sql_query($sql))) {
                     bb_die('Could not query topic');
                 }
                 $row = DB()->sql_fetchrow($result);
                 DB()->sql_freeresult($result);
                 $post_title = $row['topic_title'];
                 if (strlen($post_title) > 32) {
                     $post_title = str_short($post_title, 30);
                 }
                 $view_topic = BB_ROOT . 'viewtopic.php?' . POST_POST_URL . '=' . $ids[$j]['post_id'] . '#' . $ids[$j]['post_id'];
                 $post_titles[] = '<a href="' . $view_topic . '" class="gen" target="_blank">' . $post_title . '</a>';
             } else {
                 $post_titles[] = $lang['PRIVATE_MESSAGE'];
             }
         }
         $post_titles = implode('<br />', $post_titles);
         $hidden_field = '<input type="hidden" name="attach_id_list[]" value="' . intval($attachments[$i]['attach_id']) . '" />';
         $template->assign_block_vars('attachrow', array('ROW_NUMBER' => $i + (@$_GET['start'] + 1), 'ROW_CLASS' => $row_class, 'FILENAME' => htmlspecialchars($attachments[$i]['real_filename']), 'COMMENT' => htmlspecialchars($attachments[$i]['comment']), 'EXTENSION' => $attachments[$i]['extension'], 'SIZE' => round($attachments[$i]['filesize'] / 1024, 2), 'DOWNLOAD_COUNT' => $attachments[$i]['download_count'], 'POST_TIME' => bb_date($attachments[$i]['filetime']), 'POST_TITLE' => $post_titles, 'S_DELETE_BOX' => $delete_box, 'S_HIDDEN' => $hidden_field, 'U_VIEW_ATTACHMENT' => BB_ROOT . DOWNLOAD_URL . $attachments[$i]['attach_id']));
     }
 }
 if (!$search_based && !$user_based) {
     if ($total_attachments == 0) {
         $sql = "SELECT attach_id FROM " . BB_ATTACHMENTS_DESC;