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

Revision

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