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