Subversion-Projekte lars-tiefland.php_share

Revision

Details | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
3 lars 1
<?
2
	include("/web/apache/mediaran.de/connect.php");
3
	include("core_data.php");
4
	include("load_options.php");
5
 
6
	/* SETTINGS */
7
 
8
	// Benachrichten bei Fehler:
9
	$SETTINGS["ERROR_MSG_TO"] = "willmann@weban.de";
10
 
11
	// FTP SERVER LOGIN DATEN
12
	$SETTINGS["FTP_SERVER"] = array
13
	(
14
		"SERVER"	=> "s102378343.einsundeinsshop.de",
15
		"USER"		=> "u36425608",
16
		"PASSWORD"	=> "PWfRdNYW"
17
	);
18
	/* ENDE SETTINGS */
19
 
20
 
21
	function get_clear_path($heritage)
22
	{
23
		array_shift($heritage);
24
		return $heritage;
25
	}
26
 
27
	function output_artikel($row)
28
	{
29
		global $output;
30
		unset($row[ID]);
31
		$row[beschreibung]=preg_replace("/[\r\n;]/", "", $row[beschreibung]);
32
		$output[]=preg_replace("/[\r\n]/", "", implode(";",$row));
33
	}
34
 
35
	function getFeatures($optionen,$bitmaske)
36
	{
37
		$buffer=array();
38
		foreach(array_keys($optionen) as $option)
39
		{
40
			if (((1 << $option) & $bitmaske) == 0) {continue;}
41
			$buffer[]=$optionen[$option];
42
		}
43
		if (count($buffer) > 0)
44
		{
45
			return "selection: ".implode($buffer," | ");
46
		}
47
		else
48
		{
49
			return "";
50
		}
51
	}
52
 
53
	function ausgabe($subdir,$heritage)
54
	{
55
		global $__Features;
56
		global $__Feature_ID_from_Name;
57
		global $__Feature_to_Ware;
58
 
59
		$artikel=array_pop($subdir);
60
		$subdirs=array_pop($subdir);
61
 
62
		$heritage[]=$subdir[Name];
63
 
64
		foreach($artikel as $current_row)
65
		{
66
			$current_row[category]=implode("|",get_clear_path($heritage));
67
			foreach(array_keys($__Features) as $elem)
68
			{
69
				$current_row[$elem]=getFeatures($__Features[$elem],$__Feature_to_Ware[$current_row[ID]][$__Feature_ID_from_Name[$elem]]);
70
			}
71
			output_artikel($current_row);
72
		}
73
 
74
		foreach($subdirs as $current_subdir)
75
		{
76
			ausgabe($current_subdir,$heritage);
77
		}
78
	}
79
 
80
	$output=array();
81
	$__Felder=array
82
	(
83
                "category",
84
                "bezeichnung",
85
                "kurzbezeichnung",
86
                "bild",
87
                "beschreibung",
88
                "artikelnr",
89
                "mwst",
90
                "preis",
91
                "detailbeschreibung",
92
                "detailbild",
93
                "templatefile_smalllist",
94
                "templatefile_detail",
95
                "is_invisible",
96
                "gewicht"
97
	);
98
	$__Felder=array_merge($__Felder,array_keys($__Features));
99
 
100
	$output[]='"fieldlist: ""'.implode('";"',$__Felder).'"';
101
	//echo "lade Daten\n";
102
	ausgabe(core_data(),array());
103
 
104
	// $output in eine temporäre Datei speichern
105
	$fp = tmpfile();
106
	fwrite($fp, implode("\n",$output));
107
	rewind($fp);
108
 
109
	// FTP VERBINDUNG AUFBAUEN
110
	$conn_id = ftp_connect($SETTINGS["FTP_SERVER"]["SERVER"]);
111
	$login_result = ftp_login
112
	(
113
		$conn_id,
114
		$SETTINGS["FTP_SERVER"]["USER"],
115
		$SETTINGS["FTP_SERVER"]["PASSWORD"]
116
	);
117
	if (($conn_id) && ($login_result))
118
	{
119
		//echo "Verbindung hergestellt!\n";
120
	}
121
	else
122
	{
123
        mail
124
		(
125
			$SETTINGS["ERROR_MSG_TO"],
126
			"Mediaran Datenupload: Ftp-Verbindung konnte nicht hergestellt werden!",
127
			$SETTINGS["FTP_SERVER"]["SERVER"]."\n".
128
			$SETTINGS["FTP_SERVER"]["USER"]."\n".
129
			$SETTINGS["FTP_SERVER"]["PASSWORD"]
130
		);
131
        die;
132
    }
133
 
134
	if (ftp_fput ($conn_id, "avt-24.de.txt", $fp, FTP_BINARY))
135
	{
136
		//echo "Upload vollständig.\n";
137
	}
138
	else
139
	{
140
        mail
141
		(
142
			$SETTINGS["ERROR_MSG_TO"],
143
			"Mediaran Datenupload: Ftp-Datenupload konnte nicht hergestellt werden!",
144
			""
145
		);
146
		//echo "Fehler!\n";
147
		exit;
148
	}
149
 
150
	// FTP-Verbindung beenden
151
	ftp_close($conn_id);
152
 
153
	// temporäre Datei löschen
154
	fclose($fp);
155
 
156
?>