Completed
Push — 1.7 ( ec97c0...420789 )
by
unknown
07:31
created
app/Filter.php 1 patch
Switch Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -117,10 +117,10 @@
 block discarded – undo
117 117
 	 */
118 118
 	public static function formatText($text, Tree $WT_TREE) {
119 119
 		switch ($WT_TREE->getPreference('FORMAT_TEXT')) {
120
-		case 'markdown':
121
-			return '<div class="markdown" dir="auto">' . self::markdown($text) . '</div>';
122
-		default:
123
-			return '<div style="white-space: pre-wrap;" dir="auto">' . self::expandUrls($text) . '</div>';
120
+		    case 'markdown':
121
+			    return '<div class="markdown" dir="auto">' . self::markdown($text) . '</div>';
122
+		    default:
123
+			    return '<div style="white-space: pre-wrap;" dir="auto">' . self::expandUrls($text) . '</div>';
124 124
 		}
125 125
 	}
126 126
 
Please login to merge, or discard this patch.
admin_site_upgrade.php 1 patch
Switch Indentation   +46 added lines, -46 removed lines patch added patch discarded remove patch
@@ -117,18 +117,18 @@  discard block
 block discarded – undo
117 117
 foreach (Module::getInstalledModules('disabled') as $module) {
118 118
 	if (!in_array($module->getName(), Module::getCoreModuleNames())) {
119 119
 		switch ($modules_action) {
120
-		case 'disable':
121
-			Database::prepare(
122
-				"UPDATE `##module` SET status = 'disabled' WHERE module_name = ?"
123
-			)->execute(array($module->getName()));
124
-			break;
125
-		case 'ignore':
126
-			echo '<br>', I18N::translate('Custom module'), ' — ', WT_MODULES_DIR, $module->getName(), ' — ', $module->getTitle(), $icon_success;
127
-			break;
128
-		default:
129
-			echo '<br>', I18N::translate('Custom module'), ' — ', WT_MODULES_DIR, $module->getName(), ' — ', $module->getTitle(), $icon_failure;
130
-			$custom_modules = true;
131
-			break;
120
+		    case 'disable':
121
+			    Database::prepare(
122
+				    "UPDATE `##module` SET status = 'disabled' WHERE module_name = ?"
123
+			    )->execute(array($module->getName()));
124
+			    break;
125
+		    case 'ignore':
126
+			    echo '<br>', I18N::translate('Custom module'), ' — ', WT_MODULES_DIR, $module->getName(), ' — ', $module->getTitle(), $icon_success;
127
+			    break;
128
+		    default:
129
+			    echo '<br>', I18N::translate('Custom module'), ' — ', WT_MODULES_DIR, $module->getName(), ' — ', $module->getTitle(), $icon_failure;
130
+			    $custom_modules = true;
131
+			    break;
132 132
 		}
133 133
 	}
134 134
 }
@@ -157,40 +157,40 @@  discard block
 block discarded – undo
157 157
 $custom_themes = false;
158 158
 foreach (Theme::themeNames() as $theme_id => $theme_name) {
159 159
 	switch ($theme_id) {
160
-	case 'clouds':
161
-	case 'colors':
162
-	case 'fab':
163
-	case 'minimal':
164
-	case 'webtrees':
165
-	case 'xenea':
166
-		break;
167
-	default:
168
-		$theme_used = Database::prepare(
169
-			"SELECT EXISTS (SELECT 1 FROM `##site_setting`   WHERE setting_name='THEME_DIR' AND setting_value=?)" .
170
-			" OR    EXISTS (SELECT 1 FROM `##gedcom_setting` WHERE setting_name='THEME_DIR' AND setting_value=?)" .
171
-			" OR    EXISTS (SELECT 1 FROM `##user_setting`   WHERE setting_name='theme'     AND setting_value=?)"
172
-		)->execute(array($theme_id, $theme_id, $theme_id))->fetchOne();
173
-		if ($theme_used) {
174
-			switch ($themes_action) {
175
-			case 'disable':
176
-				Database::prepare(
177
-					"DELETE FROM `##site_setting`   WHERE setting_name = 'THEME_DIR' AND setting_value = ?"
178
-				)->execute(array($theme_id));
179
-				Database::prepare(
180
-					"DELETE FROM `##gedcom_setting` WHERE setting_name = 'THEME_DIR' AND setting_value = ?"
181
-				)->execute(array($theme_id));
182
-				Database::prepare(
183
-					"DELETE FROM `##user_setting`   WHERE setting_name = 'theme'     AND setting_value = ?"
184
-				)->execute(array($theme_id));
185
-				break;
186
-			case 'ignore':
187
-				echo '<br>', I18N::translate('Custom theme'), ' — ', $theme_id, ' — ', $theme_name, $icon_success;
188
-				break;
189
-			default:
190
-				echo '<br>', I18N::translate('Custom theme'), ' — ', $theme_id, ' — ', $theme_name, $icon_failure;
191
-				$custom_themes = true;
192
-				break;
193
-			}
160
+	    case 'clouds':
161
+	    case 'colors':
162
+	    case 'fab':
163
+	    case 'minimal':
164
+	    case 'webtrees':
165
+	    case 'xenea':
166
+		    break;
167
+	    default:
168
+		    $theme_used = Database::prepare(
169
+			    "SELECT EXISTS (SELECT 1 FROM `##site_setting`   WHERE setting_name='THEME_DIR' AND setting_value=?)" .
170
+			    " OR    EXISTS (SELECT 1 FROM `##gedcom_setting` WHERE setting_name='THEME_DIR' AND setting_value=?)" .
171
+			    " OR    EXISTS (SELECT 1 FROM `##user_setting`   WHERE setting_name='theme'     AND setting_value=?)"
172
+		    )->execute(array($theme_id, $theme_id, $theme_id))->fetchOne();
173
+		    if ($theme_used) {
174
+			    switch ($themes_action) {
175
+			        case 'disable':
176
+				        Database::prepare(
177
+					        "DELETE FROM `##site_setting`   WHERE setting_name = 'THEME_DIR' AND setting_value = ?"
178
+				        )->execute(array($theme_id));
179
+				        Database::prepare(
180
+					        "DELETE FROM `##gedcom_setting` WHERE setting_name = 'THEME_DIR' AND setting_value = ?"
181
+				        )->execute(array($theme_id));
182
+				        Database::prepare(
183
+					        "DELETE FROM `##user_setting`   WHERE setting_name = 'theme'     AND setting_value = ?"
184
+				        )->execute(array($theme_id));
185
+				        break;
186
+			        case 'ignore':
187
+				        echo '<br>', I18N::translate('Custom theme'), ' — ', $theme_id, ' — ', $theme_name, $icon_success;
188
+				        break;
189
+			        default:
190
+				        echo '<br>', I18N::translate('Custom theme'), ' — ', $theme_id, ' — ', $theme_name, $icon_failure;
191
+				        $custom_themes = true;
192
+				        break;
193
+			    }
194 194
 		}
195 195
 		break;
196 196
 	}
Please login to merge, or discard this patch.
admin_media.php 1 patch
Switch Indentation   +98 added lines, -98 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_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 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 .= ',';
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'];
154
-			}
155
-		} else {
156
-			$SELECT1 = " 1 ASC";
157
-		}
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();
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;
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_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 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 .= ',';
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'];
154
+			    }
155
+		    } else {
156
+			    $SELECT1 = " 1 ASC";
157
+		    }
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();
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.
placelist.php 1 patch
Switch Indentation   +164 added lines, -164 removed lines patch added patch discarded remove patch
@@ -51,170 +51,170 @@
 block discarded – undo
