public function action_profile($server_id) { $server = $this->getServer($server_id); $view = View::factory('server/index'); if (isset($this->user)) { // Handle adding a bot $bot_name = Arr::get($_POST, 'bot', false); if ($bot_name !== false) { $bot = ORM::factory('bot'); $bot->uid = $this->user; $bot->sid = $server; $bot->name = $bot_name; $bot->online = 0; if ($bot->check()) { $bot->save(); } else { $view->set('errors', $bot->validate()->errors('bot_errors')); } } // Handle Comments if (isset($_POST['s'])) { $posted = Model_Comment::post('server', $server, $this->user, $_POST['text']); $view->bind('posted', $posted); } } $comments = Model_Comment::fetch('server', $server, $this->request->param('page', 1)); $this->request->response = $view->bind('server', $server)->bind('comments', $comments); }
public function action_profile($user_id) { $profile = $this->getUser($user_id); $view = View::factory('user/index')->bind('profile', $profile); if (isset($this->user) && isset($_POST['s'])) { $posted = Model_Comment::post('user', $profile, $this->user, $_POST['text']); $view->bind('posted', $posted); } $comments = Model_Comment::fetch('user', $profile, $this->request->param('page', 1)); $this->request->response = $view->bind('comments', $comments); }
public function action_profile($bot_id) { $bot = $this->getBot($bot_id); $view = View::factory('bot/index')->bind('bot', $bot); if ('cu_bullshit' == $bot->server->name) { $stats = ORM::factory('bullshit')->reset(false)->bot($bot_id); $game_count = $stats->count_all(); $stats = $stats->order_by('DatePlayed', 'DESC')->limit(10)->find_all(); $view->bind('stats', $stats); $view->bind('game_count', $game_count); } if (isset($this->user) && isset($_POST['s'])) { $posted = Model_Comment::post('bot', $bot, $this->user, $_POST['text']); $view->bind('posted', $posted); } $comments = Model_Comment::fetch('bot', $bot, $this->request->param('page', 1)); $this->request->response = $view->bind('comments', $comments); }