Completed
Push — 1.7 ( c3b8e7...0a3d97 )
by
unknown
08:31
created
admin_site_change.php 1 patch
Switch Indentation   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -151,12 +151,12 @@  discard block
 block discarded – undo
151 151
 			// Datatables numbers columns 0, 1, 2
152 152
 			// MySQL numbers columns 1, 2, 3
153 153
 			switch ($value['dir']) {
154
-			case 'asc':
155
-				$order_by .= (1 + $value['column']) . " ASC ";
156
-				break;
157
-			case 'desc':
158
-				$order_by .= (1 + $value['column']) . " DESC ";
159
-				break;
154
+				case 'asc':
155
+					$order_by .= (1 + $value['column']) . " ASC ";
156
+					break;
157
+				case 'desc':
158
+					$order_by .= (1 + $value['column']) . " DESC ";
159
+					break;
160 160
 			}
161 161
 		}
162 162
 	} else {
@@ -190,14 +190,14 @@  discard block
 block discarded – undo
190 190
 
191 191
 		foreach ($differences as $difference) {
192 192
 			switch ($difference[1]) {
193
-			case MyersDiff::DELETE:
194
-				$diff_lines[] = '<del>' . $difference[0] . '</del>';
195
-				break;
196
-			case MyersDiff::INSERT:
197
-				$diff_lines[] = '<ins>' . $difference[0] . '</ins>';
198
-				break;
199
-			default:
200
-				$diff_lines[] = $difference[0];
193
+				case MyersDiff::DELETE:
194
+					$diff_lines[] = '<del>' . $difference[0] . '</del>';
195
+					break;
196
+				case MyersDiff::INSERT:
197
+					$diff_lines[] = '<ins>' . $difference[0] . '</ins>';
198
+					break;
199
+				default:
200
+					$diff_lines[] = $difference[0];
201 201
 			}
202 202
 		}
203 203
 
Please login to merge, or discard this patch.
mediafirewall.php 1 patch
Switch Indentation   +41 added lines, -41 removed lines patch added patch discarded remove patch
@@ -126,53 +126,53 @@
 block discarded – undo
126 126
 
127 127
 	// vertical and horizontal position of the text
128 128
 	switch ($vpos) {
129
-	default:
130
-	case 'top':
131
-		$taille   = textlength($maxsize, $width, $text);
132
-		$pos_y    = $height * 0.15 + $taille;
133
-		$pos_x    = $width * 0.15;
134
-		$rotation = 0;
135
-		break;
136
-	case 'middle':
137
-		$taille   = textlength($maxsize, $width, $text);
138
-		$pos_y    = ($height + $taille) / 2;
139
-		$pos_x    = $width * 0.15;
140
-		$rotation = 0;
141
-		break;
142
-	case 'bottom':
143
-		$taille   = textlength($maxsize, $width, $text);
144
-		$pos_y    = ($height * .85 - $taille);
145
-		$pos_x    = $width * 0.15;
146
-		$rotation = 0;
147
-		break;
148
-	case 'across':
149
-		switch ($hpos) {
150 129
 		default:
151
-		case 'left':
152
-			$taille   = textlength($maxsize, $hypoth, $text);
153
-			$pos_y    = ($height * .85 - $taille);
130
+		case 'top':
131
+			$taille   = textlength($maxsize, $width, $text);
132
+			$pos_y    = $height * 0.15 + $taille;
154 133
 			$pos_x    = $width * 0.15;
155
-			$rotation = $calc_angle;
134
+			$rotation = 0;
156 135
 			break;
157
-		case 'right':
158
-			$taille   = textlength($maxsize, $hypoth, $text);
159
-			$pos_y    = ($height * .15 - $taille);
160
-			$pos_x    = $width * 0.85;
161
-			$rotation = $calc_angle + 180;
162
-			break;
163
-		case 'top2bottom':
164
-			$taille   = textlength($maxsize, $height, $text);
165
-			$pos_y    = ($height * .15 - $taille);
166
-			$pos_x    = ($width * .90 - $taille);
167
-			$rotation = -90;
136
+		case 'middle':
137
+			$taille   = textlength($maxsize, $width, $text);
138
+			$pos_y    = ($height + $taille) / 2;
139
+			$pos_x    = $width * 0.15;
140
+			$rotation = 0;
168 141
 			break;
169
-		case 'bottom2top':
170
-			$taille   = textlength($maxsize, $height, $text);
171
-			$pos_y    = $height * 0.85;
142
+		case 'bottom':
143
+			$taille   = textlength($maxsize, $width, $text);
144
+			$pos_y    = ($height * .85 - $taille);
172 145
 			$pos_x    = $width * 0.15;
173
-			$rotation = 90;
146
+			$rotation = 0;
174 147
 			break;
175
-		}
148
+		case 'across':
149
+			switch ($hpos) {
150
+				default:
151
+				case 'left':
152
+					$taille   = textlength($maxsize, $hypoth, $text);
153
+					$pos_y    = ($height * .85 - $taille);
154
+					$pos_x    = $width * 0.15;
155
+					$rotation = $calc_angle;
156
+					break;
157
+				case 'right':
158
+					$taille   = textlength($maxsize, $hypoth, $text);
159
+					$pos_y    = ($height * .15 - $taille);
160
+					$pos_x    = $width * 0.85;
161
+					$rotation = $calc_angle + 180;
162
+					break;
163
+				case 'top2bottom':
164
+					$taille   = textlength($maxsize, $height, $text);
165
+					$pos_y    = ($height * .15 - $taille);
166
+					$pos_x    = ($width * .90 - $taille);
167
+					$rotation = -90;
168
+					break;
169
+				case 'bottom2top':
170
+					$taille   = textlength($maxsize, $height, $text);
171
+					$pos_y    = $height * 0.85;
172
+					$pos_x    = $width * 0.15;
173
+					$rotation = 90;
174
+					break;
175
+			}
176 176
 		break;
177 177
 	}
178 178
 
Please login to merge, or discard this patch.
admin_media.php 1 patch
Switch Indentation   +93 added lines, -93 removed lines patch added patch discarded remove patch
@@ -85,98 +85,98 @@  discard block
 block discarded – undo
85 85
 ////////////////////////////////////////////////////////////////////////////////
86 86
 
87 87
 switch ($action) {
88
-case 'load_json':
89
-	$search = Filter::get('search');
90
-	$search = $search['value'];
91
-	$start  = Filter::getInteger('start');
92
-	$length = Filter::getInteger('length');
93
-
94
-	switch ($files) {
95
-	case 'local':
96
-		// Filtered rows
97
-		$SELECT1 =
98
-			"SELECT SQL_CACHE SQL_CALC_FOUND_ROWS TRIM(LEADING :media_path_1 FROM m_filename) AS media_path, m_id AS xref, m_titl, m_file AS gedcom_id, m_gedcom AS gedcom" .
99
-			" FROM  `##media`" .
100
-			" JOIN  `##gedcom_setting` ON (m_file = gedcom_id AND setting_name = 'MEDIA_DIRECTORY')" .
101
-			" JOIN  `##gedcom` USING (gedcom_id)" .
102
-			" WHERE setting_value = :media_folder" .
103
-			" AND   m_filename LIKE CONCAT(:media_path_2, '%')" .
104
-			" AND   (SUBSTRING_INDEX(m_filename, '/', -1) LIKE CONCAT('%', :search_1, '%')" .
105
-			"  OR   m_titl LIKE CONCAT('%', :search_2, '%'))" .
106
-			" AND   m_filename NOT LIKE 'http://%'" .
107
-			" AND   m_filename NOT LIKE 'https://%'";
108
-		$ARGS1 = array(
109
-			'media_path_1' => $media_path,
110
-			'media_folder' => $media_folder,
111
-			'media_path_2' => Filter::escapeLike($media_path),
112
-			'search_1'     => Filter::escapeLike($search),
113
-			'search_2'     => Filter::escapeLike($search),
114
-		);
115
-		// Unfiltered rows
116
-		$SELECT2 =
117
-			"SELECT SQL_CACHE COUNT(*)" .
118
-			" FROM  `##media`" .
119
-			" JOIN  `##gedcom_setting` ON (m_file = gedcom_id AND setting_name = 'MEDIA_DIRECTORY')" .
120
-			" WHERE setting_value = :media_folder" .
121
-			" AND   m_filename LIKE CONCAT(:media_path_3, '%')" .
122
-			" AND   m_filename NOT LIKE 'http://%'" .
123
-			" AND   m_filename NOT LIKE 'https://%'";
124
-		$ARGS2 = array(
125
-			'media_folder' => $media_folder,
126
-			'media_path_3' => $media_path,
127
-		);
128
-
129
-		if ($subfolders == 'exclude') {
130
-			$SELECT1 .= " AND m_filename NOT LIKE CONCAT(:media_path_4, '%/%')";
131
-			$ARGS1['media_path_4'] = Filter::escapeLike($media_path);
132
-			$SELECT2 .= " AND m_filename NOT LIKE CONCAT(:media_path_4, '%/%')";
133
-			$ARGS2['media_path_4'] = Filter::escapeLike($media_path);
134
-		}
135
-
136
-		$order = Filter::getArray('order');
137
-		$SELECT1 .= " ORDER BY ";
138
-		if ($order) {
139
-			foreach ($order as $key => $value) {
140
-				if ($key > 0) {
141
-					$SELECT1 .= ',';
88
+	case 'load_json':
89
+		$search = Filter::get('search');
90
+		$search = $search['value'];
91
+		$start  = Filter::getInteger('start');
92
+		$length = Filter::getInteger('length');
93
+
94
+		switch ($files) {
95
+			case 'local':
96
+				// Filtered rows
97
+				$SELECT1 =
98
+					"SELECT SQL_CACHE SQL_CALC_FOUND_ROWS TRIM(LEADING :media_path_1 FROM m_filename) AS media_path, m_id AS xref, m_titl, m_file AS gedcom_id, m_gedcom AS gedcom" .
99
+					" FROM  `##media`" .
100
+					" JOIN  `##gedcom_setting` ON (m_file = gedcom_id AND setting_name = 'MEDIA_DIRECTORY')" .
101
+					" JOIN  `##gedcom` USING (gedcom_id)" .
102
+					" WHERE setting_value = :media_folder" .
103
+					" AND   m_filename LIKE CONCAT(:media_path_2, '%')" .
104
+					" AND   (SUBSTRING_INDEX(m_filename, '/', -1) LIKE CONCAT('%', :search_1, '%')" .
105
+					"  OR   m_titl LIKE CONCAT('%', :search_2, '%'))" .
106
+					" AND   m_filename NOT LIKE 'http://%'" .
107
+					" AND   m_filename NOT LIKE 'https://%'";
108
+				$ARGS1 = array(
109
+					'media_path_1' => $media_path,
110
+					'media_folder' => $media_folder,
111
+					'media_path_2' => Filter::escapeLike($media_path),
112
+					'search_1'     => Filter::escapeLike($search),
113
+					'search_2'     => Filter::escapeLike($search),
114
+				);
115
+				// Unfiltered rows
116
+				$SELECT2 =
117
+					"SELECT SQL_CACHE COUNT(*)" .
118
+					" FROM  `##media`" .
119
+					" JOIN  `##gedcom_setting` ON (m_file = gedcom_id AND setting_name = 'MEDIA_DIRECTORY')" .
120
+					" WHERE setting_value = :media_folder" .
121
+					" AND   m_filename LIKE CONCAT(:media_path_3, '%')" .
122
+					" AND   m_filename NOT LIKE 'http://%'" .
123
+					" AND   m_filename NOT LIKE 'https://%'";
124
+				$ARGS2 = array(
125
+					'media_folder' => $media_folder,
126
+					'media_path_3' => $media_path,
127
+				);
128
+
129
+				if ($subfolders == 'exclude') {
130
+					$SELECT1 .= " AND m_filename NOT LIKE CONCAT(:media_path_4, '%/%')";
131
+					$ARGS1['media_path_4'] = Filter::escapeLike($media_path);
132
+					$SELECT2 .= " AND m_filename NOT LIKE CONCAT(:media_path_4, '%/%')";
133
+					$ARGS2['media_path_4'] = Filter::escapeLike($media_path);
142 134
 				}
143
-				// Datatables numbers columns 0, 1, 2
144
-				// MySQL numbers columns 1, 2, 3
145
-				switch ($value['dir']) {
146
-				case 'asc':
147
-					$SELECT1 .= ":col_" . $key . " ASC";
148
-					break;
149
-				case 'desc':
150
-					$SELECT1 .= ":col_" . $key . " DESC";
151
-					break;
135
+
136
+				$order = Filter::getArray('order');
137
+				$SELECT1 .= " ORDER BY ";
138
+				if ($order) {
139
+					foreach ($order as $key => $value) {
140
+						if ($key > 0) {
141
+							$SELECT1 .= ',';
142
+						}
143
+						// Datatables numbers columns 0, 1, 2
144
+						// MySQL numbers columns 1, 2, 3
145
+						switch ($value['dir']) {
146
+							case 'asc':
147
+								$SELECT1 .= ":col_" . $key . " ASC";
148
+								break;
149
+							case 'desc':
150
+								$SELECT1 .= ":col_" . $key . " DESC";
151
+								break;
152
+						}
153
+					$ARGS1['col_' . $key] = 1 + $value['column'];
152 154
 				}
153
-				$ARGS1['col_' . $key] = 1 + $value['column'];
155
+			} else {
156
+				$SELECT1 = " 1 ASC";
154 157
 			}
155
-		} else {
156
-			$SELECT1 = " 1 ASC";
157
-		}
158 158
 
159
-		if ($length > 0) {
160
-			$SELECT1 .= " LIMIT :length OFFSET :start";
161
-			$ARGS1['length'] = $length;
162
-			$ARGS1['start']  = $start;
163
-		}
164
-
165
-		$rows = Database::prepare($SELECT1)->execute($ARGS1)->fetchAll();
166
-		// Total filtered/unfiltered rows
167
-		$recordsFiltered = Database::prepare("SELECT FOUND_ROWS()")->fetchOne();
168
-		$recordsTotal    = Database::prepare($SELECT2)->execute($ARGS2)->fetchOne();
159
+			if ($length > 0) {
160
+				$SELECT1 .= " LIMIT :length OFFSET :start";
161
+				$ARGS1['length'] = $length;
162
+				$ARGS1['start']  = $start;
163
+			}
169 164
 
170
-		$data = array();
171
-		foreach ($rows as $row) {
172
-			$media  = Media::getInstance($row->xref, Tree::findById($row->gedcom_id), $row->gedcom);
173
-			$data[] = array(
174
-				mediaFileInfo($media_folder, $media_path, $row->media_path),
175
-				$media->displayImage(),
176
-				mediaObjectInfo($media),
177
-			);
178
-		}
179
-		break;
165
+			$rows = Database::prepare($SELECT1)->execute($ARGS1)->fetchAll();
166
+			// Total filtered/unfiltered rows
167
+			$recordsFiltered = Database::prepare("SELECT FOUND_ROWS()")->fetchOne();
168
+			$recordsTotal    = Database::prepare($SELECT2)->execute($ARGS2)->fetchOne();
169
+
170
+			$data = array();
171
+			foreach ($rows as $row) {
172
+				$media  = Media::getInstance($row->xref, Tree::findById($row->gedcom_id), $row->gedcom);
173
+				$data[] = array(
174
+					mediaFileInfo($media_folder, $media_path, $row->media_path),
175
+					$media->displayImage(),
176
+					mediaObjectInfo($media),
177
+				);
178
+			}
179
+			break;
180 180
 
181 181
 	case 'external':
182 182
 		// Filtered rows
@@ -206,12 +206,12 @@  discard block
 block discarded – undo
206 206
 				// Datatables numbers columns 0, 1, 2
207 207
 				// MySQL numbers columns 1, 2, 3
208 208
 				switch ($value['dir']) {
209
-				case 'asc':
210
-					$SELECT1 .= ":col_" . $key . " ASC";
211
-					break;
212
-				case 'desc':
213
-					$SELECT1 .= ":col_" . $key . " DESC";
214
-					break;
209
+					case 'asc':
210
+						$SELECT1 .= ":col_" . $key . " ASC";
211
+						break;
212
+					case 'desc':
213
+						$SELECT1 .= ":col_" . $key . " DESC";
214
+						break;
215 215
 				}
216 216
 				$ARGS1['col_' . $key] = 1 + $value['column'];
217 217
 			}
Please login to merge, or discard this patch.
reportengine.php 1 patch
Switch Indentation   +106 added lines, -106 removed lines patch added patch discarded remove patch
@@ -58,32 +58,32 @@  discard block
 block discarded – undo
58 58
 	$newvars[$name]['id'] = $var;
59 59
 	if (!empty($type[$name])) {
60 60
 		switch ($type[$name]) {
61
-		case 'INDI':
62
-			$record = Individual::getInstance($var, $WT_TREE);
63
-			if ($record && $record->canShowName()) {
64
-				$newvars[$name]['gedcom'] = $record->privatizeGedcom(Auth::accessLevel($WT_TREE));
65
-			} else {
66
-				$action = 'setup';
67
-			}
68
-			break;
69
-		case 'FAM':
70
-			$record = Family::getInstance($var, $WT_TREE);
71
-			if ($record && $record->canShowName()) {
72
-				$newvars[$name]['gedcom'] = $record->privatizeGedcom(Auth::accessLevel($WT_TREE));
73
-			} else {
74
-				$action = 'setup';
75
-			}
76
-			break;
77
-		case 'SOUR':
78
-			$record = Source::getInstance($var, $WT_TREE);
79
-			if ($record && $record->canShowName()) {
80
-				$newvars[$name]['gedcom'] = $record->privatizeGedcom(Auth::accessLevel($WT_TREE));
81
-			} else {
82
-				$action = 'setup';
83
-			}
84
-			break;
85
-		default:
86
-			break;
61
+			case 'INDI':
62
+				$record = Individual::getInstance($var, $WT_TREE);
63
+				if ($record && $record->canShowName()) {
64
+					$newvars[$name]['gedcom'] = $record->privatizeGedcom(Auth::accessLevel($WT_TREE));
65
+				} else {
66
+					$action = 'setup';
67
+				}
68
+				break;
69
+			case 'FAM':
70
+				$record = Family::getInstance($var, $WT_TREE);
71
+				if ($record && $record->canShowName()) {
72
+					$newvars[$name]['gedcom'] = $record->privatizeGedcom(Auth::accessLevel($WT_TREE));
73
+				} else {
74
+					$action = 'setup';
75
+				}
76
+				break;
77
+			case 'SOUR':
78
+				$record = Source::getInstance($var, $WT_TREE);
79
+				if ($record && $record->canShowName()) {
80
+					$newvars[$name]['gedcom'] = $record->privatizeGedcom(Auth::accessLevel($WT_TREE));
81
+				} else {
82
+					$action = 'setup';
83
+				}
84
+				break;
85
+			default:
86
+				break;
87 87
 		}
88 88
 	}
89 89
 }
@@ -111,12 +111,12 @@  discard block
 block discarded – undo
111 111
 
112 112
 //-- choose a report to run
113 113
 switch ($action) {
114
-case 'choose':
115
-	$controller
116
-		->setPageTitle(I18N::translate('Choose a report to run'))
117
-		->pageHeader();
114
+	case 'choose':
115
+		$controller
116
+			->setPageTitle(I18N::translate('Choose a report to run'))
117
+			->pageHeader();
118 118
 
119
-	echo '<div id="reportengine-page">
119
+		echo '<div id="reportengine-page">
120 120
 		<h2 class="center">', I18N::translate('Choose a report to run'), '</h2>
121 121
 		<form name="choosereport" method="get" action="reportengine.php">
122 122
 		<input type="hidden" name="action" value="setup">
@@ -124,27 +124,27 @@  discard block
 block discarded – undo
124 124
 		<table class="facts_table width40">
125 125
 		<tr><td class="descriptionbox wrap width33 vmiddle">', I18N::translate('Report'), '</td>
126 126
 		<td class="optionbox"><select name="report">';
127
-	foreach ($reports as $file => $report) {
128
-		echo '<option value="', Filter::escapeHtml($file), '">', Filter::escapeHtml($report), '</option>';
129
-	}
130
-	echo '</select></td></tr>
127
+		foreach ($reports as $file => $report) {
128
+			echo '<option value="', Filter::escapeHtml($file), '">', Filter::escapeHtml($report), '</option>';
129
+		}
130
+		echo '</select></td></tr>
131 131
 		<tr><td class="topbottombar" colspan="2"><input type="submit" value="', I18N::translate('continue'), '"></td></tr>
132 132
 		</table></form></div>';
133
-	break;
133
+		break;
134 134
 
135
-case 'setup':
136
-	$report_setup = new ReportParserSetup($report);
137
-	$report_array = $report_setup->reportProperties();
135
+	case 'setup':
136
+		$report_setup = new ReportParserSetup($report);
137
+		$report_array = $report_setup->reportProperties();
138 138
 
139
-	$controller
140
-		->setPageTitle($report_array['title'])
141
-		->pageHeader()
142
-		->addExternalJavascript(WT_AUTOCOMPLETE_JS_URL)
143
-		->addInlineJavascript('autocomplete();');
139
+		$controller
140
+			->setPageTitle($report_array['title'])
141
+			->pageHeader()
142
+			->addExternalJavascript(WT_AUTOCOMPLETE_JS_URL)
143
+			->addInlineJavascript('autocomplete();');
144 144
 
145
-	FunctionsPrint::initializeCalendarPopup();
145
+		FunctionsPrint::initializeCalendarPopup();
146 146
 
147
-	echo '<div id="reportengine-page">
147
+		echo '<div id="reportengine-page">
148 148
 		<h2 class="center">', $report_array['title'], '</h2>
149 149
 		<form name="setupreport" method="get" action="reportengine.php">
150 150
 		<input type="hidden" name="action" value="run">
@@ -152,55 +152,55 @@  discard block
 block discarded – undo
152 152
 		<table class="facts_table width50">
153 153
 		<tr><td class="descriptionbox width30 wrap">', I18N::translate('Report'), '</td><td class="optionbox">', $report_array['description'], '</td></tr>';
154 154
 
155
-	if (!isset($report_array['inputs'])) {
156
-		$report_array['inputs'] = array();
157
-	}
158
-	foreach ($report_array['inputs'] as $input) {
159
-		echo '<tr><td class="descriptionbox wrap">';
160
-		echo '<input type="hidden" name="varnames[]" value="', Filter::escapeHtml($input["name"]), '">';
161
-		echo I18N::translate($input['value']), '</td><td class="optionbox">';
162
-		if (!isset($input['type'])) {
163
-			$input['type'] = 'text';
164
-		}
165
-		if (!isset($input['default'])) {
166
-			$input['default'] = '';
167
-		}
168
-		if (!isset($input['lookup'])) {
169
-			$input['lookup'] = '';
155
+		if (!isset($report_array['inputs'])) {
156
+			$report_array['inputs'] = array();
170 157
 		}
158
+		foreach ($report_array['inputs'] as $input) {
159
+			echo '<tr><td class="descriptionbox wrap">';
160
+			echo '<input type="hidden" name="varnames[]" value="', Filter::escapeHtml($input["name"]), '">';
161
+			echo I18N::translate($input['value']), '</td><td class="optionbox">';
162
+			if (!isset($input['type'])) {
163
+				$input['type'] = 'text';
164
+			}
165
+			if (!isset($input['default'])) {
166
+				$input['default'] = '';
167
+			}
168
+			if (!isset($input['lookup'])) {
169
+				$input['lookup'] = '';
170
+			}
171 171
 
172
-		if ($input['type'] == 'text') {
173
-			echo '<input';
172
+			if ($input['type'] == 'text') {
173
+				echo '<input';
174 174
 
175
-			switch ($input['lookup']) {
176
-			case 'INDI':
177
-				echo ' data-autocomplete-type="INDI"';
178
-				if (!empty($pid)) {
179
-					$input['default'] = $pid;
180
-				} else {
181
-					$input['default'] = $controller->getSignificantIndividual()->getXref();
182
-				}
183
-				break;
184
-			case 'FAM':
185
-				echo ' data-autocomplete-type="FAM"';
186
-				if (!empty($famid)) {
187
-					$input['default'] = $famid;
188
-				} else {
189
-					$input['default'] = $controller->getSignificantFamily()->getXref();
190
-				}
191
-				break;
192
-			case 'SOUR':
193
-				echo ' data-autocomplete-type="SOUR"';
194
-				if (!empty($sid)) {
195
-					$input['default'] = $sid;
196
-				}
197
-				break;
198
-			case 'DATE':
199
-				if (isset($input['default'])) {
200
-					$input['default'] = strtoupper($input['default']);
175
+				switch ($input['lookup']) {
176
+					case 'INDI':
177
+						echo ' data-autocomplete-type="INDI"';
178
+						if (!empty($pid)) {
179
+							$input['default'] = $pid;
180
+						} else {
181
+							$input['default'] = $controller->getSignificantIndividual()->getXref();
182
+						}
183
+						break;
184
+					case 'FAM':
185
+						echo ' data-autocomplete-type="FAM"';
186
+						if (!empty($famid)) {
187
+							$input['default'] = $famid;
188
+						} else {
189
+							$input['default'] = $controller->getSignificantFamily()->getXref();
190
+						}
191
+						break;
192
+					case 'SOUR':
193
+						echo ' data-autocomplete-type="SOUR"';
194
+						if (!empty($sid)) {
195
+							$input['default'] = $sid;
196
+						}
197
+						break;
198
+					case 'DATE':
199
+						if (isset($input['default'])) {
200
+							$input['default'] = strtoupper($input['default']);
201
+						}
202
+						break;
201 203
 				}
202
-				break;
203
-			}
204 204
 
205 205
 			echo ' type="text" name="vars[', Filter::escapeHtml($input['name']), ']" id="', Filter::escapeHtml($input['name']), '" value="', Filter::escapeHtml($input['default']), '" style="direction: ltr;">';
206 206
 		}
@@ -266,20 +266,20 @@  discard block
 block discarded – undo
266 266
 		</td></tr></table></form></div>';
267 267
 	break;
268 268
 
269
-case 'run':
270
-	if (strstr($report, 'report_singlepage.xml') !== false) {
271
-		// This is a custom module?
272
-		new \ReportPedigree;
273
-		break;
274
-	}
269
+	case 'run':
270
+		if (strstr($report, 'report_singlepage.xml') !== false) {
271
+			// This is a custom module?
272
+			new \ReportPedigree;
273
+			break;
274
+		}
275 275
 
276
-	switch ($output) {
277
-	case 'HTML':
278
-		header('Content-type: text/html; charset=UTF-8');
279
-		new ReportParserGenerate($report, new ReportHtml, $vars);
280
-		break;
281
-	case 'PDF':
282
-		new ReportParserGenerate($report, new ReportPdf, $vars);
283
-		break;
284
-	}
276
+		switch ($output) {
277
+			case 'HTML':
278
+				header('Content-type: text/html; charset=UTF-8');
279
+				new ReportParserGenerate($report, new ReportHtml, $vars);
280
+				break;
281
+			case 'PDF':
282
+				new ReportParserGenerate($report, new ReportPdf, $vars);
283
+				break;
284
+		}
285 285
 }
Please login to merge, or discard this patch.
addmedia.php 1 patch
Switch Indentation   +281 added lines, -281 removed lines patch added patch discarded remove patch
@@ -76,338 +76,338 @@
 block discarded – undo
76 76
 // …and also in the admin_media_upload.php script
77 77
 
78 78
 switch ($action) {
79
-case 'create': // Save the information from the “showcreateform” action
80
-	$controller->setPageTitle(I18N::translate('Create a media object'));
81
-
82
-	// Validate the media folder
83
-	$folderName = str_replace('\\', '/', $folder);
84
-	$folderName = trim($folderName, '/');
85
-	if ($folderName == '.') {
86
-		$folderName = '';
87
-	}
88
-	if ($folderName) {
89
-		$folderName .= '/';
90
-		// Not allowed to use “../”
91
-		if (strpos('/' . $folderName, '/../') !== false) {
92
-			FlashMessages::addMessage('Folder names are not allowed to include “../”');
93
-			break;
79
+	case 'create': // Save the information from the “showcreateform” action
80
+		$controller->setPageTitle(I18N::translate('Create a media object'));
81
+
82
+		// Validate the media folder
83
+		$folderName = str_replace('\\', '/', $folder);
84
+		$folderName = trim($folderName, '/');
85
+		if ($folderName == '.') {
86
+			$folderName = '';
94 87
 		}
95
-	}
96
-
97
-	// Make sure the media folder exists
98
-	if (!is_dir(WT_DATA_DIR . $MEDIA_DIRECTORY)) {
99
-		if (File::mkdir(WT_DATA_DIR . $MEDIA_DIRECTORY)) {
100
-			FlashMessages::addMessage(I18N::translate('The folder %s has been created.', Html::filename(WT_DATA_DIR . $MEDIA_DIRECTORY)));
101
-		} else {
102
-			FlashMessages::addMessage(I18N::translate('The folder %s does not exist, and it could not be created.', Html::filename(WT_DATA_DIR . $MEDIA_DIRECTORY)), 'danger');
103
-			break;
88
+		if ($folderName) {
89
+			$folderName .= '/';
90
+			// Not allowed to use “../”
91
+			if (strpos('/' . $folderName, '/../') !== false) {
92
+				FlashMessages::addMessage('Folder names are not allowed to include “../”');
93
+				break;
94
+			}
104 95
 		}
105
-	}
106 96
 
107
-	// Managers can create new media paths (subfolders). Users must use existing folders.
108
-	if ($folderName && !is_dir(WT_DATA_DIR . $MEDIA_DIRECTORY . $folderName)) {
109
-		if (Auth::isManager($WT_TREE)) {
110
-			if (File::mkdir(WT_DATA_DIR . $MEDIA_DIRECTORY . $folderName)) {
111
-				FlashMessages::addMessage(I18N::translate('The folder %s has been created.', Html::filename(WT_DATA_DIR . $MEDIA_DIRECTORY . $folderName)));
97
+		// Make sure the media folder exists
98
+		if (!is_dir(WT_DATA_DIR . $MEDIA_DIRECTORY)) {
99
+			if (File::mkdir(WT_DATA_DIR . $MEDIA_DIRECTORY)) {
100
+				FlashMessages::addMessage(I18N::translate('The folder %s has been created.', Html::filename(WT_DATA_DIR . $MEDIA_DIRECTORY)));
112 101
 			} else {
113
-				FlashMessages::addMessage(I18N::translate('The folder %s does not exist, and it could not be created.', Html::filename(WT_DATA_DIR . $MEDIA_DIRECTORY . $folderName)), 'danger');
102
+				FlashMessages::addMessage(I18N::translate('The folder %s does not exist, and it could not be created.', Html::filename(WT_DATA_DIR . $MEDIA_DIRECTORY)), 'danger');
114 103
 				break;
115 104
 			}
116
-		} else {
117
-			// Regular users should not have seen this option - so no need for an error message.
118
-			break;
119 105
 		}
120
-	}
121 106
 
122
-	// The media folder exists. Now create a thumbnail folder to match it.
123
-	if (!is_dir(WT_DATA_DIR . $MEDIA_DIRECTORY . 'thumbs/' . $folderName)) {
124
-		if (!File::mkdir(WT_DATA_DIR . $MEDIA_DIRECTORY . 'thumbs/' . $folderName)) {
125
-			FlashMessages::addMessage(I18N::translate('The folder %s does not exist, and it could not be created.', Html::filename(WT_DATA_DIR . $MEDIA_DIRECTORY . 'thumbs/' . $folderName)), 'danger');
126
-			break;
107
+		// Managers can create new media paths (subfolders). Users must use existing folders.
108
+		if ($folderName && !is_dir(WT_DATA_DIR . $MEDIA_DIRECTORY . $folderName)) {
109
+			if (Auth::isManager($WT_TREE)) {
110
+				if (File::mkdir(WT_DATA_DIR . $MEDIA_DIRECTORY . $folderName)) {
111
+					FlashMessages::addMessage(I18N::translate('The folder %s has been created.', Html::filename(WT_DATA_DIR . $MEDIA_DIRECTORY . $folderName)));
112
+				} else {
113
+					FlashMessages::addMessage(I18N::translate('The folder %s does not exist, and it could not be created.', Html::filename(WT_DATA_DIR . $MEDIA_DIRECTORY . $folderName)), 'danger');
114
+					break;
115
+				}
116
+			} else {
117
+				// Regular users should not have seen this option - so no need for an error message.
118
+				break;
119
+			}
127 120
 		}
128
-	}
129 121
 
130
-	// A thumbnail file with no main image?
131
-	if (!empty($_FILES['thumbnail']['name']) && empty($_FILES['mediafile']['name'])) {
132
-		// Assume the user used the wrong field, and treat this as a main image
133
-		$_FILES['mediafile'] = $_FILES['thumbnail'];
134
-		unset($_FILES['thumbnail']);
135
-	}
122
+		// The media folder exists. Now create a thumbnail folder to match it.
123
+		if (!is_dir(WT_DATA_DIR . $MEDIA_DIRECTORY . 'thumbs/' . $folderName)) {
124
+			if (!File::mkdir(WT_DATA_DIR . $MEDIA_DIRECTORY . 'thumbs/' . $folderName)) {
125
+				FlashMessages::addMessage(I18N::translate('The folder %s does not exist, and it could not be created.', Html::filename(WT_DATA_DIR . $MEDIA_DIRECTORY . 'thumbs/' . $folderName)), 'danger');
126
+				break;
127
+			}
128
+		}
136 129
 
137
-	// Thumbnail files must contain images.
138
-	if (!empty($_FILES['thumbnail']['name']) && !preg_match('/^image/', $_FILES['thumbnail']['type'])) {
139
-		FlashMessages::addMessage(I18N::translate('Thumbnail files must contain images.'));
140
-		break;
141
-	}
130
+		// A thumbnail file with no main image?
131
+		if (!empty($_FILES['thumbnail']['name']) && empty($_FILES['mediafile']['name'])) {
132
+			// Assume the user used the wrong field, and treat this as a main image
133
+			$_FILES['mediafile'] = $_FILES['thumbnail'];
134
+			unset($_FILES['thumbnail']);
135
+		}
142 136
 
143
-	// User-specified filename?
144
-	if ($tag[0] == 'FILE' && $text[0]) {
145
-		$filename = $text[0];
146
-	}
147
-	// Use the name of the uploaded file?
148
-	// If no filename specified, use the name of the uploaded file?
149
-	if (!$filename && !empty($_FILES['mediafile']['name'])) {
150
-		$filename = $_FILES['mediafile']['name'];
151
-	}
137
+		// Thumbnail files must contain images.
138
+		if (!empty($_FILES['thumbnail']['name']) && !preg_match('/^image/', $_FILES['thumbnail']['type'])) {
139
+			FlashMessages::addMessage(I18N::translate('Thumbnail files must contain images.'));
140
+			break;
141
+		}
152 142
 
153
-	// Validate the media path and filename
154
-	if (preg_match('/^https?:\/\//i', $text[0], $match)) {
155
-		// External media needs no further validation
156
-		$fileName   = $filename;
157
-		$folderName = '';
158
-		unset($_FILES['mediafile'], $_FILES['thumbnail']);
159
-	} elseif (preg_match('/([\/\\\\<>])/', $filename, $match)) {
160
-		// Local media files cannot contain certain special characters
161
-		FlashMessages::addMessage(I18N::translate('Filenames are not allowed to contain the character “%s”.', $match[1]));
162
-		break;
163
-	} elseif (preg_match('/(\.(php|pl|cgi|bash|sh|bat|exe|com|htm|html|shtml))$/i', $filename, $match)) {
164
-		// Do not allow obvious script files.
165
-		FlashMessages::addMessage(I18N::translate('Filenames are not allowed to have the extension “%s”.', $match[1]));
166
-		break;
167
-	} elseif (!$filename) {
168
-		FlashMessages::addMessage(I18N::translate('No media file was provided.'));
169
-		break;
170
-	} else {
171
-		$fileName = $filename;
172
-	}
143
+		// User-specified filename?
144
+		if ($tag[0] == 'FILE' && $text[0]) {
145
+			$filename = $text[0];
146
+		}
147
+		// Use the name of the uploaded file?
148
+		// If no filename specified, use the name of the uploaded file?
149
+		if (!$filename && !empty($_FILES['mediafile']['name'])) {
150
+			$filename = $_FILES['mediafile']['name'];
151
+		}
173 152
 
174
-	// Now copy the file to the correct location.
175
-	if (!empty($_FILES['mediafile']['name'])) {
176
-		$serverFileName = WT_DATA_DIR . $MEDIA_DIRECTORY . $folderName . $fileName;
177
-		if (file_exists($serverFileName)) {
178
-			FlashMessages::addMessage(I18N::translate('The file %s already exists. Use another filename.', $folderName . $fileName));
153
+		// Validate the media path and filename
154
+		if (preg_match('/^https?:\/\//i', $text[0], $match)) {
155
+			// External media needs no further validation
156
+			$fileName   = $filename;
157
+			$folderName = '';
158
+			unset($_FILES['mediafile'], $_FILES['thumbnail']);
159
+		} elseif (preg_match('/([\/\\\\<>])/', $filename, $match)) {
160
+			// Local media files cannot contain certain special characters
161
+			FlashMessages::addMessage(I18N::translate('Filenames are not allowed to contain the character “%s”.', $match[1]));
179 162
 			break;
180
-		}
181
-		if (move_uploaded_file($_FILES['mediafile']['tmp_name'], $serverFileName)) {
182
-			Log::addMediaLog('Media file ' . $serverFileName . ' uploaded');
183
-		} else {
184
-			FlashMessages::addMessage(
185
-				I18N::translate('There was an error uploading your file.') .
186
-				'<br>' .
187
-				Functions::fileUploadErrorText($_FILES['mediafile']['error'])
188
-			);
163
+		} elseif (preg_match('/(\.(php|pl|cgi|bash|sh|bat|exe|com|htm|html|shtml))$/i', $filename, $match)) {
164
+			// Do not allow obvious script files.
165
+			FlashMessages::addMessage(I18N::translate('Filenames are not allowed to have the extension “%s”.', $match[1]));
166
+			break;
167
+		} elseif (!$filename) {
168
+			FlashMessages::addMessage(I18N::translate('No media file was provided.'));
189 169
 			break;
170
+		} else {
171
+			$fileName = $filename;
190 172
 		}
191 173
 
192
-		// Now copy the (optional) thumbnail
193
-		if (!empty($_FILES['thumbnail']['name']) && preg_match('/^image\/(png|gif|jpeg)/', $_FILES['thumbnail']['type'], $match)) {
194
-			// Thumbnails have either
195
-			// (a) the same filename as the main image
196
-			// (b) the same filename as the main image - but with a .png extension
197
-			if ($match[1] == 'png' && !preg_match('/\.(png)$/i', $fileName)) {
198
-				$thumbFile = preg_replace('/\.[a-z0-9]{3,5}$/', '.png', $fileName);
174
+		// Now copy the file to the correct location.
175
+		if (!empty($_FILES['mediafile']['name'])) {
176
+			$serverFileName = WT_DATA_DIR . $MEDIA_DIRECTORY . $folderName . $fileName;
177
+			if (file_exists($serverFileName)) {
178
+				FlashMessages::addMessage(I18N::translate('The file %s already exists. Use another filename.', $folderName . $fileName));
179
+				break;
180
+			}
181
+			if (move_uploaded_file($_FILES['mediafile']['tmp_name'], $serverFileName)) {
182
+				Log::addMediaLog('Media file ' . $serverFileName . ' uploaded');
199 183
 			} else {
200
-				$thumbFile = $fileName;
184
+				FlashMessages::addMessage(
185
+					I18N::translate('There was an error uploading your file.') .
186
+					'<br>' .
187
+					Functions::fileUploadErrorText($_FILES['mediafile']['error'])
188
+				);
189
+				break;
201 190
 			}
202
-			$serverFileName = WT_DATA_DIR . $MEDIA_DIRECTORY . 'thumbs/' . $folderName . $thumbFile;
203
-			if (move_uploaded_file($_FILES['thumbnail']['tmp_name'], $serverFileName)) {
204
-				Log::addMediaLog('Thumbnail file ' . $serverFileName . ' uploaded');
191
+
192
+			// Now copy the (optional) thumbnail
193
+			if (!empty($_FILES['thumbnail']['name']) && preg_match('/^image\/(png|gif|jpeg)/', $_FILES['thumbnail']['type'], $match)) {
194
+				// Thumbnails have either
195
+				// (a) the same filename as the main image
196
+				// (b) the same filename as the main image - but with a .png extension
197
+				if ($match[1] == 'png' && !preg_match('/\.(png)$/i', $fileName)) {
198
+					$thumbFile = preg_replace('/\.[a-z0-9]{3,5}$/', '.png', $fileName);
199
+				} else {
200
+					$thumbFile = $fileName;
201
+				}
202
+				$serverFileName = WT_DATA_DIR . $MEDIA_DIRECTORY . 'thumbs/' . $folderName . $thumbFile;
203
+				if (move_uploaded_file($_FILES['thumbnail']['tmp_name'], $serverFileName)) {
204
+					Log::addMediaLog('Thumbnail file ' . $serverFileName . ' uploaded');
205
+				}
205 206
 			}
206 207
 		}
207
-	}
208 208
 
209
-	$controller->pageHeader();
210
-	// Build the gedcom record
211
-	$newged = "0 @new@ OBJE";
212
-	if ($tag[0] == 'FILE') {
213
-		// The admin has an edit field to change the filename
214
-		$text[0] = $folderName . $fileName;
215
-	} else {
216
-		// Users keep the original filename
217
-		$newged .= "\n1 FILE " . $folderName . $fileName;
218
-	}
209
+		$controller->pageHeader();
210
+		// Build the gedcom record
211
+		$newged = "0 @new@ OBJE";
212
+		if ($tag[0] == 'FILE') {
213
+			// The admin has an edit field to change the filename
214
+			$text[0] = $folderName . $fileName;
215
+		} else {
216
+			// Users keep the original filename
217
+			$newged .= "\n1 FILE " . $folderName . $fileName;
218
+		}
219 219
 
220
-	$newged = FunctionsEdit::handleUpdates($newged);
220
+		$newged = FunctionsEdit::handleUpdates($newged);
221 221
 
222
-	$new_media = $WT_TREE->createRecord($newged);
223
-	if ($linktoid) {
224
-		$record = GedcomRecord::getInstance($linktoid, $WT_TREE);
225
-		$record->createFact('1 OBJE @' . $new_media->getXref() . '@', true);
226
-		Log::addEditLog('Media ID ' . $new_media->getXref() . " successfully added to $linktoid.");
227
-		$controller->addInlineJavascript('closePopupAndReloadParent();');
228
-	} else {
229
-		Log::addEditLog('Media ID ' . $new_media->getXref() . ' successfully added.');
230
-		$controller->addInlineJavascript('openerpasteid("' . $new_media->getXref() . '");');
231
-	}
232
-	echo '<button onclick="closePopupAndReloadParent();">', I18N::translate('close'), '</button>';
222
+		$new_media = $WT_TREE->createRecord($newged);
223
+		if ($linktoid) {
224
+			$record = GedcomRecord::getInstance($linktoid, $WT_TREE);
225
+			$record->createFact('1 OBJE @' . $new_media->getXref() . '@', true);
226
+			Log::addEditLog('Media ID ' . $new_media->getXref() . " successfully added to $linktoid.");
227
+			$controller->addInlineJavascript('closePopupAndReloadParent();');
228
+		} else {
229
+			Log::addEditLog('Media ID ' . $new_media->getXref() . ' successfully added.');
230
+			$controller->addInlineJavascript('openerpasteid("' . $new_media->getXref() . '");');
231
+		}
232
+		echo '<button onclick="closePopupAndReloadParent();">', I18N::translate('close'), '</button>';
233 233
 
234
-	return;
234
+		return;
235 235
 
236
-case 'update': // Save the information from the “editmedia” action
237
-	$controller->setPageTitle(I18N::translate('Edit the media object'));
236
+	case 'update': // Save the information from the “editmedia” action
237
+		$controller->setPageTitle(I18N::translate('Edit the media object'));
238 238
 
239
-	// Validate the media folder
240
-	$folderName = str_replace('\\', '/', $folder);
241
-	$folderName = trim($folderName, '/');
242
-	if ($folderName == '.') {
243
-		$folderName = '';
244
-	}
245
-	if ($folderName) {
246
-		$folderName .= '/';
247
-		// Not allowed to use “../”
248
-		if (strpos('/' . $folderName, '/../') !== false) {
249
-			FlashMessages::addMessage('Folder names are not allowed to include “../”');
250
-			break;
239
+		// Validate the media folder
240
+		$folderName = str_replace('\\', '/', $folder);
241
+		$folderName = trim($folderName, '/');
242
+		if ($folderName == '.') {
243
+			$folderName = '';
251 244
 		}
252
-	}
253
-
254
-	// Make sure the media folder exists
255
-	if (!is_dir(WT_DATA_DIR . $MEDIA_DIRECTORY)) {
256
-		if (File::mkdir(WT_DATA_DIR . $MEDIA_DIRECTORY)) {
257
-			FlashMessages::addMessage(I18N::translate('The folder %s has been created.', Html::filename(WT_DATA_DIR . $MEDIA_DIRECTORY)));
258
-		} else {
259
-			FlashMessages::addMessage(I18N::translate('The folder %s does not exist, and it could not be created.', Html::filename(WT_DATA_DIR . $MEDIA_DIRECTORY)), 'danger');
260
-			break;
245
+		if ($folderName) {
246
+			$folderName .= '/';
247
+			// Not allowed to use “../”
248
+			if (strpos('/' . $folderName, '/../') !== false) {
249
+				FlashMessages::addMessage('Folder names are not allowed to include “../”');
250
+				break;
251
+			}
261 252
 		}
262
-	}
263 253
 
264
-	// Managers can create new media paths (subfolders). Users must use existing folders.
265
-	if ($folderName && !is_dir(WT_DATA_DIR . $MEDIA_DIRECTORY . $folderName)) {
266
-		if (Auth::isManager($WT_TREE)) {
267
-			if (File::mkdir(WT_DATA_DIR . $MEDIA_DIRECTORY . $folderName)) {
268
-				FlashMessages::addMessage(I18N::translate('The folder %s has been created.', Html::filename(WT_DATA_DIR . $MEDIA_DIRECTORY . $folderName)));
254
+		// Make sure the media folder exists
255
+		if (!is_dir(WT_DATA_DIR . $MEDIA_DIRECTORY)) {
256
+			if (File::mkdir(WT_DATA_DIR . $MEDIA_DIRECTORY)) {
257
+				FlashMessages::addMessage(I18N::translate('The folder %s has been created.', Html::filename(WT_DATA_DIR . $MEDIA_DIRECTORY)));
269 258
 			} else {
270
-				FlashMessages::addMessage(I18N::translate('The folder %s does not exist, and it could not be created.', Html::filename(WT_DATA_DIR . $MEDIA_DIRECTORY . $folderName)), 'danger');
259
+				FlashMessages::addMessage(I18N::translate('The folder %s does not exist, and it could not be created.', Html::filename(WT_DATA_DIR . $MEDIA_DIRECTORY)), 'danger');
271 260
 				break;
272 261
 			}
273
-		} else {
274
-			// Regular users should not have seen this option - so no need for an error message.
275
-			break;
276 262
 		}
277
-	}
278 263
 
279
-	// The media folder exists. Now create a thumbnail folder to match it.
280
-	if (!is_dir(WT_DATA_DIR . $MEDIA_DIRECTORY . 'thumbs/' . $folderName)) {
281
-		if (!File::mkdir(WT_DATA_DIR . $MEDIA_DIRECTORY . 'thumbs/' . $folderName)) {
282
-			FlashMessages::addMessage(I18N::translate('The folder %s does not exist, and it could not be created.', Html::filename(WT_DATA_DIR . $MEDIA_DIRECTORY . 'thumbs/' . $folderName)), 'danger');
283
-			break;
264
+		// Managers can create new media paths (subfolders). Users must use existing folders.
265
+		if ($folderName && !is_dir(WT_DATA_DIR . $MEDIA_DIRECTORY . $folderName)) {
266
+			if (Auth::isManager($WT_TREE)) {
267
+				if (File::mkdir(WT_DATA_DIR . $MEDIA_DIRECTORY . $folderName)) {
268
+					FlashMessages::addMessage(I18N::translate('The folder %s has been created.', Html::filename(WT_DATA_DIR . $MEDIA_DIRECTORY . $folderName)));
269
+				} else {
270
+					FlashMessages::addMessage(I18N::translate('The folder %s does not exist, and it could not be created.', Html::filename(WT_DATA_DIR . $MEDIA_DIRECTORY . $folderName)), 'danger');
271
+					break;
272
+				}
273
+			} else {
274
+				// Regular users should not have seen this option - so no need for an error message.
275
+				break;
276
+			}
284 277
 		}
285
-	}
286
-
287
-	// Validate the media path and filename
288
-	if (preg_match('/^https?:\/\//i', $filename, $match)) {
289
-		// External media needs no further validation
290
-		$fileName   = $filename;
291
-		$folderName = '';
292
-		unset($_FILES['mediafile'], $_FILES['thumbnail']);
293
-	} elseif (preg_match('/([\/\\\\<>])/', $filename, $match)) {
294
-		// Local media files cannot contain certain special characters
295
-		FlashMessages::addMessage(I18N::translate('Filenames are not allowed to contain the character “%s”.', $match[1]));
296
-		break;
297
-	} elseif (preg_match('/(\.(php|pl|cgi|bash|sh|bat|exe|com|htm|html|shtml))$/i', $filename, $match)) {
298
-		// Do not allow obvious script files.
299
-		FlashMessages::addMessage(I18N::translate('Filenames are not allowed to have the extension “%s”.', $match[1]));
300
-		break;
301
-	} elseif (!$filename) {
302
-		FlashMessages::addMessage(I18N::translate('No media file was provided.'));
303
-		break;
304
-	} else {
305
-		$fileName = $filename;
306
-	}
307 278
 
308
-	$oldFilename = $media->getFilename();
309
-	$newFilename = $folderName . $fileName;
310
-
311
-	// Cannot rename local to external or vice-versa
312
-	if (Functions::isFileExternal($oldFilename) != Functions::isFileExternal($filename)) {
313
-		FlashMessages::addMessage(I18N::translate('The media file %1$s could not be renamed to %2$s.', Html::filename($oldFilename), Html::filename($newFilename)));
314
-		break;
315
-	}
279
+		// The media folder exists. Now create a thumbnail folder to match it.
280
+		if (!is_dir(WT_DATA_DIR . $MEDIA_DIRECTORY . 'thumbs/' . $folderName)) {
281
+			if (!File::mkdir(WT_DATA_DIR . $MEDIA_DIRECTORY . 'thumbs/' . $folderName)) {
282
+				FlashMessages::addMessage(I18N::translate('The folder %s does not exist, and it could not be created.', Html::filename(WT_DATA_DIR . $MEDIA_DIRECTORY . 'thumbs/' . $folderName)), 'danger');
283
+				break;
284
+			}
285
+		}
316 286
 
317
-	$messages  = false;
318
-	$move_file = false;
287
+		// Validate the media path and filename
288
+		if (preg_match('/^https?:\/\//i', $filename, $match)) {
289
+			// External media needs no further validation
290
+			$fileName   = $filename;
291
+			$folderName = '';
292
+			unset($_FILES['mediafile'], $_FILES['thumbnail']);
293
+		} elseif (preg_match('/([\/\\\\<>])/', $filename, $match)) {
294
+			// Local media files cannot contain certain special characters
295
+			FlashMessages::addMessage(I18N::translate('Filenames are not allowed to contain the character “%s”.', $match[1]));
296
+			break;
297
+		} elseif (preg_match('/(\.(php|pl|cgi|bash|sh|bat|exe|com|htm|html|shtml))$/i', $filename, $match)) {
298
+			// Do not allow obvious script files.
299
+			FlashMessages::addMessage(I18N::translate('Filenames are not allowed to have the extension “%s”.', $match[1]));
300
+			break;
301
+		} elseif (!$filename) {
302
+			FlashMessages::addMessage(I18N::translate('No media file was provided.'));
303
+			break;
304
+		} else {
305
+			$fileName = $filename;
306
+		}
319 307
 
320
-	// Move files on disk (if we can) to reflect the change to the GEDCOM data
321
-	if (!$media->isExternal()) {
322
-		$oldServerFile  = $media->getServerFilename('main');
323
-		$oldServerThumb = $media->getServerFilename('thumb');
308
+		$oldFilename = $media->getFilename();
309
+		$newFilename = $folderName . $fileName;
324 310
 
325
-		$newmedia       = new Media("xxx", "0 @xxx@ OBJE\n1 FILE " . $newFilename, null, $WT_TREE);
326
-		$newServerFile  = $newmedia->getServerFilename('main');
327
-		$newServerThumb = $newmedia->getServerFilename('thumb');
311
+		// Cannot rename local to external or vice-versa
312
+		if (Functions::isFileExternal($oldFilename) != Functions::isFileExternal($filename)) {
313
+			FlashMessages::addMessage(I18N::translate('The media file %1$s could not be renamed to %2$s.', Html::filename($oldFilename), Html::filename($newFilename)));
314
+			break;
315
+		}
328 316
 
329
-		// We could be either renaming an existing file, or updating a record (with no valid file) to point to a new file
330
-		if ($oldServerFile !== $newServerFile) {
331
-			//-- check if the file is used in more than one gedcom
332
-			//-- do not allow it to be moved or renamed if it is
333
-			if (!$media->isExternal() && FunctionsDb::isMediaUsedInOtherTree($media->getFilename(), $WT_TREE->getTreeId())) {
334
-				FlashMessages::addMessage(I18N::translate('This file is linked to another family tree on this server. It cannot be deleted, moved, or renamed until these links have been removed.'));
335
-				break;
336
-			}
317
+		$messages  = false;
318
+		$move_file = false;
319
+
320
+		// Move files on disk (if we can) to reflect the change to the GEDCOM data
321
+		if (!$media->isExternal()) {
322
+			$oldServerFile  = $media->getServerFilename('main');
323
+			$oldServerThumb = $media->getServerFilename('thumb');
324
+
325
+			$newmedia       = new Media("xxx", "0 @xxx@ OBJE\n1 FILE " . $newFilename, null, $WT_TREE);
326
+			$newServerFile  = $newmedia->getServerFilename('main');
327
+			$newServerThumb = $newmedia->getServerFilename('thumb');
328
+
329
+			// We could be either renaming an existing file, or updating a record (with no valid file) to point to a new file
330
+			if ($oldServerFile !== $newServerFile) {
331
+				//-- check if the file is used in more than one gedcom
332
+				//-- do not allow it to be moved or renamed if it is
333
+				if (!$media->isExternal() && FunctionsDb::isMediaUsedInOtherTree($media->getFilename(), $WT_TREE->getTreeId())) {
334
+					FlashMessages::addMessage(I18N::translate('This file is linked to another family tree on this server. It cannot be deleted, moved, or renamed until these links have been removed.'));
335
+					break;
336
+				}
337 337
 
338
-			$move_file = true;
339
-			if (!file_exists($newServerFile) || md5_file($oldServerFile) === md5_file($newServerFile)) {
340
-				try {
341
-					rename($oldServerFile, $newServerFile);
342
-					FlashMessages::addMessage(I18N::translate('The media file %1$s has been renamed to %2$s.', Html::filename($oldFilename), Html::filename($newFilename)));
343
-				} catch (\ErrorException $ex) {
344
-					FlashMessages::addMessage(I18N::translate('The media file %1$s could not be renamed to %2$s.', Html::filename($oldFilename), Html::filename($newFilename)));
338
+				$move_file = true;
339
+				if (!file_exists($newServerFile) || md5_file($oldServerFile) === md5_file($newServerFile)) {
340
+					try {
341
+						rename($oldServerFile, $newServerFile);
342
+						FlashMessages::addMessage(I18N::translate('The media file %1$s has been renamed to %2$s.', Html::filename($oldFilename), Html::filename($newFilename)));
343
+					} catch (\ErrorException $ex) {
344
+						FlashMessages::addMessage(I18N::translate('The media file %1$s could not be renamed to %2$s.', Html::filename($oldFilename), Html::filename($newFilename)));
345
+					}
346
+					$messages = true;
345 347
 				}
346
-				$messages = true;
347
-			}
348
-			if (!file_exists($newServerFile)) {
349
-				FlashMessages::addMessage(I18N::translate('The media file %s does not exist.', Html::filename($newFilename)));
350
-				$messages = true;
351
-			}
352
-		}
353
-		if ($oldServerThumb != $newServerThumb) {
354
-			$move_file = true;
355
-			if (!file_exists($newServerThumb) || md5_file($oldServerFile) == md5_file($newServerThumb)) {
356
-				try {
357
-					rename($oldServerThumb, $newServerThumb);
358
-					FlashMessages::addMessage(I18N::translate('The thumbnail file %1$s has been renamed to %2$s.', Html::filename($oldFilename), Html::filename($newFilename)));
359
-				} catch (\ErrorException $ex) {
360
-					FlashMessages::addMessage(I18N::translate('The thumbnail file %1$s could not be renamed to %2$s.', Html::filename($oldFilename), Html::filename($newFilename)));
348
+				if (!file_exists($newServerFile)) {
349
+					FlashMessages::addMessage(I18N::translate('The media file %s does not exist.', Html::filename($newFilename)));
350
+					$messages = true;
361 351
 				}
362
-				$messages = true;
363 352
 			}
364
-			if (!file_exists($newServerThumb)) {
365
-				FlashMessages::addMessage(I18N::translate('The thumbnail file %s does not exist.', Html::filename($newFilename)));
366
-				$messages = true;
353
+			if ($oldServerThumb != $newServerThumb) {
354
+				$move_file = true;
355
+				if (!file_exists($newServerThumb) || md5_file($oldServerFile) == md5_file($newServerThumb)) {
356
+					try {
357
+						rename($oldServerThumb, $newServerThumb);
358
+						FlashMessages::addMessage(I18N::translate('The thumbnail file %1$s has been renamed to %2$s.', Html::filename($oldFilename), Html::filename($newFilename)));
359
+					} catch (\ErrorException $ex) {
360
+						FlashMessages::addMessage(I18N::translate('The thumbnail file %1$s could not be renamed to %2$s.', Html::filename($oldFilename), Html::filename($newFilename)));
361
+					}
362
+					$messages = true;
363
+				}
364
+				if (!file_exists($newServerThumb)) {
365
+					FlashMessages::addMessage(I18N::translate('The thumbnail file %s does not exist.', Html::filename($newFilename)));
366
+					$messages = true;
367
+				}
367 368
 			}
368 369
 		}
369
-	}
370 370
 
371
-	// Insert the 1 FILE xxx record into the arrays used by function FunctionsEdit::handle_updatesges()
372
-	$glevels = array_merge(array('1'), $glevels);
373
-	$tag     = array_merge(array('FILE'), $tag);
374
-	$islink  = array_merge(array(0), $islink);
375
-	$text    = array_merge(array($newFilename), $text);
376
-
377
-	$record = GedcomRecord::getInstance($pid, $WT_TREE);
378
-	$newrec = "0 @$pid@ OBJE\n";
379
-	$newrec = FunctionsEdit::handleUpdates($newrec);
380
-	$record->updateRecord($newrec, $update_CHAN);
381
-
382
-	if ($move_file) {
383
-		// We've moved a file. Therefore we must approve the change, as rejecting
384
-		// the change will create broken references.
385
-		FunctionsImport::acceptAllChanges($record->getXref(), $record->getTree()->getTreeId());
386
-	}
371
+		// Insert the 1 FILE xxx record into the arrays used by function FunctionsEdit::handle_updatesges()
372
+		$glevels = array_merge(array('1'), $glevels);
373
+		$tag     = array_merge(array('FILE'), $tag);
374
+		$islink  = array_merge(array(0), $islink);
375
+		$text    = array_merge(array($newFilename), $text);
376
+
377
+		$record = GedcomRecord::getInstance($pid, $WT_TREE);
378
+		$newrec = "0 @$pid@ OBJE\n";
379
+		$newrec = FunctionsEdit::handleUpdates($newrec);
380
+		$record->updateRecord($newrec, $update_CHAN);
381
+
382
+		if ($move_file) {
383
+			// We've moved a file. Therefore we must approve the change, as rejecting
384
+			// the change will create broken references.
385
+			FunctionsImport::acceptAllChanges($record->getXref(), $record->getTree()->getTreeId());
386
+		}
387 387
 
388
-	if ($pid && $linktoid) {
389
-		$record = GedcomRecord::getInstance($linktoid, $WT_TREE);
390
-		$record->createFact('1 OBJE @' . $pid . '@', true);
391
-		Log::addEditLog('Media ID ' . $pid . " successfully added to $linktoid.");
392
-	}
393
-	$controller->pageHeader();
394
-	if ($messages) {
395
-		echo '<button onclick="closePopupAndReloadParent();">', I18N::translate('close'), '</button>';
396
-	} else {
397
-		$controller->addInlineJavascript('closePopupAndReloadParent();');
398
-	}
388
+		if ($pid && $linktoid) {
389
+			$record = GedcomRecord::getInstance($linktoid, $WT_TREE);
390
+			$record->createFact('1 OBJE @' . $pid . '@', true);
391
+			Log::addEditLog('Media ID ' . $pid . " successfully added to $linktoid.");
392
+		}
393
+		$controller->pageHeader();
394
+		if ($messages) {
395
+			echo '<button onclick="closePopupAndReloadParent();">', I18N::translate('close'), '</button>';
396
+		} else {
397
+			$controller->addInlineJavascript('closePopupAndReloadParent();');
398
+		}
399 399
 
400
-	return;
401
-case 'showmediaform':
402
-	$controller->setPageTitle(I18N::translate('Create a media object'));
403
-	$action = 'create';
404
-	break;
405
-case 'editmedia':
406
-	$controller->setPageTitle(I18N::translate('Edit the media object'));
407
-	$action = 'update';
408
-	break;
409
-default:
410
-	throw new \Exception('Bad $action (' . $action . ') in addmedia.php');
400
+		return;
401
+	case 'showmediaform':
402
+		$controller->setPageTitle(I18N::translate('Create a media object'));
403
+		$action = 'create';
404
+		break;
405
+	case 'editmedia':
406
+		$controller->setPageTitle(I18N::translate('Edit the media object'));
407
+		$action = 'update';
408
+		break;
409
+	default:
410
+		throw new \Exception('Bad $action (' . $action . ') in addmedia.php');
411 411
 }
412 412
 
413 413
 $controller->pageHeader();
Please login to merge, or discard this patch.
relationship.php 1 patch
Switch Indentation   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -179,39 +179,39 @@
 block discarded – undo
179 179
 		foreach ($path as $n => $xref) {
180 180
 			if ($n % 2 === 1) {
181 181
 				switch ($relationships[$n]) {
182
-				case 'hus':
183
-				case 'wif':
184
-				case 'spo':
185
-				case 'bro':
186
-				case 'sis':
187
-				case 'sib':
188
-					$table[$x + 1][$y] = '<div style="background:url(' . Theme::theme()->parameter('image-hline') . ') repeat-x center;  width: 94px; text-align: center"><div class="hline-text" style="height: 32px;">' . Functions::getRelationshipNameFromPath($relationships[$n], Individual::getInstance($path[$n - 1], $WT_TREE), Individual::getInstance($path[$n + 1], $WT_TREE)) . '</div><div style="height: 32px;">' . $horizontal_arrow . '</div></div>';
189
-					$x += 2;
190
-					break;
191
-				case 'son':
192
-				case 'dau':
193
-				case 'chi':
194
-					if ($n > 2 && preg_match('/fat|mot|par/', $relationships[$n - 2])) {
195
-						$table[$x + 1][$y - 1] = '<div style="background:url(' . $diagonal2 . '); width: 64px; height: 64px; text-align: center;"><div style="height: 32px; text-align: end;">' . Functions::getRelationshipNameFromPath($relationships[$n], Individual::getInstance($path[$n - 1], $WT_TREE), Individual::getInstance($path[$n + 1], $WT_TREE)) . '</div><div style="height: 32px; text-align: start;">' . $down_arrow . '</div></div>';
182
+					case 'hus':
183
+					case 'wif':
184
+					case 'spo':
185
+					case 'bro':
186
+					case 'sis':
187
+					case 'sib':
188
+						$table[$x + 1][$y] = '<div style="background:url(' . Theme::theme()->parameter('image-hline') . ') repeat-x center;  width: 94px; text-align: center"><div class="hline-text" style="height: 32px;">' . Functions::getRelationshipNameFromPath($relationships[$n], Individual::getInstance($path[$n - 1], $WT_TREE), Individual::getInstance($path[$n + 1], $WT_TREE)) . '</div><div style="height: 32px;">' . $horizontal_arrow . '</div></div>';
196 189
 						$x += 2;
197
-					} else {
198
-						$table[$x][$y - 1] = '<div style="background:url(' . Theme::theme()
199
-								->parameter('image-vline') . ') repeat-y center; height: 64px; text-align: center;"><div class="vline-text" style="display: inline-block; width:50%; line-height: 64px;">' . Functions::getRelationshipNameFromPath($relationships[$n], Individual::getInstance($path[$n - 1], $WT_TREE), Individual::getInstance($path[$n + 1], $WT_TREE)) . '</div><div style="display: inline-block; width:50%; line-height: 64px;">' . $down_arrow . '</div></div>';
200
-					}
201
-					$y -= 2;
202
-					break;
203
-				case 'fat':
204
-				case 'mot':
205
-				case 'par':
206
-					if ($n > 2 && preg_match('/son|dau|chi/', $relationships[$n - 2])) {
207
-						$table[$x + 1][$y + 1] = '<div style="background:url(' . $diagonal1 . '); background-position: top right; width: 64px; height: 64px; text-align: center;"><div style="height: 32px; text-align: start;">' . Functions::getRelationshipNameFromPath($relationships[$n], Individual::getInstance($path[$n - 1], $WT_TREE), Individual::getInstance($path[$n + 1], $WT_TREE)) . '</div><div style="height: 32px; text-align: end;">' . $up_arrow . '</div></div>';
208
-						$x += 2;
209
-					} else {
210
-						$table[$x][$y + 1] = '<div style="background:url(' . Theme::theme()
211
-								->parameter('image-vline') . ') repeat-y center; height: 64px; text-align:center; "><div class="vline-text" style="display: inline-block; width: 50%; line-height: 32px;">' . Functions::getRelationshipNameFromPath($relationships[$n], Individual::getInstance($path[$n - 1], $WT_TREE), Individual::getInstance($path[$n + 1], $WT_TREE)) . '</div><div style="display: inline-block; width: 50%; line-height: 32px">' . $up_arrow . '</div></div>';
212
-					}
213
-					$y += 2;
214
-					break;
190
+						break;
191
+					case 'son':
192
+					case 'dau':
193
+					case 'chi':
194
+						if ($n > 2 && preg_match('/fat|mot|par/', $relationships[$n - 2])) {
195
+							$table[$x + 1][$y - 1] = '<div style="background:url(' . $diagonal2 . '); width: 64px; height: 64px; text-align: center;"><div style="height: 32px; text-align: end;">' . Functions::getRelationshipNameFromPath($relationships[$n], Individual::getInstance($path[$n - 1], $WT_TREE), Individual::getInstance($path[$n + 1], $WT_TREE)) . '</div><div style="height: 32px; text-align: start;">' . $down_arrow . '</div></div>';
196
+							$x += 2;
197
+						} else {
198
+							$table[$x][$y - 1] = '<div style="background:url(' . Theme::theme()
199
+									->parameter('image-vline') . ') repeat-y center; height: 64px; text-align: center;"><div class="vline-text" style="display: inline-block; width:50%; line-height: 64px;">' . Functions::getRelationshipNameFromPath($relationships[$n], Individual::getInstance($path[$n - 1], $WT_TREE), Individual::getInstance($path[$n + 1], $WT_TREE)) . '</div><div style="display: inline-block; width:50%; line-height: 64px;">' . $down_arrow . '</div></div>';
200
+						}
201
+						$y -= 2;
202
+						break;
203
+					case 'fat':
204
+					case 'mot':
205
+					case 'par':
206
+						if ($n > 2 && preg_match('/son|dau|chi/', $relationships[$n - 2])) {
207
+							$table[$x + 1][$y + 1] = '<div style="background:url(' . $diagonal1 . '); background-position: top right; width: 64px; height: 64px; text-align: center;"><div style="height: 32px; text-align: start;">' . Functions::getRelationshipNameFromPath($relationships[$n], Individual::getInstance($path[$n - 1], $WT_TREE), Individual::getInstance($path[$n + 1], $WT_TREE)) . '</div><div style="height: 32px; text-align: end;">' . $up_arrow . '</div></div>';
208
+							$x += 2;
209
+						} else {
210
+							$table[$x][$y + 1] = '<div style="background:url(' . Theme::theme()
211
+									->parameter('image-vline') . ') repeat-y center; height: 64px; text-align:center; "><div class="vline-text" style="display: inline-block; width: 50%; line-height: 32px;">' . Functions::getRelationshipNameFromPath($relationships[$n], Individual::getInstance($path[$n - 1], $WT_TREE), Individual::getInstance($path[$n + 1], $WT_TREE)) . '</div><div style="display: inline-block; width: 50%; line-height: 32px">' . $up_arrow . '</div></div>';
212
+						}
213
+						$y += 2;
214
+						break;
215 215
 				}
216 216
 				$max_x = max($max_x, $x);
217 217
 				$min_y = min($min_y, $y);
Please login to merge, or discard this patch.
admin_trees_config.php 1 patch
Switch Indentation   +152 added lines, -152 removed lines patch added patch discarded remove patch
@@ -132,176 +132,176 @@
 block discarded – undo
132 132
 $relatives_events = explode(',', $WT_TREE->getPreference('SHOW_RELATIVES_EVENTS'));
133 133
 
134 134
 switch (Filter::post('action')) {
135
-case 'privacy':
136
-	foreach (Filter::postArray('delete', WT_REGEX_INTEGER) as $delete_resn) {
137
-		Database::prepare(
138
-			"DELETE FROM `##default_resn` WHERE default_resn_id=?"
139
-		)->execute(array($delete_resn));
140
-	}
135
+	case 'privacy':
136
+		foreach (Filter::postArray('delete', WT_REGEX_INTEGER) as $delete_resn) {
137
+			Database::prepare(
138
+				"DELETE FROM `##default_resn` WHERE default_resn_id=?"
139
+			)->execute(array($delete_resn));
140
+		}
141 141
 
142
-	$xrefs     = Filter::postArray('xref', WT_REGEX_XREF);
143
-	$tag_types = Filter::postArray('tag_type', WT_REGEX_TAG);
144
-	$resns     = Filter::postArray('resn');
142
+		$xrefs     = Filter::postArray('xref', WT_REGEX_XREF);
143
+		$tag_types = Filter::postArray('tag_type', WT_REGEX_TAG);
144
+		$resns     = Filter::postArray('resn');
145 145
 
146
-	foreach ($xrefs as $n => $xref) {
147
-		$tag_type = $tag_types[$n];
148
-		$resn     = $resns[$n];
146
+		foreach ($xrefs as $n => $xref) {
147
+			$tag_type = $tag_types[$n];
148
+			$resn     = $resns[$n];
149 149
 
150
-		if ($tag_type || $xref) {
151
-			// Delete any existing data
152
-			if ($xref === '') {
153
-				Database::prepare(
154
-					"DELETE FROM `##default_resn` WHERE gedcom_id=? AND tag_type=? AND xref IS NULL"
155
-				)->execute(array($WT_TREE->getTreeId(), $tag_type));
156
-			}
157
-			if ($tag_type === '') {
150
+			if ($tag_type || $xref) {
151
+				// Delete any existing data
152
+				if ($xref === '') {
153
+					Database::prepare(
154
+						"DELETE FROM `##default_resn` WHERE gedcom_id=? AND tag_type=? AND xref IS NULL"
155
+					)->execute(array($WT_TREE->getTreeId(), $tag_type));
156
+				}
157
+				if ($tag_type === '') {
158
+					Database::prepare(
159
+						"DELETE FROM `##default_resn` WHERE gedcom_id=? AND xref=? AND tag_type IS NULL"
160
+					)->execute(array($WT_TREE->getTreeId(), $xref));
161
+				}
162
+				// Add (or update) the new data
158 163
 				Database::prepare(
159
-					"DELETE FROM `##default_resn` WHERE gedcom_id=? AND xref=? AND tag_type IS NULL"
160
-				)->execute(array($WT_TREE->getTreeId(), $xref));
164
+					"REPLACE INTO `##default_resn` (gedcom_id, xref, tag_type, resn) VALUES (?, NULLIF(?, ''), NULLIF(?, ''), ?)"
165
+				)->execute(array($WT_TREE->getTreeId(), $xref, $tag_type, $resn));
161 166
 			}
162
-			// Add (or update) the new data
163
-			Database::prepare(
164
-				"REPLACE INTO `##default_resn` (gedcom_id, xref, tag_type, resn) VALUES (?, NULLIF(?, ''), NULLIF(?, ''), ?)"
165
-			)->execute(array($WT_TREE->getTreeId(), $xref, $tag_type, $resn));
166 167
 		}
167
-	}
168 168
 
169
-	$WT_TREE->setPreference('HIDE_LIVE_PEOPLE', Filter::postBool('HIDE_LIVE_PEOPLE'));
170
-	$WT_TREE->setPreference('KEEP_ALIVE_YEARS_BIRTH', Filter::post('KEEP_ALIVE_YEARS_BIRTH', WT_REGEX_INTEGER, 0));
171
-	$WT_TREE->setPreference('KEEP_ALIVE_YEARS_DEATH', Filter::post('KEEP_ALIVE_YEARS_DEATH', WT_REGEX_INTEGER, 0));
172
-	$WT_TREE->setPreference('MAX_ALIVE_AGE', Filter::post('MAX_ALIVE_AGE', WT_REGEX_INTEGER, 100));
173
-	$WT_TREE->setPreference('REQUIRE_AUTHENTICATION', Filter::postBool('REQUIRE_AUTHENTICATION'));
174
-	$WT_TREE->setPreference('SHOW_DEAD_PEOPLE', Filter::post('SHOW_DEAD_PEOPLE'));
175
-	$WT_TREE->setPreference('SHOW_LIVING_NAMES', Filter::post('SHOW_LIVING_NAMES'));
176
-	$WT_TREE->setPreference('SHOW_PRIVATE_RELATIONSHIPS', Filter::post('SHOW_PRIVATE_RELATIONSHIPS'));
169
+		$WT_TREE->setPreference('HIDE_LIVE_PEOPLE', Filter::postBool('HIDE_LIVE_PEOPLE'));
170
+		$WT_TREE->setPreference('KEEP_ALIVE_YEARS_BIRTH', Filter::post('KEEP_ALIVE_YEARS_BIRTH', WT_REGEX_INTEGER, 0));
171
+		$WT_TREE->setPreference('KEEP_ALIVE_YEARS_DEATH', Filter::post('KEEP_ALIVE_YEARS_DEATH', WT_REGEX_INTEGER, 0));
172
+		$WT_TREE->setPreference('MAX_ALIVE_AGE', Filter::post('MAX_ALIVE_AGE', WT_REGEX_INTEGER, 100));
173
+		$WT_TREE->setPreference('REQUIRE_AUTHENTICATION', Filter::postBool('REQUIRE_AUTHENTICATION'));
174
+		$WT_TREE->setPreference('SHOW_DEAD_PEOPLE', Filter::post('SHOW_DEAD_PEOPLE'));
175
+		$WT_TREE->setPreference('SHOW_LIVING_NAMES', Filter::post('SHOW_LIVING_NAMES'));
176
+		$WT_TREE->setPreference('SHOW_PRIVATE_RELATIONSHIPS', Filter::post('SHOW_PRIVATE_RELATIONSHIPS'));
177 177
 
178
-	FlashMessages::addMessage(I18N::translate('The preferences for the family tree “%s” have been updated.', $WT_TREE->getTitleHtml()), 'success');
179
-	header('Location: ' . WT_BASE_URL . 'admin_trees_manage.php?ged=' . $WT_TREE->getNameUrl());
178
+		FlashMessages::addMessage(I18N::translate('The preferences for the family tree “%s” have been updated.', $WT_TREE->getTitleHtml()), 'success');
179
+		header('Location: ' . WT_BASE_URL . 'admin_trees_manage.php?ged=' . $WT_TREE->getNameUrl());
180 180
 
181
-	return;
181
+		return;
182 182
 
183
-case 'general':
184
-	if (!Filter::checkCsrf()) {
185
-		break;
186
-	}
183
+	case 'general':
184
+		if (!Filter::checkCsrf()) {
185
+			break;
186
+		}
187 187
 
188
-	// Coming soon
189
-	if (Filter::postBool('all_trees')) {
190
-		FlashMessages::addMessage(I18N::translate('The preferences for all family trees have been updated.', $WT_TREE->getTitleHtml()), 'success');
191
-	}
192
-	if (Filter::postBool('new_trees')) {
193
-		FlashMessages::addMessage(I18N::translate('The preferences for new family trees have been updated.', $WT_TREE->getTitleHtml()), 'success');
194
-	}
188
+		// Coming soon
189
+		if (Filter::postBool('all_trees')) {
190
+			FlashMessages::addMessage(I18N::translate('The preferences for all family trees have been updated.', $WT_TREE->getTitleHtml()), 'success');
191
+		}
192
+		if (Filter::postBool('new_trees')) {
193
+			FlashMessages::addMessage(I18N::translate('The preferences for new family trees have been updated.', $WT_TREE->getTitleHtml()), 'success');
194
+		}
195 195
 
196
-	$WT_TREE->setPreference('ADVANCED_NAME_FACTS', Filter::post('ADVANCED_NAME_FACTS'));
197
-	$WT_TREE->setPreference('ADVANCED_PLAC_FACTS', Filter::post('ADVANCED_PLAC_FACTS'));
198
-	$WT_TREE->setPreference('ALLOW_THEME_DROPDOWN', Filter::postBool('ALLOW_THEME_DROPDOWN'));
199
-	// For backwards compatibility with webtrees 1.x we store the two calendar formats in one variable
200
-	// e.g. "gregorian_and_jewish"
201
-	$WT_TREE->setPreference('CALENDAR_FORMAT', implode('_and_', array_unique(array(
202
-		Filter::post('CALENDAR_FORMAT0', 'gregorian|julian|french|jewish|hijri|jalali', 'none'),
203
-		Filter::post('CALENDAR_FORMAT1', 'gregorian|julian|french|jewish|hijri|jalali', 'none'),
204
-	))));
205
-	$WT_TREE->setPreference('CHART_BOX_TAGS', Filter::post('CHART_BOX_TAGS'));
206
-	$WT_TREE->setPreference('CONTACT_USER_ID', Filter::post('CONTACT_USER_ID'));
207
-	$WT_TREE->setPreference('DEFAULT_PEDIGREE_GENERATIONS', Filter::post('DEFAULT_PEDIGREE_GENERATIONS'));
208
-	$WT_TREE->setPreference('EXPAND_NOTES', Filter::postBool('EXPAND_NOTES'));
209
-	$WT_TREE->setPreference('EXPAND_SOURCES', Filter::postBool('EXPAND_SOURCES'));
210
-	$WT_TREE->setPreference('FAM_FACTS_ADD', str_replace(' ', '', Filter::post('FAM_FACTS_ADD')));
211
-	$WT_TREE->setPreference('FAM_FACTS_QUICK', str_replace(' ', '', Filter::post('FAM_FACTS_QUICK')));
212
-	$WT_TREE->setPreference('FAM_FACTS_UNIQUE', str_replace(' ', '', Filter::post('FAM_FACTS_UNIQUE')));
213
-	$WT_TREE->setPreference('FAM_ID_PREFIX', Filter::post('FAM_ID_PREFIX'));
214
-	$WT_TREE->setPreference('FULL_SOURCES', Filter::postBool('FULL_SOURCES'));
215
-	$WT_TREE->setPreference('FORMAT_TEXT', Filter::post('FORMAT_TEXT'));
216
-	$WT_TREE->setPreference('GEDCOM_ID_PREFIX', Filter::post('GEDCOM_ID_PREFIX'));
217
-	$WT_TREE->setPreference('GEDCOM_MEDIA_PATH', Filter::post('GEDCOM_MEDIA_PATH'));
218
-	$WT_TREE->setPreference('GENERATE_UIDS', Filter::postBool('GENERATE_UIDS'));
219
-	$WT_TREE->setPreference('GEONAMES_ACCOUNT', Filter::post('GEONAMES_ACCOUNT'));
220
-	$WT_TREE->setPreference('HIDE_GEDCOM_ERRORS', Filter::postBool('HIDE_GEDCOM_ERRORS'));
221
-	$WT_TREE->setPreference('INDI_FACTS_ADD', str_replace(' ', '', Filter::post('INDI_FACTS_ADD')));
222
-	$WT_TREE->setPreference('INDI_FACTS_QUICK', str_replace(' ', '', Filter::post('INDI_FACTS_QUICK')));
223
-	$WT_TREE->setPreference('INDI_FACTS_UNIQUE', str_replace(' ', '', Filter::post('INDI_FACTS_UNIQUE')));
224
-	$WT_TREE->setPreference('LANGUAGE', Filter::post('LANGUAGE'));
225
-	$WT_TREE->setPreference('MAX_DESCENDANCY_GENERATIONS', Filter::post('MAX_DESCENDANCY_GENERATIONS'));
226
-	$WT_TREE->setPreference('MAX_PEDIGREE_GENERATIONS', Filter::post('MAX_PEDIGREE_GENERATIONS'));
227
-	$WT_TREE->setPreference('MEDIA_ID_PREFIX', Filter::post('MEDIA_ID_PREFIX'));
228
-	$WT_TREE->setPreference('MEDIA_UPLOAD', Filter::post('MEDIA_UPLOAD'));
229
-	$WT_TREE->setPreference('META_DESCRIPTION', Filter::post('META_DESCRIPTION'));
230
-	$WT_TREE->setPreference('META_TITLE', Filter::post('META_TITLE'));
231
-	$WT_TREE->setPreference('NOTE_ID_PREFIX', Filter::post('NOTE_ID_PREFIX'));
232
-	$WT_TREE->setPreference('NO_UPDATE_CHAN', Filter::postBool('NO_UPDATE_CHAN'));
233
-	$WT_TREE->setPreference('PEDIGREE_FULL_DETAILS', Filter::postBool('PEDIGREE_FULL_DETAILS'));
234
-	$WT_TREE->setPreference('PEDIGREE_LAYOUT', Filter::postBool('PEDIGREE_LAYOUT'));
235
-	$WT_TREE->setPreference('PEDIGREE_ROOT_ID', Filter::post('PEDIGREE_ROOT_ID', WT_REGEX_XREF));
236
-	$WT_TREE->setPreference('PEDIGREE_SHOW_GENDER', Filter::postBool('PEDIGREE_SHOW_GENDER'));
237
-	$WT_TREE->setPreference('PREFER_LEVEL2_SOURCES', Filter::post('PREFER_LEVEL2_SOURCES'));
238
-	$WT_TREE->setPreference('QUICK_REQUIRED_FACTS', Filter::post('QUICK_REQUIRED_FACTS'));
239
-	$WT_TREE->setPreference('QUICK_REQUIRED_FAMFACTS', Filter::post('QUICK_REQUIRED_FAMFACTS'));
240
-	$WT_TREE->setPreference('REPO_FACTS_ADD', str_replace(' ', '', Filter::post('REPO_FACTS_ADD')));
241
-	$WT_TREE->setPreference('REPO_FACTS_QUICK', str_replace(' ', '', Filter::post('REPO_FACTS_QUICK')));
242
-	$WT_TREE->setPreference('REPO_FACTS_UNIQUE', str_replace(' ', '', Filter::post('REPO_FACTS_UNIQUE')));
243
-	$WT_TREE->setPreference('REPO_ID_PREFIX', Filter::post('REPO_ID_PREFIX'));
244
-	$WT_TREE->setPreference('SAVE_WATERMARK_IMAGE', Filter::postBool('SAVE_WATERMARK_IMAGE'));
245
-	$WT_TREE->setPreference('SAVE_WATERMARK_THUMB', Filter::postBool('SAVE_WATERMARK_THUMB'));
246
-	$WT_TREE->setPreference('SHOW_COUNTER', Filter::postBool('SHOW_COUNTER'));
247
-	$WT_TREE->setPreference('SHOW_EST_LIST_DATES', Filter::postBool('SHOW_EST_LIST_DATES'));
248
-	$WT_TREE->setPreference('SHOW_FACT_ICONS', Filter::postBool('SHOW_FACT_ICONS'));
249
-	$WT_TREE->setPreference('SHOW_GEDCOM_RECORD', Filter::postBool('SHOW_GEDCOM_RECORD'));
250
-	$WT_TREE->setPreference('SHOW_HIGHLIGHT_IMAGES', Filter::postBool('SHOW_HIGHLIGHT_IMAGES'));
251
-	$WT_TREE->setPreference('SHOW_LAST_CHANGE', Filter::postBool('SHOW_LAST_CHANGE'));
252
-	$WT_TREE->setPreference('SHOW_LDS_AT_GLANCE', Filter::postBool('SHOW_LDS_AT_GLANCE'));
253
-	$WT_TREE->setPreference('SHOW_MEDIA_DOWNLOAD', Filter::post('SHOW_MEDIA_DOWNLOAD'));
254
-	$WT_TREE->setPreference('SHOW_NO_WATERMARK', Filter::post('SHOW_NO_WATERMARK'));
255
-	$WT_TREE->setPreference('SHOW_PARENTS_AGE', Filter::postBool('SHOW_PARENTS_AGE'));
256
-	$WT_TREE->setPreference('SHOW_PEDIGREE_PLACES', Filter::post('SHOW_PEDIGREE_PLACES'));
257
-	$WT_TREE->setPreference('SHOW_PEDIGREE_PLACES_SUFFIX', Filter::postBool('SHOW_PEDIGREE_PLACES_SUFFIX'));
258
-	$WT_TREE->setPreference('SHOW_RELATIVES_EVENTS', implode(',', Filter::postArray('SHOW_RELATIVES_EVENTS')));
259
-	$WT_TREE->setPreference('SOURCE_ID_PREFIX', Filter::post('SOURCE_ID_PREFIX'));
260
-	$WT_TREE->setPreference('SOUR_FACTS_ADD', str_replace(' ', '', Filter::post('SOUR_FACTS_ADD')));
261
-	$WT_TREE->setPreference('SOUR_FACTS_QUICK', str_replace(' ', '', Filter::post('SOUR_FACTS_QUICK')));
262
-	$WT_TREE->setPreference('SOUR_FACTS_UNIQUE', str_replace(' ', '', Filter::post('SOUR_FACTS_UNIQUE')));
263
-	$WT_TREE->setPreference('SUBLIST_TRIGGER_I', Filter::post('SUBLIST_TRIGGER_I', WT_REGEX_INTEGER, 200));
264
-	$WT_TREE->setPreference('SURNAME_LIST_STYLE', Filter::post('SURNAME_LIST_STYLE'));
265
-	$WT_TREE->setPreference('SURNAME_TRADITION', Filter::post('SURNAME_TRADITION'));
266
-	$WT_TREE->setPreference('THEME_DIR', Filter::post('THEME_DIR'));
267
-	$WT_TREE->setPreference('THUMBNAIL_WIDTH', Filter::post('THUMBNAIL_WIDTH'));
268
-	$WT_TREE->setPreference('USE_SILHOUETTE', Filter::postBool('USE_SILHOUETTE'));
269
-	$WT_TREE->setPreference('WATERMARK_THUMB', Filter::postBool('WATERMARK_THUMB'));
270
-	$WT_TREE->setPreference('WEBMASTER_USER_ID', Filter::post('WEBMASTER_USER_ID'));
271
-	$WT_TREE->setPreference('WEBTREES_EMAIL', Filter::post('WEBTREES_EMAIL'));
272
-	$WT_TREE->setPreference('title', Filter::post('title'));
273
-
274
-	// Only accept valid folders for MEDIA_DIRECTORY
275
-	$MEDIA_DIRECTORY = preg_replace('/[\/\\\\]+/', '/', Filter::post('MEDIA_DIRECTORY') . '/');
276
-	if (substr($MEDIA_DIRECTORY, 0, 1) === '/') {
277
-		$MEDIA_DIRECTORY = substr($MEDIA_DIRECTORY, 1);
278
-	}
196
+		$WT_TREE->setPreference('ADVANCED_NAME_FACTS', Filter::post('ADVANCED_NAME_FACTS'));
197
+		$WT_TREE->setPreference('ADVANCED_PLAC_FACTS', Filter::post('ADVANCED_PLAC_FACTS'));
198
+		$WT_TREE->setPreference('ALLOW_THEME_DROPDOWN', Filter::postBool('ALLOW_THEME_DROPDOWN'));
199
+		// For backwards compatibility with webtrees 1.x we store the two calendar formats in one variable
200
+		// e.g. "gregorian_and_jewish"
201
+		$WT_TREE->setPreference('CALENDAR_FORMAT', implode('_and_', array_unique(array(
202
+			Filter::post('CALENDAR_FORMAT0', 'gregorian|julian|french|jewish|hijri|jalali', 'none'),
203
+			Filter::post('CALENDAR_FORMAT1', 'gregorian|julian|french|jewish|hijri|jalali', 'none'),
204
+		))));
205
+		$WT_TREE->setPreference('CHART_BOX_TAGS', Filter::post('CHART_BOX_TAGS'));
206
+		$WT_TREE->setPreference('CONTACT_USER_ID', Filter::post('CONTACT_USER_ID'));
207
+		$WT_TREE->setPreference('DEFAULT_PEDIGREE_GENERATIONS', Filter::post('DEFAULT_PEDIGREE_GENERATIONS'));
208
+		$WT_TREE->setPreference('EXPAND_NOTES', Filter::postBool('EXPAND_NOTES'));
209
+		$WT_TREE->setPreference('EXPAND_SOURCES', Filter::postBool('EXPAND_SOURCES'));
210
+		$WT_TREE->setPreference('FAM_FACTS_ADD', str_replace(' ', '', Filter::post('FAM_FACTS_ADD')));
211
+		$WT_TREE->setPreference('FAM_FACTS_QUICK', str_replace(' ', '', Filter::post('FAM_FACTS_QUICK')));
212
+		$WT_TREE->setPreference('FAM_FACTS_UNIQUE', str_replace(' ', '', Filter::post('FAM_FACTS_UNIQUE')));
213
+		$WT_TREE->setPreference('FAM_ID_PREFIX', Filter::post('FAM_ID_PREFIX'));
214
+		$WT_TREE->setPreference('FULL_SOURCES', Filter::postBool('FULL_SOURCES'));
215
+		$WT_TREE->setPreference('FORMAT_TEXT', Filter::post('FORMAT_TEXT'));
216
+		$WT_TREE->setPreference('GEDCOM_ID_PREFIX', Filter::post('GEDCOM_ID_PREFIX'));
217
+		$WT_TREE->setPreference('GEDCOM_MEDIA_PATH', Filter::post('GEDCOM_MEDIA_PATH'));
218
+		$WT_TREE->setPreference('GENERATE_UIDS', Filter::postBool('GENERATE_UIDS'));
219
+		$WT_TREE->setPreference('GEONAMES_ACCOUNT', Filter::post('GEONAMES_ACCOUNT'));
220
+		$WT_TREE->setPreference('HIDE_GEDCOM_ERRORS', Filter::postBool('HIDE_GEDCOM_ERRORS'));
221
+		$WT_TREE->setPreference('INDI_FACTS_ADD', str_replace(' ', '', Filter::post('INDI_FACTS_ADD')));
222
+		$WT_TREE->setPreference('INDI_FACTS_QUICK', str_replace(' ', '', Filter::post('INDI_FACTS_QUICK')));
223
+		$WT_TREE->setPreference('INDI_FACTS_UNIQUE', str_replace(' ', '', Filter::post('INDI_FACTS_UNIQUE')));
224
+		$WT_TREE->setPreference('LANGUAGE', Filter::post('LANGUAGE'));
225
+		$WT_TREE->setPreference('MAX_DESCENDANCY_GENERATIONS', Filter::post('MAX_DESCENDANCY_GENERATIONS'));
226
+		$WT_TREE->setPreference('MAX_PEDIGREE_GENERATIONS', Filter::post('MAX_PEDIGREE_GENERATIONS'));
227
+		$WT_TREE->setPreference('MEDIA_ID_PREFIX', Filter::post('MEDIA_ID_PREFIX'));
228
+		$WT_TREE->setPreference('MEDIA_UPLOAD', Filter::post('MEDIA_UPLOAD'));
229
+		$WT_TREE->setPreference('META_DESCRIPTION', Filter::post('META_DESCRIPTION'));
230
+		$WT_TREE->setPreference('META_TITLE', Filter::post('META_TITLE'));
231
+		$WT_TREE->setPreference('NOTE_ID_PREFIX', Filter::post('NOTE_ID_PREFIX'));
232
+		$WT_TREE->setPreference('NO_UPDATE_CHAN', Filter::postBool('NO_UPDATE_CHAN'));
233
+		$WT_TREE->setPreference('PEDIGREE_FULL_DETAILS', Filter::postBool('PEDIGREE_FULL_DETAILS'));
234
+		$WT_TREE->setPreference('PEDIGREE_LAYOUT', Filter::postBool('PEDIGREE_LAYOUT'));
235
+		$WT_TREE->setPreference('PEDIGREE_ROOT_ID', Filter::post('PEDIGREE_ROOT_ID', WT_REGEX_XREF));
236
+		$WT_TREE->setPreference('PEDIGREE_SHOW_GENDER', Filter::postBool('PEDIGREE_SHOW_GENDER'));
237
+		$WT_TREE->setPreference('PREFER_LEVEL2_SOURCES', Filter::post('PREFER_LEVEL2_SOURCES'));
238
+		$WT_TREE->setPreference('QUICK_REQUIRED_FACTS', Filter::post('QUICK_REQUIRED_FACTS'));
239
+		$WT_TREE->setPreference('QUICK_REQUIRED_FAMFACTS', Filter::post('QUICK_REQUIRED_FAMFACTS'));
240
+		$WT_TREE->setPreference('REPO_FACTS_ADD', str_replace(' ', '', Filter::post('REPO_FACTS_ADD')));
241
+		$WT_TREE->setPreference('REPO_FACTS_QUICK', str_replace(' ', '', Filter::post('REPO_FACTS_QUICK')));
242
+		$WT_TREE->setPreference('REPO_FACTS_UNIQUE', str_replace(' ', '', Filter::post('REPO_FACTS_UNIQUE')));
243
+		$WT_TREE->setPreference('REPO_ID_PREFIX', Filter::post('REPO_ID_PREFIX'));
244
+		$WT_TREE->setPreference('SAVE_WATERMARK_IMAGE', Filter::postBool('SAVE_WATERMARK_IMAGE'));
245
+		$WT_TREE->setPreference('SAVE_WATERMARK_THUMB', Filter::postBool('SAVE_WATERMARK_THUMB'));
246
+		$WT_TREE->setPreference('SHOW_COUNTER', Filter::postBool('SHOW_COUNTER'));
247
+		$WT_TREE->setPreference('SHOW_EST_LIST_DATES', Filter::postBool('SHOW_EST_LIST_DATES'));
248
+		$WT_TREE->setPreference('SHOW_FACT_ICONS', Filter::postBool('SHOW_FACT_ICONS'));
249
+		$WT_TREE->setPreference('SHOW_GEDCOM_RECORD', Filter::postBool('SHOW_GEDCOM_RECORD'));
250
+		$WT_TREE->setPreference('SHOW_HIGHLIGHT_IMAGES', Filter::postBool('SHOW_HIGHLIGHT_IMAGES'));
251
+		$WT_TREE->setPreference('SHOW_LAST_CHANGE', Filter::postBool('SHOW_LAST_CHANGE'));
252
+		$WT_TREE->setPreference('SHOW_LDS_AT_GLANCE', Filter::postBool('SHOW_LDS_AT_GLANCE'));
253
+		$WT_TREE->setPreference('SHOW_MEDIA_DOWNLOAD', Filter::post('SHOW_MEDIA_DOWNLOAD'));
254
+		$WT_TREE->setPreference('SHOW_NO_WATERMARK', Filter::post('SHOW_NO_WATERMARK'));
255
+		$WT_TREE->setPreference('SHOW_PARENTS_AGE', Filter::postBool('SHOW_PARENTS_AGE'));
256
+		$WT_TREE->setPreference('SHOW_PEDIGREE_PLACES', Filter::post('SHOW_PEDIGREE_PLACES'));
257
+		$WT_TREE->setPreference('SHOW_PEDIGREE_PLACES_SUFFIX', Filter::postBool('SHOW_PEDIGREE_PLACES_SUFFIX'));
258
+		$WT_TREE->setPreference('SHOW_RELATIVES_EVENTS', implode(',', Filter::postArray('SHOW_RELATIVES_EVENTS')));
259
+		$WT_TREE->setPreference('SOURCE_ID_PREFIX', Filter::post('SOURCE_ID_PREFIX'));
260
+		$WT_TREE->setPreference('SOUR_FACTS_ADD', str_replace(' ', '', Filter::post('SOUR_FACTS_ADD')));
261
+		$WT_TREE->setPreference('SOUR_FACTS_QUICK', str_replace(' ', '', Filter::post('SOUR_FACTS_QUICK')));
262
+		$WT_TREE->setPreference('SOUR_FACTS_UNIQUE', str_replace(' ', '', Filter::post('SOUR_FACTS_UNIQUE')));
263
+		$WT_TREE->setPreference('SUBLIST_TRIGGER_I', Filter::post('SUBLIST_TRIGGER_I', WT_REGEX_INTEGER, 200));
264
+		$WT_TREE->setPreference('SURNAME_LIST_STYLE', Filter::post('SURNAME_LIST_STYLE'));
265
+		$WT_TREE->setPreference('SURNAME_TRADITION', Filter::post('SURNAME_TRADITION'));
266
+		$WT_TREE->setPreference('THEME_DIR', Filter::post('THEME_DIR'));
267
+		$WT_TREE->setPreference('THUMBNAIL_WIDTH', Filter::post('THUMBNAIL_WIDTH'));
268
+		$WT_TREE->setPreference('USE_SILHOUETTE', Filter::postBool('USE_SILHOUETTE'));
269
+		$WT_TREE->setPreference('WATERMARK_THUMB', Filter::postBool('WATERMARK_THUMB'));
270
+		$WT_TREE->setPreference('WEBMASTER_USER_ID', Filter::post('WEBMASTER_USER_ID'));
271
+		$WT_TREE->setPreference('WEBTREES_EMAIL', Filter::post('WEBTREES_EMAIL'));
272
+		$WT_TREE->setPreference('title', Filter::post('title'));
273
+
274
+		// Only accept valid folders for MEDIA_DIRECTORY
275
+		$MEDIA_DIRECTORY = preg_replace('/[\/\\\\]+/', '/', Filter::post('MEDIA_DIRECTORY') . '/');
276
+		if (substr($MEDIA_DIRECTORY, 0, 1) === '/') {
277
+			$MEDIA_DIRECTORY = substr($MEDIA_DIRECTORY, 1);
278
+		}
279 279
 
280
-	if ($MEDIA_DIRECTORY) {
281
-		if (is_dir(WT_DATA_DIR . $MEDIA_DIRECTORY)) {
282
-			$WT_TREE->setPreference('MEDIA_DIRECTORY', $MEDIA_DIRECTORY);
283
-		} elseif (File::mkdir(WT_DATA_DIR . $MEDIA_DIRECTORY)) {
284
-			$WT_TREE->setPreference('MEDIA_DIRECTORY', $MEDIA_DIRECTORY);
285
-			FlashMessages::addMessage(I18N::translate('The folder %s has been created.', Html::filename(WT_DATA_DIR . $MEDIA_DIRECTORY)), 'info');
286
-		} else {
287
-			FlashMessages::addMessage(I18N::translate('The folder %s does not exist, and it could not be created.', Html::filename(WT_DATA_DIR . $MEDIA_DIRECTORY)), 'danger');
280
+		if ($MEDIA_DIRECTORY) {
281
+			if (is_dir(WT_DATA_DIR . $MEDIA_DIRECTORY)) {
282
+				$WT_TREE->setPreference('MEDIA_DIRECTORY', $MEDIA_DIRECTORY);
283
+			} elseif (File::mkdir(WT_DATA_DIR . $MEDIA_DIRECTORY)) {
284
+				$WT_TREE->setPreference('MEDIA_DIRECTORY', $MEDIA_DIRECTORY);
285
+				FlashMessages::addMessage(I18N::translate('The folder %s has been created.', Html::filename(WT_DATA_DIR . $MEDIA_DIRECTORY)), 'info');
286
+			} else {
287
+				FlashMessages::addMessage(I18N::translate('The folder %s does not exist, and it could not be created.', Html::filename(WT_DATA_DIR . $MEDIA_DIRECTORY)), 'danger');
288
+			}
288 289
 		}
289
-	}
290 290
 
291
-	$gedcom = Filter::post('gedcom');
292
-	if ($gedcom && $gedcom !== $WT_TREE->getName()) {
293
-		try {
294
-			Database::prepare("UPDATE `##gedcom` SET gedcom_name = ? WHERE gedcom_id = ?")->execute(array($gedcom, $WT_TREE->getTreeId()));
295
-			Database::prepare("UPDATE `##site_setting` SET setting_value = ? WHERE setting_name='DEFAULT_GEDCOM' AND setting_value = ?")->execute(array($gedcom, $WT_TREE->getName()));
296
-		} catch (\Exception $ex) {
297
-			// Probably a duplicate name.
291
+		$gedcom = Filter::post('gedcom');
292
+		if ($gedcom && $gedcom !== $WT_TREE->getName()) {
293
+			try {
294
+				Database::prepare("UPDATE `##gedcom` SET gedcom_name = ? WHERE gedcom_id = ?")->execute(array($gedcom, $WT_TREE->getTreeId()));
295
+				Database::prepare("UPDATE `##site_setting` SET setting_value = ? WHERE setting_name='DEFAULT_GEDCOM' AND setting_value = ?")->execute(array($gedcom, $WT_TREE->getName()));
296
+			} catch (\Exception $ex) {
297
+				// Probably a duplicate name.
298
+			}
298 299
 		}
299
-	}
300 300
 
301
-	FlashMessages::addMessage(I18N::translate('The preferences for the family tree “%s” have been updated.', $WT_TREE->getTitleHtml()), 'success');
302
-	header('Location: ' . WT_BASE_URL . 'admin_trees_manage.php');
301
+		FlashMessages::addMessage(I18N::translate('The preferences for the family tree “%s” have been updated.', $WT_TREE->getTitleHtml()), 'success');
302
+		header('Location: ' . WT_BASE_URL . 'admin_trees_manage.php');
303 303
 
304
-	return;
304
+		return;
305 305
 }
306 306
 
307 307
 switch (Filter::get('action')) {
Please login to merge, or discard this patch.
editnews.php 1 patch
Switch Indentation   +38 added lines, -38 removed lines patch added patch discarded remove patch
@@ -44,44 +44,44 @@
 block discarded – undo
44 44
 $text      = Filter::post('text');
45 45
 
46 46
 switch ($action) {
47
-case 'compose':
48
-	if (Module::getModuleByName('ckeditor')) {
49
-		CkeditorModule::enableEditor($controller);
50
-	}
47
+	case 'compose':
48
+		if (Module::getModuleByName('ckeditor')) {
49
+			CkeditorModule::enableEditor($controller);
50
+		}
51 51
 
52
-	echo '<h3>' . I18N::translate('Add/edit a journal/news entry') . '</h3>';
53
-	echo '<form style="overflow: hidden;" name="messageform" method="post" action="editnews.php?action=save&news_id=' . $news_id . '">';
54
-	if ($news_id) {
55
-		$news = Database::prepare("SELECT SQL_CACHE news_id AS id, user_id, gedcom_id, UNIX_TIMESTAMP(updated) AS date, subject, body FROM `##news` WHERE news_id=?")->execute(array($news_id))->fetchOneRow(PDO::FETCH_ASSOC);
56
-	} else {
57
-		$news              = array();
58
-		$news['user_id']   = $user_id;
59
-		$news['gedcom_id'] = $gedcom_id;
60
-		$news['date']      = WT_TIMESTAMP;
61
-		$news['subject']   = '';
62
-		$news['body']      = '';
63
-	}
64
-	echo '<input type="hidden" name="user_id" value="' . $news['user_id'] . '">';
65
-	echo '<input type="hidden" name="gedcom_id" value="' . $news['gedcom_id'] . '">';
66
-	echo '<input type="hidden" name="date" value="' . $news['date'] . '">';
67
-	echo '<table>';
68
-	echo '<tr><th style="text-align:start;">' . I18N::translate('Title') . '</th><tr>';
69
-	echo '<tr><td><input type="text" name="title" size="50" dir="auto" autofocus value="' . $news['subject'] . '"></td></tr>';
70
-	echo '<tr><th style="text-align:start;">' . I18N::translate('Content') . '</th></tr>';
71
-	echo '<tr><td>';
72
-	echo '<textarea name="text" class="html-edit" cols="80" rows="10" dir="auto">' . Filter::escapeHtml($news['body']) . '</textarea>';
73
-	echo '</td></tr>';
74
-	echo '<tr><td><input type="submit" value="' . I18N::translate('save') . '"></td></tr>';
75
-	echo '</table>';
76
-	echo '</form>';
77
-	break;
78
-case 'save':
79
-	if ($news_id) {
80
-		Database::prepare("UPDATE `##news` SET subject=?, body=?, updated=FROM_UNIXTIME(?) WHERE news_id=?")->execute(array($title, $text, $date, $news_id));
81
-	} else {
82
-		Database::prepare("INSERT INTO `##news` (user_id, gedcom_id, subject, body, updated) VALUES (NULLIF(?, ''), NULLIF(?, '') ,? ,?, CURRENT_TIMESTAMP)")->execute(array($user_id, $gedcom_id, $title, $text));
83
-	}
52
+		echo '<h3>' . I18N::translate('Add/edit a journal/news entry') . '</h3>';
53
+		echo '<form style="overflow: hidden;" name="messageform" method="post" action="editnews.php?action=save&news_id=' . $news_id . '">';
54
+		if ($news_id) {
55
+			$news = Database::prepare("SELECT SQL_CACHE news_id AS id, user_id, gedcom_id, UNIX_TIMESTAMP(updated) AS date, subject, body FROM `##news` WHERE news_id=?")->execute(array($news_id))->fetchOneRow(PDO::FETCH_ASSOC);
56
+		} else {
57
+			$news              = array();
58
+			$news['user_id']   = $user_id;
59
+			$news['gedcom_id'] = $gedcom_id;
60
+			$news['date']      = WT_TIMESTAMP;
61
+			$news['subject']   = '';
62
+			$news['body']      = '';
63
+		}
64
+		echo '<input type="hidden" name="user_id" value="' . $news['user_id'] . '">';
65
+		echo '<input type="hidden" name="gedcom_id" value="' . $news['gedcom_id'] . '">';
66
+		echo '<input type="hidden" name="date" value="' . $news['date'] . '">';
67
+		echo '<table>';
68
+		echo '<tr><th style="text-align:start;">' . I18N::translate('Title') . '</th><tr>';
69
+		echo '<tr><td><input type="text" name="title" size="50" dir="auto" autofocus value="' . $news['subject'] . '"></td></tr>';
70
+		echo '<tr><th style="text-align:start;">' . I18N::translate('Content') . '</th></tr>';
71
+		echo '<tr><td>';
72
+		echo '<textarea name="text" class="html-edit" cols="80" rows="10" dir="auto">' . Filter::escapeHtml($news['body']) . '</textarea>';
73
+		echo '</td></tr>';
74
+		echo '<tr><td><input type="submit" value="' . I18N::translate('save') . '"></td></tr>';
75
+		echo '</table>';
76
+		echo '</form>';
77
+		break;
78
+	case 'save':
79
+		if ($news_id) {
80
+			Database::prepare("UPDATE `##news` SET subject=?, body=?, updated=FROM_UNIXTIME(?) WHERE news_id=?")->execute(array($title, $text, $date, $news_id));
81
+		} else {
82
+			Database::prepare("INSERT INTO `##news` (user_id, gedcom_id, subject, body, updated) VALUES (NULLIF(?, ''), NULLIF(?, '') ,? ,?, CURRENT_TIMESTAMP)")->execute(array($user_id, $gedcom_id, $title, $text));
83
+		}
84 84
 
85
-	$controller->addInlineJavascript('window.opener.location.reload();window.close();');
86
-	break;
85
+		$controller->addInlineJavascript('window.opener.location.reload();window.close();');
86
+		break;
87 87
 }
Please login to merge, or discard this patch.
help_text.php 1 patch
Switch Indentation   +188 added lines, -188 removed lines patch added patch discarded remove patch
@@ -32,102 +32,102 @@  discard block
 block discarded – undo
32 32
 	// Generally, these tags need to be lists explicitly in FunctionsEdit::add_simple_tag()
33 33
 	//////////////////////////////////////////////////////////////////////////////
34 34
 
35
-case 'DATE':
36
-	$title = GedcomTag::getLabel('DATE');
37
-	$dates = array(
38
-		'1900'                                                       => new Date('1900'),
39
-		'JAN 1900'                                                   => new Date('JAN 1900'),
40
-		'FEB 1900'                                                   => new Date('FEB 1900'),
41
-		'MAR 1900'                                                   => new Date('MAR 1900'),
42
-		'APR 1900'                                                   => new Date('APR 1900'),
43
-		'MAY 1900'                                                   => new Date('MAY 1900'),
44
-		'JUN 1900'                                                   => new Date('JUN 1900'),
45
-		'JUL 1900'                                                   => new Date('JUL 1900'),
46
-		'AUG 1900'                                                   => new Date('AUG 1900'),
47
-		'SEP 1900'                                                   => new Date('SEP 1900'),
48
-		'OCT 1900'                                                   => new Date('OCT 1900'),
49
-		'NOV 1900'                                                   => new Date('NOV 1900'),
50
-		'DEC 1900'                                                   => new Date('DEC 1900'),
51
-		'11 DEC 1913'                                                => new Date('11 DEC 1913'),
52
-		'01 FEB 2003'                                                => new Date('01 FEB 2003'),
53
-		'ABT 1900'                                                   => new Date('ABT 1900'),
54
-		'EST 1900'                                                   => new Date('EST 1900'),
55
-		'CAL 1900'                                                   => new Date('CAL 1900'),
56
-		'INT 1900 (...)'                                             => new Date('INT 1900 (...)'),
57
-		'@#DJULIAN@ 44 B.C.'                                         => new Date('@#DJULIAN@ 44 B.C.'),
58
-		'@#DJULIAN@ 14 JAN 1700'                                     => new Date('@#DJULIAN@ 14 JAN 1700'),
59
-		'BET @#DJULIAN@ 01 SEP 1752 AND @#DGREGORIAN@ 30 SEP 1752'   => new Date('BET @#DJULIAN@ 01 SEP 1752 AND @#DGREGORIAN@ 30 SEP 1752'),
60
-		'@#DJULIAN@ 20 FEB 1742/43'                                  => new Date('@#DJULIAN@ 20 FEB 1742/43'),
61
-		'FROM 1900 TO 1910'                                          => new Date('FROM 1900 TO 1910'),
62
-		'FROM 1900'                                                  => new Date('FROM 1900'),
63
-		'TO 1910'                                                    => new Date('TO 1910'),
64
-		'BET 1900 AND 1910'                                          => new Date('BET 1900 AND 1910'),
65
-		'BET JAN 1900 AND MAR 1900'                                  => new Date('BET JAN 1900 AND MAR 1900'),
66
-		'BET APR 1900 AND JUN 1900'                                  => new Date('BET APR 1900 AND JUN 1900'),
67
-		'BET JUL 1900 AND SEP 1900'                                  => new Date('BET JUL 1900 AND SEP 1900'),
68
-		'BET OCT 1900 AND DEC 1900'                                  => new Date('BET OCT 1900 AND DEC 1900'),
69
-		'AFT 1900'                                                   => new Date('AFT 1900'),
70
-		'BEF 1910'                                                   => new Date('BEF 1910'),
71
-		// Hijri dates
72
-		'@#DHIJRI@ 1497'                                    => new Date('@#DHIJRI@ 1497'),
73
-		'@#DHIJRI@ MUHAR 1497'                              => new Date('@#DHIJRI@ MUHAR 1497'),
74
-		'ABT @#DHIJRI@ SAFAR 1497'                          => new Date('ABT @#DHIJRI@ SAFAR 1497'),
75
-		'BET @#DHIJRI@ RABIA 1497 AND @#DHIJRI@ RABIT 1497' => new Date('BET @#DHIJRI@ RABIA 1497 AND @#DHIJRI@ RABIT 1497'),
76
-		'FROM @#DHIJRI@ JUMAA 1497 TO @#DHIJRI@ JUMAT 1497' => new Date('FROM @#DHIJRI@ JUMAA 1497 TO @#DHIJRI@ JUMAT 1497'),
77
-		'AFT @#DHIJRI@ RAJAB 1497'                          => new Date('AFT @#DHIJRI@ RAJAB 1497'),
78
-		'BEF @#DHIJRI@ SHAAB 1497'                          => new Date('BEF @#DHIJRI@ SHAAB 1497'),
79
-		'ABT @#DHIJRI@ RAMAD 1497'                          => new Date('ABT @#DHIJRI@ RAMAD 1497'),
80
-		'FROM @#DHIJRI@ SHAWW 1497'                         => new Date('FROM @#DHIJRI@ SHAWW 1497'),
81
-		'TO @#DHIJRI@ DHUAQ 1497'                           => new Date('TO @#DHIJRI@ DHUAQ 1497'),
82
-		'@#DHIJRI@ 03 DHUAH 1497'                           => new Date('@#DHIJRI@ 03 DHUAH 1497'),
83
-		// French dates
84
-		'@#DFRENCH R@ 12'                                   => new Date('@#DFRENCH R@ 12'),
85
-		'@#DFRENCH R@ VEND 12'                              => new Date('@#DFRENCH R@ VEND 12'),
86
-		'ABT @#DFRENCH R@ BRUM 12'                          => new Date('ABT @#DFRENCH R@ BRUM 12'),
87
-		'BET @#DFRENCH R@ FRIM 12 AND @#DFRENCH R@ NIVO 12' => new Date('BET @#DFRENCH R@ FRIM 12 AND @#DFRENCH R@ NIVO 12'),
88
-		'FROM @#DFRENCH R@ PLUV 12 TO @#DFRENCH R@ VENT 12' => new Date('FROM @#DFRENCH R@ PLUV 12 TO @#DFRENCH R@ VENT 12'),
89
-		'AFT @#DFRENCH R@ GERM 12'                          => new Date('AFT @#DFRENCH R@ GERM 12'),
90
-		'BEF @#DFRENCH R@ FLOR 12'                          => new Date('BEF @#DFRENCH R@ FLOR 12'),
91
-		'ABT @#DFRENCH R@ PRAI 12'                          => new Date('ABT @#DFRENCH R@ PRAI 12'),
92
-		'FROM @#DFRENCH R@ MESS 12'                         => new Date('FROM @#DFRENCH R@ MESS 12'),
93
-		'TO @#DFRENCH R@ THER 12'                           => new Date('TO @#DFRENCH R@ THER 12'),
94
-		'EST @#DFRENCH R@ FRUC 12'                          => new Date('EST @#DFRENCH R@ FRUC 12'),
95
-		'@#DFRENCH R@ 03 COMP 12'                           => new Date('@#DFRENCH R@ 03 COMP 12'),
96
-		// Jewish dates
97
-		'@#DHEBREW@ 5481'                                 => new Date('@#DHEBREW@ 5481'),
98
-		'@#DHEBREW@ TSH 5481'                             => new Date('@#DHEBREW@ TSH 5481'),
99
-		'ABT @#DHEBREW@ CSH 5481'                         => new Date('ABT @#DHEBREW@ CSH 5481'),
100
-		'BET @#DHEBREW@ KSL 5481 AND @#DHEBREW@ TVT 5481' => new Date('BET @#DHEBREW@ KSL 5481 AND @#DHEBREW@ TVT 5481'),
101
-		'FROM @#DHEBREW@ SHV 5481 TO @#DHEBREW@ ADR 5481' => new Date('FROM @#DHEBREW@ SHV 5481 TO @#DHEBREW@ ADR 5481'),
102
-		'AFT @#DHEBREW@ ADR 5481'                         => new Date('AFT @#DHEBREW@ ADR 5481'),
103
-		'AFT @#DHEBREW@ ADS 5480'                         => new Date('AFT @#DHEBREW@ ADS 5480'),
104
-		'BEF @#DHEBREW@ NSN 5481'                         => new Date('BEF @#DHEBREW@ NSN 5481'),
105
-		'ABT @#DHEBREW@ IYR 5481'                         => new Date('ABT @#DHEBREW@ IYR 5481'),
106
-		'FROM @#DHEBREW@ SVN 5481'                        => new Date('FROM @#DHEBREW@ SVN 5481'),
107
-		'TO @#DHEBREW@ TMZ 5481'                          => new Date('TO @#DHEBREW@ TMZ 5481'),
108
-		'EST @#DHEBREW@ AAV 5481'                         => new Date('EST @#DHEBREW@ AAV 5481'),
109
-		'@#DHEBREW@ 03 ELL 5481'                          => new Date('@#DHEBREW@ 03 ELL 5481'),
110
-	);
35
+	case 'DATE':
36
+		$title = GedcomTag::getLabel('DATE');
37
+		$dates = array(
38
+			'1900'                                                       => new Date('1900'),
39
+			'JAN 1900'                                                   => new Date('JAN 1900'),
40
+			'FEB 1900'                                                   => new Date('FEB 1900'),
41
+			'MAR 1900'                                                   => new Date('MAR 1900'),
42
+			'APR 1900'                                                   => new Date('APR 1900'),
43
+			'MAY 1900'                                                   => new Date('MAY 1900'),
44
+			'JUN 1900'                                                   => new Date('JUN 1900'),
45
+			'JUL 1900'                                                   => new Date('JUL 1900'),
46
+			'AUG 1900'                                                   => new Date('AUG 1900'),
47
+			'SEP 1900'                                                   => new Date('SEP 1900'),
48
+			'OCT 1900'                                                   => new Date('OCT 1900'),
49
+			'NOV 1900'                                                   => new Date('NOV 1900'),
50
+			'DEC 1900'                                                   => new Date('DEC 1900'),
51
+			'11 DEC 1913'                                                => new Date('11 DEC 1913'),
52
+			'01 FEB 2003'                                                => new Date('01 FEB 2003'),
53
+			'ABT 1900'                                                   => new Date('ABT 1900'),
54
+			'EST 1900'                                                   => new Date('EST 1900'),
55
+			'CAL 1900'                                                   => new Date('CAL 1900'),
56
+			'INT 1900 (...)'                                             => new Date('INT 1900 (...)'),
57
+			'@#DJULIAN@ 44 B.C.'                                         => new Date('@#DJULIAN@ 44 B.C.'),
58
+			'@#DJULIAN@ 14 JAN 1700'                                     => new Date('@#DJULIAN@ 14 JAN 1700'),
59
+			'BET @#DJULIAN@ 01 SEP 1752 AND @#DGREGORIAN@ 30 SEP 1752'   => new Date('BET @#DJULIAN@ 01 SEP 1752 AND @#DGREGORIAN@ 30 SEP 1752'),
60
+			'@#DJULIAN@ 20 FEB 1742/43'                                  => new Date('@#DJULIAN@ 20 FEB 1742/43'),
61
+			'FROM 1900 TO 1910'                                          => new Date('FROM 1900 TO 1910'),
62
+			'FROM 1900'                                                  => new Date('FROM 1900'),
63
+			'TO 1910'                                                    => new Date('TO 1910'),
64
+			'BET 1900 AND 1910'                                          => new Date('BET 1900 AND 1910'),
65
+			'BET JAN 1900 AND MAR 1900'                                  => new Date('BET JAN 1900 AND MAR 1900'),
66
+			'BET APR 1900 AND JUN 1900'                                  => new Date('BET APR 1900 AND JUN 1900'),
67
+			'BET JUL 1900 AND SEP 1900'                                  => new Date('BET JUL 1900 AND SEP 1900'),
68
+			'BET OCT 1900 AND DEC 1900'                                  => new Date('BET OCT 1900 AND DEC 1900'),
69
+			'AFT 1900'                                                   => new Date('AFT 1900'),
70
+			'BEF 1910'                                                   => new Date('BEF 1910'),
71
+			// Hijri dates
72
+			'@#DHIJRI@ 1497'                                    => new Date('@#DHIJRI@ 1497'),
73
+			'@#DHIJRI@ MUHAR 1497'                              => new Date('@#DHIJRI@ MUHAR 1497'),
74
+			'ABT @#DHIJRI@ SAFAR 1497'                          => new Date('ABT @#DHIJRI@ SAFAR 1497'),
75
+			'BET @#DHIJRI@ RABIA 1497 AND @#DHIJRI@ RABIT 1497' => new Date('BET @#DHIJRI@ RABIA 1497 AND @#DHIJRI@ RABIT 1497'),
76
+			'FROM @#DHIJRI@ JUMAA 1497 TO @#DHIJRI@ JUMAT 1497' => new Date('FROM @#DHIJRI@ JUMAA 1497 TO @#DHIJRI@ JUMAT 1497'),
77
+			'AFT @#DHIJRI@ RAJAB 1497'                          => new Date('AFT @#DHIJRI@ RAJAB 1497'),
78
+			'BEF @#DHIJRI@ SHAAB 1497'                          => new Date('BEF @#DHIJRI@ SHAAB 1497'),
79
+			'ABT @#DHIJRI@ RAMAD 1497'                          => new Date('ABT @#DHIJRI@ RAMAD 1497'),
80
+			'FROM @#DHIJRI@ SHAWW 1497'                         => new Date('FROM @#DHIJRI@ SHAWW 1497'),
81
+			'TO @#DHIJRI@ DHUAQ 1497'                           => new Date('TO @#DHIJRI@ DHUAQ 1497'),
82
+			'@#DHIJRI@ 03 DHUAH 1497'                           => new Date('@#DHIJRI@ 03 DHUAH 1497'),
83
+			// French dates
84
+			'@#DFRENCH R@ 12'                                   => new Date('@#DFRENCH R@ 12'),
85
+			'@#DFRENCH R@ VEND 12'                              => new Date('@#DFRENCH R@ VEND 12'),
86
+			'ABT @#DFRENCH R@ BRUM 12'                          => new Date('ABT @#DFRENCH R@ BRUM 12'),
87
+			'BET @#DFRENCH R@ FRIM 12 AND @#DFRENCH R@ NIVO 12' => new Date('BET @#DFRENCH R@ FRIM 12 AND @#DFRENCH R@ NIVO 12'),
88
+			'FROM @#DFRENCH R@ PLUV 12 TO @#DFRENCH R@ VENT 12' => new Date('FROM @#DFRENCH R@ PLUV 12 TO @#DFRENCH R@ VENT 12'),
89
+			'AFT @#DFRENCH R@ GERM 12'                          => new Date('AFT @#DFRENCH R@ GERM 12'),
90
+			'BEF @#DFRENCH R@ FLOR 12'                          => new Date('BEF @#DFRENCH R@ FLOR 12'),
91
+			'ABT @#DFRENCH R@ PRAI 12'                          => new Date('ABT @#DFRENCH R@ PRAI 12'),
92
+			'FROM @#DFRENCH R@ MESS 12'                         => new Date('FROM @#DFRENCH R@ MESS 12'),
93
+			'TO @#DFRENCH R@ THER 12'                           => new Date('TO @#DFRENCH R@ THER 12'),
94
+			'EST @#DFRENCH R@ FRUC 12'                          => new Date('EST @#DFRENCH R@ FRUC 12'),
95
+			'@#DFRENCH R@ 03 COMP 12'                           => new Date('@#DFRENCH R@ 03 COMP 12'),
96
+			// Jewish dates
97
+			'@#DHEBREW@ 5481'                                 => new Date('@#DHEBREW@ 5481'),
98
+			'@#DHEBREW@ TSH 5481'                             => new Date('@#DHEBREW@ TSH 5481'),
99
+			'ABT @#DHEBREW@ CSH 5481'                         => new Date('ABT @#DHEBREW@ CSH 5481'),
100
+			'BET @#DHEBREW@ KSL 5481 AND @#DHEBREW@ TVT 5481' => new Date('BET @#DHEBREW@ KSL 5481 AND @#DHEBREW@ TVT 5481'),
101
+			'FROM @#DHEBREW@ SHV 5481 TO @#DHEBREW@ ADR 5481' => new Date('FROM @#DHEBREW@ SHV 5481 TO @#DHEBREW@ ADR 5481'),
102
+			'AFT @#DHEBREW@ ADR 5481'                         => new Date('AFT @#DHEBREW@ ADR 5481'),
103
+			'AFT @#DHEBREW@ ADS 5480'                         => new Date('AFT @#DHEBREW@ ADS 5480'),
104
+			'BEF @#DHEBREW@ NSN 5481'                         => new Date('BEF @#DHEBREW@ NSN 5481'),
105
+			'ABT @#DHEBREW@ IYR 5481'                         => new Date('ABT @#DHEBREW@ IYR 5481'),
106
+			'FROM @#DHEBREW@ SVN 5481'                        => new Date('FROM @#DHEBREW@ SVN 5481'),
107
+			'TO @#DHEBREW@ TMZ 5481'                          => new Date('TO @#DHEBREW@ TMZ 5481'),
108
+			'EST @#DHEBREW@ AAV 5481'                         => new Date('EST @#DHEBREW@ AAV 5481'),
109
+			'@#DHEBREW@ 03 ELL 5481'                          => new Date('@#DHEBREW@ 03 ELL 5481'),
110
+		);
111 111
 
112
-	foreach ($dates as &$date) {
113
-		$date = strip_tags($date->display(false, null, false));
114
-	}
115
-	// These shortcuts work differently for different languages
116
-	switch (preg_replace('/[^DMY]/', '', str_replace(array('J', 'F'), array('D', 'M'), I18N::dateFormat()))) {
117
-	case 'YMD':
118
-		$example1 = '11/12/1913'; // Note: we ignore the DMY order if it doesn't make sense.
119
-		$example2 = '03/02/01';
120
-		break;
121
-	case 'MDY':
122
-		$example1 = '12/11/1913';
123
-		$example2 = '02/01/03';
124
-		break;
125
-	case 'DMY':
126
-	default:
127
-		$example1 = '11/12/1913';
128
-		$example2 = '01/02/03';
129
-		break;
130
-	}
112
+		foreach ($dates as &$date) {
113
+			$date = strip_tags($date->display(false, null, false));
114
+		}
115
+		// These shortcuts work differently for different languages
116
+		switch (preg_replace('/[^DMY]/', '', str_replace(array('J', 'F'), array('D', 'M'), I18N::dateFormat()))) {
117
+			case 'YMD':
118
+				$example1 = '11/12/1913'; // Note: we ignore the DMY order if it doesn't make sense.
119
+				$example2 = '03/02/01';
120
+				break;
121
+			case 'MDY':
122
+				$example1 = '12/11/1913';
123
+				$example2 = '02/01/03';
124
+				break;
125
+			case 'DMY':
126
+			default:
127
+				$example1 = '11/12/1913';
128
+				$example2 = '01/02/03';
129
+				break;
130
+		}
131 131
 	$example1 .= '<br>' . str_replace('/', '-', $example1) . '<br>' . str_replace('/', '.', $example1);
132 132
 	$example2 .= '<br>' . str_replace('/', '-', $example2) . '<br>' . str_replace('/', '.', $example2);
133 133
 	$text =
@@ -212,114 +212,114 @@  discard block
 block discarded – undo
212 212
 	break;
213 213
 
214 214
 // This help text is used for all NAME components
215
-case 'NAME':
216
-	$title = GedcomTag::getLabel('NAME');
217
-	$text  =
218
-		'<p>' .
219
-		I18N::translate('The <b>name</b> field contains the individual’s full name, as they would have spelled it or as it was recorded. This is how it will be displayed on screen. It uses standard genealogy annotations to identify different parts of the name.') .
220
-		'</p>' .
221
-		'<ul><li>' .
222
-		I18N::translate('The surname is enclosed by slashes: <%s>John Paul /Smith/<%s>', 'span style="color:#0000ff;"', '/span') .
223
-		'</li><li>' .
224
-		I18N::translate('If the surname is unknown, use empty slashes: <%s>Mary //<%s>', 'span style="color:#0000ff;"', '/span') .
225
-		'</li><li>' .
226
-		I18N::translate('If an individual has two separate surnames, both should be enclosed by slashes: <%s>José Antonio /Gómez/ /Iglesias/<%s>', 'span style="color:#0000ff;"', '/span') .
227
-		'</li><li>' .
228
-		I18N::translate('If an individual does not have a surname, no slashes are needed: <%s>Jón Einarsson<%s>', 'span style="color:#0000ff;"', '/span') .
229
-		'</li><li>' .
230
-		I18N::translate('If an individual was not known by their first given name, the preferred name should be indicated with an asterisk: <%s>John Paul* /Smith/<%s>', 'span style="color:#0000ff;"', '/span') .
231
-		'</li><li>' .
232
-		I18N::translate('If an individual was known by a nickname which is not part of their formal name, it should be enclosed by quotation marks. For example, <%s>John &quot;Nobby&quot; /Clark/<%s>.', 'span style="color:#0000ff;"', '/span') .
233
-		'</li></ul>';
234
-	break;
215
+	case 'NAME':
216
+		$title = GedcomTag::getLabel('NAME');
217
+		$text  =
218
+			'<p>' .
219
+			I18N::translate('The <b>name</b> field contains the individual’s full name, as they would have spelled it or as it was recorded. This is how it will be displayed on screen. It uses standard genealogy annotations to identify different parts of the name.') .
220
+			'</p>' .
221
+			'<ul><li>' .
222
+			I18N::translate('The surname is enclosed by slashes: <%s>John Paul /Smith/<%s>', 'span style="color:#0000ff;"', '/span') .
223
+			'</li><li>' .
224
+			I18N::translate('If the surname is unknown, use empty slashes: <%s>Mary //<%s>', 'span style="color:#0000ff;"', '/span') .
225
+			'</li><li>' .
226
+			I18N::translate('If an individual has two separate surnames, both should be enclosed by slashes: <%s>José Antonio /Gómez/ /Iglesias/<%s>', 'span style="color:#0000ff;"', '/span') .
227
+			'</li><li>' .
228
+			I18N::translate('If an individual does not have a surname, no slashes are needed: <%s>Jón Einarsson<%s>', 'span style="color:#0000ff;"', '/span') .
229
+			'</li><li>' .
230
+			I18N::translate('If an individual was not known by their first given name, the preferred name should be indicated with an asterisk: <%s>John Paul* /Smith/<%s>', 'span style="color:#0000ff;"', '/span') .
231
+			'</li><li>' .
232
+			I18N::translate('If an individual was known by a nickname which is not part of their formal name, it should be enclosed by quotation marks. For example, <%s>John &quot;Nobby&quot; /Clark/<%s>.', 'span style="color:#0000ff;"', '/span') .
233
+			'</li></ul>';
234
+		break;
235 235
 
236
-case 'SURN':
237
-	$title = GedcomTag::getLabel('SURN');
238
-	$text  = '<p>' .
239
-		I18N::translate('The <b>surname</b> field contains a name that is used for sorting and grouping. It can be different to the individual’s actual surname which is always taken from the <b>name</b> field. This field can be used to sort surnames with or without a prefix (Gogh / van Gogh) and to group spelling variations or inflections (Kowalski / Kowalska). If an individual needs to be listed under more than one surname, each name should be separated by a comma.') .
240
-		'</p>';
241
-	break;
236
+	case 'SURN':
237
+		$title = GedcomTag::getLabel('SURN');
238
+		$text  = '<p>' .
239
+			I18N::translate('The <b>surname</b> field contains a name that is used for sorting and grouping. It can be different to the individual’s actual surname which is always taken from the <b>name</b> field. This field can be used to sort surnames with or without a prefix (Gogh / van Gogh) and to group spelling variations or inflections (Kowalski / Kowalska). If an individual needs to be listed under more than one surname, each name should be separated by a comma.') .
240
+			'</p>';
241
+		break;
242 242
 
243
-case 'OBJE':
244
-	$title = GedcomTag::getLabel('OBJE');
245
-	$text  =
246
-		'<p>' .
247
-		I18N::translate('A media object is a record in the family tree which contains information about a media file. This information may include a title, a copyright notice, a transcript, privacy restrictions, etc. The media file, such as the photo or video, can be stored locally (on this webserver) or remotely (on a different webserver).') .
248
-		'</p>';
249
-	break;
243
+	case 'OBJE':
244
+		$title = GedcomTag::getLabel('OBJE');
245
+		$text  =
246
+			'<p>' .
247
+			I18N::translate('A media object is a record in the family tree which contains information about a media file. This information may include a title, a copyright notice, a transcript, privacy restrictions, etc. The media file, such as the photo or video, can be stored locally (on this webserver) or remotely (on a different webserver).') .
248
+			'</p>';
249
+		break;
250 250
 
251
-case 'PLAC':
252
-	$title = GedcomTag::getLabel('PLAC');
253
-	$text  = I18N::translate('Places should be entered according to the standards for genealogy. In genealogy, places are recorded with the most specific information about the place first and then working up to the least specific place last, using commas to separate the different place levels. The level at which you record the place information should represent the levels of government or church where vital records for that place are kept.<br><br>For example, a place like Salt Lake City would be entered as “Salt Lake City, Salt Lake, Utah, USA”.<br><br>Let’s examine each part of this place. The first part, “Salt Lake City,” is the city or township where the event occurred. In some countries, there may be municipalities or districts inside a city which are important to note. In that case, they should come before the city. The next part, “Salt Lake,” is the county. “Utah” is the state, and “USA” is the country. It is important to note each place because genealogy records are kept by the governments of each level.<br><br>If a level of the place is unknown, you should leave a space between the commas. Suppose, in the example above, you didn’t know the county for Salt Lake City. You should then record it like this: “Salt Lake City, , Utah, USA”. Suppose you only know that an individual was born in Utah. You would enter the information like this: “, , Utah, USA”. <br><br>You can use the <b>Find Place</b> link to help you find places that already exist in the database.');
254
-	break;
251
+	case 'PLAC':
252
+		$title = GedcomTag::getLabel('PLAC');
253
+		$text  = I18N::translate('Places should be entered according to the standards for genealogy. In genealogy, places are recorded with the most specific information about the place first and then working up to the least specific place last, using commas to separate the different place levels. The level at which you record the place information should represent the levels of government or church where vital records for that place are kept.<br><br>For example, a place like Salt Lake City would be entered as “Salt Lake City, Salt Lake, Utah, USA”.<br><br>Let’s examine each part of this place. The first part, “Salt Lake City,” is the city or township where the event occurred. In some countries, there may be municipalities or districts inside a city which are important to note. In that case, they should come before the city. The next part, “Salt Lake,” is the county. “Utah” is the state, and “USA” is the country. It is important to note each place because genealogy records are kept by the governments of each level.<br><br>If a level of the place is unknown, you should leave a space between the commas. Suppose, in the example above, you didn’t know the county for Salt Lake City. You should then record it like this: “Salt Lake City, , Utah, USA”. Suppose you only know that an individual was born in Utah. You would enter the information like this: “, , Utah, USA”. <br><br>You can use the <b>Find Place</b> link to help you find places that already exist in the database.');
254
+		break;
255 255
 
256
-case 'RESN':
257
-	$title = GedcomTag::getLabel('RESN');
258
-	$text  =
259
-		I18N::translate('Restrictions can be added to records and/or facts. They restrict who can view the data and who can edit it.') .
260
-		'<br><br>' .
261
-		I18N::translate('Note that if a user account is linked to a record, then that user will always be able to view that record.');
262
-	break;
256
+	case 'RESN':
257
+		$title = GedcomTag::getLabel('RESN');
258
+		$text  =
259
+			I18N::translate('Restrictions can be added to records and/or facts. They restrict who can view the data and who can edit it.') .
260
+			'<br><br>' .
261
+			I18N::translate('Note that if a user account is linked to a record, then that user will always be able to view that record.');
262
+		break;
263 263
 
264
-case 'ROMN':
265
-	$title = GedcomTag::getLabel('ROMN');
266
-	$text  = I18N::translate('In many cultures it is customary to have a traditional name spelled in the traditional characters and also a romanized version of the name as it would be spelled or pronounced in languages based on the Latin alphabet, such as English.<br><br>If you prefer to use a non-Latin alphabet such as Hebrew, Greek, Russian, Chinese, or Arabic to enter the name in the standard name fields, then you can use this field to enter the same name using the Latin alphabet. Both versions of the name will appear in lists and charts.<br><br>Although this field is labeled “Romanized”, it is not restricted to containing only characters based on the Latin alphabet. This might be of use with Japanese names, where three different alphabets may occur.');
267
-	break;
264
+	case 'ROMN':
265
+		$title = GedcomTag::getLabel('ROMN');
266
+		$text  = I18N::translate('In many cultures it is customary to have a traditional name spelled in the traditional characters and also a romanized version of the name as it would be spelled or pronounced in languages based on the Latin alphabet, such as English.<br><br>If you prefer to use a non-Latin alphabet such as Hebrew, Greek, Russian, Chinese, or Arabic to enter the name in the standard name fields, then you can use this field to enter the same name using the Latin alphabet. Both versions of the name will appear in lists and charts.<br><br>Although this field is labeled “Romanized”, it is not restricted to containing only characters based on the Latin alphabet. This might be of use with Japanese names, where three different alphabets may occur.');
267
+		break;
268 268
 
269
-case '_HEB':
270
-	$title = GedcomTag::getLabel('_HEB');
271
-	$text  = I18N::translate('In many cultures it is customary to have a traditional name spelled in the traditional characters and also a romanized version of the name as it would be spelled or pronounced in languages based on the Latin alphabet, such as English.<br><br>If you prefer to use the Latin alphabet to enter the name in the standard name fields, then you can use this field to enter the same name in the non-Latin alphabet such as Greek, Hebrew, Russian, Arabic, or Chinese. Both versions of the name will appear in lists and charts.<br><br>Although this field is labeled “Hebrew”, it is not restricted to containing only Hebrew characters.');
272
-	break;
269
+	case '_HEB':
270
+		$title = GedcomTag::getLabel('_HEB');
271
+		$text  = I18N::translate('In many cultures it is customary to have a traditional name spelled in the traditional characters and also a romanized version of the name as it would be spelled or pronounced in languages based on the Latin alphabet, such as English.<br><br>If you prefer to use the Latin alphabet to enter the name in the standard name fields, then you can use this field to enter the same name in the non-Latin alphabet such as Greek, Hebrew, Russian, Arabic, or Chinese. Both versions of the name will appear in lists and charts.<br><br>Although this field is labeled “Hebrew”, it is not restricted to containing only Hebrew characters.');
272
+		break;
273 273
 
274
-	//////////////////////////////////////////////////////////////////////////////
275
-	// This section contains all the other help items.
276
-	//////////////////////////////////////////////////////////////////////////////
274
+		//////////////////////////////////////////////////////////////////////////////
275
+		// This section contains all the other help items.
276
+		//////////////////////////////////////////////////////////////////////////////
277 277
 
278
-case 'annivers_year_select':
279
-	$title = I18N::translate('Year input box');
280
-	$text  = I18N::translate('This input box lets you change that year of the calendar. Type a year into the box and press <b>Enter</b> to change the calendar to that year.<br><br><b>Advanced features</b> for <b>View the year</b><dl><dt><b>More than one year</b></dt><dd>You can search for dates in a range of years.<br><br>Year ranges are <u>inclusive</u>. This means that the date range extends from 1 January of the first year of the range to 31 December of the last year mentioned. Here are a few examples of year ranges:<br><br><b>1992-5</b> for all events from 1992 to 1995.<br><b>1972-89</b> for all events from 1972 to 1989.<br><b>1610-759</b> for all events from 1610 to 1759.<br><b>1880-1905</b> for all events from 1880 to 1905.<br><b>880-1105</b> for all events from 880 to 1105.<br><br>To see all the events in a given decade or century, you can use <b>?</b> in place of the final digits. For example, <b>197?</b> for all events from 1970 to 1979 or <b>16??</b> for all events from 1600 to 1699.<br><br>Selecting a range of years will change the calendar to the year view.</dd></dl>');
281
-	break;
278
+	case 'annivers_year_select':
279
+		$title = I18N::translate('Year input box');
280
+		$text  = I18N::translate('This input box lets you change that year of the calendar. Type a year into the box and press <b>Enter</b> to change the calendar to that year.<br><br><b>Advanced features</b> for <b>View the year</b><dl><dt><b>More than one year</b></dt><dd>You can search for dates in a range of years.<br><br>Year ranges are <u>inclusive</u>. This means that the date range extends from 1 January of the first year of the range to 31 December of the last year mentioned. Here are a few examples of year ranges:<br><br><b>1992-5</b> for all events from 1992 to 1995.<br><b>1972-89</b> for all events from 1972 to 1989.<br><b>1610-759</b> for all events from 1610 to 1759.<br><b>1880-1905</b> for all events from 1880 to 1905.<br><b>880-1105</b> for all events from 880 to 1105.<br><br>To see all the events in a given decade or century, you can use <b>?</b> in place of the final digits. For example, <b>197?</b> for all events from 1970 to 1979 or <b>16??</b> for all events from 1600 to 1699.<br><br>Selecting a range of years will change the calendar to the year view.</dd></dl>');
281
+		break;
282 282
 
283
-case 'edit_edit_raw':
284
-	$title = I18N::translate('Edit the raw GEDCOM');
285
-	$text  =
286
-		I18N::translate('This page allows you to bypass the usual forms, and edit the underlying data directly. It is an advanced option, and you should not use it unless you understand the GEDCOM format. If you make a mistake here, it can be difficult to fix.') .
287
-		'<br><br>' .
288
-		/* I18N: %s is a URL */ I18N::translate('You can download a copy of the GEDCOM specification from %s.', '<a href="https://wiki.webtrees.net/w/images-en/Ged551-5.pdf">https://wiki.webtrees.net/w/images-en/Ged551-5.pdf</a>');
289
-	break;
283
+	case 'edit_edit_raw':
284
+		$title = I18N::translate('Edit the raw GEDCOM');
285
+		$text  =
286
+			I18N::translate('This page allows you to bypass the usual forms, and edit the underlying data directly. It is an advanced option, and you should not use it unless you understand the GEDCOM format. If you make a mistake here, it can be difficult to fix.') .
287
+			'<br><br>' .
288
+			/* I18N: %s is a URL */ I18N::translate('You can download a copy of the GEDCOM specification from %s.', '<a href="https://wiki.webtrees.net/w/images-en/Ged551-5.pdf">https://wiki.webtrees.net/w/images-en/Ged551-5.pdf</a>');
289
+		break;
290 290
 
291
-case 'edit_SOUR_EVEN':
292
-	$title = I18N::translate('Associate events with this source');
293
-	$text  = I18N::translate('Each source records specific events, generally for a given date range and for a place jurisdiction. For example a Census records census events and church records record birth, marriage, and death events.<br><br>Select the events that are recorded by this source from the list of events provided. The date should be specified in a range format such as <i>FROM 1900 TO 1910</i>. The place jurisdiction is the name of the lowest jurisdiction that encompasses all lower-level places named in this source. For example, “Oneida, Idaho, USA” would be used as a source jurisdiction place for events occurring in the various towns within Oneida County. “Idaho, USA” would be the source jurisdiction place if the events recorded took place not only in Oneida County but also in other counties in Idaho.');
294
-	break;
291
+	case 'edit_SOUR_EVEN':
292
+		$title = I18N::translate('Associate events with this source');
293
+		$text  = I18N::translate('Each source records specific events, generally for a given date range and for a place jurisdiction. For example a Census records census events and church records record birth, marriage, and death events.<br><br>Select the events that are recorded by this source from the list of events provided. The date should be specified in a range format such as <i>FROM 1900 TO 1910</i>. The place jurisdiction is the name of the lowest jurisdiction that encompasses all lower-level places named in this source. For example, “Oneida, Idaho, USA” would be used as a source jurisdiction place for events occurring in the various towns within Oneida County. “Idaho, USA” would be the source jurisdiction place if the events recorded took place not only in Oneida County but also in other counties in Idaho.');
294
+		break;
295 295
 
296
-case 'google_chart_surname':
297
-	$title = I18N::translate('Surname');
298
-	$text  = I18N::translate('The number of occurrences of the specified name will be shown on the map. If you leave this field empty, the most common surname will be used.');
299
-	break;
296
+	case 'google_chart_surname':
297
+		$title = I18N::translate('Surname');
298
+		$text  = I18N::translate('The number of occurrences of the specified name will be shown on the map. If you leave this field empty, the most common surname will be used.');
299
+		break;
300 300
 
301
-case 'pending_changes':
302
-	$title = I18N::translate('Pending changes');
303
-	$text  =
304
-		'<p>' .
305
-		I18N::translate('When you add, edit, or delete information, the changes are not saved immediately. Instead, they are kept in a “pending” area. These pending changes need to be reviewed by a moderator before they are accepted.') .
306
-		'</p><p>' .
307
-		I18N::translate('This process allows the site’s owner to ensure that the new information follows the site’s standards and conventions, has proper source attributions, etc.') .
308
-		'</p><p>' .
309
-		I18N::translate('Pending changes are only shown when your account has permission to edit. When you sign out, you will no longer be able to see them. Also, pending changes are only shown on certain pages. For example, they are not shown in lists, reports, or search results.') .
310
-		'</p>';
311
-	if (Auth::isAdmin()) {
312
-		$text .=
301
+	case 'pending_changes':
302
+		$title = I18N::translate('Pending changes');
303
+		$text  =
313 304
 			'<p>' .
314
-			I18N::translate('Each user account has an option to “automatically accept changes”. When this is enabled, any changes made by that user are saved immediately. Many administrators enable this for their own user account.') .
305
+			I18N::translate('When you add, edit, or delete information, the changes are not saved immediately. Instead, they are kept in a “pending” area. These pending changes need to be reviewed by a moderator before they are accepted.') .
306
+			'</p><p>' .
307
+			I18N::translate('This process allows the site’s owner to ensure that the new information follows the site’s standards and conventions, has proper source attributions, etc.') .
308
+			'</p><p>' .
309
+			I18N::translate('Pending changes are only shown when your account has permission to edit. When you sign out, you will no longer be able to see them. Also, pending changes are only shown on certain pages. For example, they are not shown in lists, reports, or search results.') .
315 310
 			'</p>';
316
-	}
317
-	break;
311
+		if (Auth::isAdmin()) {
312
+			$text .=
313
+				'<p>' .
314
+				I18N::translate('Each user account has an option to “automatically accept changes”. When this is enabled, any changes made by that user are saved immediately. Many administrators enable this for their own user account.') .
315
+				'</p>';
316
+		}
317
+		break;
318 318
 
319
-default:
320
-	$title = I18N::translate('Help');
321
-	$text  = I18N::translate('The help text has not been written for this item.');
322
-	break;
319
+	default:
320
+		$title = I18N::translate('Help');
321
+		$text  = I18N::translate('The help text has not been written for this item.');
322
+		break;
323 323
 }
324 324
 // This file is called by a getJSON call so return the data
325 325
 // in correct format
Please login to merge, or discard this patch.