コード例 #1
0
    $tpl_id = (int) $_REQUEST['aid'];
}
$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);
コード例 #2
0
ファイル: entry.php プロジェクト: ReneVallecillo/almidon-blog
        $smarty->assign('data', $_POST);
    } elseif (empty($_POST['email'])) {
        error_log("Error: Campo *Correo Electrónico* es requerido.");
        $msg = '<div class="error">Error: Campo *Correo Electrónico* es requerido.</div>';
        $smarty->assign('msg', $msg);
        $smarty->assign('data', $_POST);
    } elseif (empty($_POST['ab_comment'])) {
        error_log("Error: Campo Comentario es requerido.");
        $msg = '<div class="error">Error: Campo *Comentario* es requerido.</div>';
        $smarty->assign('msg', $msg);
        $smarty->assign('data', $_POST);
        # Todo bien
    } else {
        $_REQUEST['ip'] = getip();
        $ab_comment = new ab_commentTable();
        $ab_comment->readEnv();
        $ab_comment->addRecord();
        header("Location: " . selfURL() . '?m=1#frmcomentarios');
        exit;
    }
} elseif ($_REQUEST['m'] == 1) {
    $msg = '<div class="succ">Muchas Gracias su comentario ha sido enviado.</div>';
    $smarty->assign('msg', $msg);
}
$tpl = AB_TPL_DIR . 'index.tpl';
$pattern = 'blog|entry|' . ($tpl_id = $_REQUEST['idab_entry'] = trim(preg_replace('(\\.(.*))', '', $_REQUEST['idab_entry']), "/\t\n \r\v"));
$patron = "^[[:digit:]]+\$";
$table = new Table('ab_page');
if (eregi($patron, $tpl_id)) {
    $exist = (bool) $table->getVar("SELECT idab_entry FROM ab_entry WHERE idab_entry = " . (int) escape($table, $_REQUEST['idab_entry']));
} else {