Permalink
Browse files

Eigener SQL Editor für eine einfachere Bedienung, Passwörter durch Ad…

…min rücksetzbar, Splashbilder auf Landingpage. Packages für Entwicklung hinzugefügt.
  • Loading branch information...
wi-wissen committed Jun 25, 2017
1 parent 14beb8c commit 66990bbbe68bc4e1ee12c0786a3947a95e79eda9
Showing 437 changed files with 76,826 additions and 89 deletions.
@@ -7,8 +7,10 @@
use Symfony\Component\HttpKernel\Exception\HttpException;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
//use for debugging:
//use GrahamCampbell\Exceptions\ExceptionHandler as ExceptionHandler;
class Handler extends ExceptionHandler
class Handler extends ExceptionHandler
{
/**
* A list of the exception types that should not be reported.
@@ -24,11 +24,31 @@ public function __construct()
}
public function getIndex()
{
{
$users = User::orderBy('created_at', 'asc')->get();
return view('dbadmin.index')->with('users', $users);
}
public function getPassword($id)
{
//generate id
$chars = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789';
$count = mb_strlen($chars);
for ($i = 0, $pw = ''; $i < 6; $i++) {
$index = rand(0, $count - 1);
$pw .= mb_substr($chars, $index, 1);
}
$user = User::find($id);
$user->password = bcrypt($pw);
$user->save();
flash()->overlay('New Password: ' . $pw, 'Password for User ' . $id);
return back();
}
public function getUser($id)
{
$user = User::find($id);
@@ -0,0 +1,85 @@
<?php
namespace App\Http\Controllers;
//use Illuminate\Http\Request;
use Request;
use App\Http\Requests;
use App\Http\Controllers\Controller;
use App\Profile;
use DB;
use Input;
use Config;
use Auth;
use Schema;
use Illuminate\Support\Facades\Hash;
use Debugbar;
use Table;
class SqlController extends Controller
{
/**
* Enforce Database per User.
*
*/
public function __construct()
{
$this->middleware('auth');
Config::set("database.connections.friendzone_" . Auth::user()->id, array(
'driver' => 'mysql',
'host' => 'localhost',
'database' => 'friendzone_' . Auth::user()->id,
'username' => 'friendzone_' . Auth::user()->id,
'password' => Auth::user()->db_password,
'charset' => 'utf8',
'collation' => 'utf8_unicode_ci',
'prefix' => '',
));
Config::set('database.default', "friendzone_" . Auth::user()->id);
}
public function getQuery()
{
$table =false;
if (Input::has('editor')) {
//Ergebnis vorbereiten
try {
$r = DB::select(Input::get('editor'));
if (!$r) {
flash("Anfrage ausgeführt.", 'success');
} else {
flash("Anfrage ausgeführt. " . count($r) ." Ergebnisse gefunden.", 'success');
$table = Table::create($r);
}
} catch(\Illuminate\Database\QueryException $ex){
flash($ex->getMessage(), 'danger');
}
}
//Tabelle darstellen
$dbclass ="";
$r = DB::table('information_schema.tables')->get();
if (!$r) {
echo "<div class='alert alert-danger'>Keine Tabellen gefunden.</div>";
}
foreach ($r as $v) {
if (!strcmp($v->TABLE_TYPE, "BASE TABLE")) {
$dbclass = $dbclass . "<b>" . $v->TABLE_NAME . ':</b> ';
$columns = Schema::getColumnListing($v->TABLE_NAME);
foreach ($columns as &$column) {
$dbclass = $dbclass . $column . ", ";
}
$dbclass = $dbclass . "<br />";
}
}
return view('sql', ['result' => $table, 'tables' => $dbclass]);
}
}
@@ -0,0 +1,55 @@
<?php
namespace App\Http\Controllers;
//use Illuminate\Http\Request;
use Request;
use App\Http\Requests;
use App\Http\Controllers\Controller;
use App\Profile;
use DB;
use Input;
use Config;
use Auth;
use Schema;
use Illuminate\Support\Facades\Hash;
class UserController extends Controller
{
public function __construct()
{
$this->middleware('auth');
}
public function getPassword()
{
return view('auth.set');
}
public function postPassword()
{
if (Hash::check(Input::get('old_password'), Auth::user()->getAuthPassword())) {
if (!strcmp(Input::get('password'), Input::get('password_confirmation'))) {
if (strlen(Input::get('password'))>5) {
Auth::user()->password = bcrypt(Input::get('password'));
Auth::user()->save();
flash('Password changed', 'success');
} else {
flash('password minlength is 6 characters', 'warning');
}
} else {
flash('New password does not match with confirmed password', 'danger');
}
}
else {
flash('Wrong password', 'danger');
}
return view('auth.set');
}
}
@@ -13,6 +13,7 @@
Event::listen('illuminate.query', function($query)
{
//var_dump($query);
//flash($query);
});
Route::get('auth/register', 'Auth\AuthController@getRegister');
@@ -27,6 +28,12 @@
Route::get('password/reset/{token}', 'Auth\PasswordController@getReset');
Route::post('password/reset', 'Auth\PasswordController@postReset');
Route::get('user/password', 'UserController@getPassword');
Route::post('user/password', 'UserController@postPassword');
Route::get('sql', 'SqlController@getQuery');
Route::post('sql', 'SqlController@getQuery');
Route::get('profiles/search',['uses' => 'ProfileController@getSimpleSearch','as' => 'search']);
Route::get('profiles/advancedsearch',['uses' => 'ProfileController@getAdvancedSearch','as' => 'search']);
@@ -44,3 +51,5 @@
Route::get('/about', 'PagesController@about');
Route::get('/contact', 'PagesController@contact');
Route::get('/search', 'PagesController@search');
Route::get('logs', '\Rap2hpoutre\LaravelLogViewer\LogViewerController@index')->middleware('admin');;
@@ -8,13 +8,19 @@
"php": ">=5.5.9",
"laravel/framework": "5.1.*",
"illuminate/html": "^5.0",
"guzzlehttp/guzzle": "~5.3|~6.0"
"guzzlehttp/guzzle": "~5.3|~6.0",
"graham-campbell/exceptions": "^9.3",
"laracasts/flash": "^2.0",
"rap2hpoutre/laravel-log-viewer": "^0.8.0",
"barryvdh/laravel-debugbar": "^2.3",
"gbrock/laravel-table": "^0.3.4"
},
"require-dev": {
"fzaninotto/faker": "~1.4",
"mockery/mockery": "0.9.*",
"phpunit/phpunit": "~4.0",
"phpspec/phpspec": "~2.1"
"phpspec/phpspec": "~2.1",
"filp/whoops": "^2.1"
},
"autoload": {
"classmap": [
Oops, something went wrong.

0 comments on commit 66990bb

Please sign in to comment.