Subversion-Projekte lars-tiefland.webanos.faltradxxs.de

Revision

Blame | Letzte Änderung | Log anzeigen | RSS feed

<?php
    setlocale( LC_TIME, 'de_DE.UTF-8' );

    if ( php_sapi_name() == "cli" )
    {
        return false;
    }

    $w = new Web();
    $GLOBALS["web"] = $w->where( "domain", "=", env( 'shop' ) )->first();
    if ( php_sapi_name() != "cli" )
    {
        if ( !file_exists( $_SERVER["DOCUMENT_ROOT"] . "/public/styles/" . $GLOBALS["web"]["domain"] . "_styles.css" ) )
        {
            require_once "styles.php";
        }
    }
    \View::share( "webs", $GLOBALS["web"] );
    $c_bestellarten = array();
    $c_shops = array();
    $d_shops = array();
    $ba = OrderType::get();
    foreach ( $ba as $ba_id => $bestellart )
    {
        $c_bestellarten[$bestellart->id] = $bestellart->name;
    }
    $shops = Shop::get();
    View::share( "shops", $shops );
    foreach ( $shops as $s_id => $shop )
    {
        $c_shops[$shop->id] = $shop->name;
        $d_shops[$shop->id] = $shop;
    }
    \View::share( "c_bestellarten", $c_bestellarten );
    \View::share( "c_shops", $c_shops );
    \View::share( "d_shops", $d_shops );
    $_SESSION["loadingGif"] = "/images/navigation/loading.gif";
    if ( file_exists( $_SERVER["DOCUMENT_ROOT"] . "/images/webelemente/loading.gif" ) )
    {
        $_SESSION["loadingGif"] = "/images/webelemente/loading.gif";
    }
    $webRechte = WebProperty::with( [
        "property",
        "property.tool",
        "property.tool.module"
    ] )->where( "web_id", "=", $GLOBALS["web"]->ID )->get();
    $navi = Module::with( 'tool' )->orderBy( 'modules.rang' )->get();
    \View::share( "navi", $navi );
    foreach ( $webRechte as $web_recht )
    {
        $property = $web_recht->property;
        $tool = $property->tool;
        $module = $tool->module;
        $GLOBALS["web_rechte"][$module->interner_name][$tool->button_name][$property->interner_name] = $web_recht->Bezeichnung;
    }
    \View::share( "web_rechte", $GLOBALS["web_rechte"] );
    if ( isset( $_SESSION["admin"]["uid"] ) )
    {
        $uId = $_SESSION["admin"]["uid"];
        $admin = $_SESSION["admin"]["user"]->admin;
        $GLOBALS["user_rechte"] = $GLOBALS["web_rechte"];
        if ( !$admin )
        {
            $GLOBALS["user_rechte"] = UserProperty::with( [
                "property",
                "tool",
                "module"
            ] )->where( "backend_user_id", "=", $uId )->get();
        }
        \View::share( "user_rechte", $GLOBALS["user_rechte"] );
    }