Subversion-Projekte lars-tiefland.laravel_shop

Revision

Revision 175 | Revision 177 | Zur aktuellen Revision | Ganze Datei anzeigen | Leerzeichen ignorieren | Details | Blame | Letzte Änderung | Log anzeigen | RSS feed

Revision 175 Revision 176
Zeile 11... Zeile 11...
11
| routes are loaded by the RouteServiceProvider within a group which
11
| routes are loaded by the RouteServiceProvider within a group which
12
| contains the "web" middleware group. Now create something great!
12
| contains the "web" middleware group. Now create something great!
13
|
13
|
14
 */
14
 */
Zeile 15... Zeile 15...
15
 
15
 
-
 
16
function getConfig()
-
 
17
{
-
 
18
	define('__SITE__', env('site'));
-
 
19
	define('__SHOP__', env('shop'));
-
 
20
        define( "__CFG_PATH__", "/etc/shop_configs/" . __SITE__ . "/" . __SHOP__ );
-
 
21
 
-
 
22
        $cfg_file = __CFG_PATH__ . "/config.de.xml";
-
 
23
        if ( !file_exists( $cfg_file ) )
-
 
24
        {
-
 
25
            trigger_error( "Konnte keine Konfigurationsdatei für das Shopsystem " . __SITE__ . " -> " . __SHOP__ . " finden (" . ( $cfg_file ) . ")!", E_USER_ERROR );
-
 
26
        }
-
 
27
        $xml = simplexml_load_file( $cfg_file, "SimpleXMLElement", LIBXML_NOCDATA );
-
 
28
        $ini = json_decode( json_encode( $xml ), true );
-
 
29
        foreach ( $ini as $key => $wert )
-
 
30
        {
-
 
31
            if ( $wert == array() )
-
 
32
            {
-
 
33
                $ini[ $key ] = "";
-
 
34
            }
-
 
35
            elseif ( is_array( $wert ) )
-
 
36
            {
-
 
37
                foreach ( $wert as $key2 => $wert2 )
-
 
38
                {
-
 
39
                    if ( $wert2 == array() )
-
 
40
                    {
-
 
41
                        $ini[ $key ][ $key2 ] = "";
-
 
42
                    }
-
 
43
                }
-
 
44
            }
Zeile -... Zeile 45...
-
 
45
        }
-
 
46
 
-
 
47
        $v_file = __CFG_PATH__ . "/versand.xml";
-
 
48
        if ( file_exists( $v_file ) )
-
 
49
        {
-
 
50
            $xml = simplexml_load_file( $v_file, "SimpleXMLElement", LIBXML_NOCDATA );
-
 
51
            $ini["shipping"] = json_decode( json_encode( $xml ), true );
-
 
52
            foreach ( $ini["shipping"] as $key => $wert )
-
 
53
            {
-
 
54
                if ( $wert == array() )
-
 
55
                {
-
 
56
                    $ini["shipping"][ $key ] = "";
-
 
57
                }
-
 
58
                elseif ( is_array( $wert ) )
-
 
59
                {
-
 
60
                    foreach ( $wert as $key2 => $wert2 )
-
 
61
                    {
-
 
62
                        if ( $wert2 == array() )
-
 
63
                        {
-
 
64
                            $ini["shipping"][ $key ][ $key2 ] = "";
-
 
65
                        }
-
 
66
                    }
-
 
67
                }
-
 
68
            }
-
 
69
        }
-
 
70
        return $ini;
-
 
71
}
16
session_start();
72
session_start();
17
 
73
$GLOBALS["INI"] = getConfig();
18
$GLOBALS["menu"] = \App\Models\Directory::where("directory_id", -1)->get();
74
$nav = new \App\Models\Directory();
19
$GLOBALS["ini"] = array("infoline" => "02365 / 2000 800");
75
$GLOBALS["menu"] = $nav->nav_menu();
20
/* Mobile Weiche */
76
/* Mobile Weiche */
Zeile 21... Zeile 77...
21
if (isset($_SERVER["HTTP_USER_AGENT"])) {
77
if (isset($_SERVER["HTTP_USER_AGENT"])) {
Zeile 36... Zeile 92...
36
    }
92
    }
37
}
93
}
38
Route::get("/directory/{id}", function ($id) {
94
Route::get("/directory/{id}", function ($id) {
39
    $dirs = \App\Models\Directory::where("directory_id", $id)->get();
95
    $dirs = \App\Models\Directory::where("directory_id", $id)->get();
40
    $items = \App\Models\Item::where("directory_id", $id)->join('prices', 'items.id', '=', 'prices.item_id')->get();
96
    $items = \App\Models\Item::where("directory_id", $id)->join('prices', 'items.id', '=', 'prices.item_id')->get();
41
    return view('subdir', ["subdir" => array("items" => $items, "subdirs" => $dirs), "menu" => $GLOBALS["menu"], "ini" => $GLOBALS["ini"]]);
97
    return view('subdir', ["subdir" => array("items" => $items, "subdirs" => $dirs), "menu" => $GLOBALS["menu"], "ini" => $GLOBALS["INI"]]);
42
});
98
});
43
Route::get("{id}.html", function ($id) {
99
Route::get("{id}.html", function ($id) {
44
    global $menu, $ini;
100
    global $menu, $ini;
45
    $item = \App\Models\Item::find($id);
101
    $item = \App\Models\Item::find($id);
46
    return view('item', ["item" => $item, "menu" => $GLOBALS["menu"], "ini" => $GLOBALS["ini"]]);
102
    return view('item', ["item" => $item, "menu" => $GLOBALS["menu"], "ini" => $GLOBALS["INI"]]);
47
});
103
});
48
Route::get('/', function () {
104
Route::get('/', function () {
49
    global $menu;
105
    global $menu;
50
    $aktion = \App\Models\Action::all();
106
    $aktion = \App\Models\Action::all();
51
    return view('startpage', ["aktion" => $aktion, "menu" => $GLOBALS["menu"], "ini" => $GLOBALS["iini"]]);
107
    return view('startpage', ["aktion" => $aktion, "menu" => $GLOBALS["menu"], "ini" => $GLOBALS["INI"]]);
52
});
108
});