function defaultDisplay(&$loq, $archives = null)
{
    $searchopts = array();
    if (is_null($archives)) {
        $archives = $loq->_ph->get_posts($searchopts, true, 'html');
    }
    $loq->assign('postmonths', get_post_months());
    $loq->assign_by_ref('archives', $archives);
    $loq->display('archives.html');
}
        $searchopts['month'] = substr($_POST['showmonth'], 0, 2);
        $searchopts['year'] = substr($_POST['showmonth'], 3, 4);
    }
    //print_r($searchopts);
    $q = $bBlog->make_post_query($searchopts);
    //echo $q;
    $archives = $bBlog->get_posts($q);
}
if (isset($_POST['allowcomments']) && is_numeric($_POST['allowcomments']) === true) {
    $sql = 'UPDATE ' . T_POSTS . ' SET allowcomments=IF(allowcomments="allow", "disallow", "allow") WHERE postid=' . intval($_POST['allowcomments']);
    $bBlog->_adb->Execute($sql);
} else {
    $searchopts['wherestart'] = ' WHERE 1 ';
    $archives = $ph->get_posts($searchopts);
}
$bBlog->assign('postmonths', get_post_months());
$bBlog->assign_by_ref('archives', $archives);
$bBlog->display('archives.html');
function get_post_months()
{
    global $bBlog;
    $rs = $bBlog->_adb->Execute("SELECT FROM_UNIXTIME(posttime,'%Y%m') yyyymm,  posttime from " . T_POSTS . " group by yyyymm order by yyyymm");
    if ($rs !== false && !$rs->EOF) {
        $months = array();
        while ($month = $rs->FetchRow()) {
            $nmonth['desc'] = date('F Y', $month['posttime']);
            $nmonth['numeric'] = date('m-Y', $month['posttime']);
            $months[] = $nmonth;
        }
        return $months;
    } else {
    }
    if ($_POST['showmonth'] != 'any') {
        $searchopts['month'] = substr($_POST['showmonth'], 0, 2);
        $searchopts['year'] = substr($_POST['showmonth'], 3, 4);
    }
    //print_r($searchopts);
    $q = $bBlog->make_post_query($searchopts);
    //echo $q;
    $archives = $bBlog->get_posts($q);
} else {
    $searchopts['wherestart'] = ' WHERE 1 ';
    $q = $bBlog->make_post_query($searchopts);
    $archives = $bBlog->get_posts($q);
    // ,TRUE);
}
$bBlog->smartyObj->assign('postmonths', get_post_months());
$bBlog->smartyObj->assign_by_ref('archives', $archives);
$bBlog->display('archives.html');
function get_post_months()
{
    global $bBlog;
    $months_tmp = $bBlog->get_results("SELECT FROM_UNIXTIME(posttime,'%Y%m') yyyymm,  posttime from " . T_POSTS . " group by yyyymm order by yyyymm");
    $months = array();
    foreach ($months_tmp as $month) {
        $nmonth['desc'] = date('F Y', $month->posttime);
        $nmonth['numeric'] = date('m-Y', $month->posttime);
        $months[] = $nmonth;
    }
    return $months;
}
function timestampform($ts)