Subversion-Projekte lars-tiefland.laravel_shop

Revision

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