while ($v = DB::fetch($query)) {
                 showtablerow('', array('class="td25"'), array("<input type=\"checkbox\" class=\"checkbox\" name=\"delete[]\" value=\"{$v['tid']}\">", $v['tid'], "<a href=\"forum.php?mod=viewthread&tid={$v['tid']}\" target=\"_blank\">{$v['subject']}</a>", '<a href="forum.php?mod=forumdisplay&fid=' . $v['fid'] . '" target="_blank">' . $_G['cache']['forums'][$v['fid']]['name'] . '</a>', $v['replies'], dgmdate($v['dateline'], 'u')));
             }
         }
         $multipage = isset($multipage) ? $multipage : '';
         showsubmit('delpositionsubmit', 'deleteposition', 'select_all', '<input type="submit" class="btn" name="delandaddsubmit" value="' . cplang('delandadd') . '" />', $multipage);
         showtablefooter();
         showformfooter();
     }
 } elseif ($do == 'add') {
     if (submitcheck('addpositionsubmit', 1)) {
         $delete = isset($_G['gp_delete']) && is_array($_G['gp_delete']) ? $_G['gp_delete'] : (!empty($_G['gp_tids']) ? explode(',', $_G['gp_tids']) : '');
         if (empty($delete)) {
             cpmsg('select_thread_empty');
         }
         $lastpid = create_position($delete, intval($_G['gp_lastpid']));
         if (empty($delete)) {
             cpmsg('add_postposition_succeed', 'action=threads&operation=postposition', 'succeed');
         }
         cpmsg('addpostposition_continue', 'action=threads&operation=postposition&do=add&addpositionsubmit=yes&formhash=' . FORMHASH . '&tids=' . urlencode(implode(',', $delete)) . '&lastpid=' . $lastpid, 'succeed');
     } else {
         showsubmenu('threads_postposition', array(array('admin', 'threads&operation=postposition', !$do), array('add', 'threads&operation=postposition&do=add', $do == 'add')));
         showtips('threads_postposition_tips');
         showformheader('threads&operation=postposition&do=add');
         showtableheader('srchthread', 'fixpadding');
         echo '<tr><td>' . cplang('srch_replies') . '<label><input type="radio" name="replies" value="5000"' . ($_G['gp_replies'] == 5000 ? ' checked="checked"' : '') . ' />5000</label> &nbsp;&nbsp;' . '<label><input type="radio" name="replies" value="10000"' . ($_G['gp_replies'] == 10000 ? ' checked="checked"' : '') . ' />10000</label>&nbsp;&nbsp;' . '<label><input type="radio" name="replies" value="20000"' . ($_G['gp_replies'] == 20000 ? ' checked="checked"' : '') . ' />20000</label>&nbsp;&nbsp;' . '<label><input type="radio" name="replies" value="50000"' . ($_G['gp_replies'] == 50000 ? ' checked="checked"' : '') . ' />50000</label>&nbsp;&nbsp;' . '<label><input id="replies_other" type="radio" name="replies" value="0"' . (isset($_G['gp_replies']) && $_G['gp_replies'] == 0 ? ' checked="checked"' : '') . ' onclick="$(\'above_replies\').focus()" />' . cplang('threads_postposition_replies') . '</label>&nbsp;' . '<input id="above_replies" onclick="$(\'replies_other\').checked=true" type="text class="txt" name="above_replies" value="' . $_G['gp_above_replies'] . '" size="5" />&nbsp;&nbsp;&nbsp;&nbsp;' . '&nbsp;&nbsp;&nbsp;&nbsp;<label>' . cplang('srch_tid') . '&nbsp;<input type="text class="txt" name="srchtid" size="5" value="' . $_G[gp_srchtid] . '" /></label>&nbsp;' . '&nbsp;&nbsp;&nbsp;<input type="submit" class="btn" name="srchthreadsubmit" value="' . cplang('submit') . '" />';
         showtablefooter();
         showformfooter();
         loadcache('forums');
         showformheader('threads&operation=postposition&do=add');
         showtableheader('addposition', 'fixpadding');
             $query = $db->query("SELECT * FROM {$tablepre}threads WHERE tid IN ({$tids})");
             while ($v = $db->fetch_array($query)) {
                 showtablerow('', array('class="td25"'), array("<input type=\"checkbox\" class=\"checkbox\" name=\"delete[]\" value=\"{$v['tid']}\">", $v['tid'], "<a href=\"viewthread.php?tid={$v['tid']}\" target=\"_blank\">{$v['subject']}</a>", '<a href="forumdisplay.php?fid=' . $v['fid'] . '" target="_blank">' . $_DCACHE['forums'][$v['fid']]['name'] . '</a>', $v['replies'], dgmdate("{$dateformat} {$timeformat}", $v['dateline'] + $timeoffset * 3600)));
             }
         }
         showsubmit('delpositionsubmit', 'deleteposition', 'select_all', '<input type="submit" class="btn" name="delandaddsubmit" value="' . lang('delandadd') . '" />', $multipage);
         showtablefooter();
         showformfooter();
     }
 } elseif ($do == 'add') {
     if (submitcheck('addpositionsubmit', 1)) {
         $delete = isset($delete) && is_array($delete) ? $delete : explode(',', $tids);
         if (empty($delete)) {
             cpmsg('select_thread_empty');
         }
         $lastpid = create_position($delete, $lastpid);
         if (empty($delete)) {
             cpmsg('add_postposition_succeed', $BASESCRIPT . '?action=threads&operation=postposition');
         }
         cpmsg('addpostposition_continue', $BASESCRIPT . '?action=threads&operation=postposition&do=add&addpositionsubmit=yes&formhash=' . FORMHASH . '&tids=' . urlencode(implode(',', $delete)) . '&lastpid=' . $lastpid);
     } else {
         showsubmenu('threads_postposition', array(array('admin', 'threads&operation=postposition', !$do), array('add', 'threads&operation=postposition&do=add', $do == 'add')));
         showtips('threads_postposition_tips');
         showformheader('threads&operation=postposition&do=add');
         showtableheader('srchthread', 'fixpadding');
         echo '<tr><td>' . lang('srch_replies') . '<label><input type="radio" name="replies" value="5000"' . ($replies == 5000 ? ' checked="checked"' : '') . ' />5000</label> &nbsp;&nbsp;' . '<label><input type="radio" name="replies" value="10000"' . ($replies == 10000 ? ' checked="checked"' : '') . ' />10000</label>&nbsp;&nbsp;' . '<label><input type="radio" name="replies" value="20000"' . ($replies == 20000 ? ' checked="checked"' : '') . ' />20000</label>&nbsp;&nbsp;' . '<label><input type="radio" name="replies" value="50000"' . ($replies == 50000 ? ' checked="checked"' : '') . ' />50000</label>&nbsp;&nbsp;' . '<label><input id="replies_other" type="radio" name="replies" value="0"' . (isset($replies) && $replies == 0 ? ' checked="checked"' : '') . ' onclick="$(\'above_replies\').focus()" />' . lang('threads_postposition_replies') . '</label>&nbsp;' . '<input id="above_replies" onclick="$(\'replies_other\').checked=true" type="text class="txt" name="above_replies" value="' . $above_replies . '" size="5" />&nbsp;&nbsp;&nbsp;&nbsp;' . '&nbsp;&nbsp;&nbsp;&nbsp;<label>' . lang('srch_tid') . '&nbsp;<input type="text class="txt" name="srchtid" size="5" value="' . $srchtid . '" /></label>&nbsp;' . '&nbsp;&nbsp;&nbsp;<input type="submit" class="btn" name="srchthreadsubmit" value="' . lang('submit') . '" />';
         showtablefooter();
         showformfooter();
         @(include DISCUZ_ROOT . '/forumdata/cache/cache_forums.php');
         showformheader('threads&operation=postposition&do=add');
         showtableheader('addposition', 'fixpadding');