sig.php 2.11 KB
Newer Older
1
y<?php
Marco Kellershoff's avatar
Marco Kellershoff committed
2

3
4
5
6
7
8
9
function get_post_data_by_key ( $key ) {
  if ( isset ($_POST[ $key ] ) )
    return $_POST[ $key ];
  else
    return '';
};

Marco Kellershoff's avatar
Marco Kellershoff committed
10
define('FILENAME','signature.html');
11
define('PORTAL', get_post_data_by_key('portal'));
12
13
$newsContent = "";
$news = false;
14
15
switch ( PORTAL ) {
  case 'onmeda':
16
17
    $template_contents = file_get_contents('templates/onmeda.de.html');
    break;
18
  default:
19
20
21
22
23
24
25
26
    if ( get_post_data_by_key('dmexco2015') === 'true' ) {
        $template_contents = file_get_contents('templates/gofeminin_dmexco_2016.html');
        
        if ( get_post_data_by_key('newsgif') !== '' ) {
            $newsContent = "<tr><td width=\"100%\" style=\"max-widht:600px;\" align=\"left\"><a href=\"http://www.gofeminin.de/\" target=\"_blank\"><img src=\"http://www.gofeminin.de/reloaded/emailSignature.gif\" border=\"0\" /></a></td></tr>";
        }
        
    } else if ( get_post_data_by_key('newsgif') === '' ) {
27
      $template_contents = file_get_contents('templates/gofeminin_without_newsgif.html');
28
    } else {
29
      $template_contents = file_get_contents('templates/gofeminin.html');
30
    }
31
32
    break;
}
Marco Kellershoff's avatar
Marco Kellershoff committed
33
34
35
36
37
38
39
40

$template_contents = str_replace(
  array(
    '{{firstname}}',
    '{{lastname}}',
    '{{jobtitle}}',
    '{{email}}',
    '{{telephone}}',
41
42
    '{{fax}}',
      '<!-- NEWS_GIF -->'
Marco Kellershoff's avatar
Marco Kellershoff committed
43
44
  ),
  array(
45
46
47
48
49
    get_post_data_by_key('firstname'),
    get_post_data_by_key('lastname'),
    get_post_data_by_key('jobtitle'),
    get_post_data_by_key('email'),
    get_post_data_by_key('telephone'),
50
51
    get_post_data_by_key('fax'),
    $newsContent
Marco Kellershoff's avatar
Marco Kellershoff committed
52
53
54
55
56
57
58
59
60
61
62
  ),
  $template_contents
);

  if( $_POST['genfile'] === "true" ) {
    header('Expires: 0');
    header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
    header('Content-Type: application/force-download, charset=utf-8');
    header('Content-Description: File Transfer');
    header('Content-Disposition: attachment; filename='.FILENAME);
    header('Content-Transfer-Encoding: binary');
63
    echo "\xEF\xBB\xBF"; // UTF-8 BOM
Marco Kellershoff's avatar
Marco Kellershoff committed
64
  } else {
Marco Kellershoff's avatar
Fix IE?    
Marco Kellershoff committed
65
    header('Content-Disposition: inline; filename='.FILENAME);
Marco Kellershoff's avatar
Marco Kellershoff committed
66
67
68
69
    header('Content-Type: text/html, charset=utf-8');
  }
  echo $template_contents;
?>