function &get_categories($ids = '')
 {
     global $serendipity;
     $q = 'SELECT id, category
             FROM ' . $serendipity['dbPrefix'] . 'faq_categorys
            WHERE ';
     if (is_array($ids)) {
         $q .= serendipity_db_in_sql('id', $ids, '');
     } else {
         $q .= ' parent_id = 0';
     }
     $res = serendipity_db_query($q, false, 'assoc');
     if (is_array($res)) {
         foreach ($res as $value) {
             $erg[$value['id']] = $value['category'];
         }
     }
     return $erg;
 }
/**
 * Fetch special entry data and attach it to a superarray of entries.
 *
 * Fetches all additional information like plugins, extended properties, additional categories for each entry.
 *
 * @access private
 * @see serendipity_fetchEntries()
 * @param   array       The array of entries where the output will be merged to (referenced)
 * @return null
 */
function serendipity_fetchEntryData(&$ret)
{
    global $serendipity;
    $search_ids = array();
    // An array to hold all ids of the entry we want to fetch.
    $assoc_ids = array();
    // A temporary key association container to not have to loop through the return array once again.
    foreach ($ret as $i => $entry) {
        $search_ids[] = $entry['id'];
        $ret[$i]['categories'] = array();
        // make sure every article gets its category association
        $assoc_ids[$entry['id']] = $i;
        // store temporary reference
    }
    serendipity_plugin_api::hook_event('frontend_entryproperties', $ret, $assoc_ids);
    $query = "SELECT\n                     ec.entryid,\n                     c.categoryid,\n                     c.category_name,\n                     c.category_description,\n                     c.category_icon,\n                     c.parentid\n                FROM {$serendipity['dbPrefix']}category AS c\n           LEFT JOIN {$serendipity['dbPrefix']}entrycat AS ec\n                  ON ec.categoryid = c.categoryid\n               WHERE " . serendipity_db_in_sql('ec.entryid', $search_ids) . "\n            ORDER BY c.category_name ASC";
    $search_ret =& serendipity_db_query($query, false, 'assoc');
    if (is_array($search_ret)) {
        foreach ($search_ret as $i => $entry) {
            $ret[$assoc_ids[$entry['entryid']]]['categories'][] = $entry;
        }
    }
}
 function deleteFromRecycler($ids)
 {
     global $serendipity;
     if (is_array($ids)) {
         $sql = "DELETE FROM\n                    {$serendipity['dbPrefix']}spamblock_bayes_recycler\n                    WHERE " . serendipity_db_in_sql('id', $ids);
     } else {
         $sql = "DELETE FROM\n                    {$serendipity['dbPrefix']}spamblock_bayes_recycler\n                    WHERE id = " . (int) $ids;
     }
     return serendipity_db_query($sql);
 }
 function getComment($id, $eid)
 {
     global $serendipity;
     if (is_array($id)) {
         $sql = "SELECT * FROM {$serendipity['dbPrefix']}comments\n                WHERE " . serendipity_db_in_sql('id', $id) . " AND status = 'approved'";
     } else {
         $sql = "SELECT * FROM {$serendipity['dbPrefix']}comments\n                WHERE id = " . (int) $id . " AND status = 'approved'";
     }
     $comments = serendipity_db_query($sql);
     return $comments;
 }