Code Duplication    Length = 9-12 lines in 3 locations

app/Functions/FunctionsImport.php 1 location

@@ 1117-1125 (lines=9) @@
1114
		Database::prepare("DELETE FROM `##dates`      WHERE d_gid =? AND d_file =?")->execute(array($gid, $ged_id));
1115
1116
		//-- delete any unlinked places
1117
		foreach ($placeids as $p_id) {
1118
			$num =
1119
				Database::prepare("SELECT count(pl_p_id) FROM `##placelinks` WHERE pl_p_id=? AND pl_file=?")
1120
					->execute(array($p_id, $ged_id))
1121
					->fetchOne();
1122
			if ($num == 0) {
1123
				Database::prepare("DELETE FROM `##places` WHERE p_id=? AND p_file=?")->execute(array($p_id, $ged_id));
1124
			}
1125
		}
1126
1127
		Database::prepare("DELETE FROM `##name` WHERE n_id=? AND n_file=?")->execute(array($gid, $ged_id));
1128
		Database::prepare("DELETE FROM `##link` WHERE l_from=? AND l_file=?")->execute(array($gid, $ged_id));

app/Module/GoogleMapsModule.php 2 locations

@@ 2531-2542 (lines=12) @@
2528
				$par[$i] = 'unknown';
2529
			}
2530
			$placelist = $this->createPossiblePlaceNames($par[$i], $i + 1);
2531
			foreach ($placelist as $key => $placename) {
2532
				$pl_id = (int) Database::prepare(
2533
					"SELECT pl_id FROM `##placelocation` WHERE pl_level = :level AND pl_parent_id = :parent_id AND pl_place LIKE :placename"
2534
				)->execute(array(
2535
					'level'     => $i,
2536
					'parent_id' => $place_id,
2537
					'placename' => $placename,
2538
				))->fetchOne();
2539
				if ($pl_id) {
2540
					break;
2541
				}
2542
			}
2543
			if (!$pl_id) {
2544
				break;
2545
			}
@@ 2570-2581 (lines=12) @@
2567
		for ($i = 0; $i < count($par); $i++) {
2568
			$par[$i]   = trim($par[$i]);
2569
			$placelist = $this->createPossiblePlaceNames($par[$i], $i + 1);
2570
			foreach ($placelist as $placename) {
2571
				$pl_id = (int) Database::prepare(
2572
					"SELECT p_id FROM `##places` WHERE p_parent_id = :place_id AND p_file = :tree_id AND p_place = :placename"
2573
				)->execute(array(
2574
					'place_id'  => $place_id,
2575
					'tree_id'   => $WT_TREE->getTreeId(),
2576
					'placename' => $placename,
2577
				))->fetchOne();
2578
				if ($pl_id) {
2579
					break;
2580
				}
2581
			}
2582
			if (!$pl_id) {
2583
				break;
2584
			}