XoopsModules25x/apcal

View on GitHub
admin/events.php

Summary

Maintainability
D
3 days
Test Coverage

File events.php has 304 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
/*
 * You may not change or alter any portion of this comment or credits
 * of supporting developers from this source code or any supporting source code
 * which is considered copyrighted (c) material of the original comment or credit authors.
Severity: Minor
Found in admin/events.php - About 3 hrs to fix

    Consider simplifying this complex logical expression.
    Open

    if (isset($_POST['delete'])) {
    
        // Ticket Check
        if (!$xoopsGTicket->check()) {
            redirect_header(XOOPS_URL . '/', 3, $xoopsGTicket->getErrors());
    Severity: Critical
    Found in admin/events.php - About 2 hrs to fix

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

      if (isset($_POST['delete'])) {
      
          // Ticket Check
          if (!$xoopsGTicket->check()) {
              redirect_header(XOOPS_URL . '/', 3, $xoopsGTicket->getErrors());
      Severity: Major
      Found in admin/events.php and 1 other location - About 1 day to fix
      admin/admission.php on lines 116..143

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 254.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

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

      switch ($tz) {
          case 's':
              $tzoffset  = 0;
              $tzdisp    = ($serverTZ >= 0 ? '+' : '-') . sprintf('%02d:%02d', abs($serverTZ), abs($serverTZ) * 60 % 60);
              $tzoptions = str_replace("'s'>", "'s' selected>", $tzoptions);
      Severity: Major
      Found in admin/events.php and 2 other locations - About 7 hrs to fix
      admin/admission.php on lines 75..92
      admin/icalendar_import.php on lines 66..83

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 235.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

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

          if ($event->allday) {
              $start_desc = date(_AM_APCAL_DTFMT_LIST_ALLDAY, $event->start) . '<br>(' . _APCAL_MB_ALLDAY_EVENT . ')';
              $end_desc   = date(_AM_APCAL_DTFMT_LIST_ALLDAY, $event->end - 300) . '<br>(' . _APCAL_MB_ALLDAY_EVENT . ')';
          } else {
              $start_desc = date(_AM_APCAL_DTFMT_LIST_NORMAL, $event->start + $tzoffset);
      Severity: Major
      Found in admin/events.php and 2 other locations - About 2 hrs to fix
      admin/admission.php on lines 232..238
      admin/icalendar_import.php on lines 256..262

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 140.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Blank line found at start of control structure
      Open

      if (isset($_POST['delete'])) {
      Severity: Minor
      Found in admin/events.php by phpcodesniffer

      Blank line found at start of control structure
      Open

      } elseif (isset($_POST['addlink']) && isset($_POST['ids']) && is_array($_POST['ids']) && $_POST['cid'] > 0) {
      Severity: Minor
      Found in admin/events.php by phpcodesniffer

      Blank line found at start of control structure
      Open

      ) {
      Severity: Minor
      Found in admin/events.php by phpcodesniffer

      Blank line found at start of control structure
      Open

      } elseif (isset($_POST['output_ics_confirm']) && !empty($_POST['ids']) && is_array($_POST['ids'])) {
      Severity: Minor
      Found in admin/events.php by phpcodesniffer

      Line exceeds 120 characters; contains 132 characters
      Open

      $nav      = new XoopsPageNav($numrows, $num, $pos, 'pos', "cid=$cid&amp;tz=$tz&amp;num=$num&amp;pf=$pf&amp;txt=" . urlencode($txt));
      Severity: Minor
      Found in admin/events.php by phpcodesniffer

      Line exceeds 120 characters; contains 135 characters
      Open

      <form class='apcalForm' id='MainForm' name='MainForm' action='?tz=$tz&amp;num=$num&amp;cid=$cid' method='post' style='margin-top:0px;'>
      Severity: Minor
      Found in admin/events.php by phpcodesniffer

      Line exceeds 120 characters; contains 171 characters
      Open

      $cat_selbox4extract = str_replace("<option value='0'>", "<option value='0'>" . _ALL . "</option>\n<option value='-1'" . ($cid == -1 ? 'selected' : '') . '>', $cat_selbox);
      Severity: Minor
      Found in admin/events.php by phpcodesniffer

      Line exceeds 120 characters; contains 129 characters
      Open

          $sql = "UPDATE $cal->table SET categories=CONCAT(categories,'$cid4sql') WHERE ($whr 0) AND categories NOT LIKE '%$cid4sql%'";
      Severity: Minor
      Found in admin/events.php by phpcodesniffer

      Line exceeds 120 characters; contains 183 characters
      Open

          <th><input type='checkbox' name='dummy' onclick=\"with(document.MainForm){for (i=0;i<length;i++) {if (elements[i].type=='checkbox') {elements[i].checked=this.checked;}}}\" /></th>
      Severity: Minor
      Found in admin/events.php by phpcodesniffer

      Line exceeds 120 characters; contains 170 characters
      Open

      <p><style='color: blue; '>" . (isset($_GET['mes']) ? htmlspecialchars($_GET['mes'], ENT_QUOTES) : '') . "</style></p>\n" . (isset($confirm_html) ? $confirm_html : '') . "
      Severity: Minor
      Found in admin/events.php by phpcodesniffer

      Line exceeds 120 characters; contains 206 characters
      Open

          <td class='$oddeven' align='right'><a href='$mod_url/index.php?action=Edit&amp;event_id=$event->id' target='_blank'><img src='$cal->images_url/addevent.gif' border='0' width='14' height='12' /></a></td>
      Severity: Minor
      Found in admin/events.php by phpcodesniffer

      There are no issues that match your filters.

      Category
      Status