Code Duplication    Length = 14-14 lines in 3 locations

code/BrowseContinentsPage.php 1 location

@@ 65-78 (lines=14) @@
62
        parent::requireDefaultRecords();
63
        $parents = DataObject::get("BrowseContinentsPage");
64
        if ($parents && isset($_GET["geobuild"]) && $_GET["geobuild"] && $this->allowBrowseChildren()) {
65
            foreach ($parents as $parent) {
66
                if ($parent->CreateChildren && $parent->HiddenDataID) {
67
                    echo "<li>creating countries for ".$parent->Title."<ul>";
68
                    $countries = $this->getDataFromTable("countries", "ContinentID = ".$parent->HiddenDataID, "Country");
69
                    foreach ($countries as $country) {
70
                        if (!DataObject::get_one("BrowseCountriesPage", "{$bt}HiddenDataID{$bt} = ".$country["CountryID"])) {
71
                            $page = new BrowseCountriesPage();
72
                            $page->CreateCountry($country, $parent);
73
                            $page->destroy();
74
                        }
75
                    }
76
                    echo "</ul></li>";
77
                }
78
            }
79
        }
80
    }
81
    

code/BrowseRegionsPage.php 1 location

@@ 81-94 (lines=14) @@
78
        $bt = defined('DB::USE_ANSI_SQL') ? "\"" : "`";
79
        $parents = DataObject::get("BrowseRegionsPage");
80
        if ($parents && isset($_GET["geobuild"]) && $_GET["geobuild"] && $this->allowBrowseChildren()) {
81
            foreach ($parents as $parent) {
82
                if ($parent->CreateChildren && $parent->HiddenDataID) {
83
                    echo "<li>creating cities for ".$parent->Title."<ul>";
84
                    $cities = $this->getDataFromTable("cities", "RegionID = ".$parent->HiddenDataID, "City");
85
                    foreach ($cities as $city) {
86
                        if (!DataObject::get_one("BrowseCitiesPage", "{$bt}BrowseAbstractPage{$bt}.{$bt}HiddenDataID{$bt} = ".$city["CityID"])) {
87
                            $page = new BrowseCitiesPage();
88
                            $page->CreateCity($city, $parent);
89
                            $page->destroy();
90
                        }
91
                    }
92
                    echo "</ul></li>";
93
                }
94
            }
95
            $parents->destroy();
96
        }
97
    }

code/BrowseWorldPage.php 1 location

@@ 70-83 (lines=14) @@
67
        $bt = defined('DB::USE_ANSI_SQL') ? "\"" : "`";
68
        $parents = DataObject::get("BrowseWorldPage");
69
        if ($parents && isset($_GET["geobuild"]) && $_GET["geobuild"]) {
70
            foreach ($parents as $parent) {
71
                if ($parent->CreateChildren) {
72
                    echo "<li>creating continents for ".$parent->Title."<ul>";
73
                    $continents = $this->getDataFromTable("continents", null, "Continent");
74
                    foreach ($continents as $continent) {
75
                        if (!DataObject::get("BrowseContinentsPage", "{$bt}BrowseAbstractPage{$bt}.{$bt}HiddenDataID{$bt} = ".$continent["ContinentID"])) {
76
                            $page = new BrowseContinentsPage();
77
                            $page->CreateContinent($continent, $parent);
78
                            $page->destroy();
79
                        }
80
                    }
81
                    echo "</ul></li>";
82
                }
83
            }
84
        }
85
    }
86
}