51 51
 echo '<div id="place-hierarchy">';
52 52
 
53 53
 switch ($display) {
54
-case 'list':
55
-	echo '<h2>', $controller->getPageTitle(), '</h2>';
56
-	$list_places = Place::allPlaces($WT_TREE);
57
-	$numfound    = count($list_places);
58
-
59
-	$divisor = $numfound > 20 ? 3 : 2;
60
-
61
-	if ($numfound === 0) {
62
-		echo '<b>', I18N::translate('No results found.'), '</b><br>';
63
-	} else {
64
-		$columns = array_chunk($list_places, ceil($numfound / $divisor));
65
-
66
-		$html = '<table class="list_table"><thead>';
67
-		$html .= '<tr><th class="list_label" colspan="' . $divisor . '">';
68
-		$html .= '<i class="icon-place"></i> ' . I18N::translate('Place list');
69
-		$html .= '</th></tr></thead>';
70
-		$html .= '<tbody><tr>';
71
-		foreach ($columns as $column) {
72
-			$html .= '<td class="list_value_wrap"><ul>';
73
-			foreach ($column as $item) {
74
-				$html .= '<li><a href="' . $item->getURL() . '">' . $item->getReverseName() . '</a></li>';
75
-			}
76
-			$html .= '</ul></td>';
77
-		}
78
-		$html .= '</tr></tbody></table>';
79
-		echo $html;
80
-	}
81
-	echo '<h4><a href="placelist.php?display=hierarchy">', I18N::translate('Show places in hierarchy'), '</a></h4>';
82
-	break;
83
-case 'hierarchy':
84
-	$gm_module = Module::getModuleByName('googlemap');
85
-
86
-	// Find this place and its ID
87
-	$place    = new Place(implode(', ', array_reverse($parent)), $WT_TREE);
88
-	$place_id = $place->getPlaceId();
89
-
90
-	$child_places = $place->getChildPlaces();
91
-
92
-	$numfound = count($child_places);
93
-
94
-	//-- if the number of places found is 0 then automatically redirect to search page
95
-	if ($numfound === 0) {
96
-		$action = 'show';
97
-	}
98
-
99
-	echo '<h2>', $controller->getPageTitle();
100
-	// Breadcrumbs
101
-	if ($place_id) {
102
-		$parent_place = $place->getParentPlace();
103
-		while ($parent_place->getPlaceId()) {
104
-			echo ', <a href="', $parent_place->getURL(), '" dir="auto">', $parent_place->getPlaceName(), '</a>';
105
-			$parent_place = $parent_place->getParentPlace();
106
-		}
107
-		echo ', <a href="', WT_SCRIPT_NAME, '">', I18N::translate('Top level'), '</a>';
108
-	}
109
-	echo '</h2>';
110
-
111
-	if ($gm_module && $gm_module->getSetting('GM_PLACE_HIERARCHY')) {
112
-		$linklevels  = '';
113
-		$place_names = array();
114
-		for ($j = 0; $j < $level; $j++) {
115
-			$linklevels .= '&amp;parent[' . $j . ']=' . rawurlencode($parent[$j]);
116
-		}
117
-
118
-		$gm_module->createMap();
119
-	} elseif (Module::getModuleByName('places_assistant')) {
120
-		// Places Assistant is a custom/add-on module that was once part of the core code.
121
-		\PlacesAssistantModule::display_map($level, $parent);
122
-	}
123
-
124
-	if ($numfound > 0) {
125
-		if ($numfound > 20) {
126
-			$divisor = 3;
127
-		} elseif ($numfound > 4) {
128
-			$divisor = 2;
129
-		} else {
130
-			$divisor = 1;
131
-		}
132
-
133
-		$columns = array_chunk($child_places, ceil($numfound / $divisor));
134
-		$html    = '<table id="place_hierarchy" class="list_table"><thead><tr><th class="list_label" colspan="' . $divisor . '">';
135
-		$html .= '<i class="icon-place"></i> ';
136
-		if ($place_id) {
137
-			$html .= I18N::translate('Places in %s', $place->getPlaceName());
138
-		} else {
139
-			$html .= I18N::translate('Place hierarchy');
140
-		}
141
-		$html .= '</th></tr></thead>';
142
-		$html .= '<tbody><tr>';
143
-		foreach ($columns as $column) {
144
-			$html .= '<td class="list_value"><ul>';
145
-			foreach ($column as $item) {
146
-				$html .= '<li><a href="' . $item->getURL() . '" class="list_item">' . $item->getPlaceName() . '</a></li>';
147
-				if ($gm_module && $gm_module->getSetting('GM_PLACE_HIERARCHY')) {
148
-					list($tmp)     = explode(', ', $item->getGedcomName(), 2);
149
-					$place_names[] = $tmp;
150
-				}
151
-			}
152
-			$html .= '</ul></td>';
153
-		}
154
-		$html .= '</tr></tbody>';
155
-		if ($numfound > 0 && $action == 'find' && $place_id) {
156
-			$html .= '<tfoot><tr><td class="list_label" colspan="' . $divisor . '">';
157
-			$html .= I18N::translate('View all records found in this place');
158
-			$html .= '</td></tr><tr><td class="list_value" colspan="' . $divisor . '" style="text-align: center;">';
159
-			$html .= '<a href="' . $place->getURL() . '&amp;action=show" class="formField">' . $place->getPlaceName() . '</a>';
160
-			$html .= '</td></tr></tfoot>';
161
-		}
162
-		$html .= '</table>';
163
-		// -- echo the array
164
-		echo $html;
165
-	}
166
-	if ($place_id && $action == 'show') {
167
-		// -- array of names
168
-		$myindilist = array();
169
-		$myfamlist  = array();
170
-
171
-		$positions =
172
-			Database::prepare("SELECT DISTINCT pl_gid FROM `##placelinks` WHERE pl_p_id=? AND pl_file=?")
173
-			->execute(array($place_id, $WT_TREE->getTreeId()))
174
-			->fetchOneColumn();
175
-
176
-		foreach ($positions as $position) {
177
-			$record = GedcomRecord::getInstance($position, $WT_TREE);
178
-			if ($record && $record->canShow()) {
179
-				if ($record instanceof Individual) {
180
-					$myindilist[] = $record;
181
-				}
182
-				if ($record instanceof Family) {
183
-					$myfamlist[] = $record;
184
-				}
185
-			}
186
-		}
187
-		echo '<br>';
188
-
189
-		//-- display results
190
-		$controller
191
-			->addInlineJavascript('jQuery("#places-tabs").tabs();')
192
-			->addInlineJavascript('jQuery("#places-tabs").css("visibility", "visible");')
193
-			->addInlineJavascript('jQuery(".loading-image").css("display", "none");');
194
-
195
-		echo '<div class="loading-image"></div>';
196
-		echo '<div id="places-tabs"><ul>';
197
-		if (!empty($myindilist)) {
198
-			echo '<li><a href="#places-indi"><span id="indisource">', I18N::translate('Individuals'), '</span></a></li>';
199
-		}
200
-		if (!empty($myfamlist)) {
201
-			echo '<li><a href="#places-fam"><span id="famsource">', I18N::translate('Families'), '</span></a></li>';
202
-		}
203
-		echo '</ul>';
204
-		if (!empty($myindilist)) {
205
-			echo '<div id="places-indi">', FunctionsPrintLists::individualTable($myindilist), '</div>';
206
-		}
207
-		if (!empty($myfamlist)) {
208
-			echo '<div id="places-fam">', FunctionsPrintLists::familyTable($myfamlist), '</div>';
209
-		}
210
-		echo '</div>'; // <div id="places-tabs">
211
-	}
212
-	echo '<h4><a href="placelist.php?display=list">', I18N::translate('Show all places in a list'), '</a></h4>';
213
-
214
-	if ($gm_module && $gm_module->getSetting('GM_PLACE_HIERARCHY')) {
215
-		$gm_module->mapScripts($numfound, $level, $parent, $linklevels, $place_names);
216
-	}
217
-	break;
54
+    case 'list':
55
+	    echo '<h2>', $controller->getPageTitle(), '</h2>';
56
+	    $list_places = Place::allPlaces($WT_TREE);
57
+	    $numfound    = count($list_places);
58
+
59
+	    $divisor = $numfound > 20 ? 3 : 2;
60
+
61
+	    if ($numfound === 0) {
62
+		    echo '<b>', I18N::translate('No results found.'), '</b><br>';
63
+	    } else {
64
+		    $columns = array_chunk($list_places, ceil($numfound / $divisor));
65
+
66
+		    $html = '<table class="list_table"><thead>';
67
+		    $html .= '<tr><th class="list_label" colspan="' . $divisor . '">';
68
+		    $html .= '<i class="icon-place"></i> ' . I18N::translate('Place list');
69
+		    $html .= '</th></tr></thead>';
70
+		    $html .= '<tbody><tr>';
71
+		    foreach ($columns as $column) {
72
+			    $html .= '<td class="list_value_wrap"><ul>';
73
+			    foreach ($column as $item) {
74
+				    $html .= '<li><a href="' . $item->getURL() . '">' . $item->getReverseName() . '</a></li>';
75
+			    }
76
+			    $html .= '</ul></td>';
77
+		    }
78
+		    $html .= '</tr></tbody></table>';
79
+		    echo $html;
80
+	    }
81
+	    echo '<h4><a href="placelist.php?display=hierarchy">', I18N::translate('Show places in hierarchy'), '</a></h4>';
82
+	    break;
83
+    case 'hierarchy':
84
+	    $gm_module = Module::getModuleByName('googlemap');
85
+
86
+	    // Find this place and its ID
87
+	    $place    = new Place(implode(', ', array_reverse($parent)), $WT_TREE);
88
+	    $place_id = $place->getPlaceId();
89
+
90
+	    $child_places = $place->getChildPlaces();
91
+
92
+	    $numfound = count($child_places);
93
+
94
+	    //-- if the number of places found is 0 then automatically redirect to search page
95
+	    if ($numfound === 0) {
96
+		    $action = 'show';
97
+	    }
98
+
99
+	    echo '<h2>', $controller->getPageTitle();
100
+	    // Breadcrumbs
101
+	    if ($place_id) {
102
+		    $parent_place = $place->getParentPlace();
103
+		    while ($parent_place->getPlaceId()) {
104
+			    echo ', <a href="', $parent_place->getURL(), '" dir="auto">', $parent_place->getPlaceName(), '</a>';
105
+			    $parent_place = $parent_place->getParentPlace();
106
+		    }
107
+		    echo ', <a href="', WT_SCRIPT_NAME, '">', I18N::translate('Top level'), '</a>';
108
+	    }
109
+	    echo '</h2>';
110
+
111
+	    if ($gm_module && $gm_module->getSetting('GM_PLACE_HIERARCHY')) {
112
+		    $linklevels  = '';
113
+		    $place_names = array();
114
+		    for ($j = 0; $j < $level; $j++) {
115
+			    $linklevels .= '&amp;parent[' . $j . ']=' . rawurlencode($parent[$j]);
116
+		    }
117
+
118
+		    $gm_module->createMap();
119
+	    } elseif (Module::getModuleByName('places_assistant')) {
120
+		    // Places Assistant is a custom/add-on module that was once part of the core code.
121
+		    \PlacesAssistantModule::display_map($level, $parent);
122
+	    }
123
+
124
+	    if ($numfound > 0) {
125
+		    if ($numfound > 20) {
126
+			    $divisor = 3;
127
+		    } elseif ($numfound > 4) {
128
+			    $divisor = 2;
129
+		    } else {
130
+			    $divisor = 1;
131
+		    }
132
+
133
+		    $columns = array_chunk($child_places, ceil($numfound / $divisor));
134
+		    $html    = '<table id="place_hierarchy" class="list_table"><thead><tr><th class="list_label" colspan="' . $divisor . '">';
135
+		    $html .= '<i class="icon-place"></i> ';
136
+		    if ($place_id) {
137
+			    $html .= I18N::translate('Places in %s', $place->getPlaceName());
138
+		    } else {
139
+			    $html .= I18N::translate('Place hierarchy');
140
+		    }
141
+		    $html .= '</th></tr></thead>';
142
+		    $html .= '<tbody><tr>';
143
+		    foreach ($columns as $column) {
144
+			    $html .= '<td class="list_value"><ul>';
145
+			    foreach ($column as $item) {
146
+				    $html .= '<li><a href="' . $item->getURL() . '" class="list_item">' . $item->getPlaceName() . '</a></li>';
147
+				    if ($gm_module && $gm_module->getSetting('GM_PLACE_HIERARCHY')) {
148
+					    list($tmp)     = explode(', ', $item->getGedcomName(), 2);
149
+					    $place_names[] = $tmp;
150
+				    }
151
+			    }
152
+			    $html .= '</ul></td>';
153
+		    }
154
+		    $html .= '</tr></tbody>';
155
+		    if ($numfound > 0 && $action == 'find' && $place_id) {
156
+			    $html .= '<tfoot><tr><td class="list_label" colspan="' . $divisor . '">';
157
+			    $html .= I18N::translate('View all records found in this place');
158
+			    $html .= '</td></tr><tr><td class="list_value" colspan="' . $divisor . '" style="text-align: center;">';
159
+			    $html .= '<a href="' . $place->getURL() . '&amp;action=show" class="formField">' . $place->getPlaceName() . '</a>';
160
+			    $html .= '</td></tr></tfoot>';
161
+		    }
162
+		    $html .= '</table>';
163
+		    // -- echo the array
164
+		    echo $html;
165
+	    }
166
+	    if ($place_id && $action == 'show') {
167
+		    // -- array of names
168
+		    $myindilist = array();
169
+		    $myfamlist  = array();
170
+
171
+		    $positions =
172
+			    Database::prepare("SELECT DISTINCT pl_gid FROM `##placelinks` WHERE pl_p_id=? AND pl_file=?")
173
+			    ->execute(array($place_id, $WT_TREE->getTreeId()))
174
+			    ->fetchOneColumn();
175
+
176
+		    foreach ($positions as $position) {
177
+			    $record = GedcomRecord::getInstance($position, $WT_TREE);
178
+			    if ($record && $record->canShow()) {
179
+				    if ($record instanceof Individual) {
180
+					    $myindilist[] = $record;
181
+				    }
182
+				    if ($record instanceof Family) {
183
+					    $myfamlist[] = $record;
184
+				    }
185
+			    }
186
+		    }
187
+		    echo '<br>';
188
+
189
+		    //-- display results
190
+		    $controller
191
+			    ->addInlineJavascript('jQuery("#places-tabs").tabs();')
192
+			    ->addInlineJavascript('jQuery("#places-tabs").css("visibility", "visible");')
193
+			    ->addInlineJavascript('jQuery(".loading-image").css("display", "none");');
194
+
195
+		    echo '<div class="loading-image"></div>';
196
+		    echo '<div id="places-tabs"><ul>';
197
+		    if (!empty($myindilist)) {
198
+			    echo '<li><a href="#places-indi"><span id="indisource">', I18N::translate('Individuals'), '</span></a></li>';
199
+		    }
200
+		    if (!empty($myfamlist)) {
201
+			    echo '<li><a href="#places-fam"><span id="famsource">', I18N::translate('Families'), '</span></a></li>';
202
+		    }
203
+		    echo '</ul>';
204
+		    if (!empty($myindilist)) {
205
+			    echo '<div id="places-indi">', FunctionsPrintLists::individualTable($myindilist), '</div>';
206
+		    }
207
+		    if (!empty($myfamlist)) {
208
+			    echo '<div id="places-fam">', FunctionsPrintLists::familyTable($myfamlist), '</div>';
209
+		    }
210
+		    echo '</div>'; // <div id="places-tabs">
211
+	    }
212
+	    echo '<h4><a href="placelist.php?display=list">', I18N::translate('Show all places in a list'), '</a></h4>';
213
+
214
+	    if ($gm_module && $gm_module->getSetting('GM_PLACE_HIERARCHY')) {
215
+		    $gm_module->mapScripts($numfound, $level, $parent, $linklevels, $place_names);
216
+	    }
217
+	    break;
218 218
 }
