Completed
Pull Request — master (#841)
by Rico
59:13 queued 47:04
created
app/Module/CensusAssistantModule.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -425,10 +425,10 @@  discard block
 block discarded – undo
425 425
 	 * @return string
426 426
 	 */
427 427
 	public static function censusNavigatorFamily(CensusInterface $census, Family $family, Individual $head) {
428
-		$headImg2  = '<i class="icon-button_head" title="' . I18N::translate('Click to choose individual as head of family.') . '"></i>';
428
+		$headImg2 = '<i class="icon-button_head" title="' . I18N::translate('Click to choose individual as head of family.') . '"></i>';
429 429
 
430 430
 		foreach ($family->getSpouses() as $spouse) {
431
-			$menu  = new Menu(Functions::getCloseRelationshipName($head, $spouse));
431
+			$menu = new Menu(Functions::getCloseRelationshipName($head, $spouse));
432 432
 			foreach ($spouse->getChildFamilies() as $grandparents) {
433 433
 				foreach ($grandparents->getSpouses() as $grandparent) {
434 434
 					$submenu = new Menu(
@@ -463,7 +463,7 @@  discard block
 block discarded – undo
463 463
 		}
464 464
 
465 465
 		foreach ($family->getChildren() as $child) {
466
-			$menu  = new Menu(Functions::getCloseRelationshipName($head, $child));
466
+			$menu = new Menu(Functions::getCloseRelationshipName($head, $child));
467 467
 			foreach ($child->getSpouseFamilies() as $spouse_family) {
468 468
 				foreach ($spouse_family->getSpouses() as $spouse_family_spouse) {
469 469
 					if ($spouse_family_spouse != $child) {
Please login to merge, or discard this patch.
Indentation   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -1,18 +1,18 @@
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * webtrees: online genealogy
4
- * Copyright (C) 2016 webtrees development team
5
- * This program is free software: you can redistribute it and/or modify
6
- * it under the terms of the GNU General Public License as published by
7
- * the Free Software Foundation, either version 3 of the License, or
8
- * (at your option) any later version.
9
- * This program is distributed in the hope that it will be useful,
10
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
11
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
- * GNU General Public License for more details.
13
- * You should have received a copy of the GNU General Public License
14
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
15
- */
3
+	 * webtrees: online genealogy
4
+	 * Copyright (C) 2016 webtrees development team
5
+	 * This program is free software: you can redistribute it and/or modify
6
+	 * it under the terms of the GNU General Public License as published by
7
+	 * the Free Software Foundation, either version 3 of the License, or
8
+	 * (at your option) any later version.
9
+	 * This program is distributed in the hope that it will be useful,
10
+	 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11
+	 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
+	 * GNU General Public License for more details.
13
+	 * You should have received a copy of the GNU General Public License
14
+	 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15
+	 */
16 16
 namespace Fisharebest\Webtrees;
17 17
 
18 18
 use Fisharebest\Webtrees\Theme\AdministrationTheme;
Please login to merge, or discard this patch.
app/Module/GoogleMapsModule.php 3 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -408,7 +408,7 @@  discard block
 block discarded – undo
408 408
 							if ($level == 1) {
409 409
 								$label = I18N::translate('Country');
410 410
 							} else {
411
-								$label = I18N::translate('Level') .  ' ' . $level;
411
+								$label = I18N::translate('Level') . ' ' . $level;
412 412
 							}
413 413
 							?>
414 414
 							<div class="input-group">
@@ -424,7 +424,7 @@  discard block
 block discarded – undo
424 424
 							if ($level == 1) {
425 425
 								$label = I18N::translate('Country');
426 426
 							} else {
427
-								$label = I18N::translate('Level') .  ' ' . $level;
427
+								$label = I18N::translate('Level') . ' ' . $level;
428 428
 							}
429 429
 							?>
430 430
 							<div class="input-group">
@@ -3014,7 +3014,7 @@  discard block
 block discarded – undo
3014 3014
 			}
3015 3015
 		');
3016 3016
 
3017
-		$levelm                           = $this->setLevelMap($level, $parent);
3017
+		$levelm = $this->setLevelMap($level, $parent);
3018 3018
 		if (isset($levelo[0])) {
3019 3019
 			$levelo[0] = 0;
3020 3020
 		}
@@ -4170,7 +4170,7 @@  discard block
 block discarded – undo
4170 4170
 						} else {
4171 4171
 							$placelist[$j]['long'] = null;
4172 4172
 						}
4173
-						$j                          = $j + 1;
4173
+						$j = $j + 1;
4174 4174
 					}
4175 4175
 					$i        = $i + 1;
4176 4176
 					$placerec = Functions::getSubRecord(2, '2 PLAC', $gedrec, $i);
@@ -4366,7 +4366,7 @@  discard block
 block discarded – undo
4366 4366
 			$j            = 0;
4367 4367
 			$maxLevel     = 0;
4368 4368
 			foreach ($lines as $p => $placerec) {
4369
-				$fieldrec                               = explode(';', $placerec);
4369
+				$fieldrec = explode(';', $placerec);
4370 4370
 				if ($fieldrec[0] > $maxLevel) {
4371 4371
 					$maxLevel = $fieldrec[0];
4372 4372
 				}
Please login to merge, or discard this patch.
Braces   +55 added lines, -29 removed lines patch added patch discarded remove patch
@@ -825,7 +825,9 @@  discard block
 block discarded – undo
825 825
 			$person = $this->ancestors[$i];
826 826
 			if (!empty($person)) {
827 827
 				$name = $person->getFullName();
828
-				if ($name == I18N::translate('Private')) $priv++;
828
+				if ($name == I18N::translate('Private')) {
829
+					$priv++;
830
+				}
829 831
 				$place = $person->getBirthPlace();
830 832
 				if (empty($place)) {
831 833
 					$latlongval[$i] = null;
@@ -1715,8 +1717,9 @@  discard block
 block discarded – undo
1715 1717
 
1716 1718
 				if ($row['pl_place'] != '') {
1717 1719
 					$placestr2 = $mapstr_edit . $id . "&amp;level=" . $level . $mapstr3 . $mapstr5 . I18N::translate('Zoom=') . $row['pl_zoom'] . $mapstr6 . $row['pl_placerequested'] . $mapstr8;
1718
-					if ($row['pl_place'] === 'unknown')
1719
-						$matched[$x]++;
1720
+					if ($row['pl_place'] === 'unknown') {
1721
+											$matched[$x]++;
1722
+					}
1720 1723
 				} else {
1721 1724
 					if ($levels[$z] === 'unknown') {
1722 1725
 						$placestr2 = $mapstr_add . $id . "&amp;level=" . $level . $mapstr3 . $mapstr7 . "<strong>" . I18N::translate('unknown') . "</strong>" . $mapstr8; $matched[$x]++;
@@ -2828,8 +2831,9 @@  discard block
 block discarded – undo
2828 2831
 			$parent[$level] = $place2['place'];
2829 2832
 			$this->printHowManyPeople($level + 1, $parent);
2830 2833
 			echo '<br>', I18N::translate('This place has no coordinates');
2831
-			if (Auth::isAdmin())
2832
-				echo "<br><a href='module.php?mod=googlemap&amp;mod_action=admin_places&amp;parent=", $levelm, "&amp;display=inactive'>", I18N::translate('Geographic data'), "</a>";
2834
+			if (Auth::isAdmin()) {
2835
+							echo "<br><a href='module.php?mod=googlemap&amp;mod_action=admin_places&amp;parent=", $levelm, "&amp;display=inactive'>", I18N::translate('Geographic data'), "</a>";
2836
+			}
2833 2837
 			echo "</div>\", icon_type, \"", str_replace(array('&lrm;', '&rlm;'), array(WT_UTF8_LRM, WT_UTF8_RLM), addslashes($place2['place'])), "\");\n";
2834 2838
 		} else {
2835 2839
 			$lati = str_replace(array('N', 'S', ','), array('', '-', '.'), $place2['lati']);
@@ -3030,7 +3034,8 @@  discard block
 block discarded – undo
3030 3034
 		ob_start(); // TODO: rewrite print_gm_markers, and the functions called therein, to either return text or add JS directly.
3031 3035
 
3032 3036
 		if ($numfound == 0 && $level > 0) {
3033
-			if (isset($levelo[($level - 1)])) {  // ** BH not sure yet what this if statement is for ... TODO **
3037
+			if (isset($levelo[($level - 1)])) {
3038
+// ** BH not sure yet what this if statement is for ... TODO **
3034 3039
 				// show the current place on the map
3035 3040
 
3036 3041
 				$place = Database::prepare("SELECT pl_id as place_id, pl_place as place, pl_lati as lati, pl_long as `long`, pl_zoom as zoom, pl_icon as icon FROM `##placelocation` WHERE pl_id=?")
@@ -3305,10 +3310,11 @@  discard block
 block discarded – undo
3305 3310
 			$place_name       = $row->pl_place;
3306 3311
 			$place_icon       = $row->pl_icon;
3307 3312
 			$selected_country = explode("/", $place_icon);
3308
-			if (isset($selected_country[1]) && $selected_country[1] != "flags")
3309
-				$selected_country = $selected_country[1];
3310
-			else
3311
-				$selected_country = "Countries";
3313
+			if (isset($selected_country[1]) && $selected_country[1] != "flags") {
3314
+							$selected_country = $selected_country[1];
3315
+			} else {
3316
+							$selected_country = "Countries";
3317
+			}
3312 3318
 			$parent_id         = $row->pl_parent_id;
3313 3319
 			$level             = $row->pl_level;
3314 3320
 			$zoomfactor        = $row->pl_zoom;
@@ -3387,8 +3393,9 @@  discard block
 block discarded – undo
3387 3393
 			} else {
3388 3394
 				echo '<b>', $place_name;
3389 3395
 			}
3390
-			if (count($where_am_i) > 0)
3391
-				echo ', ', Filter::escapeHtml(str_replace('Unknown', I18N::translate('unknown'), implode(I18N::$list_separator, array_reverse($where_am_i, true)))), '</b><br>';
3396
+			if (count($where_am_i) > 0) {
3397
+							echo ', ', Filter::escapeHtml(str_replace('Unknown', I18N::translate('unknown'), implode(I18N::$list_separator, array_reverse($where_am_i, true)))), '</b><br>';
3398
+			}
3392 3399
 			echo '</b><br>';
3393 3400
 		}
3394 3401
 
@@ -3897,7 +3904,8 @@  discard block
 block discarded – undo
3897 3904
 			}
3898 3905
 
3899 3906
 			function showLocation_level(address) {
3900
-				address += '<?php if ($level > 0) echo ', ', addslashes(implode(', ', array_reverse($where_am_i, true))) ?>';
3907
+				address += '<?php if ($level > 0) {
3908
+	echo ', ', addslashes(implode(', ', array_reverse($where_am_i, true))) ?>';
3901 3909
 				geocoder.geocode({'address': address}, addAddressToMap);
3902 3910
 			}
3903 3911
 
@@ -3946,6 +3954,7 @@  discard block
 block discarded – undo
3946 3954
 				</td>
3947 3955
 				<?php
3948 3956
 					$exp = explode(".", $place_lati);
3957
+}
3949 3958
 					if (isset($exp[1])) {
3950 3959
 						$precision1 = strlen($exp[1]);
3951 3960
 					} else {
@@ -3958,13 +3967,15 @@  discard block
 block discarded – undo
3958 3967
 						$precision2 = -1;
3959 3968
 					}
3960 3969
 					($precision1 > $precision2) ? ($precision = $precision1) : ($precision = $precision2);
3961
-					if ($precision == -1) ($level > 3) ? ($precision = 3) : ($precision = $level);
3962
-					elseif ($precision > 5) {
3970
+					if ($precision == -1) {
3971
+						($level > 3) ? ($precision = 3) : ($precision = $level);
3972
+					} elseif ($precision > 5) {
3963 3973
 						$precision = 5;
3964 3974
 					}
3965 3975
 				?>
3966 3976
 				<td class="optionbox" colspan="2">
3967
-					<input type="radio" id="new_prec_0" name="NEW_PRECISION" onchange="updateMap();" <?php if ($precision == $this->getSetting('GM_PRECISION_0')) echo 'checked' ?> value="<?php echo $this->getSetting('GM_PRECISION_0') ?>">
3977
+					<input type="radio" id="new_prec_0" name="NEW_PRECISION" onchange="updateMap();" <?php if ($precision == $this->getSetting('GM_PRECISION_0')) {
3978
+	echo 'checked' ?> value="<?php echo $this->getSetting('GM_PRECISION_0') ?>">
3968 3979
 					<label for="new_prec_0"><?php echo I18N::translate('Country') ?></label>
3969 3980
 					<input type="radio" id="new_prec_1" name="NEW_PRECISION" onchange="updateMap();" <?php if ($precision == $this->getSetting('GM_PRECISION_1')) echo 'checked' ?> value="<?php echo $this->getSetting('GM_PRECISION_1') ?>">
3970 3981
 					<label for="new_prec_1"><?php echo I18N::translate('State') ?></label>
@@ -3986,8 +3997,13 @@  discard block
 block discarded – undo
3986 3997
 				<td class="optionbox" colspan="2">
3987 3998
 					<input type="text" id="NEW_PLACE_LATI" name="NEW_PLACE_LATI" placeholder="<?php echo /* I18N: Measure of latitude/longitude */ I18N::translate('degrees') ?>" value="<?php echo abs($place_lati) ?>" size="20" onchange="updateMap();">
3988 3999
 					<select name="LATI_CONTROL" onchange="updateMap();">
3989
-						<option value="PL_N" <?php if ($place_lati >= 0) echo "selected"; echo ">", I18N::translate('north') ?></option>
3990
-						<option value="PL_S" <?php if ($place_lati < 0) echo "selected"; echo ">", I18N::translate('south') ?></option>
4000
+						<option value="PL_N" <?php if ($place_lati >= 0) echo "selected";
4001
+}
4002
+echo ">", I18N::translate('north') ?></option>
4003
+						<option value="PL_S" <?php if ($place_lati < 0) {
4004
+	echo "selected";
4005
+}
4006
+echo ">", I18N::translate('south') ?></option>
3991 4007
 					</select>
3992 4008
 				</td>
3993 4009
 			</tr>
@@ -3996,8 +4012,14 @@  discard block
 block discarded – undo
3996 4012
 				<td class="optionbox" colspan="2">
3997 4013
 					<input type="text" id="NEW_PLACE_LONG" name="NEW_PLACE_LONG" placeholder="<?php echo I18N::translate('degrees') ?>" value="<?php echo abs($place_long) ?>" size="20" onchange="updateMap();">
3998 4014
 					<select name="LONG_CONTROL" onchange="updateMap();">
3999
-						<option value="PL_E" <?php if ($place_long >= 0) echo "selected"; echo ">", I18N::translate('east') ?></option>
4000
-						<option value="PL_W" <?php if ($place_long < 0) echo "selected"; echo ">", I18N::translate('west') ?></option>
4015
+						<option value="PL_E" <?php if ($place_long >= 0) {
4016
+	echo "selected";
4017
+}
4018
+echo ">", I18N::translate('east') ?></option>
4019
+						<option value="PL_W" <?php if ($place_long < 0) {
4020
+	echo "selected";
4021
+}
4022
+echo ">", I18N::translate('west') ?></option>
4001 4023
 					</select>
4002 4024
 				</td>
4003 4025
 			</tr>
@@ -4210,8 +4232,9 @@  discard block
 block discarded – undo
4210 4232
 				$parent    = array_reverse($parent);
4211 4233
 				$parent_id = 0;
4212 4234
 				for ($i = 0; $i < count($parent); $i++) {
4213
-					if (!isset($default_zoom_level[$i]))
4214
-						$default_zoom_level[$i] = $default_zoom_level[$i - 1];
4235
+					if (!isset($default_zoom_level[$i])) {
4236
+											$default_zoom_level[$i] = $default_zoom_level[$i - 1];
4237
+					}
4215 4238
 					$escparent               = $parent[$i];
4216 4239
 					if ($escparent == '') {
4217 4240
 						$escparent = 'Unknown';
@@ -4451,7 +4474,8 @@  discard block
 block discarded – undo
4451 4474
 						Database::prepare("SELECT pl_id, pl_long, pl_lati, pl_zoom, pl_icon FROM `##placelocation` WHERE pl_level=? AND pl_parent_id=? AND pl_place LIKE ? ORDER BY pl_place")
4452 4475
 						->execute(array($i, $parent_id, $escparent))
4453 4476
 						->fetchOneRow();
4454
-					if (empty($row)) {       // this name does not yet exist: create entry
4477
+					if (empty($row)) {
4478
+// this name does not yet exist: create entry
4455 4479
 						if (!Filter::postBool('updateonly')) {
4456 4480
 							$highestIndex = $highestIndex + 1;
4457 4481
 							if (($i + 1) == count($parent)) {
@@ -4590,14 +4614,16 @@  discard block
 block discarded – undo
4590 4614
 		echo '<th>', I18N::translate('Icon'), '</th>';
4591 4615
 		echo '<th>';
4592 4616
 		echo I18N::translate('Edit'), '</th><th>', I18N::translate('Delete'), '</th></tr>';
4593
-		if (count($placelist) == 0)
4594
-			echo '<tr><td colspan="7">', I18N::translate('No places found'), '</td></tr>';
4617
+		if (count($placelist) == 0) {
4618
+					echo '<tr><td colspan="7">', I18N::translate('No places found'), '</td></tr>';
4619
+		}
4595 4620
 		foreach ($placelist as $place) {
4596 4621
 			echo '<tr><td><a href="module.php?mod=googlemap&mod_action=admin_places&parent=', $place['place_id'], '&inactive=', $inactive, '">';
4597
-			if ($place['place'] != 'Unknown')
4598
-					echo Filter::escapeHtml($place['place']), '</a></td>';
4599
-				else
4600
-					echo I18N::translate('unknown'), '</a></td>';
4622
+			if ($place['place'] != 'Unknown') {
4623
+								echo Filter::escapeHtml($place['place']), '</a></td>';
4624
+			} else {
4625
+									echo I18N::translate('unknown'), '</a></td>';
4626
+				}
4601 4627
 			echo '<td>', $place['lati'], '</td>';
4602 4628
 			echo '<td>', $place['long'], '</td>';
4603 4629
 			echo '<td>', $place['zoom'], '</td>';
Please login to merge, or discard this patch.
Indentation   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -1,18 +1,18 @@
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * webtrees: online genealogy
4
- * Copyright (C) 2016 webtrees development team
5
- * This program is free software: you can redistribute it and/or modify
6
- * it under the terms of the GNU General Public License as published by
7
- * the Free Software Foundation, either version 3 of the License, or
8
- * (at your option) any later version.
9
- * This program is distributed in the hope that it will be useful,
10
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
11
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
- * GNU General Public License for more details.
13
- * You should have received a copy of the GNU General Public License
14
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
15
- */
3
+	 * webtrees: online genealogy
4
+	 * Copyright (C) 2016 webtrees development team
5
+	 * This program is free software: you can redistribute it and/or modify
6
+	 * it under the terms of the GNU General Public License as published by
7
+	 * the Free Software Foundation, either version 3 of the License, or
8
+	 * (at your option) any later version.
9
+	 * This program is distributed in the hope that it will be useful,
10
+	 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11
+	 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
+	 * GNU General Public License for more details.
13
+	 * You should have received a copy of the GNU General Public License
14
+	 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15
+	 */
16 16
 namespace Fisharebest\Webtrees;
17 17
 
18 18
 use Fisharebest\Webtrees\Theme\AdministrationTheme;
Please login to merge, or discard this patch.
app/Report/ReportParserGenerate.php 3 patches
Switch Indentation   +310 added lines, -310 removed lines patch added patch discarded remove patch
@@ -934,14 +934,14 @@  discard block
 block discarded – undo
934 934
 				$tags  = preg_split('/[: ]/', $tag);
935 935
 				$value = $this->getGedcomValue($tag, $level, $this->gedrec);
936 936
 				switch (end($tags)) {
937
-					case 'DATE':
938
-						$tmp   = new Date($value);
939
-						$value = $tmp->display();
940
-						break;
941
-					case 'PLAC':
942
-						$tmp   = new Place($value, $WT_TREE);
943
-						$value = $tmp->getShortName();
944
-						break;
937
+				case 'DATE':
938
+					$tmp   = new Date($value);
939
+					$value = $tmp->display();
940
+					break;
941
+				case 'PLAC':
942
+					$tmp   = new Place($value, $WT_TREE);
943
+					$value = $tmp->getShortName();
944
+					break;
945 945
 				}
946 946
 				if ($useBreak == "1") {
947 947
 					// Insert <br> when multiple dates exist.
@@ -1325,22 +1325,22 @@  discard block
 block discarded – undo
1325 1325
 		// Arithmetic functions
1326 1326
 		if (preg_match("/(\d+)\s*([\-\+\*\/])\s*(\d+)/", $value, $match)) {
1327 1327
 			switch ($match[2]) {
1328
-				case "+":
1329
-					$t     = $match[1] + $match[3];
1330
-					$value = preg_replace("/" . $match[1] . "\s*([\-\+\*\/])\s*" . $match[3] . "/", $t, $value);
1331
-					break;
1332
-				case "-":
1333
-					$t     = $match[1] - $match[3];
1334
-					$value = preg_replace("/" . $match[1] . "\s*([\-\+\*\/])\s*" . $match[3] . "/", $t, $value);
1335
-					break;
1336
-				case "*":
1337
-					$t     = $match[1] * $match[3];
1338
-					$value = preg_replace("/" . $match[1] . "\s*([\-\+\*\/])\s*" . $match[3] . "/", $t, $value);
1339
-					break;
1340
-				case "/":
1341
-					$t     = $match[1] / $match[3];
1342
-					$value = preg_replace("/" . $match[1] . "\s*([\-\+\*\/])\s*" . $match[3] . "/", $t, $value);
1343
-					break;
1328
+			case "+":
1329
+				$t     = $match[1] + $match[3];
1330
+				$value = preg_replace("/" . $match[1] . "\s*([\-\+\*\/])\s*" . $match[3] . "/", $t, $value);
1331
+				break;
1332
+			case "-":
1333
+				$t     = $match[1] - $match[3];
1334
+				$value = preg_replace("/" . $match[1] . "\s*([\-\+\*\/])\s*" . $match[3] . "/", $t, $value);
1335
+				break;
1336
+			case "*":
1337
+				$t     = $match[1] * $match[3];
1338
+				$value = preg_replace("/" . $match[1] . "\s*([\-\+\*\/])\s*" . $match[3] . "/", $t, $value);
1339
+				break;
1340
+			case "/":
1341
+				$t     = $match[1] / $match[3];
1342
+				$value = preg_replace("/" . $match[1] . "\s*([\-\+\*\/])\s*" . $match[3] . "/", $t, $value);
1343
+				break;
1344 1344
 			}
1345 1345
 		}
1346 1346
 		if (strpos($value, "@") !== false) {
@@ -1850,180 +1850,180 @@  discard block
 block discarded – undo
1850 1850
 		}
1851 1851
 		// Some filters/sorts can be applied using SQL, while others require PHP
1852 1852
 		switch ($listname) {
1853
-			case "pending":
1854
-				$rows = Database::prepare(
1855
-					"SELECT xref, CASE new_gedcom WHEN '' THEN old_gedcom ELSE new_gedcom END AS gedcom" .
1856
-					" FROM `##change`" . " WHERE (xref, change_id) IN (" .
1857
-					"  SELECT xref, MAX(change_id)" .
1858
-					"  FROM `##change`" .
1859
-					"  WHERE status = 'pending' AND gedcom_id = :tree_id" .
1860
-					"  GROUP BY xref" .
1861
-					" )"
1862
-				)->execute(array(
1863
-					'tree_id' => $WT_TREE->getTreeId(),
1864
-				))->fetchAll();
1865
-				$this->list = array();
1866
-				foreach ($rows as $row) {
1867
-					$this->list[] = GedcomRecord::getInstance($row->xref, $WT_TREE, $row->gedcom);
1868
-				}
1869
-				break;
1870
-			case 'individual':
1871
-				$sql_select   = "SELECT DISTINCT i_id AS xref, i_gedcom AS gedcom FROM `##individuals` ";
1872
-				$sql_join     = "";
1873
-				$sql_where    = " WHERE i_file = :tree_id";
1874
-				$sql_order_by = "";
1875
-				$sql_params   = array('tree_id' => $WT_TREE->getTreeId());
1876
-				foreach ($attrs as $attr => $value) {
1877
-					if (strpos($attr, 'filter') === 0 && $value) {
1878
-						$value = $this->substituteVars($value, false);
1879
-						// Convert the various filters into SQL
1880
-						if (preg_match('/^(\w+):DATE (LTE|GTE) (.+)$/', $value, $match)) {
1881
-							$sql_join .= " JOIN `##dates` AS {$attr} ON ({$attr}.d_file=i_file AND {$attr}.d_gid=i_id)";
1882
-							$sql_where .= " AND {$attr}.d_fact = :{$attr}fact";
1883
-							$sql_params[$attr . 'fact'] = $match[1];
1884
-							$date                       = new Date($match[3]);
1885
-							if ($match[2] == "LTE") {
1886
-								$sql_where .= " AND {$attr}.d_julianday2 <= :{$attr}date";
1887
-								$sql_params[$attr . 'date'] = $date->maximumJulianDay();
1888
-							} else {
1889
-								$sql_where .= " AND {$attr}.d_julianday1 >= :{$attr}date";
1890
-								$sql_params[$attr . 'date'] = $date->minimumJulianDay();
1853
+		case "pending":
1854
+			$rows = Database::prepare(
1855
+				"SELECT xref, CASE new_gedcom WHEN '' THEN old_gedcom ELSE new_gedcom END AS gedcom" .
1856
+				" FROM `##change`" . " WHERE (xref, change_id) IN (" .
1857
+				"  SELECT xref, MAX(change_id)" .
1858
+				"  FROM `##change`" .
1859
+				"  WHERE status = 'pending' AND gedcom_id = :tree_id" .
1860
+				"  GROUP BY xref" .
1861
+				" )"
1862
+			)->execute(array(
1863
+				'tree_id' => $WT_TREE->getTreeId(),
1864
+			))->fetchAll();
1865
+			$this->list = array();
1866
+			foreach ($rows as $row) {
1867
+				$this->list[] = GedcomRecord::getInstance($row->xref, $WT_TREE, $row->gedcom);
1868
+			}
1869
+			break;
1870
+		case 'individual':
1871
+			$sql_select   = "SELECT DISTINCT i_id AS xref, i_gedcom AS gedcom FROM `##individuals` ";
1872
+			$sql_join     = "";
1873
+			$sql_where    = " WHERE i_file = :tree_id";
1874
+			$sql_order_by = "";
1875
+			$sql_params   = array('tree_id' => $WT_TREE->getTreeId());
1876
+			foreach ($attrs as $attr => $value) {
1877
+				if (strpos($attr, 'filter') === 0 && $value) {
1878
+					$value = $this->substituteVars($value, false);
1879
+					// Convert the various filters into SQL
1880
+					if (preg_match('/^(\w+):DATE (LTE|GTE) (.+)$/', $value, $match)) {
1881
+						$sql_join .= " JOIN `##dates` AS {$attr} ON ({$attr}.d_file=i_file AND {$attr}.d_gid=i_id)";
1882
+						$sql_where .= " AND {$attr}.d_fact = :{$attr}fact";
1883
+						$sql_params[$attr . 'fact'] = $match[1];
1884
+						$date                       = new Date($match[3]);
1885
+						if ($match[2] == "LTE") {
1886
+							$sql_where .= " AND {$attr}.d_julianday2 <= :{$attr}date";
1887
+							$sql_params[$attr . 'date'] = $date->maximumJulianDay();
1888
+						} else {
1889
+							$sql_where .= " AND {$attr}.d_julianday1 >= :{$attr}date";
1890
+							$sql_params[$attr . 'date'] = $date->minimumJulianDay();
1891
+						}
1892
+						if ($sortby == $match[1]) {
1893
+							$sortby = "";
1894
+							$sql_order_by .= ($sql_order_by ? ", " : " ORDER BY ") . "{$attr}.d_julianday1";
1895
+						}
1896
+						unset($attrs[$attr]); // This filter has been fully processed
1897
+					} elseif (preg_match('/^NAME CONTAINS (.*)$/', $value, $match)) {
1898
+						// Do nothing, unless you have to
1899
+						if ($match[1] != '' || $sortby == 'NAME') {
1900
+							$sql_join .= " JOIN `##name` AS {$attr} ON (n_file=i_file AND n_id=i_id)";
1901
+							// Search the DB only if there is any name supplied
1902
+							if ($match[1] != "") {
1903
+								$names = explode(" ", $match[1]);
1904
+								foreach ($names as $n => $name) {
1905
+									$sql_where .= " AND {$attr}.n_full LIKE CONCAT('%', :{$attr}name{$n}, '%')";
1906
+									$sql_params[$attr . 'name' . $n] = $name;
1907
+								}
1891 1908
 							}
1892
-							if ($sortby == $match[1]) {
1909
+							// Let the DB do the name sorting even when no name was entered
1910
+							if ($sortby == "NAME") {
1893 1911
 								$sortby = "";
1894
-								$sql_order_by .= ($sql_order_by ? ", " : " ORDER BY ") . "{$attr}.d_julianday1";
1912
+								$sql_order_by .= ($sql_order_by ? ", " : " ORDER BY ") . "{$attr}.n_sort";
1895 1913
 							}
1896
-							unset($attrs[$attr]); // This filter has been fully processed
1897
-						} elseif (preg_match('/^NAME CONTAINS (.*)$/', $value, $match)) {
1898
-							// Do nothing, unless you have to
1899
-							if ($match[1] != '' || $sortby == 'NAME') {
1900
-								$sql_join .= " JOIN `##name` AS {$attr} ON (n_file=i_file AND n_id=i_id)";
1901
-								// Search the DB only if there is any name supplied
1902
-								if ($match[1] != "") {
1903
-									$names = explode(" ", $match[1]);
1904
-									foreach ($names as $n => $name) {
1905
-										$sql_where .= " AND {$attr}.n_full LIKE CONCAT('%', :{$attr}name{$n}, '%')";
1906
-										$sql_params[$attr . 'name' . $n] = $name;
1907
-									}
1908
-								}
1909
-								// Let the DB do the name sorting even when no name was entered
1910
-								if ($sortby == "NAME") {
1911
-									$sortby = "";
1912
-									$sql_order_by .= ($sql_order_by ? ", " : " ORDER BY ") . "{$attr}.n_sort";
1913
-								}
1914
-							}
1915
-							unset($attrs[$attr]); // This filter has been fully processed
1916
-						} elseif (preg_match('/^REGEXP \/(.+)\//', $value, $match)) {
1917
-							$sql_where .= " AND i_gedcom REGEXP :{$attr}gedcom";
1918
-							// PDO helpfully escapes backslashes for us, preventing us from matching "\n1 FACT"
1919
-							$sql_params[$attr . 'gedcom'] = str_replace('\n', "\n", $match[1]);
1920
-							unset($attrs[$attr]); // This filter has been fully processed
1921
-						} elseif (preg_match('/^(?:\w+):PLAC CONTAINS (.+)$/', $value, $match)) {
1922
-							$sql_join .= " JOIN `##places` AS {$attr}a ON ({$attr}a.p_file = i_file)";
1923
-							$sql_join .= " JOIN `##placelinks` AS {$attr}b ON ({$attr}a.p_file = {$attr}b.pl_file AND {$attr}b.pl_p_id = {$attr}a.p_id AND {$attr}b.pl_gid = i_id)";
1924
-							$sql_where .= " AND {$attr}a.p_place LIKE CONCAT('%', :{$attr}place, '%')";
1925
-							$sql_params[$attr . 'place'] = $match[1];
1926
-							// Don't unset this filter. This is just initial filtering
1927
-						} elseif (preg_match('/^(\w*):*(\w*) CONTAINS (.+)$/', $value, $match)) {
1928
-							$sql_where .= " AND i_gedcom LIKE CONCAT('%', :{$attr}contains1, '%', :{$attr}contains2, '%', :{$attr}contains3, '%')";
1929
-							$sql_params[$attr . 'contains1'] = $match[1];
1930
-							$sql_params[$attr . 'contains2'] = $match[2];
1931
-							$sql_params[$attr . 'contains3'] = $match[3];
1932
-							// Don't unset this filter. This is just initial filtering
1933 1914
 						}
1915
+						unset($attrs[$attr]); // This filter has been fully processed
1916
+					} elseif (preg_match('/^REGEXP \/(.+)\//', $value, $match)) {
1917
+						$sql_where .= " AND i_gedcom REGEXP :{$attr}gedcom";
1918
+						// PDO helpfully escapes backslashes for us, preventing us from matching "\n1 FACT"
1919
+						$sql_params[$attr . 'gedcom'] = str_replace('\n', "\n", $match[1]);
1920
+						unset($attrs[$attr]); // This filter has been fully processed
1921
+					} elseif (preg_match('/^(?:\w+):PLAC CONTAINS (.+)$/', $value, $match)) {
1922
+						$sql_join .= " JOIN `##places` AS {$attr}a ON ({$attr}a.p_file = i_file)";
1923
+						$sql_join .= " JOIN `##placelinks` AS {$attr}b ON ({$attr}a.p_file = {$attr}b.pl_file AND {$attr}b.pl_p_id = {$attr}a.p_id AND {$attr}b.pl_gid = i_id)";
1924
+						$sql_where .= " AND {$attr}a.p_place LIKE CONCAT('%', :{$attr}place, '%')";
1925
+						$sql_params[$attr . 'place'] = $match[1];
1926
+						// Don't unset this filter. This is just initial filtering
1927
+					} elseif (preg_match('/^(\w*):*(\w*) CONTAINS (.+)$/', $value, $match)) {
1928
+						$sql_where .= " AND i_gedcom LIKE CONCAT('%', :{$attr}contains1, '%', :{$attr}contains2, '%', :{$attr}contains3, '%')";
1929
+						$sql_params[$attr . 'contains1'] = $match[1];
1930
+						$sql_params[$attr . 'contains2'] = $match[2];
1931
+						$sql_params[$attr . 'contains3'] = $match[3];
1932
+						// Don't unset this filter. This is just initial filtering
1934 1933
 					}
1935 1934
 				}
1935
+			}
1936 1936
 
1937
-				$this->list = array();
1938
-				$rows       = Database::prepare(
1939
-					$sql_select . $sql_join . $sql_where . $sql_order_by
1940
-				)->execute($sql_params)->fetchAll();
1941
-
1942
-				foreach ($rows as $row) {
1943
-					$this->list[] = Individual::getInstance($row->xref, $WT_TREE, $row->gedcom);
1944
-				}
1945
-				break;
1946
-
1947
-			case 'family':
1948
-				$sql_select   = "SELECT DISTINCT f_id AS xref, f_gedcom AS gedcom FROM `##families`";
1949
-				$sql_join     = "";
1950
-				$sql_where    = " WHERE f_file = :tree_id";
1951
-				$sql_order_by = "";
1952
-				$sql_params   = array('tree_id' => $WT_TREE->getTreeId());
1953
-				foreach ($attrs as $attr => $value) {
1954
-					if (strpos($attr, 'filter') === 0 && $value) {
1955
-						$value = $this->substituteVars($value, false);
1956
-						// Convert the various filters into SQL
1957
-						if (preg_match('/^(\w+):DATE (LTE|GTE) (.+)$/', $value, $match)) {
1958
-							$sql_join .= " JOIN `##dates` AS {$attr} ON ({$attr}.d_file=f_file AND {$attr}.d_gid=f_id)";
1959
-							$sql_where .= " AND {$attr}.d_fact = :{$attr}fact";
1960
-							$sql_params[$attr . 'fact'] = $match[1];
1961
-							$date                       = new Date($match[3]);
1962
-							if ($match[2] == "LTE") {
1963
-								$sql_where .= " AND {$attr}.d_julianday2 <= :{$attr}date";
1964
-								$sql_params[$attr . 'date'] = $date->maximumJulianDay();
1965
-							} else {
1966
-								$sql_where .= " AND {$attr}.d_julianday1 >= :{$attr}date";
1967
-								$sql_params[$attr . 'date'] = $date->minimumJulianDay();
1937
+			$this->list = array();
1938
+			$rows       = Database::prepare(
1939
+				$sql_select . $sql_join . $sql_where . $sql_order_by
1940
+			)->execute($sql_params)->fetchAll();
1941
+
1942
+			foreach ($rows as $row) {
1943
+				$this->list[] = Individual::getInstance($row->xref, $WT_TREE, $row->gedcom);
1944
+			}
1945
+			break;
1946
+
1947
+		case 'family':
1948
+			$sql_select   = "SELECT DISTINCT f_id AS xref, f_gedcom AS gedcom FROM `##families`";
1949
+			$sql_join     = "";
1950
+			$sql_where    = " WHERE f_file = :tree_id";
1951
+			$sql_order_by = "";
1952
+			$sql_params   = array('tree_id' => $WT_TREE->getTreeId());
1953
+			foreach ($attrs as $attr => $value) {
1954
+				if (strpos($attr, 'filter') === 0 && $value) {
1955
+					$value = $this->substituteVars($value, false);
1956
+					// Convert the various filters into SQL
1957
+					if (preg_match('/^(\w+):DATE (LTE|GTE) (.+)$/', $value, $match)) {
1958
+						$sql_join .= " JOIN `##dates` AS {$attr} ON ({$attr}.d_file=f_file AND {$attr}.d_gid=f_id)";
1959
+						$sql_where .= " AND {$attr}.d_fact = :{$attr}fact";
1960
+						$sql_params[$attr . 'fact'] = $match[1];
1961
+						$date                       = new Date($match[3]);
1962
+						if ($match[2] == "LTE") {
1963
+							$sql_where .= " AND {$attr}.d_julianday2 <= :{$attr}date";
1964
+							$sql_params[$attr . 'date'] = $date->maximumJulianDay();
1965
+						} else {
1966
+							$sql_where .= " AND {$attr}.d_julianday1 >= :{$attr}date";
1967
+							$sql_params[$attr . 'date'] = $date->minimumJulianDay();
1968
+						}
1969
+						if ($sortby == $match[1]) {
1970
+							$sortby = "";
1971
+							$sql_order_by .= ($sql_order_by ? ", " : " ORDER BY ") . "{$attr}.d_julianday1";
1972
+						}
1973
+						unset($attrs[$attr]); // This filter has been fully processed
1974
+					} elseif (preg_match('/^REGEXP \/(.+)\//', $value, $match)) {
1975
+						$sql_where .= " AND f_gedcom REGEXP :{$attr}gedcom";
1976
+						// PDO helpfully escapes backslashes for us, preventing us from matching "\n1 FACT"
1977
+						$sql_params[$attr . 'gedcom'] = str_replace('\n', "\n", $match[1]);
1978
+						unset($attrs[$attr]); // This filter has been fully processed
1979
+					} elseif (preg_match('/^NAME CONTAINS (.+)$/', $value, $match)) {
1980
+						// Do nothing, unless you have to
1981
+						if ($match[1] != '' || $sortby == 'NAME') {
1982
+							$sql_join .= " JOIN `##name` AS {$attr} ON n_file = f_file AND n_id IN (f_husb, f_wife)";
1983
+							// Search the DB only if there is any name supplied
1984
+							if ($match[1] != "") {
1985
+								$names = explode(" ", $match[1]);
1986
+								foreach ($names as $n => $name) {
1987
+									$sql_where .= " AND {$attr}.n_full LIKE CONCAT('%', :{$attr}name{$n}, '%')";
1988
+									$sql_params[$attr . 'name' . $n] = $name;
1989
+								}
1968 1990
 							}
1969
-							if ($sortby == $match[1]) {
1991
+							// Let the DB do the name sorting even when no name was entered
1992
+							if ($sortby == "NAME") {
1970 1993
 								$sortby = "";
1971
-								$sql_order_by .= ($sql_order_by ? ", " : " ORDER BY ") . "{$attr}.d_julianday1";
1972
-							}
1973
-							unset($attrs[$attr]); // This filter has been fully processed
1974
-						} elseif (preg_match('/^REGEXP \/(.+)\//', $value, $match)) {
1975
-							$sql_where .= " AND f_gedcom REGEXP :{$attr}gedcom";
1976
-							// PDO helpfully escapes backslashes for us, preventing us from matching "\n1 FACT"
1977
-							$sql_params[$attr . 'gedcom'] = str_replace('\n', "\n", $match[1]);
1978
-							unset($attrs[$attr]); // This filter has been fully processed
1979
-						} elseif (preg_match('/^NAME CONTAINS (.+)$/', $value, $match)) {
1980
-							// Do nothing, unless you have to
1981
-							if ($match[1] != '' || $sortby == 'NAME') {
1982
-								$sql_join .= " JOIN `##name` AS {$attr} ON n_file = f_file AND n_id IN (f_husb, f_wife)";
1983
-								// Search the DB only if there is any name supplied
1984
-								if ($match[1] != "") {
1985
-									$names = explode(" ", $match[1]);
1986
-									foreach ($names as $n => $name) {
1987
-										$sql_where .= " AND {$attr}.n_full LIKE CONCAT('%', :{$attr}name{$n}, '%')";
1988
-										$sql_params[$attr . 'name' . $n] = $name;
1989
-									}
1990
-								}
1991
-								// Let the DB do the name sorting even when no name was entered
1992
-								if ($sortby == "NAME") {
1993
-									$sortby = "";
1994
-									$sql_order_by .= ($sql_order_by ? ", " : " ORDER BY ") . "{$attr}.n_sort";
1995
-								}
1994
+								$sql_order_by .= ($sql_order_by ? ", " : " ORDER BY ") . "{$attr}.n_sort";
1996 1995
 							}
1997
-							unset($attrs[$attr]); // This filter has been fully processed
1998
-
1999
-						} elseif (preg_match('/^(?:\w+):PLAC CONTAINS (.+)$/', $value, $match)) {
2000
-							$sql_join .= " JOIN `##places` AS {$attr}a ON ({$attr}a.p_file=f_file)";
2001
-							$sql_join .= " JOIN `##placelinks` AS {$attr}b ON ({$attr}a.p_file={$attr}b.pl_file AND {$attr}b.pl_p_id={$attr}a.p_id AND {$attr}b.pl_gid=f_id)";
2002
-							$sql_where .= " AND {$attr}a.p_place LIKE CONCAT('%', :{$attr}place, '%')";
2003
-							$sql_params[$attr . 'place'] = $match[1];
2004
-							// Don't unset this filter. This is just initial filtering
2005
-						} elseif (preg_match('/^(\w*):*(\w*) CONTAINS (.+)$/', $value, $match)) {
2006
-							$sql_where .= " AND f_gedcom LIKE CONCAT('%', :{$attr}contains1, '%', :{$attr}contains2, '%', :{$attr}contains3, '%')";
2007
-							$sql_params[$attr . 'contains1'] = $match[1];
2008
-							$sql_params[$attr . 'contains2'] = $match[2];
2009
-							$sql_params[$attr . 'contains3'] = $match[3];
2010
-							// Don't unset this filter. This is just initial filtering
2011 1996
 						}
1997
+						unset($attrs[$attr]); // This filter has been fully processed
1998
+
1999
+					} elseif (preg_match('/^(?:\w+):PLAC CONTAINS (.+)$/', $value, $match)) {
2000
+						$sql_join .= " JOIN `##places` AS {$attr}a ON ({$attr}a.p_file=f_file)";
2001
+						$sql_join .= " JOIN `##placelinks` AS {$attr}b ON ({$attr}a.p_file={$attr}b.pl_file AND {$attr}b.pl_p_id={$attr}a.p_id AND {$attr}b.pl_gid=f_id)";
2002
+						$sql_where .= " AND {$attr}a.p_place LIKE CONCAT('%', :{$attr}place, '%')";
2003
+						$sql_params[$attr . 'place'] = $match[1];
2004
+						// Don't unset this filter. This is just initial filtering
2005
+					} elseif (preg_match('/^(\w*):*(\w*) CONTAINS (.+)$/', $value, $match)) {
2006
+						$sql_where .= " AND f_gedcom LIKE CONCAT('%', :{$attr}contains1, '%', :{$attr}contains2, '%', :{$attr}contains3, '%')";
2007
+						$sql_params[$attr . 'contains1'] = $match[1];
2008
+						$sql_params[$attr . 'contains2'] = $match[2];
2009
+						$sql_params[$attr . 'contains3'] = $match[3];
2010
+						// Don't unset this filter. This is just initial filtering
2012 2011
 					}
2013 2012
 				}
2013
+			}
2014 2014
 
2015
-				$this->list = array();
2016
-				$rows       = Database::prepare(
2017
-					$sql_select . $sql_join . $sql_where . $sql_order_by
2018
-				)->execute($sql_params)->fetchAll();
2015
+			$this->list = array();
2016
+			$rows       = Database::prepare(
2017
+				$sql_select . $sql_join . $sql_where . $sql_order_by
2018
+			)->execute($sql_params)->fetchAll();
2019 2019
 
2020
-				foreach ($rows as $row) {
2021
-					$this->list[] = Family::getInstance($row->xref, $WT_TREE, $row->gedcom);
2022
-				}
2023
-				break;
2020
+			foreach ($rows as $row) {
2021
+				$this->list[] = Family::getInstance($row->xref, $WT_TREE, $row->gedcom);
2022
+			}
2023
+			break;
2024 2024
 
2025
-			default:
2026
-				throw new \DomainException('Invalid list name: ' . $listname);
2025
+		default:
2026
+			throw new \DomainException('Invalid list name: ' . $listname);
2027 2027
 		}
2028 2028
 
2029 2029
 		$filters  = array();
@@ -2084,17 +2084,17 @@  discard block
 block discarded – undo
2084 2084
 								$searchstr = "1 " . $tag;
2085 2085
 							}
2086 2086
 							switch ($expr) {
2087
-								case "CONTAINS":
2088
-									if ($t == "PLAC") {
2089
-										$searchstr .= "[^\n]*[, ]*" . $val;
2090
-									} else {
2091
-										$searchstr .= "[^\n]*" . $val;
2092
-									}
2093
-									$filters[] = $searchstr;
2094
-									break;
2095
-								default:
2096
-									$filters2[] = array("tag" => $tag, "expr" => $expr, "val" => $val);
2097
-									break;
2087
+							case "CONTAINS":
2088
+								if ($t == "PLAC") {
2089
+									$searchstr .= "[^\n]*[, ]*" . $val;
2090
+								} else {
2091
+									$searchstr .= "[^\n]*" . $val;
2092
+								}
2093
+								$filters[] = $searchstr;
2094
+								break;
2095
+							default:
2096
+								$filters2[] = array("tag" => $tag, "expr" => $expr, "val" => $val);
2097
+								break;
2098 2098
 							}
2099 2099
 						}
2100 2100
 					}
@@ -2138,31 +2138,31 @@  discard block
 block discarded – undo
2138 2138
 						}
2139 2139
 
2140 2140
 						switch ($expr) {
2141
-							case "GTE":
2142
-								if ($t == "DATE") {
2143
-									$date1 = new Date($v);
2144
-									$date2 = new Date($val);
2145
-									$keep  = (Date::compare($date1, $date2) >= 0);
2146
-								} elseif ($val >= $v) {
2147
-									$keep = true;
2148
-								}
2149
-								break;
2150
-							case "LTE":
2151
-								if ($t == "DATE") {
2152
-									$date1 = new Date($v);
2153
-									$date2 = new Date($val);
2154
-									$keep  = (Date::compare($date1, $date2) <= 0);
2155
-								} elseif ($val >= $v) {
2156
-									$keep = true;
2157
-								}
2158
-								break;
2159
-							default:
2160
-								if ($v == $val) {
2161
-									$keep = true;
2162
-								} else {
2163
-									$keep = false;
2164
-								}
2165
-								break;
2141
+						case "GTE":
2142
+							if ($t == "DATE") {
2143
+								$date1 = new Date($v);
2144
+								$date2 = new Date($val);
2145
+								$keep  = (Date::compare($date1, $date2) >= 0);
2146
+							} elseif ($val >= $v) {
2147
+								$keep = true;
2148
+							}
2149
+							break;
2150
+						case "LTE":
2151
+							if ($t == "DATE") {
2152
+								$date1 = new Date($v);
2153
+								$date2 = new Date($val);
2154
+								$keep  = (Date::compare($date1, $date2) <= 0);
2155
+							} elseif ($val >= $v) {
2156
+								$keep = true;
2157
+							}
2158
+							break;
2159
+						default:
2160
+							if ($v == $val) {
2161
+								$keep = true;
2162
+							} else {
2163
+								$keep = false;
2164
+							}
2165
+							break;
2166 2166
 						}
2167 2167
 					}
2168 2168
 				}
@@ -2174,26 +2174,26 @@  discard block
 block discarded – undo
2174 2174
 		}
2175 2175
 
2176 2176
 		switch ($sortby) {
2177
-			case 'NAME':
2178
-				uasort($this->list, '\Fisharebest\Webtrees\GedcomRecord::compare');
2179
-				break;
2180
-			case 'CHAN':
2181
-				uasort($this->list, function (GedcomRecord $x, GedcomRecord $y) {
2182
-					return $y->lastChangeTimestamp(true) - $x->lastChangeTimestamp(true);
2183
-				});
2184
-				break;
2185
-			case 'BIRT:DATE':
2186
-				uasort($this->list, '\Fisharebest\Webtrees\Individual::compareBirthDate');
2187
-				break;
2188
-			case 'DEAT:DATE':
2189
-				uasort($this->list, '\Fisharebest\Webtrees\Individual::compareDeathDate');
2190
-				break;
2191
-			case 'MARR:DATE':
2192
-				uasort($this->list, '\Fisharebest\Webtrees\Family::compareMarrDate');
2193
-				break;
2194
-			default:
2195
-				// unsorted or already sorted by SQL
2196
-				break;
2177
+		case 'NAME':
2178
+			uasort($this->list, '\Fisharebest\Webtrees\GedcomRecord::compare');
2179
+			break;
2180
+		case 'CHAN':
2181
+			uasort($this->list, function (GedcomRecord $x, GedcomRecord $y) {
2182
+				return $y->lastChangeTimestamp(true) - $x->lastChangeTimestamp(true);
2183
+			});
2184
+			break;
2185
+		case 'BIRT:DATE':
2186
+			uasort($this->list, '\Fisharebest\Webtrees\Individual::compareBirthDate');
2187
+			break;
2188
+		case 'DEAT:DATE':
2189
+			uasort($this->list, '\Fisharebest\Webtrees\Individual::compareDeathDate');
2190
+			break;
2191
+		case 'MARR:DATE':
2192
+			uasort($this->list, '\Fisharebest\Webtrees\Family::compareMarrDate');
2193
+			break;
2194
+		default:
2195
+			// unsorted or already sorted by SQL
2196
+			break;
2197 2197
 		}
2198 2198
 
2199 2199
 		array_push($this->repeats_stack, array($this->repeats, $this->repeat_bytes));
@@ -2344,88 +2344,88 @@  discard block
 block discarded – undo
2344 2344
 		if (!empty($person)) {
2345 2345
 			$this->list[$id] = $person;
2346 2346
 			switch ($group) {
2347
-				case "child-family":
2348
-					foreach ($person->getChildFamilies() as $family) {
2349
-						$husband = $family->getHusband();
2350
-						$wife    = $family->getWife();
2351
-						if (!empty($husband)) {
2352
-							$this->list[$husband->getXref()] = $husband;
2353
-						}
2354
-						if (!empty($wife)) {
2355
-							$this->list[$wife->getXref()] = $wife;
2356
-						}
2357
-						$children = $family->getChildren();
2358
-						foreach ($children as $child) {
2359
-							if (!empty($child)) {
2360
-								$this->list[$child->getXref()] = $child;
2361
-							}
2362
-						}
2347
+			case "child-family":
2348
+				foreach ($person->getChildFamilies() as $family) {
2349
+					$husband = $family->getHusband();
2350
+					$wife    = $family->getWife();
2351
+					if (!empty($husband)) {
2352
+						$this->list[$husband->getXref()] = $husband;
2363 2353
 					}
2364
-					break;
2365
-				case "spouse-family":
2366
-					foreach ($person->getSpouseFamilies() as $family) {
2367
-						$husband = $family->getHusband();
2368
-						$wife    = $family->getWife();
2369
-						if (!empty($husband)) {
2370
-							$this->list[$husband->getXref()] = $husband;
2371
-						}
2372
-						if (!empty($wife)) {
2373
-							$this->list[$wife->getXref()] = $wife;
2354
+					if (!empty($wife)) {
2355
+						$this->list[$wife->getXref()] = $wife;
2356
+					}
2357
+					$children = $family->getChildren();
2358
+					foreach ($children as $child) {
2359
+						if (!empty($child)) {
2360
+							$this->list[$child->getXref()] = $child;
2374 2361
 						}
2375
-						$children = $family->getChildren();
2376
-						foreach ($children as $child) {
2377
-							if (!empty($child)) {
2378
-								$this->list[$child->getXref()] = $child;
2379
-							}
2362
+					}
2363
+				}
2364
+				break;
2365
+			case "spouse-family":
2366
+				foreach ($person->getSpouseFamilies() as $family) {
2367
+					$husband = $family->getHusband();
2368
+					$wife    = $family->getWife();
2369
+					if (!empty($husband)) {
2370
+						$this->list[$husband->getXref()] = $husband;
2371
+					}
2372
+					if (!empty($wife)) {
2373
+						$this->list[$wife->getXref()] = $wife;
2374
+					}
2375
+					$children = $family->getChildren();
2376
+					foreach ($children as $child) {
2377
+						if (!empty($child)) {
2378
+							$this->list[$child->getXref()] = $child;
2380 2379
 						}
2381 2380
 					}
2382
-					break;
2383
-				case "direct-ancestors":
2384
-					$this->addAncestors($this->list, $id, false, $maxgen);
2385
-					break;
2386
-				case "ancestors":
2387
-					$this->addAncestors($this->list, $id, true, $maxgen);
2388
-					break;
2389
-				case "descendants":
2390
-					$this->list[$id]->generation = 1;
2391
-					$this->addDescendancy($this->list, $id, false, $maxgen);
2392
-					break;
2393
-				case "all":
2394
-					$this->addAncestors($this->list, $id, true, $maxgen);
2395
-					$this->addDescendancy($this->list, $id, true, $maxgen);
2396
-					break;
2381
+				}
2382
+				break;
2383
+			case "direct-ancestors":
2384
+				$this->addAncestors($this->list, $id, false, $maxgen);
2385
+				break;
2386
+			case "ancestors":
2387
+				$this->addAncestors($this->list, $id, true, $maxgen);
2388
+				break;
2389
+			case "descendants":
2390
+				$this->list[$id]->generation = 1;
2391
+				$this->addDescendancy($this->list, $id, false, $maxgen);
2392
+				break;
2393
+			case "all":
2394
+				$this->addAncestors($this->list, $id, true, $maxgen);
2395
+				$this->addDescendancy($this->list, $id, true, $maxgen);
2396
+				break;
2397 2397
 			}
2398 2398
 		}
2399 2399
 
2400 2400
 		switch ($sortby) {
2401
-			case 'NAME':
2402
-				uasort($this->list, '\Fisharebest\Webtrees\GedcomRecord::compare');
2403
-				break;
2404
-			case 'BIRT:DATE':
2405
-				uasort($this->list, '\Fisharebest\Webtrees\Individual::compareBirthDate');
2406
-				break;
2407
-			case 'DEAT:DATE':
2408
-				uasort($this->list, '\Fisharebest\Webtrees\Individual::compareDeathDate');
2409
-				break;
2410
-			case 'generation':
2411
-				$newarray = array();
2412
-				reset($this->list);
2413
-				$genCounter = 1;
2414
-				while (count($newarray) < count($this->list)) {
2415
-					foreach ($this->list as $key => $value) {
2416
-						$this->generation = $value->generation;
2417
-						if ($this->generation == $genCounter) {
2418
-							$newarray[$key]             = new \stdClass;
2419
-							$newarray[$key]->generation = $this->generation;
2420
-						}
2401
+		case 'NAME':
2402
+			uasort($this->list, '\Fisharebest\Webtrees\GedcomRecord::compare');
2403
+			break;
2404
+		case 'BIRT:DATE':
2405
+			uasort($this->list, '\Fisharebest\Webtrees\Individual::compareBirthDate');
2406
+			break;
2407
+		case 'DEAT:DATE':
2408
+			uasort($this->list, '\Fisharebest\Webtrees\Individual::compareDeathDate');
2409
+			break;
2410
+		case 'generation':
2411
+			$newarray = array();
2412
+			reset($this->list);
2413
+			$genCounter = 1;
2414
+			while (count($newarray) < count($this->list)) {
2415
+				foreach ($this->list as $key => $value) {
2416
+					$this->generation = $value->generation;
2417
+					if ($this->generation == $genCounter) {
2418
+						$newarray[$key]             = new \stdClass;
2419
+						$newarray[$key]->generation = $this->generation;
2421 2420
 					}
2422
-					$genCounter++;
2423 2421
 				}
2424
-				$this->list = $newarray;
2425
-				break;
2426
-			default:
2427
-				// unsorted
2428
-				break;
2422
+				$genCounter++;
2423
+			}
2424
+			$this->list = $newarray;
2425
+			break;
2426
+		default:
2427
+			// unsorted
2428
+			break;
2429 2429
 		}
2430 2430
 		array_push($this->repeats_stack, array($this->repeats, $this->repeat_bytes));
2431 2431
 		$this->repeat_bytes = xml_get_current_line_number($this->parser) + 1;
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -954,7 +954,7 @@  discard block
 block discarded – undo
954 954
 					}
955 955
 				}
956 956
 				$tmp = explode(':', $tag);
957
-				if (in_array(end($tmp),  array('NOTE', 'TEXT'))) {
957
+				if (in_array(end($tmp), array('NOTE', 'TEXT'))) {
958 958
 					$value = Filter::formatText($value, $WT_TREE); // We'll strip HTML in addText()
959 959
 				}
960 960
 				$this->current_element->addText($value);
@@ -2734,7 +2734,7 @@  discard block
 block discarded – undo
2734 2734
 		$tags      = explode(':', $tag);
2735 2735
 		$origlevel = $level;
2736 2736
 		if ($level == 0) {
2737
-			$level = $gedrec{0} + 1;
2737
+			$level = $gedrec{0} +1;
2738 2738
 		}
2739 2739
 
2740 2740
 		$subrec = $gedrec;
Please login to merge, or discard this patch.
Indentation   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -1,18 +1,18 @@
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * webtrees: online genealogy
4
- * Copyright (C) 2016 webtrees development team
5
- * This program is free software: you can redistribute it and/or modify
6
- * it under the terms of the GNU General Public License as published by
7
- * the Free Software Foundation, either version 3 of the License, or
8
- * (at your option) any later version.
9
- * This program is distributed in the hope that it will be useful,
10
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
11
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
- * GNU General Public License for more details.
13
- * You should have received a copy of the GNU General Public License
14
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
15
- */
3
+	 * webtrees: online genealogy
4
+	 * Copyright (C) 2016 webtrees development team
5
+	 * This program is free software: you can redistribute it and/or modify
6
+	 * it under the terms of the GNU General Public License as published by
7
+	 * the Free Software Foundation, either version 3 of the License, or
8
+	 * (at your option) any later version.
9
+	 * This program is distributed in the hope that it will be useful,
10
+	 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11
+	 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
+	 * GNU General Public License for more details.
13
+	 * You should have received a copy of the GNU General Public License
14
+	 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15
+	 */
16 16
 namespace Fisharebest\Webtrees;
17 17
 
18 18
 use Fisharebest\Webtrees\Theme\AdministrationTheme;
Please login to merge, or discard this patch.
app/SurnameTradition/IcelandicSurnameTradition.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -42,7 +42,7 @@
 block discarded – undo
42 42
 	 */
43 43
 	public function newChildNames($father_name, $mother_name, $child_sex) {
44 44
 		if (preg_match(self::REGEX_GIVN, $father_name, $father_match)) {
45
-			switch($child_sex) {
45
+			switch ($child_sex) {
46 46
 			case 'M':
47 47
 				return array(
48 48
 					'NAME' => $father_match['GIVN'] . 'sson',
Please login to merge, or discard this patch.
Indentation   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -1,18 +1,18 @@
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * webtrees: online genealogy
4
- * Copyright (C) 2016 webtrees development team
5
- * This program is free software: you can redistribute it and/or modify
6
- * it under the terms of the GNU General Public License as published by
7
- * the Free Software Foundation, either version 3 of the License, or
8
- * (at your option) any later version.
9
- * This program is distributed in the hope that it will be useful,
10
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
11
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
- * GNU General Public License for more details.
13
- * You should have received a copy of the GNU General Public License
14
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
15
- */
3
+	 * webtrees: online genealogy
4
+	 * Copyright (C) 2016 webtrees development team
5
+	 * This program is free software: you can redistribute it and/or modify
6
+	 * it under the terms of the GNU General Public License as published by
7
+	 * the Free Software Foundation, either version 3 of the License, or
8
+	 * (at your option) any later version.
9
+	 * This program is distributed in the hope that it will be useful,
10
+	 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11
+	 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
+	 * GNU General Public License for more details.
13
+	 * You should have received a copy of the GNU General Public License
14
+	 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15
+	 */
16 16
 namespace Fisharebest\Webtrees;
17 17
 
18 18
 use Fisharebest\Webtrees\Theme\AdministrationTheme;
Please login to merge, or discard this patch.
app/SurnameTradition/SpanishSurnameTradition.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -61,7 +61,7 @@
 block discarded – undo
61 61
 	 */
62 62
 	public function newParentNames($child_name, $parent_sex) {
63 63
 		if (preg_match(self::REGEX_SURNS, $child_name, $match)) {
64
-			switch($parent_sex) {
64
+			switch ($parent_sex) {
65 65
 			case 'M':
66 66
 				return array(
67 67
 					'NAME' => '/' . $match['SURN1'] . '/ //',
Please login to merge, or discard this patch.
Indentation   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -1,18 +1,18 @@
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * webtrees: online genealogy
4
- * Copyright (C) 2016 webtrees development team
5
- * This program is free software: you can redistribute it and/or modify
6
- * it under the terms of the GNU General Public License as published by
7
- * the Free Software Foundation, either version 3 of the License, or
8
- * (at your option) any later version.
9
- * This program is distributed in the hope that it will be useful,
10
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
11
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
- * GNU General Public License for more details.
13
- * You should have received a copy of the GNU General Public License
14
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
15
- */
3
+	 * webtrees: online genealogy
4
+	 * Copyright (C) 2016 webtrees development team
5
+	 * This program is free software: you can redistribute it and/or modify
6
+	 * it under the terms of the GNU General Public License as published by
7
+	 * the Free Software Foundation, either version 3 of the License, or
8
+	 * (at your option) any later version.
9
+	 * This program is distributed in the hope that it will be useful,
10
+	 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11
+	 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
+	 * GNU General Public License for more details.
13
+	 * You should have received a copy of the GNU General Public License
14
+	 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15
+	 */
16 16
 namespace Fisharebest\Webtrees;
17 17
 
18 18
 use Fisharebest\Webtrees\Theme\AdministrationTheme;
Please login to merge, or discard this patch.
calendar.php 1 patch
Upper-Lower-Casing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -67,14 +67,14 @@
 block discarded – undo
67 67
 	if (strlen($match[1]) > strlen($match[2])) {
68 68
 		$match[2] = substr($match[1], 0, strlen($match[1]) - strlen($match[2])) . $match[2];
69 69
 	}
70
-	$ged_date = new Date("FROM {$cal} {$match[1]} TO {$cal} {$match[2]}");
70
+	$ged_date = new Date("from {$cal} {$match[1]} TO {$cal} {$match[2]}");
71 71
 	$view     = 'year';
72 72
 } else {
73 73
 	// advanced-year "decade/century wildcard"
74 74
 	if (preg_match('/^(\d+)(\?+)$/', $year, $match)) {
75 75
 		$y1       = $match[1] . str_replace('?', '0', $match[2]);
76 76
 		$y2       = $match[1] . str_replace('?', '9', $match[2]);
77
-		$ged_date = new Date("FROM {$cal} {$y1} TO {$cal} {$y2}");
77
+		$ged_date = new Date("from {$cal} {$y1} TO {$cal} {$y2}");
78 78
 		$view     = 'year';
79 79
 	} else {
80 80
 		if ($year < 0) {
Please login to merge, or discard this patch.
edit_interface.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -2066,7 +2066,7 @@
 block discarded – undo
2066 2066
 	}
2067 2067
 
2068 2068
 	$CHIL = array();
2069
-	for ($i = 0;; ++$i) {
2069
+	for ($i = 0; ; ++$i) {
2070 2070
 		if (isset($_POST['CHIL' . $i])) {
2071 2071
 			$CHIL[] = Filter::post('CHIL' . $i, WT_REGEX_XREF);
2072 2072
 		} else {
Please login to merge, or discard this patch.
edituser.php 2 patches
Braces   +5 added lines, -2 removed lines patch added patch discarded remove patch
@@ -183,8 +183,11 @@
 block discarded – undo
183 183
 			<div class="value">
184 184
 				<?php if ($my_individual_record): ?>
185 185
 				<?php echo $my_individual_record->formatList('span'); ?>
186
-				<?php else: ?>
187
-					<?php echo I18N::translateContext('unknown people', 'Unknown'); ?>
186
+				<?php else {
187
+	: ?>
188
+					<?php echo I18N::translateContext('unknown people', 'Unknown');
189
+}
190
+?>
188 191
 				<?php endif; ?>
189 192
 				<p class="small text-muted">
190 193
 					<?php echo I18N::translate('This is a link to your own record in the family tree.  If this is the wrong individual, contact an administrator.'); ?>
Please login to merge, or discard this patch.
Indentation   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -1,18 +1,18 @@
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * webtrees: online genealogy
4
- * Copyright (C) 2016 webtrees development team
5
- * This program is free software: you can redistribute it and/or modify
6
- * it under the terms of the GNU General Public License as published by
7
- * the Free Software Foundation, either version 3 of the License, or
8
- * (at your option) any later version.
9
- * This program is distributed in the hope that it will be useful,
10
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
11
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
- * GNU General Public License for more details.
13
- * You should have received a copy of the GNU General Public License
14
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
15
- */
3
+	 * webtrees: online genealogy
4
+	 * Copyright (C) 2016 webtrees development team
5
+	 * This program is free software: you can redistribute it and/or modify
6
+	 * it under the terms of the GNU General Public License as published by
7
+	 * the Free Software Foundation, either version 3 of the License, or
8
+	 * (at your option) any later version.
9
+	 * This program is distributed in the hope that it will be useful,
10
+	 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11
+	 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
+	 * GNU General Public License for more details.
13
+	 * You should have received a copy of the GNU General Public License
14
+	 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15
+	 */
16 16
 namespace Fisharebest\Webtrees;
17 17
 
18 18
 use Fisharebest\Webtrees\Theme\AdministrationTheme;
Please login to merge, or discard this patch.
login.php 2 patches
Braces   +12 added lines, -4 removed lines patch added patch discarded remove patch
@@ -52,10 +52,18 @@
 block discarded – undo
52 52
 $password        = Filter::post('password');
53 53
 
54 54
 // These parameters may come from the URL which is emailed to users.
55
-if (!$action)        $action        = Filter::get('action');
56
-if (!$user_name)     $user_name     = Filter::get('user_name');
57
-if (!$user_hashcode) $user_hashcode = Filter::get('user_hashcode');
58
-if (!$url)           $url           = Filter::get('url');
55
+if (!$action) {
56
+	$action        = Filter::get('action');
57
+}
58
+if (!$user_name) {
59
+	$user_name     = Filter::get('user_name');
60
+}
61
+if (!$user_hashcode) {
62
+	$user_hashcode = Filter::get('user_hashcode');
63
+}
64
+if (!$url) {
65
+	$url           = Filter::get('url');
66
+}
59 67
 
60 68
 $message = '';
61 69
 
Please login to merge, or discard this patch.
Indentation   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -1,18 +1,18 @@
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * webtrees: online genealogy
4
- * Copyright (C) 2016 webtrees development team
5
- * This program is free software: you can redistribute it and/or modify
6
- * it under the terms of the GNU General Public License as published by
7
- * the Free Software Foundation, either version 3 of the License, or
8
- * (at your option) any later version.
9
- * This program is distributed in the hope that it will be useful,
10
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
11
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
- * GNU General Public License for more details.
13
- * You should have received a copy of the GNU General Public License
14
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
15
- */
3
+	 * webtrees: online genealogy
4
+	 * Copyright (C) 2016 webtrees development team
5
+	 * This program is free software: you can redistribute it and/or modify
6
+	 * it under the terms of the GNU General Public License as published by
7
+	 * the Free Software Foundation, either version 3 of the License, or
8
+	 * (at your option) any later version.
9
+	 * This program is distributed in the hope that it will be useful,
10
+	 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11
+	 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
+	 * GNU General Public License for more details.
13
+	 * You should have received a copy of the GNU General Public License
14
+	 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15
+	 */
16 16
 namespace Fisharebest\Webtrees;
17 17
 
18 18
 use Fisharebest\Webtrees\Theme\AdministrationTheme;
Please login to merge, or discard this patch.