Merge pull request #326 from MyIgel/master

Reapplied missing commits
This commit is contained in:
msquare 2017-07-19 20:52:31 +02:00 committed by GitHub
commit 0d772ec908
10 changed files with 37 additions and 16 deletions

View File

@ -18,6 +18,9 @@
"erusev/parsedown": "1.6.*", "erusev/parsedown": "1.6.*",
"twbs/bootstrap": "^3.3" "twbs/bootstrap": "^3.3"
}, },
"require-dev": {
"phpunit/phpunit": "^6.2"
},
"autoload": { "autoload": {
"psr-4": { "psr-4": {
"Engelsystem\\": "src/" "Engelsystem\\": "src/"

View File

@ -26,6 +26,9 @@ return [
// Contact email address, linked on every page // Contact email address, linked on every page
'contact_email' => 'mailto:ticket@c3heaven.de', '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 // Default theme of the start page, 1=style1.css
'theme' => 1, 'theme' => 1,
@ -35,7 +38,7 @@ return [
// Anzahl Stunden bis zum Austragen eigener Schichten // Anzahl Stunden bis zum Austragen eigener Schichten
'last_unsubscribe' => 3, '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, // Falls ein Benutzerpasswort in einem anderen Format gespeichert ist,
// wird es bei der ersten Benutzung des Klartext-Passworts in das neue Format // wird es bei der ersten Benutzung des Klartext-Passworts in das neue Format
// konvertiert. // konvertiert.

View File

@ -19,7 +19,11 @@ function room_controller()
redirect(page_link_to()); 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); $all_shifts = Shifts_by_room($room);
$days = []; $days = [];
foreach ($all_shifts as $shift) { foreach ($all_shifts as $shift) {
@ -99,15 +103,16 @@ function room_edit_link($room)
/** /**
* Loads room by request param room_id * Loads room by request param room_id
* *
* @param bool $onlyVisible
* @return array * @return array
*/ */
function load_room() function load_room($onlyVisible = true)
{ {
if (!test_request_int('room_id')) { if (!test_request_int('room_id')) {
redirect(page_link_to()); redirect(page_link_to());
} }
$room = Room($_REQUEST['room_id']); $room = Room($_REQUEST['room_id'], $onlyVisible);
if ($room == null) { if ($room == null) {
redirect(page_link_to()); redirect(page_link_to());
} }

View File

@ -39,7 +39,7 @@ function engelsystem_email($address, $title, $message)
$address, $address,
$title, $title,
$message, $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) { if ($result === false) {

View File

@ -57,16 +57,16 @@ function Room_create($name, $from_frab, $public, $number = null)
* Returns room by id. * Returns room by id.
* *
* @param int $room_id RID * @param int $room_id RID
* @param bool $show_only * @param bool $onlyVisible
* @return array|false * @return array|false
*/ */
function Room($room_id, $show_only = true) function Room($room_id, $onlyVisible = true)
{ {
$room_source = DB::select(' $room_source = DB::select('
SELECT * SELECT *
FROM `Room` FROM `Room`
WHERE `RID` = ? WHERE `RID` = ?
' . ($show_only ? 'AND `show` = \'Y\'' : ''), ' . ($onlyVisible ? 'AND `show` = \'Y\'' : ''),
[$room_id] [$room_id]
); );

View File

@ -29,8 +29,8 @@ function UserDriverLicense_new()
*/ */
function UserDriverLicense_valid($user_driver_license) function UserDriverLicense_valid($user_driver_license)
{ {
return $user_driver_license['has_car'] return
|| $user_driver_license['has_license_car'] $user_driver_license['has_license_car']
|| $user_driver_license['has_license_3_5t_transporter'] || $user_driver_license['has_license_3_5t_transporter']
|| $user_driver_license['has_license_7_5t_truck'] || $user_driver_license['has_license_7_5t_truck']
|| $user_driver_license['has_license_12_5t_truck'] || $user_driver_license['has_license_12_5t_truck']

View File

@ -197,7 +197,8 @@ function make_room_navigation($menu)
return $menu; return $menu;
} }
$rooms = Rooms(); // Get a list of all rooms
$rooms = Rooms(true);
$room_menu = []; $room_menu = [];
if (in_array('admin_rooms', $privileges)) { if (in_array('admin_rooms', $privileges)) {
$room_menu[] = toolbar_item_link(page_link_to('admin_rooms'), 'list', _('Manage rooms')); $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(); $room_menu[] = toolbar_item_divider();
} }
foreach ($rooms as $room) { 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) { if (count($room_menu) > 0) {
$menu[] = toolbar_dropdown('map-marker', _('Rooms'), $room_menu); $menu[] = toolbar_dropdown('map-marker', _('Rooms'), $room_menu);

View File

@ -182,7 +182,7 @@ function AngelType_view_members($angeltype, $members, $admin_user_angeltypes, $a
$member['Nick'] = User_Nick_render($member); $member['Nick'] = User_Nick_render($member);
if ($angeltype['requires_driver_license']) { 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_car'] = glyph_bool($member['has_car']);
$member['has_license_car'] = glyph_bool($member['has_license_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']); $member['has_license_3_5t_transporter'] = glyph_bool($member['has_license_3_5t_transporter']);

View File

@ -17,12 +17,12 @@ function UserDriverLicense_edit_view($user_source, $wants_to_drive, $user_driver
msg(), msg(),
form([ form([
form_info(_('Privacy'), _('Your driving license information is only visible for supporters and admins.')), 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 panel-default', [
div('panel-body', [ div('panel-body', [
form_checkbox( form_checkbox(
'has_car', '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'] $user_driver_license['has_car']
), ),
heading(_('Driver license'), 3), heading(_('Driver license'), 3),

View File

@ -1,6 +1,6 @@
@import "../vendor/twbs/bootstrap/less/bootstrap"; @import "../vendor/twbs/bootstrap/less/bootstrap";
@icon-font-path: "../vendor/bootstrap/fonts/"; @icon-font-path: "../../../../vendor/bootstrap/fonts/";
body { body {
padding-top: 50px; padding-top: 50px;