lancew/DojoList

View on GitHub
controllers/admin.php

Summary

Maintainability
B
4 hrs
Test Coverage

Admin_index accesses the super-global variable $_COOKIE.
Open

function Admin_index() 
{
    if (isset($_COOKIE["user"]) ) {
        return html('admin/index.html.php');
    } else {
Severity: Minor
Found in controllers/admin.php by phpmd

Superglobals

Since: 0.2

Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.

Example

class Foo {
    public function bar() {
        $name = $_POST['foo'];
    }
}

Source

Admin_login accesses the super-global variable $_POST.
Open

function Admin_login() 
{
    if ($_POST['password'] == option('password') ) {
        setcookie("user", "Alex Porter", time()+3600);
        return html('admin/index.html.php');
Severity: Minor
Found in controllers/admin.php by phpmd

Superglobals

Since: 0.2

Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.

Example

class Foo {
    public function bar() {
        $name = $_POST['foo'];
    }
}

Source

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

function Admin_importjwm() 
{

    set_time_limit();
    $ch = curl_init("http://judoworldmap.com/");
Severity: Minor
Found in controllers/admin.php - About 1 hr to fix

    Method Admin_Create_kml has 38 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function Admin_Create_kml() 
    {
        $xml = Find_Dojo_all();
    
        $newKML = '<?xml version="1.0" encoding="UTF-8"?>
    Severity: Minor
    Found in controllers/admin.php - About 1 hr to fix

      Function Admin_importjwm has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

      function Admin_importjwm() 
      {
      
          set_time_limit();
          $ch = curl_init("http://judoworldmap.com/");
      Severity: Minor
      Found in controllers/admin.php - About 55 mins to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

      Avoid using undefined variables such as '$Newlist' which will lead to PHP notices.
      Open

          $Newlist[]='No new in far site data';
      Severity: Minor
      Found in controllers/admin.php by phpmd

      UndefinedVariable

      Since: 2.8.0

      Detects when a variable is used that has not been defined before.

      Example

      class Foo
      {
          private function bar()
          {
              // $message is undefined
              echo $message;
          }
      }

      Source https://phpmd.org/rules/cleancode.html#undefinedvariable

      The method Admin_index uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
      Open

          } else {
              return html('admin/index_login.html.php');
          }
      Severity: Minor
      Found in controllers/admin.php by phpmd

      ElseExpression

      Since: 1.4.0

      An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

      Example

      class Foo
      {
          public function bar($flag)
          {
              if ($flag) {
                  // one branch
              } else {
                  // another branch
              }
          }
      }

      Source https://phpmd.org/rules/cleancode.html#elseexpression

      The method Admin_importjwm uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
      Open

          } else {
              halt('CC License no longer on JWM site');
          }
      Severity: Minor
      Found in controllers/admin.php by phpmd

      ElseExpression

      Since: 1.4.0

      An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

      Example

      class Foo
      {
          public function bar($flag)
          {
              if ($flag) {
                  // one branch
              } else {
                  // another branch
              }
          }
      }

      Source https://phpmd.org/rules/cleancode.html#elseexpression

      The method Admin_importjwm uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
      Open

                  } else {
                      echo "<td>&nbsp;</td>";
                  }
      Severity: Minor
      Found in controllers/admin.php by phpmd

      ElseExpression

      Since: 1.4.0

      An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

      Example

      class Foo
      {
          public function bar($flag)
          {
              if ($flag) {
                  // one branch
              } else {
                  // another branch
              }
          }
      }

      Source https://phpmd.org/rules/cleancode.html#elseexpression

      The method Admin_login uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
      Open

          } else {
              return html('admin/index_login.html.php');
          }
      Severity: Minor
      Found in controllers/admin.php by phpmd

      ElseExpression

      Since: 1.4.0

      An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

      Example

      class Foo
      {
          public function bar($flag)
          {
              if ($flag) {
                  // one branch
              } else {
                  // another branch
              }
          }
      }

      Source https://phpmd.org/rules/cleancode.html#elseexpression

      Avoid unused local variables such as '$Newlist'.
      Open

          $Newlist[]='No new in far site data';
      Severity: Minor
      Found in controllers/admin.php by phpmd

      UnusedLocalVariable

      Since: 0.2

      Detects when a local variable is declared and/or assigned, but not used.

      Example

      class Foo {
          public function doSomething()
          {
              $i = 5; // Unused
          }
      }

      Source https://phpmd.org/rules/unusedcode.html#unusedlocalvariable

      The function Admin_Create_kml() contains an exit expression.
      Open

          $fh = fopen($myFile, 'w') or die("can't open file");
      Severity: Minor
      Found in controllers/admin.php by phpmd

      ExitExpression

      Since: 0.2

      An exit-expression within regular code is untestable and therefore it should be avoided. Consider to move the exit-expression into some kind of startup script where an error/exception code is returned to the calling environment.

      Example

      class Foo {
          public function bar($param)  {
              if ($param === 42) {
                  exit(23);
              }
          }
      }

      Source https://phpmd.org/rules/design.html#exitexpression

      Avoid variables with short names like $ch. Configured minimum length is 3.
      Open

          $ch = curl_init("http://judoworldmap.com/");
      Severity: Minor
      Found in controllers/admin.php by phpmd

      ShortVariable

      Since: 0.2

      Detects when a field, local, or parameter has a very short name.

      Example

      class Something {
          private $q = 15; // VIOLATION - Field
          public static function main( array $as ) { // VIOLATION - Formal
              $r = 20 + $this->q; // VIOLATION - Local
              for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
                  $r += $this->q;
              }
          }
      }

      Source https://phpmd.org/rules/naming.html#shortvariable

      Avoid variables with short names like $fp. Configured minimum length is 3.
      Open

          $fp = fopen("data/jwm.txt", "w");
      Severity: Minor
      Found in controllers/admin.php by phpmd

      ShortVariable

      Since: 0.2

      Detects when a field, local, or parameter has a very short name.

      Example

      class Something {
          private $q = 15; // VIOLATION - Field
          public static function main( array $as ) { // VIOLATION - Formal
              $r = 20 + $this->q; // VIOLATION - Local
              for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
                  $r += $this->q;
              }
          }
      }

      Source https://phpmd.org/rules/naming.html#shortvariable

      Avoid variables with short names like $fh. Configured minimum length is 3.
      Open

          $fh = fopen($myFile, 'w') or die("can't open file");
      Severity: Minor
      Found in controllers/admin.php by phpmd

      ShortVariable

      Since: 0.2

      Detects when a field, local, or parameter has a very short name.

      Example

      class Something {
          private $q = 15; // VIOLATION - Field
          public static function main( array $as ) { // VIOLATION - Formal
              $r = 20 + $this->q; // VIOLATION - Local
              for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
                  $r += $this->q;
              }
          }
      }

      Source https://phpmd.org/rules/naming.html#shortvariable

      The variable $Newlist is not named in camelCase.
      Open

      function Sync_new() 
      {
          $Newlist = ListDojoNotInLocal(option('sync_site'));
          set('Newlist', $Newlist);
          return html('admin/sync_new.html.php');
      Severity: Minor
      Found in controllers/admin.php by phpmd

      CamelCaseVariableName

      Since: 0.2

      It is considered best practice to use the camelCase notation to name variables.

      Example

      class ClassName {
          public function doSomething() {
              $data_module = new DataModule();
          }
      }

      Source

      The variable $LatLng is not named in camelCase.
      Open

      function Admin_importjwm() 
      {
      
          set_time_limit();
          $ch = curl_init("http://judoworldmap.com/");
      Severity: Minor
      Found in controllers/admin.php by phpmd

      CamelCaseVariableName

      Since: 0.2

      It is considered best practice to use the camelCase notation to name variables.

      Example

      class ClassName {
          public function doSomething() {
              $data_module = new DataModule();
          }
      }

      Source

      The variable $NewInFar is not named in camelCase.
      Open

      function sync() 
      {
          $NewInFar = DojoNotInLocal(option('sync_site'));
          $Newlist[]='No new in far site data';
          $UpdatedInFar = NewerFarDojo(option('sync_site'));
      Severity: Minor
      Found in controllers/admin.php by phpmd

      CamelCaseVariableName

      Since: 0.2

      It is considered best practice to use the camelCase notation to name variables.

      Example

      class ClassName {
          public function doSomething() {
              $data_module = new DataModule();
          }
      }

      Source

      The variable $Newlist is not named in camelCase.
      Open

      function Sync_updated() 
      {
          $Newlist = ListNewerFarDojo(option('sync_site'));
          set('Newlist', $Newlist);
          return html('admin/sync_updated.html.php');
      Severity: Minor
      Found in controllers/admin.php by phpmd

      CamelCaseVariableName

      Since: 0.2

      It is considered best practice to use the camelCase notation to name variables.

      Example

      class ClassName {
          public function doSomething() {
              $data_module = new DataModule();
          }
      }

      Source

      The variable $Lat is not named in camelCase.
      Open

      function Admin_importjwm() 
      {
      
          set_time_limit();
          $ch = curl_init("http://judoworldmap.com/");
      Severity: Minor
      Found in controllers/admin.php by phpmd

      CamelCaseVariableName

      Since: 0.2

      It is considered best practice to use the camelCase notation to name variables.

      Example

      class ClassName {
          public function doSomething() {
              $data_module = new DataModule();
          }
      }

      Source

      The variable $NewInFar is not named in camelCase.
      Open

      function sync() 
      {
          $NewInFar = DojoNotInLocal(option('sync_site'));
          $Newlist[]='No new in far site data';
          $UpdatedInFar = NewerFarDojo(option('sync_site'));
      Severity: Minor
      Found in controllers/admin.php by phpmd

      CamelCaseVariableName

      Since: 0.2

      It is considered best practice to use the camelCase notation to name variables.

      Example

      class ClassName {
          public function doSomething() {
              $data_module = new DataModule();
          }
      }

      Source

      The variable $LatLng is not named in camelCase.
      Open

      function Admin_importjwm() 
      {
      
          set_time_limit();
          $ch = curl_init("http://judoworldmap.com/");
      Severity: Minor
      Found in controllers/admin.php by phpmd

      CamelCaseVariableName

      Since: 0.2

      It is considered best practice to use the camelCase notation to name variables.

      Example

      class ClassName {
          public function doSomething() {
              $data_module = new DataModule();
          }
      }

      Source

      The variable $Newlist is not named in camelCase.
      Open

      function Sync_new() 
      {
          $Newlist = ListDojoNotInLocal(option('sync_site'));
          set('Newlist', $Newlist);
          return html('admin/sync_new.html.php');
      Severity: Minor
      Found in controllers/admin.php by phpmd

      CamelCaseVariableName

      Since: 0.2

      It is considered best practice to use the camelCase notation to name variables.

      Example

      class ClassName {
          public function doSomething() {
              $data_module = new DataModule();
          }
      }

      Source

      The variable $Lat is not named in camelCase.
      Open

      function Admin_importjwm() 
      {
      
          set_time_limit();
          $ch = curl_init("http://judoworldmap.com/");
      Severity: Minor
      Found in controllers/admin.php by phpmd

      CamelCaseVariableName

      Since: 0.2

      It is considered best practice to use the camelCase notation to name variables.

      Example

      class ClassName {
          public function doSomething() {
              $data_module = new DataModule();
          }
      }

      Source

      The variable $raw_data is not named in camelCase.
      Open

      function Admin_importjwm() 
      {
      
          set_time_limit();
          $ch = curl_init("http://judoworldmap.com/");
      Severity: Minor
      Found in controllers/admin.php by phpmd

      CamelCaseVariableName

      Since: 0.2

      It is considered best practice to use the camelCase notation to name variables.

      Example

      class ClassName {
          public function doSomething() {
              $data_module = new DataModule();
          }
      }

      Source

      The variable $raw_data is not named in camelCase.
      Open

      function Admin_importjwm() 
      {
      
          set_time_limit();
          $ch = curl_init("http://judoworldmap.com/");
      Severity: Minor
      Found in controllers/admin.php by phpmd

      CamelCaseVariableName

      Since: 0.2

      It is considered best practice to use the camelCase notation to name variables.

      Example

      class ClassName {
          public function doSomething() {
              $data_module = new DataModule();
          }
      }

      Source

      The variable $data_array is not named in camelCase.
      Open

      function Admin_importjwm() 
      {
      
          set_time_limit();
          $ch = curl_init("http://judoworldmap.com/");
      Severity: Minor
      Found in controllers/admin.php by phpmd

      CamelCaseVariableName

      Since: 0.2

      It is considered best practice to use the camelCase notation to name variables.

      Example

      class ClassName {
          public function doSomething() {
              $data_module = new DataModule();
          }
      }

      Source

      The variable $LatLng is not named in camelCase.
      Open

      function Admin_importjwm() 
      {
      
          set_time_limit();
          $ch = curl_init("http://judoworldmap.com/");
      Severity: Minor
      Found in controllers/admin.php by phpmd

      CamelCaseVariableName

      Since: 0.2

      It is considered best practice to use the camelCase notation to name variables.

      Example

      class ClassName {
          public function doSomething() {
              $data_module = new DataModule();
          }
      }

      Source

      The variable $Lng is not named in camelCase.
      Open

      function Admin_importjwm() 
      {
      
          set_time_limit();
          $ch = curl_init("http://judoworldmap.com/");
      Severity: Minor
      Found in controllers/admin.php by phpmd

      CamelCaseVariableName

      Since: 0.2

      It is considered best practice to use the camelCase notation to name variables.

      Example

      class ClassName {
          public function doSomething() {
              $data_module = new DataModule();
          }
      }

      Source

      The variable $Newlist is not named in camelCase.
      Open

      function Sync_updated() 
      {
          $Newlist = ListNewerFarDojo(option('sync_site'));
          set('Newlist', $Newlist);
          return html('admin/sync_updated.html.php');
      Severity: Minor
      Found in controllers/admin.php by phpmd

      CamelCaseVariableName

      Since: 0.2

      It is considered best practice to use the camelCase notation to name variables.

      Example

      class ClassName {
          public function doSomething() {
              $data_module = new DataModule();
          }
      }

      Source

      The variable $UpdatedInFar is not named in camelCase.
      Open

      function sync() 
      {
          $NewInFar = DojoNotInLocal(option('sync_site'));
          $Newlist[]='No new in far site data';
          $UpdatedInFar = NewerFarDojo(option('sync_site'));
      Severity: Minor
      Found in controllers/admin.php by phpmd

      CamelCaseVariableName

      Since: 0.2

      It is considered best practice to use the camelCase notation to name variables.

      Example

      class ClassName {
          public function doSomething() {
              $data_module = new DataModule();
          }
      }

      Source

      The variable $raw_data is not named in camelCase.
      Open

      function Admin_importjwm() 
      {
      
          set_time_limit();
          $ch = curl_init("http://judoworldmap.com/");
      Severity: Minor
      Found in controllers/admin.php by phpmd

      CamelCaseVariableName

      Since: 0.2

      It is considered best practice to use the camelCase notation to name variables.

      Example

      class ClassName {
          public function doSomething() {
              $data_module = new DataModule();
          }
      }

      Source

      The variable $Lng is not named in camelCase.
      Open

      function Admin_importjwm() 
      {
      
          set_time_limit();
          $ch = curl_init("http://judoworldmap.com/");
      Severity: Minor
      Found in controllers/admin.php by phpmd

      CamelCaseVariableName

      Since: 0.2

      It is considered best practice to use the camelCase notation to name variables.

      Example

      class ClassName {
          public function doSomething() {
              $data_module = new DataModule();
          }
      }

      Source

      The variable $dojo_array is not named in camelCase.
      Open

      function Admin_importjwm() 
      {
      
          set_time_limit();
          $ch = curl_init("http://judoworldmap.com/");
      Severity: Minor
      Found in controllers/admin.php by phpmd

      CamelCaseVariableName

      Since: 0.2

      It is considered best practice to use the camelCase notation to name variables.

      Example

      class ClassName {
          public function doSomething() {
              $data_module = new DataModule();
          }
      }

      Source

      The variable $Newlist is not named in camelCase.
      Open

      function sync() 
      {
          $NewInFar = DojoNotInLocal(option('sync_site'));
          $Newlist[]='No new in far site data';
          $UpdatedInFar = NewerFarDojo(option('sync_site'));
      Severity: Minor
      Found in controllers/admin.php by phpmd

      CamelCaseVariableName

      Since: 0.2

      It is considered best practice to use the camelCase notation to name variables.

      Example

      class ClassName {
          public function doSomething() {
              $data_module = new DataModule();
          }
      }

      Source

      The variable $Lat is not named in camelCase.
      Open

      function Admin_importjwm() 
      {
      
          set_time_limit();
          $ch = curl_init("http://judoworldmap.com/");
      Severity: Minor
      Found in controllers/admin.php by phpmd

      CamelCaseVariableName

      Since: 0.2

      It is considered best practice to use the camelCase notation to name variables.

      Example

      class ClassName {
          public function doSomething() {
              $data_module = new DataModule();
          }
      }

      Source

      The variable $data_array is not named in camelCase.
      Open

      function Admin_importjwm() 
      {
      
          set_time_limit();
          $ch = curl_init("http://judoworldmap.com/");
      Severity: Minor
      Found in controllers/admin.php by phpmd

      CamelCaseVariableName

      Since: 0.2

      It is considered best practice to use the camelCase notation to name variables.

      Example

      class ClassName {
          public function doSomething() {
              $data_module = new DataModule();
          }
      }

      Source

      The variable $UpdatedInFar is not named in camelCase.
      Open

      function sync() 
      {
          $NewInFar = DojoNotInLocal(option('sync_site'));
          $Newlist[]='No new in far site data';
          $UpdatedInFar = NewerFarDojo(option('sync_site'));
      Severity: Minor
      Found in controllers/admin.php by phpmd

      CamelCaseVariableName

      Since: 0.2

      It is considered best practice to use the camelCase notation to name variables.

      Example

      class ClassName {
          public function doSomething() {
              $data_module = new DataModule();
          }
      }

      Source

      The variable $Lng is not named in camelCase.
      Open

      function Admin_importjwm() 
      {
      
          set_time_limit();
          $ch = curl_init("http://judoworldmap.com/");
      Severity: Minor
      Found in controllers/admin.php by phpmd

      CamelCaseVariableName

      Since: 0.2

      It is considered best practice to use the camelCase notation to name variables.

      Example

      class ClassName {
          public function doSomething() {
              $data_module = new DataModule();
          }
      }

      Source

      The variable $dojo_array is not named in camelCase.
      Open

      function Admin_importjwm() 
      {
      
          set_time_limit();
          $ch = curl_init("http://judoworldmap.com/");
      Severity: Minor
      Found in controllers/admin.php by phpmd

      CamelCaseVariableName

      Since: 0.2

      It is considered best practice to use the camelCase notation to name variables.

      Example

      class ClassName {
          public function doSomething() {
              $data_module = new DataModule();
          }
      }

      Source

      There are no issues that match your filters.

      Category
      Status