Subversion-Projekte lars-tiefland.webanos.marine-sales.de

Revision

Revision 358 | Revision 366 | Zur aktuellen Revision | Details | Vergleich mit vorheriger | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
2 lars 1
<?php
2
 
176 lars 3
    use App\Http\Controllers\online_shop\ActionController;
4
    use App\Http\Controllers\online_shop\ActionMediumController;
2 lars 5
    use App\Http\Controllers\BackendController;
6
    use App\Http\Controllers\BackendUserController;
7
    use App\Http\Controllers\GoogleAuthenticatorController;
176 lars 8
    use App\Http\Controllers\online_shop\ManufacturerController;
2 lars 9
    use App\Http\Controllers\MediumController;
11 lars 10
    use App\Http\Controllers\PriceAgencyController;
177 lars 11
    use App\Http\Controllers\warenwirtschaft\OrderController;
6 lars 12
    use App\Http\Controllers\SalesPortalController;
13
    use App\Http\Controllers\SalesPortalItemController;
176 lars 14
    use App\Http\Controllers\online_shop\ShippingController;
15
    use App\Http\Controllers\online_shop\ShippingGroupController;
16
    use App\Http\Controllers\bestellwesen\SupplierController;
224 lars 17
    use App\Http\Controllers\bestellwesen\SupplierShippingController;
181 lars 18
    use App\Http\Controllers\bestellwesen\SupplierWarehouseController;
2 lars 19
    use App\Http\Controllers\ToolboxController;
11 lars 20
    use App\Models\Module;
21
    use App\Models\OrderType;
22
    use App\Models\Shop;
23
    use App\Models\UserProperty;
24
    use App\Models\Web;
25
    use App\Models\WebProperty;
2 lars 26
    use Illuminate\Support\Facades\Route;
11 lars 27
 
2 lars 28
    session_start();
29
 
11 lars 30
    setlocale( LC_TIME, 'de_DE.UTF-8' );
31
 
32
    $_SESSION["loadingGif"] = "/images/navigation/loading.gif";
33
    if ( file_exists( $_SERVER["DOCUMENT_ROOT"] . "/images/webelemente/loading.gif" ) )
34
    {
35
        $_SESSION["loadingGif"] = "/images/webelemente/loading.gif";
36
    }
37
 
38
    $c_bestellarten = array();
39
    $c_shops = array();
40
    $d_shops = array();
41
 
42
    $w = new Web();
43
    $GLOBALS["web"] = $w->where( "domain", "=", env( 'shop' ) )->first();
44
    if ( php_sapi_name() != "cli" )
45
    {
46
        if ( !file_exists( $_SERVER["DOCUMENT_ROOT"] . "/public/styles/" . $GLOBALS["web"]["domain"] . "_styles.css" ) )
47
        {
48
            require_once "styles.php";
49
        }
50
    }
217 lars 51
    View::share( "webs", $GLOBALS["web"] );
11 lars 52
 
218 lars 53
    $shops = Shop::all();
11 lars 54
    View::share( "shops", $shops );
28 lars 55
    $c_shops[""] = "alle";
11 lars 56
    foreach ( $shops as $s_id => $shop )
57
    {
58
        $c_shops[$shop->id] = $shop->name;
59
        $d_shops[$shop->id] = $shop;
60
    }
217 lars 61
    View::share( "c_shops", $c_shops );
62
    View::share( "d_shops", $d_shops );
11 lars 63
 
218 lars 64
    $ba = OrderType::all();
11 lars 65
    foreach ( $ba as $ba_id => $bestellart )
66
    {
67
        $c_bestellarten[$bestellart->id] = $bestellart->name;
68
    }
217 lars 69
    View::share( "c_bestellarten", $c_bestellarten );
11 lars 70
 
71
    $webRechte = WebProperty::with( [
72
        "property",
73
        "property.tool",
74
        "property.tool.module"
75
    ] )->where( "web_id", "=", $GLOBALS["web"]->ID )->get();
76
    $navi = Module::with( 'tool' )->orderBy( 'modules.rang' )->get();
217 lars 77
    View::share( "navi", $navi );
11 lars 78
    foreach ( $webRechte as $web_recht )
79
    {
80
        $property = $web_recht->property;
81
        $tool = $property->tool;
82
        $module = $tool->module;
83
        $GLOBALS["web_rechte"][$module->interner_name][$tool->button_name][$property->interner_name] = $web_recht->Bezeichnung;
84
    }
217 lars 85
    View::share( "web_rechte", $GLOBALS["web_rechte"] );