219 219
 
220 220
 echo '</div>'; // <div id="place-hierarchy">
Please login to merge, or discard this patch.
calendar.php 1 patch
Switch Indentation   +105 added lines, -105 removed lines patch added patch discarded remove patch
@@ -118,15 +118,15 @@  discard block
 block discarded – undo
118 118
 $controller->setPageTitle(I18N::translate('Anniversary calendar'));
119 119
 
120 120
 switch ($view) {
121
-case 'day':
122
-	$controller->setPageTitle(I18N::translate('On this day…') . ' ' . $ged_date->display(false));
123
-	break;
124
-case 'month':
125
-	$controller->setPageTitle(I18N::translate('In this month…') . ' ' . $ged_date->display(false, '%F %Y'));
126
-	break;
127
-case 'year':
128
-	$controller->setPageTitle(I18N::translate('In this year…') . ' ' . $ged_date->display(false, '%Y'));
129
-	break;
121
+    case 'day':
122
+	    $controller->setPageTitle(I18N::translate('On this day…') . ' ' . $ged_date->display(false));
123
+	    break;
124
+    case 'month':
125
+	    $controller->setPageTitle(I18N::translate('In this month…') . ' ' . $ged_date->display(false, '%F %Y'));
126
+	    break;
127
+    case 'year':
128
+	    $controller->setPageTitle(I18N::translate('In this year…') . ' ' . $ged_date->display(false, '%Y'));
129
+	    break;
130 130
 }
