fix codacy unused code

main
msquare 8 years ago
parent 29cbd4a9dd
commit 53ad1b5110

@ -42,7 +42,7 @@ function angeltype_link($angeltype_id) {
* Job description for all angeltypes (public to everyone) * Job description for all angeltypes (public to everyone)
*/ */
function angeltypes_about_controller() { function angeltypes_about_controller() {
global $privileges, $user; global $user;
if (isset($user)) if (isset($user))
$angeltypes = AngelTypes_with_user($user); $angeltypes = AngelTypes_with_user($user);

@ -23,7 +23,7 @@ function user_angeltypes_unconfirmed_hint() {
* Remove all unconfirmed users from a specific angeltype. * Remove all unconfirmed users from a specific angeltype.
*/ */
function user_angeltypes_delete_all_controller() { function user_angeltypes_delete_all_controller() {
global $user, $privileges; global $user;
if (! isset($_REQUEST['angeltype_id'])) { if (! isset($_REQUEST['angeltype_id'])) {
error(_("Angeltype doesn't exist.")); error(_("Angeltype doesn't exist."));

@ -30,7 +30,7 @@ function user_driver_license_required_hint() {
* Route user driver licenses actions. * Route user driver licenses actions.
*/ */
function user_driver_licenses_controller() { function user_driver_licenses_controller() {
global $privileges, $user; global $user;
if (! isset($user)) if (! isset($user))
redirect(page_link_to('')); redirect(page_link_to(''));

@ -4,7 +4,7 @@
* Route user actions. * Route user actions.
*/ */
function users_controller() { function users_controller() {
global $privileges, $user; global $user;
if (! isset($user)) if (! isset($user))
redirect(page_link_to('')); redirect(page_link_to(''));

@ -60,7 +60,7 @@ function mail_shift_delete($shift) {
$message = _("A Shift you are registered on was deleted:") . "\n"; $message = _("A Shift you are registered on was deleted:") . "\n";
$message .= $shift["name"] . "\n"; $message .= $shift["name"] . "\n";
$message .= $new_shift["title"] . "\n"; $message .= $shift["title"] . "\n";
$message .= date("Y-m-d H:i", $shift["start"]) . " - " . date("H:i", $shift["end"]) . "\n"; $message .= date("Y-m-d H:i", $shift["start"]) . " - " . date("H:i", $shift["end"]) . "\n";
$message .= $room["Name"] . "\n"; $message .= $room["Name"] . "\n";

@ -189,7 +189,6 @@ function sql_bool($boolean) {
* @return int Count of result lines * @return int Count of result lines
*/ */
function sql_num_query($query) { function sql_num_query($query) {
global $sql_connection;
return sql_query($query)->num_rows; return sql_query($query)->num_rows;
} }

@ -5,7 +5,7 @@ function admin_active_title() {
} }
function admin_active() { function admin_active() {
global $tshirt_sizes, $shift_sum_formula; global $tshirt_sizes;
$msg = ""; $msg = "";
$search = ""; $search = "";
@ -146,7 +146,7 @@ function admin_active() {
} }
$shirt_statistics = []; $shirt_statistics = [];
foreach ($tshirt_sizes as $size => $_) { foreach (array_keys($tshirt_sizes) as $size) {
if ($size != '') { if ($size != '') {
$shirt_statistics[] = [ $shirt_statistics[] = [
'size' => $size, 'size' => $size,

@ -36,7 +36,6 @@ function admin_arrive() {
$arrival_count_at_day = []; $arrival_count_at_day = [];
$planned_arrival_count_at_day = []; $planned_arrival_count_at_day = [];
$planned_departure_count_at_day = []; $planned_departure_count_at_day = [];
$table = "";
$users_matched = []; $users_matched = [];
if ($search == "") if ($search == "")
$tokens = []; $tokens = [];
@ -104,7 +103,7 @@ function admin_arrive() {
]; ];
} }
$planned_arrival_sum_at_day = []; $planned_arrival_at_day = [];
$planned_arrival_sum = 0; $planned_arrival_sum = 0;
foreach ($planned_arrival_count_at_day as $day => $count) { foreach ($planned_arrival_count_at_day as $day => $count) {
$planned_arrival_sum += $count; $planned_arrival_sum += $count;

@ -4,8 +4,6 @@ function admin_groups_title() {
} }
function admin_groups() { function admin_groups() {
global $user;
$html = ""; $html = "";
$groups = sql_select("SELECT * FROM `Groups` ORDER BY `Name`"); $groups = sql_select("SELECT * FROM `Groups` ORDER BY `Name`");
if (! isset($_REQUEST["action"])) { if (! isset($_REQUEST["action"])) {

@ -4,7 +4,7 @@ function admin_questions_title() {
} }
function admin_new_questions() { function admin_new_questions() {
global $user, $privileges; global $privileges;
if (in_array("admin_questions", $privileges)) { if (in_array("admin_questions", $privileges)) {
$new_messages = sql_num_query("SELECT * FROM `Questions` WHERE `AID` IS NULL"); $new_messages = sql_num_query("SELECT * FROM `Questions` WHERE `AID` IS NULL");

@ -5,8 +5,6 @@ function admin_rooms_title() {
} }
function admin_rooms() { function admin_rooms() {
global $user;
$rooms_source = sql_select("SELECT * FROM `Room` ORDER BY `Name`"); $rooms_source = sql_select("SELECT * FROM `Room` ORDER BY `Name`");
$rooms = array(); $rooms = array();
foreach ($rooms_source as $room) foreach ($rooms_source as $room)

@ -290,7 +290,6 @@ function admin_shifts() {
if (! isset($_REQUEST['rid'])) if (! isset($_REQUEST['rid']))
$_REQUEST['rid'] = null; $_REQUEST['rid'] = null;
$room_select = html_select_key('rid', 'rid', $room_array, $_REQUEST['rid']);
$angel_types = ""; $angel_types = "";
foreach ($types as $type) foreach ($types as $type)
$angel_types .= '<div class="col-md-4">' . form_spinner('type_' . $type['id'], $type['name'], $needed_angel_types[$type['id']]) . '</div>'; $angel_types .= '<div class="col-md-4">' . form_spinner('type_' . $type['id'], $type['name'], $needed_angel_types[$type['id']]) . '</div>';

@ -105,7 +105,7 @@ function guest_register() {
} }
$selected_angel_types = array(); $selected_angel_types = array();
foreach ($angel_types as $angel_type_id => $angel_type_name) foreach (array_keys($angel_types) as $angel_type_id)
if (isset($_REQUEST['angel_types_' . $angel_type_id])) if (isset($_REQUEST['angel_types_' . $angel_type_id]))
$selected_angel_types[] = $angel_type_id; $selected_angel_types[] = $angel_type_id;
@ -252,7 +252,7 @@ function guest_logout() {
} }
function guest_login() { function guest_login() {
global $user, $privileges; global $privileges;
$nick = ""; $nick = "";

@ -2,7 +2,7 @@
// publically available page to feed the news to feedreaders // publically available page to feed the news to feedreaders
function user_atom() { function user_atom() {
global $ical_shifts, $user, $DISPLAY_NEWS; global $user, $DISPLAY_NEWS;
if (isset ($_REQUEST['key']) && preg_match("/^[0-9a-f]{32}$/", $_REQUEST['key'])) if (isset ($_REQUEST['key']) && preg_match("/^[0-9a-f]{32}$/", $_REQUEST['key']))
$key = $_REQUEST['key']; $key = $_REQUEST['key'];

@ -8,7 +8,6 @@ function myshifts_title() {
function user_myshifts() { function user_myshifts() {
global $LETZTES_AUSTRAGEN; global $LETZTES_AUSTRAGEN;
global $user, $privileges; global $user, $privileges;
$msg = "";
if (isset($_REQUEST['id']) && in_array("user_shifts_admin", $privileges) && preg_match("/^[0-9]{1,}$/", $_REQUEST['id']) && sql_num_query("SELECT * FROM `User` WHERE `UID`='" . sql_escape($_REQUEST['id']) . "'") > 0) { if (isset($_REQUEST['id']) && in_array("user_shifts_admin", $privileges) && preg_match("/^[0-9]{1,}$/", $_REQUEST['id']) && sql_num_query("SELECT * FROM `User` WHERE `UID`='" . sql_escape($_REQUEST['id']) . "'") > 0) {
$id = $_REQUEST['id']; $id = $_REQUEST['id'];

@ -12,7 +12,7 @@ function meetings_title() {
} }
function user_meetings() { function user_meetings() {
global $DISPLAY_NEWS, $privileges, $user; global $DISPLAY_NEWS, $user;
$html = '<div class="col-md-12"><h1>' . meetings_title() . '</h1>' . msg(); $html = '<div class="col-md-12"><h1>' . meetings_title() . '</h1>' . msg();

@ -21,7 +21,6 @@ function user_settings() {
$jabber = $user['jabber']; $jabber = $user['jabber'];
$hometown = $user['Hometown']; $hometown = $user['Hometown'];
$tshirt_size = $user['Size']; $tshirt_size = $user['Size'];
$password_hash = "";
$selected_theme = $user['color']; $selected_theme = $user['color'];
$selected_language = $user['Sprache']; $selected_language = $user['Sprache'];
$planned_arrival_date = $user['planned_arrival_date']; $planned_arrival_date = $user['planned_arrival_date'];

@ -5,7 +5,7 @@ function shifts_title() {
} }
function user_shifts() { function user_shifts() {
global $user, $privileges, $max_freeloadable_shifts; global $user, $privileges;
if (User_is_freeloader($user)) if (User_is_freeloader($user))
redirect(page_link_to('user_myshifts')); redirect(page_link_to('user_myshifts'));
@ -162,7 +162,7 @@ function user_shifts() {
$needed_angel_types_info[] = $angel_types[$type_id]['name'] . ": " . $count; $needed_angel_types_info[] = $angel_types[$type_id]['name'] . ": " . $count;
} }
engelsystem_log("Updated shift '" . $name . "' from " . date("Y-m-d H:i", $start) . " to " . date("Y-m-d H:i", $end) . " with angel types " . join(", ", $needed_angel_types_info)); engelsystem_log("Updated shift '" . $shifttypes[$shifttype_id] . ", " . $title . "' from " . date("Y-m-d H:i", $start) . " to " . date("Y-m-d H:i", $end) . " with angel types " . join(", ", $needed_angel_types_info));
success(_("Shift updated.")); success(_("Shift updated."));
redirect(shift_link([ redirect(shift_link([
@ -171,8 +171,6 @@ function user_shifts() {
} }
} }
$room_select = html_select_key('rid', 'rid', $room_array, $rid);
$angel_types = ""; $angel_types = "";
foreach ($types as $type) foreach ($types as $type)
$angel_types .= form_spinner('type_' . $type['id'], $type['name'], $needed_angel_types[$type['id']]); $angel_types .= form_spinner('type_' . $type['id'], $type['name'], $needed_angel_types[$type['id']]);

@ -139,19 +139,6 @@ function make_navigation() {
return toolbar($menu); return toolbar($menu);
} }
function make_navigation_for($name, $pages) {
global $privileges, $p;
$menu = "";
foreach ($pages as $page)
if (in_array($page, $privileges))
$menu .= '<li' . ($page == $p ? ' class="selected"' : '') . '><a href="' . page_link_to($page) . '">' . $title . '</a></li>';
if ($menu != "")
$menu = '<nav class="container"><h4>' . $name . '</h4><ul class="content">' . $menu . '</ul></nav>';
return $menu;
}
function make_menu() { function make_menu() {
return make_navigation(); return make_navigation();
} }

@ -132,7 +132,6 @@ function User_view($user_source, $admin_user_privilege, $freeloader, $user_angel
$user_name = htmlspecialchars($user_source['Vorname']) . " " . htmlspecialchars($user_source['Name']); $user_name = htmlspecialchars($user_source['Vorname']) . " " . htmlspecialchars($user_source['Name']);
$myshifts_table = array(); $myshifts_table = array();
$html = "";
$timesum = 0; $timesum = 0;
foreach ($shifts as $shift) { foreach ($shifts as $shift) {
$shift_info = '<a href="' . shift_link($shift) . '">' . $shift['name'] . '</a>'; $shift_info = '<a href="' . shift_link($shift) . '">' . $shift['name'] . '</a>';

Loading…
Cancel
Save