コード例 #1
0
ファイル: Front.php プロジェクト: Gouken/WebMuApp
 public function showpost($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);
     $thread->view = $thread->view + 1.25;
     $thread->save();
     $view = ForumViewCount::find($forum_id);
     $view->view = $view->view + 1.25;
     $view->save();
     $seo['page'] = $thread->title;
     $seo['title'] = $thread->title;
     $seo['discription'] = 'discription of this page';
     $seo['forum'] = $forum_id;
     $posts = Post::where('thread_id', $thread_id)->orderBy('status', 'desc')->where('status', '>', 0)->orderBy('created_at', 'asc')->paginate(10);
     $user_id = Session::get('WebUserId');
     $data = array('webuser' => WebUser::find($user_id), 'seo' => $seo, 'thread' => $thread, 'forums' => HelperFunctions::forum_list(), 'posts' => $posts, 'page' => "Forum", 'id' => Session::get('idCok'), 'coin' => Session::get('coinCok'));
     return View::make('template.neon.post')->with($data);
 }
コード例 #2
0
ファイル: FlatFront.php プロジェクト: Gouken/WebMuApp
 public function createthread($name)
 {
     $forums = HelperFunctions::forum_list();
     foreach ($forums as $key => $f) {
         if ($f[0] == $name) {
             $forum = $key + 1;
         }
     }
     if ($forum == 0) {
         return Redirect::to("/dien-dan.html");
     }
     $title = Input::get('title');
     $text = Input::get('text');
     $user_id = Session::get('WebUserId');
     $thread = new Thread();
     $thread->webuser_id = $user_id;
     $thread->forum = $forum;
     $thread->title = $title;
     $thread->reply = 0;
     $thread->lastuser_id = $user_id;
     $thread->created_at = time();
     $thread->updated_at = time();
     $thread->save();
     $first_post = new Post();
     $first_post->webuser_id = $user_id;
     $first_post->thread_id = $thread->id;
     $first_post->text = $text;
     $first_post->save();
     $last_post_seed = new Post();
     $last_post_seed->webuser_id = $user_id;
     $last_post_seed->thread_id = $thread->id;
     $last_post_seed->text = 'seed_for_textbox';
     $last_post_seed->status = 1;
     $last_post_seed->save();
     $view = ForumViewCount::find($forum);
     $view->topic = $view->topic + 1;
     $view->save();
     return Redirect::to("/dien-dan/" . $name);
 }