fossasia/engelsystem

View on GitHub

Showing 271 of 271 total issues

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

if (isset($_REQUEST['event_end_date']) && $_REQUEST['event_end_date'] != '') {
if (DateTime::createFromFormat("Y-m-d", trim($_REQUEST['event_end_date']))) {
$event_end_date = DateTime::createFromFormat("Y-m-d", trim($_REQUEST['event_end_date']))->getTimestamp();
} else {
$ok = false;
Severity: Major
Found in includes/controller/admin_settings_controller.php and 3 other locations - About 1 hr to fix
includes/controller/admin_settings_controller.php on lines 32..39
includes/controller/admin_settings_controller.php on lines 41..48
includes/controller/admin_settings_controller.php on lines 59..66

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

if (isset($_REQUEST['event_start_date']) && $_REQUEST['event_start_date'] != '') {
if (DateTime::createFromFormat("Y-m-d", trim($_REQUEST['event_start_date']))) {
$event_start_date = DateTime::createFromFormat("Y-m-d", trim($_REQUEST['event_start_date']))->getTimestamp();
} else {
$ok = false;
Severity: Major
Found in includes/controller/admin_settings_controller.php and 3 other locations - About 1 hr to fix
includes/controller/admin_settings_controller.php on lines 32..39
includes/controller/admin_settings_controller.php on lines 50..57
includes/controller/admin_settings_controller.php on lines 59..66

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

if (isset($_REQUEST['teardown_end_date']) && $_REQUEST['teardown_end_date'] != '') {
if (DateTime::createFromFormat("Y-m-d", trim($_REQUEST['teardown_end_date']))) {
$teardown_end_date = DateTime::createFromFormat("Y-m-d", trim($_REQUEST['teardown_end_date']))->getTimestamp();
} else {
$ok = false;
Severity: Major
Found in includes/controller/admin_settings_controller.php and 3 other locations - About 1 hr to fix
includes/controller/admin_settings_controller.php on lines 32..39
includes/controller/admin_settings_controller.php on lines 41..48
includes/controller/admin_settings_controller.php on lines 50..57

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

if (isset($_REQUEST['buildup_start_date']) && $_REQUEST['buildup_start_date'] != '') {
if (DateTime::createFromFormat("Y-m-d", trim($_REQUEST['buildup_start_date']))) {
$buildup_start_date = DateTime::createFromFormat("Y-m-d", trim($_REQUEST['buildup_start_date']))->getTimestamp();
} else {
$ok = false;
Severity: Major
Found in includes/controller/admin_settings_controller.php and 3 other locations - About 1 hr to fix
includes/controller/admin_settings_controller.php on lines 41..48
includes/controller/admin_settings_controller.php on lines 50..57
includes/controller/admin_settings_controller.php on lines 59..66

Method admin_create_groups has 48 lines of code (exceeds 25 allowed). Consider refactoring.
Open

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

    Method admin_news has 48 lines of code (exceeds 25 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 1 hr to fix

      Function user_news has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
      Open

      function user_news() {
      global $DISPLAY_NEWS, $privileges, $user;
       
      $html = '<div class="col-md-12"><h1>' . news_title() . '</h1>' . msg();
       
       
      Severity: Minor
      Found in includes/controller/user_news_controller.php - About 1 hr to fix

      Method prepare_events has 45 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function prepare_events($file, $shifttype_id, $add_minutes_start, $add_minutes_end) {
      global $rooms_import;
      $data = read_xml($file);
       
      $rooms = Room_all();
      Severity: Minor
      Found in includes/controller/admin_import_controller.php - About 1 hr to fix

        Method ShiftEntry_edit_view has 44 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function ShiftEntry_edit_view($angel, $date, $location, $title, $type, $comment, $freeloaded, $freeload_comment, $user_admin_shifts = false) {
        if ($user_admin_shifts) {
        $freeload_form = array(
        form_checkbox('freeloaded', _("Freeloaded"), $freeloaded),
        form_textarea('freeload_comment', _("Freeload comment (Only for shift coordination):"), $freeload_comment)
        Severity: Minor
        Found in includes/view/ShiftEntry_view.php - About 1 hr to fix

          Function prepare_events has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
          Open

          function prepare_events($file, $shifttype_id, $add_minutes_start, $add_minutes_end) {
          global $rooms_import;
          $data = read_xml($file);
           
          $rooms = Room_all();
          Severity: Minor
          Found in includes/controller/admin_import_controller.php - About 1 hr to fix

          Function shift_controller has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
          Open

          function shift_controller() {
          global $user, $privileges;
           
          if (! in_array('user_shifts', $privileges))
          redirect(page_link_to('?'));
          Severity: Minor
          Found in includes/controller/shifts_controller.php - About 1 hr to fix

          Function user_angeltype_update_controller has a Cognitive Complexity of 14 (exceeds 5 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

          Method user_angeltype_delete_controller has 43 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          function user_angeltype_delete_controller() {
          global $user, $privileges;
           
          if (! isset($_REQUEST['user_angeltype_id'])) {
          error(_("User angeltype doesn't exist."));
          Severity: Minor
          Found in includes/controller/user_angeltypes_controller.php - About 1 hr to fix

            Method user_ical has 43 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            function user_ical() {
            global $ical_shifts, $user;
             
            if (isset ($_REQUEST['key']) && preg_match("/^[0-9a-f]{32}$/", $_REQUEST['key']))
            $key = $_REQUEST['key'];
            Severity: Minor
            Found in includes/controller/user_ical_controller.php - About 1 hr to fix

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

              if ($angeltype['user_angeltype_id'] != null)
              $buttons[] = button(page_link_to('user_angeltypes') . '&action=delete&user_angeltype_id=' . $angeltype['user_angeltype_id'], _("leave"), 'cancel');
              else
              $buttons[] = button(page_link_to('user_angeltypes') . '&action=add&angeltype_id=' . $angeltype['id'], _("join"), 'add');
              Severity: Major
              Found in includes/view/AngelTypes_view.php and 1 other location - About 1 hr to fix
              includes/controller/angeltypes_controller.php on lines 228..232

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

              if ($angeltype['user_angeltype_id'] != null) {
              $actions[] = button(page_link_to('user_angeltypes') . '&action=delete&user_angeltype_id=' . $angeltype['user_angeltype_id'], _("leave"), "btn-xs");
              } else {
              $actions[] = button(page_link_to('user_angeltypes') . '&action=add&angeltype_id=' . $angeltype['id'], _("join"), "btn-xs");
              }
              Severity: Major
              Found in includes/controller/angeltypes_controller.php and 1 other location - About 1 hr to fix
              includes/view/AngelTypes_view.php on lines 274..277

              Method user_angeltype_confirm_controller has 42 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              function user_angeltype_confirm_controller() {
              global $user, $privileges;
               
              if (! isset($_REQUEST['user_angeltype_id'])) {
              error(_("User angeltype doesn't exist."));
              Severity: Minor
              Found in includes/controller/user_angeltypes_controller.php - About 1 hr to fix

                Method user_questions has 42 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                function user_questions() {
                global $user;
                if (! isset($_REQUEST['action'])) {
                $open_questions = select_open_questions($user['UID']);
                $answered_questions = select_ansd_questions($user['UID']);
                Severity: Minor
                Found in includes/controller/user_questions_controller.php - About 1 hr to fix

                  Method user_news has 40 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  function user_news() {
                  global $DISPLAY_NEWS, $privileges, $user;
                   
                  $html = '<div class="col-md-12"><h1>' . news_title() . '</h1>' . msg();
                   
                   
                  Severity: Minor
                  Found in includes/controller/user_news_controller.php - About 1 hr to fix

                    Function user_delete_controller has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                    Open

                    function user_delete_controller() {
                    global $privileges, $user;
                     
                    if (isset($_REQUEST['user_id'])) {
                    $user_source = User($_REQUEST['user_id']);
                    Severity: Minor
                    Found in includes/controller/users_controller.php - About 1 hr to fix
                    Severity
                    Category
                    Status
                    Source
                    Language