131 131
 
132 132
 $controller->pageHeader();
@@ -329,38 +329,38 @@  discard block
 block discarded – undo
329 329
 $found_facts = array();
330 330
 
331 331
 switch ($view) {
332
-case 'day':
333
-	$found_facts = apply_filter(FunctionsDb::getAnniversaryEvents($cal_date->minJD, $filterev, $WT_TREE), $filterof, $filtersx);
334
-	break;
335
-case 'month':
336
-	$cal_date->d = 0;
337
-	$cal_date->setJdFromYmd();
338
-	// Make a separate list for each day. Unspecified/invalid days go in day 0.
339
-	for ($d = 0; $d <= $days_in_month; ++$d) {
340
-		$found_facts[$d] = array();
341
-	}
342
-	// Fetch events for each day
343
-	for ($jd = $cal_date->minJD; $jd <= $cal_date->maxJD; ++$jd) {
344
-		foreach (apply_filter(FunctionsDb::getAnniversaryEvents($jd, $filterev, $WT_TREE), $filterof, $filtersx) as $fact) {
345
-			$tmp = $fact->getDate()->minimumDate();
346
-			if ($tmp->d >= 1 && $tmp->d <= $tmp->daysInMonth()) {
347
-				// If the day is valid (for its own calendar), display it in the
348
-				// anniversary day (for the display calendar).
349
-				$found_facts[$jd - $cal_date->minJD + 1][] = $fact;
350
-			} else {
351
-				// Otherwise, display it in the "Day not set" box.
352
-				$found_facts[0][] = $fact;
353
-			}
354
-		}
355
-	}
356
-	break;
357
-case 'year':
358
-	$cal_date->m = 0;
359
-	$cal_date->setJdFromYmd();
360
-	$found_facts = apply_filter(FunctionsDb::getCalendarEvents($ged_date->minimumJulianDay(), $ged_date->maximumJulianDay(), $filterev, $WT_TREE), $filterof, $filtersx);
361
-	// Eliminate duplicates (e.g. BET JUL 1900 AND SEP 1900 will appear twice in 1900)
362
-	$found_facts = array_unique($found_facts);
363
-	break;
332
+    case 'day':
333
+	    $found_facts = apply_filter(FunctionsDb::getAnniversaryEvents($cal_date->minJD, $filterev, $WT_TREE), $filterof, $filtersx);
334
+	    break;
335
+    case 'month':
336
+	    $cal_date->d = 0;
337
+	    $cal_date->setJdFromYmd();
338
+	    // Make a separate list for each day. Unspecified/invalid days go in day 0.
339
+	    for ($d = 0; $d <= $days_in_month; ++$d) {
340
+		    $found_facts[$d] = array();
341
+	    }
342
+	    // Fetch events for each day
343
+	    for ($jd = $cal_date->minJD; $jd <= $cal_date->maxJD; ++$jd) {
344
+		    foreach (apply_filter(FunctionsDb::getAnniversaryEvents($jd, $filterev, $WT_TREE), $filterof, $filtersx) as $fact) {
345
+			    $tmp = $fact->getDate()->minimumDate();
346
+			    if ($tmp->d >= 1 && $tmp->d <= $tmp->daysInMonth()) {
347
+				    // If the day is valid (for its own calendar), display it in the
348
+				    // anniversary day (for the display calendar).
349
+				    $found_facts[$jd - $cal_date->minJD + 1][] = $fact;
350
+			    } else {
351
+				    // Otherwise, display it in the "Day not set" box.
352
+				    $found_facts[0][] = $fact;
353
+			    }
354
+		    }
355
+	    }
356
+	    break;
357
+    case 'year':
358
+	    $cal_date->m = 0;
359
+	    $cal_date->setJdFromYmd();
360
+	    $found_facts = apply_filter(FunctionsDb::getCalendarEvents($ged_date->minimumJulianDay(), $ged_date->maximumJulianDay(), $filterev, $WT_TREE), $filterof, $filtersx);
361
+	    // Eliminate duplicates (e.g. BET JUL 1900 AND SEP 1900 will appear twice in 1900)
362
+	    $found_facts = array_unique($found_facts);
363
+	    break;
364 364
 }
365 365
 
