} } else { $valid = false; } # Contenido, cache c/30 mins $smarty->cache_lifetime = 1800; # Cache de 1 dia if (!$smarty->is_cached($tpl, $pattern)) { # Paginas $pagina = new ab_pageTable(); $rows = $pagina->readDataSQL("SELECT idab_page,ab_page FROM ab_page WHERE menu IS TRUE ORDER BY orden"); $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']); }
<?php require './common.inc.php'; $tpl = AB_TPL_DIR . 'print.tpl'; $pattern = 'blog|' . ($tpl_id = $_REQUEST['idab_entry'] = (int) trim(preg_replace('(\\.(.*))', '', $_REQUEST['idab_entry']), "/\t\n \r\v") . '|imprimir'); # Cache de 1 dia $smarty->cache_lifetime = 86400; if (!$smarty->is_cached($tpl, $pattern)) { # Entradas $entrada = new ab_entryTable(); $entrada->readEnv(); list($row) = $entrada->readDataFilter("idab_entry = " . $entrada->request['idab_entry'] . " AND public IS TRUE"); if (!empty($row)) { $smarty->assign('entrada', $row); } unset($entrada); unset($row); print_r($row); } $smarty->display($tpl, $pattern);
} elseif (empty($_POST['name'])) { error_log("Error: Campo *Tu Nombre* es requerido."); $msg = '<div class="error">Error: Campo *Tu Nombre* es requerido.</div>'; $smarty->assign('msg', $msg); $smarty->assign('data', $_POST); } elseif (empty($_POST['email'])) { error_log("Error: Campo *Tu Correo Electrónico* es requerido."); $msg = '<div class="error">Error: Campo *Tu Correo Electrónico* es requerido.</div>'; $smarty->assign('msg', $msg); $smarty->assign('data', $_POST); # Todo bien } else { $_REQUEST['ip'] = getip(); $message = strip_tags($_REQUEST['ab_comment']); $tos = explode(',', trim($_REQUEST['tos'])); $ab_entry = new ab_entryTable(); $ab_entry->readEnv(); $row = $ab_entry->readRecord(); $subject = 'Recomendación: ' . $row['ab_entry']; $message = $_REQUEST['name'] . ' te ha enviado el siguiente articulo. Sus Comentarios son los siguientes: ---- ' . $_REQUEST['ab_comment'] . ' ---- <b>' . $row['ab_entry'] . '</b> ' . substr(trim(strip_tags(strip_code($row['body']))), 0, 125); $message = nl2br($message); # Headers $headers = 'From: ' . AB_NAME_NOREPLAY . '<' . AB_EMAIL_NOREPLAY . ">\r\n"; $headers .= 'MIME-Version: 1.0' . "\r\n"; //$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$pg = 1; } unset($table); $pattern .= "|{$pg}"; # 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);