railpage/railpagecore

View on GitHub
lib/Forums/Forums.php

Summary

Maintainability
F
1 wk
Test Coverage

File Forums.php has 648 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

/**
 * Forums API
 * @since Version 3.0.1
Severity: Major
Found in lib/Forums/Forums.php - About 1 day to fix

    Function buildACL has a Cognitive Complexity of 47 (exceeds 5 allowed). Consider refactoring.
    Open

        public function buildACL($force = false) {
            
            $Registry = Registry::getInstance(); 
            
            try {
    Severity: Minor
    Found in lib/Forums/Forums.php - About 7 hrs 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

    Function getReadTopics has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring.
    Open

        public function getReadTopics($user_id = false) {
            global $Error;
            
            if (!$user_id) {
                return false;
    Severity: Minor
    Found in lib/Forums/Forums.php - About 4 hrs 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

    Method buildACL has 96 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function buildACL($force = false) {
            
            $Registry = Registry::getInstance(); 
            
            try {
    Severity: Major
    Found in lib/Forums/Forums.php - About 3 hrs to fix

      The class Forums has an overall complexity of 105 which is very high. The configured complexity threshold is 50.
      Open

      class Forums extends AppCore {
          
          /**
           * Auth: list all
           * @const AUTH_LIST_ALL
      Severity: Minor
      Found in lib/Forums/Forums.php by phpmd

      Function latestPosts has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
      Open

          public function latestPosts($is_auth_ary, $since, $limit = 10) {
              if (empty($is_auth_ary) || !is_array($is_auth_ary)) {
                  return false;
              }
              
      Severity: Minor
      Found in lib/Forums/Forums.php - About 3 hrs 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

      Method getAllForums has 70 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function getAllForums() {
              $query = "SELECT f.*, c.*, lp.topic_id AS lastpost_topic_id, lp.poster_id AS lastpost_user_id, u.username AS lastpost_username, lp.post_time AS lastpost_time 
                          FROM nuke_bbforums AS f
                          LEFT JOIN nuke_bbposts AS lp ON lp.post_id = forum_last_post_id
                          LEFT JOIN nuke_bbcategories AS c ON c.cat_id = f.cat_id
      Severity: Major
      Found in lib/Forums/Forums.php - About 2 hrs to fix

        Function getReadItemsForUser has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
        Open

            public static function getReadItemsForUser(User $User, $type = "t") {
                
                /**
                 * Not logged in - no threads/forums
                 */
        Severity: Minor
        Found in lib/Forums/Forums.php - About 2 hrs 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

        Method latestPosts has 61 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function latestPosts($is_auth_ary, $since, $limit = 10) {
                if (empty($is_auth_ary) || !is_array($is_auth_ary)) {
                    return false;
                }
                
        Severity: Major
        Found in lib/Forums/Forums.php - About 2 hrs to fix

          Method newPosts has 58 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function newPosts($forums = false, $from_time = false, $items_per_page = 25, $start = 0) {
                  if (!$forums || !is_array($forums)) {
                      throw new \Exception("You must provide a list of forums this user has permission to view");
                      return false;
                  }
          Severity: Major
          Found in lib/Forums/Forums.php - About 2 hrs to fix

            Function newPosts has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
            Open

                public function newPosts($forums = false, $from_time = false, $items_per_page = 25, $start = 0) {
                    if (!$forums || !is_array($forums)) {
                        throw new \Exception("You must provide a list of forums this user has permission to view");
                        return false;
                    }
            Severity: Minor
            Found in lib/Forums/Forums.php - About 2 hrs 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

            Method getLatestPostRatings has 47 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function getLatestPostRatings($limit = 10) {
                    $query = "SELECT r.*, u.username, t.topic_title, f.forum_name, p.poster_id
                                FROM nuke_bbposts_reputation AS r 
                                    LEFT JOIN nuke_users AS u ON r.user_id = u.user_id 
                                    LEFT JOIN nuke_bbposts AS p ON r.post_id = p.post_id
            Severity: Minor
            Found in lib/Forums/Forums.php - About 1 hr to fix

              Method getReadTopics has 45 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function getReadTopics($user_id = false) {
                      global $Error;
                      
                      if (!$user_id) {
                          return false;
              Severity: Minor
              Found in lib/Forums/Forums.php - About 1 hr to fix

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

                    public static function getReadItemsForUser(User $User, $type = "t") {
                        
                        /**
                         * Not logged in - no threads/forums
                         */
                Severity: Minor
                Found in lib/Forums/Forums.php - About 1 hr to fix

                  Method getReputationTypes has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public static function getReputationTypes() {
                          $reps = array(
                              1 => array(
                                  "id" => 1,
                                  "name" => "Like",
                  Severity: Minor
                  Found in lib/Forums/Forums.php - About 1 hr to fix

                    Method getUnreadForumThreadsForUser has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public function getUnreadForumThreadsForUser(User $User, $offset = 0, $items_per_page = false) {
                            $forums = $this->getAllowedForumsIDsForUser($User, "auth_read");
                            
                            if ($items_per_page === false) {
                                $items_per_page = $User->items_per_page;
                    Severity: Minor
                    Found in lib/Forums/Forums.php - About 1 hr to fix

                      Function ranks has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                      Open

                          public function ranks() {
                              $query = "SELECT * FROM nuke_bbranks WHERE rank_special = 0";
                                  
                              if ($this->db instanceof \sql_db) {
                                  if ($rs = $this->db->query($query)) {
                      Severity: Minor
                      Found in lib/Forums/Forums.php - About 45 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 too many return statements within this method.
                      Open

                              return array(); 
                      Severity: Major
                      Found in lib/Forums/Forums.php - About 30 mins to fix

                        Avoid too many return statements within this method.
                        Open

                                    return false;
                        Severity: Major
                        Found in lib/Forums/Forums.php - About 30 mins to fix

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

                              public function getAllowedForumsIDsForUser(User $User, $permission = self::AUTH_ALL) {
                                  $acl = $this->setUser($User)->getACL(); 
                                  
                                  $ids = array(); 
                                  $allforums = $this->getAllForums();
                          Severity: Minor
                          Found in lib/Forums/Forums.php - About 25 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 buildACL() has an NPath complexity of 27792. The configured NPath complexity threshold is 200.
                          Open

                              public function buildACL($force = false) {
                                  
                                  $Registry = Registry::getInstance(); 
                                  
                                  try {
                          Severity: Minor
                          Found in lib/Forums/Forums.php by phpmd

                          NPathComplexity

                          Since: 0.1

                          The NPath complexity of a method is the number of acyclic execution paths through that method. A threshold of 200 is generally considered the point where measures should be taken to reduce complexity.

                          Example

                          class Foo {
                              function bar() {
                                  // lots of complicated code
                              }
                          }

                          Source https://phpmd.org/rules/codesize.html#npathcomplexity

                          The method buildACL() has 210 lines of code. Current threshold is set to 100. Avoid really long methods.
                          Open

                              public function buildACL($force = false) {
                                  
                                  $Registry = Registry::getInstance(); 
                                  
                                  try {
                          Severity: Minor
                          Found in lib/Forums/Forums.php by phpmd

                          The method getReadItemsForUser() has an NPath complexity of 240. The configured NPath complexity threshold is 200.
                          Open

                              public static function getReadItemsForUser(User $User, $type = "t") {
                                  
                                  /**
                                   * Not logged in - no threads/forums
                                   */
                          Severity: Minor
                          Found in lib/Forums/Forums.php by phpmd

                          NPathComplexity

                          Since: 0.1

                          The NPath complexity of a method is the number of acyclic execution paths through that method. A threshold of 200 is generally considered the point where measures should be taken to reduce complexity.

                          Example

                          class Foo {
                              function bar() {
                                  // lots of complicated code
                              }
                          }

                          Source https://phpmd.org/rules/codesize.html#npathcomplexity

                          The method latestPosts() has an NPath complexity of 240. The configured NPath complexity threshold is 200.
                          Open

                              public function latestPosts($is_auth_ary, $since, $limit = 10) {
                                  if (empty($is_auth_ary) || !is_array($is_auth_ary)) {
                                      return false;
                                  }
                                  
                          Severity: Minor
                          Found in lib/Forums/Forums.php by phpmd

                          NPathComplexity

                          Since: 0.1

                          The NPath complexity of a method is the number of acyclic execution paths through that method. A threshold of 200 is generally considered the point where measures should be taken to reduce complexity.

                          Example

                          class Foo {
                              function bar() {
                                  // lots of complicated code
                              }
                          }

                          Source https://phpmd.org/rules/codesize.html#npathcomplexity

                          The class Forums has 1171 lines of code. Current threshold is 1000. Avoid really long classes.
                          Open

                          class Forums extends AppCore {
                              
                              /**
                               * Auth: list all
                               * @const AUTH_LIST_ALL
                          Severity: Minor
                          Found in lib/Forums/Forums.php by phpmd

                          The method getReadTopics() has a Cyclomatic Complexity of 13. The configured cyclomatic complexity threshold is 10.
                          Open

                              public function getReadTopics($user_id = false) {
                                  global $Error;
                                  
                                  if (!$user_id) {
                                      return false;
                          Severity: Minor
                          Found in lib/Forums/Forums.php by phpmd

                          CyclomaticComplexity

                          Since: 0.1

                          Complexity is determined by the number of decision points in a method plus one for the method entry. The decision points are 'if', 'while', 'for', and 'case labels'. Generally, 1-4 is low complexity, 5-7 indicates moderate complexity, 8-10 is high complexity, and 11+ is very high complexity.

                          Example

                          // Cyclomatic Complexity = 11
                          class Foo {
                          1   public function example() {
                          2       if ($a == $b) {
                          3           if ($a1 == $b1) {
                                          fiddle();
                          4           } elseif ($a2 == $b2) {
                                          fiddle();
                                      } else {
                                          fiddle();
                                      }
                          5       } elseif ($c == $d) {
                          6           while ($c == $d) {
                                          fiddle();
                                      }
                          7        } elseif ($e == $f) {
                          8           for ($n = 0; $n < $h; $n++) {
                                          fiddle();
                                      }
                                  } else {
                                      switch ($z) {
                          9               case 1:
                                              fiddle();
                                              break;
                          10              case 2:
                                              fiddle();
                                              break;
                          11              case 3:
                                              fiddle();
                                              break;
                                          default:
                                              fiddle();
                                              break;
                                      }
                                  }
                              }
                          }

                          Source https://phpmd.org/rules/codesize.html#cyclomaticcomplexity

                          The method getReadItemsForUser() has a Cyclomatic Complexity of 12. The configured cyclomatic complexity threshold is 10.
                          Open

                              public static function getReadItemsForUser(User $User, $type = "t") {
                                  
                                  /**
                                   * Not logged in - no threads/forums
                                   */
                          Severity: Minor
                          Found in lib/Forums/Forums.php by phpmd

                          CyclomaticComplexity

                          Since: 0.1

                          Complexity is determined by the number of decision points in a method plus one for the method entry. The decision points are 'if', 'while', 'for', and 'case labels'. Generally, 1-4 is low complexity, 5-7 indicates moderate complexity, 8-10 is high complexity, and 11+ is very high complexity.

                          Example

                          // Cyclomatic Complexity = 11
                          class Foo {
                          1   public function example() {
                          2       if ($a == $b) {
                          3           if ($a1 == $b1) {
                                          fiddle();
                          4           } elseif ($a2 == $b2) {
                                          fiddle();
                                      } else {
                                          fiddle();
                                      }
                          5       } elseif ($c == $d) {
                          6           while ($c == $d) {
                                          fiddle();
                                      }
                          7        } elseif ($e == $f) {
                          8           for ($n = 0; $n < $h; $n++) {
                                          fiddle();
                                      }
                                  } else {
                                      switch ($z) {
                          9               case 1:
                                              fiddle();
                                              break;
                          10              case 2:
                                              fiddle();
                                              break;
                          11              case 3:
                                              fiddle();
                                              break;
                                          default:
                                              fiddle();
                                              break;
                                      }
                                  }
                              }
                          }

                          Source https://phpmd.org/rules/codesize.html#cyclomaticcomplexity

                          The method latestPosts() has a Cyclomatic Complexity of 16. The configured cyclomatic complexity threshold is 10.
                          Open

                              public function latestPosts($is_auth_ary, $since, $limit = 10) {
                                  if (empty($is_auth_ary) || !is_array($is_auth_ary)) {
                                      return false;
                                  }
                                  
                          Severity: Minor
                          Found in lib/Forums/Forums.php by phpmd

                          CyclomaticComplexity

                          Since: 0.1

                          Complexity is determined by the number of decision points in a method plus one for the method entry. The decision points are 'if', 'while', 'for', and 'case labels'. Generally, 1-4 is low complexity, 5-7 indicates moderate complexity, 8-10 is high complexity, and 11+ is very high complexity.

                          Example

                          // Cyclomatic Complexity = 11
                          class Foo {
                          1   public function example() {
                          2       if ($a == $b) {
                          3           if ($a1 == $b1) {
                                          fiddle();
                          4           } elseif ($a2 == $b2) {
                                          fiddle();
                                      } else {
                                          fiddle();
                                      }
                          5       } elseif ($c == $d) {
                          6           while ($c == $d) {
                                          fiddle();
                                      }
                          7        } elseif ($e == $f) {
                          8           for ($n = 0; $n < $h; $n++) {
                                          fiddle();
                                      }
                                  } else {
                                      switch ($z) {
                          9               case 1:
                                              fiddle();
                                              break;
                          10              case 2:
                                              fiddle();
                                              break;
                          11              case 3:
                                              fiddle();
                                              break;
                                          default:
                                              fiddle();
                                              break;
                                      }
                                  }
                              }
                          }

                          Source https://phpmd.org/rules/codesize.html#cyclomaticcomplexity

                          The method buildACL() has a Cyclomatic Complexity of 21. The configured cyclomatic complexity threshold is 10.
                          Open

                              public function buildACL($force = false) {
                                  
                                  $Registry = Registry::getInstance(); 
                                  
                                  try {
                          Severity: Minor
                          Found in lib/Forums/Forums.php by phpmd

                          CyclomaticComplexity

                          Since: 0.1

                          Complexity is determined by the number of decision points in a method plus one for the method entry. The decision points are 'if', 'while', 'for', and 'case labels'. Generally, 1-4 is low complexity, 5-7 indicates moderate complexity, 8-10 is high complexity, and 11+ is very high complexity.

                          Example

                          // Cyclomatic Complexity = 11
                          class Foo {
                          1   public function example() {
                          2       if ($a == $b) {
                          3           if ($a1 == $b1) {
                                          fiddle();
                          4           } elseif ($a2 == $b2) {
                                          fiddle();
                                      } else {
                                          fiddle();
                                      }
                          5       } elseif ($c == $d) {
                          6           while ($c == $d) {
                                          fiddle();
                                      }
                          7        } elseif ($e == $f) {
                          8           for ($n = 0; $n < $h; $n++) {
                                          fiddle();
                                      }
                                  } else {
                                      switch ($z) {
                          9               case 1:
                                              fiddle();
                                              break;
                          10              case 2:
                                              fiddle();
                                              break;
                          11              case 3:
                                              fiddle();
                                              break;
                                          default:
                                              fiddle();
                                              break;
                                      }
                                  }
                              }
                          }

                          Source https://phpmd.org/rules/codesize.html#cyclomaticcomplexity

                          The class Forums has a coupling between objects value of 14. Consider to reduce the number of dependencies under 13.
                          Open

                          class Forums extends AppCore {
                              
                              /**
                               * Auth: list all
                               * @const AUTH_LIST_ALL
                          Severity: Minor
                          Found in lib/Forums/Forums.php by phpmd

                          CouplingBetweenObjects

                          Since: 1.1.0

                          A class with too many dependencies has negative impacts on several quality aspects of a class. This includes quality criteria like stability, maintainability and understandability

                          Example

                          class Foo {
                              /**
                               * @var \foo\bar\X
                               */
                              private $x = null;
                          
                              /**
                               * @var \foo\bar\Y
                               */
                              private $y = null;
                          
                              /**
                               * @var \foo\bar\Z
                               */
                              private $z = null;
                          
                              public function setFoo(\Foo $foo) {}
                              public function setBar(\Bar $bar) {}
                              public function setBaz(\Baz $baz) {}
                          
                              /**
                               * @return \SplObjectStorage
                               * @throws \OutOfRangeException
                               * @throws \InvalidArgumentException
                               * @throws \ErrorException
                               */
                              public function process(\Iterator $it) {}
                          
                              // ...
                          }

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

                          Missing class import via use statement (line '418', column '23').
                          Open

                                      throw new \Exception("You must provide a list of forums this user has permission to view");
                          Severity: Minor
                          Found in lib/Forums/Forums.php by phpmd

                          MissingImport

                          Since: 2.7.0

                          Importing all external classes in a file through use statements makes them clearly visible.

                          Example

                          function make() {
                              return new \stdClass();
                          }

                          Source http://phpmd.org/rules/cleancode.html#MissingImport

                          Missing class import via use statement (line '453', column '27').
                          Open

                                          throw new \Exception($this->db->error); 
                          Severity: Minor
                          Found in lib/Forums/Forums.php by phpmd

                          MissingImport

                          Since: 2.7.0

                          Importing all external classes in a file through use statements makes them clearly visible.

                          Example

                          function make() {
                              return new \stdClass();
                          }

                          Source http://phpmd.org/rules/cleancode.html#MissingImport

                          The method getUnreadForumThreadsForUser has a boolean flag argument $items_per_page, which is a certain sign of a Single Responsibility Principle violation.
                          Open

                              public function getUnreadForumThreadsForUser(User $User, $offset = 0, $items_per_page = false) {
                          Severity: Minor
                          Found in lib/Forums/Forums.php by phpmd

                          BooleanArgumentFlag

                          Since: 1.4.0

                          A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.

                          Example

                          class Foo {
                              public function bar($flag = true) {
                              }
                          }

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

                          The method getReadTopics has a boolean flag argument $user_id, which is a certain sign of a Single Responsibility Principle violation.
                          Open

                              public function getReadTopics($user_id = false) {
                          Severity: Minor
                          Found in lib/Forums/Forums.php by phpmd

                          BooleanArgumentFlag

                          Since: 1.4.0

                          A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.

                          Example

                          class Foo {
                              public function bar($flag = true) {
                              }
                          }

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

                          The method newPosts has a boolean flag argument $from_time, which is a certain sign of a Single Responsibility Principle violation.
                          Open

                              public function newPosts($forums = false, $from_time = false, $items_per_page = 25, $start = 0) {
                          Severity: Minor
                          Found in lib/Forums/Forums.php by phpmd

                          BooleanArgumentFlag

                          Since: 1.4.0

                          A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.

                          Example

                          class Foo {
                              public function bar($flag = true) {
                              }
                          }

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

                          The method buildACL has a boolean flag argument $force, which is a certain sign of a Single Responsibility Principle violation.
                          Open

                              public function buildACL($force = false) {
                          Severity: Minor
                          Found in lib/Forums/Forums.php by phpmd

                          BooleanArgumentFlag

                          Since: 1.4.0

                          A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.

                          Example

                          class Foo {
                              public function bar($flag = true) {
                              }
                          }

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

                          The method newPosts has a boolean flag argument $forums, which is a certain sign of a Single Responsibility Principle violation.
                          Open

                              public function newPosts($forums = false, $from_time = false, $items_per_page = 25, $start = 0) {
                          Severity: Minor
                          Found in lib/Forums/Forums.php by phpmd

                          BooleanArgumentFlag

                          Since: 1.4.0

                          A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.

                          Example

                          class Foo {
                              public function bar($flag = true) {
                              }
                          }

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

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

                                  } else {
                                      $query = "SELECT SQL_CALC_FOUND_ROWS p.post_time, pt.bbcode_uid, pt.post_subject, pt.post_text, u.username, u.user_id, t.topic_title, t.topic_id, t.topic_views, t.topic_replies, f.forum_name, f.forum_id, ufirst.user_id AS first_user_id, ufirst.username AS first_username, pfirst.post_id AS first_post_id, pfirst.post_time AS first_post_time
                                                  FROM nuke_bbposts AS p
                                                  LEFT JOIN nuke_bbposts_text AS pt ON p.post_id = pt.post_id
                                                  LEFT JOIN nuke_users AS u ON u.user_id = p.poster_id
                          Severity: Minor
                          Found in lib/Forums/Forums.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 ranks uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
                          Open

                                      } else {
                                          trigger_error("PhpBB Base : Unable to fetch standard ranks from database");
                                          trigger_error($this->db->error);
                                          
                                          return false;
                          Severity: Minor
                          Found in lib/Forums/Forums.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 getReadTopics uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
                          Open

                                  } else {
                                      $query = "SELECT vt.topic_id, vt.time, t.forum_id, t.topic_last_post_id AS last_post_id, p.post_time AS last_post_time 
                                                  FROM viewed_threads AS vt
                                                  LEFT JOIN nuke_bbtopics AS t ON vt.topic_id = t.topic_id
                                                  LEFT JOIN nuke_bbposts AS p ON t.topic_last_post_id = p.post_id
                          Severity: Minor
                          Found in lib/Forums/Forums.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 assigning values to variables in if clauses and the like (line '364', column '17').
                          Open

                              public function getReadTopics($user_id = false) {
                                  global $Error;
                                  
                                  if (!$user_id) {
                                      return false;
                          Severity: Minor
                          Found in lib/Forums/Forums.php by phpmd

                          IfStatementAssignment

                          Since: 2.7.0

                          Assignments in if clauses and the like are considered a code smell. Assignments in PHP return the right operand as their result. In many cases, this is an expected behavior, but can lead to many difficult to spot bugs, especially when the right operand could result in zero, null or an empty string and the like.

                          Example

                          class Foo
                          {
                              public function bar($flag)
                              {
                                  if ($foo = 'bar') { // possible typo
                                      // ...
                                  }
                                  if ($baz = 0) { // always false
                                      // ...
                                  }
                              }
                          }

                          Source http://phpmd.org/rules/cleancode.html#ifstatementassignment

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

                                  } else {
                                      return $this->db->fetchAll($query); 
                                  }
                          Severity: Minor
                          Found in lib/Forums/Forums.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 getReadTopics uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
                          Open

                                      } else {
                                          return false;
                                      }
                          Severity: Minor
                          Found in lib/Forums/Forums.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 assigning values to variables in if clauses and the like (line '538', column '24').
                          Open

                              public function buildACL($force = false) {
                                  
                                  $Registry = Registry::getInstance(); 
                                  
                                  try {
                          Severity: Minor
                          Found in lib/Forums/Forums.php by phpmd

                          IfStatementAssignment

                          Since: 2.7.0

                          Assignments in if clauses and the like are considered a code smell. Assignments in PHP return the right operand as their result. In many cases, this is an expected behavior, but can lead to many difficult to spot bugs, especially when the right operand could result in zero, null or an empty string and the like.

                          Example

                          class Foo
                          {
                              public function bar($flag)
                              {
                                  if ($foo = 'bar') { // possible typo
                                      // ...
                                  }
                                  if ($baz = 0) { // always false
                                      // ...
                                  }
                              }
                          }

                          Source http://phpmd.org/rules/cleancode.html#ifstatementassignment

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

                                      } else {
                                          trigger_error("Could not fetch new posts");
                                          trigger_error($this->db->error);
                                          return false;
                                      }
                          Severity: Minor
                          Found in lib/Forums/Forums.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 assigning values to variables in if clauses and the like (line '442', column '17').
                          Open

                              public function newPosts($forums = false, $from_time = false, $items_per_page = 25, $start = 0) {
                                  if (!$forums || !is_array($forums)) {
                                      throw new \Exception("You must provide a list of forums this user has permission to view");
                                      return false;
                                  }
                          Severity: Minor
                          Found in lib/Forums/Forums.php by phpmd

                          IfStatementAssignment

                          Since: 2.7.0

                          Assignments in if clauses and the like are considered a code smell. Assignments in PHP return the right operand as their result. In many cases, this is an expected behavior, but can lead to many difficult to spot bugs, especially when the right operand could result in zero, null or an empty string and the like.

                          Example

                          class Foo
                          {
                              public function bar($flag)
                              {
                                  if ($foo = 'bar') { // possible typo
                                      // ...
                                  }
                                  if ($baz = 0) { // always false
                                      // ...
                                  }
                              }
                          }

                          Source http://phpmd.org/rules/cleancode.html#ifstatementassignment

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

                                      } else {
                                          throw new \Exception($this->db->error); 
                                          return false;
                                      } 
                          Severity: Minor
                          Found in lib/Forums/Forums.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 latestPosts uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
                          Open

                                  } else {
                                      $params = array(); 
                                      
                                      if (!empty($since) && is_int($since) && $since > 0) {
                                          $since = " AND p.post_time >= ?";
                          Severity: Minor
                          Found in lib/Forums/Forums.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 assigning values to variables in if clauses and the like (line '233', column '17').
                          Open

                              public function ranks() {
                                  $query = "SELECT * FROM nuke_bbranks WHERE rank_special = 0";
                                      
                                  if ($this->db instanceof \sql_db) {
                                      if ($rs = $this->db->query($query)) {
                          Severity: Minor
                          Found in lib/Forums/Forums.php by phpmd

                          IfStatementAssignment

                          Since: 2.7.0

                          Assignments in if clauses and the like are considered a code smell. Assignments in PHP return the right operand as their result. In many cases, this is an expected behavior, but can lead to many difficult to spot bugs, especially when the right operand could result in zero, null or an empty string and the like.

                          Example

                          class Foo
                          {
                              public function bar($flag)
                              {
                                  if ($foo = 'bar') { // possible typo
                                      // ...
                                  }
                                  if ($baz = 0) { // always false
                                      // ...
                                  }
                              }
                          }

                          Source http://phpmd.org/rules/cleancode.html#ifstatementassignment

                          Avoid assigning values to variables in if clauses and the like (line '295', column '17').
                          Open

                              public function latestPosts($is_auth_ary, $since, $limit = 10) {
                                  if (empty($is_auth_ary) || !is_array($is_auth_ary)) {
                                      return false;
                                  }
                                  
                          Severity: Minor
                          Found in lib/Forums/Forums.php by phpmd

                          IfStatementAssignment

                          Since: 2.7.0

                          Assignments in if clauses and the like are considered a code smell. Assignments in PHP return the right operand as their result. In many cases, this is an expected behavior, but can lead to many difficult to spot bugs, especially when the right operand could result in zero, null or an empty string and the like.

                          Example

                          class Foo
                          {
                              public function bar($flag)
                              {
                                  if ($foo = 'bar') { // possible typo
                                      // ...
                                  }
                                  if ($baz = 0) { // always false
                                      // ...
                                  }
                              }
                          }

                          Source http://phpmd.org/rules/cleancode.html#ifstatementassignment

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

                                      $tracking_forums = self::getReadItemsForUser($User, "f");
                          Severity: Minor
                          Found in lib/Forums/Forums.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

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

                                                  foreach ($group as $gitem => $gval) {
                          Severity: Minor
                          Found in lib/Forums/Forums.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

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

                                          $posts = array(); 
                          Severity: Minor
                          Found in lib/Forums/Forums.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

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

                                      foreach ($permissions as $item => $value) {
                          Severity: Minor
                          Found in lib/Forums/Forums.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

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

                                      $Redis = AppCore::getRedis(true); 
                          Severity: Minor
                          Found in lib/Forums/Forums.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

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

                                      $Redis = AppCore::getRedis(); 
                          Severity: Minor
                          Found in lib/Forums/Forums.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

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

                                      $tracking_topics = self::getReadItemsForUser($User);
                          Severity: Minor
                          Found in lib/Forums/Forums.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

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

                                  global $Error;
                          Severity: Minor
                          Found in lib/Forums/Forums.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

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

                                  $auth_fields = array('auth_view', 'auth_read', 'auth_post', 'auth_reply', 'auth_edit', 'auth_delete', 'auth_sticky', 'auth_announce', 'auth_vote', 'auth_pollcreate');
                          Severity: Minor
                          Found in lib/Forums/Forums.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

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

                                                  foreach ($group as $gitem => $gval) {
                          Severity: Minor
                          Found in lib/Forums/Forums.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

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

                                      if ($guestfucknamingthis[self::AUTH_ADMIN]) {
                                          $allowed = array_merge($allowed, array_keys($permissions, self::AUTH_ADMIN)); 
                                      }
                          Severity: Major
                          Found in lib/Forums/Forums.php and 3 other locations - About 1 hr to fix
                          lib/Forums/Forums.php on lines 620..622
                          lib/Forums/Forums.php on lines 636..638
                          lib/Forums/Forums.php on lines 640..642

                          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 42.

                          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

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

                                                      if ($guestfucknamingthis[self::AUTH_ADMIN]) {
                                                          $allowed = array_merge($allowed, array_keys($permissions, self::AUTH_ADMIN)); 
                                                      }
                          Severity: Major
                          Found in lib/Forums/Forums.php and 3 other locations - About 1 hr to fix
                          lib/Forums/Forums.php on lines 620..622
                          lib/Forums/Forums.php on lines 624..626
                          lib/Forums/Forums.php on lines 636..638

                          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 42.

                          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

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

                                      if ($guestfucknamingthis[self::AUTH_MOD]) {
                                          $allowed = array_merge($allowed, array_keys($permissions, self::AUTH_MOD)); 
                                      }
                          Severity: Major
                          Found in lib/Forums/Forums.php and 3 other locations - About 1 hr to fix
                          lib/Forums/Forums.php on lines 624..626
                          lib/Forums/Forums.php on lines 636..638
                          lib/Forums/Forums.php on lines 640..642

                          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 42.

                          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

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

                                                      if ($guestfucknamingthis[self::AUTH_MOD]) {
                                                          $allowed = array_merge($allowed, array_keys($permissions, self::AUTH_MOD)); 
                                                      }
                          Severity: Major
                          Found in lib/Forums/Forums.php and 3 other locations - About 1 hr to fix
                          lib/Forums/Forums.php on lines 620..622
                          lib/Forums/Forums.php on lines 624..626
                          lib/Forums/Forums.php on lines 640..642

                          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 42.

                          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

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

                              public function getCategories() {
                                  $query = "SELECT cat_id FROM nuke_bbcategories ORDER BY cat_order";
                                  
                                  foreach ($this->db->fetchAll($query) as $row) {
                                      yield new Category($row['cat_id']);
                          Severity: Major
                          Found in lib/Forums/Forums.php and 5 other locations - About 1 hr to fix
                          lib/Feedback/Feedback.php on lines 32..43
                          lib/Ideas/Ideas.php on lines 92..100
                          lib/SiteMessage/SiteMessage.php on lines 109..115
                          lib/SiteMessages/SiteMessages.php on lines 26..32
                          lib/Timetables/Timetables.php on lines 156..162

                          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 41.

                          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

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

                                  $auth_fields = array('auth_view', 'auth_read', 'auth_post', 'auth_reply', 'auth_edit', 'auth_delete', 'auth_sticky', 'auth_announce', 'auth_vote', 'auth_pollcreate');
                          Severity: Major
                          Found in lib/Forums/Forums.php and 1 other location - About 1 hr to fix
                          lib/Forums/Forums.php on lines 567..567

                          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 38.

                          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

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

                                  $a_sql = array("auth_view", "auth_read", "auth_post", "auth_reply", "auth_edit", "auth_delete", "auth_sticky", "auth_announce", "auth_vote", "auth_pollcreate");
                          Severity: Major
                          Found in lib/Forums/Forums.php and 1 other location - About 1 hr to fix
                          lib/Forums/Forums.php on lines 568..568

                          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 38.

                          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

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

                                      $row['author'] = array(
                                          "id" => $ThisUser->id,
                                          "username" => $ThisUser->username,
                                          "url" => $ThisUser->url->getURLs()
                                      );
                          Severity: Major
                          Found in lib/Forums/Forums.php and 2 other locations - About 1 hr to fix
                          lib/Forums/Forums.php on lines 904..908
                          lib/Timetables/Train.php on lines 334..338

                          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 36.

                          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

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

                                      $row['user'] = array(
                                          "id" => $ThisUser->id,
                                          "username" => $ThisUser->username,
                                          "url" => $ThisUser->url->getURLs()
                                      );
                          Severity: Major
                          Found in lib/Forums/Forums.php and 2 other locations - About 1 hr to fix
                          lib/Forums/Forums.php on lines 911..915
                          lib/Timetables/Train.php on lines 334..338

                          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 36.

                          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

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

                                      if ($rs = $this->db->query($query)) {
                                          $return = array(); 
                                          
                                          while ($row = $rs->fetch_assoc()) {
                                              $row['post_text'] = stripslashes($row['post_text']);
                          Severity: Major
                          Found in lib/Forums/Forums.php and 1 other location - About 1 hr to fix
                          lib/Forums/Forums.php on lines 233..246

                          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 33.

                          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 2 locations. Consider refactoring.
                          Open

                                          while ($row = $rs->fetch_assoc()) {
                                              $row['post_text'] = stripslashes($row['post_text']);
                                              $return[] = $row;
                                          }
                          Severity: Major
                          Found in lib/Forums/Forums.php and 1 other location - About 1 hr to fix
                          lib/Forums/Forums.php on lines 331..334

                          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 32.

                          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 2 locations. Consider refactoring.
                          Open

                                      foreach ($this->db->fetchAll($query, $params) as $row) {
                                          $row['post_text'] = stripslashes($row['post_text']);
                                          $return[] = $row;
                                      }
                          Severity: Major
                          Found in lib/Forums/Forums.php and 1 other location - About 1 hr to fix
                          lib/Forums/Forums.php on lines 298..301

                          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 32.

                          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 2 locations. Consider refactoring.
                          Open

                                      if ($rs = $this->db->query($query)) {
                                          $return = array(); 
                                          
                                          while ($row = $rs->fetch_assoc()) {
                                              $return[] = $row;
                          Severity: Major
                          Found in lib/Forums/Forums.php and 1 other location - About 1 hr to fix
                          lib/SiteMessage/Admin.php on lines 37..50

                          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 32.

                          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

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

                              public function newPosts($forums = false, $from_time = false, $items_per_page = 25, $start = 0) {
                                  if (!$forums || !is_array($forums)) {
                                      throw new \Exception("You must provide a list of forums this user has permission to view");
                                      return false;
                                  }
                          Severity: Major
                          Found in lib/Forums/Forums.php and 1 other location - About 1 hr to fix
                          lib/Locations/Locations.php on lines 286..343

                          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 31.

                          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

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

                                  return array(
                                      "offset" => $offset,
                                      "items_per_page" => $items_per_page,
                                      "total" => $this->db->fetchOne("SELECT FOUND_ROWS() AS total"),
                                      "threads" => $posts
                          Severity: Major
                          Found in lib/Forums/Forums.php and 1 other location - About 1 hr to fix
                          lib/Notifications/Notifications.php on lines 123..128

                          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 31.

                          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

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

                                      foreach ($this->db->fetchAll($query, $user_id) as $row) {
                                          $topics[$row['forum_id']]['topics'][$row['topic_id']] = $row;
                                      }
                          Severity: Major
                          Found in lib/Forums/Forums.php and 2 other locations - About 55 mins to fix
                          lib/Forums/Forums.php on lines 365..367
                          lib/Links/Links.php on lines 75..77

                          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 28.

                          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

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

                                          while ($row = $rs->fetch_assoc()) {
                                              $topics[$row['forum_id']]['topics'][$row['topic_id']] = $row;
                                          }
                          Severity: Major
                          Found in lib/Forums/Forums.php and 2 other locations - About 55 mins to fix
                          lib/Forums/Forums.php on lines 391..393
                          lib/Links/Links.php on lines 75..77

                          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 28.

                          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

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

                                      $Date = new DateTime(sprintf("@%d", $row['lastpost_time']));
                          Severity: Minor
                          Found in lib/Forums/Forums.php and 1 other location - About 55 mins to fix
                          lib/Feedback/Feedback.php on lines 79..79

                          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 28.

                          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

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

                                      $query = "SELECT p.post_id, pt.bbcode_uid, p.post_time, pt.post_text, p.enable_bbcode, p.enable_html, p.enable_smilies, p.enable_sig, p.post_edit_time, p.poster_id AS user_id, u.username, t.topic_title, t.topic_id, f.forum_name, f.forum_id
                                                  FROM nuke_bbposts p
                                                  LEFT JOIN nuke_bbposts_text AS pt ON p.post_id = pt.post_id
                                                  LEFT JOIN nuke_users AS u ON p.poster_id = u.user_id
                                                  LEFT JOIN nuke_bbtopics AS t ON p.topic_id = t.topic_id
                          Severity: Minor
                          Found in lib/Forums/Forums.php and 1 other location - About 50 mins to fix
                          lib/Forums/Forums.php on lines 317..325

                          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 27.

                          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

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

                                      $query = "SELECT p.post_id, pt.bbcode_uid, p.post_time, pt.post_text, p.enable_bbcode, p.enable_html, p.enable_smilies, p.enable_sig, p.post_edit_time, p.poster_id AS user_id, u.username, t.topic_title, t.topic_id, f.forum_name, f.forum_id
                                                  FROM nuke_bbposts p
                                                  LEFT JOIN nuke_bbposts_text AS pt ON p.post_id = pt.post_id
                                                  LEFT JOIN nuke_users AS u ON p.poster_id = u.user_id
                                                  LEFT JOIN nuke_bbtopics AS t ON p.topic_id = t.topic_id
                          Severity: Minor
                          Found in lib/Forums/Forums.php and 1 other location - About 50 mins to fix
                          lib/Forums/Forums.php on lines 285..293

                          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 27.

                          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

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

                                      6 => array(
                                          "id" => 6,
                                          "name" => "Disagree",
                                          "icon" => "<span class='glyphicon glyphicon-remove'></span>",
                                          "count" => 0
                          Severity: Major
                          Found in lib/Forums/Forums.php and 5 other locations - About 45 mins to fix
                          lib/Forums/Forums.php on lines 831..836
                          lib/Forums/Forums.php on lines 837..842
                          lib/Forums/Forums.php on lines 843..848
                          lib/Forums/Forums.php on lines 849..854
                          lib/Forums/Forums.php on lines 855..860

                          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 26.

                          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

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

                                      1 => array(
                                          "id" => 1,
                                          "name" => "Like",
                                          "icon" => "<span class='glyphicon glyphicon-thumbs-up'></span>",
                                          "count" => 0
                          Severity: Major
                          Found in lib/Forums/Forums.php and 5 other locations - About 45 mins to fix
                          lib/Forums/Forums.php on lines 837..842
                          lib/Forums/Forums.php on lines 843..848
                          lib/Forums/Forums.php on lines 849..854
                          lib/Forums/Forums.php on lines 855..860
                          lib/Forums/Forums.php on lines 861..866

                          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 26.

                          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

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

                                      4 => array(
                                          "id" => 4,
                                          "name" => "Funny",
                                          "icon" => "<span class='glyphicon glyphicon-heart-empty'></span>",
                                          "count" => 0
                          Severity: Major
                          Found in lib/Forums/Forums.php and 5 other locations - About 45 mins to fix
                          lib/Forums/Forums.php on lines 831..836
                          lib/Forums/Forums.php on lines 837..842
                          lib/Forums/Forums.php on lines 843..848
                          lib/Forums/Forums.php on lines 855..860
                          lib/Forums/Forums.php on lines 861..866

                          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 26.

                          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

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

                                      5 => array(
                                          "id" => 5,
                                          "name" => "Agree",
                                          "icon" => "<span class='glyphicon glyphicon-ok'></span>",
                                          "count" => 0
                          Severity: Major
                          Found in lib/Forums/Forums.php and 5 other locations - About 45 mins to fix
                          lib/Forums/Forums.php on lines 831..836
                          lib/Forums/Forums.php on lines 837..842
                          lib/Forums/Forums.php on lines 843..848
                          lib/Forums/Forums.php on lines 849..854
                          lib/Forums/Forums.php on lines 861..866

                          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 26.

                          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

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

                                      3 => array(
                                          "id" => 3,
                                          "name" => "Helpful",
                                          "icon" => "<span class='glyphicon glyphicon-flash'></span>",
                                          "count" => 0
                          Severity: Major
                          Found in lib/Forums/Forums.php and 5 other locations - About 45 mins to fix
                          lib/Forums/Forums.php on lines 831..836
                          lib/Forums/Forums.php on lines 837..842
                          lib/Forums/Forums.php on lines 849..854
                          lib/Forums/Forums.php on lines 855..860
                          lib/Forums/Forums.php on lines 861..866

                          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 26.

                          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

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

                                      2 => array(
                                          "id" => 2,
                                          "name" => "Informative",
                                          "icon" => "<span class='glyphicon glyphicon-info-sign'></span>",
                                          "count" => 0
                          Severity: Major
                          Found in lib/Forums/Forums.php and 5 other locations - About 45 mins to fix
                          lib/Forums/Forums.php on lines 831..836
                          lib/Forums/Forums.php on lines 843..848
                          lib/Forums/Forums.php on lines 849..854
                          lib/Forums/Forums.php on lines 855..860
                          lib/Forums/Forums.php on lines 861..866

                          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 26.

                          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

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

                                      $return['categories'][$row['cat_id']]['forums'][$row['forum_id']] = array(
                                          "id" => $row['forum_id'],
                                          "url" => sprintf("/f-f%d.htm", $row['forum_id']),
                                          "name" => $row['forum_name'],
                                          "desc" => $row['forum_desc'],
                          Severity: Minor
                          Found in lib/Forums/Forums.php and 1 other location - About 45 mins to fix
                          lib/Downloads/Base.php on lines 110..110

                          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 26.

                          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

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

                                              "url" => sprintf("/f-p%d.htm#%d", $row['forum_last_post_id'], $row['forum_last_post_id']),
                          Severity: Minor
                          Found in lib/Forums/Forums.php and 1 other location - About 45 mins to fix
                          lib/Images/Exif.php on lines 370..370

                          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 26.

                          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 2 locations. Consider refactoring.
                          Open

                                      if (!empty($since) && is_int($since) && $since > 0) {
                                          $since = " AND p.post_time >= ?";
                                          $params[] = intval($since); 
                                      }
                          Severity: Minor
                          Found in lib/Forums/Forums.php and 1 other location - About 45 mins to fix
                          lib/Forums/Forums.php on lines 281..283

                          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 25.

                          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 2 locations. Consider refactoring.
                          Open

                                      if (!empty($since) && is_int($since) && $since > 0) {
                                          $since = " AND p.post_time >= ".$this->db->real_escape_string(intval($since));
                                      }
                          Severity: Minor
                          Found in lib/Forums/Forums.php and 1 other location - About 45 mins to fix
                          lib/Forums/Forums.php on lines 312..315

                          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 25.

                          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

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

                                      $acl->allow("forums_viewer", sprintf("railpage.forums.forum:%d", $forum_id), $allowed);
                          Severity: Minor
                          Found in lib/Forums/Forums.php and 1 other location - About 45 mins to fix
                          lib/Forums/Forums.php on lines 712..712

                          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 25.

                          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

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

                                      $acl->deny("forums_viewer", sprintf("railpage.forums.forum:%d", $forum_id), $denied);
                          Severity: Minor
                          Found in lib/Forums/Forums.php and 1 other location - About 45 mins to fix
                          lib/Forums/Forums.php on lines 711..711

                          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 25.

                          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

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

                                      $key = sprintf("railpage:forums.read;user=%d;type=%s", $User->id, $type);
                          Severity: Major
                          Found in lib/Forums/Forums.php and 3 other locations - About 35 mins to fix
                          lib/Forums/Forums.php on lines 1113..1113
                          lib/Images/Image.php on lines 1099..1099
                          lib/Users/Group.php on lines 466..466

                          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 22.

                          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 2 locations. Consider refactoring.
                          Open

                                      foreach ($result as $row) {
                                          $return['topics'][$row['topic_id']][] = $row; 
                                      }
                          Severity: Minor
                          Found in lib/Forums/Forums.php and 1 other location - About 35 mins to fix
                          lib/Forums/Forums.php on lines 449..451

                          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 22.

                          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

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

                                      $key = sprintf("railpage:forums.read;user=%d;type=%s", $User->id, $type);
                          Severity: Major
                          Found in lib/Forums/Forums.php and 3 other locations - About 35 mins to fix
                          lib/Forums/Forums.php on lines 1193..1193
                          lib/Images/Image.php on lines 1099..1099
                          lib/Users/Group.php on lines 466..466

                          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 22.

                          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 2 locations. Consider refactoring.
                          Open

                                          while ($row = $rs->fetch_assoc()) {
                                              $return['topics'][$row['topic_id']][] = $row; 
                                          }
                          Severity: Minor
                          Found in lib/Forums/Forums.php and 1 other location - About 35 mins to fix
                          lib/Forums/Forums.php on lines 485..487

                          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 22.

                          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

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

                                              if (is_array($unserial)) {
                                                  $result = $unserial;
                                                  unset($unserial);
                                              }
                          Severity: Minor
                          Found in lib/Forums/Forums.php and 1 other location - About 35 mins to fix
                          lib/Forums/Forums.php on lines 1133..1136

                          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 22.

                          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

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

                                              if (is_array($json)) {
                                                  $result = $json;
                                                  unset($json);
                                              }
                          Severity: Minor
                          Found in lib/Forums/Forums.php and 1 other location - About 35 mins to fix
                          lib/Forums/Forums.php on lines 1124..1127

                          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 22.

                          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

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

                                  if (!isset($this->ZendACL) || !$this->ZendACL instanceof Zend_Acl) {
                                      $this->buildACL(); 
                                  }
                          Severity: Minor
                          Found in lib/Forums/Forums.php and 2 other locations - About 30 mins to fix
                          lib/News/Article.php on lines 774..776
                          lib/Notifications/Notifications.php on lines 96..98

                          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 21.

                          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

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

                                      $acl_forum_name = sprintf("railpage.forums.forum:%d", $row['forum_id']);
                          Severity: Major
                          Found in lib/Forums/Forums.php and 3 other locations - About 30 mins to fix
                          lib/Images/Utility/Finder.php on lines 147..147
                          lib/News/Topic.php on lines 236..236
                          lib/Railcams/Camera.php on lines 279..279

                          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 21.

                          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

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

                                      if ($from_time) { 
                                          $query .= " AND p.post_time >= ?"; 
                                          $params[] = $from_time;
                                      } 
                          Severity: Minor
                          Found in lib/Forums/Forums.php and 2 other locations - About 30 mins to fix
                          lib/Links/Links.php on lines 194..197
                          lib/PlaceUtility.php on lines 262..265

                          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 21.

                          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 2 locations. Consider refactoring.
                          Open

                                                  if ($array['last_post_time'] > $topics[$forum_id]['last_viewed']) {
                                                      $topics[$forum_id]['last_viewed'] = $array['last_post_time'];
                                                  }
                          Severity: Minor
                          Found in lib/Forums/Forums.php and 1 other location - About 30 mins to fix
                          lib/Forums/Forums.php on lines 398..400

                          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 20.

                          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 2 locations. Consider refactoring.
                          Open

                                              if (!isset($topics[$forum_id]['last_viewed']) || $array['last_post_time'] > $topics[$forum_id]['last_viewed']) {
                                                  $topics[$forum_id]['last_viewed'] = $array['last_post_time'];
                                              }
                          Severity: Minor
                          Found in lib/Forums/Forums.php and 1 other location - About 30 mins to fix
                          lib/Forums/Forums.php on lines 372..374

                          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 20.

                          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

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

                                      $perms_acl = array_keys($permissions, self::AUTH_ACL);
                          Severity: Minor
                          Found in lib/Forums/Forums.php and 1 other location - About 30 mins to fix
                          lib/GTFS/StandardProvider.php on lines 134..134

                          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 20.

                          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

                          The parameter $user_id is not named in camelCase.
                          Open

                              public function getReadTopics($user_id = false) {
                                  global $Error;
                                  
                                  if (!$user_id) {
                                      return false;
                          Severity: Minor
                          Found in lib/Forums/Forums.php by phpmd

                          CamelCaseParameterName

                          Since: 0.2

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

                          Example

                          class ClassName {
                              public function doSomething($user_name) {
                              }
                          }

                          Source

                          The parameter $User is not named in camelCase.
                          Open

                              public function getUnreadForumThreadsForUser(User $User, $offset = 0, $items_per_page = false) {
                                  $forums = $this->getAllowedForumsIDsForUser($User, "auth_read");
                                  
                                  if ($items_per_page === false) {
                                      $items_per_page = $User->items_per_page;
                          Severity: Minor
                          Found in lib/Forums/Forums.php by phpmd

                          CamelCaseParameterName

                          Since: 0.2

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

                          Example

                          class ClassName {
                              public function doSomething($user_name) {
                              }
                          }

                          Source

                          The parameter $User is not named in camelCase.
                          Open

                              public static function saveReadItemsForUser(User $User, $items, $type = "t") {
                                  
                                  $cookiename = sprintf("%s_%s", "phpbb2mysqlrp2", $type);
                                  
                                  /**
                          Severity: Minor
                          Found in lib/Forums/Forums.php by phpmd

                          CamelCaseParameterName

                          Since: 0.2

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

                          Example

                          class ClassName {
                              public function doSomething($user_name) {
                              }
                          }

                          Source

                          The parameter $User is not named in camelCase.
                          Open

                              public function getAllowedForumsIDsForUser(User $User, $permission = self::AUTH_ALL) {
                                  $acl = $this->setUser($User)->getACL(); 
                                  
                                  $ids = array(); 
                                  $allforums = $this->getAllForums();
                          Severity: Minor
                          Found in lib/Forums/Forums.php by phpmd

                          CamelCaseParameterName

                          Since: 0.2

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

                          Example

                          class ClassName {
                              public function doSomething($user_name) {
                              }
                          }

                          Source

                          The parameter $is_auth_ary is not named in camelCase.
                          Open

                              public function latestPosts($is_auth_ary, $since, $limit = 10) {
                                  if (empty($is_auth_ary) || !is_array($is_auth_ary)) {
                                      return false;
                                  }
                                  
                          Severity: Minor
                          Found in lib/Forums/Forums.php by phpmd

                          CamelCaseParameterName

                          Since: 0.2

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

                          Example

                          class ClassName {
                              public function doSomething($user_name) {
                              }
                          }

                          Source

                          The parameter $items_per_page is not named in camelCase.
                          Open

                              public function newPosts($forums = false, $from_time = false, $items_per_page = 25, $start = 0) {
                                  if (!$forums || !is_array($forums)) {
                                      throw new \Exception("You must provide a list of forums this user has permission to view");
                                      return false;
                                  }
                          Severity: Minor
                          Found in lib/Forums/Forums.php by phpmd

                          CamelCaseParameterName

                          Since: 0.2

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

                          Example

                          class ClassName {
                              public function doSomething($user_name) {
                              }
                          }

                          Source

                          The parameter $items_per_page is not named in camelCase.
                          Open

                              public function getUnreadForumThreadsForUser(User $User, $offset = 0, $items_per_page = false) {
                                  $forums = $this->getAllowedForumsIDsForUser($User, "auth_read");
                                  
                                  if ($items_per_page === false) {
                                      $items_per_page = $User->items_per_page;
                          Severity: Minor
                          Found in lib/Forums/Forums.php by phpmd

                          CamelCaseParameterName

                          Since: 0.2

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

                          Example

                          class ClassName {
                              public function doSomething($user_name) {
                              }
                          }

                          Source

                          The parameter $User is not named in camelCase.
                          Open

                              public static function getReadItemsForUser(User $User, $type = "t") {
                                  
                                  /**
                                   * Not logged in - no threads/forums
                                   */
                          Severity: Minor
                          Found in lib/Forums/Forums.php by phpmd

                          CamelCaseParameterName

                          Since: 0.2

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

                          Example

                          class ClassName {
                              public function doSomething($user_name) {
                              }
                          }

                          Source

                          The parameter $from_time is not named in camelCase.
                          Open

                              public function newPosts($forums = false, $from_time = false, $items_per_page = 25, $start = 0) {
                                  if (!$forums || !is_array($forums)) {
                                      throw new \Exception("You must provide a list of forums this user has permission to view");
                                      return false;
                                  }
                          Severity: Minor
                          Found in lib/Forums/Forums.php by phpmd

                          CamelCaseParameterName

                          Since: 0.2

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

                          Example

                          class ClassName {
                              public function doSomething($user_name) {
                              }
                          }

                          Source

                          Blank line found at end of control structure
                          Open

                                      
                          Severity: Minor
                          Found in lib/Forums/Forums.php by phpcodesniffer

                          Function closing brace must go on the next line following the body; found 1 blank lines before brace
                          Open

                              }
                          Severity: Minor
                          Found in lib/Forums/Forums.php by phpcodesniffer

                          Function closing brace must go on the next line following the body; found 1 blank lines before brace
                          Open

                              }
                          Severity: Minor
                          Found in lib/Forums/Forums.php by phpcodesniffer

                          Expected 1 space after FOREACH keyword; 0 found
                          Open

                                  foreach($array as $var => $value) {
                          Severity: Minor
                          Found in lib/Forums/Forums.php by phpcodesniffer

                          There are no issues that match your filters.

                          Category
                          Status