summaryrefslogtreecommitdiff
path: root/includes
diff options
context:
space:
mode:
authormsquare <msquare@notrademark.de>2017-12-26 20:41:35 +0100
committermsquare <msquare@notrademark.de>2017-12-27 11:35:26 +0100
commitabf4b1da30e7fabebfa5e36cfc5c1fe691320a1e (patch)
tree5532fee9e0a73cab59a1346330c6da071300db4a /includes
parent07f1cae93dcd9f049522f30eeb1aa5f52cdc24eb (diff)
check if logged in before sign up
Diffstat (limited to 'includes')
-rw-r--r--includes/controller/shift_entries_controller.php4
-rw-r--r--includes/model/AngelType_model.php2
-rw-r--r--includes/pages/user_shifts.php23
-rw-r--r--includes/view/User_view.php3
4 files changed, 24 insertions, 8 deletions
diff --git a/includes/controller/shift_entries_controller.php b/includes/controller/shift_entries_controller.php
index fcd911de..818557a4 100644
--- a/includes/controller/shift_entries_controller.php
+++ b/includes/controller/shift_entries_controller.php
@@ -10,6 +10,10 @@ use Engelsystem\ShiftSignupState;
function shift_entries_controller()
{
global $user;
+
+ if(!isset($user)) {
+ redirect(page_link_to('login'));
+ }
$action = strip_request_item('action');
if ($action == null) {
diff --git a/includes/model/AngelType_model.php b/includes/model/AngelType_model.php
index 3641f125..6feb9dd0 100644
--- a/includes/model/AngelType_model.php
+++ b/includes/model/AngelType_model.php
@@ -126,7 +126,7 @@ function AngelType_create($angeltype)
$angeltype['contact_name'],
$angeltype['contact_dect'],
$angeltype['contact_email'],
- $angeltype['show_on_dashboard']
+ (int)$angeltype['show_on_dashboard']
]
);
diff --git a/includes/pages/user_shifts.php b/includes/pages/user_shifts.php
index 2d294ff4..2c30c86a 100644
--- a/includes/pages/user_shifts.php
+++ b/includes/pages/user_shifts.php
@@ -248,12 +248,7 @@ function view_user_shifts()
. _('Description of the jobs.')
. '</a>',
'shifts_table' => msg() . $shiftCalendarRenderer->render(),
- 'ical_text' => '<h2>' . _('iCal export') . '</h2><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>',
+ 'ical_text' => ical_hint(),
'filter' => _('Filter'),
'set_yesterday' => _('Yesterday'),
'set_today' => _('Today'),
@@ -272,6 +267,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
* @return array
*/
diff --git a/includes/view/User_view.php b/includes/view/User_view.php
index c9530307..a80eb096 100644
--- a/includes/view/User_view.php
+++ b/includes/view/User_view.php
@@ -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.'),
page_link_to('user_shifts')
), true)
- : ''
+ : '',
+ ical_hint()
]
);
}