Completed
Pull Request — master (#1258)
by Rico
13:22
created
index_edit.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
127 127
 			}
128 128
 		}
129 129
 	}
130
-	if ($user_id < 0 || $gedcom_id < 0 ) {
130
+	if ($user_id < 0 || $gedcom_id < 0) {
131 131
 		header('Location: admin.php');
132 132
 	} elseif ($user_id > 0) {
133 133
 		header('Location: index.php?ctype=user&ged=' . $WT_TREE->getNameUrl());
@@ -371,7 +371,7 @@  discard block
 block discarded – undo
371 371
 						<?= FontAwesome::decorativeIcon('save') ?>
372 372
 						<?= I18N::translate('save') ?>
373 373
 					</button>
374
-					<?php if ($user_id < 0 || $gedcom_id < 0 ): ?>
374
+					<?php if ($user_id < 0 || $gedcom_id < 0): ?>
375 375
 						<a class="btn btn-secondary" href="admin.php">
376 376
 					<?php elseif ($user_id > 0): ?>
377 377
 						<a class="btn btn-secondary" href="index.php?ctype=user&amp;ged=<?= $WT_TREE->getNameHtml() ?>">
Please login to merge, or discard this patch.
edit_interface.php 2 patches
Switch Indentation   +97 added lines, -97 removed lines patch added patch discarded remove patch
@@ -273,40 +273,40 @@  discard block
 block discarded – undo
273 273
 
274 274
 		$level1type = $edit_fact->getTag();
275 275
 		switch ($record::RECORD_TYPE) {
276
-			case 'REPO':
277
-				// REPO:NAME facts may take a NOTE (but the REPO record may not).
278
-				if ($level1type === 'NAME') {
279
-					FunctionsEdit::printAddLayer('NOTE');
280
-					FunctionsEdit::printAddLayer('SHARED_NOTE');
276
+		case 'REPO':
277
+			// REPO:NAME facts may take a NOTE (but the REPO record may not).
278
+			if ($level1type === 'NAME') {
279
+				FunctionsEdit::printAddLayer('NOTE');
280
+				FunctionsEdit::printAddLayer('SHARED_NOTE');
281
+			}
282
+			break;
283
+		case 'FAM':
284
+		case 'INDI':
285
+			// FAM and INDI records have real facts. They can take NOTE/SOUR/OBJE/etc.
286
+			if ($level1type !== 'SEX' && $level1type !== 'NOTE' && $level1type !== 'ALIA') {
287
+				if ($level1type !== 'SOUR') {
288
+					FunctionsEdit::printAddLayer('SOUR');
281 289
 				}
282
-				break;
283
-			case 'FAM':
284
-			case 'INDI':
285
-				// FAM and INDI records have real facts. They can take NOTE/SOUR/OBJE/etc.
286
-				if ($level1type !== 'SEX' && $level1type !== 'NOTE' && $level1type !== 'ALIA') {
287
-					if ($level1type !== 'SOUR') {
288
-						FunctionsEdit::printAddLayer('SOUR');
289
-					}
290
-					if ($level1type !== 'OBJE') {
291
-						FunctionsEdit::printAddLayer('OBJE');
292
-					}
293
-					FunctionsEdit::printAddLayer('NOTE');
294
-					FunctionsEdit::printAddLayer('SHARED_NOTE', 2, $level1type);
295
-					if ($level1type !== 'ASSO' && $level1type !== 'NOTE' && $level1type !== 'SOUR') {
296
-						FunctionsEdit::printAddLayer('ASSO');
297
-					}
298
-					// allow to add godfather and godmother for CHR fact or best man and bridesmaid  for MARR fact in one window
299
-					if (in_array($level1type, Config::twoAssociates())) {
300
-						FunctionsEdit::printAddLayer('ASSO2');
301
-					}
302
-					if ($level1type !== 'SOUR') {
303
-						FunctionsEdit::printAddLayer('RESN');
304
-					}
290
+				if ($level1type !== 'OBJE') {
291
+					FunctionsEdit::printAddLayer('OBJE');
305 292
 				}
306
-				break;
307
-			default:
308
-				// Other types of record do not have these lower-level records
309
-				break;
293
+				FunctionsEdit::printAddLayer('NOTE');
294
+				FunctionsEdit::printAddLayer('SHARED_NOTE', 2, $level1type);
295
+				if ($level1type !== 'ASSO' && $level1type !== 'NOTE' && $level1type !== 'SOUR') {
296
+					FunctionsEdit::printAddLayer('ASSO');
297
+				}
298
+				// allow to add godfather and godmother for CHR fact or best man and bridesmaid  for MARR fact in one window
299
+				if (in_array($level1type, Config::twoAssociates())) {
300
+					FunctionsEdit::printAddLayer('ASSO2');
301
+				}
302
+				if ($level1type !== 'SOUR') {
303
+					FunctionsEdit::printAddLayer('RESN');
304
+				}
305
+			}
306
+			break;
307
+		default:
308
+			// Other types of record do not have these lower-level records
309
+			break;
310 310
 		}
311 311
 
312 312
 		?>
@@ -2089,15 +2089,15 @@  discard block
 block discarded – undo
2089 2089
 								<b>
2090 2090
 									<?php
2091 2091
 									switch ($father->getSex()) {
2092
-										case 'M':
2093
-											echo I18N::translate('husband');
2094
-											break;
2095
-										case 'F':
2096
-											echo I18N::translate('wife');
2097
-											break;
2098
-										default:
2099
-											echo I18N::translate('spouse');
2100
-											break;
2092
+									case 'M':
2093
+										echo I18N::translate('husband');
2094
+										break;
2095
+									case 'F':
2096
+										echo I18N::translate('wife');
2097
+										break;
2098
+									default:
2099
+										echo I18N::translate('spouse');
2100
+										break;
2101 2101
 									}
2102 2102
 									?>
2103 2103
 								</b>
@@ -2128,15 +2128,15 @@  discard block
 block discarded – undo
2128 2128
 								<b>
2129 2129
 									<?php
2130 2130
 									switch ($mother->getSex()) {
2131
-										case 'M':
2132
-											echo I18N::translate('husband');
2133
-											break;
2134
-										case 'F':
2135
-											echo I18N::translate('wife');
2136
-											break;
2137
-										default:
2138
-											echo I18N::translate('spouse');
2139
-											break;
2131
+									case 'M':
2132
+										echo I18N::translate('husband');
2133
+										break;
2134
+									case 'F':
2135
+										echo I18N::translate('wife');
2136
+										break;
2137
+									default:
2138
+										echo I18N::translate('spouse');
2139
+										break;
2140 2140
 									}
2141 2141
 									?>
2142 2142
 								</b>
@@ -2169,15 +2169,15 @@  discard block
 block discarded – undo
2169 2169
 								<b>
2170 2170
 									<?php
2171 2171
 									switch ($child->getSex()) {
2172
-										case 'M':
2173
-											echo I18N::translate('son');
2174
-											break;
2175
-										case 'F':
2176
-											echo I18N::translate('daughter');
2177
-											break;
2178
-										default:
2179
-											echo I18N::translate('child');
2180
-											break;
2172
+									case 'M':
2173
+										echo I18N::translate('son');
2174
+										break;
2175
+									case 'F':
2176
+										echo I18N::translate('daughter');
2177
+										break;
2178
+									default:
2179
+										echo I18N::translate('child');
2180
+										break;
2181 2181
 									}
2182 2182
 									?>
2183 2183
 								</b>
@@ -2561,35 +2561,35 @@  discard block
 block discarded – undo
2561 2561
 		}
2562 2562
 
2563 2563
 		switch ($nextaction) {
2564
-			case 'add_child_to_family_action':
2565
-				$name_fields = array_merge($name_fields, $surname_tradition->newChildNames($father_name, $mother_name, $gender));
2566
-				break;
2567
-			case 'add_child_to_individual_action':
2568
-				if ($person->getSex() === 'F') {
2569
-					$name_fields = array_merge($name_fields, $surname_tradition->newChildNames('', $indi_name, $gender));
2570
-				} else {
2571
-					$name_fields = array_merge($name_fields, $surname_tradition->newChildNames($indi_name, '', $gender));
2572
-				}
2573
-				break;
2574
-			case 'add_parent_to_individual_action':
2575
-				$name_fields = array_merge($name_fields, $surname_tradition->newParentNames($indi_name, $gender));
2576
-				break;
2577
-			case 'add_spouse_to_family_action':
2578
-				if ($father) {
2579
-					$name_fields = array_merge($name_fields, $surname_tradition->newSpouseNames($father_name, $gender));
2580
-				} else {
2581
-					$name_fields = array_merge($name_fields, $surname_tradition->newSpouseNames($mother_name, $gender));
2582
-				}
2583
-				break;
2584
-			case 'add_spouse_to_individual_action':
2585
-				$name_fields = array_merge($name_fields, $surname_tradition->newSpouseNames($indi_name, $gender));
2586
-				break;
2587
-			case 'add_unlinked_indi_action':
2588
-			case 'update':
2589
-				if ($surname_tradition->hasSurnames()) {
2590
-					$name_fields['NAME'] = '//';
2591
-				}
2592
-				break;
2564
+		case 'add_child_to_family_action':
2565
+			$name_fields = array_merge($name_fields, $surname_tradition->newChildNames($father_name, $mother_name, $gender));
2566
+			break;
2567
+		case 'add_child_to_individual_action':
2568
+			if ($person->getSex() === 'F') {
2569
+				$name_fields = array_merge($name_fields, $surname_tradition->newChildNames('', $indi_name, $gender));
2570
+			} else {
2571
+				$name_fields = array_merge($name_fields, $surname_tradition->newChildNames($indi_name, '', $gender));
2572
+			}
2573
+			break;
2574
+		case 'add_parent_to_individual_action':
2575
+			$name_fields = array_merge($name_fields, $surname_tradition->newParentNames($indi_name, $gender));
2576
+			break;
2577
+		case 'add_spouse_to_family_action':
2578
+			if ($father) {
2579
+				$name_fields = array_merge($name_fields, $surname_tradition->newSpouseNames($father_name, $gender));
2580
+			} else {
2581
+				$name_fields = array_merge($name_fields, $surname_tradition->newSpouseNames($mother_name, $gender));
2582
+			}
2583
+			break;
2584
+		case 'add_spouse_to_individual_action':
2585
+			$name_fields = array_merge($name_fields, $surname_tradition->newSpouseNames($indi_name, $gender));
2586
+			break;
2587
+		case 'add_unlinked_indi_action':
2588
+		case 'update':
2589
+			if ($surname_tradition->hasSurnames()) {
2590
+				$name_fields['NAME'] = '//';
2591
+			}
2592
+			break;
2593 2593
 		}
2594 2594
 	}
2595 2595
 
@@ -2609,15 +2609,15 @@  discard block
 block discarded – undo
2609 2609
 	echo '<table class="facts_table">';
2610 2610
 
2611 2611
 	switch ($nextaction) {
2612
-		case 'add_child_to_family_action':
2613
-		case 'add_child_to_individual_action':
2614
-			// When adding a new child, specify the pedigree
2615
-			FunctionsEdit::addSimpleTag('0 PEDI');
2616
-			break;
2617
-		case 'update':
2618
-			// When adding/editing a name, specify the type
2619
-			FunctionsEdit::addSimpleTag('0 TYPE ' . $name_type, '', '', null, $person);
2620
-			break;
2612
+	case 'add_child_to_family_action':
2613
+	case 'add_child_to_individual_action':
2614
+		// When adding a new child, specify the pedigree
2615
+		FunctionsEdit::addSimpleTag('0 PEDI');
2616
+		break;
2617
+	case 'update':
2618
+		// When adding/editing a name, specify the type
2619
+		FunctionsEdit::addSimpleTag('0 TYPE ' . $name_type, '', '', null, $person);
2620
+		break;
2621 2621
 	}
2622 2622
 
2623 2623
 	// First - new/existing standard name fields
Please login to merge, or discard this patch.
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
 
27 27
 $action = Filter::post('action', null, Filter::get('action'));
28 28
 
29
-$controller  = new PageController;
29
+$controller = new PageController;
30 30
 $controller
31 31
 	->restrictAccess(Auth::isEditor($controller->tree()))
32 32
 	->addInlineJavascript('var locale_date_format="' . preg_replace('/[^DMY]/', '', str_replace(['j', 'F'], ['D', 'M'], I18N::dateFormat())) . '";');
@@ -339,7 +339,7 @@  discard block
 block discarded – undo
339 339
 	////////////////////////////////////////////////////////////////////////////////
340 340
 	case 'add':
341 341
 		$xref = Filter::get('xref', WT_REGEX_XREF);
342
-		$fact    = Filter::get('fact', WT_REGEX_TAG);
342
+		$fact = Filter::get('fact', WT_REGEX_TAG);
343 343
 
344 344
 		$record = GedcomRecord::getInstance($xref, $controller->tree());
345 345
 		check_record_access($record);
@@ -438,7 +438,7 @@  discard block
 block discarded – undo
438 438
 
439 439
 		$newged = '';
440 440
 		if (!empty($_POST['NAME'])) {
441
-			$newged     .= "\n1 NAME " . $_POST['NAME'];
441
+			$newged .= "\n1 NAME " . $_POST['NAME'];
442 442
 			$name_facts = ['TYPE', 'NPFX', 'GIVN', 'NICK', 'SPFX', 'SURN', 'NSFX'];
443 443
 			foreach ($name_facts as $name_fact) {
444 444
 				if (!empty($_POST[$name_fact])) {
@@ -1192,7 +1192,7 @@  discard block
 block discarded – undo
1192 1192
 	////////////////////////////////////////////////////////////////////////////////
1193 1193
 	case 'linkspouse':
1194 1194
 		$famtag = Filter::get('famtag', 'HUSB|WIFE');
1195
-		$xref    = Filter::get('xref', WT_REGEX_XREF);
1195
+		$xref = Filter::get('xref', WT_REGEX_XREF);
1196 1196
 
1197 1197
 		$person = Individual::getInstance($xref, $controller->tree());
1198 1198
 		check_record_access($person);
@@ -1440,7 +1440,7 @@  discard block
 block discarded – undo
1440 1440
 		$TITL = Filter::post('TITL');
1441 1441
 		if ($TITL) {
1442 1442
 			$newgedrec .= "\n1 TITL " . $TITL;
1443
-			$_HEB      = Filter::post('_HEB');
1443
+			$_HEB = Filter::post('_HEB');
1444 1444
 			if ($_HEB) {
1445 1445
 				$newgedrec .= "\n2 _HEB " . $_HEB;
1446 1446
 			}
@@ -1460,7 +1460,7 @@  discard block
 block discarded – undo
1460 1460
 		$REPO = Filter::post('REPO', WT_REGEX_XREF);
1461 1461
 		if ($REPO) {
1462 1462
 			$newgedrec .= "\n1 REPO @" . $REPO . '@';
1463
-			$CALN      = Filter::post('CALN');
1463
+			$CALN = Filter::post('CALN');
1464 1464
 			if ($CALN) {
1465 1465
 				$newgedrec .= "\n2 CALN " . $CALN;
1466 1466
 			}
@@ -1734,7 +1734,7 @@  discard block
 block discarded – undo
1734 1734
 		$REPO_NAME = Filter::post('REPO_NAME');
1735 1735
 		if ($REPO_NAME) {
1736 1736
 			$gedrec .= "\n1 NAME " . $REPO_NAME;
1737
-			$_HEB   = Filter::post('_HEB');
1737
+			$_HEB = Filter::post('_HEB');
1738 1738
 			if ($_HEB) {
1739 1739
 				$gedrec .= "\n2 _HEB " . $_HEB;
1740 1740
 			}
@@ -1944,7 +1944,7 @@  discard block
 block discarded – undo
1944 1944
 	////////////////////////////////////////////////////////////////////////////////
1945 1945
 	case 'reorder_children':
1946 1946
 		$xref = Filter::post('xref', WT_REGEX_XREF, Filter::get('xref', WT_REGEX_XREF));
1947
-		$option  = Filter::post('option');
1947
+		$option = Filter::post('option');
1948 1948
 
1949 1949
 		$family = Family::getInstance($xref, $controller->tree());
1950 1950
 		check_record_access($family);
@@ -2342,7 +2342,7 @@  discard block
 block discarded – undo
2342 2342
 	////////////////////////////////////////////////////////////////////////////////
2343 2343
 	case 'reorder_fams':
2344 2344
 		$xref = Filter::post('xref', WT_REGEX_XREF, Filter::get('xref', WT_REGEX_XREF));
2345
-		$option  = Filter::post('option');
2345
+		$option = Filter::post('option');
2346 2346
 
2347 2347
 		$person = Individual::getInstance($xref, $controller->tree());
2348 2348
 		check_record_access($person);
@@ -2460,7 +2460,7 @@  discard block
 block discarded – undo
2460 2460
 			'<div class="form-group row"><label class="col-sm-3 col-form-label" for="keep_chan">' .
2461 2461
 			I18N::translate('Last change') .
2462 2462
 			'</label><div class="col-sm-9">' .
2463
-			Bootstrap4::checkbox(I18N::translate('Keep the existing “last change” information'), true, ['name' => 'keep_chan', 'checked' => (bool)$controller->tree()->getPreference('NO_UPDATE_CHAN')]) .
2463
+			Bootstrap4::checkbox(I18N::translate('Keep the existing “last change” information'), true, ['name' => 'keep_chan', 'checked' => (bool) $controller->tree()->getPreference('NO_UPDATE_CHAN')]) .
2464 2464
 			$details .
2465 2465
 			'</div></div>';
2466 2466
 	} else {
Please login to merge, or discard this patch.
addmedia.php 1 patch
Unused Use Statements   -2 removed lines patch added patch discarded remove patch
@@ -17,9 +17,7 @@
 block discarded – undo
17 17
 
18 18
 use Fisharebest\Webtrees\Controller\PageController;
19 19
 use Fisharebest\Webtrees\Functions\Functions;
20
-use Fisharebest\Webtrees\Functions\FunctionsDb;
21 20
 use Fisharebest\Webtrees\Functions\FunctionsEdit;
22
-use Fisharebest\Webtrees\Functions\FunctionsImport;
23 21
 use Fisharebest\Webtrees\Functions\FunctionsPrint;
24 22
 use Fisharebest\Webtrees\Query\QueryMedia;
25 23
 
Please login to merge, or discard this patch.
app/Functions/FunctionsPrintFacts.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -176,7 +176,8 @@  discard block
 block discarded – undo
176 176
 			<div class="editfacts">
177 177
 				<?php if ($fact->getTag() === 'FILE' && $fact->getParent() instanceof Media): ?>
178 178
 					<?= FontAwesome::linkIcon('edit', I18N::translate('Edit'), ['class' => 'btn btn-link', 'href' => 'edit_interface.php?action=media-edit&xref=' . $parent->getXref() . '&fact_id=' . $fact->getFactId() . '&ged=' . $parent->getTree()->getNameHtml()]) ?>
179
-				<?php else: ?>
179
+				<?php else {
180
+	: ?>
180 181
 					<?= FontAwesome::linkIcon('edit', I18N::translate('Edit'), ['class' => 'btn btn-link', 'href' => 'edit_interface.php?action=edit&xref=' . $parent->getXref() . '&fact_id=' . $fact->getFactId() . '&ged=' . $parent->getTree()->getNameHtml()]) ?>
181 182
 					<?= FontAwesome::linkIcon('copy', I18N::translate('Copy'), ['class' => 'btn btn-link', 'href' => '#', 'onclick' => 'return copy_fact("' . $parent->getXref() . '", "' . $fact->getFactId() . '");']) ?>
182 183
 					<?= FontAwesome::linkIcon('delete', I18N::translate('Delete'), ['class' => 'btn btn-link', 'href' => '#', 'onclick' => 'return delete_fact("' . I18N::translate('Are you sure you want to delete this fact?') . '", "' . $parent->getXref() . '", "' . $fact->getFactId() . '");']) ?>
@@ -185,6 +186,7 @@  discard block
 block discarded – undo
185 186
 		<?php
186 187
 		} else {
187 188
 			echo $label;
189
+}
188 190
 		}
189 191
 
190 192
 		switch ($fact->getTag()) {
Please login to merge, or discard this patch.
action.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
 
96 96
 	// Create a media object, and return parameters needed by Select2
97 97
 	header('Content-type: application/json');
98
-	$filename   = 'eek.jpg';
98
+	$filename = 'eek.jpg';
99 99
 	$auto   = Filter::post('auto');
100 100
 	$folder = Filter::post('folder');
101 101
 	$note   = Filter::post('note');
@@ -142,7 +142,7 @@  discard block
 block discarded – undo
142 142
 		break;
143 143
 	}
144 144
 
145
-	$gedcom = "0 @new@ OBJE\n1 FILE " . $folder . $file . "\n2 FORM " .  $format;
145
+	$gedcom = "0 @new@ OBJE\n1 FILE " . $folder . $file . "\n2 FORM " . $format;
146 146
 	if ($type !== '') {
147 147
 		$gedcom .= "\n3 TYPE " . $type;
148 148
 	}
Please login to merge, or discard this patch.