Removed spaces

main
Bot 8 years ago committed by Igor Scheller
parent 8506d6d27e
commit 3de0cc840f

@ -59,7 +59,7 @@ return [
// multiply 'night shifts' and freeloaded shifts (start or end between 2 and 6 exclusive) by 2 // multiply 'night shifts' and freeloaded shifts (start or end between 2 and 6 exclusive) by 2
'shift_sum_formula' => ' 'shift_sum_formula' => '
SUM( SUM(
(1 + (1 +
( (
(HOUR(FROM_UNIXTIME(`Shifts`.`end`)) > 2 AND HOUR(FROM_UNIXTIME(`Shifts`.`end`)) < 6) (HOUR(FROM_UNIXTIME(`Shifts`.`end`)) > 2 AND HOUR(FROM_UNIXTIME(`Shifts`.`end`)) < 6)
OR (HOUR(FROM_UNIXTIME(`Shifts`.`start`)) > 2 AND HOUR(FROM_UNIXTIME(`Shifts`.`start`)) < 6) OR (HOUR(FROM_UNIXTIME(`Shifts`.`start`)) > 2 AND HOUR(FROM_UNIXTIME(`Shifts`.`start`)) < 6)

@ -82,7 +82,7 @@ function AngelType_contact_info($angeltype)
function AngelType_delete($angeltype) function AngelType_delete($angeltype)
{ {
$result = DB::delete(' $result = DB::delete('
DELETE FROM `AngelTypes` DELETE FROM `AngelTypes`
WHERE `id`=? WHERE `id`=?
LIMIT 1 LIMIT 1
', [$angeltype['id']]); ', [$angeltype['id']]);
@ -102,8 +102,8 @@ function AngelType_delete($angeltype)
function AngelType_update($angeltype) function AngelType_update($angeltype)
{ {
$result = DB::update(' $result = DB::update('
UPDATE `AngelTypes` SET UPDATE `AngelTypes` SET
`name` = ?, `name` = ?,
`restricted` = ?, `restricted` = ?,
`description` = ?, `description` = ?,
`requires_driver_license` = ?, `requires_driver_license` = ?,
@ -201,7 +201,7 @@ function AngelType_validate_name($name, $angeltype)
if ($angeltype != null && isset($angeltype['id'])) { if ($angeltype != null && isset($angeltype['id'])) {
$valid = (count(DB::select(' $valid = (count(DB::select('
SELECT `id` SELECT `id`
FROM `AngelTypes` FROM `AngelTypes`
WHERE `name`=? WHERE `name`=?
AND NOT `id`=? AND NOT `id`=?
LIMIT 1 LIMIT 1
@ -209,8 +209,8 @@ function AngelType_validate_name($name, $angeltype)
return new ValidationResult($valid, $name); return new ValidationResult($valid, $name);
} }
$valid = (count(DB::select(' $valid = (count(DB::select('
SELECT `id` SELECT `id`
FROM `AngelTypes` FROM `AngelTypes`
WHERE `name`=? WHERE `name`=?
LIMIT 1', [$name])) == 0); LIMIT 1', [$name])) == 0);
return new ValidationResult($valid, $name); return new ValidationResult($valid, $name);
@ -225,12 +225,12 @@ function AngelType_validate_name($name, $angeltype)
function AngelTypes_with_user($user) function AngelTypes_with_user($user)
{ {
$result = DB::select(' $result = DB::select('
SELECT `AngelTypes`.*, SELECT `AngelTypes`.*,
`UserAngelTypes`.`id` AS `user_angeltype_id`, `UserAngelTypes`.`id` AS `user_angeltype_id`,
`UserAngelTypes`.`confirm_user_id`, `UserAngelTypes`.`confirm_user_id`,
`UserAngelTypes`.`supporter` `UserAngelTypes`.`supporter`
FROM `AngelTypes` FROM `AngelTypes`
LEFT JOIN `UserAngelTypes` ON `AngelTypes`.`id`=`UserAngelTypes`.`angeltype_id` LEFT JOIN `UserAngelTypes` ON `AngelTypes`.`id`=`UserAngelTypes`.`angeltype_id`
AND `UserAngelTypes`.`user_id` = ? AND `UserAngelTypes`.`user_id` = ?
ORDER BY `name`', [$user['UID']]); ORDER BY `name`', [$user['UID']]);
@ -248,8 +248,8 @@ function AngelTypes_with_user($user)
function AngelTypes() function AngelTypes()
{ {
$result = DB::select(' $result = DB::select('
SELECT * SELECT *
FROM `AngelTypes` FROM `AngelTypes`
ORDER BY `name`'); ORDER BY `name`');
if (DB::getStm()->errorCode() != '00000') { if (DB::getStm()->errorCode() != '00000') {

@ -70,7 +70,7 @@ function EventConfig_update(
`buildup_start_date` = ?, `buildup_start_date` = ?,
`event_start_date` = ?, `event_start_date` = ?,
`event_end_date` = ?, `event_end_date` = ?,
`teardown_end_date` = ?, `teardown_end_date` = ?,
`event_welcome_msg` = ? `event_welcome_msg` = ?
', ',
[ [

@ -26,7 +26,7 @@ function ShiftType_update($shifttype_id, $name, $angeltype_id, $description)
{ {
DB::update(' DB::update('
UPDATE `ShiftTypes` SET UPDATE `ShiftTypes` SET
`name`=?, `name`=?,
`angeltype_id`=?, `angeltype_id`=?,
`description`=? `description`=?
WHERE `id`=? WHERE `id`=?

@ -35,9 +35,9 @@ function Shifts_by_ShiftsFilter(ShiftsFilter $shiftsFilter)
AND `NeededAngelTypes`.`angel_type_id` IN (' . implode(',', $shiftsFilter->getTypes()) . ') AND `NeededAngelTypes`.`angel_type_id` IN (' . implode(',', $shiftsFilter->getTypes()) . ')
AND `NeededAngelTypes`.`count` > 0 AND `NeededAngelTypes`.`count` > 0
AND `Shifts`.`PSID` IS NULL AND `Shifts`.`PSID` IS NULL
UNION UNION
SELECT DISTINCT `Shifts`.*, `ShiftTypes`.`name`, `Room`.`Name` AS `room_name` SELECT DISTINCT `Shifts`.*, `ShiftTypes`.`name`, `Room`.`Name` AS `room_name`
FROM `Shifts` FROM `Shifts`
JOIN `Room` USING (`RID`) JOIN `Room` USING (`RID`)
@ -48,7 +48,7 @@ function Shifts_by_ShiftsFilter(ShiftsFilter $shiftsFilter)
AND `NeededAngelTypes`.`angel_type_id` IN (' . implode(',', $shiftsFilter->getTypes()) . ') AND `NeededAngelTypes`.`angel_type_id` IN (' . implode(',', $shiftsFilter->getTypes()) . ')
AND `NeededAngelTypes`.`count` > 0 AND `NeededAngelTypes`.`count` > 0
AND NOT `Shifts`.`PSID` IS NULL) AS tmp_shifts AND NOT `Shifts`.`PSID` IS NULL) AS tmp_shifts
ORDER BY `start`'; ORDER BY `start`';
$result = DB::select($sql); $result = DB::select($sql);
if (DB::getStm()->errorCode() != '00000') { if (DB::getStm()->errorCode() != '00000') {
@ -122,9 +122,9 @@ function NeededAngeltype_by_Shift_and_Angeltype($shift, $angeltype)
WHERE `Shifts`.`SID`=? WHERE `Shifts`.`SID`=?
AND `AngelTypes`.`id`=? AND `AngelTypes`.`id`=?
AND `Shifts`.`PSID` IS NULL AND `Shifts`.`PSID` IS NULL
UNION UNION
SELECT SELECT
`NeededAngelTypes`.*, `NeededAngelTypes`.*,
`Shifts`.`SID`, `Shifts`.`SID`,
@ -532,12 +532,12 @@ function Shifts_by_user($user, $include_freeload_comments = false)
SELECT `ShiftTypes`.`id` AS `shifttype_id`, `ShiftTypes`.`name`, SELECT `ShiftTypes`.`id` AS `shifttype_id`, `ShiftTypes`.`name`,
`ShiftEntry`.`id`, `ShiftEntry`.`SID`, `ShiftEntry`.`TID`, `ShiftEntry`.`UID`, `ShiftEntry`.`freeloaded`, `ShiftEntry`.`Comment`, `ShiftEntry`.`id`, `ShiftEntry`.`SID`, `ShiftEntry`.`TID`, `ShiftEntry`.`UID`, `ShiftEntry`.`freeloaded`, `ShiftEntry`.`Comment`,
' . ($include_freeload_comments ? '`ShiftEntry`.`freeload_comment`, ' : '') . ' ' . ($include_freeload_comments ? '`ShiftEntry`.`freeload_comment`, ' : '') . '
`Shifts`.*, `Room`.* `Shifts`.*, `Room`.*
FROM `ShiftEntry` FROM `ShiftEntry`
JOIN `Shifts` ON (`ShiftEntry`.`SID` = `Shifts`.`SID`) JOIN `Shifts` ON (`ShiftEntry`.`SID` = `Shifts`.`SID`)
JOIN `ShiftTypes` ON (`ShiftTypes`.`id` = `Shifts`.`shifttype_id`) JOIN `ShiftTypes` ON (`ShiftTypes`.`id` = `Shifts`.`shifttype_id`)
JOIN `Room` ON (`Shifts`.`RID` = `Room`.`RID`) JOIN `Room` ON (`Shifts`.`RID` = `Room`.`RID`)
WHERE `UID` = ? WHERE `UID` = ?
ORDER BY `start` ORDER BY `start`
', ',
[ [
@ -560,7 +560,7 @@ function Shift($shift_id)
{ {
$shifts_source = DB::select(' $shifts_source = DB::select('
SELECT `Shifts`.*, `ShiftTypes`.`name` SELECT `Shifts`.*, `ShiftTypes`.`name`
FROM `Shifts` FROM `Shifts`
JOIN `ShiftTypes` ON (`ShiftTypes`.`id` = `Shifts`.`shifttype_id`) JOIN `ShiftTypes` ON (`ShiftTypes`.`id` = `Shifts`.`shifttype_id`)
WHERE `SID`=?', [$shift_id]); WHERE `SID`=?', [$shift_id]);
@ -603,7 +603,7 @@ function Shift($shift_id)
function Shifts() function Shifts()
{ {
$shifts_source = DB::select(' $shifts_source = DB::select('
SELECT `ShiftTypes`.`name`, `Shifts`.*, `Room`.`RID`, `Room`.`Name` AS `room_name` SELECT `ShiftTypes`.`name`, `Shifts`.*, `Room`.`RID`, `Room`.`Name` AS `room_name`
FROM `Shifts` FROM `Shifts`
JOIN `ShiftTypes` ON (`ShiftTypes`.`id` = `Shifts`.`shifttype_id`) JOIN `ShiftTypes` ON (`ShiftTypes`.`id` = `Shifts`.`shifttype_id`)
JOIN `Room` ON `Room`.`RID` = `Shifts`.`RID` JOIN `Room` ON `Room`.`RID` = `Shifts`.`RID`

@ -16,7 +16,7 @@ use Engelsystem\Database\DB;
function UserAngelType_exists($user, $angeltype) function UserAngelType_exists($user, $angeltype)
{ {
return count(DB::select(' return count(DB::select('
SELECT `id` SELECT `id`
FROM `UserAngelTypes` FROM `UserAngelTypes`
WHERE `UserAngelTypes`.`user_id`=? WHERE `UserAngelTypes`.`user_id`=?
AND `angeltype_id`=? AND `angeltype_id`=?
@ -55,10 +55,10 @@ function User_angeltypes($user)
function User_unconfirmed_AngelTypes($user) function User_unconfirmed_AngelTypes($user)
{ {
$result = DB::select(' $result = DB::select('
SELECT SELECT
`UserAngelTypes`.*, `UserAngelTypes`.*,
`AngelTypes`.`name`, `AngelTypes`.`name`,
count(`UnconfirmedMembers`.`user_id`) AS `count` count(`UnconfirmedMembers`.`user_id`) AS `count`
FROM `UserAngelTypes` FROM `UserAngelTypes`
JOIN `AngelTypes` ON `UserAngelTypes`.`angeltype_id`=`AngelTypes`.`id` JOIN `AngelTypes` ON `UserAngelTypes`.`angeltype_id`=`AngelTypes`.`id`
JOIN `UserAngelTypes` AS `UnconfirmedMembers` ON `UserAngelTypes`.`angeltype_id`=`UnconfirmedMembers`.`angeltype_id` JOIN `UserAngelTypes` AS `UnconfirmedMembers` ON `UserAngelTypes`.`angeltype_id`=`UnconfirmedMembers`.`angeltype_id`
@ -90,8 +90,8 @@ function User_is_AngelType_supporter(&$user, $angeltype)
$user['privileges'] = privileges_for_user($user['UID']); $user['privileges'] = privileges_for_user($user['UID']);
} }
return (count(DB::select(' return (count(DB::select('
SELECT `id` SELECT `id`
FROM `UserAngelTypes` FROM `UserAngelTypes`
WHERE `user_id`=? WHERE `user_id`=?
AND `angeltype_id`=? AND `angeltype_id`=?
AND `supporter`=TRUE AND `supporter`=TRUE
@ -201,7 +201,7 @@ function UserAngelType_confirm($user_angeltype_id, $confirm_user)
function UserAngelType_delete($user_angeltype) function UserAngelType_delete($user_angeltype)
{ {
return (bool)DB::delete(' return (bool)DB::delete('
DELETE FROM `UserAngelTypes` DELETE FROM `UserAngelTypes`
WHERE `id`=? WHERE `id`=?
LIMIT 1', [$user_angeltype['id']]); LIMIT 1', [$user_angeltype['id']]);
} }

@ -486,8 +486,7 @@ function User_by_password_recovery_token($token)
function User_reset_api_key(&$user, $log = true) function User_reset_api_key(&$user, $log = true)
{ {
$user['api_key'] = md5($user['Nick'] . time() . rand()); $user['api_key'] = md5($user['Nick'] . time() . rand());
DB::update( DB::update('
'
UPDATE `User` UPDATE `User`
SET `api_key`=? SET `api_key`=?
WHERE `UID`=? WHERE `UID`=?

@ -53,8 +53,7 @@ function admin_active()
} }
if (isset($_REQUEST['ack'])) { if (isset($_REQUEST['ack'])) {
DB::update('UPDATE `User` SET `Aktiv` = 0 WHERE `Tshirt` = 0'); DB::update('UPDATE `User` SET `Aktiv` = 0 WHERE `Tshirt` = 0');
$users = DB::select(sprintf( $users = DB::select(sprintf('
'
SELECT SELECT
`User`.*, `User`.*,
COUNT(`ShiftEntry`.`id`) AS `shift_count`, COUNT(`ShiftEntry`.`id`) AS `shift_count`,
@ -137,11 +136,11 @@ function admin_active()
`User`.*, `User`.*,
COUNT(`ShiftEntry`.`id`) AS `shift_count`, COUNT(`ShiftEntry`.`id`) AS `shift_count`,
%s AS `shift_length` %s AS `shift_length`
FROM `User` LEFT JOIN `ShiftEntry` ON `User`.`UID` = `ShiftEntry`.`UID` FROM `User` LEFT JOIN `ShiftEntry` ON `User`.`UID` = `ShiftEntry`.`UID`
LEFT JOIN `Shifts` ON `ShiftEntry`.`SID` = `Shifts`.`SID` ' LEFT JOIN `Shifts` ON `ShiftEntry`.`SID` = `Shifts`.`SID` '
. ($show_all_shifts ? '' : 'AND (`Shifts`.`end` < ' . time() . " OR `Shifts`.`end` IS NULL)") . ' . ($show_all_shifts ? '' : 'AND (`Shifts`.`end` < ' . time() . " OR `Shifts`.`end` IS NULL)") . '
WHERE `User`.`Gekommen` = 1 WHERE `User`.`Gekommen` = 1
GROUP BY `User`.`UID` GROUP BY `User`.`UID`
ORDER BY `force_active` DESC, `shift_length` DESC ORDER BY `force_active` DESC, `shift_length` DESC
%s %s
', ',

@ -44,10 +44,10 @@ function admin_free()
} }
$users = DB::select(' $users = DB::select('
SELECT `User`.* SELECT `User`.*
FROM `User` FROM `User`
' . $angelTypeSearch . ' ' . $angelTypeSearch . '
LEFT JOIN `ShiftEntry` ON `User`.`UID` = `ShiftEntry`.`UID` LEFT JOIN `ShiftEntry` ON `User`.`UID` = `ShiftEntry`.`UID`
LEFT JOIN `Shifts` LEFT JOIN `Shifts`
ON ( ON (
`ShiftEntry`.`SID` = `Shifts`.`SID` `ShiftEntry`.`SID` = `Shifts`.`SID`
@ -55,8 +55,8 @@ function admin_free()
AND `Shifts`.`end` > ? AND `Shifts`.`end` > ?
) )
WHERE `User`.`Gekommen` = 1 WHERE `User`.`Gekommen` = 1
AND `Shifts`.`SID` IS NULL AND `Shifts`.`SID` IS NULL
GROUP BY `User`.`UID` GROUP BY `User`.`UID`
ORDER BY `Nick` ORDER BY `Nick`
', ',
[ [

@ -46,7 +46,7 @@ function admin_news()
case 'save': case 'save':
DB::update(' DB::update('
UPDATE `News` SET UPDATE `News` SET
`Datum`=?, `Datum`=?,
`Betreff`=?, `Betreff`=?,
`Text`=?, `Text`=?,

@ -116,8 +116,7 @@ function admin_questions()
)); ));
if ($answer != '') { if ($answer != '') {
DB::update( DB::update('
'
UPDATE `Questions` UPDATE `Questions`
SET `AID`=?, `Answer`=? SET `AID`=?, `Answer`=?
WHERE `QID`=? WHERE `QID`=?

@ -247,7 +247,7 @@ function admin_user()
$force_active = $_REQUEST['force_active']; $force_active = $_REQUEST['force_active'];
} }
$sql = ' $sql = '
UPDATE `User` SET UPDATE `User` SET
`Nick` = ?, `Nick` = ?,
`Name` = ?, `Name` = ?,
`Vorname` = ?, `Vorname` = ?,

@ -24,7 +24,7 @@ function user_atom()
$news = DB::select(' $news = DB::select('
SELECT * SELECT *
FROM `News` FROM `News`
' . (empty($_REQUEST['meetings']) ? '' : 'WHERE `Treffen` = 1 ') . ' ' . (empty($_REQUEST['meetings']) ? '' : 'WHERE `Treffen` = 1 ') . '
ORDER BY `ID` ORDER BY `ID`
DESC LIMIT ' . (int)config('display_news') DESC LIMIT ' . (int)config('display_news')

@ -132,8 +132,8 @@ function user_myshifts()
$user_id = $_REQUEST['cancel']; $user_id = $_REQUEST['cancel'];
$shift = DB::select(' $shift = DB::select('
SELECT * SELECT *
FROM `Shifts` FROM `Shifts`
INNER JOIN `ShiftEntry` USING (`SID`) INNER JOIN `ShiftEntry` USING (`SID`)
WHERE `ShiftEntry`.`id`=? AND `UID`=? WHERE `ShiftEntry`.`id`=? AND `UID`=?
', ',
[ [

@ -186,10 +186,10 @@ function toolbar_popover($glyphicon, $label, $content, $class = '')
<script type="text/javascript"> <script type="text/javascript">
$(function(){ $(function(){
$("#' . $dom_id . '").popover({ $("#' . $dom_id . '").popover({
trigger: "focus", trigger: "focus",
html: true, html: true,
content: "' . addslashes(join('', $content)) . '", content: "' . addslashes(join('', $content)) . '",
placement: "bottom", placement: "bottom",
container: "#navbar-collapse-1" container: "#navbar-collapse-1"
}) })
}); });

@ -54,7 +54,7 @@ function UserDriverLicense_edit_view($user_source, $wants_to_drive, $user_driver
$("#driving_license").show(); $("#driving_license").show();
else else
$("#driving_license").hide(); $("#driving_license").hide();
checkbox.click( checkbox.click(
function() { function() {
if($("#wants_to_drive").is(":checked")) if($("#wants_to_drive").is(":checked"))

Loading…
Cancel
Save