Skip to content

Commit

Permalink
#7 forum signature
Browse files Browse the repository at this point in the history
fixes
  • Loading branch information
Gummibeer committed Oct 10, 2015
1 parent cfdf1fc commit 96c79f1
Show file tree
Hide file tree
Showing 11 changed files with 526 additions and 52 deletions.
113 changes: 70 additions & 43 deletions app/Http/Controllers/App/DashboardController.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,57 +30,84 @@ public function getIndex()

private function getLife()
{
$sourceQuery = new \SourceQuery();
$sourceQuery->Connect(env('A3L_HOST', ''), env('A3L_PORT', 2303), 1, \SourceQuery::SOURCE);
$a3lInfo = $sourceQuery->GetInfo();
$a3lPlayers = collect($sourceQuery->GetPlayers());
$sourceQuery->Disconnect();
try {
$sourceQuery = new \SourceQuery();
$sourceQuery->Connect(env('A3L_HOST', ''), env('A3L_PORT', 2303), 1, \SourceQuery::SOURCE);
$a3lInfo = $sourceQuery->GetInfo();
$a3lPlayers = collect($sourceQuery->GetPlayers());
$sourceQuery->Disconnect();

$a3lRestart = Carbon::now()->setTimezone('Europe/Berlin');
$a3lRestart->minute = 0;
$a3lRestart->second = 0;
$hours = (ceil($a3lRestart->hour / 6) * 6) - $a3lRestart->hour;
$hours = $hours == 0 ? 6 : $hours;
$a3lRestart->addHours($hours);
$a3lRestart = Carbon::now()->setTimezone('Europe/Berlin');
$a3lRestart->minute = 0;
$a3lRestart->second = 0;
$hours = (ceil($a3lRestart->hour / 6) * 6) - $a3lRestart->hour;
$hours = $hours == 0 ? 6 : $hours;
$a3lRestart->addHours($hours);

return [
'player_count' => A3lPlayer::count(),
'vehicle_count' => A3lVehicle::count(),
'money_sum' => A3lPlayer::sum('cash') + A3lPlayer::sum('bankacc'),
'karma_sum' => A3lPlayer::sum('Karma'),
'info' => $a3lInfo,
'playersOnline' => $a3lPlayers,
'restart' => $a3lRestart,
];
return [
'player_count' => A3lPlayer::count(),
'vehicle_count' => A3lVehicle::count(),
'money_sum' => A3lPlayer::sum('cash') + A3lPlayer::sum('bankacc'),
'karma_sum' => A3lPlayer::sum('Karma'),
'info' => $a3lInfo,
'playersOnline' => $a3lPlayers,
'restart' => $a3lRestart,
];
} catch (\Exception $e) {
return [
'player_count' => 0,
'vehicle_count' => 0,
'money_sum' => 0,
'karma_sum' => 0,
'info' => null,
'playersOnline' => 0,
'restart' => null,
];
}
}

