check if logged in before sign up

This commit is contained in:
msquare 2017-12-26 20:41:35 +01:00
parent 07f1cae93d
commit abf4b1da30
4 changed files with 24 additions and 8 deletions

View File

@ -10,6 +10,10 @@ use Engelsystem\ShiftSignupState;
function shift_entries_controller() function shift_entries_controller()
{ {
global $user; global $user;
if(!isset($user)) {
redirect(page_link_to('login'));
}
$action = strip_request_item('action'); $action = strip_request_item('action');
if ($action == null) { if ($action == null) {

View File

@ -126,7 +126,7 @@ function AngelType_create($angeltype)
$angeltype['contact_name'], $angeltype['contact_name'],
$angeltype['contact_dect'], $angeltype['contact_dect'],
$angeltype['contact_email'], $angeltype['contact_email'],
$angeltype['show_on_dashboard'] (int)$angeltype['show_on_dashboard']
] ]
); );

View File

@ -248,12 +248,7 @@ function view_user_shifts()
. _('Description of the jobs.') . _('Description of the jobs.')
. '</a>', . '</a>',
'shifts_table' => msg() . $shiftCalendarRenderer->render(), 'shifts_table' => msg() . $shiftCalendarRenderer->render(),
'ical_text' => '<h2>' . _('iCal export') . '</h2><p>' . sprintf( 'ical_text' => ical_hint(),
_('Export of shown shifts. <a href="%s">iCal format</a> or <a href="%s">JSON format</a> available (please keep secret, otherwise <a href="%s">reset the api key</a>).'),
page_link_to('ical', ['key' => $user['api_key']]),
page_link_to('shifts_json_export', ['key' => $user['api_key']]),
page_link_to('user_myshifts', ['reset' => 1])
) . '</p>',
'filter' => _('Filter'), 'filter' => _('Filter'),
'set_yesterday' => _('Yesterday'), 'set_yesterday' => _('Yesterday'),
'set_today' => _('Today'), 'set_today' => _('Today'),
@ -271,6 +266,22 @@ function view_user_shifts()
]); ]);
} }
/**
* Returns a hint for the user how the ical feature works.
*/
function ical_hint() {
global $user;
return heading(
_('iCal export'), 2)
. '<p>' . sprintf(
_('Export of shown shifts. <a href="%s">iCal format</a> or <a href="%s">JSON format</a> available (please keep secret, otherwise <a href="%s">reset the api key</a>).'),
page_link_to('ical', ['key' => $user['api_key']]),
page_link_to('shifts_json_export', ['key' => $user['api_key']]),
page_link_to('user_myshifts', ['reset' => 1])
) . '</p>';
}
/** /**
* @param array $array * @param array $array
* @return array * @return array

View File

@ -518,7 +518,8 @@ function User_view($user_source, $admin_user_privilege, $freeloader, $user_angel
_('Go to the <a href="%s">shifts table</a> to sign yourself up for some shifts.'), _('Go to the <a href="%s">shifts table</a> to sign yourself up for some shifts.'),
page_link_to('user_shifts') page_link_to('user_shifts')
), true) ), true)
: '' : '',
ical_hint()
] ]
); );
} }