Subversion-Projekte lars-tiefland.laravel_shop

Revision

Revision 1405 | Revision 1446 | Zur aktuellen Revision | Details | Vergleich mit vorheriger | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
964 lars 1
<?php
2
 
1334 lars 3
    use App\Http\Controllers\ActionController;
992 lars 4
    use App\Http\Controllers\BackendController;
1247 lars 5
    use App\Http\Controllers\BackendUserController;
1337 lars 6
    use App\Http\Controllers\OrderController;
1118 lars 7
    use App\Http\Controllers\ToolboxController;
1093 lars 8
    use App\Models\Module;
1106 lars 9
    use App\Models\UserProperty;
1071 lars 10
    use App\Models\Web;
1076 lars 11
    use App\Models\WebProperty;
1107 lars 12
    use Illuminate\Support\Facades\Auth;
964 lars 13
    use Illuminate\Support\Facades\Route;
14
 
1197 lars 15
    setlocale( LC_TIME, 'de_DE.UTF-8' );
1385 lars 16
 
17
    $w = new Web();
18
    $GLOBALS["web"] = $w->where( "domain", "=", env( 'shop' ) )->first();
1408 lars 19
    if ( php_sapi_name() != "cli" )
1384 lars 20
    {
1408 lars 21
        if ( !file_exists( $_SERVER["DOCUMENT_ROOT"] . "/public/admin/styles/" . $GLOBALS["web"]["domain"] . "_styles.css" ) )
22
        {
23
            require_once "styles.php";
24
        }
1384 lars 25
    }
1214 lars 26
    \View::share( "webs", $GLOBALS["web"] );
1204 lars 27
    $_SESSION["loadingGif"] = "/images/navigation/loading.gif";
1205 lars 28
    if ( file_exists( $_SERVER["DOCUMENT_ROOT"] . "/images/webelemente/loading.gif" ) )
1203 lars 29
    {
30
        $_SESSION["loadingGif"] = "/images/webelemente/loading.gif";
31
    }
1197 lars 32
    $webRechte = WebProperty::with( [
33
        "property",
34
        "property.tool",
35
        "property.tool.module"
36
    ] )->where( "web_id", "=", $GLOBALS["web"]->ID )->get();
1107 lars 37
    $navi = Module::with( 'tool' )->orderBy( 'modules.rang' )->get();
1092 lars 38
    \View::share( "navi", $navi );
1087 lars 39
    foreach ( $webRechte as $web_recht )
1081 lars 40
    {
1087 lars 41
        $property = $web_recht->property;
42
        $tool = $property->tool;
43
        $module = $tool->module;
1197 lars 44
        $GLOBALS["web_rechte"][ $module->interner_name ][ $tool->button_name ][ $property->interner_name ] = $web_recht->Bezeichnung;
1081 lars 45
    }
1088 lars 46
    \View::share( "web_rechte", $GLOBALS["web_rechte"] );
1110 lars 47
    if ( isset( $_SESSION["admin"]["uid"] ) )
1106 lars 48
    {
1110 lars 49
        $uId = $_SESSION["admin"]["uid"];
1108 lars 50
        $admin = $_SESSION["admin"]["user"]->admin;
51
        $user_rechte = $GLOBALS["web_rechte"];
52
        if ( !$admin )
53
        {
1197 lars 54
            $user_rechte = UserProperty::with( [
55
                "property",
56
                "tool",
57
                "module"
58
            ] )->where( "backend_user_id", "=", $uId )->get();
1108 lars 59
        }
1109 lars 60
        \View::share( "user_rechte", $user_rechte );
1106 lars 61
    }
1071 lars 62
 
1197 lars 63
    Route::get( '/login', [
64
        BackendController::class,
65
        'create'
66
    ] )->name( 'login' );
67
    Route::post( '/login', [
68
        BackendController::class,
69
        'store'
70
    ] );
1146 lars 71
    Route::middleware( 'auth:admin' )->group( function ()
964 lars 72
    {
1197 lars 73
        Route::get( '/logout', [
74
            BackendController::class,
75
            'destroy'
76
        ] )->name( 'logout' );
1117 lars 77
        Route::prefix( "/toolbox" )->group( function ()
78
        {
1197 lars 79
            Route::get( "/", [
80
                ToolboxController::class,
81
                "create"
82
            ] );
83
            Route::get( "/changeShopVersion", [
84
                ToolboxController::class,
85
                "changeShopVersion"
86
            ] );
1234 lars 87
            Route::get( "/updateShopVersion", [
1226 lars 88
                ToolboxController::class,
89
                "updateShopVersion"
90
            ] );
1227 lars 91
            Route::get( "/readSVNLog", [
92
                ToolboxController::class,
93
                "readSVNLog"
94
            ] );
1117 lars 95
        } );
1384 lars 96
        Route::resource( 'actions', ActionController::class );
97
        Route::resource( 'backend_users', BackendUserController::class );
98
        Route::resource( 'orders', OrderController::class );
1143 lars 99
        Route::view( "/", "admin/index" );
1405 lars 100
    } );