Sommer Style, Avatare, Duplikate
This commit is contained in:
@@ -51,6 +51,30 @@ class User extends Eloquent implements UserInterface, RemindableInterface {
|
||||
return $this->email;
|
||||
}
|
||||
|
||||
public function getAvatar() {
|
||||
if($avatar = $this->getSetting('avatar')) {
|
||||
return asset('img/avatars/'.$avatar);
|
||||
} else {
|
||||
return asset('img/no-avatar.jpg');
|
||||
}
|
||||
}
|
||||
|
||||
public function getSetting($key, $false = false) {
|
||||
$settings = json_decode($this->settings);
|
||||
if(!is_null($settings))
|
||||
return $settings->$key;
|
||||
else
|
||||
return $false;
|
||||
}
|
||||
|
||||
public function setSetting($key, $value) {
|
||||
$settings = json_decode($this->settings);
|
||||
if(!is_null($settings)) {
|
||||
$settings = array();
|
||||
}
|
||||
$settings[$key] = $value;
|
||||
$this->settings = json_encode($settings);
|
||||
}
|
||||
|
||||
public function films() {
|
||||
return $this->hasMany('Film', 'user');
|
||||
|
@@ -220,15 +220,22 @@ Route::post('neu', array('before' => 'auth', function() {
|
||||
}));
|
||||
|
||||
Route::get('vorschlag/{id}', array('before' => 'auth', function($id) {
|
||||
$tmdb = new TMDb('b187f8d9c5e72b1faecb741d5d04239a', 'de', TRUE);
|
||||
$f = $tmdb->getMovie($id);
|
||||
$film = new Film();
|
||||
$film ->name = $f['title'];
|
||||
$film->tvdbid = $id;
|
||||
$film->vorgeschlagen = \Carbon\Carbon::today();
|
||||
$film->user = Auth::user()->id;
|
||||
$film->save();
|
||||
return Redirect::to('film/' . $film->id);
|
||||
$ef = Film::where('tvdbid', '=', $id)->whereNull('gesehen')->first();
|
||||
if(is_null($ef)) {
|
||||
$tmdb = new TMDb('b187f8d9c5e72b1faecb741d5d04239a', 'de', TRUE);
|
||||
$f = $tmdb->getMovie($id);
|
||||
$film = new Film();
|
||||
$film->name = $f['title'];
|
||||
$film->tvdbid = $id;
|
||||
$film->vorgeschlagen = \Carbon\Carbon::today();
|
||||
$film->user = Auth::user()->id;
|
||||
$film->save();
|
||||
Session::put('message', 'Film hinzugefügt.');
|
||||
return Redirect::to('film/' . $film->id);
|
||||
} else {
|
||||
Session::put('message', 'Film bereits vorgeschlagen von ' . $ef->besitzer->name . '.');
|
||||
return Redirect::to('film/' . $ef->id);
|
||||
}
|
||||
}));
|
||||
|
||||
Route::get('mark-read/{id}', array('before' => 'auth', function($id) {
|
||||
@@ -320,6 +327,44 @@ Route::post('settings/{mode}', array('before' => 'auth', function($mode) {
|
||||
return View::make('settings')->with('errors', $val->messages());
|
||||
}
|
||||
}
|
||||
|
||||
if($mode == 'avatar-reset') {
|
||||
/** @var User $u */
|
||||
$u = Auth::user();
|
||||
$u->setSetting('avatar', false);
|
||||
$u->save();
|
||||
|
||||
/* Delete old Avatars */
|
||||
array_map('unlink', glob(public_path("img/avatars/". Auth::user()->id . "-*")));
|
||||
return View::make('settings')->with('message', 'Avatar gelöscht.');
|
||||
}
|
||||
|
||||
if($mode == 'avatar-upload') {
|
||||
$vfields = array('avatar' => Input::file('avatar'));
|
||||
$vrules = array('avatar' => 'required|image|max:5000');
|
||||
$val = Validator::make($vfields, $vrules);
|
||||
if($val->passes()) {
|
||||
/* Delete old Avatars */
|
||||
array_map('unlink', glob(public_path("img/avatars/". Auth::user()->id . "-*")));
|
||||
|
||||
/** @var Symfony\Component\HttpFoundation\File\UploadedFile $file */
|
||||
$file = Input::file('avatar');
|
||||
$file = $file->move( public_path("img/avatars/"), Auth::user()->id . "-". Str::slug($file->getFilename()) . "." . $file->guessExtension() );
|
||||
|
||||
$i = new Imagick();
|
||||
$i->readImage($file->getRealPath());
|
||||
$i->cropThumbnailImage(100, 100);
|
||||
$i->writeImage();
|
||||
|
||||
/** @var User $u */
|
||||
$u = Auth::user();
|
||||
$u->setSetting('avatar', $file->getFilename());
|
||||
$u->save();
|
||||
return View::make('settings')->with('message', 'Avatar gespeichert.');
|
||||
} else {
|
||||
return View::make('settings')->with('errors', $val->messages());
|
||||
}
|
||||
}
|
||||
}));
|
||||
|
||||
Route::get('users', array('before' => 'auth', function() {
|
||||
|
@@ -144,7 +144,7 @@
|
||||
@else
|
||||
<div class="media">
|
||||
<div class="pull-left">
|
||||
<img class="media-object" src="{{ "http://www.gravatar.com/avatar/" . md5( strtolower( trim( Auth::user()->email ) ) ) . "?s=40" }}">
|
||||
<img class="media-object" src="{{ Auth::user()->getAvatar() }}" width="64">
|
||||
</div>
|
||||
<div class="media-body">
|
||||
<h4 class="media-heading">Neuer Kommentar</h4>
|
||||
@@ -173,7 +173,7 @@
|
||||
|
||||
<div class="media">
|
||||
<div class="pull-left">
|
||||
<img class="media-object" src="{{ "http://www.gravatar.com/avatar/" . md5( strtolower( trim( $comment->autor->email ) ) ) . "?s=40" }}" alt="{{ $comment->autor->name }}">
|
||||
<img class="media-object" src="{{ $comment->autor->getAvatar() }}" alt="{{ $comment->autor->name }}" width="64">
|
||||
</div>
|
||||
<div class="media-body" id="comment{{$comment->id}}">
|
||||
<h5 class="media-heading">{{ $comment->autor->name }} <small>{{\Carbon\Carbon::parse($comment->created_at)->format('d.m.Y H:i')}}
|
||||
|
@@ -4,7 +4,7 @@
|
||||
<meta charset="utf-8">
|
||||
<title>@yield('title') Dumbo</title>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<link href="{{ asset('css/bootstrap-my.min.css') }}" type="text/css" rel="stylesheet">
|
||||
<link href="{{ asset('css/bootstrap.css') }}" type="text/css" rel="stylesheet">
|
||||
<link href="{{ asset('css/general.css') }}" type="text/css" rel="stylesheet">
|
||||
@yield('styles')
|
||||
</head>
|
||||
@@ -21,8 +21,8 @@
|
||||
</div>
|
||||
<div class="navbar-collapse collapse">
|
||||
<ul class="nav navbar-nav">
|
||||
<li>{{ HTML::link('beliebt', 'Beliebt') }}</li>
|
||||
<li>{{ HTML::link('vorgeschlagen', 'Vorgeschlagen') }}</li>
|
||||
<li>{{ HTML::link('beliebt', 'Beliebt (Wertung)') }}</li>
|
||||
<li>{{ HTML::link('vorgeschlagen', 'Vorgeschlagen (Datum)') }}</li>
|
||||
<li>{{ HTML::link('gesehen', 'Gesehen') }}</li>
|
||||
<li>{{ HTML::link('neu', 'Film vorschlagen')}}
|
||||
</ul>
|
||||
@@ -32,9 +32,11 @@
|
||||
<li>{{ HTML::link('login', 'Login') }}</li>
|
||||
@else
|
||||
<li class="dropdown">
|
||||
<a class="dropdown-toggle" data-toggle="dropdown" href="#">{{Auth::user()->name}} <span class="caret"></span></a>
|
||||
<a class="dropdown-toggle" data-toggle="dropdown" href="#">
|
||||
<img src="{{ Auth::user()->getAvatar() }}" height="25" }}>
|
||||
{{Auth::user()->name}} <span class="caret"></span></a>
|
||||
<ul class="dropdown-menu">
|
||||
<li>{{ HTML::link('settings', 'Passwort & Email ändern')}}</li>
|
||||
<li>{{ HTML::link('settings', 'Einstellungen')}}</li>
|
||||
@if(Auth::user()->admin)
|
||||
<li>{{ HTML::link('users', 'Benutzerverwaltung')}}</li>
|
||||
<li>{{ HTML::link('news', 'News erstellen')}}</li>
|
||||
@@ -60,7 +62,7 @@
|
||||
<div class="container">
|
||||
<div class="alert alert-success alert-dismissable">
|
||||
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
|
||||
{{ Session::get('message') }}
|
||||
{{ Session::get('message') }} <?php Session::forget('message'); ?>
|
||||
</div>
|
||||
</div>
|
||||
@endif
|
||||
|
@@ -9,7 +9,7 @@
|
||||
<img src="{{$image}}" class="pull-left thumbnail" style="max-height: 100px; margin-right: 15px;">
|
||||
<h4>{{$topfilm->name}}</h4>
|
||||
<p><span class="glyphicon glyphicon-thumbs-up"></span> {{$topfilm->upvotes}}
|
||||
<span class="glyphicon glyphicon-tree-conifer"></span> {{$topfilm->downvotes + $topfilm->upvotes}}</p>
|
||||
<span class="glyphicon glyphicon-tree-deciduous"></span> {{$topfilm->downvotes + $topfilm->upvotes}}</p>
|
||||
@if(!is_null(Auth::user()) && Auth::user()->admin)
|
||||
<a href='{{ url('view-next/' . $topfilm->id) }}' class='btn btn-success btn-xs'>Als nächstes sehen</a>
|
||||
@endif
|
||||
|
@@ -1,76 +1,112 @@
|
||||
@extends('hello')
|
||||
|
||||
@section('content')
|
||||
<div class="container" style="margin-top: 40px;">
|
||||
<div class="row">
|
||||
<div class="col-md-8 col-md-offset-2">
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading"><h2 class="panel-title">Passwort ändern</h2></div>
|
||||
<div class="panel-body">
|
||||
{{ Form::open(array('url' => 'settings/password')) }}
|
||||
{{ $errors->first() }}
|
||||
<div class="input-group form-group <?php if($errors->has('oldpw')) echo "has-error" ?>">
|
||||
<div class="container" style="margin-top: 40px;">
|
||||
<div class="row">
|
||||
<div class="col-md-2">
|
||||
<ul class="nav nav-pills nav-stacked">
|
||||
<li class="active"><a href="#avatar" data-toggle="pill">Avatar</a></li>
|
||||
<li><a href="#password" data-toggle="pill">Password</a></li>
|
||||
<li><a href="#email" data-toggle="pill">E-Mail</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="col-md-8 tab-content">
|
||||
<div class="tab-pane active" id="avatar">
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading">
|
||||
<h2 class="panel-title">Avatar</h2>
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
<div class="media media-left">
|
||||
<a href="#"><img class="media-object" src="{{ Auth::user()->getAvatar() }}" width="64"></a>
|
||||
</div>
|
||||
<div class="media-body">
|
||||
<h4 class="media-heading">Aktueller Avatar</h4>
|
||||
Du kannst unten einen neuen Avatar hochladen oder den Avatar zurücksetzen.
|
||||
</div>
|
||||
<p>
|
||||
{{ Form::open(array('url' => 'settings/avatar-upload', 'files' => true)) }}
|
||||
{{ $errors->first() }}
|
||||
{{ Form::file('avatar'); }}
|
||||
<button type="submit" class="btn btn-primary">Absenden</button>
|
||||
{{ Form::close() }}
|
||||
</p>
|
||||
<p>
|
||||
{{ Form::open(array('url' => 'settings/avatar-reset')) }}
|
||||
<button type="submit" class="btn btn-danger">Avatar zurücksetzen</button>
|
||||
{{ Form::close() }}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="tab-pane" id="password">
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading"><h2 class="panel-title">Passwort ändern</h2></div>
|
||||
<div class="panel-body">
|
||||
{{ Form::open(array('url' => 'settings/password')) }}
|
||||
{{ $errors->first() }}
|
||||
<div class="input-group form-group <?php if ($errors->has('oldpw')) echo "has-error" ?>">
|
||||
<span class="input-group-addon">
|
||||
<span class="glyphicon glyphicon-lock"></span>
|
||||
</span>
|
||||
<input type="password" class="form-control" name="oldpw" placeholder="Altes Passwort">
|
||||
</div>
|
||||
<div class="input-group form-group <?php if($errors->has('newpw')) echo "has-error" ?>">
|
||||
<input type="password" class="form-control" name="oldpw" placeholder="Altes Passwort">
|
||||
</div>
|
||||
<div class="input-group form-group <?php if ($errors->has('newpw')) echo "has-error" ?>">
|
||||
<span class="input-group-addon">
|
||||
<span class="glyphicon glyphicon-lock"></span>
|
||||
</span>
|
||||
<input type="password" class="form-control" name="newpw" placeholder="Neues Passwort">
|
||||
</div>
|
||||
<div class="input-group form-group <?php if($errors->has('newpw')) echo "has-error" ?>">
|
||||
<input type="password" class="form-control" name="newpw" placeholder="Neues Passwort">
|
||||
</div>
|
||||
<div class="input-group form-group <?php if ($errors->has('newpw')) echo "has-error" ?>">
|
||||
<span class="input-group-addon">
|
||||
<span class="glyphicon glyphicon-lock"></span>
|
||||
</span>
|
||||
<input type="password" class="form-control" name="newpw2" placeholder="Neues Passwort bestätigen">
|
||||
</div>
|
||||
<button type="submit" class="btn btn-primary">Absenden</button>
|
||||
{{ Form::close() }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-8 col-md-offset-2">
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading"><h2 class="panel-title">Email ändern</h2></div>
|
||||
<div class="panel-body">
|
||||
<dl class="dl-horizontal">
|
||||
<dt>Aktuelle Email</dt>
|
||||
<dd>{{Auth::user()->email}}</dd>
|
||||
</dl>
|
||||
{{ Form::open(array('url' => 'settings/email')) }}
|
||||
<div class="input-group form-group <?php if($errors->has('pw')) echo "has-error" ?>">
|
||||
<input type="password" class="form-control" name="newpw2"
|
||||
placeholder="Neues Passwort bestätigen">
|
||||
</div>
|
||||
<button type="submit" class="btn btn-primary">Absenden</button>
|
||||
{{ Form::close() }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="tab-pane" id="email">
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading"><h2 class="panel-title">E-Mail ändern</h2></div>
|
||||
<div class="panel-body">
|
||||
<dl class="dl-horizontal">
|
||||
<dt>Aktuelle E-Mail</dt>
|
||||
<dd>{{Auth::user()->email}}</dd>
|
||||
</dl>
|
||||
{{ Form::open(array('url' => 'settings/email')) }}
|
||||
<div class="input-group form-group <?php if ($errors->has('pw')) echo "has-error" ?>">
|
||||
<span class="input-group-addon">
|
||||
<span class="glyphicon glyphicon-lock"></span>
|
||||
</span>
|
||||
<input type="password" class="form-control" name="pw" placeholder="Passwort">
|
||||
</div>
|
||||
<div class="input-group form-group <?php if($errors->has('email')) echo "has-error" ?>">
|
||||
<input type="password" class="form-control" name="pw" placeholder="Passwort">
|
||||
</div>
|
||||
<div class="input-group form-group <?php if ($errors->has('email')) echo "has-error" ?>">
|
||||
<span class="input-group-addon">
|
||||
<span class="glyphicon glyphicon-envelope"></span>
|
||||
</span>
|
||||
<input type="email" class="form-control" name="email" placeholder="Neue Email">
|
||||
</div>
|
||||
<div class="input-group form-group <?php if($errors->has('email')) echo "has-error" ?>">
|
||||
<input type="email" class="form-control" name="email" placeholder="Neue E-Mail">
|
||||
</div>
|
||||
<div class="input-group form-group <?php if ($errors->has('email')) echo "has-error" ?>">
|
||||
<span class="input-group-addon">
|
||||
<span class="glyphicon glyphicon-envelope"></span>
|
||||
</span>
|
||||
<input type="email" class="form-control" name="email2" placeholder="Neue Email bestätigen">
|
||||
</div>
|
||||
<button type="submit" class="btn btn-primary">Absenden</button>
|
||||
{{ Form::close() }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<input type="email" class="form-control" name="email2"
|
||||
placeholder="Neue E-Mail bestätigen">
|
||||
</div>
|
||||
<button type="submit" class="btn btn-primary">Absenden</button>
|
||||
{{ Form::close() }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@stop
|
||||
|
||||
@section('title')
|
||||
Einstellungen ~
|
||||
Einstellungen ~
|
||||
@stop
|
||||
|
@@ -27,7 +27,7 @@
|
||||
$vp = $film->upvotes;
|
||||
$np = $film->downvotes;
|
||||
?>
|
||||
<span class="glyphicon glyphicon-tree-conifer"></span> {{ $vp + $np }}
|
||||
<span class="glyphicon glyphicon-tree-deciduous"></span> {{ $vp + $np }}
|
||||
</td>
|
||||
<td>
|
||||
@if(($vp) > 0) <span class="label label-default">+{{$vp}}</span>
|
||||
|
Reference in New Issue
Block a user