Subversion-Projekte lars-tiefland.laravel_shop

Revision

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