/** * Startup activity */ public function __construct() { parent::__construct(); // Extract the request parameters $this->show_thumbs = Filter::getBool('show_thumbs'); if ($this->root && $this->root->canShowName()) { $this->setPageTitle(I18N::translate('Compact tree of %s', $this->root->getFullName())); } else { $this->setPageTitle(I18N::translate('Compact tree')); } $this->treeid = $this->sosaAncestors(5); }
/** * Create a branches list controller */ public function __construct() { global $WT_TREE; parent::__construct(); $this->surname = Filter::get('surname'); $this->soundex_std = Filter::getBool('soundex_std'); $this->soundex_dm = Filter::getBool('soundex_dm'); if ($this->surname) { $this->setPageTitle(I18N::translate('Branches of the %s family', Filter::escapeHtml($this->surname))); $this->loadIndividuals(); $self = Individual::getInstance($WT_TREE->getUserPreference(Auth::user(), 'gedcomid'), $WT_TREE); if ($self) { $this->loadAncestors($self, 1); } } else { $this->setPageTitle(I18N::translate('Branches')); } }
/** * Task@setStatus */ public function setStatus() { $controller = new JsonController(); $task_name = Filter::get('task'); $task = $this->provider->getTask($task_name, false); $controller->restrictAccess(true && Auth::isAdmin() && $task); $status = Filter::getBool('status'); $res = array('task' => $task->getName(), 'error' => null); try { $this->provider->setTaskStatus($task, $status); $res['status'] = $status; Log::addConfigurationLog('Module ' . $this->module->getName() . ' : Admin Task "' . $task->getName() . '" has been ' . ($status ? 'enabled' : 'disabled') . '.'); } catch (\Exception $ex) { $res['error'] = $ex->getMessage(); Log::addErrorLog('Module ' . $this->module->getName() . ' : Admin Task "' . $task->getName() . '" could not be ' . ($status ? 'enabled' : 'disabled') . '. Error: ' . $ex->getMessage()); } $controller->pageHeader(); if ($res['error']) { http_response_code(500); } $controller->encode($res); }
* Defined in session.php * * @global Tree $WT_TREE */ global $WT_TREE; use Fisharebest\Webtrees\Controller\SimpleController; use Fisharebest\Webtrees\Functions\FunctionsDb; use Fisharebest\Webtrees\Query\QueryMedia; define('WT_SCRIPT_NAME', 'find.php'); require './includes/session.php'; $controller = new SimpleController(); $type = Filter::get('type'); $filter = Filter::get('filter'); $action = Filter::get('action'); $callback = Filter::get('callback', '[a-zA-Z0-9_]+', 'paste_id'); $all = Filter::getBool('all'); $subclick = Filter::get('subclick'); $choose = Filter::get('choose', '[a-zA-Z0-9_]+', '0all'); $qs = Filter::get('tags'); if ($subclick === 'all') { $all = true; } $embed = substr($choose, 0, 1) === '1'; switch ($type) { case 'indi': $controller->setPageTitle(I18N::translate('Find an individual')); break; case 'fam': $controller->setPageTitle(I18N::translate('Find a family')); break; case 'media':
/** * Places administration. */ private function adminPlaces() { global $WT_TREE; $action = Filter::get('action'); $parent = Filter::get('parent'); $inactive = Filter::getBool('inactive'); $deleteRecord = Filter::get('deleteRecord'); if (!isset($parent)) { $parent = 0; } $controller = new PageController(); $controller->restrictAccess(Auth::isAdmin()); if ($action == 'ExportFile' && Auth::isAdmin()) { $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 '"', I18N::translate('Level'), '";"', I18N::translate('Country'), '";'; if ($maxLevel > 0) { echo '"', I18N::translate('State'), '";'; } if ($maxLevel > 1) { echo '"', I18N::translate('County'), '";'; } if ($maxLevel > 2) { echo '"', I18N::translate('City'), '";'; } if ($maxLevel > 3) { echo '"', I18N::translate('Place'), '";'; } if ($maxLevel > 4) { echo '"', I18N::translate('Place'), '";'; } if ($maxLevel > 5) { echo '"', I18N::translate('Place'), '";'; } if ($maxLevel > 6) { echo '"', I18N::translate('Place'), '";'; } if ($maxLevel > 7) { echo '"', I18N::translate('Place'), '";'; } echo '"', I18N::translate('Longitude'), '";"', I18N::translate('Latitude'), '";'; echo '"', I18N::translate('Zoom level'), '";"', I18N::translate('Icon'), '";', WT_EOL; $this->outputLevel($parent); exit; } $controller->setPageTitle(I18N::translate('Google Maps™'))->pageHeader(); ?> <ol class="breadcrumb small"> <li><a href="admin.php"><?php echo I18N::translate('Control panel'); ?> </a></li> <li><a href="admin_modules.php"><?php echo I18N::translate('Module administration'); ?> </a></li> <li class="active"><?php echo $controller->getPageTitle(); ?> </li> </ol> <ul class="nav nav-tabs nav-justified" role="tablist"> <li role="presentation"> <a href="?mod=googlemap&mod_action=admin_config" role="tab"> <?php echo I18N::translate('Google Maps™ preferences'); ?> </a> </li> <li role="presentation" class="active"> <a href="#"> <?php echo I18N::translate('Geographic data'); ?> </a> </li> <li role="presentation"> <a href="?mod=googlemap&mod_action=admin_placecheck"> <?php echo I18N::translate('Place check'); ?> </a> </li> </ul> <h2><?php echo I18N::translate('Geographic data'); ?> </h2> <?php if ($action == 'ImportGedcom') { $placelist = array(); $j = 0; $gedcom_records = Database::prepare("SELECT i_gedcom FROM `##individuals` WHERE i_file=? UNION ALL SELECT f_gedcom FROM `##families` WHERE f_file=?")->execute(array($WT_TREE->getTreeId(), $WT_TREE->getTreeId()))->fetchOneColumn(); foreach ($gedcom_records as $gedrec) { $i = 1; $placerec = Functions::getSubRecord(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 = Functions::getSubRecord(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 = Database::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++; Database::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 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++; Database::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 Filter::escapeHtml($escparent), '<br>'; } else { if (empty($row->pl_long) && empty($row->pl_lati) && $place['lati'] != '0' && $place['long'] != '0') { Database::prepare("UPDATE `##placelocation` SET pl_lati=?, pl_long=? WHERE pl_id=?")->execute(array($place['lati'], $place['long'], $row->pl_id)); echo Filter::escapeHtml($escparent), '<br>'; } } } } } $parent = 0; } if ($action === 'ImportFile') { $placefiles = $this->findFiles(WT_MODULES_DIR . 'googlemap/extra'); sort($placefiles); ?> <form class="form-horizontal" method="post" enctype="multipart/form-data" id="importfile" name="importfile" action="module.php?mod=googlemap&mod_action=admin_places&action=ImportFile2"> <!-- PLACES FILE --> <div class="form-group"> <label class="control-label col-sm-4" for="placesfile"> <?php echo I18N::translate('File containing places (CSV)'); ?> </label> <div class="col-sm-8"> <div class="btn btn-default"> <input id="placesfile" type="file" name="placesfile"> </div> </div> </div> <!-- LOCAL FILE --> <?php if (count($placefiles) > 0) { ?> <div class="form-group"> <label class="control-label col-sm-4" for="localfile"> <?php echo I18N::translate('Server file containing places (CSV)'); ?> </label> <div class="col-sm-8"> <div class="input-group"> <span class="input-group-addon"> <?php echo WT_MODULES_DIR . 'googlemap/extra/'; ?> </span> <?php foreach ($placefiles as $p => $placefile) { unset($placefiles[$p]); $p = Filter::escapeHtml($placefile); if (substr($placefile, 0, 1) == "/") { $placefiles[$p] = substr($placefile, 1); } else { $placefiles[$p] = $placefile; } } echo FunctionsEdit::selectEditControl('localfile', $placefiles, '', '', 'class="form-control"'); ?> </div> </div> </div> <?php } ?> <!-- CLEAR DATABASE --> <fieldset class="form-group"> <legend class="control-label col-sm-4"> <?php echo I18N::translate('Delete all existing geographic data before importing the file.'); ?> </legend> <div class="col-sm-8"> <?php echo FunctionsEdit::editFieldYesNo('cleardatabase', 0, 'class="radio-inline"'); ?> </div> </fieldset> <!-- UPDATE ONLY --> <fieldset class="form-group"> <legend class="control-label col-sm-4"> <?php echo I18N::translate('Do not create new locations, just import coordinates for existing locations.'); ?> </legend> <div class="col-sm-8"> <?php echo FunctionsEdit::editFieldYesNo('updateonly', 0, 'class="radio-inline"'); ?> </div> </fieldset> <!-- OVERWRITE DATA --> <fieldset class="form-group"> <legend class="control-label col-sm-4"> <?php echo I18N::translate('Overwrite existing coordinates.'); ?> </legend> <div class="col-sm-8"> <?php echo FunctionsEdit::editFieldYesNo('overwritedata', 0, 'class="radio-inline"'); ?> </div> </fieldset> <!-- SAVE BUTTON --> <div class="form-group"> <div class="col-sm-offset-4 col-sm-8"> <button type="submit" class="btn btn-primary"> <i class="fa fa-check"></i> <?php echo I18N::translate('Continue adding'); ?> </button> </div> </div> </form> <?php exit; } if ($action === 'ImportFile2') { $country_names = array(); $stats = new Stats($WT_TREE); foreach ($stats->iso3166() as $key => $value) { $country_names[$key] = I18N::translate($key); } if (Filter::postBool('cleardatabase')) { Database::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 = Database::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 (!Filter::postBool('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)) { Database::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); } Database::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 (Filter::postBool('overwritedata') && $i + 1 == count($parent)) { Database::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 { // Update only if existing data is missing if (!$row->pl_long && !$row->pl_lati) { Database::prepare("UPDATE `##placelocation` SET pl_lati = ?, pl_long = ? WHERE pl_id = ?")->execute(array($place['lati'], $place['long'], $parent_id)); } if (!$row->pl_icon && $place['icon']) { Database::prepare("UPDATE `##placelocation` SET pl_icon = ? WHERE pl_id = ?")->execute(array($place['icon'], $parent_id)); } } } } } $parent = 0; } if ($action == 'DeleteRecord') { $exists = Database::prepare("SELECT 1 FROM `##placelocation` WHERE pl_parent_id=?")->execute(array($deleteRecord))->fetchOne(); if (!$exists) { Database::prepare("DELETE FROM `##placelocation` WHERE pl_id=?")->execute(array($deleteRecord)); } else { echo '<table class="facts_table"><tr><td>', 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 I18N::translate('Remove this location?'); ?> '); if (answer == true) { window.location = '<?php echo Functions::getQueryUrl(array('action' => 'DeleteRecord')); ?> &action=DeleteRecord&deleteRecord=' + placeid; } } </script> <p id="gm_breadcrumb"> <?php $where_am_i = $this->placeIdToHierarchy($parent); foreach (array_reverse($where_am_i, true) as $id => $place) { if ($id == $parent) { if ($place != 'Unknown') { echo Filter::escapeHtml($place); } else { echo I18N::translate('unknown'); } } else { echo '<a href="module.php?mod=googlemap&mod_action=admin_places&parent=', $id, '&inactive=', $inactive, '">'; if ($place != 'Unknown') { echo Filter::escapeHtml($place), '</a>'; } else { echo I18N::translate('unknown'), '</a>'; } } echo ' - '; } ?> <a href="module.php?mod=googlemap&mod_action=admin_places&parent=0&inactive=', $inactive, '"><?php echo I18N::translate('Top level'); ?> </a> </p> <form class="form-inline" name="active" method="post" action="module.php?mod=googlemap&mod_action=admin_places&parent=', $parent, '&inactive=', $inactive, '"> <div class="checkbox"> <label for="inactive"> <?php echo FunctionsEdit::checkbox('inactive', $inactive, 'onclick="updateList(this.checked)"'); ?> <?php echo I18N::translate('Show inactive places'); ?> </label> </div> <p class="small text-muted"> <?php echo I18N::translate('By default, the list shows only those places which can be found in your family trees. You may have details for other places, such as those imported in bulk from an external file. Selecting this option will show all places, including ones that are not currently used.'); ?> <?php echo I18N::translate('If you have a large number of inactive places, it can be slow to generate the list.'); ?> </p> </form> <?php $placelist = $this->getPlaceListLocation($parent, $inactive); echo '<div class="gm_plac_edit">'; echo '<table class="table table-bordered table-condensed table-hover"><tr>'; echo '<th>', GedcomTag::getLabel('PLAC'), '</th>'; echo '<th>', GedcomTag::getLabel('LATI'), '</th>'; echo '<th>', GedcomTag::getLabel('LONG'), '</th>'; echo '<th>', I18N::translate('Zoom level'), '</th>'; echo '<th>', I18N::translate('Icon'), '</th>'; echo '<th>'; echo I18N::translate('Edit'), '</th><th>', I18N::translate('Delete'), '</th></tr>'; if (count($placelist) == 0) { echo '<tr><td colspan="7">', 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 Filter::escapeHtml($place['place']), '</a></td>'; } else { echo 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']) { echo '<img src="', WT_STATIC_URL, WT_MODULES_DIR, 'googlemap/', $place['icon'], '" width="25" height="15">'; } else { if ($place['lati'] || $place['long']) { 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/images/mm_20_yellow.png">'; } } echo '</td>'; echo '<td class="narrow"><a href="#" onclick="edit_place_location(', $place['place_id'], ');return false;" class="icon-edit" title="', I18N::translate('Edit'), '"></a></td>'; $noRows = Database::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 I18N::translate('Remove'); ?> "></a></td> <?php } else { ?> <td><i class="icon-delete-grey"></i></td> <?php } ?> </tr> <?php } ?> </table> </div> <hr> <form class="form-horizontal" action="?" onsubmit="add_place_location(this.parent_id.options[this.parent_id.selectedIndex].value); return false;"> <div class="form-group"> <label class="form-control-static col-sm-4" for="parent_id"> <?php echo I18N::translate('Add a new geographic location'); ?> </label> <div class="col-sm-8"> <div class="col-sm-6"> <?php echo FunctionsEdit::selectEditControl('parent_id', $where_am_i, I18N::translate('Top level'), $parent, 'class="form-control"'); ?> </div> <button type="submit" class="btn btn-default"> <i class="fa fa-plus"></i> <?php echo I18N::translate('Add'); ?> </button> </div> </div> </form> <form class="form-horizontal" 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"> <div class="form-group"> <label class="form-control-static col-sm-4" for="ged"> <?php echo I18N::translate('Import all places from a family tree'); ?> </label> <div class="col-sm-8"> <div class="col-sm-6"> <?php echo FunctionsEdit::selectEditControl('ged', Tree::getNameList(), null, $WT_TREE->getName(), 'class="form-control"'); ?> </div> <button type="submit" class="btn btn-default"> <i class="fa fa-upload"></i> <?php echo I18N::translate('Import'); ?> </button> </div> </div> </form> <form class="form-horizontal" 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"> <div class="form-group"> <label class="form-control-static col-sm-4"> <?php echo I18N::translate('Upload geographic data'); ?> </label> <div class="col-sm-8"> <div class="col-sm-6"> <button type="submit" class="btn btn-default"> <i class="fa fa-upload"></i> <?php echo I18N::translate('Upload'); ?> </button> </div> </div> </div> </form> <form class="form-horizontal" 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"> <div class="form-group"> <label class="form-control-static col-sm-4"> <?php echo I18N::translate('Download geographic data'); ?> </label> <div class="col-sm-8"> <div class="col-sm-6"> <?php echo FunctionsEdit::selectEditControl('parent', $where_am_i, I18N::translate('All'), $WT_TREE->getTreeId(), 'class="form-control"'); ?> </div> <button type="submit" class="btn btn-default"> <i class="fa fa-download"></i> <?php echo I18N::translate('Download'); ?> </button> </div> </div> </form> <?php }
/** * Startup activity */ public function __construct() { global $WT_TREE; parent::__construct(); $this->setPageTitle(I18N::translate('Lifespans')); $this->facts = explode('|', WT_EVENTS_BIRT . '|' . WT_EVENTS_DEAT . '|' . WT_EVENTS_MARR . '|' . WT_EVENTS_DIV); $tmp = explode('\\', get_class(I18N::defaultCalendar())); $cal = strtolower(array_pop($tmp)); $this->defaultCalendar = str_replace('calendar', '', $cal); $filterPids = false; // Request parameters $clear = Filter::getBool('clear'); $newpid = Filter::get('newpid', WT_REGEX_XREF); $addfam = Filter::getBool('addFamily'); $this->place = Filter::get('place'); $this->beginYear = Filter::getInteger('beginYear', 0, PHP_INT_MAX, null); $this->endYear = Filter::getInteger('endYear', 0, PHP_INT_MAX, null); $this->calendar = Filter::get('calendar', null, $this->defaultCalendar); $this->strictDate = Filter::getBool('strictDate'); // Set up base color parameters $this->colors['M'] = new ColorGenerator(240, self::SATURATION, self::LIGHTNESS, self::ALPHA, self::RANGE * -1); $this->colors['F'] = new ColorGenerator(00, self::SATURATION, self::LIGHTNESS, self::ALPHA, self::RANGE); // Build a list of people based on the input parameters if ($clear) { // Empty list & reset form $xrefs = array(); $this->place = null; $this->beginYear = null; $this->endYear = null; $this->calendar = $this->defaultCalendar; } elseif ($this->place) { // Get all individual & family records found for a place $this->place_obj = new Place($this->place, $WT_TREE); $xrefs = Database::prepare("SELECT DISTINCT `i_id` FROM `##placelinks`" . " JOIN `##individuals` ON `pl_gid`=`i_id` AND `pl_file`=`i_file`" . " WHERE `i_file`=:tree_id" . " AND `pl_p_id`=:place_id" . " UNION" . " SELECT DISTINCT `f_id` FROM `##placelinks`" . " JOIN `##families` ON `pl_gid`=`f_id` AND `pl_file`=`f_file`" . " WHERE `f_file`=:tree_id" . " AND `pl_p_id`=:place_id")->execute(array('tree_id' => $WT_TREE->getTreeId(), 'place_id' => $this->place_obj->getPlaceId()))->fetchOneColumn(); } else { // Modify an existing list of records $xrefs = Session::get(self::SESSION_DATA, array()); if ($newpid) { $xrefs = array_merge($xrefs, $this->addFamily(Individual::getInstance($newpid, $WT_TREE), $addfam)); $xrefs = array_unique($xrefs); } elseif (!$xrefs) { $xrefs = $this->addFamily($this->getSignificantIndividual(), false); } } $tmp = $this->getCalendarDate(unixtojd()); $this->currentYear = $tmp->today()->y; $tmp = strtoupper(strtr($this->calendar, array('jewish' => 'hebrew', 'french' => 'french r'))); $this->calendarEscape = sprintf('@#D%s@', $tmp); if ($xrefs) { // ensure date ranges are valid in preparation for filtering list if ($this->beginYear || $this->endYear) { $filterPids = true; if (!$this->beginYear) { $tmp = new Date($this->calendarEscape . ' 1'); $this->beginYear = $tmp->minimumDate()->y; } if (!$this->endYear) { $this->endYear = $this->currentYear; } $this->startDate = new Date($this->calendarEscape . $this->beginYear); $this->endDate = new Date($this->calendarEscape . $this->endYear); } // Test each xref to see if the search criteria are met foreach ($xrefs as $key => $xref) { $valid = false; $person = Individual::getInstance($xref, $WT_TREE); if ($person) { if ($person->canShow()) { foreach ($person->getFacts() as $fact) { if ($this->checkFact($fact)) { $this->people[] = $person; $valid = true; break; } } } } else { $family = Family::getInstance($xref, $WT_TREE); if ($family && $family->canShow() && $this->checkFact($family->getMarriage())) { $valid = true; $this->people[] = $family->getHusband(); $this->people[] = $family->getWife(); } } if (!$valid) { unset($xrefs[$key]); // no point in storing a xref if we can't use it } } Session::put(self::SESSION_DATA, $xrefs); } else { Session::forget(self::SESSION_DATA); } $this->people = array_filter(array_unique($this->people)); $count = count($this->people); if ($count) { // Build the subtitle if ($this->place && $filterPids) { $this->subtitle = I18N::plural('%s individual with events in %s between %s and %s', '%s individuals with events in %s between %s and %s', $count, I18N::number($count), $this->place, $this->startDate->display(false, '%Y'), $this->endDate->display(false, '%Y')); } elseif ($this->place) { $this->subtitle = I18N::plural('%s individual with events in %s', '%s individuals with events in %s', $count, I18N::number($count), $this->place); } elseif ($filterPids) { $this->subtitle = I18N::plural('%s individual with events between %s and %s', '%s individuals with events between %s and %s', $count, I18N::number($count), $this->startDate->display(false, '%Y'), $this->endDate->display(false, '%Y')); } else { $this->subtitle = I18N::plural('%s individual', '%s individuals', $count, I18N::number($count)); } // Sort the array in order of birth year usort($this->people, function (Individual $a, Individual $b) { return Date::compare($a->getEstimatedBirthDate(), $b->getEstimatedBirthDate()); }); //Find the mimimum birth year and maximum death year from the individuals in the array. $bdate = $this->getCalendarDate($this->people[0]->getEstimatedBirthDate()->minimumJulianDay()); $minyear = $bdate->y; $that = $this; // PHP5.3 cannot access $this inside a closure $maxyear = array_reduce($this->people, function ($carry, Individual $item) use($that) { $date = $that->getCalendarDate($item->getEstimatedDeathDate()->maximumJulianDay()); return max($carry, $date->y); }, 0); } elseif ($filterPids) { $minyear = $this->endYear; $maxyear = $this->endYear; } else { $minyear = $this->currentYear; $maxyear = $this->currentYear; } $maxyear = min($maxyear, $this->currentYear); // Limit maximum year to current year as we can't forecast the future $minyear = min($minyear, $maxyear - $WT_TREE->getPreference('MAX_ALIVE_AGE')); // Set default minimum chart length $this->timelineMinYear = (int) floor($minyear / 10) * 10; // round down to start of the decade $this->timelineMaxYear = (int) ceil($maxyear / 10) * 10; // round up to start of next decade }
/** * Find a media object. */ private static function mediaFind() { global $WT_TREE; $controller = new SimpleController(); $filter = Filter::get('filter'); $multiple = Filter::getBool('multiple'); $controller->setPageTitle(I18N::translate('Find an individual'))->pageHeader(); ?> <script> function pasterow(id, name, gend, yob, age, bpl) { window.opener.opener.insertRowToTable(id, name, '', gend, '', yob, age, 'Y', '', bpl); } function pasteid(id, name, thumb) { if (thumb) { window.opener.paste_id(id, name, thumb); <?php if (!$multiple) { echo "window.close();"; } ?> } else { // GEDFact_assistant ======================== if (window.opener.document.getElementById('addlinkQueue')) { window.opener.insertRowToTable(id, name); } window.opener.paste_id(id); if (window.opener.pastename) { window.opener.pastename(name); } <?php if (!$multiple) { echo "window.close();"; } ?> } } function checknames(frm) { if (document.forms[0].subclick) { button = document.forms[0].subclick.value; } else { button = ""; } if (frm.filter.value.length < 2 && button !== "all") { alert("<?php echo I18N::translate('Please enter more than one character.'); ?> "); frm.filter.focus(); return false; } if (button=="all") { frm.filter.value = ""; } return true; } </script> <?php echo '<div>'; echo '<table class="list_table width90" border="0">'; echo '<tr><td style="padding: 10px;" class="facts_label03 width90">'; // start column for find text header echo $controller->getPageTitle(); echo '</td>'; echo '</tr>'; echo '</table>'; echo '<br>'; echo '<button onclick="window.close();">', I18N::translate('close'), '</button>'; echo '<br>'; $filter = trim($filter); $filter_array = explode(' ', preg_replace('/ {2,}/', ' ', $filter)); echo '<table class="tabs_table width90"><tr>'; $myindilist = FunctionsDb::searchIndividualNames($filter_array, array($WT_TREE)); if ($myindilist) { echo '<td class="list_value_wrap"><ul>'; usort($myindilist, '\\Fisharebest\\Webtrees\\GedcomRecord::compare'); foreach ($myindilist as $indi) { $nam = Filter::escapeHtml($indi->getFullName()); echo "<li><a href=\"#\" onclick=\"pasterow(\n\t\t\t\t\t'" . $indi->getXref() . "' ,\n\t\t\t\t\t'" . $nam . "' ,\n\t\t\t\t\t'" . $indi->getSex() . "' ,\n\t\t\t\t\t'" . $indi->getBirthYear() . "' ,\n\t\t\t\t\t'" . (1901 - $indi->getBirthYear()) . "' ,\n\t\t\t\t\t'" . $indi->getBirthPlace() . "'); return false;\">\n\t\t\t\t\t<b>" . $indi->getFullName() . "</b> "; $born = GedcomTag::getLabel('BIRT'); echo "</span><br><span class=\"list_item\">", $born, " ", $indi->getBirthYear(), " ", $indi->getBirthPlace(), "</span></a></li>"; echo "<hr>"; } echo '</ul></td></tr><tr><td class="list_label">', I18N::translate('Total individuals: %s', count($myindilist)), '</tr></td>'; } else { echo "<td class=\"list_value_wrap\">"; echo I18N::translate('No results found.'); echo "</td></tr>"; } echo "</table>"; echo '</div>'; }
* Defined in session.php * * @global Tree $WT_TREE */ global $WT_TREE; use Fisharebest\Webtrees\Controller\RelationshipController; use Fisharebest\Webtrees\Functions\Functions; use Fisharebest\Webtrees\Functions\FunctionsEdit; use Fisharebest\Webtrees\Functions\FunctionsPrint; define('WT_SCRIPT_NAME', 'relationship.php'); require './includes/session.php'; $controller = new RelationshipController(); $pid1 = Filter::get('pid1', WT_REGEX_XREF); $pid2 = Filter::get('pid2', WT_REGEX_XREF); $show_full = Filter::getInteger('show_full', 0, 1, $WT_TREE->getPreference('PEDIGREE_FULL_DETAILS')); $find_all = Filter::getBool('find_all'); $person1 = Individual::getInstance($pid1, $WT_TREE); $person2 = Individual::getInstance($pid2, $WT_TREE); $controller->addExternalJavascript(WT_AUTOCOMPLETE_JS_URL)->addInlineJavascript('autocomplete();'); if ($person1 && $person2) { $controller->setPageTitle(I18N::translate('Relationships between %1$s and %2$s', $person1->getFullName(), $person2->getFullName()))->pageHeader(); $paths = $controller->calculateRelationships($person1, $person2, $find_all); } else { $controller->setPageTitle(I18N::translate('Relationships'))->pageHeader(); $paths = array(); } ?> <h2><?php echo $controller->getPageTitle(); ?> </h2>
/** * An HTML form to edit block settings * * @param int $block_id */ public function configureBlock($block_id) { if (Filter::postBool('save') && Filter::checkCsrf()) { $this->setBlockSetting($block_id, 'filter', Filter::post('filter', 'indi|event|all', 'all')); $this->setBlockSetting($block_id, 'controls', Filter::postBool('controls')); $this->setBlockSetting($block_id, 'start', Filter::postBool('start')); $this->setBlockSetting($block_id, 'filter_avi', Filter::postBool('filter_avi')); $this->setBlockSetting($block_id, 'filter_bmp', Filter::postBool('filter_bmp')); $this->setBlockSetting($block_id, 'filter_gif', Filter::postBool('filter_gif')); $this->setBlockSetting($block_id, 'filter_jpeg', Filter::postBool('filter_jpeg')); $this->setBlockSetting($block_id, 'filter_mp3', Filter::postBool('filter_mp3')); $this->setBlockSetting($block_id, 'filter_ole', Filter::postBool('filter_ole')); $this->setBlockSetting($block_id, 'filter_pcx', Filter::postBool('filter_pcx')); $this->setBlockSetting($block_id, 'filter_pdf', Filter::postBool('filter_pdf')); $this->setBlockSetting($block_id, 'filter_png', Filter::postBool('filter_png')); $this->setBlockSetting($block_id, 'filter_tiff', Filter::postBool('filter_tiff')); $this->setBlockSetting($block_id, 'filter_wav', Filter::postBool('filter_wav')); $this->setBlockSetting($block_id, 'filter_audio', Filter::postBool('filter_audio')); $this->setBlockSetting($block_id, 'filter_book', Filter::postBool('filter_book')); $this->setBlockSetting($block_id, 'filter_card', Filter::postBool('filter_card')); $this->setBlockSetting($block_id, 'filter_certificate', Filter::postBool('filter_certificate')); $this->setBlockSetting($block_id, 'filter_coat', Filter::postBool('filter_coat')); $this->setBlockSetting($block_id, 'filter_document', Filter::postBool('filter_document')); $this->setBlockSetting($block_id, 'filter_electronic', Filter::postBool('filter_electronic')); $this->setBlockSetting($block_id, 'filter_fiche', Filter::postBool('filter_fiche')); $this->setBlockSetting($block_id, 'filter_film', Filter::postBool('filter_film')); $this->setBlockSetting($block_id, 'filter_magazine', Filter::postBool('filter_magazine')); $this->setBlockSetting($block_id, 'filter_manuscript', Filter::postBool('filter_manuscript')); $this->setBlockSetting($block_id, 'filter_map', Filter::postBool('filter_map')); $this->setBlockSetting($block_id, 'filter_newspaper', Filter::postBool('filter_newspaper')); $this->setBlockSetting($block_id, 'filter_other', Filter::postBool('filter_other')); $this->setBlockSetting($block_id, 'filter_painting', Filter::postBool('filter_painting')); $this->setBlockSetting($block_id, 'filter_photo', Filter::postBool('filter_photo')); $this->setBlockSetting($block_id, 'filter_tombstone', Filter::postBool('filter_tombstone')); $this->setBlockSetting($block_id, 'filter_video', Filter::postBool('filter_video')); } $filter = $this->getBlockSetting($block_id, 'filter', 'all'); $controls = $this->getBlockSetting($block_id, 'controls', '1'); $start = $this->getBlockSetting($block_id, 'start', '0') || Filter::getBool('start'); echo '<tr><td class="descriptionbox wrap width33">'; echo I18N::translate('Show only individuals, events, or all'); echo '</td><td class="optionbox">'; echo FunctionsEdit::selectEditControl('filter', array('indi' => I18N::translate('Individuals'), 'event' => I18N::translate('Facts and events'), 'all' => I18N::translate('All')), null, $filter, ''); echo '</td></tr>'; $filters = array('avi' => $this->getBlockSetting($block_id, 'filter_avi', '0'), 'bmp' => $this->getBlockSetting($block_id, 'filter_bmp', '1'), 'gif' => $this->getBlockSetting($block_id, 'filter_gif', '1'), 'jpeg' => $this->getBlockSetting($block_id, 'filter_jpeg', '1'), 'mp3' => $this->getBlockSetting($block_id, 'filter_mp3', '0'), 'ole' => $this->getBlockSetting($block_id, 'filter_ole', '1'), 'pcx' => $this->getBlockSetting($block_id, 'filter_pcx', '1'), 'pdf' => $this->getBlockSetting($block_id, 'filter_pdf', '0'), 'png' => $this->getBlockSetting($block_id, 'filter_png', '1'), 'tiff' => $this->getBlockSetting($block_id, 'filter_tiff', '1'), 'wav' => $this->getBlockSetting($block_id, 'filter_wav', '0'), 'audio' => $this->getBlockSetting($block_id, 'filter_audio', '0'), 'book' => $this->getBlockSetting($block_id, 'filter_book', '1'), 'card' => $this->getBlockSetting($block_id, 'filter_card', '1'), 'certificate' => $this->getBlockSetting($block_id, 'filter_certificate', '1'), 'coat' => $this->getBlockSetting($block_id, 'filter_coat', '1'), 'document' => $this->getBlockSetting($block_id, 'filter_document', '1'), 'electronic' => $this->getBlockSetting($block_id, 'filter_electronic', '1'), 'fiche' => $this->getBlockSetting($block_id, 'filter_fiche', '1'), 'film' => $this->getBlockSetting($block_id, 'filter_film', '1'), 'magazine' => $this->getBlockSetting($block_id, 'filter_magazine', '1'), 'manuscript' => $this->getBlockSetting($block_id, 'filter_manuscript', '1'), 'map' => $this->getBlockSetting($block_id, 'filter_map', '1'), 'newspaper' => $this->getBlockSetting($block_id, 'filter_newspaper', '1'), 'other' => $this->getBlockSetting($block_id, 'filter_other', '1'), 'painting' => $this->getBlockSetting($block_id, 'filter_painting', '1'), 'photo' => $this->getBlockSetting($block_id, 'filter_photo', '1'), 'tombstone' => $this->getBlockSetting($block_id, 'filter_tombstone', '1'), 'video' => $this->getBlockSetting($block_id, 'filter_video', '0')); ?> <tr> <td class="descriptionbox wrap width33"> <?php echo I18N::translate('Filter'); ?> </td> <td class="optionbox"> <center><b><?php echo GedcomTag::getLabel('FORM'); ?> </b></center> <table class="width100"> <tr> <td class="width33"> <label> <input type="checkbox" value="yes" name="filter_avi" <?php echo $filters['avi'] ? 'checked' : ''; ?> > avi </td> <td class="width33"> <label> <input type="checkbox" value="yes" name="filter_bmp" <?php echo $filters['bmp'] ? 'checked' : ''; ?> > bmp </label> </td> <td class="width33"> <label> <input type="checkbox" value="yes" name="filter_gif" <?php echo $filters['gif'] ? 'checked' : ''; ?> > gif </label> </td> </tr> <tr> <td class="width33"> <label> <input type="checkbox" value="yes" name="filter_jpeg" <?php echo $filters['jpeg'] ? 'checked' : ''; ?> > jpeg </label> </td> <td class="width33"> <label> <input type="checkbox" value="yes" name="filter_mp3" <?php echo $filters['mp3'] ? 'checked' : ''; ?> > mp3 </label> </td> <td class="width33"> <label> <input type="checkbox" value="yes" name="filter_ole" <?php echo $filters['ole'] ? 'checked' : ''; ?> > ole </label> </td> </tr> <tr> <td class="width33"> <label> <input type="checkbox" value="yes" name="filter_pcx" <?php echo $filters['pcx'] ? 'checked' : ''; ?> > pcx </label> </td> <td class="width33"> <label> <input type="checkbox" value="yes" name="filter_pdf" <?php echo $filters['pdf'] ? 'checked' : ''; ?> > pdf </label> </td> <td class="width33"> <label> <input type="checkbox" value="yes" name="filter_png" <?php echo $filters['png'] ? 'checked' : ''; ?> > png </label> </td> </tr> <tr> <td class="width33"> <label> <input type="checkbox" value="yes" name="filter_tiff" <?php echo $filters['tiff'] ? 'checked' : ''; ?> > tiff </label> </td> <td class="width33"> <label> <input type="checkbox" value="yes" name="filter_wav" <?php echo $filters['wav'] ? 'checked' : ''; ?> > wav </label> </td> <td class="width33"></td> <td class="width33"></td> </tr> </table> <br> <center><b><?php echo GedcomTag::getLabel('TYPE'); ?> </b></center> <table class="width100"> <tr> <?php //-- Build the list of checkboxes $i = 0; foreach (GedcomTag::getFileFormTypes() as $typeName => $typeValue) { $i++; if ($i > 3) { $i = 1; echo '</tr><tr>'; } echo '<td class="width33"><label><input type="checkbox" value="yes" name="filter_' . $typeName . '" '; echo $filters[$typeName] ? 'checked' : ''; echo '> ' . $typeValue . '</label></td>'; } ?> </tr> </table> </td> </tr> <?php echo '<tr><td class="descriptionbox wrap width33">'; echo I18N::translate('Show slide show controls'); echo '</td><td class="optionbox">'; echo FunctionsEdit::editFieldYesNo('controls', $controls); echo '</td></tr>'; echo '<tr><td class="descriptionbox wrap width33">'; echo I18N::translate('Start slide show on page load'); echo '</td><td class="optionbox">'; echo FunctionsEdit::editFieldYesNo('start', $start); echo '</td></tr>'; }
/** * Default option is just the "don't update CHAN record" */ public function getOptions() { $this->chan = Filter::getBool('chan'); }
namespace Fisharebest\Webtrees; /** * Defined in session.php * * @global Tree $WT_TREE */ global $WT_TREE; use Fisharebest\Webtrees\Controller\AjaxController; use Fisharebest\Webtrees\Controller\PageController; use Fisharebest\Webtrees\Functions\FunctionsPrint; define('WT_SCRIPT_NAME', 'statistics.php'); require './includes/session.php'; // check for on demand content loading $tab = Filter::getInteger('tab', 0, 3); $ajax = Filter::getBool('ajax'); if (!$ajax) { $controller = new PageController(); $controller->setPageTitle(I18N::translate('Statistics'))->addExternalJavascript(WT_AUTOCOMPLETE_JS_URL)->addInlineJavascript(' jQuery("#statistics_chart").css("visibility", "visible"); jQuery("#statistics_chart").tabs({ load: function() { jQuery("#loading-indicator").removeClass("loading-image"); }, beforeLoad: function(event, ui) { // Only load each tab once if (ui.tab.data("loaded")) { event.preventDefault(); return; } else {
/** * GeoAnalysis@setStatus */ public function setStatus() { global $WT_TREE; $controller = new JsonController(); $ga_id = Filter::getInteger('ga_id'); $ga = $this->provider->getGeoAnalysis($ga_id, false); $controller->restrictAccess(true && Auth::isManager($WT_TREE) && $ga !== null); $status = Filter::getBool('status'); $res = array('geoanalysis' => $ga->getId(), 'error' => null); try { $this->provider->setGeoAnalysisStatus($ga, $status); $res['status'] = $status; Log::addConfigurationLog('Module ' . $this->module->getName() . ' : Geo Analysis ID "' . $ga->getId() . '" has been ' . ($status ? 'enabled' : 'disabled') . '.'); } catch (\Exception $ex) { $res['error'] = $ex->getMessage(); Log::addErrorLog('Module ' . $this->module->getName() . ' : Geo Analysis ID "' . $ga->getId() . '" could not be ' . ($status ? 'enabled' : 'disabled') . '. Error: ' . $ex->getMessage()); } $controller->pageHeader(); if ($res['error']) { http_response_code(500); } $controller->encode($res); }
* 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, see <http://www.gnu.org/licenses/>. */ namespace Fisharebest\Webtrees; use Fisharebest\Webtrees\Controller\FanchartController; use Fisharebest\Webtrees\Functions\FunctionsEdit; use Fisharebest\Webtrees\Functions\FunctionsPrint; define('WT_SCRIPT_NAME', 'fanchart.php'); require './includes/session.php'; $controller = new FanchartController(); global $WT_TREE; if (Filter::getBool('img')) { header('Content-Type: image/png'); echo $controller->generateFanChart('png'); return; } $controller->restrictAccess(Module::isActiveChart($WT_TREE, 'fan_chart'))->pageHeader()->addExternalJavascript(WT_AUTOCOMPLETE_JS_URL)->addInlineJavascript(' autocomplete(); var WT_FANCHART = (function() { jQuery("area") .click(function (e) { e.stopPropagation(); e.preventDefault(); var target = jQuery(this.hash); target // position the menu centered immediately above the mouse click position and // make sure it doesn’t end up off the screen
* You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ namespace Fisharebest\Webtrees; /** * Defined in session.php * * @global Tree $WT_TREE */ global $WT_TREE; use Fisharebest\Webtrees\Functions\FunctionsMedia; define('WT_SCRIPT_NAME', 'mediafirewall.php'); require './includes/session.php'; $mid = Filter::get('mid', WT_REGEX_XREF); $thumb = Filter::getBool('thumb'); $media = Media::getInstance($mid, $WT_TREE); /** * Send a “Not found” error as an image */ function send404AsImage() { $error = I18N::translate('The media file was not found in this family tree.'); $width = mb_strlen($error) * 6.5 + 50; $height = 60; $im = imagecreatetruecolor($width, $height); /* Create a black image */ $bgc = imagecolorallocate($im, 255, 255, 255); /* set background color */ imagefilledrectangle($im, 2, 2, $width - 4, $height - 4, $bgc); /* create a rectangle, leaving 2 px border */
/** * {@inheritDoc} * @see \MyArtJaub\Webtrees\Hook\HookInterfaces\PageFooterExtenderInterface::hPrintFooter() */ public function hPrintFooter() { global $WT_TREE; $html = ''; if ($this->getSetting('MAJ_DISPLAY_CNIL', 0) == 1) { $html .= '<br/>'; $html .= '<div class="center">'; $cnil_ref = $this->getSetting('MAJ_CNIL_REFERENCE', ''); if ($cnil_ref != '') { $html .= I18N::translate('This site has been notified to the French National Commission for Data protection (CNIL) and registered under number %s. ', $cnil_ref); } $html .= I18N::translate('In accordance with the French Data protection Act (<em>Loi Informatique et Libertés</em>) of January 6th, 1978, you have the right to access, modify, rectify and delete personal information that pertains to you. To exercice this right, please contact %s, and provide your name, address and a proof of your identity.', Theme::theme()->contactLink(User::find($WT_TREE->getPreference('WEBMASTER_USER_ID')))); $html .= '</div>'; } if ($this->getSetting('MAJ_ADD_HTML_FOOTER', 0) == 1) { if (Auth::accessLevel($WT_TREE) >= $this->getSetting('MAJ_SHOW_HTML_FOOTER', Auth::PRIV_HIDE) && !Filter::getBool('nofooter')) { $html .= $this->getSetting('MAJ_HTML_FOOTER', ''); } } return $html; }