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