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"	=> "s87594393.einsundeinsshop.de",
15
		"USER"		=> "u35337859",
16
		"PASSWORD"	=> "alco17"
17
	);
18
	/* ENDE SETTINGS */
19
 
20
	function get_clear_path($heritage)
21
	{
22
		array_shift($heritage);
23
		return $heritage;
24
	}
25
 
26
	function output_artikel($row)
27
	{
28
		global $output;
29
		unset($row[ID]);
30
		$row[beschreibung]=preg_replace("/[\r\n;]/", "", $row[beschreibung]);
31
		$output[]=preg_replace("/[\r\n]/", "", implode(";",$row));
32
	}
33
 
34
	function getFeatures($optionen,$bitmaske)
35
	{
36
		$buffer=array();
37
		foreach(array_keys($optionen) as $option)
38
		{
39
			if (((1 << $option) & $bitmaske) == 0) {continue;}
40
			$buffer[]=$optionen[$option];
41
		}
42
		if (count($buffer) > 0)
43
		{
44
			return "selection: ".implode($buffer," | ");
45
		}
46
		else
47
		{
48
			return "";
49
		}
50
	}
51
 
52
	function ausgabe($subdir,$heritage)
53
	{
54
		global $__Features;
55
		global $__Feature_ID_from_Name;
56
		global $__Feature_to_Ware;
57
 
58
		$artikel=array_pop($subdir);
59
		$subdirs=array_pop($subdir);
60
 
61
		$heritage[]=$subdir[Name];
62
 
63
		foreach($artikel as $current_row)
64
		{
65
			$current_row[category]=implode("|",get_clear_path($heritage));
66
			foreach(array_keys($__Features) as $elem)
67
			{
68
				$current_row[$elem]=getFeatures($__Features[$elem],$__Feature_to_Ware[$current_row[ID]][$__Feature_ID_from_Name[$elem]]);
69
			}
70
			output_artikel($current_row);
71
		}
72
 
73
		foreach($subdirs as $current_subdir)
74
		{
75
			ausgabe($current_subdir,$heritage);
76
		}
77
	}
78
 
79
	$output=array();
80
	$__Felder=array
81
	(
82
		"category",
83
		"bezeichnung",
84
		"kurzbezeichnung",
85
		"bild",
86
		"beschreibung",
87
		"artikelnr",
88
		"mwst",
89
		"preis",
90
		"detailbeschreibung",
91
		"detailbild",
92
		"templatefile_smalllist",
93
		"templatefile_detail",
94
		"is_invisible",
95
		"gewicht",
96
		"startseite"
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, "gateway24.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
?>