Subversion-Projekte lars-tiefland.laravel_shop

Revision

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