Subversion-Projekte lars-tiefland.webanos.faltradxxs.de

Revision

Revision 115 | Revision 119 | Zur aktuellen Revision | Details | Vergleich mit vorheriger | Letzte Änderung | Log anzeigen | RSS feed

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