| 3 |
lars |
1 |
<?
|
|
|
2 |
// forget about any script timeouts
|
|
|
3 |
set_time_limit(0);
|
|
|
4 |
|
|
|
5 |
include("/web/apache/mediaran.de/preisagent/transfer/connect.php");
|
|
|
6 |
include("/web/apache/mediaran.de/preisagent/transfer/avt-24/core_data.php");
|
|
|
7 |
|
|
|
8 |
/* ############################################################################################### */
|
|
|
9 |
/* ## SETTINGS ## */
|
|
|
10 |
/* ############################################################################################### */
|
|
|
11 |
|
|
|
12 |
// Benachrichten bei Fehler:
|
|
|
13 |
$SETTINGS["ERROR_MSG_TO"] = "willmann@weban.de";
|
|
|
14 |
|
|
|
15 |
// FTP SERVER LOGIN DATEN
|
|
|
16 |
$SETTINGS["FTP_SERVER"] = array
|
|
|
17 |
(
|
|
|
18 |
"SERVER" => "s102378343.einsundeinsshop.de",
|
|
|
19 |
"USER" => "u35337859",
|
|
|
20 |
"PASSWORD" => "JAzGqqB2"
|
|
|
21 |
);
|
|
|
22 |
|
|
|
23 |
|
|
|
24 |
/* ############################################################################################### */
|
|
|
25 |
/* ## core-Funktionen ## */
|
|
|
26 |
/* ############################################################################################### */
|
|
|
27 |
|
|
|
28 |
function get_clear_path($heritage)
|
|
|
29 |
{
|
|
|
30 |
array_shift($heritage);
|
|
|
31 |
return $heritage;
|
|
|
32 |
}
|
|
|
33 |
|
|
|
34 |
function ausgabe($subdir,$heritage)
|
|
|
35 |
{
|
|
|
36 |
global $output;
|
|
|
37 |
|
|
|
38 |
$artikel=array_pop($subdir);
|
|
|
39 |
$subdirs=array_pop($subdir);
|
|
|
40 |
|
|
|
41 |
$heritage[]=$subdir[Name];
|
|
|
42 |
|
|
|
43 |
foreach($artikel as $current_row)
|
|
|
44 |
{
|
|
|
45 |
$current_row[category]=implode("|",get_clear_path($heritage));
|
|
|
46 |
$output[]=$current_row;
|
|
|
47 |
}
|
|
|
48 |
|
|
|
49 |
foreach($subdirs as $current_subdir)
|
|
|
50 |
{
|
|
|
51 |
ausgabe($current_subdir,$heritage);
|
|
|
52 |
}
|
|
|
53 |
}
|
|
|
54 |
|
|
|
55 |
$output=array();
|
|
|
56 |
ausgabe(core_data(),array());
|
|
|
57 |
// $output ist jetzt gefüllt
|
|
|
58 |
|
|
|
59 |
function localSize($file)
|
|
|
60 |
{
|
|
|
61 |
if (file_exists($file)) { return filesize($file); } else { return -1; }
|
|
|
62 |
}
|
|
|
63 |
|
|
|
64 |
/* ############################################################################################### */
|
|
|
65 |
/* ## MAIN ## */
|
|
|
66 |
/* ############################################################################################### */
|
|
|
67 |
|
|
|
68 |
// FTP VERBINDUNG AUFBAUEN (Passiv)
|
|
|
69 |
$conn_id = ftp_connect($SETTINGS["FTP_SERVER"]["SERVER"]);
|
|
|
70 |
$login_result = ftp_login
|
|
|
71 |
(
|
|
|
72 |
$conn_id,
|
|
|
73 |
$SETTINGS["FTP_SERVER"]["USER"],
|
|
|
74 |
$SETTINGS["FTP_SERVER"]["PASSWORD"]
|
|
|
75 |
);
|
|
|
76 |
ftp_pasv($conn_id,TRUE);
|
|
|
77 |
|
|
|
78 |
if ((!$conn_id) || (!$login_result))
|
|
|
79 |
{
|
|
|
80 |
mail
|
|
|
81 |
(
|
|
|
82 |
$SETTINGS["ERROR_MSG_TO"],
|
|
|
83 |
"Mediaran Bilderabgleich: Ftp-Verbindung konnte nicht hergestellt werden!",
|
|
|
84 |
$SETTINGS["FTP_SERVER"]["SERVER"]."\n".
|
|
|
85 |
$SETTINGS["FTP_SERVER"]["USER"]."\n".
|
|
|
86 |
$SETTINGS["FTP_SERVER"]["PASSWORD"]
|
|
|
87 |
);
|
|
|
88 |
die;
|
|
|
89 |
}
|
|
|
90 |
|
|
|
91 |
$error_log=array();
|
|
|
92 |
$success_log=array();
|
|
|
93 |
|
|
|
94 |
foreach ($output as $artikel)
|
|
|
95 |
{
|
|
|
96 |
if ($artikel[bild])
|
|
|
97 |
{
|
|
|
98 |
$fname=substr(strrchr($artikel[bild],"/"), 1);
|
|
|
99 |
$path="/web/apache/mediaran.de/images/Bild_5/kl/";
|
|
|
100 |
|
|
|
101 |
echo
|
|
|
102 |
md5_file($path.$fname).
|
|
|
103 |
" | ".
|
|
|
104 |
file_get_contents("http://s102378343.einsundeinsshop.de/MD5.php?file=shopdata".$artikel[bild]).
|
|
|
105 |
" | ".
|
|
|
106 |
$artikel[bild].
|
|
|
107 |
"\n";
|
|
|
108 |
}
|
|
|
109 |
}
|
|
|
110 |
|
|
|
111 |
// FTP-Verbindung beenden
|
|
|
112 |
ftp_close($conn_id);
|
|
|
113 |
if (count($error_log) > 0)
|
|
|
114 |
{
|
|
|
115 |
mail ($SETTINGS["ERROR_MSG_TO"],"Mediaran Bilderabgleich: Upload-Fehler",implode("\n",$error_log));
|
|
|
116 |
}
|
|
|
117 |
|
|
|
118 |
if (count($success_log) > 0)
|
|
|
119 |
{
|
|
|
120 |
//mail ($SETTINGS["ERROR_MSG_TO"],"Mediaran Bilderabgleich: Upload-Status",implode("\n",$success_log));
|
|
|
121 |
}
|
|
|
122 |
|
|
|
123 |
|
|
|
124 |
/*
|
|
|
125 |
if ($artikel[bild])
|
|
|
126 |
{
|
|
|
127 |
$fname=substr(strrchr($artikel[bild],"/"), 1);
|
|
|
128 |
exec ("convert -scale 80x80 /web/apache/mediaran.de/images/Bild_5/$fname /web/apache/mediaran.de/images/Bild_5/kl/$fname");
|
|
|
129 |
}
|
|
|
130 |
|
|
|
131 |
echo
|
|
|
132 |
"http://s102378343.einsundeinsshop.de".$artikel[bild]."\n".
|
|
|
133 |
"http://s102378343.einsundeinsshop.de".$artikel[detailbild]."\n";
|
|
|
134 |
*/
|
|
|
135 |
?>
|