Subversion-Projekte lars-tiefland.laravel_shop

Revision

Revision 1659 | Revision 1701 | Zur aktuellen Revision | Ganze Datei anzeigen | Leerzeichen ignorieren | Details | Blame | Letzte Änderung | Log anzeigen | RSS feed

Revision 1659 Revision 1699
Zeile 1... Zeile 1...
1
<?php
1
<?php
Zeile 2... Zeile -...
2
 
-
 
3
    use App\Models\Directory;
-
 
4
    use Illuminate\Database\Eloquent\ModelNotFoundException;
2
 
5
    use Illuminate\Support\Collection;
-
 
6
 
-
 
7
    function getPath( $root, $return_locked_folders = false ): Collection
3
    function getConfig()
8
    {
4
    {
9
        $ini = $GLOBALS["INI"];
5
        define( '__SITE__', env( 'site' ) );
-
 
6
        define( '__SHOP__', env( 'shop' ) );
-
 
7
        define( "__CFG_PATH__", "/etc/shop_configs/" . __SITE__ . "/" . __SHOP__ );
-
 
8
 
10
        $treeRoot = -1;
9
        $cfg_file = __CFG_PATH__ . "/config.de.xml";
11
        if ( $ini["treeRoot"] )
10
        if ( !file_exists( $cfg_file ) )
12
        {
11
        {
13
            $treeRoot = $ini["treeRoot"];
12
            trigger_error( "Konnte keine Konfigurationsdatei für das Shopsystem " . __SITE__ . " -> " . __SHOP__ . " finden (" . ( $cfg_file ) . ")!", E_USER_ERROR );
14
        }
-
 
15
 
13
        }
16
        $path = collect();
14
        $xml = simplexml_load_file( $cfg_file, "SimpleXMLElement", LIBXML_NOCDATA );
17
        $father = $root;
15
        $ini = json_decode( json_encode( $xml ), true );
18
        while ( $father != $treeRoot && !is_null( $father ) )
16
        foreach ( $ini as $key => $wert )
19
        {
17
        {
20
            try
18
            if ( $wert == array() )
21
            {
19
            {
22
                $row = Directory::where( "id", $father )->whereIn( "status", [ 0, 2 ] )->firstOrFail();
20
                $ini[$key] = "";
23
            }
21
            }
24
            catch ( ModelNotFoundException)
22
            elseif ( is_array( $wert ) )
-
 
23
            {
-
 
24
                foreach ( $wert as $key2 => $wert2 )
-
 
25
                {
25
            {
26
                    if ( $wert2 == array() )
-
 
27
                    {
-
 
28
                        $ini[$key][$key2] = "";
-
 
29
                    }
26
                return $path;
30
                }
27
            }
-
 
28
            $father = $row->directory_id;
-
 
29
            $path[] = $row;
31
            }
30
        }
-
 
31
        return $path;
-
 
Zeile -... Zeile 32...
-
 
32
        }
-
 
33
 
-
 
34
        $v_file = __CFG_PATH__ . "/versand.xml";
-
 
35
        if ( file_exists( $v_file ) )
-
 
36
        {
-
 
37
            $xml = simplexml_load_file( $v_file, "SimpleXMLElement", LIBXML_NOCDATA );
-
 
38
            $ini["shipping"] = json_decode( json_encode( $xml ), true );
-
 
39
            foreach ( $ini["shipping"] as $key => $wert )
-
 
40
            {
-
 
41
                if ( $wert == array() )
-
 
42
                {
-
 
43
                    $ini["shipping"][$key] = "";
-
 
44
                }
-
 
45
                elseif ( is_array( $wert ) )
-
 
46
                {
-
 
47
                    foreach ( $wert as $key2 => $wert2 )
-
 
48
                    {
-
 
49
                        if ( $wert2 == array() )
-
 
50
                        {
-
 
51
                            $ini["shipping"][$key][$key2] = "";
-
 
52
                        }
-
 
53
                    }
-
 
54
                }
-
 
55
            }
-
 
56
        }