| 9 |
lars |
1 |
<?php
|
|
|
2 |
setlocale( LC_TIME, 'de_DE.UTF-8' );
|
|
|
3 |
|
|
|
4 |
if ( php_sapi_name() == "cli" )
|
|
|
5 |
{
|
|
|
6 |
return false;
|
|
|
7 |
}
|
|
|
8 |
|
|
|
9 |
$w = new Web();
|
|
|
10 |
$GLOBALS["web"] = $w->where( "domain", "=", env( 'shop' ) )->first();
|
|
|
11 |
if ( php_sapi_name() != "cli" )
|
|
|
12 |
{
|
|
|
13 |
if ( !file_exists( $_SERVER["DOCUMENT_ROOT"] . "/public/styles/" . $GLOBALS["web"]["domain"] . "_styles.css" ) )
|
|
|
14 |
{
|
|
|
15 |
require_once "styles.php";
|
|
|
16 |
}
|
|
|
17 |
}
|
|
|
18 |
\View::share( "webs", $GLOBALS["web"] );
|
|
|
19 |
$c_bestellarten = array();
|
|
|
20 |
$c_shops = array();
|
|
|
21 |
$d_shops = array();
|
|
|
22 |
$ba = OrderType::get();
|
|
|
23 |
foreach ( $ba as $ba_id => $bestellart )
|
|
|
24 |
{
|
|
|
25 |
$c_bestellarten[$bestellart->id] = $bestellart->name;
|
|
|
26 |
}
|
|
|
27 |
$shops = Shop::get();
|
|
|
28 |
View::share( "shops", $shops );
|
|
|
29 |
foreach ( $shops as $s_id => $shop )
|
|
|
30 |
{
|
|
|
31 |
$c_shops[$shop->id] = $shop->name;
|
|
|
32 |
$d_shops[$shop->id] = $shop;
|
|
|
33 |
}
|
|
|
34 |
\View::share( "c_bestellarten", $c_bestellarten );
|
|
|
35 |
\View::share( "c_shops", $c_shops );
|
|
|
36 |
\View::share( "d_shops", $d_shops );
|
|
|
37 |
$_SESSION["loadingGif"] = "/images/navigation/loading.gif";
|
|
|
38 |
if ( file_exists( $_SERVER["DOCUMENT_ROOT"] . "/images/webelemente/loading.gif" ) )
|
|
|
39 |
{
|
|
|
40 |
$_SESSION["loadingGif"] = "/images/webelemente/loading.gif";
|
|
|
41 |
}
|
|
|
42 |
$webRechte = WebProperty::with( [
|
|
|
43 |
"property",
|
|
|
44 |
"property.tool",
|
|
|
45 |
"property.tool.module"
|
|
|
46 |
] )->where( "web_id", "=", $GLOBALS["web"]->ID )->get();
|
|
|
47 |
$navi = Module::with( 'tool' )->orderBy( 'modules.rang' )->get();
|
|
|
48 |
\View::share( "navi", $navi );
|
|
|
49 |
foreach ( $webRechte as $web_recht )
|
|
|
50 |
{
|
|
|
51 |
$property = $web_recht->property;
|
|
|
52 |
$tool = $property->tool;
|
|
|
53 |
$module = $tool->module;
|
|
|
54 |
$GLOBALS["web_rechte"][$module->interner_name][$tool->button_name][$property->interner_name] = $web_recht->Bezeichnung;
|
|
|
55 |
}
|
|
|
56 |
\View::share( "web_rechte", $GLOBALS["web_rechte"] );
|
|
|
57 |
if ( isset( $_SESSION["admin"]["uid"] ) )
|
|
|
58 |
{
|
|
|
59 |
$uId = $_SESSION["admin"]["uid"];
|
|
|
60 |
$admin = $_SESSION["admin"]["user"]->admin;
|
|
|
61 |
$GLOBALS["user_rechte"] = $GLOBALS["web_rechte"];
|
|
|
62 |
if ( !$admin )
|
|
|
63 |
{
|
|
|
64 |
$GLOBALS["user_rechte"] = UserProperty::with( [
|
|
|
65 |
"property",
|
|
|
66 |
"tool",
|
|
|
67 |
"module"
|
|
|
68 |
] )->where( "backend_user_id", "=", $uId )->get();
|
|
|
69 |
}
|
|
|
70 |
\View::share( "user_rechte", $GLOBALS["user_rechte"] );
|
|
|
71 |
}
|