| 4 |
lars |
1 |
<?php
|
|
|
2 |
|
|
|
3 |
use App\Http\Controllers\ActionController;
|
|
|
4 |
use App\Http\Controllers\ActionMediumController;
|
|
|
5 |
use App\Http\Controllers\BackendController;
|
|
|
6 |
use App\Http\Controllers\BackendUserController;
|
|
|
7 |
use App\Http\Controllers\GoogleAuthenticatorController;
|
|
|
8 |
use App\Http\Controllers\MediumController;
|
|
|
9 |
use App\Http\Controllers\OrderController;
|
|
|
10 |
use App\Http\Controllers\ShippingController;
|
|
|
11 |
use App\Http\Controllers\ShippingGroupController;
|
|
|
12 |
use App\Http\Controllers\ToolboxController;
|
|
|
13 |
use App\Models\Module;
|
|
|
14 |
use App\Models\OrderType;
|
|
|
15 |
use App\Models\Shop;
|
|
|
16 |
use App\Models\UserProperty;
|
|
|
17 |
use App\Models\Web;
|
|
|
18 |
use App\Models\WebProperty;
|
|
|
19 |
use Illuminate\Support\Facades\Route;
|
|
|
20 |
|
|
|
21 |
session_start();
|
|
|
22 |
setlocale( LC_TIME, 'de_DE.UTF-8' );
|
|
|
23 |
|
|
|
24 |
if ( php_sapi_name() == "cli" )
|
|
|
25 |
{
|
|
|
26 |
return false;
|
|
|
27 |
}
|
|
|
28 |
|
|
|
29 |
$w = new Web();
|
|
|
30 |
$GLOBALS["web"] = $w->where( "domain", "=", env( 'shop' ) )->first();
|
|
|
31 |
if ( php_sapi_name() != "cli" )
|
|
|
32 |
{
|
|
|
33 |
if ( !file_exists( $_SERVER["DOCUMENT_ROOT"] . "/public/styles/" . $GLOBALS["web"]["domain"] . "_styles.css" ) )
|
|
|
34 |
{
|
|
|
35 |
require_once "styles.php";
|
|
|
36 |
}
|
|
|
37 |
}
|
|
|
38 |
\View::share( "webs", $GLOBALS["web"] );
|
|
|
39 |
$c_bestellarten = array();
|
|
|
40 |
$c_shops = array();
|
|
|
41 |
$d_shops = array();
|
|
|
42 |
$ba = OrderType::get();
|
|
|
43 |
foreach ( $ba as $ba_id => $bestellart )
|
|
|
44 |
{
|
|
|
45 |
$c_bestellarten[$bestellart->id] = $bestellart->name;
|
|
|
46 |
}
|
|
|
47 |
$shops = Shop::get();
|
|
|
48 |
View::share( "shops", $shops );
|
|
|
49 |
foreach ( $shops as $s_id => $shop )
|
|
|
50 |
{
|
|
|
51 |
$c_shops[$shop->id] = $shop->name;
|
|
|
52 |
$d_shops[$shop->id] = $shop;
|
|
|
53 |
}
|
|
|
54 |
\View::share( "c_bestellarten", $c_bestellarten );
|
|
|
55 |
\View::share( "c_shops", $c_shops );
|
|
|
56 |
\View::share( "d_shops", $d_shops );
|
|
|
57 |
$_SESSION["loadingGif"] = "/images/navigation/loading.gif";
|
|
|
58 |
if ( file_exists( $_SERVER["DOCUMENT_ROOT"] . "/images/webelemente/loading.gif" ) )
|
|
|
59 |
{
|
|
|
60 |
$_SESSION["loadingGif"] = "/images/webelemente/loading.gif";
|
|
|
61 |
}
|
|
|
62 |
$webRechte = WebProperty::with( [
|
|
|
63 |
"property",
|
|
|
64 |
"property.tool",
|
|
|
65 |
"property.tool.module"
|
|
|
66 |
] )->where( "web_id", "=", $GLOBALS["web"]->ID )->get();
|
|
|
67 |
$navi = Module::with( 'tool' )->orderBy( 'modules.rang' )->get();
|
|
|
68 |
\View::share( "navi", $navi );
|
|
|
69 |
foreach ( $webRechte as $web_recht )
|
|
|
70 |
{
|
|
|
71 |
$property = $web_recht->property;
|
|
|
72 |
$tool = $property->tool;
|
|
|
73 |
$module = $tool->module;
|
|
|
74 |
$GLOBALS["web_rechte"][$module->interner_name][$tool->button_name][$property->interner_name] = $web_recht->Bezeichnung;
|
|
|
75 |
}
|
|
|
76 |
\View::share( "web_rechte", $GLOBALS["web_rechte"] );
|
|
|
77 |
if ( isset( $_SESSION["admin"]["uid"] ) )
|
|
|
78 |
{
|
|
|
79 |
$uId = $_SESSION["admin"]["uid"];
|
|
|
80 |
$admin = $_SESSION["admin"]["user"]->admin;
|
|
|
81 |
$GLOBALS["user_rechte"] = $GLOBALS["web_rechte"];
|
|
|
82 |
if ( !$admin )
|
|
|
83 |
{
|
|
|
84 |
$GLOBALS["user_rechte"] = UserProperty::with( [
|
|
|
85 |
"property",
|
|
|
86 |
"tool",
|
|
|
87 |
"module"
|
|
|
88 |
] )->where( "backend_user_id", "=", $uId )->get();
|
|
|
89 |
}
|
|
|
90 |
\View::share( "user_rechte", $GLOBALS["user_rechte"] );
|
|
|
91 |
}
|
|
|
92 |
|
|
|
93 |
Route::get( '/login', [
|
|
|
94 |
BackendController::class,
|
|
|
95 |
'create'
|
|
|
96 |
] )->name( 'login' );
|
|
|
97 |
Route::post( '/login', [
|
|
|
98 |
BackendController::class,
|
|
|
99 |
'store'
|
|
|
100 |
] );
|
|
|
101 |
Route::middleware( [
|
|
|
102 |
'auth',
|
|
|
103 |
//'2fa'
|
|
|
104 |
] )->group( function ()
|
|
|
105 |
{
|
|
|
106 |
Route::get( '/logout', [
|
|
|
107 |
BackendController::class,
|
|
|
108 |
'destroy'
|
|
|
109 |
] )->name( 'logout' );
|
|
|
110 |
Route::prefix( "/toolbox" )->group( function ()
|
|
|
111 |
{
|
|
|
112 |
Route::get( "/ga", [
|
|
|
113 |
GoogleAuthenticatorController::class,
|
|
|
114 |
"create"
|
|
|
115 |
] )->name( 'complete.registration' );
|
|
|
116 |
Route::post( "/ga", [
|
|
|
117 |
GoogleAuthenticatorController::class,
|
|
|
118 |
"store"
|
|
|
119 |
] )->name( '2fa' );
|
|
|
120 |
Route::delete( "/ga", [
|
|
|
121 |
GoogleAuthenticatorController::class,
|
|
|
122 |
"DESTROY"
|
|
|
123 |
] );
|
|
|
124 |
Route::get( "/", [
|
|
|
125 |
ToolboxController::class,
|
|
|
126 |
"create"
|
|
|
127 |
] );
|
|
|
128 |
Route::get( "/changeShopVersion", [
|
|
|
129 |
ToolboxController::class,
|
|
|
130 |
"changeShopVersion"
|
|
|
131 |
] );
|
|
|
132 |
Route::get( "/updateShopVersion", [
|
|
|
133 |
ToolboxController::class,
|
|
|
134 |
"updateShopVersion"
|
|
|
135 |
] );
|
|
|
136 |
Route::get( "/readSVNLog", [
|
|
|
137 |
ToolboxController::class,
|
|
|
138 |
"readSVNLog"
|
|
|
139 |
] );
|
|
|
140 |
} );
|
|
|
141 |
Route::resource( 'media', MediumController::class );
|
|
|
142 |
Route::prefix( "/Online-Shop" )->group( function ()
|
|
|
143 |
{
|
|
|
144 |
Route::resource( '/actions', ActionController::class );
|
|
|
145 |
Route::resource( "/shippings", ShippingController::class );
|
|
|
146 |
Route::resource( "/shippingGroups", ShippingGroupController::class );
|
|
|
147 |
} );
|
|
|
148 |
|
|
|
149 |
Route::resource( 'backend_users', BackendUserController::class );
|
|
|
150 |
Route::prefix( "/Warenwirtschaft" )->group( function ()
|
|
|
151 |
{
|
|
|
152 |
Route::resource( 'orders', OrderController::class );
|
|
|
153 |
} );
|
|
|
154 |
Route::prefix( "vportale" )->group( function ()
|
|
|
155 |
{
|
|
|
156 |
Route::resource( "salesPortals", \App\Http\Controllers\SalesPortalController::class );
|
|
|
157 |
} );
|
|
|
158 |
Route::get( "/actions/{id}/getMedia", [
|
|
|
159 |
ActionMediumController::class,
|
|
|
160 |
"liste"
|
|
|
161 |
] );
|
|
|
162 |
Route::view( "/", "index" );
|
|
|
163 |
} );
|