366 366
 // Group the facts by family/individual
@@ -369,39 +369,39 @@  discard block
 block discarded – undo
369 369
 $cal_facts = array();
370 370
 
371 371
 switch ($view) {
372
-case 'year':
373
-case 'day':
374
-	foreach ($found_facts as $fact) {
375
-		$record = $fact->getParent();
376
-		$xref   = $record->getXref();
377
-		if ($record instanceof Individual) {
378
-			if (empty($indis[$xref])) {
379
-				$indis[$xref] = calendar_fact_text($fact, true);
380
-			} else {
381
-				$indis[$xref] .= '<br>' . calendar_fact_text($fact, true);
382
-			}
383
-		} elseif ($record instanceof Family) {
384
-			if (empty($indis[$xref])) {
385
-				$fams[$xref] = calendar_fact_text($fact, true);
386
-			} else {
387
-				$fams[$xref] .= '<br>' . calendar_fact_text($fact, true);
388
-			}
389
-		}
390
-	}
391
-	break;
392
-case 'month':
393
-	foreach ($found_facts as $d => $facts) {
394
-		$cal_facts[$d] = array();
395
-		foreach ($facts as $fact) {
396
-			$xref = $fact->getParent()->getXref();
397
-			if (empty($cal_facts[$d][$xref])) {
398
-				$cal_facts[$d][$xref] = calendar_fact_text($fact, false);
399
-			} else {
400
-				$cal_facts[$d][$xref] .= '<br>' . calendar_fact_text($fact, false);
401
-			}
402
-		}
403
-	}
404
-	break;
372
+    case 'year':
373
+    case 'day':
374
+	    foreach ($found_facts as $fact) {
375
+		    $record = $fact->getParent();
376
+		    $xref   = $record->getXref();
377
+		    if ($record instanceof Individual) {
378
+			    if (empty($indis[$xref])) {
379
+				    $indis[$xref] = calendar_fact_text($fact, true);
380
+			    } else {
381
+				    $indis[$xref] .= '<br>' . calendar_fact_text($fact, true);
382
+			    }
383
+		    } elseif ($record instanceof Family) {
384
+			    if (empty($indis[$xref])) {
385
+				    $fams[$xref] = calendar_fact_text($fact, true);
386
+			    } else {
387
+				    $fams[$xref] .= '<br>' . calendar_fact_text($fact, true);
388
+			    }
389
+		    }
390
+	    }
391
+	    break;
392
+    case 'month':
393
+	    foreach ($found_facts as $d => $facts) {
394
+		    $cal_facts[$d] = array();
395
+		    foreach ($facts as $fact) {
396
+			    $xref = $fact->getParent()->getXref();
397
+			    if (empty($cal_facts[$d][$xref])) {
398
+				    $cal_facts[$d][$xref] = calendar_fact_text($fact, false);
399
+			    } else {
400
+				    $cal_facts[$d][$xref] .= '<br>' . calendar_fact_text($fact, false);
401
+			    }
402
+		    }
403
+	    }
404
+	    break;
405 405
 }
406 406
 
