Completed
Push — 1.7 ( a32880...ba597d )
by Greg
38:51 queued 16:21
created
app/Report/ReportTcpdf.php 1 patch
Doc Comments   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
 	/**
142 142
 	 * Add an element to the Page Header -PDF
143 143
 	 *
144
-	 * @param object|string $element
144
+	 * @param ReportBaseElement $element
145 145
 	 *
146 146
 	 * @return int The number of the Page Header elements
147 147
 	 */
@@ -232,7 +232,7 @@  discard block
 block discarded – undo
232 232
 	/**
233 233
 	 * Set the report.
234 234
 	 *
235
-	 * @param $r
235
+	 * @param ReportPdf $r
236 236
 	 */
237 237
 	public function setReport($r) {
238 238
 		$this->wt_report = $r;
@@ -340,7 +340,7 @@  discard block
 block discarded – undo
340 340
 	/**
341 341
 	 * Checks the Footnote and numbers them
342 342
 	 *
343
-	 * @param object $footnote
343
+	 * @param ReportBaseFootnote $footnote
344 344
 	 *
345 345
 	 * @return bool false if not numbered befor | object if already numbered
346 346
 	 */
Please login to merge, or discard this patch.
app/Schema/MigrationInterface.php 1 patch
Doc Comments   +1 added lines patch added patch discarded remove patch
@@ -21,6 +21,7 @@
 block discarded – undo
21 21
 interface MigrationInterface {
22 22
 	/**
23 23
 	 * Upgrade to to the next version
24
+	 * @return void
24 25
 	 */
25 26
 	public function upgrade();
26 27
 }
Please login to merge, or discard this patch.
app/Stats.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -5362,7 +5362,7 @@
 block discarded – undo
5362 5362
 	/**
5363 5363
 	 * Find common surnames.
5364 5364
 	 *
5365
-	 * @return string
5365
+	 * @return integer|null
5366 5366
 	 */
5367 5367
 	public function getCommonSurname() {
5368 5368
 		$surnames = array_keys(FunctionsDb::getTopSurnames($this->tree->getTreeId(), 1, 1));
Please login to merge, or discard this patch.
Switch Indentation   +387 added lines, -387 removed lines patch added patch discarded remove patch
@@ -303,22 +303,22 @@  discard block
 block discarded – undo
303 303
 	 */
304 304
 	private function getPercentage($total, $type) {
305 305
 		switch ($type) {
306
-		case 'individual':
307
-			$type = $this->totalIndividualsQuery();
308
-			break;
309
-		case 'family':
310
-			$type = $this->totalFamiliesQuery();
311
-			break;
312
-		case 'source':
313
-			$type = $this->totalSourcesQuery();
314
-			break;
315
-		case 'note':
316
-			$type = $this->totalNotesQuery();
317
-			break;
318
-		case 'all':
319
-		default:
320
-			$type = $this->totalIndividualsQuery() + $this->totalFamiliesQuery() + $this->totalSourcesQuery();
321
-			break;
306
+			case 'individual':
307
+				$type = $this->totalIndividualsQuery();
308
+				break;
309
+			case 'family':
310
+				$type = $this->totalFamiliesQuery();
311
+				break;
312
+			case 'source':
313
+				$type = $this->totalSourcesQuery();
314
+				break;
315
+			case 'note':
316
+				$type = $this->totalNotesQuery();
317
+				break;
318
+			case 'all':
319
+			default:
320
+				$type = $this->totalIndividualsQuery() + $this->totalFamiliesQuery() + $this->totalSourcesQuery();
321
+				break;
322 322
 		}
323 323
 		if ($type == 0) {
324 324
 			return I18N::percentage(0, 1);
@@ -1444,29 +1444,29 @@  discard block
 block discarded – undo
1444 1444
 		$row    = $rows[0];
1445 1445
 		$record = GedcomRecord::getInstance($row['d_gid'], $this->tree);
1446 1446
 		switch ($type) {
1447
-		default:
1448
-		case 'full':
1449
-			if ($record->canShow()) {
1450
-				$result = $record->formatList('span', false, $record->getFullName());
1451
-			} else {
1452
-				$result = I18N::translate('This information is private and cannot be shown.');
1453
-			}
1454
-			break;
1455
-		case 'year':
1456
-			$date   = new Date($row['d_type'] . ' ' . $row['d_year']);
1457
-			$result = $date->display();
1458
-			break;
1459
-		case 'name':
1460
-			$result = "<a href=\"" . $record->getHtmlUrl() . "\">" . $record->getFullName() . "</a>";
1461
-			break;
1462
-		case 'place':
1463
-			$fact = GedcomRecord::getInstance($row['d_gid'], $this->tree)->getFirstFact($row['d_fact']);
1464
-			if ($fact) {
1465
-				$result = FunctionsPrint::formatFactPlace($fact, true, true, true);
1466
-			} else {
1467
-				$result = I18N::translate('Private');
1468
-			}
1469
-			break;
1447
+			default:
1448
+			case 'full':
1449
+				if ($record->canShow()) {
1450
+					$result = $record->formatList('span', false, $record->getFullName());
1451
+				} else {
1452
+					$result = I18N::translate('This information is private and cannot be shown.');
1453
+				}
1454
+				break;
1455
+			case 'year':
1456
+				$date   = new Date($row['d_type'] . ' ' . $row['d_year']);
1457
+				$result = $date->display();
1458
+				break;
1459
+			case 'name':
1460
+				$result = "<a href=\"" . $record->getHtmlUrl() . "\">" . $record->getFullName() . "</a>";
1461
+				break;
1462
+			case 'place':
1463
+				$fact = GedcomRecord::getInstance($row['d_gid'], $this->tree)->getFirstFact($row['d_fact']);
1464
+				if ($fact) {
1465
+					$result = FunctionsPrint::formatFactPlace($fact, true, true, true);
1466
+				} else {
1467
+					$result = I18N::translate('Private');
1468
+				}
1469
+				break;
1470 1470
 		}
1471 1471
 
1472 1472
 		return $result;
@@ -1631,96 +1631,96 @@  discard block
 block discarded – undo
1631 1631
 		}
1632 1632
 		I18N::init(WT_LOCALE);
1633 1633
 		switch ($chart_type) {
1634
-		case 'surname_distribution_chart':
1635
-			if ($surname == "") {
1636
-				$surname = $this->getCommonSurname();
1637
-			}
1638
-			$chart_title = I18N::translate('Surname distribution chart') . ': ' . $surname;
1639
-			// Count how many people are events in each country
1640
-			$surn_countries = array();
1641
-			$indis          = QueryName::individuals($this->tree, I18N::strtoupper($surname), '', '', false, false);
1642
-			foreach ($indis as $person) {
1643
-				if (preg_match_all('/^2 PLAC (?:.*, *)*(.*)/m', $person->getGedcom(), $matches)) {
1644
-					// webtrees uses 3 letter country codes and localised country names, but google uses 2 letter codes.
1645
-					foreach ($matches[1] as $country) {
1646
-						if (array_key_exists($country, $country_to_iso3166)) {
1647
-							if (array_key_exists($country_to_iso3166[$country], $surn_countries)) {
1648
-								$surn_countries[$country_to_iso3166[$country]]++;
1649
-							} else {
1650
-								$surn_countries[$country_to_iso3166[$country]] = 1;
1634
+			case 'surname_distribution_chart':
1635
+				if ($surname == "") {
1636
+					$surname = $this->getCommonSurname();
1637
+				}
1638
+				$chart_title = I18N::translate('Surname distribution chart') . ': ' . $surname;
1639
+				// Count how many people are events in each country
1640
+				$surn_countries = array();
1641
+				$indis          = QueryName::individuals($this->tree, I18N::strtoupper($surname), '', '', false, false);
1642
+				foreach ($indis as $person) {
1643
+					if (preg_match_all('/^2 PLAC (?:.*, *)*(.*)/m', $person->getGedcom(), $matches)) {
1644
+						// webtrees uses 3 letter country codes and localised country names, but google uses 2 letter codes.
1645
+						foreach ($matches[1] as $country) {
1646
+							if (array_key_exists($country, $country_to_iso3166)) {
1647
+								if (array_key_exists($country_to_iso3166[$country], $surn_countries)) {
1648
+									$surn_countries[$country_to_iso3166[$country]]++;
1649
+								} else {
1650
+									$surn_countries[$country_to_iso3166[$country]] = 1;
1651
+								}
1651 1652
 							}
1652 1653
 						}
1653 1654
 					}
1654
-				}
1655
-			};
1656
-			break;
1657
-		case 'birth_distribution_chart':
1658
-			$chart_title = I18N::translate('Birth by country');
1659
-			// Count how many people were born in each country
1660
-			$surn_countries = array();
1661
-			$b_countries    = $this->statsPlaces('INDI', 'BIRT', 0, true);
1662
-			foreach ($b_countries as $place => $count) {
1663
-				$country = $place;
1664
-				if (array_key_exists($country, $country_to_iso3166)) {
1665
-					if (!isset($surn_countries[$country_to_iso3166[$country]])) {
1666
-						$surn_countries[$country_to_iso3166[$country]] = $count;
1667
-					} else {
1668
-						$surn_countries[$country_to_iso3166[$country]] += $count;
1655
+				};
1656
+				break;
1657
+			case 'birth_distribution_chart':
1658
+				$chart_title = I18N::translate('Birth by country');
1659
+				// Count how many people were born in each country
1660
+				$surn_countries = array();
1661
+				$b_countries    = $this->statsPlaces('INDI', 'BIRT', 0, true);
1662
+				foreach ($b_countries as $place => $count) {
1663
+					$country = $place;
1664
+					if (array_key_exists($country, $country_to_iso3166)) {
1665
+						if (!isset($surn_countries[$country_to_iso3166[$country]])) {
1666
+							$surn_countries[$country_to_iso3166[$country]] = $count;
1667
+						} else {
1668
+							$surn_countries[$country_to_iso3166[$country]] += $count;
1669
+						}
1669 1670
 					}
1670 1671
 				}
1671
-			}
1672
-			break;
1673
-		case 'death_distribution_chart':
1674
-			$chart_title = I18N::translate('Death by country');
1675
-			// Count how many people were death in each country
1676
-			$surn_countries = array();
1677
-			$d_countries    = $this->statsPlaces('INDI', 'DEAT', 0, true);
1678
-			foreach ($d_countries as $place => $count) {
1679
-				$country = $place;
1680
-				if (array_key_exists($country, $country_to_iso3166)) {
1681
-					if (!isset($surn_countries[$country_to_iso3166[$country]])) {
1682
-						$surn_countries[$country_to_iso3166[$country]] = $count;
1683
-					} else {
1684
-						$surn_countries[$country_to_iso3166[$country]] += $count;
1672
+				break;
1673
+			case 'death_distribution_chart':
1674
+				$chart_title = I18N::translate('Death by country');
1675
+				// Count how many people were death in each country
1676
+				$surn_countries = array();
1677
+				$d_countries    = $this->statsPlaces('INDI', 'DEAT', 0, true);
1678
+				foreach ($d_countries as $place => $count) {
1679
+					$country = $place;
1680
+					if (array_key_exists($country, $country_to_iso3166)) {
1681
+						if (!isset($surn_countries[$country_to_iso3166[$country]])) {
1682
+							$surn_countries[$country_to_iso3166[$country]] = $count;
1683
+						} else {
1684
+							$surn_countries[$country_to_iso3166[$country]] += $count;
1685
+						}
1685 1686
 					}
1686 1687
 				}
1687
-			}
1688
-			break;
1689
-		case 'marriage_distribution_chart':
1690
-			$chart_title = I18N::translate('Marriage by country');
1691
-			// Count how many families got marriage in each country
1692
-			$surn_countries = array();
1693
-			$m_countries    = $this->statsPlaces('FAM');
1694
-			// webtrees uses 3 letter country codes and localised country names, but google uses 2 letter codes.
1695
-			foreach ($m_countries as $place) {
1696
-				$country = $place['country'];
1697
-				if (array_key_exists($country, $country_to_iso3166)) {
1698
-					if (!isset($surn_countries[$country_to_iso3166[$country]])) {
1699
-						$surn_countries[$country_to_iso3166[$country]] = $place['tot'];
1700
-					} else {
1701
-						$surn_countries[$country_to_iso3166[$country]] += $place['tot'];
1688
+				break;
1689
+			case 'marriage_distribution_chart':
1690
+				$chart_title = I18N::translate('Marriage by country');
1691
+				// Count how many families got marriage in each country
1692
+				$surn_countries = array();
1693
+				$m_countries    = $this->statsPlaces('FAM');
1694
+				// webtrees uses 3 letter country codes and localised country names, but google uses 2 letter codes.
1695
+				foreach ($m_countries as $place) {
1696
+					$country = $place['country'];
1697
+					if (array_key_exists($country, $country_to_iso3166)) {
1698
+						if (!isset($surn_countries[$country_to_iso3166[$country]])) {
1699
+							$surn_countries[$country_to_iso3166[$country]] = $place['tot'];
1700
+						} else {
1701
+							$surn_countries[$country_to_iso3166[$country]] += $place['tot'];
1702
+						}
1702 1703
 					}
1703 1704
 				}
1704
-			}
1705
-			break;
1706
-		case 'indi_distribution_chart':
1707
-		default:
1708
-			$chart_title = I18N::translate('Individual distribution chart');
1709
-			// Count how many people have events in each country
1710
-			$surn_countries = array();
1711
-			$a_countries    = $this->statsPlaces('INDI');
1712
-			// webtrees uses 3 letter country codes and localised country names, but google uses 2 letter codes.
1713
-			foreach ($a_countries as $place) {
1714
-				$country = $place['country'];
1715
-				if (array_key_exists($country, $country_to_iso3166)) {
1716
-					if (!isset($surn_countries[$country_to_iso3166[$country]])) {
1717
-						$surn_countries[$country_to_iso3166[$country]] = $place['tot'];
1718
-					} else {
1719
-						$surn_countries[$country_to_iso3166[$country]] += $place['tot'];
1705
+				break;
1706
+			case 'indi_distribution_chart':
1707
+			default:
1708
+				$chart_title = I18N::translate('Individual distribution chart');
1709
+				// Count how many people have events in each country
1710
+				$surn_countries = array();
1711
+				$a_countries    = $this->statsPlaces('INDI');
1712
+				// webtrees uses 3 letter country codes and localised country names, but google uses 2 letter codes.
1713
+				foreach ($a_countries as $place) {
1714
+					$country = $place['country'];
1715
+					if (array_key_exists($country, $country_to_iso3166)) {
1716
+						if (!isset($surn_countries[$country_to_iso3166[$country]])) {
1717
+							$surn_countries[$country_to_iso3166[$country]] = $place['tot'];
1718
+						} else {
1719
+							$surn_countries[$country_to_iso3166[$country]] += $place['tot'];
1720
+						}
1720 1721
 					}
1721 1722
 				}
1722
-			}
1723
-			break;
1723
+				break;
1724 1724
 		}
1725 1725
 		$chart_url = "https://chart.googleapis.com/chart?cht=t&amp;chtm=" . $chart_shows;
1726 1726
 		$chart_url .= "&amp;chco=" . $WT_STATS_CHART_COLOR1 . "," . $WT_STATS_CHART_COLOR3 . "," . $WT_STATS_CHART_COLOR2; // country colours
@@ -2259,20 +2259,20 @@  discard block
 block discarded – undo
2259 2259
 		$row    = $rows[0];
2260 2260
 		$person = Individual::getInstance($row['id'], $this->tree);
2261 2261
 		switch ($type) {
2262
-		default:
2263
-		case 'full':
2264
-			if ($person->canShowName()) {
2265
-				$result = $person->formatList('span', false, $person->getFullName());
2266
-			} else {
2267
-				$result = I18N::translate('This information is private and cannot be shown.');
2268
-			}
2269
-			break;
2270
-		case 'age':
2271
-			$result = I18N::number((int) ($row['age'] / 365.25));
2272
-			break;
2273
-		case 'name':
2274
-			$result = "<a href=\"" . $person->getHtmlUrl() . "\">" . $person->getFullName() . "</a>";
2275
-			break;
2262
+			default:
2263
+			case 'full':
2264
+				if ($person->canShowName()) {
2265
+					$result = $person->formatList('span', false, $person->getFullName());
2266
+				} else {
2267
+					$result = I18N::translate('This information is private and cannot be shown.');
2268
+				}
2269
+				break;
2270
+			case 'age':
2271
+				$result = I18N::number((int) ($row['age'] / 365.25));
2272
+				break;
2273
+			case 'name':
2274
+				$result = "<a href=\"" . $person->getHtmlUrl() . "\">" . $person->getFullName() . "</a>";
2275
+				break;
2276 2276
 		}
2277 2277
 
2278 2278
 		return $result;
@@ -2942,36 +2942,36 @@  discard block
 block discarded – undo
2942 2942
 		$row    = $rows[0];
2943 2943
 		$record = GedcomRecord::getInstance($row['id'], $this->tree);
2944 2944
 		switch ($type) {
2945
-		default:
2946
-		case 'full':
2947
-			if ($record->canShow()) {
2948
-				$result = $record->formatList('span', false, $record->getFullName());
2949
-			} else {
2950
-				$result = I18N::translate('This information is private and cannot be shown.');
2951
-			}
2952
-			break;
2953
-		case 'year':
2954
-			$date   = new Date($row['type'] . ' ' . $row['year']);
2955
-			$result = $date->display();
2956
-			break;
2957
-		case 'type':
2958
-			if (isset($eventTypes[$row['fact']])) {
2959
-				$result = $eventTypes[$row['fact']];
2960
-			} else {
2961
-				$result = GedcomTag::getLabel($row['fact']);
2962
-			}
2963
-			break;
2964
-		case 'name':
2965
-			$result = "<a href=\"" . $record->getHtmlUrl() . "\">" . $record->getFullName() . "</a>";
2966
-			break;
2967
-		case 'place':
2968
-			$fact = $record->getFirstFact($row['fact']);
2969
-			if ($fact) {
2970
-				$result = FunctionsPrint::formatFactPlace($fact, true, true, true);
2971
-			} else {
2972
-				$result = I18N::translate('Private');
2973
-			}
2974
-			break;
2945
+			default:
2946
+			case 'full':
2947
+				if ($record->canShow()) {
2948
+					$result = $record->formatList('span', false, $record->getFullName());
2949
+				} else {
2950
+					$result = I18N::translate('This information is private and cannot be shown.');
2951
+				}
2952
+				break;
2953
+			case 'year':
2954
+				$date   = new Date($row['type'] . ' ' . $row['year']);
2955
+				$result = $date->display();
2956
+				break;
2957
+			case 'type':
2958
+				if (isset($eventTypes[$row['fact']])) {
2959
+					$result = $eventTypes[$row['fact']];
2960
+				} else {
2961
+					$result = GedcomTag::getLabel($row['fact']);
2962
+				}
2963
+				break;
2964
+			case 'name':
2965
+				$result = "<a href=\"" . $record->getHtmlUrl() . "\">" . $record->getFullName() . "</a>";
2966
+				break;
2967
+			case 'place':
2968
+				$fact = $record->getFirstFact($row['fact']);
2969
+				if ($fact) {
2970
+					$result = FunctionsPrint::formatFactPlace($fact, true, true, true);
2971
+				} else {
2972
+					$result = I18N::translate('Private');
2973
+				}
2974
+				break;
2975 2975
 		}
2976 2976
 
2977 2977
 		return $result;
@@ -3116,32 +3116,32 @@  discard block
 block discarded – undo
3116 3116
 			$person = Individual::getInstance($row['i_id'], $this->tree);
3117 3117
 		}
3118 3118
 		switch ($type) {
3119
-		default:
3120
-		case 'full':
3121
-			if ($family->canShow()) {
3122
-				$result = $family->formatList('span', false, $person->getFullName());
3123
-			} else {
3124
-				$result = I18N::translate('This information is private and cannot be shown.');
3125
-			}
3126
-			break;
3127
-		case 'name':
3128
-			$result = '<a href="' . $family->getHtmlUrl() . '">' . $person->getFullName() . '</a>';
3129
-			break;
3130
-		case 'age':
3131
-			$age = $row['age'];
3132
-			if ($show_years) {
3133
-				if ((int) ($age / 365.25) > 0) {
3134
-					$age = (int) ($age / 365.25) . 'y';
3135
-				} elseif ((int) ($age / 30.4375) > 0) {
3136
-					$age = (int) ($age / 30.4375) . 'm';
3119
+			default:
3120
+			case 'full':
3121
+				if ($family->canShow()) {
3122
+					$result = $family->formatList('span', false, $person->getFullName());
3137 3123
 				} else {
3138
-					$age = $age . 'd';
3124
+					$result = I18N::translate('This information is private and cannot be shown.');
3139 3125
 				}
3140
-				$result = FunctionsDate::getAgeAtEvent($age);
3141
-			} else {
3142
-				$result = I18N::number((int) ($age / 365.25));
3143
-			}
3144
-			break;
3126
+				break;
3127
+			case 'name':
3128
+				$result = '<a href="' . $family->getHtmlUrl() . '">' . $person->getFullName() . '</a>';
3129
+				break;
3130
+			case 'age':
3131
+				$age = $row['age'];
3132
+				if ($show_years) {
3133
+					if ((int) ($age / 365.25) > 0) {
3134
+						$age = (int) ($age / 365.25) . 'y';
3135
+					} elseif ((int) ($age / 30.4375) > 0) {
3136
+						$age = (int) ($age / 30.4375) . 'm';
3137
+					} else {
3138
+						$age = $age . 'd';
3139
+					}
3140
+					$result = FunctionsDate::getAgeAtEvent($age);
3141
+				} else {
3142
+					$result = I18N::number((int) ($age / 365.25));
3143
+				}
3144
+				break;
3145 3145
 		}
3146 3146
 
3147 3147
 		return $result;
@@ -3414,32 +3414,32 @@  discard block
 block discarded – undo
3414 3414
 			$person = Individual::getInstance($row['id'], $this->tree);
3415 3415
 		}
3416 3416
 		switch ($type) {
3417
-		default:
3418
-		case 'full':
3419
-			if ($person->canShow()) {
3420
-				$result = $person->formatList('span', false, $person->getFullName());
3421
-			} else {
3422
-				$result = I18N::translate('This information is private and cannot be shown.');
3423
-			}
3424
-			break;
3425
-		case 'name':
3426
-			$result = '<a href="' . $person->getHtmlUrl() . '">' . $person->getFullName() . '</a>';
3427
-			break;
3428
-		case 'age':
3429
-			$age = $row['age'];
3430
-			if ($show_years) {
3431
-				if ((int) ($age / 365.25) > 0) {
3432
-					$age = (int) ($age / 365.25) . 'y';
3433
-				} elseif ((int) ($age / 30.4375) > 0) {
3434
-					$age = (int) ($age / 30.4375) . 'm';
3417
+			default:
3418
+			case 'full':
3419
+				if ($person->canShow()) {
3420
+					$result = $person->formatList('span', false, $person->getFullName());
3435 3421
 				} else {
3436
-					$age = $age . 'd';
3422
+					$result = I18N::translate('This information is private and cannot be shown.');
3437 3423
 				}
3438
-				$result = FunctionsDate::getAgeAtEvent($age);
3439
-			} else {
3440
-				$result = (int) ($age / 365.25);
3441
-			}
3442
-			break;
3424
+				break;
3425
+			case 'name':
3426
+				$result = '<a href="' . $person->getHtmlUrl() . '">' . $person->getFullName() . '</a>';
3427
+				break;
3428
+			case 'age':
3429
+				$age = $row['age'];
3430
+				if ($show_years) {
3431
+					if ((int) ($age / 365.25) > 0) {
3432
+						$age = (int) ($age / 365.25) . 'y';
3433
+					} elseif ((int) ($age / 30.4375) > 0) {
3434
+						$age = (int) ($age / 30.4375) . 'm';
3435
+					} else {
3436
+						$age = $age . 'd';
3437
+					}
3438
+					$result = FunctionsDate::getAgeAtEvent($age);
3439
+				} else {
3440
+					$result = (int) ($age / 365.25);
3441
+				}
3442
+				break;
3443 3443
 		}
3444 3444
 
3445 3445
 		return $result;
@@ -4397,20 +4397,20 @@  discard block
 block discarded – undo
4397 4397
 		$row    = $rows[0];
4398 4398
 		$family = Family::getInstance($row['id'], $this->tree);
4399 4399
 		switch ($type) {
4400
-		default:
4401
-		case 'full':
4402
-			if ($family->canShow()) {
4403
-				$result = $family->formatList('span', false, $family->getFullName());
4404
-			} else {
4405
-				$result = I18N::translate('This information is private and cannot be shown.');
4406
-			}
4407
-			break;
4408
-		case 'size':
4409
-			$result = I18N::number($row['tot']);
4410
-			break;
4411
-		case 'name':
4412
-			$result = "<a href=\"" . $family->getHtmlUrl() . "\">" . $family->getFullName() . '</a>';
4413
-			break;
4400
+			default:
4401
+			case 'full':
4402
+				if ($family->canShow()) {
4403
+					$result = $family->formatList('span', false, $family->getFullName());
4404
+				} else {
4405
+					$result = I18N::translate('This information is private and cannot be shown.');
4406
+				}
4407
+				break;
4408
+			case 'size':
4409
+				$result = I18N::number($row['tot']);
4410
+				break;
4411
+			case 'name':
4412
+				$result = "<a href=\"" . $family->getHtmlUrl() . "\">" . $family->getFullName() . '</a>';
4413
+				break;
4414 4414
 		}
4415 4415
 
4416 4416
 		return $result;
@@ -4689,43 +4689,43 @@  discard block
 block discarded – undo
4689 4689
 			foreach ($rows as $values) {
4690 4690
 				$counts[] = round(100 * $values['total'] / $tot, 0);
4691 4691
 				switch ($values['d_month']) {
4692
-				default:
4693
-				case 'JAN':
4694
-					$values['d_month'] = 1;
4695
-					break;
4696
-				case 'FEB':
4697
-					$values['d_month'] = 2;
4698
-					break;
4699
-				case 'MAR':
4700
-					$values['d_month'] = 3;
4701
-					break;
4702
-				case 'APR':
4703
-					$values['d_month'] = 4;
4704
-					break;
4705
-				case 'MAY':
4706
-					$values['d_month'] = 5;
4707
-					break;
4708
-				case 'JUN':
4709
-					$values['d_month'] = 6;
4710
-					break;
4711
-				case 'JUL':
4712
-					$values['d_month'] = 7;
4713
-					break;
4714
-				case 'AUG':
4715
-					$values['d_month'] = 8;
4716
-					break;
4717
-				case 'SEP':
4718
-					$values['d_month'] = 9;
4719
-					break;
4720
-				case 'OCT':
4721
-					$values['d_month'] = 10;
4722
-					break;
4723
-				case 'NOV':
4724
-					$values['d_month'] = 11;
4725
-					break;
4726
-				case 'DEC':
4727
-					$values['d_month'] = 12;
4728
-					break;
4692
+					default:
4693
+					case 'JAN':
4694
+						$values['d_month'] = 1;
4695
+						break;
4696
+					case 'FEB':
4697
+						$values['d_month'] = 2;
4698
+						break;
4699
+					case 'MAR':
4700
+						$values['d_month'] = 3;
4701
+						break;
4702
+					case 'APR':
4703
+						$values['d_month'] = 4;
4704
+						break;
4705
+					case 'MAY':
4706
+						$values['d_month'] = 5;
4707
+						break;
4708
+					case 'JUN':
4709
+						$values['d_month'] = 6;
4710
+						break;
4711
+					case 'JUL':
4712
+						$values['d_month'] = 7;
4713
+						break;
4714
+					case 'AUG':
4715
+						$values['d_month'] = 8;
4716
+						break;
4717
+					case 'SEP':
4718
+						$values['d_month'] = 9;
4719
+						break;
4720
+					case 'OCT':
4721
+						$values['d_month'] = 10;
4722
+						break;
4723
+					case 'NOV':
4724
+						$values['d_month'] = 11;
4725
+						break;
4726
+					case 'DEC':
4727
+						$values['d_month'] = 12;
4728
+						break;
4729 4729
 				}
4730 4730
 				$text .= I18N::translate(ucfirst(strtolower(($values['d_month'])))) . ' - ' . $values['total'] . '|';
4731 4731
 			}
@@ -5316,16 +5316,16 @@  discard block
 block discarded – undo
5316 5316
 		}
5317 5317
 
5318 5318
 		switch ($sorting) {
5319
-		default:
5320
-		case 'alpha':
5321
-			uksort($surname_list, '\Fisharebest\Webtrees\I18N::strcasecmp');
5322
-			break;
5323
-		case 'count':
5324
-			asort($surname_list);
5325
-			break;
5326
-		case 'rcount':
5327
-			arsort($surname_list);
5328
-			break;
5319
+			default:
5320
+			case 'alpha':
5321
+				uksort($surname_list, '\Fisharebest\Webtrees\I18N::strcasecmp');
5322
+				break;
5323
+			case 'count':
5324
+				asort($surname_list);
5325
+				break;
5326
+			case 'rcount':
5327
+				arsort($surname_list);
5328
+				break;
5329 5329
 		}
5330 5330
 
5331 5331
 		// Note that we count/display SPFX SURN, but sort/group under just SURN
@@ -5439,9 +5439,9 @@  discard block
 block discarded – undo
5439 5439
 				}
5440 5440
 			}
5441 5441
 			switch ($SURNAME_TRADITION) {
5442
-			case 'polish':
5443
-				// most common surname should be in male variant (Kowalski, not Kowalska)
5444
-				$top_name = preg_replace(array('/ska$/', '/cka$/', '/dzka$/', '/żka$/'), array('ski', 'cki', 'dzki', 'żki'), $top_name);
5442
+				case 'polish':
5443
+					// most common surname should be in male variant (Kowalski, not Kowalska)
5444
+					$top_name = preg_replace(array('/ska$/', '/cka$/', '/dzka$/', '/żka$/'), array('ski', 'cki', 'dzki', 'żki'), $top_name);
5445 5445
 			}
5446 5446
 			$per = round(100 * $count_per / $tot_indi, 0);
5447 5447
 			$chd .= $this->arrayToExtendedEncoding(array($per));
@@ -5481,19 +5481,19 @@  discard block
 block discarded – undo
5481 5481
 		}
5482 5482
 
5483 5483
 		switch ($sex) {
5484
-		case 'M':
5485
-			$sex_sql = "i_sex='M'";
5486
-			break;
5487
-		case 'F':
5488
-			$sex_sql = "i_sex='F'";
5489
-			break;
5490
-		case 'U':
5491
-			$sex_sql = "i_sex='U'";
5492
-			break;
5493
-		case 'B':
5494
-		default:
5495
-			$sex_sql = "i_sex<>'U'";
5496
-			break;
5484
+			case 'M':
5485
+				$sex_sql = "i_sex='M'";
5486
+				break;
5487
+			case 'F':
5488
+				$sex_sql = "i_sex='F'";
5489
+				break;
5490
+			case 'U':
5491
+				$sex_sql = "i_sex='U'";
5492
+				break;
5493
+			case 'B':
5494
+			default:
5495
+				$sex_sql = "i_sex<>'U'";
5496
+				break;
5497 5497
 		}
5498 5498
 		$ged_id = $this->tree->getTreeId();
5499 5499
 
@@ -5538,25 +5538,25 @@  discard block
 block discarded – undo
5538 5538
 				$tot = '';
5539 5539
 			}
5540 5540
 			switch ($type) {
5541
-			case 'table':
5542
-				$common[] = '<tr><td>' . $given . '</td><td>' . I18N::number($total) . '</td><td>' . $total . '</td></tr>';
5543
-				break;
5544
-			case 'list':
5545
-				$common[] = '<li><span dir="auto">' . $given . '</span>' . $tot . '</li>';
5546
-				break;
5547
-			case 'nolist':
5548
-				$common[] = '<span dir="auto">' . $given . '</span>' . $tot;
5549
-				break;
5541
+				case 'table':
5542
+					$common[] = '<tr><td>' . $given . '</td><td>' . I18N::number($total) . '</td><td>' . $total . '</td></tr>';
5543
+					break;
5544
+				case 'list':
5545
+					$common[] = '<li><span dir="auto">' . $given . '</span>' . $tot . '</li>';
5546
+					break;
5547
+				case 'nolist':
5548
+					$common[] = '<span dir="auto">' . $given . '</span>' . $tot;
5549
+					break;
5550 5550
 			}
5551 5551
 		}
5552 5552
 		if ($common) {
5553 5553
 			switch ($type) {
5554
-			case 'table':
5555
-				global $controller;
5556
-				$table_id = Uuid::uuid4(); // lists requires a unique ID in case there are multiple lists per page
5557
-				$controller
5558
-					->addExternalJavascript(WT_JQUERY_DATATABLES_JS_URL)
5559
-					->addInlineJavascript('
5554
+				case 'table':
5555
+					global $controller;
5556
+					$table_id = Uuid::uuid4(); // lists requires a unique ID in case there are multiple lists per page
5557
+					$controller
5558
+						->addExternalJavascript(WT_JQUERY_DATATABLES_JS_URL)
5559
+						->addInlineJavascript('
5560 5560
 					jQuery("#' . $table_id . '").dataTable({
5561 5561
 						dom: \'t\',
5562 5562
 						autoWidth: false,
@@ -5574,15 +5574,15 @@  discard block
 block discarded – undo
5574 5574
 					});
5575 5575
 					jQuery("#' . $table_id . '").css("visibility", "visible");
5576 5576
 				');
5577
-				$lookup = array('M' => I18N::translate('Male'), 'F' => I18N::translate('Female'), 'U' => I18N::translateContext('unknown gender', 'Unknown'), 'B' => I18N::translate('All'));
5577
+					$lookup = array('M' => I18N::translate('Male'), 'F' => I18N::translate('Female'), 'U' => I18N::translateContext('unknown gender', 'Unknown'), 'B' => I18N::translate('All'));
5578 5578
 
5579
-				return '<table id="' . $table_id . '" class="givn-list"><thead><tr><th class="ui-state-default" colspan="3">' . $lookup[$sex] . '</th></tr><tr><th>' . I18N::translate('Name') . '</th><th>' . I18N::translate('Count') . '</th><th>COUNT</th></tr></thead><tbody>' . implode('', $common) . '</tbody></table>';
5580
-			case 'list':
5581
-				return '<ul>' . implode('', $common) . '</ul>';
5582
-			case 'nolist':
5583
-				return implode(I18N::$list_separator, $common);
5584
-			default:
5585
-				return '';
5579
+					return '<table id="' . $table_id . '" class="givn-list"><thead><tr><th class="ui-state-default" colspan="3">' . $lookup[$sex] . '</th></tr><tr><th>' . I18N::translate('Name') . '</th><th>' . I18N::translate('Count') . '</th><th>COUNT</th></tr></thead><tbody>' . implode('', $common) . '</tbody></table>';
5580
+				case 'list':
5581
+					return '<ul>' . implode('', $common) . '</ul>';
5582
+				case 'nolist':
5583
+					return implode(I18N::$list_separator, $common);
5584
+				default:
5585
+					return '';
5586 5586
 			}
5587 5587
 		} else {
5588 5588
 			return '';
@@ -6069,42 +6069,42 @@  discard block
 block discarded – undo
6069 6069
 		}
6070 6070
 
6071 6071
 		switch ($type) {
6072
-		default:
6073
-		case 'userid':
6074
-			return $user->getUserId();
6075
-		case 'username':
6076
-			return Filter::escapeHtml($user->getUserName());
6077
-		case 'fullname':
6078
-			return $user->getRealNameHtml();
6079
-		case 'regdate':
6080
-			if (is_array($params) && isset($params[0]) && $params[0] != '') {
6081
-				$datestamp = $params[0];
6082
-			} else {
6083
-				$datestamp = I18N::dateFormat();
6084
-			}
6072
+			default:
6073
+			case 'userid':
6074
+				return $user->getUserId();
6075
+			case 'username':
6076
+				return Filter::escapeHtml($user->getUserName());
6077
+			case 'fullname':
6078
+				return $user->getRealNameHtml();
6079
+			case 'regdate':
6080
+				if (is_array($params) && isset($params[0]) && $params[0] != '') {
6081
+					$datestamp = $params[0];
6082
+				} else {
6083
+					$datestamp = I18N::dateFormat();
6084
+				}
6085 6085
 
6086
-			return FunctionsDate::timestampToGedcomDate($user->getPreference('reg_timestamp'))->display(false, $datestamp);
6087
-		case 'regtime':
6088
-			if (is_array($params) && isset($params[0]) && $params[0] != '') {
6089
-				$datestamp = $params[0];
6090
-			} else {
6091
-				$datestamp = str_replace('%', '', I18N::timeFormat());
6092
-			}
6086
+				return FunctionsDate::timestampToGedcomDate($user->getPreference('reg_timestamp'))->display(false, $datestamp);
6087
+			case 'regtime':
6088
+				if (is_array($params) && isset($params[0]) && $params[0] != '') {
6089
+					$datestamp = $params[0];
6090
+				} else {
6091
+					$datestamp = str_replace('%', '', I18N::timeFormat());
6092
+				}
6093 6093
 
6094
-			return date($datestamp, $user->getPreference('reg_timestamp'));
6095
-		case 'loggedin':
6096
-			if (is_array($params) && isset($params[0]) && $params[0] != '') {
6097
-				$yes = $params[0];
6098
-			} else {
6099
-				$yes = I18N::translate('yes');
6100
-			}
6101
-			if (is_array($params) && isset($params[1]) && $params[1] != '') {
6102
-				$no = $params[1];
6103
-			} else {
6104
-				$no = I18N::translate('no');
6105
-			}
6094
+				return date($datestamp, $user->getPreference('reg_timestamp'));
6095
+			case 'loggedin':
6096
+				if (is_array($params) && isset($params[0]) && $params[0] != '') {
6097
+					$yes = $params[0];
6098
+				} else {
6099
+					$yes = I18N::translate('yes');
6100
+				}
6101
+				if (is_array($params) && isset($params[1]) && $params[1] != '') {
6102
+					$no = $params[1];
6103
+				} else {
6104
+					$no = I18N::translate('no');
6105
+				}
6106 6106
 
6107
-			return Database::prepare("SELECT SQL_NO_CACHE 1 FROM `##session` WHERE user_id=? LIMIT 1")->execute(array($user->getUserId()))->fetchOne() ? $yes : $no;
6107
+				return Database::prepare("SELECT SQL_NO_CACHE 1 FROM `##session` WHERE user_id=? LIMIT 1")->execute(array($user->getUserId()))->fetchOne() ? $yes : $no;
6108 6108
 		}
6109 6109
 	}
6110 6110
 
@@ -6941,50 +6941,50 @@  discard block
 block discarded – undo
6941 6941
 		}
6942 6942
 		// The current chart engine (Google charts) can't handle <sup></sup> markup
6943 6943
 		switch ($century) {
6944
-		case 21:
6945
-			return strip_tags(I18N::translateContext('CENTURY', '21st'));
6946
-		case 20:
6947
-			return strip_tags(I18N::translateContext('CENTURY', '20th'));
6948
-		case 19:
6949
-			return strip_tags(I18N::translateContext('CENTURY', '19th'));
6950
-		case 18:
6951
-			return strip_tags(I18N::translateContext('CENTURY', '18th'));
6952
-		case 17:
6953
-			return strip_tags(I18N::translateContext('CENTURY', '17th'));
6954
-		case 16:
6955
-			return strip_tags(I18N::translateContext('CENTURY', '16th'));
6956
-		case 15:
6957
-			return strip_tags(I18N::translateContext('CENTURY', '15th'));
6958
-		case 14:
6959
-			return strip_tags(I18N::translateContext('CENTURY', '14th'));
6960
-		case 13:
6961
-			return strip_tags(I18N::translateContext('CENTURY', '13th'));
6962
-		case 12:
6963
-			return strip_tags(I18N::translateContext('CENTURY', '12th'));
6964
-		case 11:
6965
-			return strip_tags(I18N::translateContext('CENTURY', '11th'));
6966
-		case 10:
6967
-			return strip_tags(I18N::translateContext('CENTURY', '10th'));
6968
-		case  9:
6969
-			return strip_tags(I18N::translateContext('CENTURY', '9th'));
6970
-		case  8:
6971
-			return strip_tags(I18N::translateContext('CENTURY', '8th'));
6972
-		case  7:
6973
-			return strip_tags(I18N::translateContext('CENTURY', '7th'));
6974
-		case  6:
6975
-			return strip_tags(I18N::translateContext('CENTURY', '6th'));
6976
-		case  5:
6977
-			return strip_tags(I18N::translateContext('CENTURY', '5th'));
6978
-		case  4:
6979
-			return strip_tags(I18N::translateContext('CENTURY', '4th'));
6980
-		case  3:
6981
-			return strip_tags(I18N::translateContext('CENTURY', '3rd'));
6982
-		case  2:
6983
-			return strip_tags(I18N::translateContext('CENTURY', '2nd'));
6984
-		case  1:
6985
-			return strip_tags(I18N::translateContext('CENTURY', '1st'));
6986
-		default:
6987
-			return ($century - 1) . '01-' . $century . '00';
6944
+			case 21:
6945
+				return strip_tags(I18N::translateContext('CENTURY', '21st'));
6946
+			case 20:
6947
+				return strip_tags(I18N::translateContext('CENTURY', '20th'));
6948
+			case 19:
6949
+				return strip_tags(I18N::translateContext('CENTURY', '19th'));
6950
+			case 18:
6951
+				return strip_tags(I18N::translateContext('CENTURY', '18th'));
6952
+			case 17:
6953
+				return strip_tags(I18N::translateContext('CENTURY', '17th'));
6954
+			case 16:
6955
+				return strip_tags(I18N::translateContext('CENTURY', '16th'));
6956
+			case 15:
6957
+				return strip_tags(I18N::translateContext('CENTURY', '15th'));
6958
+			case 14:
6959
+				return strip_tags(I18N::translateContext('CENTURY', '14th'));
6960
+			case 13:
6961
+				return strip_tags(I18N::translateContext('CENTURY', '13th'));
6962
+			case 12:
6963
+				return strip_tags(I18N::translateContext('CENTURY', '12th'));
6964
+			case 11:
6965
+				return strip_tags(I18N::translateContext('CENTURY', '11th'));
6966
+			case 10:
6967
+				return strip_tags(I18N::translateContext('CENTURY', '10th'));
6968
+			case  9:
6969
+				return strip_tags(I18N::translateContext('CENTURY', '9th'));
6970
+			case  8:
6971
+				return strip_tags(I18N::translateContext('CENTURY', '8th'));
6972
+			case  7:
6973
+				return strip_tags(I18N::translateContext('CENTURY', '7th'));
6974
+			case  6:
6975
+				return strip_tags(I18N::translateContext('CENTURY', '6th'));
6976
+			case  5:
6977
+				return strip_tags(I18N::translateContext('CENTURY', '5th'));
6978
+			case  4:
6979
+				return strip_tags(I18N::translateContext('CENTURY', '4th'));
6980
+			case  3:
6981
+				return strip_tags(I18N::translateContext('CENTURY', '3rd'));
6982
+			case  2:
6983
+				return strip_tags(I18N::translateContext('CENTURY', '2nd'));
6984
+			case  1:
6985
+				return strip_tags(I18N::translateContext('CENTURY', '1st'));
6986
+			default:
6987
+				return ($century - 1) . '01-' . $century . '00';
6988 6988
 		}
6989 6989
 	}
6990 6990
 }
Please login to merge, or discard this patch.
app/Theme/ThemeInterface.php 1 patch
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -102,6 +102,7 @@  discard block
 block discarded – undo
102 102
 	/**
103 103
 	 * Allow themes to do things after initialization (since they cannot use
104 104
 	 * the constructor).
105
+	 * @return void
105 106
 	 */
106 107
 	public function hookAfterInit();
107 108
 
@@ -193,6 +194,7 @@  discard block
 block discarded – undo
193 194
 	 * happens in a theme file, and we need to be able to change it.
194 195
 	 *
195 196
 	 * @param Tree|null $tree The current tree (if there is one).
197
+	 * @return void
196 198
 	 */
197 199
 	public function init(Tree $tree = null);
198 200
 
@@ -214,6 +216,7 @@  discard block
 block discarded – undo
214 216
 
215 217
 	/**
216 218
 	 * Send any HTTP headers.
219
+	 * @return void
217 220
 	 */
218 221
 	public function sendHeaders();
219 222
 
Please login to merge, or discard this patch.
admin_media.php 2 patches
Braces   +10 added lines, -4 removed lines patch added patch discarded remove patch
@@ -648,16 +648,22 @@
 block discarded – undo
648 648
 					<div dir="ltr">
649 649
 						<?php if (count($media_folders) > 1): ?>
650 650
 						<?php echo WT_DATA_DIR, FunctionsEdit::selectEditControl('media_folder', $media_folders, null, $media_folder, 'onchange="this.form.submit();"'); ?>
651
-						<?php else: ?>
652
-						<?php echo WT_DATA_DIR, Filter::escapeHtml($media_folder); ?>
651
+						<?php else {
652
+	: ?>
653
+						<?php echo WT_DATA_DIR, Filter::escapeHtml($media_folder);
654
+}
655
+?>
653 656
 						<input type="hidden" name="media_folder" value="<?php echo Filter::escapeHtml($media_folder); ?>">
654 657
 						<?php endif; ?>
655 658
 					</div>
656 659
 
657 660
 					<?php if (count($media_paths) > 1): ?>
658 661
 					<?php echo FunctionsEdit::selectEditControl('media_path', $media_paths, null, $media_path, 'onchange="this.form.submit();"'); ?>
659
-					<?php else: ?>
660
-					<?php echo Filter::escapeHtml($media_path); ?>
662
+					<?php else {
663
+	: ?>
664
+					<?php echo Filter::escapeHtml($media_path);
665
+}
666
+?>
661 667
 					<input type="hidden" name="media_path" value="<?php echo Filter::escapeHtml($media_path); ?>">
662 668
 					<?php endif; ?>
663 669
 
Please login to merge, or discard this patch.
Switch Indentation   +93 added lines, -93 removed lines patch added patch discarded remove patch
@@ -85,98 +85,98 @@  discard block
 block discarded – undo
85 85
 ////////////////////////////////////////////////////////////////////////////////
86 86
 
87 87
 switch ($action) {
88
-case 'load_json':
89
-	$search = Filter::get('search');
90
-	$search = $search['value'];
91
-	$start  = Filter::getInteger('start');
92
-	$length = Filter::getInteger('length');
93
-
94
-	switch ($files) {
95
-	case 'local':
96
-		// Filtered rows
97
-		$SELECT1 =
98
-			"SELECT SQL_CACHE SQL_CALC_FOUND_ROWS TRIM(LEADING :media_path_1 FROM m_filename) AS media_path, m_id AS xref, m_titl, m_file AS gedcom_id, m_gedcom AS gedcom" .
99
-			" FROM  `##media`" .
100
-			" JOIN  `##gedcom_setting` ON (m_file = gedcom_id AND setting_name = 'MEDIA_DIRECTORY')" .
101
-			" JOIN  `##gedcom` USING (gedcom_id)" .
102
-			" WHERE setting_value = :media_folder" .
103
-			" AND   m_filename LIKE CONCAT(:media_path_2, '%')" .
104
-			" AND   (SUBSTRING_INDEX(m_filename, '/', -1) LIKE CONCAT('%', :search_1, '%')" .
105
-			"  OR   m_titl LIKE CONCAT('%', :search_2, '%'))" .
106
-			" AND   m_filename NOT LIKE 'http://%'" .
107
-			" AND   m_filename NOT LIKE 'https://%'";
108
-		$ARGS1 = array(
109
-			'media_path_1' => $media_path,
110
-			'media_folder' => $media_folder,
111
-			'media_path_2' => Filter::escapeLike($media_path),
112
-			'search_1'     => Filter::escapeLike($search),
113
-			'search_2'     => Filter::escapeLike($search),
114
-		);
115
-		// Unfiltered rows
116
-		$SELECT2 =
117
-			"SELECT SQL_CACHE COUNT(*)" .
118
-			" FROM  `##media`" .
119
-			" JOIN  `##gedcom_setting` ON (m_file = gedcom_id AND setting_name = 'MEDIA_DIRECTORY')" .
120
-			" WHERE setting_value = :media_folder" .
121
-			" AND   m_filename LIKE CONCAT(:media_path_3, '%')" .
122
-			" AND   m_filename NOT LIKE 'http://%'" .
123
-			" AND   m_filename NOT LIKE 'https://%'";
124
-		$ARGS2 = array(
125
-			'media_folder' => $media_folder,
126
-			'media_path_3' => $media_path,
127
-		);
128
-
129
-		if ($subfolders == 'exclude') {
130
-			$SELECT1 .= " AND m_filename NOT LIKE CONCAT(:media_path_4, '%/%')";
131
-			$ARGS1['media_path_4'] = Filter::escapeLike($media_path);
132
-			$SELECT2 .= " AND m_filename NOT LIKE CONCAT(:media_path_4, '%/%')";
133
-			$ARGS2['media_path_4'] = Filter::escapeLike($media_path);
134
-		}
135
-
136
-		$order = Filter::getArray('order');
137
-		$SELECT1 .= " ORDER BY ";
138
-		if ($order) {
139
-			foreach ($order as $key => $value) {
140
-				if ($key > 0) {
141
-					$SELECT1 .= ',';
88
+	case 'load_json':
89
+		$search = Filter::get('search');
90
+		$search = $search['value'];
91
+		$start  = Filter::getInteger('start');
92
+		$length = Filter::getInteger('length');
93
+
94
+		switch ($files) {
95
+			case 'local':
96
+				// Filtered rows
97
+				$SELECT1 =
98
+					"SELECT SQL_CACHE SQL_CALC_FOUND_ROWS TRIM(LEADING :media_path_1 FROM m_filename) AS media_path, m_id AS xref, m_titl, m_file AS gedcom_id, m_gedcom AS gedcom" .
99
+					" FROM  `##media`" .
100
+					" JOIN  `##gedcom_setting` ON (m_file = gedcom_id AND setting_name = 'MEDIA_DIRECTORY')" .
101
+					" JOIN  `##gedcom` USING (gedcom_id)" .
102
+					" WHERE setting_value = :media_folder" .
103
+					" AND   m_filename LIKE CONCAT(:media_path_2, '%')" .
104
+					" AND   (SUBSTRING_INDEX(m_filename, '/', -1) LIKE CONCAT('%', :search_1, '%')" .
105
+					"  OR   m_titl LIKE CONCAT('%', :search_2, '%'))" .
106
+					" AND   m_filename NOT LIKE 'http://%'" .
107
+					" AND   m_filename NOT LIKE 'https://%'";
108
+				$ARGS1 = array(
109
+					'media_path_1' => $media_path,
110
+					'media_folder' => $media_folder,
111
+					'media_path_2' => Filter::escapeLike($media_path),
112
+					'search_1'     => Filter::escapeLike($search),
113
+					'search_2'     => Filter::escapeLike($search),
114
+				);
115
+				// Unfiltered rows
116
+				$SELECT2 =
117
+					"SELECT SQL_CACHE COUNT(*)" .
118
+					" FROM  `##media`" .
119
+					" JOIN  `##gedcom_setting` ON (m_file = gedcom_id AND setting_name = 'MEDIA_DIRECTORY')" .
120
+					" WHERE setting_value = :media_folder" .
121
+					" AND   m_filename LIKE CONCAT(:media_path_3, '%')" .
122
+					" AND   m_filename NOT LIKE 'http://%'" .
123
+					" AND   m_filename NOT LIKE 'https://%'";
124
+				$ARGS2 = array(
125
+					'media_folder' => $media_folder,
126
+					'media_path_3' => $media_path,
127
+				);
128
+
129
+				if ($subfolders == 'exclude') {
130
+					$SELECT1 .= " AND m_filename NOT LIKE CONCAT(:media_path_4, '%/%')";
131
+					$ARGS1['media_path_4'] = Filter::escapeLike($media_path);
132
+					$SELECT2 .= " AND m_filename NOT LIKE CONCAT(:media_path_4, '%/%')";
133
+					$ARGS2['media_path_4'] = Filter::escapeLike($media_path);
142 134
 				}
143
-				// Datatables numbers columns 0, 1, 2
144
-				// MySQL numbers columns 1, 2, 3
145
-				switch ($value['dir']) {
146
-				case 'asc':
147
-					$SELECT1 .= ":col_" . $key . " ASC";
148
-					break;
149
-				case 'desc':
150
-					$SELECT1 .= ":col_" . $key . " DESC";
151
-					break;
135
+
136
+				$order = Filter::getArray('order');
137
+				$SELECT1 .= " ORDER BY ";
138
+				if ($order) {
139
+					foreach ($order as $key => $value) {
140
+						if ($key > 0) {
141
+							$SELECT1 .= ',';
142
+						}
143
+						// Datatables numbers columns 0, 1, 2
144
+						// MySQL numbers columns 1, 2, 3
145
+						switch ($value['dir']) {
146
+							case 'asc':
147
+								$SELECT1 .= ":col_" . $key . " ASC";
148
+								break;
149
+							case 'desc':
150
+								$SELECT1 .= ":col_" . $key . " DESC";
151
+								break;
152
+						}
153
+					$ARGS1['col_' . $key] = 1 + $value['column'];
152 154
 				}
153
-				$ARGS1['col_' . $key] = 1 + $value['column'];
155
+			} else {
156
+				$SELECT1 = " 1 ASC";
154 157
 			}
155
-		} else {
156
-			$SELECT1 = " 1 ASC";
157
-		}
158 158
 
159
-		if ($length > 0) {
160
-			$SELECT1 .= " LIMIT :length OFFSET :start";
161
-			$ARGS1['length'] = $length;
162
-			$ARGS1['start']  = $start;
163
-		}
164
-
165
-		$rows = Database::prepare($SELECT1)->execute($ARGS1)->fetchAll();
166
-		// Total filtered/unfiltered rows
167
-		$recordsFiltered = Database::prepare("SELECT FOUND_ROWS()")->fetchOne();
168
-		$recordsTotal    = Database::prepare($SELECT2)->execute($ARGS2)->fetchOne();
159
+			if ($length > 0) {
160
+				$SELECT1 .= " LIMIT :length OFFSET :start";
161
+				$ARGS1['length'] = $length;
162
+				$ARGS1['start']  = $start;
163
+			}
169 164
 
170
-		$data = array();
171
-		foreach ($rows as $row) {
172
-			$media  = Media::getInstance($row->xref, Tree::findById($row->gedcom_id), $row->gedcom);
173
-			$data[] = array(
174
-				mediaFileInfo($media_folder, $media_path, $row->media_path),
175
-				$media->displayImage(),
176
-				mediaObjectInfo($media),
177
-			);
178
-		}
179
-		break;
165
+			$rows = Database::prepare($SELECT1)->execute($ARGS1)->fetchAll();
166
+			// Total filtered/unfiltered rows
167
+			$recordsFiltered = Database::prepare("SELECT FOUND_ROWS()")->fetchOne();
168
+			$recordsTotal    = Database::prepare($SELECT2)->execute($ARGS2)->fetchOne();
169
+
170
+			$data = array();
171
+			foreach ($rows as $row) {
172
+				$media  = Media::getInstance($row->xref, Tree::findById($row->gedcom_id), $row->gedcom);
173
+				$data[] = array(
174
+					mediaFileInfo($media_folder, $media_path, $row->media_path),
175
+					$media->displayImage(),
176
+					mediaObjectInfo($media),
177
+				);
178
+			}
179
+			break;
180 180
 
181 181
 	case 'external':
182 182
 		// Filtered rows
@@ -206,12 +206,12 @@  discard block
 block discarded – undo
206 206
 				// Datatables numbers columns 0, 1, 2
207 207
 				// MySQL numbers columns 1, 2, 3
208 208
 				switch ($value['dir']) {
209
-				case 'asc':
210
-					$SELECT1 .= ":col_" . $key . " ASC";
211
-					break;
212
-				case 'desc':
213
-					$SELECT1 .= ":col_" . $key . " DESC";
214
-					break;
209
+					case 'asc':
210
+						$SELECT1 .= ":col_" . $key . " ASC";
211
+						break;
212
+					case 'desc':
213
+						$SELECT1 .= ":col_" . $key . " DESC";
214
+						break;
215 215
 				}
216 216
 				$ARGS1['col_' . $key] = 1 + $value['column'];
217 217
 			}
Please login to merge, or discard this patch.
admin_module_blocks.php 1 patch
Braces   +5 added lines, -2 removed lines patch added patch discarded remove patch
@@ -81,8 +81,11 @@
 block discarded – undo
81 81
 				<td class="col-xs-2">
82 82
 					<?php if ($module instanceof ModuleConfigInterface): ?>
83 83
 						<a href="<?php echo $module->getConfigLink(); ?>"><?php echo $module->getTitle(); ?> <i class="fa fa-cogs"></i></a>
84
-					<?php else: ?>
85
-						<?php echo $module->getTitle(); ?>
84
+					<?php else {
85
+	: ?>
86
+						<?php echo $module->getTitle();
87
+}
88
+?>
86 89
 					<?php endif; ?>
87 90
 				</td>
88 91
 				<td class="col-xs-5"><?php echo $module->getDescription(); ?></td>
Please login to merge, or discard this patch.
admin_module_menus.php 1 patch
Braces   +5 added lines, -2 removed lines patch added patch discarded remove patch
@@ -98,8 +98,11 @@
 block discarded – undo
98 98
 				<td class="col-xs-1">
99 99
 					<?php if ($module instanceof ModuleConfigInterface): ?>
100 100
 					<a href="<?php echo $module->getConfigLink(); ?>"><?php echo $module->getTitle(); ?> <i class="fa fa-cogs"></i></a>
101
-					<?php else: ?>
102
-					<?php echo $module->getTitle(); ?>
101
+					<?php else {
102
+	: ?>
103
+					<?php echo $module->getTitle();
104
+}
105
+?>
103 106
 					<?php endif; ?>
104 107
 				</td>
105 108
 				<td class="col-xs-5"><?php echo $module->getDescription(); ?></td>
Please login to merge, or discard this patch.
admin_site_merge.php 1 patch
Braces   +20 added lines, -8 removed lines patch added patch discarded remove patch
@@ -232,9 +232,12 @@  discard block
 block discarded – undo
232 232
 				<?php endforeach; ?>
233 233
 				</tbody>
234 234
 			</table>
235
-			<?php else: ?>
235
+			<?php else {
236
+	: ?>
236 237
 			<p>
237
-				<?php echo I18N::translate('No matching facts found'); ?>
238
+				<?php echo I18N::translate('No matching facts found');
239
+}
240
+?>
238 241
 			</p>
239 242
 			<?php endif; ?>
240 243
 		</div>
@@ -279,9 +282,12 @@  discard block
 block discarded – undo
279 282
 							<?php endforeach; ?>
280 283
 							</tbody>
281 284
 						</table>
282
-					<?php else: ?>
285
+					<?php else {
286
+	: ?>
283 287
 						<p>
284
-							<?php echo I18N::translate('No matching facts found'); ?>
288
+							<?php echo I18N::translate('No matching facts found');
289
+}
290
+?>
285 291
 						</p>
286 292
 					<?php endif; ?>
287 293
 				</div>
@@ -325,9 +331,12 @@  discard block
 block discarded – undo
325 331
 							<?php endforeach; ?>
326 332
 							</tbody>
327 333
 						</table>
328
-					<?php else: ?>
334
+					<?php else {
335
+	: ?>
329 336
 						<p>
330
-							<?php echo I18N::translate('No matching facts found'); ?>
337
+							<?php echo I18N::translate('No matching facts found');
338
+}
339
+?>
331 340
 						</p>
332 341
 					<?php endif; ?>
333 342
 				</div>
@@ -341,10 +350,13 @@  discard block
 block discarded – undo
341 350
 	</button>
342 351
 </form>
343 352
 
344
-<?php else: ?>
353
+<?php else {
354
+	: ?>
345 355
 
346 356
 <form class="form form-horizontal">
347
-	<input type="hidden" name="ged" value="<?php echo $WT_TREE->getNameHtml(); ?>">
357
+	<input type="hidden" name="ged" value="<?php echo $WT_TREE->getNameHtml();
358
+}
359
+?>">
348 360
 	<p><?php echo /* I18N: Records are indviduals, sources, etc. */ I18N::translate('Select two records to merge.'); ?></p>
349 361
 
350 362
 	<div class="form-group">
Please login to merge, or discard this patch.
admin_trees_config.php 2 patches
Braces   +10 added lines, -4 removed lines patch added patch discarded remove patch
@@ -554,18 +554,24 @@
 block discarded – undo
554 554
 					<div class="bg-danger text-danger">
555 555
 						<?php echo $resn->xref, ' — ', I18N::translate('this record does not exist'); ?>
556 556
 					</div>
557
-					<?php else: ?>
557
+					<?php else {
558
+	: ?>
558 559
 					<div class="text-muted">
559
-						<?php echo I18N::translate('All records'); ?>
560
+						<?php echo I18N::translate('All records');
561
+}
562
+?>
560 563
 					</div>
561 564
 					<?php endif; ?>
562 565
 				</td>
563 566
 				<td>
564 567
 					<?php if ($resn->tag_label): ?>
565 568
 					<?php echo $resn->tag_label; ?>
566
-					<?php else: ?>
569
+					<?php else {
570
+	: ?>
567 571
 					<div class="text-muted">
568
-						<?php echo I18N::translate('All facts and events'); ?>
572
+						<?php echo I18N::translate('All facts and events');
573
+}
574
+?>
569 575
 					</div>
570 576
 					<?php endif; ?>
571 577
 				</td>
Please login to merge, or discard this patch.
Switch Indentation   +152 added lines, -152 removed lines patch added patch discarded remove patch
@@ -132,176 +132,176 @@
 block discarded – undo
132 132
 $relatives_events = explode(',', $WT_TREE->getPreference('SHOW_RELATIVES_EVENTS'));
133 133
 
134 134
 switch (Filter::post('action')) {
135
-case 'privacy':
136
-	foreach (Filter::postArray('delete', WT_REGEX_INTEGER) as $delete_resn) {
137
-		Database::prepare(
138
-			"DELETE FROM `##default_resn` WHERE default_resn_id=?"
139
-		)->execute(array($delete_resn));
140
-	}
135
+	case 'privacy':
136
+		foreach (Filter::postArray('delete', WT_REGEX_INTEGER) as $delete_resn) {
137
+			Database::prepare(
138
+				"DELETE FROM `##default_resn` WHERE default_resn_id=?"
139
+			)->execute(array($delete_resn));
140
+		}
141 141
 
142
-	$xrefs     = Filter::postArray('xref', WT_REGEX_XREF);
143
-	$tag_types = Filter::postArray('tag_type', WT_REGEX_TAG);
144
-	$resns     = Filter::postArray('resn');
142
+		$xrefs     = Filter::postArray('xref', WT_REGEX_XREF);
143
+		$tag_types = Filter::postArray('tag_type', WT_REGEX_TAG);
144
+		$resns     = Filter::postArray('resn');
145 145
 
146
-	foreach ($xrefs as $n => $xref) {
147
-		$tag_type = $tag_types[$n];
148
-		$resn     = $resns[$n];
146
+		foreach ($xrefs as $n => $xref) {
147
+			$tag_type = $tag_types[$n];
148
+			$resn     = $resns[$n];
149 149
 
150
-		if ($tag_type || $xref) {
151
-			// Delete any existing data
152
-			if ($xref === '') {
153
-				Database::prepare(
154
-					"DELETE FROM `##default_resn` WHERE gedcom_id=? AND tag_type=? AND xref IS NULL"
155
-				)->execute(array($WT_TREE->getTreeId(), $tag_type));
156
-			}
157
-			if ($tag_type === '') {
150
+			if ($tag_type || $xref) {
151
+				// Delete any existing data
152
+				if ($xref === '') {
153
+					Database::prepare(
154
+						"DELETE FROM `##default_resn` WHERE gedcom_id=? AND tag_type=? AND xref IS NULL"
155
+					)->execute(array($WT_TREE->getTreeId(), $tag_type));
156
+				}
157
+				if ($tag_type === '') {
158
+					Database::prepare(
159
+						"DELETE FROM `##default_resn` WHERE gedcom_id=? AND xref=? AND tag_type IS NULL"
160
+					)->execute(array($WT_TREE->getTreeId(), $xref));
161
+				}
162
+				// Add (or update) the new data
158 163
 				Database::prepare(
159
-					"DELETE FROM `##default_resn` WHERE gedcom_id=? AND xref=? AND tag_type IS NULL"
160
-				)->execute(array($WT_TREE->getTreeId(), $xref));
164
+					"REPLACE INTO `##default_resn` (gedcom_id, xref, tag_type, resn) VALUES (?, NULLIF(?, ''), NULLIF(?, ''), ?)"
165
+				)->execute(array($WT_TREE->getTreeId(), $xref, $tag_type, $resn));
161 166
 			}
162
-			// Add (or update) the new data
163
-			Database::prepare(
164
-				"REPLACE INTO `##default_resn` (gedcom_id, xref, tag_type, resn) VALUES (?, NULLIF(?, ''), NULLIF(?, ''), ?)"
165
-			)->execute(array($WT_TREE->getTreeId(), $xref, $tag_type, $resn));
166 167
 		}
167
-	}
168 168
 
169
-	$WT_TREE->setPreference('HIDE_LIVE_PEOPLE', Filter::postBool('HIDE_LIVE_PEOPLE'));
170
-	$WT_TREE->setPreference('KEEP_ALIVE_YEARS_BIRTH', Filter::post('KEEP_ALIVE_YEARS_BIRTH', WT_REGEX_INTEGER, 0));
171
-	$WT_TREE->setPreference('KEEP_ALIVE_YEARS_DEATH', Filter::post('KEEP_ALIVE_YEARS_DEATH', WT_REGEX_INTEGER, 0));
172
-	$WT_TREE->setPreference('MAX_ALIVE_AGE', Filter::post('MAX_ALIVE_AGE', WT_REGEX_INTEGER, 100));
173
-	$WT_TREE->setPreference('REQUIRE_AUTHENTICATION', Filter::postBool('REQUIRE_AUTHENTICATION'));
174
-	$WT_TREE->setPreference('SHOW_DEAD_PEOPLE', Filter::post('SHOW_DEAD_PEOPLE'));
175
-	$WT_TREE->setPreference('SHOW_LIVING_NAMES', Filter::post('SHOW_LIVING_NAMES'));
176
-	$WT_TREE->setPreference('SHOW_PRIVATE_RELATIONSHIPS', Filter::post('SHOW_PRIVATE_RELATIONSHIPS'));
169
+		$WT_TREE->setPreference('HIDE_LIVE_PEOPLE', Filter::postBool('HIDE_LIVE_PEOPLE'));
170
+		$WT_TREE->setPreference('KEEP_ALIVE_YEARS_BIRTH', Filter::post('KEEP_ALIVE_YEARS_BIRTH', WT_REGEX_INTEGER, 0));
171
+		$WT_TREE->setPreference('KEEP_ALIVE_YEARS_DEATH', Filter::post('KEEP_ALIVE_YEARS_DEATH', WT_REGEX_INTEGER, 0));
172
+		$WT_TREE->setPreference('MAX_ALIVE_AGE', Filter::post('MAX_ALIVE_AGE', WT_REGEX_INTEGER, 100));
173
+		$WT_TREE->setPreference('REQUIRE_AUTHENTICATION', Filter::postBool('REQUIRE_AUTHENTICATION'));
174
+		$WT_TREE->setPreference('SHOW_DEAD_PEOPLE', Filter::post('SHOW_DEAD_PEOPLE'));
175
+		$WT_TREE->setPreference('SHOW_LIVING_NAMES', Filter::post('SHOW_LIVING_NAMES'));
176
+		$WT_TREE->setPreference('SHOW_PRIVATE_RELATIONSHIPS', Filter::post('SHOW_PRIVATE_RELATIONSHIPS'));
177 177
 
178
-	FlashMessages::addMessage(I18N::translate('The preferences for the family tree “%s” have been updated.', $WT_TREE->getTitleHtml()), 'success');
179
-	header('Location: ' . WT_BASE_URL . 'admin_trees_manage.php?ged=' . $WT_TREE->getNameUrl());
178
+		FlashMessages::addMessage(I18N::translate('The preferences for the family tree “%s” have been updated.', $WT_TREE->getTitleHtml()), 'success');
179
+		header('Location: ' . WT_BASE_URL . 'admin_trees_manage.php?ged=' . $WT_TREE->getNameUrl());
180 180
 
181
-	return;
181
+		return;
182 182
 
183
-case 'general':
184
-	if (!Filter::checkCsrf()) {
185
-		break;
186
-	}
183
+	case 'general':
184
+		if (!Filter::checkCsrf()) {
185
+			break;
186
+		}
187 187
 
188
-	// Coming soon
189
-	if (Filter::postBool('all_trees')) {
190
-		FlashMessages::addMessage(I18N::translate('The preferences for all family trees have been updated.', $WT_TREE->getTitleHtml()), 'success');
191
-	}
192
-	if (Filter::postBool('new_trees')) {
193
-		FlashMessages::addMessage(I18N::translate('The preferences for new family trees have been updated.', $WT_TREE->getTitleHtml()), 'success');
194
-	}
188
+		// Coming soon
189
+		if (Filter::postBool('all_trees')) {
190
+			FlashMessages::addMessage(I18N::translate('The preferences for all family trees have been updated.', $WT_TREE->getTitleHtml()), 'success');
191
+		}
192
+		if (Filter::postBool('new_trees')) {
193
+			FlashMessages::addMessage(I18N::translate('The preferences for new family trees have been updated.', $WT_TREE->getTitleHtml()), 'success');
194
+		}
195 195
 
196
-	$WT_TREE->setPreference('ADVANCED_NAME_FACTS', Filter::post('ADVANCED_NAME_FACTS'));
197
-	$WT_TREE->setPreference('ADVANCED_PLAC_FACTS', Filter::post('ADVANCED_PLAC_FACTS'));
198
-	$WT_TREE->setPreference('ALLOW_THEME_DROPDOWN', Filter::postBool('ALLOW_THEME_DROPDOWN'));
199
-	// For backwards compatibility with webtrees 1.x we store the two calendar formats in one variable
200
-	// e.g. "gregorian_and_jewish"
201
-	$WT_TREE->setPreference('CALENDAR_FORMAT', implode('_and_', array_unique(array(
202
-		Filter::post('CALENDAR_FORMAT0', 'gregorian|julian|french|jewish|hijri|jalali', 'none'),
203
-		Filter::post('CALENDAR_FORMAT1', 'gregorian|julian|french|jewish|hijri|jalali', 'none'),
204
-	))));
205
-	$WT_TREE->setPreference('CHART_BOX_TAGS', Filter::post('CHART_BOX_TAGS'));
206
-	$WT_TREE->setPreference('CONTACT_USER_ID', Filter::post('CONTACT_USER_ID'));
207
-	$WT_TREE->setPreference('DEFAULT_PEDIGREE_GENERATIONS', Filter::post('DEFAULT_PEDIGREE_GENERATIONS'));
208
-	$WT_TREE->setPreference('EXPAND_NOTES', Filter::postBool('EXPAND_NOTES'));
209
-	$WT_TREE->setPreference('EXPAND_SOURCES', Filter::postBool('EXPAND_SOURCES'));
210
-	$WT_TREE->setPreference('FAM_FACTS_ADD', str_replace(' ', '', Filter::post('FAM_FACTS_ADD')));
211
-	$WT_TREE->setPreference('FAM_FACTS_QUICK', str_replace(' ', '', Filter::post('FAM_FACTS_QUICK')));
212
-	$WT_TREE->setPreference('FAM_FACTS_UNIQUE', str_replace(' ', '', Filter::post('FAM_FACTS_UNIQUE')));
213
-	$WT_TREE->setPreference('FAM_ID_PREFIX', Filter::post('FAM_ID_PREFIX'));
214
-	$WT_TREE->setPreference('FULL_SOURCES', Filter::postBool('FULL_SOURCES'));
215
-	$WT_TREE->setPreference('FORMAT_TEXT', Filter::post('FORMAT_TEXT'));
216
-	$WT_TREE->setPreference('GEDCOM_ID_PREFIX', Filter::post('GEDCOM_ID_PREFIX'));
217
-	$WT_TREE->setPreference('GEDCOM_MEDIA_PATH', Filter::post('GEDCOM_MEDIA_PATH'));
218
-	$WT_TREE->setPreference('GENERATE_UIDS', Filter::postBool('GENERATE_UIDS'));
219
-	$WT_TREE->setPreference('GEONAMES_ACCOUNT', Filter::post('GEONAMES_ACCOUNT'));
220
-	$WT_TREE->setPreference('HIDE_GEDCOM_ERRORS', Filter::postBool('HIDE_GEDCOM_ERRORS'));
221
-	$WT_TREE->setPreference('INDI_FACTS_ADD', str_replace(' ', '', Filter::post('INDI_FACTS_ADD')));
222
-	$WT_TREE->setPreference('INDI_FACTS_QUICK', str_replace(' ', '', Filter::post('INDI_FACTS_QUICK')));
223
-	$WT_TREE->setPreference('INDI_FACTS_UNIQUE', str_replace(' ', '', Filter::post('INDI_FACTS_UNIQUE')));
224
-	$WT_TREE->setPreference('LANGUAGE', Filter::post('LANGUAGE'));
225
-	$WT_TREE->setPreference('MAX_DESCENDANCY_GENERATIONS', Filter::post('MAX_DESCENDANCY_GENERATIONS'));
226
-	$WT_TREE->setPreference('MAX_PEDIGREE_GENERATIONS', Filter::post('MAX_PEDIGREE_GENERATIONS'));
227
-	$WT_TREE->setPreference('MEDIA_ID_PREFIX', Filter::post('MEDIA_ID_PREFIX'));
228
-	$WT_TREE->setPreference('MEDIA_UPLOAD', Filter::post('MEDIA_UPLOAD'));
229
-	$WT_TREE->setPreference('META_DESCRIPTION', Filter::post('META_DESCRIPTION'));
230
-	$WT_TREE->setPreference('META_TITLE', Filter::post('META_TITLE'));
231
-	$WT_TREE->setPreference('NOTE_ID_PREFIX', Filter::post('NOTE_ID_PREFIX'));
232
-	$WT_TREE->setPreference('NO_UPDATE_CHAN', Filter::postBool('NO_UPDATE_CHAN'));
233
-	$WT_TREE->setPreference('PEDIGREE_FULL_DETAILS', Filter::postBool('PEDIGREE_FULL_DETAILS'));
234
-	$WT_TREE->setPreference('PEDIGREE_LAYOUT', Filter::postBool('PEDIGREE_LAYOUT'));
235
-	$WT_TREE->setPreference('PEDIGREE_ROOT_ID', Filter::post('PEDIGREE_ROOT_ID', WT_REGEX_XREF));
236
-	$WT_TREE->setPreference('PEDIGREE_SHOW_GENDER', Filter::postBool('PEDIGREE_SHOW_GENDER'));
237
-	$WT_TREE->setPreference('PREFER_LEVEL2_SOURCES', Filter::post('PREFER_LEVEL2_SOURCES'));
238
-	$WT_TREE->setPreference('QUICK_REQUIRED_FACTS', Filter::post('QUICK_REQUIRED_FACTS'));
239
-	$WT_TREE->setPreference('QUICK_REQUIRED_FAMFACTS', Filter::post('QUICK_REQUIRED_FAMFACTS'));
240
-	$WT_TREE->setPreference('REPO_FACTS_ADD', str_replace(' ', '', Filter::post('REPO_FACTS_ADD')));
241
-	$WT_TREE->setPreference('REPO_FACTS_QUICK', str_replace(' ', '', Filter::post('REPO_FACTS_QUICK')));
242
-	$WT_TREE->setPreference('REPO_FACTS_UNIQUE', str_replace(' ', '', Filter::post('REPO_FACTS_UNIQUE')));
243
-	$WT_TREE->setPreference('REPO_ID_PREFIX', Filter::post('REPO_ID_PREFIX'));
244
-	$WT_TREE->setPreference('SAVE_WATERMARK_IMAGE', Filter::postBool('SAVE_WATERMARK_IMAGE'));
245
-	$WT_TREE->setPreference('SAVE_WATERMARK_THUMB', Filter::postBool('SAVE_WATERMARK_THUMB'));
246
-	$WT_TREE->setPreference('SHOW_COUNTER', Filter::postBool('SHOW_COUNTER'));
247
-	$WT_TREE->setPreference('SHOW_EST_LIST_DATES', Filter::postBool('SHOW_EST_LIST_DATES'));
248
-	$WT_TREE->setPreference('SHOW_FACT_ICONS', Filter::postBool('SHOW_FACT_ICONS'));
249
-	$WT_TREE->setPreference('SHOW_GEDCOM_RECORD', Filter::postBool('SHOW_GEDCOM_RECORD'));
250
-	$WT_TREE->setPreference('SHOW_HIGHLIGHT_IMAGES', Filter::postBool('SHOW_HIGHLIGHT_IMAGES'));
251
-	$WT_TREE->setPreference('SHOW_LAST_CHANGE', Filter::postBool('SHOW_LAST_CHANGE'));
252
-	$WT_TREE->setPreference('SHOW_LDS_AT_GLANCE', Filter::postBool('SHOW_LDS_AT_GLANCE'));
253
-	$WT_TREE->setPreference('SHOW_MEDIA_DOWNLOAD', Filter::post('SHOW_MEDIA_DOWNLOAD'));
254
-	$WT_TREE->setPreference('SHOW_NO_WATERMARK', Filter::post('SHOW_NO_WATERMARK'));
255
-	$WT_TREE->setPreference('SHOW_PARENTS_AGE', Filter::postBool('SHOW_PARENTS_AGE'));
256
-	$WT_TREE->setPreference('SHOW_PEDIGREE_PLACES', Filter::post('SHOW_PEDIGREE_PLACES'));
257
-	$WT_TREE->setPreference('SHOW_PEDIGREE_PLACES_SUFFIX', Filter::postBool('SHOW_PEDIGREE_PLACES_SUFFIX'));
258
-	$WT_TREE->setPreference('SHOW_RELATIVES_EVENTS', implode(',', Filter::postArray('SHOW_RELATIVES_EVENTS')));
259
-	$WT_TREE->setPreference('SOURCE_ID_PREFIX', Filter::post('SOURCE_ID_PREFIX'));
260
-	$WT_TREE->setPreference('SOUR_FACTS_ADD', str_replace(' ', '', Filter::post('SOUR_FACTS_ADD')));
261
-	$WT_TREE->setPreference('SOUR_FACTS_QUICK', str_replace(' ', '', Filter::post('SOUR_FACTS_QUICK')));
262
-	$WT_TREE->setPreference('SOUR_FACTS_UNIQUE', str_replace(' ', '', Filter::post('SOUR_FACTS_UNIQUE')));
263
-	$WT_TREE->setPreference('SUBLIST_TRIGGER_I', Filter::post('SUBLIST_TRIGGER_I', WT_REGEX_INTEGER, 200));
264
-	$WT_TREE->setPreference('SURNAME_LIST_STYLE', Filter::post('SURNAME_LIST_STYLE'));
265
-	$WT_TREE->setPreference('SURNAME_TRADITION', Filter::post('SURNAME_TRADITION'));
266
-	$WT_TREE->setPreference('THEME_DIR', Filter::post('THEME_DIR'));
267
-	$WT_TREE->setPreference('THUMBNAIL_WIDTH', Filter::post('THUMBNAIL_WIDTH'));
268
-	$WT_TREE->setPreference('USE_SILHOUETTE', Filter::postBool('USE_SILHOUETTE'));
269
-	$WT_TREE->setPreference('WATERMARK_THUMB', Filter::postBool('WATERMARK_THUMB'));
270
-	$WT_TREE->setPreference('WEBMASTER_USER_ID', Filter::post('WEBMASTER_USER_ID'));
271
-	$WT_TREE->setPreference('WEBTREES_EMAIL', Filter::post('WEBTREES_EMAIL'));
272
-	$WT_TREE->setPreference('title', Filter::post('title'));
273
-
274
-	// Only accept valid folders for MEDIA_DIRECTORY
275
-	$MEDIA_DIRECTORY = preg_replace('/[\/\\\\]+/', '/', Filter::post('MEDIA_DIRECTORY') . '/');
276
-	if (substr($MEDIA_DIRECTORY, 0, 1) === '/') {
277
-		$MEDIA_DIRECTORY = substr($MEDIA_DIRECTORY, 1);
278
-	}
196
+		$WT_TREE->setPreference('ADVANCED_NAME_FACTS', Filter::post('ADVANCED_NAME_FACTS'));
197
+		$WT_TREE->setPreference('ADVANCED_PLAC_FACTS', Filter::post('ADVANCED_PLAC_FACTS'));
198
+		$WT_TREE->setPreference('ALLOW_THEME_DROPDOWN', Filter::postBool('ALLOW_THEME_DROPDOWN'));
199
+		// For backwards compatibility with webtrees 1.x we store the two calendar formats in one variable
200
+		// e.g. "gregorian_and_jewish"
201
+		$WT_TREE->setPreference('CALENDAR_FORMAT', implode('_and_', array_unique(array(
202
+			Filter::post('CALENDAR_FORMAT0', 'gregorian|julian|french|jewish|hijri|jalali', 'none'),
203
+			Filter::post('CALENDAR_FORMAT1', 'gregorian|julian|french|jewish|hijri|jalali', 'none'),
204
+		))));
205
+		$WT_TREE->setPreference('CHART_BOX_TAGS', Filter::post('CHART_BOX_TAGS'));
206
+		$WT_TREE->setPreference('CONTACT_USER_ID', Filter::post('CONTACT_USER_ID'));
207
+		$WT_TREE->setPreference('DEFAULT_PEDIGREE_GENERATIONS', Filter::post('DEFAULT_PEDIGREE_GENERATIONS'));
208
+		$WT_TREE->setPreference('EXPAND_NOTES', Filter::postBool('EXPAND_NOTES'));
209
+		$WT_TREE->setPreference('EXPAND_SOURCES', Filter::postBool('EXPAND_SOURCES'));
210
+		$WT_TREE->setPreference('FAM_FACTS_ADD', str_replace(' ', '', Filter::post('FAM_FACTS_ADD')));
211
+		$WT_TREE->setPreference('FAM_FACTS_QUICK', str_replace(' ', '', Filter::post('FAM_FACTS_QUICK')));
212
+		$WT_TREE->setPreference('FAM_FACTS_UNIQUE', str_replace(' ', '', Filter::post('FAM_FACTS_UNIQUE')));
213
+		$WT_TREE->setPreference('FAM_ID_PREFIX', Filter::post('FAM_ID_PREFIX'));
214
+		$WT_TREE->setPreference('FULL_SOURCES', Filter::postBool('FULL_SOURCES'));
215
+		$WT_TREE->setPreference('FORMAT_TEXT', Filter::post('FORMAT_TEXT'));
216
+		$WT_TREE->setPreference('GEDCOM_ID_PREFIX', Filter::post('GEDCOM_ID_PREFIX'));
217
+		$WT_TREE->setPreference('GEDCOM_MEDIA_PATH', Filter::post('GEDCOM_MEDIA_PATH'));
218
+		$WT_TREE->setPreference('GENERATE_UIDS', Filter::postBool('GENERATE_UIDS'));
219
+		$WT_TREE->setPreference('GEONAMES_ACCOUNT', Filter::post('GEONAMES_ACCOUNT'));
220
+		$WT_TREE->setPreference('HIDE_GEDCOM_ERRORS', Filter::postBool('HIDE_GEDCOM_ERRORS'));
221
+		$WT_TREE->setPreference('INDI_FACTS_ADD', str_replace(' ', '', Filter::post('INDI_FACTS_ADD')));
222
+		$WT_TREE->setPreference('INDI_FACTS_QUICK', str_replace(' ', '', Filter::post('INDI_FACTS_QUICK')));
223
+		$WT_TREE->setPreference('INDI_FACTS_UNIQUE', str_replace(' ', '', Filter::post('INDI_FACTS_UNIQUE')));
224
+		$WT_TREE->setPreference('LANGUAGE', Filter::post('LANGUAGE'));
225
+		$WT_TREE->setPreference('MAX_DESCENDANCY_GENERATIONS', Filter::post('MAX_DESCENDANCY_GENERATIONS'));
226
+		$WT_TREE->setPreference('MAX_PEDIGREE_GENERATIONS', Filter::post('MAX_PEDIGREE_GENERATIONS'));
227
+		$WT_TREE->setPreference('MEDIA_ID_PREFIX', Filter::post('MEDIA_ID_PREFIX'));
228
+		$WT_TREE->setPreference('MEDIA_UPLOAD', Filter::post('MEDIA_UPLOAD'));
229
+		$WT_TREE->setPreference('META_DESCRIPTION', Filter::post('META_DESCRIPTION'));
230
+		$WT_TREE->setPreference('META_TITLE', Filter::post('META_TITLE'));
231
+		$WT_TREE->setPreference('NOTE_ID_PREFIX', Filter::post('NOTE_ID_PREFIX'));
232
+		$WT_TREE->setPreference('NO_UPDATE_CHAN', Filter::postBool('NO_UPDATE_CHAN'));
233
+		$WT_TREE->setPreference('PEDIGREE_FULL_DETAILS', Filter::postBool('PEDIGREE_FULL_DETAILS'));
234
+		$WT_TREE->setPreference('PEDIGREE_LAYOUT', Filter::postBool('PEDIGREE_LAYOUT'));
235
+		$WT_TREE->setPreference('PEDIGREE_ROOT_ID', Filter::post('PEDIGREE_ROOT_ID', WT_REGEX_XREF));
236
+		$WT_TREE->setPreference('PEDIGREE_SHOW_GENDER', Filter::postBool('PEDIGREE_SHOW_GENDER'));
237
+		$WT_TREE->setPreference('PREFER_LEVEL2_SOURCES', Filter::post('PREFER_LEVEL2_SOURCES'));
238
+		$WT_TREE->setPreference('QUICK_REQUIRED_FACTS', Filter::post('QUICK_REQUIRED_FACTS'));
239
+		$WT_TREE->setPreference('QUICK_REQUIRED_FAMFACTS', Filter::post('QUICK_REQUIRED_FAMFACTS'));
240
+		$WT_TREE->setPreference('REPO_FACTS_ADD', str_replace(' ', '', Filter::post('REPO_FACTS_ADD')));
241
+		$WT_TREE->setPreference('REPO_FACTS_QUICK', str_replace(' ', '', Filter::post('REPO_FACTS_QUICK')));
242
+		$WT_TREE->setPreference('REPO_FACTS_UNIQUE', str_replace(' ', '', Filter::post('REPO_FACTS_UNIQUE')));
243
+		$WT_TREE->setPreference('REPO_ID_PREFIX', Filter::post('REPO_ID_PREFIX'));
244
+		$WT_TREE->setPreference('SAVE_WATERMARK_IMAGE', Filter::postBool('SAVE_WATERMARK_IMAGE'));
245
+		$WT_TREE->setPreference('SAVE_WATERMARK_THUMB', Filter::postBool('SAVE_WATERMARK_THUMB'));
246
+		$WT_TREE->setPreference('SHOW_COUNTER', Filter::postBool('SHOW_COUNTER'));
247
+		$WT_TREE->setPreference('SHOW_EST_LIST_DATES', Filter::postBool('SHOW_EST_LIST_DATES'));
248
+		$WT_TREE->setPreference('SHOW_FACT_ICONS', Filter::postBool('SHOW_FACT_ICONS'));
249
+		$WT_TREE->setPreference('SHOW_GEDCOM_RECORD', Filter::postBool('SHOW_GEDCOM_RECORD'));
250
+		$WT_TREE->setPreference('SHOW_HIGHLIGHT_IMAGES', Filter::postBool('SHOW_HIGHLIGHT_IMAGES'));
251
+		$WT_TREE->setPreference('SHOW_LAST_CHANGE', Filter::postBool('SHOW_LAST_CHANGE'));
252
+		$WT_TREE->setPreference('SHOW_LDS_AT_GLANCE', Filter::postBool('SHOW_LDS_AT_GLANCE'));
253
+		$WT_TREE->setPreference('SHOW_MEDIA_DOWNLOAD', Filter::post('SHOW_MEDIA_DOWNLOAD'));
254
+		$WT_TREE->setPreference('SHOW_NO_WATERMARK', Filter::post('SHOW_NO_WATERMARK'));
255
+		$WT_TREE->setPreference('SHOW_PARENTS_AGE', Filter::postBool('SHOW_PARENTS_AGE'));
256
+		$WT_TREE->setPreference('SHOW_PEDIGREE_PLACES', Filter::post('SHOW_PEDIGREE_PLACES'));
257
+		$WT_TREE->setPreference('SHOW_PEDIGREE_PLACES_SUFFIX', Filter::postBool('SHOW_PEDIGREE_PLACES_SUFFIX'));
258
+		$WT_TREE->setPreference('SHOW_RELATIVES_EVENTS', implode(',', Filter::postArray('SHOW_RELATIVES_EVENTS')));
259
+		$WT_TREE->setPreference('SOURCE_ID_PREFIX', Filter::post('SOURCE_ID_PREFIX'));
260
+		$WT_TREE->setPreference('SOUR_FACTS_ADD', str_replace(' ', '', Filter::post('SOUR_FACTS_ADD')));
261
+		$WT_TREE->setPreference('SOUR_FACTS_QUICK', str_replace(' ', '', Filter::post('SOUR_FACTS_QUICK')));
262
+		$WT_TREE->setPreference('SOUR_FACTS_UNIQUE', str_replace(' ', '', Filter::post('SOUR_FACTS_UNIQUE')));
263
+		$WT_TREE->setPreference('SUBLIST_TRIGGER_I', Filter::post('SUBLIST_TRIGGER_I', WT_REGEX_INTEGER, 200));
264
+		$WT_TREE->setPreference('SURNAME_LIST_STYLE', Filter::post('SURNAME_LIST_STYLE'));
265
+		$WT_TREE->setPreference('SURNAME_TRADITION', Filter::post('SURNAME_TRADITION'));
266
+		$WT_TREE->setPreference('THEME_DIR', Filter::post('THEME_DIR'));
267
+		$WT_TREE->setPreference('THUMBNAIL_WIDTH', Filter::post('THUMBNAIL_WIDTH'));
268
+		$WT_TREE->setPreference('USE_SILHOUETTE', Filter::postBool('USE_SILHOUETTE'));
269
+		$WT_TREE->setPreference('WATERMARK_THUMB', Filter::postBool('WATERMARK_THUMB'));
270
+		$WT_TREE->setPreference('WEBMASTER_USER_ID', Filter::post('WEBMASTER_USER_ID'));
271
+		$WT_TREE->setPreference('WEBTREES_EMAIL', Filter::post('WEBTREES_EMAIL'));
272
+		$WT_TREE->setPreference('title', Filter::post('title'));
273
+
274
+		// Only accept valid folders for MEDIA_DIRECTORY
275
+		$MEDIA_DIRECTORY = preg_replace('/[\/\\\\]+/', '/', Filter::post('MEDIA_DIRECTORY') . '/');
276
+		if (substr($MEDIA_DIRECTORY, 0, 1) === '/') {
277
+			$MEDIA_DIRECTORY = substr($MEDIA_DIRECTORY, 1);
278
+		}
279 279
 
280
-	if ($MEDIA_DIRECTORY) {
281
-		if (is_dir(WT_DATA_DIR . $MEDIA_DIRECTORY)) {
282
-			$WT_TREE->setPreference('MEDIA_DIRECTORY', $MEDIA_DIRECTORY);
283
-		} elseif (File::mkdir(WT_DATA_DIR . $MEDIA_DIRECTORY)) {
284
-			$WT_TREE->setPreference('MEDIA_DIRECTORY', $MEDIA_DIRECTORY);
285
-			FlashMessages::addMessage(I18N::translate('The folder %s has been created.', Html::filename(WT_DATA_DIR . $MEDIA_DIRECTORY)), 'info');
286
-		} else {
287
-			FlashMessages::addMessage(I18N::translate('The folder %s does not exist, and it could not be created.', Html::filename(WT_DATA_DIR . $MEDIA_DIRECTORY)), 'danger');
280
+		if ($MEDIA_DIRECTORY) {
281
+			if (is_dir(WT_DATA_DIR . $MEDIA_DIRECTORY)) {
282
+				$WT_TREE->setPreference('MEDIA_DIRECTORY', $MEDIA_DIRECTORY);
283
+			} elseif (File::mkdir(WT_DATA_DIR . $MEDIA_DIRECTORY)) {
284
+				$WT_TREE->setPreference('MEDIA_DIRECTORY', $MEDIA_DIRECTORY);
285
+				FlashMessages::addMessage(I18N::translate('The folder %s has been created.', Html::filename(WT_DATA_DIR . $MEDIA_DIRECTORY)), 'info');
286
+			} else {
287
+				FlashMessages::addMessage(I18N::translate('The folder %s does not exist, and it could not be created.', Html::filename(WT_DATA_DIR . $MEDIA_DIRECTORY)), 'danger');
288
+			}
288 289
 		}
289
-	}
290 290
 
291
-	$gedcom = Filter::post('gedcom');
292
-	if ($gedcom && $gedcom !== $WT_TREE->getName()) {
293
-		try {
294
-			Database::prepare("UPDATE `##gedcom` SET gedcom_name = ? WHERE gedcom_id = ?")->execute(array($gedcom, $WT_TREE->getTreeId()));
295
-			Database::prepare("UPDATE `##site_setting` SET setting_value = ? WHERE setting_name='DEFAULT_GEDCOM' AND setting_value = ?")->execute(array($gedcom, $WT_TREE->getName()));
296
-		} catch (\Exception $ex) {
297
-			// Probably a duplicate name.
291
+		$gedcom = Filter::post('gedcom');
292
+		if ($gedcom && $gedcom !== $WT_TREE->getName()) {
293
+			try {
294
+				Database::prepare("UPDATE `##gedcom` SET gedcom_name = ? WHERE gedcom_id = ?")->execute(array($gedcom, $WT_TREE->getTreeId()));
295
+				Database::prepare("UPDATE `##site_setting` SET setting_value = ? WHERE setting_name='DEFAULT_GEDCOM' AND setting_value = ?")->execute(array($gedcom, $WT_TREE->getName()));
296
+			} catch (\Exception $ex) {
297
+				// Probably a duplicate name.
298
+			}
298 299
 		}
299
-	}
300 300
 
301
-	FlashMessages::addMessage(I18N::translate('The preferences for the family tree “%s” have been updated.', $WT_TREE->getTitleHtml()), 'success');
302
-	header('Location: ' . WT_BASE_URL . 'admin_trees_manage.php');
301
+		FlashMessages::addMessage(I18N::translate('The preferences for the family tree “%s” have been updated.', $WT_TREE->getTitleHtml()), 'success');
302
+		header('Location: ' . WT_BASE_URL . 'admin_trees_manage.php');
303 303
 
304
-	return;
304
+		return;
305 305
 }
306 306
 
307 307
 switch (Filter::get('action')) {
Please login to merge, or discard this patch.