function build_posts($posts, $user)
{
    $html = '<div id="posts" style="height:100%; width:100%">';
    foreach ($posts as $post) {
        build_post($html, $post, $user);
    }
    $html .= '</div>';
    return $html;
}
        $mail->addTo($email['email'], $email['fullname']);
        $mail->send();
    }
}
if (@is_dir(CACHE_DIRECTORY) && @is_writable(CACHE_DIRECTORY)) {
    /**
     * Lock present: application busy: quit
     */
    if (!@file_exists(COMMUNITY_NOTIFY_LOCK)) {
        if (@file_put_contents(COMMUNITY_NOTIFY_LOCK, 'L_O_C_K')) {
            $limit = COMMUNITY_NOTIFY_LIMIT;
            $query = "SELECT * FROM `community_notifications` WHERE `release_time` < " . $db->qstr(time());
            $posts = $db->GetAll($query);
            if ($posts) {
                foreach ($posts as $post) {
                    build_post($post);
                    $query = "SELECT `ccnotification_id`, `proxy_id` FROM `cron_community_notifications`\n\t\t\t\t\t\t\t\tWHERE `cnotification_id` = " . $db->qstr($post['cnotification_id']);
                    $proxies = $db->GetAll($query);
                    foreach ($proxies as $proxy) {
                        $query = "SELECT `email`, CONCAT_WS(' ', `firstname`, `lastname`) AS `fullname`, `notifications` FROM `" . AUTH_DATABASE . "`.`user_data`\n\t\t\t\t\t\t\t\t\tWHERE `id` = " . $db->qstr($proxy['proxy_id']);
                        $result = $db->GetRow($query);
                        if ($result && $result["notifications"]) {
                            send_member($result);
                        }
                        if (!$db->Execute("DELETE FROM `cron_community_notifications` WHERE `ccnotification_id` = " . $db->qstr($proxy['ccnotification_id']))) {
                            // Delete the recipient
                            application_log("error", "Failed to delete record with `ccnotification_id` {$proxy['ccnotification_id']} from table `cron_community_notifications`. Database said: " . $db->ErrorMsg());
                        }
                        /**
                         * Email limit so exit
                         */