$smarty->assign('paginas', $rows);
 unset($pagina);
 unset($rows);
 # Entradas
 $entrada = new ab_entryTable();
 $entrada->readEnv();
 #$entrada->limit = ENTRY;
 #$entrada->offset = (($pg>1)?(($pg-1)*$entrada->limit):0);
 if ($_REQUEST['m']) {
     $period = strftime("%B/%Y", strtotime($_REQUEST['y'] . '-' . $_REQUEST['m'] . '-01'));
     $range_filter = "extract(month from ab_entry.creation) = " . $_REQUEST['m'] . " AND extract(year from ab_entry.creation) = " . $_REQUEST['y'];
 } else {
     $period = $_REQUEST['y'];
     $range_filter = "extract(year from ab_entry.creation) = " . $_REQUEST['y'];
 }
 $rows = $entrada->readDataFilter("ab_entry.public IS TRUE AND {$range_filter}");
 for ($i = 0; $i < count($rows); $i++) {
     $rows[$i]['seo_title'] = generate_seo_link($rows[$i]['ab_entry']);
     $rows[$i]['texto'] = strip_code($rows[$i]['texto']);
 }
 $smarty->assign('entradas', $rows);
 $smarty->assign('title', $period . ' &#8212; Archivo');
 $smarty->assign('period', $period);
 unset($rows);
 $smarty->assign('pgs', $pgs);
 $smarty->assign('pg', $pg);
 unset($rows);
 # Ultimas Entradas
 $entrada->readEnv();
 $entrada->limit = 10;
 $rows = $entrada->readDataFilter("public IS TRUE");
# Contenido, cache c/30 mins
$smarty->cache_lifetime = 1800;
if ($exist !== false) {
    # Cache de 1 dia
    if (!$smarty->is_cached($tpl, $pattern)) {
        # Paginas
        $ab_page = new ab_pageTable();
        $rows = $ab_page->readDataSQL("SELECT idab_page,ab_page FROM ab_page WHERE menu IS TRUE ORDER BY orden");
        $smarty->assign('paginas', $rows);
        unset($rows);
        # Entradas
        $ab_entry = new ab_entryTable();
        $ab_entry->readEnv();
        $ab_entry->limit = AB_ENTRIES_PAGE;
        $ab_entry->offset = $pg > 1 ? ($pg - 1) * $ab_entry->limit : 0;
        $rows = $ab_entry->readDataFilter("public IS TRUE");
        for ($i = 0; $i < count($rows); $i++) {
            $rows[$i]['seo_title'] = generate_seo_link($rows[$i]['ab_entry']);
            $rows[$i]['texto'] = strip_code($rows[$i]['body']);
        }
        $smarty->assign('entradas', $rows);
        # Portada
        $smarty->assign('portada', true);
        if ($rows) {
            $smarty->assign('title', $rows[0]['ab_entry']);
        }
        unset($rows);
        $smarty->assign('pgs', $pgs);
        $smarty->assign('pg', $pg);
        unset($rows);
        # Ultimas Entradas
Exemple #3
0
    $exist = (bool) $table->getVar("SELECT idab_entry FROM ab_entry WHERE idab_entry = " . (int) escape($table, $_REQUEST['idab_entry']));
} else {
    $exist = false;
}
if ($exist) {
    # Cache de 1 dia
    if (!$smarty->is_cached($tpl, $pattern)) {
        # Paginas
        $ab_page = new ab_pageTable();
        $rows = $ab_page->readDataSQL("SELECT idab_page,ab_page FROM ab_page WHERE menu IS TRUE ORDER BY orden");
        $smarty->assign('paginas', $rows);
        unset($rows);
        # Entradas
        $entrada = new ab_entryTable();
        $entrada->readEnv();
        list($row) = $entrada->readDataFilter("idab_entry = " . $entrada->request['idab_entry'] . " AND public IS TRUE");
        if (count($row)) {
            $row['seo_title'] = generate_seo_link($row['ab_entry']);
            $row['body'] = strip_code($row['body']);
            $smarty->assign('entrada', $row);
            $smarty->assign('title', '(Enviar) ' . $row['ab_entry']);
        }
        unset($entrada);
        unset($ab_page);
    }
    $smarty->display($tpl, $pattern);
} else {
    require ROOTDIR . '/classes/include.d/404.inc.php';
    if (!$smarty->is_cached('blogs/404p.tpl', $grp_id)) {
        # Variables
        require_once ROOTDIR . '/classes/include.d/const.inc.php';
    # Bottom
    $tpl = AB_TPL_DIR . 'bottom.tpl';
    # Cache de 1 dia
    if (!$smarty->is_cached($tpl, $pattern)) {
        # Paginas
        if (!isset($ab_page)) {
            $ab_page = new ab_pageTable();
            $entrada = new ab_entryTable();
        }
        $rows = $ab_page->readDataSQL("SELECT idab_page,ab_page FROM ab_page ORDER BY orden");
        $smarty->assign('ab_pages', $rows);
        unset($rows);
        # Ultimas Entradas
        $entrada->readEnv();
        $entrada->limit = 10;
        $rows = $entrada->readDataFilter("public IS TRUE");
        $smarty->assign('ult_entradas', $rows);
        unset($rows);
        # Meses
        $smarty->assign('periodos', getArchive($entrada));
        unset($rows);
    }
    $smarty->display($tpl, $pattern);
    if (is_object($entrada)) {
        unset($entrada);
        unset($ab_page);
    }
} else {
    require ROOTDIR . '/classes/include.d/404.inc.php';
    if (!$smarty->is_cached('blogs/404p.tpl', $grp_id)) {
        # Variables