<?php $channel = channel_peer::instance()->get_by_id((int) $_GET['id']); $posts = channel_post_peer::instance()->get_list($channel['id'], null, 20); $is_mine = user_channel_peer::instance()->is_my_channel($_SESSION['user_id'], $channel['id']); $user_count = channel_user_peer::instance()->length($channel['id']);
/** * @return channel_post_peer */ public static function instance() { return self::$instance ? self::$instance : (self::$instance = new self()); }
<?php if ($user_id) { $list = user_post_peer::instance()->get_list($user_id); } if (!$list) { $list = channel_post_peer::instance()->get_list(0, null, 50); }
<?php if ($text = trim($_POST['text'])) { $channel_id = (int) $_POST['channel_id']; $id = post_peer::instance()->insert($text, $channel_id, $_SESSION['user_id']); channel_post_peer::instance()->insert($id, $channel_id); }