private function getExile()
{
$sourceQuery = new \SourceQuery();
$sourceQuery->Connect(env('A3E_HOST', ''), env('A3E_PORT', 2303), 1, \SourceQuery::SOURCE);
$a3eInfo = $sourceQuery->GetInfo();
$a3ePlayers = collect($sourceQuery->GetPlayers());
$sourceQuery->Disconnect();
try {
$sourceQuery = new \SourceQuery();
$sourceQuery->Connect(env('A3E_HOST', ''), env('A3E_PORT', 2303), 1, \SourceQuery::SOURCE);
$a3eInfo = $sourceQuery->GetInfo();
$a3ePlayers = collect($sourceQuery->GetPlayers());
$sourceQuery->Disconnect();

$a3eRestart = Carbon::now()->setTimezone('Europe/Berlin');
$a3eRestart->minute = 0;
$a3eRestart->second = 0;
$hours = (ceil($a3eRestart->hour / 6) * 6) - $a3eRestart->hour;
$hours = $hours == 0 ? 6 : $hours;
$a3eRestart->addHours($hours);
$a3eRestart = Carbon::now()->setTimezone('Europe/Berlin');
$a3eRestart->minute = 0;
$a3eRestart->second = 0;
$hours = (ceil($a3eRestart->hour / 6) * 6) - $a3eRestart->hour;
$hours = $hours == 0 ? 6 : $hours;
$a3eRestart->addHours($hours);

return [
'account_count' => A3eAccount::count(),
'vehicle_count' => A3eVehicle::count(),
'territory_count' => A3eTerritory::count(),
'money_sum' => A3eAccount::sum('money'),
'score_sum' => A3eAccount::sum('score'),
'kills_sum' => A3eAccount::sum('kills'),
'deaths_sum' => A3eAccount::sum('deaths'),
'info' => $a3eInfo,
'playersOnline' => $a3ePlayers,
'restart' => $a3eRestart,
];
return [
'account_count' => A3eAccount::count(),
'vehicle_count' => A3eVehicle::count(),
'territory_count' => A3eTerritory::count(),
'money_sum' => A3eAccount::sum('money'),
'score_sum' => A3eAccount::sum('score'),
'kills_sum' => A3eAccount::sum('kills'),
'deaths_sum' => A3eAccount::sum('deaths'),
'info' => $a3eInfo,
'playersOnline' => $a3ePlayers,
'restart' => $a3eRestart,
];
} catch (\Exception $e) {
return [
'account_count' => 0,
'vehicle_count' => 0,
'territory_count' => 0,
'money_sum' => 0,
'score_sum' => 0,
'kills_sum' => 0,
'deaths_sum' => 0,
'info' => null,
'playersOnline' => 0,
'restart' => null,
];
}
}

private function getGitlab()
Expand Down
4 changes: 3 additions & 1 deletion app/Http/Controllers/App/ProfileController.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@ public function postUpdate(Request $request, $id)
abort(403);
}

$data = array_filter(\Input::only('email', 'password', 'password_confirmation'));
$data = array_filter(\Input::only('email', 'password', 'password_confirmation', 'content'));
$data['signature'] = array_get($data, 'content', '');
unset($data['content']);
$validator = \Validator::make($data, User::$rules['update']);
if($validator->fails()) {
return back()->withErrors($validator)->withInput();
Expand Down
3 changes: 2 additions & 1 deletion app/Teamspeak/Server.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ public function __construct()
try {
$this->instance = TeamSpeak3::factory('serverquery://'.config('services.teamspeak.user').':'.config('services.teamspeak.password').'@'.config('services.teamspeak.host').':'.config('services.teamspeak.port').'/?server_port='.config('services.teamspeak.server_port').'');
$this->info = $this->instance->getInfo();
$this->prepareAttributes();
} catch(\Exception $e) {
$this->info = [];
}
$this->prepareAttributes();
}

private function prepareAttributes()
Expand All @@ -31,6 +31,7 @@ private function prepareAttributes()
public function getClients()
{
try {
if(is_null($this->instance)) return null;
$clientList = $this->instance->clientList();
$clients = new Collection();
foreach ($clientList as $client) {
Expand Down
1 change: 1 addition & 0 deletions app/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ class User extends Model implements AuthenticatableContract, AuthorizableContrac
'username',
'email',
'password',
'signature',
'facebook',
'github',
'steam',
Expand Down
19 changes: 19 additions & 0 deletions database/migrations/2015_10_10_115546_add_user_signature.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?php

use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class AddUserSignature extends Migration
{
public function up()
{
Schema::table('users', function (Blueprint $table) {
$table->text('signature')->after('password');
});
}

public function down()
{
//
}
}
4 changes: 2 additions & 2 deletions public/css/styles.min.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion public/css/styles.min.css.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion public/js/components/jquery.markdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,6 @@ jQuery('body').on('site.init', function () {

jQuery('.twemoji.clickable').on('click', function() {
var $this = jQuery(this);
insert_code('textareaFieldContent','',$this.data('alt'));
insert_code('textareaFieldContent', '', $this.data('alt'));
});
});
4 changes: 2 additions & 2 deletions resources/assets/less/twemoji.less
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
}

img.twemoji {
height: 1em;
width: 1em;
height: 1.25em;
width: 1.25em;
margin: 0 .05em 0 .1em;
vertical-align: -0.1em;

Expand Down
Loading

0 comments on commit 96c79f1

Please sign in to comment.