Code Duplication    Length = 11-12 lines in 8 locations

require/class.ATC.php 1 location

@@ 12-23 (lines=12) @@
9
    		$this->db = $Connection->db;
10
	}
11
12
       public function getAll() {
13
                $query = "SELECT * FROM atc GROUP BY ident";
14
                $query_values = array();
15
                 try {
16
                        $sth = $this->db->prepare($query);
17
                        $sth->execute($query_values);
18
                } catch(PDOException $e) {
19
                        return "error : ".$e->getMessage();
20
                }
21
                $all = $sth->fetchAll(PDO::FETCH_ASSOC);
22
                return $all;
23
        }
24
25
       public function add($ident,$frequency,$latitude,$longitude,$range,$info,$date,$type = '',$ivao_id = '',$ivao_name = '') {
26
    		$info = preg_replace('/[^(\x20-\x7F)]*/','',$info);

require/class.NOTAM.php 1 location

@@ 715-726 (lines=12) @@
712
		$Connection = new Connection($dbc);
713
		$this->db = $Connection->db;
714
	}
715
	public function getAllNOTAM() {
716
		$query = "SELECT * FROM notam";
717
		$query_values = array();
718
		try {
719
			$sth = $this->db->prepare($query);
720
			$sth->execute($query_values);
721
		} catch(PDOException $e) {
722
			return "error : ".$e->getMessage();
723
		}
724
		$all = $sth->fetchAll(PDO::FETCH_ASSOC);
725
		return $all;
726
	}
727
728
	public function addNOTAM($ref,$title,$type,$fir,$code,$rules,$scope,$lower_limit,$upper_limit,$center_latitude,$center_longitude,$radius,$date_begin,$date_end,$permanent,$text,$full_notam) {
729
		$query = "INSERT INTO notam (ref,title,notam_type,fir,code,rules,scope,lower_limit,upper_limit,center_latitude,center_longitude,radius,date_begin,date_end,permanent,notam_text,full_notam) VALUES (:ref,:title,:type,:fir,:code,:rules,:scope,:lower_limit,:upper_limit,:center_latitude,:center_longitude,:radius,:date_begin,:date_end,:permanent,:text,:full_notam)";

require/class.Source.php 3 locations

@@ 11-22 (lines=12) @@
8
		$Connection = new Connection($dbc);
9
		$this->db = $Connection->db;
10
        }
11
       public function getAllLocationInfo() {
12
                $query = "SELECT * FROM source_location";
13
                $query_values = array();
14
                 try {
15
                        $sth = $this->db->prepare($query);
16
                        $sth->execute($query_values);
17
                } catch(PDOException $e) {
18
                        return "error : ".$e->getMessage();
19
                }
20
                $all = $sth->fetchAll(PDO::FETCH_ASSOC);
21
                return $all;
22
        }
23
       public function getLocationInfobyName($name) {
24
                $query = "SELECT * FROM source_location WHERE name = :name";
25
                $query_values = array(':name' => $name);
@@ 23-34 (lines=12) @@
20
                $all = $sth->fetchAll(PDO::FETCH_ASSOC);
21
                return $all;
22
        }
23
       public function getLocationInfobyName($name) {
24
                $query = "SELECT * FROM source_location WHERE name = :name";
25
                $query_values = array(':name' => $name);
26
                 try {
27
                        $sth = $this->db->prepare($query);
28
                        $sth->execute($query_values);
29
                } catch(PDOException $e) {
30
                        return "error : ".$e->getMessage();
31
                }
32
                $all = $sth->fetchAll(PDO::FETCH_ASSOC);
33
                return $all;
34
        }
35
       public function getLocationInfobySourceName($name) {
36
                $query = "SELECT * FROM source_location WHERE source = :name";
37
                $query_values = array(':name' => $name);
@@ 35-46 (lines=12) @@
32
                $all = $sth->fetchAll(PDO::FETCH_ASSOC);
33
                return $all;
34
        }
35
       public function getLocationInfobySourceName($name) {
36
                $query = "SELECT * FROM source_location WHERE source = :name";
37
                $query_values = array(':name' => $name);
38
                 try {
39
                        $sth = $this->db->prepare($query);
40
                        $sth->execute($query_values);
41
                } catch(PDOException $e) {
42
                        return "error : ".$e->getMessage();
43
                }
44
                $all = $sth->fetchAll(PDO::FETCH_ASSOC);
45
                return $all;
46
        }
47
  
48
       public function addLocation($name,$latitude,$longitude,$altitude,$city,$country,$source,$logo = 'antenna.png') {
49
                $query = "INSERT INTO source_location (name,latitude,longitude,altitude,country,city,logo,source) VALUES (:name,:latitude,:longitude,:altitude,:country,:city,:logo,:source)";

require/class.Stats.php 3 locations

@@ 28-38 (lines=11) @@
25
                }
26
        }
27
28
	public function getLastStatsUpdate($type = 'last_update_stats') {
29
                $query = "SELECT value FROM config WHERE name = :type";
30
                 try {
31
                        $sth = $this->db->prepare($query);
32
                        $sth->execute(array(':type' => $type));
33
                } catch(PDOException $e) {
34
                        echo "error : ".$e->getMessage();
35
                }
36
                $all = $sth->fetchAll(PDO::FETCH_ASSOC);
37
                return $all;
38
        }
39
	public function getAllAirlineNames($airline_type = '') {
40
                $query = "SELECT * FROM stats_airline ORDER BY airline_name ASC";
41
                 try {
@@ 519-530 (lines=12) @@
516
		return $all;
517
	}
518
519
	public function getLast7DaysAirports($airport_icao = '') {
520
		$query = "SELECT * FROM stats_airport WHERE stats_type = 'daily' AND airport_icao = :airport_icao ORDER BY date";
521
		$query_values = array(':airport_icao' => $airport_icao);
522
                 try {
523
                        $sth = $this->db->prepare($query);
524
                        $sth->execute($query_values);
525
                } catch(PDOException $e) {
526
                        echo "error : ".$e->getMessage();
527
                }
528
                $all = $sth->fetchAll(PDO::FETCH_ASSOC);
529
                return $all;
530
	}
531
	public function getStats($type) {
532
                $query = "SELECT * FROM stats WHERE stats_type = :type ORDER BY stats_date";
533
                $query_values = array(':type' => $type);
@@ 531-542 (lines=12) @@
528
                $all = $sth->fetchAll(PDO::FETCH_ASSOC);
529
                return $all;
530
	}
531
	public function getStats($type) {
532
                $query = "SELECT * FROM stats WHERE stats_type = :type ORDER BY stats_date";
533
                $query_values = array(':type' => $type);
534
                 try {
535
                        $sth = $this->db->prepare($query);
536
                        $sth->execute($query_values);
537
                } catch(PDOException $e) {
538
                        echo "error : ".$e->getMessage();
539
                }
540
                $all = $sth->fetchAll(PDO::FETCH_ASSOC);
541
                return $all;
542
        }
543
	public function getSumStats($type,$year) {
544
    		global $globalArchiveMonths, $globalDBdriver;
545
    		if ($globalDBdriver == 'mysql') {