Update view entity encoding

This commit is contained in:
Daniel Supernault 2018-06-13 18:54:27 -06:00
parent 4e51fbd5eb
commit 231884c770
4 changed files with 42 additions and 12 deletions

View file

@ -34,8 +34,8 @@ class CommentController extends Controller
$reply = new Status();
$reply->profile_id = $profile->id;
$reply->caption = $comment;
$reply->rendered = e($comment);
$reply->caption = e(strip_tags($comment));
$reply->rendered = $comment;
$reply->in_reply_to_id = $status->id;
$reply->in_reply_to_profile_id = $status->profile_id;
$reply->save();

View file

@ -47,7 +47,7 @@ class StatusController extends Controller
$status = new Status;
$status->profile_id = $profile->id;
$status->caption = $request->caption;
$status->caption = strip_tags($request->caption);
$status->is_nsfw = $cw;
$status->save();

View file

@ -16,17 +16,46 @@
</div>
</div>
<div class="col-12 col-md-8 status-photo px-0">
@if($status->is_nsfw)
@if($status->is_nsfw && $status->media_count == 1)
<details class="details-animated">
<p>
<summary>NSFW / Hidden Image</summary>
<a class="max-hide-overflow" href="{{$status->url()}}">
<a class="max-hide-overflow {{$status->firstMedia()->filter_class}}" href="{{$status->url()}}">
<img class="card-img-top" src="{{$status->mediaUrl()}}">
</a>
</p>
</details>
@else
<img src="{{$status->mediaUrl()}}" width="100%">
@elseif(!$status->is_nsfw && $status->media_count == 1)
<div class="{{$status->firstMedia()->filter_class}}">
<img src="{{$status->mediaUrl()}}" width="100%">
</div>
@elseif($status->is_nsfw && $status->media_count > 1)
@elseif(!$status->is_nsfw && $status->media_count > 1)
<div id="photoCarousel" class="carousel slide carousel-fade" data-ride="carousel">
<ol class="carousel-indicators">
@for($i = 0; $i < $status->media_count; $i++)
<li data-target="#photoCarousel" data-slide-to="{{$i}}" class="{{$i == 0 ? 'active' : ''}}"></li>
@endfor
</ol>
<div class="carousel-inner">
@foreach($status->media()->orderBy('order')->get() as $media)
<div class="carousel-item {{$loop->iteration == 1 ? 'active' : ''}}">
<figure class="{{$media->filter_class}}">
<img class="d-block w-100" src="{{$media->url()}}" alt="{{$status->caption}}">
</figure>
</div>
@endforeach
</div>
<a class="carousel-control-prev" href="#photoCarousel" role="button" data-slide="prev">
<span class="carousel-control-prev-icon" aria-hidden="true"></span>
<span class="sr-only">Previous</span>
</a>
<a class="carousel-control-next" href="#photoCarousel" role="button" data-slide="next">
<span class="carousel-control-next-icon" aria-hidden="true"></span>
<span class="sr-only">Next</span>
</a>
</div>
@endif
</div>
<div class="col-12 col-md-4 px-0 d-flex flex-column border-left border-md-left-0">
@ -51,7 +80,7 @@
@foreach($status->comments->reverse()->take(10) as $item)
<p class="mb-0">
<span class="font-weight-bold pr-1"><bdi><a class="text-dark" href="{{$item->profile->url()}}">{{$item->profile->username}}</a></bdi></span>
<span class="comment-text">{!!$item->rendered!!} <a href="{{$item->url()}}" class="text-dark small font-weight-bold float-right">{{$item->created_at->diffForHumans(null, true, true ,true)}}</a></span>
<span class="comment-text">{!! $item->rendered ?? e($item->caption) !!} <a href="{{$item->url()}}" class="text-dark small font-weight-bold float-right">{{$item->created_at->diffForHumans(null, true, true ,true)}}</a></span>
</p>
@endforeach
</div>

View file

@ -15,6 +15,7 @@
<a class="dropdown-item" href="#">Embed</a>
@if(Auth::check())
@if(Auth::user()->profile->id === $item->profile->id || Auth::user()->is_admin == true)
<a class="dropdown-item" href="{{$item->editUrl()}}">Edit</a>
<form method="post" action="/i/delete">
@csrf
<input type="hidden" name="type" value="post">
@ -32,13 +33,13 @@
<details class="details-animated">
<p>
<summary>NSFW / Hidden Image</summary>
<a class="max-hide-overflow" href="{{$item->url()}}">
<a class="max-hide-overflow {{$item->firstMedia()->filter_class}}" href="{{$item->url()}}">
<img class="card-img-top" src="{{$item->mediaUrl()}}">
</a>
</p>
</details>
@else
<a class="max-hide-overflow" href="{{$item->url()}}">
<a class="max-hide-overflow {{$item->firstMedia()->filter_class}}" href="{{$item->url()}}">
<img class="card-img-top" src="{{$item->mediaUrl()}}">
</a>
@endif
@ -84,7 +85,7 @@
<a class="text-dark" href="{{$status->profile->url()}}">{{$status->profile->username}}</a>
</bdi>
</span>
<span class="comment-text">{!!$status->rendered!!}</span>
<span class="comment-text">{!! $item->rendered ?? e($item->caption) !!}</span>
<span class="float-right">
<a href="{{$status->url()}}" class="text-dark small font-weight-bold">
{{$status->created_at->diffForHumans(null, true, true, true)}}
@ -95,7 +96,7 @@
@foreach($item->comments->reverse()->take(3) as $comment)
<p class="mb-0">
<span class="font-weight-bold pr-1"><bdi><a class="text-dark" href="{{$comment->profile->url()}}">{{$comment->profile->username}}</a></bdi></span>
<span class="comment-text">{{ str_limit($comment->caption, 125) }}</span>
<span class="comment-text">{!! str_limit($item->rendered ?? e($item->caption), 150) !!}</span>
</p>
@endforeach
@endif