public function modAction($mod_action) { switch ($mod_action) { case 'admin_batch_update': $controller = new WT_Controller_Page(); $controller->setPageTitle(WT_I18N::translate('Batch update'))->restrictAccess(Auth::isAdmin())->pageHeader(); // TODO: these files should be methods in this class require WT_ROOT . WT_MODULES_DIR . $this->getName() . '/' . $mod_action . '.php'; $mod = new batch_update(); echo $mod->main(); break; default: header('HTTP/1.0 404 Not Found'); } }
public function pageHeader() { global $view; $view = 'simple'; parent::pageHeader(); return $this; }
public function getSignificantIndividual() { if ($this->root) { return $this->root; } else { return parent::getSignificantIndividual(); } }
public function __construct() { parent::__construct(); $this->surname = WT_Filter::get('surname'); $this->soundex_std = WT_Filter::getBool('soundex_std'); $this->soundex_dm = WT_Filter::getBool('soundex_dm'); if ($this->surname) { $this->setPageTitle(WT_I18N::translate('Branches of the %s family', WT_Filter::escapeHtml($this->surname))); $this->loadIndividuals(); $self = WT_Individual::getInstance(WT_USER_GEDCOM_ID); if ($self) { $this->loadAncestors(WT_Individual::getInstance(WT_USER_GEDCOM_ID), 1); } } else { $this->setPageTitle(WT_I18N::translate('Branches')); } }
public function __construct() { // Automatically fix broken links if ($this->record && $this->record->canEdit()) { $broken_links = 0; foreach ($this->record->getFacts('HUSB|WIFE|CHIL|FAMS|FAMC|REPO') as $fact) { if (!$fact->isOld() && $fact->getTarget() === null) { $this->record->deleteFact($fact->getFactId(), false); WT_FlashMessages::addMessage(WT_I18N::translate('The link from “%1$s” to “%2$s” has been deleted.', $this->record->getFullName(), $fact->getValue())); $broken_links = true; } } foreach ($this->record->getFacts('NOTE|SOUR|OBJE') as $fact) { // These can be links or inline. Only delete links. if (!$fact->isOld() && $fact->getTarget() === null && preg_match('/^@.*@$/', $fact->getValue())) { $this->record->deleteFact($fact->getFactId(), false); WT_FlashMessages::addMessage(WT_I18N::translate('The link from “%1$s” to “%2$s” has been deleted.', $this->record->getFullName(), $fact->getValue())); $broken_links = true; } } if ($broken_links) { // Reload the updated family $this->record = WT_GedcomRecord::getInstance($this->record->getXref()); } } parent::__construct(); // We want robots to index this page $this->setMetaRobots('index,follow'); // Set a page title if ($this->record) { $this->setCanonicalUrl($this->record->getHtmlUrl()); if ($this->record->canShowName()) { // e.g. "John Doe" or "1881 Census of Wales" $this->setPageTitle($this->record->getFullName()); } else { // e.g. "Individual" or "Source" $record = $this->record; $this->setPageTitle(WT_Gedcom_Tag::getLabel($record::RECORD_TYPE)); } } else { // No such record $this->setPageTitle(WT_I18N::translate('Private')); } }
// the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // 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 define('WT_SCRIPT_NAME', 'downloadbackup.php'); require './includes/session.php'; $fname = WT_Filter::get('fname'); if (!WT_USER_GEDCOM_ADMIN || !preg_match('/\\.zip$/', $fname)) { $controller = new WT_Controller_Page(); $controller->setPageTitle(WT_I18N::translate('Error'))->pageHeader(); echo '<p class="ui-state-error">', WT_I18N::translate('You do not have permission to view this page.'), '</p>'; exit; } header('Pragma: public'); // required header('Expires: 0'); header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); header('Cache-Control: private', false); // required for certain browsers header('Content-Type: application/zip'); header('Content-Disposition: attachment; filename="' . $fname . '"'); header('Content-length: ' . filesize(WT_DATA_DIR . $fname)); header('Content-Transfer-Encoding: binary'); readfile(WT_DATA_DIR . $fname);
public function getSignificantIndividual() { if ($this->people) { return $this->people[0]; } else { return parent::getSignificantIndividual(); } }
// 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 define('WT_SCRIPT_NAME', 'login.php'); require './includes/session.php'; require WT_ROOT . 'includes/functions/functions_edit.php'; use Rhumsaa\Uuid\Uuid; use WT\Auth; use WT\Log; use WT\User; // If we are already logged in, then go to the “Home page” if (WT_USER_ID && WT_GED_ID) { header('Location: ' . WT_SERVER_NAME . WT_SCRIPT_PATH); exit; } $controller = new WT_Controller_Page(); $REQUIRE_ADMIN_AUTH_REGISTRATION = WT_Site::preference('REQUIRE_ADMIN_AUTH_REGISTRATION'); $action = WT_Filter::post('action'); $user_realname = WT_Filter::post('user_realname'); $user_name = WT_Filter::post('user_name', WT_REGEX_USERNAME); $user_email = WT_Filter::postEmail('user_email'); $user_password01 = WT_Filter::post('user_password01', WT_REGEX_PASSWORD); $user_password02 = WT_Filter::post('user_password02', WT_REGEX_PASSWORD); $user_comments = WT_Filter::post('user_comments'); $user_password = WT_Filter::post('user_password'); $user_hashcode = WT_Filter::post('user_hashcode'); $url = WT_Filter::post('url'); // Not actually a URL - just a path $username = WT_Filter::post('username'); $password = WT_Filter::post('password'); $timediff = WT_Filter::postInteger('timediff', -43200, 50400, 0);
// Repositories List // // webtrees: Web based Family History software // Copyright (C) 2014 webtrees development team. // // Derived from PhpGedView // Copyright (C) 2002 to 2009 PGV Development Team. All rights reserved. // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // 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 define('WT_SCRIPT_NAME', 'repolist.php'); require './includes/session.php'; require_once WT_ROOT . 'includes/functions/functions_print_lists.php'; $controller = new WT_Controller_Page(); $controller->setPageTitle(WT_I18N::translate('Repositories')); $controller->pageHeader(); echo '<div id="repolist-page">', '<h2>', WT_I18N::translate('Repositories'), '</h2>'; echo format_repo_table(get_repo_list(WT_GED_ID)); echo '</div>';
// the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // 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; use WT\User; define('WT_SCRIPT_NAME', 'admin_site_logs.php'); require './includes/session.php'; $controller = new WT_Controller_Page(); $controller->restrictAccess(Auth::isManager())->setPageTitle(WT_I18N::translate('Logs')); require WT_ROOT . 'includes/functions/functions_edit.php'; $earliest = WT_DB::prepare("SELECT DATE(MIN(log_time)) FROM `##log`")->execute(array())->fetchOne(); $latest = WT_DB::prepare("SELECT DATE(MAX(log_time)) FROM `##log`")->execute(array())->fetchOne(); // Filtering $action = WT_Filter::get('action'); $from = WT_Filter::get('from', '\\d\\d\\d\\d-\\d\\d-\\d\\d', $earliest); $to = WT_Filter::get('to', '\\d\\d\\d\\d-\\d\\d-\\d\\d', $latest); $type = WT_Filter::get('type', 'auth|change|config|debug|edit|error|media|search'); $text = WT_Filter::get('text'); $ip = WT_Filter::get('ip'); $user = WT_Filter::get('user'); $search = WT_Filter::get('search'); $search = isset($search['value']) ? $search['value'] : null; if (Auth::isAdmin()) {
// (at your option) any later version. // // This program is distributed in the hope that it will be useful, // 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; use WT\User; define('WT_SCRIPT_NAME', 'admin_trees_manage.php'); require './includes/session.php'; require WT_ROOT . 'includes/functions/functions_edit.php'; $controller = new WT_Controller_Page(); $controller->restrictAccess(Auth::isAdmin())->setPageTitle(WT_I18N::translate('Family trees')); // Don’t allow the user to cancel the request. We do not want to be left // with an incomplete transaction. ignore_user_abort(true); // $path is the full path to the (possibly temporary) file. // $filename is the actual filename (no folder). function import_gedcom_file($gedcom_id, $path, $filename) { // Read the file in blocks of roughly 64K. Ensure that each block // contains complete gedcom records. This will ensure we don’t split // multi-byte characters, as well as simplifying the code to import // each block. $file_data = ''; $fp = fopen($path, 'rb'); WT_DB::exec("START TRANSACTION");
// it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // 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_users_bulk.php'); require './includes/session.php'; $controller = new WT_Controller_Page(); $controller->restrictAccess(Auth::isAdmin())->setPageTitle(WT_I18N::translate('Send broadcast messages'))->pageHeader(); ?> <div id="users_bulk"> <p> <a href="#" onclick="message('all', 'messaging2', ''); return false;"> <?php echo WT_I18N::translate('Send message to all users'); ?> </a> </p> <p> <a href="#" onclick="message('never_logged', 'messaging2', ''); return false;"> <?php echo WT_I18N::translate('Send message to users who have never logged in'); ?>
// it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // 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_site_clean.php'); require './includes/session.php'; $controller = new WT_Controller_Page(); $controller->restrictAccess(Auth::isAdmin())->setPageTitle(WT_I18N::translate('Clean up data folder'))->pageHeader(); require WT_ROOT . 'includes/functions/functions_edit.php'; function full_rmdir($dir) { if (!is_writable($dir)) { if (!@chmod($dir, WT_PERM_EXE)) { return false; } } $d = dir($dir); while (false !== ($entry = $d->read())) { if ($entry == '.' || $entry == '..') { continue; } $entry = $dir . '/' . $entry;
public function getSignificantIndividual() { if ($this->pids) { return WT_Individual::getInstance($this->pids[0]); } else { return parent::getSignificantIndividual(); } }
// the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // 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', 'famlist.php'); require './includes/session.php'; require_once WT_ROOT . 'includes/functions/functions_print_lists.php'; $controller = new WT_Controller_Page(); // We show three different lists: initials, surnames and individuals // Note that the data may contain special chars, such as surname="<unknown>", $alpha = WT_Filter::get('alpha'); // All surnames beginning with this letter where "@"=unknown and ","=none $surname = WT_Filter::get('surname'); // All indis with this surname $show_all = WT_Filter::get('show_all', 'no|yes', 'no'); // All indis // Long lists can be broken down by given name $show_all_firstnames = WT_Filter::get('show_all_firstnames', 'no|yes', 'no'); if ($show_all_firstnames == 'yes') { $falpha = ''; } else { $falpha = WT_Filter::get('falpha'); // All first names beginning with this letter
list($latest_version, $earliest_version, $download_url) = explode('|', '||'); } $latest_version_html = '<span dir="ltr">' . $latest_version . '</span>'; $download_url_html = '<b dir="auto"><a href="' . WT_Filter::escapeHtml($download_url) . '">' . WT_Filter::escapeHtml($download_url) . '</a></b>'; // Show a friendly message while the site is being upgraded $lock_file = __DIR__ . DIRECTORY_SEPARATOR . 'data' . DIRECTORY_SEPARATOR . 'offline.txt'; $lock_file_html = '<span dir="ltr">' . WT_Filter::escapeHtml($lock_file) . '</span>'; $lock_file_text = WT_I18N::translate('This site is being upgraded. Try again in a few minutes.') . PHP_EOL . format_timestamp(WT_TIMESTAMP) . WT_I18N::translate('UTC'); // Success/failure indicators $icon_success = '<i class="icon-yes"></i>'; $icon_failure = '<i class="icon-failure"></i>'; // Need confirmation for various actions $continue = WT_Filter::post('continue', '1') && WT_Filter::checkCsrf(); $modules_action = WT_Filter::post('modules', 'ignore|disable'); $themes_action = WT_Filter::post('themes', 'ignore|disable'); $controller = new WT_Controller_Page(); $controller->restrictAccess(Auth::isAdmin())->setPageTitle(WT_I18N::translate('Upgrade wizard'))->pageHeader(); // Flush output as it happens - only effective on some webserver configurations. ob_implicit_flush(true); if (ob_get_level()) { ob_end_flush(); } echo '<h2>', $controller->getPageTitle(), '</h2>'; if ($latest_version == '') { echo '<p>', WT_I18N::translate('No upgrade information is available.'), '</p>'; exit; } if (version_compare(WT_VERSION, $latest_version) >= 0) { echo '<p>', WT_I18N::translate('This is the latest version of webtrees. No upgrade is available.'), '</p>'; exit; }
<?php // Parses gedcom file and displays a list of the shared notes in the file. // // webtrees: Web based Family History software // Copyright (C) 2014 webtrees development team. // // Derived from PhpGedView // Copyright (C) 2009 PGV Development Team. All rights reserved. // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // 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 define('WT_SCRIPT_NAME', 'notelist.php'); require './includes/session.php'; require_once WT_ROOT . 'includes/functions/functions_print_lists.php'; $controller = new WT_Controller_Page(); $controller->setPageTitle(WT_I18N::translate('Shared notes')); $controller->pageHeader(); echo '<div id="notelist-page">', '<h2>', WT_I18N::translate('Shared notes'), '</h2>', format_note_table(get_note_list(WT_GED_ID)); echo '</div>';
// the Free Software Foundation; either version 2 of the License or, // at your discretion, any later version. // // This program is distributed in the hope that it will be useful, // 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_merge.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('Merge family trees'))->pageHeader(); echo '<h2>', $controller->getPageTitle(), '</h2>'; $ged2_id = WT_Filter::post('ged2_id'); if ($ged2_id && $ged2_id != WT_GED_ID) { // Every XREF used by both trees $xrefs = WT_DB::prepare("SELECT xref, type FROM (" . " SELECT i_id AS xref, 'INDI' AS type FROM `##individuals` WHERE i_file = ?" . " UNION " . " SELECT f_id AS xref, 'FAM' AS type FROM `##families` WHERE f_file = ?" . " UNION " . " SELECT s_id AS xref, 'SOUR' AS type FROM `##sources` WHERE s_file = ?" . " UNION " . " SELECT m_id AS xref, 'OBJE' AS type FROM `##media` WHERE m_file = ?" . " UNION " . " SELECT o_id AS xref, o_type AS type FROM `##other` WHERE o_file = ? AND o_type NOT IN ('HEAD', 'TRLR')" . ") AS this_tree JOIN (" . " SELECT xref FROM `##change` WHERE gedcom_id = ?" . " UNION " . " SELECT i_id AS xref FROM `##individuals` WHERE i_file = ?" . " UNION " . " SELECT f_id AS xref FROM `##families` WHERE f_file = ?" . " UNION " . " SELECT s_id AS xref FROM `##sources` WHERE s_file = ?" . " UNION " . " SELECT m_id AS xref FROM `##media` WHERE m_file = ?" . " UNION " . " SELECT o_id AS xref FROM `##other` WHERE o_file = ? AND o_type NOT IN ('HEAD', 'TRLR')" . ") AS other_trees USING (xref)")->execute(array(WT_GED_ID, WT_GED_ID, WT_GED_ID, WT_GED_ID, WT_GED_ID, $ged2_id, $ged2_id, $ged2_id, $ged2_id, $ged2_id, $ged2_id))->fetchAssoc(); if ($xrefs) { echo '<p class="error">', WT_I18N::plural('The two family trees have %1$s record which uses the same “XREF”.', 'The two family trees have %1$s records which uses the same “XREF”.', count($xrefs), count($xrefs)), '</p>', '<p class="error">', WT_I18N::translate('You must renumber the records in one of the trees before you can merge them.'), '</p>'; } else { WT_DB::exec("START TRANSACTION"); WT_DB::exec("LOCK TABLE" . " `##individuals` WRITE," . " `##individuals` AS individuals2 READ," . " `##families` WRITE," . " `##families` AS families2 READ," . " `##sources` WRITE," . " `##sources` AS sources2 READ," . " `##media` WRITE," . " `##media` AS media2 READ," . " `##other` WRITE," . " `##other` AS other2 READ," . " `##name` WRITE," . " `##name` AS name2 READ," . " `##placelinks` WRITE," . " `##placelinks` AS placelinks2 READ," . " `##change` WRITE," . " `##change` AS change2 READ," . " `##dates` WRITE," . " `##dates` AS dates2 READ," . " `##default_resn` WRITE," . " `##default_resn` AS default_resn2 READ," . " `##hit_counter` WRITE," . " `##hit_counter` AS hit_counter2 READ," . " `##link` WRITE," . " `##link` AS link2 READ"); try { WT_DB::prepare("INSERT INTO `##individuals` (i_id, i_file, i_rin, i_sex, i_gedcom)" . " SELECT i_id, ?, i_rin, i_sex, i_gedcom FROM `##individuals` AS individuals2 WHERE i_file = ?")->execute(array($ged2_id, WT_GED_ID)); WT_DB::prepare("INSERT INTO `##families` (f_id, f_file, f_husb, f_wife, f_gedcom, f_numchil)" . " SELECT f_id, ?, f_husb, f_wife, f_gedcom, f_numchil FROM `##families` AS families2 WHERE f_file = ?")->execute(array($ged2_id, WT_GED_ID)); WT_DB::prepare("INSERT INTO `##sources` (s_id, s_file, s_name, s_gedcom)" . " SELECT s_id, ?, s_name, s_gedcom FROM `##sources` AS sources2 WHERE s_file = ?")->execute(array($ged2_id, WT_GED_ID));
// it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // 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 define('WT_SCRIPT_NAME', 'placelist.php'); require './includes/session.php'; require_once WT_ROOT . 'includes/functions/functions_print_lists.php'; $controller = new WT_Controller_Page(); $action = WT_Filter::get('action', 'find|show', 'find'); $display = WT_Filter::get('display', 'hierarchy|list', 'hierarchy'); $parent = WT_Filter::getArray('parent'); $level = count($parent); if ($display == 'hierarchy') { if ($level) { $controller->setPageTitle(WT_I18N::translate('Place hierarchy') . ' - <span dir="auto">' . WT_Filter::escapeHtml(end($parent)) . '</span>'); } else { $controller->setPageTitle(WT_I18N::translate('Place hierarchy')); } } else { $controller->setPageTitle(WT_I18N::translate('Place list')); } $controller->pageHeader(); echo '<div id="place-hierarchy">';
// the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // 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_site_access.php'); require './includes/session.php'; require WT_ROOT . 'includes/functions/functions_edit.php'; $controller = new WT_Controller_Page(); $controller->restrictAccess(Auth::isAdmin())->addExternalJavascript(WT_JQUERY_DATATABLES_URL)->addExternalJavascript(WT_JQUERY_JEDITABLE_URL)->setPageTitle(WT_I18N::translate('Site access rules')); $action = WT_Filter::get('action'); switch ($action) { case 'delete': $user_access_rule_id = WT_Filter::getInteger('site_access_rule_id'); WT_DB::prepare("DELETE FROM `##site_access_rule` WHERE site_access_rule_id=?")->execute(array($user_access_rule_id)); break; case 'allow': case 'deny': case 'robot': $user_access_rule_id = WT_Filter::getInteger('site_access_rule_id'); WT_DB::prepare("UPDATE `##site_access_rule` SET rule=? WHERE site_access_rule_id=?")->execute(array($action, $user_access_rule_id)); break; case 'load_rules': Zend_Session::writeClose();
// it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // 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 define('WT_SCRIPT_NAME', 'reportengine.php'); require './includes/session.php'; require WT_ROOT . 'includes/functions/functions_rtl.php'; $controller = new WT_Controller_Page(); $famid = WT_Filter::get('famid', WT_REGEX_XREF); $pid = WT_Filter::get('pid', WT_REGEX_XREF); $action = WT_Filter::get('action', 'choose|setup|run', 'choose'); $report = WT_Filter::get('report'); $output = WT_Filter::get('output', 'HTML|PDF', 'PDF'); $vars = WT_Filter::get('vars'); $varnames = WT_Filter::get('varnames'); $type = WT_Filter::get('type'); if (!is_array($vars)) { $vars = array(); } if (!is_array($varnames)) { $varnames = array(); } if (!is_array($type)) {
// it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License or, // at your discretion, any later version. // // This program is distributed in the hope that it will be useful, // 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_renumber.php'); require './includes/session.php'; $controller = new WT_Controller_Page(); $controller->restrictAccess(Auth::isManager())->setPageTitle(WT_I18N::translate('Renumber family tree'))->pageHeader(); // Every XREF used by this tree and also used by some other tree $xrefs = WT_DB::prepare("SELECT xref, type FROM (" . " SELECT i_id AS xref, 'INDI' AS type FROM `##individuals` WHERE i_file = ?" . " UNION " . " SELECT f_id AS xref, 'FAM' AS type FROM `##families` WHERE f_file = ?" . " UNION " . " SELECT s_id AS xref, 'SOUR' AS type FROM `##sources` WHERE s_file = ?" . " UNION " . " SELECT m_id AS xref, 'OBJE' AS type FROM `##media` WHERE m_file = ?" . " UNION " . " SELECT o_id AS xref, o_type AS type FROM `##other` WHERE o_file = ? AND o_type NOT IN ('HEAD', 'TRLR')" . ") AS this_tree JOIN (" . " SELECT xref FROM `##change` WHERE gedcom_id <> ?" . " UNION " . " SELECT i_id AS xref FROM `##individuals` WHERE i_file <> ?" . " UNION " . " SELECT f_id AS xref FROM `##families` WHERE f_file <> ?" . " UNION " . " SELECT s_id AS xref FROM `##sources` WHERE s_file <> ?" . " UNION " . " SELECT m_id AS xref FROM `##media` WHERE m_file <> ?" . " UNION " . " SELECT o_id AS xref FROM `##other` WHERE o_file <> ? AND o_type NOT IN ('HEAD', 'TRLR')" . ") AS other_trees USING (xref)")->execute(array(WT_GED_ID, WT_GED_ID, WT_GED_ID, WT_GED_ID, WT_GED_ID, WT_GED_ID, WT_GED_ID, WT_GED_ID, WT_GED_ID, WT_GED_ID, WT_GED_ID))->fetchAssoc(); echo '<h2>', $controller->getPageTitle(), ' — ', $WT_TREE->tree_title_html, '</h2>'; if (WT_Filter::get('go')) { foreach ($xrefs as $old_xref => $type) { WT_DB::exec("START TRANSACTION"); WT_DB::exec("LOCK TABLE `##individuals` WRITE," . " `##families` WRITE," . " `##sources` WRITE," . " `##media` WRITE," . " `##other` WRITE," . " `##name` WRITE," . " `##placelinks` WRITE," . " `##change` WRITE," . " `##next_id` WRITE," . " `##dates` WRITE," . " `##default_resn` WRITE," . " `##hit_counter` WRITE," . " `##link` WRITE," . " `##user_gedcom_setting` WRITE"); $new_xref = get_new_xref($type); switch ($type) { case 'INDI': WT_DB::prepare("UPDATE `##individuals` SET i_id = ?, i_gedcom = REPLACE(i_gedcom, ?, ?) WHERE i_id = ? AND i_file = ?")->execute(array($new_xref, "0 @{$old_xref}@ INDI\n", "0 @{$new_xref}@ INDI\n", $old_xref, WT_GED_ID)); WT_DB::prepare("UPDATE `##families` JOIN `##link` ON (l_file = f_file AND l_to = ? AND l_type = 'HUSB') SET f_gedcom = REPLACE(f_gedcom, ?, ?) WHERE f_file = ?")->execute(array($old_xref, " HUSB @{$old_xref}@", " HUSB @{$new_xref}@", WT_GED_ID)); WT_DB::prepare("UPDATE `##families` JOIN `##link` ON (l_file = f_file AND l_to = ? AND l_type = 'WIFE') SET f_gedcom = REPLACE(f_gedcom, ?, ?) WHERE f_file = ?")->execute(array($old_xref, " WIFE @{$old_xref}@", " WIFE @{$new_xref}@", WT_GED_ID)); WT_DB::prepare("UPDATE `##families` JOIN `##link` ON (l_file = f_file AND l_to = ? AND l_type = 'CHIL') SET f_gedcom = REPLACE(f_gedcom, ?, ?) WHERE f_file = ?")->execute(array($old_xref, " CHIL @{$old_xref}@", " CHIL @{$new_xref}@", WT_GED_ID));
define('WT_THEME_URL', WT_STATIC_URL . WT_THEME_DIR); require WT_ROOT . WT_THEME_DIR . 'theme.php'; // Page hit counter - load after theme, as we need theme formatting if ($WT_TREE && $WT_TREE->preference('SHOW_COUNTER') && !$SEARCH_SPIDER) { require WT_ROOT . 'includes/hitcount.php'; } else { $hitCount = ''; } // define constants to be used when setting permissions after creating files/directories if (substr(PHP_SAPI, 0, 3) == 'cgi') { // cgi-mode, should only be writable by owner define('WT_PERM_EXE', 0755); // to be used on directories, php files, etc. define('WT_PERM_FILE', 0644); // to be used on images, text files, etc. } else { // mod_php mode, should be writable by everyone define('WT_PERM_EXE', 0777); define('WT_PERM_FILE', 0666); } // Lightbox needs custom integration in many places. Only check for the module once. define('WT_USE_LIGHTBOX', !$SEARCH_SPIDER && array_key_exists('lightbox', WT_Module::getActiveModules())); // Search engines are only allowed to see certain pages. if ($SEARCH_SPIDER && !in_array(WT_SCRIPT_NAME, array('index.php', 'indilist.php', 'module.php', 'mediafirewall.php', 'individual.php', 'family.php', 'mediaviewer.php', 'note.php', 'repo.php', 'source.php'))) { header($_SERVER['SERVER_PROTOCOL'] . ' 403 Forbidden'); $controller = new WT_Controller_Page(); $controller->setPageTitle(WT_I18N::translate('Search engine')); $controller->pageHeader(); echo '<p class="ui-state-error">', WT_I18N::translate('You do not have permission to view this page.'), '</p>'; exit; }
private function show_list() { global $controller; $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 ] }); '); $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 '<h2 class="center">', WT_I18N::translate('Stories'), '</h2>'; if (count($stories) > 0) { echo '<table id="story_table" class="width100">'; echo '<thead><tr> <th>', WT_I18N::translate('Story title'), '</th> <th>', WT_I18N::translate('Individual'), '</th> </tr></thead> <tbody>'; foreach ($stories as $story) { $indi = WT_Individual::getInstance($story->xref); $story_title = get_block_setting($story->block_id, 'title'); $languages = get_block_setting($story->block_id, 'languages'); if (!$languages || in_array(WT_LOCALE, explode(',', $languages))) { if ($indi) { if ($indi->canShow()) { echo '<tr><td><a href="' . $indi->getHtmlUrl() . '#stories">' . $story_title . '</a></td><td><a href="' . $indi->getHtmlUrl() . '#stories">' . $indi->getFullName() . '</a></td></tr>'; } } else { echo '<tr><td>', $story_title, '</td><td class="error">', $story->xref, '</td></tr>'; } } } echo '</tbody></table>'; } }
// the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // 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_module_sidebar.php'); require 'includes/session.php'; require WT_ROOT . 'includes/functions/functions_edit.php'; $controller = new WT_Controller_Page(); $controller->restrictAccess(Auth::isAdmin())->setPageTitle(WT_I18N::translate('Module administration'))->pageHeader()->addInlineJavascript(' jQuery("#sidebars_table").sortable({items: ".sortme", forceHelperSize: true, forcePlaceholderSize: true, opacity: 0.7, cursor: "move", axis: "y"}); //-- update the order numbers after drag-n-drop sorting is complete jQuery("#sidebars_table").bind("sortupdate", function(event, ui) { jQuery("#"+jQuery(this).attr("id")+" input").each( function (index, value) { value.value = index+1; } ); }); '); $modules = WT_Module::getActiveSidebars(WT_GED_ID, WT_PRIV_HIDE); $action = WT_Filter::post('action'); if ($action == 'update_mods' && WT_Filter::checkCsrf()) {
// 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; use WT\User; define('WT_SCRIPT_NAME', 'admin_pgv_to_wt.php'); require './includes/session.php'; //require WT_ROOT.'includes/functions/functions_edit.php'; // We can only import into an empty system, so deny access if we have already created a gedcom or added users. if (WT_GED_ID || count(User::all()) > 1) { header('Location: ' . WT_SERVER_NAME . WT_SCRIPT_PATH); exit; } $controller = new WT_Controller_Page(); $controller->restrictAccess(Auth::isAdmin())->setPageTitle(WT_I18N::translate('PhpGedView to webtrees transfer wizard')); $error = ''; $warning = ''; $PGV_PATH = WT_Filter::post('PGV_PATH'); if ($PGV_PATH) { if (!is_dir($PGV_PATH) || !is_readable($PGV_PATH . '/config.php')) { $error = WT_I18N::translate('The specified directory does not contain an installation of PhpGedView'); } else { // Load the configuration settings $config_php = file_get_contents($PGV_PATH . '/config.php'); // The easiest way to do this is to exec() the file - but not lines containing require or PHP tags $config_php = preg_replace(array('/^\\s*(include|require).*/m', '/.*<\\?php.*/', '/.*\\?>.*/'), '', $config_php); eval($config_php); // $INDEX_DIRECTORY can be either absolute or relative to the PhpGedView root. if (preg_match('/^(\\/|\\|[A-Z]:)/', $INDEX_DIRECTORY)) {
public function modAction($mod_action) { switch ($mod_action) { case 'ajax': $html = $this->getSidebarAjaxContent(); Zend_Session::writeClose(); header('Content-Type: text/html; charset=UTF-8'); echo $html; break; case 'index': global $MAX_PEDIGREE_GENERATIONS, $controller, $WT_SESSION, $GEDCOM_MEDIA_PATH; require_once WT_ROOT . WT_MODULES_DIR . 'clippings/clippings_ctrl.php'; require_once WT_ROOT . 'includes/functions/functions_export.php'; $clip_ctrl = new WT_Controller_Clippings(); $controller = new WT_Controller_Page(); $controller->setPageTitle($this->getTitle())->PageHeader()->addExternalJavascript(WT_STATIC_URL . 'js/autocomplete.js')->addInlineJavascript('autocomplete();'); echo '<script>'; echo 'function radAncestors(elementid) {var radFamilies=document.getElementById(elementid);radFamilies.checked=true;}'; echo '</script>'; if (!$WT_SESSION->cart[WT_GED_ID]) { echo '<h2>', WT_I18N::translate('Family tree clippings cart'), '</h2>'; } if ($clip_ctrl->action == 'add') { $person = WT_GedcomRecord::getInstance($clip_ctrl->id); echo '<h3><a href="', $person->getHtmlUrl(), '">' . $person->getFullName(), '</a></h3>'; if ($clip_ctrl->type == 'fam') { ?> <form action="module.php" method="get"> <input type="hidden" name="mod" value="clippings"> <input type="hidden" name="mod_action" value="index"> <table> <tr><td class="topbottombar"><?php echo WT_I18N::translate('Which other links from this family would you like to add?'); ?> <input type="hidden" name="id" value="<?php echo $clip_ctrl->id; ?> "> <input type="hidden" name="type" value="<?php echo $clip_ctrl->type; ?> "> <input type="hidden" name="action" value="add1"></td></tr> <tr><td class="optionbox"><input type="radio" name="others" checked value="none"><?php echo WT_I18N::translate('Add just this family record.'); ?> </td></tr> <tr><td class="optionbox"><input type="radio" name="others" value="parents"><?php echo WT_I18N::translate('Add parents’ records together with this family record.'); ?> </td></tr> <tr><td class="optionbox"><input type="radio" name="others" value="members"><?php echo WT_I18N::translate('Add parents’ and children’s records together with this family record.'); ?> </td></tr> <tr><td class="optionbox"><input type="radio" name="others" value="descendants"><?php echo WT_I18N::translate('Add parents’ and all descendants’ records together with this family record.'); ?> </td></tr> <tr><td class="topbottombar"><input type="submit" value="<?php echo WT_I18N::translate('Continue adding'); ?> "></td></tr> </table> </form> <?php } else { if ($clip_ctrl->type == 'indi') { ?> <form action="module.php" method="get"> <input type="hidden" name="mod" value="clippings"> <input type="hidden" name="mod_action" value="index"> <table> <tr><td class="topbottombar"><?php echo WT_I18N::translate('Which links from this individual would you also like to add?'); ?> <input type="hidden" name="id" value="<?php echo $clip_ctrl->id; ?> "> <input type="hidden" name="type" value="<?php echo $clip_ctrl->type; ?> "> <input type="hidden" name="action" value="add1"></td></tr> <tr><td class="optionbox"><input type="radio" name="others" checked value="none"><?php echo WT_I18N::translate('Add just this individual.'); ?> </td></tr> <tr><td class="optionbox"><input type="radio" name="others" value="parents"><?php echo WT_I18N::translate('Add this individual, his parents, and siblings.'); ?> </td></tr> <tr><td class="optionbox"><input type="radio" name="others" value="ancestors" id="ancestors"><?php echo WT_I18N::translate('Add this individual and his direct line ancestors.'); ?> <br> <?php echo WT_I18N::translate('Number of generations:'); ?> <input type="text" size="5" name="level1" value="<?php echo $MAX_PEDIGREE_GENERATIONS; ?> " onfocus="radAncestors('ancestors');"></td></tr> <tr><td class="optionbox"><input type="radio" name="others" value="ancestorsfamilies" id="ancestorsfamilies"><?php echo WT_I18N::translate('Add this individual, his direct line ancestors, and their families.'); ?> <br > <?php echo WT_I18N::translate('Number of generations:'); ?> <input type="text" size="5" name="level2" value="<?php echo $MAX_PEDIGREE_GENERATIONS; ?> " onfocus="radAncestors('ancestorsfamilies');"></td></tr> <tr><td class="optionbox"><input type="radio" name="others" value="members"><?php echo WT_I18N::translate('Add this individual, his spouse, and children.'); ?> </td></tr> <tr><td class="optionbox"><input type="radio" name="others" value="descendants" id="descendants"><?php echo WT_I18N::translate('Add this individual, his spouse, and all descendants.'); ?> <br > <?php echo WT_I18N::translate('Number of generations:'); ?> <input type="text" size="5" name="level3" value="<?php echo $MAX_PEDIGREE_GENERATIONS; ?> " onfocus="radAncestors('descendants');"></td></tr> <tr><td class="topbottombar"><input type="submit" value="<?php echo WT_I18N::translate('Continue adding'); ?> "> </table> </form> <?php } else { if ($clip_ctrl->type == 'sour') { ?> <form action="module.php" method="get"> <input type="hidden" name="mod" value="clippings"> <input type="hidden" name="mod_action" value="index"> <table> <tr><td class="topbottombar"><?php echo WT_I18N::translate('Which records linked to this source should be added?'); ?> <input type="hidden" name="id" value="<?php echo $clip_ctrl->id; ?> "> <input type="hidden" name="type" value="<?php echo $clip_ctrl->type; ?> "> <input type="hidden" name="action" value="add1"></td></tr> <tr><td class="optionbox"><input type="radio" name="others" checked value="none"><?php echo WT_I18N::translate('Add just this source.'); ?> </td></tr> <tr><td class="optionbox"><input type="radio" name="others" value="linked"><?php echo WT_I18N::translate('Add this source and families/individuals linked to it.'); ?> </td></tr> <tr><td class="topbottombar"><input type="submit" value="<?php echo WT_I18N::translate('Continue adding'); ?> "> </table> </form> <?php } } } } if ($clip_ctrl->privCount > 0) { echo "<span class=\"error\">" . WT_I18N::translate('Some items could not be added due to privacy restrictions') . "</span><br><br>"; } if (!$WT_SESSION->cart[WT_GED_ID]) { if ($clip_ctrl->action != 'add') { echo WT_I18N::translate('The clippings cart allows you to take extracts (“clippings”) from this family tree and bundle them up into a single file for downloading and subsequent importing into your own genealogy program. The downloadable file is recorded in GEDCOM format.<br><ul><li>How to take clippings?<br>This is really simple. Whenever you see a clickable name (individual, family, or source) you can go to the Details page of that name. There you will see the <b>Add to clippings cart</b> option. When you click that link you will be offered several options to download.</li><li>How to download?<br>Once you have items in your cart, you can download them just by clicking the “Download” link. Follow the instructions and links.</li></ul>'); ?> <form method="get" name="addin" action="module.php"> <input type="hidden" name="mod" value="clippings"> <input type="hidden" name="mod_action" value="index"> <table> <tr> <td colspan="2" class="topbottombar" style="text-align:center; "> <?php echo WT_I18N::translate('Enter an individual, family, or source ID'), help_link('add_by_id', $this->getName()); ?> </td> </tr> <tr> <td class="optionbox"> <input type="hidden" name="action" value="add"> <input type="text" data-autocomplete-type="IFSRO" name="id" id="cart_item_id" size="5"> </td> <td class="optionbox"> <?php echo print_findindi_link('cart_item_id'); ?> <?php echo print_findfamily_link('cart_item_id'); ?> <?php echo print_findsource_link('cart_item_id', ''); ?> <input type="submit" value="<?php echo WT_I18N::translate('Add'); ?> "> </td> </tr> </table> </form> <?php } // -- end new lines echo WT_I18N::translate('Your clippings cart is empty.'); } else { // Keep track of the INDI from the parent page, otherwise it will // get lost after ajax updates $pid = WT_Filter::get('pid', WT_REGEX_XREF); if ($clip_ctrl->action != 'download' && $clip_ctrl->action != 'add') { ?> <table><tr><td class="width33" valign="top" rowspan="3"> <form method="get" action="module.php"> <input type="hidden" name="mod" value="clippings"> <input type="hidden" name="mod_action" value="index"> <input type="hidden" name="action" value="download"> <input type="hidden" name="pid" value="<?php echo $pid; ?> "> <table> <tr><td colspan="2" class="topbottombar"><h2><?php echo WT_I18N::translate('Download'); ?> </h2></td></tr> <tr><td class="descriptionbox width50 wrap"><?php echo WT_I18N::translate('Zip file(s)'), help_link('zip'); ?> </td> <td class="optionbox"><input type="checkbox" name="Zip" value="yes"></td></tr> <tr><td class="descriptionbox width50 wrap"><?php echo WT_I18N::translate('Include media (automatically zips files)'), help_link('include_media'); ?> </td> <td class="optionbox"><input type="checkbox" name="IncludeMedia" value="yes"></td></tr> <?php if (WT_USER_GEDCOM_ADMIN) { ?> <tr><td class="descriptionbox width50 wrap"><?php echo WT_I18N::translate('Apply privacy settings?'), help_link('apply_privacy'); ?> </td> <td class="optionbox"> <input type="radio" name="privatize_export" value="none" checked="checked"> <?php echo WT_I18N::translate('None'); ?> <br> <input type="radio" name="privatize_export" value="gedadmin"> <?php echo WT_I18N::translate('Manager'); ?> <br> <input type="radio" name="privatize_export" value="user"> <?php echo WT_I18N::translate('Member'); ?> <br> <input type="radio" name="privatize_export" value="visitor"> <?php echo WT_I18N::translate('Visitor'); ?> </td></tr> <?php } elseif (WT_USER_CAN_ACCESS) { ?> <tr><td class="descriptionbox width50 wrap"><?php echo WT_I18N::translate('Apply privacy settings?'), help_link('apply_privacy'); ?> </td> <td class="optionbox"> <input type="radio" name="privatize_export" value="user" checked="checked"> <?php echo WT_I18N::translate('Member'); ?> <br> <input type="radio" name="privatize_export" value="visitor"> <?php echo WT_I18N::translate('Visitor'); ?> </td></tr> <?php } ?> <tr><td class="descriptionbox width50 wrap"><?php echo WT_I18N::translate('Convert from UTF-8 to ANSI (ISO-8859-1)'), help_link('utf8_ansi'); ?> </td> <td class="optionbox"><input type="checkbox" name="convert" value="yes"></td></tr> <tr><td class="descriptionbox width50 wrap"><?php echo WT_I18N::translate('Add the GEDCOM media path to filenames'), help_link('GEDCOM_MEDIA_PATH'); ?> </td> <td class="optionbox"> <input type="checkbox" name="conv_path" value="<?php echo WT_Filter::escapeHtml($GEDCOM_MEDIA_PATH); ?> "> <span dir="auto"><?php echo WT_Filter::escapeHtml($GEDCOM_MEDIA_PATH); ?> </span> </td></tr> <tr><td class="topbottombar" colspan="2"> <input type="submit" value="<?php echo WT_I18N::translate('Download'); ?> "> </form> </td></tr> </table> </td></tr> </table> <br> <form method="get" name="addin" action="module.php"> <input type="hidden" name="mod" value="clippings"> <input type="hidden" name="mod_action" value="index"> <table> <tr> <td colspan="2" class="topbottombar" style="text-align:center; "> <?php echo WT_I18N::translate('Enter an individual, family, or source ID'), help_link('add_by_id', $this->getName()); ?> </td> </tr> <tr> <td class="optionbox"> <input type="hidden" name="action" value="add"> <input type="text" data-autocomplete-type="IFSRO" name="id" id="cart_item_id" size="8"> </td> <td class="optionbox"> <?php echo print_findindi_link('cart_item_id'); ?> <?php echo print_findfamily_link('cart_item_id'); ?> <?php echo print_findsource_link('cart_item_id'); ?> <input type="submit" value="<?php echo WT_I18N::translate('Add'); ?> "> </td> </tr> </table> </form> <?php } ?> <br><a href="module.php?mod=clippings&mod_action=index&action=empty"><?php echo WT_I18N::translate('Empty the clippings cart'); ?> </a><?php echo help_link('empty_cart', $this->getName()); ?> </td></tr> <tr><td class="topbottombar"><h2><?php echo WT_I18N::translate('Family tree clippings cart'); ?> </h2></td></tr> <tr><td valign="top"> <table id="mycart" class="sortable list_table width100"> <tr> <th class="list_label"><?php echo WT_I18N::translate('Record'); ?> </th> <th class="list_label"><?php echo WT_I18N::translate('Remove'); ?> </th> </tr> <?php foreach (array_keys($WT_SESSION->cart[WT_GED_ID]) as $xref) { $record = WT_GedcomRecord::getInstance($xref); if ($record) { switch ($record::RECORD_TYPE) { case 'INDI': $icon = 'icon-indis'; break; case 'FAM': $icon = 'icon-sfamily'; break; case 'SOUR': $icon = 'icon-source'; break; case 'REPO': $icon = 'icon-repository'; break; case 'NOTE': $icon = 'icon-note'; break; case 'OBJE': $icon = 'icon-media'; break; default: $icon = 'icon-clippings'; break; } ?> <tr><td class="list_value"> <i class="<?php echo $icon; ?> "></i> <?php echo '<a href="', $record->getHtmlUrl(), '">', $record->getFullName(), '</a>'; ?> </td> <td class="list_value center vmiddle"><a href="module.php?mod=clippings&mod_action=index&action=remove&id=<?php echo $xref; ?> " class="icon-remove" title="<?php echo WT_I18N::translate('Remove'); ?> "></a></td> </tr> <?php } } ?> </table> </td></tr></table> <?php } break; default: header('HTTP/1.0 404 Not Found'); break; } }
// UI for online updating of the config file. // // webtrees: Web based Family History software // Copyright (C) 2014 webtrees development team. // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // 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 Michelf\MarkdownExtra; use WT\Auth; define('WT_SCRIPT_NAME', 'admin_site_readme.php'); require './includes/session.php'; $controller = new WT_Controller_Page(); $controller->restrictAccess(Auth::isAdmin())->setPageTitle(WT_I18N::translate('README documentation'))->pageHeader(); ?> <div class="markdown" dir="ltr" lang="en"> <?php echo MarkdownExtra::defaultTransform(file_get_contents('README.md')); ?> </div>
// (at your option) any later version. // // This program is distributed in the hope that it will be useful, // 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; use WT\Log; use WT\User; define('WT_SCRIPT_NAME', 'admin_users.php'); require './includes/session.php'; $controller = new WT_Controller_Page(); $controller->restrictAccess(Auth::isAdmin())->setPageTitle(WT_I18N::translate('User administration')); require_once WT_ROOT . 'includes/functions/functions_edit.php'; // Valid values for form variables $ALL_THEMES_DIRS = array(); foreach (get_theme_names() as $themename => $themedir) { $ALL_THEME_DIRS[] = $themedir; } $ALL_EDIT_OPTIONS = array('none' => WT_I18N::translate('Visitor'), 'access' => WT_I18N::translate('Member'), 'edit' => WT_I18N::translate('Editor'), 'accept' => WT_I18N::translate('Moderator'), 'admin' => WT_I18N::translate('Manager')); // Form actions $action = WT_Filter::get('action', null, 'listusers'); $usrlang = WT_Filter::post('usrlang', implode('|', array_keys(WT_I18N::installed_languages())), WT_LOCALE); $username = WT_Filter::post('username', WT_REGEX_USERNAME); $filter = WT_Filter::post('filter'); $ged = WT_Filter::post('ged'); // Extract form variables
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 }