APO-Epsilon/apo-website

View on GitHub
includes/family_tree_info.php

Summary

Maintainability
A
1 hr
Test Coverage

show_info accesses the super-global variable $_GET.
Open

function show_info($access) {
  require_once("../get_photo.php");
  $user_id = $_GET['user_id'];
  $photolink = getPhotoLink($user_id);
  include("../mysql_access.php");
Severity: Minor
Found in includes/family_tree_info.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 show_info has 32 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function show_info($access) {
  require_once("../get_photo.php");
  $user_id = $_GET['user_id'];
  $photolink = getPhotoLink($user_id);
  include("../mysql_access.php");
Severity: Minor
Found in includes/family_tree_info.php - About 1 hr to fix

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

      $result = $db->query($sql);
    Severity: Minor
    Found in includes/family_tree_info.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

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

      $result = $db->query($sql);
    Severity: Minor
    Found in includes/family_tree_info.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

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

      $result = $db->query($sql);
    Severity: Minor
    Found in includes/family_tree_info.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

    Avoid unused parameters such as '$access'.
    Open

    function show_info($access) {
    Severity: Minor
    Found in includes/family_tree_info.php by phpmd

    UnusedFormalParameter

    Since: 0.2

    Avoid passing parameters to methods or constructors and then not using those parameters.

    Example

    class Foo
    {
        private function bar($howdy)
        {
            // $howdy is not used
        }
    }

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

    A file should declare new symbols (classes, functions, constants, etc.) and cause no other side effects, or it should execute logic with side effects, but should not do both. The first symbol is defined on line 13 and the first side effect is on line 2.
    Open

    <?php

    TRUE, FALSE and NULL must be lowercase; expected "true" but found "True"
    Open

    $active_page = True;

    TRUE, FALSE and NULL must be lowercase; expected "false" but found "False"
    Open

    $exec_page = False;

    TRUE, FALSE and NULL must be lowercase; expected "true" but found "True"
    Open

    $public_page = True;

    Line exceeds 120 characters; contains 389 characters
    Open

      $sql = "SELECT firstname, lastname, pledgesem, pledgeyear FROM (SELECT id, firstname, lastname, pledgesem, pledgeyear FROM contact_information UNION DISTINCT SELECT id, firstname, lastname, pledgesem, pledgeyear FROM alumni UNION DISTINCT SELECT id, firstname, lastname, pledgesem, pledgeyear FROM alumni_info WHERE pledgesem<>\"\" AND pledgeyear<>\"\")all_users WHERE id=\"$user_id\";";

    Line exceeds 120 characters; contains 391 characters
    Open

      $sql = "SELECT big_id, firstname, lastname FROM family_tree LEFT JOIN (SELECT id, firstname, lastname FROM contact_information UNION DISTINCT SELECT id, firstname, lastname FROM alumni UNION DISTINCT SELECT id, firstname, lastname FROM alumni_info WHERE pledgesem<>\"\" AND pledgeyear<>\"\")all_users ON family_tree.big_id=all_users.id WHERE little_id=\"$user_id\" ORDER BY lastname ASC;";

    Line exceeds 120 characters; contains 394 characters
    Open

      $sql = "SELECT little_id, firstname, lastname FROM family_tree LEFT JOIN (SELECT id, firstname, lastname FROM contact_information UNION DISTINCT SELECT id, firstname, lastname FROM alumni UNION DISTINCT SELECT id, firstname, lastname FROM alumni_info WHERE pledgesem<>\"\" AND pledgeyear<>\"\")all_users ON family_tree.little_id=all_users.id WHERE big_id=\"$user_id\" ORDER BY lastname ASC;";

    Line indented incorrectly; expected at least 4 spaces, found 2
    Open

      echo "</div><div class=\"small-8 columns\">";

    Line indented incorrectly; expected at least 8 spaces, found 4
    Open

        echo "</div></div>";

    Line indented incorrectly; expected at least 4 spaces, found 2
    Open

      $sql = "SELECT little_id, firstname, lastname FROM family_tree LEFT JOIN (SELECT id, firstname, lastname FROM contact_information UNION DISTINCT SELECT id, firstname, lastname FROM alumni UNION DISTINCT SELECT id, firstname, lastname FROM alumni_info WHERE pledgesem<>\"\" AND pledgeyear<>\"\")all_users ON family_tree.little_id=all_users.id WHERE big_id=\"$user_id\" ORDER BY lastname ASC;";

    Line indented incorrectly; expected at least 4 spaces, found 2
    Open

      echo "</div>";

    Line indented incorrectly; expected at least 4 spaces, found 2
    Open

      $sql = "SELECT big_id, firstname, lastname FROM family_tree LEFT JOIN (SELECT id, firstname, lastname FROM contact_information UNION DISTINCT SELECT id, firstname, lastname FROM alumni UNION DISTINCT SELECT id, firstname, lastname FROM alumni_info WHERE pledgesem<>\"\" AND pledgeyear<>\"\")all_users ON family_tree.big_id=all_users.id WHERE little_id=\"$user_id\" ORDER BY lastname ASC;";

    Line indented incorrectly; expected at least 4 spaces, found 2
    Open

      $result = $db->query($sql);

    Line indented incorrectly; expected at least 8 spaces, found 4
    Open

        echo "<div class=\"small-3 columns end text-center\"><div class=\"biglittle\" id=\"bl" . $row['little_id'] . "\">";

    Line indented incorrectly; expected at least 4 spaces, found 2
    Open

      echo "<div class=\"row\"><div class=\"small-4 columns\">";

    Opening brace should be on a new line
    Open

    function show_active() {

    Line indented incorrectly; expected at least 4 spaces, found 2
    Open

      $sql = "SELECT firstname, lastname, pledgesem, pledgeyear FROM (SELECT id, firstname, lastname, pledgesem, pledgeyear FROM contact_information UNION DISTINCT SELECT id, firstname, lastname, pledgesem, pledgeyear FROM alumni UNION DISTINCT SELECT id, firstname, lastname, pledgesem, pledgeyear FROM alumni_info WHERE pledgesem<>\"\" AND pledgeyear<>\"\")all_users WHERE id=\"$user_id\";";

    Line indented incorrectly; expected at least 4 spaces, found 2
    Open

      $result = $db->query($sql);

    Line indented incorrectly; expected 4 spaces, found 2
    Open

      }

    Line indented incorrectly; expected at least 4 spaces, found 2
    Open

      echo "<div class=\"small-12 columns\"><h5>Littles</h5>";

    Line indented incorrectly; expected at least 8 spaces, found 4
    Open

        echo "<img src=\"" . getPhotoLink($row['little_id']) . "\"><br>";

    Line indented incorrectly; expected at least 4 spaces, found 2
    Open

      echo "<p>Pledged: {$row['pledgesem']} {$row['pledgeyear']}</p></div>";

    Line indented incorrectly; expected at least 4 spaces, found 2
    Open

      show_info("public");

    Line indented incorrectly; expected at least 4 spaces, found 2
    Open

      echo "</div>";

    Line indented incorrectly; expected at least 8 spaces, found 4
    Open

        echo "</div></div>";

    Line indented incorrectly; expected at least 4 spaces, found 2
    Open

      require_once("../get_photo.php");

    Line indented incorrectly; expected at least 4 spaces, found 2
    Open

      $user_id = $_GET['user_id'];

    Line indented incorrectly; expected at least 4 spaces, found 2
    Open

      echo "<div class=\"small-12 columns\"><h5>Bigs</h5>";

    Line indented incorrectly; expected at least 4 spaces, found 2
    Open

      $photolink = getPhotoLink($user_id);

    Line indented incorrectly; expected at least 4 spaces, found 2
    Open

      echo "<img src=\"$photolink\">";

    Line indented incorrectly; expected at least 8 spaces, found 4
    Open

        echo "<div class=\"small-3 columns end text-center\"><div class=\"biglittle\" id=\"bl" . $row['big_id'] . "\">";

    Line indented incorrectly; expected at least 4 spaces, found 2
    Open

      echo "<h4>{$row['firstname']} {$row['lastname']}</h4>\n";

    Line indented incorrectly; expected at least 4 spaces, found 2
    Open

      show_info("active");

    Line indented incorrectly; expected at least 4 spaces, found 2
    Open

      die("Unable to determine user_id");

    Line indented incorrectly; expected at least 4 spaces, found 2
    Open

      include("../mysql_access.php");

    Line indented incorrectly; expected at least 8 spaces, found 4
    Open

        echo "<p>" . $row['firstname'] . " " . $row['lastname'] . "</p>";

    Line indented incorrectly; expected 4 spaces, found 2
    Open

      while ($row = mysqli_fetch_array($result)) {

    Line indented incorrectly; expected 4 spaces, found 2
    Open

      }

    Line indented incorrectly; expected at least 8 spaces, found 4
    Open

        echo "<p>" . $row['firstname'] . " " . $row['lastname'] . "</p>";

    Line indented incorrectly; expected at least 4 spaces, found 2
    Open

      $row = mysqli_fetch_array($result);

    Opening brace should be on a new line
    Open

    function show_info($access) {

    Line indented incorrectly; expected 4 spaces, found 2
    Open

      while ($row = mysqli_fetch_array($result)) {

    Opening brace should be on a new line
    Open

    function show_public() {

    Line indented incorrectly; expected at least 4 spaces, found 2
    Open

      $result = $db->query($sql);

    Line indented incorrectly; expected at least 8 spaces, found 4
    Open

        echo "<img src=\"" . getPhotoLink($row['big_id']) . "\"><br>";

    The variable $user_id is not named in camelCase.
    Open

    function show_info($access) {
      require_once("../get_photo.php");
      $user_id = $_GET['user_id'];
      $photolink = getPhotoLink($user_id);
      include("../mysql_access.php");
    Severity: Minor
    Found in includes/family_tree_info.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 $user_id is not named in camelCase.
    Open

    function show_info($access) {
      require_once("../get_photo.php");
      $user_id = $_GET['user_id'];
      $photolink = getPhotoLink($user_id);
      include("../mysql_access.php");
    Severity: Minor
    Found in includes/family_tree_info.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 $user_id is not named in camelCase.
    Open

    function show_info($access) {
      require_once("../get_photo.php");
      $user_id = $_GET['user_id'];
      $photolink = getPhotoLink($user_id);
      include("../mysql_access.php");
    Severity: Minor
    Found in includes/family_tree_info.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 $user_id is not named in camelCase.
    Open

    function show_info($access) {
      require_once("../get_photo.php");
      $user_id = $_GET['user_id'];
      $photolink = getPhotoLink($user_id);
      include("../mysql_access.php");
    Severity: Minor
    Found in includes/family_tree_info.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 $user_id is not named in camelCase.
    Open

    function show_info($access) {
      require_once("../get_photo.php");
      $user_id = $_GET['user_id'];
      $photolink = getPhotoLink($user_id);
      include("../mysql_access.php");
    Severity: Minor
    Found in includes/family_tree_info.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