| 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 |
| test | true | NEIN |
|
|
|
25 |
| | kein logging in der Datenbank | |
|
|
|
26 |
+-------+--------------------------------------------+----------+
|
|
|
27 |
*/
|
|
|
28 |
|
|
|
29 |
if (!$_GET['conf']) { die("No conf? Go and get one!");}
|
|
|
30 |
|
|
|
31 |
/* INI-Datei parsen */
|
|
|
32 |
$_SESSION[INI]=parse_ini_file("../mediaran.de.ini.php",true);
|
|
|
33 |
$_SESSION[INI][systemPath] = "../".$_SESSION[INI][systemPath];
|
|
|
34 |
|
|
|
35 |
/* Basisroutine einbinden */
|
|
|
36 |
include_once("../includes/listFiles.php");
|
|
|
37 |
|
|
|
38 |
/* Systemroutinen einbinden */
|
|
|
39 |
foreach(listFiles($_SESSION[INI][systemPath],"php") as $file)
|
|
|
40 |
{
|
|
|
41 |
include_once($file);
|
|
|
42 |
}
|
|
|
43 |
|
|
|
44 |
/* conf laden */
|
|
|
45 |
include ("conf/".$_GET['conf']);
|
|
|
46 |
|
|
|
47 |
/* Beginn der Ausgabe */
|
|
|
48 |
|
|
|
49 |
if ($_GET['demo'] == "true") {} else
|
|
|
50 |
{
|
|
|
51 |
header('Content-Type: text/x-csv');
|
|
|
52 |
header('Content-Disposition: attachment; filename='.$filename);
|
|
|
53 |
header('Expires: 0');
|
|
|
54 |
}
|
|
|
55 |
|
|
|
56 |
if ($prefix != "")
|
|
|
57 |
{
|
|
|
58 |
echo $prefix."\n";
|
|
|
59 |
}
|
|
|
60 |
|
|
|
61 |
// Abfrage limitieren um beim Entwickel Zeit zu sparen
|
|
|
62 |
if ($_GET['limit']) {$limit = "limit ".$_GET['limit'];}
|
|
|
63 |
|
|
|
64 |
$datensaetze = 0;
|
|
|
65 |
$result=getPreisagenturItemsResource($PreisagenturID, $limit);
|
|
|
66 |
while($artikel=mysql_fetch_assoc($result))
|
|
|
67 |
{
|
|
|
68 |
$artikel["path"] = getPath($artikel[Father]);
|
|
|
69 |
if ($artikel["path"] != array())
|
|
|
70 |
{
|
|
|
71 |
$datensaetze++;
|
|
|
72 |
|
|
|
73 |
$artikel = itemKorrektur($artikel);
|
|
|
74 |
$artikel[beschreibung]=preg_replace("/[;\r\n]/", "", strip_tags($artikel[beschreibung]));
|
|
|
75 |
$artikel['itemLink'] = $artikel['itemLink']."&from=".$from;
|
|
|
76 |
|
|
|
77 |
if (empty($artikel["versandItem"]))
|
|
|
78 |
{
|
|
|
79 |
$artikel["versandItem"] = getVersandItem($artikel['gewicht'], $artikel['preis']);
|
|
|
80 |
}
|
|
|
81 |
|
|
|
82 |
$buffer = array();
|
|
|
83 |
|
|
|
84 |
if ($_GET['info'] == 'true')
|
|
|
85 |
{
|
|
|
86 |
$buffer = $artikel;
|
|
|
87 |
}
|
|
|
88 |
else
|
|
|
89 |
{
|
|
|
90 |
foreach($content as $c)
|
|
|
91 |
{
|
|
|
92 |
list($col, $required) = $c;
|
|
|
93 |
|
|
|
94 |
// Inhalt ist vorhanden oder muss ausgewertet werden ?
|
|
|
95 |
if (in_array ($col, array_keys($artikel)))
|
|
|
96 |
{ $col = addslashes($artikel[$col]); }
|
|
|
97 |
else
|
|
|
98 |
{ $col = eval($col); }
|
|
|
99 |
|
|
|
100 |
// Inhalt mit required vergleichen
|
|
|
101 |
/*
|
|
|
102 |
required
|
|
|
103 |
true : Wert muss vorhanden sein
|
|
|
104 |
false : Wert muss nicht vorhanden sein
|
|
|
105 |
string : Ausdruck muss string ergeben
|
|
|
106 |
*/
|
|
|
107 |
|
|
|
108 |
if (is_bool($required))
|
|
|
109 |
{
|
|
|
110 |
if (($required == true) && (!$col)) { continue 2; }
|
|
|
111 |
}
|
|
|
112 |
else
|
|
|
113 |
{
|
|
|
114 |
if (!eval($required)) { continue 2; }
|
|
|
115 |
}
|
|
|
116 |
|
|
|
117 |
$buffer[] = $quote.$col.$quote;
|
|
|
118 |
} // foreach
|
|
|
119 |
} // elseif
|
|
|
120 |
|
|
|
121 |
|
|
|
122 |
if ($_GET['demo'] == "true") {
|
|
|
123 |
pre($buffer); }
|
|
|
124 |
else {
|
|
|
125 |
echo implode($trenner, $buffer)."\n";
|
|
|
126 |
}
|
|
|
127 |
}
|
|
|
128 |
}
|
|
|
129 |
|
|
|
130 |
if ($suffix != "")
|
|
|
131 |
{
|
|
|
132 |
echo $suffix."\n";
|
|
|
133 |
}
|
|
|
134 |
|
|
|
135 |
/* Daten des Abrufs in die Datenbank schreiben */
|
|
|
136 |
// Aufruf der Datei protokollieren - NW 24.10.2004
|
|
|
137 |
if (!$_GET[test])
|
|
|
138 |
{ //nicht ausführen wenn der Parameter test übergeben wird!
|
|
|
139 |
$query_log="
|
|
|
140 |
update
|
|
|
141 |
Preisagentur
|
|
|
142 |
set
|
|
|
143 |
datensaetze = $datensaetze,
|
|
|
144 |
letzter_Abruf_am = NOW(),
|
|
|
145 |
letzter_Abruf_von = '".$_SERVER["REMOTE_ADDR"]."'
|
|
|
146 |
where
|
|
|
147 |
ID = $PreisagenturID
|
|
|
148 |
";
|
|
|
149 |
$result_log = mysql_query ($query_log) or
|
|
|
150 |
mail("niewerth@weban.de","Fehler in Preisagentur-CSV","Fehler in Preisagentur-CSV ".$_GET[conf]);
|
|
|
151 |
}
|
|
|
152 |
?>
|