예제 #1
0
$blog_id = trim(preg_replace('(\\.(.*))', '', $_REQUEST['idblog']), "/\t\n \r\v");
# Comentarios, 1 hr
$pg = (int) $_REQUEST['pg'] ? (int) $_REQUEST['pg'] : 1;
$smarty->cache_lifetime = 3600;
$tpl = AB_TPL_DIR . 'comments.tpl';
$pattern = "blogs|{$blog_id}|{$tpl_id}|comentarios|{$pg}";
if (!$smarty->is_cached($tpl, $pattern)) {
    $comentario = new ab_commentTable();
    $comentario->order = 'sentdate DESC';
    $comentario->limit = defined('AB_COMMENT_PAGE') && AB_COMMENT_PAGE > 0 ? AB_COMMENT_PAGE : 10;
    $comentario->offset = ($pg - 1) * $comentario->limit;
    $comentario->filter = '';
    $_REQUEST['idab_entry'] = $tpl_id;
    $comentario->readEnv();
    if ($comentario->request['identrada']) {
        $w = $comentario->name . ".public IS TRUE AND " . $comentario->name . ".idab_entry = " . $comentario->request['idab_entry'];
        $rows = $comentario->readDataFilter($w);
        if (!empty($rows)) {
            $num_comentarios = $comentario->getVar("SELECT count(" . $comentario->key . ") FROM " . $comentario->name . " WHERE {$w}");
            $pgs = ceil($num_comentarios / $comentario->limit);
            $smarty->assign('pg', $pg);
            $smarty->assign('pgs', $pgs);
            $smarty->assign('prev_num', $num_comentarios - ($pg - 1) * $comentario->limit);
            $smarty->assign('comentarios', $rows);
            $smarty->assign('num_comentarios', $num_comentarios);
            unset($rows);
        }
    }
    unset($comentario);
}
$smarty->display($tpl, $pattern);
예제 #2
0
     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'] = replace_code($row['body']);
         $smarty->assign('entrada', $row);
         $smarty->assign('title', $row['ab_entry']);
     }
     $comentarioent = new ab_commentTable();
     $comentarioent->order = 'sentdate DESC';
     $comentarioent->filter = '';
     if ($row) {
         $rows = $comentarioent->readDataFilter("ab_comment.public IS TRUE AND ab_comment.idab_entry = " . $row['idab_entry']);
         $pgs = ceil($comentarioent->getVar("SELECT count(idab_comment) FROM ab_comment WHERE ab_comment.public IS TRUE AND ab_comment.idab_entry = " . $row['idab_entry']) / AB_COMMENT_PAGE);
         $smarty->assign('pg', 1);
         $smarty->assign('prev_num', 1);
         $smarty->assign('pgs', $pgs);
         $smarty->assign('comentarios', $rows);
     }
     unset($row);
     unset($comentarios);
 }
 $smarty->display($tpl, $pattern);
 # Comments
 include_once 'comments.php';
 # Formulario, 1 semana
 $smarty->cache_lifetime = 604800;
 $tpl = AB_TPL_DIR . 'comments.frm.tpl';