fossasia/engelsystem

View on GitHub

Showing 271 of 271 total issues

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

if (count($tokens) > 0) {
$match = false;
$index = join(" ", $usr);
foreach ($tokens as $t)
if (stristr($index, trim($t))) {
Severity: Minor
Found in includes/view/User_view.php and 2 other locations - About 30 mins to fix
includes/controller/admin_arrive_controller.php on lines 46..56
includes/controller/admin_free_controller.php on lines 37..47

Avoid too many return statements within this method.
Open

return '<span class="text-danger moment-countdown" data-timestamp="' . $upcoming_shifts[0]['start'] . '">' . _("Shift starts %c") . '</span>';
Severity: Major
Found in includes/view/User_view.php - About 30 mins to fix

    Avoid too many return statements within this method.
    Open

    return '<span class="text-danger moment-countdown" data-timestamp="' . $upcoming_shifts[0]['end'] . '">' . _("Shift ends %c") . '</span>';
    Severity: Major
    Found in includes/view/User_view.php - About 30 mins to fix

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

      if (count($tokens) > 0) {
      $match = false;
      $index = join("", $usr);
      foreach ($tokens as $t)
      if (stristr($index, trim($t))) {
      Severity: Minor
      Found in includes/controller/admin_free_controller.php and 2 other locations - About 30 mins to fix
      includes/controller/admin_arrive_controller.php on lines 46..56
      includes/view/User_view.php on lines 66..76

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

      if (count($tokens) > 0) {
      $match = false;
      $index = join(" ", $usr);
      foreach ($tokens as $t)
      if (stristr($index, trim($t))) {
      Severity: Minor
      Found in includes/controller/admin_arrive_controller.php and 2 other locations - About 30 mins to fix
      includes/controller/admin_free_controller.php on lines 37..47
      includes/view/User_view.php on lines 66..76

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

      function ShiftType_update($shifttype_id, $name, $angeltype_id, $description) {
      return sql_query("UPDATE `ShiftTypes` SET
      `name`='" . sql_escape($name) . "',
      `angeltype_id`=" . sql_null($angeltype_id) . ",
      `description`='" . sql_escape($description) . "'
      Severity: Minor
      Found in includes/model/ShiftTypes_model.php and 1 other location - About 30 mins to fix
      includes/model/User_model.php on lines 702..709

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

      function update_user_sn($twitter, $facebook, $github, $uid) {
      return sql_query("
      UPDATE `User` SET
      `twitter`='" . sql_escape($twitter) . "',
      `facebook`='" . sql_escape($facebook) . "',
      Severity: Minor
      Found in includes/model/User_model.php and 1 other location - About 30 mins to fix
      includes/model/ShiftTypes_model.php on lines 19..25

      Function shifttype_controller has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

      function shifttype_controller() {
      if (! isset($_REQUEST['shifttype_id']))
      redirect(page_link_to('shifttypes'));
      $shifttype = ShiftType($_REQUEST['shifttype_id']);
      if ($shifttype === false)
      Severity: Minor
      Found in includes/controller/shifttypes_controller.php - About 25 mins to fix

      Function angeltype_delete_controller has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

      function angeltype_delete_controller() {
      global $privileges, $user;
       
      if (! in_array('admin_angel_types', $privileges))
      redirect(page_link_to('angeltypes'));
      Severity: Minor
      Found in includes/controller/angeltypes_controller.php - About 25 mins to fix

      Function shifttype_delete_controller has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

      function shifttype_delete_controller() {
      if (! isset($_REQUEST['shifttype_id']))
      redirect(page_link_to('shifttypes'));
      $shifttype = ShiftType($_REQUEST['shifttype_id']);
      if ($shifttype === false)
      Severity: Minor
      Found in includes/controller/shifttypes_controller.php - About 25 mins to fix

      Function Shift_signup_button_render has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

      function Shift_signup_button_render($shift, $angeltype, $user_angeltype = null, $user_shifts = null) {
      global $user;
       
      if ($user_angeltype == null) {
      $user_angeltype = UserAngelType_by_User_and_AngelType($user, $angeltype);
      Severity: Minor
      Found in includes/view/Shifts_view.php - About 25 mins to fix
      Severity
      Category
      Status
      Source
      Language