summaryrefslogtreecommitdiff
path: root/includes
diff options
context:
space:
mode:
authormsquare <msquare@notrademark.de>2017-07-19 20:52:31 +0200
committerGitHub <noreply@github.com>2017-07-19 20:52:31 +0200
commit0d772ec9082ef780ec67c239eba61e979143ad05 (patch)
treeba68d1f00a0c9fb434f24f03eaaf2b7a8a9ec4e2 /includes
parent20e0765f571ed60aa21c07502ee7efcbe9995a6e (diff)
parent04217834fa4e6f94fec0836a80ea5526b8ebc9bc (diff)
Merge pull request #326 from MyIgel/master
Reapplied missing commits
Diffstat (limited to 'includes')
-rw-r--r--includes/controller/rooms_controller.php11
-rw-r--r--includes/helper/email_helper.php2
-rw-r--r--includes/model/Room_model.php6
-rw-r--r--includes/model/UserDriverLicenses_model.php4
-rw-r--r--includes/sys_menu.php14
-rw-r--r--includes/view/AngelTypes_view.php2
-rw-r--r--includes/view/UserDriverLicenses_view.php4
7 files changed, 29 insertions, 14 deletions
diff --git a/includes/controller/rooms_controller.php b/includes/controller/rooms_controller.php
index 3f5ff387..3082a28d 100644
--- a/includes/controller/rooms_controller.php
+++ b/includes/controller/rooms_controller.php
@@ -19,7 +19,11 @@ function room_controller()
redirect(page_link_to());
}
- $room = load_room();
+ $room = load_room(false);
+ if ($room['show'] != 'Y' && !in_array('admin_rooms', $privileges)) {
+ redirect(page_link_to());
+ }
+
$all_shifts = Shifts_by_room($room);
$days = [];
foreach ($all_shifts as $shift) {
@@ -99,15 +103,16 @@ function room_edit_link($room)
/**
* Loads room by request param room_id
*
+ * @param bool $onlyVisible
* @return array
*/
-function load_room()
+function load_room($onlyVisible = true)
{
if (!test_request_int('room_id')) {
redirect(page_link_to());
}
- $room = Room($_REQUEST['room_id']);
+ $room = Room($_REQUEST['room_id'], $onlyVisible);
if ($room == null) {
redirect(page_link_to());
}
diff --git a/includes/helper/email_helper.php b/includes/helper/email_helper.php
index a2e25269..dad27b39 100644
--- a/includes/helper/email_helper.php
+++ b/includes/helper/email_helper.php
@@ -39,7 +39,7 @@ function engelsystem_email($address, $title, $message)
$address,
$title,
$message,
- "Content-Type: text/plain; charset=UTF-8\r\nFrom: Engelsystem <noreply@engelsystem.de>"
+ sprintf("Content-Type: text/plain; charset=UTF-8\r\nFrom: Engelsystem <%s>", config('no_reply_email'))
);
if ($result === false) {
diff --git a/includes/model/Room_model.php b/includes/model/Room_model.php
index c8399bc4..17617b39 100644
--- a/includes/model/Room_model.php
+++ b/includes/model/Room_model.php
@@ -57,16 +57,16 @@ function Room_create($name, $from_frab, $public, $number = null)
* Returns room by id.
*
* @param int $room_id RID
- * @param bool $show_only
+ * @param bool $onlyVisible
* @return array|false
*/
-function Room($room_id, $show_only = true)
+function Room($room_id, $onlyVisible = true)
{
$room_source = DB::select('
SELECT *
FROM `Room`
WHERE `RID` = ?
- ' . ($show_only ? 'AND `show` = \'Y\'' : ''),
+ ' . ($onlyVisible ? 'AND `show` = \'Y\'' : ''),
[$room_id]
);
diff --git a/includes/model/UserDriverLicenses_model.php b/includes/model/UserDriverLicenses_model.php
index 5ff4df35..525d2016 100644
--- a/includes/model/UserDriverLicenses_model.php
+++ b/includes/model/UserDriverLicenses_model.php
@@ -29,8 +29,8 @@ function UserDriverLicense_new()
*/
function UserDriverLicense_valid($user_driver_license)
{
- return $user_driver_license['has_car']
- || $user_driver_license['has_license_car']
+ return
+ $user_driver_license['has_license_car']
|| $user_driver_license['has_license_3_5t_transporter']
|| $user_driver_license['has_license_7_5t_truck']
|| $user_driver_license['has_license_12_5t_truck']
diff --git a/includes/sys_menu.php b/includes/sys_menu.php
index 0b7d6b37..f160441c 100644
--- a/includes/sys_menu.php
+++ b/includes/sys_menu.php
@@ -197,7 +197,8 @@ function make_room_navigation($menu)
return $menu;
}
- $rooms = Rooms();
+ // Get a list of all rooms
+ $rooms = Rooms(true);
$room_menu = [];
if (in_array('admin_rooms', $privileges)) {
$room_menu[] = toolbar_item_link(page_link_to('admin_rooms'), 'list', _('Manage rooms'));
@@ -206,7 +207,16 @@ function make_room_navigation($menu)
$room_menu[] = toolbar_item_divider();
}
foreach ($rooms as $room) {
- $room_menu[] = toolbar_item_link(room_link($room), 'map-marker', $room['Name']);
+ if (
+ $room['show'] == 'Y' // room is public
+ || (
+ // room is not public, but user can admin_rooms
+ $room['show'] != 'Y'
+ && in_array('admin_rooms', $privileges)
+ )
+ ) {
+ $room_menu[] = toolbar_item_link(room_link($room), 'map-marker', $room['Name']);
+ }
}
if (count($room_menu) > 0) {
$menu[] = toolbar_dropdown('map-marker', _('Rooms'), $room_menu);
diff --git a/includes/view/AngelTypes_view.php b/includes/view/AngelTypes_view.php
index bd258d3a..f74b0eb1 100644
--- a/includes/view/AngelTypes_view.php
+++ b/includes/view/AngelTypes_view.php
@@ -182,7 +182,7 @@ function AngelType_view_members($angeltype, $members, $admin_user_angeltypes, $a
$member['Nick'] = User_Nick_render($member);
if ($angeltype['requires_driver_license']) {
- $member['wants_to_drive'] = glyph_bool($member['user_id']);
+ $member['wants_to_drive'] = glyph_bool($member['wants_to_drive']);
$member['has_car'] = glyph_bool($member['has_car']);
$member['has_license_car'] = glyph_bool($member['has_license_car']);
$member['has_license_3_5t_transporter'] = glyph_bool($member['has_license_3_5t_transporter']);
diff --git a/includes/view/UserDriverLicenses_view.php b/includes/view/UserDriverLicenses_view.php
index dce08c29..5eacf456 100644
--- a/includes/view/UserDriverLicenses_view.php
+++ b/includes/view/UserDriverLicenses_view.php
@@ -17,12 +17,12 @@ function UserDriverLicense_edit_view($user_source, $wants_to_drive, $user_driver
msg(),
form([
form_info(_('Privacy'), _('Your driving license information is only visible for supporters and admins.')),
- form_checkbox('wants_to_drive', _('I am willing to operate cars for the PL'), $wants_to_drive),
+ form_checkbox('wants_to_drive', _('I am willing to drive a car for the event'), $wants_to_drive),
div('panel panel-default', [
div('panel-body', [
form_checkbox(
'has_car',
- _('I have my own car with me and am willing to use it for the PL (You\'ll get reimbursed for fuel)'),
+ _('I have my own car with me and am willing to use it for the event (You\'ll get reimbursed for fuel)'),
$user_driver_license['has_car']
),
heading(_('Driver license'), 3),