Completed
Push — 1.7 ( 5dea34...6cf9f6 )
by
unknown
08:46
created
admin_trees_manage.php 2 patches
Braces   +5 added lines, -2 removed lines patch added patch discarded remove patch
@@ -433,8 +433,11 @@
 block discarded – undo
433 433
 									<i class="fa fa-li fa-star"></i>
434 434
 									<?php if ($tree->getName() == Site::getPreference('DEFAULT_GEDCOM')): ?>
435 435
 										<?php echo I18N::translate('Default family tree'); ?>
436
-									<?php else: ?>
437
-										<a href="#" onclick="document.defaultform<?php echo $tree->getTreeId(); ?>.submit();">
436
+									<?php else {
437
+	: ?>
438
+										<a href="#" onclick="document.defaultform<?php echo $tree->getTreeId();
439
+}
440
+?>.submit();">
438 441
 											<?php echo I18N::translate('Set as default'); ?>
439 442
 											<span class="sr-only">
440 443
 										<?php echo $tree->getTitleHtml(); ?>
Please login to merge, or discard this patch.
Switch Indentation   +139 added lines, -139 removed lines patch added patch discarded remove patch
@@ -50,116 +50,116 @@  discard block
 block discarded – undo
50 50
 }
51 51
 // Process POST actions
