Code Duplication    Length = 10-10 lines in 3 locations

include/classes/news.class.php 2 locations

@@ 42-51 (lines=10) @@
39
  /**
40
   * Get all active news
41
   **/
42
  public function getAllActive() {
43
    $this->debug->append("STA " . __METHOD__, 4);
44
    $stmt = $this->mysqli->prepare("SELECT n.*, a.username AS author FROM $this->table AS n LEFT JOIN " . $this->user->getTableName() . " AS a ON a.id = n.account_id WHERE active = 1 ORDER BY time DESC");
45
    if ($stmt && $stmt->execute() && $result = $stmt->get_result())
46
      return $result->fetch_all(MYSQLI_ASSOC);
47
    return $this->sqlError('E0040');
48
  }
49
50
  /**
51
   * Get all news
52
   **/
53
  public function getAll() {
54
    $this->debug->append("STA " . __METHOD__, 4);
@@ 53-62 (lines=10) @@
50
  /**
51
   * Get all news
52
   **/
53
  public function getAll() {
54
    $this->debug->append("STA " . __METHOD__, 4);
55
    $stmt = $this->mysqli->prepare("SELECT n.*, a.username AS author FROM $this->table AS n LEFT JOIN " . $this->user->getTableName() . " AS a ON a.id = n.account_id ORDER BY time DESC");
56
    if ($stmt && $stmt->execute() && $result = $stmt->get_result())
57
      return $result->fetch_all(MYSQLI_ASSOC);
58
    return $this->sqlError('E0039');
59
  }
60
61
  /**
62
   * Get a specific news entry
63
   **/
64
  public function getEntry($id) {
65
    $this->debug->append("STA " . __METHOD__, 4);

include/classes/base.class.php 1 location

@@ 183-192 (lines=10) @@
180
   * @param none
181
   * @return array Assoc array of all rows found in table
182
   **/
183
  public function getAllAssoc() {
184
    $this->debug->append("STA " . __METHOD__, 4);
185
    $stmt = $this->mysqli->prepare("SELECT * FROM $this->table");
186
    if ($this->checkStmt($stmt) && $stmt->execute() && $result = $stmt->get_result())
187
      return $result->fetch_all(MYSQLI_ASSOC);
188
    return $this->sqlError();
189
  }
190
191
  /**
192
   * Get a single row as an assoc array
193
   * @param value string Value to search for
194
   * @param field string Column to search for
195
   * @param type string Type of value