function main() { // HTML common to all pages $html = self::getJavascript() . '<form id="batch_update_form" action="module.php" method="get">' . '<input type="hidden" name="mod" value="batch_update">' . '<input type="hidden" name="mod_action" value="admin_batch_update">' . '<input type="hidden" name="xref" value="' . $this->xref . '">' . '<input type="hidden" name="action" value="">' . '<input type="hidden" name="data" value="">' . '<table id="batch_update"><tr>' . '<th>' . WT_I18N::translate('Family tree') . '</th>' . '<td>' . select_edit_control('ged', WT_Tree::getNameList(), '', WT_GEDCOM, 'onchange="reset_reload();"') . '</td></tr><tr><th>' . WT_I18N::translate('Batch update') . '</th><td><select name="plugin" onchange="reset_reload();">'; if (!$this->plugin) { $html .= '<option value="" selected="selected"></option>'; } foreach ($this->plugins as $class => $plugin) { $html .= '<option value="' . $class . '"' . ($this->plugin == $class ? ' selected="selected"' : '') . '>' . $plugin->getName() . '</option>'; } $html .= '</select>'; if ($this->PLUGIN) { $html .= '<br><em>' . $this->PLUGIN->getDescription() . '</em>'; } $html .= '</td></tr>'; if (!Auth::user()->getSetting('auto_accept')) { $html .= '<tr><td colspan="2" class="warning">' . WT_I18N::translate('Your user account does not have “automatically approve changes” enabled. You will only be able to change one record at a time.') . '</td></tr>'; } // If a plugin is selected, display the details if ($this->PLUGIN) { $html .= $this->PLUGIN->getOptionsForm(); if (substr($this->action, -4) == '_all') { // Reset - otherwise we might "undo all changes", which refreshes the // page, which makes them all again! $html .= '<script>reset_reload();</script>'; } else { if ($this->curr_xref) { // Create an object, so we can get the latest version of the name. $this->record = WT_GedcomRecord::getInstance($this->curr_xref); $html .= '</table><table id="batch_update2"><tr><td>' . self::createSubmitButton(WT_I18N::translate('previous'), $this->prev_xref) . self::createSubmitButton(WT_I18N::translate('next'), $this->next_xref) . '</td><th><a href="' . $this->record->getHtmlUrl() . '">' . $this->record->getFullName() . '</a>' . '</th>' . '</tr><tr><td valign="top">' . '<br>' . implode('<br>', $this->PLUGIN->getActionButtons($this->curr_xref, $this->record)) . '<br>' . '</td><td dir="ltr" align="left">' . $this->PLUGIN->getActionPreview($this->record) . '</td></tr>'; } else { $html .= '<tr><td class="accepted" colspan=2>' . WT_I18N::translate('Nothing found.') . '</td></tr>'; } } } $html .= '</table></form>'; return $html; }
} // Total filtered/unfiltered rows $recordsFiltered = WT_DB::prepare("SELECT FOUND_ROWS()")->fetchColumn(); $recordsTotal = WT_DB::prepare($SELECT2 . $WHERE)->execute($args)->fetchColumn(); header('Content-type: application/json'); echo json_encode(array('sEcho' => WT_Filter::getInteger('sEcho'), 'recordsTotal' => $recordsTotal, 'recordsFiltered' => $recordsFiltered, 'data' => $data)); exit; } $controller->pageHeader()->addExternalJavascript(WT_JQUERY_DATATABLES_URL)->addInlineJavascript(' jQuery("#log_list").dataTable( { dom: \'<"H"pf<"dt-clear">irl>t<"F"pl>\', processing: true, serverSide: true, ajax: "' . WT_SERVER_NAME . WT_SCRIPT_PATH . WT_SCRIPT_NAME . '?action=load_json&from=' . $from . '&to=' . $to . '&type=' . $type . '&text=' . rawurlencode($text) . '&ip=' . rawurlencode($ip) . '&user='******'&gedc=' . rawurlencode($gedc) . '", ' . WT_I18N::datatablesI18N(array(10, 20, 50, 100, 500, 1000, -1)) . ', jQueryUI: true, autoWidth: false, sorting: [[ 0, "desc" ]], pageLength: ' . Auth::user()->getSetting('admin_site_log_page_size', 20) . ', pagingType: "full_numbers" }); '); $url = WT_SCRIPT_NAME . '?from=' . rawurlencode($from) . '&to=' . rawurlencode($to) . '&type=' . rawurlencode($type) . '&text=' . rawurlencode($text) . '&ip=' . rawurlencode($ip) . '&user='******'&gedc=' . rawurlencode($gedc); $users_array = array(); foreach (User::all() as $tmp_user) { $users_array[$tmp_user->getUserName()] = $tmp_user->getUserName(); } echo '<form name="logs" method="get" action="' . WT_SCRIPT_NAME . '">', '<input type="hidden" name="action", value="show">', '<table class="site_logs">', '<tr>', '<td colspan="6">', WT_I18N::translate('From %s to %s', '<input class="log-date" name="from" value="' . WT_Filter::escapeHtml($from) . '">', '<input class="log-date" name="to" value="' . WT_Filter::escapeHtml($to) . '">'), '</td>', '</tr><tr>', '<td>', WT_I18N::translate('Type'), '<br>', select_edit_control('type', array('' => '', 'auth' => 'auth', 'config' => 'config', 'debug' => 'debug', 'edit' => 'edit', 'error' => 'error', 'media' => 'media', 'search' => 'search'), null, $type, ''), '</td>', '<td>', WT_I18N::translate('Message'), '<br><input class="log-filter" name="text" value="', WT_Filter::escapeHtml($text), '"> ', '</td>', '<td>', WT_I18N::translate('IP address'), '<br><input class="log-filter" name="ip" value="', WT_Filter::escapeHtml($ip), '"> ', '</td>', '<td>', WT_I18N::translate('User'), '<br>', select_edit_control('user', $users_array, '', $user, ''), '</td>', '<td>', WT_I18N::translate('Family tree'), '<br>', select_edit_control('gedc', WT_Tree::getNameList(), '', $gedc, Auth::isAdmin() ? '' : 'disabled'), '</td>', '</tr><tr>', '<td colspan="6">', '<input type="submit" value="', WT_I18N::translate('Filter'), '">', '<input type="submit" value="', WT_I18N::translate('Export'), '" onclick="document.logs.action.value=\'export\';return true;" ', $action == 'show' ? '' : 'disabled="disabled"', '>', '<input type="submit" value="', WT_I18N::translate('Delete'), '" onclick="if (confirm(\'', WT_Filter::escapeHtml(WT_I18N::translate('Permanently delete these records?')), '\')) {document.logs.action.value=\'delete\';return true;} else {return false;}" ', $action == 'show' ? '' : 'disabled="disabled"', '>', '</td>', '</tr>', '</table>', '</form>'; if ($action) { echo '<br>', '<table id="log_list">', '<thead>', '<tr>', '<th>', WT_I18N::translate('Timestamp'), '</th>', '<th>', WT_I18N::translate('Type'), '</th>', '<th>', WT_I18N::translate('Message'), '</th>', '<th>', WT_I18N::translate('IP address'), '</th>', '<th>', WT_I18N::translate('User'), '</th>', '<th>', WT_I18N::translate('Family tree'), '</th>', '</tr>', '</thead>', '<tbody>', '</tbody>', '</table>'; }
private function adminPlaces() { require WT_ROOT . 'includes/functions/functions_edit.php'; $action = WT_Filter::get('action'); $parent = WT_Filter::get('parent'); $inactive = WT_Filter::getBool('inactive'); $deleteRecord = WT_Filter::get('deleteRecord'); if (!isset($parent)) { $parent = 0; } $controller = new WT_Controller_Page(); $controller->restrictAccess(Auth::isAdmin()); if ($action == 'ExportFile' && Auth::isAdmin()) { Zend_Session::writeClose(); $tmp = $this->placeIdToHierarchy($parent); $maxLevel = $this->getHighestLevel(); if ($maxLevel > 8) { $maxLevel = 8; } $tmp[0] = 'places'; $outputFileName = preg_replace('/[:;\\/\\\\(\\)\\{\\}\\[\\] $]/', '_', implode('-', $tmp)) . '.csv'; header('Content-Type: application/octet-stream'); header('Content-Disposition: attachment; filename="' . $outputFileName . '"'); echo '"', WT_I18N::translate('Level'), '";"', WT_I18N::translate('Country'), '";'; if ($maxLevel > 0) { echo '"', WT_I18N::translate('State'), '";'; } if ($maxLevel > 1) { echo '"', WT_I18N::translate('County'), '";'; } if ($maxLevel > 2) { echo '"', WT_I18N::translate('City'), '";'; } if ($maxLevel > 3) { echo '"', WT_I18N::translate('Place'), '";'; } if ($maxLevel > 4) { echo '"', WT_I18N::translate('Place'), '";'; } if ($maxLevel > 5) { echo '"', WT_I18N::translate('Place'), '";'; } if ($maxLevel > 6) { echo '"', WT_I18N::translate('Place'), '";'; } if ($maxLevel > 7) { echo '"', WT_I18N::translate('Place'), '";'; } echo '"', WT_I18N::translate('Longitude'), '";"', WT_I18N::translate('Latitude'), '";'; echo '"', WT_I18N::translate('Zoom level'), '";"', WT_I18N::translate('Icon'), '";', WT_EOL; $this->outputLevel($parent); exit; } $controller->setPageTitle(WT_I18N::translate('Google Maps™'))->pageHeader(); ?> <table id="gm_config"> <tr> <th> <a href="module.php?mod=googlemap&mod_action=admin_config"> <?php echo WT_I18N::translate('Google Maps™ preferences'); ?> </a> </th> <th> <a class="current" href="module.php?mod=googlemap&mod_action=admin_places"> <?php echo WT_I18N::translate('Geographic data'); ?> </a> </th> <th> <a href="module.php?mod=googlemap&mod_action=admin_placecheck"> <?php echo WT_I18N::translate('Place check'); ?> </a> </th> </tr> </table> <?php if ($action == 'ImportGedcom') { $placelist = array(); $j = 0; $gedcom_records = WT_DB::prepare("SELECT i_gedcom FROM `##individuals` WHERE i_file=? UNION ALL SELECT f_gedcom FROM `##families` WHERE f_file=?")->execute(array(WT_GED_ID, WT_GED_ID))->fetchOneColumn(); foreach ($gedcom_records as $gedrec) { $i = 1; $placerec = get_sub_record(2, '2 PLAC', $gedrec, $i); while (!empty($placerec)) { if (preg_match("/2 PLAC (.+)/", $placerec, $match)) { $placelist[$j] = array(); $placelist[$j]['place'] = trim($match[1]); if (preg_match("/4 LATI (.*)/", $placerec, $match)) { $placelist[$j]['lati'] = trim($match[1]); if ($placelist[$j]['lati'][0] != 'N' && $placelist[$j]['lati'][0] != 'S') { if ($placelist[$j]['lati'] < 0) { $placelist[$j]['lati'][0] = 'S'; } else { $placelist[$j]['lati'] = 'N' . $placelist[$j]['lati']; } } } else { $placelist[$j]['lati'] = NULL; } if (preg_match("/4 LONG (.*)/", $placerec, $match)) { $placelist[$j]['long'] = trim($match[1]); if ($placelist[$j]['long'][0] != 'E' && $placelist[$j]['long'][0] != 'W') { if ($placelist[$j]['long'] < 0) { $placelist[$j]['long'][0] = 'W'; } else { $placelist[$j]['long'] = 'E' . $placelist[$j]['long']; } } } else { $placelist[$j]['long'] = NULL; } $j = $j + 1; } $i = $i + 1; $placerec = get_sub_record(2, '2 PLAC', $gedrec, $i); } } asort($placelist); $prevPlace = ''; $prevLati = ''; $prevLong = ''; $placelistUniq = array(); $j = 0; foreach ($placelist as $k => $place) { if ($place['place'] != $prevPlace) { $placelistUniq[$j] = array(); $placelistUniq[$j]['place'] = $place['place']; $placelistUniq[$j]['lati'] = $place['lati']; $placelistUniq[$j]['long'] = $place['long']; $j = $j + 1; } elseif ($place['place'] == $prevPlace && ($place['lati'] != $prevLati || $place['long'] != $prevLong)) { if ($placelistUniq[$j - 1]['lati'] == 0 || $placelistUniq[$j - 1]['long'] == 0) { $placelistUniq[$j - 1]['lati'] = $place['lati']; $placelistUniq[$j - 1]['long'] = $place['long']; } elseif ($place['lati'] != '0' || $place['long'] != '0') { echo 'Difference: previous value = ', $prevPlace, ', ', $prevLati, ', ', $prevLong, ' current = ', $place['place'], ', ', $place['lati'], ', ', $place['long'], '<br>'; } } $prevPlace = $place['place']; $prevLati = $place['lati']; $prevLong = $place['long']; } $highestIndex = $this->getHighestIndex(); $default_zoom_level = array(4, 7, 10, 12); foreach ($placelistUniq as $k => $place) { $parent = preg_split('/ *, */', $place['place']); $parent = array_reverse($parent); $parent_id = 0; for ($i = 0; $i < count($parent); $i++) { if (!isset($default_zoom_level[$i])) { $default_zoom_level[$i] = $default_zoom_level[$i - 1]; } $escparent = $parent[$i]; if ($escparent == '') { $escparent = 'Unknown'; } $row = WT_DB::prepare("SELECT pl_id, pl_long, pl_lati, pl_zoom FROM `##placelocation` WHERE pl_level=? AND pl_parent_id=? AND pl_place LIKE ?")->execute(array($i, $parent_id, $escparent))->fetchOneRow(); if ($i < count($parent) - 1) { // Create higher-level places, if necessary if (empty($row)) { $highestIndex++; WT_DB::prepare("INSERT INTO `##placelocation` (pl_id, pl_parent_id, pl_level, pl_place, pl_zoom) VALUES (?, ?, ?, ?, ?)")->execute(array($highestIndex, $parent_id, $i, $escparent, $default_zoom_level[$i])); echo WT_Filter::escapeHtml($escparent), '<br>'; $parent_id = $highestIndex; } else { $parent_id = $row->pl_id; } } else { // Create lowest-level place, if necessary if (empty($row->pl_id)) { $highestIndex++; WT_DB::prepare("INSERT INTO `##placelocation` (pl_id, pl_parent_id, pl_level, pl_place, pl_long, pl_lati, pl_zoom) VALUES (?, ?, ?, ?, ?, ?, ?)")->execute(array($highestIndex, $parent_id, $i, $escparent, $place['long'], $place['lati'], $default_zoom_level[$i])); echo WT_Filter::escapeHtml($escparent), '<br>'; } else { if (empty($row->pl_long) && empty($row->pl_lati) && $place['lati'] != '0' && $place['long'] != '0') { WT_DB::prepare("UPDATE `##placelocation` SET pl_lati=?, pl_long=? WHERE pl_id=?")->execute(array($place['lati'], $place['long'], $row->pl_id)); echo WT_Filter::escapeHtml($escparent), '<br>'; } } } } } $parent = 0; } if ($action == 'ImportFile') { $placefiles = array(); $this->findFiles(WT_MODULES_DIR . 'googlemap/extra'); sort($placefiles); ?> <form method="post" enctype="multipart/form-data" id="importfile" name="importfile" action="module.php?mod=googlemap&mod_action=admin_places&action=ImportFile2"> <table class="gm_plac_edit"> <tr> <th><?php echo WT_I18N::translate('File containing places (CSV)'); ?> </th> <td><input type="file" name="placesfile" size="50"></td> </tr> <?php if (count($placefiles) > 0) { ?> <tr> <th><?php echo WT_I18N::translate('Server file containing places (CSV)'), help_link('PLIF_LOCALFILE', 'googlemap'); ?> </th> <td> <select name="localfile"> <option></option> <?php foreach ($placefiles as $p => $placefile) { ?> <option value="<?php echo WT_Filter::escapeHtml($placefile); ?> "><?php if (substr($placefile, 0, 1) == "/") { echo substr($placefile, 1); } else { echo $placefile; } ?> </option> <?php } ?> </select> </td> </tr> <?php } ?> <tr> <th><?php echo WT_I18N::translate('Delete all existing geographic data before importing the file.'); ?> </th> <td><input type="checkbox" name="cleardatabase"></td> </tr> <tr> <th><?php echo WT_I18N::translate('Do not create new locations, just import coordinates for existing locations.'); ?> </th> <td><input type="checkbox" name="updateonly"></td> </tr> <tr> <th><?php echo WT_I18N::translate('Overwrite existing coordinates.'); ?> </th> <td><input type="checkbox" name="overwritedata"></td> </tr> </table> <input id="savebutton" type="submit" value="<?php echo WT_I18N::translate('Continue adding'); ?> "><br> </form> <?php exit; } if ($action == 'ImportFile2') { $country_names = array(); foreach (WT_Stats::iso3166() as $key => $value) { $country_names[$key] = WT_I18N::translate($key); } if (isset($_POST['cleardatabase'])) { WT_DB::exec("DELETE FROM `##placelocation` WHERE 1=1"); } if (!empty($_FILES['placesfile']['tmp_name'])) { $lines = file($_FILES['placesfile']['tmp_name']); } elseif (!empty($_REQUEST['localfile'])) { $lines = file(WT_MODULES_DIR . 'googlemap/extra' . $_REQUEST['localfile']); } // Strip BYTE-ORDER-MARK, if present if (!empty($lines[0]) && substr($lines[0], 0, 3) == WT_UTF8_BOM) { $lines[0] = substr($lines[0], 3); } asort($lines); $highestIndex = $this->getHighestIndex(); $placelist = array(); $j = 0; $maxLevel = 0; foreach ($lines as $p => $placerec) { $fieldrec = explode(';', $placerec); if ($fieldrec[0] > $maxLevel) { $maxLevel = $fieldrec[0]; } } $fields = count($fieldrec); $set_icon = true; if (!is_dir(WT_MODULES_DIR . 'googlemap/places/flags/')) { $set_icon = false; } foreach ($lines as $p => $placerec) { $fieldrec = explode(';', $placerec); if (is_numeric($fieldrec[0]) && $fieldrec[0] <= $maxLevel) { $placelist[$j] = array(); $placelist[$j]['place'] = ''; for ($ii = $fields - 4; $ii > 1; $ii--) { if ($fieldrec[0] > $ii - 2) { $placelist[$j]['place'] .= $fieldrec[$ii] . ','; } } foreach ($country_names as $countrycode => $countryname) { if ($countrycode == strtoupper($fieldrec[1])) { $fieldrec[1] = $countryname; break; } } $placelist[$j]['place'] .= $fieldrec[1]; $placelist[$j]['long'] = $fieldrec[$fields - 4]; $placelist[$j]['lati'] = $fieldrec[$fields - 3]; $placelist[$j]['zoom'] = $fieldrec[$fields - 2]; if ($set_icon) { $placelist[$j]['icon'] = trim($fieldrec[$fields - 1]); } else { $placelist[$j]['icon'] = ''; } $j = $j + 1; } } $prevPlace = ''; $prevLati = ''; $prevLong = ''; $placelistUniq = array(); $j = 0; foreach ($placelist as $k => $place) { if ($place['place'] != $prevPlace) { $placelistUniq[$j] = array(); $placelistUniq[$j]['place'] = $place['place']; $placelistUniq[$j]['lati'] = $place['lati']; $placelistUniq[$j]['long'] = $place['long']; $placelistUniq[$j]['zoom'] = $place['zoom']; $placelistUniq[$j]['icon'] = $place['icon']; $j = $j + 1; } elseif ($place['place'] == $prevPlace && ($place['lati'] != $prevLati || $place['long'] != $prevLong)) { if ($placelistUniq[$j - 1]['lati'] == 0 || $placelistUniq[$j - 1]['long'] == 0) { $placelistUniq[$j - 1]['lati'] = $place['lati']; $placelistUniq[$j - 1]['long'] = $place['long']; $placelistUniq[$j - 1]['zoom'] = $place['zoom']; $placelistUniq[$j - 1]['icon'] = $place['icon']; } elseif ($place['lati'] != '0' || $place['long'] != '0') { echo 'Difference: previous value = ', $prevPlace, ', ', $prevLati, ', ', $prevLong, ' current = ', $place['place'], ', ', $place['lati'], ', ', $place['long'], '<br>'; } } $prevPlace = $place['place']; $prevLati = $place['lati']; $prevLong = $place['long']; } $default_zoom_level = array(); $default_zoom_level[0] = 4; $default_zoom_level[1] = 7; $default_zoom_level[2] = 10; $default_zoom_level[3] = 12; foreach ($placelistUniq as $k => $place) { $parent = explode(',', $place['place']); $parent = array_reverse($parent); $parent_id = 0; for ($i = 0; $i < count($parent); $i++) { $escparent = $parent[$i]; if ($escparent == '') { $escparent = 'Unknown'; } $row = WT_DB::prepare("SELECT pl_id, pl_long, pl_lati, pl_zoom, pl_icon FROM `##placelocation` WHERE pl_level=? AND pl_parent_id=? AND pl_place LIKE ? ORDER BY pl_place")->execute(array($i, $parent_id, $escparent))->fetchOneRow(); if (empty($row)) { // this name does not yet exist: create entry if (!isset($_POST['updateonly'])) { $highestIndex = $highestIndex + 1; if ($i + 1 == count($parent)) { $zoomlevel = $place['zoom']; } elseif (isset($default_zoom_level[$i])) { $zoomlevel = $default_zoom_level[$i]; } else { $zoomlevel = $this->getSetting('GM_MAX_ZOOM'); } if ($place['lati'] == '0' || $place['long'] == '0' || $i + 1 < count($parent)) { WT_DB::prepare("INSERT INTO `##placelocation` (pl_id, pl_parent_id, pl_level, pl_place, pl_zoom, pl_icon) VALUES (?, ?, ?, ?, ?, ?)")->execute(array($highestIndex, $parent_id, $i, $escparent, $zoomlevel, $place['icon'])); } else { //delete leading zero $pl_lati = str_replace(array('N', 'S', ','), array('', '-', '.'), $place['lati']); $pl_long = str_replace(array('E', 'W', ','), array('', '-', '.'), $place['long']); if ($pl_lati >= 0) { $place['lati'] = 'N' . abs($pl_lati); } elseif ($pl_lati < 0) { $place['lati'] = 'S' . abs($pl_lati); } if ($pl_long >= 0) { $place['long'] = 'E' . abs($pl_long); } elseif ($pl_long < 0) { $place['long'] = 'W' . abs($pl_long); } WT_DB::prepare("INSERT INTO `##placelocation` (pl_id, pl_parent_id, pl_level, pl_place, pl_long, pl_lati, pl_zoom, pl_icon) VALUES (?, ?, ?, ?, ?, ?, ?, ?)")->execute(array($highestIndex, $parent_id, $i, $escparent, $place['long'], $place['lati'], $zoomlevel, $place['icon'])); } $parent_id = $highestIndex; } } else { $parent_id = $row->pl_id; if (isset($_POST['overwritedata']) && $i + 1 == count($parent)) { WT_DB::prepare("UPDATE `##placelocation` SET pl_lati=?, pl_long=?, pl_zoom=?, pl_icon=? WHERE pl_id=?")->execute(array($place['lati'], $place['long'], $place['zoom'], $place['icon'], $parent_id)); } else { if (($row->pl_long == '0' || $row->pl_long == null) && ($row->pl_lati == '0' || $row->pl_lati == null)) { WT_DB::prepare("UPDATE `##placelocation` SET pl_lati=?, pl_long=? WHERE pl_id=?")->execute(array($place['lati'], $place['long'], $parent_id)); } if (empty($row->pl_icon) && !empty($place['icon'])) { WT_DB::prepare("UPDATE `##placelocation` SET pl_icon=? WHERE pl_id=?")->execute(array($place['icon'], $parent_id)); } } } } } $parent = 0; } if ($action == 'DeleteRecord') { $exists = WT_DB::prepare("SELECT 1 FROM `##placelocation` WHERE pl_parent_id=?")->execute(array($deleteRecord))->fetchOne(); if (!$exists) { WT_DB::prepare("DELETE FROM `##placelocation` WHERE pl_id=?")->execute(array($deleteRecord)); } else { echo '<table class="facts_table"><tr><td>', WT_I18N::translate('Location not removed: this location contains sub-locations'), '</td></tr></table>'; } } ?> <script> function updateList(inactive) { window.location.href='<?php if (strstr($_SERVER['REQUEST_URI'], '&inactive', true)) { $uri = strstr($_SERVER['REQUEST_URI'], '&inactive', true); } else { $uri = $_SERVER['REQUEST_URI']; } echo $uri, '&inactive='; ?> '+inactive; } function edit_place_location(placeid) { window.open('module.php?mod=googlemap&mod_action=places_edit&action=update&placeid='+placeid, '_blank', gmap_window_specs); return false; } function add_place_location(placeid) { window.open('module.php?mod=googlemap&mod_action=places_edit&action=add&placeid='+placeid, '_blank', gmap_window_specs); return false; } function delete_place(placeid) { var answer=confirm('<?php echo WT_I18N::translate('Remove this location?'); ?> '); if (answer == true) { window.location = '<?php echo $_SERVER['REQUEST_URI']; ?> &action=DeleteRecord&deleteRecord=' + placeid; } } </script> <?php echo '<div id="gm_breadcrumb">'; $where_am_i = $this->placeIdToHierarchy($parent); foreach (array_reverse($where_am_i, true) as $id => $place) { if ($id == $parent) { if ($place != 'Unknown') { echo WT_Filter::escapeHtml($place); } else { echo WT_I18N::translate('unknown'); } } else { echo '<a href="module.php?mod=googlemap&mod_action=admin_places&parent=', $id, '&inactive=', $inactive, '">'; if ($place != 'Unknown') { echo WT_Filter::escapeHtml($place), '</a>'; } else { echo WT_I18N::translate('unknown'), '</a>'; } } echo ' - '; } echo '<a href="module.php?mod=googlemap&mod_action=admin_places&parent=0&inactive=', $inactive, '">', WT_I18N::translate('Top level'), '</a></div>'; echo '<form name="active" method="post" action="module.php?mod=googlemap&mod_action=admin_places&parent=', $parent, '&inactive=', $inactive, '"><div id="gm_active">'; echo '<label for="inactive">', WT_I18N::translate('Show inactive places'), '</label>'; echo '<input type="checkbox" name="inactive" id="inactive"'; if ($inactive) { echo ' checked="checked"'; } echo ' onclick="updateList(this.checked)"'; echo '>', help_link('PLE_ACTIVE', 'googlemap'), '</div></form>'; $placelist = $this->getPlaceListLocation($parent, $inactive); echo '<div class="gm_plac_edit">'; echo '<table class="gm_plac_edit"><tr>'; echo '<th>', WT_Gedcom_Tag::getLabel('PLAC'), '</th>'; echo '<th>', WT_Gedcom_Tag::getLabel('LATI'), '</th>'; echo '<th>', WT_Gedcom_Tag::getLabel('LONG'), '</th>'; echo '<th>', WT_I18N::translate('Zoom level'), '</th>'; echo '<th>', WT_I18N::translate('Icon'), '</th>'; echo '<th>'; echo WT_I18N::translate('Edit'), '</th><th>', WT_I18N::translate('Delete'), '</th></tr>'; if (count($placelist) == 0) { echo '<tr><td colspan="7" class="accepted">', WT_I18N::translate('No places found'), '</td></tr>'; } foreach ($placelist as $place) { echo '<tr><td><a href="module.php?mod=googlemap&mod_action=admin_places&parent=', $place['place_id'], '&inactive=', $inactive, '">'; if ($place['place'] != 'Unknown') { echo WT_Filter::escapeHtml($place['place']), '</a></td>'; } else { echo WT_I18N::translate('unknown'), '</a></td>'; } echo '<td>', $place['lati'], '</td>'; echo '<td>', $place['long'], '</td>'; echo '<td>', $place['zoom'], '</td>'; echo '<td>'; if ($place['icon'] == NULL || $place['icon'] == '') { if ($place['lati'] == NULL || $place['long'] == NULL || $place['lati'] == '0' && $place['long'] == '0') { echo '<img src="', WT_STATIC_URL, WT_MODULES_DIR, 'googlemap/images/mm_20_yellow.png">'; } else { echo '<img src="', WT_STATIC_URL, WT_MODULES_DIR, 'googlemap/images/mm_20_red.png">'; } } else { echo '<img src="', WT_STATIC_URL, WT_MODULES_DIR, 'googlemap/', $place['icon'], '" width="25" height="15">'; } echo '</td>'; echo '<td class="narrow"><a href="#" onclick="edit_place_location(', $place['place_id'], ');return false;" class="icon-edit" title="', WT_I18N::translate('Edit'), '"></a></td>'; $noRows = WT_DB::prepare("SELECT COUNT(pl_id) FROM `##placelocation` WHERE pl_parent_id=?")->execute(array($place['place_id']))->fetchOne(); if ($noRows == 0) { ?> <td><a href="#" onclick="delete_place(<?php echo $place['place_id']; ?> );return false;" class="icon-delete" title="<?php echo WT_I18N::translate('Remove'); ?> "></a></td> <?php } else { ?> <td><i class="icon-delete-grey"></i></td> <?php } ?> </tr> <?php } ?> </table> </div> <table id="gm_manage"> <tr> <td> <?php echo WT_I18N::translate('Add a new geographic location'); ?> </td> <td> <form action="?" onsubmit="add_place_location(this.parent_id.options[this.parent_id.selectedIndex].value); return false;"> <?php echo select_edit_control('parent_id', $where_am_i, WT_I18N::translate('Top level'), $parent); ?> <input type="submit" value="<?php echo WT_I18N::translate('Add'); ?> "> </form> </td> </tr> <tr> <td> <?php echo WT_I18N::translate('Import all places from a family tree'); ?> </td> <td> <form action="module.php" method="get"> <input type="hidden" name="mod" value="googlemap"> <input type="hidden" name="mod_action" value="admin_places"> <input type="hidden" name="action" value="ImportGedcom"> <?php echo select_edit_control('ged', WT_Tree::getNameList(), null, WT_GEDCOM); ?> <input type="submit" value="<?php echo WT_I18N::translate('Import'); ?> "> </form> </td> </tr> <tr> <td> <?php echo WT_I18N::translate('Upload geographic data'); ?> </td> <td> <form action="module.php" method="get"> <input type="hidden" name="mod" value="googlemap"> <input type="hidden" name="mod_action" value="admin_places"> <input type="hidden" name="action" value="ImportFile"> <input type="submit" value="<?php echo WT_I18N::translate('Upload'); ?> "> </form> </td> </tr> <tr> <td> <?php echo WT_I18N::translate('Download geographic data'); ?> </td> <td> <form action="module.php" method="get"> <input type="hidden" name="mod" value="googlemap"> <input type="hidden" name="mod_action" value="admin_places"> <input type="hidden" name="action" value="ExportFile"> <?php echo select_edit_control('parent', $where_am_i, WT_I18N::translate('All'), WT_GED_ID); ?> <input type="submit" value="<?php echo WT_I18N::translate('Download'); ?> "> </form> </td> </tr> </table> <?php }
private function config() { require_once WT_ROOT . 'includes/functions/functions_edit.php'; if (WT_USER_GEDCOM_ADMIN) { $controller = new WT_Controller_Page(); $controller->setPageTitle($this->getTitle())->pageHeader()->addExternalJavascript(WT_JQUERY_DATATABLES_URL)->addInlineJavascript(' jQuery("#story_table").dataTable({ dom: \'<"H"pf<"dt-clear">irl>t<"F"pl>\', ' . WT_I18N::datatablesI18N() . ', autoWidth: false, paging: true, pagingType: "full_numbers", lengthChange: true, filter: true, info: true, jQueryUI: true, sorting: [[0,"asc"]], columns: [ /* 0-name */ null, /* 1-NAME */ null, /* 2-NAME */ { sortable:false }, /* 3-NAME */ { sortable:false } ] }); '); $stories = WT_DB::prepare("SELECT block_id, xref" . " FROM `##block` b" . " WHERE module_name=?" . " AND gedcom_id=?" . " ORDER BY xref")->execute(array($this->getName(), WT_GED_ID))->fetchAll(); echo '<form method="get" action="', WT_SCRIPT_NAME, '">', WT_I18N::translate('Family tree'), ' ', '<input type="hidden" name="mod" value="', $this->getName(), '">', '<input type="hidden" name="mod_action" value="admin_config">', select_edit_control('ged', WT_Tree::getNameList(), null, WT_GEDCOM), '<input type="submit" value="', WT_I18N::translate('show'), '">', '</form>'; echo '<h3><a href="module.php?mod=', $this->getName(), '&mod_action=admin_edit">', WT_I18N::translate('Add a story'), '</a></h3>'; if (count($stories) > 0) { echo '<table id="story_table">'; echo '<thead><tr> <th>', WT_I18N::translate('Story title'), '</th> <th>', WT_I18N::translate('Individual'), '</th> <th> </th> <th> </th> </tr></thead>'; } echo '<tbody>'; foreach ($stories as $story) { $story_title = get_block_setting($story->block_id, 'title'); $indi = WT_Individual::getInstance($story->xref); if ($indi) { echo '<tr><td><a href="', $indi->getHtmlUrl() . '#stories">', $story_title, '</a></td> <td><a href="', $indi->getHtmlUrl() . '#stories">' . $indi->getFullName(), '</a></td>'; } else { echo '<tr><td>', $story_title, '</td><td class="error">', $story->xref, '</td>'; } echo '<td><a href="module.php?mod=', $this->getName(), '&mod_action=admin_edit&block_id=', $story->block_id, '"><div class="icon-edit"> </div></a></td> <td><a href="module.php?mod=', $this->getName(), '&mod_action=admin_delete&block_id=', $story->block_id, '" onclick="return confirm(\'', WT_I18N::translate('Are you sure you want to delete this story?'), '\');"><div class="icon-delete"> </div></a></td> </tr>'; } echo '</tbody></table>'; } else { header('Location: ' . WT_SERVER_NAME . WT_SCRIPT_PATH); exit; } }
$in_progress = WT_DB::prepare("SELECT 1 FROM `##gedcom_chunk` WHERE gedcom_id=? AND imported=1 LIMIT 1")->execute(array($tree->tree_id))->fetchOne(); if (!$in_progress) { echo '<div id="import', $tree->tree_id, '"><div id="progressbar', $tree->tree_id, '"><div style="position:absolute;">', WT_I18N::translate('Deleting old genealogy data…'), '</div></div></div>'; $controller->addInlineJavascript('jQuery("#progressbar' . $tree->tree_id . '").progressbar({value: 0});'); } else { echo '<div id="import', $tree->tree_id, '"></div>'; } $controller->addInlineJavascript('jQuery("#import' . $tree->tree_id . '").load("import.php?gedcom_id=' . $tree->tree_id . '&keep_media' . $tree->tree_id . '=' . WT_Filter::get('keep_media' . $tree->tree_id) . '");'); echo '<table border="0" width="100%" id="actions', $tree->tree_id, '" style="display:none">'; } else { echo '<table border="0" width="100%" id="actions', $tree->tree_id, '">'; } echo '<tr align="center">', '<td><a href="admin_trees_export.php?ged=', $tree->tree_name_url, '" onclick="return modalDialog(\'admin_trees_export.php?ged=', $tree->tree_name_url, '\', \'', WT_I18N::translate('Export'), '\');">', WT_I18N::translate('Export'), '</a>', help_link('export_gedcom'), '</td>', '<td><a href="', WT_SCRIPT_NAME, '?action=importform&gedcom_id=', $tree->tree_id, '">', WT_I18N::translate('Import'), '</a>', help_link('import_gedcom'), '</td>', '<td><a href="admin_trees_download.php?ged=', $tree->tree_name_url, '">', WT_I18N::translate('Download'), '</a>', help_link('download_gedcom'), '</td>', '<td><a href="', WT_SCRIPT_NAME, '?action=uploadform&gedcom_id=', $tree->tree_id, '">', WT_I18N::translate('Upload'), '</a>', help_link('upload_gedcom'), '</td>', '<td>', '<a href="#" onclick="if (confirm(\'' . WT_Filter::escapeJs(WT_I18N::translate('Are you sure you want to delete “%s”?', $tree->tree_name)), '\')) document.delete_form', $tree->tree_id, '.submit(); return false;">', WT_I18N::translate('Delete'), '</a>', '<form name="delete_form', $tree->tree_id, '" method="post" action="', WT_SCRIPT_NAME, '">', '<input type="hidden" name="action" value="delete">', '<input type="hidden" name="gedcom_id" value="', $tree->tree_id, '">', WT_Filter::getCsrf(), '</form>', '</td></tr></table></td></tr></table><br>'; } } // Options for creating new gedcoms and setting defaults if (Auth::isAdmin()) { echo '<table class="gedcom_table2"><tr>'; if (count(WT_Tree::GetAll()) > 1) { echo '<th>', WT_I18N::translate('Default family tree'), help_link('default_gedcom'), '</th>'; } echo '<th>', WT_I18N::translate('Create a new family tree'), help_link('add_new_gedcom'), '</th></tr><tr>'; if (count(WT_Tree::GetAll()) > 1) { echo '<td><form name="defaultform" method="post" action="', WT_SCRIPT_NAME, '">', '<input type="hidden" name="action" value="setdefault">', WT_Filter::getCsrf(), select_edit_control('default_ged', WT_Tree::getNameList(), '', WT_Site::preference('DEFAULT_GEDCOM'), 'onchange="document.defaultform.submit();"'), '</form></td>'; } echo '<td class="button">', '<form name="createform" method="post" action="', WT_SCRIPT_NAME, '">', WT_Filter::getCsrf(), '<input type="hidden" name="action" value="new_tree">', '<input name="ged_name">', ' <input type="submit" value="', WT_I18N::translate('save'), '">', '</form>', '</td>', '</tr></table><br>'; // display link to PGV-WT transfer wizard on first visit to this page, before any GEDCOM is loaded if (count(WT_Tree::GetAll()) == 0 && count(User::all()) == 1) { echo '<div class="center">', '<a style="color:green; font-weight:bold;" href="admin_pgv_to_wt.php">', WT_I18N::translate('Click here for PhpGedView to <b>webtrees</b> transfer wizard'), '</a>', help_link('PGV_WIZARD'), '</div>'; } }
jQuery("#log_list").dataTable( { "dom": \'<"H"pf<"dt-clear">irl>t<"F"pl>\', "processing": true, "serverSide": true, "ajax": "' . WT_SERVER_NAME . WT_SCRIPT_PATH . WT_SCRIPT_NAME . '?action=load_json&from=' . $from . '&to=' . $to . '&type=' . $type . '&oldged=' . rawurlencode($oldged) . '&newged=' . rawurlencode($newged) . '&xref=' . rawurlencode($xref) . '&user='******'&gedc=' . rawurlencode($gedc) . '", ' . WT_I18N::datatablesI18N(array(10, 20, 50, 100, 500, 1000, -1)) . ', jQueryUI: true, autoWidth: false, sorting: [[ 0, "desc" ]], pageLength: ' . Auth::user()->getSetting('admin_site_change_page_size', 10) . ', pagingType: "full_numbers", columns: [ /* Timestamp */ { }, /* Status */ { }, /* Record */ { }, /* Old data */ { class: "raw_gedcom", sortable: false }, /* New data */ { class: "raw_gedcom", sortable: false }, /* User */ { }, /* Family tree */ { } ] }); '); $url = WT_SCRIPT_NAME . '?from=' . rawurlencode($from) . '&to=' . rawurlencode($to) . '&type=' . rawurlencode($type) . '&oldged=' . rawurlencode($oldged) . '&newged=' . rawurlencode($newged) . '&xref=' . rawurlencode($xref) . '&user='******'&gedc=' . rawurlencode($gedc); $users_array = array(); foreach (User::all() as $tmp_user) { $users_array[$tmp_user->getUserName()] = $tmp_user->getUserName(); } echo '<form name="changes" method="get" action="' . WT_SCRIPT_NAME . '">', '<input type="hidden" name="action", value="show">', '<table class="site_change">', '<tr>', '<td colspan="6">', WT_I18N::translate('From %s to %s', '<input class="log-date" name="from" value="' . WT_Filter::escapeHtml($from) . '">', '<input class="log-date" name="to" value="' . WT_Filter::escapeHtml($to) . '">'), '</td>', '</tr><tr>', '<td>', WT_I18N::translate('Status'), '<br>', select_edit_control('type', $statuses, null, $type, ''), '</td>', '<td>', WT_I18N::translate('Record'), '<br><input class="log-filter" name="xref" value="', WT_Filter::escapeHtml($xref), '"> ', '</td>', '<td>', WT_I18N::translate('Old data'), '<br><input class="log-filter" name="oldged" value="', WT_Filter::escapeHtml($oldged), '"> ', '</td>', '<td>', WT_I18N::translate('New data'), '<br><input class="log-filter" name="newged" value="', WT_Filter::escapeHtml($newged), '"> ', '</td>', '<td>', WT_I18N::translate('User'), '<br>', select_edit_control('user', $users_array, '', $user, ''), '</td>', '<td>', WT_I18N::translate('Family tree'), '<br>', select_edit_control('gedc', WT_Tree::getNameList(), '', $gedc, Auth::isAdmin() ? '' : 'disabled'), '</td>', '</tr><tr>', '<td colspan="6">', '<input type="submit" value="', WT_I18N::translate('Filter'), '">', '<input type="submit" value="', WT_I18N::translate('Export'), '" onclick="document.changes.action.value=\'export\';return true;" ', $action == 'show' ? '' : 'disabled="disabled"', '>', '<input type="submit" value="', WT_I18N::translate('Delete'), '" onclick="if (confirm(\'', WT_Filter::escapeHtml(WT_I18N::translate('Permanently delete these records?')), '\')) {document.changes.action.value=\'delete\';return true;} else {return false;}" ', $action == 'show' ? '' : 'disabled="disabled"', '>', '</td>', '</tr>', '</table>', '</form>'; if ($action) { echo '<br>', '<table id="log_list">', '<thead>', '<tr>', '<th>', WT_I18N::translate('Timestamp'), '</th>', '<th>', WT_I18N::translate('Status'), '</th>', '<th>', WT_I18N::translate('Record'), '</th>', '<th>', WT_I18N::translate('Old data'), '</th>', '<th>', WT_I18N::translate('New data'), '</th>', '<th>', WT_I18N::translate('User'), '</th>', '<th>', WT_I18N::translate('Family tree'), '</th>', '</tr>', '</thead>', '<tbody>', '</tbody>', '</table>'; }
private function config() { require_once WT_ROOT . 'includes/functions/functions_edit.php'; $controller = new WT_Controller_Page(); $controller->setPageTitle($this->getTitle())->pageHeader(); $faqs = WT_DB::prepare("SELECT block_id, block_order, gedcom_id, bs1.setting_value AS header, bs2.setting_value AS faqbody" . " FROM `##block` b" . " JOIN `##block_setting` bs1 USING (block_id)" . " JOIN `##block_setting` bs2 USING (block_id)" . " WHERE module_name = ?" . " AND bs1.setting_name = 'header'" . " AND bs2.setting_name = 'faqbody'" . " AND IFNULL(gedcom_id, ?) = ?" . " ORDER BY block_order")->execute(array($this->getName(), WT_GED_ID, WT_GED_ID))->fetchAll(); $min_block_order = WT_DB::prepare("SELECT MIN(block_order) FROM `##block` WHERE module_name=?")->execute(array($this->getName()))->fetchOne(); $max_block_order = WT_DB::prepare("SELECT MAX(block_order) FROM `##block` WHERE module_name=?")->execute(array($this->getName()))->fetchOne(); echo '<p><form method="get" action="', WT_SCRIPT_NAME, '">', WT_I18N::translate('Family tree'), ' ', '<input type="hidden" name="mod", value="', $this->getName(), '">', '<input type="hidden" name="mod_action", value="admin_config">', select_edit_control('ged', WT_Tree::getNameList(), null, WT_GEDCOM), '<input type="submit" value="', WT_I18N::translate('show'), '">', '</form></p>'; echo '<a href="module.php?mod=', $this->getName(), '&mod_action=admin_edit">', WT_I18N::translate('Add an FAQ item'), '</a>'; echo help_link('add_faq_item', $this->getName()); echo '<table id="faq_edit">'; if (empty($faqs)) { echo '<tr><td class="error center" colspan="5">', WT_I18N::translate('The FAQ list is empty.'), '</td></tr></table>'; } else { $trees = WT_Tree::getAll(); foreach ($faqs as $faq) { // NOTE: Print the position of the current item echo '<tr class="faq_edit_pos"><td>'; echo WT_I18N::translate('Position item'), ': ', $faq->block_order + 1, ', '; if ($faq->gedcom_id == null) { echo WT_I18N::translate('All'); } else { echo $trees[$faq->gedcom_id]->tree_title_html; } echo '</td>'; // NOTE: Print the edit options of the current item echo '<td>'; if ($faq->block_order == $min_block_order) { echo ' '; } else { echo '<a href="module.php?mod=', $this->getName(), '&mod_action=admin_moveup&block_id=', $faq->block_id, '" class="icon-uarrow"></a>'; echo help_link('moveup_faq_item', $this->getName()); } echo '</td><td>'; if ($faq->block_order == $max_block_order) { echo ' '; } else { echo '<a href="module.php?mod=', $this->getName(), '&mod_action=admin_movedown&block_id=', $faq->block_id, '" class="icon-darrow"></a>'; echo help_link('movedown_faq_item', $this->getName()); } echo '</td><td>'; echo '<a href="module.php?mod=', $this->getName(), '&mod_action=admin_edit&block_id=', $faq->block_id, '">', WT_I18N::translate('Edit'), '</a>'; echo help_link('edit_faq_item', $this->getName()); echo '</td><td>'; echo '<a href="module.php?mod=', $this->getName(), '&mod_action=admin_delete&block_id=', $faq->block_id, '" onclick="return confirm(\'', WT_I18N::translate('Are you sure you want to delete this FAQ entry?'), '\');">', WT_I18N::translate('Delete'), '</a>'; echo help_link('delete_faq_item', $this->getName()); echo '</td></tr>'; // NOTE: Print the title text of the current item echo '<tr><td colspan="5">'; echo '<div class="faq_edit_item">'; echo '<div class="faq_edit_title">', $faq->header, '</div>'; // NOTE: Print the body text of the current item echo '<div class="faq_edit_content">', substr($faq->faqbody, 0, 1) == '<' ? $faq->faqbody : nl2br($faq->faqbody, false), '</div></div></td></tr>'; } echo '</table>'; } }
</h2> <p> <?php echo WT_I18N::translate('This will update the highest-level part or parts of the place name. For example, “Mexico” will match “Quintana Roo, Mexico”, but not “Santa Fe, New Mexico”.'); ?> </p> <form method="post"> <dl> <dt><?php echo WT_I18N::translate('Family tree'); ?> </dt> <dd><?php echo select_edit_control('ged', WT_Tree::getNameList(), null, WT_GEDCOM, 'autofocus'); ?> </dd> <dt><label for="search"><?php echo WT_I18N::translate('Search for'); ?> </label></dt> <dd><input name="search" id="search" type="text" size="30" value="<?php echo WT_Filter::escapeHtml($search); ?> " required></dd> <dt><label for="replace"><?php echo WT_I18N::translate('Replace with'); ?> </label></dt> <dd><input name="replace" id="replace" type="text" size="30" value="<?php
// but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA use WT\Auth; define('WT_SCRIPT_NAME', 'admin_trees_check.php'); require './includes/session.php'; require WT_ROOT . 'includes/functions/functions_edit.php'; $controller = new WT_Controller_Page(); $controller->restrictAccess(Auth::isManager())->setPageTitle(WT_I18N::translate('Check for errors'))->pageHeader(); echo '<form method="get" action="', WT_SCRIPT_NAME, '">'; echo '<input type="hidden" name="go" value="1">'; echo select_edit_control('ged', WT_Tree::getNameList(), null, WT_GEDCOM); echo '<input type="submit" value="', $controller->getPageTitle(), '">'; echo '</form>'; if (!WT_Filter::get('go')) { exit; } // We need to work with raw GEDCOM data, as we are looking for errors // which may prevent the WT_GedcomRecord objects from working... $rows = WT_DB::prepare("SELECT i_id AS xref, 'INDI' AS type, i_gedcom AS gedrec FROM `##individuals` WHERE i_file=?" . " UNION " . "SELECT f_id AS xref, 'FAM' AS type, f_gedcom AS gedrec FROM `##families` WHERE f_file=?" . " UNION " . "SELECT s_id AS xref, 'SOUR' AS type, s_gedcom AS gedrec FROM `##sources` WHERE s_file=?" . " UNION " . "SELECT m_id AS xref, 'OBJE' AS type, m_gedcom AS gedrec FROM `##media` WHERE m_file=?" . " UNION " . "SELECT o_id AS xref, o_type AS type, o_gedcom AS gedrec FROM `##other` WHERE o_file=? AND o_type NOT IN ('HEAD', 'TRLR')")->execute(array(WT_GED_ID, WT_GED_ID, WT_GED_ID, WT_GED_ID, WT_GED_ID))->fetchAll(); $records = array(); foreach ($rows as $row) { $records[$row->xref] = $row; } // Need to merge pending new/changed/deleted records $rows = WT_DB::prepare(" SELECT xref, SUBSTRING_INDEX(SUBSTRING_INDEX(SUBSTRING_INDEX(CASE WHEN old_gedcom='' THEN new_gedcom ELSE old_gedcom END, '\n', 1), ' ', 3), ' ', -1) AS type, new_gedcom AS gedrec" . " FROM (" . " SELECT MAX(change_id) AS change_id" . " FROM `##change`" . " WHERE gedcom_id=? AND status='pending'" . " GROUP BY xref" . " ) AS t1" . " JOIN `##change` t2 USING (change_id)")->execute(array(WT_GED_ID))->fetchAll(); foreach ($rows as $row) {
define('WT_SCRIPT_NAME', 'admin_site_other.php'); require './includes/session.php'; require WT_ROOT . 'includes/functions/functions_edit.php'; $controller = new WT_Controller_Page(); $controller->restrictAccess(Auth::isManager())->setPageTitle(WT_I18N::translate('Add unlinked records'))->pageHeader(); ?> <div id="other"> <p> <?php echo WT_I18N::translate('Add unlinked records'); ?> </p> <p> <form method="post" action="?" name="tree"> <?php echo select_edit_control('ged', WT_Tree::getNameList(), null, WT_GEDCOM, ' onchange="tree.submit();"'); ?> </form> </p> <table id="other"> <tr> <td> <a href="#" onclick="add_unlinked_indi(); return false;"> <?php echo WT_I18N::translate('Create a new individual'); ?> </a> </td> </tr> <tr> <td>