Subversion-Projekte lars-tiefland.php_share

Revision

Blame | Letzte Änderung | Log anzeigen | RSS feed

<?
        /*
                +---------------------------------------------------------------+
                | PARAMETER:                                                    |
                +-------+--------------------------------------------+----------+
                | Name  | Werte / Auswirkungen                       | Benötigt |
                +-------+--------------------------------------------+----------+
                | conf  | Name der Conf-Datei im Verzeichnis conf    |    JA    |
                +-------+--------------------------------------------+----------+
                | demo  | true:                                      |   NEIN   |
                |       | 1. Die Datei wird ohne Informationsheader  |          |
                |       |    ausgeben.                               |          |
                |       | 2. Die Ausgebe der Daten erfolgt in einem  |          |
                |       |    lesbaren Format. $trenner und $query    |          |
                |       |    entfallen.                              |          |
                +-------+--------------------------------------------+----------+
                | limit | Zahl 0..x                                  |   NEIN   |
                |       | Der Abfragequery wird auf $limit begrenzt. |          |
                +-------+--------------------------------------------+----------+
                | info  | true                                       |   NEIN   |
                |       | liefert den kompletten Datensatz anstelle  |          |
                |       | der Auswahl.                               |          |
                +-------+--------------------------------------------+----------+
        */

        if (!$_GET['conf']) { die("No conf? Go and get one!");}

        /* INI-Datei parsen */
        $_SESSION[INI]=parse_ini_file("../mediaran.de.ini.php",true);
        $_SESSION[INI][systemPath] = "../".$_SESSION[INI][systemPath];

        /* Basisroutine einbinden */
        include_once("../includes/listFiles.php");

        /* Systemroutinen einbinden */
        foreach(listFiles($_SESSION[INI][systemPath],"php") as $file)
        {
                include_once($file);
        }

        /* conf laden */
        include ("conf/".$_GET['conf']);

        /* Beginn der Ausgabe */
        
        if ($_GET['demo'] == "true") {} else 
        {
                header('Content-Type: text/x-csv'); 
                header('Content-Disposition: attachment; filename="'.$filename.'"');
                header('Expires: 0');
        }
        
        echo $prefix."\n";

        // Abfrage limitieren um beim Entwickel Zeit zu sparen
        if ($_GET['limit']) {$limit = "limit ".$_GET['limit'];}
        
        foreach(getPreisagenturItems($PreisagenturID, $limit) as $artikel)
        {
                $artikel[beschreibung]=preg_replace("/[;\r\n]/", "", $artikel[beschreibung]);
                $artikel['itemLink'] = $artikel['itemLink']."?from=".$from;
                
                $buffer = array();

                if ($_GET['info'] == 'true')
                {
                        $buffer = $artikel;
                }
                else
                {
                        foreach($content as $c)
                        {
                                list($col, $required) = $c;
                                
                                // Inhalt ist vorhanden oder muss ausgewertet werden ?
                                if (in_array ($col, array_keys($artikel)))
                                        { $col = addslashes($artikel[$col]); }
                                else
                                        { $col = eval($col); }

                                // Inhalt mit required vergleichen
                                /*
                                        required
                                                true    : Wert muss vorhanden sein
                                                false   : Wert muss nicht vorhanden sein
                                                string  : Ausdruck muss string ergeben
                                */
                                if (is_bool($required))
                                {
                                        if (($required == true) && (!$col)) { continue 2; }
                                }
                                else
                                {
                                        if (!eval($required)) { continue 2; }
                                }
                                        
                                $buffer[] = $quote.$col.$quote;
                        } // foreach
                } // elseif
                
                if ($_GET['demo'] == "true") {
                        pre($buffer); }
                        else {
                        echo implode($trenner, $buffer)."\n";
                }
        }
        
        echo $suffix."\n";
?>