@@ -13,7 +13,7 @@ |
||
13 | 13 | * You should have received a copy of the GNU General Public License |
14 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
15 | 15 | */ |
16 | -declare(strict_types=1); |
|
16 | +declare(strict_types = 1); |
|
17 | 17 | |
18 | 18 | namespace Fisharebest\Webtrees\Http\Controllers; |
19 | 19 |
@@ -13,7 +13,7 @@ |
||
13 | 13 | * You should have received a copy of the GNU General Public License |
14 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
15 | 15 | */ |
16 | -declare(strict_types=1); |
|
16 | +declare(strict_types = 1); |
|
17 | 17 | |
18 | 18 | namespace Fisharebest\Webtrees; |
19 | 19 |
@@ -35,72 +35,72 @@ discard block |
||
35 | 35 | $url = Filter::get('url', null, 'index.php'); |
36 | 36 | |
37 | 37 | switch ($action) { |
38 | -case 'reject': |
|
39 | - $gedcom_id = Database::prepare("SELECT gedcom_id FROM `##change` WHERE change_id=?")->execute([$change_id])->fetchOne(); |
|
40 | - $xref = Database::prepare("SELECT xref FROM `##change` WHERE change_id=?")->execute([$change_id])->fetchOne(); |
|
41 | - // Reject a change, and subsequent changes to the same record |
|
42 | - Database::prepare( |
|
43 | - "UPDATE `##change`" . |
|
44 | - " SET status = 'rejected'" . |
|
45 | - " WHERE status = 'pending'" . |
|
46 | - " AND gedcom_id = ?" . |
|
47 | - " AND xref = ?" . |
|
48 | - " AND change_id >= ?" |
|
49 | - )->execute([$gedcom_id, $xref, $change_id]); |
|
50 | - break; |
|
51 | -case 'accept': |
|
52 | - $gedcom_id = Database::prepare("SELECT gedcom_id FROM `##change` WHERE change_id=?")->execute([$change_id])->fetchOne(); |
|
53 | - $xref = Database::prepare("SELECT xref FROM `##change` WHERE change_id=?")->execute([$change_id])->fetchOne(); |
|
54 | - // Accept a change, and all previous changes to the same record |
|
55 | - $all_changes = Database::prepare( |
|
56 | - "SELECT change_id, gedcom_id, gedcom_name, xref, old_gedcom, new_gedcom" . |
|
57 | - " FROM `##change` c" . |
|
58 | - " JOIN `##gedcom` g USING (gedcom_id)" . |
|
59 | - " WHERE c.status = 'pending'" . |
|
60 | - " AND gedcom_id = ?" . |
|
61 | - " AND xref = ?" . |
|
62 | - " AND change_id <= ?" . |
|
63 | - " ORDER BY change_id" |
|
64 | - )->execute([$gedcom_id, $xref, $change_id])->fetchAll(); |
|
65 | - foreach ($all_changes as $change) { |
|
66 | - if (empty($change->new_gedcom)) { |
|
67 | - // delete |
|
68 | - FunctionsImport::updateRecord($change->old_gedcom, $gedcom_id, true); |
|
69 | - } else { |
|
70 | - // add/update |
|
71 | - FunctionsImport::updateRecord($change->new_gedcom, $gedcom_id, false); |
|
38 | + case 'reject': |
|
39 | + $gedcom_id = Database::prepare("SELECT gedcom_id FROM `##change` WHERE change_id=?")->execute([$change_id])->fetchOne(); |
|
40 | + $xref = Database::prepare("SELECT xref FROM `##change` WHERE change_id=?")->execute([$change_id])->fetchOne(); |
|
41 | + // Reject a change, and subsequent changes to the same record |
|
42 | + Database::prepare( |
|
43 | + "UPDATE `##change`" . |
|
44 | + " SET status = 'rejected'" . |
|
45 | + " WHERE status = 'pending'" . |
|
46 | + " AND gedcom_id = ?" . |
|
47 | + " AND xref = ?" . |
|
48 | + " AND change_id >= ?" |
|
49 | + )->execute([$gedcom_id, $xref, $change_id]); |
|
50 | + break; |
|
51 | + case 'accept': |
|
52 | + $gedcom_id = Database::prepare("SELECT gedcom_id FROM `##change` WHERE change_id=?")->execute([$change_id])->fetchOne(); |
|
53 | + $xref = Database::prepare("SELECT xref FROM `##change` WHERE change_id=?")->execute([$change_id])->fetchOne(); |
|
54 | + // Accept a change, and all previous changes to the same record |
|
55 | + $all_changes = Database::prepare( |
|
56 | + "SELECT change_id, gedcom_id, gedcom_name, xref, old_gedcom, new_gedcom" . |
|
57 | + " FROM `##change` c" . |
|
58 | + " JOIN `##gedcom` g USING (gedcom_id)" . |
|
59 | + " WHERE c.status = 'pending'" . |
|
60 | + " AND gedcom_id = ?" . |
|
61 | + " AND xref = ?" . |
|
62 | + " AND change_id <= ?" . |
|
63 | + " ORDER BY change_id" |
|
64 | + )->execute([$gedcom_id, $xref, $change_id])->fetchAll(); |
|
65 | + foreach ($all_changes as $change) { |
|
66 | + if (empty($change->new_gedcom)) { |
|
67 | + // delete |
|
68 | + FunctionsImport::updateRecord($change->old_gedcom, $gedcom_id, true); |
|
69 | + } else { |
|
70 | + // add/update |
|
71 | + FunctionsImport::updateRecord($change->new_gedcom, $gedcom_id, false); |
|
72 | + } |
|
73 | + Database::prepare("UPDATE `##change` SET status='accepted' WHERE change_id=?")->execute([$change->change_id]); |
|
74 | + Log::addEditLog("Accepted change {$change->change_id} for {$change->xref} / {$change->gedcom_name} into database"); |
|
72 | 75 | } |
73 | - Database::prepare("UPDATE `##change` SET status='accepted' WHERE change_id=?")->execute([$change->change_id]); |
|
74 | - Log::addEditLog("Accepted change {$change->change_id} for {$change->xref} / {$change->gedcom_name} into database"); |
|
75 | - } |
|
76 | - break; |
|
77 | -case 'rejectall': |
|
78 | - Database::prepare( |
|
79 | - "UPDATE `##change`" . |
|
80 | - " SET status='rejected'" . |
|
81 | - " WHERE status='pending' AND gedcom_id=?" |
|
82 | - )->execute([$WT_TREE->getTreeId()]); |
|
83 | - break; |
|
84 | -case 'acceptall': |
|
85 | - $all_changes = Database::prepare( |
|
86 | - "SELECT change_id, gedcom_id, gedcom_name, xref, old_gedcom, new_gedcom" . |
|
87 | - " FROM `##change` c" . |
|
88 | - " JOIN `##gedcom` g USING (gedcom_id)" . |
|
89 | - " WHERE c.status='pending' AND gedcom_id=?" . |
|
90 | - " ORDER BY change_id" |
|
91 | - )->execute([$WT_TREE->getTreeId()])->fetchAll(); |
|
92 | - foreach ($all_changes as $change) { |
|
93 | - if (empty($change->new_gedcom)) { |
|
94 | - // delete |
|
95 | - FunctionsImport::updateRecord($change->old_gedcom, $change->gedcom_id, true); |
|
96 | - } else { |
|
97 | - // add/update |
|
98 | - FunctionsImport::updateRecord($change->new_gedcom, $change->gedcom_id, false); |
|
76 | + break; |
|
77 | + case 'rejectall': |
|
78 | + Database::prepare( |
|
79 | + "UPDATE `##change`" . |
|
80 | + " SET status='rejected'" . |
|
81 | + " WHERE status='pending' AND gedcom_id=?" |
|
82 | + )->execute([$WT_TREE->getTreeId()]); |
|
83 | + break; |
|
84 | + case 'acceptall': |
|
85 | + $all_changes = Database::prepare( |
|
86 | + "SELECT change_id, gedcom_id, gedcom_name, xref, old_gedcom, new_gedcom" . |
|
87 | + " FROM `##change` c" . |
|
88 | + " JOIN `##gedcom` g USING (gedcom_id)" . |
|
89 | + " WHERE c.status='pending' AND gedcom_id=?" . |
|
90 | + " ORDER BY change_id" |
|
91 | + )->execute([$WT_TREE->getTreeId()])->fetchAll(); |
|
92 | + foreach ($all_changes as $change) { |
|
93 | + if (empty($change->new_gedcom)) { |
|
94 | + // delete |
|
95 | + FunctionsImport::updateRecord($change->old_gedcom, $change->gedcom_id, true); |
|
96 | + } else { |
|
97 | + // add/update |
|
98 | + FunctionsImport::updateRecord($change->new_gedcom, $change->gedcom_id, false); |
|
99 | + } |
|
100 | + Database::prepare("UPDATE `##change` SET status='accepted' WHERE change_id=?")->execute([$change->change_id]); |
|
101 | + Log::addEditLog("Accepted change {$change->change_id} for {$change->xref} / {$change->gedcom_name} into database"); |
|
99 | 102 | } |
100 | - Database::prepare("UPDATE `##change` SET status='accepted' WHERE change_id=?")->execute([$change->change_id]); |
|
101 | - Log::addEditLog("Accepted change {$change->change_id} for {$change->xref} / {$change->gedcom_name} into database"); |
|
102 | - } |
|
103 | - break; |
|
103 | + break; |
|
104 | 104 | } |
105 | 105 | |
106 | 106 | $rows = Database::prepare( |
@@ -120,27 +120,27 @@ discard block |
||
120 | 120 | preg_match('/^0 (?:@' . WT_REGEX_XREF . '@ )?(' . WT_REGEX_TAG . ')/', $row->old_gedcom . $row->new_gedcom, $match); |
121 | 121 | |
122 | 122 | switch ($match[1]) { |
123 | - case 'INDI': |
|
124 | - $row->record = new Individual($row->xref, $row->old_gedcom, $row->new_gedcom, $tree); |
|
125 | - break; |
|
126 | - case 'FAM': |
|
127 | - $row->record = new Family($row->xref, $row->old_gedcom, $row->new_gedcom, $tree); |
|
128 | - break; |
|
129 | - case 'SOUR': |
|
130 | - $row->record = new Source($row->xref, $row->old_gedcom, $row->new_gedcom, $tree); |
|
131 | - break; |
|
132 | - case 'REPO': |
|
133 | - $row->record = new Repository($row->xref, $row->old_gedcom, $row->new_gedcom, $tree); |
|
134 | - break; |
|
135 | - case 'OBJE': |
|
136 | - $row->record = new Media($row->xref, $row->old_gedcom, $row->new_gedcom, $tree); |
|
137 | - break; |
|
138 | - case 'NOTE': |
|
139 | - $row->record = new Note($row->xref, $row->old_gedcom, $row->new_gedcom, $tree); |
|
140 | - break; |
|
141 | - default: |
|
142 | - $row->record = new GedcomRecord($row->xref, $row->old_gedcom, $row->new_gedcom, $tree); |
|
143 | - break; |
|
123 | + case 'INDI': |
|
124 | + $row->record = new Individual($row->xref, $row->old_gedcom, $row->new_gedcom, $tree); |
|
125 | + break; |
|
126 | + case 'FAM': |
|
127 | + $row->record = new Family($row->xref, $row->old_gedcom, $row->new_gedcom, $tree); |
|
128 | + break; |
|
129 | + case 'SOUR': |
|
130 | + $row->record = new Source($row->xref, $row->old_gedcom, $row->new_gedcom, $tree); |
|
131 | + break; |
|
132 | + case 'REPO': |
|
133 | + $row->record = new Repository($row->xref, $row->old_gedcom, $row->new_gedcom, $tree); |
|
134 | + break; |
|
135 | + case 'OBJE': |
|
136 | + $row->record = new Media($row->xref, $row->old_gedcom, $row->new_gedcom, $tree); |
|
137 | + break; |
|
138 | + case 'NOTE': |
|
139 | + $row->record = new Note($row->xref, $row->old_gedcom, $row->new_gedcom, $tree); |
|
140 | + break; |
|
141 | + default: |
|
142 | + $row->record = new GedcomRecord($row->xref, $row->old_gedcom, $row->new_gedcom, $tree); |
|
143 | + break; |
|
144 | 144 | } |
145 | 145 | |
146 | 146 | $row->accept_url = Html::url('edit_changes.php', [ |
@@ -38,38 +38,38 @@ |
||
38 | 38 | |
39 | 39 | foreach ($facts as $fact) { |
40 | 40 | switch ($fact->getTag()) { |
41 | - case 'ADDR': |
|
42 | - case 'ALIA': |
|
43 | - case 'ASSO': |
|
44 | - case 'CHAN': |
|
45 | - case 'CHIL': |
|
46 | - case 'EMAIL': |
|
47 | - case 'FAMC': |
|
48 | - case 'FAMS': |
|
49 | - case 'HUSB': |
|
50 | - case 'NAME': |
|
51 | - case 'NOTE': |
|
52 | - case 'OBJE': |
|
53 | - case 'PHON': |
|
54 | - case 'RESI': |
|
55 | - case 'RESN': |
|
56 | - case 'SEX': |
|
57 | - case 'SOUR': |
|
58 | - case 'SSN': |
|
59 | - case 'SUBM': |
|
60 | - case 'TITL': |
|
61 | - case 'URL': |
|
62 | - case 'WIFE': |
|
63 | - case 'WWW': |
|
64 | - case '_EMAIL': |
|
65 | - case '_TODO': |
|
66 | - case '_UID': |
|
67 | - case '_WT_OBJE_SORT': |
|
68 | - // Do not show these |
|
69 | - break; |
|
70 | - default: |
|
71 | - // Simple version of FunctionsPrintFacts::print_fact() |
|
72 | - echo $fact->summary(); |
|
73 | - break; |
|
41 | + case 'ADDR': |
|
42 | + case 'ALIA': |
|
43 | + case 'ASSO': |
|
44 | + case 'CHAN': |
|
45 | + case 'CHIL': |
|
46 | + case 'EMAIL': |
|
47 | + case 'FAMC': |
|
48 | + case 'FAMS': |
|
49 | + case 'HUSB': |
|
50 | + case 'NAME': |
|
51 | + case 'NOTE': |
|
52 | + case 'OBJE': |
|
53 | + case 'PHON': |
|
54 | + case 'RESI': |
|
55 | + case 'RESN': |
|
56 | + case 'SEX': |
|
57 | + case 'SOUR': |
|
58 | + case 'SSN': |
|
59 | + case 'SUBM': |
|
60 | + case 'TITL': |
|
61 | + case 'URL': |
|
62 | + case 'WIFE': |
|
63 | + case 'WWW': |
|
64 | + case '_EMAIL': |
|
65 | + case '_TODO': |
|
66 | + case '_UID': |
|
67 | + case '_WT_OBJE_SORT': |
|
68 | + // Do not show these |
|
69 | + break; |
|
70 | + default: |
|
71 | + // Simple version of FunctionsPrintFacts::print_fact() |
|
72 | + echo $fact->summary(); |
|
73 | + break; |
|
74 | 74 | } |
75 | 75 | } |
@@ -37,12 +37,12 @@ discard block |
||
37 | 37 | |
38 | 38 | $show_marnm = Filter::get('show_marnm', 'no|yes'); |
39 | 39 | switch ($show_marnm) { |
40 | -case 'no': |
|
41 | -case 'yes': |
|
42 | - Auth::user()->setPreference('famlist.php_show_marnm', $show_marnm); |
|
43 | - break; |
|
44 | -default: |
|
45 | - $show_marnm = Auth::user()->getPreference('famlist.php_show_marnm'); |
|
40 | + case 'no': |
|
41 | + case 'yes': |
|
42 | + Auth::user()->setPreference('famlist.php_show_marnm', $show_marnm); |
|
43 | + break; |
|
44 | + default: |
|
45 | + $show_marnm = Auth::user()->getPreference('famlist.php_show_marnm'); |
|
46 | 46 | } |
47 | 47 | |
48 | 48 | // Make sure selections are consistent. |
@@ -79,16 +79,16 @@ discard block |
||
79 | 79 | } |
80 | 80 | $url = '?surname=' . rawurlencode($surname) . '&ged=' . $controller->tree()->getNameUrl(); |
81 | 81 | switch ($falpha) { |
82 | - case '': |
|
83 | - break; |
|
84 | - case '@': |
|
85 | - $legend .= ', ' . I18N::translateContext('Unknown given name', '…'); |
|
86 | - $url .= '&falpha=' . rawurlencode($falpha) . '&ged=' . $controller->tree()->getNameUrl(); |
|
87 | - break; |
|
88 | - default: |
|
89 | - $legend .= ', ' . Html::escape($falpha) . '…'; |
|
90 | - $url .= '&falpha=' . rawurlencode($falpha) . '&ged=' . $controller->tree()->getNameUrl(); |
|
91 | - break; |
|
82 | + case '': |
|
83 | + break; |
|
84 | + case '@': |
|
85 | + $legend .= ', ' . I18N::translateContext('Unknown given name', '…'); |
|
86 | + $url .= '&falpha=' . rawurlencode($falpha) . '&ged=' . $controller->tree()->getNameUrl(); |
|
87 | + break; |
|
88 | + default: |
|
89 | + $legend .= ', ' . Html::escape($falpha) . '…'; |
|
90 | + $url .= '&falpha=' . rawurlencode($falpha) . '&ged=' . $controller->tree()->getNameUrl(); |
|
91 | + break; |
|
92 | 92 | } |
93 | 93 | $show = 'indi'; // SURN list makes no sense here |
94 | 94 | } elseif ($alpha === '@') { |
@@ -173,16 +173,16 @@ discard block |
||
173 | 173 | if ($show === 'surn') { |
174 | 174 | // Show the surname list |
175 | 175 | switch ($controller->tree()->getPreference('SURNAME_LIST_STYLE')) { |
176 | - case 'style1': |
|
177 | - echo FunctionsPrintLists::surnameList($surns, 3, true, 'famlist.php', $controller->tree()); |
|
178 | - break; |
|
179 | - case 'style3': |
|
180 | - echo FunctionsPrintLists::surnameTagCloud($surns, 'famlist.php', true, $controller->tree()); |
|
181 | - break; |
|
182 | - case 'style2': |
|
183 | - default: |
|
184 | - echo FunctionsPrintLists::surnameTable($surns, 'famlist.php', $controller->tree()); |
|
185 | - break; |
|
176 | + case 'style1': |
|
177 | + echo FunctionsPrintLists::surnameList($surns, 3, true, 'famlist.php', $controller->tree()); |
|
178 | + break; |
|
179 | + case 'style3': |
|
180 | + echo FunctionsPrintLists::surnameTagCloud($surns, 'famlist.php', true, $controller->tree()); |
|
181 | + break; |
|
182 | + case 'style2': |
|
183 | + default: |
|
184 | + echo FunctionsPrintLists::surnameTable($surns, 'famlist.php', $controller->tree()); |
|
185 | + break; |
|
186 | 186 | } |
187 | 187 | } else { |
188 | 188 | // Show the list |
@@ -53,15 +53,15 @@ |
||
53 | 53 | $route = $request->get('route'); |
54 | 54 | |
55 | 55 | switch ($method . ':' . $route) { |
56 | -default: |
|
57 | - $url = Html::url('setup.php', ['route' => 'setup']); |
|
58 | - $response = new RedirectResponse($url); |
|
59 | - break; |
|
56 | + default: |
|
57 | + $url = Html::url('setup.php', ['route' => 'setup']); |
|
58 | + $response = new RedirectResponse($url); |
|
59 | + break; |
|
60 | 60 | |
61 | -case 'GET:setup': |
|
62 | -case 'POST:setup': |
|
63 | - $response = (new SetupController)->setup($request); |
|
64 | - break; |
|
61 | + case 'GET:setup': |
|
62 | + case 'POST:setup': |
|
63 | + $response = (new SetupController)->setup($request); |
|
64 | + break; |
|
65 | 65 | } |
66 | 66 | |
67 | 67 | $response->prepare($request)->send(); |
@@ -27,25 +27,25 @@ |
||
27 | 27 | // Only generate the content for interactive users (not search robots). |
28 | 28 | if (Filter::getBool('ajax') && Session::has('initiated')) { |
29 | 29 | switch ($controller->chart_style) { |
30 | - case 0: // List |
|
31 | - echo '<ul id="descendancy_chart" class="chart_common">'; |
|
32 | - $controller->printChildDescendancy($controller->root, $controller->generations); |
|
33 | - echo '</ul>'; |
|
34 | - break; |
|
35 | - case 1: // Booklet |
|
36 | - $show_cousins = true; |
|
37 | - echo '<div id="descendancy_booklet">'; |
|
38 | - $controller->printChildFamily($controller->root, $controller->generations); |
|
39 | - echo '</div>'; |
|
40 | - break; |
|
41 | - case 2: // Individual list |
|
42 | - $descendants = $controller->individualDescendancy($controller->root, $controller->generations, []); |
|
43 | - echo '<div id="descendancy-list">', FunctionsPrintLists::individualTable($descendants), '</div>'; |
|
44 | - break; |
|
45 | - case 3: // Family list |
|
46 | - $descendants = $controller->familyDescendancy($controller->root, $controller->generations, []); |
|
47 | - echo '<div id="descendancy-list">', FunctionsPrintLists::familyTable($descendants), '</div>'; |
|
48 | - break; |
|
30 | + case 0: // List |
|
31 | + echo '<ul id="descendancy_chart" class="chart_common">'; |
|
32 | + $controller->printChildDescendancy($controller->root, $controller->generations); |
|
33 | + echo '</ul>'; |
|
34 | + break; |
|
35 | + case 1: // Booklet |
|
36 | + $show_cousins = true; |
|
37 | + echo '<div id="descendancy_booklet">'; |
|
38 | + $controller->printChildFamily($controller->root, $controller->generations); |
|
39 | + echo '</div>'; |
|
40 | + break; |
|
41 | + case 2: // Individual list |
|
42 | + $descendants = $controller->individualDescendancy($controller->root, $controller->generations, []); |
|
43 | + echo '<div id="descendancy-list">', FunctionsPrintLists::individualTable($descendants), '</div>'; |
|
44 | + break; |
|
45 | + case 3: // Family list |
|
46 | + $descendants = $controller->familyDescendancy($controller->root, $controller->generations, []); |
|
47 | + echo '<div id="descendancy-list">', FunctionsPrintLists::familyTable($descendants), '</div>'; |
|
48 | + break; |
|
49 | 49 | } |
50 | 50 | echo $controller->getJavascript(); |
51 | 51 |
@@ -82,146 +82,146 @@ |
||
82 | 82 | ); |
83 | 83 | $new_xref = $WT_TREE->getNewXref($type); |
84 | 84 | switch ($type) { |
85 | - case 'INDI': |
|
86 | - Database::prepare( |
|
87 | - "UPDATE `##individuals` SET i_id = ?, i_gedcom = REPLACE(i_gedcom, ?, ?) WHERE i_id = ? AND i_file = ?" |
|
88 | - )->execute([$new_xref, "0 @$old_xref@ INDI\n", "0 @$new_xref@ INDI\n", $old_xref, $WT_TREE->getTreeId()]); |
|
89 | - Database::prepare( |
|
90 | - "UPDATE `##families` JOIN `##link` ON (l_file = f_file AND l_to = ? AND l_type = 'HUSB') SET f_gedcom = REPLACE(f_gedcom, ?, ?) WHERE f_file = ?" |
|
91 | - )->execute([$old_xref, " HUSB @$old_xref@", " HUSB @$new_xref@", $WT_TREE->getTreeId()]); |
|
92 | - Database::prepare( |
|
93 | - "UPDATE `##families` JOIN `##link` ON (l_file = f_file AND l_to = ? AND l_type = 'WIFE') SET f_gedcom = REPLACE(f_gedcom, ?, ?) WHERE f_file = ?" |
|
94 | - )->execute([$old_xref, " WIFE @$old_xref@", " WIFE @$new_xref@", $WT_TREE->getTreeId()]); |
|
95 | - Database::prepare( |
|
96 | - "UPDATE `##families` JOIN `##link` ON (l_file = f_file AND l_to = ? AND l_type = 'CHIL') SET f_gedcom = REPLACE(f_gedcom, ?, ?) WHERE f_file = ?" |
|
97 | - )->execute([$old_xref, " CHIL @$old_xref@", " CHIL @$new_xref@", $WT_TREE->getTreeId()]); |
|
98 | - Database::prepare( |
|
99 | - "UPDATE `##families` JOIN `##link` ON (l_file = f_file AND l_to = ? AND l_type = 'ASSO') SET f_gedcom = REPLACE(f_gedcom, ?, ?) WHERE f_file = ?" |
|
100 | - )->execute([$old_xref, " ASSO @$old_xref@", " ASSO @$new_xref@", $WT_TREE->getTreeId()]); |
|
101 | - Database::prepare( |
|
102 | - "UPDATE `##families` JOIN `##link` ON (l_file = f_file AND l_to = ? AND l_type = '_ASSO') SET f_gedcom = REPLACE(f_gedcom, ?, ?) WHERE f_file = ?" |
|
103 | - )->execute([$old_xref, " _ASSO @$old_xref@", " _ASSO @$new_xref@", $WT_TREE->getTreeId()]); |
|
104 | - Database::prepare( |
|
105 | - "UPDATE `##individuals` JOIN `##link` ON (l_file = i_file AND l_to = ? AND l_type = 'ASSO') SET i_gedcom = REPLACE(i_gedcom, ?, ?) WHERE i_file = ?" |
|
106 | - )->execute([$old_xref, " ASSO @$old_xref@", " ASSO @$new_xref@", $WT_TREE->getTreeId()]); |
|
107 | - Database::prepare( |
|
108 | - "UPDATE `##individuals` JOIN `##link` ON (l_file = i_file AND l_to = ? AND l_type = '_ASSO') SET i_gedcom = REPLACE(i_gedcom, ?, ?) WHERE i_file = ?" |
|
109 | - )->execute([$old_xref, " _ASSO @$old_xref@", " _ASSO @$new_xref@", $WT_TREE->getTreeId()]); |
|
110 | - Database::prepare( |
|
111 | - "UPDATE `##placelinks` SET pl_gid = ? WHERE pl_gid = ? AND pl_file = ?" |
|
112 | - )->execute([$new_xref, $old_xref, $WT_TREE->getTreeId()]); |
|
113 | - Database::prepare( |
|
114 | - "UPDATE `##dates` SET d_gid = ? WHERE d_gid = ? AND d_file = ?" |
|
115 | - )->execute([$new_xref, $old_xref, $WT_TREE->getTreeId()]); |
|
116 | - Database::prepare( |
|
117 | - "UPDATE `##user_gedcom_setting` SET setting_value = ? WHERE setting_value = ? AND gedcom_id = ? AND setting_name IN ('gedcomid', 'rootid')" |
|
118 | - )->execute([$new_xref, $old_xref, $WT_TREE->getTreeId()]); |
|
119 | - break; |
|
120 | - case 'FAM': |
|
121 | - Database::prepare( |
|
122 | - "UPDATE `##families` SET f_id = ?, f_gedcom = REPLACE(f_gedcom, ?, ?) WHERE f_id = ? AND f_file = ?" |
|
123 | - )->execute([$new_xref, "0 @$old_xref@ FAM\n", "0 @$new_xref@ FAM\n", $old_xref, $WT_TREE->getTreeId()]); |
|
124 | - Database::prepare( |
|
125 | - "UPDATE `##individuals` JOIN `##link` ON (l_file = i_file AND l_to = ? AND l_type = 'FAMC') SET i_gedcom = REPLACE(i_gedcom, ?, ?) WHERE i_file = ?" |
|
126 | - )->execute([$old_xref, " FAMC @$old_xref@", " FAMC @$new_xref@", $WT_TREE->getTreeId()]); |
|
127 | - Database::prepare( |
|
128 | - "UPDATE `##individuals` JOIN `##link` ON (l_file = i_file AND l_to = ? AND l_type = 'FAMS') SET i_gedcom = REPLACE(i_gedcom, ?, ?) WHERE i_file = ?" |
|
129 | - )->execute([$old_xref, " FAMS @$old_xref@", " FAMS @$new_xref@", $WT_TREE->getTreeId()]); |
|
130 | - Database::prepare( |
|
131 | - "UPDATE `##placelinks` SET pl_gid = ? WHERE pl_gid = ? AND pl_file = ?" |
|
132 | - )->execute([$new_xref, $old_xref, $WT_TREE->getTreeId()]); |
|
133 | - Database::prepare( |
|
134 | - "UPDATE `##dates` SET d_gid = ? WHERE d_gid = ? AND d_file = ?" |
|
135 | - )->execute([$new_xref, $old_xref, $WT_TREE->getTreeId()]); |
|
136 | - break; |
|
137 | - case 'SOUR': |
|
138 | - Database::prepare( |
|
139 | - "UPDATE `##sources` SET s_id = ?, s_gedcom = REPLACE(s_gedcom, ?, ?) WHERE s_id = ? AND s_file = ?" |
|
140 | - )->execute([$new_xref, "0 @$old_xref@ SOUR\n", "0 @$new_xref@ SOUR\n", $old_xref, $WT_TREE->getTreeId()]); |
|
141 | - Database::prepare( |
|
142 | - "UPDATE `##individuals` JOIN `##link` ON (l_file = i_file AND l_to = ? AND l_type = 'SOUR') SET i_gedcom = REPLACE(i_gedcom, ?, ?) WHERE i_file = ?" |
|
143 | - )->execute([$old_xref, " SOUR @$old_xref@", " SOUR @$new_xref@", $WT_TREE->getTreeId()]); |
|
144 | - Database::prepare( |
|
145 | - "UPDATE `##families` JOIN `##link` ON (l_file = f_file AND l_to = ? AND l_type = 'SOUR') SET f_gedcom = REPLACE(f_gedcom, ?, ?) WHERE f_file = ?" |
|
146 | - )->execute([$old_xref, " SOUR @$old_xref@", " SOUR @$new_xref@", $WT_TREE->getTreeId()]); |
|
147 | - Database::prepare( |
|
148 | - "UPDATE `##media` JOIN `##link` ON (l_file = m_file AND l_to = ? AND l_type = 'SOUR') SET m_gedcom = REPLACE(m_gedcom, ?, ?) WHERE m_file = ?" |
|
149 | - )->execute([$old_xref, " SOUR @$old_xref@", " SOUR @$new_xref@", $WT_TREE->getTreeId()]); |
|
150 | - Database::prepare( |
|
151 | - "UPDATE `##other` JOIN `##link` ON (l_file = o_file AND l_to = ? AND l_type = 'SOUR') SET o_gedcom = REPLACE(o_gedcom, ?, ?) WHERE o_file = ?" |
|
152 | - )->execute([$old_xref, " SOUR @$old_xref@", " SOUR @$new_xref@", $WT_TREE->getTreeId()]); |
|
153 | - break; |
|
154 | - case 'REPO': |
|
155 | - Database::prepare( |
|
156 | - "UPDATE `##other` SET o_id = ?, o_gedcom = REPLACE(o_gedcom, ?, ?) WHERE o_id = ? AND o_file = ?" |
|
157 | - )->execute([$new_xref, "0 @$old_xref@ REPO\n", "0 @$new_xref@ REPO\n", $old_xref, $WT_TREE->getTreeId()]); |
|
158 | - Database::prepare( |
|
159 | - "UPDATE `##sources` JOIN `##link` ON (l_file = s_file AND l_to = ? AND l_type = 'REPO') SET s_gedcom = REPLACE(s_gedcom, ?, ?) WHERE s_file = ?" |
|
160 | - )->execute([$old_xref, " REPO @$old_xref@", " REPO @$new_xref@", $WT_TREE->getTreeId()]); |
|
161 | - break; |
|
162 | - case 'NOTE': |
|
163 | - Database::prepare( |
|
164 | - "UPDATE `##other` SET o_id = ?, o_gedcom = REPLACE(REPLACE(o_gedcom, ?, ?), ?, ?) WHERE o_id = ? AND o_file = ?" |
|
165 | - )->execute([$new_xref, "0 @$old_xref@ NOTE\n", "0 @$new_xref@ NOTE\n", "0 @$old_xref@ NOTE ", "0 @$new_xref@ NOTE ", $old_xref, $WT_TREE->getTreeId()]); |
|
166 | - Database::prepare( |
|
167 | - "UPDATE `##individuals` JOIN `##link` ON (l_file = i_file AND l_to = ? AND l_type = 'NOTE') SET i_gedcom = REPLACE(i_gedcom, ?, ?) WHERE i_file = ?" |
|
168 | - )->execute([$old_xref, " NOTE @$old_xref@", " NOTE @$new_xref@", $WT_TREE->getTreeId()]); |
|
169 | - Database::prepare( |
|
170 | - "UPDATE `##families` JOIN `##link` ON (l_file = f_file AND l_to = ? AND l_type = 'NOTE') SET f_gedcom = REPLACE(f_gedcom, ?, ?) WHERE f_file = ?" |
|
171 | - )->execute([$old_xref, " NOTE @$old_xref@", " NOTE @$new_xref@", $WT_TREE->getTreeId()]); |
|
172 | - Database::prepare( |
|
173 | - "UPDATE `##media` JOIN `##link` ON (l_file = m_file AND l_to = ? AND l_type = 'NOTE') SET m_gedcom = REPLACE(m_gedcom, ?, ?) WHERE m_file = ?" |
|
174 | - )->execute([$old_xref, " NOTE @$old_xref@", " NOTE @$new_xref@", $WT_TREE->getTreeId()]); |
|
175 | - Database::prepare( |
|
176 | - "UPDATE `##sources` JOIN `##link` ON (l_file = s_file AND l_to = ? AND l_type = 'NOTE') SET s_gedcom = REPLACE(s_gedcom, ?, ?) WHERE s_file = ?" |
|
177 | - )->execute([$old_xref, " NOTE @$old_xref@", " NOTE @$new_xref@", $WT_TREE->getTreeId()]); |
|
178 | - Database::prepare( |
|
179 | - "UPDATE `##other` JOIN `##link` ON (l_file = o_file AND l_to = ? AND l_type = 'NOTE') SET o_gedcom = REPLACE(o_gedcom, ?, ?) WHERE o_file = ?" |
|
180 | - )->execute([$old_xref, " NOTE @$old_xref@", " NOTE @$new_xref@", $WT_TREE->getTreeId()]); |
|
181 | - break; |
|
182 | - case 'OBJE': |
|
183 | - Database::prepare( |
|
184 | - "UPDATE `##media` SET m_id = ?, m_gedcom = REPLACE(m_gedcom, ?, ?) WHERE m_id = ? AND m_file = ?" |
|
185 | - )->execute([$new_xref, "0 @$old_xref@ OBJE\n", "0 @$new_xref@ OBJE\n", $old_xref, $WT_TREE->getTreeId()]); |
|
186 | - Database::prepare( |
|
187 | - "UPDATE `##media_file` SET m_id = ? WHERE m_id = ? AND m_file = ?" |
|
188 | - )->execute([$new_xref, $old_xref, $WT_TREE->getTreeId()]); |
|
189 | - Database::prepare( |
|
190 | - "UPDATE `##individuals` JOIN `##link` ON (l_file = i_file AND l_to = ? AND l_type = 'OBJE') SET i_gedcom = REPLACE(i_gedcom, ?, ?) WHERE i_file = ?" |
|
191 | - )->execute([$old_xref, " OBJE @$old_xref@", " OBJE @$new_xref@", $WT_TREE->getTreeId()]); |
|
192 | - Database::prepare( |
|
193 | - "UPDATE `##families` JOIN `##link` ON (l_file = f_file AND l_to = ? AND l_type = 'OBJE') SET f_gedcom = REPLACE(f_gedcom, ?, ?) WHERE f_file = ?" |
|
194 | - )->execute([$old_xref, " OBJE @$old_xref@", " OBJE @$new_xref@", $WT_TREE->getTreeId()]); |
|
195 | - Database::prepare( |
|
196 | - "UPDATE `##media` JOIN `##link` ON (l_file = m_file AND l_to = ? AND l_type = 'OBJE') SET m_gedcom = REPLACE(m_gedcom, ?, ?) WHERE m_file = ?" |
|
197 | - )->execute([$old_xref, " OBJE @$old_xref@", " OBJE @$new_xref@", $WT_TREE->getTreeId()]); |
|
198 | - Database::prepare( |
|
199 | - "UPDATE `##sources` JOIN `##link` ON (l_file = s_file AND l_to = ? AND l_type = 'OBJE') SET s_gedcom = REPLACE(s_gedcom, ?, ?) WHERE s_file = ?" |
|
200 | - )->execute([$old_xref, " OBJE @$old_xref@", " OBJE @$new_xref@", $WT_TREE->getTreeId()]); |
|
201 | - Database::prepare( |
|
202 | - "UPDATE `##other` JOIN `##link` ON (l_file = o_file AND l_to = ? AND l_type = 'OBJE') SET o_gedcom = REPLACE(o_gedcom, ?, ?) WHERE o_file = ?" |
|
203 | - )->execute([$old_xref, " OBJE @$old_xref@", " OBJE @$new_xref@", $WT_TREE->getTreeId()]); |
|
204 | - break; |
|
205 | - default: |
|
206 | - Database::prepare( |
|
207 | - "UPDATE `##other` SET o_id = ?, o_gedcom = REPLACE(o_gedcom, ?, ?) WHERE o_id = ? AND o_file = ?" |
|
208 | - )->execute([$new_xref, "0 @$old_xref@ $type\n", "0 @$new_xref@ $type\n", $old_xref, $WT_TREE->getTreeId()]); |
|
209 | - Database::prepare( |
|
210 | - "UPDATE `##individuals` JOIN `##link` ON (l_file = i_file AND l_to = ?) SET i_gedcom = REPLACE(i_gedcom, ?, ?) WHERE i_file = ?" |
|
211 | - )->execute([$old_xref, " @$old_xref@", " @$new_xref@", $WT_TREE->getTreeId()]); |
|
212 | - Database::prepare( |
|
213 | - "UPDATE `##families` JOIN `##link` ON (l_file = f_file AND l_to = ?) SET f_gedcom = REPLACE(f_gedcom, ?, ?) WHERE f_file = ?" |
|
214 | - )->execute([$old_xref, " @$old_xref@", " @$new_xref@", $WT_TREE->getTreeId()]); |
|
215 | - Database::prepare( |
|
216 | - "UPDATE `##media` JOIN `##link` ON (l_file = m_file AND l_to = ?) SET m_gedcom = REPLACE(m_gedcom, ?, ?) WHERE m_file = ?" |
|
217 | - )->execute([$old_xref, " @$old_xref@", " @$new_xref@", $WT_TREE->getTreeId()]); |
|
218 | - Database::prepare( |
|
219 | - "UPDATE `##sources` JOIN `##link` ON (l_file = s_file AND l_to = ?) SET s_gedcom = REPLACE(s_gedcom, ?, ?) WHERE s_file = ?" |
|
220 | - )->execute([$old_xref, " @$old_xref@", " @$new_xref@", $WT_TREE->getTreeId()]); |
|
221 | - Database::prepare( |
|
222 | - "UPDATE `##other` JOIN `##link` ON (l_file = o_file AND l_to = ?) SET o_gedcom = REPLACE(o_gedcom, ?, ?) WHERE o_file = ?" |
|
223 | - )->execute([$old_xref, " @$old_xref@", " @$new_xref@", $WT_TREE->getTreeId()]); |
|
224 | - break; |
|
85 | + case 'INDI': |
|
86 | + Database::prepare( |
|
87 | + "UPDATE `##individuals` SET i_id = ?, i_gedcom = REPLACE(i_gedcom, ?, ?) WHERE i_id = ? AND i_file = ?" |
|
88 | + )->execute([$new_xref, "0 @$old_xref@ INDI\n", "0 @$new_xref@ INDI\n", $old_xref, $WT_TREE->getTreeId()]); |
|
89 | + Database::prepare( |
|
90 | + "UPDATE `##families` JOIN `##link` ON (l_file = f_file AND l_to = ? AND l_type = 'HUSB') SET f_gedcom = REPLACE(f_gedcom, ?, ?) WHERE f_file = ?" |
|
91 | + )->execute([$old_xref, " HUSB @$old_xref@", " HUSB @$new_xref@", $WT_TREE->getTreeId()]); |
|
92 | + Database::prepare( |
|
93 | + "UPDATE `##families` JOIN `##link` ON (l_file = f_file AND l_to = ? AND l_type = 'WIFE') SET f_gedcom = REPLACE(f_gedcom, ?, ?) WHERE f_file = ?" |
|
94 | + )->execute([$old_xref, " WIFE @$old_xref@", " WIFE @$new_xref@", $WT_TREE->getTreeId()]); |
|
95 | + Database::prepare( |
|
96 | + "UPDATE `##families` JOIN `##link` ON (l_file = f_file AND l_to = ? AND l_type = 'CHIL') SET f_gedcom = REPLACE(f_gedcom, ?, ?) WHERE f_file = ?" |
|
97 | + )->execute([$old_xref, " CHIL @$old_xref@", " CHIL @$new_xref@", $WT_TREE->getTreeId()]); |
|
98 | + Database::prepare( |
|
99 | + "UPDATE `##families` JOIN `##link` ON (l_file = f_file AND l_to = ? AND l_type = 'ASSO') SET f_gedcom = REPLACE(f_gedcom, ?, ?) WHERE f_file = ?" |
|
100 | + )->execute([$old_xref, " ASSO @$old_xref@", " ASSO @$new_xref@", $WT_TREE->getTreeId()]); |
|
101 | + Database::prepare( |
|
102 | + "UPDATE `##families` JOIN `##link` ON (l_file = f_file AND l_to = ? AND l_type = '_ASSO') SET f_gedcom = REPLACE(f_gedcom, ?, ?) WHERE f_file = ?" |
|
103 | + )->execute([$old_xref, " _ASSO @$old_xref@", " _ASSO @$new_xref@", $WT_TREE->getTreeId()]); |
|
104 | + Database::prepare( |
|
105 | + "UPDATE `##individuals` JOIN `##link` ON (l_file = i_file AND l_to = ? AND l_type = 'ASSO') SET i_gedcom = REPLACE(i_gedcom, ?, ?) WHERE i_file = ?" |
|
106 | + )->execute([$old_xref, " ASSO @$old_xref@", " ASSO @$new_xref@", $WT_TREE->getTreeId()]); |
|
107 | + Database::prepare( |
|
108 | + "UPDATE `##individuals` JOIN `##link` ON (l_file = i_file AND l_to = ? AND l_type = '_ASSO') SET i_gedcom = REPLACE(i_gedcom, ?, ?) WHERE i_file = ?" |
|
109 | + )->execute([$old_xref, " _ASSO @$old_xref@", " _ASSO @$new_xref@", $WT_TREE->getTreeId()]); |
|
110 | + Database::prepare( |
|
111 | + "UPDATE `##placelinks` SET pl_gid = ? WHERE pl_gid = ? AND pl_file = ?" |
|
112 | + )->execute([$new_xref, $old_xref, $WT_TREE->getTreeId()]); |
|
113 | + Database::prepare( |
|
114 | + "UPDATE `##dates` SET d_gid = ? WHERE d_gid = ? AND d_file = ?" |
|
115 | + )->execute([$new_xref, $old_xref, $WT_TREE->getTreeId()]); |
|
116 | + Database::prepare( |
|
117 | + "UPDATE `##user_gedcom_setting` SET setting_value = ? WHERE setting_value = ? AND gedcom_id = ? AND setting_name IN ('gedcomid', 'rootid')" |
|
118 | + )->execute([$new_xref, $old_xref, $WT_TREE->getTreeId()]); |
|
119 | + break; |
|
120 | + case 'FAM': |
|
121 | + Database::prepare( |
|
122 | + "UPDATE `##families` SET f_id = ?, f_gedcom = REPLACE(f_gedcom, ?, ?) WHERE f_id = ? AND f_file = ?" |
|
123 | + )->execute([$new_xref, "0 @$old_xref@ FAM\n", "0 @$new_xref@ FAM\n", $old_xref, $WT_TREE->getTreeId()]); |
|
124 | + Database::prepare( |
|
125 | + "UPDATE `##individuals` JOIN `##link` ON (l_file = i_file AND l_to = ? AND l_type = 'FAMC') SET i_gedcom = REPLACE(i_gedcom, ?, ?) WHERE i_file = ?" |
|
126 | + )->execute([$old_xref, " FAMC @$old_xref@", " FAMC @$new_xref@", $WT_TREE->getTreeId()]); |
|
127 | + Database::prepare( |
|
128 | + "UPDATE `##individuals` JOIN `##link` ON (l_file = i_file AND l_to = ? AND l_type = 'FAMS') SET i_gedcom = REPLACE(i_gedcom, ?, ?) WHERE i_file = ?" |
|
129 | + )->execute([$old_xref, " FAMS @$old_xref@", " FAMS @$new_xref@", $WT_TREE->getTreeId()]); |
|
130 | + Database::prepare( |
|
131 | + "UPDATE `##placelinks` SET pl_gid = ? WHERE pl_gid = ? AND pl_file = ?" |
|
132 | + )->execute([$new_xref, $old_xref, $WT_TREE->getTreeId()]); |
|
133 | + Database::prepare( |
|
134 | + "UPDATE `##dates` SET d_gid = ? WHERE d_gid = ? AND d_file = ?" |
|
135 | + )->execute([$new_xref, $old_xref, $WT_TREE->getTreeId()]); |
|
136 | + break; |
|
137 | + case 'SOUR': |
|
138 | + Database::prepare( |
|
139 | + "UPDATE `##sources` SET s_id = ?, s_gedcom = REPLACE(s_gedcom, ?, ?) WHERE s_id = ? AND s_file = ?" |
|
140 | + )->execute([$new_xref, "0 @$old_xref@ SOUR\n", "0 @$new_xref@ SOUR\n", $old_xref, $WT_TREE->getTreeId()]); |
|
141 | + Database::prepare( |
|
142 | + "UPDATE `##individuals` JOIN `##link` ON (l_file = i_file AND l_to = ? AND l_type = 'SOUR') SET i_gedcom = REPLACE(i_gedcom, ?, ?) WHERE i_file = ?" |
|
143 | + )->execute([$old_xref, " SOUR @$old_xref@", " SOUR @$new_xref@", $WT_TREE->getTreeId()]); |
|
144 | + Database::prepare( |
|
145 | + "UPDATE `##families` JOIN `##link` ON (l_file = f_file AND l_to = ? AND l_type = 'SOUR') SET f_gedcom = REPLACE(f_gedcom, ?, ?) WHERE f_file = ?" |
|
146 | + )->execute([$old_xref, " SOUR @$old_xref@", " SOUR @$new_xref@", $WT_TREE->getTreeId()]); |
|
147 | + Database::prepare( |
|
148 | + "UPDATE `##media` JOIN `##link` ON (l_file = m_file AND l_to = ? AND l_type = 'SOUR') SET m_gedcom = REPLACE(m_gedcom, ?, ?) WHERE m_file = ?" |
|
149 | + )->execute([$old_xref, " SOUR @$old_xref@", " SOUR @$new_xref@", $WT_TREE->getTreeId()]); |
|
150 | + Database::prepare( |
|
151 | + "UPDATE `##other` JOIN `##link` ON (l_file = o_file AND l_to = ? AND l_type = 'SOUR') SET o_gedcom = REPLACE(o_gedcom, ?, ?) WHERE o_file = ?" |
|
152 | + )->execute([$old_xref, " SOUR @$old_xref@", " SOUR @$new_xref@", $WT_TREE->getTreeId()]); |
|
153 | + break; |
|
154 | + case 'REPO': |
|
155 | + Database::prepare( |
|
156 | + "UPDATE `##other` SET o_id = ?, o_gedcom = REPLACE(o_gedcom, ?, ?) WHERE o_id = ? AND o_file = ?" |
|
157 | + )->execute([$new_xref, "0 @$old_xref@ REPO\n", "0 @$new_xref@ REPO\n", $old_xref, $WT_TREE->getTreeId()]); |
|
158 | + Database::prepare( |
|
159 | + "UPDATE `##sources` JOIN `##link` ON (l_file = s_file AND l_to = ? AND l_type = 'REPO') SET s_gedcom = REPLACE(s_gedcom, ?, ?) WHERE s_file = ?" |
|
160 | + )->execute([$old_xref, " REPO @$old_xref@", " REPO @$new_xref@", $WT_TREE->getTreeId()]); |
|
161 | + break; |
|
162 | + case 'NOTE': |
|
163 | + Database::prepare( |
|
164 | + "UPDATE `##other` SET o_id = ?, o_gedcom = REPLACE(REPLACE(o_gedcom, ?, ?), ?, ?) WHERE o_id = ? AND o_file = ?" |
|
165 | + )->execute([$new_xref, "0 @$old_xref@ NOTE\n", "0 @$new_xref@ NOTE\n", "0 @$old_xref@ NOTE ", "0 @$new_xref@ NOTE ", $old_xref, $WT_TREE->getTreeId()]); |
|
166 | + Database::prepare( |
|
167 | + "UPDATE `##individuals` JOIN `##link` ON (l_file = i_file AND l_to = ? AND l_type = 'NOTE') SET i_gedcom = REPLACE(i_gedcom, ?, ?) WHERE i_file = ?" |
|
168 | + )->execute([$old_xref, " NOTE @$old_xref@", " NOTE @$new_xref@", $WT_TREE->getTreeId()]); |
|
169 | + Database::prepare( |
|
170 | + "UPDATE `##families` JOIN `##link` ON (l_file = f_file AND l_to = ? AND l_type = 'NOTE') SET f_gedcom = REPLACE(f_gedcom, ?, ?) WHERE f_file = ?" |
|
171 | + )->execute([$old_xref, " NOTE @$old_xref@", " NOTE @$new_xref@", $WT_TREE->getTreeId()]); |
|
172 | + Database::prepare( |
|
173 | + "UPDATE `##media` JOIN `##link` ON (l_file = m_file AND l_to = ? AND l_type = 'NOTE') SET m_gedcom = REPLACE(m_gedcom, ?, ?) WHERE m_file = ?" |
|
174 | + )->execute([$old_xref, " NOTE @$old_xref@", " NOTE @$new_xref@", $WT_TREE->getTreeId()]); |
|
175 | + Database::prepare( |
|
176 | + "UPDATE `##sources` JOIN `##link` ON (l_file = s_file AND l_to = ? AND l_type = 'NOTE') SET s_gedcom = REPLACE(s_gedcom, ?, ?) WHERE s_file = ?" |
|
177 | + )->execute([$old_xref, " NOTE @$old_xref@", " NOTE @$new_xref@", $WT_TREE->getTreeId()]); |
|
178 | + Database::prepare( |
|
179 | + "UPDATE `##other` JOIN `##link` ON (l_file = o_file AND l_to = ? AND l_type = 'NOTE') SET o_gedcom = REPLACE(o_gedcom, ?, ?) WHERE o_file = ?" |
|
180 | + )->execute([$old_xref, " NOTE @$old_xref@", " NOTE @$new_xref@", $WT_TREE->getTreeId()]); |
|
181 | + break; |
|
182 | + case 'OBJE': |
|
183 | + Database::prepare( |
|
184 | + "UPDATE `##media` SET m_id = ?, m_gedcom = REPLACE(m_gedcom, ?, ?) WHERE m_id = ? AND m_file = ?" |
|
185 | + )->execute([$new_xref, "0 @$old_xref@ OBJE\n", "0 @$new_xref@ OBJE\n", $old_xref, $WT_TREE->getTreeId()]); |
|
186 | + Database::prepare( |
|
187 | + "UPDATE `##media_file` SET m_id = ? WHERE m_id = ? AND m_file = ?" |
|
188 | + )->execute([$new_xref, $old_xref, $WT_TREE->getTreeId()]); |
|
189 | + Database::prepare( |
|
190 | + "UPDATE `##individuals` JOIN `##link` ON (l_file = i_file AND l_to = ? AND l_type = 'OBJE') SET i_gedcom = REPLACE(i_gedcom, ?, ?) WHERE i_file = ?" |
|
191 | + )->execute([$old_xref, " OBJE @$old_xref@", " OBJE @$new_xref@", $WT_TREE->getTreeId()]); |
|
192 | + Database::prepare( |
|
193 | + "UPDATE `##families` JOIN `##link` ON (l_file = f_file AND l_to = ? AND l_type = 'OBJE') SET f_gedcom = REPLACE(f_gedcom, ?, ?) WHERE f_file = ?" |
|
194 | + )->execute([$old_xref, " OBJE @$old_xref@", " OBJE @$new_xref@", $WT_TREE->getTreeId()]); |
|
195 | + Database::prepare( |
|
196 | + "UPDATE `##media` JOIN `##link` ON (l_file = m_file AND l_to = ? AND l_type = 'OBJE') SET m_gedcom = REPLACE(m_gedcom, ?, ?) WHERE m_file = ?" |
|
197 | + )->execute([$old_xref, " OBJE @$old_xref@", " OBJE @$new_xref@", $WT_TREE->getTreeId()]); |
|
198 | + Database::prepare( |
|
199 | + "UPDATE `##sources` JOIN `##link` ON (l_file = s_file AND l_to = ? AND l_type = 'OBJE') SET s_gedcom = REPLACE(s_gedcom, ?, ?) WHERE s_file = ?" |
|
200 | + )->execute([$old_xref, " OBJE @$old_xref@", " OBJE @$new_xref@", $WT_TREE->getTreeId()]); |
|
201 | + Database::prepare( |
|
202 | + "UPDATE `##other` JOIN `##link` ON (l_file = o_file AND l_to = ? AND l_type = 'OBJE') SET o_gedcom = REPLACE(o_gedcom, ?, ?) WHERE o_file = ?" |
|
203 | + )->execute([$old_xref, " OBJE @$old_xref@", " OBJE @$new_xref@", $WT_TREE->getTreeId()]); |
|
204 | + break; |
|
205 | + default: |
|
206 | + Database::prepare( |
|
207 | + "UPDATE `##other` SET o_id = ?, o_gedcom = REPLACE(o_gedcom, ?, ?) WHERE o_id = ? AND o_file = ?" |
|
208 | + )->execute([$new_xref, "0 @$old_xref@ $type\n", "0 @$new_xref@ $type\n", $old_xref, $WT_TREE->getTreeId()]); |
|
209 | + Database::prepare( |
|
210 | + "UPDATE `##individuals` JOIN `##link` ON (l_file = i_file AND l_to = ?) SET i_gedcom = REPLACE(i_gedcom, ?, ?) WHERE i_file = ?" |
|
211 | + )->execute([$old_xref, " @$old_xref@", " @$new_xref@", $WT_TREE->getTreeId()]); |
|
212 | + Database::prepare( |
|
213 | + "UPDATE `##families` JOIN `##link` ON (l_file = f_file AND l_to = ?) SET f_gedcom = REPLACE(f_gedcom, ?, ?) WHERE f_file = ?" |
|
214 | + )->execute([$old_xref, " @$old_xref@", " @$new_xref@", $WT_TREE->getTreeId()]); |
|
215 | + Database::prepare( |
|
216 | + "UPDATE `##media` JOIN `##link` ON (l_file = m_file AND l_to = ?) SET m_gedcom = REPLACE(m_gedcom, ?, ?) WHERE m_file = ?" |
|
217 | + )->execute([$old_xref, " @$old_xref@", " @$new_xref@", $WT_TREE->getTreeId()]); |
|
218 | + Database::prepare( |
|
219 | + "UPDATE `##sources` JOIN `##link` ON (l_file = s_file AND l_to = ?) SET s_gedcom = REPLACE(s_gedcom, ?, ?) WHERE s_file = ?" |
|
220 | + )->execute([$old_xref, " @$old_xref@", " @$new_xref@", $WT_TREE->getTreeId()]); |
|
221 | + Database::prepare( |
|
222 | + "UPDATE `##other` JOIN `##link` ON (l_file = o_file AND l_to = ?) SET o_gedcom = REPLACE(o_gedcom, ?, ?) WHERE o_file = ?" |
|
223 | + )->execute([$old_xref, " @$old_xref@", " @$new_xref@", $WT_TREE->getTreeId()]); |
|
224 | + break; |
|
225 | 225 | } |
226 | 226 | Database::prepare( |
227 | 227 | "UPDATE `##name` SET n_id = ? WHERE n_id = ? AND n_file = ?" |
@@ -48,46 +48,46 @@ |
||
48 | 48 | // Respond to form action |
49 | 49 | if ($action !== '' && Filter::checkCsrf()) { |
50 | 50 | switch ($action) { |
51 | - case 'update': |
|
52 | - if ($username !== Auth::user()->getUserName() && User::findByUserName($username)) { |
|
53 | - FlashMessages::addMessage(I18N::translate('Duplicate username. A user with that username already exists. Please choose another username.')); |
|
54 | - } elseif ($email !== Auth::user()->getEmail() && User::findByEmail($email)) { |
|
55 | - FlashMessages::addMessage(I18N::translate('Duplicate email address. A user with that email already exists.')); |
|
56 | - } else { |
|
57 | - // Change username |
|
58 | - if ($username !== Auth::user()->getUserName()) { |
|
59 | - Log::addAuthenticationLog('User ' . Auth::user()->getUserName() . ' renamed to ' . $username); |
|
60 | - Auth::user()->setUserName($username); |
|
51 | + case 'update': |
|
52 | + if ($username !== Auth::user()->getUserName() && User::findByUserName($username)) { |
|
53 | + FlashMessages::addMessage(I18N::translate('Duplicate username. A user with that username already exists. Please choose another username.')); |
|
54 | + } elseif ($email !== Auth::user()->getEmail() && User::findByEmail($email)) { |
|
55 | + FlashMessages::addMessage(I18N::translate('Duplicate email address. A user with that email already exists.')); |
|
56 | + } else { |
|
57 | + // Change username |
|
58 | + if ($username !== Auth::user()->getUserName()) { |
|
59 | + Log::addAuthenticationLog('User ' . Auth::user()->getUserName() . ' renamed to ' . $username); |
|
60 | + Auth::user()->setUserName($username); |
|
61 | + } |
|
62 | + |
|
63 | + // Change password |
|
64 | + if ($password_1 !== '' && $password_1 === $password_2) { |
|
65 | + Auth::user()->setPassword($password_1); |
|
66 | + } |
|
67 | + |
|
68 | + // Change other settings |
|
69 | + Auth::user() |
|
70 | + ->setRealName($real_name) |
|
71 | + ->setEmail($email) |
|
72 | + ->setPreference('language', $language) |
|
73 | + ->setPreference('TIMEZONE', $time_zone) |
|
74 | + ->setPreference('contactmethod', $contact_method) |
|
75 | + ->setPreference('visibleonline', $visible_online ? '1' : '0'); |
|
76 | + |
|
77 | + Auth::user()->setPreference('theme', $theme); |
|
78 | + |
|
79 | + $WT_TREE->setUserPreference(Auth::user(), 'rootid', $root_id); |
|
61 | 80 | } |
62 | - |
|
63 | - // Change password |
|
64 | - if ($password_1 !== '' && $password_1 === $password_2) { |
|
65 | - Auth::user()->setPassword($password_1); |
|
81 | + break; |
|
82 | + |
|
83 | + case 'delete': |
|
84 | + // An administrator can only be deleted by another administrator |
|
85 | + if (!Auth::user()->getPreference('canadmin')) { |
|
86 | + $currentUser = Auth::user(); |
|
87 | + Auth::logout(); |
|
88 | + $currentUser->delete(); |
|
66 | 89 | } |
67 | - |
|
68 | - // Change other settings |
|
69 | - Auth::user() |
|
70 | - ->setRealName($real_name) |
|
71 | - ->setEmail($email) |
|
72 | - ->setPreference('language', $language) |
|
73 | - ->setPreference('TIMEZONE', $time_zone) |
|
74 | - ->setPreference('contactmethod', $contact_method) |
|
75 | - ->setPreference('visibleonline', $visible_online ? '1' : '0'); |
|
76 | - |
|
77 | - Auth::user()->setPreference('theme', $theme); |
|
78 | - |
|
79 | - $WT_TREE->setUserPreference(Auth::user(), 'rootid', $root_id); |
|
80 | - } |
|
81 | - break; |
|
82 | - |
|
83 | - case 'delete': |
|
84 | - // An administrator can only be deleted by another administrator |
|
85 | - if (!Auth::user()->getPreference('canadmin')) { |
|
86 | - $currentUser = Auth::user(); |
|
87 | - Auth::logout(); |
|
88 | - $currentUser->delete(); |
|
89 | - } |
|
90 | - break; |
|
90 | + break; |
|
91 | 91 | } |
92 | 92 | |
93 | 93 | header('Location: edituser.php'); |