From c8719e89fa0e2548edbd5dbfdec6cba8cd9b360a Mon Sep 17 00:00:00 2001 From: Igor Scheller Date: Mon, 17 Jul 2017 18:54:06 +0200 Subject: [PATCH 1/5] Added phpunit and fixed typo --- composer.json | 3 +++ config/config.default.php | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 7655275c..0605bcf3 100644 --- a/composer.json +++ b/composer.json @@ -18,6 +18,9 @@ "erusev/parsedown": "1.6.*", "twbs/bootstrap": "^3.3" }, + "require-dev": { + "phpunit/phpunit": "^6.2" + }, "autoload": { "psr-4": { "Engelsystem\\": "src/" diff --git a/config/config.default.php b/config/config.default.php index 8ae01144..263b4605 100644 --- a/config/config.default.php +++ b/config/config.default.php @@ -35,7 +35,7 @@ return [ // Anzahl Stunden bis zum Austragen eigener Schichten 'last_unsubscribe' => 3, - // Setzt den zu verwendenden Crypto-Algorismus (entsprechend der Dokumentation von crypt()). + // Setzt den zu verwendenden Crypto-Algorithmus (entsprechend der Dokumentation von crypt()). // Falls ein Benutzerpasswort in einem anderen Format gespeichert ist, // wird es bei der ersten Benutzung des Klartext-Passworts in das neue Format // konvertiert. From a2b9edc6a301745a299c8c29cdbbbc795961c9f0 Mon Sep 17 00:00:00 2001 From: Igor Scheller Date: Mon, 17 Jul 2017 22:17:58 +0200 Subject: [PATCH 2/5] Reapplied "Merge pull request #314 from Scriptkiddi/master" --- config/config.default.php | 3 +++ includes/helper/email_helper.php | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/config/config.default.php b/config/config.default.php index 263b4605..e816fe9c 100644 --- a/config/config.default.php +++ b/config/config.default.php @@ -26,6 +26,9 @@ return [ // Contact email address, linked on every page 'contact_email' => 'mailto:ticket@c3heaven.de', + // From address of all emails + 'no_reply_email' => 'noreply@engelsystem.de', + // Default theme of the start page, 1=style1.css 'theme' => 1, 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 " + sprintf("Content-Type: text/plain; charset=UTF-8\r\nFrom: Engelsystem <%s>", config('no_reply_email')) ); if ($result === false) { From 317c91a22f736342c52ed643c94d510a100f7fdb Mon Sep 17 00:00:00 2001 From: Igor Scheller Date: Mon, 17 Jul 2017 23:08:15 +0200 Subject: [PATCH 3/5] Reapplied "Merge pull request #319 from jwacalex/gh_317_unable_to_edit_hidden_room_in_admin" --- includes/controller/rooms_controller.php | 11 ++++++++--- includes/model/Room_model.php | 6 +++--- includes/sys_menu.php | 14 ++++++++++++-- 3 files changed, 23 insertions(+), 8 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/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/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); From cdf14f9d3f83b43bda6cb636c22546d315f3acdb Mon Sep 17 00:00:00 2001 From: Igor Scheller Date: Mon, 17 Jul 2017 23:43:47 +0200 Subject: [PATCH 4/5] Reapplied "Merge pull request #321 from raboof/wantsToDrive" --- includes/model/UserDriverLicenses_model.php | 4 ++-- includes/view/AngelTypes_view.php | 2 +- includes/view/UserDriverLicenses_view.php | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) 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/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), From 04217834fa4e6f94fec0836a80ea5526b8ebc9bc Mon Sep 17 00:00:00 2001 From: Igor Scheller Date: Mon, 17 Jul 2017 23:44:39 +0200 Subject: [PATCH 5/5] Reapplied "fix icon font path" --- themes/base.less | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/themes/base.less b/themes/base.less index 766679bb..677f3200 100644 --- a/themes/base.less +++ b/themes/base.less @@ -1,6 +1,6 @@ @import "../vendor/twbs/bootstrap/less/bootstrap"; -@icon-font-path: "../vendor/bootstrap/fonts/"; +@icon-font-path: "../../../../vendor/bootstrap/fonts/"; body { padding-top: 50px;