Subversion-Projekte lars-tiefland.laravel_shop

Revision

Revision 1497 | Revision 1550 | 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;
1522 lars 4
    use App\Http\Controllers\ActionMediumController;
992 lars 5
    use App\Http\Controllers\BackendController;
1247 lars 6
    use App\Http\Controllers\BackendUserController;
1337 lars 7
    use App\Http\Controllers\OrderController;
1118 lars 8
    use App\Http\Controllers\ToolboxController;
1093 lars 9
    use App\Models\Module;
1448 lars 10
    use App\Models\OrderType;
1449 lars 11
    use App\Models\Shop;
1106 lars 12
    use App\Models\UserProperty;
1071 lars 13
    use App\Models\Web;
1076 lars 14
    use App\Models\WebProperty;
964 lars 15
    use Illuminate\Support\Facades\Route;
16
 
1197 lars 17
    setlocale( LC_TIME, 'de_DE.UTF-8' );
1385 lars 18
 
19
    $w = new Web();
20
    $GLOBALS["web"] = $w->where( "domain", "=", env( 'shop' ) )->first();
1408 lars 21
    if ( php_sapi_name() != "cli" )
1384 lars 22
    {
1408 lars 23
        if ( !file_exists( $_SERVER["DOCUMENT_ROOT"] . "/public/admin/styles/" . $GLOBALS["web"]["domain"] . "_styles.css" ) )
24
        {
25
            require_once "styles.php";
26
        }
1384 lars 27
    }
1214 lars 28
    \View::share( "webs", $GLOBALS["web"] );
1447 lars 29
    $c_bestellarten = array();
30
    $c_shops = array();
31
    $d_shops = array();
32
    $ba = OrderType::get();
1446 lars 33
    foreach ( $ba as $ba_id => $bestellart )
34
    {
1447 lars 35
        $c_bestellarten[$bestellart->id] = $bestellart->name;
1446 lars 36
    }
37
    $shops = Shop::get();
1496 lars 38
    View::share( "shops", $shops );
1446 lars 39
    foreach ( $shops as $s_id => $shop )
40
    {
41
        $c_shops[$shop->id] = $shop->name;
42
        $d_shops[$shop->id] = $shop;
43
    }
1450 lars 44
    \View::share( "c_bestellarten", $c_bestellarten );
1446 lars 45
    \View::share( "c_shops", $c_shops );
46
    \View::share( "d_shops", $d_shops );
1204 lars 47
    $_SESSION["loadingGif"] = "/images/navigation/loading.gif";
1205 lars 48
    if ( file_exists( $_SERVER["DOCUMENT_ROOT"] . "/images/webelemente/loading.gif" ) )
1203 lars 49
    {
50
        $_SESSION["loadingGif"] = "/images/webelemente/loading.gif";
51
    }
1197 lars 52
    $webRechte = WebProperty::with( [
53
        "property",
54
        "property.tool",
55
        "property.tool.module"
56
    ] )->where( "web_id", "=", $GLOBALS["web"]->ID )->get();
1107 lars 57
    $navi = Module::with( 'tool' )->orderBy( 'modules.rang' )->get();
1092 lars 58
    \View::share( "navi", $navi );
1087 lars 59
    foreach ( $webRechte as $web_recht )
1081 lars 60
    {
1087 lars 61
        $property = $web_recht->property;
62
        $tool = $property->tool;
63
        $module = $tool->module;
1446 lars 64
        $GLOBALS["web_rechte"][$module->interner_name][$tool->button_name][$property->interner_name] = $web_recht->Bezeichnung;
1081 lars 65
    }
1088 lars 66
    \View::share( "web_rechte", $GLOBALS["web_rechte"] );
1110 lars 67
    if ( isset( $_SESSION["admin"]["uid"] ) )
1106 lars 68
    {
1110 lars 69
        $uId = $_SESSION["admin"]["uid"];
1108 lars 70
        $admin = $_SESSION["admin"]["user"]->admin;
71
        $user_rechte = $GLOBALS["web_rechte"];
72
        if ( !$admin )
73
        {
1197 lars 74
            $user_rechte = UserProperty::with( [
75
                "property",
76
                "tool",
77
                "module"
78
            ] )->where( "backend_user_id", "=", $uId )->get();
1108 lars 79
        }
1109 lars 80
        \View::share( "user_rechte", $user_rechte );
1106 lars 81
    }
1071 lars 82
 
1197 lars 83
    Route::get( '/login', [
84
        BackendController::class,
85
        'create'
86
    ] )->name( 'login' );
87
    Route::post( '/login', [
88
        BackendController::class,
89
        'store'
90
    ] );
1146 lars 91
    Route::middleware( 'auth:admin' )->group( function ()
964 lars 92
    {
1197 lars 93
        Route::get( '/logout', [
94
            BackendController::class,
95
            'destroy'
96
        ] )->name( 'logout' );
1117 lars 97
        Route::prefix( "/toolbox" )->group( function ()
98
        {
1197 lars 99
            Route::get( "/", [
100
                ToolboxController::class,
101
                "create"
102
            ] );
103
            Route::get( "/changeShopVersion", [
104
                ToolboxController::class,
105
                "changeShopVersion"
106
            ] );
1234 lars 107
            Route::get( "/updateShopVersion", [
1226 lars 108
                ToolboxController::class,
109
                "updateShopVersion"
110
            ] );
1227 lars 111
            Route::get( "/readSVNLog", [
112
                ToolboxController::class,
113
                "readSVNLog"
114
            ] );
1117 lars 115
        } );
1384 lars 116
        Route::resource( 'actions', ActionController::class );
1522 lars 117
        Route::get( "/actions/{id}/getMedia", [ ActionMediumController::class, "liste" ] );
1384 lars 118
        Route::resource( 'backend_users', BackendUserController::class );
119
        Route::resource( 'orders', OrderController::class );
1143 lars 120
        Route::view( "/", "admin/index" );
1405 lars 121
    } );