Subversion-Projekte lars-tiefland.laravel_shop

Revision

Revision 1699 | Revision 1702 | Zur aktuellen Revision | Details | Vergleich mit vorheriger | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
1657 lars 1
<?php
2
 
1699 lars 3
    function getConfig()
4
    {
1701 lars 5
        if ( !defined( "__SITE__" ) )
6
        {
7
            define( '__SITE__', env( 'site' ) );
8
        }
9
        if ( !defined( "__SHOP__" ) )
10
        {
11
            define( '__SHOP__', env( 'shop' ) );
12
        }
13
        if ( !defined( "__CFG_PATH__" ) )
14
        {
15
            define( "__CFG_PATH__", "/etc/shop_configs/" . __SITE__ . "/" . __SHOP__ );
16
        }
1699 lars 17
        $cfg_file = __CFG_PATH__ . "/config.de.xml";
18
        if ( !file_exists( $cfg_file ) )
1657 lars 19
        {
1699 lars 20
            trigger_error( "Konnte keine Konfigurationsdatei für das Shopsystem " . __SITE__ . " -> " . __SHOP__ . " finden (" . ( $cfg_file ) . ")!", E_USER_ERROR );
1657 lars 21
        }
1699 lars 22
        $xml = simplexml_load_file( $cfg_file, "SimpleXMLElement", LIBXML_NOCDATA );
23
        $ini = json_decode( json_encode( $xml ), true );
24
        foreach ( $ini as $key => $wert )
1657 lars 25
        {
1699 lars 26
            if ( $wert == array() )
1659 lars 27
            {
1699 lars 28
                $ini[$key] = "";
1659 lars 29
            }
1699 lars 30
            elseif ( is_array( $wert ) )
1659 lars 31
            {
1699 lars 32
                foreach ( $wert as $key2 => $wert2 )
33
                {
34
                    if ( $wert2 == array() )
35
                    {
36
                        $ini[$key][$key2] = "";
37
                    }
38
                }
1659 lars 39
            }
1657 lars 40
        }
1699 lars 41
 
42
        $v_file = __CFG_PATH__ . "/versand.xml";
43
        if ( file_exists( $v_file ) )
44
        {
45
            $xml = simplexml_load_file( $v_file, "SimpleXMLElement", LIBXML_NOCDATA );
46
            $ini["shipping"] = json_decode( json_encode( $xml ), true );
47
            foreach ( $ini["shipping"] as $key => $wert )
48
            {
49
                if ( $wert == array() )
50
                {
51
                    $ini["shipping"][$key] = "";
52
                }
53
                elseif ( is_array( $wert ) )
54
                {
55
                    foreach ( $wert as $key2 => $wert2 )
56
                    {
57
                        if ( $wert2 == array() )
58
                        {
59
                            $ini["shipping"][$key][$key2] = "";
60
                        }
61
                    }
62
                }
63
            }
64
        }
65
        return $ini;
1657 lars 66
    }