index.php.20110202
4.38 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
<?
require_once("config_FormSaveMail.php");
header('Content-Type: text/html; charset='.$_LOSP_CHARSET);
function check_password($password) {
global $_KINDOFEMAILLIST;
return ($password == $_KINDOFEMAILLIST[$_POST['KindOfList']]['password']);
}
$DB = StorableFactory::create($_LOSP_STORABLE_KINDOF, $_LOSP_STORABLE_DATA);
if(array_key_exists($_GET['KindOfList'], $_KINDOFEMAILLIST) || array_key_exists($_POST['KindOfList'], $_KINDOFEMAILLIST)) {
if($_GET['KindOfList']) {
$var_KindOfList = $_GET['KindOfList'];
} else {
$var_KindOfList = $_POST['KindOfList'];
}
$quickform = new HTML_QuickForm2('FormSaveMail');
$quickform->addDataSource(new HTML_QuickForm2_DataSource_Array(array(
'KindOfList' => $var_KindOfList,
)));
$fsText = $quickform->addElement('fieldset')->setLabel('Registrierung');
$qf_KindOfList = $fsText->addElement('text', 'KindOfList', array('style' => 'width: 300px;'), array('label' => 'Art der Liste:'));
$qf_KindOfList->addRule('required', '<b>:-( Email ist ein Pflichtfeld!!!</b>');
$qf_Email = $fsText->addElement('text', 'Email', array('style' => 'width: 300px;'), array('label' => 'Email:'));
$qf_Email->addRule('required', '<b>:-( Email ist ein Pflichtfeld!!!</b>');
$qf_NickName = $fsText->addElement('text', 'NickName', array('style' => 'width: 300px;'), array('label' => 'NickName:'));
$qf_NickName->addRule('required', '<b>:-( NickName ist ein Pflichtfeld!!!</b>');
$fsText->addElement('text', 'FirstName', array('style' => 'width: 300px;'), array('label' => 'Vorame:'));
$fsText->addElement('text', 'SurName', array('style' => 'width: 300px;'), array('label' => 'Nachname:'));
$area = $fsText->addElement(
'textarea', 'Note', array('style' => 'width: 300px;', 'cols' => 50, 'rows' => 7),
array('label' => 'Notiz:')
);
if(is_array($_KINDOFEMAILLIST[$var_KindOfList]) && array_key_exists('password', $_KINDOFEMAILLIST[$var_KindOfList]) && $_KINDOFEMAILLIST[$var_KindOfList]['password']) {
$fsText = $quickform->addElement('fieldset')->setLabel('Passwort geschützte Liste');
$qf_Password = $fsText->addElement('password', 'pwdTest', array('style' => 'width: 300px;'), array('label' => 'Passwort:'));
$qf_Password->addRule('required', '<b>:-( Passwort ist ein Pflichtfeld!!!</b>');
$qf_Password->addRule('empty')->or_($qf_Password->createRule('callback', '<b>Passwort falsch!!!!!!!!!!</b>', 'check_password'));
}
$fsButton = $quickform->addElement('fieldset')->setLabel('Buttons');
$testReset = $fsButton->addElement( 'reset', 'testReset', array('value' => 'Abbrechen') );
$fsButton->addElement( 'button', 'SubmitButton', array('type' => 'submit'), array('content' => '<img src="logo.png" width="46" height="35" alt="pear" />Fertig') );
}
?>
<html>
<head>
<style type="text/css">
body {
margin-left: 10px;
font-family: Arial, sans-serif;
font-size: small;
}
.quickform {
min-width: 350px;
max-width: 600px;
width: 350px;
}
</style>
<title>EMail Liste "<?=$var_KindOfList?>"</title>
</head>
<body>
<?
if($quickform) {
?>
<h2>EMail Liste "<?=$var_KindOfList?>"</h2>
<?
if ($quickform->validate()) {
$var_bindValueArray = array(
':NickName' => $_POST['NickName'],
':EMail' => $_POST['Email'],
':FirstName' => $_POST['FirstName'],
':SurName' => $_POST['SurName'],
':Text' => $_POST['Note'],
':KindOfList' => $_POST['KindOfList'],
);
$var_query = 'SELECT tool_insertEmailToList(:NickName, :EMail, :FirstName, :SurName, :Text, :KindOfList) AS ID';
$stmt = $DB->PDO_query($var_query, $var_bindValueArray);
$row = $DB->PDO_getResultRow($stmt);
if($row['ID']) {
echo ':-) '.$_POST['Email'].' wurde erfolgreich in die '.$var_KindOfList.' Liste eingetragen';
$param_subject = '[mensch.coop][maillist]['.$var_KindOfList.'] '.$_POST['Email'].'';
$param_message = ":-) ".$_POST['Email']." wurde erfolgreich in die ".$var_KindOfList." Liste eingetragen \n\n
\t NickName = ".$_POST['NickName']." \n
\t EMail = ".$_POST['Email']." \n
\t FirstName = ".$_POST['FirstName']." \n
\t SurName = ".$_POST['SurName']." \n
\t Text = ".$_POST['Note']." \n
\t KindOfList = ".$_POST['KindOfList']." \n
";
mail($_TOOL_MAILADMIN, $param_subject, $param_message);
} else {
echo ':-( '.$_POST['Email'].' wurde nicht erfolgreich in die '.$var_KindOfList.' Liste eingetragen';
D::show($var_bindValueArray);
}
} else {
echo $quickform;
}
}
?>
</body>
</html>