Ejemplo n.º 1
0
function GetBoardLatestFeed($bName, $postLimit, $requirePreview)
{
    $raw = DBGetLastestFeed($bName, $postLimit);
    if ($raw) {
        $post_ids = '*';
        $index = 0;
        while ($raw[$index] != null) {
            $result[$index]['postId'] = $raw[$index]['post_id'];
            //BY: post_id to postId for consistency
            $result[$index]['author'] = $raw[$index]['author'];
            $result[$index]['month'] = date('M', $raw[$index]['date']);
            //BY: separated date into month and date
            $result[$index]['date'] = date('j', $raw[$index]['date']);
            //BY: and added formatting
            $result[$index]['title'] = $raw[$index]['title'];
            $result[$index]['commentCount'] = $raw[$index]['commentCount'];
            if ($requirePreview) {
                $result[$index]['pureContent'] = strcut_utf8(strip_tags($raw[$index]['content']), 200);
            }
            //BY: if statement, strip tags and strcut
            $result[$index]['selectedTags'] = DBGetPostTags($result[$index]['post_id']);
            //BY: moved $index++
            $index++;
            //BY: to another line
        }
    }
    return $result;
}
Ejemplo n.º 2
0
function GetBoardLatestFeed($bName, $postLimit, $requirePreview)
{
    $raw = DBGetLastestFeed($bName, $postLimit);
    if ($raw) {
        $post_ids = '*';
        $index = 0;
        while ($raw[$index] != null) {
            $result[$index]['postId'] = $raw[$index]['post_id'];
            //BY: post_id to postId for consistency
            $result[$index]['author'] = htmlentities($raw[$index]['author'], ENT_QUOTES, "UTF-8");
            $result[$index]['month'] = date('M', $raw[$index]['date']);
            //BY: separated date into month and date
            $result[$index]['date'] = date('j', $raw[$index]['date']);
            //BY: and added formatting
            $result[$index]['title'] = str_replace("&", "&", $raw[$index]['title']);
            $result[$index]['commentCount'] = $raw[$index]['commentCount'];
            if ($requirePreview) {
                $result[$index]['pureContent'] = strcut_utf8(str_replace("&", "&amp;", str_replace('&nbsp;', ' ', htmlspecialchars_decode(strip_tags(preg_replace("/<p/", " <p", preg_replace("/<div/", " <div", preg_replace("/<img(?:.|\n)*?>/", " [ attached image ] ", $raw[$index]['content']))))))), 200);
            }
            $result[$index]['selectedTags'] = DBGetPostTags($result[$index]['post_id']);
            //BY: moved $index++
            $index++;
            //BY: to another line
        }
    } else {
        $result = array();
    }
    return $result;
}