#44 new register form

main
Philip Häusler 13 years ago
parent ce7f071c38
commit d1078f60fd

@ -30,7 +30,7 @@ function admin_news() {
$news["Text"] . "</textarea></td></tr>\n"; $news["Text"] . "</textarea></td></tr>\n";
$html .= " <tr><td>Engel</td><td>" . $html .= " <tr><td>Engel</td><td>" .
UID2Nick($news["UID"]) . "</td></tr>\n"; UID2Nick($news["UID"]) . "</td></tr>\n";
$html .= " <tr><td>Treffen</td><td>" . html_select_key('eTreffen', array ( $html .= " <tr><td>Treffen</td><td>" . html_select_key('eTreffen', 'eTreffen', array (
'1' => "Ja", '1' => "Ja",
'0' => "Nein" '0' => "Nein"
), $news['Treffen']) . "</td></tr>\n"; ), $news['Treffen']) . "</td></tr>\n";

@ -244,7 +244,7 @@ function admin_shifts() {
unset ($_SESSION['admin_shifts_types']); unset ($_SESSION['admin_shifts_types']);
} }
$room_select = html_select_key('rid', $room_array, $_REQUEST['rid']); $room_select = html_select_key('rid', 'rid', $room_array, $_REQUEST['rid']);
$angel_types = ""; $angel_types = "";
foreach ($types as $type) { foreach ($types as $type) {
$angel_types .= template_render('../templates/admin_shifts_angel_types.html', array ( $angel_types .= template_render('../templates/admin_shifts_angel_types.html', array (

@ -56,7 +56,7 @@ function admin_user() {
"<input type=\"text\" size=\"40\" name=\"ejabber\" value=\"" . "<input type=\"text\" size=\"40\" name=\"ejabber\" value=\"" .
mysql_result($Erg, 0, "jabber") . "\"></td></tr>\n"; mysql_result($Erg, 0, "jabber") . "\"></td></tr>\n";
$html .= " <tr><td>Size</td><td>" . $html .= " <tr><td>Size</td><td>" .
html_select_key('size', array ( html_select_key('size', 'size', array (
'S' => "S", 'S' => "S",
'M' => "M", 'M' => "M",
'L' => "L", 'L' => "L",

@ -3,7 +3,9 @@
// Engel registrieren // Engel registrieren
function guest_register() { function guest_register() {
/* global $tshirt_sizes, $enable_tshirt_size;
$msg = "";
$nick = ""; $nick = "";
$lastname = ""; $lastname = "";
$prename = ""; $prename = "";
@ -12,215 +14,121 @@ function guest_register() {
$dect = ""; $dect = "";
$mobile = ""; $mobile = "";
$mail = ""; $mail = "";
$icq = "";
return page(array ( $jabber = "";
Get_Text("makeuser_text1"), $hometown = "";
form(array ( $comment = "";
form_text('nick', Get_Text("makeuser_Nickname") . "*", $nick), $tshirt_size = 'S';
form_text('lastname', Get_Text("makeuser_Nachname"), $lastname), $password_hash = "";
form_text('lastname', Get_Text("makeuser_Vorname"), $lastname),
form_text('age', Get_Text("makeuser_Alter"), $age), if (isset ($_REQUEST['submit'])) {
form_text('tel', Get_Text("makeuser_Telefon"), $tel), $ok = true;
form_text('dect', Get_Text("makeuser_DECT"), $tel),
form_text('mobile', Get_Text("makeuser_Handy"), $mobile), if (isset ($_REQUEST['nick']) && strlen(strip_request_item('nick')) > 1) {
form_text('mail', Get_Text("makeuser_E-Mail") . "*", $mail), $nick = strip_request_item('nick');
info(Get_Text("makeuser_text3"), true), if (sql_num_query("SELECT * FROM `User` WHERE `Nick`='" . sql_escape($nick) . "' LIMIT 1") > 0) {
form_submit('submit', Get_Text("makeuser_Anmelden")) $ok = false;
)) $msg .= error(sprintf(Get_Text("makeuser_error_nick1") . "%s" . Get_Text("makeuser_error_nick3"), $nick), true);
)); }
*/
global $SubscribeMailinglist, $enable_tshirt_size;
$html = "";
$success = "none";
if (isset ($_POST["send"])) {
$eNick = trim($_POST["Nick"]);
if ($_POST["Alter"] == "")
$_POST["Alter"] = 23;
// user vorhanden?
$Ergans = sql_select("SELECT UID FROM `User` WHERE `Nick`='" . sql_escape($_POST["Nick"]) . "'");
if (strlen($_POST["Nick"]) < 2)
$error = Get_Text("makeuser_error_nick1") . $_POST["Nick"] . Get_Text("makeuser_error_nick2");
elseif (count($Ergans) > 0) $error = Get_Text("makeuser_error_nick1") . $_POST["Nick"] . Get_Text("makeuser_error_nick3");
elseif (strlen($_POST["email"]) <= 6 && strstr($_POST["email"], "@") == FALSE && strstr($_POST["email"], ".") == false) $error = Get_Text("makeuser_error_mail");
elseif (!is_numeric($_POST["Alter"])) $error = Get_Text("makeuser_error_Alter");
elseif ($_POST["Passwort"] != $_POST["Passwort2"]) $error = Get_Text("makeuser_error_password1");
elseif (strlen($_POST["Passwort"]) < 6) $error = Get_Text("makeuser_error_password2");
else {
$_POST["Passwort"] = PassCrypt($_POST["Passwort"]);
unset ($_POST["Passwort2"]);
$Erg = sql_query("INSERT INTO `User` (" .
"`Nick` , " . "`Name` , " .
"`Vorname`, " . "`Alter` , " .
"`Telefon`, " . "`DECT`, " .
"`Handy`, " . "`email`, " .
"`ICQ`, " . "`jabber`, " .
"`Size`, " . "`Passwort`, " .
"`Art` , " . "`kommentar`, " .
"`Hometown`," . "`CreateDate`, `Sprache` ) " .
"VALUES ( '" . sql_escape($_POST["Nick"]) . "', " . "'" . sql_escape($_POST["Name"]) . "', " . "'" . sql_escape($_POST["Vorname"]) . "', " . "'" . sql_escape($_POST["Alter"]) . "', " . "'" . sql_escape($_POST["Telefon"]) . "', " . "'" . sql_escape($_POST["DECT"]) . "', " . "'" . sql_escape($_POST["Handy"]) . "', " . "'" . sql_escape($_POST["email"]) . "', " . "'" . sql_escape($_POST["ICQ"]) . "', " . "'" . sql_escape($_POST["jabber"]) . "', " . "'" . sql_escape($_POST["Size"]) . "', " . "'" . sql_escape($_POST["Passwort"]) . "', " . "'" . sql_escape($_POST["Art"]) . "', " . "'" . sql_escape($_POST["kommentar"]) . "', " . "'" . sql_escape($_POST["Hometown"]) . "'," . "NOW(), '" . sql_escape($_SESSION["Sprache"]) . "')");
if ($Erg != 1) {
$html .= Get_Text("makeuser_error_write1") . "<br />\n";
$error = sql_error();
} else { } else {
$html .= "<p class=\"success\">" . Get_Text("makeuser_writeOK") . "\n"; $ok = false;
$msg .= error(sprintf(Get_Text("makeuser_error_nick1") . "%s" . Get_Text("makeuser_error_nick2"), strip_request_item('nick')), true);
// Assign user-group }
sql_query("INSERT INTO `UserGroups` SET `uid`=" . sql_escape(sql_id()) . ", `group_id`=-2");
$html .= Get_Text("makeuser_writeOK2") . "<br />\n";
$html .= "<h1>" . Get_Text("makeuser_writeOK3") . "</h1>\n";
$html .= Get_Text("makeuser_writeOK4") . "</p><p></p>\n<br /><br />\n";
$success = "any";
if (isset ($SubscribeMailinglist)) { if (isset ($_REQUEST['mail']) && strlen(strip_request_item('mail')) > 0) {
if ($_POST["subscribe-mailinglist"] == "") { $mail = strip_request_item('mail');
$headers = "From: " . $_POST["email"] . "\r\n" . if (!check_email($mail)) {
"X-Mailer: PHP/" . phpversion(); $ok = false;
mail($SubscribeMailinglist, "subject", "message", $headers); $msg .= error(Get_Text("makeuser_error_mail"), true);
} }
} else {
$ok = false;
$msg .= error("Please enter your e-mail.", true);
} }
if (isset ($_REQUEST['icq']))
$icq = strip_request_item('icq');
if (isset ($_REQUEST['jabber']) && strlen(strip_request_item('jabber')) > 0) {
$jabber = strip_request_item('jabber');
if (!check_email($jabber)) {
$ok = false;
$msg .= error("Please check your jabber.", true);
} }
} }
if (isset ($error)) if (isset ($_REQUEST['tshirt_size']) && isset ($tshirt_sizes[$_REQUEST['tshirt_size']]))
$html .= error($error, true); $tshirt_size = $_REQUEST['tshirt_size'];
} else { else {
// init vars $ok = false;
$_POST["Nick"] = "";
$_POST["Name"] = "";
$_POST["Vorname"] = "";
$_POST["Alter"] = "";
$_POST["Telefon"] = "";
$_POST["DECT"] = "";
$_POST["Handy"] = "";
$_POST["email"] = "";
$_POST["subscribe-mailinglist"] = "";
$_POST["ICQ"] = "";
$_POST["jabber"] = "";
$_POST["Size"] = "L";
$_POST["Art"] = "";
$_POST["kommentar"] = "";
$_POST["Hometown"] = "";
} }
if ($success == "none") { if (isset ($_REQUEST['password']) && strlen($_REQUEST['password']) >= 6) {
$html .= "<h1>" . Get_Text("makeuser_text0") . "</h1>\n"; if ($_REQUEST['password'] == $_REQUEST['password2']) {
$html .= "<h2>" . Get_Text("makeuser_text1") . "</h2>\n"; $password_hash = PassCrypt($_REQUEST['password']);
$html .= "<form action=\"\" method=\"post\">\n"; } else {
$html .= "<table>\n"; $ok = false;
$html .= "<tr><td>" . Get_Text("makeuser_Nickname") . "*</td><td><input type=\"text\" size=\"40\" name=\"Nick\" value=\"" . $_POST["Nick"] . "\" /></td></tr>\n"; $msg .= error(Get_Text("makeuser_error_password1"), true);
$html .= "<tr><td>" . Get_Text("makeuser_Nachname") . "</td><td><input type=\"text\" size=\"40\" name=\"Name\" value=\"" . $_POST["Name"] . "\" /></td></tr>\n"; }
$html .= "<tr><td>" . Get_Text("makeuser_Vorname") . "</td><td><input type=\"text\" size=\"40\" name=\"Vorname\" value=\"" . $_POST["Vorname"] . "\" /></td></tr>\n"; } else {
$html .= "<tr><td>" . Get_Text("makeuser_Alter") . "</td><td><input type=\"text\" size=\"40\" name=\"Alter\" value=\"" . $_POST["Alter"] . "\"></td></tr>\n"; $ok = false;
$html .= "<tr><td>" . Get_Text("makeuser_Telefon") . "</td><td><input type=\"text\" size=\"40\" name=\"Telefon\" value=\"" . $_POST["Telefon"] . "\"></td></tr>\n"; $msg .= error(Get_Text("makeuser_error_password2"), true);
$html .= "<tr><td>" . Get_Text("makeuser_DECT") . "</td><td><input type=\"text\" size=\"40\" name=\"DECT\" value=\"" . $_POST["DECT"] . "\"></td><td>\n";
$html .= "<!--a href=\"https://21c3.ccc.de/wiki/index.php/POC\"><img src=\"./pic/external.png\" alt=\"external: \">DECT</a--></td></tr>\n";
$html .= "<tr><td>" . Get_Text("makeuser_Handy") . "</td><td><input type=\"text\" size=\"40\" name=\"Handy\" value=\"" . $_POST["Handy"] . "\"></td></tr>\n";
$html .= "<tr><td>" . Get_Text("makeuser_E-Mail") . "*</td><td><input type=\"text\" size=\"40\" name=\"email\" value=\"" . $_POST["email"] . "\"></td></tr>\n";
if (isset ($SubscribeMailinglist))
$html .= "<tr><td>" . Get_Text("makeuser_subscribe-mailinglist") . "</td><td><input type=\"checkbox\" name=\"subscribe-mailinglist\" value=\"" . $_POST["subscribe-mailinglist"] . "\">($SubscribeMailinglist)</td></tr>\n";
$html .= "<tr><td>ICQ</td><td><input type=\"text\" size=\"40\" name=\"ICQ\" value=\"" . $_POST["ICQ"] . "\"></td></tr>\n";
$html .= "<tr><td>jabber</td><td><input type=\"text\" size=\"40\" name=\"jabber\" value=\"" . $_POST["jabber"] . "\"></td></tr>\n";
if ($enable_tshirt_size) {
$html .= "<tr><td>" . Get_Text("makeuser_T-Shirt") . " Gr&ouml;sse*</td><td align=\"left\">\n";
$html .= "<select name=\"Size\">\n";
$html .= "<option value=\"S\"";
if ($_POST["Size"] == "S")
$html .= " selected";
$html .= ">S</option>\n";
$html .= "<option value=\"M\"";
if ($_POST["Size"] == "M")
$html .= " selected";
$html .= ">M</option>\n";
$html .= "<option value=\"L\"";
if ($_POST["Size"] == "L")
$html .= " selected";
$html .= ">L</option>\n";
$html .= "<option value=\"XL\"";
if ($_POST["Size"] == "XL")
$html .= " selected";
$html .= ">XL</option>\n";
$html .= "<option value=\"2XL\"";
if ($_POST["Size"] == "2XL")
$html .= " selected";
$html .= ">2XL</option>\n";
$html .= "<option value=\"3XL\"";
if ($_POST["Size"] == "3XL")
$html .= " selected";
$html .= ">3XL</option>\n";
$html .= "<option value=\"4XL\"";
if ($_POST["Size"] == "4XL")
$html .= " selected";
$html .= ">4XL</option>\n";
$html .= "<option value=\"5XL\"";
if ($_POST["Size"] == "5XL")
$html .= " selected";
$html .= ">5XL</option>\n";
$html .= "<option value=\"S-G\"";
if ($_POST["Size"] == "S-G")
$html .= " selected";
$html .= ">S Girl</option>\n";
$html .= "<option value=\"M-G\"";
if ($_POST["Size"] == "M-G")
$html .= " selected";
$html .= ">M Girl</option>\n";
$html .= "<option value=\"L-G\"";
if ($_POST["Size"] == "L-G")
$html .= " selected";
$html .= ">L Girl</option>\n";
$html .= "<option value=\"XL-G\"";
if ($_POST["Size"] == "XL-G")
$html .= " selected";
$html .= ">XL Girl</option>\n";
$html .= "</select>\n";
$html .= "</td></tr>\n";
} }
$html .= "<tr><td>" . Get_Text("makeuser_Engelart") . "</td><td align=\"left\">\n";
$html .= "<select name=\"Art\">\n";
$engel_types = sql_select("SELECT * FROM `AngelTypes` ORDER BY `name`"); // Trivia
foreach ($engel_types as $engel_type) { if (isset ($_REQUEST['lastname']))
$Name = $engel_type['name'] . Get_Text("inc_schicht_engel"); $lastname = strip_request_item('lastname');
$html .= "<option value=\"" . $Name . "\""; if (isset ($_REQUEST['prename']))
$prename = strip_request_item('prename');
if (isset ($_REQUEST['age']) && preg_match("/^[0-9]{0,4}$/", $_REQUEST['age']))
$age = strip_request_item('age');
if (isset ($_REQUEST['tel']))
$tel = strip_request_item('tel');
if (isset ($_REQUEST['dect']))
$dect = strip_request_item('dect');
if (isset ($_REQUEST['mobile']))
$mobile = strip_request_item('mobile');
if (isset ($_REQUEST['hometown']))
$hometown = strip_request_item('hometown');
if (isset ($_REQUEST['comment']))
$comment = strip_request_item_nl('comment');
if ($ok) {
sql_query("INSERT INTO `User` SET `Nick`='" . sql_escape($nick) . "', `Vorname`='" . sql_escape($prename) . "', `Name`='" . sql_escape($lastname) .
"', `Alter`='" . sql_escape($age) . "', `Telefon`='" . sql_escape($tel) . "', `DECT`='" . sql_escape($dect) . "', `Handy`='" . sql_escape($mobile) .
"', `email`='" . sql_escape($mail) . "', `ICQ`='" . sql_escape($icq) . "', `jabber`='" . sql_escape($jabber) . "', `Size`='" . sql_escape($tshirt_size) .
"', `Passwort`='" . sql_escape($password_hash) . "', `kommentar`='" . sql_escape($comment) . "', `Hometown`='" . sql_escape($hometown) . "', `CreateDate`=NOW(), `Sprache`='" . sql_escape($_SESSION["Sprache"]) . "'");
if ($_POST["Art"] == $Name) // Assign user-group
$html .= " selected"; sql_query("INSERT INTO `UserGroups` SET `uid`=" . sql_escape(sql_id()) . ", `group_id`=-2");
$html .= ">$Name</option>\n"; success(Get_Text("makeuser_writeOK4"));
redirect(page_link_to('login'));
} }
$html .= "</select>\n";
$html .= "</td>\n";
$html .= "</tr>\n";
$html .= "<tr>\n";
$html .= "<td>" . Get_Text("makeuser_text2") . "</td>\n";
$html .= "<td><textarea rows=\"5\" cols=\"40\" name=\"kommentar\">" . $_POST["kommentar"] . "</textarea></td>\n";
$html .= "</tr>\n";
$html .= "<tr><td>" . Get_Text("makeuser_Hometown") . "</td><td><input type=\"text\" size=\"40\" name=\"Hometown\" value=\"" . $_POST["Hometown"] . "\"></td></tr>\n";
$html .= "<tr><td>" . Get_Text("makeuser_Passwort") . "*</td><td><input type=\"password\" size=\"40\" name=\"Passwort\"/></td></tr>\n";
$html .= "<tr><td>" . Get_Text("makeuser_Passwort2") . "*</td><td><input type=\"password\" size=\"40\" name=\"Passwort2\"/></td></tr>\n";
$html .= "<tr><td>&nbsp;</td><td><input type=\"submit\" name=\"send\" value=\"" . Get_Text("makeuser_Anmelden") . "\"/></td></tr>\n";
$html .= "</table>\n";
$html .= "</form>\n";
$html .= Get_Text("makeuser_text3");
} }
return $html;
return page(array (
Get_Text("makeuser_text1"),
$msg,
form(array (
form_text('nick', Get_Text("makeuser_Nickname") . "*", $nick),
form_text('lastname', Get_Text("makeuser_Nachname"), $lastname),
form_text('prename', Get_Text("makeuser_Vorname"), $prename),
form_text('age', Get_Text("makeuser_Alter"), $age),
form_text('tel', Get_Text("makeuser_Telefon"), $tel),
form_text('dect', Get_Text("makeuser_DECT"), $tel),
form_text('mobile', Get_Text("makeuser_Handy"), $mobile),
form_text('mail', Get_Text("makeuser_E-Mail") . "*", $mail),
form_text('icq', "ICQ", $icq),
form_text('jabber', "Jabber", $jabber),
form_text('hometown', Get_Text("makeuser_Hometown"), $hometown),
$enable_tshirt_size ? form_select('tshirt_size', Get_Text("makeuser_T-Shirt"), $tshirt_sizes, $tshirt_size) : '',
form_textarea('comment', Get_Text("makeuser_text2"), $comment),
form_password('password', Get_Text("makeuser_Passwort")),
form_password('password2', Get_Text("makeuser_Passwort2")),
info(Get_Text("makeuser_text3"), true),
form_submit('submit', Get_Text("makeuser_Anmelden"))
))
));
} }
function guest_logout() { function guest_logout() {
@ -230,44 +138,55 @@ function guest_logout() {
function guest_login() { function guest_login() {
global $user; global $user;
$msg = "";
$nick = "";
unset ($_SESSION['uid']); unset ($_SESSION['uid']);
$html = ""; if (isset ($_REQUEST['submit'])) {
if (isset ($_REQUEST['login_submit'])) { $ok = true;
$login_user = sql_select("SELECT * FROM `User` WHERE `Nick`='" . sql_escape($_REQUEST["user"]) . "'");
if (count($login_user) == 1) { // Check, ob User angemeldet wird... if (isset ($_REQUEST['nick']) && strlen(strip_request_item('nick')) > 0) {
$nick = strip_request_item('nick');
$login_user = sql_select("SELECT * FROM `User` WHERE `Nick`='" . sql_escape($nick) . "'");
if (count($login_user) > 0) {
$login_user = $login_user[0]; $login_user = $login_user[0];
if ($login_user["Passwort"] == PassCrypt($_REQUEST["password"])) { // Passwort ok... if (isset ($_REQUEST['password'])) {
if ($login_user['Passwort'] != PassCrypt($_REQUEST['password'])) {
$ok = false;
$msg .= error(Get_Text("pub_index_pass_no_ok"), true);
}
} else {
$ok = false;
$msg .= error("Please enter a password.", true);
}
} else {
$ok = false;
$msg .= error(Get_Text("pub_index_User_unset"), true);
}
} else {
$ok = false;
$msg .= error("Please enter a nickname.", true);
}
if ($ok) {
$_SESSION['uid'] = $login_user['UID']; $_SESSION['uid'] = $login_user['UID'];
$_SESSION['Sprache'] = $login_user['Sprache']; $_SESSION['Sprache'] = $login_user['Sprache'];
header("Location: " . page_link_to("news")); redirect(page_link_to('news'));
} else { // Passwort nicht ok...
$ErrorText = "pub_index_pass_no_ok";
} // Ende Passwort-Check
} else { // Anzahl der User in User-Tabelle <> 1 --> keine Anmeldung
if ($user_anz == 0)
$ErrorText = "pub_index_User_unset";
else
$ErrorText = "pub_index_User_more_as_one";
} // Ende Check, ob User angemeldet wurde}
} }
if (isset ($ErrorText))
$html .= error(Get_Text($ErrorText), true);
$html .= guest_login_form();
return $html;
} }
function guest_login_form() { return page(array (
return template_render("../templates/guest_login_form.html", array ( Get_Text("index_text1") . " " . Get_Text("index_text2") . " " . Get_Text("index_text3"),
'link' => page_link_to("login"), $msg,
'nick' => Get_Text("index_lang_nick"), msg(),
'pass' => Get_Text("index_lang_pass"), form(array (
'send' => Get_Text("index_lang_send"), form_text('nick', Get_Text("index_lang_nick"), $nick),
'text1' => Get_Text("index_text1"), form_password('password', Get_Text("index_lang_pass")),
'text2' => Get_Text("index_text2"), form_submit('submit', Get_Text("index_lang_send"))
'text3' => Get_Text("index_text3"), )),
'text4' => Get_Text("index_text4") info(Get_Text("index_text4"), true)
)); ));
} }
?> ?>

@ -25,7 +25,7 @@ function user_messages() {
foreach ($users as $u) foreach ($users as $u)
$to_select_data[$u['UID']] = $u['Nick']; $to_select_data[$u['UID']] = $u['Nick'];
$to_select = html_select_key('to', $to_select_data, ''); $to_select = html_select_key('to', 'to', $to_select_data, '');
$messages_html = ""; $messages_html = "";
$messages = sql_select("SELECT * FROM `Messages` WHERE `SUID`=" . sql_escape($user['UID']) . " OR `RUID`=" . sql_escape($user['UID']) . " ORDER BY `isRead`,`Datum` DESC"); $messages = sql_select("SELECT * FROM `Messages` WHERE `SUID`=" . sql_escape($user['UID']) . " OR `RUID`=" . sql_escape($user['UID']) . " ORDER BY `isRead`,`Datum` DESC");

@ -7,7 +7,7 @@ function user_settings() {
if ($enable_tshirt_size) if ($enable_tshirt_size)
$tshirt_html = template_render('../templates/user_settings_tshirt.html', array ( $tshirt_html = template_render('../templates/user_settings_tshirt.html', array (
'label_size' => Get_Text("makeuser_T-Shirt"), 'label_size' => Get_Text("makeuser_T-Shirt"),
'size_select' => ($user['Tshirt'] == 0) ? html_select_key('size', array ( 'size_select' => ($user['Tshirt'] == 0) ? html_select_key('size', 'size', array (
'S' => "S", 'S' => "S",
'M' => "M", 'M' => "M",
'L' => "L", 'L' => "L",
@ -57,7 +57,7 @@ function user_settings() {
'new_pw2_label' => Get_Text(17), 'new_pw2_label' => Get_Text(17),
'text_theme' => Get_Text(18), 'text_theme' => Get_Text(18),
'theme_label' => Get_Text(19), 'theme_label' => Get_Text(19),
'theme_select' => html_select_key('theme', array ( 'theme_select' => html_select_key('theme', 'theme', array (
"1" => "Standard-Style", "1" => "Standard-Style",
"2" => "ot/Gelber Style", "2" => "ot/Gelber Style",
"3" => "Club-Mate Style", "3" => "Club-Mate Style",
@ -67,11 +67,11 @@ function user_settings() {
"8" => "Pastel Style", "8" => "Pastel Style",
"4" => "Test Style", "4" => "Test Style",
"9" => "Test Style 21c3", "9" => "Test Style 21c3",
"10" => "msquare (cccamp2011)" "10" => "msquare (28C3)"
), $user['color']), ), $user['color']),
'text_language' => Get_Text(20), 'text_language' => Get_Text(20),
'language_label' => Get_Text(21), 'language_label' => Get_Text(21),
'language_select' => html_select_key('language', array ( 'language_select' => html_select_key('language', 'language', array (
'DE' => "Deutsch", 'DE' => "Deutsch",
'EN' => "English" 'EN' => "English"
), $user['Sprache']) ), $user['Sprache'])

@ -100,7 +100,7 @@ function user_shifts() {
} }
} }
$room_select = html_select_key('rid', $room_array, $rid); $room_select = html_select_key('rid', 'rid', $room_array, $rid);
$angel_types = ""; $angel_types = "";
foreach ($types as $type) { foreach ($types as $type) {
$angel_types .= template_render('../templates/admin_shifts_angel_types.html', array ( $angel_types .= template_render('../templates/admin_shifts_angel_types.html', array (
@ -196,7 +196,7 @@ function user_shifts() {
$users_select = array (); $users_select = array ();
foreach ($users as $usr) foreach ($users as $usr)
$users_select[$usr['UID']] = $usr['Nick']; $users_select[$usr['UID']] = $usr['Nick'];
$user_text = html_select_key('user_id', $users_select, $user['UID']); $user_text = html_select_key('user_id', 'user_id', $users_select, $user['UID']);
} else } else
$user_text = $user['Nick']; $user_text = $user['Nick'];

@ -39,6 +39,13 @@ function strip_item($item) {
return preg_replace("/([^\p{L}\p{P}\p{Z}\p{N}+]{1,})/ui", '', strip_tags($item)); return preg_replace("/([^\p{L}\p{P}\p{Z}\p{N}+]{1,})/ui", '', strip_tags($item));
} }
/**
* Überprüft eine E-Mail-Adresse.
*/
function check_email($email) {
return (bool) preg_match("#^([a-zA-Z0-9_\-])+(\.([a-zA-Z0-9_\-])+)*@((\[(((([0-1])?([0-9])?[0-9])|(2[0-4][0-9])|(2[0-5][0-5])))\.(((([0-1])?([0-9])?[0-9])|(2[0-4][0-9])|(2[0-5][0-5])))\.(((([0-1])?([0-9])?[0-9])|(2[0-4][0-9])|(2[0-5][0-5])))\.(((([0-1])?([0-9])?[0-9])|(2[0-4][0-9])|(2[0-5][0-5]))\]))|((([\p{L}0-9])+(([\-])+([\p{L}0-9])+)*\.)+([\p{L}])+(([\-])+([\p{L}0-9])+)*))$#u", $email);
}
/** /**
* Gibt zwischengespeicherte Fehlermeldungen zurück und löscht den Zwischenspeicher * Gibt zwischengespeicherte Fehlermeldungen zurück und löscht den Zwischenspeicher
*/ */

@ -48,6 +48,14 @@ function form_text($name, $label, $value, $disabled = false) {
return form_element($label, '<input id="form_' . $name . '" type="text" name="' . $name . '" value="' . $value . '" ' . $disabled . '/>', 'form_' . $name); return form_element($label, '<input id="form_' . $name . '" type="text" name="' . $name . '" value="' . $value . '" ' . $disabled . '/>', 'form_' . $name);
} }
/**
* Rendert ein Formular-Passwortfeld
*/
function form_password($name, $label, $disabled = false) {
$disabled = $disabled ? ' disabled="disabled"' : '';
return form_element($label, '<input id="form_' . $name . '" type="password" name="' . $name . '" value="" ' . $disabled . '/>', 'form_' . $name);
}
/** /**
* Rendert ein Formular-Textfeld * Rendert ein Formular-Textfeld
*/ */
@ -168,13 +176,15 @@ function html_options($name, $options, $selected = "") {
return $html; return $html;
} }
function html_select_key($name, $rows, $selected) { function html_select_key($id, $name, $rows, $selected) {
$html = '<select name="' . $name . '">'; $html = '<select id="' . $id . '" name="' . $name . '">';
foreach ($rows as $key => $row) foreach ($rows as $key => $row) {
if (($key == $selected) || ($row == $selected)) if (($key == $selected) || ($row == $selected)) {
$html .= '<option value="' . $key . '" selected="selected">' . $row . '</option>'; $html .= '<option value="' . $key . '" selected="selected">' . $row . '</option>';
else } else {
$html .= '<option value="' . $key . '">' . $row . '</option>'; $html .= '<option value="' . $key . '">' . $row . '</option>';
}
}
$html .= '</select>'; $html .= '</select>';
return $html; return $html;
} }

@ -1,4 +1,24 @@
<?php <?php
/**
* Available T-Shirt sizes
*/
$tshirt_sizes = array (
'S' => "S",
'M' => "M",
'L' => "L",
'XL' => "XL",
'2XL' => "2XL",
'3XL' => "3XL",
'4XL' => "4XL",
'5XL' => "5XL",
'S-G' => "S Girl",
'M-G' => "M Girl",
'L-G' => "L Girl",
'XL-G' => "XL Girl"
);
function UID2Nick($UID) { function UID2Nick($UID) {
if ($UID > 0) if ($UID > 0)
$SQL = "SELECT Nick FROM `User` WHERE UID='" . sql_escape($UID) . "'"; $SQL = "SELECT Nick FROM `User` WHERE UID='" . sql_escape($UID) . "'";

@ -316,7 +316,7 @@ tr:hover .hidden {
margin-left: 250px; margin-left: 250px;
} }
.form input[type="text"], .form textarea { .form input[type="text"], .form input[type="password"], .form textarea {
background: #fff; background: #fff;
border: 1px solid #888; border: 1px solid #888;
color: inherit; color: inherit;

@ -1,34 +0,0 @@
<p>
%text1%
</p>
<p>
%text2%
</p>
<p>
%text3%
</p>
<form action="%link%" method="post">
<table>
<tr>
<td align="right">
%nick%
</td>
<td>
<input type="text" name="user" size="23" />
</td>
</tr>
<tr>
<td align="right">
%pass%
</td>
<td>
<input type="password" name="password" size="23">
</td>
</tr>
</table>
<br/>
<input type="submit" name="login_submit" value="%send%">
</form>
<p>
%text4%
</p>
Loading…
Cancel
Save