public static function createUser($user_fp, $input, $timestamp = false) { $timestamp = $timestamp ? $timestamp : date('Y-m-d H:i:s'); $pub_hash = BaseController::randString(8) . strtolower(substr($user_fp, -8)); $priv_hash = BaseController::randString(32); $clear_info = BaseController::isSigned(trim($input['info'])); $user = new User(); $user->public_hash = $pub_hash; $user->private_hash = password_hash($priv_hash, PASSWORD_BCRYPT); $user->pgp = trim($input['key']); $user->user_fp = $user_fp; $user->info = $input['info'] ? $input['info'] : ""; $user->clear_info = $clear_info ? $clear_info : ""; $user->active_session = ""; $user->timestamp = $timestamp; $user->save(); return ['priv_hash' => $priv_hash, 'user' => $user]; }
public static function createPost($user_fp, $input, $timestamp = false) { $timestamp = $timestamp ? $timestamp : date('Y-m-d H:i:s'); if ($input['parent_id'] != 0) { $parent_post = Post::findOrFail($input['parent_id']); if ($parent_post->parent_id != 0) { App::abort(500, "Illegal post_id"); } if (Ban::isBanned($parent_post->user_fp, $user_fp)) { App::abort(500, "You are banned"); } if ($parent_post->group_name != "" && Group::where('group_name', $parent_post->group_name)->first()->is_private == 1) { if (!Gsub::membership($user_fp, $parent_post->group_name)) { App::abort(500, 'Only members of group can leave comments.'); } } } else { if ($input['group_name']) { $group = Group::where('group_name', $input['group_name'])->firstOrFail(); if ($group->is_private == 1) { if (!Gsub::membership($user_fp, $input['group_name'])) { App::abort(500, 'Membership required to post.'); } } } } $message = rtrim($input['message']); $plaintext = BaseController::isSigned($message); $post = new Post(); $post->parent_id = $input['parent_id'] ? $input['parent_id'] : 0; $post->user_fp = $user_fp; $post->timestamp = $timestamp; if ($input['source_link']) { $post->source_link = $input['source_link']; } if ($input['title']) { $post->title = $input['title']; } if ($plaintext) { $post->clear_message = self::convertEmoji($plaintext); $post->message = $message; } else { $post->clear_message = ""; $post->message = self::convertEmoji($message); } if (!isset($parent_post)) { if ($input['chan']) { $post->chan = $input['chan']; } if ($input['group_name']) { $post->group_name = $input['group_name']; } } $post->save(); if (isset($parent_post)) { $parent_post->replies += 1; $parent_post->save(); } return $post; }
→ <a href="#" class="text-warning small">/g/{{{Input::get('group_name')}}}</a> @endif @ 1 second ago .txt <a href="#"class="btn btn-xs btn-default">{{Lang::get('board.post_more')}}</a> @if(Input::get('source_link')) <a href="#"class="btn btn-xs btn-default">{{Lang::get('general.link')}}</a> @endif </div> <div class="panel-body"> @if(Input::get('title')) <h1>{{{Input::get('title')}}}</h1> @endif <?php $message = rtrim(Input::get('message')); if (BaseController::userFp() != "") { $plaintext = BaseController::isSigned($message); if ($plaintext) { $message = Post::convertEmoji($plaintext); } else { $message = Post::convertEmoji($message); } $html_post = OnelonMarkup::markup($message, true); } else { $html_post = OnelonMarkup::markup($message); } ?> <div>{{ $html_post }}</div> </div> </div> @include('post_form')