11 lars 86
 
87
    if ( isset( $_SESSION["admin"]["uid"] ) )
88
    {
89
        $uId = $_SESSION["admin"]["uid"];
90
        $admin = $_SESSION["admin"]["user"]->admin;
91
        $GLOBALS["user_rechte"] = $GLOBALS["web_rechte"];
92
        if ( !$admin )
93
        {
351 lars 94
            $user_rechte = UserProperty::with( [
11 lars 95
                "property",
346 lars 96
                "property.tool",
97
                "property.tool.module"
11 lars 98
            ] )->where( "backend_user_id", "=", $uId )->get();
351 lars 99
            foreach ( $user_rechte as $user_recht )
100
            {
101
                $property = $user_recht->property;
355 lars 102
                $tool = $property->tool;
351 lars 103
                $module = $tool->module;
355 lars 104
                $GLOBALS["user_rechte"][$module->interner_name][$tool->button_name][$property->interner_name] = 1;
351 lars 105
            }
11 lars 106
        }
217 lars 107
        View::share( "user_rechte", $GLOBALS["user_rechte"] );
11 lars 108
    }
109
 
2 lars 110
    Route::get( '/login', [
111
        BackendController::class,
112
        'create'
113
    ] )->name( 'login' );
114
    Route::post( '/login', [
115
        BackendController::class,
116
        'store'
117
    ] );
118
    Route::middleware( [
119
        'auth',
120
        //'2fa'
121
    ] )->group( function ()
122
    {
6 lars 123
        Route::view( "/", "index" );
124
        Route::get( "/actions/{id}/getMedia", [
125
            ActionMediumController::class,
126
            "liste"
127
        ] );
128
        Route::resource( 'backend_users', BackendUserController::class );
130 lars 129
        Route::prefix( "/bestellwesen" )->group( function ()
130
        {
131
            Route::resource( "/suppliers", SupplierController::class );
351 lars 132
            Route::scopeBindings()->group( function ()
133
            {
202 lars 134
                Route::resource( "/suppliers.supplierWarehouse", SupplierWarehouseController::class );
224 lars 135
                Route::resource( "/suppliers.shipping", SupplierShippingController::class );
351 lars 136
            } );
130 lars 137
        } );
2 lars 138
        Route::get( '/logout', [
139
            BackendController::class,
140
            'destroy'
141
        ] )->name( 'logout' );
6 lars 142
        Route::resource( 'media', MediumController::class );
143
        Route::prefix( "/Online-Shop" )->group( function ()
144
        {
145
            Route::resource( '/actions', ActionController::class );
83 lars 146
            Route::resource( '/manufacturers', ManufacturerController::class );
6 lars 147
            Route::resource( "/shippings", ShippingController::class );
148
            Route::resource( "/shippingGroups", ShippingGroupController::class );
149
        } );
28 lars 150
        Route::prefix( '/marketing' )->group( function ()
151
        {
11 lars 152
            Route::resource( '/priceAgencies', PriceAgencyController::class );
28 lars 153
        } );
2 lars 154
        Route::prefix( "/toolbox" )->group( function ()
155
        {
156
            Route::get( "/ga", [
157
                GoogleAuthenticatorController::class,
158
                "create"
159
            ] )->name( 'complete.registration' );
160
            Route::post( "/ga", [
161
                GoogleAuthenticatorController::class,
162
                "store"
163
            ] )->name( '2fa' );
164
            Route::delete( "/ga", [
165
                GoogleAuthenticatorController::class,
166
                "DESTROY"
167
            ] );
168
            Route::get( "/", [
169
                ToolboxController::class,
170
                "create"
171
            ] );
172
            Route::get( "/changeShopVersion", [
173
                ToolboxController::class,
174
                "changeShopVersion"
175
            ] );
176
            Route::get( "/updateShopVersion", [
177
                ToolboxController::class,
178
                "updateShopVersion"
179
            ] );
180
            Route::get( "/readSVNLog", [
181
                ToolboxController::class,
182
                "readSVNLog"
183
            ] );
184
        } );
6 lars 185
 
186
        Route::prefix( "vportale" )->group( function ()
2 lars 187
        {
6 lars 188
            Route::resource( "salesPortals", SalesPortalController::class );
189
            Route::resource( "salesPortalItems", SalesPortalItemController::class );
2 lars 190
        } );
11 lars 191
 
28 lars 192
        Route::prefix( "/Warenwirtschaft" )->group( function ()
2 lars 193
        {
194
            Route::resource( 'orders', OrderController::class );
195
        } );
196
    } );