Esempio n. 1
0
function getCommentList($blogid, $search)
{
    $list = array('title' => "{$search}", 'items' => array());
    $search = escapeSearchString($search);
    $context = Model_Context::getInstance();
    $pool = DBModel::getInstance();
    $pool->reset('Comments');
    $pool->setAlias("Comments", "c");
    $pool->setAlias("Entries", "e");
    $pool->join("Entries", "inner", array(array("c.entry", "eq", "e.id"), array("c.blogid", "eq", "e.blogid"), array("e.draft", "eq", 0)));
    $pool->setQualifier('c.blogid', 'eq', $blogid);
    $pool->setQualifier('c.entry', '>', 0);
    $pool->setQualifier('parent', 'eq', NULL);
    $pool->setQualifier('isfiltered', 'eq', 0);
    $pool->setQualifierSet(array("c.comment", "like", $search, true), "OR", array("c.name", "like", $search, true));
    if (doesHaveOwnership()) {
        $pool->setQualifier("c.secret", "eq", 0);
        $pool = getPrivateCategoryExclusionQualifier($pool, $blogid);
    }
    $pool->setOrder("c.written", "asc");
    if ($entry == 0) {
        $pool->setOrder('written', 'desc');
    } else {
        if ($order == 'DESC') {
            $pool->setOrder('id', 'desc');
        } else {
            $pool->setOrder('id', 'asc');
        }
    }
    if ($result = $pool->getAll()) {
        $comments = coverComments($result);
    }
    if ($result = $pool->getAll("c.id, c.entry, c.parent, c.name, c.comment, c.written, e.slogan")) {
        foreach ($result as $comment) {
            array_push($list['items'], $comment);
        }
    }
    return $list;
}
Esempio n. 2
0
function getComments($entry, $order = 'ASC')
{
    global $database;
    $comments = array();
    $aux = $entry == 0 ? 'ORDER BY written DESC' : 'ORDER BY id ' . ($order == 'DESC' ? 'DESC' : 'ASC');
    $sql = "SELECT *\n\t\tFROM {$database['prefix']}Comments\n\t\tWHERE blogid = " . getBlogId() . "\n\t\t\tAND entry = {$entry}\n\t\t\tAND parent IS NULL\n\t\t\tAND isfiltered = 0 {$aux}";
    if ($result = POD::queryAll($sql)) {
        $comments = coverComments($result);
    }
    return $comments;
}
Esempio n. 3
0
function getComments($entry, $order = 'ASC')
{
    $comments = array();
    $context = Model_Context::getInstance();
    $pool = DBModel::getInstance();
    $pool->reset('Comments');
    $pool->setQualifier('blogid', 'eq', $context->getProperty('blog.id'));
    $pool->setQualifier('entry', 'eq', $entry);
    $pool->setQualifier('parent', 'eq', NULL);
    $pool->setQualifier('isfiltered', 'eq', 0);
    if ($entry == 0) {
        $pool->setOrder('written', 'desc');
    } else {
        if ($order == 'DESC') {
            $pool->setOrder('id', 'desc');
        } else {
            $pool->setOrder('id', 'asc');
        }
    }
    if ($result = $pool->getAll()) {
        $comments = coverComments($result);
    }
    return $comments;
}