fix codacy unused code

This commit is contained in:
msquare 2016-08-21 18:00:24 +02:00
parent 29cbd4a9dd
commit 53ad1b5110
20 changed files with 15 additions and 40 deletions

View File

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

View File

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

View File

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

View File

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

View File

@ -60,7 +60,7 @@ function mail_shift_delete($shift) {
$message = _("A Shift you are registered on was deleted:") . "\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 .= $room["Name"] . "\n";

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -105,7 +105,7 @@ function guest_register() {
}
$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]))
$selected_angel_types[] = $angel_type_id;
@ -252,7 +252,7 @@ function guest_logout() {
}
function guest_login() {
global $user, $privileges;
global $privileges;
$nick = "";

View File

@ -2,7 +2,7 @@
// publically available page to feed the news to feedreaders
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']))
$key = $_REQUEST['key'];

View File

@ -8,7 +8,6 @@ function myshifts_title() {
function user_myshifts() {
global $LETZTES_AUSTRAGEN;
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) {
$id = $_REQUEST['id'];

View File

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

View File

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

View File

@ -5,7 +5,7 @@ function shifts_title() {
}
function user_shifts() {
global $user, $privileges, $max_freeloadable_shifts;
global $user, $privileges;
if (User_is_freeloader($user))
redirect(page_link_to('user_myshifts'));
@ -162,7 +162,7 @@ function user_shifts() {
$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."));
redirect(shift_link([
@ -171,8 +171,6 @@ function user_shifts() {
}
}
$room_select = html_select_key('rid', 'rid', $room_array, $rid);
$angel_types = "";
foreach ($types as $type)
$angel_types .= form_spinner('type_' . $type['id'], $type['name'], $needed_angel_types[$type['id']]);

View File

@ -139,19 +139,6 @@ function make_navigation() {
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() {
return make_navigation();
}

View File

@ -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']);
$myshifts_table = array();
$html = "";
$timesum = 0;
foreach ($shifts as $shift) {
$shift_info = '<a href="' . shift_link($shift) . '">' . $shift['name'] . '</a>';