fossasia/engelsystem

View on GitHub

Showing 271 of 271 total issues

Similar blocks of code found in 2 locations. Consider refactoring.
Open

} elseif (isset($_REQUEST['arrived']) && preg_match("/^[0-9]*$/", $_REQUEST['arrived'])) {
$id = $_REQUEST['arrived'];
$user_source = User($id);
if ($user_source != null) {
User_update_set_Gokemon($id);
Severity: Major
Found in includes/controller/admin_arrive_controller.php and 1 other location - About 2 hrs to fix
includes/controller/admin_arrive_controller.php on lines 13..33

Similar blocks of code found in 2 locations. Consider refactoring.
Open

if (isset($_REQUEST['reset']) && preg_match("/^[0-9]*$/", $_REQUEST['reset'])) {
$id = $_REQUEST['reset'];
$user_source = User($id);
if ($user_source != null) {
User_update_unset_Gokemon($id);
Severity: Major
Found in includes/controller/admin_arrive_controller.php and 1 other location - About 2 hrs to fix
includes/controller/admin_arrive_controller.php on lines 23..33

Method user_password_recovery_controller has 62 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function user_password_recovery_controller() {
if (isset($_REQUEST['token'])) {
$user_source = User_by_password_recovery_token($_REQUEST['token']);
if ($user_source === false)
engelsystem_error("Unable to load user.");
Severity: Major
Found in includes/controller/users_controller.php - About 2 hrs to fix

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

    $shift_row['info'] .= ' ' . table_buttons(array(
    button(page_link_to('user_shifts') . '&edit_shift=' . $shift['SID'], glyph('edit'), 'btn-xs'),
    button(page_link_to('user_shifts') . '&delete_shift=' . $shift['SID'], glyph('trash'), 'btn-xs'),
    form_checkbox('del_shifts[] btn-xs', '', '', $value = $shift['SID'], false)
    ));
    Severity: Major
    Found in includes/controller/user_shifts_controller.php and 1 other location - About 2 hrs to fix
    includes/controller/user_shifts_controller.php on lines 746..750

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

    $shifts_row .= '<div class="pull-right">' . table_buttons(array(
    button(page_link_to('user_shifts') . '&edit_shift=' . $shift['SID'], glyph('edit'), 'btn-xs'),
    button(page_link_to('user_shifts') . '&delete_shift=' . $shift['SID'], glyph('trash'), 'btn-xs'),
    form_checkbox('del_shifts[] btn-xs', '', '', $value = $shift['SID'], false)
    )). '</div>';
    Severity: Major
    Found in includes/controller/user_shifts_controller.php and 1 other location - About 2 hrs to fix
    includes/controller/user_shifts_controller.php on lines 878..882

    Function admin_create_groups has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
    Open

    function admin_create_groups() {
     
    global $user;
     
    $name = "";
    Severity: Minor
    Found in includes/controller/admin_cgroups_controller.php - About 2 hrs to fix

    Function Users_view has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
    Open

    function Users_view($users, $order_by, $arrived_count, $active_count, $force_active_count, $freeloads_count, $tshirts_count, $voucher_count) {
    $search = "";
    $users_matched = [];
    if (isset($_REQUEST['search']))
    $search = strip_request_item('search');
    Severity: Minor
    Found in includes/view/User_view.php - About 2 hrs to fix

    Similar blocks of code found in 3 locations. Consider refactoring.
    Open

    function update_rooms($name, $from_pentabarf, $public, $number, $id, $event_id) {
    return sql_query("UPDATE `Room` SET `Name`='" . sql_escape($name) . "', `FromPentabarf`='" . sql_escape($from_pentabarf) . "', `show`='" . sql_escape($public) . "', `Number`='" . sql_escape($number) . "', `e_id`='" . sql_escape($event_id) . "' WHERE `RID`='" . sql_escape($id) . "' LIMIT 1");
    }
    Severity: Major
    Found in includes/model/Room_model.php and 2 other locations - About 2 hrs to fix
    includes/model/Settings_model.php on lines 12..20
    includes/model/Settings_model.php on lines 32..40

    Similar blocks of code found in 3 locations. Consider refactoring.
    Open

    function Settings_update($event_name, $buildup_start_date, $event_start_date, $event_end_date, $teardown_end_date, $event_welcome_msg) {
    return sql_query("UPDATE `Settings` SET
    `event_name`='" . sql_escape($event_name) . "',
    `buildup_start_date`='" . sql_escape($buildup_start_date) . "',
    `event_start_date`='" . sql_escape($event_start_date) . "',
    Severity: Major
    Found in includes/model/Settings_model.php and 2 other locations - About 2 hrs to fix
    includes/model/Room_model.php on lines 84..86
    includes/model/Settings_model.php on lines 32..40

    Similar blocks of code found in 3 locations. Consider refactoring.
    Open

    function Settings_create($event_name, $buildup_start_date, $event_start_date, $event_end_date, $teardown_end_date, $event_welcome_msg) {
    return sql_query("INSERT INTO `Settings` SET
    `event_name`='" . sql_escape($event_name) . "',
    `buildup_start_date`='" . sql_escape($buildup_start_date) . "',
    `event_start_date`='" . sql_escape($event_start_date) . "',
    Severity: Major
    Found in includes/model/Settings_model.php and 2 other locations - About 2 hrs to fix
    includes/model/Room_model.php on lines 84..86
    includes/model/Settings_model.php on lines 12..20

    Method angeltype_edit_controller has 58 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function angeltype_edit_controller() {
    global $privileges, $user;
     
    $name = "";
    $restricted = false;
    Severity: Major
    Found in includes/controller/angeltypes_controller.php - About 2 hrs to fix

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

      for ($i = 0; $i < $dis_rows; $i ++) {
      if (isset($_REQUEST['page']) && $i == $_REQUEST['page'])
      $html .= '<li class="active">';
      elseif (! isset($_REQUEST['page']) && $i == 0)
      $html .= '<li class="active">';
      Severity: Major
      Found in includes/controller/user_news_controller.php and 1 other location - About 2 hrs to fix
      includes/controller/user_news_controller.php on lines 30..38

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

      for ($i = 0; $i < $dis_rows; $i ++) {
      if (isset($_REQUEST['page']) && $i == $_REQUEST['page'])
      $html .= '<li class="active">';
      elseif (! isset($_REQUEST['page']) && $i == 0)
      $html .= '<li class="active">';
      Severity: Major
      Found in includes/controller/user_news_controller.php and 1 other location - About 2 hrs to fix
      includes/controller/user_news_controller.php on lines 141..149

      Method shifttype_edit_controller has 55 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function shifttype_edit_controller() {
      $shifttype_id = null;
      $name = "";
      $angeltype_id = null;
      $description = "";
      Severity: Major
      Found in includes/controller/shifttypes_controller.php - About 2 hrs to fix

        Method update_user has 17 arguments (exceeds 4 allowed). Consider refactoring.
        Open

        function update_user($eNick, $eName, $eVorname, $eTelefon, $eHandy, $eAlter, $eDECT, $eemail, $email_shiftinfo, $ejabber, $eSize, $eGekommen, $eAktiv, $force_active, $eTshirt, $Hometown, $id) {
        Severity: Major
        Found in includes/model/User_model.php - About 2 hrs to fix

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

          div('col-sm-3 col-xs-6', [
          '<h4>' . _('Start') . '</h4>',
          '<p class="lead' . (time() >= $shift['start'] ? ' text-success' : '') . '">',
          glyph('calendar') . date('Y-m-d', $shift['start']),
          '<br />',
          Severity: Major
          Found in includes/view/Shifts_view.php and 1 other location - About 2 hrs to fix
          includes/view/Shifts_view.php on lines 95..102

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

          div('col-sm-3 col-xs-6', [
          '<h4>' . _('End') . '</h4>',
          '<p class="lead' . (time() >= $shift['end'] ? ' text-success' : '') . '">',
          glyph('calendar') . date('Y-m-d', $shift['end']),
          '<br />',
          Severity: Major
          Found in includes/view/Shifts_view.php and 1 other location - About 2 hrs to fix
          includes/view/Shifts_view.php on lines 87..94

          Function admin_news has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
          Open

          function admin_news() {
          global $user;
           
          if (! isset($_GET["action"])) {
          redirect(page_link_to("news"));
          Severity: Minor
          Found in includes/controller/admin_news_controller.php - About 2 hrs to fix

          Method update_user_details has 16 arguments (exceeds 4 allowed). Consider refactoring.
          Open

          function update_user_details($nick, $prename, $lastname, $age, $tel, $dect, $mobile, $mail, $email_shiftinfo, $jabber, $tshirt_size, $hometown, $planned_arrival_date, $planned_departure_date, $timezone, $uid) {
          Severity: Major
          Found in includes/model/User_model.php - About 2 hrs to fix

            Method user_angeltype_update_controller has 49 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            function user_angeltype_update_controller() {
            global $user, $privileges;
             
            if (! in_array('admin_angel_types', $privileges)) {
            error(_("You are not allowed to set coordinator rights."));
            Severity: Minor
            Found in includes/controller/user_angeltypes_controller.php - About 1 hr to fix
              Severity
              Category
              Status
              Source
              Language