Subversion-Projekte lars-tiefland.laravel_shop

Revision

Revision 1703 | Revision 1705 | Zur aktuellen Revision | Details | Vergleich mit vorheriger | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
2 lars 1
<?php
2
 
730 lars 3
    use App\Http\Controllers\BasketController;
4
    use App\Http\Controllers\BuyController;
1692 lars 5
    use App\Http\Controllers\DirectoryController;
1669 lars 6
    use App\Http\Controllers\PriceAgencyController;
875 lars 7
    use App\Http\Controllers\ShippingController;
765 lars 8
    use App\Http\Controllers\UserController;
375 lars 9
    use Illuminate\Support\Facades\DB;
673 lars 10
    use Illuminate\Support\Facades\Schema;
333 lars 11
    use App\Models\Action;
12
    use App\Models\Item;
13
    use Illuminate\Support\Facades\Route;
2 lars 14
 
333 lars 15
    /*
16
    |--------------------------------------------------------------------------
17
    | Web Routes
18
    |--------------------------------------------------------------------------
19
    |
20
    | Here is where you can register web routes for your application. These
21
    | routes are loaded by the RouteServiceProvider within a group which
22
    | contains the "web" middleware group. Now create something great!
23
    |
24
     */
2 lars 25
 
848 lars 26
    $GLOBALS["INI"] = getConfig();
832 lars 27
 
624 lars 28
    if ( php_sapi_name() == "cli" )
582 lars 29
    {
30
        return;
31
    }
704 lars 32
    session_start();
697 lars 33
    if ( !isset( $_SESSION["SHOP"]["BASKET"] ) )
34
    {
730 lars 35
        $_SESSION["SHOP"]["BASKET"] = new BasketController();
697 lars 36
    }
355 lars 37
 
1586 lars 38
    if ( !isset( $_SESSION["navigation"]["position"] ) )
39
    {
40
        $_SESSION["navigation"]["position"] = null;
41
    }
1693 lars 42
    $nav = new DirectoryController();
848 lars 43
    $menu = $nav->nav_menu();
1582 lars 44
    $shopPosition = $nav->shopPosition();
368 lars 45
    $sc = parseCMSPage( $GLOBALS["INI"]["typo3"]["url"] . "/typo3/" );
852 lars 46
    $data = [
47
        "nav"               => $menu,
48
        "serviceCenterMenu" => $sc["menu"],
1582 lars 49
        "shopPosition"      => $shopPosition,
852 lars 50
        "langstrings"       => $GLOBALS["langstrings"],
51
        "ini"               => $GLOBALS["INI"],
52
    ];
53
    \View::share( $data );
848 lars 54
 
333 lars 55
    /* Mobile Weiche */
355 lars 56
    if ( isset( $_SERVER["HTTP_USER_AGENT"] ) )
333 lars 57
    {
375 lars 58
        if ( !isset( $_SESSION['isMobile'] ) || $_SESSION['isMobile'] === false || !isset( $GLOBALS['isMobile'] ) || $GLOBALS['isMobile'] === false )
333 lars 59
        {
88 lars 60
 
355 lars 61
            $_SESSION['isMobile'] = false;
62
            $GLOBALS['isMobile'] = false;
88 lars 63
 
853 lars 64
            $pattern = "/(alcatel|amoi|android|avantgo|blackberry|benq|cell|cricket|docomo|elaine|htc|iemobile|iphone|iPad|ipaq|ipod|j2me|java|midp|mini|mmp|mobi|motorola|nec-|nokia|palm|panasonic|philips|phone|playbook|sagem|sharp|sie-|silk|smartphone|sony|symbian|t-mobile|telus|up\.browser|up\.link|vodafone|wap|webos|wireless|xda|xoom|zte)/i";
65
            if ( preg_match( $pattern, $_SERVER["HTTP_USER_AGENT"] ) )
333 lars 66
            {
88 lars 67
 
355 lars 68
                $_SESSION['isMobile'] = true;
69
                $GLOBALS['isMobile'] = true;
333 lars 70
            }
71
 
88 lars 72
        }
73
    }
1674 lars 74
    Route::get( "/preisagentur/{filename}", [ PriceAgencyController::class, "download" ] );
405 lars 75
    Route::get( "/addItemToBasket", function ()
385 lars 76
    {
697 lars 77
        $_SESSION["SHOP"]["BASKET"]->addItem();
848 lars 78
        return view( 'header_wk' );
405 lars 79
    } );
