| 3 |
lars |
1 |
<?
|
|
|
2 |
/*
|
|
|
3 |
+---------------------------------------------------------------+
|
|
|
4 |
| PARAMETER: |
|
|
|
5 |
+-------+--------------------------------------------+----------+
|
|
|
6 |
| Name | Werte / Auswirkungen | Benötigt |
|
|
|
7 |
+-------+--------------------------------------------+----------+
|
|
|
8 |
| conf | Name der Conf-Datei im Verzeichnis conf | JA |
|
|
|
9 |
+-------+--------------------------------------------+----------+
|
|
|
10 |
| demo | true: | NEIN |
|
|
|
11 |
| | 1. Die Datei wird ohne Informationsheader | |
|
|
|
12 |
| | ausgeben. | |
|
|
|
13 |
| | 2. Die Ausgebe der Daten erfolgt in einem | |
|
|
|
14 |
| | lesbaren Format. $trenner und $query | |
|
|
|
15 |
| | entfallen. | |
|
|
|
16 |
+-------+--------------------------------------------+----------+
|
|
|
17 |
| limit | Zahl 0..x | NEIN |
|
|
|
18 |
| | Der Abfragequery wird auf $limit begrenzt. | |
|
|
|
19 |
+-------+--------------------------------------------+----------+
|
|
|
20 |
| info | true | NEIN |
|
|
|
21 |
| | liefert den kompletten Datensatz anstelle | |
|
|
|
22 |
| | der Auswahl. | |
|
|
|
23 |
+-------+--------------------------------------------+----------+
|
|
|
24 |
*/
|
|
|
25 |
|
|
|
26 |
if (!$_GET['conf']) { die("No conf? Go and get one!");}
|
|
|
27 |
|
|
|
28 |
/* INI-Datei parsen */
|
|
|
29 |
$_SESSION[INI]=parse_ini_file("../mediaran.de.ini.php",true);
|
|
|
30 |
$_SESSION[INI][systemPath] = "../".$_SESSION[INI][systemPath];
|
|
|
31 |
|
|
|
32 |
/* Basisroutine einbinden */
|
|
|
33 |
include_once("../includes/listFiles.php");
|
|
|
34 |
|
|
|
35 |
/* Systemroutinen einbinden */
|
|
|
36 |
foreach(listFiles($_SESSION[INI][systemPath],"php") as $file)
|
|
|
37 |
{
|
|
|
38 |
include_once($file);
|
|
|
39 |
}
|
|
|
40 |
|
|
|
41 |
/* conf laden */
|
|
|
42 |
include ("conf/".$_GET['conf']);
|
|
|
43 |
|
|
|
44 |
/* Beginn der Ausgabe */
|
|
|
45 |
|
|
|
46 |
if ($_GET['demo'] == "true") {} else
|
|
|
47 |
{
|
|
|
48 |
header('Content-Type: text/x-csv');
|
|
|
49 |
header('Content-Disposition: attachment; filename="'.$filename.'"');
|
|
|
50 |
header('Expires: 0');
|
|
|
51 |
}
|
|
|
52 |
|
|
|
53 |
echo $prefix."\n";
|
|
|
54 |
|
|
|
55 |
// Abfrage limitieren um beim Entwickel Zeit zu sparen
|
|
|
56 |
if ($_GET['limit']) {$limit = "limit ".$_GET['limit'];}
|
|
|
57 |
|
|
|
58 |
foreach(getPreisagenturItems($PreisagenturID, $limit) as $artikel)
|
|
|
59 |
{
|
|
|
60 |
$artikel[beschreibung]=preg_replace("/[;\r\n]/", "", $artikel[beschreibung]);
|
|
|
61 |
$artikel['itemLink'] = $artikel['itemLink']."?from=".$from;
|
|
|
62 |
|
|
|
63 |
$buffer = array();
|
|
|
64 |
|
|
|
65 |
if ($_GET['info'] == 'true')
|
|
|
66 |
{
|
|
|
67 |
$buffer = $artikel;
|
|
|
68 |
}
|
|
|
69 |
else
|
|
|
70 |
{
|
|
|
71 |
foreach($content as $c)
|
|
|
72 |
{
|
|
|
73 |
list($col, $required) = $c;
|
|
|
74 |
|
|
|
75 |
// Inhalt ist vorhanden oder muss ausgewertet werden ?
|
|
|
76 |
if (in_array ($col, array_keys($artikel)))
|
|
|
77 |
{ $col = addslashes($artikel[$col]); }
|
|
|
78 |
else
|
|
|
79 |
{ $col = eval($col); }
|
|
|
80 |
|
|
|
81 |
// Inhalt mit required vergleichen
|
|
|
82 |
/*
|
|
|
83 |
required
|
|
|
84 |
true : Wert muss vorhanden sein
|
|
|
85 |
false : Wert muss nicht vorhanden sein
|
|
|
86 |
string : Ausdruck muss string ergeben
|
|
|
87 |
*/
|
|
|
88 |
if (is_bool($required))
|
|
|
89 |
{
|
|
|
90 |
if (($required == true) && (!$col)) { continue 2; }
|
|
|
91 |
}
|
|
|
92 |
else
|
|
|
93 |
{
|
|
|
94 |
if (!eval($required)) { continue 2; }
|
|
|
95 |
}
|
|
|
96 |
|
|
|
97 |
$buffer[] = $quote.$col.$quote;
|
|
|
98 |
} // foreach
|
|
|
99 |
} // elseif
|
|
|
100 |
|
|
|
101 |
if ($_GET['demo'] == "true") {
|
|
|
102 |
pre($buffer); }
|
|
|
103 |
else {
|
|
|
104 |
echo implode($trenner, $buffer)."\n";
|
|
|
105 |
}
|
|
|
106 |
}
|
|
|
107 |
|
|
|
108 |
echo $suffix."\n";
|
|
|
109 |
?>
|