@@ -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 = ?" |
@@ -118,18 +118,18 @@ discard block |
||
| 118 | 118 | foreach (Module::getInstalledModules('disabled') as $module) { |
| 119 | 119 | if (!in_array($module->getName(), Module::getCoreModuleNames())) { |
| 120 | 120 | switch ($modules_action) { |
| 121 | - case 'disable': |
|
| 122 | - Database::prepare( |
|
| 123 | - "UPDATE `##module` SET status = 'disabled' WHERE module_name = ?" |
|
| 124 | - )->execute([$module->getName()]); |
|
| 125 | - break; |
|
| 126 | - case 'ignore': |
|
| 127 | - echo '<br>', I18N::translate('Custom module'), ' — ', WT_MODULES_DIR, $module->getName(), ' — ', $module->getTitle(), $icon_success; |
|
| 128 | - break; |
|
| 129 | - default: |
|
| 130 | - echo '<br>', I18N::translate('Custom module'), ' — ', WT_MODULES_DIR, $module->getName(), ' — ', $module->getTitle(), $icon_failure; |
|
| 131 | - $custom_modules = true; |
|
| 132 | - break; |
|
| 121 | + case 'disable': |
|
| 122 | + Database::prepare( |
|
| 123 | + "UPDATE `##module` SET status = 'disabled' WHERE module_name = ?" |
|
| 124 | + )->execute([$module->getName()]); |
|
| 125 | + break; |
|
| 126 | + case 'ignore': |
|
| 127 | + echo '<br>', I18N::translate('Custom module'), ' — ', WT_MODULES_DIR, $module->getName(), ' — ', $module->getTitle(), $icon_success; |
|
| 128 | + break; |
|
| 129 | + default: |
|
| 130 | + echo '<br>', I18N::translate('Custom module'), ' — ', WT_MODULES_DIR, $module->getName(), ' — ', $module->getTitle(), $icon_failure; |
|
| 131 | + $custom_modules = true; |
|
| 132 | + break; |
|
| 133 | 133 | } |
| 134 | 134 | } |
| 135 | 135 | } |
@@ -158,40 +158,40 @@ discard block |
||
| 158 | 158 | $custom_themes = false; |
| 159 | 159 | foreach (Theme::themeNames() as $theme_id => $theme_name) { |
| 160 | 160 | switch ($theme_id) { |
| 161 | - case 'clouds': |
|
| 162 | - case 'colors': |
|
| 163 | - case 'fab': |
|
| 164 | - case 'minimal': |
|
| 165 | - case 'webtrees': |
|
| 166 | - case 'xenea': |
|
| 167 | - break; |
|
| 168 | - default: |
|
| 169 | - $theme_used = Database::prepare( |
|
| 170 | - "SELECT EXISTS (SELECT 1 FROM `##site_setting` WHERE setting_name='THEME_DIR' AND setting_value=?)" . |
|
| 171 | - " OR EXISTS (SELECT 1 FROM `##gedcom_setting` WHERE setting_name='THEME_DIR' AND setting_value=?)" . |
|
| 172 | - " OR EXISTS (SELECT 1 FROM `##user_setting` WHERE setting_name='theme' AND setting_value=?)" |
|
| 173 | - )->execute([$theme_id, $theme_id, $theme_id])->fetchOne(); |
|
| 174 | - if ($theme_used) { |
|
| 175 | - switch ($themes_action) { |
|
| 176 | - case 'disable': |
|
| 177 | - Database::prepare( |
|
| 178 | - "DELETE FROM `##site_setting` WHERE setting_name = 'THEME_DIR' AND setting_value = ?" |
|
| 179 | - )->execute([$theme_id]); |
|
| 180 | - Database::prepare( |
|
| 181 | - "DELETE FROM `##gedcom_setting` WHERE setting_name = 'THEME_DIR' AND setting_value = ?" |
|
| 182 | - )->execute([$theme_id]); |
|
| 183 | - Database::prepare( |
|
| 184 | - "DELETE FROM `##user_setting` WHERE setting_name = 'theme' AND setting_value = ?" |
|
| 185 | - )->execute([$theme_id]); |
|
| 186 | - break; |
|
| 187 | - case 'ignore': |
|
| 188 | - echo '<br>', I18N::translate('Custom theme'), ' — ', $theme_id, ' — ', $theme_name, $icon_success; |
|
| 189 | - break; |
|
| 190 | - default: |
|
| 191 | - echo '<br>', I18N::translate('Custom theme'), ' — ', $theme_id, ' — ', $theme_name, $icon_failure; |
|
| 192 | - $custom_themes = true; |
|
| 193 | - break; |
|
| 194 | - } |
|
| 161 | + case 'clouds': |
|
| 162 | + case 'colors': |
|
| 163 | + case 'fab': |
|
| 164 | + case 'minimal': |
|
| 165 | + case 'webtrees': |
|
| 166 | + case 'xenea': |
|
| 167 | + break; |
|
| 168 | + default: |
|
| 169 | + $theme_used = Database::prepare( |
|
| 170 | + "SELECT EXISTS (SELECT 1 FROM `##site_setting` WHERE setting_name='THEME_DIR' AND setting_value=?)" . |
|
| 171 | + " OR EXISTS (SELECT 1 FROM `##gedcom_setting` WHERE setting_name='THEME_DIR' AND setting_value=?)" . |
|
| 172 | + " OR EXISTS (SELECT 1 FROM `##user_setting` WHERE setting_name='theme' AND setting_value=?)" |
|
| 173 | + )->execute([$theme_id, $theme_id, $theme_id])->fetchOne(); |
|
| 174 | + if ($theme_used) { |
|
| 175 | + switch ($themes_action) { |
|
| 176 | + case 'disable': |
|
| 177 | + Database::prepare( |
|
| 178 | + "DELETE FROM `##site_setting` WHERE setting_name = 'THEME_DIR' AND setting_value = ?" |
|
| 179 | + )->execute([$theme_id]); |
|
| 180 | + Database::prepare( |
|
| 181 | + "DELETE FROM `##gedcom_setting` WHERE setting_name = 'THEME_DIR' AND setting_value = ?" |
|
| 182 | + )->execute([$theme_id]); |
|
| 183 | + Database::prepare( |
|
| 184 | + "DELETE FROM `##user_setting` WHERE setting_name = 'theme' AND setting_value = ?" |
|
| 185 | + )->execute([$theme_id]); |
|
| 186 | + break; |
|
| 187 | + case 'ignore': |
|
| 188 | + echo '<br>', I18N::translate('Custom theme'), ' — ', $theme_id, ' — ', $theme_name, $icon_success; |
|
| 189 | + break; |
|
| 190 | + default: |
|
| 191 | + echo '<br>', I18N::translate('Custom theme'), ' — ', $theme_id, ' — ', $theme_name, $icon_failure; |
|
| 192 | + $custom_themes = true; |
|
| 193 | + break; |
|
| 194 | + } |
|
| 195 | 195 | } |
| 196 | 196 | break; |
| 197 | 197 | } |
@@ -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'); |
@@ -88,104 +88,104 @@ discard block |
||
| 88 | 88 | //////////////////////////////////////////////////////////////////////////////// |
| 89 | 89 | |
| 90 | 90 | switch ($action) { |
| 91 | -case 'load_json': |
|
| 92 | - $search = Filter::get('search'); |
|
| 93 | - $search = $search['value']; |
|
| 94 | - $start = Filter::getInteger('start'); |
|
| 95 | - $length = Filter::getInteger('length'); |
|
| 96 | - |
|
| 97 | - switch ($files) { |
|
| 98 | - case 'local': |
|
| 99 | - // Filtered rows |
|
| 100 | - $SELECT1 = |
|
| 101 | - "SELECT SQL_CACHE SQL_CALC_FOUND_ROWS TRIM(LEADING :media_path_1 FROM multimedia_file_refn) AS media_path, m_id AS xref, descriptive_title, m_file AS gedcom_id, m_gedcom AS gedcom" . |
|
| 102 | - " FROM `##media`" . |
|
| 103 | - " JOIN `##media_file` USING (m_file, m_id)" . |
|
| 104 | - " JOIN `##gedcom_setting` ON (m_file = gedcom_id AND setting_name = 'MEDIA_DIRECTORY')" . |
|
| 105 | - " JOIN `##gedcom` USING (gedcom_id)" . |
|
| 106 | - " WHERE setting_value = :media_folder" . |
|
| 107 | - " AND multimedia_file_refn LIKE CONCAT(:media_path_2, '%')" . |
|
| 108 | - " AND (SUBSTRING_INDEX(multimedia_file_refn, '/', -1) LIKE CONCAT('%', :search_1, '%')" . |
|
| 109 | - " OR descriptive_title LIKE CONCAT('%', :search_2, '%'))" . |
|
| 110 | - " AND multimedia_file_refn NOT LIKE 'http://%'" . |
|
| 111 | - " AND multimedia_file_refn NOT LIKE 'https://%'"; |
|
| 112 | - $ARGS1 = [ |
|
| 113 | - 'media_path_1' => $media_path, |
|
| 114 | - 'media_folder' => $media_folder, |
|
| 115 | - 'media_path_2' => Database::escapeLike($media_path), |
|
| 116 | - 'search_1' => Database::escapeLike($search), |
|
| 117 | - 'search_2' => Database::escapeLike($search), |
|
| 118 | - ]; |
|
| 119 | - // Unfiltered rows |
|
| 120 | - $SELECT2 = |
|
| 121 | - "SELECT SQL_CACHE COUNT(*)" . |
|
| 122 | - " FROM `##media`" . |
|
| 123 | - " JOIN `##media_file` USING (m_file, m_id)" . |
|
| 124 | - " JOIN `##gedcom_setting` ON (m_file = gedcom_id AND setting_name = 'MEDIA_DIRECTORY')" . |
|
| 125 | - " WHERE setting_value = :media_folder" . |
|
| 126 | - " AND multimedia_file_refn LIKE CONCAT(:media_path_3, '%')" . |
|
| 127 | - " AND multimedia_file_refn NOT LIKE 'http://%'" . |
|
| 128 | - " AND multimedia_file_refn NOT LIKE 'https://%'"; |
|
| 129 | - $ARGS2 = [ |
|
| 130 | - 'media_folder' => $media_folder, |
|
| 131 | - 'media_path_3' => $media_path, |
|
| 132 | - ]; |
|
| 133 | - |
|
| 134 | - if ($subfolders == 'exclude') { |
|
| 135 | - $SELECT1 .= " AND multimedia_file_refn NOT LIKE CONCAT(:media_path_4, '%/%')"; |
|
| 136 | - $ARGS1['media_path_4'] = Database::escapeLike($media_path); |
|
| 137 | - $SELECT2 .= " AND multimedia_file_refn NOT LIKE CONCAT(:media_path_4, '%/%')"; |
|
| 138 | - $ARGS2['media_path_4'] = Database::escapeLike($media_path); |
|
| 139 | - } |
|
| 140 | - |
|
| 141 | - $order = Filter::getArray('order'); |
|
| 142 | - $SELECT1 .= " ORDER BY "; |
|
| 143 | - if ($order) { |
|
| 144 | - foreach ($order as $key => $value) { |
|
| 145 | - if ($key > 0) { |
|
| 146 | - $SELECT1 .= ','; |
|
| 91 | + case 'load_json': |
|
| 92 | + $search = Filter::get('search'); |
|
| 93 | + $search = $search['value']; |
|
| 94 | + $start = Filter::getInteger('start'); |
|
| 95 | + $length = Filter::getInteger('length'); |
|
| 96 | + |
|
| 97 | + switch ($files) { |
|
| 98 | + case 'local': |
|
| 99 | + // Filtered rows |
|
| 100 | + $SELECT1 = |
|
| 101 | + "SELECT SQL_CACHE SQL_CALC_FOUND_ROWS TRIM(LEADING :media_path_1 FROM multimedia_file_refn) AS media_path, m_id AS xref, descriptive_title, m_file AS gedcom_id, m_gedcom AS gedcom" . |
|
| 102 | + " FROM `##media`" . |
|
| 103 | + " JOIN `##media_file` USING (m_file, m_id)" . |
|
| 104 | + " JOIN `##gedcom_setting` ON (m_file = gedcom_id AND setting_name = 'MEDIA_DIRECTORY')" . |
|
| 105 | + " JOIN `##gedcom` USING (gedcom_id)" . |
|
| 106 | + " WHERE setting_value = :media_folder" . |
|
| 107 | + " AND multimedia_file_refn LIKE CONCAT(:media_path_2, '%')" . |
|
| 108 | + " AND (SUBSTRING_INDEX(multimedia_file_refn, '/', -1) LIKE CONCAT('%', :search_1, '%')" . |
|
| 109 | + " OR descriptive_title LIKE CONCAT('%', :search_2, '%'))" . |
|
| 110 | + " AND multimedia_file_refn NOT LIKE 'http://%'" . |
|
| 111 | + " AND multimedia_file_refn NOT LIKE 'https://%'"; |
|
| 112 | + $ARGS1 = [ |
|
| 113 | + 'media_path_1' => $media_path, |
|
| 114 | + 'media_folder' => $media_folder, |
|
| 115 | + 'media_path_2' => Database::escapeLike($media_path), |
|
| 116 | + 'search_1' => Database::escapeLike($search), |
|
| 117 | + 'search_2' => Database::escapeLike($search), |
|
| 118 | + ]; |
|
| 119 | + // Unfiltered rows |
|
| 120 | + $SELECT2 = |
|
| 121 | + "SELECT SQL_CACHE COUNT(*)" . |
|
| 122 | + " FROM `##media`" . |
|
| 123 | + " JOIN `##media_file` USING (m_file, m_id)" . |
|
| 124 | + " JOIN `##gedcom_setting` ON (m_file = gedcom_id AND setting_name = 'MEDIA_DIRECTORY')" . |
|
| 125 | + " WHERE setting_value = :media_folder" . |
|
| 126 | + " AND multimedia_file_refn LIKE CONCAT(:media_path_3, '%')" . |
|
| 127 | + " AND multimedia_file_refn NOT LIKE 'http://%'" . |
|
| 128 | + " AND multimedia_file_refn NOT LIKE 'https://%'"; |
|
| 129 | + $ARGS2 = [ |
|
| 130 | + 'media_folder' => $media_folder, |
|
| 131 | + 'media_path_3' => $media_path, |
|
| 132 | + ]; |
|
| 133 | + |
|
| 134 | + if ($subfolders == 'exclude') { |
|
| 135 | + $SELECT1 .= " AND multimedia_file_refn NOT LIKE CONCAT(:media_path_4, '%/%')"; |
|
| 136 | + $ARGS1['media_path_4'] = Database::escapeLike($media_path); |
|
| 137 | + $SELECT2 .= " AND multimedia_file_refn NOT LIKE CONCAT(:media_path_4, '%/%')"; |
|
| 138 | + $ARGS2['media_path_4'] = Database::escapeLike($media_path); |
|
| 147 | 139 | } |
| 148 | - // Datatables numbers columns 0, 1, 2 |
|
| 149 | - // MySQL numbers columns 1, 2, 3 |
|
| 150 | - switch ($value['dir']) { |
|
| 151 | - case 'asc': |
|
| 152 | - $SELECT1 .= ":col_" . $key . " ASC"; |
|
| 153 | - break; |
|
| 154 | - case 'desc': |
|
| 155 | - $SELECT1 .= ":col_" . $key . " DESC"; |
|
| 156 | - break; |
|
| 140 | + |
|
| 141 | + $order = Filter::getArray('order'); |
|
| 142 | + $SELECT1 .= " ORDER BY "; |
|
| 143 | + if ($order) { |
|
| 144 | + foreach ($order as $key => $value) { |
|
| 145 | + if ($key > 0) { |
|
| 146 | + $SELECT1 .= ','; |
|
| 147 | + } |
|
| 148 | + // Datatables numbers columns 0, 1, 2 |
|
| 149 | + // MySQL numbers columns 1, 2, 3 |
|
| 150 | + switch ($value['dir']) { |
|
| 151 | + case 'asc': |
|
| 152 | + $SELECT1 .= ":col_" . $key . " ASC"; |
|
| 153 | + break; |
|
| 154 | + case 'desc': |
|
| 155 | + $SELECT1 .= ":col_" . $key . " DESC"; |
|
| 156 | + break; |
|
| 157 | + } |
|
| 158 | + $ARGS1['col_' . $key] = 1 + $value['column']; |
|
| 157 | 159 | } |
| 158 | - $ARGS1['col_' . $key] = 1 + $value['column']; |
|
| 160 | + } else { |
|
| 161 | + $SELECT1 = " 1 ASC"; |
|
| 159 | 162 | } |
| 160 | - } else { |
|
| 161 | - $SELECT1 = " 1 ASC"; |
|
| 162 | - } |
|
| 163 | 163 | |
| 164 | - if ($length > 0) { |
|
| 165 | - $SELECT1 .= " LIMIT :length OFFSET :start"; |
|
| 166 | - $ARGS1['length'] = $length; |
|
| 167 | - $ARGS1['start'] = $start; |
|
| 168 | - } |
|
| 169 | - |
|
| 170 | - $rows = Database::prepare($SELECT1)->execute($ARGS1)->fetchAll(); |
|
| 171 | - // Total filtered/unfiltered rows |
|
| 172 | - $recordsFiltered = Database::prepare("SELECT FOUND_ROWS()")->fetchOne(); |
|
| 173 | - $recordsTotal = Database::prepare($SELECT2)->execute($ARGS2)->fetchOne(); |
|
| 164 | + if ($length > 0) { |
|
| 165 | + $SELECT1 .= " LIMIT :length OFFSET :start"; |
|
| 166 | + $ARGS1['length'] = $length; |
|
| 167 | + $ARGS1['start'] = $start; |
|
| 168 | + } |
|
| 174 | 169 | |
| 175 | - $data = []; |
|
| 176 | - foreach ($rows as $row) { |
|
| 177 | - $media = Media::getInstance($row->xref, Tree::findById($row->gedcom_id), $row->gedcom); |
|
| 178 | - $media_files = $media->mediaFiles(); |
|
| 179 | - $media_files = array_map(function(MediaFile $media_file) { |
|
| 180 | - return $media_file->displayImage(150, 150, '', []); |
|
| 181 | - }, $media_files); |
|
| 182 | - $data[] = [ |
|
| 183 | - mediaFileInfo($media_folder, $media_path, $row->media_path), |
|
| 184 | - implode('', $media_files), |
|
| 185 | - mediaObjectInfo($media), |
|
| 186 | - ]; |
|
| 187 | - } |
|
| 188 | - break; |
|
| 170 | + $rows = Database::prepare($SELECT1)->execute($ARGS1)->fetchAll(); |
|
| 171 | + // Total filtered/unfiltered rows |
|
| 172 | + $recordsFiltered = Database::prepare("SELECT FOUND_ROWS()")->fetchOne(); |
|
| 173 | + $recordsTotal = Database::prepare($SELECT2)->execute($ARGS2)->fetchOne(); |
|
| 174 | + |
|
| 175 | + $data = []; |
|
| 176 | + foreach ($rows as $row) { |
|
| 177 | + $media = Media::getInstance($row->xref, Tree::findById($row->gedcom_id), $row->gedcom); |
|
| 178 | + $media_files = $media->mediaFiles(); |
|
| 179 | + $media_files = array_map(function(MediaFile $media_file) { |
|
| 180 | + return $media_file->displayImage(150, 150, '', []); |
|
| 181 | + }, $media_files); |
|
| 182 | + $data[] = [ |
|
| 183 | + mediaFileInfo($media_folder, $media_path, $row->media_path), |
|
| 184 | + implode('', $media_files), |
|
| 185 | + mediaObjectInfo($media), |
|
| 186 | + ]; |
|
| 187 | + } |
|
| 188 | + break; |
|
| 189 | 189 | |
| 190 | 190 | case 'external': |
| 191 | 191 | // Filtered rows |
@@ -216,12 +216,12 @@ discard block |
||
| 216 | 216 | // Datatables numbers columns 0, 1, 2 |
| 217 | 217 | // MySQL numbers columns 1, 2, 3 |
| 218 | 218 | switch ($value['dir']) { |
| 219 | - case 'asc': |
|
| 220 | - $SELECT1 .= ":col_" . $key . " ASC"; |
|
| 221 | - break; |
|
| 222 | - case 'desc': |
|
| 223 | - $SELECT1 .= ":col_" . $key . " DESC"; |
|
| 224 | - break; |
|
| 219 | + case 'asc': |
|
| 220 | + $SELECT1 .= ":col_" . $key . " ASC"; |
|
| 221 | + break; |
|
| 222 | + case 'desc': |
|
| 223 | + $SELECT1 .= ":col_" . $key . " DESC"; |
|
| 224 | + break; |
|
| 225 | 225 | } |
| 226 | 226 | $ARGS1['col_' . $key] = 1 + $value['column']; |
| 227 | 227 | } |