summaryrefslogtreecommitdiff
path: root/includes
diff options
context:
space:
mode:
authormsquare <msquare@notrademark.de>2016-11-11 15:24:51 +0100
committermsquare <msquare@notrademark.de>2016-11-11 15:24:51 +0100
commitf5a5f234e41a23f56c1515eebc0824ce8cd115d1 (patch)
treeecb7f74ca64f4d50deebec9daf1cd7c71fbb4422 /includes
parent82b9436c508fd9739555240991abda1b2fd63bd4 (diff)
fixes #266: add checkbox allowing the users email to be used by humans like event-team
Diffstat (limited to 'includes')
-rw-r--r--includes/controller/event_config_controller.php3
-rw-r--r--includes/model/EventConfig_model.php1
-rw-r--r--includes/model/User_model.php1
-rw-r--r--includes/pages/admin_free.php2
-rw-r--r--includes/pages/admin_user.php6
-rw-r--r--includes/pages/guest_login.php17
-rw-r--r--includes/pages/user_settings.php8
7 files changed, 21 insertions, 17 deletions
diff --git a/includes/controller/event_config_controller.php b/includes/controller/event_config_controller.php
index a9709d38..4f07fe4c 100644
--- a/includes/controller/event_config_controller.php
+++ b/includes/controller/event_config_controller.php
@@ -19,9 +19,6 @@ function event_config_edit_controller() {
$teardown_end_date = null;
$event_config = EventConfig();
- if ($event_config === false) {
- engelsystem_error('Unable to load event config.');
- }
if ($event_config != null) {
$event_name = $event_config['event_name'];
$buildup_start_date = $event_config['buildup_start_date'];
diff --git a/includes/model/EventConfig_model.php b/includes/model/EventConfig_model.php
index ac8d5e72..de5073d0 100644
--- a/includes/model/EventConfig_model.php
+++ b/includes/model/EventConfig_model.php
@@ -6,6 +6,7 @@
function EventConfig() {
$event_config = sql_select("SELECT * FROM `EventConfig` LIMIT 1");
if ($event_config === false) {
+ engelsystem_error("Unable to load event config.");
return false;
}
if (count($event_config) > 0) {
diff --git a/includes/model/User_model.php b/includes/model/User_model.php
index 831ebb56..4d7bbb65 100644
--- a/includes/model/User_model.php
+++ b/includes/model/User_model.php
@@ -29,6 +29,7 @@ function User_update($user) {
`Handy`='" . sql_escape($user['Handy']) . "',
`email`='" . sql_escape($user['email']) . "',
`email_shiftinfo`=" . sql_bool($user['email_shiftinfo']) . ",
+ `email_by_human_allowed`=" . sql_bool($user['email_by_human_allowed']) . ",
`jabber`='" . sql_escape($user['jabber']) . "',
`Size`='" . sql_escape($user['Size']) . "',
`Gekommen`='" . sql_escape($user['Gekommen']) . "',
diff --git a/includes/pages/admin_free.php b/includes/pages/admin_free.php
index d3b5b01b..427de61a 100644
--- a/includes/pages/admin_free.php
+++ b/includes/pages/admin_free.php
@@ -67,7 +67,7 @@ function admin_free() {
'shift_state' => User_shift_state_render($usr),
'dect' => $usr['DECT'],
'jabber' => $usr['jabber'],
- 'email' => $usr['email'],
+ 'email' => $usr['email_by_human_allowed'] ? $usr['email'] : glyph('eye-close'),
'actions' => in_array('admin_user', $privileges) ? button(page_link_to('admin_user') . '&amp;id=' . $usr['UID'], _("edit"), 'btn-xs') : ''
];
}
diff --git a/includes/pages/admin_user.php b/includes/pages/admin_user.php
index ef4eb2de..9b1bc0df 100644
--- a/includes/pages/admin_user.php
+++ b/includes/pages/admin_user.php
@@ -36,8 +36,9 @@ function admin_user() {
$html .= " <tr><td>Telefon</td><td>" . "<input type=\"text\" size=\"40\" name=\"eTelefon\" value=\"" . $user_source['Telefon'] . "\"></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>email</td><td>" . "<input type=\"text\" size=\"40\" name=\"eemail\" value=\"" . $user_source['email'] . "\"></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";
+ if ($user_source['email_by_human_allowed']) {
+ $html .= " <tr><td>email</td><td>" . "<input type=\"text\" size=\"40\" name=\"eemail\" value=\"" . $user_source['email'] . "\"></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";
@@ -173,7 +174,6 @@ function admin_user() {
`Alter` = '" . sql_escape($_POST["eAlter"]) . "',
`DECT` = '" . sql_escape($_POST["eDECT"]) . "',
`email` = '" . sql_escape($_POST["eemail"]) . "',
- `email_shiftinfo` = " . sql_bool(isset($_REQUEST['email_shiftinfo'])) . ",
`jabber` = '" . sql_escape($_POST["ejabber"]) . "',
`Size` = '" . sql_escape($_POST["eSize"]) . "',
`Gekommen`= '" . sql_escape($_POST["eGekommen"]) . "',
diff --git a/includes/pages/guest_login.php b/includes/pages/guest_login.php
index 7420e7fb..b30e3d15 100644
--- a/includes/pages/guest_login.php
+++ b/includes/pages/guest_login.php
@@ -17,9 +17,6 @@ function guest_register() {
global $tshirt_sizes, $enable_tshirt_size, $default_theme, $user;
$event_config = EventConfig();
- if ($event_config === false) {
- engelsystem_error("Unable to load event config.");
- }
$msg = "";
$nick = "";
@@ -31,6 +28,7 @@ function guest_register() {
$mobile = "";
$mail = "";
$email_shiftinfo = false;
+ $email_by_human_allowed = false;
$jabber = "";
$hometown = "";
$comment = "";
@@ -39,7 +37,7 @@ function guest_register() {
$selected_angel_types = [];
$planned_arrival_date = null;
- $angel_types_source = sql_select("SELECT * FROM `AngelTypes` ORDER BY `name`");
+ $angel_types_source = AngelTypes();
$angel_types = [];
foreach ($angel_types_source as $angel_type) {
$angel_types[$angel_type['id']] = $angel_type['name'] . ($angel_type['restricted'] ? " (restricted)" : "");
@@ -77,6 +75,10 @@ function guest_register() {
$email_shiftinfo = true;
}
+ if (isset($_REQUEST['email_by_human_allowed'])) {
+ $email_by_human_allowed = true;
+ }
+
if (isset($_REQUEST['jabber']) && strlen(strip_request_item('jabber')) > 0) {
$jabber = strip_request_item('jabber');
if (! check_email($jabber)) {
@@ -157,6 +159,7 @@ function guest_register() {
`Handy`='" . sql_escape($mobile) . "',
`email`='" . sql_escape($mail) . "',
`email_shiftinfo`=" . sql_bool($email_shiftinfo) . ",
+ `email_by_human_allowed`=" . sql_bool($email_by_human_allowed) . ",
`jabber`='" . sql_escape($jabber) . "',
`Size`='" . sql_escape($tshirt_size) . "',
`Passwort`='" . sql_escape($password_hash) . "',
@@ -209,7 +212,8 @@ function guest_register() {
]),
div('col-sm-8', [
form_email('mail', _("E-Mail") . ' ' . entry_required(), $mail),
- form_checkbox('email_shiftinfo', _("Please send me an email if my shifts change"), $email_shiftinfo)
+ form_checkbox('email_shiftinfo', _("The engelsystem is allowed to send me an email (e.g. when my shifts change)"), $email_shiftinfo),
+ form_checkbox('email_by_human_allowed', _("Humans are allowed to send me an email (e.g. for ticket vouchers)"), $email_by_human_allowed)
])
]),
div('row', [
@@ -318,9 +322,6 @@ function guest_login() {
}
$event_config = EventConfig();
- if ($event_config === false) {
- engelsystem_error("Unable to load event config.");
- }
return page([
div('col-md-12', [
diff --git a/includes/pages/user_settings.php b/includes/pages/user_settings.php
index 22ead68b..b92f7bd3 100644
--- a/includes/pages/user_settings.php
+++ b/includes/pages/user_settings.php
@@ -18,6 +18,7 @@ function user_settings() {
$mobile = $user['Handy'];
$mail = $user['email'];
$email_shiftinfo = $user['email_shiftinfo'];
+ $email_by_human_allowed = $user['email_by_human_allowed'];
$jabber = $user['jabber'];
$hometown = $user['Hometown'];
$tshirt_size = $user['Size'];
@@ -39,8 +40,9 @@ function user_settings() {
$valid = false;
$msg .= error(_("Please enter your e-mail."), true);
}
-
+
$email_shiftinfo = isset($_REQUEST['email_shiftinfo']);
+ $email_by_human_allowed = isset($_REQUEST['email_by_human_allowed']);
if (isset($_REQUEST['jabber']) && strlen(strip_request_item('jabber')) > 0) {
$jabber = strip_request_item('jabber');
@@ -109,6 +111,7 @@ function user_settings() {
`Handy`='" . sql_escape($mobile) . "',
`email`='" . sql_escape($mail) . "',
`email_shiftinfo`=" . sql_bool($email_shiftinfo) . ",
+ `email_by_human_allowed`=" . sql_bool($email_by_human_allowed) . ",
`jabber`='" . sql_escape($jabber) . "',
`Size`='" . sql_escape($tshirt_size) . "',
`Hometown`='" . sql_escape($hometown) . "',
@@ -185,7 +188,8 @@ function user_settings() {
form_text('dect', _("DECT"), $dect),
form_text('mobile', _("Mobile"), $mobile),
form_text('mail', _("E-Mail") . ' ' . entry_required(), $mail),
- form_checkbox('email_shiftinfo', _("Please send me an email if my shifts change"), $email_shiftinfo),
+ form_checkbox('email_shiftinfo', _("The engelsystem is allowed to send me an email (e.g. when my shifts change)"), $email_shiftinfo),
+ form_checkbox('email_by_human_allowed', _("Humans are allowed to send me an email (e.g. for ticket vouchers)"), $email_by_human_allowed),
form_text('jabber', _("Jabber"), $jabber),
form_text('hometown', _("Hometown"), $hometown),
$enable_tshirt_size ? form_select('tshirt_size', _("Shirt size"), $tshirt_sizes, $tshirt_size) : '',