745 lars 80
    Route::get( "/editItem/{id}/{menge}", function ()
81
    {
82
        $_SESSION["SHOP"]["BASKET"]->editItem();
765 lars 83
        return redirect( "/basket.html" );
745 lars 84
    } )->where( [ "id" => "[0-9a-f]{40}", "menge" => "[0-9]+" ] );
85
    Route::get( "/delItem/{id}", function ()
86
    {
87
        $_SESSION["SHOP"]["BASKET"]->delItem();
765 lars 88
        return redirect( "/basket.html" );
745 lars 89
    } )->where( "id", "[0-9a-f]{40}" );
766 lars 90
    Route::post( "/login", [ UserController::class, "login" ] );
809 lars 91
    Route::post( "/logout", [ UserController::class, "logout" ] );
814 lars 92
    Route::post( "/send_pw", [ UserController::class, "forgot_pw" ] );
1704 lars 93
    Route::get( "/favoriten", 'login_center' );
94
    Route::view( "/forgot_pw", 'login_center' );
95
    Route::view( "/login", 'login_center' );
96
    Route::view( "/register", 'login_center' );
890 lars 97
    Route::get( "/update_versand", [ ShippingController::class, "updateShipping" ] );
891 lars 98
    Route::get( "/checkLand.php", function ()
890 lars 99
    {
100
        $_SESSION['SHOP']["BASKET"]->getShippingCountries();
101
        $valid = 1;
893 lars 102
        if ( !in_array( $_GET["land"], array_keys( $_SESSION["SHOP"]["BASKET"]->shippingCountries ) ) )
890 lars 103
        {
104
            $valid = 0;
105
        }
899 lars 106
        echo $valid;
890 lars 107
        return $valid;
108
    } );
658 lars 109
    Route::get( '/setSessionVars', function ()
110
    {
111
        foreach ( $_GET as $key => $value )
112
        {
113
            if ( $value == "false" )
114
            {
115
                unset( $_SESSION[$key] );
116
            }
117
            else
118
            {
119
                $_SESSION[$key] = $value;
120
            }
121
        }
122
    } );
765 lars 123
    Route::post( "/setSessionVars", function ()
124
    {
762 lars 125
        foreach ( $_POST as $key => $value )
126
        {
127
            if ( $value == "false" )
128
            {
129
                unset( $_SESSION[$key] );
130
            }
131
            else
132
            {
133
                $_SESSION[$key] = $value;
134
            }
135
        }
765 lars 136
    } );
137
    Route::post( "/updateSession", function ()
756 lars 138
    {
139
    } );
355 lars 140
    Route::get( "/cms/{slug}", function ( $slug )
141
    {
359 lars 142
        $url = $GLOBALS["INI"]["typo3"]["url"] . "/typo3/" . $slug;
365 lars 143
        $arr = parseCMSPage( $url );
355 lars 144
        $content = $arr["content"];
361 lars 145
        return view( 'service_center_content', [
848 lars 146
            "serviceContent" => $content,
355 lars 147
        ] );
148
    } );
925 lars 149
    Route::get( "/bestellen_seite_{step}.html", function ( $step )
376 lars 150
    {
925 lars 151
        return view( 'buy_' . $step, [
924 lars 152
            "pagetype"      => "Bestellvorgang1",
848 lars 153
            "Laender"       => getRechnungsLaender(),
154
            "defaultLandID" => 47,
376 lars 155
        ] );
925 lars 156
    } )->where( 'step', '[1-4][ab]{0,1}' );
157
    Route::post( "/bestellen_seite_{step}.html", [ BuyController::class, 'step1' ] )->where( 'step', '[1-4][ab]{0,1}' );
1704 lars 158
    Route::view( "basket.html",'basket' );
1564 lars 159
    Route::get( "{item:slug}.html", function ( Item $item )
333 lars 160
    {
1564 lars 161
        return view( 'item', [
162
            "item" => $item,
163
        ] );
164
    } );
1692 lars 165
    Route::get( "/directory/{id}-{name}", [ DirectoryController::class, "index" ] )->whereNumber( 'id' );
333 lars 166
    Route::get( '/', function ()
167
    {
405 lars 168
        $date = date( "Y-m-d" );
169
        $aktion = Action::with( 'medium.medium' )->where( 'valid_from', '<=', $date )->where( 'valid_to', '>=', $date )->get();
333 lars 170
        return view( 'startpage', [
848 lars 171
            "pagetype" => "Startseite",
172
            "aktion"   => $aktion,
333 lars 173
        ] );
174
    } );