This repository has been archived by the owner on May 7, 2019. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 0149fed
Showing
104 changed files
with
7,310 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
APP_ENV=local | ||
APP_DEBUG=true | ||
APP_KEY=SomeRandomString | ||
|
||
DB_HOST=localhost | ||
DB_DATABASE=homestead | ||
DB_USERNAME=homestead | ||
DB_PASSWORD=secret | ||
|
||
CACHE_DRIVER=file | ||
SESSION_DRIVER=file | ||
QUEUE_DRIVER=sync | ||
|
||
MAIL_DRIVER=smtp | ||
MAIL_HOST=mailtrap.io | ||
MAIL_PORT=2525 | ||
MAIL_USERNAME=null | ||
MAIL_PASSWORD=null | ||
MAIL_ENCRYPTION=null | ||
|
||
DOMAIN=u.pste.pw | ||
SITE_NAME=Pste | ||
OWNER_EMAIL=me@example.com | ||
OWNER_NAME=Me | ||
UPLOAD_LIMIT=20M | ||
IRC_CHANNEL=#leliana | ||
IRC_CHANNEL=irc.rizon.net | ||
SITE_EMAIL_FROM=noreply@pste.pw |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
* text=auto | ||
*.css linguist-vendored | ||
*.less linguist-vendored |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
/vendor | ||
/node_modules | ||
Homestead.yaml | ||
.env | ||
_ide_helper.php | ||
.phpstorm.meta.php | ||
_ide_helper_models.php |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<?php | ||
|
||
namespace App\Console\Commands; | ||
|
||
use Illuminate\Console\Command; | ||
use Illuminate\Foundation\Inspiring; | ||
|
||
class Inspire extends Command | ||
{ | ||
/** | ||
* The name and signature of the console command. | ||
* | ||
* @var string | ||
*/ | ||
protected $signature = 'inspire'; | ||
|
||
/** | ||
* The console command description. | ||
* | ||
* @var string | ||
*/ | ||
protected $description = 'Display an inspiring quote'; | ||
|
||
/** | ||
* Execute the console command. | ||
* | ||
* @return mixed | ||
*/ | ||
public function handle() | ||
{ | ||
$this->comment(PHP_EOL.Inspiring::quote().PHP_EOL); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<?php | ||
|
||
namespace App\Console; | ||
|
||
use Illuminate\Console\Scheduling\Schedule; | ||
use Illuminate\Foundation\Console\Kernel as ConsoleKernel; | ||
|
||
class Kernel extends ConsoleKernel | ||
{ | ||
/** | ||
* The Artisan commands provided by your application. | ||
* | ||
* @var array | ||
*/ | ||
protected $commands = [ | ||
\App\Console\Commands\Inspire::class, | ||
]; | ||
|
||
/** | ||
* Define the application's command schedule. | ||
* | ||
* @param \Illuminate\Console\Scheduling\Schedule $schedule | ||
* @return void | ||
*/ | ||
protected function schedule(Schedule $schedule) | ||
{ | ||
$schedule->command('inspire') | ||
->hourly(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<?php | ||
|
||
namespace App\Events; | ||
|
||
abstract class Event | ||
{ | ||
// | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
<?php | ||
|
||
namespace App\Exceptions; | ||
|
||
use Exception; | ||
use Symfony\Component\HttpKernel\Exception\HttpException; | ||
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler; | ||
|
||
class Handler extends ExceptionHandler | ||
{ | ||
/** | ||
* A list of the exception types that should not be reported. | ||
* | ||
* @var array | ||
*/ | ||
protected $dontReport = [ | ||
HttpException::class, | ||
]; | ||
|
||
/** | ||
* Report or log an exception. | ||
* | ||
* This is a great spot to send exceptions to Sentry, Bugsnag, etc. | ||
* | ||
* @param \Exception $e | ||
* @return void | ||
*/ | ||
public function report(Exception $e) | ||
{ | ||
return parent::report($e); | ||
} | ||
|
||
/** | ||
* Render an exception into an HTTP response. | ||
* | ||
* @param \Illuminate\Http\Request $request | ||
* @param \Exception $e | ||
* @return \Illuminate\Http\Response | ||
*/ | ||
public function render($request, Exception $e) | ||
{ | ||
return parent::render($request, $e); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
<?php | ||
|
||
namespace App\Http\Controllers; | ||
|
||
use App\Http\Requests; | ||
use Auth; | ||
use Mail; | ||
|
||
class AccountController extends Controller | ||
{ | ||
public function index() | ||
{ | ||
$now = time(); | ||
$registered_date = strtotime(Auth::user()->created_at); | ||
$datediff = $now - $registered_date; | ||
$days = floor($datediff / (60*60*24)); | ||
$new = $days == 0; | ||
|
||
return view('account.index', ['new' => $new]); | ||
} | ||
|
||
public function resources() | ||
{ | ||
return view('account.resources'); | ||
} | ||
|
||
public function script() | ||
{ | ||
return response()->view('account.script')->header('Content-Type', 'text/plain'); | ||
} | ||
|
||
public function uploads() | ||
{ | ||
$uploads = Auth::user()->uploads; | ||
return view('account.uploads', compact('uploads')); | ||
} | ||
|
||
public function resetKey() | ||
{ | ||
Auth::user()->fill(['apikey' => str_random(64)])->save(); | ||
Mail::queue('emails.user.api_key_reset', ['user' => Auth::user()], function($message) | ||
{ | ||
$message->from(env('SITE_EMAIL_FROM'), env('SITE_NAME')); | ||
$message->subject(sprintf("[%s] API Key Reset", env('DOMAIN'))); | ||
$message->to(Auth::user()->email); | ||
}); | ||
return redirect()->route('account'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
<?php | ||
|
||
namespace App\Http\Controllers; | ||
|
||
use App\User; | ||
|
||
use App\Http\Requests; | ||
use Mail; | ||
use Session; | ||
|
||
class AdminController extends Controller | ||
{ | ||
public function index() | ||
{ | ||
return view('admin.index'); | ||
} | ||
|
||
public function requests() | ||
{ | ||
$users = User::where('enabled', 0)->get(); | ||
return view('admin.requests', compact('users')); | ||
} | ||
|
||
public function users() | ||
{ | ||
$users = User::all(); | ||
return view('admin.users', ['users' => $users]); | ||
} | ||
|
||
public function ban($user) | ||
{ | ||
if ($user->id == 1) { | ||
Session::flash('alert', | ||
'You cannot ban the superuser account.'); | ||
return redirect()->back(); | ||
} | ||
$user->fill(['banned' => true])->save(); | ||
return redirect()->back(); | ||
} | ||
|
||
public function unban($user) | ||
{ | ||
$user->fill(['banned' => false])->save(); | ||
return redirect()->back(); | ||
} | ||
|
||
public function enable($user) | ||
{ | ||
$user->fill(['enabled' => true])->save(); | ||
Mail::queue('emails.user.account_approved', ['user' => $user], function($message) use ($user) | ||
{ | ||
$message->from(env('SITE_EMAIL_FROM'), env('SITE_NAME')); | ||
$message->subject(sprintf("[%s] Account Approved", env('DOMAIN'))); | ||
$message->to($user->email); | ||
}); | ||
return redirect()->back(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
<?php | ||
|
||
namespace App\Http\Controllers; | ||
|
||
use App\Upload; | ||
use Auth; | ||
use Illuminate\Http\Request; | ||
|
||
use App\Http\Requests; | ||
|
||
class ApiController extends Controller | ||
{ | ||
public function upload(Request $request) | ||
{ | ||
if (!$request->hasFile('file')) { | ||
return response()->json(['upload_file_not_found'], 400); | ||
} | ||
|
||
$file = $request->file('file'); | ||
if (!$file->isValid()) { | ||
return response()->json(['invalid_file_upload'], 400); | ||
} | ||
|
||
$path = storage_path() . '/uploads/'; | ||
$ext = $file->getClientOriginalExtension(); | ||
if (!$ext) { | ||
$ext = 'txt'; | ||
} | ||
|
||
$newname = str_random('5').".$ext"; | ||
$upload = Upload::create([ | ||
'user_id' => Auth::user()->id, | ||
'hash' => sha1_file($file), | ||
'name' => $newname, | ||
'size' => $file->getSize(), | ||
'original_name' => $file->getClientOriginalName() | ||
]); | ||
|
||
$upload->save(); | ||
$file->move($path, $newname); | ||
|
||
$result = [ | ||
'code' => 200, | ||
'hash' => $upload->getAttribute('hash'), | ||
'url' => url($newname) | ||
]; | ||
|
||
return response()->json($result); | ||
} | ||
} |
Oops, something went wrong.