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

Revision

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