Merge branch 'master' of github.com:engelsystem/engelsystem

This commit is contained in:
Felix Favre 2014-12-06 19:02:26 +01:00
commit 2f445eb90c
12 changed files with 365 additions and 327 deletions

View File

@ -1,3 +1,9 @@
/* cleanup */
ALTER TABLE `User` DROP `ICQ` ;
/* opt-in field for user shiftinfo mails */
ALTER TABLE `User` ADD `email_shiftinfo` BOOLEAN NOT NULL DEFAULT FALSE COMMENT 'User wants to be informed by mail about changes in his shifts' AFTER `email` ;
/* fix questions */ /* fix questions */
ALTER TABLE `Questions` CHANGE `AID` `AID` INT( 11 ) NULL DEFAULT NULL ; ALTER TABLE `Questions` CHANGE `AID` `AID` INT( 11 ) NULL DEFAULT NULL ;

View File

@ -63,7 +63,7 @@ getUser
id (integer) - User ID id (integer) - User ID
Return Example: Return Example:
[{"UID":"1"},{"UID":"23"},{"UID":"42"}] [{"UID":"1"},{"UID":"23"},{"UID":"42"}]
{"UID":"1","Nick":"admin","Name":"Gates","Vorname":"Bill","Telefon":"","DECT":"","Handy":"","email":"","ICQ":"","jabber":"","Avatar":"115"} {"UID":"1","Nick":"admin","Name":"Gates","Vorname":"Bill","Telefon":"","DECT":"","Handy":"","email":"","jabber":"","Avatar":"115"}
getShift getShift
Description: Description:

View File

