Example #1
0
         return true;
     }
     return false;
 };
 $hidden_threads = hidden_threads_get_filtred_by_boards($boards, $htfilter, $_SESSION['user']);
 // Get favorite threads. Calculate count of unread posts and sort.
 $favorites = favorites_get_by_user($_SESSION['user']);
 $threads = array();
 foreach ($favorites as $f) {
     array_push($threads, $f['thread']);
 }
 // Pass all posts of thread.
 $pfilter = function ($thread, $post) {
     return true;
 };
 $posts = posts_get_visible_filtred_by_threads($threads, $_SESSION['user'], $pfilter);
 foreach ($favorites as &$f) {
     $f['unread'] = 0;
     foreach ($posts as $post) {
         if ($f['thread']['id'] == $post['thread']['id'] && $post['number'] > $f['last_readed']) {
             $f['unread']++;
         }
     }
 }
 // Order by last unread.
 $cmp = function ($a, $b) {
     if ($a['unread'] == $b['unread']) {
         return $a['post']['number'] > $b['post']['number'] ? -1 : 1;
     } else {
         return $a['unread'] > $b['unread'] ? -1 : 1;
     }
Example #2
0
     static $recived = 0;
     static $prev_thread = NULL;
     if ($prev_thread !== $thread) {
         $recived = 0;
         $prev_thread = $thread;
     }
     if ($thread['original_post'] == $post['post_number']) {
         return TRUE;
     }
     $recived++;
     if ($recived >= $thread['posts_count'] - $posts_per_thread) {
         return TRUE;
     }
     return FALSE;
 };
 $posts = posts_get_visible_filtred_by_threads(array($thread), $_SESSION['user'], $pfilter, $thread['posts_count']);
 if (is_attachments_enabled($board)) {
     $posts_attachments = posts_attachments_get_by_posts($posts);
     $attachments = attachments_get_by_posts($posts);
 }
 $ht_filter = function ($hidden_thread, $user) {
     if ($hidden_thread['user'] == $user) {
         return true;
     }
     return false;
 };
 $hidden_threads = hidden_threads_get_filtred_by_boards(array($board), $ht_filter, $_SESSION['user']);
 $upload_types = upload_types_get_by_board($board['id']);
 if (is_macrochan_enabled($board)) {
     $macrochan_tags = macrochan_tags_get_all();
 } else {