예제 #1
0
 public function showProfile($userid)
 {
     $user = User::where("alphaid", "=", $userid);
     if (!$user->exists()) {
         abort(404);
     }
     $user = $user->first();
     $favorites = Mark::where("username", "=", $user->alphaid)->orderBy("created_at", "desc")->get();
     $uploads = Sprite::where("username", "=", $user->alphaid)->orderBy("created_at", "desc")->get();
     return view("user/show", ["username" => $user->username, "name" => $user->name, "about" => $user->about, "favorites" => $favorites, "uploads" => $uploads, "creation" => $user->created_at, "modification" => $user->updated_at]);
 }
예제 #2
0
 public function remove($spriteid, Request $request)
 {
     if ($request->input("t") == csrf_token()) {
         $sprite = Sprite::where("alphaid", "=", $spriteid);
         if (!$sprite->exists()) {
             abort(404);
         }
         $sprite = $sprite->first();
         if (!($sprite->username == Auth::user()->alphaid || str_contains(Auth::user()->rights, "delete_anything "))) {
             abort(403);
         }
         unlink(public_path() . "/sprites/full/" . $spriteid . ".png");
         unlink(public_path() . "/sprites/small/" . $spriteid . ".png");
         $favorites = Mark::where("alphaid", "=", $spriteid);
         foreach ($favorites as $favorite) {
             $favorite->delete();
         }
         $sprite->delete();
     } else {
         abort(403);
     }
     return redirect("");
 }
예제 #3
0
	</a>
@endforeach
</div>
<main>
@else
<p class="empty"><em>Nothing here</em></p>
@endif

@if ($username != Auth::user()->username && false)
<h3>Favorites ({{ count($favorites) }})</h3>
@if (count($favorites) > 0)
</main>
<div class="grid">
@foreach ($favorites as $favorite)
	<?php 
$sprite = \App\Sprite::where("alphaid", "=", $favorite->alphaid)->first();
?>
	<a class="item @if ($sprite->width/$sprite->height > 1.5) double @endif" href="{{ url("/sprite/".$sprite->alphaid) }}">
		<img src="{{ url("/sprites/small/".$sprite->alphaid.".png") }}"
		     data-original="{{ url("/sprites/full/".$sprite->alphaid.".png") }}"
		     width="{{ $sprite->width }}" height="{{ $sprite->height }}"
		     class="checker" />
		<div>{{ \App\Sprite::where("alphaid", "=", $sprite->alphaid)->first()->title }}</div><i> </i>
	</a>
@endforeach
</div>
<main>
@else
<p class="empty"><em>Nothing here</em></p>
@endif
@endif