summaryrefslogtreecommitdiff
path: root/includes
diff options
context:
space:
mode:
Diffstat (limited to 'includes')
-rw-r--r--includes/autoload.php3
-rw-r--r--includes/controller/shifts_controller.php36
-rw-r--r--includes/helper/graph_helper.php2
-rw-r--r--includes/model/Shifts_model.php2
-rw-r--r--includes/pages/admin_arrive.php1
-rw-r--r--includes/pages/user_myshifts.php2
-rw-r--r--includes/pages/user_shifts.php2
-rw-r--r--includes/sys_form.php18
-rw-r--r--includes/sys_menu.php4
-rw-r--r--includes/sys_template.php10
-rw-r--r--includes/view/UserDriverLicenses_view.php14
11 files changed, 35 insertions, 59 deletions
diff --git a/includes/autoload.php b/includes/autoload.php
index 0cd9d355..f2e90b16 100644
--- a/includes/autoload.php
+++ b/includes/autoload.php
@@ -2,7 +2,8 @@
// Check for autoloader
if (!is_readable(__DIR__ . '/../vendor/autoload.php')) {
- die('Please run composer.phar install');
+ echo 'Please run composer.phar install';
+ exit(1);
}
// Include composer autoloader
diff --git a/includes/controller/shifts_controller.php b/includes/controller/shifts_controller.php
index 326449cf..7cac5b4a 100644
--- a/includes/controller/shifts_controller.php
+++ b/includes/controller/shifts_controller.php
@@ -277,6 +277,10 @@ function shift_controller()
$shift_signup_state = new ShiftSignupState(ShiftSignupState::OCCUPIED, 0);
foreach ($angeltypes as &$angeltype) {
$needed_angeltype = NeededAngeltype_by_Shift_and_Angeltype($shift, $angeltype);
+ if(empty($needed_angeltype)) {
+ continue;
+ }
+
$shift_entries = ShiftEntries_by_shift_and_angeltype($shift['SID'], $angeltype['id']);
$angeltype_signup_state = Shift_signup_allowed(
@@ -288,11 +292,7 @@ function shift_controller()
$needed_angeltype,
$shift_entries
);
- if (empty($shift_signup_state)) {
- $shift_signup_state = $angeltype_signup_state;
- } else {
- $shift_signup_state->combineWith($angeltype_signup_state);
- }
+ $shift_signup_state->combineWith($angeltype_signup_state);
$angeltype['shift_signup_state'] = $angeltype_signup_state;
}
@@ -346,32 +346,6 @@ function shift_next_controller()
}
/**
- * Export all shifts using api-key.
- */
-function shifts_json_export_all_controller()
-{
- $api_key = config('api_key');
- $request = request();
-
- if (empty($api_key)) {
- engelsystem_error('Config contains empty apikey.');
- }
-
- if (!$request->has('api_key')) {
- engelsystem_error('Missing parameter api_key.');
- }
-
- if ($request->input('api_key') != $api_key) {
- engelsystem_error('Invalid api_key.');
- }
-
- $shifts_source = Shifts();
-
- header('Content-Type: application/json; charset=utf-8');
- raw_output(json_encode($shifts_source));
-}
-
-/**
* Export filtered shifts via JSON.
* (Like iCal Export or shifts view)
*/
diff --git a/includes/helper/graph_helper.php b/includes/helper/graph_helper.php
index 12c7df6c..f49ab635 100644
--- a/includes/helper/graph_helper.php
+++ b/includes/helper/graph_helper.php
@@ -33,7 +33,7 @@ function bargraph($dom_id, $key, $row_names, $colors, $data)
return '<canvas id="' . $dom_id . '" style="width: 100%; height: 300px;"></canvas>
<script type="text/javascript">
$(function(){
- var ctx = $("#' . $dom_id . '").get(0).getContext("2d");
+ var ctx = $(\'#' . $dom_id . '\').get(0).getContext(\'2d\');
var chart = new Chart(ctx).Bar(' . json_encode([
'labels' => $labels,
'datasets' => $datasets
diff --git a/includes/model/Shifts_model.php b/includes/model/Shifts_model.php
index 94513ff3..b5e3a205 100644
--- a/includes/model/Shifts_model.php
+++ b/includes/model/Shifts_model.php
@@ -182,7 +182,7 @@ function NeededAngeltypes_by_ShiftsFilter(ShiftsFilter $shiftsFilter)
/**
* @param array $shift
* @param array $angeltype
- * @return array
+ * @return array|null
*/
function NeededAngeltype_by_Shift_and_Angeltype($shift, $angeltype)
{
diff --git a/includes/pages/admin_arrive.php b/includes/pages/admin_arrive.php
index 8dada3e2..b1c38453 100644
--- a/includes/pages/admin_arrive.php
+++ b/includes/pages/admin_arrive.php
@@ -21,6 +21,7 @@ function admin_arrive()
if ($request->has('search')) {
$search = strip_request_item('search');
+ $search = trim($search);
}
if ($request->has('reset') && preg_match('/^\d+$/', $request->input('reset'))) {
diff --git a/includes/pages/user_myshifts.php b/includes/pages/user_myshifts.php
index 5819f5c6..b61fc1e4 100644
--- a/includes/pages/user_myshifts.php
+++ b/includes/pages/user_myshifts.php
@@ -71,7 +71,7 @@ function user_myshifts()
$shifts_user['UID'],
]
);
- if (count($shift) > 0) {
+ if (!empty($shift)) {
$freeloaded = $shift['freeloaded'];
$freeload_comment = $shift['freeload_comment'];
diff --git a/includes/pages/user_shifts.php b/includes/pages/user_shifts.php
index 67f6785f..020cfe54 100644
--- a/includes/pages/user_shifts.php
+++ b/includes/pages/user_shifts.php
@@ -333,7 +333,7 @@ function make_select($items, $selected, $name, $title = null, $additionalButtons
. (in_array($i['id'], $selected) ? ' checked="checked"' : '')
. ' > ' . $i['name'] . '</label>'
. (!isset($i['enabled']) || $i['enabled'] ? '' : glyph('lock'))
- . '</div><br />';
+ . '</div>';
}
$html .= '<div id="selection_' . $name . '" class="selection ' . $name . '">' . "\n";
$html .= implode("\n", $htmlItems);
diff --git a/includes/sys_form.php b/includes/sys_form.php
index 9cb6f38d..cd1c84e6 100644
--- a/includes/sys_form.php
+++ b/includes/sys_form.php
@@ -38,12 +38,12 @@ function form_spinner($name, $label, $value)
</div>
</div>
<script type="text/javascript">
- $("#spinner-' . $name . '-down").click(function() {
- var spinner = $("#spinner-' . $name . '");
+ $(\'#spinner-' . $name . '-down\').click(function() {
+ var spinner = $(\'#spinner-' . $name . '\');
spinner.val(parseInt(spinner.val()) - 1);
});
- $("#spinner-' . $name . '-up").click(function() {
- var spinner = $("#spinner-' . $name . '");
+ $(\'#spinner-' . $name . '-up\').click(function() {
+ var spinner = $(\'#spinner-' . $name . '\');
spinner.val(parseInt(spinner.val()) + 1);
});
</script>
@@ -157,17 +157,17 @@ function form_multi_checkboxes($names, $label, $items, $selected, $disabled = []
* @param string $label
* @param string $selected
* @param string $value
- * @param string $id
+ * @param string $html_id
* @return string
*/
-function form_checkbox($name, $label, $selected, $value = 'checked', $id = null)
+function form_checkbox($name, $label, $selected, $value = 'checked', $html_id = null)
{
- if (is_null($id)) {
- $id = $name;
+ if (is_null($html_id)) {
+ $html_id = $name;
}
return '<div class="checkbox"><label>'
- . '<input type="checkbox" id="' . $id . '" name="' . $name . '" value="' . htmlspecialchars($value) . '" '
+ . '<input type="checkbox" id="' . $html_id . '" name="' . $name . '" value="' . htmlspecialchars($value) . '" '
. ($selected ? ' checked="checked"' : '') . ' /> '
. $label
. '</label></div>';
diff --git a/includes/sys_menu.php b/includes/sys_menu.php
index 58d4bab3..5609c0ab 100644
--- a/includes/sys_menu.php
+++ b/includes/sys_menu.php
@@ -89,8 +89,8 @@ function header_toolbar()
if (in_array('user_myshifts', $privileges)) {
$toolbar_items[] = toolbar_item_link(
page_link_to('users', ['action' => 'view']),
- ' icon-icon_angel',
- $user['Nick'],
+ '',
+ '<span class="icon-icon_angel"></span> ' . $user['Nick'],
$page == 'users'
);
}
diff --git a/includes/sys_template.php b/includes/sys_template.php
index a988ca7c..986270b5 100644
--- a/includes/sys_template.php
+++ b/includes/sys_template.php
@@ -231,12 +231,12 @@ function toolbar_popover($glyphicon, $label, $content, $class = '')
. ' <span class="caret"></span></a>
<script type="text/javascript">
$(function(){
- $("#' . $dom_id . '").popover({
- trigger: "focus",
+ $(\'#' . $dom_id . '\').popover({
+ trigger: \'focus\',
html: true,
- content: "' . addslashes(join('', $content)) . '",
- placement: "bottom",
- container: "#navbar-collapse-1"
+ content: \'' . addslashes(join('', $content)) . '\',
+ placement: \'bottom\',
+ container: \'#navbar-collapse-1\'
})
});
</script></li>';
diff --git a/includes/view/UserDriverLicenses_view.php b/includes/view/UserDriverLicenses_view.php
index b92f5f07..be21ca53 100644
--- a/includes/view/UserDriverLicenses_view.php
+++ b/includes/view/UserDriverLicenses_view.php
@@ -53,18 +53,18 @@ function UserDriverLicense_edit_view($user_source, $wants_to_drive, $user_driver
]),
'<script type="text/javascript">
$(function() {
- var checkbox = $("#wants_to_drive");
- if(checkbox.is(":checked"))
- $("#driving_license").show();
+ var checkbox = $(\'#wants_to_drive\');
+ if(checkbox.is(\':checked\'))
+ $(\'#driving_license\').show();
else
- $("#driving_license").hide();
+ $(\'#driving_license\').hide();
checkbox.click(
function() {
- if($("#wants_to_drive").is(":checked"))
- $("#driving_license").show();
+ if($(\'#wants_to_drive\').is(\':checked\'))
+ $(\'#driving_license\').show();
else
- $("#driving_license").hide();
+ $(\'#driving_license\').hide();
}
);
});