Esempio n. 1
0
 public function managepost($id, $name)
 {
     $id_len = strlen($id);
     $forum_id = substr($id, 0, 1);
     $thread_id = substr($id, 1, $id_len - 1);
     $thread = Thread::find($thread_id);
     $user_id = Session::get('WebUserId');
     if (Input::get('submit') == 'post') {
         if (Input::get('text') != '') {
             $post = new Post();
             $post->text = Input::get('text');
             $post->webuser_id = $user_id;
             $post->thread_id = $thread_id;
             $post->save();
             $thread->updated_at = time();
             $thread->lastuser_id = $user_id;
             $thread->save();
             $view = ForumViewCount::find($forum_id);
             $view->post = $view->post + 1;
             $view->save();
         }
     } elseif (Input::get('submit') == 'manage') {
         if (Input::get('action') == 'close') {
             $thread->status = 1;
             $thread->icon = 'lock';
             $thread->save();
         } else {
             if (Input::get('action') == 'open') {
                 $thread->status = 2;
                 $thread->icon = 'lock-open';
                 $thread->save();
             } else {
                 if (Input::get('action') == 'stick') {
                     $thread->status = 3;
                     $thread->icon = 'publish';
                     $thread->save();
                 } else {
                     if (Input::get('action') == 'unstick') {
                         $thread->status = 2;
                         $thread->icon = 'chat';
                         $thread->save();
                     } else {
                         if (Input::get('action') == 'del') {
                             $thread->status = 0;
                             $thread->save();
                             return Redirect::to('/dien-dan.html');
                         }
                     }
                 }
             }
         }
     } elseif (Input::get('postid') != NULL) {
         $postedit = Post::find(Input::get('postid'));
         $postedit->text = Input::get('text');
         $postedit->save();
     } elseif (Input::get('submit') == 'editthread') {
         $thread->title = Input::get('title');
         $thread->forum = Input::get('destination');
         $thread->save();
     }
     return Redirect::to("/dien-dan/" . $id . "/" . $name);
 }
Esempio n. 2
0
 public static function forum_list()
 {
     $forums = array(array('thong-bao.html', 'Thông Báo', ForumViewCount::find(1), 'megaphone'), array('thao-luan-chung.html', 'Thảo Luận Chung', ForumViewCount::find(2), 'chat'), array('dong-gop-y-kien.html', 'Đóng Góp Ý Kiến', ForumViewCount::find(3), 'lamp'), array('buon-ban.html', 'Buôn Bán Trao Đổi', ForumViewCount::find(4), 'basket'), array('kinh-nghiem-choi.html', 'Kinh Nghiệm Chơi', ForumViewCount::find(5), 'list-add'), array('bang-hoi.html', 'Bang Hội Liên Minh', ForumViewCount::find(6), 'users'), array('report-loi-game.html', 'Report Lỗi Game', ForumViewCount::find(7), 'help-circled'));
     return $forums;
 }