Код: Выделить всё
function _sf_stack($into, $from)
{
$more_recent = $into && isset($into['forum_last_post_id']) && ($into['forum_last_post_id'] > $from['forum_last_post_id']);
$stack = array(
'forum_posts' => ($into && isset($into['forum_posts']) ? intval($into['forum_posts']) : 0) + intval($from['forum_posts']),
'forum_topics' => ($into && isset($into['forum_topics']) ? intval($into['forum_topics']) : 0) + intval($from['forum_topics']),
'unread' => ($into && isset($into['unread']) ? $into['unread'] : false) || $from['unread'],
'forum_last_post_id' => $more_recent ? $into['forum_last_post_id'] : $from['forum_last_post_id'],
'user_id' => $more_recent ? $into['user_id'] : $from['user_id'],
'post_username' => $more_recent ? $into['post_username'] : $from['post_username'],
'username' => $more_recent ? $into['username'] : $from['username'],
'post_time' => $more_recent ? $into['post_time'] : $from['post_time'],
'post_title' => $more_recent ? $into['post_title'] : $from['post_title'],
'topic_id' => $more_recent ? $into['topic_id'] : $from['topic_id'],
'topic_title' => $more_recent ? $into['topic_title'] : $from['topic_title'],
);
return $stack;
}