@@ -29,259 +29,259 @@ |
||
| 29 | 29 | |
| 30 | 30 | $controller = new PageController; |
| 31 | 31 | $controller |
| 32 | - ->restrictAccess(Auth::isManager($WT_TREE)) |
|
| 33 | - ->setPageTitle(I18N::translate(/* I18N: Renumber the records in a family tree */ 'Renumber family tree') . ' — ' . $WT_TREE->getTitleHtml()) |
|
| 34 | - ->pageHeader(); |
|
| 32 | + ->restrictAccess(Auth::isManager($WT_TREE)) |
|
| 33 | + ->setPageTitle(I18N::translate(/* I18N: Renumber the records in a family tree */ 'Renumber family tree') . ' — ' . $WT_TREE->getTitleHtml()) |
|
| 34 | + ->pageHeader(); |
|
| 35 | 35 | |
| 36 | 36 | // Every XREF used by this tree and also used by some other tree |
| 37 | 37 | $xrefs = Database::prepare( |
| 38 | - "SELECT xref, type FROM (" . |
|
| 39 | - " SELECT i_id AS xref, 'INDI' AS type FROM `##individuals` WHERE i_file = ?" . |
|
| 40 | - " UNION " . |
|
| 41 | - " SELECT f_id AS xref, 'FAM' AS type FROM `##families` WHERE f_file = ?" . |
|
| 42 | - " UNION " . |
|
| 43 | - " SELECT s_id AS xref, 'SOUR' AS type FROM `##sources` WHERE s_file = ?" . |
|
| 44 | - " UNION " . |
|
| 45 | - " SELECT m_id AS xref, 'OBJE' AS type FROM `##media` WHERE m_file = ?" . |
|
| 46 | - " UNION " . |
|
| 47 | - " SELECT o_id AS xref, o_type AS type FROM `##other` WHERE o_file = ? AND o_type NOT IN ('HEAD', 'TRLR')" . |
|
| 48 | - ") AS this_tree JOIN (" . |
|
| 49 | - " SELECT xref FROM `##change` WHERE gedcom_id <> ?" . |
|
| 50 | - " UNION " . |
|
| 51 | - " SELECT i_id AS xref FROM `##individuals` WHERE i_file <> ?" . |
|
| 52 | - " UNION " . |
|
| 53 | - " SELECT f_id AS xref FROM `##families` WHERE f_file <> ?" . |
|
| 54 | - " UNION " . |
|
| 55 | - " SELECT s_id AS xref FROM `##sources` WHERE s_file <> ?" . |
|
| 56 | - " UNION " . |
|
| 57 | - " SELECT m_id AS xref FROM `##media` WHERE m_file <> ?" . |
|
| 58 | - " UNION " . |
|
| 59 | - " SELECT o_id AS xref FROM `##other` WHERE o_file <> ? AND o_type NOT IN ('HEAD', 'TRLR')" . |
|
| 60 | - ") AS other_trees USING (xref)" |
|
| 38 | + "SELECT xref, type FROM (" . |
|
| 39 | + " SELECT i_id AS xref, 'INDI' AS type FROM `##individuals` WHERE i_file = ?" . |
|
| 40 | + " UNION " . |
|
| 41 | + " SELECT f_id AS xref, 'FAM' AS type FROM `##families` WHERE f_file = ?" . |
|
| 42 | + " UNION " . |
|
| 43 | + " SELECT s_id AS xref, 'SOUR' AS type FROM `##sources` WHERE s_file = ?" . |
|
| 44 | + " UNION " . |
|
| 45 | + " SELECT m_id AS xref, 'OBJE' AS type FROM `##media` WHERE m_file = ?" . |
|
| 46 | + " UNION " . |
|
| 47 | + " SELECT o_id AS xref, o_type AS type FROM `##other` WHERE o_file = ? AND o_type NOT IN ('HEAD', 'TRLR')" . |
|
| 48 | + ") AS this_tree JOIN (" . |
|
| 49 | + " SELECT xref FROM `##change` WHERE gedcom_id <> ?" . |
|
| 50 | + " UNION " . |
|
| 51 | + " SELECT i_id AS xref FROM `##individuals` WHERE i_file <> ?" . |
|
| 52 | + " UNION " . |
|
| 53 | + " SELECT f_id AS xref FROM `##families` WHERE f_file <> ?" . |
|
| 54 | + " UNION " . |
|
| 55 | + " SELECT s_id AS xref FROM `##sources` WHERE s_file <> ?" . |
|
| 56 | + " UNION " . |
|
| 57 | + " SELECT m_id AS xref FROM `##media` WHERE m_file <> ?" . |
|
| 58 | + " UNION " . |
|
| 59 | + " SELECT o_id AS xref FROM `##other` WHERE o_file <> ? AND o_type NOT IN ('HEAD', 'TRLR')" . |
|
| 60 | + ") AS other_trees USING (xref)" |
|
| 61 | 61 | )->execute(array( |
| 62 | - $WT_TREE->getTreeId(), $WT_TREE->getTreeId(), $WT_TREE->getTreeId(), $WT_TREE->getTreeId(), $WT_TREE->getTreeId(), |
|
| 63 | - $WT_TREE->getTreeId(), $WT_TREE->getTreeId(), $WT_TREE->getTreeId(), $WT_TREE->getTreeId(), $WT_TREE->getTreeId(), $WT_TREE->getTreeId(), |
|
| 62 | + $WT_TREE->getTreeId(), $WT_TREE->getTreeId(), $WT_TREE->getTreeId(), $WT_TREE->getTreeId(), $WT_TREE->getTreeId(), |
|
| 63 | + $WT_TREE->getTreeId(), $WT_TREE->getTreeId(), $WT_TREE->getTreeId(), $WT_TREE->getTreeId(), $WT_TREE->getTreeId(), $WT_TREE->getTreeId(), |
|
| 64 | 64 | ))->fetchAssoc(); |
| 65 | 65 | |
| 66 | 66 | echo '<h1>', $controller->getPageTitle(), '</h1>'; |
| 67 | 67 | |
| 68 | 68 | if (Filter::get('action') === 'renumber') { |
| 69 | - foreach ($xrefs as $old_xref => $type) { |
|
| 70 | - Database::beginTransaction(); |
|
| 71 | - Database::exec( |
|
| 72 | - "LOCK TABLE `##individuals` WRITE," . |
|
| 73 | - " `##families` WRITE," . |
|
| 74 | - " `##sources` WRITE," . |
|
| 75 | - " `##media` WRITE," . |
|
| 76 | - " `##other` WRITE," . |
|
| 77 | - " `##name` WRITE," . |
|
| 78 | - " `##placelinks` WRITE," . |
|
| 79 | - " `##change` WRITE," . |
|
| 80 | - " `##next_id` WRITE," . |
|
| 81 | - " `##dates` WRITE," . |
|
| 82 | - " `##default_resn` WRITE," . |
|
| 83 | - " `##hit_counter` WRITE," . |
|
| 84 | - " `##link` WRITE," . |
|
| 85 | - " `##user_gedcom_setting` WRITE" |
|
| 86 | - ); |
|
| 87 | - $new_xref = $WT_TREE->getNewXref($type); |
|
| 88 | - switch ($type) { |
|
| 89 | - case 'INDI': |
|
| 90 | - Database::prepare( |
|
| 91 | - "UPDATE `##individuals` SET i_id = ?, i_gedcom = REPLACE(i_gedcom, ?, ?) WHERE i_id = ? AND i_file = ?" |
|
| 92 | - )->execute(array($new_xref, "0 @$old_xref@ INDI\n", "0 @$new_xref@ INDI\n", $old_xref, $WT_TREE->getTreeId())); |
|
| 93 | - Database::prepare( |
|
| 94 | - "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 = ?" |
|
| 95 | - )->execute(array($old_xref, " HUSB @$old_xref@", " HUSB @$new_xref@", $WT_TREE->getTreeId())); |
|
| 96 | - Database::prepare( |
|
| 97 | - "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 = ?" |
|
| 98 | - )->execute(array($old_xref, " WIFE @$old_xref@", " WIFE @$new_xref@", $WT_TREE->getTreeId())); |
|
| 99 | - Database::prepare( |
|
| 100 | - "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 = ?" |
|
| 101 | - )->execute(array($old_xref, " CHIL @$old_xref@", " CHIL @$new_xref@", $WT_TREE->getTreeId())); |
|
| 102 | - Database::prepare( |
|
| 103 | - "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 = ?" |
|
| 104 | - )->execute(array($old_xref, " ASSO @$old_xref@", " ASSO @$new_xref@", $WT_TREE->getTreeId())); |
|
| 105 | - Database::prepare( |
|
| 106 | - "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 = ?" |
|
| 107 | - )->execute(array($old_xref, " _ASSO @$old_xref@", " _ASSO @$new_xref@", $WT_TREE->getTreeId())); |
|
| 108 | - Database::prepare( |
|
| 109 | - "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 = ?" |
|
| 110 | - )->execute(array($old_xref, " ASSO @$old_xref@", " ASSO @$new_xref@", $WT_TREE->getTreeId())); |
|
| 111 | - Database::prepare( |
|
| 112 | - "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 = ?" |
|
| 113 | - )->execute(array($old_xref, " _ASSO @$old_xref@", " _ASSO @$new_xref@", $WT_TREE->getTreeId())); |
|
| 114 | - Database::prepare( |
|
| 115 | - "UPDATE `##placelinks` SET pl_gid = ? WHERE pl_gid = ? AND pl_file = ?" |
|
| 116 | - )->execute(array($new_xref, $old_xref, $WT_TREE->getTreeId())); |
|
| 117 | - Database::prepare( |
|
| 118 | - "UPDATE `##dates` SET d_gid = ? WHERE d_gid = ? AND d_file = ?" |
|
| 119 | - )->execute(array($new_xref, $old_xref, $WT_TREE->getTreeId())); |
|
| 120 | - Database::prepare( |
|
| 121 | - "UPDATE `##user_gedcom_setting` SET setting_value = ? WHERE setting_value = ? AND gedcom_id = ? AND setting_name IN ('gedcomid', 'rootid')" |
|
| 122 | - )->execute(array($new_xref, $old_xref, $WT_TREE->getTreeId())); |
|
| 123 | - break; |
|
| 124 | - case 'FAM': |
|
| 125 | - Database::prepare( |
|
| 126 | - "UPDATE `##families` SET f_id = ?, f_gedcom = REPLACE(f_gedcom, ?, ?) WHERE f_id = ? AND f_file = ?" |
|
| 127 | - )->execute(array($new_xref, "0 @$old_xref@ FAM\n", "0 @$new_xref@ FAM\n", $old_xref, $WT_TREE->getTreeId())); |
|
| 128 | - Database::prepare( |
|
| 129 | - "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 = ?" |
|
| 130 | - )->execute(array($old_xref, " FAMC @$old_xref@", " FAMC @$new_xref@", $WT_TREE->getTreeId())); |
|
| 131 | - Database::prepare( |
|
| 132 | - "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 = ?" |
|
| 133 | - )->execute(array($old_xref, " FAMS @$old_xref@", " FAMS @$new_xref@", $WT_TREE->getTreeId())); |
|
| 134 | - Database::prepare( |
|
| 135 | - "UPDATE `##placelinks` SET pl_gid = ? WHERE pl_gid = ? AND pl_file = ?" |
|
| 136 | - )->execute(array($new_xref, $old_xref, $WT_TREE->getTreeId())); |
|
| 137 | - Database::prepare( |
|
| 138 | - "UPDATE `##dates` SET d_gid = ? WHERE d_gid = ? AND d_file = ?" |
|
| 139 | - )->execute(array($new_xref, $old_xref, $WT_TREE->getTreeId())); |
|
| 140 | - break; |
|
| 141 | - case 'SOUR': |
|
| 142 | - Database::prepare( |
|
| 143 | - "UPDATE `##sources` SET s_id = ?, s_gedcom = REPLACE(s_gedcom, ?, ?) WHERE s_id = ? AND s_file = ?" |
|
| 144 | - )->execute(array($new_xref, "0 @$old_xref@ SOUR\n", "0 @$new_xref@ SOUR\n", $old_xref, $WT_TREE->getTreeId())); |
|
| 145 | - Database::prepare( |
|
| 146 | - "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 = ?" |
|
| 147 | - )->execute(array($old_xref, " SOUR @$old_xref@", " SOUR @$new_xref@", $WT_TREE->getTreeId())); |
|
| 148 | - Database::prepare( |
|
| 149 | - "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 = ?" |
|
| 150 | - )->execute(array($old_xref, " SOUR @$old_xref@", " SOUR @$new_xref@", $WT_TREE->getTreeId())); |
|
| 151 | - Database::prepare( |
|
| 152 | - "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 = ?" |
|
| 153 | - )->execute(array($old_xref, " SOUR @$old_xref@", " SOUR @$new_xref@", $WT_TREE->getTreeId())); |
|
| 154 | - Database::prepare( |
|
| 155 | - "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 = ?" |
|
| 156 | - )->execute(array($old_xref, " SOUR @$old_xref@", " SOUR @$new_xref@", $WT_TREE->getTreeId())); |
|
| 157 | - break; |
|
| 158 | - case 'REPO': |
|
| 159 | - Database::prepare( |
|
| 160 | - "UPDATE `##other` SET o_id = ?, o_gedcom = REPLACE(o_gedcom, ?, ?) WHERE o_id = ? AND o_file = ?" |
|
| 161 | - )->execute(array($new_xref, "0 @$old_xref@ REPO\n", "0 @$new_xref@ REPO\n", $old_xref, $WT_TREE->getTreeId())); |
|
| 162 | - Database::prepare( |
|
| 163 | - "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 = ?" |
|
| 164 | - )->execute(array($old_xref, " REPO @$old_xref@", " REPO @$new_xref@", $WT_TREE->getTreeId())); |
|
| 165 | - break; |
|
| 166 | - case 'NOTE': |
|
| 167 | - Database::prepare( |
|
| 168 | - "UPDATE `##other` SET o_id = ?, o_gedcom = REPLACE(REPLACE(o_gedcom, ?, ?), ?, ?) WHERE o_id = ? AND o_file = ?" |
|
| 169 | - )->execute(array($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())); |
|
| 170 | - Database::prepare( |
|
| 171 | - "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 = ?" |
|
| 172 | - )->execute(array($old_xref, " NOTE @$old_xref@", " NOTE @$new_xref@", $WT_TREE->getTreeId())); |
|
| 173 | - Database::prepare( |
|
| 174 | - "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 = ?" |
|
| 175 | - )->execute(array($old_xref, " NOTE @$old_xref@", " NOTE @$new_xref@", $WT_TREE->getTreeId())); |
|
| 176 | - Database::prepare( |
|
| 177 | - "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 = ?" |
|
| 178 | - )->execute(array($old_xref, " NOTE @$old_xref@", " NOTE @$new_xref@", $WT_TREE->getTreeId())); |
|
| 179 | - Database::prepare( |
|
| 180 | - "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 = ?" |
|
| 181 | - )->execute(array($old_xref, " NOTE @$old_xref@", " NOTE @$new_xref@", $WT_TREE->getTreeId())); |
|
| 182 | - Database::prepare( |
|
| 183 | - "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 = ?" |
|
| 184 | - )->execute(array($old_xref, " NOTE @$old_xref@", " NOTE @$new_xref@", $WT_TREE->getTreeId())); |
|
| 185 | - break; |
|
| 186 | - case 'OBJE': |
|
| 187 | - Database::prepare( |
|
| 188 | - "UPDATE `##media` SET m_id = ?, m_gedcom = REPLACE(m_gedcom, ?, ?) WHERE m_id = ? AND m_file = ?" |
|
| 189 | - )->execute(array($new_xref, "0 @$old_xref@ OBJE\n", "0 @$new_xref@ OBJE\n", $old_xref, $WT_TREE->getTreeId())); |
|
| 190 | - Database::prepare( |
|
| 191 | - "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 = ?" |
|
| 192 | - )->execute(array($old_xref, " OBJE @$old_xref@", " OBJE @$new_xref@", $WT_TREE->getTreeId())); |
|
| 193 | - Database::prepare( |
|
| 194 | - "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 = ?" |
|
| 195 | - )->execute(array($old_xref, " OBJE @$old_xref@", " OBJE @$new_xref@", $WT_TREE->getTreeId())); |
|
| 196 | - Database::prepare( |
|
| 197 | - "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 = ?" |
|
| 198 | - )->execute(array($old_xref, " OBJE @$old_xref@", " OBJE @$new_xref@", $WT_TREE->getTreeId())); |
|
| 199 | - Database::prepare( |
|
| 200 | - "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 = ?" |
|
| 201 | - )->execute(array($old_xref, " OBJE @$old_xref@", " OBJE @$new_xref@", $WT_TREE->getTreeId())); |
|
| 202 | - Database::prepare( |
|
| 203 | - "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 = ?" |
|
| 204 | - )->execute(array($old_xref, " OBJE @$old_xref@", " OBJE @$new_xref@", $WT_TREE->getTreeId())); |
|
| 205 | - break; |
|
| 206 | - default: |
|
| 207 | - Database::prepare( |
|
| 208 | - "UPDATE `##other` SET o_id = ?, o_gedcom = REPLACE(o_gedcom, ?, ?) WHERE o_id = ? AND o_file = ?" |
|
| 209 | - )->execute(array($new_xref, "0 @$old_xref@ $type\n", "0 @$new_xref@ $type\n", $old_xref, $WT_TREE->getTreeId())); |
|
| 210 | - Database::prepare( |
|
| 211 | - "UPDATE `##individuals` JOIN `##link` ON (l_file = i_file AND l_to = ?) SET i_gedcom = REPLACE(i_gedcom, ?, ?) WHERE i_file = ?" |
|
| 212 | - )->execute(array($old_xref, " @$old_xref@", " @$new_xref@", $WT_TREE->getTreeId())); |
|
| 213 | - Database::prepare( |
|
| 214 | - "UPDATE `##families` JOIN `##link` ON (l_file = f_file AND l_to = ?) SET f_gedcom = REPLACE(f_gedcom, ?, ?) WHERE f_file = ?" |
|
| 215 | - )->execute(array($old_xref, " @$old_xref@", " @$new_xref@", $WT_TREE->getTreeId())); |
|
| 216 | - Database::prepare( |
|
| 217 | - "UPDATE `##media` JOIN `##link` ON (l_file = m_file AND l_to = ?) SET m_gedcom = REPLACE(m_gedcom, ?, ?) WHERE m_file = ?" |
|
| 218 | - )->execute(array($old_xref, " @$old_xref@", " @$new_xref@", $WT_TREE->getTreeId())); |
|
| 219 | - Database::prepare( |
|
| 220 | - "UPDATE `##sources` JOIN `##link` ON (l_file = s_file AND l_to = ?) SET s_gedcom = REPLACE(s_gedcom, ?, ?) WHERE s_file = ?" |
|
| 221 | - )->execute(array($old_xref, " @$old_xref@", " @$new_xref@", $WT_TREE->getTreeId())); |
|
| 222 | - Database::prepare( |
|
| 223 | - "UPDATE `##other` JOIN `##link` ON (l_file = o_file AND l_to = ?) SET o_gedcom = REPLACE(o_gedcom, ?, ?) WHERE o_file = ?" |
|
| 224 | - )->execute(array($old_xref, " @$old_xref@", " @$new_xref@", $WT_TREE->getTreeId())); |
|
| 225 | - break; |
|
| 226 | - } |
|
| 227 | - Database::prepare( |
|
| 228 | - "UPDATE `##name` SET n_id = ? WHERE n_id = ? AND n_file = ?" |
|
| 229 | - )->execute(array($new_xref, $old_xref, $WT_TREE->getTreeId())); |
|
| 230 | - Database::prepare( |
|
| 231 | - "UPDATE `##default_resn` SET xref = ? WHERE xref = ? AND gedcom_id = ?" |
|
| 232 | - )->execute(array($new_xref, $old_xref, $WT_TREE->getTreeId())); |
|
| 233 | - Database::prepare( |
|
| 234 | - "UPDATE `##hit_counter` SET page_parameter = ? WHERE page_parameter = ? AND gedcom_id = ?" |
|
| 235 | - )->execute(array($new_xref, $old_xref, $WT_TREE->getTreeId())); |
|
| 236 | - Database::prepare( |
|
| 237 | - "UPDATE `##link` SET l_from = ? WHERE l_from = ? AND l_file = ?" |
|
| 238 | - )->execute(array($new_xref, $old_xref, $WT_TREE->getTreeId())); |
|
| 239 | - Database::prepare( |
|
| 240 | - "UPDATE `##link` SET l_to = ? WHERE l_to = ? AND l_file = ?" |
|
| 241 | - )->execute(array($new_xref, $old_xref, $WT_TREE->getTreeId())); |
|
| 242 | - echo '<p>', I18N::translate('The record %1$s has been renamed to %2$s.', $old_xref, $new_xref), '</p>'; |
|
| 243 | - unset($xrefs[$old_xref]); |
|
| 244 | - Database::exec("UNLOCK TABLES"); |
|
| 245 | - Database::commit(); |
|
| 69 | + foreach ($xrefs as $old_xref => $type) { |
|
| 70 | + Database::beginTransaction(); |
|
| 71 | + Database::exec( |
|
| 72 | + "LOCK TABLE `##individuals` WRITE," . |
|
| 73 | + " `##families` WRITE," . |
|
| 74 | + " `##sources` WRITE," . |
|
| 75 | + " `##media` WRITE," . |
|
| 76 | + " `##other` WRITE," . |
|
| 77 | + " `##name` WRITE," . |
|
| 78 | + " `##placelinks` WRITE," . |
|
| 79 | + " `##change` WRITE," . |
|
| 80 | + " `##next_id` WRITE," . |
|
| 81 | + " `##dates` WRITE," . |
|
| 82 | + " `##default_resn` WRITE," . |
|
| 83 | + " `##hit_counter` WRITE," . |
|
| 84 | + " `##link` WRITE," . |
|
| 85 | + " `##user_gedcom_setting` WRITE" |
|
| 86 | + ); |
|
| 87 | + $new_xref = $WT_TREE->getNewXref($type); |
|
| 88 | + switch ($type) { |
|
| 89 | + case 'INDI': |
|
| 90 | + Database::prepare( |
|
| 91 | + "UPDATE `##individuals` SET i_id = ?, i_gedcom = REPLACE(i_gedcom, ?, ?) WHERE i_id = ? AND i_file = ?" |
|
| 92 | + )->execute(array($new_xref, "0 @$old_xref@ INDI\n", "0 @$new_xref@ INDI\n", $old_xref, $WT_TREE->getTreeId())); |
|
| 93 | + Database::prepare( |
|
| 94 | + "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 = ?" |
|
| 95 | + )->execute(array($old_xref, " HUSB @$old_xref@", " HUSB @$new_xref@", $WT_TREE->getTreeId())); |
|
| 96 | + Database::prepare( |
|
| 97 | + "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 = ?" |
|
| 98 | + )->execute(array($old_xref, " WIFE @$old_xref@", " WIFE @$new_xref@", $WT_TREE->getTreeId())); |
|
| 99 | + Database::prepare( |
|
| 100 | + "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 = ?" |
|
| 101 | + )->execute(array($old_xref, " CHIL @$old_xref@", " CHIL @$new_xref@", $WT_TREE->getTreeId())); |
|
| 102 | + Database::prepare( |
|
| 103 | + "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 = ?" |
|
| 104 | + )->execute(array($old_xref, " ASSO @$old_xref@", " ASSO @$new_xref@", $WT_TREE->getTreeId())); |
|
| 105 | + Database::prepare( |
|
| 106 | + "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 = ?" |
|
| 107 | + )->execute(array($old_xref, " _ASSO @$old_xref@", " _ASSO @$new_xref@", $WT_TREE->getTreeId())); |
|
| 108 | + Database::prepare( |
|
| 109 | + "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 = ?" |
|
| 110 | + )->execute(array($old_xref, " ASSO @$old_xref@", " ASSO @$new_xref@", $WT_TREE->getTreeId())); |
|
| 111 | + Database::prepare( |
|
| 112 | + "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 = ?" |
|
| 113 | + )->execute(array($old_xref, " _ASSO @$old_xref@", " _ASSO @$new_xref@", $WT_TREE->getTreeId())); |
|
| 114 | + Database::prepare( |
|
| 115 | + "UPDATE `##placelinks` SET pl_gid = ? WHERE pl_gid = ? AND pl_file = ?" |
|
| 116 | + )->execute(array($new_xref, $old_xref, $WT_TREE->getTreeId())); |
|
| 117 | + Database::prepare( |
|
| 118 | + "UPDATE `##dates` SET d_gid = ? WHERE d_gid = ? AND d_file = ?" |
|
| 119 | + )->execute(array($new_xref, $old_xref, $WT_TREE->getTreeId())); |
|
| 120 | + Database::prepare( |
|
| 121 | + "UPDATE `##user_gedcom_setting` SET setting_value = ? WHERE setting_value = ? AND gedcom_id = ? AND setting_name IN ('gedcomid', 'rootid')" |
|
| 122 | + )->execute(array($new_xref, $old_xref, $WT_TREE->getTreeId())); |
|
| 123 | + break; |
|
| 124 | + case 'FAM': |
|
| 125 | + Database::prepare( |
|
| 126 | + "UPDATE `##families` SET f_id = ?, f_gedcom = REPLACE(f_gedcom, ?, ?) WHERE f_id = ? AND f_file = ?" |
|
| 127 | + )->execute(array($new_xref, "0 @$old_xref@ FAM\n", "0 @$new_xref@ FAM\n", $old_xref, $WT_TREE->getTreeId())); |
|
| 128 | + Database::prepare( |
|
| 129 | + "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 = ?" |
|
| 130 | + )->execute(array($old_xref, " FAMC @$old_xref@", " FAMC @$new_xref@", $WT_TREE->getTreeId())); |
|
| 131 | + Database::prepare( |
|
| 132 | + "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 = ?" |
|
| 133 | + )->execute(array($old_xref, " FAMS @$old_xref@", " FAMS @$new_xref@", $WT_TREE->getTreeId())); |
|
| 134 | + Database::prepare( |
|
| 135 | + "UPDATE `##placelinks` SET pl_gid = ? WHERE pl_gid = ? AND pl_file = ?" |
|
| 136 | + )->execute(array($new_xref, $old_xref, $WT_TREE->getTreeId())); |
|
| 137 | + Database::prepare( |
|
| 138 | + "UPDATE `##dates` SET d_gid = ? WHERE d_gid = ? AND d_file = ?" |
|
| 139 | + )->execute(array($new_xref, $old_xref, $WT_TREE->getTreeId())); |
|
| 140 | + break; |
|
| 141 | + case 'SOUR': |
|
| 142 | + Database::prepare( |
|
| 143 | + "UPDATE `##sources` SET s_id = ?, s_gedcom = REPLACE(s_gedcom, ?, ?) WHERE s_id = ? AND s_file = ?" |
|
| 144 | + )->execute(array($new_xref, "0 @$old_xref@ SOUR\n", "0 @$new_xref@ SOUR\n", $old_xref, $WT_TREE->getTreeId())); |
|
| 145 | + Database::prepare( |
|
| 146 | + "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 = ?" |
|
| 147 | + )->execute(array($old_xref, " SOUR @$old_xref@", " SOUR @$new_xref@", $WT_TREE->getTreeId())); |
|
| 148 | + Database::prepare( |
|
| 149 | + "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 = ?" |
|
| 150 | + )->execute(array($old_xref, " SOUR @$old_xref@", " SOUR @$new_xref@", $WT_TREE->getTreeId())); |
|
| 151 | + Database::prepare( |
|
| 152 | + "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 = ?" |
|
| 153 | + )->execute(array($old_xref, " SOUR @$old_xref@", " SOUR @$new_xref@", $WT_TREE->getTreeId())); |
|
| 154 | + Database::prepare( |
|
| 155 | + "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 = ?" |
|
| 156 | + )->execute(array($old_xref, " SOUR @$old_xref@", " SOUR @$new_xref@", $WT_TREE->getTreeId())); |
|
| 157 | + break; |
|
| 158 | + case 'REPO': |
|
| 159 | + Database::prepare( |
|
| 160 | + "UPDATE `##other` SET o_id = ?, o_gedcom = REPLACE(o_gedcom, ?, ?) WHERE o_id = ? AND o_file = ?" |
|
| 161 | + )->execute(array($new_xref, "0 @$old_xref@ REPO\n", "0 @$new_xref@ REPO\n", $old_xref, $WT_TREE->getTreeId())); |
|
| 162 | + Database::prepare( |
|
| 163 | + "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 = ?" |
|
| 164 | + )->execute(array($old_xref, " REPO @$old_xref@", " REPO @$new_xref@", $WT_TREE->getTreeId())); |
|
| 165 | + break; |
|
| 166 | + case 'NOTE': |
|
| 167 | + Database::prepare( |
|
| 168 | + "UPDATE `##other` SET o_id = ?, o_gedcom = REPLACE(REPLACE(o_gedcom, ?, ?), ?, ?) WHERE o_id = ? AND o_file = ?" |
|
| 169 | + )->execute(array($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())); |
|
| 170 | + Database::prepare( |
|
| 171 | + "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 = ?" |
|
| 172 | + )->execute(array($old_xref, " NOTE @$old_xref@", " NOTE @$new_xref@", $WT_TREE->getTreeId())); |
|
| 173 | + Database::prepare( |
|
| 174 | + "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 = ?" |
|
| 175 | + )->execute(array($old_xref, " NOTE @$old_xref@", " NOTE @$new_xref@", $WT_TREE->getTreeId())); |
|
| 176 | + Database::prepare( |
|
| 177 | + "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 = ?" |
|
| 178 | + )->execute(array($old_xref, " NOTE @$old_xref@", " NOTE @$new_xref@", $WT_TREE->getTreeId())); |
|
| 179 | + Database::prepare( |
|
| 180 | + "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 = ?" |
|
| 181 | + )->execute(array($old_xref, " NOTE @$old_xref@", " NOTE @$new_xref@", $WT_TREE->getTreeId())); |
|
| 182 | + Database::prepare( |
|
| 183 | + "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 = ?" |
|
| 184 | + )->execute(array($old_xref, " NOTE @$old_xref@", " NOTE @$new_xref@", $WT_TREE->getTreeId())); |
|
| 185 | + break; |
|
| 186 | + case 'OBJE': |
|
| 187 | + Database::prepare( |
|
| 188 | + "UPDATE `##media` SET m_id = ?, m_gedcom = REPLACE(m_gedcom, ?, ?) WHERE m_id = ? AND m_file = ?" |
|
| 189 | + )->execute(array($new_xref, "0 @$old_xref@ OBJE\n", "0 @$new_xref@ OBJE\n", $old_xref, $WT_TREE->getTreeId())); |
|
| 190 | + Database::prepare( |
|
| 191 | + "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 = ?" |
|
| 192 | + )->execute(array($old_xref, " OBJE @$old_xref@", " OBJE @$new_xref@", $WT_TREE->getTreeId())); |
|
| 193 | + Database::prepare( |
|
| 194 | + "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 = ?" |
|
| 195 | + )->execute(array($old_xref, " OBJE @$old_xref@", " OBJE @$new_xref@", $WT_TREE->getTreeId())); |
|
| 196 | + Database::prepare( |
|
| 197 | + "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 = ?" |
|
| 198 | + )->execute(array($old_xref, " OBJE @$old_xref@", " OBJE @$new_xref@", $WT_TREE->getTreeId())); |
|
| 199 | + Database::prepare( |
|
| 200 | + "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 = ?" |
|
| 201 | + )->execute(array($old_xref, " OBJE @$old_xref@", " OBJE @$new_xref@", $WT_TREE->getTreeId())); |
|
| 202 | + Database::prepare( |
|
| 203 | + "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 = ?" |
|
| 204 | + )->execute(array($old_xref, " OBJE @$old_xref@", " OBJE @$new_xref@", $WT_TREE->getTreeId())); |
|
| 205 | + break; |
|
| 206 | + default: |
|
| 207 | + Database::prepare( |
|
| 208 | + "UPDATE `##other` SET o_id = ?, o_gedcom = REPLACE(o_gedcom, ?, ?) WHERE o_id = ? AND o_file = ?" |
|
| 209 | + )->execute(array($new_xref, "0 @$old_xref@ $type\n", "0 @$new_xref@ $type\n", $old_xref, $WT_TREE->getTreeId())); |
|
| 210 | + Database::prepare( |
|
| 211 | + "UPDATE `##individuals` JOIN `##link` ON (l_file = i_file AND l_to = ?) SET i_gedcom = REPLACE(i_gedcom, ?, ?) WHERE i_file = ?" |
|
| 212 | + )->execute(array($old_xref, " @$old_xref@", " @$new_xref@", $WT_TREE->getTreeId())); |
|
| 213 | + Database::prepare( |
|
| 214 | + "UPDATE `##families` JOIN `##link` ON (l_file = f_file AND l_to = ?) SET f_gedcom = REPLACE(f_gedcom, ?, ?) WHERE f_file = ?" |
|
| 215 | + )->execute(array($old_xref, " @$old_xref@", " @$new_xref@", $WT_TREE->getTreeId())); |
|
| 216 | + Database::prepare( |
|
| 217 | + "UPDATE `##media` JOIN `##link` ON (l_file = m_file AND l_to = ?) SET m_gedcom = REPLACE(m_gedcom, ?, ?) WHERE m_file = ?" |
|
| 218 | + )->execute(array($old_xref, " @$old_xref@", " @$new_xref@", $WT_TREE->getTreeId())); |
|
| 219 | + Database::prepare( |
|
| 220 | + "UPDATE `##sources` JOIN `##link` ON (l_file = s_file AND l_to = ?) SET s_gedcom = REPLACE(s_gedcom, ?, ?) WHERE s_file = ?" |
|
| 221 | + )->execute(array($old_xref, " @$old_xref@", " @$new_xref@", $WT_TREE->getTreeId())); |
|
| 222 | + Database::prepare( |
|
| 223 | + "UPDATE `##other` JOIN `##link` ON (l_file = o_file AND l_to = ?) SET o_gedcom = REPLACE(o_gedcom, ?, ?) WHERE o_file = ?" |
|
| 224 | + )->execute(array($old_xref, " @$old_xref@", " @$new_xref@", $WT_TREE->getTreeId())); |
|
| 225 | + break; |
|
| 226 | + } |
|
| 227 | + Database::prepare( |
|
| 228 | + "UPDATE `##name` SET n_id = ? WHERE n_id = ? AND n_file = ?" |
|
| 229 | + )->execute(array($new_xref, $old_xref, $WT_TREE->getTreeId())); |
|
| 230 | + Database::prepare( |
|
| 231 | + "UPDATE `##default_resn` SET xref = ? WHERE xref = ? AND gedcom_id = ?" |
|
| 232 | + )->execute(array($new_xref, $old_xref, $WT_TREE->getTreeId())); |
|
| 233 | + Database::prepare( |
|
| 234 | + "UPDATE `##hit_counter` SET page_parameter = ? WHERE page_parameter = ? AND gedcom_id = ?" |
|
| 235 | + )->execute(array($new_xref, $old_xref, $WT_TREE->getTreeId())); |
|
| 236 | + Database::prepare( |
|
| 237 | + "UPDATE `##link` SET l_from = ? WHERE l_from = ? AND l_file = ?" |
|
| 238 | + )->execute(array($new_xref, $old_xref, $WT_TREE->getTreeId())); |
|
| 239 | + Database::prepare( |
|
| 240 | + "UPDATE `##link` SET l_to = ? WHERE l_to = ? AND l_file = ?" |
|
| 241 | + )->execute(array($new_xref, $old_xref, $WT_TREE->getTreeId())); |
|
| 242 | + echo '<p>', I18N::translate('The record %1$s has been renamed to %2$s.', $old_xref, $new_xref), '</p>'; |
|
| 243 | + unset($xrefs[$old_xref]); |
|
| 244 | + Database::exec("UNLOCK TABLES"); |
|
| 245 | + Database::commit(); |
|
| 246 | 246 | |
| 247 | - try { |
|
| 248 | - Database::prepare( |
|
| 249 | - "UPDATE `##favorite` SET xref = ? WHERE xref = ? AND gedcom_id = ?" |
|
| 250 | - )->execute(array($new_xref, $old_xref, $WT_TREE->getTreeId())); |
|
| 251 | - } catch (\Exception $ex) { |
|
| 252 | - // Perhaps the favorites module was not installed? |
|
| 253 | - } |
|
| 247 | + try { |
|
| 248 | + Database::prepare( |
|
| 249 | + "UPDATE `##favorite` SET xref = ? WHERE xref = ? AND gedcom_id = ?" |
|
| 250 | + )->execute(array($new_xref, $old_xref, $WT_TREE->getTreeId())); |
|
| 251 | + } catch (\Exception $ex) { |
|
| 252 | + // Perhaps the favorites module was not installed? |
|
| 253 | + } |
|
| 254 | 254 | |
| 255 | - // How much time do we have left? |
|
| 256 | - if (microtime(true) - WT_START_TIME > ini_get('max_execution_time') - 2) { |
|
| 257 | - echo '<p>', I18N::translate('The server’s time limit has been reached.'), '</p>'; |
|
| 258 | - break; |
|
| 259 | - } |
|
| 260 | - } |
|
| 261 | - if ($xrefs) { |
|
| 255 | + // How much time do we have left? |
|
| 256 | + if (microtime(true) - WT_START_TIME > ini_get('max_execution_time') - 2) { |
|
| 257 | + echo '<p>', I18N::translate('The server’s time limit has been reached.'), '</p>'; |
|
| 258 | + break; |
|
| 259 | + } |
|
| 260 | + } |
|
| 261 | + if ($xrefs) { |
|
| 262 | 262 | |
| 263 | - } |
|
| 263 | + } |
|
| 264 | 264 | } else { |
| 265 | - echo '<p>', I18N::translate('In a family tree, each record has an internal reference number (called an “XREF”) such as “F123” or “R14”.'), '</p>'; |
|
| 266 | - echo '<p>', I18N::translate('You can renumber the records in a family tree, so that these internal reference numbers are not duplicated in any other family tree.'), '</p>'; |
|
| 265 | + echo '<p>', I18N::translate('In a family tree, each record has an internal reference number (called an “XREF”) such as “F123” or “R14”.'), '</p>'; |
|
| 266 | + echo '<p>', I18N::translate('You can renumber the records in a family tree, so that these internal reference numbers are not duplicated in any other family tree.'), '</p>'; |
|
| 267 | 267 | } |
| 268 | 268 | |
| 269 | 269 | echo '<p>', I18N::plural( |
| 270 | - 'This family tree has %s record which uses the same “XREF” as another family tree.', |
|
| 271 | - 'This family tree has %s records which use the same “XREF” as another family tree.', |
|
| 272 | - count($xrefs), count($xrefs) |
|
| 270 | + 'This family tree has %s record which uses the same “XREF” as another family tree.', |
|
| 271 | + 'This family tree has %s records which use the same “XREF” as another family tree.', |
|
| 272 | + count($xrefs), count($xrefs) |
|
| 273 | 273 | ), '</p>'; |
| 274 | 274 | |
| 275 | 275 | if ($xrefs) { |
| 276 | - // We use GET (not POST) for this update operation - because we want the user to |
|
| 277 | - // be able to press F5 to continue after a timeout. |
|
| 278 | - echo '<form>'; |
|
| 279 | - echo '<p>', I18N::translate('You can renumber this family tree.'), '</p>'; |
|
| 280 | - echo '<button type="submit" class="btn btn-primary">'; |
|
| 281 | - echo '<i class="fa fa-check"></i> ', /* I18N: A button label. */ I18N::translate('continue'); |
|
| 282 | - echo '</button>'; |
|
| 283 | - echo '<input type="hidden" name="action" value="renumber">'; |
|
| 284 | - echo '<input type="hidden" name="ged" value="', $WT_TREE->getNameHtml(), '">'; |
|
| 285 | - echo '</form>'; |
|
| 286 | - echo '<p>', I18N::translate('Caution! This may take a long time. Be patient.'), '</p>'; |
|
| 276 | + // We use GET (not POST) for this update operation - because we want the user to |
|
| 277 | + // be able to press F5 to continue after a timeout. |
|
| 278 | + echo '<form>'; |
|
| 279 | + echo '<p>', I18N::translate('You can renumber this family tree.'), '</p>'; |
|
| 280 | + echo '<button type="submit" class="btn btn-primary">'; |
|
| 281 | + echo '<i class="fa fa-check"></i> ', /* I18N: A button label. */ I18N::translate('continue'); |
|
| 282 | + echo '</button>'; |
|
| 283 | + echo '<input type="hidden" name="action" value="renumber">'; |
|
| 284 | + echo '<input type="hidden" name="ged" value="', $WT_TREE->getNameHtml(), '">'; |
|
| 285 | + echo '</form>'; |
|
| 286 | + echo '<p>', I18N::translate('Caution! This may take a long time. Be patient.'), '</p>'; |
|
| 287 | 287 | } |
@@ -24,29 +24,29 @@ |
||
| 24 | 24 | |
| 25 | 25 | $controller = new PageController; |
| 26 | 26 | $controller |
| 27 | - ->restrictAccess(Auth::isAdmin()) |
|
| 28 | - ->setPageTitle(I18N::translate('Reports')); |
|
| 27 | + ->restrictAccess(Auth::isAdmin()) |
|
| 28 | + ->setPageTitle(I18N::translate('Reports')); |
|
| 29 | 29 | |
| 30 | 30 | $action = Filter::post('action'); |
| 31 | 31 | $modules = Module::getAllModulesByComponent('report'); |
| 32 | 32 | |
| 33 | 33 | if ($action === 'update_mods' && Filter::checkCsrf()) { |
| 34 | - foreach ($modules as $module) { |
|
| 35 | - foreach (Tree::getAll() as $tree) { |
|
| 36 | - $access_level = Filter::post('access-' . $module->getName() . '-' . $tree->getTreeId(), WT_REGEX_INTEGER, $module->defaultAccessLevel()); |
|
| 37 | - Database::prepare( |
|
| 38 | - "REPLACE INTO `##module_privacy` (module_name, gedcom_id, component, access_level) VALUES (?, ?, 'report', ?)" |
|
| 39 | - )->execute(array($module->getName(), $tree->getTreeId(), $access_level)); |
|
| 40 | - } |
|
| 41 | - } |
|
| 34 | + foreach ($modules as $module) { |
|
| 35 | + foreach (Tree::getAll() as $tree) { |
|
| 36 | + $access_level = Filter::post('access-' . $module->getName() . '-' . $tree->getTreeId(), WT_REGEX_INTEGER, $module->defaultAccessLevel()); |
|
| 37 | + Database::prepare( |
|
| 38 | + "REPLACE INTO `##module_privacy` (module_name, gedcom_id, component, access_level) VALUES (?, ?, 'report', ?)" |
|
| 39 | + )->execute(array($module->getName(), $tree->getTreeId(), $access_level)); |
|
| 40 | + } |
|
| 41 | + } |
|
| 42 | 42 | |
| 43 | - header('Location: ' . WT_BASE_URL . WT_SCRIPT_NAME); |
|
| 43 | + header('Location: ' . WT_BASE_URL . WT_SCRIPT_NAME); |
|
| 44 | 44 | |
| 45 | - return; |
|
| 45 | + return; |
|
| 46 | 46 | } |
| 47 | 47 | |
| 48 | 48 | $controller |
| 49 | - ->pageHeader(); |
|
| 49 | + ->pageHeader(); |
|
| 50 | 50 | |
| 51 | 51 | ?> |
| 52 | 52 | <ol class="breadcrumb small"> |
@@ -74,8 +74,11 @@ |
||
| 74 | 74 | <td class="col-xs-2"> |
| 75 | 75 | <?php if ($module instanceof ModuleConfigInterface): ?> |
| 76 | 76 | <a href="<?php echo $module->getConfigLink(); ?>"><?php echo $module->getTitle(); ?> <i class="fa fa-cogs"></i></a> |
| 77 | - <?php else: ?> |
|
| 78 | - <?php echo $module->getTitle(); ?> |
|
| 77 | + <?php else { |
|
| 78 | + : ?> |
|
| 79 | + <?php echo $module->getTitle(); |
|
| 80 | +} |
|
| 81 | +?> |
|
| 79 | 82 | <?php endif; ?> |
| 80 | 83 | </td> |
| 81 | 84 | <td class="col-xs-5"><?php echo $module->getDescription(); ?></td> |
@@ -31,9 +31,9 @@ discard block |
||
| 31 | 31 | |
| 32 | 32 | $controller = new SimpleController; |
| 33 | 33 | $controller |
| 34 | - ->setPageTitle(I18N::translate('Add/edit a journal/news entry')) |
|
| 35 | - ->restrictAccess(Auth::isMember($WT_TREE)) |
|
| 36 | - ->pageHeader(); |
|
| 34 | + ->setPageTitle(I18N::translate('Add/edit a journal/news entry')) |
|
| 35 | + ->restrictAccess(Auth::isMember($WT_TREE)) |
|
| 36 | + ->pageHeader(); |
|
| 37 | 37 | |
| 38 | 38 | $action = Filter::get('action', 'compose|save', 'compose'); |
| 39 | 39 | $news_id = Filter::getInteger('news_id'); |
@@ -45,43 +45,43 @@ discard block |
||
| 45 | 45 | |
| 46 | 46 | switch ($action) { |
| 47 | 47 | case 'compose': |
| 48 | - if (Module::getModuleByName('ckeditor')) { |
|
| 49 | - CkeditorModule::enableEditor($controller); |
|
| 50 | - } |
|
| 48 | + if (Module::getModuleByName('ckeditor')) { |
|
| 49 | + CkeditorModule::enableEditor($controller); |
|
| 50 | + } |
|
| 51 | 51 | |
| 52 | - echo '<h3>' . I18N::translate('Add/edit a journal/news entry') . '</h3>'; |
|
| 53 | - echo '<form style="overflow: hidden;" name="messageform" method="post" action="editnews.php?action=save&news_id=' . $news_id . '">'; |
|
| 54 | - if ($news_id) { |
|
| 55 | - $news = Database::prepare("SELECT news_id AS id, user_id, gedcom_id, UNIX_TIMESTAMP(updated) AS date, subject, body FROM `##news` WHERE news_id=?")->execute(array($news_id))->fetchOneRow(PDO::FETCH_ASSOC); |
|
| 56 | - } else { |
|
| 57 | - $news = array(); |
|
| 58 | - $news['user_id'] = $user_id; |
|
| 59 | - $news['gedcom_id'] = $gedcom_id; |
|
| 60 | - $news['date'] = WT_TIMESTAMP; |
|
| 61 | - $news['subject'] = ''; |
|
| 62 | - $news['body'] = ''; |
|
| 63 | - } |
|
| 64 | - echo '<input type="hidden" name="user_id" value="' . $news['user_id'] . '">'; |
|
| 65 | - echo '<input type="hidden" name="gedcom_id" value="' . $news['gedcom_id'] . '">'; |
|
| 66 | - echo '<input type="hidden" name="date" value="' . $news['date'] . '">'; |
|
| 67 | - echo '<table>'; |
|
| 68 | - echo '<tr><th style="text-align:start;">' . I18N::translate('Title') . '</th><tr>'; |
|
| 69 | - echo '<tr><td><input type="text" name="title" size="50" dir="auto" autofocus value="' . $news['subject'] . '"></td></tr>'; |
|
| 70 | - echo '<tr><th style="text-align:start;">' . I18N::translate('Content') . '</th></tr>'; |
|
| 71 | - echo '<tr><td>'; |
|
| 72 | - echo '<textarea name="text" class="html-edit" cols="80" rows="10" dir="auto">' . Filter::escapeHtml($news['body']) . '</textarea>'; |
|
| 73 | - echo '</td></tr>'; |
|
| 74 | - echo '<tr><td><input type="submit" value="' . I18N::translate('save') . '"></td></tr>'; |
|
| 75 | - echo '</table>'; |
|
| 76 | - echo '</form>'; |
|
| 77 | - break; |
|
| 52 | + echo '<h3>' . I18N::translate('Add/edit a journal/news entry') . '</h3>'; |
|
| 53 | + echo '<form style="overflow: hidden;" name="messageform" method="post" action="editnews.php?action=save&news_id=' . $news_id . '">'; |
|
| 54 | + if ($news_id) { |
|
| 55 | + $news = Database::prepare("SELECT news_id AS id, user_id, gedcom_id, UNIX_TIMESTAMP(updated) AS date, subject, body FROM `##news` WHERE news_id=?")->execute(array($news_id))->fetchOneRow(PDO::FETCH_ASSOC); |
|
| 56 | + } else { |
|
| 57 | + $news = array(); |
|
| 58 | + $news['user_id'] = $user_id; |
|
| 59 | + $news['gedcom_id'] = $gedcom_id; |
|
| 60 | + $news['date'] = WT_TIMESTAMP; |
|
| 61 | + $news['subject'] = ''; |
|
| 62 | + $news['body'] = ''; |
|
| 63 | + } |
|
| 64 | + echo '<input type="hidden" name="user_id" value="' . $news['user_id'] . '">'; |
|
| 65 | + echo '<input type="hidden" name="gedcom_id" value="' . $news['gedcom_id'] . '">'; |
|
| 66 | + echo '<input type="hidden" name="date" value="' . $news['date'] . '">'; |
|
| 67 | + echo '<table>'; |
|
| 68 | + echo '<tr><th style="text-align:start;">' . I18N::translate('Title') . '</th><tr>'; |
|
| 69 | + echo '<tr><td><input type="text" name="title" size="50" dir="auto" autofocus value="' . $news['subject'] . '"></td></tr>'; |
|
| 70 | + echo '<tr><th style="text-align:start;">' . I18N::translate('Content') . '</th></tr>'; |
|
| 71 | + echo '<tr><td>'; |
|
| 72 | + echo '<textarea name="text" class="html-edit" cols="80" rows="10" dir="auto">' . Filter::escapeHtml($news['body']) . '</textarea>'; |
|
| 73 | + echo '</td></tr>'; |
|
| 74 | + echo '<tr><td><input type="submit" value="' . I18N::translate('save') . '"></td></tr>'; |
|
| 75 | + echo '</table>'; |
|
| 76 | + echo '</form>'; |
|
| 77 | + break; |
|
| 78 | 78 | case 'save': |
| 79 | - if ($news_id) { |
|
| 80 | - Database::prepare("UPDATE `##news` SET subject=?, body=?, updated=FROM_UNIXTIME(?) WHERE news_id=?")->execute(array($title, $text, $date, $news_id)); |
|
| 81 | - } else { |
|
| 82 | - Database::prepare("INSERT INTO `##news` (user_id, gedcom_id, subject, body, updated) VALUES (NULLIF(?, ''), NULLIF(?, '') ,? ,?, CURRENT_TIMESTAMP)")->execute(array($user_id, $gedcom_id, $title, $text)); |
|
| 83 | - } |
|
| 79 | + if ($news_id) { |
|
| 80 | + Database::prepare("UPDATE `##news` SET subject=?, body=?, updated=FROM_UNIXTIME(?) WHERE news_id=?")->execute(array($title, $text, $date, $news_id)); |
|
| 81 | + } else { |
|
| 82 | + Database::prepare("INSERT INTO `##news` (user_id, gedcom_id, subject, body, updated) VALUES (NULLIF(?, ''), NULLIF(?, '') ,? ,?, CURRENT_TIMESTAMP)")->execute(array($user_id, $gedcom_id, $title, $text)); |
|
| 83 | + } |
|
| 84 | 84 | |
| 85 | - $controller->addInlineJavascript('window.opener.location.reload();window.close();'); |
|
| 86 | - break; |
|
| 85 | + $controller->addInlineJavascript('window.opener.location.reload();window.close();'); |
|
| 86 | + break; |
|
| 87 | 87 | } |
@@ -32,61 +32,61 @@ |
||
| 32 | 32 | * The rest are just examples, and should be removed in actual themes. |
| 33 | 33 | */ |
| 34 | 34 | class MyTheme extends WebtreesTheme { |
| 35 | - /** |
|
| 36 | - * Give your theme a unique identifier. Themes beginning with an underscore |
|
| 37 | - * are reserved for internal use. |
|
| 38 | - * |
|
| 39 | - * {@inheritdoc} |
|
| 40 | - */ |
|
| 41 | - public function themeId() { |
|
| 42 | - return '_custom'; |
|
| 43 | - } |
|
| 35 | + /** |
|
| 36 | + * Give your theme a unique identifier. Themes beginning with an underscore |
|
| 37 | + * are reserved for internal use. |
|
| 38 | + * |
|
| 39 | + * {@inheritdoc} |
|
| 40 | + */ |
|
| 41 | + public function themeId() { |
|
| 42 | + return '_custom'; |
|
| 43 | + } |
|
| 44 | 44 | |
| 45 | - /** |
|
| 46 | - * Give your theme a name. This is shown to the users. |
|
| 47 | - * Use HTML entities where appropriate. e.g. “Black & white”. |
|
| 48 | - * |
|
| 49 | - * You could use switch($this->locale) {} to provide a translated versions |
|
| 50 | - * of the theme name. |
|
| 51 | - * |
|
| 52 | - * {@inheritdoc} |
|
| 53 | - */ |
|
| 54 | - public function themeName() { |
|
| 55 | - return 'Custom theme'; |
|
| 56 | - } |
|
| 45 | + /** |
|
| 46 | + * Give your theme a name. This is shown to the users. |
|
| 47 | + * Use HTML entities where appropriate. e.g. “Black & white”. |
|
| 48 | + * |
|
| 49 | + * You could use switch($this->locale) {} to provide a translated versions |
|
| 50 | + * of the theme name. |
|
| 51 | + * |
|
| 52 | + * {@inheritdoc} |
|
| 53 | + */ |
|
| 54 | + public function themeName() { |
|
| 55 | + return 'Custom theme'; |
|
| 56 | + } |
|
| 57 | 57 | |
| 58 | - /** |
|
| 59 | - * This is an example function which shows how to add an additional CSS file to the theme. |
|
| 60 | - * |
|
| 61 | - * {@inheritdoc} |
|
| 62 | - */ |
|
| 63 | - public function stylesheets() { |
|
| 64 | - $css_files = parent::stylesheets(); |
|
| 65 | - // Put a version number in the URL, to prevent browsers from caching old versions. |
|
| 66 | - $css_files[] = WT_BASE_URL . 'themes/_custom/custom-v1.0.css'; |
|
| 58 | + /** |
|
| 59 | + * This is an example function which shows how to add an additional CSS file to the theme. |
|
| 60 | + * |
|
| 61 | + * {@inheritdoc} |
|
| 62 | + */ |
|
| 63 | + public function stylesheets() { |
|
| 64 | + $css_files = parent::stylesheets(); |
|
| 65 | + // Put a version number in the URL, to prevent browsers from caching old versions. |
|
| 66 | + $css_files[] = WT_BASE_URL . 'themes/_custom/custom-v1.0.css'; |
|
| 67 | 67 | |
| 68 | - return $css_files; |
|
| 69 | - } |
|
| 68 | + return $css_files; |
|
| 69 | + } |
|
| 70 | 70 | |
| 71 | - /** |
|
| 72 | - * This is an example function which shows one way to remove an entry from a menu. |
|
| 73 | - * |
|
| 74 | - * @param string $surname The significant surname for the page. |
|
| 75 | - * |
|
| 76 | - * {@inheritdoc} |
|
| 77 | - */ |
|
| 78 | - public function menuLists($surname) { |
|
| 79 | - // Start with the default "Lists" menu. |
|
| 80 | - $menu = parent::menuLists($surname); |
|
| 81 | - // Remove the "notes" sub-menu. |
|
| 82 | - $submenus = array_filter($menu->getSubmenus(), function (Menu $menu) { |
|
| 83 | - return $menu->getClass() !== 'menu-list-note'; |
|
| 84 | - }); |
|
| 85 | - // Replace the sub-menus |
|
| 86 | - $menu->setSubmenus($submenus); |
|
| 71 | + /** |
|
| 72 | + * This is an example function which shows one way to remove an entry from a menu. |
|
| 73 | + * |
|
| 74 | + * @param string $surname The significant surname for the page. |
|
| 75 | + * |
|
| 76 | + * {@inheritdoc} |
|
| 77 | + */ |
|
| 78 | + public function menuLists($surname) { |
|
| 79 | + // Start with the default "Lists" menu. |
|
| 80 | + $menu = parent::menuLists($surname); |
|
| 81 | + // Remove the "notes" sub-menu. |
|
| 82 | + $submenus = array_filter($menu->getSubmenus(), function (Menu $menu) { |
|
| 83 | + return $menu->getClass() !== 'menu-list-note'; |
|
| 84 | + }); |
|
| 85 | + // Replace the sub-menus |
|
| 86 | + $menu->setSubmenus($submenus); |
|
| 87 | 87 | |
| 88 | - return $menu; |
|
| 89 | - } |
|
| 88 | + return $menu; |
|
| 89 | + } |
|
| 90 | 90 | } |
| 91 | 91 | |
| 92 | 92 | return new MyTheme; // This script must return a theme object. |
@@ -31,14 +31,16 @@ discard block |
||
| 31 | 31 | * Only the first two functions are required: themeId() and themeName(). |
| 32 | 32 | * The rest are just examples, and should be removed in actual themes. |
| 33 | 33 | */ |
| 34 | -class MyTheme extends WebtreesTheme { |
|
| 34 | +class MyTheme extends WebtreesTheme |
|
| 35 | +{ |
|
| 35 | 36 | /** |
| 36 | 37 | * Give your theme a unique identifier. Themes beginning with an underscore |
| 37 | 38 | * are reserved for internal use. |
| 38 | 39 | * |
| 39 | 40 | * {@inheritdoc} |
| 40 | 41 | */ |
| 41 | - public function themeId() { |
|
| 42 | + public function themeId() |
|
| 43 | + { |
|
| 42 | 44 | return '_custom'; |
| 43 | 45 | } |
| 44 | 46 | |
@@ -51,7 +53,8 @@ discard block |
||
| 51 | 53 | * |
| 52 | 54 | * {@inheritdoc} |
| 53 | 55 | */ |
| 54 | - public function themeName() { |
|
| 56 | + public function themeName() |
|
| 57 | + { |
|
| 55 | 58 | return 'Custom theme'; |
| 56 | 59 | } |
| 57 | 60 | |
@@ -60,7 +63,8 @@ discard block |
||
| 60 | 63 | * |
| 61 | 64 | * {@inheritdoc} |
| 62 | 65 | */ |
| 63 | - public function stylesheets() { |
|
| 66 | + public function stylesheets() |
|
| 67 | + { |
|
| 64 | 68 | $css_files = parent::stylesheets(); |
| 65 | 69 | // Put a version number in the URL, to prevent browsers from caching old versions. |
| 66 | 70 | $css_files[] = WT_BASE_URL . 'themes/_custom/custom-v1.0.css'; |
@@ -75,7 +79,8 @@ discard block |
||
| 75 | 79 | * |
| 76 | 80 | * {@inheritdoc} |
| 77 | 81 | */ |
| 78 | - public function menuLists($surname) { |
|
| 82 | + public function menuLists($surname) |
|
| 83 | + { |
|
| 79 | 84 | // Start with the default "Lists" menu. |
| 80 | 85 | $menu = parent::menuLists($surname); |
| 81 | 86 | // Remove the "notes" sub-menu. |
@@ -25,9 +25,9 @@ discard block |
||
| 25 | 25 | |
| 26 | 26 | $controller = new LifespanController; |
| 27 | 27 | $controller |
| 28 | - ->restrictAccess(Module::isActiveChart($WT_TREE, 'lifespans_chart')) |
|
| 29 | - ->pageHeader() |
|
| 30 | - ->addExternalJavascript(WT_AUTOCOMPLETE_JS_URL); |
|
| 28 | + ->restrictAccess(Module::isActiveChart($WT_TREE, 'lifespans_chart')) |
|
| 29 | + ->pageHeader() |
|
| 30 | + ->addExternalJavascript(WT_AUTOCOMPLETE_JS_URL); |
|
| 31 | 31 | |
| 32 | 32 | ?> |
| 33 | 33 | <div id="lifespan-page"> |
@@ -126,7 +126,7 @@ discard block |
||
| 126 | 126 | </div> |
| 127 | 127 | <?php |
| 128 | 128 | $controller |
| 129 | - ->addInlineJavascript(" |
|
| 129 | + ->addInlineJavascript(" |
|
| 130 | 130 | autocomplete(); |
| 131 | 131 | var scale = jQuery('#lifespan-scale'), |
| 132 | 132 | barHeight = jQuery('#lifespan-people').children().first().outerHeight(); |
@@ -24,29 +24,29 @@ |
||
| 24 | 24 | |
| 25 | 25 | $controller = new PageController; |
| 26 | 26 | $controller |
| 27 | - ->restrictAccess(Auth::isAdmin()) |
|
| 28 | - ->setPageTitle(I18N::translate('Charts')); |
|
| 27 | + ->restrictAccess(Auth::isAdmin()) |
|
| 28 | + ->setPageTitle(I18N::translate('Charts')); |
|
| 29 | 29 | |
| 30 | 30 | $action = Filter::post('action'); |
| 31 | 31 | $modules = Module::getAllModulesByComponent('chart'); |
| 32 | 32 | |
| 33 | 33 | if ($action === 'update_mods' && Filter::checkCsrf()) { |
| 34 | - foreach ($modules as $module) { |
|
| 35 | - foreach (Tree::getAll() as $tree) { |
|
| 36 | - $access_level = Filter::post('access-' . $module->getName() . '-' . $tree->getTreeId(), WT_REGEX_INTEGER, $module->defaultAccessLevel()); |
|
| 37 | - Database::prepare( |
|
| 38 | - "REPLACE INTO `##module_privacy` (module_name, gedcom_id, component, access_level) VALUES (?, ?, 'chart', ?)" |
|
| 39 | - )->execute(array($module->getName(), $tree->getTreeId(), $access_level)); |
|
| 40 | - } |
|
| 41 | - } |
|
| 34 | + foreach ($modules as $module) { |
|
| 35 | + foreach (Tree::getAll() as $tree) { |
|
| 36 | + $access_level = Filter::post('access-' . $module->getName() . '-' . $tree->getTreeId(), WT_REGEX_INTEGER, $module->defaultAccessLevel()); |
|
| 37 | + Database::prepare( |
|
| 38 | + "REPLACE INTO `##module_privacy` (module_name, gedcom_id, component, access_level) VALUES (?, ?, 'chart', ?)" |
|
| 39 | + )->execute(array($module->getName(), $tree->getTreeId(), $access_level)); |
|
| 40 | + } |
|
| 41 | + } |
|
| 42 | 42 | |
| 43 | - header('Location: ' . WT_BASE_URL . WT_SCRIPT_NAME); |
|
| 43 | + header('Location: ' . WT_BASE_URL . WT_SCRIPT_NAME); |
|
| 44 | 44 | |
| 45 | - return; |
|
| 45 | + return; |
|
| 46 | 46 | } |
| 47 | 47 | |
| 48 | 48 | $controller |
| 49 | - ->pageHeader(); |
|
| 49 | + ->pageHeader(); |
|
| 50 | 50 | |
| 51 | 51 | ?> |
| 52 | 52 | <ol class="breadcrumb small"> |
@@ -74,8 +74,11 @@ |
||
| 74 | 74 | <td class="col-xs-2"> |
| 75 | 75 | <?php if ($module instanceof ModuleConfigInterface): ?> |
| 76 | 76 | <a href="<?php echo $module->getConfigLink(); ?>"><?php echo $module->getTitle(); ?> <i class="fa fa-cogs"></i></a> |
| 77 | - <?php else: ?> |
|
| 78 | - <?php echo $module->getTitle(); ?> |
|
| 77 | + <?php else { |
|
| 78 | + : ?> |
|
| 79 | + <?php echo $module->getTitle(); |
|
| 80 | +} |
|
| 81 | +?> |
|
| 79 | 82 | <?php endif; ?> |
| 80 | 83 | </td> |
| 81 | 84 | <td class="col-xs-5"><?php echo $module->getDescription(); ?></td> |
@@ -41,66 +41,66 @@ discard block |
||
| 41 | 41 | $qs = Filter::get('tags'); |
| 42 | 42 | |
| 43 | 43 | if ($subclick === 'all') { |
| 44 | - $all = true; |
|
| 44 | + $all = true; |
|
| 45 | 45 | } |
| 46 | 46 | |
| 47 | 47 | $embed = substr($choose, 0, 1) === '1'; |
| 48 | 48 | |
| 49 | 49 | switch ($type) { |
| 50 | 50 | case 'indi': |
| 51 | - $controller->setPageTitle(I18N::translate('Find an individual')); |
|
| 52 | - break; |
|
| 51 | + $controller->setPageTitle(I18N::translate('Find an individual')); |
|
| 52 | + break; |
|
| 53 | 53 | case 'fam': |
| 54 | - $controller->setPageTitle(I18N::translate('Find a family')); |
|
| 55 | - break; |
|
| 54 | + $controller->setPageTitle(I18N::translate('Find a family')); |
|
| 55 | + break; |
|
| 56 | 56 | case 'media': |
| 57 | - $controller->setPageTitle(I18N::translate('Find a media object')); |
|
| 58 | - break; |
|
| 57 | + $controller->setPageTitle(I18N::translate('Find a media object')); |
|
| 58 | + break; |
|
| 59 | 59 | case 'place': |
| 60 | - $controller->setPageTitle(I18N::translate('Find a place')); |
|
| 61 | - break; |
|
| 60 | + $controller->setPageTitle(I18N::translate('Find a place')); |
|
| 61 | + break; |
|
| 62 | 62 | case 'repo': |
| 63 | - $controller->setPageTitle(I18N::translate('Find a repository')); |
|
| 64 | - break; |
|
| 63 | + $controller->setPageTitle(I18N::translate('Find a repository')); |
|
| 64 | + break; |
|
| 65 | 65 | case 'note': |
| 66 | - $controller->setPageTitle(I18N::translate('Find a shared note')); |
|
| 67 | - break; |
|
| 66 | + $controller->setPageTitle(I18N::translate('Find a shared note')); |
|
| 67 | + break; |
|
| 68 | 68 | case 'source': |
| 69 | - $controller->setPageTitle(I18N::translate('Find a source')); |
|
| 70 | - break; |
|
| 69 | + $controller->setPageTitle(I18N::translate('Find a source')); |
|
| 70 | + break; |
|
| 71 | 71 | case 'specialchar': |
| 72 | - $controller->setPageTitle(I18N::translate('Find a special character')); |
|
| 73 | - break; |
|
| 72 | + $controller->setPageTitle(I18N::translate('Find a special character')); |
|
| 73 | + break; |
|
| 74 | 74 | case 'factINDI': |
| 75 | - $controller |
|
| 76 | - ->setPageTitle(I18N::translate('Find a fact or event')) |
|
| 77 | - ->addInlineJavascript('initPickFact("INDI");'); |
|
| 78 | - break; |
|
| 75 | + $controller |
|
| 76 | + ->setPageTitle(I18N::translate('Find a fact or event')) |
|
| 77 | + ->addInlineJavascript('initPickFact("INDI");'); |
|
| 78 | + break; |
|
| 79 | 79 | case 'factFAM': |
| 80 | - $controller |
|
| 81 | - ->setPageTitle(I18N::translate('Find a fact or event')) |
|
| 82 | - ->addInlineJavascript('initPickFact("FAM");'); |
|
| 83 | - break; |
|
| 80 | + $controller |
|
| 81 | + ->setPageTitle(I18N::translate('Find a fact or event')) |
|
| 82 | + ->addInlineJavascript('initPickFact("FAM");'); |
|
| 83 | + break; |
|
| 84 | 84 | case 'factSOUR': |
| 85 | - $controller |
|
| 86 | - ->setPageTitle(I18N::translate('Find a fact or event')) |
|
| 87 | - ->addInlineJavascript('initPickFact("SOUR");'); |
|
| 88 | - break; |
|
| 85 | + $controller |
|
| 86 | + ->setPageTitle(I18N::translate('Find a fact or event')) |
|
| 87 | + ->addInlineJavascript('initPickFact("SOUR");'); |
|
| 88 | + break; |
|
| 89 | 89 | case 'factREPO': |
| 90 | - $controller |
|
| 91 | - ->setPageTitle(I18N::translate('Find a fact or event')) |
|
| 92 | - ->addInlineJavascript('initPickFact("REPO");'); |
|
| 93 | - break; |
|
| 90 | + $controller |
|
| 91 | + ->setPageTitle(I18N::translate('Find a fact or event')) |
|
| 92 | + ->addInlineJavascript('initPickFact("REPO");'); |
|
| 93 | + break; |
|
| 94 | 94 | case 'factNAME': |
| 95 | - $controller |
|
| 96 | - ->setPageTitle(I18N::translate('Find a fact or event')) |
|
| 97 | - ->addInlineJavascript('initPickFact("NAME");'); |
|
| 98 | - break; |
|
| 95 | + $controller |
|
| 96 | + ->setPageTitle(I18N::translate('Find a fact or event')) |
|
| 97 | + ->addInlineJavascript('initPickFact("NAME");'); |
|
| 98 | + break; |
|
| 99 | 99 | case 'factPLAC': |
| 100 | - $controller |
|
| 101 | - ->setPageTitle(I18N::translate('Find a fact or event')) |
|
| 102 | - ->addInlineJavascript('initPickFact("PLAC");'); |
|
| 103 | - break; |
|
| 100 | + $controller |
|
| 101 | + ->setPageTitle(I18N::translate('Find a fact or event')) |
|
| 102 | + ->addInlineJavascript('initPickFact("PLAC");'); |
|
| 103 | + break; |
|
| 104 | 104 | } |
| 105 | 105 | $controller->pageHeader(); |
| 106 | 106 | |
@@ -140,41 +140,41 @@ discard block |
||
| 140 | 140 | |
| 141 | 141 | // Show indi and hide the rest |
| 142 | 142 | if ($type == "indi") { |
| 143 | - echo '<div id="find-header"> |
|
| 143 | + echo '<div id="find-header"> |
|
| 144 | 144 | <form name="filterindi" method="get" onsubmit="return checknames(this);" action="find.php"> |
| 145 | 145 | <input type="hidden" name="callback" value="' . $callback . '"> |
| 146 | 146 | <input type="hidden" name="action" value="filter"> |
| 147 | 147 | <input type="hidden" name="type" value="indi"> |
| 148 | 148 | <span>', /* I18N: Label for search field */ I18N::translate('Name contains'), '</span> |
| 149 | 149 | <input type="text" name="filter" value="'; |
| 150 | - if ($filter) { |
|
| 151 | - echo $filter; |
|
| 152 | - } |
|
| 153 | - echo '" autofocus> |
|
| 150 | + if ($filter) { |
|
| 151 | + echo $filter; |
|
| 152 | + } |
|
| 153 | + echo '" autofocus> |
|
| 154 | 154 | <input type="submit" value="', I18N::translate('search'), '"> |
| 155 | 155 | </form></div>'; |
| 156 | 156 | } |
| 157 | 157 | |
| 158 | 158 | // Show fam and hide the rest |
| 159 | 159 | if ($type == "fam") { |
| 160 | - echo '<div id="find-header"> |
|
| 160 | + echo '<div id="find-header"> |
|
| 161 | 161 | <form name="filterfam" method="get" onsubmit="return checknames(this);" action="find.php"> |
| 162 | 162 | <input type="hidden" name="callback" value="' . $callback . '"> |
| 163 | 163 | <input type="hidden" name="action" value="filter"> |
| 164 | 164 | <input type="hidden" name="type" value="fam"> |
| 165 | 165 | <span>', I18N::translate('Name contains'), '</span> |
| 166 | 166 | <input type="text" name="filter" value="'; |
| 167 | - if ($filter) { |
|
| 168 | - echo $filter; |
|
| 169 | - } |
|
| 170 | - echo '" autofocus> |
|
| 167 | + if ($filter) { |
|
| 168 | + echo $filter; |
|
| 169 | + } |
|
| 170 | + echo '" autofocus> |
|
| 171 | 171 | <input type="submit" value="', I18N::translate('search'), '"> |
| 172 | 172 | </form></div>'; |
| 173 | 173 | } |
| 174 | 174 | |
| 175 | 175 | // Show media and hide the rest |
| 176 | 176 | if ($type == 'media') { |
| 177 | - echo '<div id="find-header"> |
|
| 177 | + echo '<div id="find-header"> |
|
| 178 | 178 | <form name="filtermedia" method="get" action="find.php"> |
| 179 | 179 | <input type="hidden" name="choose" value="', $choose, '"> |
| 180 | 180 | <input type="hidden" name="action" value="filter"> |
@@ -183,17 +183,17 @@ discard block |
||
| 183 | 183 | <input type="hidden" name="subclick"> |
| 184 | 184 | <span>', /* I18N: Label for search field */ I18N::translate('Media contains'), '</span> |
| 185 | 185 | <input type="text" name="filter" value="'; |
| 186 | - if ($filter) { |
|
| 187 | - echo $filter; |
|
| 188 | - } |
|
| 189 | - echo '" autofocus>', |
|
| 190 | - '<p><input type="submit" name="search" value="', I18N::translate('search'), '" onclick="this.form.subclick.value=this.name"> |
|
| 186 | + if ($filter) { |
|
| 187 | + echo $filter; |
|
| 188 | + } |
|
| 189 | + echo '" autofocus>', |
|
| 190 | + '<p><input type="submit" name="search" value="', I18N::translate('search'), '" onclick="this.form.subclick.value=this.name"> |
|
| 191 | 191 | </p></form></div>'; |
| 192 | 192 | } |
| 193 | 193 | |
| 194 | 194 | // Show place and hide the rest |
| 195 | 195 | if ($type == "place") { |
| 196 | - echo '<div id="find-header"> |
|
| 196 | + echo '<div id="find-header"> |
|
| 197 | 197 | <form name="filterplace" method="get" action="find.php"> |
| 198 | 198 | <input type="hidden" name="action" value="filter"> |
| 199 | 199 | <input type="hidden" name="type" value="place"> |
@@ -201,17 +201,17 @@ discard block |
||
| 201 | 201 | <input type="hidden" name="subclick"> |
| 202 | 202 | <span>', /* I18N: Label for search field */ I18N::translate('Place contains'), '</span> |
| 203 | 203 | <input type="text" name="filter" value="'; |
| 204 | - if ($filter) { |
|
| 205 | - echo $filter; |
|
| 206 | - } |
|
| 207 | - echo '" autofocus> |
|
| 204 | + if ($filter) { |
|
| 205 | + echo $filter; |
|
| 206 | + } |
|
| 207 | + echo '" autofocus> |
|
| 208 | 208 | <p><input type="submit" name="search" value="', I18N::translate('search'), '" onclick="this.form.subclick.value=this.name"> |
| 209 | 209 | </p></form></div>'; |
| 210 | 210 | } |
| 211 | 211 | |
| 212 | 212 | // Show repo and hide the rest |
| 213 | 213 | if ($type == "repo") { |
| 214 | - echo '<div id="find-header"> |
|
| 214 | + echo '<div id="find-header"> |
|
| 215 | 215 | <form name="filterrepo" method="get" action="find.php"> |
| 216 | 216 | <input type="hidden" name="action" value="filter"> |
| 217 | 217 | <input type="hidden" name="type" value="repo"> |
@@ -219,10 +219,10 @@ discard block |
||
| 219 | 219 | <input type="hidden" name="subclick"> |
| 220 | 220 | <span>', /* I18N: Label for search field */ I18N::translate('Repository contains'), '</span> |
| 221 | 221 | <input type="text" name="filter" value="'; |
| 222 | - if ($filter) { |
|
| 223 | - echo $filter; |
|
| 224 | - } |
|
| 225 | - echo '" autofocus> |
|
| 222 | + if ($filter) { |
|
| 223 | + echo $filter; |
|
| 224 | + } |
|
| 225 | + echo '" autofocus> |
|
| 226 | 226 | <p><input type="submit" name="search" value="', I18N::translate('search'), '" onclick="this.form.subclick.value=this.name"> |
| 227 | 227 | </td></tr></table> |
| 228 | 228 | </p></form></div>'; |
@@ -230,7 +230,7 @@ discard block |
||
| 230 | 230 | |
| 231 | 231 | // Show Shared Notes and hide the rest |
| 232 | 232 | if ($type == "note") { |
| 233 | - echo '<div id="find-header"> |
|
| 233 | + echo '<div id="find-header"> |
|
| 234 | 234 | <form name="filternote" method="get" action="find.php"> |
| 235 | 235 | <input type="hidden" name="action" value="filter"> |
| 236 | 236 | <input type="hidden" name="type" value="note"> |
@@ -238,17 +238,17 @@ discard block |
||
| 238 | 238 | <input type="hidden" name="subclick"> |
| 239 | 239 | <span>', /* I18N: Label for search field */ I18N::translate('Shared note contains'), '</span> |
| 240 | 240 | <input type="text" name="filter" value="'; |
| 241 | - if ($filter) { |
|
| 242 | - echo $filter; |
|
| 243 | - } |
|
| 244 | - echo '" autofocus> |
|
| 241 | + if ($filter) { |
|
| 242 | + echo $filter; |
|
| 243 | + } |
|
| 244 | + echo '" autofocus> |
|
| 245 | 245 | <p><input type="submit" name="search" value="', I18N::translate('search'), '" onclick="this.form.subclick.value=this.name"> |
| 246 | 246 | </p></form></div>'; |
| 247 | 247 | } |
| 248 | 248 | |
| 249 | 249 | // Show source and hide the rest |
| 250 | 250 | if ($type == "source") { |
| 251 | - echo '<div id="find-header"> |
|
| 251 | + echo '<div id="find-header"> |
|
| 252 | 252 | <form name="filtersource" method="get" action="find.php"> |
| 253 | 253 | <input type="hidden" name="action" value="filter"> |
| 254 | 254 | <input type="hidden" name="type" value="source"> |
@@ -256,43 +256,43 @@ discard block |
||
| 256 | 256 | <input type="hidden" name="subclick"> |
| 257 | 257 | <span>', /* I18N: Label for search field */ I18N::translate('Source contains'), '</span> |
| 258 | 258 | <input type="text" name="filter" value="'; |
| 259 | - if ($filter) { |
|
| 260 | - echo $filter; |
|
| 261 | - } |
|
| 262 | - echo '" autofocus> |
|
| 259 | + if ($filter) { |
|
| 260 | + echo $filter; |
|
| 261 | + } |
|
| 262 | + echo '" autofocus> |
|
| 263 | 263 | <p><input type="submit" name="search" value="', I18N::translate('search'), '" onclick="this.form.subclick.value=this.name"> |
| 264 | 264 | </p></form></div>'; |
| 265 | 265 | } |
| 266 | 266 | |
| 267 | 267 | // Show specialchar and hide the rest |
| 268 | 268 | if ($type == 'specialchar') { |
| 269 | - $language_filter = Filter::get('language_filter', null, Auth::user()->getPreference('default_language_filter')); |
|
| 270 | - $specialchar_languages = SpecialChars::allLanguages(); |
|
| 271 | - if (!array_key_exists($language_filter, $specialchar_languages)) { |
|
| 272 | - $language_filter = 'en'; |
|
| 273 | - } |
|
| 274 | - Auth::user()->setPreference('default_language_filter', $language_filter); |
|
| 275 | - $action = 'filter'; |
|
| 276 | - echo '<div id="find-header"> |
|
| 269 | + $language_filter = Filter::get('language_filter', null, Auth::user()->getPreference('default_language_filter')); |
|
| 270 | + $specialchar_languages = SpecialChars::allLanguages(); |
|
| 271 | + if (!array_key_exists($language_filter, $specialchar_languages)) { |
|
| 272 | + $language_filter = 'en'; |
|
| 273 | + } |
|
| 274 | + Auth::user()->setPreference('default_language_filter', $language_filter); |
|
| 275 | + $action = 'filter'; |
|
| 276 | + echo '<div id="find-header"> |
|
| 277 | 277 | <form name="filterspecialchar" method="get" action="find.php"> |
| 278 | 278 | <input type="hidden" name="action" value="filter"> |
| 279 | 279 | <input type="hidden" name="type" value="specialchar"> |
| 280 | 280 | <input type="hidden" name="callback" value="' . $callback . '"> |
| 281 | 281 | <p><select id="language_filter" name="language_filter" onchange="submit();">'; |
| 282 | - foreach (SpecialChars::allLanguages() as $lanuguage_tag => $language_name) { |
|
| 283 | - echo '<option value="' . $lanuguage_tag . '" '; |
|
| 284 | - if ($lanuguage_tag === $language_filter) { |
|
| 285 | - echo 'selected'; |
|
| 286 | - } |
|
| 287 | - echo '>', $language_name, '</option>'; |
|
| 288 | - } |
|
| 289 | - echo '</select> |
|
| 282 | + foreach (SpecialChars::allLanguages() as $lanuguage_tag => $language_name) { |
|
| 283 | + echo '<option value="' . $lanuguage_tag . '" '; |
|
| 284 | + if ($lanuguage_tag === $language_filter) { |
|
| 285 | + echo 'selected'; |
|
| 286 | + } |
|
| 287 | + echo '>', $language_name, '</option>'; |
|
| 288 | + } |
|
| 289 | + echo '</select> |
|
| 290 | 290 | </p></form></div>'; |
| 291 | 291 | } |
| 292 | 292 | |
| 293 | 293 | // Show facts |
| 294 | 294 | if ($type == "factINDI" || $type == "factFAM" || $type == "factSOUR" || $type == "factREPO" || $type == "factNAME" || $type == "factPLAC") { |
| 295 | - echo '<div id="find-facts-header"> |
|
| 295 | + echo '<div id="find-facts-header"> |
|
| 296 | 296 | <form name="filterfacts" method="get" action="find.php" |
| 297 | 297 | input type="hidden" name="type" value="facts"> |
| 298 | 298 | <input type="hidden" name="tags" value="', $qs, '"> |
@@ -300,18 +300,18 @@ discard block |
||
| 300 | 300 | <table class="list_table width100" border="0"> |
| 301 | 301 | <tr><td class="list_label" style="padding: 5px; font-weight: normal; white-space: normal;">'; |
| 302 | 302 | |
| 303 | - $all = strlen($qs) ? explode(',', strtoupper($qs)) : array(); |
|
| 304 | - $preselDefault = array(); |
|
| 305 | - $preselCustom = array(); |
|
| 306 | - foreach ($all as $one) { |
|
| 307 | - if (GedcomTag::isTag($one)) { |
|
| 308 | - $preselDefault[] = $one; |
|
| 309 | - } else { |
|
| 310 | - $preselCustom[] = $one; |
|
| 311 | - } |
|
| 312 | - } |
|
| 313 | - |
|
| 314 | - echo '<script>'; ?> |
|
| 303 | + $all = strlen($qs) ? explode(',', strtoupper($qs)) : array(); |
|
| 304 | + $preselDefault = array(); |
|
| 305 | + $preselCustom = array(); |
|
| 306 | + foreach ($all as $one) { |
|
| 307 | + if (GedcomTag::isTag($one)) { |
|
| 308 | + $preselDefault[] = $one; |
|
| 309 | + } else { |
|
| 310 | + $preselCustom[] = $one; |
|
| 311 | + } |
|
| 312 | + } |
|
| 313 | + |
|
| 314 | + echo '<script>'; ?> |
|
| 315 | 315 | // A class representing a default tag |
| 316 | 316 | function DefaultTag(id, name, selected) { |
| 317 | 317 | this.Id=id; |
@@ -402,81 +402,81 @@ discard block |
||
| 402 | 402 | switch (factType) { |
| 403 | 403 | case "INDI": |
| 404 | 404 | DefaultTags=[<?php |
| 405 | - $firstFact = true; |
|
| 406 | - foreach (GedcomTag::getPicklistFacts('INDI') as $factId => $factName) { |
|
| 407 | - if ($firstFact) { |
|
| 408 | - $firstFact = false; |
|
| 409 | - } else { |
|
| 410 | - echo ','; |
|
| 411 | - } |
|
| 412 | - echo 'new DefaultTag("' . addslashes($factId) . '","' . addslashes($factName) . '",preselectedDefaultTags.indexOf("\\x01' . addslashes($factId) . '\\x01")>=0)'; |
|
| 413 | - } |
|
| 414 | - ?>]; |
|
| 405 | + $firstFact = true; |
|
| 406 | + foreach (GedcomTag::getPicklistFacts('INDI') as $factId => $factName) { |
|
| 407 | + if ($firstFact) { |
|
| 408 | + $firstFact = false; |
|
| 409 | + } else { |
|
| 410 | + echo ','; |
|
| 411 | + } |
|
| 412 | + echo 'new DefaultTag("' . addslashes($factId) . '","' . addslashes($factName) . '",preselectedDefaultTags.indexOf("\\x01' . addslashes($factId) . '\\x01")>=0)'; |
|
| 413 | + } |
|
| 414 | + ?>]; |
|
| 415 | 415 | break; |
| 416 | 416 | case "FAM": |
| 417 | 417 | DefaultTags=[<?php |
| 418 | - $firstFact = true; |
|
| 419 | - foreach (GedcomTag::getPicklistFacts('FAM') as $factId => $factName) { |
|
| 420 | - if ($firstFact) { |
|
| 421 | - $firstFact = false; |
|
| 422 | - } else { |
|
| 423 | - echo ','; |
|
| 424 | - } |
|
| 425 | - echo 'new DefaultTag("' . addslashes($factId) . '","' . addslashes($factName) . '",preselectedDefaultTags.indexOf("\\x01' . addslashes($factId) . '\\x01")>=0)'; |
|
| 426 | - } |
|
| 427 | - ?>]; |
|
| 418 | + $firstFact = true; |
|
| 419 | + foreach (GedcomTag::getPicklistFacts('FAM') as $factId => $factName) { |
|
| 420 | + if ($firstFact) { |
|
| 421 | + $firstFact = false; |
|
| 422 | + } else { |
|
| 423 | + echo ','; |
|
| 424 | + } |
|
| 425 | + echo 'new DefaultTag("' . addslashes($factId) . '","' . addslashes($factName) . '",preselectedDefaultTags.indexOf("\\x01' . addslashes($factId) . '\\x01")>=0)'; |
|
| 426 | + } |
|
| 427 | + ?>]; |
|
| 428 | 428 | break; |
| 429 | 429 | case "SOUR": |
| 430 | 430 | DefaultTags=[<?php |
| 431 | - $firstFact = true; |
|
| 432 | - foreach (GedcomTag::getPicklistFacts('SOUR') as $factId => $factName) { |
|
| 433 | - if ($firstFact) { |
|
| 434 | - $firstFact = false; |
|
| 435 | - } else { |
|
| 436 | - echo ','; |
|
| 437 | - } |
|
| 438 | - echo 'new DefaultTag("' . addslashes($factId) . '","' . addslashes($factName) . '",preselectedDefaultTags.indexOf("\\x01' . addslashes($factId) . '\\x01")>=0)'; |
|
| 439 | - } |
|
| 440 | - ?>]; |
|
| 431 | + $firstFact = true; |
|
| 432 | + foreach (GedcomTag::getPicklistFacts('SOUR') as $factId => $factName) { |
|
| 433 | + if ($firstFact) { |
|
| 434 | + $firstFact = false; |
|
| 435 | + } else { |
|
| 436 | + echo ','; |
|
| 437 | + } |
|
| 438 | + echo 'new DefaultTag("' . addslashes($factId) . '","' . addslashes($factName) . '",preselectedDefaultTags.indexOf("\\x01' . addslashes($factId) . '\\x01")>=0)'; |
|
| 439 | + } |
|
| 440 | + ?>]; |
|
| 441 | 441 | break; |
| 442 | 442 | case "REPO": |
| 443 | 443 | DefaultTags=[<?php |
| 444 | - $firstFact = true; |
|
| 445 | - foreach (GedcomTag::getPicklistFacts('REPO') as $factId => $factName) { |
|
| 446 | - if ($firstFact) { |
|
| 447 | - $firstFact = false; |
|
| 448 | - } else { |
|
| 449 | - echo ','; |
|
| 450 | - } |
|
| 451 | - echo 'new DefaultTag("' . addslashes($factId) . '","' . addslashes($factName) . '",preselectedDefaultTags.indexOf("\\x01' . addslashes($factId) . '\\x01")>=0)'; |
|
| 452 | - } |
|
| 453 | - ?>]; |
|
| 444 | + $firstFact = true; |
|
| 445 | + foreach (GedcomTag::getPicklistFacts('REPO') as $factId => $factName) { |
|
| 446 | + if ($firstFact) { |
|
| 447 | + $firstFact = false; |
|
| 448 | + } else { |
|
| 449 | + echo ','; |
|
| 450 | + } |
|
| 451 | + echo 'new DefaultTag("' . addslashes($factId) . '","' . addslashes($factName) . '",preselectedDefaultTags.indexOf("\\x01' . addslashes($factId) . '\\x01")>=0)'; |
|
| 452 | + } |
|
| 453 | + ?>]; |
|
| 454 | 454 | break; |
| 455 | 455 | case "PLAC": |
| 456 | 456 | DefaultTags=[<?php |
| 457 | - $firstFact = true; |
|
| 458 | - foreach (GedcomTag::getPicklistFacts('PLAC') as $factId => $factName) { |
|
| 459 | - if ($firstFact) { |
|
| 460 | - $firstFact = false; |
|
| 461 | - } else { |
|
| 462 | - echo ','; |
|
| 463 | - } |
|
| 464 | - echo 'new DefaultTag("' . addslashes($factId) . '","' . addslashes($factName) . '",preselectedDefaultTags.indexOf("\\x01' . addslashes($factId) . '\\x01")>=0)'; |
|
| 465 | - } |
|
| 466 | - ?>]; |
|
| 457 | + $firstFact = true; |
|
| 458 | + foreach (GedcomTag::getPicklistFacts('PLAC') as $factId => $factName) { |
|
| 459 | + if ($firstFact) { |
|
| 460 | + $firstFact = false; |
|
| 461 | + } else { |
|
| 462 | + echo ','; |
|
| 463 | + } |
|
| 464 | + echo 'new DefaultTag("' . addslashes($factId) . '","' . addslashes($factName) . '",preselectedDefaultTags.indexOf("\\x01' . addslashes($factId) . '\\x01")>=0)'; |
|
| 465 | + } |
|
| 466 | + ?>]; |
|
| 467 | 467 | break; |
| 468 | 468 | case "NAME": |
| 469 | 469 | DefaultTags=[<?php |
| 470 | - $firstFact = true; |
|
| 471 | - foreach (GedcomTag::getPicklistFacts('NAME') as $factId => $factName) { |
|
| 472 | - if ($firstFact) { |
|
| 473 | - $firstFact = false; |
|
| 474 | - } else { |
|
| 475 | - echo ','; |
|
| 476 | - } |
|
| 477 | - echo 'new DefaultTag("' . addslashes($factId) . '","' . addslashes($factName) . '",preselectedDefaultTags.indexOf("\\x01' . addslashes($factId) . '\\x01")>=0)'; |
|
| 478 | - } |
|
| 479 | - ?>]; |
|
| 470 | + $firstFact = true; |
|
| 471 | + foreach (GedcomTag::getPicklistFacts('NAME') as $factId => $factName) { |
|
| 472 | + if ($firstFact) { |
|
| 473 | + $firstFact = false; |
|
| 474 | + } else { |
|
| 475 | + echo ','; |
|
| 476 | + } |
|
| 477 | + echo 'new DefaultTag("' . addslashes($factId) . '","' . addslashes($factName) . '",preselectedDefaultTags.indexOf("\\x01' . addslashes($factId) . '\\x01")>=0)'; |
|
| 478 | + } |
|
| 479 | + ?>]; |
|
| 480 | 480 | break; |
| 481 | 481 | default: |
| 482 | 482 | DefaultTags=[]; |
@@ -513,7 +513,7 @@ discard block |
||
| 513 | 513 | return false; |
| 514 | 514 | } |
| 515 | 515 | <?php echo '</script>'; |
| 516 | - echo '<div id="layDefinedTags"><table id="tabDefinedTags"> |
|
| 516 | + echo '<div id="layDefinedTags"><table id="tabDefinedTags"> |
|
| 517 | 517 | <thead><tr> |
| 518 | 518 | <th></th> |
| 519 | 519 | <th>', I18N::translate('Tag'), '</th> |
@@ -541,221 +541,221 @@ discard block |
||
| 541 | 541 | } |
| 542 | 542 | |
| 543 | 543 | if ($action === 'filter') { |
| 544 | - $filter = trim($filter); |
|
| 545 | - $filter_array = explode(' ', preg_replace('/ {2,}/', ' ', $filter)); |
|
| 546 | - |
|
| 547 | - // Output Individual |
|
| 548 | - if ($type === 'indi') { |
|
| 549 | - echo '<div id="find-output">'; |
|
| 550 | - $myindilist = FunctionsDb::searchIndividualNames($filter_array, array($WT_TREE)); |
|
| 551 | - if ($myindilist) { |
|
| 552 | - echo '<ul>'; |
|
| 553 | - usort($myindilist, '\Fisharebest\Webtrees\GedcomRecord::compare'); |
|
| 554 | - foreach ($myindilist as $indi) { |
|
| 555 | - echo $indi->formatList('li', true); |
|
| 556 | - } |
|
| 557 | - echo '</ul> |
|
| 544 | + $filter = trim($filter); |
|
| 545 | + $filter_array = explode(' ', preg_replace('/ {2,}/', ' ', $filter)); |
|
| 546 | + |
|
| 547 | + // Output Individual |
|
| 548 | + if ($type === 'indi') { |
|
| 549 | + echo '<div id="find-output">'; |
|
| 550 | + $myindilist = FunctionsDb::searchIndividualNames($filter_array, array($WT_TREE)); |
|
| 551 | + if ($myindilist) { |
|
| 552 | + echo '<ul>'; |
|
| 553 | + usort($myindilist, '\Fisharebest\Webtrees\GedcomRecord::compare'); |
|
| 554 | + foreach ($myindilist as $indi) { |
|
| 555 | + echo $indi->formatList('li', true); |
|
| 556 | + } |
|
| 557 | + echo '</ul> |
|
| 558 | 558 | <p>', I18N::translate('Total individuals: %s', count($myindilist)), '</p>'; |
| 559 | - } else { |
|
| 560 | - echo '<p>', I18N::translate('No results found.'), '</p>'; |
|
| 561 | - } |
|
| 562 | - echo '</div>'; |
|
| 563 | - } |
|
| 564 | - |
|
| 565 | - // Output Family |
|
| 566 | - if ($type == "fam") { |
|
| 567 | - echo '<div id="find-output">'; |
|
| 568 | - // Get the famrecs with hits on names from the family table |
|
| 569 | - // Get the famrecs with hits in the gedcom record from the family table |
|
| 570 | - $myfamlist = array_unique(array_merge( |
|
| 571 | - FunctionsDb::searchFamilyNames($filter_array, array($WT_TREE)), |
|
| 572 | - FunctionsDb::searchFamilies($filter_array, array($WT_TREE)) |
|
| 573 | - )); |
|
| 574 | - |
|
| 575 | - if ($myfamlist) { |
|
| 576 | - echo '<ul>'; |
|
| 577 | - usort($myfamlist, '\Fisharebest\Webtrees\GedcomRecord::compare'); |
|
| 578 | - foreach ($myfamlist as $family) { |
|
| 579 | - echo $family->formatList('li', true); |
|
| 580 | - } |
|
| 581 | - echo '</ul> |
|
| 559 | + } else { |
|
| 560 | + echo '<p>', I18N::translate('No results found.'), '</p>'; |
|
| 561 | + } |
|
| 562 | + echo '</div>'; |
|
| 563 | + } |
|
| 564 | + |
|
| 565 | + // Output Family |
|
| 566 | + if ($type == "fam") { |
|
| 567 | + echo '<div id="find-output">'; |
|
| 568 | + // Get the famrecs with hits on names from the family table |
|
| 569 | + // Get the famrecs with hits in the gedcom record from the family table |
|
| 570 | + $myfamlist = array_unique(array_merge( |
|
| 571 | + FunctionsDb::searchFamilyNames($filter_array, array($WT_TREE)), |
|
| 572 | + FunctionsDb::searchFamilies($filter_array, array($WT_TREE)) |
|
| 573 | + )); |
|
| 574 | + |
|
| 575 | + if ($myfamlist) { |
|
| 576 | + echo '<ul>'; |
|
| 577 | + usort($myfamlist, '\Fisharebest\Webtrees\GedcomRecord::compare'); |
|
| 578 | + foreach ($myfamlist as $family) { |
|
| 579 | + echo $family->formatList('li', true); |
|
| 580 | + } |
|
| 581 | + echo '</ul> |
|
| 582 | 582 | <p>', I18N::translate('Total families: %s', count($myfamlist)), '</p>'; |
| 583 | - } else { |
|
| 584 | - echo '<p>', I18N::translate('No results found.'), '</p>'; |
|
| 585 | - } |
|
| 586 | - echo '</div>'; |
|
| 587 | - } |
|
| 588 | - |
|
| 589 | - // Output Media |
|
| 590 | - if ($type === 'media') { |
|
| 591 | - $medialist = QueryMedia::mediaList('', 'include', 'title', $filter, ''); |
|
| 592 | - |
|
| 593 | - echo '<div id="find-output">'; |
|
| 594 | - |
|
| 595 | - if ($medialist) { |
|
| 596 | - foreach ($medialist as $media) { |
|
| 597 | - echo '<div class="find-media-media">'; |
|
| 598 | - echo '<div class="find-media-thumb">', $media->displayImage(), '</div>'; |
|
| 599 | - echo '<div class="find-media-details">', $media->getFullName(), '</div>'; |
|
| 600 | - if (!$embed) { |
|
| 601 | - echo '<p><a href="#" dir="auto" onclick="pasteid(\'', $media->getXref(), '\');">', $media->getFilename(), '</a></p>'; |
|
| 602 | - } else { |
|
| 603 | - echo '<p><a href="#" dir="auto" onclick="pasteid(\'', $media->getXref(), '\', \'', '\', \'', Filter::escapeJs($media->getFilename()), '\');">', Filter::escapeHtml($media->getFilename()), '</a></p> '; |
|
| 604 | - } |
|
| 605 | - if ($media->fileExists()) { |
|
| 606 | - $imgsize = $media->getImageAttributes(); |
|
| 607 | - echo GedcomTag::getLabelValue('__IMAGE_SIZE__', $imgsize['WxH']); |
|
| 608 | - } |
|
| 609 | - echo '<ul>'; |
|
| 610 | - $found = false; |
|
| 611 | - foreach ($media->linkedIndividuals('OBJE') as $indindividual) { |
|
| 612 | - echo '<li>', $indindividual->getFullName(), '</li>'; |
|
| 613 | - $found = true; |
|
| 614 | - } |
|
| 615 | - foreach ($media->linkedFamilies('OBJE') as $family) { |
|
| 616 | - echo '<li>', $family->getFullName(), '</li>'; |
|
| 617 | - $found = true; |
|
| 618 | - } |
|
| 619 | - foreach ($media->linkedSources('OBJE') as $source) { |
|
| 620 | - echo '<li>', $source->getFullName(), '</li>'; |
|
| 621 | - $found = true; |
|
| 622 | - } |
|
| 623 | - foreach ($media->linkedNotes('OBJE') as $note) { |
|
| 624 | - // Invalid GEDCOM - you cannot link a NOTE to an OBJE |
|
| 625 | - echo '<li>', $note->getFullName(), '</li>'; |
|
| 626 | - $found = true; |
|
| 627 | - } |
|
| 628 | - foreach ($media->linkedRepositories('OBJE') as $repository) { |
|
| 629 | - // Invalid GEDCOM - you cannot link a REPO to an OBJE |
|
| 630 | - echo '<li>', $repository->getFullName(), '</li>'; |
|
| 631 | - $found = true; |
|
| 632 | - } |
|
| 633 | - if (!$found) { |
|
| 634 | - echo '<li>', I18N::translate('This media object is not linked to any other record.'), '</li>'; |
|
| 635 | - } |
|
| 636 | - echo '</ul>'; |
|
| 637 | - echo '</div>'; // close div="find-media-media" |
|
| 638 | - } |
|
| 639 | - } else { |
|
| 640 | - echo '<p>', I18N::translate('No results found.'), '</p>'; |
|
| 641 | - } |
|
| 642 | - echo '</div>'; |
|
| 643 | - } |
|
| 644 | - |
|
| 645 | - // Output Places |
|
| 646 | - if ($type == "place") { |
|
| 647 | - echo '<div id="find-output">'; |
|
| 648 | - if (!$filter || $all) { |
|
| 649 | - $places = Place::allPlaces($WT_TREE); |
|
| 650 | - } else { |
|
| 651 | - $places = Place::findPlaces($filter, $WT_TREE); |
|
| 652 | - } |
|
| 653 | - if ($places) { |
|
| 654 | - echo '<ul>'; |
|
| 655 | - foreach ($places as $place) { |
|
| 656 | - echo '<li><a href="#" onclick="pasteid(\'', Filter::escapeJs($place->getGedcomName()), '\');">'; |
|
| 657 | - if (!$filter || $all) { |
|
| 658 | - echo $place->getReverseName(); // When displaying all names, sort/display by the country, then region, etc. |
|
| 659 | - } else { |
|
| 660 | - echo $place->getFullName(); // When we’ve searched for a place, sort by this place |
|
| 661 | - } |
|
| 662 | - echo '</a></li>'; |
|
| 663 | - } |
|
| 664 | - echo '</ul> |
|
| 583 | + } else { |
|
| 584 | + echo '<p>', I18N::translate('No results found.'), '</p>'; |
|
| 585 | + } |
|
| 586 | + echo '</div>'; |
|
| 587 | + } |
|
| 588 | + |
|
| 589 | + // Output Media |
|
| 590 | + if ($type === 'media') { |
|
| 591 | + $medialist = QueryMedia::mediaList('', 'include', 'title', $filter, ''); |
|
| 592 | + |
|
| 593 | + echo '<div id="find-output">'; |
|
| 594 | + |
|
| 595 | + if ($medialist) { |
|
| 596 | + foreach ($medialist as $media) { |
|
| 597 | + echo '<div class="find-media-media">'; |
|
| 598 | + echo '<div class="find-media-thumb">', $media->displayImage(), '</div>'; |
|
| 599 | + echo '<div class="find-media-details">', $media->getFullName(), '</div>'; |
|
| 600 | + if (!$embed) { |
|
| 601 | + echo '<p><a href="#" dir="auto" onclick="pasteid(\'', $media->getXref(), '\');">', $media->getFilename(), '</a></p>'; |
|
| 602 | + } else { |
|
| 603 | + echo '<p><a href="#" dir="auto" onclick="pasteid(\'', $media->getXref(), '\', \'', '\', \'', Filter::escapeJs($media->getFilename()), '\');">', Filter::escapeHtml($media->getFilename()), '</a></p> '; |
|
| 604 | + } |
|
| 605 | + if ($media->fileExists()) { |
|
| 606 | + $imgsize = $media->getImageAttributes(); |
|
| 607 | + echo GedcomTag::getLabelValue('__IMAGE_SIZE__', $imgsize['WxH']); |
|
| 608 | + } |
|
| 609 | + echo '<ul>'; |
|
| 610 | + $found = false; |
|
| 611 | + foreach ($media->linkedIndividuals('OBJE') as $indindividual) { |
|
| 612 | + echo '<li>', $indindividual->getFullName(), '</li>'; |
|
| 613 | + $found = true; |
|
| 614 | + } |
|
| 615 | + foreach ($media->linkedFamilies('OBJE') as $family) { |
|
| 616 | + echo '<li>', $family->getFullName(), '</li>'; |
|
| 617 | + $found = true; |
|
| 618 | + } |
|
| 619 | + foreach ($media->linkedSources('OBJE') as $source) { |
|
| 620 | + echo '<li>', $source->getFullName(), '</li>'; |
|
| 621 | + $found = true; |
|
| 622 | + } |
|
| 623 | + foreach ($media->linkedNotes('OBJE') as $note) { |
|
| 624 | + // Invalid GEDCOM - you cannot link a NOTE to an OBJE |
|
| 625 | + echo '<li>', $note->getFullName(), '</li>'; |
|
| 626 | + $found = true; |
|
| 627 | + } |
|
| 628 | + foreach ($media->linkedRepositories('OBJE') as $repository) { |
|
| 629 | + // Invalid GEDCOM - you cannot link a REPO to an OBJE |
|
| 630 | + echo '<li>', $repository->getFullName(), '</li>'; |
|
| 631 | + $found = true; |
|
| 632 | + } |
|
| 633 | + if (!$found) { |
|
| 634 | + echo '<li>', I18N::translate('This media object is not linked to any other record.'), '</li>'; |
|
| 635 | + } |
|
| 636 | + echo '</ul>'; |
|
| 637 | + echo '</div>'; // close div="find-media-media" |
|
| 638 | + } |
|
| 639 | + } else { |
|
| 640 | + echo '<p>', I18N::translate('No results found.'), '</p>'; |
|
| 641 | + } |
|
| 642 | + echo '</div>'; |
|
| 643 | + } |
|
| 644 | + |
|
| 645 | + // Output Places |
|
| 646 | + if ($type == "place") { |
|
| 647 | + echo '<div id="find-output">'; |
|
| 648 | + if (!$filter || $all) { |
|
| 649 | + $places = Place::allPlaces($WT_TREE); |
|
| 650 | + } else { |
|
| 651 | + $places = Place::findPlaces($filter, $WT_TREE); |
|
| 652 | + } |
|
| 653 | + if ($places) { |
|
| 654 | + echo '<ul>'; |
|
| 655 | + foreach ($places as $place) { |
|
| 656 | + echo '<li><a href="#" onclick="pasteid(\'', Filter::escapeJs($place->getGedcomName()), '\');">'; |
|
| 657 | + if (!$filter || $all) { |
|
| 658 | + echo $place->getReverseName(); // When displaying all names, sort/display by the country, then region, etc. |
|
| 659 | + } else { |
|
| 660 | + echo $place->getFullName(); // When we’ve searched for a place, sort by this place |
|
| 661 | + } |
|
| 662 | + echo '</a></li>'; |
|
| 663 | + } |
|
| 664 | + echo '</ul> |
|
| 665 | 665 | <p>', I18N::translate('Places found'), ' ', count($places), '</p>'; |
| 666 | - } else { |
|
| 667 | - echo '<p>', I18N::translate('No results found.'), '</p>'; |
|
| 668 | - } |
|
| 669 | - echo '</div>'; |
|
| 670 | - } |
|
| 671 | - |
|
| 672 | - // Output Repositories |
|
| 673 | - if ($type == "repo") { |
|
| 674 | - echo '<div id="find-output">'; |
|
| 675 | - if ($filter) { |
|
| 676 | - $repo_list = FunctionsDb::searchRepositories($filter_array, array($WT_TREE)); |
|
| 677 | - } else { |
|
| 678 | - $repo_list = FunctionsDb::getRepositoryList($WT_TREE); |
|
| 679 | - } |
|
| 680 | - if ($repo_list) { |
|
| 681 | - usort($repo_list, '\Fisharebest\Webtrees\GedcomRecord::compare'); |
|
| 682 | - echo '<ul>'; |
|
| 683 | - foreach ($repo_list as $repo) { |
|
| 684 | - echo '<li><a href="', $repo->getHtmlUrl(), '" onclick="pasteid(\'', $repo->getXref(), '\');"><span class="list_item">', $repo->getFullName(), '</span></a></li>'; |
|
| 685 | - } |
|
| 686 | - echo '</ul> |
|
| 666 | + } else { |
|
| 667 | + echo '<p>', I18N::translate('No results found.'), '</p>'; |
|
| 668 | + } |
|
| 669 | + echo '</div>'; |
|
| 670 | + } |
|
| 671 | + |
|
| 672 | + // Output Repositories |
|
| 673 | + if ($type == "repo") { |
|
| 674 | + echo '<div id="find-output">'; |
|
| 675 | + if ($filter) { |
|
| 676 | + $repo_list = FunctionsDb::searchRepositories($filter_array, array($WT_TREE)); |
|
| 677 | + } else { |
|
| 678 | + $repo_list = FunctionsDb::getRepositoryList($WT_TREE); |
|
| 679 | + } |
|
| 680 | + if ($repo_list) { |
|
| 681 | + usort($repo_list, '\Fisharebest\Webtrees\GedcomRecord::compare'); |
|
| 682 | + echo '<ul>'; |
|
| 683 | + foreach ($repo_list as $repo) { |
|
| 684 | + echo '<li><a href="', $repo->getHtmlUrl(), '" onclick="pasteid(\'', $repo->getXref(), '\');"><span class="list_item">', $repo->getFullName(), '</span></a></li>'; |
|
| 685 | + } |
|
| 686 | + echo '</ul> |
|
| 687 | 687 | <p>', I18N::translate('Repositories found'), " ", count($repo_list), '</p>'; |
| 688 | - } else { |
|
| 689 | - echo '<p>', I18N::translate('No results found.'), '</p>'; |
|
| 690 | - } |
|
| 691 | - echo '</div>'; |
|
| 692 | - } |
|
| 693 | - |
|
| 694 | - // Output Shared Notes |
|
| 695 | - if ($type == "note") { |
|
| 696 | - echo '<div id="find-output">'; |
|
| 697 | - if ($filter) { |
|
| 698 | - $mynotelist = FunctionsDb::searchNotes($filter_array, array($WT_TREE)); |
|
| 699 | - } else { |
|
| 700 | - $mynotelist = FunctionsDb::getNoteList($WT_TREE); |
|
| 701 | - } |
|
| 702 | - if ($mynotelist) { |
|
| 703 | - usort($mynotelist, '\Fisharebest\Webtrees\GedcomRecord::compare'); |
|
| 704 | - echo '<ul>'; |
|
| 705 | - foreach ($mynotelist as $note) { |
|
| 706 | - echo '<li><a href="', $note->getHtmlUrl(), '" onclick="pasteid(\'', $note->getXref(), '\');"><span class="list_item">', $note->getFullName(), '</span></a></li>'; |
|
| 707 | - } |
|
| 708 | - echo '</ul> |
|
| 688 | + } else { |
|
| 689 | + echo '<p>', I18N::translate('No results found.'), '</p>'; |
|
| 690 | + } |
|
| 691 | + echo '</div>'; |
|
| 692 | + } |
|
| 693 | + |
|
| 694 | + // Output Shared Notes |
|
| 695 | + if ($type == "note") { |
|
| 696 | + echo '<div id="find-output">'; |
|
| 697 | + if ($filter) { |
|
| 698 | + $mynotelist = FunctionsDb::searchNotes($filter_array, array($WT_TREE)); |
|
| 699 | + } else { |
|
| 700 | + $mynotelist = FunctionsDb::getNoteList($WT_TREE); |
|
| 701 | + } |
|
| 702 | + if ($mynotelist) { |
|
| 703 | + usort($mynotelist, '\Fisharebest\Webtrees\GedcomRecord::compare'); |
|
| 704 | + echo '<ul>'; |
|
| 705 | + foreach ($mynotelist as $note) { |
|
| 706 | + echo '<li><a href="', $note->getHtmlUrl(), '" onclick="pasteid(\'', $note->getXref(), '\');"><span class="list_item">', $note->getFullName(), '</span></a></li>'; |
|
| 707 | + } |
|
| 708 | + echo '</ul> |
|
| 709 | 709 | <p>', I18N::translate('Shared notes found'), ' ', count($mynotelist), '</p>'; |
| 710 | - } else { |
|
| 711 | - echo '<p>', I18N::translate('No results found.'), '</p>'; |
|
| 712 | - } |
|
| 713 | - echo '</div>'; |
|
| 714 | - } |
|
| 715 | - |
|
| 716 | - // Output Sources |
|
| 717 | - if ($type == "source") { |
|
| 718 | - echo '<div id="find-output">'; |
|
| 719 | - if ($filter) { |
|
| 720 | - $mysourcelist = FunctionsDb::searchSources($filter_array, array($WT_TREE)); |
|
| 721 | - } else { |
|
| 722 | - $mysourcelist = FunctionsDb::getSourceList($WT_TREE); |
|
| 723 | - } |
|
| 724 | - if ($mysourcelist) { |
|
| 725 | - usort($mysourcelist, '\Fisharebest\Webtrees\GedcomRecord::compare'); |
|
| 726 | - echo '<ul>'; |
|
| 727 | - foreach ($mysourcelist as $source) { |
|
| 728 | - echo '<li><a href="', $source->getHtmlUrl(), '" onclick="pasteid(\'', $source->getXref(), '\', \'', |
|
| 729 | - Filter::escapeJs($source->getFullName()), '\');"><span class="list_item">', |
|
| 730 | - $source->getFullName(), '</span></a></li>'; |
|
| 731 | - } |
|
| 732 | - echo '</ul> |
|
| 710 | + } else { |
|
| 711 | + echo '<p>', I18N::translate('No results found.'), '</p>'; |
|
| 712 | + } |
|
| 713 | + echo '</div>'; |
|
| 714 | + } |
|
| 715 | + |
|
| 716 | + // Output Sources |
|
| 717 | + if ($type == "source") { |
|
| 718 | + echo '<div id="find-output">'; |
|
| 719 | + if ($filter) { |
|
| 720 | + $mysourcelist = FunctionsDb::searchSources($filter_array, array($WT_TREE)); |
|
| 721 | + } else { |
|
| 722 | + $mysourcelist = FunctionsDb::getSourceList($WT_TREE); |
|
| 723 | + } |
|
| 724 | + if ($mysourcelist) { |
|
| 725 | + usort($mysourcelist, '\Fisharebest\Webtrees\GedcomRecord::compare'); |
|
| 726 | + echo '<ul>'; |
|
| 727 | + foreach ($mysourcelist as $source) { |
|
| 728 | + echo '<li><a href="', $source->getHtmlUrl(), '" onclick="pasteid(\'', $source->getXref(), '\', \'', |
|
| 729 | + Filter::escapeJs($source->getFullName()), '\');"><span class="list_item">', |
|
| 730 | + $source->getFullName(), '</span></a></li>'; |
|
| 731 | + } |
|
| 732 | + echo '</ul> |
|
| 733 | 733 | <p>', I18N::translate('Total sources: %s', count($mysourcelist)), '</p>'; |
| 734 | - } else { |
|
| 735 | - echo '<p>', I18N::translate('No results found.'), '</p>'; |
|
| 736 | - } |
|
| 737 | - echo '</div>'; |
|
| 738 | - } |
|
| 739 | - |
|
| 740 | - // Output Special Characters |
|
| 741 | - if ($type == "specialchar") { |
|
| 742 | - echo '<div id="find-output-special"><p>'; |
|
| 743 | - // lower case special characters |
|
| 744 | - foreach (SpecialChars::create($language_filter)->upper() as $special_character) { |
|
| 745 | - echo '<a class="largechars" href="#" onclick="return window.opener.paste_char(\'', $special_character, '\');">', $special_character, '</a> '; |
|
| 746 | - } |
|
| 747 | - echo '</p><p>'; |
|
| 748 | - //upper case special characters |
|
| 749 | - foreach (SpecialChars::create($language_filter)->lower() as $special_character) { |
|
| 750 | - echo '<a class="largechars" href="#" onclick="return window.opener.paste_char(\'', $special_character, '\');">', $special_character, '</a> '; |
|
| 751 | - } |
|
| 752 | - echo '</p><p>'; |
|
| 753 | - // other special characters (not letters) |
|
| 754 | - foreach (SpecialChars::create($language_filter)->other() as $special_character) { |
|
| 755 | - echo '<a class="largechars" href="#" onclick="return window.opener.paste_char(\'', $special_character, '\');">', $special_character, '</a> '; |
|
| 756 | - } |
|
| 757 | - echo '</p></div>'; |
|
| 758 | - } |
|
| 734 | + } else { |
|
| 735 | + echo '<p>', I18N::translate('No results found.'), '</p>'; |
|
| 736 | + } |
|
| 737 | + echo '</div>'; |
|
| 738 | + } |
|
| 739 | + |
|
| 740 | + // Output Special Characters |
|
| 741 | + if ($type == "specialchar") { |
|
| 742 | + echo '<div id="find-output-special"><p>'; |
|
| 743 | + // lower case special characters |
|
| 744 | + foreach (SpecialChars::create($language_filter)->upper() as $special_character) { |
|
| 745 | + echo '<a class="largechars" href="#" onclick="return window.opener.paste_char(\'', $special_character, '\');">', $special_character, '</a> '; |
|
| 746 | + } |
|
| 747 | + echo '</p><p>'; |
|
| 748 | + //upper case special characters |
|
| 749 | + foreach (SpecialChars::create($language_filter)->lower() as $special_character) { |
|
| 750 | + echo '<a class="largechars" href="#" onclick="return window.opener.paste_char(\'', $special_character, '\');">', $special_character, '</a> '; |
|
| 751 | + } |
|
| 752 | + echo '</p><p>'; |
|
| 753 | + // other special characters (not letters) |
|
| 754 | + foreach (SpecialChars::create($language_filter)->other() as $special_character) { |
|
| 755 | + echo '<a class="largechars" href="#" onclick="return window.opener.paste_char(\'', $special_character, '\');">', $special_character, '</a> '; |
|
| 756 | + } |
|
| 757 | + echo '</p></div>'; |
|
| 758 | + } |
|
| 759 | 759 | } |
| 760 | 760 | echo '<button onclick="window.close();">', I18N::translate('close'), '</button>'; |
| 761 | 761 | echo "</div>"; |
@@ -23,9 +23,9 @@ |
||
| 23 | 23 | |
| 24 | 24 | $controller = new SearchController; |
| 25 | 25 | $controller |
| 26 | - ->pageHeader() |
|
| 27 | - ->addExternalJavascript(WT_AUTOCOMPLETE_JS_URL) |
|
| 28 | - ->addInlineJavascript('autocomplete();'); |
|
| 26 | + ->pageHeader() |
|
| 27 | + ->addExternalJavascript(WT_AUTOCOMPLETE_JS_URL) |
|
| 28 | + ->addInlineJavascript('autocomplete();'); |
|
| 29 | 29 | |
| 30 | 30 | ?> |
| 31 | 31 | <script> |
@@ -30,9 +30,9 @@ discard block |
||
| 30 | 30 | |
| 31 | 31 | $controller = new PageController; |
| 32 | 32 | $controller |
| 33 | - ->restrictAccess(Auth::isManager($WT_TREE)) |
|
| 34 | - ->setPageTitle(I18N::translate('Merge family trees')) |
|
| 35 | - ->pageHeader(); |
|
| 33 | + ->restrictAccess(Auth::isManager($WT_TREE)) |
|
| 34 | + ->setPageTitle(I18N::translate('Merge family trees')) |
|
| 35 | + ->pageHeader(); |
|
| 36 | 36 | |
| 37 | 37 | ?> |
| 38 | 38 | <ol class="breadcrumb small"> |
@@ -49,157 +49,157 @@ discard block |
||
| 49 | 49 | $tree2_id = Filter::post('tree2_id'); |
| 50 | 50 | |
| 51 | 51 | if ($tree1_id && $tree2_id != $tree1_id) { |
| 52 | - // Every XREF used by both trees |
|
| 53 | - $xrefs = Database::prepare( |
|
| 54 | - "SELECT xref, type FROM (" . |
|
| 55 | - " SELECT i_id AS xref, 'INDI' AS type FROM `##individuals` WHERE i_file = ?" . |
|
| 56 | - " UNION " . |
|
| 57 | - " SELECT f_id AS xref, 'FAM' AS type FROM `##families` WHERE f_file = ?" . |
|
| 58 | - " UNION " . |
|
| 59 | - " SELECT s_id AS xref, 'SOUR' AS type FROM `##sources` WHERE s_file = ?" . |
|
| 60 | - " UNION " . |
|
| 61 | - " SELECT m_id AS xref, 'OBJE' AS type FROM `##media` WHERE m_file = ?" . |
|
| 62 | - " UNION " . |
|
| 63 | - " SELECT o_id AS xref, o_type AS type FROM `##other` WHERE o_file = ? AND o_type NOT IN ('HEAD', 'TRLR')" . |
|
| 64 | - ") AS this_tree JOIN (" . |
|
| 65 | - " SELECT xref FROM `##change` WHERE gedcom_id = ?" . |
|
| 66 | - " UNION " . |
|
| 67 | - " SELECT i_id AS xref FROM `##individuals` WHERE i_file = ?" . |
|
| 68 | - " UNION " . |
|
| 69 | - " SELECT f_id AS xref FROM `##families` WHERE f_file = ?" . |
|
| 70 | - " UNION " . |
|
| 71 | - " SELECT s_id AS xref FROM `##sources` WHERE s_file = ?" . |
|
| 72 | - " UNION " . |
|
| 73 | - " SELECT m_id AS xref FROM `##media` WHERE m_file = ?" . |
|
| 74 | - " UNION " . |
|
| 75 | - " SELECT o_id AS xref FROM `##other` WHERE o_file = ? AND o_type NOT IN ('HEAD', 'TRLR')" . |
|
| 76 | - ") AS other_trees USING (xref)" |
|
| 77 | - )->execute(array( |
|
| 78 | - $tree1_id, $tree1_id, $tree1_id, $tree1_id, $tree1_id, |
|
| 79 | - $tree2_id, $tree2_id, $tree2_id, $tree2_id, $tree2_id, $tree2_id, |
|
| 80 | - ))->fetchAssoc(); |
|
| 52 | + // Every XREF used by both trees |
|
| 53 | + $xrefs = Database::prepare( |
|
| 54 | + "SELECT xref, type FROM (" . |
|
| 55 | + " SELECT i_id AS xref, 'INDI' AS type FROM `##individuals` WHERE i_file = ?" . |
|
| 56 | + " UNION " . |
|
| 57 | + " SELECT f_id AS xref, 'FAM' AS type FROM `##families` WHERE f_file = ?" . |
|
| 58 | + " UNION " . |
|
| 59 | + " SELECT s_id AS xref, 'SOUR' AS type FROM `##sources` WHERE s_file = ?" . |
|
| 60 | + " UNION " . |
|
| 61 | + " SELECT m_id AS xref, 'OBJE' AS type FROM `##media` WHERE m_file = ?" . |
|
| 62 | + " UNION " . |
|
| 63 | + " SELECT o_id AS xref, o_type AS type FROM `##other` WHERE o_file = ? AND o_type NOT IN ('HEAD', 'TRLR')" . |
|
| 64 | + ") AS this_tree JOIN (" . |
|
| 65 | + " SELECT xref FROM `##change` WHERE gedcom_id = ?" . |
|
| 66 | + " UNION " . |
|
| 67 | + " SELECT i_id AS xref FROM `##individuals` WHERE i_file = ?" . |
|
| 68 | + " UNION " . |
|
| 69 | + " SELECT f_id AS xref FROM `##families` WHERE f_file = ?" . |
|
| 70 | + " UNION " . |
|
| 71 | + " SELECT s_id AS xref FROM `##sources` WHERE s_file = ?" . |
|
| 72 | + " UNION " . |
|
| 73 | + " SELECT m_id AS xref FROM `##media` WHERE m_file = ?" . |
|
| 74 | + " UNION " . |
|
| 75 | + " SELECT o_id AS xref FROM `##other` WHERE o_file = ? AND o_type NOT IN ('HEAD', 'TRLR')" . |
|
| 76 | + ") AS other_trees USING (xref)" |
|
| 77 | + )->execute(array( |
|
| 78 | + $tree1_id, $tree1_id, $tree1_id, $tree1_id, $tree1_id, |
|
| 79 | + $tree2_id, $tree2_id, $tree2_id, $tree2_id, $tree2_id, $tree2_id, |
|
| 80 | + ))->fetchAssoc(); |
|
| 81 | 81 | |
| 82 | - if ($xrefs) { |
|
| 83 | - $tree1 = Tree::findById($tree1_id); |
|
| 84 | - $tree2 = Tree::findById($tree2_id); |
|
| 85 | - echo |
|
| 86 | - '<p>', I18N::translate('In a family tree, each record has an internal reference number (called an “XREF”) such as “F123” or “R14”.'), '</p>', |
|
| 87 | - '<p>', |
|
| 88 | - I18N::plural( |
|
| 89 | - /* I18N: An XREF is the identification number used in GEDCOM files. */ |
|
| 90 | - 'The two family trees have %1$s record which uses the same “XREF”.', |
|
| 91 | - 'The two family trees have %1$s records which use the same “XREF”.', |
|
| 92 | - count($xrefs), count($xrefs) |
|
| 93 | - ), |
|
| 94 | - '</p>', |
|
| 95 | - '<p>', |
|
| 96 | - I18N::translate('You must renumber the records in one of the trees before you can merge them.'), |
|
| 97 | - '</p>', |
|
| 98 | - '<p>', |
|
| 99 | - '<a class="current" href="admin_trees_renumber.php?ged=', $tree1->getNameUrl(), '">', |
|
| 100 | - I18N::translate('Renumber family tree'), ' — ', $tree1->getTitleHtml(), |
|
| 101 | - '</a>', |
|
| 102 | - '</p>', |
|
| 103 | - '<p>', |
|
| 104 | - '<a class="current" href="admin_trees_renumber.php?ged=', $tree2->getNameUrl(), '">', |
|
| 105 | - I18N::translate('Renumber family tree'), ' — ', $tree2->getTitleHtml(), |
|
| 106 | - '</a>', |
|
| 107 | - '</p>'; |
|
| 108 | - } else { |
|
| 109 | - Database::beginTransaction(); |
|
| 110 | - Database::exec( |
|
| 111 | - "LOCK TABLE" . |
|
| 112 | - " `##individuals` WRITE," . |
|
| 113 | - " `##individuals` AS individuals2 READ," . |
|
| 114 | - " `##families` WRITE," . |
|
| 115 | - " `##families` AS families2 READ," . |
|
| 116 | - " `##sources` WRITE," . |
|
| 117 | - " `##sources` AS sources2 READ," . |
|
| 118 | - " `##media` WRITE," . |
|
| 119 | - " `##media` AS media2 READ," . |
|
| 120 | - " `##other` WRITE," . |
|
| 121 | - " `##other` AS other2 READ," . |
|
| 122 | - " `##name` WRITE," . |
|
| 123 | - " `##name` AS name2 READ," . |
|
| 124 | - " `##placelinks` WRITE," . |
|
| 125 | - " `##placelinks` AS placelinks2 READ," . |
|
| 126 | - " `##change` WRITE," . |
|
| 127 | - " `##change` AS change2 READ," . |
|
| 128 | - " `##dates` WRITE," . |
|
| 129 | - " `##dates` AS dates2 READ," . |
|
| 130 | - " `##default_resn` WRITE," . |
|
| 131 | - " `##default_resn` AS default_resn2 READ," . |
|
| 132 | - " `##hit_counter` WRITE," . |
|
| 133 | - " `##hit_counter` AS hit_counter2 READ," . |
|
| 134 | - " `##link` WRITE," . |
|
| 135 | - " `##link` AS link2 READ" |
|
| 136 | - ); |
|
| 137 | - Database::prepare( |
|
| 138 | - "INSERT INTO `##individuals` (i_id, i_file, i_rin, i_sex, i_gedcom)" . |
|
| 139 | - " SELECT i_id, ?, i_rin, i_sex, i_gedcom FROM `##individuals` AS individuals2 WHERE i_file = ?" |
|
| 140 | - )->execute(array($tree2_id, $tree1_id)); |
|
| 141 | - Database::prepare( |
|
| 142 | - "INSERT INTO `##families` (f_id, f_file, f_husb, f_wife, f_gedcom, f_numchil)" . |
|
| 143 | - " SELECT f_id, ?, f_husb, f_wife, f_gedcom, f_numchil FROM `##families` AS families2 WHERE f_file = ?" |
|
| 144 | - )->execute(array($tree2_id, $tree1_id)); |
|
| 145 | - Database::prepare( |
|
| 146 | - "INSERT INTO `##sources` (s_id, s_file, s_name, s_gedcom)" . |
|
| 147 | - " SELECT s_id, ?, s_name, s_gedcom FROM `##sources` AS sources2 WHERE s_file = ?" |
|
| 148 | - )->execute(array($tree2_id, $tree1_id)); |
|
| 149 | - Database::prepare( |
|
| 150 | - "INSERT INTO `##media` (m_id, m_ext, m_type, m_titl, m_filename, m_file, m_gedcom)" . |
|
| 151 | - " SELECT m_id, m_ext, m_type, m_titl, m_filename, ?, m_gedcom FROM `##media` AS media2 WHERE m_file = ?" |
|
| 152 | - )->execute(array($tree2_id, $tree1_id)); |
|
| 153 | - Database::prepare( |
|
| 154 | - "INSERT INTO `##other` (o_id, o_file, o_type, o_gedcom)" . |
|
| 155 | - " SELECT o_id, ?, o_type, o_gedcom FROM `##other` AS other2 WHERE o_file = ? AND o_type NOT IN ('HEAD', 'TRLR')" |
|
| 156 | - )->execute(array($tree2_id, $tree1_id)); |
|
| 157 | - Database::prepare( |
|
| 158 | - "INSERT INTO `##name` (n_file, n_id, n_num, n_type, n_sort, n_full, n_surname, n_surn, n_givn, n_soundex_givn_std, n_soundex_surn_std, n_soundex_givn_dm, n_soundex_surn_dm)" . |
|
| 159 | - " SELECT ?, n_id, n_num, n_type, n_sort, n_full, n_surname, n_surn, n_givn, n_soundex_givn_std, n_soundex_surn_std, n_soundex_givn_dm, n_soundex_surn_dm FROM `##name` AS name2 WHERE n_file = ?" |
|
| 160 | - )->execute(array($tree2_id, $tree1_id)); |
|
| 161 | - Database::prepare( |
|
| 162 | - "INSERT INTO `##placelinks` (pl_p_id, pl_gid, pl_file)" . |
|
| 163 | - " SELECT pl_p_id, pl_gid, ? FROM `##placelinks` AS placelinks2 WHERE pl_file = ?" |
|
| 164 | - )->execute(array($tree2_id, $tree1_id)); |
|
| 165 | - Database::prepare( |
|
| 166 | - "INSERT INTO `##dates` (d_day, d_month, d_mon, d_year, d_julianday1, d_julianday2, d_fact, d_gid, d_file, d_type)" . |
|
| 167 | - " SELECT d_day, d_month, d_mon, d_year, d_julianday1, d_julianday2, d_fact, d_gid, ?, d_type FROM `##dates` AS dates2 WHERE d_file = ?" |
|
| 168 | - )->execute(array($tree2_id, $tree1_id)); |
|
| 169 | - Database::prepare( |
|
| 170 | - "INSERT INTO `##default_resn` (gedcom_id, xref, tag_type, resn)" . |
|
| 171 | - " SELECT ?, xref, tag_type, resn FROM `##default_resn` AS default_resn2 WHERE gedcom_id = ?" |
|
| 172 | - )->execute(array($tree2_id, $tree1_id)); |
|
| 173 | - Database::prepare( |
|
| 174 | - "INSERT INTO `##link` (l_file, l_from, l_type, l_to)" . |
|
| 175 | - " SELECT ?, l_from, l_type, l_to FROM `##link` AS link2 WHERE l_file = ?" |
|
| 176 | - )->execute(array($tree2_id, $tree1_id)); |
|
| 177 | - // This table may contain old (deleted) references, which could clash. IGNORE these. |
|
| 178 | - Database::prepare( |
|
| 179 | - "INSERT IGNORE INTO `##change` (change_time, status, gedcom_id, xref, old_gedcom, new_gedcom, user_id)" . |
|
| 180 | - " SELECT change_time, status, ?, xref, old_gedcom, new_gedcom, user_id FROM `##change` AS change2 WHERE gedcom_id = ?" |
|
| 181 | - )->execute(array($tree2_id, $tree1_id)); |
|
| 182 | - // This table may contain old (deleted) references, which could clash. IGNORE these. |
|
| 183 | - Database::prepare( |
|
| 184 | - "INSERT IGNORE INTO `##hit_counter` (gedcom_id, page_name, page_parameter, page_count)" . |
|
| 185 | - " SELECT ?, page_name, page_parameter, page_count FROM `##hit_counter` AS hit_counter2 WHERE gedcom_id = ? AND page_name <> 'index.php'" |
|
| 186 | - )->execute(array($tree2_id, $tree1_id)); |
|
| 187 | - Database::exec("UNLOCK TABLES"); |
|
| 188 | - Database::commit(); |
|
| 189 | - echo '<p>', I18N::translate('The family trees have been merged successfully.'), '</p>'; |
|
| 190 | - } |
|
| 82 | + if ($xrefs) { |
|
| 83 | + $tree1 = Tree::findById($tree1_id); |
|
| 84 | + $tree2 = Tree::findById($tree2_id); |
|
| 85 | + echo |
|
| 86 | + '<p>', I18N::translate('In a family tree, each record has an internal reference number (called an “XREF”) such as “F123” or “R14”.'), '</p>', |
|
| 87 | + '<p>', |
|
| 88 | + I18N::plural( |
|
| 89 | + /* I18N: An XREF is the identification number used in GEDCOM files. */ |
|
| 90 | + 'The two family trees have %1$s record which uses the same “XREF”.', |
|
| 91 | + 'The two family trees have %1$s records which use the same “XREF”.', |
|
| 92 | + count($xrefs), count($xrefs) |
|
| 93 | + ), |
|
| 94 | + '</p>', |
|
| 95 | + '<p>', |
|
| 96 | + I18N::translate('You must renumber the records in one of the trees before you can merge them.'), |
|
| 97 | + '</p>', |
|
| 98 | + '<p>', |
|
| 99 | + '<a class="current" href="admin_trees_renumber.php?ged=', $tree1->getNameUrl(), '">', |
|
| 100 | + I18N::translate('Renumber family tree'), ' — ', $tree1->getTitleHtml(), |
|
| 101 | + '</a>', |
|
| 102 | + '</p>', |
|
| 103 | + '<p>', |
|
| 104 | + '<a class="current" href="admin_trees_renumber.php?ged=', $tree2->getNameUrl(), '">', |
|
| 105 | + I18N::translate('Renumber family tree'), ' — ', $tree2->getTitleHtml(), |
|
| 106 | + '</a>', |
|
| 107 | + '</p>'; |
|
| 108 | + } else { |
|
| 109 | + Database::beginTransaction(); |
|
| 110 | + Database::exec( |
|
| 111 | + "LOCK TABLE" . |
|
| 112 | + " `##individuals` WRITE," . |
|
| 113 | + " `##individuals` AS individuals2 READ," . |
|
| 114 | + " `##families` WRITE," . |
|
| 115 | + " `##families` AS families2 READ," . |
|
| 116 | + " `##sources` WRITE," . |
|
| 117 | + " `##sources` AS sources2 READ," . |
|
| 118 | + " `##media` WRITE," . |
|
| 119 | + " `##media` AS media2 READ," . |
|
| 120 | + " `##other` WRITE," . |
|
| 121 | + " `##other` AS other2 READ," . |
|
| 122 | + " `##name` WRITE," . |
|
| 123 | + " `##name` AS name2 READ," . |
|
| 124 | + " `##placelinks` WRITE," . |
|
| 125 | + " `##placelinks` AS placelinks2 READ," . |
|
| 126 | + " `##change` WRITE," . |
|
| 127 | + " `##change` AS change2 READ," . |
|
| 128 | + " `##dates` WRITE," . |
|
| 129 | + " `##dates` AS dates2 READ," . |
|
| 130 | + " `##default_resn` WRITE," . |
|
| 131 | + " `##default_resn` AS default_resn2 READ," . |
|
| 132 | + " `##hit_counter` WRITE," . |
|
| 133 | + " `##hit_counter` AS hit_counter2 READ," . |
|
| 134 | + " `##link` WRITE," . |
|
| 135 | + " `##link` AS link2 READ" |
|
| 136 | + ); |
|
| 137 | + Database::prepare( |
|
| 138 | + "INSERT INTO `##individuals` (i_id, i_file, i_rin, i_sex, i_gedcom)" . |
|
| 139 | + " SELECT i_id, ?, i_rin, i_sex, i_gedcom FROM `##individuals` AS individuals2 WHERE i_file = ?" |
|
| 140 | + )->execute(array($tree2_id, $tree1_id)); |
|
| 141 | + Database::prepare( |
|
| 142 | + "INSERT INTO `##families` (f_id, f_file, f_husb, f_wife, f_gedcom, f_numchil)" . |
|
| 143 | + " SELECT f_id, ?, f_husb, f_wife, f_gedcom, f_numchil FROM `##families` AS families2 WHERE f_file = ?" |
|
| 144 | + )->execute(array($tree2_id, $tree1_id)); |
|
| 145 | + Database::prepare( |
|
| 146 | + "INSERT INTO `##sources` (s_id, s_file, s_name, s_gedcom)" . |
|
| 147 | + " SELECT s_id, ?, s_name, s_gedcom FROM `##sources` AS sources2 WHERE s_file = ?" |
|
| 148 | + )->execute(array($tree2_id, $tree1_id)); |
|
| 149 | + Database::prepare( |
|
| 150 | + "INSERT INTO `##media` (m_id, m_ext, m_type, m_titl, m_filename, m_file, m_gedcom)" . |
|
| 151 | + " SELECT m_id, m_ext, m_type, m_titl, m_filename, ?, m_gedcom FROM `##media` AS media2 WHERE m_file = ?" |
|
| 152 | + )->execute(array($tree2_id, $tree1_id)); |
|
| 153 | + Database::prepare( |
|
| 154 | + "INSERT INTO `##other` (o_id, o_file, o_type, o_gedcom)" . |
|
| 155 | + " SELECT o_id, ?, o_type, o_gedcom FROM `##other` AS other2 WHERE o_file = ? AND o_type NOT IN ('HEAD', 'TRLR')" |
|
| 156 | + )->execute(array($tree2_id, $tree1_id)); |
|
| 157 | + Database::prepare( |
|
| 158 | + "INSERT INTO `##name` (n_file, n_id, n_num, n_type, n_sort, n_full, n_surname, n_surn, n_givn, n_soundex_givn_std, n_soundex_surn_std, n_soundex_givn_dm, n_soundex_surn_dm)" . |
|
| 159 | + " SELECT ?, n_id, n_num, n_type, n_sort, n_full, n_surname, n_surn, n_givn, n_soundex_givn_std, n_soundex_surn_std, n_soundex_givn_dm, n_soundex_surn_dm FROM `##name` AS name2 WHERE n_file = ?" |
|
| 160 | + )->execute(array($tree2_id, $tree1_id)); |
|
| 161 | + Database::prepare( |
|
| 162 | + "INSERT INTO `##placelinks` (pl_p_id, pl_gid, pl_file)" . |
|
| 163 | + " SELECT pl_p_id, pl_gid, ? FROM `##placelinks` AS placelinks2 WHERE pl_file = ?" |
|
| 164 | + )->execute(array($tree2_id, $tree1_id)); |
|
| 165 | + Database::prepare( |
|
| 166 | + "INSERT INTO `##dates` (d_day, d_month, d_mon, d_year, d_julianday1, d_julianday2, d_fact, d_gid, d_file, d_type)" . |
|
| 167 | + " SELECT d_day, d_month, d_mon, d_year, d_julianday1, d_julianday2, d_fact, d_gid, ?, d_type FROM `##dates` AS dates2 WHERE d_file = ?" |
|
| 168 | + )->execute(array($tree2_id, $tree1_id)); |
|
| 169 | + Database::prepare( |
|
| 170 | + "INSERT INTO `##default_resn` (gedcom_id, xref, tag_type, resn)" . |
|
| 171 | + " SELECT ?, xref, tag_type, resn FROM `##default_resn` AS default_resn2 WHERE gedcom_id = ?" |
|
| 172 | + )->execute(array($tree2_id, $tree1_id)); |
|
| 173 | + Database::prepare( |
|
| 174 | + "INSERT INTO `##link` (l_file, l_from, l_type, l_to)" . |
|
| 175 | + " SELECT ?, l_from, l_type, l_to FROM `##link` AS link2 WHERE l_file = ?" |
|
| 176 | + )->execute(array($tree2_id, $tree1_id)); |
|
| 177 | + // This table may contain old (deleted) references, which could clash. IGNORE these. |
|
| 178 | + Database::prepare( |
|
| 179 | + "INSERT IGNORE INTO `##change` (change_time, status, gedcom_id, xref, old_gedcom, new_gedcom, user_id)" . |
|
| 180 | + " SELECT change_time, status, ?, xref, old_gedcom, new_gedcom, user_id FROM `##change` AS change2 WHERE gedcom_id = ?" |
|
| 181 | + )->execute(array($tree2_id, $tree1_id)); |
|
| 182 | + // This table may contain old (deleted) references, which could clash. IGNORE these. |
|
| 183 | + Database::prepare( |
|
| 184 | + "INSERT IGNORE INTO `##hit_counter` (gedcom_id, page_name, page_parameter, page_count)" . |
|
| 185 | + " SELECT ?, page_name, page_parameter, page_count FROM `##hit_counter` AS hit_counter2 WHERE gedcom_id = ? AND page_name <> 'index.php'" |
|
| 186 | + )->execute(array($tree2_id, $tree1_id)); |
|
| 187 | + Database::exec("UNLOCK TABLES"); |
|
| 188 | + Database::commit(); |
|
| 189 | + echo '<p>', I18N::translate('The family trees have been merged successfully.'), '</p>'; |
|
| 190 | + } |
|
| 191 | 191 | } else { |
| 192 | - echo '<form method="post">'; |
|
| 193 | - echo '<input type="hidden" name="go" value="1">'; |
|
| 194 | - echo '<p>', I18N::translate(/* I18N: Copy all the records from [family tree 1] into [family tree 2] */ |
|
| 195 | - 'Copy all the records from %1$s into %2$s.', |
|
| 196 | - FunctionsEdit::selectEditControl('tree1_id', Tree::getIdList(), '', null), |
|
| 197 | - FunctionsEdit::selectEditControl('tree2_id', Tree::getIdList(), '', null) |
|
| 198 | - ), |
|
| 199 | - '</p>'; |
|
| 192 | + echo '<form method="post">'; |
|
| 193 | + echo '<input type="hidden" name="go" value="1">'; |
|
| 194 | + echo '<p>', I18N::translate(/* I18N: Copy all the records from [family tree 1] into [family tree 2] */ |
|
| 195 | + 'Copy all the records from %1$s into %2$s.', |
|
| 196 | + FunctionsEdit::selectEditControl('tree1_id', Tree::getIdList(), '', null), |
|
| 197 | + FunctionsEdit::selectEditControl('tree2_id', Tree::getIdList(), '', null) |
|
| 198 | + ), |
|
| 199 | + '</p>'; |
|
| 200 | 200 | |
| 201 | - echo '<button type="submit" class="btn btn-primary">'; |
|
| 202 | - echo '<i class="fa fa-check"></i> ', /* I18N: A button label. */ I18N::translate('continue'); |
|
| 203 | - echo '</button>'; |
|
| 204 | - echo '</form>'; |
|
| 201 | + echo '<button type="submit" class="btn btn-primary">'; |
|
| 202 | + echo '<i class="fa fa-check"></i> ', /* I18N: A button label. */ I18N::translate('continue'); |
|
| 203 | + echo '</button>'; |
|
| 204 | + echo '</form>'; |
|
| 205 | 205 | } |