407 407
 switch ($view) {
@@ -498,26 +498,26 @@  discard block
 block discarded – undo
498 498
 			// Show a converted date
499 499
 			foreach (explode('_and_', $CALENDAR_FORMAT) as $convcal) {
500 500
 				switch ($convcal) {
501
-				case 'french':
502
-					$alt_date = new FrenchDate($cal_date->minJD + $d - 1);
503
-					break;
504
-				case 'gregorian':
505
-					$alt_date = new GregorianDate($cal_date->minJD + $d - 1);
506
-					break;
507
-				case 'jewish':
508
-					$alt_date = new JewishDate($cal_date->minJD + $d - 1);
509
-					break;
510
-				case 'julian':
511
-					$alt_date = new JulianDate($cal_date->minJD + $d - 1);
512
-					break;
513
-				case 'hijri':
514
-					$alt_date = new HijriDate($cal_date->minJD + $d - 1);
515
-					break;
516
-				case 'jalali':
517
-					$alt_date = new JalaliDate($cal_date->minJD + $d - 1);
518
-					break;
519
-				default:
520
-					break 2;
501
+				    case 'french':
502
+					    $alt_date = new FrenchDate($cal_date->minJD + $d - 1);
503
+					    break;
504
+				    case 'gregorian':
505
+					    $alt_date = new GregorianDate($cal_date->minJD + $d - 1);
506
+					    break;
507
+				    case 'jewish':
508
+					    $alt_date = new JewishDate($cal_date->minJD + $d - 1);
509
+					    break;
510
+				    case 'julian':
511
+					    $alt_date = new JulianDate($cal_date->minJD + $d - 1);
512
+					    break;
513
+				    case 'hijri':
514
+					    $alt_date = new HijriDate($cal_date->minJD + $d - 1);
515
+					    break;
516
+				    case 'jalali':
517
+					    $alt_date = new JalaliDate($cal_date->minJD + $d - 1);
518
+					    break;
519
+				    default:
520
+					    break 2;
521 521
 				}
522 522
 				if (get_class($alt_date) !== get_class($cal_date) && $alt_date->inValidRange()) {
523 523
 					echo '<span class="rtl_cal_day">' . $alt_date->format("%j %M") . '</span>';
@@ -627,17 +627,17 @@  discard block
 block discarded – undo
627 627
 		$html .= $tag1 . '<a href="' . $tmp->getHtmlUrl() . '">' . $tmp->getFullName() . '</a> ';
628 628
 		if ($show_sex_symbols && $tmp instanceof Individual) {
629 629
 			switch ($tmp->getSex()) {
630
-			case 'M':
631
-				$html .= '<i class="icon-sex_m_9x9" title="' . I18N::translate('Male') . '"></i>';
632
-				++$males;
633
-				break;
634
-			case 'F':
635
-				$html .= '<i class="icon-sex_f_9x9" title="' . I18N::translate('Female') . '"></i>';
636
-				++$females;
637
-				break;
638
-			default:
639
-				$html .= '<i class="icon-sex_u_9x9" title="' . I18N::translateContext('unknown gender', 'Unknown') . '"></i>';
640
-				break;
630
+			    case 'M':
631
+				    $html .= '<i class="icon-sex_m_9x9" title="' . I18N::translate('Male') . '"></i>';
632
+				    ++$males;
633
+				    break;
634
+			    case 'F':
635
+				    $html .= '<i class="icon-sex_f_9x9" title="' . I18N::translate('Female') . '"></i>';
636
+				    ++$females;
637
+				    break;
638
+			    default:
639
+				    $html .= '<i class="icon-sex_u_9x9" title="' . I18N::translateContext('unknown gender', 'Unknown') . '"></i>';
640
+				    break;
641 641
 			}
642 642
 		}
643 643
 		$html .= '<div class="indent">' . $facts . '</div>' . $tag2;
Please login to merge, or discard this patch.
search_advanced.php 1 patch
Switch Indentation   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -185,18 +185,18 @@
 block discarded – undo
185 185
 				$searchField  = $controller->getField($k);
186 186
 				$searchOption = substr($searchField, 20); // Assume we have something like "FAMC:HUSB:NAME:GIVN:foo"
187 187
 				switch (substr($searchField, 0, 20)) {
188
-				case 'FAMC:HUSB:NAME:GIVN:':
189
-					$fatherGivnOption = $searchOption;
190
-					break;
191
-				case 'FAMC:HUSB:NAME:SURN:':
192
-					$fatherSurnOption = $searchOption;
193
-					break;
194
-				case 'FAMC:WIFE:NAME:GIVN:':
195
-					$motherGivnOption = $searchOption;
196
-					break;
197
-				case 'FAMC:WIFE:NAME:SURN:':
198
-					$motherSurnOption = $searchOption;
199
-					break;
188
+				    case 'FAMC:HUSB:NAME:GIVN:':
189
+					    $fatherGivnOption = $searchOption;
190
+					    break;
191
+				    case 'FAMC:HUSB:NAME:SURN:':
192
+					    $fatherSurnOption = $searchOption;
193
+					    break;
194
+				    case 'FAMC:WIFE:NAME:GIVN:':
195
+					    $motherGivnOption = $searchOption;
196
+					    break;
197
+				    case 'FAMC:WIFE:NAME:SURN:':
198
+					    $motherSurnOption = $searchOption;
199
+					    break;
200 200
 				}
201 201
 			}
202 202
 			?>
Please login to merge, or discard this patch.
import.php 1 patch
Switch Indentation   +69 added lines, -69 removed lines patch added patch discarded remove patch
@@ -125,75 +125,75 @@
 block discarded – undo
125 125
 		// MySQL supports a wide range of collation conversions. These are ones that
126 126
 		// have been encountered "in the wild".
127 127
 		switch ($charset) {
128
-		case 'ASCII':
129
-			Database::prepare(
130
-				"UPDATE `##gedcom_chunk`" .
131
-				" SET chunk_data=CONVERT(CONVERT(chunk_data USING ascii) USING utf8)" .
132
-				" WHERE gedcom_id=?"
133
-			)->execute(array($gedcom_id));
134
-			break;
135
-		case 'IBMPC':   // IBMPC, IBM WINDOWS and MS-DOS could be anything. Mostly it means CP850.
136
-		case 'IBM WINDOWS':
137
-		case 'MS-DOS':
138
-		case 'CP437':
139
-		case 'CP850':
140
-			// CP850 has extra letters with diacritics to replace box-drawing chars in CP437.
141
-			Database::prepare(
142
-				"UPDATE `##gedcom_chunk`" .
143
-				" SET chunk_data=CONVERT(CONVERT(chunk_data USING cp850) USING utf8)" .
144
-				" WHERE gedcom_id=?"
145
-			)->execute(array($gedcom_id));
146
-			break;
147
-		case 'ANSI': // ANSI could be anything. Most applications seem to treat it as latin1.
148
-			$controller->addInlineJavascript(
149
-				'jQuery("#import' . $gedcom_id . '").parent().prepend("<div class=\"bg-info\">' . /* I18N: %1$s and %2$s are the names of character encodings, such as ISO-8859-1 or ASCII */
150
-					I18N::translate('This GEDCOM file is encoded using %1$s. Assume this to mean %2$s.', $charset, 'ISO-8859-1') . '</div>");'
151
-				);
152
-			// no break;
153
-		case 'WINDOWS':
154
-		case 'CP1252':
155
-		case 'ISO8859-1':
156
-		case 'ISO-8859-1':
157
-		case 'LATIN1':
158
-		case 'LATIN-1':
159
-			// Convert from ISO-8859-1 (western european) to UTF8.
160
-			Database::prepare(
161
-				"UPDATE `##gedcom_chunk`" .
162
-				" SET chunk_data=CONVERT(CONVERT(chunk_data USING latin1) USING utf8)" .
163
-				" WHERE gedcom_id=?"
164
-			)->execute(array($gedcom_id));
165
-			break;
166
-		case 'CP1250':
167
-		case 'ISO8859-2':
168
-		case 'ISO-8859-2':
169
-		case 'LATIN2':
170
-		case 'LATIN-2':
171
-			// Convert from ISO-8859-2 (eastern european) to UTF8.
172
-			Database::prepare(
173
-				"UPDATE `##gedcom_chunk`" .
174
-				" SET chunk_data=CONVERT(CONVERT(chunk_data USING latin2) USING utf8)" .
175
-				" WHERE gedcom_id=?"
176
-			)->execute(array($gedcom_id));
177
-			break;
178
-		case 'MACINTOSH':
179
-			// Convert from MAC Roman to UTF8.
180
-			Database::prepare(
181
-				"UPDATE `##gedcom_chunk`" .
182
-				" SET chunk_data=CONVERT(CONVERT(chunk_data USING macroman) USING utf8)" .
183
-				" WHERE gedcom_id=?"
184
-			)->execute(array($gedcom_id));
185
-			break;
186
-		case 'UTF8':
187
-		case 'UTF-8':
188
-			// Already UTF-8 so nothing to do!
189
-			break;
190
-		case 'ANSEL':
191
-		default:
192
-			Database::rollBack();
193
-			echo '<span class="error">', I18N::translate('Error: converting GEDCOM files from %s encoding to UTF-8 encoding not currently supported.', $charset), '</span>';
194
-			$controller->addInlineJavascript('jQuery("#actions' . $gedcom_id . '").removeClass("hidden");');
195
-
196
-			return;
128
+		    case 'ASCII':
129
+			    Database::prepare(
130
+				    "UPDATE `##gedcom_chunk`" .
131
+				    " SET chunk_data=CONVERT(CONVERT(chunk_data USING ascii) USING utf8)" .
132
+				    " WHERE gedcom_id=?"
133
+			    )->execute(array($gedcom_id));
134
+			    break;
135
+		    case 'IBMPC':   // IBMPC, IBM WINDOWS and MS-DOS could be anything. Mostly it means CP850.
136
+		    case 'IBM WINDOWS':
137
+		    case 'MS-DOS':
138
+		    case 'CP437':
139
+		    case 'CP850':
140
+			    // CP850 has extra letters with diacritics to replace box-drawing chars in CP437.
141
+			    Database::prepare(
142
+				    "UPDATE `##gedcom_chunk`" .
143
+				    " SET chunk_data=CONVERT(CONVERT(chunk_data USING cp850) USING utf8)" .
144
+				    " WHERE gedcom_id=?"
145
+			    )->execute(array($gedcom_id));
146
+			    break;
147
+		    case 'ANSI': // ANSI could be anything. Most applications seem to treat it as latin1.
148
+			    $controller->addInlineJavascript(
149
+				    'jQuery("#import' . $gedcom_id . '").parent().prepend("<div class=\"bg-info\">' . /* I18N: %1$s and %2$s are the names of character encodings, such as ISO-8859-1 or ASCII */
150
+					    I18N::translate('This GEDCOM file is encoded using %1$s. Assume this to mean %2$s.', $charset, 'ISO-8859-1') . '</div>");'
151
+				    );
152
+			    // no break;
153
+		    case 'WINDOWS':
154
+		    case 'CP1252':
155
+		    case 'ISO8859-1':
156
+		    case 'ISO-8859-1':
157
+		    case 'LATIN1':
158
+		    case 'LATIN-1':
159
+			    // Convert from ISO-8859-1 (western european) to UTF8.
160
+			    Database::prepare(
161
+				    "UPDATE `##gedcom_chunk`" .
162
+				    " SET chunk_data=CONVERT(CONVERT(chunk_data USING latin1) USING utf8)" .
163
+				    " WHERE gedcom_id=?"
164
+			    )->execute(array($gedcom_id));
165
+			    break;
166
+		    case 'CP1250':
167
+		    case 'ISO8859-2':
168
+		    case 'ISO-8859-2':
169
+		    case 'LATIN2':
170
+		    case 'LATIN-2':
171
+			    // Convert from ISO-8859-2 (eastern european) to UTF8.
172
+			    Database::prepare(
173
+				    "UPDATE `##gedcom_chunk`" .
174
+				    " SET chunk_data=CONVERT(CONVERT(chunk_data USING latin2) USING utf8)" .
175
+				    " WHERE gedcom_id=?"
176
+			    )->execute(array($gedcom_id));
177
+			    break;
178
+		    case 'MACINTOSH':
179
+			    // Convert from MAC Roman to UTF8.
180
+			    Database::prepare(
181
+				    "UPDATE `##gedcom_chunk`" .
182
+				    " SET chunk_data=CONVERT(CONVERT(chunk_data USING macroman) USING utf8)" .
183
+				    " WHERE gedcom_id=?"
184
+			    )->execute(array($gedcom_id));
185
+			    break;
186
+		    case 'UTF8':
187
+		    case 'UTF-8':
188
+			    // Already UTF-8 so nothing to do!
189
+			    break;
190
+		    case 'ANSEL':
191
+		    default:
192
+			    Database::rollBack();
193
+			    echo '<span class="error">', I18N::translate('Error: converting GEDCOM files from %s encoding to UTF-8 encoding not currently supported.', $charset), '</span>';
194
+			    $controller->addInlineJavascript('jQuery("#actions' . $gedcom_id . '").removeClass("hidden");');
195
+
196
+			    return;
197 197
 		}
198 198
 		$first_time = false;
199 199
 
Please login to merge, or discard this patch.
admin_trees_config.php 1 patch
Switch Indentation   +170 added lines, -170 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
-	}
141
-
142
-	$xrefs     = Filter::postArray('xref', WT_REGEX_XREF);
143
-	$tag_types = Filter::postArray('tag_type', WT_REGEX_TAG);
144
-	$resns     = Filter::postArray('resn');
145
-
146
-	foreach ($xrefs as $n => $xref) {
147
-		$tag_type = $tag_types[$n];
148
-		$resn     = $resns[$n];
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 === '') {
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
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
-	}
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'));
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());
180
-
181
-	return;
182
-
183
-case 'general':
184
-	if (!Filter::checkCsrf()) {
185
-		break;
186
-	}
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
-	}
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
-	}
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');
288
-		}
289
-	}
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.
298
-		}
299
-	}
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');
303
-
304
-	return;
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
+
142
+	    $xrefs     = Filter::postArray('xref', WT_REGEX_XREF);
143
+	    $tag_types = Filter::postArray('tag_type', WT_REGEX_TAG);
144
+	    $resns     = Filter::postArray('resn');
145
+
146
+	    foreach ($xrefs as $n => $xref) {
147
+		    $tag_type = $tag_types[$n];
148
+		    $resn     = $resns[$n];
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 === '') {
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
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
+	    }
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'));
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());
180
+
181
+	    return;
182
+
183
+    case 'general':
184
+	    if (!Filter::checkCsrf()) {
185
+		    break;
186
+	    }
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
+	    }
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
+	    }
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');
288
+		    }
289
+	    }
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.
298
+		    }
299
+	    }
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');
303
+
304
+	    return;
305 305
 }
