Esempio n. 1
0
function showSearchThreads() {
	global $_G, $page, $perpage;;
	$threads = array();
	$starttime = 0;
	$srchtid = intval($_GET['srchtid']);
	$srchorder = in_array($_GET['srchorder'], array('views', 'replies', 'heats', 'dateline', 'lastpost')) ? $_GET['srchorder'] : 'dateline';

	$datelinearray = array(1 => 3600, 2 => 86400, 3 => 86400 * 7, 4 => 86400 * 30);
	$srchdateline = array_key_exists($_GET['srchdateline'], $datelinearray) ? $datelinearray[$_GET['srchdateline']] : 86400 * 30;

	$start = ($page - 1) * $perpage;

	if($srchtid) {
		$threads = C::t('forum_thread')->fetch_all_by_tid_displayorder($srchtid, 0);
	} else {
		$starttime = TIMESTAMP - $srchdateline;
		$threads = C::t('forum_thread')->fetch_all_by_dateline($starttime, $start, $perpage, $srchorder);
	}

	$mpurl = ADMINSCRIPT.'?action=cloud&operation=qqgroup&anchor=block&op=searchForm'
					.'&srchtid='.$srchtid.'&srchorder='.$srchorder.'&srchdateline='.intval($_GET['srchdateline']);

	return showSearchResultThreads($threads, $mpurl);
}
Esempio n. 2
0
function showSearchThreads()
{
    global $_G;
    $where = $order = array();
    $srchtid = intval($_G['gp_srchtid']);
    $srchorder = in_array($_G['gp_srchorder'], array('views', 'replies', 'heats', 'dateline', 'lastpost')) ? $_G['gp_srchorder'] : 'dateline';
    $datelinearray = array(1 => 3600, 2 => 86400, 3 => 86400 * 7, 4 => 86400 * 30, 0 => 0);
    $srchdateline = array_key_exists($_G['gp_srchdateline'], $datelinearray) ? $datelinearray[$_G['gp_srchdateline']] : 86400 * 30;
    if ($srchtid) {
        $where[] = "tid='{$srchtid}'";
    } else {
        if ($srchdateline) {
            $starttime = TIMESTAMP - $srchdateline;
            $where[] = "dateline > '{$starttime}'";
        }
        $order = array("`{$srchorder}` DESC");
    }
    $where[] = "displayorder>'-1'";
    $mpurl = ADMINSCRIPT . '?action=cloud&operation=qqgroup&anchor=block&op=searchForm' . '&srchtid=' . $srchtid . '&srchorder=' . $srchorder . '&srchdateline=' . intval($_G['gp_srchdateline']);
    return showSearchResultThreads($where, $order, $mpurl);
}