| 1 |
lars |
1 |
<?php
|
|
|
2 |
$self = basename( $PHP_SELF );
|
|
|
3 |
$DB = "verteiler";
|
|
|
4 |
define( "modul_name", "mail_verteiler" );
|
|
|
5 |
define( "tool_name", "versenden" );
|
|
|
6 |
require_once "../Online-Shop/connect2.php";
|
|
|
7 |
set_time_limit( 0 );
|
|
|
8 |
|
|
|
9 |
if ( !isset( $user_rechte["mail_verteiler"]["versenden"]["html"] ) )
|
|
|
10 |
{
|
|
|
11 |
header( "Location: mailVerteilerSelect.php" );
|
|
|
12 |
}
|
|
|
13 |
|
|
|
14 |
function getVerteiler( $Verteiler_NR )
|
|
|
15 |
{
|
|
|
16 |
$query = "SELECT
|
|
|
17 |
*
|
|
|
18 |
FROM
|
|
|
19 |
Verteiler
|
|
|
20 |
WHERE
|
|
|
21 |
ID = $Verteiler_NR
|
|
|
22 |
";
|
| 2 |
lars |
23 |
$result_Verteiler = mysql_query( $query ) or die( mysql_errno() . ": " .
|
|
|
24 |
mysql_error() . "<hr>$query<hr>" );
|
| 1 |
lars |
25 |
return mysql_fetch_assoc( $result_Verteiler );
|
|
|
26 |
}
|
|
|
27 |
|
|
|
28 |
function boundary()
|
|
|
29 |
{
|
|
|
30 |
return md5( rand() );
|
|
|
31 |
}
|
|
|
32 |
|
|
|
33 |
|
|
|
34 |
function getShopsIdFromTemplateURL( $tplURL )
|
|
|
35 |
{
|
|
|
36 |
$shops_ID = null;
|
|
|
37 |
$url = parse_url( $tplURL );
|
|
|
38 |
$domain = str_replace( "www.", "", $url['host'] );
|
|
|
39 |
$domain = str_replace( ".local", "", $domain );
|
|
|
40 |
|
|
|
41 |
$sql = "SELECT
|
|
|
42 |
ID
|
|
|
43 |
FROM
|
|
|
44 |
shops
|
|
|
45 |
WHERE
|
|
|
46 |
domain = '" . $domain . "'
|
|
|
47 |
";
|
|
|
48 |
if ( $q = mysql_query( $sql ) )
|
|
|
49 |
{
|
|
|
50 |
if ( $r = mysql_fetch_assoc( $q ) )
|
|
|
51 |
{
|
|
|
52 |
$shops_ID = $r['ID'];
|
|
|
53 |
}
|
|
|
54 |
}
|
|
|
55 |
return $shops_ID;
|
|
|
56 |
}
|
|
|
57 |
|
|
|
58 |
|
|
|
59 |
if ( $action )
|
|
|
60 |
{
|
|
|
61 |
$Verteiler = getVerteiler( $Verteiler_NR );
|
|
|
62 |
$boundary = boundary();
|
|
|
63 |
$msgBoundary = boundary();
|
|
|
64 |
|
|
|
65 |
|
|
|
66 |
/* LOGOUT-LINK an eingegebene Nachrichten anhängen */
|
|
|
67 |
if ( !empty( $web_rechte["mail_verteiler"]["verteiler"]["logout_link"] ) )
|
|
|
68 |
{
|
|
|
69 |
//$message[PLAIN] = $message[PLAIN] . "\n\n##logout_link##";
|
|
|
70 |
$message["HTML"] = $message["HTML"] . "<br><br><a href=\"##logout_link##\">Newsletter abbestellen</a>";
|
|
|
71 |
}
|
|
|
72 |
else
|
|
|
73 |
{
|
|
|
74 |
//$message[PLAIN]=$message[PLAIN];
|
|
|
75 |
//$message[HTML]=stripslashes(preg_replace ("/=/", "=3D", $message[HTML]));
|
|
|
76 |
}
|
|
|
77 |
|
|
|
78 |
|
|
|
79 |
/* ############################################################################################ */
|
|
|
80 |
/* Headers zusammenstellen */
|
|
|
81 |
/* ############################################################################################ */
|
|
|
82 |
|
| 2 |
lars |
83 |
$headers = array(
|
|
|
84 |
"From: $Verteiler[Absender]",
|
|
|
85 |
"MIME-Version: 1.0",
|
|
|
86 |
"Content-Type: multipart/mixed;",
|
|
|
87 |
" boundary=\"" . $boundary . "\"" );
|
| 1 |
lars |
88 |
|
|
|
89 |
/* ############################################################################################ */
|
|
|
90 |
/* Nachricht zusammenstellen */
|
|
|
91 |
/* ############################################################################################ */
|
|
|
92 |
|
|
|
93 |
/*
|
|
|
94 |
$msg = array( // "alternative"-Header
|
|
|
95 |
"--" . $boundary, "Content-Type: multipart/alternative;",
|
|
|
96 |
" boundary=\"" . $msgBoundary . "\"", "", // TEXT HEADER
|
|
|
97 |
"--" . $msgBoundary, "Content-Type: text/plain; charset=\"ISO-8859-1\"",
|
|
|
98 |
"Content-Transfer-Encoding: 7bit", "", $message["PLAIN"], "", "",
|
|
|
99 |
// HTML HEADER
|
|
|
100 |
"--" . $msgBoundary, "Content-Type: text/html; charset=\"ISO-8859-1\"",
|
|
|
101 |
"Content-Transfer-Encoding: 7bit", "", $message["HTML"], "",
|
|
|
102 |
"--" . $msgBoundary . "--", "" );
|
|
|
103 |
*/
|
|
|
104 |
$msg = array( $message["PLAIN"], $message["HTML"] );
|
|
|
105 |
|
|
|
106 |
if ( is_array( $_FILES["attach"]["error"] ) )
|
|
|
107 |
{
|
|
|
108 |
foreach ( array_keys( $_FILES["attach"]["error"] ) as $fileIndex =>
|
|
|
109 |
$errorCode )
|
|
|
110 |
{
|
|
|
111 |
if ( $_FILES["attach"]["error"][$fileIndex] == 0 )
|
|
|
112 |
{
|
| 2 |
lars |
113 |
$msg = array_merge( $msg, array(
|
|
|
114 |
"--" . $boundary,
|
| 1 |
lars |
115 |
"Content-Type: " . $_FILES["attach"]["type"][$fileIndex] .
|
| 2 |
lars |
116 |
";",
|
|
|
117 |
"\tname=\"" . $_FILES["attach"]["name"][$fileIndex] . "\"",
|
|
|
118 |
"Content-Transfer-Encoding: base64",
|
|
|
119 |
"Content-Disposition: attachment;",
|
|
|
120 |
"\tfilename=\"" . $_FILES["attach"]["name"][$fileIndex] .
|
|
|
121 |
"\"",
|
|
|
122 |
"",
|
| 1 |
lars |
123 |
chunk_split( base64_encode( file_get_contents( $_FILES["attach"]["tmp_name"][$fileIndex] ) ) ),
|
| 2 |
lars |
124 |
"",
|
|
|
125 |
"" ) );
|
| 1 |
lars |
126 |
}
|
|
|
127 |
}
|
|
|
128 |
}
|
|
|
129 |
|
|
|
130 |
|
|
|
131 |
//$textRaw = join( "\n", $msg ) . "\n\n--" . $boundary . "--\n\n";
|
|
|
132 |
$textRaw = join( "\n", $msg );
|
|
|
133 |
|
|
|
134 |
/* ############################################################################################ */
|
|
|
135 |
/* Nachricht zusammenstellen ENDE */
|
|
|
136 |
/* ############################################################################################ */
|
|
|
137 |
|
|
|
138 |
$getValue = create_function( '$value,$key',
|
|
|
139 |
'echo "zzz ".$key." zzz"; return $value[$key];' );
|
|
|
140 |
|
|
|
141 |
$To = preg_replace( "/\|/", "", $To );
|
|
|
142 |
$To = explode( "\n", trim( $To ) );
|
|
|
143 |
//exit;
|
|
|
144 |
|
|
|
145 |
if ( $_REQUEST["gutscheinvorlagenid"] )
|
|
|
146 |
{
|
|
|
147 |
$gs_vorlage = leseGutscheinvorlage( $_REQUEST["gutscheinvorlagenid"] );
|
|
|
148 |
}
|
|
|
149 |
foreach ( $To as $ToIndex => $ToValue )
|
|
|
150 |
{
|
|
|
151 |
$value = explode( ";", trim( $ToValue ) );
|
| 2 |
lars |
152 |
$logout_link = "";
|
|
|
153 |
if ( !empty( $web_rechte["mail_verteiler"]["verteiler"]["logout_link"] ) )
|
|
|
154 |
{
|
|
|
155 |
$logout_link = $web_rechte["mail_verteiler"]["verteiler"]["logout_link"];
|
|
|
156 |
if ( stristr( $logout_link, "?" ) )
|
|
|
157 |
{
|
|
|
158 |
$trenner = "&";
|
|
|
159 |
}
|
|
|
160 |
else
|
|
|
161 |
{
|
|
|
162 |
$trenner = "?";
|
|
|
163 |
}
|
|
|
164 |
$logout_link .= $trenner . "m=" . $value[0] . "&v=" . $Verteiler["ID"];
|
|
|
165 |
}
|
| 1 |
lars |
166 |
|
| 2 |
lars |
167 |
$value = array_merge( array(
|
|
|
168 |
"logout_link" => $logout_link,
|
|
|
169 |
"E_Mail" => $value[0],
|
|
|
170 |
"" ), $value );
|
| 1 |
lars |
171 |
|
|
|
172 |
|
|
|
173 |
$Betreff = $Verteiler["Betreff"];
|
|
|
174 |
$text = $textRaw;
|
|
|
175 |
|
|
|
176 |
// Platzhalter gegeb Inhalt tauschen
|
|
|
177 |
// Änderung am 01.06.06
|
|
|
178 |
// ersetze ##...## und [...] Abgeschaltet da [weiter] als Schlüsselwort interpretiert wurde
|
|
|
179 |
// Es wird nur noch ##...## ersetzt
|
|
|
180 |
// "/#{2}$valueKey#{2}|\[$valueKey\]/",
|
|
|
181 |
// "/#{2}\S*#{2}|\[\S*\]/"
|
|
|
182 |
|
|
|
183 |
if ( !$_REQUEST['shops_ID'] )
|
|
|
184 |
{
|
|
|
185 |
$_REQUEST['shops_ID'] = 1;
|
|
|
186 |
}
|
|
|
187 |
|
|
|
188 |
if ( $gs_vorlage )
|
|
|
189 |
{
|
|
|
190 |
$gs = gen_gutschein( $gs_vorlage, $value[1], $_REQUEST["shops_ID"] );
|
|
|
191 |
$text = str_replace( "##gutscheinname##", $gs["name"], $text );
|
|
|
192 |
$wert = $gs["anfangswert"];
|
|
|
193 |
if ( $wert < 0 )
|
|
|
194 |
{
|
|
|
195 |
$wert = number_format( $wert * -1 ) . " %";
|
|
|
196 |
}
|
|
|
197 |
else
|
|
|
198 |
{
|
|
|
199 |
$wert = number_format( $wert, 2, ',', '.' ) . " €";
|
|
|
200 |
}
|
|
|
201 |
$text = str_replace( "##gutscheinpreis1##", $wert, $text );
|
|
|
202 |
$text = str_replace( "##gutscheinpreis2##", number_format( $gs["minbestwert"],
|
|
|
203 |
2, ',', '.' ) . " €", $text );
|
|
|
204 |
$text = str_replace( "##gutscheincode##", $gs["code"], $text );
|
|
|
205 |
$ablauf = date( "d.m.Y H:i", strtotime( $gs["gueltig_bis"] ) );
|
|
|
206 |
$text = str_replace( "##gutscheinablauf##", $ablauf, $text );
|
|
|
207 |
}
|
|
|
208 |
|
|
|
209 |
foreach ( $value as $valueKey => $valueValue )
|
|
|
210 |
{
|
| 2 |
lars |
211 |
$Betreff = preg_replace( "/#{2}$valueKey#{2}/", $valueValue, $Betreff );
|
| 1 |
lars |
212 |
|
|
|
213 |
$text = preg_replace( "/#{2}$valueKey#{2}/", $valueValue, $text );
|
|
|
214 |
}
|
|
|
215 |
|
|
|
216 |
$Betreff = preg_replace( "/#{2}\S*#{2}/", "", $Betreff );
|
|
|
217 |
$text = preg_replace( "/#{2}\S*#{2}/", "", $text );
|
|
|
218 |
|
|
|
219 |
// In den Mailspool packen
|
| 2 |
lars |
220 |
$mail = array(
|
|
|
221 |
"shops_ID" => $_REQUEST['shops_ID'],
|
|
|
222 |
"webs_ID" => $webs["ID"],
|
|
|
223 |
"to" => $value["E_Mail"],
|
|
|
224 |
"cc" => '',
|
|
|
225 |
"bcc" => '',
|
|
|
226 |
"subject" => $Betreff,
|
|
|
227 |
"from" => $Verteiler["Absender"],
|
|
|
228 |
"header_add" => implode( "\n", $headers ),
|
|
|
229 |
"text" => $text,
|
|
|
230 |
"erstellt_von" => $PHP_AUTH_USER,
|
|
|
231 |
"smtp_server" => $_REQUEST['smtp_server'],
|
|
|
232 |
"smtp_user" => $_REQUEST['smtp_user'],
|
|
|
233 |
"smtp_pass" => $_REQUEST['smtp_pass'],
|
| 1 |
lars |
234 |
"smtp_authed" => $_REQUEST['smtp_authed'] );
|
|
|
235 |
|
|
|
236 |
list( $tag, $monat, $jahr, $stunde, $minute, $sekunde ) = sscanf( $_POST["takeoff"],
|
|
|
237 |
"%d.%d.%d %d:%d:%d" );
|
|
|
238 |
$mail["takeoff"] = "$jahr-$monat-$tag $stunde:$minute:$sekunde";
|
|
|
239 |
|
|
|
240 |
if ( $MySQL_Host_write )
|
|
|
241 |
{
|
|
|
242 |
//echo "schreibe in Haupt-DB";
|
|
|
243 |
$w_conn = @mysql_connect( $MySQL_Host_write, $MySQL_User, $MySQL_Passwd );
|
|
|
244 |
if ( !$w_conn )
|
|
|
245 |
{
|
|
|
246 |
$error = true;
|
|
|
247 |
$meld =
|
|
|
248 |
"Leider können keine Newsletter verschickt werden, da keine Verbindung zur Datenbank möglich ist.";
|
|
|
249 |
}
|
|
|
250 |
$r = @mysql_select_db( $database_name );
|
|
|
251 |
if ( !$r )
|
|
|
252 |
{
|
|
|
253 |
$meld =
|
|
|
254 |
"Leider können keine Newsletter verschickt werden, da keine Verbindung zur Datenbank möglich ist.";
|
|
|
255 |
$error = true;
|
|
|
256 |
}
|
|
|
257 |
if ( $meld )
|
|
|
258 |
{
|
|
|
259 |
die( $meld );
|
|
|
260 |
}
|
|
|
261 |
}
|
|
|
262 |
else
|
|
|
263 |
{
|
|
|
264 |
$w_conn = $localhost_dbh;
|
|
|
265 |
}
|
|
|
266 |
foreach ( $mail as $field => $value )
|
|
|
267 |
{
|
|
|
268 |
$mail[$field] = mysql_real_escape_string( $value );
|
|
|
269 |
}
|
|
|
270 |
$query_spool = "
|
|
|
271 |
INSERT INTO
|
|
|
272 |
content_management.mailspool_out
|
|
|
273 |
(
|
|
|
274 |
`shops_ID` ,
|
|
|
275 |
`webs_ID` ,
|
|
|
276 |
`to` ,
|
|
|
277 |
`cc` ,
|
|
|
278 |
`bcc` ,
|
|
|
279 |
`subject` ,
|
|
|
280 |
`from` ,
|
|
|
281 |
`header_add` ,
|
|
|
282 |
`text` ,
|
|
|
283 |
`takeoff` ,
|
|
|
284 |
`erstellt_am` ,
|
|
|
285 |
`erstellt_von`,
|
|
|
286 |
`smtp_server`,
|
|
|
287 |
`smtp_user`,
|
|
|
288 |
`smtp_pass`,
|
|
|
289 |
`smtp_authed`
|
|
|
290 |
)
|
|
|
291 |
VALUES
|
|
|
292 |
(
|
|
|
293 |
" . $mail["shops_ID"] . ",
|
|
|
294 |
" . $mail["webs_ID"] . ",
|
|
|
295 |
'" . $mail["to"] . "',
|
|
|
296 |
'" . $mail["cc"] . "' ,
|
|
|
297 |
'" . $mail["bcc"] . "' ,
|
|
|
298 |
'" . $mail["subject"] . "',
|
|
|
299 |
'" . $mail["from"] . "',
|
|
|
300 |
'" . $mail["header_add"] . "',
|
|
|
301 |
'" . $mail['text'] . "',
|
|
|
302 |
'" . $mail["takeoff"] . "',
|
|
|
303 |
NOW(),
|
|
|
304 |
'" . $mail["erstellt_von"] . "',
|
|
|
305 |
'" . $mail["smtp_server"] . "',
|
|
|
306 |
'" . $mail["smtp_user"] . "',
|
|
|
307 |
'" . $mail["smtp_pass"] . "',
|
|
|
308 |
'" . $mail["smtp_authed"] . "'
|
|
|
309 |
)
|
|
|
310 |
";
|
| 2 |
lars |
311 |
$result = mysql_query( $query_spool, $w_conn ) or die( mysql_errno( $w_conn ) .
|
|
|
312 |
": " . mysql_error( $w_conn ) . "<hr>$query_spool<hr>" );
|
| 1 |
lars |
313 |
} // end of foreach($To as $ToIndex => $ToValue)
|
|
|
314 |
header( "Location: mailsent.php?count=" . count( $To ) );
|
|
|
315 |
exit;
|
|
|
316 |
} // end of if ($action)
|
|
|
317 |
|
|
|
318 |
$Verteiler = array();
|
|
|
319 |
$result = mysql_query( "SELECT * FROM Verteiler order by name" ) or die( mysql_errno
|
|
|
320 |
() . ": " . mysql_error() );
|
|
|
321 |
while ( $zeile = mysql_fetch_array( $result ) )
|
|
|
322 |
{
|
|
|
323 |
$Verteiler[$zeile["ID"]] = $zeile;
|
|
|
324 |
}
|
|
|
325 |
|
|
|
326 |
if ( !$Verteiler_NR )
|
|
|
327 |
{
|
|
|
328 |
$Verteiler_NR = array_keys( $Verteiler );
|
|
|
329 |
$Verteiler_NR = $Verteiler_NR[0];
|
|
|
330 |
}
|
|
|
331 |
?>
|
|
|
332 |
<html>
|
|
|
333 |
<head>
|
|
|
334 |
<title>Mail versenden</title>
|
|
|
335 |
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
|
|
336 |
<meta name="author" content="Webagentur Niewerth - www.weban.de">
|
|
|
337 |
<meta name="revisit-after" content="30 days">
|
|
|
338 |
<meta name="language" content="deutsch, de">
|
|
|
339 |
<meta name="distribution" content="global">
|
|
|
340 |
<meta name="robots" content="all">
|
|
|
341 |
<link rel="stylesheet" type="text/css" href="../buttons.css">
|
|
|
342 |
<style type="text/css">
|
|
|
343 |
<!--
|
|
|
344 |
a { color: #<?php echo $webs["font_color_rechts"]
|
|
|
345 |
?>}
|
|
|
346 |
-->
|
|
|
347 |
</style>
|
|
|
348 |
<script language="JavaScript" src="../checkDate.js"></script>
|
|
|
349 |
<script type="text/javascript" src="../whizzyRte/whizzywig.js"></script>
|
|
|
350 |
</head>
|
|
|
351 |
|
|
|
352 |
<body bgcolor="#<?php echo $webs["bgcolor_seite"]
|
|
|
353 |
?>" leftmargin="20" topmargin="10" marginwidth="20" marginheight="10" text="#<?php echo
|
|
|
354 |
$webs["font_color_rechts"]
|
|
|
355 |
?>">
|
|
|
356 |
<form method="post" action="#" enctype="multipart/form-data">
|
|
|
357 |
<table width="800" border="1" cellspacing="0" cellpadding="3" bordercolorlight="#FFFFFF" bordercolordark="#999999">
|
|
|
358 |
<tr>
|
|
|
359 |
<td bgcolor="#<?php echo $webs["bgcolor_links"]
|
|
|
360 |
?>" colspan="2"><font color="#<?php echo $webs["font_color_links"]
|
|
|
361 |
?>">Verteiler
|
|
|
362 |
senden: <input type="hidden" name="Verteiler_NR" value="<?= $_REQUEST["Verteiler_NR"];
|
|
|
363 |
?>"></td>
|
|
|
364 |
</tr>
|
|
|
365 |
<tr>
|
|
|
366 |
<td bgcolor="#<?php echo $webs["bgcolor_links"]
|
|
|
367 |
?>" class="headline" width="20%" valign="top"><font color="#<?php echo $webs["font_color_links"]
|
|
|
368 |
?>">An:</td>
|
|
|
369 |
<td bgcolor="#<?php echo $webs["bgcolor_rechts"]
|
|
|
370 |
?>">
|
|
|
371 |
<?php
|
|
|
372 |
$to = array();
|
|
|
373 |
//Jenachdem was im Redaktionssystem angegeben ist, werden mehr Infos geholt und später mit in $to gepackt
|
|
|
374 |
$grundfunktionen = explode( ";", $web_rechte["mail_verteiler"]["versenden"]["grundfunktionen"] );
|
|
|
375 |
$zusatzfelder = '';
|
|
|
376 |
foreach ( $grundfunktionen as $value )
|
|
|
377 |
{
|
|
|
378 |
if ( $value )
|
|
|
379 |
{
|
|
|
380 |
$zusatzfelder .= ", $value";
|
|
|
381 |
}
|
|
|
382 |
}
|
|
|
383 |
$query = "SELECT DISTINCT
|
|
|
384 |
Logins.E_Mail,
|
|
|
385 |
MD5(Logins.E_Mail) as MD5
|
|
|
386 |
$zusatzfelder
|
|
|
387 |
FROM
|
|
|
388 |
Logins,
|
|
|
389 |
Logins_to_Verteiler
|
|
|
390 |
WHERE
|
|
|
391 |
Logins.ID = Logins_to_Verteiler.Logins
|
|
|
392 |
AND
|
| 2 |
lars |
393 |
Logins_to_Verteiler.Verteiler = '" . $_REQUEST["Verteiler_NR"] . "'
|
| 1 |
lars |
394 |
ORDER BY
|
|
|
395 |
ID
|
|
|
396 |
";
|
| 2 |
lars |
397 |
$result = mysql_query( $query ) or die( mysql_errno() . ": " . mysql_error() .
|
|
|
398 |
"<hr>$query<hr>" );
|
| 1 |
lars |
399 |
$count = mysql_num_rows( $result );
|
|
|
400 |
// Userdaten werden ins Array $to gepackt
|
|
|
401 |
while ( $zeile = mysql_fetch_assoc( $result ) )
|
|
|
402 |
{
|
| 2 |
lars |
403 |
if ( preg_match( "/^[A-Za-z0-9-_.+]+\@[A-Za-z0-9-_.+]+\.[A-Za-z]+$/", $zeile["E_Mail"] ) >
|
|
|
404 |
|
| 1 |
lars |
405 |
{
|
|
|
406 |
$to[$zeile["MD5"]]["E_Mail"] = $zeile[E_Mail];
|
|
|
407 |
//Jenachdem was im Redaktionssystem angegeben ist, werden mehr Infos geholt und später mit in $to gepackt
|
|
|
408 |
foreach ( $grundfunktionen as $value )
|
|
|
409 |
{
|
|
|
410 |
$to[$zeile[MD5]][$value] = $zeile[$value];
|
|
|
411 |
}
|
|
|
412 |
}
|
|
|
413 |
}
|
|
|
414 |
?>
|
|
|
415 |
<ul style="float:right; list-style-position: outside; list-style-type: none; padding-right:20px;">
|
|
|
416 |
<li style="padding:3px">##1##</li>
|
|
|
417 |
<li style="padding:3px">##2##</li>
|
|
|
418 |
<li style="padding:3px">##3##</li>
|
|
|
419 |
<li style="padding:3px">...</li>
|
|
|
420 |
</ul>
|
|
|
421 |
|
|
|
422 |
<textarea name="To" cols="100" rows="10" style="float:left;"><?php
|
|
|
423 |
foreach ( $to as $key => $value )
|
|
|
424 |
{
|
|
|
425 |
$ausgabe = '';
|
|
|
426 |
foreach ( $value as $key2 => $value2 )
|
|
|
427 |
{
|
|
|
428 |
if ( $value2 )
|
|
|
429 |
{
|
|
|
430 |
$ausgabe .= "$value2;";
|
|
|
431 |
}
|
|
|
432 |
}
|
|
|
433 |
$ausgabe = substr( $ausgabe, 0, strlen( $ausgabe ) - 1 ) . "|\n";
|
|
|
434 |
echo $ausgabe;
|
|
|
435 |
}
|
|
|
436 |
?></textarea>
|
|
|
437 |
<br style="clear:both">
|
|
|
438 |
Anzahl der ausgelesenen Empfänger: <?= count( $to );
|
|
|
439 |
?>
|
|
|
440 |
</td>
|
|
|
441 |
</tr>
|
|
|
442 |
<tr>
|
|
|
443 |
<td bgcolor="#<?php echo $webs["bgcolor_links"]
|
|
|
444 |
?>" class="headline" width="20%" valign="top"><font color="#<?php echo $webs["font_color_links"]
|
|
|
445 |
?>">Versenden am/ab:</td>
|
|
|
446 |
<td bgcolor="#<?php echo $webs["bgcolor_rechts"]
|
|
|
447 |
?>">
|
|
|
448 |
<input type="text" name="takeoff" size="30" value="<?= date( "d.m.Y H:i:s" );
|
|
|
449 |
?>" onFocus="current_value=this.value;if (this.value=='') {this.value=now2(uhrzeit());} this.select();" onChange="this.value=check_Date(this.value)">
|
|
|
450 |
</td>
|
|
|
451 |
</tr>
|
|
|
452 |
<?php
|
|
|
453 |
if ( isset( $user_rechte["mail_verteiler"]["versenden"]["gutscheinversand"] ) )
|
|
|
454 |
{
|
|
|
455 |
?>
|
|
|
456 |
<tr>
|
|
|
457 |
<td bgcolor="#<?php echo $webs["bgcolor_links"]
|
|
|
458 |
?>" class="headline" width="20%" valign="top"><font color="#<?php echo $webs["font_color_links"]
|
|
|
459 |
?>">GutscheinvorlagenID:</td>
|
|
|
460 |
<td bgcolor="#<?php echo $webs["bgcolor_rechts"]
|
|
|
461 |
?>">
|
|
|
462 |
<input type="text" name="gutscheinvorlagenid">
|
|
|
463 |
</td>
|
|
|
464 |
</tr>
|
|
|
465 |
<?php
|
|
|
466 |
}
|
|
|
467 |
?>
|
|
|
468 |
<tr>
|
|
|
469 |
<td bgcolor="#<?php echo $webs["bgcolor_links"]
|
|
|
470 |
?>" class="headline" width="20%" valign="top"><font color="#<?php echo $webs["font_color_links"]
|
|
|
471 |
?>">Absender:</td>
|
|
|
472 |
<td bgcolor="#<?php echo $webs["bgcolor_rechts"]
|
|
|
473 |
?>"><?php echo nl2br( $Verteiler[$Verteiler_NR]["Absender"] )
|
|
|
474 |
?></td>
|
|
|
475 |
</tr>
|
|
|
476 |
<tr>
|
|
|
477 |
<td bgcolor="#<?php echo $webs["bgcolor_links"]
|
|
|
478 |
?>" class="headline" width="20%" valign="top"><font color="#<?php echo $webs["font_color_links"]
|
|
|
479 |
?>">Betreff:</td>
|
|
|
480 |
<td bgcolor="#<?php echo $webs["bgcolor_rechts"]
|
|
|
481 |
?>"><?php echo nl2br( $Verteiler[$Verteiler_NR]["Betreff"] )
|
|
|
482 |
?></td>
|
|
|
483 |
</tr>
|
|
|
484 |
<?php if ( !isset( $web_rechte[2]["versenden"]["html"] ) )
|
|
|
485 |
{
|
|
|
486 |
?>
|
|
|
487 |
<tr>
|
|
|
488 |
<td bgcolor="#<?php echo $webs["bgcolor_links"]
|
|
|
489 |
?>" class="headline" width="20%" valign="top"><font color="#<?php echo $webs["font_color_links"]
|
|
|
490 |
?>">Begrüssung:</td>
|
|
|
491 |
<td bgcolor="#<?php echo $webs["bgcolor_rechts"]
|
|
|
492 |
?>"><?php echo nl2br( $Verteiler[$Verteiler_NR]["Begruessung"] )
|
|
|
493 |
?></td>
|
|
|
494 |
</tr>
|
|
|
495 |
<?php
|
|
|
496 |
}
|
|
|
497 |
?>
|
|
|
498 |
<tr>
|
|
|
499 |
<td bgcolor="#<?php echo $webs["bgcolor_links"]
|
|
|
500 |
?>" class="headline" width="20%" valign="top"><font color="#<?php echo $webs["font_color_links"]
|
|
|
501 |
?>">Text:
|
|
|
502 |
(Plain) </td>
|
|
|
503 |
<td bgcolor="#<?php echo $webs["bgcolor_rechts"]
|
|
|
504 |
?>">
|
|
|
505 |
<textarea name="message[PLAIN]" cols="100" rows="10" wrap="OFF"></textarea>
|
|
|
506 |
</td>
|
|
|
507 |
</tr>
|
|
|
508 |
<tr>
|
|
|
509 |
<td bgcolor="#<?php echo $webs["bgcolor_links"]
|
|
|
510 |
?>" class="headline" width="20%" valign="top"><font color="#<?php echo $webs["font_color_links"]
|
|
|
511 |
?>">Text:
|
|
|
512 |
(HTML) </td>
|
|
|
513 |
<td bgcolor="#<?php echo $webs["bgcolor_rechts"]
|
|
|
514 |
?>">
|
|
|
515 |
|
|
|
516 |
|
|
|
517 |
<!--<textarea id="messageHTML" name="message[HTML]" cols="150" rows="100" wrap="OFF" height="200">-->
|
|
|
518 |
<textarea id="messageHTML" name="message[HTML]" cols="150" rows="100">
|
|
|
519 |
|
|
|
520 |
<?php
|
|
|
521 |
if ( $Verteiler[$_GET["Verteiler_NR"]]["Template_URL"] )
|
|
|
522 |
{
|
|
|
523 |
echo $Verteiler[$Verteiler_NR]["Begruessung"];
|
|
|
524 |
readfile( $Verteiler[$_GET["Verteiler_NR"]]["Template_URL"] );
|
|
|
525 |
echo $Verteiler[$Verteiler_NR]["Schlusstext"];
|
|
|
526 |
}
|
|
|
527 |
?>
|
|
|
528 |
</textarea>
|
|
|
529 |
<!-- Einbindung TinyMCE -->
|
|
|
530 |
<script type="text/javascript" language="javascript" src="/js/jquery-1.4.4.min.js"></script>
|
|
|
531 |
<script type="text/javascript" src="../tiny_mce/tiny_mce.js"></script>
|
|
|
532 |
<script type="text/javascript">
|
|
|
533 |
tinyMCE.init({
|
|
|
534 |
// General options
|
|
|
535 |
apply_source_formatting : false,
|
|
|
536 |
inline_styles : true,
|
|
|
537 |
mode : "exact",
|
|
|
538 |
elements: "messageHTML",
|
|
|
539 |
theme : "advanced",
|
|
|
540 |
verify_html : false,
|
|
|
541 |
cleanup : false,
|
|
|
542 |
extended_valid_elements : "style,head,body,html",
|
|
|
543 |
language: "de",
|
|
|
544 |
plugins : "safari,spellchecker,pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template",
|
|
|
545 |
|
|
|
546 |
// Theme options
|
|
|
547 |
theme_advanced_buttons1 : "bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|,styleselect,formatselect,fontselect,fontsizeselect",
|
|
|
548 |
theme_advanced_buttons2 : "cut,copy,paste,pastetext,pasteword,|,search,replace,|,bullist,numlist,|,outdent,indent,blockquote,|,undo,redo,|,link,unlink,anchor,image,cleanup,help,code,|,insertdate,inserttime,preview,|,forecolor,backcolor",
|
|
|
549 |
theme_advanced_buttons3 : "tablecontrols,|,hr,removeformat,visualaid,|,sub,sup,|,charmap,emotions,iespell,media,advhr,|,print,|,ltr,rtl,|,fullscreen",
|
|
|
550 |
theme_advanced_buttons4 : "insertlayer,moveforward,movebackward,absolute,|,styleprops,spellchecker,|,cite,abbr,acronym,del,ins,attribs,|,visualchars,nonbreaking,template,blockquote,pagebreak,|,insertfile,insertimage",
|
|
|
551 |
theme_advanced_toolbar_location : "top",
|
|
|
552 |
theme_advanced_toolbar_align : "left",
|
|
|
553 |
theme_advanced_statusbar_location : "bottom",
|
|
|
554 |
theme_advanced_resizing : true,
|
|
|
555 |
|
|
|
556 |
// Example content CSS (should be your site CSS)
|
|
|
557 |
content_css : "css/example.css",
|
|
|
558 |
|
|
|
559 |
// Drop lists for link/image/media/template dialogs
|
|
|
560 |
template_external_list_url : "js/template_list.js",
|
|
|
561 |
external_link_list_url : "js/link_list.js",
|
|
|
562 |
external_image_list_url : "js/image_list.js",
|
|
|
563 |
media_external_list_url : "js/media_list.js",
|
|
|
564 |
|
|
|
565 |
// Replace values for the template plugin
|
|
|
566 |
template_replace_values : {
|
|
|
567 |
username : "Some User",
|
|
|
568 |
staffid : "991234"
|
|
|
569 |
}
|
|
|
570 |
});
|
|
|
571 |
</script>
|
|
|
572 |
</td>
|
|
|
573 |
</tr>
|
|
|
574 |
<?php if ( !isset( $web_rechte["mail_verteiler"]["versenden"]["html"] ) )
|
|
|
575 |
{
|
|
|
576 |
?>
|
|
|
577 |
<tr>
|
|
|
578 |
<td bgcolor="#<?php echo $webs["bgcolor_links"]
|
|
|
579 |
?>" class="headline" width="20%" valign="top"><font color="#<?php echo $webs["font_color_links"]
|
|
|
580 |
?>">Schlusstext:</td>
|
|
|
581 |
<td bgcolor="#<?php echo $webs["bgcolor_rechts"]
|
|
|
582 |
?>"><?= nl2br( $Verteiler[$Verteiler_NR]["Schlusstext"] );
|
|
|
583 |
?></td>
|
|
|
584 |
</tr>
|
|
|
585 |
<?php
|
|
|
586 |
}
|
|
|
587 |
?>
|
|
|
588 |
<?php
|
|
|
589 |
if ( isset( $user_rechte[modul_name][tool_name]["attachments"] ) )
|
|
|
590 |
{
|
|
|
591 |
?>
|
|
|
592 |
<script language="javascript">
|
|
|
593 |
function addAttach()
|
|
|
594 |
{
|
|
|
595 |
source=document.getElementById("attachment")
|
|
|
596 |
clone=source.cloneNode(true);
|
|
|
597 |
clone.removeAttribute("id");
|
|
|
598 |
|
|
|
599 |
source.parentNode.appendChild(clone);
|
|
|
600 |
}
|
|
|
601 |
|
|
|
602 |
function removeAttach(obj)
|
|
|
603 |
{
|
|
|
604 |
div = obj.parentNode;
|
|
|
605 |
td = obj.parentNode.parentNode;
|
|
|
606 |
if (!div.id) { td.removeChild(div); }
|
|
|
607 |
}
|
|
|
608 |
</script>
|
|
|
609 |
<tr>
|
|
|
610 |
<td bgcolor="#<?php echo $webs["bgcolor_links"]
|
|
|
611 |
?>" class="headline" valign="top" width="20%"><font color="#<?php echo $webs["font_color_links"]
|
|
|
612 |
?>">Dateianhänge:</td>
|
|
|
613 |
<td bgcolor="#<?php echo $webs["bgcolor_rechts"]
|
|
|
614 |
?>">
|
|
|
615 |
<div id="attachment">
|
|
|
616 |
|
|
|
617 |
<input type="file" name="attach[]">
|
|
|
618 |
<input type="button" value=" + " onClick="addAttach()">
|
|
|
619 |
<input type="button" value=" - " onClick="removeAttach(this)">
|
|
|
620 |
</div>
|
|
|
621 |
</td>
|
|
|
622 |
</tr>
|
|
|
623 |
<?php
|
|
|
624 |
}
|
|
|
625 |
|
|
|
626 |
$shops_ID = getShopsIdFromTemplateURL( $Verteiler[$_GET['Verteiler_NR']]['Template_URL'] );
|
|
|
627 |
?>
|
|
|
628 |
<tr align="right">
|
|
|
629 |
<td bgcolor="#<?php echo $webs["bgcolor_links"]
|
|
|
630 |
?>" class="headline" colspan="2">
|
|
|
631 |
<input type="hidden" name="shops_ID" value="<?php echo $shops_ID;
|
|
|
632 |
?>">
|
|
|
633 |
<input type="hidden" name="smtp_server" value="<?php echo $Verteiler[$_GET['Verteiler_NR']]['smtp_server'];
|
|
|
634 |
?>">
|
|
|
635 |
<input type="hidden" name="smtp_user" value="<?php echo $Verteiler[$_GET['Verteiler_NR']]['smtp_user'];
|
|
|
636 |
?>">
|
|
|
637 |
<input type="hidden" name="smtp_pass" value="<?php echo $Verteiler[$_GET['Verteiler_NR']]['smtp_pass'];
|
|
|
638 |
?>">
|
|
|
639 |
<input type="hidden" name="smtp_authed" value="<?php echo $Verteiler[$_GET['Verteiler_NR']]['smtp_authed'];
|
|
|
640 |
?>">
|
|
|
641 |
<input type="submit" name="action" value="Abschicken">
|
|
|
642 |
<input type="reset" value="Zurücksetzen">
|
|
|
643 |
</td>
|
|
|
644 |
</tr>
|
|
|
645 |
</table>
|
|
|
646 |
</form>
|
|
|
647 |
</body>
|
|
|
648 |
</html>
|
|
|
649 |
|
|
|
650 |
<?php
|
|
|
651 |
function leseGutscheinvorlage( $vorlagenID )
|
|
|
652 |
{
|
|
|
653 |
require_once
|
|
|
654 |
"../Warenwirtschaft/includes/bestellungen/system/artikelDatabase.php";
|
|
|
655 |
$table = "artikel";
|
|
|
656 |
$sql = "SELECT
|
|
|
657 |
kurzbezeichnung,
|
|
|
658 |
short_line_1,
|
|
|
659 |
short_line_2,
|
|
|
660 |
preis1,
|
|
|
661 |
preis2
|
|
|
662 |
FROM
|
|
|
663 |
$table
|
|
|
664 |
WHERE
|
|
|
665 |
ID=$vorlagenID
|
|
|
666 |
";
|
|
|
667 |
//echo $sql;
|
|
|
668 |
$res = mysql_query( $sql );
|
|
|
669 |
$row = mysql_fetch_assoc( $res );
|
|
|
670 |
return $row;
|
|
|
671 |
}
|
|
|
672 |
function gen_gutschein( $row, $empfaenger, $shopID )
|
|
|
673 |
{
|
|
|
674 |
define( "FROM_BESTELLUNG", true );
|
|
|
675 |
require_once "../marketing/gutscheine.php";
|
|
|
676 |
$_POST["gen_pdf"] = false;
|
|
|
677 |
$_POST["gs_shop"] = 0;
|
|
|
678 |
$_POST["gs_anfangswert"] = $row["preis1"];
|
|
|
679 |
$_POST["gs_minbestwert"] = $row["preis2"];
|
| 2 |
lars |
680 |
$_POST["gs_name"] = ( $row["short_line_1"] ) ? $row["short_line_1"] : $row["kurzbezeichnung"];
|
| 1 |
lars |
681 |
$_POST["gs_empfaenger"] = $empfaenger;
|
|
|
682 |
$_POST["gs_gueltig_von"] = date( "d.m.Y" );
|
|
|
683 |
$_POST["gs_gueltig_bis"] = date( "d.m.Y", strtotime( $row["short_line_2"] .
|
|
|
684 |
" days" ) );
|
|
|
685 |
$_POST["gs_status"] = 1;
|
|
|
686 |
$gs = insert_into_gutscheine();
|
|
|
687 |
return $gs;
|
|
|
688 |
}
|
|
|
689 |
?>
|