306 306
 
307 307
 switch (Filter::get('action')) {
Please login to merge, or discard this patch.
admin_pgv_to_wt.php 1 patch
Switch Indentation   +83 added lines, -83 removed lines patch added patch discarded remove patch
@@ -778,69 +778,69 @@  discard block
 block discarded – undo
778 778
 	$stmt_gedcom_setting->execute(array($GED_DATA['id'], 'INDI_FACTS_QUICK', $INDI_FACTS_QUICK));
779 779
 	$stmt_gedcom_setting->execute(array($GED_DATA['id'], 'INDI_FACTS_UNIQUE', $INDI_FACTS_UNIQUE));
780 780
 	switch ($LANGUAGE) {
781
-	case 'catalan':
782
-		$stmt_gedcom_setting->execute(array($GED_DATA['id'], 'LANGUAGE', 'ca'));
783
-		break;
784
-	case 'english-uk':
785
-		$stmt_gedcom_setting->execute(array($GED_DATA['id'], 'LANGUAGE', 'en-GB'));
786
-		break;
787
-	case 'polish':
788
-		$stmt_gedcom_setting->execute(array($GED_DATA['id'], 'LANGUAGE', 'pl'));
789
-		break;
790
-	case 'italian':
791
-		$stmt_gedcom_setting->execute(array($GED_DATA['id'], 'LANGUAGE', 'it'));
792
-		break;
793
-	case 'spanish':
794
-		$stmt_gedcom_setting->execute(array($GED_DATA['id'], 'LANGUAGE', 'es'));
795
-		break;
796
-	case 'finnish':
797
-		$stmt_gedcom_setting->execute(array($GED_DATA['id'], 'LANGUAGE', 'fi'));
798
-		break;
799
-	case 'french':
800
-		$stmt_gedcom_setting->execute(array($GED_DATA['id'], 'LANGUAGE', 'fr'));
801
-		break;
802
-	case 'german':
803
-		$stmt_gedcom_setting->execute(array($GED_DATA['id'], 'LANGUAGE', 'de'));
804
-		break;
805
-	case 'danish':
806
-		$stmt_gedcom_setting->execute(array($GED_DATA['id'], 'LANGUAGE', 'da'));
807
-		break;
808
-	case 'portuguese':
809
-		$stmt_gedcom_setting->execute(array($GED_DATA['id'], 'LANGUAGE', 'pt'));
810
-		break;
811
-	case 'hebrew':
812
-		$stmt_gedcom_setting->execute(array($GED_DATA['id'], 'LANGUAGE', 'he'));
813
-		break;
814
-	case 'estonian':
815
-		$stmt_gedcom_setting->execute(array($GED_DATA['id'], 'LANGUAGE', 'et'));
816
-		break;
817
-	case 'turkish':
818
-		$stmt_gedcom_setting->execute(array($GED_DATA['id'], 'LANGUAGE', 'tr'));
819
-		break;
820
-	case 'dutch':
821
-		$stmt_gedcom_setting->execute(array($GED_DATA['id'], 'LANGUAGE', 'nl'));
822
-		break;
823
-	case 'slovak':
824
-		$stmt_gedcom_setting->execute(array($GED_DATA['id'], 'LANGUAGE', 'sk'));
825
-		break;
826
-	case 'norwegian':
827
-		$stmt_gedcom_setting->execute(array($GED_DATA['id'], 'LANGUAGE', 'nn'));
828
-		break;
829
-	case 'slovenian':
830
-		$stmt_gedcom_setting->execute(array($GED_DATA['id'], 'LANGUAGE', 'sl'));
831
-		break;
832
-	case 'hungarian':
833
-		$stmt_gedcom_setting->execute(array($GED_DATA['id'], 'LANGUAGE', 'hu'));
834
-		break;
835
-	case 'swedish':
836
-		$stmt_gedcom_setting->execute(array($GED_DATA['id'], 'LANGUAGE', 'sv'));
837
-		break;
838
-	case 'russian':
839
-		$stmt_gedcom_setting->execute(array($GED_DATA['id'], 'LANGUAGE', 'ru'));
840
-		break;
841
-	default:
842
-		$stmt_gedcom_setting->execute(array($GED_DATA['id'], 'LANGUAGE', 'en-US'));
843
-		break;
781
+	    case 'catalan':
782
+		    $stmt_gedcom_setting->execute(array($GED_DATA['id'], 'LANGUAGE', 'ca'));
783
+		    break;
784
+	    case 'english-uk':
785
+		    $stmt_gedcom_setting->execute(array($GED_DATA['id'], 'LANGUAGE', 'en-GB'));
786
+		    break;
787
+	    case 'polish':
788
+		    $stmt_gedcom_setting->execute(array($GED_DATA['id'], 'LANGUAGE', 'pl'));
789
+		    break;
790
+	    case 'italian':
791
+		    $stmt_gedcom_setting->execute(array($GED_DATA['id'], 'LANGUAGE', 'it'));
792
+		    break;
793
+	    case 'spanish':
794
+		    $stmt_gedcom_setting->execute(array($GED_DATA['id'], 'LANGUAGE', 'es'));
795
+		    break;
796
+	    case 'finnish':
797
+		    $stmt_gedcom_setting->execute(array($GED_DATA['id'], 'LANGUAGE', 'fi'));
798
+		    break;
799
+	    case 'french':
800
+		    $stmt_gedcom_setting->execute(array($GED_DATA['id'], 'LANGUAGE', 'fr'));
801
+		    break;
802
+	    case 'german':
803
+		    $stmt_gedcom_setting->execute(array($GED_DATA['id'], 'LANGUAGE', 'de'));
804
+		    break;
805
+	    case 'danish':
806
+		    $stmt_gedcom_setting->execute(array($GED_DATA['id'], 'LANGUAGE', 'da'));
807
+		    break;
808
+	    case 'portuguese':
809
+		    $stmt_gedcom_setting->execute(array($GED_DATA['id'], 'LANGUAGE', 'pt'));
810
+		    break;
811
+	    case 'hebrew':
812
+		    $stmt_gedcom_setting->execute(array($GED_DATA['id'], 'LANGUAGE', 'he'));
813
+		    break;
814
+	    case 'estonian':
815
+		    $stmt_gedcom_setting->execute(array($GED_DATA['id'], 'LANGUAGE', 'et'));
816
+		    break;
817
+	    case 'turkish':
818
+		    $stmt_gedcom_setting->execute(array($GED_DATA['id'], 'LANGUAGE', 'tr'));
819
+		    break;
820
+	    case 'dutch':
821
+		    $stmt_gedcom_setting->execute(array($GED_DATA['id'], 'LANGUAGE', 'nl'));
822
+		    break;
823
+	    case 'slovak':
824
+		    $stmt_gedcom_setting->execute(array($GED_DATA['id'], 'LANGUAGE', 'sk'));
825
+		    break;
826
+	    case 'norwegian':
827
+		    $stmt_gedcom_setting->execute(array($GED_DATA['id'], 'LANGUAGE', 'nn'));
828
+		    break;
829
+	    case 'slovenian':
830
+		    $stmt_gedcom_setting->execute(array($GED_DATA['id'], 'LANGUAGE', 'sl'));
831
+		    break;
832
+	    case 'hungarian':
833
+		    $stmt_gedcom_setting->execute(array($GED_DATA['id'], 'LANGUAGE', 'hu'));
834
+		    break;
835
+	    case 'swedish':
836
+		    $stmt_gedcom_setting->execute(array($GED_DATA['id'], 'LANGUAGE', 'sv'));
837
+		    break;
838
+	    case 'russian':
839
+		    $stmt_gedcom_setting->execute(array($GED_DATA['id'], 'LANGUAGE', 'ru'));
840
+		    break;
841
+	    default:
842
+		    $stmt_gedcom_setting->execute(array($GED_DATA['id'], 'LANGUAGE', 'en-US'));
843
+		    break;
844 844
 	}
845 845
 	$stmt_gedcom_setting->execute(array($GED_DATA['id'], 'MAX_ALIVE_AGE', $MAX_ALIVE_AGE));
846 846
 	$stmt_gedcom_setting->execute(array($GED_DATA['id'], 'MAX_DESCENDANCY_GENERATIONS', $MAX_DESCENDANCY_GENERATIONS));
@@ -900,26 +900,26 @@  discard block
 block discarded – undo
900 900
 	$stmt_gedcom_setting->execute(array($GED_DATA['id'], 'SURNAME_LIST_STYLE', $SURNAME_LIST_STYLE));
901 901
 	$stmt_gedcom_setting->execute(array($GED_DATA['id'], 'SURNAME_TRADITION', $SURNAME_TRADITION));
902 902
 	switch ($THEME_DIR) {
903
-	case '':
904
-		$stmt_gedcom_setting->execute(array($GED_DATA['id'], 'THEME_DIR', ''));
905
-		break;
906
-	case 'themes/cloudy/':
907
-		$stmt_gedcom_setting->execute(array($GED_DATA['id'], 'THEME_DIR', 'clouds'));
908
-		break;
909
-	case 'themes/minimal/':
910
-		$stmt_gedcom_setting->execute(array($GED_DATA['id'], 'THEME_DIR', 'minimal'));
911
-		break;
912
-	case 'themes/simplyblue/':
913
-	case 'themes/simplygreen/':
914
-	case 'themes/simplyred/':
915
-		$stmt_gedcom_setting->execute(array($GED_DATA['id'], 'THEME_DIR', 'colors'));
916
-		break;
917
-	case 'themes/xenea/':
918
-		$stmt_gedcom_setting->execute(array($GED_DATA['id'], 'THEME_DIR', 'xenea'));
919
-		break;
920
-	default:
921
-		$stmt_gedcom_setting->execute(array($GED_DATA['id'], 'THEME_DIR', 'webtrees'));
922
-		break;
903
+	    case '':
904
+		    $stmt_gedcom_setting->execute(array($GED_DATA['id'], 'THEME_DIR', ''));
905
+		    break;
906
+	    case 'themes/cloudy/':
907
+		    $stmt_gedcom_setting->execute(array($GED_DATA['id'], 'THEME_DIR', 'clouds'));
908
+		    break;
909
+	    case 'themes/minimal/':
910
+		    $stmt_gedcom_setting->execute(array($GED_DATA['id'], 'THEME_DIR', 'minimal'));
911
+		    break;
912
+	    case 'themes/simplyblue/':
913
+	    case 'themes/simplygreen/':
914
+	    case 'themes/simplyred/':
915
+		    $stmt_gedcom_setting->execute(array($GED_DATA['id'], 'THEME_DIR', 'colors'));
916
+		    break;
917
+	    case 'themes/xenea/':
918
+		    $stmt_gedcom_setting->execute(array($GED_DATA['id'], 'THEME_DIR', 'xenea'));
919
+		    break;
920
+	    default:
921
+		    $stmt_gedcom_setting->execute(array($GED_DATA['id'], 'THEME_DIR', 'webtrees'));
922
+		    break;
923 923
 	}
924 924
 	$stmt_gedcom_setting->execute(array($GED_DATA['id'], 'THUMBNAIL_WIDTH', $THUMBNAIL_WIDTH));
925 925
 	$stmt_gedcom_setting->execute(array($GED_DATA['id'], 'USE_RELATIONSHIP_PRIVACY', $USE_RELATIONSHIP_PRIVACY));
Please login to merge, or discard this patch.