Subversion-Projekte lars-tiefland.laravel_shop

Revision

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