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

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
12
13
14
define('PORTAL', get_post_data_by_key('portal'));

switch ( PORTAL ) {
  case 'onmeda':
15
16
17
18
19
    $template_contents = file_get_contents('templates/onmeda.de.html');
    break;

  case 'bildderfrau':
    $template_contents = file_get_contents('templates/bildderfrau.html');
20
21
22
23
24
25
26
27
28
    break;

  default:
    if ( get_post_data_by_key('newsgif') === '' )
      $template_contents = file_get_contents('templates/gofeminin_without_newsgif.html');
    else
      $template_contents = file_get_contents('templates/gofeminin.html');
    break;
}
Marco Kellershoff's avatar
Marco Kellershoff committed
29
30
31
32
33
34
35
36
37
38
39

$template_contents = str_replace(
  array(
    '{{firstname}}',
    '{{lastname}}',
    '{{jobtitle}}',
    '{{email}}',
    '{{telephone}}',
    '{{fax}}'
  ),
  array(
40
41
42
43
44
45
    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'),
    get_post_data_by_key('fax')
Marco Kellershoff's avatar
Marco Kellershoff committed
46
47
48
49
50
51
52
53
54
55
56
  ),
  $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');
57
    echo "\xEF\xBB\xBF"; // UTF-8 BOM
Marco Kellershoff's avatar
Marco Kellershoff committed
58
59
60
61
62
  } else {
    header('Content-Type: text/html, charset=utf-8');
  }
  echo $template_contents;
?>