@ -5,14 +5,18 @@
*/ */
function user_angeltypes_unconfirmed_hint() { function user_angeltypes_unconfirmed_hint() {
global $user; global $user;
$unconfirmed_user_angeltypes = User_unconfirmed_AngelTypes($user); $unconfirmed_user_angeltypes = User_unconfirmed_AngelTypes($user);
if ($unconfirmed_user_angeltypes === false) if ($unconfirmed_user_angeltypes === false)
engelsystem_error("Unable to load user angeltypes."); engelsystem_error("Unable to load user angeltypes.");
if (count($unconfirmed_user_angeltypes) == 0) if (count($unconfirmed_user_angeltypes) == 0)
return ''; return '';
if ($_REQUEST['p'] == 'angeltypes' && $_REQUEST['action'] == 'view' && $_REQUEST['angeltype_id'] == $unconfirmed_user_angeltypes[0]['angeltype_id'])
return ''; $unconfirmed_links = [];
return error(sprintf(ngettext("There is %d unconfirmed angeltype.", "There are %d unconfirmed angeltypes.", count($unconfirmed_user_angeltypes)), count($unconfirmed_user_angeltypes)) . " " . sprintf(_("The first wants to join %s."), '<a href="' . page_link_to('angeltypes') . '&action=view&angeltype_id=' . $unconfirmed_user_angeltypes[0]['angeltype_id'] . '">' . $unconfirmed_user_angeltypes[0]['name'] . '</a>')); foreach ($unconfirmed_user_angeltypes as $user_angeltype)
$unconfirmed_links[] = '<a href="' . page_link_to('angeltypes') . '&action=view&angeltype_id=' . $user_angeltype['angeltype_id'] . '">' . $user_angeltype['name'] . '</a>';
return error(sprintf(ngettext("There is %d unconfirmed angeltype.", "There are %d unconfirmed angeltypes.", count($unconfirmed_user_angeltypes)), count($unconfirmed_user_angeltypes)) . " " . _('Angel types which need approvals:') . ' ' . join(', ', $unconfirmed_links));
} }
/** /**

View File

@ -23,6 +23,7 @@ function User_unconfirmed_AngelTypes($user) {
JOIN `AngelTypes` ON `UserAngelTypes`.`angeltype_id`=`AngelTypes`.`id` JOIN `AngelTypes` ON `UserAngelTypes`.`angeltype_id`=`AngelTypes`.`id`
JOIN `UserAngelTypes` as `UnconfirmedMembers` ON `UserAngelTypes`.`angeltype_id`=`UnconfirmedMembers`.`angeltype_id` JOIN `UserAngelTypes` as `UnconfirmedMembers` ON `UserAngelTypes`.`angeltype_id`=`UnconfirmedMembers`.`angeltype_id`
WHERE `UserAngelTypes`.`user_id`=" . sql_escape($user['UID']) . " WHERE `UserAngelTypes`.`user_id`=" . sql_escape($user['UID']) . "
AND `UserAngelTypes`.`coordinator`=TRUE
AND `AngelTypes`.`restricted`=TRUE AND `AngelTypes`.`restricted`=TRUE
AND `UnconfirmedMembers`.`confirm_user_id` IS NULL"); AND `UnconfirmedMembers`.`confirm_user_id` IS NULL");
} }

View File

@ -132,7 +132,7 @@ function User($id) {
* @param $id UID * @param $id UID
*/ */
function mUser_Limit($id) { function mUser_Limit($id) {
$user_source = sql_select("SELECT `UID`, `Nick`, `Name`, `Vorname`, `Telefon`, `DECT`, `Handy`, `email`, `ICQ`, `jabber`, `Avatar` FROM `User` WHERE `UID`=" . sql_escape($id) . " LIMIT 1"); $user_source = sql_select("SELECT `UID`, `Nick`, `Name`, `Vorname`, `Telefon`, `DECT`, `Handy`, `email`, `jabber`, `Avatar` FROM `User` WHERE `UID`=" . sql_escape($id) . " LIMIT 1");
if ($user_source === false) if ($user_source === false)
return false; return false;
if (count($user_source) > 0) if (count($user_source) > 0)

View File

@ -33,7 +33,7 @@ function admin_user() {
$html .= " <tr><td>Handy</td><td>" . "<input type=\"text\" size=\"40\" name=\"eHandy\" value=\"" . $user_source['Handy'] . "\"></td></tr>\n"; $html .= " <tr><td>Handy</td><td>" . "<input type=\"text\" size=\"40\" name=\"eHandy\" value=\"" . $user_source['Handy'] . "\"></td></tr>\n";
$html .= " <tr><td>DECT</td><td>" . "<input type=\"text\" size=\"4\" name=\"eDECT\" value=\"" . $user_source['DECT'] . "\"></td></tr>\n"; $html .= " <tr><td>DECT</td><td>" . "<input type=\"text\" size=\"4\" name=\"eDECT\" value=\"" . $user_source['DECT'] . "\"></td></tr>\n";
$html .= " <tr><td>email</td><td>" . "<input type=\"text\" size=\"40\" name=\"eemail\" value=\"" . $user_source['email'] . "\"></td></tr>\n"; $html .= " <tr><td>email</td><td>" . "<input type=\"text\" size=\"40\" name=\"eemail\" value=\"" . $user_source['email'] . "\"></td></tr>\n";
$html .= " <tr><td>ICQ</td><td>" . "<input type=\"text\" size=\"40\" name=\"eICQ\" value=\"" . $user_source['ICQ'] . "\"></td></tr>\n"; $html .= "<tr><td>".form_checkbox('email_shiftinfo', _("Please send me an email if my shifts change"), $user_source['email_shiftinfo']) . "</td></tr>\n";
$html .= " <tr><td>jabber</td><td>" . "<input type=\"text\" size=\"40\" name=\"ejabber\" value=\"" . $user_source['jabber'] . "\"></td></tr>\n"; $html .= " <tr><td>jabber</td><td>" . "<input type=\"text\" size=\"40\" name=\"ejabber\" value=\"" . $user_source['jabber'] . "\"></td></tr>\n";
$html .= " <tr><td>Size</td><td>" . html_select_key('size', 'eSize', $tshirt_sizes, $user_source['Size']) . "</td></tr>\n"; $html .= " <tr><td>Size</td><td>" . html_select_key('size', 'eSize', $tshirt_sizes, $user_source['Size']) . "</td></tr>\n";
@ -236,7 +236,7 @@ function admin_user() {
`Alter` = '" . sql_escape($_POST["eAlter"]) . "', `Alter` = '" . sql_escape($_POST["eAlter"]) . "',
`DECT` = '" . sql_escape($_POST["eDECT"]) . "', `DECT` = '" . sql_escape($_POST["eDECT"]) . "',
`email` = '" . sql_escape($_POST["eemail"]) . "', `email` = '" . sql_escape($_POST["eemail"]) . "',
`ICQ` = '" . sql_escape($_POST["eICQ"]) . "', `email_shiftinfo` = " . sql_escape(isset($_REQUEST['email_shiftinfo']) ? 'TRUE' : 'FALSE') . ",
`jabber` = '" . sql_escape($_POST["ejabber"]) . "', `jabber` = '" . sql_escape($_POST["ejabber"]) . "',
`Size` = '" . sql_escape($_POST["eSize"]) . "', `Size` = '" . sql_escape($_POST["eSize"]) . "',
`Gekommen`= '" . sql_escape($_POST["eGekommen"]) . "', `Gekommen`= '" . sql_escape($_POST["eGekommen"]) . "',

View File

@ -25,7 +25,7 @@ function guest_register() {
$dect = ""; $dect = "";
$mobile = ""; $mobile = "";
$mail = ""; $mail = "";
$icq = ""; $email_shiftinfo = false;
$jabber = ""; $jabber = "";
$hometown = ""; $hometown = "";
$comment = ""; $comment = "";
@ -66,8 +66,9 @@ function guest_register() {
$msg .= error(_("Please enter your e-mail."), true); $msg .= error(_("Please enter your e-mail."), true);
} }
if (isset($_REQUEST['icq'])) if (isset($_REQUEST['email_shiftinfo']))
$icq = strip_request_item('icq'); $email_shiftinfo = true;
if (isset($_REQUEST['jabber']) && strlen(strip_request_item('jabber')) > 0) { if (isset($_REQUEST['jabber']) && strlen(strip_request_item('jabber')) > 0) {
$jabber = strip_request_item('jabber'); $jabber = strip_request_item('jabber');
if (! check_email($jabber)) { if (! check_email($jabber)) {
@ -119,7 +120,25 @@ function guest_register() {
$comment = strip_request_item_nl('comment'); $comment = strip_request_item_nl('comment');
if ($ok) { if ($ok) {
sql_query("INSERT INTO `User` SET `color`=" . sql_escape($default_theme) . ", `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["locale"]) . "'"); sql_query("
INSERT INTO `User` SET
`color`=" . sql_escape($default_theme) . ",
`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) . "',
`email_shiftinfo`=" . sql_escape($email_shiftinfo ? 'TRUE' : 'FALSE') . ",
`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["locale"]) . "'");
// Assign user-group and set password // Assign user-group and set password
$user_id = sql_id(); $user_id = sql_id();
@ -147,19 +166,20 @@ function guest_register() {
div('row', array( div('row', array(
div('col-md-6', array( div('col-md-6', array(
div('row', array( div('row', array(
div('col-md-4', array( div('col-sm-4', array(
form_text('nick', _("Nick") . ' ' . entry_required(), $nick) form_text('nick', _("Nick") . ' ' . entry_required(), $nick)
)), )),
div('col-md-8', array( div('col-sm-8', array(
form_text('mail', _("E-Mail") . ' ' . entry_required(), $mail) form_text('mail', _("E-Mail") . ' ' . entry_required(), $mail),
form_checkbox('email_shiftinfo', _("Please send me an email if my shifts change"), $email_shiftinfo)
)) ))
)), )),
$enable_tshirt_size ? form_select('tshirt_size', _("Shirt size") . ' ' . entry_required(), $tshirt_sizes, $tshirt_size) : '', $enable_tshirt_size ? form_select('tshirt_size', _("Shirt size") . ' ' . entry_required(), $tshirt_sizes, $tshirt_size) : '',
div('row', array( div('row', array(
div('col-md-6', array( div('col-sm-6', array(
form_password('password', _("Password") . ' ' . entry_required()) form_password('password', _("Password") . ' ' . entry_required())
)), )),
div('col-md-6', array( div('col-sm-6', array(
form_password('password2', _("Confirm password") . ' ' . entry_required()) form_password('password2', _("Confirm password") . ' ' . entry_required())
)) ))
)), )),
@ -168,37 +188,36 @@ function guest_register() {
)), )),
div('col-md-6', array( div('col-md-6', array(
div('row', array( div('row', array(
div('col-md-4', array( div('col-sm-4', array(
form_text('dect', _("DECT"), $dect) form_text('dect', _("DECT"), $dect)
)), )),
div('col-md-4', array( div('col-sm-4', array(
form_text('mobile', _("Mobile"), $mobile) form_text('mobile', _("Mobile"), $mobile)
)), )),
div('col-md-4', array( div('col-sm-4', array(
form_text('tel', _("Phone"), $tel) form_text('tel', _("Phone"), $tel)
)) ))
)), )),
form_text('jabber', _("Jabber"), $jabber), form_text('jabber', _("Jabber"), $jabber),
div('row', array( div('row', array(
div('col-md-6', array( div('col-sm-6', array(
form_text('prename', _("First name"), $prename) form_text('prename', _("First name"), $prename)
)), )),
div('col-md-6', array( div('col-sm-6', array(
form_text('lastname', _("Last name"), $lastname) form_text('lastname', _("Last name"), $lastname)
)) ))
)), )),
div('row', array( div('row', array(
div('col-md-3', array( div('col-sm-3', array(
form_text('age', _("Age"), $age) form_text('age', _("Age"), $age)
)), )),
div('col-md-9', array( div('col-sm-9', array(
form_text('hometown', _("Hometown"), $hometown) form_text('hometown', _("Hometown"), $hometown)
)) ))
)), )),
form_info(entry_required() . ' = ' . _("Entry required!")) form_info(entry_required() . ' = ' . _("Entry required!"))
)) ))
)), )),
// form_text('icq', _("ICQ"), $icq),
// form_textarea('comment', _("Did you help at former CCC events and which tasks have you performed then?"), $comment), // form_textarea('comment', _("Did you help at former CCC events and which tasks have you performed then?"), $comment),
form_submit('submit', _("Register")) form_submit('submit', _("Register"))
)) ))

View File

@ -1,4 +1,5 @@
<?php <?php
function settings_title() { function settings_title() {
return _("Settings"); return _("Settings");
} }
@ -16,7 +17,7 @@ function user_settings() {
$dect = $user['DECT']; $dect = $user['DECT'];
$mobile = $user['Handy']; $mobile = $user['Handy'];
$mail = $user['email']; $mail = $user['email'];
$icq = $user['ICQ']; $email_shiftinfo = $user['email_shiftinfo'];
$jabber = $user['jabber']; $jabber = $user['jabber'];
$hometown = $user['Hometown']; $hometown = $user['Hometown'];
$tshirt_size = $user['Size']; $tshirt_size = $user['Size'];
@ -59,8 +60,8 @@ function user_settings() {
$msg .= error(_("Please enter your e-mail."), true); $msg .= error(_("Please enter your e-mail."), true);
} }
if (isset($_REQUEST['icq'])) $email_shiftinfo = isset($_REQUEST['email_shiftinfo']);
$icq = strip_request_item('icq');
if (isset($_REQUEST['jabber']) && strlen(strip_request_item('jabber')) > 0) { if (isset($_REQUEST['jabber']) && strlen(strip_request_item('jabber')) > 0) {
$jabber = strip_request_item('jabber'); $jabber = strip_request_item('jabber');
if (! check_email($jabber)) { if (! check_email($jabber)) {
@ -97,7 +98,21 @@ function user_settings() {
$hometown = strip_request_item('hometown'); $hometown = strip_request_item('hometown');
if ($ok) { if ($ok) {
sql_query("UPDATE `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) . "', `Hometown`='" . sql_escape($hometown) . "' WHERE `UID`=" . sql_escape($user['UID'])); sql_query("
UPDATE `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) . "',
`email_shiftinfo`=" . sql_escape($email_shiftinfo ? 'TRUE' : 'FALSE') . ",
`jabber`='" . sql_escape($jabber) . "',
`Size`='" . sql_escape($tshirt_size) . "',
`Hometown`='" . sql_escape($hometown) . "'
WHERE `UID`=" . sql_escape($user['UID']));
// Assign angel-types // Assign angel-types
$user_angel_type_info = array(); $user_angel_type_info = array();
@ -178,7 +193,7 @@ function user_settings() {
form_text('dect', _("DECT"), $dect), form_text('dect', _("DECT"), $dect),
form_text('mobile', _("Mobile"), $mobile), form_text('mobile', _("Mobile"), $mobile),
form_text('mail', _("E-Mail") . "*", $mail), form_text('mail', _("E-Mail") . "*", $mail),
form_text('icq', _("ICQ"), $icq), form_checkbox('email_shiftinfo', _("Please send me an email if my shifts change"), $email_shiftinfo),
form_text('jabber', _("Jabber"), $jabber), form_text('jabber', _("Jabber"), $jabber),
form_text('hometown', _("Hometown"), $hometown), form_text('hometown', _("Hometown"), $hometown),
$enable_tshirt_size ? form_select('tshirt_size', _("Shirt size"), $tshirt_sizes, $tshirt_size) : '', $enable_tshirt_size ? form_select('tshirt_size', _("Shirt size"), $tshirt_sizes, $tshirt_size) : '',

File diff suppressed because it is too large Load Diff

View File

@ -1,5 +1,4 @@
<?php <?php
require_once realpath(__DIR__ . '/../includes/mysqli_provider.php'); require_once realpath(__DIR__ . '/../includes/mysqli_provider.php');
require_once realpath(__DIR__ . '/../includes/sys_auth.php'); require_once realpath(__DIR__ . '/../includes/sys_auth.php');