52 52
 switch (Filter::post('action')) {
53
-case 'delete':
54
-	$gedcom_id = Filter::postInteger('gedcom_id');
55
-	if (Filter::checkCsrf() && $gedcom_id) {
56
-		$tree = Tree::findById($gedcom_id);
57
-		FlashMessages::addMessage(/* I18N: %s is the name of a family tree */ I18N::translate('The family tree “%s” has been deleted.', $tree->getTitleHtml()), 'success');
58
-		$tree->delete();
59
-	}
60
-	header('Location: ' . WT_BASE_URL . WT_SCRIPT_NAME);
61
-
62
-	return;
63
-case 'setdefault':
64
-	if (Filter::checkCsrf()) {
65
-		Site::setPreference('DEFAULT_GEDCOM', Filter::post('ged'));
66
-		FlashMessages::addMessage(/* I18N: %s is the name of a family tree */ I18N::translate('The family tree “%s” will be shown to visitors when they first arrive at this website.', $WT_TREE->getTitleHtml()), 'success');
67
-	}
68
-	header('Location: ' . WT_BASE_URL . WT_SCRIPT_NAME);
69
-
70
-	return;
71
-case 'new_tree':
72
-	$basename   = basename(Filter::post('tree_name'));
73
-	$tree_title = Filter::post('tree_title');
74
-
75
-	if (Filter::checkCsrf() && $basename && $tree_title) {
76
-		if (Tree::findByName($basename)) {
77
-			FlashMessages::addMessage(/* I18N: %s is the name of a family tree */ I18N::translate('The family tree “%s” already exists.', Filter::escapeHtml($basename)), 'danger');
78
-		} else {
79
-			Tree::create($basename, $tree_title);
80
-			FlashMessages::addMessage(/* I18N: %s is the name of a family tree */ I18N::translate('The family tree “%s” has been created.', Filter::escapeHtml($basename)), 'success');
53
+	case 'delete':
54
+		$gedcom_id = Filter::postInteger('gedcom_id');
55
+		if (Filter::checkCsrf() && $gedcom_id) {
56
+			$tree = Tree::findById($gedcom_id);
57
+			FlashMessages::addMessage(/* I18N: %s is the name of a family tree */ I18N::translate('The family tree “%s” has been deleted.', $tree->getTitleHtml()), 'success');
58
+			$tree->delete();
81 59
 		}
82
-	}
83
-	header('Location: ' . WT_BASE_URL . WT_SCRIPT_NAME . '?ged=' . Filter::escapeUrl($basename));
84
-
85
-	return;
86
-case 'replace_upload':
87
-	$gedcom_id          = Filter::postInteger('gedcom_id');
88
-	$keep_media         = Filter::post('keep_media', '1', '0');
89
-	$GEDCOM_MEDIA_PATH  = Filter::post('GEDCOM_MEDIA_PATH');
90
-	$WORD_WRAPPED_NOTES = Filter::post('WORD_WRAPPED_NOTES', '1', '0');
91
-	$tree               = Tree::findById($gedcom_id);
92
-
93
-	if (Filter::checkCsrf() && $tree) {
94
-		$tree->setPreference('keep_media', $keep_media);
95
-		$tree->setPreference('GEDCOM_MEDIA_PATH', $GEDCOM_MEDIA_PATH);
96
-		$tree->setPreference('WORD_WRAPPED_NOTES', $WORD_WRAPPED_NOTES);
97
-		if (isset($_FILES['tree_name'])) {
98
-			if ($_FILES['tree_name']['error'] == 0 && is_readable($_FILES['tree_name']['tmp_name'])) {
99
-				$tree->importGedcomFile($_FILES['tree_name']['tmp_name'], $_FILES['tree_name']['name']);
100
-			} else {
101
-				FlashMessages::addMessage(Functions::fileUploadErrorText($_FILES['tree_name']['error']), 'danger');
102
-			}
103
-		} else {
104
-			FlashMessages::addMessage(I18N::translate('No GEDCOM file was received.'), 'danger');
105
-		}
106
-	}
107
-	header('Location: ' . WT_BASE_URL . WT_SCRIPT_NAME);
108
-
109
-	return;
110
-case 'replace_import':
111
-	$basename           = basename(Filter::post('tree_name'));
112
-	$gedcom_id          = Filter::postInteger('gedcom_id');
113
-	$keep_media         = Filter::post('keep_media', '1', '0');
114
-	$GEDCOM_MEDIA_PATH  = Filter::post('GEDCOM_MEDIA_PATH');
115
-	$WORD_WRAPPED_NOTES = Filter::post('WORD_WRAPPED_NOTES', '1', '0');
116
-	$tree               = Tree::findById($gedcom_id);
117
-
118
-	if (Filter::checkCsrf() && $tree) {
119
-		$tree->setPreference('keep_media', $keep_media);
120
-		$tree->setPreference('GEDCOM_MEDIA_PATH', $GEDCOM_MEDIA_PATH);
121
-		$tree->setPreference('WORD_WRAPPED_NOTES', $WORD_WRAPPED_NOTES);
122
-		if ($basename) {
123
-			$tree->importGedcomFile(WT_DATA_DIR . $basename, $basename);
124
-		} else {
125
-			FlashMessages::addMessage(I18N::translate('No GEDCOM file was received.'), 'danger');
126
-		}
127
-	}
128
-	header('Location: ' . WT_BASE_URL . WT_SCRIPT_NAME);
129
-
130
-	return;
60
+		header('Location: ' . WT_BASE_URL . WT_SCRIPT_NAME);
131 61
 
132
-case 'synchronize':
133
-	if (Filter::checkCsrf()) {
134
-		$basenames = array();
62
+		return;
63
+	case 'setdefault':
64
+		if (Filter::checkCsrf()) {
65
+			Site::setPreference('DEFAULT_GEDCOM', Filter::post('ged'));
66
+			FlashMessages::addMessage(/* I18N: %s is the name of a family tree */ I18N::translate('The family tree “%s” will be shown to visitors when they first arrive at this website.', $WT_TREE->getTitleHtml()), 'success');
67
+		}
68
+		header('Location: ' . WT_BASE_URL . WT_SCRIPT_NAME);
135 69
 
136
-		foreach ($gedcom_files as $gedcom_file) {
137
-			$filemtime   = filemtime($gedcom_file); // Only import files that have changed
138
-			$basename    = basename($gedcom_file);
139
-			$basenames[] = $basename;
70
+		return;
71
+	case 'new_tree':
72
+		$basename   = basename(Filter::post('tree_name'));
73
+		$tree_title = Filter::post('tree_title');
140 74
 
141
-			$tree = Tree::findByName($basename);
142
-			if (!$tree) {
143
-				$tree = Tree::create($basename, $basename);
75
+		if (Filter::checkCsrf() && $basename && $tree_title) {
76
+			if (Tree::findByName($basename)) {
77
+				FlashMessages::addMessage(/* I18N: %s is the name of a family tree */ I18N::translate('The family tree “%s” already exists.', Filter::escapeHtml($basename)), 'danger');
78
+			} else {
79
+				Tree::create($basename, $tree_title);
80
+				FlashMessages::addMessage(/* I18N: %s is the name of a family tree */ I18N::translate('The family tree “%s” has been created.', Filter::escapeHtml($basename)), 'success');
144 81
 			}
145
-			if ($tree->getPreference('filemtime') != $filemtime) {
146
-				$tree->importGedcomFile($gedcom_file, $basename);
147
-				$tree->setPreference('filemtime', $filemtime);
148
-				FlashMessages::addMessage(I18N::translate('The GEDCOM file “%s” has been imported.', Filter::escapeHtml($basename)), 'success');
82
+		}
83
+		header('Location: ' . WT_BASE_URL . WT_SCRIPT_NAME . '?ged=' . Filter::escapeUrl($basename));
84
+
85
+		return;
86
+	case 'replace_upload':
87
+		$gedcom_id          = Filter::postInteger('gedcom_id');
88
+		$keep_media         = Filter::post('keep_media', '1', '0');
89
+		$GEDCOM_MEDIA_PATH  = Filter::post('GEDCOM_MEDIA_PATH');
90
+		$WORD_WRAPPED_NOTES = Filter::post('WORD_WRAPPED_NOTES', '1', '0');
91
+		$tree               = Tree::findById($gedcom_id);
92
+
93
+		if (Filter::checkCsrf() && $tree) {
94
+			$tree->setPreference('keep_media', $keep_media);
95
+			$tree->setPreference('GEDCOM_MEDIA_PATH', $GEDCOM_MEDIA_PATH);
96
+			$tree->setPreference('WORD_WRAPPED_NOTES', $WORD_WRAPPED_NOTES);
97
+			if (isset($_FILES['tree_name'])) {
98
+				if ($_FILES['tree_name']['error'] == 0 && is_readable($_FILES['tree_name']['tmp_name'])) {
99
+					$tree->importGedcomFile($_FILES['tree_name']['tmp_name'], $_FILES['tree_name']['name']);
100
+				} else {
101
+					FlashMessages::addMessage(Functions::fileUploadErrorText($_FILES['tree_name']['error']), 'danger');
102
+				}
103
+			} else {
104
+				FlashMessages::addMessage(I18N::translate('No GEDCOM file was received.'), 'danger');
149 105
 			}
150 106
 		}
151
-
152
-		foreach (Tree::getAll() as $tree) {
153
-			if (!in_array($tree->getName(), $basenames)) {
154
-				FlashMessages::addMessage(I18N::translate('The family tree “%s” has been deleted.', $tree->getTitleHtml()), 'success');
155
-				$tree->delete();
107
+		header('Location: ' . WT_BASE_URL . WT_SCRIPT_NAME);
108
+
109
+		return;
110
+	case 'replace_import':
111
+		$basename           = basename(Filter::post('tree_name'));
112
+		$gedcom_id          = Filter::postInteger('gedcom_id');
113
+		$keep_media         = Filter::post('keep_media', '1', '0');
114
+		$GEDCOM_MEDIA_PATH  = Filter::post('GEDCOM_MEDIA_PATH');
115
+		$WORD_WRAPPED_NOTES = Filter::post('WORD_WRAPPED_NOTES', '1', '0');
116
+		$tree               = Tree::findById($gedcom_id);
117
+
118
+		if (Filter::checkCsrf() && $tree) {
119
+			$tree->setPreference('keep_media', $keep_media);
120
+			$tree->setPreference('GEDCOM_MEDIA_PATH', $GEDCOM_MEDIA_PATH);
121
+			$tree->setPreference('WORD_WRAPPED_NOTES', $WORD_WRAPPED_NOTES);
122
+			if ($basename) {
123
+				$tree->importGedcomFile(WT_DATA_DIR . $basename, $basename);
124
+			} else {
125
+				FlashMessages::addMessage(I18N::translate('No GEDCOM file was received.'), 'danger');
156 126
 			}
157 127
 		}
128
+		header('Location: ' . WT_BASE_URL . WT_SCRIPT_NAME);
129
+
130
+		return;
131
+
132
+	case 'synchronize':
133
+		if (Filter::checkCsrf()) {
134
+			$basenames = array();
135
+
136
+			foreach ($gedcom_files as $gedcom_file) {
137
+				$filemtime   = filemtime($gedcom_file); // Only import files that have changed
138
+				$basename    = basename($gedcom_file);
139
+				$basenames[] = $basename;
140
+
141
+				$tree = Tree::findByName($basename);
142
+				if (!$tree) {
143
+					$tree = Tree::create($basename, $basename);
144
+				}
145
+				if ($tree->getPreference('filemtime') != $filemtime) {
146
+					$tree->importGedcomFile($gedcom_file, $basename);
147
+					$tree->setPreference('filemtime', $filemtime);
148
+					FlashMessages::addMessage(I18N::translate('The GEDCOM file “%s” has been imported.', Filter::escapeHtml($basename)), 'success');
149
+				}
150
+			}
158 151
 
159
-	}
160
-	header('Location: ' . WT_BASE_URL . WT_SCRIPT_NAME);
152
+			foreach (Tree::getAll() as $tree) {
153
+				if (!in_array($tree->getName(), $basenames)) {
154
+					FlashMessages::addMessage(I18N::translate('The family tree “%s” has been deleted.', $tree->getTitleHtml()), 'success');
155
+					$tree->delete();
156
+				}
157
+			}
158
+
159
+		}
160
+		header('Location: ' . WT_BASE_URL . WT_SCRIPT_NAME);
161 161
 
162
-	return;
162
+		return;
163 163
 }
164 164
 
165 165
 $default_tree_title  = /* I18N: Default name for a new tree */ I18N::translate('My family tree');
@@ -173,12 +173,12 @@  discard block
 block discarded – undo
173 173
 
174 174
 // Process GET actions
175 175
 switch (Filter::get('action')) {
176
-case 'importform':
177
-	$controller
178
-		->setPageTitle($WT_TREE->getTitleHtml() . ' — ' . I18N::translate('Import a GEDCOM file'))
179
-		->pageHeader();
176
+	case 'importform':
177
+		$controller
178
+			->setPageTitle($WT_TREE->getTitleHtml() . ' — ' . I18N::translate('Import a GEDCOM file'))
179
+			->pageHeader();
180 180
 
181
-	?>
181
+		?>
182 182
 	<ol class="breadcrumb small">
183 183
 		<li><a href="admin.php"><?php echo I18N::translate('Control panel'); ?></a></li>
184 184
 		<li><a href="admin_trees_manage.php"><?php echo I18N::translate('Manage family trees'); ?></a></li>
@@ -188,14 +188,14 @@  discard block
 block discarded – undo
188 188
 	<h1><?php echo $controller->getPageTitle(); ?></h1>
189 189
 	<?php
190 190
 
191
-	$tree = Tree::findById(Filter::getInteger('gedcom_id'));
192
-	// Check it exists
193
-	if (!$tree) {
194
-		break;
195
-	}
196
-	$gedcom_filename = $tree->getPreference('gedcom_filename')
197
-	?>
198
-	<p>
191
+		$tree = Tree::findById(Filter::getInteger('gedcom_id'));
192
+		// Check it exists
193
+		if (!$tree) {
194
+			break;
195
+		}
196
+		$gedcom_filename = $tree->getPreference('gedcom_filename')
197
+		?>
198
+		<p>
199 199
 		<?php echo /* I18N: %s is the name of a family tree */ I18N::translate('This will delete all the genealogy data from “%s” and replace it with data from a GEDCOM file.', $tree->getTitleHtml()); ?>
200 200
 	</p>
201 201
 	<form class="form form-horizontal" name="gedcomimportform" method="post" enctype="multipart/form-data" onsubmit="return checkGedcomImportForm('<?php echo Filter::escapeHtml(I18N::translate('You have selected a GEDCOM file with a different name. Is this correct?')); ?>');">
@@ -228,35 +228,35 @@  discard block
 block discarded – undo
228 228
 						<div class="input-group">
229 229
 							<span class="input-group-addon">
230 230
 								<?php echo WT_DATA_DIR; ?>
231
-							</span>
231
+								</span>
232 232
 							<?php
233
-							$d     = opendir(WT_DATA_DIR);
234
-							$files = array();
235
-							while (($f = readdir($d)) !== false) {
236
-								if (!is_dir(WT_DATA_DIR . $f) && is_readable(WT_DATA_DIR . $f)) {
237
-									$fp     = fopen(WT_DATA_DIR . $f, 'rb');
238
-									$header = fread($fp, 64);
239
-									fclose($fp);
240
-									if (preg_match('/^(' . WT_UTF8_BOM . ')?0 *HEAD/', $header)) {
241
-										$files[] = $f;
233
+								$d     = opendir(WT_DATA_DIR);
234
+								$files = array();
235
+								while (($f = readdir($d)) !== false) {
236
+									if (!is_dir(WT_DATA_DIR . $f) && is_readable(WT_DATA_DIR . $f)) {
237
+										$fp     = fopen(WT_DATA_DIR . $f, 'rb');
238
+										$header = fread($fp, 64);
239
+										fclose($fp);
240
+										if (preg_match('/^(' . WT_UTF8_BOM . ')?0 *HEAD/', $header)) {
241
+											$files[] = $f;
242
+										}
243
+									}
244
+								}
245
+								echo '<select name="tree_name" class="form-control" id="import-server-file">';
246
+								echo '<option value=""></option>';
247
+								sort($files);
248
+								foreach ($files as $gedcom_file) {
249
+									echo '<option value="', Filter::escapeHtml($gedcom_file), '" ';
250
+									if ($gedcom_file === $gedcom_filename) {
251
+										echo ' selected';
242 252
 									}
253
+									echo'>', Filter::escapeHtml($gedcom_file), '</option>';
243 254
 								}
244
-							}
245
-							echo '<select name="tree_name" class="form-control" id="import-server-file">';
246
-							echo '<option value=""></option>';
247
-							sort($files);
248
-							foreach ($files as $gedcom_file) {
249
-								echo '<option value="', Filter::escapeHtml($gedcom_file), '" ';
250
-								if ($gedcom_file === $gedcom_filename) {
251
-									echo ' selected';
255
+								if (!$files) {
256
+									echo '<option disabled selected>', I18N::translate('No GEDCOM files found.'), '</option>';
252 257
 								}
253
-								echo'>', Filter::escapeHtml($gedcom_file), '</option>';
254
-							}
255
-							if (!$files) {
256
-								echo '<option disabled selected>', I18N::translate('No GEDCOM files found.'), '</option>';
257
-							}
258
-							echo '</select>';
259
-							?>
258
+								echo '</select>';
259
+								?>
260 260
 						</div>
261 261
 					</div>
262 262
 				</div>
@@ -298,7 +298,7 @@  discard block
 block discarded – undo
298 298
 					>
299 299
 				<p class="small text-muted">
300 300
 					<?php echo /* I18N: Help text for the “GEDCOM media path” configuration setting. A “path” is something like “C:\Documents\Genealogy\Photos\John_Smith.jpeg” */ I18N::translate('Some genealogy software creates GEDCOM files that contain media filenames with full paths. These paths will not exist on the web-server. To allow webtrees to find the file, the first part of the path must be removed.'); ?>
301
-					<?php echo /* I18N: Help text for the “GEDCOM media path” configuration setting. %s are all folder names */ I18N::translate('For example, if the GEDCOM file contains %1$s and webtrees expects to find %2$s in the media folder, then you would need to remove %3$s.', '<code>C:\\Documents\\family\\photo.jpeg</code>', '<code>family\\photo.jpeg</code>', '<code>C:\\Documents\\</code>'); ?>
301
+						<?php echo /* I18N: Help text for the “GEDCOM media path” configuration setting. %s are all folder names */ I18N::translate('For example, if the GEDCOM file contains %1$s and webtrees expects to find %2$s in the media folder, then you would need to remove %3$s.', '<code>C:\\Documents\\family\\photo.jpeg</code>', '<code>family\\photo.jpeg</code>', '<code>C:\\Documents\\</code>'); ?>
302 302
 				</p>
303 303
 			</div>
304 304
 		</fieldset>
@@ -313,7 +313,7 @@  discard block
 block discarded – undo
313 313
 	</form>
314 314
 	<?php
315 315
 
316
-	return;
316
+		return;
317 317
 }
318 318
 
319 319
 if (!Tree::getAll()) {
Please login to merge, or discard this patch.
admin_users.php 2 patches
Braces   +5 added lines, -2 removed lines patch added patch discarded remove patch
@@ -791,8 +791,11 @@
 block discarded – undo
791 791
 		<p>
792 792
 		<?php if ($ucnt): ?>
793 793
 			<input type="submit" value="<?php echo I18N::translate('delete'); ?>">
794
-			<?php else: ?>
795
-			<?php echo I18N::translate('Nothing found to cleanup'); ?>
794
+			<?php else {
795
+	: ?>
796
+			<?php echo I18N::translate('Nothing found to cleanup');
797
+}
798
+?>
796 799
 			<?php endif; ?>
797 800
 		</p>
798 801
 	</form>
Please login to merge, or discard this patch.
Switch Indentation   +84 added lines, -84 removed lines patch added patch discarded remove patch
@@ -45,95 +45,95 @@  discard block
 block discarded – undo
45 45
 
46 46
 // Form actions
47 47
 switch (Filter::post('action')) {
48
-case 'save':
49
-	if (Filter::checkCsrf()) {
50
-		$user_id        = Filter::postInteger('user_id');
51
-		$user           = User::find($user_id);
52
-		$username       = Filter::post('username');
53
-		$real_name      = Filter::post('real_name');
54
-		$email          = Filter::postEmail('email');
55
-		$pass1          = Filter::post('pass1', WT_REGEX_PASSWORD);
56
-		$pass2          = Filter::post('pass2', WT_REGEX_PASSWORD);
57
-		$theme          = Filter::post('theme', implode('|', array_keys(Theme::themeNames())), '');
58
-		$language       = Filter::post('language');
59
-		$timezone       = Filter::post('timezone');
60
-		$contact_method = Filter::post('contact_method');
61
-		$comment        = Filter::post('comment');
62
-		$auto_accept    = Filter::postBool('auto_accept');
63
-		$canadmin       = Filter::postBool('canadmin');
64
-		$visible_online = Filter::postBool('visible_online');
65
-		$verified       = Filter::postBool('verified');
66
-		$approved       = Filter::postBool('approved');
67
-
68
-		if ($user_id === 0) {
69
-			// Create a new user
70
-			if (User::findByUserName($username)) {
71
-				FlashMessages::addMessage(I18N::translate('Duplicate username. A user with that username already exists. Please choose another username.'));
72
-			} elseif (User::findByEmail($email)) {
73
-				FlashMessages::addMessage(I18N::translate('Duplicate email address. A user with that email already exists.'));
74
-			} elseif ($pass1 !== $pass2) {
75
-				FlashMessages::addMessage(I18N::translate('The passwords do not match.'));
48
+	case 'save':
49
+		if (Filter::checkCsrf()) {
50
+			$user_id        = Filter::postInteger('user_id');
51
+			$user           = User::find($user_id);
52
+			$username       = Filter::post('username');
53
+			$real_name      = Filter::post('real_name');
54
+			$email          = Filter::postEmail('email');
55
+			$pass1          = Filter::post('pass1', WT_REGEX_PASSWORD);
56
+			$pass2          = Filter::post('pass2', WT_REGEX_PASSWORD);
57
+			$theme          = Filter::post('theme', implode('|', array_keys(Theme::themeNames())), '');
58
+			$language       = Filter::post('language');
59
+			$timezone       = Filter::post('timezone');
60
+			$contact_method = Filter::post('contact_method');
61
+			$comment        = Filter::post('comment');
62
+			$auto_accept    = Filter::postBool('auto_accept');
63
+			$canadmin       = Filter::postBool('canadmin');
64
+			$visible_online = Filter::postBool('visible_online');
65
+			$verified       = Filter::postBool('verified');
66
+			$approved       = Filter::postBool('approved');
67
+
68
+			if ($user_id === 0) {
69
+				// Create a new user
70
+				if (User::findByUserName($username)) {
71
+					FlashMessages::addMessage(I18N::translate('Duplicate username. A user with that username already exists. Please choose another username.'));
72
+				} elseif (User::findByEmail($email)) {
73
+					FlashMessages::addMessage(I18N::translate('Duplicate email address. A user with that email already exists.'));
74
+				} elseif ($pass1 !== $pass2) {
75
+					FlashMessages::addMessage(I18N::translate('The passwords do not match.'));
76
+				} else {
77
+					$user = User::create($username, $real_name, $email, $pass1);
78
+					$user->setPreference('reg_timestamp', date('U'))->setPreference('sessiontime', '0');
79
+					Log::addAuthenticationLog('User ->' . $username . '<- created');
80
+				}
76 81
 			} else {
77
-				$user = User::create($username, $real_name, $email, $pass1);
78
-				$user->setPreference('reg_timestamp', date('U'))->setPreference('sessiontime', '0');
79
-				Log::addAuthenticationLog('User ->' . $username . '<- created');
80
-			}
81
-		} else {
82
-			$user = User::find($user_id);
83
-			if ($user && $username && $real_name) {
84
-				$user->setEmail($email);
85
-				$user->setUserName($username);
86
-				$user->setRealName($real_name);
87
-				if ($pass1 !== null && $pass1 === $pass2) {
88
-					$user->setPassword($pass1);
82
+				$user = User::find($user_id);
83
+				if ($user && $username && $real_name) {
84
+					$user->setEmail($email);
85
+					$user->setUserName($username);
86
+					$user->setRealName($real_name);
87
+					if ($pass1 !== null && $pass1 === $pass2) {
88
+						$user->setPassword($pass1);
89
+					}
89 90
 				}
90 91
 			}
91
-		}
92 92
 
93
-		if ($user) {
94
-			// Approving for the first time? Send a confirmation email
95
-			if ($approved && !$user->getPreference('verified_by_admin') && $user->getPreference('sessiontime') == 0) {
96
-				I18N::init($user->getPreference('language'));
97
-				Mail::systemMessage(
98
-					$WT_TREE,
99
-					$user,
100
-					I18N::translate('Approval of account at %s', WT_BASE_URL),
101
-					I18N::translate('The administrator at the webtrees site %s has approved your application for an account. You may now sign in by accessing the following link: %s', WT_BASE_URL, WT_BASE_URL)
102
-				);
103
-			}
93
+			if ($user) {
94
+				// Approving for the first time? Send a confirmation email
95
+				if ($approved && !$user->getPreference('verified_by_admin') && $user->getPreference('sessiontime') == 0) {
96
+					I18N::init($user->getPreference('language'));
97
+					Mail::systemMessage(
98
+						$WT_TREE,
99
+						$user,
100
+						I18N::translate('Approval of account at %s', WT_BASE_URL),
101
+						I18N::translate('The administrator at the webtrees site %s has approved your application for an account. You may now sign in by accessing the following link: %s', WT_BASE_URL, WT_BASE_URL)
102
+					);
103
+				}
104 104
 
105
-			$user
106
-				->setPreference('theme', $theme)
107
-				->setPreference('language', $language)
108
-				->setPreference('TIMEZONE', $timezone)
109
-				->setPreference('contactmethod', $contact_method)
110
-				->setPreference('comment', $comment)
111
-				->setPreference('auto_accept', $auto_accept ? '1' : '0')
112
-				->setPreference('visibleonline', $visible_online ? '1' : '0')
113
-				->setPreference('verified', $verified ? '1' : '0')
114
-				->setPreference('verified_by_admin', $approved ? '1' : '0');
115
-
116
-			// We cannot change our own admin status. Another admin will need to do it.
117
-			if ($user->getUserId() !== Auth::id()) {
118
-				$user->setPreference('canadmin', $canadmin ? '1' : '0');
119
-			}
105
+				$user
106
+					->setPreference('theme', $theme)
107
+					->setPreference('language', $language)
108
+					->setPreference('TIMEZONE', $timezone)
109
+					->setPreference('contactmethod', $contact_method)
110
+					->setPreference('comment', $comment)
111
+					->setPreference('auto_accept', $auto_accept ? '1' : '0')
112
+					->setPreference('visibleonline', $visible_online ? '1' : '0')
113
+					->setPreference('verified', $verified ? '1' : '0')
114
+					->setPreference('verified_by_admin', $approved ? '1' : '0');
115
+
116
+				// We cannot change our own admin status. Another admin will need to do it.
117
+				if ($user->getUserId() !== Auth::id()) {
118
+					$user->setPreference('canadmin', $canadmin ? '1' : '0');
119
+				}
120 120
 
121
-			foreach (Tree::getAll() as $tree) {
122
-				$tree->setUserPreference($user, 'gedcomid', Filter::post('gedcomid' . $tree->getTreeId(), WT_REGEX_XREF));
123
-				$tree->setUserPreference($user, 'canedit', Filter::post('canedit' . $tree->getTreeId(), implode('|', array_keys($ALL_EDIT_OPTIONS))));
124
-				if (Filter::post('gedcomid' . $tree->getTreeId(), WT_REGEX_XREF)) {
125
-					$tree->setUserPreference($user, 'RELATIONSHIP_PATH_LENGTH', Filter::postInteger('RELATIONSHIP_PATH_LENGTH' . $tree->getTreeId(), 0, 10, 0));
126
-				} else {
127
-					// Do not allow a path length to be set if the individual ID is not
128
-					$tree->setUserPreference($user, 'RELATIONSHIP_PATH_LENGTH', null);
121
+				foreach (Tree::getAll() as $tree) {
122
+					$tree->setUserPreference($user, 'gedcomid', Filter::post('gedcomid' . $tree->getTreeId(), WT_REGEX_XREF));
123
+					$tree->setUserPreference($user, 'canedit', Filter::post('canedit' . $tree->getTreeId(), implode('|', array_keys($ALL_EDIT_OPTIONS))));
124
+					if (Filter::post('gedcomid' . $tree->getTreeId(), WT_REGEX_XREF)) {
125
+						$tree->setUserPreference($user, 'RELATIONSHIP_PATH_LENGTH', Filter::postInteger('RELATIONSHIP_PATH_LENGTH' . $tree->getTreeId(), 0, 10, 0));
126
+					} else {
127
+						// Do not allow a path length to be set if the individual ID is not
128
+						$tree->setUserPreference($user, 'RELATIONSHIP_PATH_LENGTH', null);
129
+					}
129 130
 				}
130 131
 			}
131 132
 		}
132
-	}
133 133
 
134
-	header('Location: ' . WT_BASE_URL . WT_SCRIPT_NAME);
134
+		header('Location: ' . WT_BASE_URL . WT_SCRIPT_NAME);
135 135
 
136
-	return;
136
+		return;
137 137
 }
138 138
 
139 139
 switch (Filter::get('action')) {
@@ -173,12 +173,12 @@  discard block
 block discarded – undo
173 173
 			// Datatables numbers columns 0, 1, 2
174 174
 			// MySQL numbers columns 1, 2, 3
175 175
 			switch ($value['dir']) {
176
-			case 'asc':
177
-				$sql_select .= (1 + $value['column']) . " ASC ";
178
-				break;
179
-			case 'desc':
180
-				$sql_select .= (1 + $value['column']) . " DESC ";
181
-				break;
176
+				case 'asc':
177
+					$sql_select .= (1 + $value['column']) . " ASC ";
178
+					break;
179
+				case 'desc':
180
+					$sql_select .= (1 + $value['column']) . " DESC ";
181
+					break;
182 182
 			}
183 183
 		}
184 184
 	} else {
Please login to merge, or discard this patch.
app/Database.php 1 patch
Spacing   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -85,8 +85,7 @@
 block discarded – undo
85 85
 		// Create the underlying PDO object
86 86
 		self::$pdo = new PDO(
87 87
 			(substr($DBHOST, 0, 1) === '/' ?
88
-				"mysql:unix_socket={$DBHOST};dbname={$DBNAME}" :
89
-				"mysql:host={$DBHOST};dbname={$DBNAME};port={$DBPORT}"
88
+				"mysql:unix_socket={$DBHOST};dbname={$DBNAME}" : "mysql:host={$DBHOST};dbname={$DBNAME};port={$DBPORT}"
90 89
 			),
91 90
 			$DBUSER, $DBPASS,
92 91
 			array(
Please login to merge, or discard this patch.
app/File.php 1 patch
Upper-Lower-Casing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -47,7 +47,7 @@
 block discarded – undo
47 47
 		try {
48 48
 			$fp = fsockopen($scheme . $host, $port, $errno, $errstr, 5);
49 49
 
50
-			fputs($fp, "GET $path?$query HTTP/1.0\r\nHost: $host\r\nConnection: Close\r\n\r\n");
50
+			fputs($fp, "get $path?$query HTTP/1.0\r\nHost: $host\r\nConnection: Close\r\n\r\n");
51 51
 
52 52
 			// The first part of the response include the HTTP headers
53 53
 			$response = fread($fp, 65536);
Please login to merge, or discard this patch.
app/Module/StoriesModule.php 2 patches
Braces   +5 added lines, -2 removed lines patch added patch discarded remove patch
@@ -389,8 +389,11 @@
 block discarded – undo
389 389
 						<a href="<?php echo $individual->getHtmlUrl(); ?>#stories">
390 390
 							<?php echo $individual->getFullName(); ?>
391 391
 						</a>
392
-						<?php else: ?>
393
-							<?php echo $story->xref; ?>
392
+						<?php else {
393
+	: ?>
394
+							<?php echo $story->xref;
395
+}
396
+?>
394 397
 						<?php endif; ?>
395 398
 						</td>
396 399
 						<td>
Please login to merge, or discard this patch.
Switch Indentation   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -50,21 +50,21 @@
 block discarded – undo
50 50
 	 */
51 51
 	public function modAction($mod_action) {
52 52
 		switch ($mod_action) {
53
-		case 'admin_edit':
54
-			$this->edit();
55
-			break;
56
-		case 'admin_delete':
57
-			$this->delete();
58
-			$this->config();
59
-			break;
60
-		case 'admin_config':
61
-			$this->config();
62
-			break;
63
-		case 'show_list':
64
-			$this->showList();
65
-			break;
66
-		default:
67
-			http_response_code(404);
53
+			case 'admin_edit':
54
+				$this->edit();
55
+				break;
56
+			case 'admin_delete':
57
+				$this->delete();
58
+				$this->config();
59
+				break;
60
+			case 'admin_config':
61
+				$this->config();
62
+				break;
63
+			case 'show_list':
64
+				$this->showList();
65
+				break;
66
+			default:
67
+				http_response_code(404);
68 68
 		}
69 69
 	}
70 70
 
Please login to merge, or discard this patch.
calendar.php 2 patches
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.
Switch Indentation   +99 added lines, -99 removed lines patch added patch discarded remove patch
@@ -118,15 +118,15 @@  discard block
 block discarded – undo
118 118
 $controller->setPageTitle(I18N::translate('Anniversary calendar'));
119 119
 
120 120
 switch ($view) {
121
-case 'day':
122
-	$controller->setPageTitle(I18N::translate('On this day…') . ' ' . $ged_date->display(false));
123
-	break;
124
-case 'month':
125
-	$controller->setPageTitle(I18N::translate('In this month…') . ' ' . $ged_date->display(false, '%F %Y'));
126
-	break;
127
-case 'year':
128
-	$controller->setPageTitle(I18N::translate('In this year…') . ' ' . $ged_date->display(false, '%Y'));
129
-	break;
121
+	case 'day':
122
+		$controller->setPageTitle(I18N::translate('On this day…') . ' ' . $ged_date->display(false));
123
+		break;
124
+	case 'month':
125
+		$controller->setPageTitle(I18N::translate('In this month…') . ' ' . $ged_date->display(false, '%F %Y'));
126
+		break;
127
+	case 'year':
128
+		$controller->setPageTitle(I18N::translate('In this year…') . ' ' . $ged_date->display(false, '%Y'));
129
+		break;
130 130
 }
131 131
 
132 132
 $controller->pageHeader();
@@ -329,38 +329,38 @@  discard block
 block discarded – undo
329 329
 $found_facts = array();
330 330
 
331 331
 switch ($view) {
332
-case 'day':
333
-	$found_facts = apply_filter(FunctionsDb::getAnniversaryEvents($cal_date->minJD, $filterev, $WT_TREE), $filterof, $filtersx);
334
-	break;
335
-case 'month':
336
-	$cal_date->d = 0;
337
-	$cal_date->setJdFromYmd();
338
-	// Make a separate list for each day. Unspecified/invalid days go in day 0.
339
-	for ($d = 0; $d <= $days_in_month; ++$d) {
340
-		$found_facts[$d] = array();
341
-	}
342
-	// Fetch events for each day
343
-	for ($jd = $cal_date->minJD; $jd <= $cal_date->maxJD; ++$jd) {
344
-		foreach (apply_filter(FunctionsDb::getAnniversaryEvents($jd, $filterev, $WT_TREE), $filterof, $filtersx) as $fact) {
345
-			$tmp = $fact->getDate()->minimumDate();
346
-			if ($tmp->d >= 1 && $tmp->d <= $tmp->daysInMonth()) {
347
-				// If the day is valid (for its own calendar), display it in the
348
-				// anniversary day (for the display calendar).
349
-				$found_facts[$jd - $cal_date->minJD + 1][] = $fact;
350
-			} else {
351
-				// Otherwise, display it in the "Day not set" box.
352
-				$found_facts[0][] = $fact;
332
+	case 'day':
333
+		$found_facts = apply_filter(FunctionsDb::getAnniversaryEvents($cal_date->minJD, $filterev, $WT_TREE), $filterof, $filtersx);
334
+		break;
335
+	case 'month':
336
+		$cal_date->d = 0;
337
+		$cal_date->setJdFromYmd();
338
+		// Make a separate list for each day. Unspecified/invalid days go in day 0.
339
+		for ($d = 0; $d <= $days_in_month; ++$d) {
340
+			$found_facts[$d] = array();
341
+		}
342
+		// Fetch events for each day
343
+		for ($jd = $cal_date->minJD; $jd <= $cal_date->maxJD; ++$jd) {
344
+			foreach (apply_filter(FunctionsDb::getAnniversaryEvents($jd, $filterev, $WT_TREE), $filterof, $filtersx) as $fact) {
345
+				$tmp = $fact->getDate()->minimumDate();
346
+				if ($tmp->d >= 1 && $tmp->d <= $tmp->daysInMonth()) {
347
+					// If the day is valid (for its own calendar), display it in the
348
+					// anniversary day (for the display calendar).
349
+					$found_facts[$jd - $cal_date->minJD + 1][] = $fact;
350
+				} else {
351
+					// Otherwise, display it in the "Day not set" box.
352
+					$found_facts[0][] = $fact;
353
+				}
353 354
 			}
354 355
 		}
355
-	}
356
-	break;
357
-case 'year':
358
-	$cal_date->m = 0;
359
-	$cal_date->setJdFromYmd();
360
-	$found_facts = apply_filter(FunctionsDb::getCalendarEvents($ged_date->minimumJulianDay(), $ged_date->maximumJulianDay(), $filterev, $WT_TREE), $filterof, $filtersx);
361
-	// Eliminate duplicates (e.g. BET JUL 1900 AND SEP 1900 will appear twice in 1900)
362
-	$found_facts = array_unique($found_facts);
363
-	break;
356
+		break;
357
+	case 'year':
358
+		$cal_date->m = 0;
359
+		$cal_date->setJdFromYmd();
360
+		$found_facts = apply_filter(FunctionsDb::getCalendarEvents($ged_date->minimumJulianDay(), $ged_date->maximumJulianDay(), $filterev, $WT_TREE), $filterof, $filtersx);
361
+		// Eliminate duplicates (e.g. BET JUL 1900 AND SEP 1900 will appear twice in 1900)
362
+		$found_facts = array_unique($found_facts);
363
+		break;
364 364
 }
365 365
 
366 366
 // Group the facts by family/individual
@@ -369,39 +369,39 @@  discard block
 block discarded – undo
369 369
 $cal_facts = array();
370 370
 
371 371
 switch ($view) {
372
-case 'year':
373
-case 'day':
374
-	foreach ($found_facts as $fact) {
375
-		$record = $fact->getParent();
376
-		$xref   = $record->getXref();
377
-		if ($record instanceof Individual) {
378
-			if (empty($indis[$xref])) {
379
-				$indis[$xref] = calendar_fact_text($fact, true);
380
-			} else {
381
-				$indis[$xref] .= '<br>' . calendar_fact_text($fact, true);
382
-			}
383
-		} elseif ($record instanceof Family) {
384
-			if (empty($indis[$xref])) {
385
-				$fams[$xref] = calendar_fact_text($fact, true);
386
-			} else {
387
-				$fams[$xref] .= '<br>' . calendar_fact_text($fact, true);
372
+	case 'year':
373
+	case 'day':
374
+		foreach ($found_facts as $fact) {
375
+			$record = $fact->getParent();
376
+			$xref   = $record->getXref();
377
+			if ($record instanceof Individual) {
378
+				if (empty($indis[$xref])) {
379
+					$indis[$xref] = calendar_fact_text($fact, true);
380
+				} else {
381
+					$indis[$xref] .= '<br>' . calendar_fact_text($fact, true);
382
+				}
383
+			} elseif ($record instanceof Family) {
384
+				if (empty($indis[$xref])) {
385
+					$fams[$xref] = calendar_fact_text($fact, true);
386
+				} else {
387
+					$fams[$xref] .= '<br>' . calendar_fact_text($fact, true);
388
+				}
388 389
 			}
389 390
 		}
390
-	}
391
-	break;
392
-case 'month':
393
-	foreach ($found_facts as $d => $facts) {
394
-		$cal_facts[$d] = array();
395
-		foreach ($facts as $fact) {
396
-			$xref = $fact->getParent()->getXref();
397
-			if (empty($cal_facts[$d][$xref])) {
398
-				$cal_facts[$d][$xref] = calendar_fact_text($fact, false);
399
-			} else {
400
-				$cal_facts[$d][$xref] .= '<br>' . calendar_fact_text($fact, false);
391
+		break;
392
+	case 'month':
393
+		foreach ($found_facts as $d => $facts) {
394
+			$cal_facts[$d] = array();
395
+			foreach ($facts as $fact) {
396
+				$xref = $fact->getParent()->getXref();
397
+				if (empty($cal_facts[$d][$xref])) {
398
+					$cal_facts[$d][$xref] = calendar_fact_text($fact, false);
399
+				} else {
400
+					$cal_facts[$d][$xref] .= '<br>' . calendar_fact_text($fact, false);
401
+				}
401 402
 			}
402 403
 		}
403
-	}
404
-	break;
404
+		break;
405 405
 }
406 406
 
407 407
 switch ($view) {
@@ -498,26 +498,26 @@  discard block
 block discarded – undo
498 498
 			// Show a converted date
499 499
 			foreach (explode('_and_', $CALENDAR_FORMAT) as $convcal) {
500 500
 				switch ($convcal) {
501
-				case 'french':
502
-					$alt_date = new FrenchDate($cal_date->minJD + $d - 1);
503
-					break;
504
-				case 'gregorian':
505
-					$alt_date = new GregorianDate($cal_date->minJD + $d - 1);
506
-					break;
507
-				case 'jewish':
508
-					$alt_date = new JewishDate($cal_date->minJD + $d - 1);
509
-					break;
510
-				case 'julian':
511
-					$alt_date = new JulianDate($cal_date->minJD + $d - 1);
512
-					break;
513
-				case 'hijri':
514
-					$alt_date = new HijriDate($cal_date->minJD + $d - 1);
515
-					break;
516
-				case 'jalali':
517
-					$alt_date = new JalaliDate($cal_date->minJD + $d - 1);
518
-					break;
519
-				default:
520
-					break 2;
501
+					case 'french':
502
+						$alt_date = new FrenchDate($cal_date->minJD + $d - 1);
503
+						break;
504
+					case 'gregorian':
505
+						$alt_date = new GregorianDate($cal_date->minJD + $d - 1);
506
+						break;
507
+					case 'jewish':
508
+						$alt_date = new JewishDate($cal_date->minJD + $d - 1);
509
+						break;
510
+					case 'julian':
511
+						$alt_date = new JulianDate($cal_date->minJD + $d - 1);
512
+						break;
513
+					case 'hijri':
514
+						$alt_date = new HijriDate($cal_date->minJD + $d - 1);
515
+						break;
516
+					case 'jalali':
517
+						$alt_date = new JalaliDate($cal_date->minJD + $d - 1);
518
+						break;
519
+					default:
520
+						break 2;
521 521
 				}
522 522
 				if (get_class($alt_date) !== get_class($cal_date) && $alt_date->inValidRange()) {
523 523
 					echo '<span class="rtl_cal_day">' . $alt_date->format("%j %M") . '</span>';
@@ -627,17 +627,17 @@  discard block
 block discarded – undo
627 627
 		$html .= $tag1 . '<a href="' . $tmp->getHtmlUrl() . '">' . $tmp->getFullName() . '</a> ';
628 628
 		if ($show_sex_symbols && $tmp instanceof Individual) {
629 629
 			switch ($tmp->getSex()) {
630
-			case 'M':
631
-				$html .= '<i class="icon-sex_m_9x9" title="' . I18N::translate('Male') . '"></i>';
632
-				++$males;
633
-				break;
634
-			case 'F':
635
-				$html .= '<i class="icon-sex_f_9x9" title="' . I18N::translate('Female') . '"></i>';
636
-				++$females;
637
-				break;
638
-			default:
639
-				$html .= '<i class="icon-sex_u_9x9" title="' . I18N::translateContext('unknown gender', 'Unknown') . '"></i>';
640
-				break;
630
+				case 'M':
631
+					$html .= '<i class="icon-sex_m_9x9" title="' . I18N::translate('Male') . '"></i>';
632
+					++$males;
633
+					break;
634
+				case 'F':
635
+					$html .= '<i class="icon-sex_f_9x9" title="' . I18N::translate('Female') . '"></i>';
636
+					++$females;
637
+					break;
638
+				default:
639
+					$html .= '<i class="icon-sex_u_9x9" title="' . I18N::translateContext('unknown gender', 'Unknown') . '"></i>';
640
+					break;
641 641
 			}
642 642
 		}
643 643
 		$html .= '<div class="indent">' . $facts . '</div>' . $tag2;
Please login to merge, or discard this patch.
medialist.php 1 patch
Braces   +5 added lines, -2 removed lines patch added patch discarded remove patch
@@ -110,10 +110,13 @@
 block discarded – undo
110 110
 						</option>
111 111
 					</select>
112 112
 				</td>
113
-				<?php else: ?>
113
+				<?php else {
114
+	: ?>
114 115
 					<td class="descriptionbox wrap"></td>
115 116
 					<td class="optionbox wrap"></td>
116
-				<?php endif; ?>
117
+				<?php endif;
118
+}
119
+?>
117 120
 			</tr>
118 121
 			<tr>
119 122
 				<td class="descriptionbox wrap">
Please login to merge, or discard this patch.
search_advanced.php 2 patches
Braces   +92 added lines, -23 removed lines patch added patch discarded remove patch
@@ -154,10 +154,22 @@  discard block
 block discarded – undo
154 154
 				<input type="text" id="value<?php echo $i; ?>" name="values[<?php echo $i; ?>]" value="<?php echo Filter::escapeHtml($controller->getValue($i)); ?>"<?php echo substr($controller->getField($i), -4) == 'PLAC' ? 'data-autocomplete-type="PLAC"' : ''; ?>>
155 155
 			<?php if (preg_match("/^NAME:/", $currentFieldSearch) > 0) { ?>
156 156
 				<select name="fields[<?php echo $i; ?>]">
157
-					<option value="<?php echo $currentField; ?>:EXACT" <?php if (preg_match("/:EXACT$/", $currentFieldSearch) > 0) echo 'selected'; ?>><?php echo I18N::translate('Exact'); ?></option>
158
-					<option value="<?php echo $currentField; ?>:BEGINS" <?php if (preg_match("/:BEGINS$/", $currentFieldSearch) > 0) echo 'selected'; ?>><?php echo I18N::translate('Begins with'); ?></option>
159
-					<option value="<?php echo $currentField; ?>:CONTAINS" <?php if (preg_match("/:CONTAINS$/", $currentFieldSearch) > 0) echo 'selected'; ?>><?php echo I18N::translate('Contains'); ?></option>
160
-					<option value="<?php echo $currentField; ?>:SDX" <?php if (preg_match("/:SDX$/", $currentFieldSearch) > 0) echo 'selected'; ?>><?php echo I18N::translate('Sounds like'); ?></option>
157
+					<option value="<?php echo $currentField; ?>:EXACT" <?php if (preg_match("/:EXACT$/", $currentFieldSearch) > 0) {
158
+	echo 'selected';
159
+}
160
+?>><?php echo I18N::translate('Exact'); ?></option>
161
+					<option value="<?php echo $currentField; ?>:BEGINS" <?php if (preg_match("/:BEGINS$/", $currentFieldSearch) > 0) {
162
+	echo 'selected';
163
+}
164
+?>><?php echo I18N::translate('Begins with'); ?></option>
165
+					<option value="<?php echo $currentField; ?>:CONTAINS" <?php if (preg_match("/:CONTAINS$/", $currentFieldSearch) > 0) {
166
+	echo 'selected';
167
+}
168
+?>><?php echo I18N::translate('Contains'); ?></option>
169
+					<option value="<?php echo $currentField; ?>:SDX" <?php if (preg_match("/:SDX$/", $currentFieldSearch) > 0) {
170
+	echo 'selected';
171
+}
172
+?>><?php echo I18N::translate('Sounds like'); ?></option>
161 173
 				</select>
162 174
 			<?php } else { ?>
163 175
 			<input type="hidden" name="fields[<?php echo $i; ?>]" value="<?php echo $controller->getField($i); ?>">
@@ -166,9 +178,18 @@  discard block
 block discarded – undo
166 178
 				?>
167 179
 				<select name="plusminus[<?php echo $i; ?>]">
168 180
 					<option value=""><?php echo I18N::translate('Exact date'); ?></option>
169
-					<option value="2" <?php if (!empty($controller->plusminus[$i]) && $controller->plusminus[$i] == 2) echo 'selected'; ?>><?php echo I18N::plural('±%s year', '±%s years', 2, I18N::number(2)); ?></option>
170
-					<option value="5" <?php if (!empty($controller->plusminus[$i]) && $controller->plusminus[$i] == 5) echo 'selected'; ?>><?php echo I18N::plural('±%s year', '±%s years', 5, I18N::number(5)); ?></option>
171
-					<option value="10" <?php if (!empty($controller->plusminus[$i]) && $controller->plusminus[$i] == 10) echo 'selected'; ?>><?php echo I18N::plural('±%s year', '±%s years', 10, I18N::number(10)); ?></option>
181
+					<option value="2" <?php if (!empty($controller->plusminus[$i]) && $controller->plusminus[$i] == 2) {
182
+	echo 'selected';
183
+}
184
+?>><?php echo I18N::plural('±%s year', '±%s years', 2, I18N::number(2)); ?></option>
185
+					<option value="5" <?php if (!empty($controller->plusminus[$i]) && $controller->plusminus[$i] == 5) {
186
+	echo 'selected';
187
+}
188
+?>><?php echo I18N::plural('±%s year', '±%s years', 5, I18N::number(5)); ?></option>
189
+					<option value="10" <?php if (!empty($controller->plusminus[$i]) && $controller->plusminus[$i] == 10) {
190
+	echo 'selected';
191
+}
192
+?>><?php echo I18N::plural('±%s year', '±%s years', 10, I18N::number(10)); ?></option>
172 193
 				</select>
173 194
 			<?php } ?>
174 195
 		</td>
@@ -216,10 +237,22 @@  discard block
 block discarded – undo
216 237
 		<td class="list_value">
217 238
 			<input type="text" name="values[<?php echo $j; ?>]" value="<?php echo $controller->getValue($controller->getIndex('FAMC:HUSB:NAME:GIVN:' . $fatherGivnOption)); ?>">
218 239
 			<select name="fields[<?php echo $j; ?>]">
219
-				<option value="FAMC:HUSB:NAME:GIVN:EXACT" <?php if ($fatherGivnOption == 'EXACT') echo 'selected'; ?>><?php echo I18N::translate('Exact'); ?></option>
220
-				<option value="FAMC:HUSB:NAME:GIVN:BEGINS" <?php if ($fatherGivnOption == 'BEGINS') echo 'selected'; ?>><?php echo I18N::translate('Begins with'); ?></option>
221
-				<option value="FAMC:HUSB:NAME:GIVN:CONTAINS" <?php if ($fatherGivnOption == 'CONTAINS') echo 'selected'; ?>><?php echo I18N::translate('Contains'); ?></option>
222
-				<option value="FAMC:HUSB:NAME:GIVN:SDX" <?php if ($fatherGivnOption == 'SDX') echo 'selected'; ?>><?php echo I18N::translate('Sounds like'); ?></option>
240
+				<option value="FAMC:HUSB:NAME:GIVN:EXACT" <?php if ($fatherGivnOption == 'EXACT') {
241
+	echo 'selected';
242
+}
243
+?>><?php echo I18N::translate('Exact'); ?></option>
244
+				<option value="FAMC:HUSB:NAME:GIVN:BEGINS" <?php if ($fatherGivnOption == 'BEGINS') {
245
+	echo 'selected';
246
+}
247
+?>><?php echo I18N::translate('Begins with'); ?></option>
248
+				<option value="FAMC:HUSB:NAME:GIVN:CONTAINS" <?php if ($fatherGivnOption == 'CONTAINS') {
249
+	echo 'selected';
250
+}
251
+?>><?php echo I18N::translate('Contains'); ?></option>
252
+				<option value="FAMC:HUSB:NAME:GIVN:SDX" <?php if ($fatherGivnOption == 'SDX') {
253
+	echo 'selected';
254
+}
255
+?>><?php echo I18N::translate('Sounds like'); ?></option>
223 256
 			</select>
224 257
 		</td>
225 258
 	</tr>
@@ -231,10 +264,22 @@  discard block
 block discarded – undo
231 264
 		<td class="list_value">
232 265
 			<input type="text" name="values[<?php echo $j; ?>]" value="<?php echo $controller->getValue($controller->getIndex('FAMC:HUSB:NAME:SURN:' . $fatherSurnOption)); ?>">
233 266
 			<select name="fields[<?php echo $j; ?>]">
234
-				<option value="FAMC:HUSB:NAME:SURN:EXACT" <?php if ($fatherSurnOption == 'EXACT') echo 'selected'; ?>><?php echo I18N::translate('Exact'); ?></option>
235
-				<option value="FAMC:HUSB:NAME:SURN:BEGINS" <?php if ($fatherSurnOption == 'BEGINS') echo 'selected'; ?>><?php echo I18N::translate('Begins with'); ?></option>
236
-				<option value="FAMC:HUSB:NAME:SURN:CONTAINS" <?php if ($fatherSurnOption == 'CONTAINS') echo 'selected'; ?>><?php echo I18N::translate('Contains'); ?></option>
237
-				<option value="FAMC:HUSB:NAME:SURN:SDX" <?php if ($fatherSurnOption == 'SDX') echo 'selected'; ?>><?php echo I18N::translate('Sounds like'); ?></option>
267
+				<option value="FAMC:HUSB:NAME:SURN:EXACT" <?php if ($fatherSurnOption == 'EXACT') {
268
+	echo 'selected';
269
+}
270
+?>><?php echo I18N::translate('Exact'); ?></option>
271
+				<option value="FAMC:HUSB:NAME:SURN:BEGINS" <?php if ($fatherSurnOption == 'BEGINS') {
272
+	echo 'selected';
273
+}
274
+?>><?php echo I18N::translate('Begins with'); ?></option>
275
+				<option value="FAMC:HUSB:NAME:SURN:CONTAINS" <?php if ($fatherSurnOption == 'CONTAINS') {
276
+	echo 'selected';
277
+}
278
+?>><?php echo I18N::translate('Contains'); ?></option>
279
+				<option value="FAMC:HUSB:NAME:SURN:SDX" <?php if ($fatherSurnOption == 'SDX') {
280
+	echo 'selected';
281
+}
282
+?>><?php echo I18N::translate('Sounds like'); ?></option>
238 283
 			</select>
239 284
 		</td>
240 285
 	</tr>
@@ -252,10 +297,22 @@  discard block
 block discarded – undo
252 297
 		<td class="list_value">
253 298
 			<input type="text" name="values[<?php echo $j; ?>]" value="<?php echo $controller->getValue($controller->getIndex('FAMC:WIFE:NAME:GIVN:' . $motherGivnOption)); ?>">
254 299
 			<select name="fields[<?php echo $j; ?>]">
255
-				<option value="FAMC:WIFE:NAME:GIVN:EXACT" <?php if ($motherGivnOption == 'EXACT') echo 'selected'; ?>><?php echo I18N::translate('Exact'); ?></option>
256
-				<option value="FAMC:WIFE:NAME:GIVN:BEGINS" <?php if ($motherGivnOption == 'BEGINS') echo 'selected'; ?>><?php echo I18N::translate('Begins with'); ?></option>
257
-				<option value="FAMC:WIFE:NAME:GIVN:CONTAINS" <?php if ($motherGivnOption == 'CONTAINS') echo 'selected'; ?>><?php echo I18N::translate('Contains'); ?></option>
258
-				<option value="FAMC:WIFE:NAME:GIVN:SDX" <?php if ($motherGivnOption == 'SDX') echo 'selected'; ?>><?php echo I18N::translate('Sounds like'); ?></option>
300
+				<option value="FAMC:WIFE:NAME:GIVN:EXACT" <?php if ($motherGivnOption == 'EXACT') {
301
+	echo 'selected';
302
+}
303
+?>><?php echo I18N::translate('Exact'); ?></option>
304
+				<option value="FAMC:WIFE:NAME:GIVN:BEGINS" <?php if ($motherGivnOption == 'BEGINS') {
305
+	echo 'selected';
306
+}
307
+?>><?php echo I18N::translate('Begins with'); ?></option>
308
+				<option value="FAMC:WIFE:NAME:GIVN:CONTAINS" <?php if ($motherGivnOption == 'CONTAINS') {
309
+	echo 'selected';
310
+}
311
+?>><?php echo I18N::translate('Contains'); ?></option>
312
+				<option value="FAMC:WIFE:NAME:GIVN:SDX" <?php if ($motherGivnOption == 'SDX') {
313
+	echo 'selected';
314
+}
315
+?>><?php echo I18N::translate('Sounds like'); ?></option>
259 316
 			</select>
260 317
 		</td>
261 318
 		<?php $j++; ?>
@@ -267,10 +324,22 @@  discard block
 block discarded – undo
267 324
 		<td class="list_value">
268 325
 			<input type="text" name="values[<?php echo $j; ?>]" value="<?php echo $controller->getValue($controller->getIndex('FAMC:WIFE:NAME:SURN:' . $motherSurnOption)); ?>">
269 326
 			<select name="fields[<?php echo $j; ?>]">
270
-				<option value="FAMC:WIFE:NAME:SURN:EXACT" <?php if ($motherSurnOption == 'EXACT') echo 'selected'; ?>><?php echo I18N::translate('Exact'); ?></option>
271
-				<option value="FAMC:WIFE:NAME:SURN:BEGINS" <?php if ($motherSurnOption == 'BEGINS') echo 'selected'; ?>><?php echo I18N::translate('Begins with'); ?></option>
272
-				<option value="FAMC:WIFE:NAME:SURN:CONTAINS" <?php if ($motherSurnOption == 'CONTAINS') 'selected'; ?>><?php echo I18N::translate('Contains'); ?></option>
273
-				<option value="FAMC:WIFE:NAME:SURN:SDX" <?php if ($motherSurnOption == 'SDX') echo 'selected'; ?>><?php echo I18N::translate('Sounds like'); ?></option>
327
+				<option value="FAMC:WIFE:NAME:SURN:EXACT" <?php if ($motherSurnOption == 'EXACT') {
328
+	echo 'selected';
329
+}
330
+?>><?php echo I18N::translate('Exact'); ?></option>
331
+				<option value="FAMC:WIFE:NAME:SURN:BEGINS" <?php if ($motherSurnOption == 'BEGINS') {
332
+	echo 'selected';
333
+}
334
+?>><?php echo I18N::translate('Begins with'); ?></option>
335
+				<option value="FAMC:WIFE:NAME:SURN:CONTAINS" <?php if ($motherSurnOption == 'CONTAINS') {
336
+	'selected';
337
+}
338
+?>><?php echo I18N::translate('Contains'); ?></option>
339
+				<option value="FAMC:WIFE:NAME:SURN:SDX" <?php if ($motherSurnOption == 'SDX') {
340
+	echo 'selected';
341
+}
342
+?>><?php echo I18N::translate('Sounds like'); ?></option>
274 343
 			</select>
275 344
 		</td>
276 345
 		<?php $j++; ?>
Please login to merge, or discard this patch.
Switch Indentation   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -185,18 +185,18 @@
 block discarded – undo
185 185
 				$searchField  = $controller->getField($k);
186 186
 				$searchOption = substr($searchField, 20); // Assume we have something like "FAMC:HUSB:NAME:GIVN:foo"
187 187
 				switch (substr($searchField, 0, 20)) {
188
-				case 'FAMC:HUSB:NAME:GIVN:':
189
-					$fatherGivnOption = $searchOption;
190
-					break;
191
-				case 'FAMC:HUSB:NAME:SURN:':
192
-					$fatherSurnOption = $searchOption;
193
-					break;
194
-				case 'FAMC:WIFE:NAME:GIVN:':
195
-					$motherGivnOption = $searchOption;
196
-					break;
197
-				case 'FAMC:WIFE:NAME:SURN:':
198
-					$motherSurnOption = $searchOption;
199
-					break;
188
+					case 'FAMC:HUSB:NAME:GIVN:':
189
+						$fatherGivnOption = $searchOption;
190
+						break;
191
+					case 'FAMC:HUSB:NAME:SURN:':
192
+						$fatherSurnOption = $searchOption;
193
+						break;
194
+					case 'FAMC:WIFE:NAME:GIVN:':
195
+						$motherGivnOption = $searchOption;
196
+						break;
197
+					case 'FAMC:WIFE:NAME:SURN:':
198
+						$motherSurnOption = $searchOption;
199
+						break;
200 200
 				}
201 201
 			}
202 202
 			?>
Please login to merge, or discard this patch.
admin.php 1 patch
Braces   +35 added lines, -14 removed lines patch added patch discarded remove patch
@@ -611,8 +611,11 @@  discard block
 block discarded – undo
611 611
 					<a href="admin_site_upgrade.php" class="error">
612 612
 						<?php echo /* I18N: %s is a version number */ I18N::translate('Upgrade to webtrees %s.', Filter::escapeHtml($latest_version)); ?>
613 613
 					</a>
614
-					<?php else: ?>
615
-						<?php echo I18N::translate('This is the latest version of webtrees. No upgrade is available.'); ?>
614
+					<?php else {
615
+	: ?>
616
+						<?php echo I18N::translate('This is the latest version of webtrees. No upgrade is available.');
617
+}
618
+?>
616 619
 					<?php endif; ?>
617 620
 				</p>
618 621
 				<?php endif; ?>
@@ -774,9 +777,12 @@  discard block
 block discarded – undo
774 777
 									<?php echo I18N::number($changes[$tree->getTreeId()]); ?>
775 778
 									<span class="sr-only"><?php echo I18N::translate('Pending changes'); ?> <?php echo $tree->getTitleHtml(); ?></span>
776 779
 								</a>
777
-								<?php else: ?>
780
+								<?php else {
781
+	: ?>
778 782
 								-
779
-								<?php endif; ?>
783
+								<?php endif;
784
+}
785
+?>
780 786
 							</td>
781 787
 							<td class="text-right flip">
782 788
 								<?php if ($individuals[$tree->getTreeId()]): ?>
@@ -784,9 +790,12 @@  discard block
 block discarded – undo
784 790
 									<?php echo I18N::number($individuals[$tree->getTreeId()]); ?>
785 791
 									<span class="sr-only"><?php echo I18N::translate('Individuals'); ?> <?php echo $tree->getTitleHtml(); ?></span>
786 792
 								</a>
787
-								<?php else: ?>
793
+								<?php else {
794
+	: ?>
788 795
 									-
789
-								<?php endif; ?>
796
+								<?php endif;
797
+}
798
+?>
790 799
 								</td>
791 800
 							<td class="text-right flip">
792 801
 								<?php if ($families[$tree->getTreeId()]): ?>
@@ -794,9 +803,12 @@  discard block
 block discarded – undo
794 803
 									<?php echo I18N::number($families[$tree->getTreeId()]); ?>
795 804
 									<span class="sr-only"><?php echo I18N::translate('Families'); ?> <?php echo $tree->getTitleHtml(); ?></span>
796 805
 								</a>
797
-								<?php else: ?>
806
+								<?php else {
807
+	: ?>
798 808
 								-
799
-								<?php endif; ?>
809
+								<?php endif;
810
+}
811
+?>
800 812
 								</td>
801 813
 							<td class="text-right flip">
802 814
 								<?php if ($sources[$tree->getTreeId()]): ?>
@@ -804,9 +816,12 @@  discard block
 block discarded – undo
804 816
 									<?php echo I18N::number($sources[$tree->getTreeId()]); ?>
805 817
 									<span class="sr-only"><?php echo I18N::translate('Sources'); ?> <?php echo $tree->getTitleHtml(); ?></span>
806 818
 								</a>
807
-								<?php else: ?>
819
+								<?php else {
820
+	: ?>
808 821
 								-
809
-								<?php endif; ?>
822
+								<?php endif;
823
+}
824
+?>
810 825
 							</td>
811 826
 							<td class="text-right flip">
812 827
 								<?php if ($repositories[$tree->getTreeId()]): ?>
@@ -814,9 +829,12 @@  discard block
 block discarded – undo
814 829
 									<?php echo I18N::number($repositories[$tree->getTreeId()]); ?>
815 830
 									<span class="sr-only"><?php echo I18N::translate('Repositories'); ?> <?php echo $tree->getTitleHtml(); ?></span>
816 831
 								</a>
817
-								<?php else: ?>
832
+								<?php else {
833
+	: ?>
818 834
 									-
819
-								<?php endif; ?>
835
+								<?php endif;
836
+}
837
+?>
820 838
 							</td>
821 839
 							<td class="text-right flip">
822 840
 								<?php if ($media[$tree->getTreeId()]): ?>
@@ -824,9 +842,12 @@  discard block
 block discarded – undo
824 842
 									<?php echo I18N::number($media[$tree->getTreeId()]); ?>
825 843
 									<span class="sr-only"><?php echo I18N::translate('Media objects'); ?> <?php echo $tree->getTitleHtml(); ?></span>
826 844
 								</a>
827
-								<?php else: ?>
845
+								<?php else {
846
+	: ?>
828 847
 								-
829
-								<?php endif; ?>
848
+								<?php endif;
849
+}
850
+?>
830 851
 							</td>
831 852
 						</tr>
832 853
 						<?php endforeach; ?>
Please login to merge, or discard this patch.