Example #1
0
function print_parent_article_link($articleid)
{
    $query = "SELECT title FROM articles WHERE articleid = " . $articleid . ";";
    $table = getTable($query);
    $row = getNextRow($table);
    echo '<a href="index.php?articleid=' . $articleid . '&m_c=va">' . stripslashes($row['title']) . '</a>';
}
Example #2
0
function getArray($query)
{
    $table = getTable($query);
    $array = array();
    while ($row = getNextRow($table)) {
        $array[] = $row;
    }
    return $array;
}
Example #3
0
function getAllUsersNames()
{
    $query = "SELECT firstname FROM user ORDER BY firstname ASC";
    $table = getTable($query);
    while ($row = getNextRow($table)) {
        $newtable[] = $row['firstname'];
        // Add name to array
    }
    return $newtable;
}
function getAllLanguageIds()
{
    $query = "SELECT id FROM Languages";
    $table = getTable($query);
    while ($row = getNextRow($table)) {
        $newtable[] = $row['id'];
        // Add id to array
    }
    return $newtable;
}
Example #5
0
function textSearchService($text, $partialmatch, $author, $checkcomments)
{
    if (strlen($text) < 3) {
        return NULL;
    }
    $text = makeSafeForDAO($text);
    $selectfrom = "SELECT * FROM articles ";
    $where = "WHERE body LIKE '%" . $text . "%' AND is_deleted IS NULL AND is_draft IS NULL ";
    $orderby = " ORDER BY date_posted DESC, time_posted DESC;";
    $findWordAlone = "| " . $text . "[ !?,.:;'/)]|i";
    $findWordAnywhere = "|" . $text . "|i";
    if ($partialmatch == 0) {
        $pattern = $findWordAlone;
    } else {
        $pattern = $findWordAnywhere;
    }
    if ($author == "0") {
    } else {
        $where .= " AND author_username = '******' ";
    }
    if ($checkcomments == "0") {
        $where .= " AND comment_to IS NULL";
    }
    $query = $selectfrom . $where . $orderby;
    $newtable = array();
    $table = getTable($query);
    $num_rows = getRowsAffected($table);
    if ($table && $num_rows > 0) {
        while ($row = getNextRow($table)) {
            if (preg_match($pattern, $row['body'])) {
                $newtable[] = $row;
                // Add row to array
            }
        }
        return $newtable;
    } else {
        return NULL;
    }
}
Example #6
0
function nextArticleRowDAO($table)
{
    return getNextRow($table);
}