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

Since: PHPMD 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: http://phpmd.org/rules/controversial.txt

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

Since: PHPMD 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: http://phpmd.org/rules/controversial.txt

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

      The method Admin_importjwm uses an else expression. Else is never necessary and you can simplify the code to work without else.
      Open

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

      Since: PHPMD 1.4.0

      An if expression with an else branch is never necessary. You can rewrite the conditions in a way that the else is not necessary and the code becomes simpler to read. To achieve this use early return statements. To achieve this 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: http://phpmd.org/rules/cleancode.txt

      The method Admin_importjwm uses an else expression. Else is never necessary and you can simplify the code to work without else.
      Open

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

      Since: PHPMD 1.4.0

      An if expression with an else branch is never necessary. You can rewrite the conditions in a way that the else is not necessary and the code becomes simpler to read. To achieve this use early return statements. To achieve this 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: http://phpmd.org/rules/cleancode.txt

      The method Admin_index uses an else expression. Else is never necessary and you can simplify the code to work without else.
      Open

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

      Since: PHPMD 1.4.0

      An if expression with an else branch is never necessary. You can rewrite the conditions in a way that the else is not necessary and the code becomes simpler to read. To achieve this use early return statements. To achieve this 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: http://phpmd.org/rules/cleancode.txt

      The method Admin_login uses an else expression. Else is never necessary and you can simplify the code to work without else.
      Open

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

      Since: PHPMD 1.4.0

      An if expression with an else branch is never necessary. You can rewrite the conditions in a way that the else is not necessary and the code becomes simpler to read. To achieve this use early return statements. To achieve this 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: http://phpmd.org/rules/cleancode.txt

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

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

      Since: PHPMD 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: http://phpmd.org/rules/unusedcode.txt

      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

      Since: PHPMD 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: http://phpmd.org/rules/design.txt

      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

      Since: PHPMD 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: http://phpmd.org/rules/naming.txt

      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

      Since: PHPMD 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: http://phpmd.org/rules/naming.txt

      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

      Since: PHPMD 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: http://phpmd.org/rules/naming.txt

      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

      Since: PHPMD 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: http://phpmd.org/rules/controversial.txt

      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

      Since: PHPMD 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: http://phpmd.org/rules/controversial.txt

      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

      Since: PHPMD 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: http://phpmd.org/rules/controversial.txt

      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

      Since: PHPMD 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: http://phpmd.org/rules/controversial.txt

      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

      Since: PHPMD 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: http://phpmd.org/rules/controversial.txt

      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

      Since: PHPMD 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: http://phpmd.org/rules/controversial.txt

      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

      Since: PHPMD 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: http://phpmd.org/rules/controversial.txt

      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

      Since: PHPMD 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: http://phpmd.org/rules/controversial.txt

      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

      Since: PHPMD 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: http://phpmd.org/rules/controversial.txt

      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

      Since: PHPMD 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: http://phpmd.org/rules/controversial.txt

      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

      Since: PHPMD 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: http://phpmd.org/rules/controversial.txt

      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

      Since: PHPMD 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: http://phpmd.org/rules/controversial.txt

      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

      Since: PHPMD 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: http://phpmd.org/rules/controversial.txt

      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

      Since: PHPMD 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: http://phpmd.org/rules/controversial.txt

      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

      Since: PHPMD 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: http://phpmd.org/rules/controversial.txt

      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

      Since: PHPMD 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: http://phpmd.org/rules/controversial.txt

      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

      Since: PHPMD 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: http://phpmd.org/rules/controversial.txt

      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

      Since: PHPMD 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: http://phpmd.org/rules/controversial.txt

      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

      Since: PHPMD 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: http://phpmd.org/rules/controversial.txt

      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

      Since: PHPMD 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: http://phpmd.org/rules/controversial.txt

      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

      Since: PHPMD 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: http://phpmd.org/rules/controversial.txt

      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

      Since: PHPMD 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: http://phpmd.org/rules/controversial.txt

      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

      Since: PHPMD 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: http://phpmd.org/rules/controversial.txt

      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

      Since: PHPMD 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: http://phpmd.org/rules/controversial.txt

      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

      Since: PHPMD 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: http://phpmd.org/rules/controversial.txt

      There are no issues that match your filters.

      Category
      Status